diff --git a/Codes.xml b/Codes.xml index 1009226..3a48e50 100644 --- a/Codes.xml +++ b/Codes.xml @@ -3344,8 +3344,8 @@ Pattern Selector パターン選択 sup39(サポミク) - 0.3 - Jan 28, 2023 + 0.4 + Jan 31, 2023 drawText Ⓑ is the cursor to select the pattern, @@ -3426,28 +3426,31 @@ %object[]{data="/img/PatternSelector/PV1-3.svg"} - 0424F32C 495A9CD5 - 042069DC 495F26B8 - 077F9000 00000192 - 801F0000 3D00817F - 61089147 3D40817F - 614A0024 3D80803D - 618CA9C0 7C006040 - 41820048 3D80803D - 618C87C0 7C006040 - 40820034 819F0004 - 898C0013 508C442E - 39280031 88080007 - 7CEA00AE A0080005 - 7C006040 41820024 - 39080007 7C084840 - 4180FFE4 4AA671C0 - 2C05FFFF 4082FFF8 - 88EA0000 39080031 - 7CE73B79 4182FFE8 - 7C0838AE 280000FF - 4182FFDC 7C030378 - 4E800020 3C808040 + C224F32C 00000013 + 801F0000 3D80817F + 61880440 618A0024 + 6C0C803D 280CA9C0 + 41820054 6C0C803D + 280C87C0 40820034 + 819F0004 898C0013 + 508C442E 39280031 + 88080007 7CEA00AE + A0080005 7C006040 + 41820034 39080007 + 7C084840 4180FFE4 + 3D808026 618C0224 + 7D8803A6 4E800021 + 4800002C 2C05FFFF + 4082FFE8 88EA0000 + 39080031 7CE73B79 + 4182FFD8 7C0838AE + 280000FF 4182FFCC + 7C030378 00000000 + C22069DC 00000019 + 3C60817F 60630410 + 38830010 3D808020 + 618C1EA8 7D8803A6 + 4E800021 3C808040 A4040D82 3C60817F 85630024 70000040 41A20050 88840019 @@ -3465,45 +3468,37 @@ 5C00603E 5405063E 5407C63E 5409863E 88C30000 89030001 - 89430002 3C60817F - 60639138 38830045 - 4BFF7109 4AA0D8AC - 00100140 00000014 - FFFFFFFF FFFFFFFF - 452020FF 213200FF - 621CFF1D 32005025 - 25252630 01FF4520 - 20213001 FFFF621C - 1D300151 0707FF08 - 3102FF36 01FF0231 - 021E6E20 FF506174 - 7465726E 20256325 - 58256325 58256325 - 58000000 00000000 + 89430002 3D80817F + 61830424 61840434 + 618C0238 7D8803A6 + 4E800021 00000000 - 04027900 497D1701 - 04125548 496D3B4C - 077F9000 00000192 - 801F0000 3D00817F - 61089147 3D40817F - 614A0024 3D80803A - 618C6D70 7C006040 - 41820048 3D80803A - 618C4B80 7C006040 - 40820034 819F0004 - 898C0013 508C442E - 39280031 88080007 - 7CEA00AE A0080005 - 7C006040 41820024 - 39080007 7C084840 - 4180FFE4 4A83F620 - 2C05FFFF 4082FFF8 - 88EA0000 39080031 - 7CE73B79 4182FFE8 - 7C0838AE 280000FF - 4182FFDC 7C030378 - 4E800020 3C80803F + C2027900 00000013 + 801F0000 3D80817F + 61880440 618A0024 + 6C0C803A 280C6D70 + 41820054 6C0C803A + 280C4B80 40820034 + 819F0004 898C0013 + 508C442E 39280031 + 88080007 7CEA00AE + A0080005 7C006040 + 41820034 39080007 + 7C084840 4180FFE4 + 3D808003 618C8684 + 7D8803A6 4E800021 + 4800002C 2C05FFFF + 4082FFE8 88EA0000 + 39080031 7CE73B79 + 4182FFD8 7C0838AE + 280000FF 4182FFCC + 7C030378 00000000 + C2125548 00000019 + 3C60817F 60630410 + 38830010 3D808012 + 618C1660 7D8803A6 + 4E800021 3C80803F A404545A 3C60817F 85630024 70000040 41A20050 88840019 @@ -3521,45 +3516,37 @@ 5C00603E 5405063E 5407C63E 5409863E 88C30000 89030001 - 89430002 3C60817F - 60639138 38830045 - 4BFF7109 4A92C418 - 00100140 00000014 - FFFFFFFF FFFFFFFF - 452020FF 213200FF - 621CFF1D 32005025 - 25252630 01FF4520 - 20213001 FFFF621C - 1D300151 0707FF08 - 3102FF36 01FF0231 - 021E6E20 FF506174 - 7465726E 20256325 - 58256325 58256325 - 58000000 00000000 + 89430002 3D80817F + 61830424 61840434 + 618C0238 7D8803A6 + 4E800021 00000000 - 0403B54C 497BDAB5 - 04138DF8 496C029C - 077F9000 00000192 - 801F0000 3D00817F - 61089147 3D40817F - 614A0024 3D80803A - 618CDF98 7C006040 - 41820048 3D80803A - 618CBDA8 7C006040 - 40820034 819F0004 - 898C0013 508C442E - 39280031 88080007 - 7CEA00AE A0080005 - 7C006040 41820024 - 39080007 7C084840 - 4180FFE4 4A8531C4 - 2C05FFFF 4082FFF8 - 88EA0000 39080031 - 7CE73B79 4182FFE8 - 7C0838AE 280000FF - 4182FFDC 7C030378 - 4E800020 3C808040 + C203B54C 00000013 + 801F0000 3D80817F + 61880440 618A0024 + 6C0C803A 280CDF98 + 41820054 6C0C803A + 280CBDA8 40820034 + 819F0004 898C0013 + 508C442E 39280031 + 88080007 7CEA00AE + A0080005 7C006040 + 41820034 39080007 + 7C084840 4180FFE4 + 3D808004 618CC228 + 7D8803A6 4E800021 + 4800002C 2C05FFFF + 4082FFE8 88EA0000 + 39080031 7CE73B79 + 4182FFD8 7C0838AE + 280000FF 4182FFCC + 7C030378 00000000 + C2138DF8 00000019 + 3C60817F 60630410 + 38830010 3D808013 + 618C4F0C 7D8803A6 + 4E800021 3C808040 A404BC26 3C60817F 85630024 70000040 41A20050 88840019 @@ -3577,45 +3564,37 @@ 5C00603E 5405063E 5407C63E 5409863E 88C30000 89030001 - 89430002 3C60817F - 60639138 38830045 - 4BFF7109 4A93FCC8 - 00100140 00000014 - FFFFFFFF FFFFFFFF - 452020FF 213200FF - 621CFF1D 32005025 - 25252630 01FF4520 - 20213001 FFFF621C - 1D300151 0707FF08 - 3102FF36 01FF0231 - 021E6E20 FF506174 - 7465726E 20256325 - 58256325 58256325 - 58000000 00000000 + 89430002 3D80817F + 61830424 61840434 + 618C0238 7D8803A6 + 4E800021 00000000 - 0403B6FC 497BD905 - 041441BC 496B4ED8 - 077F9000 00000192 - 801F0000 3D00817F - 61089147 3D40817F - 614A0024 3D80803B - 618C6178 7C006040 - 41820048 3D80803B - 618C3F88 7C006040 - 40820034 819F0004 - 898C0013 508C442E - 39280031 88080007 - 7CEA00AE A0080005 - 7C006040 41820024 - 39080007 7C084840 - 4180FFE4 4A854070 - 2C05FFFF 4082FFF8 - 88EA0000 39080031 - 7CE73B79 4182FFE8 - 7C0838AE 280000FF - 4182FFDC 7C030378 - 4E800020 3C808040 + C203B6FC 00000013 + 801F0000 3D80817F + 61880440 618A0024 + 6C0C803B 280C6178 + 41820054 6C0C803B + 280C3F88 40820034 + 819F0004 898C0013 + 508C442E 39280031 + 88080007 7CEA00AE + A0080005 7C006040 + 41820034 39080007 + 7C084840 4180FFE4 + 3D808004 618CD0D4 + 7D8803A6 4E800021 + 4800002C 2C05FFFF + 4082FFE8 88EA0000 + 39080031 7CE73B79 + 4182FFD8 7C0838AE + 280000FF 4182FFCC + 7C030378 00000000 + C21441BC 00000019 + 3C60817F 60630410 + 38830010 3D808014 + 618C0390 7D8803A6 + 4E800021 3C808040 A4044486 3C60817F 85630024 70000040 41A20050 88840019 @@ -3633,21 +3612,10 @@ 5C00603E 5405063E 5407C63E 5409863E 88C30000 89030001 - 89430002 3C60817F - 60639138 38830045 - 4BFF7109 4A94B08C - 00100140 00000014 - FFFFFFFF FFFFFFFF - 452020FF 213200FF - 621CFF1D 32005025 - 25252630 01FF4520 - 20213001 FFFF621C - 1D300151 0707FF08 - 3102FF36 01FF0231 - 021E6E20 FF506174 - 7465726E 20256325 - 58256325 58256325 - 58000000 00000000 + 89430002 3D80817F + 61830424 61840434 + 618C0238 7D8803A6 + 4E800021 00000000 diff --git a/Readme.md b/Readme.md index fa9e1d9..5355390 100644 --- a/Readme.md +++ b/Readme.md @@ -67,7 +67,12 @@ 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/unallocated.svg) | `0x39C` | `0xFFF` | Not Allocated | +| ![](./docs/unallocated.svg) | `0x39C` | `0x40F` | Not Allocated | +| ![](./docs/reserved.svg) | `0x410` | `0x41F` | Pattern Selector: Background Options | +| ![](./docs/reserved.svg) | `0x424` | `0x433` | Pattern Selector: Text Options | +| ![](./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 | ### Adding translations diff --git a/changelog.md b/changelog.md index 44009a4..c535885 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog ## Jan 31, 2023 +### Updated 'Pattern Selector' +- Rewrote with C2 + separated config 06 +- Remove label option ### Updated 'Customized Display' - Rewrote with C2 - Implemented a more complex assembler/compiler to support function call diff --git a/site/.vuepress/components/codes/PatternSelector/codegen.js b/site/.vuepress/components/codes/PatternSelector/codegen.js index 9770105..7190ef9 100644 --- a/site/.vuepress/components/codes/PatternSelector/codegen.js +++ b/site/.vuepress/components/codes/PatternSelector/codegen.js @@ -1,5 +1,5 @@ import { parseJSON } from '../codegen.js'; -import { ASM, liDX, str2hex, inst2gecko, getFillRectParams } from '../asm.js'; +import { ASM, liDX, str2hex, insts2hex, getFillRectParams, getDrawTextOpt } from '../asm.js'; import { measureText } from '../text.js'; import { int2hex } from '../utils.js'; import { addrs } from '../addrs.js'; @@ -12,20 +12,19 @@ import * as GMSP01 from './code/GMSP01.js'; const codes = { GMSJ01, GMSJ0A, GMSP01 }; export const defaultConfig = { - x: 16, - y: 320, - fontSize: 20, + x: 498, + y: 462, + fontSize: 14, fgRGB: 0xffffff, fgA: 0xff, fgRGB2: null, fgA2: null, bgRGB: 0, - bgA: 0, - bgLeft: 0, - bgRight: 0, - bgTop: 0, - bgBot: 0, - label: 'Pattern ', + bgA: 128, + bgLeft: 2, + bgRight: 4, + bgTop: 2, + bgBot: 2, }; /** @returns {typeof defaultConfig} */ @@ -33,77 +32,34 @@ export function getConfig() { const config = (typeof localStorage !== 'undefined' && parseJSON(localStorage.getItem(lskey))) || {}; const o = { ...defaultConfig, ...config }; - return { ...o, text: getPreviewText(o) }; + return { ...o, text: getPreviewText() }; } -/** @param {typeof defaultConfig} config */ -export const getPreviewText = ({ label }) => label + '#0 0 0'; +export const getPreviewText = () => '#0 0 0'; -const codePattern = ` -452020FF 213200FF -621CFF1D 32005025 -25252630 01FF4520 -20213001 FFFF621C -1D300151 0707FF08 -3102FF36 01FF0231 -021E6E20 FF +/** + * @param {keyof typeof codes} version + * @param {string} baseCode + */ +export default function codegen(version, baseCode) { + const config = getConfig(); + let code = baseCode; + code += '077F0410 00000066'; + // fillRectOpt + code += insts2hex(getFillRectParams(config, measureText(getPreviewText(), version))); + // drawTextOpt + code += insts2hex(getDrawTextOpt(config)); + // fmt + code += '25632558256325582563255800'; + // pattern data + code += `452020 FF213200 +FF621CFF 1D320050 +25252526 3001FF45 +20202130 01FFFF62 +1C1D3001 510707FF +083102FF 3601FF02 +31021E6E 20FF0000 `; -/** @param {keyof typeof codes} version */ -export default function codegen(version) { - const config = getConfig(); - const { x, y, fontSize, fgRGB, fgA, fgRGB2, fgA2, bgA, label } = config; - const colorTop = (fgRGB << 8) | fgA; - const colorBot = fgRGB2 == null || fgA2 == null ? colorTop : (fgRGB2 << 8) | fgA; - const text = label + '%c%X%c%X%c%X'; - - const { code04, codeBase } = codes[version]; - const code07 = [ - codeBase, - // drawTextOpt - int2hex(x, 2), - int2hex(y, 2), - int2hex(fontSize, 4), - int2hex(colorTop, 4), - int2hex(colorBot, 4), - // pattern.s - codePattern, - // fmt - str2hex(text, version), - ] - .map((s) => s.replace(/\s+/g, '')) - .join(''); - - const head07 = [ - '077F9000', - // byte count = hex length >> 1 - int2hex(code07.length >> 1, 4), - ].join(''); - - // align code 07 (1 line = 16 hex digits) - const tail07 = ''.padEnd(code07.length % 16 ? 16 - (code07.length % 16) : 0, '0'); - - // background - const addrFillRect = addrs.fillRect[version]; - const codeBg = bgA - ? [ - 0xc2000000 + ((addrs.drawWater[version] - 0x28) & 0x01ffffff), - 0x00000007, - 0x48000019, // bl trick - // rect, color - ...getFillRectParams(config, measureText(label + '#0 0 0', version)), - 0x7c6802a6, // mtlr r3 - 0x38830010, // addi r4, r3, 0x10 - 0x3d800000 | (addrFillRect >>> 16), // lis r12, fill_rect@h - 0x618c0000 | (addrFillRect & 0xffff), // ori r12, r12, fill_rect@l - 0x7d8803a6, // mtlr r12 - 0x4e800021, // blrl - 0x60000000, // nop - 0x00000000, // End of C2 - ] - .map(inst2gecko) - .join('') - : ''; - - return (code04 + head07 + code07 + tail07 + codeBg).replace(/\s+/g, ''); + return code.replace(/\s/g, ''); } diff --git a/site/.vuepress/components/codes/PatternSelector/config.vue b/site/.vuepress/components/codes/PatternSelector/config.vue index b1c174a..fa8f43f 100644 --- a/site/.vuepress/components/codes/PatternSelector/config.vue +++ b/site/.vuepress/components/codes/PatternSelector/config.vue @@ -4,9 +4,6 @@
-
- {{l.label}} -
@@ -46,9 +43,6 @@ export default { }, }, }, - watch: { - label: updateConfig, - }, };