ogrebattle64/src/main.c

308 lines
7.5 KiB
C

#include "common.h"
#include "libmus.h"
INCLUDE_ASM(const s32, "main", func_80070C60);
INCLUDE_ASM(const s32, "main", AddHeap);
INCLUDE_ASM(const s32, "main", func_80070F14);
INCLUDE_ASM(const s32, "main", __virtual_mem_alloc);
INCLUDE_ASM(const s32, "main", func_800710DC);
INCLUDE_ASM(const s32, "main", func_80071288);
INCLUDE_ASM(const s32, "main", func_800712C4);
INCLUDE_ASM(const s32, "main", func_800713EC);
INCLUDE_ASM(const s32, "main", HIsAllocatedPointer);
INCLUDE_ASM(const s32, "main", func_80071634);
INCLUDE_ASM(const s32, "main", func_8007163C);
INCLUDE_ASM(const s32, "main", func_80071644);
INCLUDE_ASM(const s32, "main", func_80071950);
INCLUDE_ASM(const s32, "main", func_800719E8);
INCLUDE_ASM(const s32, "main", func_80071A3C);
INCLUDE_ASM(const s32, "main", func_80071A74);
INCLUDE_ASM(const s32, "main", func_80071B9C);
INCLUDE_ASM(const s32, "main", func_80071C04);
INCLUDE_ASM(const s32, "main", func_80071E74);
INCLUDE_ASM(const s32, "main", obMain);
INCLUDE_ASM(const s32, "main", func_80072398);
INCLUDE_ASM(const s32, "main", func_80072710);
INCLUDE_ASM(const s32, "main", __set_vi_mode);
INCLUDE_ASM(const s32, "main", func_800727D8);
extern u8 D_800AEF9A;
extern OSContPad __GLOBAL_CONTROLLER_DATA;
void func_8007284C(u16 __unused) {
const u16 pattern_a = CONT_A | CONT_B | CONT_L | CONT_START;
const u16 pattern_b = CONT_A | CONT_B | CONT_G | CONT_START;
if ((D_800AEF9A & 1) && !(D_800AEF9A & 4)) {
if (D_800AEF9A & 2) {
if (__GLOBAL_CONTROLLER_DATA.button == 0) {
D_800AEF9A = D_800AEF9A & 0xFD;
}
} else if (__GLOBAL_CONTROLLER_DATA.button == pattern_a ||
__GLOBAL_CONTROLLER_DATA.button == pattern_b) {
D_800AEF9A = D_800AEF9A | 6;
}
}
}
u8 func_800728BC(void) {
s32 mask;
u8 temp_s0;
mask = osSetIntMask(OS_IM_NONE);
temp_s0 = D_800AEF9A | 1;
D_800AEF9A = temp_s0;
osSetIntMask(mask);
return temp_s0;
}
u8 func_80072900(void) {
s32 mask;
u8 temp_s0;
mask = osSetIntMask(OS_IM_NONE);
temp_s0 = D_800AEF9A & 0xFA;
D_800AEF9A = temp_s0;
osSetIntMask(mask);
return temp_s0;
}
s32 func_80072944(void) {
u8 temp_s0;
s32 mask;
mask = osSetIntMask(OS_IM_NONE);
temp_s0 = D_800AEF9A;
osSetIntMask(mask);
return temp_s0 & 4;
}
INCLUDE_ASM(const s32, "main", __calls_copy_controller_data);
extern u8 __reset_compared_osTvType(); /* extern */
extern void* D_800C4BB8;
#define OS_TV_TYPE_PAL 0
#define OS_TV_TYPE_NTSC 1
#define OS_TV_TYPE_MPAL 2
/* 347C 8007307C */
void __calls_osViSwapBuffer_8007307C(void** buffers)
{
u8 prev;
D_800C4BB8 = buffers[3];
prev = __reset_compared_osTvType();
if (prev == OS_TV_TYPE_MPAL)
{
switch(osTvType)
{
case OS_TV_TYPE_NTSC:
osViSetMode(&osViModeNtscHpf1);
break;
case OS_TV_TYPE_MPAL:
osViSetMode(&osViModeMpalHpf1);
break;
}
}
else if (prev == OS_TV_TYPE_NTSC)
{
if (osTvType == prev) goto ntsc;
if(osTvType == OS_TV_TYPE_MPAL) goto pal;
goto next;
ntsc:
osViSetMode(&osViModeNtscLan1);
goto next;
pal:
osViSetMode(&osViModeMpalLan1);
goto next;
}
next:
if (prev != OS_TV_TYPE_PAL)
osViSetSpecialFeatures(OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF);
osViSwapBuffer(buffers[3]);
}
/* 3564 80073164 */
void func_80073164(u8 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6) {
if (arg0 == 0) {
if ((arg1 << 0x10) >= 0) {
D_800C4C08 = arg1;
}
if ((arg2 << 0x10) >= 0) {
D_800E7D68 = arg2;
}
if ((arg3 << 0x10) >= 0) {
D_800C4A18 = arg3;
}
if ((arg4 << 0x10) >= 0) {
D_800E7A1C = arg4;
}
if ((arg5 << 0x10) >= 0) {
D_800C4BCA = arg5;
}
if ((arg6 << 0x10) >= 0) {
D_800C4AD8 = arg6;
}
} else {
D_800C4C08 += arg1;
D_800E7D68 += arg2;
D_800C4A18 += arg3;
D_800E7A1C += arg4;
D_800C4BCA += arg5;
D_800C4AD8 += arg6;
}
D_800AEE72 = 2;
}
/* 368C 8007328C */
void func_8007328C(void) {
s32 index;
for(index = 0; index < 2; index++) {
func_800712C4(D_800A81C0[index].field_0x0);
func_800712C4(D_800A81C0[index].field_0x4);
func_800712C4(D_800A81C0[index].field_0x8);
func_800712C4(D_800A81C0[index].field_0xc);
func_800712C4(D_800A81C0[index].field_0x10);
func_800712C4(D_800A81C0[index].field_0x14);
}
D_800C4C08 = 0;
D_800E7D68 = 0;
D_800C4A18 = 0;
D_800E7A1C = 0;
D_800C4BCA = 0;
D_800C4AD8 = 0;
D_800AEE72 = 2;
bzero(&D_800A81C0, 0x30);
D_800A81F0 = 0;
}
INCLUDE_ASM(const s32, "main", func_8007337C);
INCLUDE_ASM(const s32, "main", func_8007338C);
INCLUDE_ASM(const s32, "main", func_80073398);
INCLUDE_ASM(const s32, "main", func_800733F8);
/* 3BA0 800737A0 */
void func_800737A0(void) {
gDPPipeSync(obPtrDisplayList++);
gSPSegment(obPtrDisplayList++, 0, 0);
gDPPipeSync(obPtrDisplayList++);
gSPDisplayList(obPtrDisplayList++, DISPLAY_LIST_80186E70);
gSPDisplayList(obPtrDisplayList++, DISPLAY_LIST_801869C8);
}
INCLUDE_ASM(const s32, "main", func_8007382C);
INCLUDE_ASM(const s32, "main", func_80073AE4);
/* 3FD0 80073BD0 */
void func_80073BD0(void) {
osViSetSpecialFeatures(OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF);
gDPPipeSync(obPtrDisplayList++);
gDPSetColorDither(obPtrDisplayList++, G_CD_MAGICSQ);
gDPSetAlphaDither(obPtrDisplayList++, G_AD_DISABLE);
}
INCLUDE_ASM(const s32, "main", func_80073C48);
INCLUDE_ASM(const s32, "main", func_80073CB0);
extern s32 D_800A81F4;
extern s32 D_800A81F8;
extern s32 D_800C4BCC;
/* 42D8 80073ED8 */
void func_80073ED8(void) {
if (D_800A81F4 == 0) {
__MAYBE_SONG_800EB0B0.field_0x2c = 0;
__MAYBE_SONG_800EB100.field_0x2c = 0;
__MAYBE_SONG_800EB150.field_0x2c = 0;
__MAYBE_SONG_800EB1A0.field_0x2c = 0;
__MAYBE_SONG_800EB1F0.field_0x2c = 0;
__MAYBE_SONG_800EB240.field_0x2c = 0;
__MAYBE_SONG_800EB290.field_0x2c = 0;
MusStop(MUSFLAG_SONGS | MUSFLAG_EFFECTS, 12);
D_800A81F4 = 12;
D_800A81F8 = D_800C4BCC;
}
}
INCLUDE_ASM(const s32, "main", func_80073F58);
/* 43D4 80073FD4 */
void __initialize_song_mem(void) {
s32 mask;
s32 count;
mask = osSetIntMask(OS_IM_NONE);
for(count = 0; count < 7; count++) {
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x2c = 0;
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x30 = 0;
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x34 = 0;
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x38 = 0;
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x3c = 0;
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x40 = 0;
__MAYBE_SONG_ARRAY_800A8218[count]->field_0x4c = 0;
}
osSetIntMask(mask);
}
INCLUDE_ASM(const s32, "main", func_80074050);
INCLUDE_ASM(const s32, "main", func_80074080);
INCLUDE_ASM(const s32, "main", func_800740F0);
INCLUDE_ASM(const s32, "main", func_800741A8);
INCLUDE_ASM(const s32, "main", func_8007422C);
INCLUDE_ASM(const s32, "main", func_800742F4);
INCLUDE_ASM(const s32, "main", func_80074494);