diff --git a/Codes.xml b/Codes.xml index 2d9644a..75fc64d 100644 --- a/Codes.xml +++ b/Codes.xml @@ -4048,8 +4048,8 @@
@@ -4373,4 +4597,171 @@
38210030 00000000
+
+ AttemptCounter
+ misc
+ Attempt Counter
+ sup39(サポミク)
+ 0.1
+ Feb 05, 2023
+ drawText
+
+ Display attempt count and success count of current area.
+
+ This code can be used with 'Area Lock' of 'Instant Level Select'.
+
+
+ 現在のエリアの試行回数と成功回数を表示します。
+
+ このコードは「レベル選択DX」の「エリアロック」と併用できます。
+
+
+
+
+
+
diff --git a/Readme.md b/Readme.md
index b5bc1cc..46f9df4 100644
--- a/Readme.md
+++ b/Readme.md
@@ -35,6 +35,8 @@ you may also need to check the following files:
- [site/.vuepress/components/codes/ui.js](site/.vuepress/components/codes/ui.js):
Specify the vue component for the configuration of the code.
The version string will be passed as a property.
+- [site/.vuepress/components/codes/preview.js](site/.vuepress/components/codes/preview.js):
+ Specify the `id` and the `getConfig(version)` function of the code to make it shown in preview.
#### Reserved Memory
@@ -67,18 +69,28 @@ Some codes store some states in the games memory starting from address 0x817F000
| ![](./docs/reserved.svg) | `0x110` | `0x237` | QF Timer: Timer Textbox |
| ![](./docs/reserved.svg) | `0x238` | `0x347` | General Function (`drawText`) |
| ![](./docs/buffer.svg) | `0x348` | `0x39B` | Buffer (QF Timer) |
-| ![](./docs/reserved.svg) | `0x39C` | `0x3AF` | QF Section Timer: Background Options |
-| ![](./docs/reserved.svg) | `0x3B0` | `0x3BF` | QF Section Timer: Text Options |
+| ![](./docs/reserved.svg) | `0x39C` | `0x3AF` | QF Section Timer: Background Config |
+| ![](./docs/reserved.svg) | `0x3B0` | `0x3BF` | QF Section Timer: Text Config |
| ![](./docs/reserved.svg) | `0x3C0` | `0x3C8` | QF Section Timer: Format String |
| ![](./docs/reserved.svg) | `0x3C9` | `0x3C9` | QF Section Timer: (Unused) |
| ![](./docs/reserved.svg) | `0x3CA` | `0x3CB` | QF Section Timer: Section Count |
| ![](./docs/reserved.svg) | `0x3CC` | `0x3CF` | QF Section Timer: Last Freezed Time |
| ![](./docs/reserved.svg) | `0x3D0` | `0x40F` | QF Section Timer: Section Time Array |
-| ![](./docs/reserved.svg) | `0x410` | `0x41F` | Pattern Selector: Background Options |
-| ![](./docs/reserved.svg) | `0x424` | `0x433` | Pattern Selector: Text Options |
+| ![](./docs/reserved.svg) | `0x410` | `0x41F` | Pattern Selector: Background Config |
+| ![](./docs/reserved.svg) | `0x424` | `0x433` | Pattern Selector: Text Config |
| ![](./docs/reserved.svg) | `0x434` | `0x440` | Pattern Selector: Format String |
| ![](./docs/reserved.svg) | `0x441` | `0x475` | Pattern Selector: Pattern Data |
-| ![](./docs/unallocated.svg) | `0x476` | `0xFFF` | Not Allocated |
+| ![](./docs/reserved.svg) | `0x476` | `0x477` | Attempt Counter: Previous Area |
+| ![](./docs/reserved.svg) | `0x478` | `0x478` | Attempt Counter: Display Timer |
+| ![](./docs/reserved.svg) | `0x479` | `0x479` | Attempt Counter: Display Duration |
+| ![](./docs/reserved.svg) | `0x47A` | `0x47F` | Attempt Counter: Format String |
+| ![](./docs/reserved.svg) | `0x480` | `0x48F` | Attempt Counter: Text Config |
+| ![](./docs/reserved.svg) | `0x490` | `0x4A3` | Attempt Counter: Background Config |
+| ![](./docs/reserved.svg) | `0x4A4` | `0x4A5` | Attempt Counter: Success Count |
+| ![](./docs/reserved.svg) | `0x4A6` | `0x4A7` | Attempt Counter: Attempt Count |
+| ![](./docs/reserved.svg) | `0x4A8` | `0x4A8` | Attempt Counter: Got Shine Flag |
+| ![](./docs/buffer.svg) | `0x4A9` | `0x4AF` | Buffer (Attempt Counter) |
+| ![](./docs/unallocated.svg) | `0x4B0` | `0xFFF` | Not Allocated |
### Adding translations
diff --git a/changelog.md b/changelog.md
index efc9433..3e6845c 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,11 @@
# Changelog
+## Feb 05, 2023
+### Created 'Attempt Counter'
+Display attempt count and success count of current area
+### Updated 'Instant Level Select'
+- Rewrote with C2
+- Go to level instantly without transition
+
## Jan 31, 2023
### Created 'Quarterframe Section Timer'
Calculate and display section times whenever Quarterframe Timer freezes
diff --git a/site/.vuepress/components/CodeInfo.vue b/site/.vuepress/components/CodeInfo.vue
index 00c5124..12c0c19 100644
--- a/site/.vuepress/components/CodeInfo.vue
+++ b/site/.vuepress/components/CodeInfo.vue
@@ -19,6 +19,7 @@
diff --git a/site/.vuepress/components/codes/AttemptCounter/codegen.js b/site/.vuepress/components/codes/AttemptCounter/codegen.js
new file mode 100644
index 0000000..b141dfd
--- /dev/null
+++ b/site/.vuepress/components/codes/AttemptCounter/codegen.js
@@ -0,0 +1,55 @@
+import { parseJSON } from '../codegen.js';
+import { insts2hex, getDrawTextOpt, getFillRectParams } from '../asm';
+import { measureText } from '../text.js';
+import { int2hex } from '../utils.js';
+export const lskey = 'config/AttemptCounter';
+
+export const defaultConfig = {
+ x: 152,
+ y: 125,
+ fontSize: 32,
+ fgRGB: 0xffff99,
+ fgA: 0xff,
+ fgRGB2: null,
+ fgA2: null,
+ bgRGB: 0x000000,
+ bgA: 0x40,
+ bgLeft: 4,
+ bgRight: 6,
+ bgTop: 4,
+ bgBot: 3,
+ duration: 60,
+};
+
+export const getPreviewText = () => '88\n99';
+
+/** @returns {typeof defaultConfig} */
+export function getConfig() {
+ const config =
+ (typeof localStorage !== 'undefined' && parseJSON(localStorage.getItem(lskey))) || {};
+ return {
+ ...defaultConfig,
+ ...config,
+ text: getPreviewText(),
+ };
+}
+
+/**
+ * @param {keyof typeof import('../addrs.js').ctxSpOff} version
+ * @param {string=} baseCode
+ */
+export default function codegen(version, baseCode) {
+ if (!baseCode) return '';
+
+ const config = getConfig();
+
+ let code = baseCode;
+ code += '077F0479 0000002B';
+ code += int2hex(config.duration, 1);
+ code += '25640A256400'; // fmt = "%d\n%d"
+ code += insts2hex(getDrawTextOpt(config));
+ code += insts2hex(getFillRectParams(config, measureText(getPreviewText(), version)));
+ code += '0000000000'; // padding
+
+ return code.replace(/\s/g, '');
+}
diff --git a/site/.vuepress/components/codes/AttemptCounter/config.vue b/site/.vuepress/components/codes/AttemptCounter/config.vue
new file mode 100644
index 0000000..da8add2
--- /dev/null
+++ b/site/.vuepress/components/codes/AttemptCounter/config.vue
@@ -0,0 +1,76 @@
+
+