Add GCI+XXX as download format; Add return code for GCI Loader

This commit is contained in:
sup39 2022-11-16 17:20:30 +09:00
parent 918eb0eb50
commit 215af313de
8 changed files with 98 additions and 51 deletions

View file

@ -4659,60 +4659,60 @@
</source>
</code>
<code>
<category>misc</category>
<category>lib</category>
<id>GCILoader</id>
<title lang="en-US">GCI Loader</title>
<author>sup39(サポミク)</author>
<version>0.1</version>
<date>Nov 11, 2022</date>
<version>0.2</version>
<date>Nov 16, 2022</date>
<description lang="en-US">
Execute Gecko code loaded from GCI file.
::: warning
You will need to reset the game if you hotplug your memory card
:::
Execute Gecko code loaded from GCI file.
::: warning
You will need to reset the game if you hotplug your memory card
:::
</description>
<source version="GMSJ01">
C21069F4 0000001C
9421FFF0 7C0802A6
BFC10008 7C9F2378
38800001 90010014
7C7E1B78 3D808010
618C7B50 7D8803A6
4E800021 2C030000
40820084 807E0000
C21069F4 00000021
9421FFE0 BF61000C
3FA0817F 63BDE800
3F80ABCD 813D0000
639C1234 7C7E1B78
7C09E000 7C9F2378
418200B8 3D208010
38800001 39297B50
7D2903A6 4E800421
2C030000 4082009C
3D20800A 39293CAC
807E0000 7FE5FB78
48000009 67637400
7C8802A6 7FE5FB78
3D80800A 618C3CAC
7D8803A6 4E800021
2C030000 40820058
38A00000 38C00000
60A5E000 3C80817F
7FE3FB78 3D80800A
618C4640 7D8803A6
4E800021 2C030000
40820018 3D20817F
3D40534D 6129DFFC
614A53FF 91490000
7FE3FB78 3D80800A
618C3E24 7D8803A6
4E800021 80010014
7FE4FB78 7FC3F378
83E1000C 83C10008
38210010 3D808010
618C72F4 7D8803A6
4E800021 00000000
C0000000 0000000C
3CA0803E 88A56008
28050004 4D800020
3CA0534D 60A553FF
3C608180 8003DFFC
7C002840 4C820020
3CA000D0 60A5C0DE
3C608180 8403B000
7C002840 4C820020
80030004 7C002840
4C820020 7C0F2214
9003FFFC 39E30008
7C8802A6 7D2903A6
4E800421 2C030000
40820070 3F60817F
3D20800A 39294640
637BA800 38C00000
38A04000 7F64DB78
7FE3FB78 7D2903A6
4E800421 2C030000
4082002C 813B0000
6D2AFF2F 2C0AC0DE
4082001C 3D40817F
614AA804 814A0000
7C0A4800 40A20008
939D0000 3D20800A
7FE3FB78 39293E24
7D2903A6 4E800421
3D208010 7FE4FB78
392972F4 7FC3F378
7D2903A6 4E800421
BB61000C 38210020
60000000 00000000
2C3E6008 00FF0300
217FE800 ABCD1234
C0000000 00000003
7C0F2214 3C608180
9403A7FC 39E3000C
7DE47850 4E800020
E0000000 00000000
</source>
</code>
</codes>

View file

@ -1,4 +1,9 @@
# Changelog
## Nov 16, 2022
- Add GCI+XXX as download format
- Add return code for GCI Loader
- Smaller GCI file (0xE000 bytes to 0x4000 bytes)
## Nov 11, 2022
- Add GCI Loader (NTSC-J 1.0 only)
- Support GCI as download format (NTSC-J 1.0 only)

View file

@ -86,6 +86,18 @@ export default {
this.alertDolphinCodeSize(codeSize);
this.generateCheatManagerTXT(c, fileName);
break;
case 'gci+gct':
this.generateGCI(c, fileName) &&
this.generateGCT(this.getGCILoader(), fileName);
break;
case 'gci+dolphin':
this.generateGCI(c, fileName) &&
this.generateDolphinINI(this.getGCILoader(), fileName);
break;
case 'gci+gcm':
this.generateGCI(c, fileName) &&
this.generateCheatManagerTXT(this.getGCILoader(), fileName);
break;
case 'gci':
this.generateGCI(c, fileName);
break;
@ -102,6 +114,11 @@ export default {
alert(translate('generatorconfig.alert.dolphin', this.$lang).replaceAll('{size}', size-16));
}
},
getGCILoader() {
const {codes} = gameVersions.find((v) => v.identifier === this.versionIdentifier);
const code = codes.find(code => code.id === 'GCILoader');
return [code];
},
generateGCT(codes, version) {
let code = '00D0C0DE00D0C0DE';
codes.forEach((c) => (code += c.source));
@ -150,15 +167,15 @@ export default {
generateGCI(codes, version) {
if (!['GMSJ01'].includes(version)) {
alert('GCI format is not yet supported for versions other than GMSJ01');
return;
return false; // error
}
let code = '00D0C0DE00D0C0DE';
codes.forEach((c) => (code += c.source));
code += 'F000000000000000';
code += 'C0000000000000023C60818081E3A7FC7DE478504E800020'; // return
const blockCount = 7; // TODO
const blockCount = 2; // TODO
const gciSize = 0x40+0x2000*blockCount;
const padSize = 0xB040; // TODO
const padSize = 0x40; // TODO
let rawData = new Uint8Array(gciSize);
for (let iD=padSize, iC=0; iD<rawData.length; iD++, iC+=2) {
@ -175,6 +192,7 @@ export default {
for (let i=0x3A; i<0x40; i++) rawData[i] = 0xff;
this.downloadFile(rawData, `01-${version.slice(0, 4)}-gct.gci`);
return true; // good
},
downloadFile(data, filename) {
var file = new Blob([data], {

View file

@ -11,6 +11,18 @@
"target": "gcm",
"i18nKey": "generatorconfig.downloadformat.options.gcm"
},
{
"target": "gci+gct",
"i18nKey": "generatorconfig.downloadformat.options.gci+gct"
},
{
"target": "gci+dolphin",
"i18nKey": "generatorconfig.downloadformat.options.gci+dolphin"
},
{
"target": "gci+gcm",
"i18nKey": "generatorconfig.downloadformat.options.gci+gcm"
},
{
"target": "gci",
"i18nKey": "generatorconfig.downloadformat.options.gci"

View file

@ -45,6 +45,9 @@
"gct": "GCT",
"dolphin": "Dolphin INI",
"gcm": "CheatManager TXT",
"gci+gct": "GCI + GCT",
"gci+dolphin": "GCI + Dolphin INI",
"gci+gcm": "GCI + CheatManager TXT",
"gci": "GCI"
}
},

View file

@ -45,6 +45,9 @@
"gct": "GCT",
"dolphin": "Dolphin INI",
"gcm": "CheatManager TXT",
"gci+gct": "GCI + GCT",
"gci+dolphin": "GCI + Dolphin INI",
"gci+gcm": "GCI + CheatManager TXT",
"gci": "GCI"
}
},

View file

@ -30,6 +30,9 @@
"gct": "GCT",
"dolphin": "Dolphin INI",
"gcm": "CheatManager TXT",
"gci+gct": "GCI + GCT",
"gci+dolphin": "GCI + Dolphin INI",
"gci+gcm": "GCI + CheatManager TXT",
"gci": "GCI"
}
}

View file

@ -30,6 +30,9 @@
"gct": "GCT",
"dolphin": "Dolphin INI",
"gcm": "CheatManager TXT",
"gci+gct": "GCI + GCT",
"gci+dolphin": "GCI + Dolphin INI",
"gci+gcm": "GCI + CheatManager TXT",
"gci": "GCI"
}
},