mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-27 15:04:15 +01:00
Merge pull request #600 from vpelletier/trim_globals_unsure
SFM.ino: Get rid of write-only global variables
This commit is contained in:
commit
281a8251f0
@ -17,11 +17,11 @@
|
|||||||
byte sfmReady = 0;
|
byte sfmReady = 0;
|
||||||
|
|
||||||
// Arrays that hold game info
|
// Arrays that hold game info
|
||||||
int gameSize[8];
|
// int gameSize[8];
|
||||||
int saveSize[8];
|
// int saveSize[8];
|
||||||
byte gameAddress[8];
|
byte gameAddress[8];
|
||||||
byte gameVersion[8];
|
// byte gameVersion[8];
|
||||||
boolean hirom[8];
|
// boolean hirom[8];
|
||||||
|
|
||||||
/******************************************
|
/******************************************
|
||||||
Menu
|
Menu
|
||||||
@ -460,23 +460,23 @@ void getGames(char gameCode[8][20], boolean* hasMenu, byte* numGames) {
|
|||||||
for (int i = 0; i < *numGames; i++) {
|
for (int i = 0; i < *numGames; i++) {
|
||||||
// Read starting address and size
|
// Read starting address and size
|
||||||
gameAddress[i] = 0xC0 + readBank_SFM(0xC6, i * 0x2000 + 0x01) * 0x8;
|
gameAddress[i] = 0xC0 + readBank_SFM(0xC6, i * 0x2000 + 0x01) * 0x8;
|
||||||
gameSize[i] = readBank_SFM(0xC6, i * 0x2000 + 0x03) * 128;
|
// gameSize[i] = readBank_SFM(0xC6, i * 0x2000 + 0x03) * 128;
|
||||||
saveSize[i] = readBank_SFM(0xC6, i * 0x2000 + 0x05) / 8;
|
// saveSize[i] = readBank_SFM(0xC6, i * 0x2000 + 0x05) / 8;
|
||||||
|
|
||||||
//check if hirom
|
//check if hirom
|
||||||
if (readBank_SFM(gameAddress[i], 0xFFD5) == 0x31) {
|
// if (readBank_SFM(gameAddress[i], 0xFFD5) == 0x31) {
|
||||||
hirom[i] = true;
|
// hirom[i] = true;
|
||||||
} else if (readBank_SFM(gameAddress[i], 0xFFD5) == 0x21) {
|
// } else if (readBank_SFM(gameAddress[i], 0xFFD5) == 0x21) {
|
||||||
hirom[i] = true;
|
// hirom[i] = true;
|
||||||
} else {
|
// } else {
|
||||||
hirom[i] = false;
|
// hirom[i] = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (hirom[i]) {
|
// if (hirom[i]) {
|
||||||
gameVersion[i] = readBank_SFM(gameAddress[i], 0xFFDB);
|
// gameVersion[i] = readBank_SFM(gameAddress[i], 0xFFDB);
|
||||||
} else {
|
// } else {
|
||||||
gameVersion[i] = readBank_SFM(gameAddress[i], 0x7FDB);
|
// gameVersion[i] = readBank_SFM(gameAddress[i], 0x7FDB);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Read game code
|
// Read game code
|
||||||
byte myByte = 0;
|
byte myByte = 0;
|
||||||
@ -497,14 +497,14 @@ void getGames(char gameCode[8][20], boolean* hasMenu, byte* numGames) {
|
|||||||
*numGames = 1;
|
*numGames = 1;
|
||||||
//check if hirom
|
//check if hirom
|
||||||
if (readBank_SFM(0xC0, 0xFFD5) == 0x31) {
|
if (readBank_SFM(0xC0, 0xFFD5) == 0x31) {
|
||||||
hirom[0] = true;
|
// hirom[0] = true;
|
||||||
base = 0xFF00;
|
base = 0xFF00;
|
||||||
} else {
|
} else {
|
||||||
hirom[0] = false;
|
// hirom[0] = false;
|
||||||
base = 0x7F00;
|
base = 0x7F00;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameVersion[0] = readBank_SFM(0xC0, base + 0xDB);
|
// gameVersion[0] = readBank_SFM(0xC0, base + 0xDB);
|
||||||
gameCode[0][0] = 'G';
|
gameCode[0][0] = 'G';
|
||||||
gameCode[0][1] = 'A';
|
gameCode[0][1] = 'A';
|
||||||
gameCode[0][2] = 'M';
|
gameCode[0][2] = 'M';
|
||||||
@ -515,7 +515,7 @@ void getGames(char gameCode[8][20], boolean* hasMenu, byte* numGames) {
|
|||||||
gameCode[0][7] = readBank_SFM(0xC0, base + 0xB4);
|
gameCode[0][7] = readBank_SFM(0xC0, base + 0xB4);
|
||||||
gameCode[0][8] = readBank_SFM(0xC0, base + 0xB5);
|
gameCode[0][8] = readBank_SFM(0xC0, base + 0xB5);
|
||||||
gameCode[0][9] = '\0';
|
gameCode[0][9] = '\0';
|
||||||
gameSize[0] = 1 << (readBank_SFM(0xC0, base + 0xD7) - 7);
|
// gameSize[0] = 1 << (readBank_SFM(0xC0, base + 0xD7) - 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user