Put IntroSkip in GCT instead of GCI to prevent softlock

This commit is contained in:
sup39 2023-02-11 04:24:17 +09:00
parent 1b1d156d0b
commit 3e0dbe0a1e
4 changed files with 40 additions and 22 deletions

View file

@ -3375,6 +3375,7 @@
<code> <code>
<category>qol</category> <category>qol</category>
<presets>standard,recommended,il</presets> <presets>standard,recommended,il</presets>
<id>IntroSkip</id>
<title lang="en-US">Intro Skip</title> <title lang="en-US">Intro Skip</title>
<title lang="de-CH">Überspringbare Intros</title> <title lang="de-CH">Überspringbare Intros</title>
<title lang="fr-FR">Passer l'intro</title> <title lang="fr-FR">Passer l'intro</title>

View file

@ -70,10 +70,41 @@ export default {
} }
} }
let format;
const formats = this.format.split('+');
if (formats[0] === 'gci') {
format = formats[1];
const codeListGCT = [];
const codeListGCI = codeList.splice(0).flatMap(c => {
if (c.id === 'IntroSkip') { // TODO
codeListGCT.push(c);
return [];
}
return c;
});
// download GCI Loader + GCT only code as remaining format
const {codes} = gameVersions.find((v) => v.identifier === this.versionIdentifier);
const gciLoader = codes.find(code => code.id === 'GCILoader');
codeList.push(gciLoader, ...codeListGCT);
if (!format && codeListGCT.length) {
const list = codeListGCT.map(c => (
c.title.find(o => o.lang === this.$lang) ??
c.title.find(o => o.lang === 'en-US')
).content).join(', ');
alert(translate('generatorconfig.alert.gci-compatibility', this.$lang)+list);
}
// download GCI file
if (codeListGCI.length) {
this.generateGCI(codeListGCI, version);
}
} else {
format = formats[0];
}
// 16 = 8(00D0C0DE 00D0C0DE) + 8(F0000000 00000000)
const codeSize = codeList.reduce((a, e) => a + e.source.length, 0) / 2 + 16;
// generate file // generate file
const codeSize = codeList.reduce((a, e) => a + e.source.length, 0) / 2 + 16; // 8(00D0)+8(F000) switch (format) {
// console.log(codeSize, codeList);
switch (this.format) {
case 'gct': case 'gct':
this.alertGCTCodeSize(codeSize); this.alertGCTCodeSize(codeSize);
this.generateGCT(codeList, version); this.generateGCT(codeList, version);
@ -86,21 +117,6 @@ export default {
this.alertDolphinCodeSize(codeSize); this.alertDolphinCodeSize(codeSize);
this.generateCheatManagerTXT(codeList, version); this.generateCheatManagerTXT(codeList, version);
break; break;
case 'gci+gct':
this.generateGCI(codeList, version) &&
this.generateGCT(this.getGCILoader(), version);
break;
case 'gci+dolphin':
this.generateGCI(codeList, version) &&
this.generateDolphinINI(this.getGCILoader(), version);
break;
case 'gci+gcm':
this.generateGCI(codeList, version) &&
this.generateCheatManagerTXT(this.getGCILoader(), version);
break;
case 'gci':
this.generateGCI(codeList, version);
break;
} }
}, },
alertGCTCodeSize(size) { alertGCTCodeSize(size) {
@ -174,7 +190,7 @@ export default {
const codeSize = code.length>>1; const codeSize = code.length>>1;
const fileName = `GCT_${version}`; const fileName = `GCT_${version}`;
const blockCount = 6; // Math.ceil(codeSize/0x2000); const blockCount = 6; // Math.ceil(codeSize/0x2000); // TODO
const headSize = 0x40; const headSize = 0x40;
const gciSize = headSize+0x2000*blockCount; const gciSize = headSize+0x2000*blockCount;
const rawData = new Uint8Array(gciSize); const rawData = new Uint8Array(gciSize);
@ -193,7 +209,6 @@ export default {
for (let i=0x3A; i<0x40; i++) rawData[i] = 0xff; for (let i=0x3A; i<0x40; i++) rawData[i] = 0xff;
this.downloadFile(rawData, `01-${version.slice(0, 4)}-${fileName}.gci`); this.downloadFile(rawData, `01-${version.slice(0, 4)}-${fileName}.gci`);
return true; // good
}, },
downloadFile(data, filename) { downloadFile(data, filename) {
var file = new Blob([data], { var file = new Blob([data], {

View file

@ -53,7 +53,8 @@
}, },
"alert": { "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.", "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." "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.",
"gci-compatibility": "The following code is not included in the GCI file due to incompatibility: "
}, },
"categories": { "categories": {
"qol": "Quality of Life", "qol": "Quality of Life",

View file

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