mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
42e0
This commit is contained in:
parent
6dcb5d8b4b
commit
b8edd71cd8
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -30,6 +30,7 @@
|
||||
},
|
||||
"files.associations": {
|
||||
"*.tcc": "c",
|
||||
"ratio": "c"
|
||||
"ratio": "c",
|
||||
"vector": "c"
|
||||
},
|
||||
}
|
||||
|
20
asm/nonmatchings/code_42e0_len_1f60/_heap_create.s
generated
20
asm/nonmatchings/code_42e0_len_1f60/_heap_create.s
generated
@ -1,20 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel _heap_create
|
||||
/* 4430 80029030 2CA20020 */ sltiu $v0, $a1, 0x20
|
||||
/* 4434 80029034 1440000B */ bnez $v0, .L80029064
|
||||
/* 4438 80029038 2482000F */ addiu $v0, $a0, 0xf
|
||||
/* 443C 8002903C 2403FFF0 */ addiu $v1, $zero, -0x10
|
||||
/* 4440 80029040 00431024 */ and $v0, $v0, $v1
|
||||
/* 4444 80029044 00441823 */ subu $v1, $v0, $a0
|
||||
/* 4448 80029048 00A32823 */ subu $a1, $a1, $v1
|
||||
/* 444C 8002904C 24A3FFF0 */ addiu $v1, $a1, -0x10
|
||||
/* 4450 80029050 AC400000 */ sw $zero, ($v0)
|
||||
/* 4454 80029054 AC430004 */ sw $v1, 4($v0)
|
||||
/* 4458 80029058 A4400008 */ sh $zero, 8($v0)
|
||||
/* 445C 8002905C 03E00008 */ jr $ra
|
||||
/* 4460 80029060 AC45000C */ sw $a1, 0xc($v0)
|
||||
.L80029064:
|
||||
/* 4464 80029064 03E00008 */ jr $ra
|
||||
/* 4468 80029068 2402FFFF */ addiu $v0, $zero, -1
|
27
asm/nonmatchings/code_42e0_len_1f60/func_80028F8C.s
generated
27
asm/nonmatchings/code_42e0_len_1f60/func_80028F8C.s
generated
@ -1,27 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel func_80028F8C
|
||||
/* 438C 80028F8C 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 4390 80028F90 3C028007 */ lui $v0, %hi(gGameStatusPtr)
|
||||
/* 4394 80028F94 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0)
|
||||
/* 4398 80028F98 3C048007 */ lui $a0, %hi(D_80074264)
|
||||
/* 439C 80028F9C 24844264 */ addiu $a0, $a0, %lo(D_80074264)
|
||||
/* 43A0 80028FA0 AFBF0010 */ sw $ra, 0x10($sp)
|
||||
/* 43A4 80028FA4 8C830000 */ lw $v1, ($a0)
|
||||
/* 43A8 80028FA8 8C420000 */ lw $v0, ($v0)
|
||||
/* 43AC 80028FAC 10620003 */ beq $v1, $v0, .L80028FBC
|
||||
/* 43B0 80028FB0 00000000 */ nop
|
||||
/* 43B4 80028FB4 0C00A3F8 */ jal func_80028FE0
|
||||
/* 43B8 80028FB8 AC820000 */ sw $v0, ($a0)
|
||||
.L80028FBC:
|
||||
/* 43BC 80028FBC 3C038007 */ lui $v1, %hi(D_80074260)
|
||||
/* 43C0 80028FC0 24634260 */ addiu $v1, $v1, %lo(D_80074260)
|
||||
/* 43C4 80028FC4 94620000 */ lhu $v0, ($v1)
|
||||
/* 43C8 80028FC8 10400002 */ beqz $v0, .L80028FD4
|
||||
/* 43CC 80028FCC 2442FFFF */ addiu $v0, $v0, -1
|
||||
/* 43D0 80028FD0 A4620000 */ sh $v0, ($v1)
|
||||
.L80028FD4:
|
||||
/* 43D4 80028FD4 8FBF0010 */ lw $ra, 0x10($sp)
|
||||
/* 43D8 80028FD8 03E00008 */ jr $ra
|
||||
/* 43DC 80028FDC 27BD0018 */ addiu $sp, $sp, 0x18
|
39
asm/nonmatchings/code_42e0_len_1f60/start_rumble.s
generated
39
asm/nonmatchings/code_42e0_len_1f60/start_rumble.s
generated
@ -1,39 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel start_rumble
|
||||
/* 4308 80028F08 3C028007 */ lui $v0, %hi(gGameStatusPtr)
|
||||
/* 430C 80028F0C 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0)
|
||||
/* 4310 80028F10 27BDFFE0 */ addiu $sp, $sp, -0x20
|
||||
/* 4314 80028F14 AFB10014 */ sw $s1, 0x14($sp)
|
||||
/* 4318 80028F18 0080882D */ daddu $s1, $a0, $zero
|
||||
/* 431C 80028F1C AFBF0018 */ sw $ra, 0x18($sp)
|
||||
/* 4320 80028F20 AFB00010 */ sw $s0, 0x10($sp)
|
||||
/* 4324 80028F24 80420071 */ lb $v0, 0x71($v0)
|
||||
/* 4328 80028F28 14400013 */ bnez $v0, .L80028F78
|
||||
/* 432C 80028F2C 00A0802D */ daddu $s0, $a1, $zero
|
||||
/* 4330 80028F30 3C038007 */ lui $v1, %hi(D_80074260)
|
||||
/* 4334 80028F34 24634260 */ addiu $v1, $v1, %lo(D_80074260)
|
||||
/* 4338 80028F38 94620000 */ lhu $v0, ($v1)
|
||||
/* 433C 80028F3C 1040000E */ beqz $v0, .L80028F78
|
||||
/* 4340 80028F40 00021840 */ sll $v1, $v0, 1
|
||||
/* 4344 80028F44 0070102A */ slt $v0, $v1, $s0
|
||||
/* 4348 80028F48 54400001 */ bnel $v0, $zero, .L80028F50
|
||||
/* 434C 80028F4C 0060802D */ daddu $s0, $v1, $zero
|
||||
.L80028F50:
|
||||
/* 4350 80028F50 0C017FBC */ jal nuContRmbCheck
|
||||
/* 4354 80028F54 0000202D */ daddu $a0, $zero, $zero
|
||||
/* 4358 80028F58 14400007 */ bnez $v0, .L80028F78
|
||||
/* 435C 80028F5C 0000202D */ daddu $a0, $zero, $zero
|
||||
/* 4360 80028F60 0C017FE4 */ jal nuContRmbModeSet
|
||||
/* 4364 80028F64 24050002 */ addiu $a1, $zero, 2
|
||||
/* 4368 80028F68 0000202D */ daddu $a0, $zero, $zero
|
||||
/* 436C 80028F6C 3225FFFF */ andi $a1, $s1, 0xffff
|
||||
/* 4370 80028F70 0C017FA4 */ jal nuContRmbStart
|
||||
/* 4374 80028F74 3206FFFF */ andi $a2, $s0, 0xffff
|
||||
.L80028F78:
|
||||
/* 4378 80028F78 8FBF0018 */ lw $ra, 0x18($sp)
|
||||
/* 437C 80028F7C 8FB10014 */ lw $s1, 0x14($sp)
|
||||
/* 4380 80028F80 8FB00010 */ lw $s0, 0x10($sp)
|
||||
/* 4384 80028F84 03E00008 */ jr $ra
|
||||
/* 4388 80028F88 27BD0020 */ addiu $sp, $sp, 0x20
|
@ -16,7 +16,7 @@ void func_80070A90(s32, f32, f32, f32);
|
||||
void func_80070AF0(s32, f32, f32, f32);
|
||||
|
||||
s32 heap_malloc(s32 size);
|
||||
HeapNode* _heap_create(void* addr, s32 size);
|
||||
HeapNode* _heap_create(s32* addr, u32 size);
|
||||
s32 dma_copy(s32 romStart, s32 romEnd, void* vramDest);
|
||||
|
||||
s32 get_global_byte(s32 index);
|
||||
|
@ -1,4 +1,10 @@
|
||||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
|
||||
// TODO: replace nustuff with defines
|
||||
|
||||
extern u16 D_80074260;
|
||||
extern s32 D_80074264;
|
||||
|
||||
void sin_cos_rad(f32 rad, f32* outSinTheta, f32* outCosTheta);
|
||||
void func_80029860(s32 romStart, s32 vramDest, s32 length);
|
||||
@ -6,22 +12,72 @@ void func_80029860(s32 romStart, s32 vramDest, s32 length);
|
||||
#define ROM_CHUNK_SIZE 0x2000
|
||||
|
||||
void poll_rumble(void) {
|
||||
// TODO: replace with defines
|
||||
nuContRmbCheck(0);
|
||||
nuContRmbModeSet(0, 2);
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", start_rumble);
|
||||
void start_rumble(s32 freq, s32 frame) {
|
||||
if (GAME_STATUS->demoState == 0) {
|
||||
u16* sym = &D_80074260;
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80028F8C);
|
||||
if (*sym != 0) {
|
||||
s32 symx2 = *sym * 2;
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80028FE0);
|
||||
if (frame > symx2) {
|
||||
frame = symx2;
|
||||
}
|
||||
|
||||
if (nuContRmbCheck(0) == 0) {
|
||||
nuContRmbModeSet(0, 2);
|
||||
nuContRmbStart(0, freq, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80028F8C);
|
||||
void func_80028F8C(void) {
|
||||
s32* sym = &D_80074264;
|
||||
u16* sym2;
|
||||
|
||||
if (*sym != GAME_STATUS->currentButtons) {
|
||||
*sym = GAME_STATUS->currentButtons;
|
||||
func_80028FE0();
|
||||
}
|
||||
|
||||
sym2 = &D_80074260;
|
||||
if (*sym2 != 0) {
|
||||
(*sym2)--;
|
||||
}
|
||||
}
|
||||
|
||||
// needs data
|
||||
#ifdef NON_MATCHING
|
||||
void func_80028FE0(void) {
|
||||
D_80074260 = 300;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "code_42e0_len_1f60", func_80028FE0);
|
||||
#endif
|
||||
|
||||
f32 length2D(f32 x, f32 y) {
|
||||
return sqrtf(SQ(x) + SQ(y));
|
||||
}
|
||||
|
||||
INCLUDE_ASM(HeapNode*, "code_42e0_len_1f60", _heap_create, void* addr, s32 size);
|
||||
HeapNode* _heap_create(s32* addr, u32 size) {
|
||||
if (size < 32) {
|
||||
return (HeapNode*) - 1;
|
||||
} else {
|
||||
HeapNode* heapNode = ALIGN16((s32)addr);
|
||||
|
||||
size -= ((char*)heapNode - (char*)addr);
|
||||
heapNode->next = NULL;
|
||||
heapNode->length = size - sizeof(HeapNode);
|
||||
heapNode->allocated = 0;
|
||||
heapNode->capacity = size;
|
||||
return heapNode;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_malloc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user