Attempt to decompile func0f19b540

This commit is contained in:
Ryan Dwyer 2020-01-05 12:53:49 +10:00
parent 7ecbfac128
commit 17cb46d612
6 changed files with 56 additions and 14 deletions

View File

@ -7099,7 +7099,7 @@ s32 menuhandlerMpSimulantSlot(u32 operation, struct menu_item *item, s32 *value)
case MENUOP_SET:
g_MenuStack[g_MpPlayerNum].slotindex = item->param;
if ((g_MpSetup.simslots & (1 << (item->param + 4))) == 0) {
if ((g_MpSetup.chrslots & (1 << (item->param + 4))) == 0) {
menuPushDialog(&g_MpAddSimulantMenuDialog);
} else if (var80090af0 == 1) {
menuPushDialog(&menudialog_1b414);

View File

@ -2155,6 +2155,46 @@ glabel func0f19b540
/* f19b660: 00000000 */ sll $zero,$zero,0x0
);
// Mismatch because it's doing something weird with the chrslots, and also
// writing to negative mpsim offsets. This code below might not be functionally
// identical.
//void func0f19b540(void)
//{
// if (var800acc10 == 5) {
// s32 slot = 0;
// s32 i;
// u32 *ptr;
//
// for (i = 0; i < 4; i++) {
// if (g_MpSetup.chrslots & (1 << i)) {
// g_MpChrs[i].unk9d = 0x80;
// slot++;
// }
// }
//
// g_MpSetup.chrslots &= 0x000f;
// ptr = &var800ac798[slot];
//
// for (i = 0; i != 8; i++) {
// g_MpSimulants[i].unk48 = *(ptr - 1);
//
// if (*(ptr - 1) != 6) {
// g_MpSetup.chrslots |= 1 << (i + 4);
// }
//
// ptr++;
// }
//
// if (g_MpSetup.scenario == MPSCENARIO_KINGOFTHEHILL) {
// g_Vars.mphilltime = 10;
// }
// } else {
// if (!mpIsChallengeComplete(CHALLENGE_UNK64)) {
// g_MpSetup.chrslots &= 0x00ff;
// }
// }
//}
s32 mpGetNumAvailableChallenges(void)
{
s32 challengeindex;

View File

@ -30637,14 +30637,7 @@ u32 var800ac52c = 0;
u32 var800ac530 = 0;
u32 var800ac534 = 0;
struct mpsim g_MpSimulants[8] = {0};
u32 var800ac798 = 0;
u32 var800ac79c = 0;
u32 var800ac7a0 = 0;
u32 var800ac7a4 = 0;
u32 var800ac7a8 = 0;
u32 var800ac7ac = 0;
u32 var800ac7b0 = 0;
u32 var800ac7b4 = 0;
u32 var800ac798[8] = {0};
struct mpchr g_MpChrs[4] = {0};
u32 var800aca38 = 0;
u32 var800aca3c = 0;

View File

@ -27,7 +27,7 @@ u32 func0f19ab70(void);
u32 func0f19af3c(void);
bool mpIsChallengeAvailable(s32 challengeindex);
void func0f19afdc(void);
u32 func0f19b540(void);
void func0f19b540(void);
s32 mpGetNumAvailableChallenges(void);
char *mpChallengeGetName(s32 challengeindex);
u32 func0f19b6f8(void);

View File

@ -844,7 +844,7 @@ extern u32 var800ac4d0;
extern u32 var800ac500;
extern u32 var800ac530;
extern struct mpsim g_MpSimulants[8];
extern u32 var800ac798;
extern u32 var800ac798[8];
extern struct mpchr g_MpChrs[];
extern u32 var800aca38;
extern u32 var800acad8;

View File

@ -3998,7 +3998,7 @@ struct mpchr {
/*0x94*/ u8 unk94;
/*0x95*/ u8 title;
/*0x98*/ u32 unk98;
/*0x9c*/ u32 unk9c;
/*0x9c*/ u8 unk9c;
};
struct missionconfig {
@ -4029,7 +4029,16 @@ struct mpsetup {
/*0x8009cb9a*/ u8 timelimit;
/*0x8009cb9b*/ u8 scorelimit;
/*0x8009cb9c*/ u16 teamscorelimit;
/*0x8009cb9e*/ u16 simslots;
/**
* Each bit signifies that a player or sim is participating.
*
* Bits 0x000f are for players
* Bits 0x0ff0 are for sims
* Bits 0xf000 are probably not used
*/
/*0x8009cb9e*/ u16 chrslots;
/*0x8009cba0*/ u32 unk18;
/*0x8009cba4*/ u32 unk1c;
/*0x8009cba8*/ bool saved;
@ -4085,7 +4094,7 @@ struct mpsim {
/*0x3c*/ u32 unk3c;
/*0x40*/ u32 unk40;
/*0x44*/ u32 unk44;
/*0x48*/ u32 unk48;
/*0x48*/ u8 unk48;
};
struct savelocation {