Attempt to decompile cheatIsUnlocked

This commit is contained in:
Ryan Dwyer 2019-12-26 22:29:39 +10:00
parent da45377c7c
commit 355d52c035
5 changed files with 46 additions and 33 deletions

View File

@ -107,6 +107,46 @@ glabel cheatIsUnlocked
/* f106e60: 00000000 */ sll $zero,$zero,0x0
);
// Mismatch due to incorrect jump address for g_BestTimes.
// It appears to be in a struct that starts 0x20 earlier, but this means other
// variables like g_EepromFlags are in the struct too. Resolving this will be
// done separately.
//bool cheatIsUnlocked(s32 cheat_id)
//{
// struct cheatspec *spec = &g_CheatSpecs[cheat_id];
// bool unlocked = false;
//
// if (spec->method & CHEATMETHOD_FIRINGRANGE) {
// if (func0f19cf20(spec->time)) {
// unlocked = true;
// }
// } else if (spec->method & CHEATMETHOD_COMPLETE) {
// if (g_BestTimes[spec->stage_index * 3]) {
// unlocked++;
// }
// if (g_BestTimes[spec->stage_index * 3 + 1]) {
// unlocked++;
// }
// if (g_BestTimes[spec->stage_index * 3 + 2]) {
// unlocked++;
// }
// } else {
// s32 mytime = g_BestTimes[spec->stage_index * 3 + spec->difficulty];
//
// if (mytime && mytime <= spec->time) {
// unlocked = true;
// }
// }
//
// if (spec->method & CHEATMETHOD_TRANSFERPAK) {
// if (eepromGet(0x23)) {
// unlocked++;
// }
// }
//
// return unlocked;
//}
bool cheatIsEnabled(s32 cheat_id)
{
if (cheat_id < 32) {

View File

@ -21322,38 +21322,9 @@ u32 g_EepromFlags = 0;
u32 var800a2218 = 0;
u32 var800a221c = 0;
u32 var800a2220 = 0;
u32 var800a2224 = 0;
u32 var800a2228 = 0;
u32 var800a222c = 0;
u32 var800a2230 = 0;
u32 var800a2234 = 0;
u32 var800a2238 = 0;
u32 var800a223c = 0;
u32 var800a2240 = 0;
u32 var800a2244 = 0;
u32 var800a2248 = 0;
u32 var800a224c = 0;
u32 var800a2250 = 0;
u32 var800a2254 = 0;
u32 var800a2258 = 0;
u32 var800a225c = 0;
u32 var800a2260 = 0;
u32 var800a2264 = 0;
u32 var800a2268 = 0;
u32 var800a226c = 0;
u32 var800a2270 = 0;
u32 var800a2274 = 0;
u32 var800a2278 = 0;
u32 var800a227c = 0;
u32 var800a2280 = 0;
u32 var800a2284 = 0;
u32 var800a2288 = 0;
u32 var800a228c = 0;
u32 var800a2290 = 0;
u32 var800a2294 = 0;
u32 var800a2298 = 0;
u32 var800a229c = 0;
u16 g_BestTimes[63] = {0};
u32 var800a22a0 = 0;
u32 var800a22a4 = 0;
u32 var800a22a8 = 0;

View File

@ -337,6 +337,7 @@
#define DOORSTATEBIT_CLOSING 4
#define DOORSTATEBIT_OPENING 8
#define EEPROMFLAG_USED_TRANSFERPAK 0x23
#define EEPROMFLAG_CI_TOUR_DONE 0x24
#define EEPROMFLAG_CI_HOLO7_DONE 0x29
#define EEPROMFLAG_CI_HOLO6_DONE 0x2a

View File

@ -13,7 +13,7 @@ u32 func0f19cbcc(void);
u32 func0f19cc50(void);
u32 func0f19ccc0(void);
u32 func0f19cdf0(void);
u32 func0f19cf20(void);
s32 func0f19cf20(s32 stage_index); // firing range related
u32 func0f19d250(void);
u32 func0f19d25c(void);
u32 func0f19d268(void);

View File

@ -703,6 +703,7 @@ extern u32 var800a2200;
extern u32 var800a2204;
extern u32 var800a2208;
extern u32 var800a220c;
extern u16 g_BestTimes[];
extern u32 var800a22c0;
extern u32 var800a22d0;
extern u32 var800a2330;