From 3e0dbe0a1e3b26daa899c22d344f8e0a6681f707 Mon Sep 17 00:00:00 2001 From: sup39 Date: Sat, 11 Feb 2023 04:24:17 +0900 Subject: [PATCH] Put IntroSkip in GCT instead of GCI to prevent softlock --- Codes.xml | 1 + site/.vuepress/components/DownloadButton.vue | 55 +++++++++++++------- site/.vuepress/i18n/en-US.json | 3 +- site/.vuepress/i18n/ja-JP.json | 3 +- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/Codes.xml b/Codes.xml index 8be5ed8..d1d45df 100644 --- a/Codes.xml +++ b/Codes.xml @@ -3375,6 +3375,7 @@ qol standard,recommended,il + IntroSkip Intro Skip Überspringbare Intros Passer l'intro diff --git a/site/.vuepress/components/DownloadButton.vue b/site/.vuepress/components/DownloadButton.vue index 62ec7df..bd597db 100644 --- a/site/.vuepress/components/DownloadButton.vue +++ b/site/.vuepress/components/DownloadButton.vue @@ -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 - const codeSize = codeList.reduce((a, e) => a + e.source.length, 0) / 2 + 16; // 8(00D0)+8(F000) - // console.log(codeSize, codeList); - switch (this.format) { + switch (format) { case 'gct': this.alertGCTCodeSize(codeSize); this.generateGCT(codeList, version); @@ -86,21 +117,6 @@ export default { this.alertDolphinCodeSize(codeSize); this.generateCheatManagerTXT(codeList, version); 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) { @@ -174,7 +190,7 @@ export default { const codeSize = code.length>>1; const fileName = `GCT_${version}`; - const blockCount = 6; // Math.ceil(codeSize/0x2000); + const blockCount = 6; // Math.ceil(codeSize/0x2000); // TODO const headSize = 0x40; const gciSize = headSize+0x2000*blockCount; const rawData = new Uint8Array(gciSize); @@ -193,7 +209,6 @@ export default { for (let i=0x3A; i<0x40; i++) rawData[i] = 0xff; this.downloadFile(rawData, `01-${version.slice(0, 4)}-${fileName}.gci`); - return true; // good }, downloadFile(data, filename) { var file = new Blob([data], { diff --git a/site/.vuepress/i18n/en-US.json b/site/.vuepress/i18n/en-US.json index ae735ef..253d4e5 100644 --- a/site/.vuepress/i18n/en-US.json +++ b/site/.vuepress/i18n/en-US.json @@ -53,7 +53,8 @@ }, "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." + "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": { "qol": "Quality of Life", diff --git a/site/.vuepress/i18n/ja-JP.json b/site/.vuepress/i18n/ja-JP.json index 7f66c06..6024079 100644 --- a/site/.vuepress/i18n/ja-JP.json +++ b/site/.vuepress/i18n/ja-JP.json @@ -38,7 +38,8 @@ }, "alert": { "gct": "生成されたGCTファイルのサイズが5000バイトを超えました({size}バイト)。NintendontでこのGCTファイルを使う時、全ての機能が動作しなくなることがあるため、5000バイトを超えないようにいくつかの機能を減らすことをおすすめします。", - "dolphin": "コードの合計サイズが3256バイトを超えました({size}バイト)。Dolphinで全てのコードをONにすると、全ての機能が動作しなくなることがあります。その場合はいくつかのコードをOFFにしてください。" + "dolphin": "コードの合計サイズが3256バイトを超えました({size}バイト)。Dolphinで全てのコードをONにすると、全ての機能が動作しなくなることがあります。その場合はいくつかのコードをOFFにしてください。", + "gci-compatibility": "互換性がないため次のコードはGCIファイルに含まれません:" } }, "landingpage": {