From a0bb9f925a094426b26eff0457229ad17a41f17c Mon Sep 17 00:00:00 2001 From: sup39 Date: Sat, 23 Apr 2022 23:29:38 +0900 Subject: [PATCH] add code size warning and the shortened QFT --- Codes.xml | 4 ++-- changelog.md | 5 +++++ site/.vuepress/components/DownloadButton.vue | 18 +++++++++++++++++- site/.vuepress/i18n/en-US.json | 4 ++++ site/.vuepress/i18n/ja-JP.json | 4 ++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Codes.xml b/Codes.xml index 3513843..26b11ae 100644 --- a/Codes.xml +++ b/Codes.xml @@ -1241,8 +1241,8 @@ Quarterframe Timer (Experimental) QFタイマー Noki Doki, sup39(サポミク) - 0.5 - Nov 28, 2021 + 1.1 + Apr 22, 2022 drawText Adds an in-game timer to every level, starting on the last black frame after the diff --git a/changelog.md b/changelog.md index ed8dc0c..42aa9b0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,9 @@ # Changelog +## Apr 23, 2022 +### Add code size warning +- Alert message `generatorconfig.alert.gct` when code size > 5000 bytes and download format is `GCT` +- Alert message `generatorconfig.alert.dolphin` when code size > 3256 bytes (excluding header(00D0) and footer(F000)) and download format is `Dolphin INI` or `CheatManager TXT`. + ## Apr 22, 2022 ### Shortened QFT and simplified config - Shorten QFT's freeze code by replacing C2 with 04(bl@event) and 07. diff --git a/site/.vuepress/components/DownloadButton.vue b/site/.vuepress/components/DownloadButton.vue index 1c02274..c649946 100644 --- a/site/.vuepress/components/DownloadButton.vue +++ b/site/.vuepress/components/DownloadButton.vue @@ -13,7 +13,7 @@ import gameVersions from '../data/gameVersions.json'; // Util -import { translateCode } from '../i18n/localeHelper'; +import { translate, translateCode } from '../i18n/localeHelper'; // customizable code import codegens from './codes/codegen.js'; @@ -71,18 +71,34 @@ export default { } // generate file + const codeSize = c.reduce((a, e) => a+e.source.length, 0)/2 + 16; // 8(00D0)+8(F000) + console.log(codeSize, c); switch (this.format) { case 'gct': + this.alertGCTCodeSize(codeSize); this.generateGCT(c, fileName); break; case 'dolphin': + this.alertDolphinCodeSize(codeSize); this.generateDolphinINI(c, fileName); break; case 'gcm': + this.alertDolphinCodeSize(codeSize); this.generateCheatManagerTXT(c, fileName); break; } }, + alertGCTCodeSize(size) { + if (size > 5000) { + alert(translate('generatorconfig.alert.gct', this.$lang).replaceAll('{size}', size)); + } + }, + alertDolphinCodeSize(size) { + if (size > 3272) { // 0x3000-0x2338 + // excluding header+footer + alert(translate('generatorconfig.alert.dolphin', this.$lang).replaceAll('{size}', size-16)); + } + }, generateGCT(codes, version) { let code = '00D0C0DE00D0C0DE'; codes.forEach((c) => (code += c.source)); diff --git a/site/.vuepress/i18n/en-US.json b/site/.vuepress/i18n/en-US.json index 5f69d50..18c3bcc 100644 --- a/site/.vuepress/i18n/en-US.json +++ b/site/.vuepress/i18n/en-US.json @@ -47,6 +47,10 @@ "gcm": "CheatManager TXT" } }, + "alert": { + "gct": "The generated GCT file size exceeds 5000 bytes ({size} bytes). All of the codes may not work when using this file on Nintendont.", + "dolphin": "The total code size exceeds 3256 bytes ({size} bytes). All of the codes may not work when all of them are enabled on Dolphin. Try to disable some codes in that case." + }, "categories": { "qol": "Quality of Life", "loader": "Loaders", diff --git a/site/.vuepress/i18n/ja-JP.json b/site/.vuepress/i18n/ja-JP.json index bb425a3..47727f0 100644 --- a/site/.vuepress/i18n/ja-JP.json +++ b/site/.vuepress/i18n/ja-JP.json @@ -31,6 +31,10 @@ "dolphin": "Dolphin INI", "gcm": "CheatManager TXT" } + }, + "alert": { + "gct": "生成されたGCTファイルのサイズが5000バイトを超えました({size}バイト)。NintendontでこのGCTファイルを使う時、全ての機能が動作しなくなることがあるため、5000バイトを超えないようにいくつかの機能を減らすことをおすすめします。", + "dolphin": "コードの合計サイズが3256バイトを超えました({size}バイト)。Dolphinで全てのコードをONにすると、全ての機能が動作しなくなることがあります。その場合はいくつかのコードをOFFにしてください。" } }, "landingpage": {