Ported GCI Loader to all versions

This commit is contained in:
sup39 2023-02-11 03:33:39 +09:00
parent ac637e0712
commit 1b1d156d0b
6 changed files with 329 additions and 71 deletions

345
Codes.xml
View file

@ -4772,57 +4772,314 @@
<category>lib</category> <category>lib</category>
<id>GCILoader</id> <id>GCILoader</id>
<title lang="en-US">GCI Loader</title> <title lang="en-US">GCI Loader</title>
<author>sup39(サポミク)</author> <author>sup39(サポミク), Psychonauter</author>
<version>0.2</version> <version>0.3</version>
<date>Nov 16, 2022</date> <date>Feb 10, 2023</date>
<description lang="en-US"> <description lang="en-US">
Execute Gecko code loaded from GCI file. Execute Gecko code loaded from GCI file.
::: warning ::: warning
You will need to reset the game if you hotplug your memory card You will need to reset the game if you hotplug your memory card
::: :::
</description> </description>
<source version="GMSE01">
077FE800 00000207
9421FFE8 7C0802A6
93C10010 7C9E2378
38800001 93810008
93A1000C 7C7C1B78
93E10014 7CDD3378
9001001C 7CBF2B78
4AAB40E5 2C030000
408200AC 807C0000
7FE4FB78 7FC5F378
4AB5AB45 7C7F1B79
40820064 3D20817F
6129E800 7D3D4850
2809BFFF 40810088
38A00000 7FA4EB78
60A5C000 38C00000
7FC3F378 4AB5B4A5
7C7F1B79 40820070
7FC3F378 4AB5AC79
8001001C 7FE3FB78
83810008 83A1000C
7C0803A6 83C10010
83E10014 38210018
4E800020 2C1FFFFC
41A2FFD8 8001001C
3BE0FFFE 7FE3FB78
83810008 83A1000C
7C0803A6 83C10010
83E10014 38210018
4E800020 3BE0FFFF
4BFFFFA8 3BE0FFFD
4BFFFFA0 3BE0FFFB
4BFFFF98 9421FFF0
3CA08180 7C0802A6
39200001 93E1000C
3FE0817F 38DF17F8
38A5E9FC 38C60008
90010014 913F17F8
4BFFFED9 2C030000
40820008 38600002
80010014 907F17F8
7C0803A6 83E1000C
38210010 4E800020
9421FFE8 93A1000C
3FA0817F 813D17F8
93C10010 7C9E2378
2C090000 93E10014
7C7F1B78 40810020
83A1000C 7FC4F378
7FE3FB78 83C10010
83E10014 38210018
4AAB3740 38DD17F8
3CA08180 7C0802A6
39200001 38C60008
38A5E9FC 9001001C
913D17F8 4BFFFE4D
2C030000 4182002C
8001001C 907D17F8
7C0803A6 83A1000C
7FC4F378 7FE3FB78
83C10010 83E10014
38210018 4AAB36EC
8001001C 38600002
907D17F8 7C0803A6
4BFFFFD4 4743545F
474D5345 30310000
042A96E0 49555271
C0000000 00000005
3C60817F 840317F8
2C000002 4C820020
7C0F2214 90030004
39E30008 7DE47850
4E800020 4E800020
</source>
<source version="GMSJ01"> <source version="GMSJ01">
C21069F4 00000021 077FE800 00000207
9421FFE0 BF61000C 9421FFE8 7C0802A6
3FA0817F 63BDE800 93C10010 7C9E2378
3F80ABCD 813D0000 38800001 93810008
639C1234 7C7E1B78 93A1000C 7C7C1B78
7C09E000 7C9F2378 93E10014 7CDD3378
418200B8 3D208010 9001001C 7CBF2B78
38800001 39297B50 4A909321 2C030000
7D2903A6 4E800421 408200AC 807C0000
2C030000 4082009C 7FE4FB78 7FC5F378
3D20800A 39293CAC 4A8A5465 7C7F1B79
807E0000 7FE5FB78 40820064 3D20817F
48000009 67637400 6129E800 7D3D4850
7C8802A6 7D2903A6 2809BFFF 40810088
4E800421 2C030000 38A00000 7FA4EB78
40820070 3F60817F 60A5C000 38C00000
3D20800A 39294640 7FC3F378 4A8A5DC5
637BA800 38C00000 7C7F1B79 40820070
38A04000 7F64DB78 7FC3F378 4A8A5599
7FE3FB78 7D2903A6 8001001C 7FE3FB78
4E800421 2C030000 83810008 83A1000C
4082002C 813B0000 7C0803A6 83C10010
6D2AFF2F 2C0AC0DE 83E10014 38210018
4082001C 3D40817F 4E800020 2C1FFFFC
614AA804 814A0000 41A2FFD8 8001001C
7C0A4800 40A20008 3BE0FFFE 7FE3FB78
939D0000 3D20800A 83810008 83A1000C
7FE3FB78 39293E24 7C0803A6 83C10010
7D2903A6 4E800421 83E10014 38210018
3D208010 7FE4FB78 4E800020 3BE0FFFF
392972F4 7FC3F378 4BFFFFA8 3BE0FFFD
7D2903A6 4E800421 4BFFFFA0 3BE0FFFB
BB61000C 38210020 4BFFFF98 9421FFF0
60000000 00000000 3CA08180 7C0802A6
2C3E6008 00FF0300 39200001 93E1000C
217FE800 ABCD1234 3FE0817F 38DF17F8
C0000000 00000003 38A5E9FC 38C60008
7C0F2214 3C608180 90010014 913F17F8
9403A7FC 39E3000C 4BFFFED9 2C030000
7DE47850 4E800020 40820008 38600002
E0000000 00000000 80010014 907F17F8
7C0803A6 83E1000C
38210010 4E800020
9421FFE8 93A1000C
3FA0817F 813D17F8
93C10010 7C9E2378
2C090000 93E10014
7C7F1B78 40810020
83A1000C 7FC4F378
7FE3FB78 83C10010
83E10014 38210018
4A908964 38DD17F8
3CA08180 7C0802A6
39200001 38C60008
38A5E9FC 9001001C
913D17F8 4BFFFE4D
2C030000 4182002C
8001001C 907D17F8
7C0803A6 83A1000C
7FC4F378 7FE3FB78
83C10010 83E10014
38210018 4A908910
8001001C 38600002
907D17F8 7C0803A6
4BFFFFD4 4743545F
474D534A 30310000
041069F4 496F7F5D
C0000000 00000005
3C60817F 840317F8
2C000002 4C820020
7C0F2214 90030004
39E30008 7DE47850
4E800020 4E800020
</source>
<source version="GMSP01">
077FE800 00000207
9421FFE8 7C0802A6
93C10010 7C9E2378
38800001 93810008
93A1000C 7C7C1B78
93E10014 7CDD3378
9001001C 7CBF2B78
4AAABFF5 2C030000
408200AC 807C0000
7FE4FB78 7FC5F378
4AB52D65 7C7F1B79
40820064 3D20817F
6129E800 7D3D4850
2809BFFF 40810088
38A00000 7FA4EB78
60A5C000 38C00000
7FC3F378 4AB536C5
7C7F1B79 40820070
7FC3F378 4AB52E99
8001001C 7FE3FB78
83810008 83A1000C
7C0803A6 83C10010
83E10014 38210018
4E800020 2C1FFFFC
41A2FFD8 8001001C
3BE0FFFE 7FE3FB78
83810008 83A1000C
7C0803A6 83C10010
83E10014 38210018
4E800020 3BE0FFFF
4BFFFFA8 3BE0FFFD
4BFFFFA0 3BE0FFFB
4BFFFF98 9421FFF0
3CA08180 7C0802A6
39200001 93E1000C
3FE0817F 38DF17F8
38A5E9FC 38C60008
90010014 913F17F8
4BFFFED9 2C030000
40820008 38600002
80010014 907F17F8
7C0803A6 83E1000C
38210010 4E800020
9421FFE8 93A1000C
3FA0817F 813D17F8
93C10010 7C9E2378
2C090000 93E10014
7C7F1B78 40810020
83A1000C 7FC4F378
7FE3FB78 83C10010
83E10014 38210018
4AAAB650 38DD17F8
3CA08180 7C0802A6
39200001 38C60008
38A5E9FC 9001001C
913D17F8 4BFFFE4D
2C030000 4182002C
8001001C 907D17F8
7C0803A6 83A1000C
7FC4F378 7FE3FB78
83C10010 83E10014
38210018 4AAAB5FC
8001001C 38600002
907D17F8 7C0803A6
4BFFFFD4 4743545F
474D5350 30310000
042A96E0 49555271
C0000000 00000005
3C60817F 840317F8
2C000002 4C820020
7C0F2214 90030004
39E30008 7DE47850
4E800020 4E800020
</source>
<source version="GMSJ0A">
077FE800 00000207
9421FFE8 7C0802A6
93C10010 7C9E2378
38800001 93810008
93A1000C 7C7C1B78
93E10014 7CDD3378
9001001C 7CBF2B78
4AA93E05 2C030000
408200AC 807C0000
7FE4FB78 7FC5F378
4AB3A445 7C7F1B79
40820064 3D20817F
6129E800 7D3D4850
2809BFFF 40810088
38A00000 7FA4EB78
60A5C000 38C00000
7FC3F378 4AB3ADA5
7C7F1B79 40820070
7FC3F378 4AB3A579
8001001C 7FE3FB78
83810008 83A1000C
7C0803A6 83C10010
83E10014 38210018
4E800020 2C1FFFFC
41A2FFD8 8001001C
3BE0FFFE 7FE3FB78
83810008 83A1000C
7C0803A6 83C10010
83E10014 38210018
4E800020 3BE0FFFF
4BFFFFA8 3BE0FFFD
4BFFFFA0 3BE0FFFB
4BFFFF98 9421FFF0
3CA08180 7C0802A6
39200001 93E1000C
3FE0817F 38DF17F8
38A5E9FC 38C60008
90010014 913F17F8
4BFFFED9 2C030000
40820008 38600002
80010014 907F17F8
7C0803A6 83E1000C
38210010 4E800020
9421FFE8 93A1000C
3FA0817F 813D17F8
93C10010 7C9E2378
2C090000 93E10014
7C7F1B78 40810020
83A1000C 7FC4F378
7FE3FB78 83C10010
83E10014 38210018
4AA934A8 38DD17F8
3CA08180 7C0802A6
39200001 38C60008
38A5E9FC 9001001C
913D17F8 4BFFFE4D
2C030000 4182002C
8001001C 907D17F8
7C0803A6 83A1000C
7FC4F378 7FE3FB78
83C10010 83E10014
38210018 4AA93454
8001001C 38600002
907D17F8 7C0803A6
4BFFFFD4 4743545F
474D534A 30410000
04291538 4956D419
C0000000 00000005
3C60817F 840317F8
2C000002 4C820020
7C0F2214 90030004
39E30008 7DE47850
4E800020 4E800020
</source> </source>
</code> </code>
</codes> </codes>

View file

@ -1,4 +1,7 @@
# Changelog # Changelog
## Feb 10, 2023
Ported GCI Loader to all versions
## Feb 08, 2023 ## Feb 08, 2023
### Updated 'Instant Level Select' ### Updated 'Instant Level Select'
Overwrite button input value to prevent Level Select being activated when AreaLock is enabled Overwrite button input value to prevent Level Select being activated when AreaLock is enabled

View file

@ -60,7 +60,7 @@ export default {
]); ]);
} catch {} } catch {}
const fileName = gameVersions.find((v) => v.identifier === this.versionIdentifier).version; const version = gameVersions.find((v) => v.identifier === this.versionIdentifier).version;
// apply customizable codes // apply customizable codes
for (const code of codeList) { for (const code of codeList) {
@ -76,30 +76,30 @@ export default {
switch (this.format) { switch (this.format) {
case 'gct': case 'gct':
this.alertGCTCodeSize(codeSize); this.alertGCTCodeSize(codeSize);
this.generateGCT(codeList, fileName); this.generateGCT(codeList, version);
break; break;
case 'dolphin': case 'dolphin':
this.alertDolphinCodeSize(codeSize); this.alertDolphinCodeSize(codeSize);
this.generateDolphinINI(codeList, fileName); this.generateDolphinINI(codeList, version);
break; break;
case 'gcm': case 'gcm':
this.alertDolphinCodeSize(codeSize); this.alertDolphinCodeSize(codeSize);
this.generateCheatManagerTXT(codeList, fileName); this.generateCheatManagerTXT(codeList, version);
break; break;
case 'gci+gct': case 'gci+gct':
this.generateGCI(c, fileName) && this.generateGCI(codeList, version) &&
this.generateGCT(this.getGCILoader(), fileName); this.generateGCT(this.getGCILoader(), version);
break; break;
case 'gci+dolphin': case 'gci+dolphin':
this.generateGCI(c, fileName) && this.generateGCI(codeList, version) &&
this.generateDolphinINI(this.getGCILoader(), fileName); this.generateDolphinINI(this.getGCILoader(), version);
break; break;
case 'gci+gcm': case 'gci+gcm':
this.generateGCI(c, fileName) && this.generateGCI(codeList, version) &&
this.generateCheatManagerTXT(this.getGCILoader(), fileName); this.generateCheatManagerTXT(this.getGCILoader(), version);
break; break;
case 'gci': case 'gci':
this.generateGCI(c, fileName); this.generateGCI(codeList, version);
break; break;
} }
}, },
@ -168,33 +168,31 @@ export default {
this.downloadFile(data, `${version}.txt`); this.downloadFile(data, `${version}.txt`);
}, },
generateGCI(codes, version) { generateGCI(codes, version) {
if (!['GMSJ01'].includes(version)) { let code = '';
alert('GCI format is not yet supported for versions other than GMSJ01');
return false; // error
}
let code = '00D0C0DE00D0C0DE';
codes.forEach((c) => (code += c.source)); codes.forEach((c) => (code += c.source));
code += 'C0000000000000023C60818081E3A7FC7DE478504E800020'; // return code += 'C0000000000000023C60817F81E317FC7DE478504E800020'; // return
const codeSize = code.length>>1;
const blockCount = 2; // TODO const fileName = `GCT_${version}`;
const gciSize = 0x40+0x2000*blockCount; const blockCount = 6; // Math.ceil(codeSize/0x2000);
const padSize = 0x40; // TODO const headSize = 0x40;
let rawData = new Uint8Array(gciSize); const gciSize = headSize+0x2000*blockCount;
const rawData = new Uint8Array(gciSize);
for (let iD=padSize, iC=0; iD<rawData.length; iD++, iC+=2) { for (let iD=headSize, iC=0; iC<code.length; iD++, iC+=2) {
rawData[iD] = parseInt(code.slice(iC, iC+2), 16); rawData[iD] = parseInt(code.slice(iC, iC+2), 16);
} }
// game id // game id
[...new TextEncoder().encode(version), 0xff, 0x00].forEach((e, i) => rawData[i] = e); [...new TextEncoder().encode(version), 0xff, 0x00].forEach((e, i) => rawData[i] = e);
// file name // file name
[...new TextEncoder().encode('gct')].forEach((e, i) => rawData[0x8+i] = e); [...new TextEncoder().encode(fileName)].forEach((e, i) => rawData[0x8+i] = e);
// block count // block count
rawData[0x39] = blockCount; rawData[0x39] = blockCount;
// ff*6 // ff*6
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)}-gct.gci`); this.downloadFile(rawData, `01-${version.slice(0, 4)}-${fileName}.gci`);
return true; // good return true; // good
}, },
downloadFile(data, filename) { downloadFile(data, filename) {