Merge pull request #407 from DizzyEggg/credits1

This commit is contained in:
Seth Barberee
2025-05-29 05:53:12 -07:00
committed by GitHub
6 changed files with 30 additions and 56 deletions

View File

@@ -1,7 +1,6 @@
#ifndef GUARD_CODE_8099360_H
#define GUARD_CODE_8099360_H
bool8 sub_8099360(u8 *);
bool8 sub_8099394(u8 *);
void sub_80993C0(bool8);
@@ -15,10 +14,13 @@ void sub_809965C(void);
extern void sub_8099690(u32);
// code_8099360.s
extern void sub_8099744(void);
extern void sub_8099750(void);
extern void sub_8099A5C(u32, u32, u32);
extern void sub_8099AFC(u32, u32, u32);
extern bool8 sub_8099B94(void);
#include "structs/str_3000400.h"
void sub_8099744(void);
void sub_8099750(void);
void sub_8099A5C(s32 a0, s32 a1, unkStruct_3000400 a2);
void sub_8099AFC(s32 a0, s32 a1, unkStruct_3000400 a2);
bool8 sub_8099B94(void);
#endif //GUARD_CODE_8099360_H

View File

@@ -0,0 +1,11 @@
#ifndef GUARD_STR_3000400_H
#define GUARD_STR_3000400_H
// TODO: Figure out if this is, in fact, the RGB struct. code_80035F0.s will tell us more once decompiled.
typedef struct unkStruct_3000400
{
// size: 0x4
u8 unk0[0x4];
} unkStruct_3000400;
#endif // GUARD_STR_3000400_H

View File

@@ -391,12 +391,8 @@ void sub_8099690(u32 param_1)
}
// TODO: figure out if a new file starts here...
typedef struct unkStruct_3000400
{
// size: 0x4
u8 unk0[0x4];
} unkStruct_3000400;
#include "structs/str_3000400.h"
#include "code_8099360.h"
extern void sub_8003810(u16 idx, unkStruct_3000400 param_2);
extern void sub_80039B8(void);

View File

@@ -11,7 +11,7 @@ EWRAM_INIT static Credits1Work *sCredits1Work = {NULL};
extern const WindowTemplate gUnknown_80E4A10;
extern const WindowTemplate gUnknown_80E4A28;
extern const u32 gUnknown_80E4A40[];
extern const unkStruct_3000400 gUnknown_80E4A40;
extern const CreditsData* gCreditsTable[27];
bool8 DrawCredits(s32 creditsCategoryIndex, s32 param_2)
@@ -79,29 +79,17 @@ bool8 DrawCredits(s32 creditsCategoryIndex, s32 param_2)
sub_80073E0(0);
SelectCharmap(0);
do {
const u32 *a = gUnknown_80E4A40;
int b = 9;
unsigned long long c = b;
sub_8099AFC(c, 0, a[0]);
} while(0);
sub_8099AFC(9, 0, gUnknown_80E4A40);
return TRUE;
}
s32 sub_8035574(void)
{
#ifdef NONMATCHING
u32 const *p;
#else
register u32 const *p asm("r2");
#endif
switch (sCredits1Work->unk60) {
case 0:
if (!sub_8099B94()) {
sCredits1Work->unk60 = 1;
p = gUnknown_80E4A40;
sub_8099A5C(9, 30, p[0]); // Probably same/similar macro from the above func - Kermalis
sub_8099A5C(9, 30, gUnknown_80E4A40);
}
break;
case 1:
@@ -111,8 +99,7 @@ s32 sub_8035574(void)
case 2:
if (sCredits1Work->unk64 < 1) {
sCredits1Work->unk60 = 3;
p = gUnknown_80E4A40;
sub_8099AFC(9, 30, p[0]);
sub_8099AFC(9, 30, gUnknown_80E4A40);
}
sCredits1Work->unk64--;
break;
@@ -125,8 +112,7 @@ s32 sub_8035574(void)
break;
case 4:
sub_8099690(0);
p = gUnknown_80E4A40;
sub_8099A5C(1, 0, p[0]);
sub_8099A5C(1, 0, gUnknown_80E4A40);
return 3;
}
return 0;

View File

@@ -1820,18 +1820,7 @@ s32 ExecuteScriptCommand(Action *action)
break;
}
case 0x27: case 0x28: {
// THANK YOU pidgey, only an array *inside* a struct works
// TODO: Define this struct globally, so it can be passed to sub_8099A5C and sub_8099AFC
// This kind of hackiness is used at all callsites (or they load from a global)
s32 color = ({
struct color { u8 arr[4]; } color = {{
curCmd.arg2 >> 16,
curCmd.arg2 >> 8,
curCmd.arg2,
0,
}};
*(s32*)&color;
});
unkStruct_3000400 color = { curCmd.arg2 >> 16, curCmd.arg2 >> 8, curCmd.arg2, 0 };
switch (curCmd.op) {
case 0x27:
sub_8099A5C(curCmd.argShort, curCmd.arg1, color);

View File

@@ -558,17 +558,7 @@ static void WigglytuffShop_GoToFallbackState(void)
static void sub_80226F0(void)
{
union {
vu32 a;
vu8 b[4];
} temp;
vu8 *ptr = temp.b;
u32 r2 = 0;
ptr[0] = 0x80;
ptr[1] = 0x80;
ptr[2] = 0x10;
ptr[3] = r2;
unkStruct_3000400 unkStr = {0x80, 0x80, 0x10, 0};
if (sub_8099B94())
return;
@@ -576,11 +566,11 @@ static void sub_80226F0(void)
switch (sWigglytuffShop3Work->unk130) {
case 1:
case 3:
sub_8099AFC(5, 2, temp.a);
sub_8099AFC(5, 2, unkStr);
break;
case 2:
case 4:
sub_8099A5C(5, 2, temp.a);
sub_8099A5C(5, 2, unkStr);
break;
case 0:
default: