mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Dump last 32MB from certain GBA Video ROMs
This commit is contained in:
parent
864a350b10
commit
3bf8f17b7c
@ -46,6 +46,7 @@ Once everything is downloaded and installed, `git clone` this repository, naviga
|
||||
* [Evie/Pk11](https://github.com/Epicpkmn11): Contributor.
|
||||
* [zacchi4k](https://github.com/zacchi4k): Logo designer.
|
||||
* [Edo9300](https://github.com/edo9300): Save reading code from his save manager tool.
|
||||
* [endrift](https://github.com/endrift): GBA ROM dumping code from [duplo](https://github.com/endrift/duplo), used for 64MB ROMs.
|
||||
* [JimmyZ](https://github.com/JimmyZ): NAND code from twlnf (with writing code stripped for safety reasons).
|
||||
* [zoogie](https://github.com/zoogie): ConsoleID code (originating from dumpTool).
|
||||
* [devkitPro](https://github.com/devkitPro): devkitARM, libnds, original nds-hb-menu code, and screenshot code.
|
||||
|
||||
@ -466,6 +466,21 @@ void ndsCardDump(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void writeChange(const u32* buffer) {
|
||||
// Input registers are at 0x08800000 - 0x088001FF
|
||||
*(vu32*) 0x08800184 = buffer[1];
|
||||
*(vu32*) 0x08800188 = buffer[2];
|
||||
*(vu32*) 0x0880018C = buffer[3];
|
||||
|
||||
*(vu32*) 0x08800180 = buffer[0];
|
||||
}
|
||||
|
||||
void readChange(void) {
|
||||
// Output registers are at 0x08800100 - 0x088001FF
|
||||
while (*(vu32*) 0x08000180 & 0x1000); // Busy bit
|
||||
}
|
||||
|
||||
void gbaCartDump(void) {
|
||||
int pressed = 0;
|
||||
|
||||
@ -553,8 +568,29 @@ void gbaCartDump(void) {
|
||||
// Dump!
|
||||
remove(destPath);
|
||||
FILE* destinationFile = fopen(destPath, "wb");
|
||||
fwrite((void*)0x08000000, 1, romSize, destinationFile);
|
||||
fwrite(GBAROM, 1, romSize, destinationFile);
|
||||
fclose(destinationFile);
|
||||
// Check for 64MB GBA Video ROM
|
||||
if (strncmp((char*)0x080000AC, "MSAE", 4)==0 // Shark Tale
|
||||
|| strncmp((char*)0x080000AC, "MSKE", 4)==0 // Shrek
|
||||
|| strncmp((char*)0x080000AC, "M2SE", 4)==0 // Shrek 2
|
||||
) {
|
||||
// Dump last 32MB
|
||||
u32 cmd[4] = {
|
||||
0x11, // Command
|
||||
0, // ROM address
|
||||
0x08001000, // Virtual address
|
||||
0x8, // Size (in 0x200 byte blocks)
|
||||
};
|
||||
|
||||
size_t i;
|
||||
for (i = 0x02000000; i < 0x04000000; i += 0x1000) {
|
||||
cmd[1] = i,
|
||||
writeChange(cmd);
|
||||
readChange();
|
||||
fwrite(GBAROM + (0x1000 >> 1), 0x1000, 1, destinationFile);
|
||||
}
|
||||
}
|
||||
// Save file
|
||||
remove(destSavPath);
|
||||
destinationFile = fopen(destSavPath, "wb");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user