From 5f81c7b9b16e9e98bffb1851a80aaf2a2c40cde8 Mon Sep 17 00:00:00 2001 From: sup39 Date: Sun, 16 Oct 2022 13:39:02 +0900 Subject: [PATCH] [QFT v1.2] Fix QFT background when 112*fontSize is not an integer --- Codes.xml | 4 ++-- changelog.md | 3 +++ site/.vuepress/components/codes/qft/codegen.js | 17 ++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Codes.xml b/Codes.xml index 6023346..1b91e93 100644 --- a/Codes.xml +++ b/Codes.xml @@ -1237,8 +1237,8 @@ Quarterframe Timer (Experimental) QFタイマー Noki Doki, sup39(サポミク) - 1.1 - Apr 22, 2022 + 1.2 + Oct 16, 2022 drawText drawText diff --git a/changelog.md b/changelog.md index c637a3d..e3abbc1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Changelog +## Oct 16, 2022 +\[QFT v1.2] Fix QFT background when 112\*fontSize is not an integer + ## Jun 8, 2022 ### Fixed 'Shine Get Timer' stopping on any cutscene started after touching a Shine Shoutouts to plankton for touching the Pinna 1 Shine before its spawn cutscene started, in which case the timer would stop around 8 seconds early. diff --git a/site/.vuepress/components/codes/qft/codegen.js b/site/.vuepress/components/codes/qft/codegen.js index 3540027..62c35d6 100644 --- a/site/.vuepress/components/codes/qft/codegen.js +++ b/site/.vuepress/components/codes/qft/codegen.js @@ -37,10 +37,8 @@ export function getConfig() { }; } -const int16 = (x) => - (x < 0 ? x + 0x10000 : x).toString(16).padStart(4, '0').slice(-4).toUpperCase(); -const int32 = (x) => - (x < 0 ? x + 0x100000000 : x).toString(16).padStart(8, '0').slice(-8).toUpperCase(); +/** @param {number} x */ +const inst2gecko = (x) => (x >>> 0).toString(16).toUpperCase().padStart(8, '0'); import * as GMSJ01 from './code/GMSJ01.js'; import * as GMSE01 from './code/GMSE01.js'; @@ -68,6 +66,7 @@ export const codes = { GMSJ01, GMSE01, GMSP01, GMSJ0A }; bl 817fxxxx ****/ const freezeCodeAddr = 0x817f0348; +/** @param {keyof typeof codes} version */ export default function codegen(version) { const config = getConfig(); const { freezeCodeInfo, baseCode, r13off } = codes[version] ?? {}; @@ -99,7 +98,7 @@ export default function codegen(version) { 0x60000000, 0x00000000, ] - .map(int32) + .map(inst2gecko) .join(''); } else { // handle regular freezing code later @@ -124,7 +123,7 @@ export default function codegen(version) { 0x916c00bc, // stw r11, 0xBC(r12) 0x00000000, ]) - .map(int32) + .map(inst2gecko) .join(''); } else { const code04 = []; @@ -160,7 +159,7 @@ export default function codegen(version) { code07.push(0); } // apply code - code += [...code04, ...code07].map(int32).join(''); + code += [...code04, ...code07].map(inst2gecko).join(''); } // ui (GMSJ01/GMSJ0A only) @@ -175,7 +174,7 @@ export default function codegen(version) { x + width * scale, // x2 y, // y2 ] - .map(int32) + .map(inst2gecko) .join(''); code += '25753a253032752e2530337500000000'; // fmt /* fontSize, fgColor, bgColor */ @@ -184,7 +183,7 @@ export default function codegen(version) { const fgColor = (config.fgRGB & 0xffffff) * 256 + (config.fgA & 0xff); const fgColor2 = ((config.fgRGB2 ?? config.fgRGB) & 0xffffff) * 256 + ((config.fgA2 ?? config.fgA) & 0xff); - code += [fontSize, fgColor, fgColor2, bgColor].map(int32).join(''); + code += [fontSize, fgColor, fgColor2, bgColor].map(inst2gecko).join(''); } return code.replace(/\s/g, '');