Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragment35 #125

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ void func_8000D970(OSPfs *);
// exception_set.s
void set_watch_lohi(s32);

unsigned long long __ull_rshift(unsigned long long a0, unsigned long long a1);
unsigned long long __ull_rem(unsigned long long a0, unsigned long long a1);
unsigned long long __ull_div(unsigned long long a0, unsigned long long a1);
unsigned long long __ll_lshift(unsigned long long a0, unsigned long long a1);
long long __ll_rem(unsigned long long a0, long long a1);
long long __ll_div(long long a0, long long a1);
unsigned long long __ll_mul(unsigned long long a0, unsigned long long a1);
void __ull_divremi(unsigned long long* div, unsigned long long* rem, unsigned long long a2, unsigned short a3);
long long __ll_mod(long long a0, long long a1);
long long __ll_rshift(long long a0, long long a1);

#endif
2 changes: 1 addition & 1 deletion include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern Gfx* gDisplayListHead;
extern u64 _binary_assets_us_F3DEX2_bin_start[];

extern u8 D_1000000[];
extern u8 D_2000000[];
extern u8 D_3000000[];
extern u8 D_4000000[];
extern u8 D_4000008[];
Expand All @@ -61,7 +62,6 @@ extern u8 D_4001820[];
extern u8 D_5000000[];
extern u8 D_6000000[];
extern u8 D_8D000000[];

extern void* D_800AA688;


Expand Down
1 change: 1 addition & 0 deletions src/20470.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

void func_80020460(s32, s32, s32, s32, s32);
void func_8002053C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u8*, u8*);
void func_80021920(void);


#endif // _20470_H_
2 changes: 2 additions & 0 deletions src/22630.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#include "global.h"

void func_80021CA4(char*, u8);
void func_80023068(void);
s32 func_8002311C(s32);
void func_80024040(s16);
void func_800240A0(void);


#endif // _6BC0_H_
1 change: 1 addition & 0 deletions src/26820.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typedef struct unk_func_80027F24 {
void func_80026684(s32, s32);
void func_80027F24(unk_func_80027F24*);
void func_80027F40(unk_func_80027F24*);
void func_80028070(u16*);
void func_800280D4(s32);
void func_800284B4(s32);
void func_80028AFC(s32);
Expand Down
1 change: 1 addition & 0 deletions src/3D140.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "global.h"

void func_8003D68C(s32);
void func_8003D918(u32 arg0, u32 arg1);
void func_8003DB84(s32 arg0);
void func_80041A98(void);
Expand Down
109 changes: 103 additions & 6 deletions src/fragments/35/fragment35.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,108 @@
#include "global.h"
#include "fragment35.h"
#include "src/26820.h"
#include "src/22630.h"
#include "src/20470.h"
#include "src/2E110.h"
#include "src/3D140.h"
#include "src/3FB0.h"
#include "src/49790.h"
#include "src/4BA90.h"
#include "src/6A40.h"
#include "src/6BC0.h"
#include "src/memory.h"
#include "src/stage_loader.h"

#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/35/fragment35/func_82000020.s")
void func_82000020(void) {
s32 var_t4;
u8* var_t5;
u32 tmp = 0xF;

#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/35/fragment35/func_820002B4.s")
gDPPipeSync(gDisplayListHead++);
gDPSetCycleType(gDisplayListHead++, G_CYC_COPY);
gDPSetRenderMode(gDisplayListHead++, G_RM_NOOP, G_RM_NOOP2);
gDPSetTexturePersp(gDisplayListHead++, G_TP_NONE);
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240);
gDPPipeSync(gDisplayListHead++);

#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/35/fragment35/func_820002F0.s")
var_t5 = D_2000000;
for (var_t4 = 0x40; var_t4 < 0xB0; var_t4 += 0x10, var_t5 += 0x1000) {
gDPLoadTextureBlock(gDisplayListHead++, var_t5, G_IM_FMT_RGBA, G_IM_SIZ_16b, 128, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 7, 4, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(gDisplayListHead++, 0x0180, var_t4 << 2, 0x037C, (var_t4 + tmp) << 2, G_TX_RENDERTILE, 0, 0,
0x1000, 0x0400);
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/35/fragment35/func_8200036C.s")
gDPPipeSync(gDisplayListHead++);
gDPSetTextureConvert(gDisplayListHead++, G_TC_FILT);
}

#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/35/fragment35/func_820003A4.s")
s32 func_820002B4(UNUSED u8 arg0) {
func_800079C4();
func_8000699C(&gDisplayListHead, 1);
func_82000020();

return 0;
}

void func_820002F0(u64 arg0) {
u32 temp_ret = 0xF;

while (temp_ret < 0xF4240) {
temp_ret = __ull_div(__ll_mul(osGetTime() - arg0, 0x40), 0xBB8);
}
}

void func_8200036C(void) {
main_pool_push_state('GPAK');

func_800240A0();

main_pool_pop_state('GPAK');
}

s32 func_820003A4(UNUSED s32 arg0, UNUSED s32 arg1) {
u64 sp30;
unk_func_80007444* sp2C;
u16 sp2A;

main_pool_push_state('LOGO');

func_80005E40(0x10000, 0);
sp2C = func_80007444(0, 1, 2, 0, 2, 1);

ASSET_LOAD(D_1000000, _4BD6B0, 0);
ASSET_LOAD(D_2000000, _3B96B0, 0);

func_80028AFC(2);
func_80007678(sp2C);
func_80006C04(1);
func_80007820(3, func_820002B4);
func_8002D510();
func_80023068();
func_80021920();
func_80028070(&sp2A);

if (sp2A & 1) {
func_8004AF24(1);
} else {
func_8004AF24(0);
}

if (sp2A & 2) {
func_8003D68C(0);
} else {
func_8003D68C(1);
}

func_80048B90(0xA);
sp30 = osGetTime();
func_8200036C();
func_820002F0(sp30);
func_80006C04(0x10);
func_80007820(0x10, func_820002B4);
func_800076C0();
func_80005EAC();

main_pool_pop_state('LOGO');
return 2;
}
12 changes: 12 additions & 0 deletions src/fragments/35/fragment35.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _FRAGMENT35_H_
#define _FRAGMENT35_H_

#include "global.h"

void func_82000020(void);
s32 func_820002B4(UNUSED u8 arg0);
void func_820002F0(u64 arg0);
void func_8200036C(void);
s32 func_820003A4(UNUSED s32 arg0, UNUSED s32 arg1);

#endif // _FRAGMENT35_H_
Loading