Skip to content

Commit

Permalink
split and move more data to src
Browse files Browse the repository at this point in the history
  • Loading branch information
SethBarberee committed Jan 4, 2025
1 parent 6d55198 commit 0b6ec9a
Show file tree
Hide file tree
Showing 6 changed files with 803 additions and 775 deletions.
630 changes: 0 additions & 630 deletions data/data_80B9BB8_2.s

Large diffs are not rendered by default.

603 changes: 603 additions & 0 deletions data/data_80CE77C.s

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
#if defined(__APPLE__) || defined(__CYGWIN__)
#define _(x) x
#define __(x) x
#define INCBIN_U8 {0}
#define INCBIN_U16 {0}
#define INCBIN_U32 {0}
#define INCBIN_S8 {0}
#define INCBIN_S16 {0}
#define INCBIN_S32 {0}
#define INCBIN(...) {0}
#define INCBIN_U8 INCBIN
#define INCBIN_U16 INCBIN
#define INCBIN_U32 INCBIN
#define INCBIN_S8 INCBIN
#define INCBIN_S16 INCBIN
#define INCBIN_S32 INCBIN
#define INCBIN_COMP INCBIN
#endif

// Prevent cross-jump optimization.
Expand Down
4 changes: 4 additions & 0 deletions ld_script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ SECTIONS {
src/code_800E9E4.o(.text);
src/code_800ED38.o(.text);
asm/code_800ED38.o(.text);
src/code_800F034.o(.text);
src/code_800F958.o(.text);
asm/code_800F990.o(.text);
src/code_8010EF0.o(.text);
Expand Down Expand Up @@ -428,6 +429,9 @@ SECTIONS {
src/main.o(.rodata);
src/reg_control.o(.rodata);
data/data_80B9BB8_2.o(.rodata);
src/code_800F034.o(.rodata);
src/code_800F958.o(.rodata);
data/data_80CE77C.o(.rodata);
src/debug.o(.rodata);
src/save.o(.rodata);
src/save_read.o(.rodata);
Expand Down
140 changes: 140 additions & 0 deletions src/code_800F034.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#include "global.h"
#include "globaldata.h"
#include <stdio.h>
#include "code_800E9E4.h"
#include "file_system.h"
#include "memory.h"

struct unkStruct_800F18C
{
s32 effectID;
u32 counter;
};

struct unkStruct_203B0D4
{
struct unkStruct_800F18C unk0[2];
};

struct unkStruct_203B0D4 *gUnknown_203B0D4;

ALIGNED(4) static const u8 gUnknown_80CE77C[] = "efob%03d";
ALIGNED(4) static const u8 gUnknown_80CE788[] = "efbg%03d";

extern struct FileArchive gEffectFileArchive;

void sub_800F034(void) {
s32 index;
if(gUnknown_203B0D4 == NULL)
{
gUnknown_203B0D4 = MemoryAlloc(sizeof(struct unkStruct_203B0D4), 0xB);
MemoryClear8(gUnknown_203B0D4, sizeof(struct unkStruct_203B0D4));
}
for(index = 0; index < 2; index++)
{
gUnknown_203B0D4->unk0[index].effectID = -1;
gUnknown_203B0D4->unk0[index].counter = 0;
}
}

void sub_800F078(void)
{
if(gUnknown_203B0D4)
{
MemoryFree(gUnknown_203B0D4);
gUnknown_203B0D4 = NULL;
}
}

void sub_800F094(void)
{
s32 index;
for(index = 0; index < 2; index++)
{
gUnknown_203B0D4->unk0[index].effectID = -1;
gUnknown_203B0D4->unk0[index].counter = 0;
}
}

s32 sub_800F0C0(s32 animType, s32 effectID)
{
if (animType == 3) {
if (gUnknown_203B0D4->unk0[0].effectID == effectID) return 0;
}
else {
if (gUnknown_203B0D4->unk0[1].effectID == effectID) return 1;
}
return -3;
}


s32 sub_800F0F4(s32 animType, s32 effectID)
{
if (animType == 3) {
if (gUnknown_203B0D4->unk0[0].effectID == effectID) return -2;
if (gUnknown_203B0D4->unk0[0].counter == 0) return 0;
}
else {
if (gUnknown_203B0D4->unk0[1].effectID == effectID) return -2;
if (gUnknown_203B0D4->unk0[1].counter == 0) return 1;
}
return -1;
}

void sub_800F13C(s32 index, OpenedFile *file, unkStruct_80B9CC4 * r2)
{
if(gUnknown_203B0D4->unk0[index].counter == 0)
gUnknown_203B0D4->unk0[index].effectID = r2->effectId;
}

void sub_800F15C(s32 effectID)
{
s32 index;

for(index = 0; index < 2; index++)
{
if(gUnknown_203B0D4->unk0[index].effectID == effectID)
{
gUnknown_203B0D4->unk0[index].counter++;
break;
}
}
}

struct unkStruct_800F18C *sub_800F18C(s32 index)
{
return &gUnknown_203B0D4->unk0[index];
}

s32 sub_800F19C(s32 index)
{
if(gUnknown_203B0D4->unk0[index].counter == 0)
return 0;
else
return 1;
}

OpenedFile * sub_800F1C0(u32 animType, s32 effectID)
{
u8 fileName [8];

switch(animType)
{
case 1:
case 2:
case 3:
sprintf(fileName,gUnknown_80CE77C,effectID); // efob
break;
case 4:
sprintf(fileName,gUnknown_80CE788,effectID); // efbg
break;

}
return Call_OpenFileAndGetFileDataPtr(fileName,&gEffectFileArchive);
}

void sub_800F204(OpenedFile *file)
{
CloseFile(file);
}

Loading

0 comments on commit 0b6ec9a

Please sign in to comment.