From 3fa675eceaab130e7f9e210bd3374f4d6f699cdd Mon Sep 17 00:00:00 2001 From: sup39 Date: Mon, 6 Feb 2023 23:47:07 +0900 Subject: [PATCH] Fixed CustomizedDisplay: hex value of multi-byte char in format string --- changelog.md | 4 ++++ .../.vuepress/components/codes/CustomizedDisplay/codegen.js | 6 +++--- site/.vuepress/components/codes/asm.js | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index fb070c3..d9fd4be 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,8 @@ # Changelog +## Feb 06, 2023 +### Fixed 'Customized Display' +Fixed the hex value of multi-byte char in format string + ## Feb 05, 2023 ### Created 'Controller Input Display' Display controller input diff --git a/site/.vuepress/components/codes/CustomizedDisplay/codegen.js b/site/.vuepress/components/codes/CustomizedDisplay/codegen.js index 016262a..c24a1bb 100644 --- a/site/.vuepress/components/codes/CustomizedDisplay/codegen.js +++ b/site/.vuepress/components/codes/CustomizedDisplay/codegen.js @@ -39,8 +39,8 @@ export default function codegen(version) { const asm = []; for (const config of configs) { - const { fmt, bgA } = config; - const { preview, format, fields } = parseFormat(fmt, version); + const { fmt: fmtRaw, bgA } = config; + const { preview, format, fields } = parseFormat(fmtRaw, version); // fill_rect if (bgA) { @@ -48,7 +48,7 @@ export default function codegen(version) { } // drawText - if (fmt.trim()) { + if (format.trim()) { const { insts, sp } = drawText(version, config, format, fields); stackFrameSize = Math.max(stackFrameSize, sp); asm.push(...insts); diff --git a/site/.vuepress/components/codes/asm.js b/site/.vuepress/components/codes/asm.js index c404c92..3d0df90 100644 --- a/site/.vuepress/components/codes/asm.js +++ b/site/.vuepress/components/codes/asm.js @@ -195,8 +195,8 @@ export function str2bytes(s, version) { /** @type {Record} */ const charInfo = version.startsWith('GMSJ') ? charInfoJP : charInfoEU; // TODO US const fmtbuf = Array.from(s).flatMap((c) => { - const code = charInfo[c]?.code ?? c.charCodeAt(0); - return code >= 0x100 ? [code >> 16, code & 0xff] : [code]; + const code = charInfo[c]?.code ?? c.charCodeAt(0); // TODO multi-byte invalid char + return code >= 0x100 ? [code >> 8, code & 0xff] : [code]; }); fmtbuf.push(0); // NUL terminated return fmtbuf;