From 9dfd0ec905b1155c9166a1ed54acde43371d3cdf Mon Sep 17 00:00:00 2001 From: Bobby Lovell Date: Thu, 16 Nov 2023 21:11:31 -0500 Subject: [PATCH] Add the main unlock hacks --- src/game/gamefile.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/game/gamefile.c b/src/game/gamefile.c index d8d36474e..fba27901a 100644 --- a/src/game/gamefile.c +++ b/src/game/gamefile.c @@ -567,3 +567,57 @@ void gamefileGetOverview(char *arg0, char *name, u8 *stage, u8 *difficulty, u32 *difficulty = savebufferReadBits(&buffer, 2); } + +#ifndef PLATFORM_N64 +// Unlock all of the unlockables. +// These hacks are taken from the original debug mode. +void gamefileUnlockEverything(void) +{ + s32 i, j; + + // unlock all challenges + for (i = 0; i < ARRAYCOUNT(g_MpChallenges); ++i) { + for (j = 0; j < MAX_PLAYERS; ++j) { + g_MpChallenges[i].completions[j] = 0x0f; + } + } + challengeDetermineUnlockedFeatures(); + + // complete all missions in coop + for (i = 0; i < ARRAYCOUNT(g_GameFile.coopcompletions); ++i) { + g_GameFile.coopcompletions[i] = 0x1fffff; + } + + // unlock all guns + for (i = 0; i < ARRAYCOUNT(g_GameFile.weaponsfound); ++i) { + g_GameFile.weaponsfound[i] = 0xff; + } + + // unlock all campaign levels + for (i = 0; i < NUM_SOLOSTAGES; i++) { + for (j = 0; j < 3; j++) { + g_GameFile.besttimes[i][j] = 7; + } + } + + // unlock alternate intro sequence + g_AltTitleUnlocked = true; + + // unlock all firing range challenges + for (i = 0; i < ARRAYCOUNT(g_GameFile.firingrangescores); ++i) { + g_GameFile.firingrangescores[i] = 0xff; + } + + // unlock all device training + gamefileSetFlag(GAMEFILEFLAG_CI_CLOAK_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_DISGUISE_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_XRAY_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_IR_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_RTRACKER_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_DOORDECODER_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_NIGHTVISION_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_CAMSPY_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_ECMMINE_DONE); + gamefileSetFlag(GAMEFILEFLAG_CI_UPLINK_DONE); +} +#endif