Skip to content

Commit

Permalink
port: move unlock everything option to cheats
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Nov 24, 2023
1 parent 5a68daf commit 45a44cd
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 85 deletions.
85 changes: 0 additions & 85 deletions port/src/optionsmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,83 +1073,6 @@ static MenuItemHandlerResult menuhandlerOpenBindsMenu(s32 operation, struct menu
return 0;
}

static MenuItemHandlerResult menuhandlerUnlockEverything(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
gamefileUnlockEverything();
}
return 0;
}

struct menuitem g_ConfirmUnlockMenuItems[] = {
{
MENUITEMTYPE_LABEL,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Are you sure?\n\nThis will overwrite any progress\nsaved to the current profile.\n",
0,
NULL,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0x00000082,
0,
NULL,
},
{
MENUITEMTYPE_MARQUEE,
0,
MENUITEMFLAG_SMALLFONT | MENUITEMFLAG_MARQUEE_FADEBOTHSIDES | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Unlocks all cheats, weapons, missions, challenges and combat simulator items.\n",
0,
NULL,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0x00000082,
0,
NULL,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
L_OPTIONS_191, // "No"
0,
NULL,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
L_OPTIONS_190, // "Yes"
0,
menuhandlerUnlockEverything,
},
{ MENUITEMTYPE_END },
};

struct menudialogdef g_ConfirmUnlockMenuDialog = {
MENUDIALOGTYPE_DANGER,
L_OPTIONS_188, // "Warning"
g_ConfirmUnlockMenuItems,
NULL,
0,
NULL,
};

static MenuItemHandlerResult menuhandlerUnlockEverythingPrompt(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
menuPushDialog(&g_ConfirmUnlockMenuDialog);
}
return 0;
}

struct menuitem g_ExtendedMenuItems[] = {
{
MENUITEMTYPE_SELECTABLE,
Expand Down Expand Up @@ -1191,14 +1114,6 @@ struct menuitem g_ExtendedMenuItems[] = {
0,
menuhandlerOpenBindsMenu,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Unlock Everything\n",
0,
menuhandlerUnlockEverythingPrompt,
},
{
MENUITEMTYPE_SEPARATOR,
0,
Expand Down
83 changes: 83 additions & 0 deletions src/game/cheats.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,79 @@ char *cheatGetName(s32 cheat_id)
}
#endif

#ifndef PLATFORM_N64

static MenuItemHandlerResult menuhandlerUnlockEverything(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
gamefileUnlockEverything();
}
return 0;
}

struct menuitem g_CheatsConfirmUnlockMenuItems[] = {
{
MENUITEMTYPE_LABEL,
0,
MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Are you sure?\n\nThis will overwrite any progress\nsaved to the current profile.\n",
0,
NULL,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0x00000082,
0,
NULL,
},
{
MENUITEMTYPE_MARQUEE,
0,
MENUITEMFLAG_SMALLFONT | MENUITEMFLAG_MARQUEE_FADEBOTHSIDES | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"Unlocks all cheats, weapons, missions, challenges and combat simulator items.\n",
0,
NULL,
},
{
MENUITEMTYPE_SEPARATOR,
0,
0,
0x00000082,
0,
NULL,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
L_OPTIONS_191, // "No"
0,
NULL,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
L_OPTIONS_190, // "Yes"
0,
menuhandlerUnlockEverything,
},
{ MENUITEMTYPE_END },
};

struct menudialogdef g_CheatsConfirmUnlockMenuDialog = {
MENUDIALOGTYPE_DANGER,
L_OPTIONS_188, // "Warning"
g_CheatsConfirmUnlockMenuItems,
NULL,
0,
NULL,
};

#endif

struct menuitem g_CheatsFunMenuItems[] = {
{
MENUITEMTYPE_CHECKBOX,
Expand Down Expand Up @@ -1538,6 +1611,16 @@ struct menuitem g_CheatsMenuItems[] = {
0,
cheatMenuHandleTurnOffAllCheats,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_SELECTABLE_OPENSDIALOG,
(uintptr_t)"Unlock Everything\n",
0,
(void *)&g_CheatsConfirmUnlockMenuDialog,
},
#endif
{
MENUITEMTYPE_SEPARATOR,
0,
Expand Down
2 changes: 2 additions & 0 deletions src/game/gamefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ void gamefileGetOverview(char *arg0, char *name, u8 *stage, u8 *difficulty, u32
}

#ifndef PLATFORM_N64

// Unlock all of the unlockables.
// These hacks are taken from the original debug mode.
void gamefileUnlockEverything(void)
Expand Down Expand Up @@ -620,4 +621,5 @@ void gamefileUnlockEverything(void)
gamefileSetFlag(GAMEFILEFLAG_CI_ECMMINE_DONE);
gamefileSetFlag(GAMEFILEFLAG_CI_UPLINK_DONE);
}

#endif

0 comments on commit 45a44cd

Please sign in to comment.