add code size warning and the shortened QFT

This commit is contained in:
sup39 2022-04-23 23:29:38 +09:00
parent df449cc97c
commit a0bb9f925a
5 changed files with 32 additions and 3 deletions

View file

@ -1241,8 +1241,8 @@
<title lang="en-US">Quarterframe Timer (Experimental)</title> <title lang="en-US">Quarterframe Timer (Experimental)</title>
<title lang="ja-JP">QFタイマー</title> <title lang="ja-JP">QFタイマー</title>
<author>Noki Doki, sup39(サポミク)</author> <author>Noki Doki, sup39(サポミク)</author>
<version>0.5</version> <version>1.1</version>
<date>Nov 28, 2021</date> <date>Apr 22, 2022</date>
<dependencies version="GMSJ01">drawText</dependencies> <dependencies version="GMSJ01">drawText</dependencies>
<description lang="en-US"> <description lang="en-US">
Adds an in-game timer to every level, starting on the last black frame after the Adds an in-game timer to every level, starting on the last black frame after the

View file

@ -1,4 +1,9 @@
# Changelog # 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 ## Apr 22, 2022
### Shortened QFT and simplified config ### Shortened QFT and simplified config
- Shorten QFT's freeze code by replacing C2 with 04(bl@event) and 07. - Shorten QFT's freeze code by replacing C2 with 04(bl@event) and 07.

View file

@ -13,7 +13,7 @@
import gameVersions from '../data/gameVersions.json'; import gameVersions from '../data/gameVersions.json';
// Util // Util
import { translateCode } from '../i18n/localeHelper'; import { translate, translateCode } from '../i18n/localeHelper';
// customizable code // customizable code
import codegens from './codes/codegen.js'; import codegens from './codes/codegen.js';
@ -71,18 +71,34 @@ export default {
} }
// generate file // 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) { switch (this.format) {
case 'gct': case 'gct':
this.alertGCTCodeSize(codeSize);
this.generateGCT(c, fileName); this.generateGCT(c, fileName);
break; break;
case 'dolphin': case 'dolphin':
this.alertDolphinCodeSize(codeSize);
this.generateDolphinINI(c, fileName); this.generateDolphinINI(c, fileName);
break; break;
case 'gcm': case 'gcm':
this.alertDolphinCodeSize(codeSize);
this.generateCheatManagerTXT(c, fileName); this.generateCheatManagerTXT(c, fileName);
break; 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) { generateGCT(codes, version) {
let code = '00D0C0DE00D0C0DE'; let code = '00D0C0DE00D0C0DE';
codes.forEach((c) => (code += c.source)); codes.forEach((c) => (code += c.source));

View file

@ -47,6 +47,10 @@
"gcm": "CheatManager TXT" "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": { "categories": {
"qol": "Quality of Life", "qol": "Quality of Life",
"loader": "Loaders", "loader": "Loaders",

View file

@ -31,6 +31,10 @@
"dolphin": "Dolphin INI", "dolphin": "Dolphin INI",
"gcm": "CheatManager TXT" "gcm": "CheatManager TXT"
} }
},
"alert": {
"gct": "生成されたGCTファイルのサイズが5000バイトを超えました({size}バイト)。NintendontでこのGCTファイルを使う時、全ての機能が動作しなくなることがあるため、5000バイトを超えないようにいくつかの機能を減らすことをおすすめします。",
"dolphin": "コードの合計サイズが3256バイトを超えました({size}バイト)。Dolphinで全てのコードをONにすると、全ての機能が動作しなくなることがあります。その場合はいくつかのコードをOFFにしてください。"
} }
}, },
"landingpage": { "landingpage": {