PR fixes and a couple more

This commit is contained in:
Ethan Roseman 2020-09-02 12:37:33 -04:00
parent 90d2ddf2f6
commit ee8d55d6a2
6 changed files with 14 additions and 40 deletions

View File

@ -1,17 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel fio_erase_flash
/* 006E1C 8002BA1C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006E20 8002BA20 AFBF0010 */ sw $ra, 0x10($sp)
/* 006E24 8002BA24 0C01BD09 */ jal osFlashSectorErase
/* 006E28 8002BA28 000421C0 */ sll $a0, $a0, 7
/* 006E2C 8002BA2C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006E30 8002BA30 03E00008 */ jr $ra
/* 006E34 8002BA34 27BD0018 */ addiu $sp, $sp, 0x18
/* 006E38 8002BA38 00000000 */ nop
/* 006E3C 8002BA3C 00000000 */ nop

View File

@ -1,13 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel fio_init_flash
/* 006C4C 8002B84C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006C50 8002B850 AFBF0010 */ sw $ra, 0x10($sp)
/* 006C54 8002B854 0C01BBDA */ jal osFlashInit
/* 006C58 8002B858 00000000 */ nop
/* 006C5C 8002B85C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006C60 8002B860 03E00008 */ jr $ra
/* 006C64 8002B864 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -8,7 +8,7 @@
void osCleanupThread(void); void osCleanupThread(void);
s32 heap_malloc(s32 size); s32 heap_malloc(s32 size);
HeapNode* _heap_create(s32 addr, s32 size); HeapNode* _heap_create(u32* addr, s32 size);
void clone_model(u16 srcModelID, u16 newModelID); void clone_model(u16 srcModelID, u16 newModelID);
void update_collider_transform(s16 colliderID); void update_collider_transform(s16 colliderID);

View File

@ -10,7 +10,7 @@ INCLUDE_ASM("code_42e0_len_1f60", func_80028FE0);
INCLUDE_API_ASM("code_42e0_len_1f60", length2D); INCLUDE_API_ASM("code_42e0_len_1f60", length2D);
HeapNode* INCLUDE_ASM("code_42e0_len_1f60", _heap_create, s32 addr, s32 size); HeapNode* INCLUDE_ASM("code_42e0_len_1f60", _heap_create, u32* addr, s32 size);
INCLUDE_ASM("code_42e0_len_1f60", _heap_malloc); INCLUDE_ASM("code_42e0_len_1f60", _heap_malloc);

View File

@ -4,7 +4,7 @@ extern s32 D_80268000;
extern s32 D_802FB800; extern s32 D_802FB800;
extern s32 D_803DA800; extern s32 D_803DA800;
s32 general_heap_create(void) { HeapNode* general_heap_create(void) {
return _heap_create(&D_802FB800, 0x54000); return _heap_create(&D_802FB800, 0x54000);
} }
@ -21,7 +21,7 @@ s32 general_heap_free(s32 size) {
} }
s32 battle_heap_create(void) { s32 battle_heap_create(void) {
if (_heap_create(&D_803DA800, 0x25800) == -1) { if ((s32)_heap_create(&D_803DA800, 0x25800) == -1) {
return -1; return -1;
} else { } else {
return 0; return 0;
@ -49,7 +49,7 @@ s32 heap_free(s32 size) {
} }
s32 collision_heap_create(void) { s32 collision_heap_create(void) {
if (_heap_create(&D_80268000, 0x18000) == -1) { if ((s32)_heap_create(&D_80268000, 0x18000) == -1) {
return -1; return -1;
} }
return 0; return 0;
@ -63,10 +63,10 @@ s32 collision_heap_malloc(s32 size) {
} }
} }
s32 collision_heap_free(s32 size) { s32 collision_heap_free(UNK_PTR data) {
if (!(*gGameStatusPtr)->isBattle) { if (!(*gGameStatusPtr)->isBattle) {
_heap_free(&D_80268000, size); _heap_free(&D_80268000, data);
} else { } else {
_heap_free(&D_803DA800, size); _heap_free(&D_803DA800, data);
} }
} }

View File

@ -26,10 +26,14 @@ INCLUDE_ASM("code_6240_len_c00", fio_deserialize_state);
INCLUDE_ASM("code_6240_len_c00", fio_serialize_state); INCLUDE_ASM("code_6240_len_c00", fio_serialize_state);
INCLUDE_ASM("code_6240_len_c00", fio_init_flash); void fio_init_flash(void) {
osFlashInit();
}
INCLUDE_ASM("code_6240_len_c00", fio_read_flash); INCLUDE_ASM("code_6240_len_c00", fio_read_flash);
INCLUDE_ASM("code_6240_len_c00", fio_write_flash); INCLUDE_ASM("code_6240_len_c00", fio_write_flash);
INCLUDE_ASM("code_6240_len_c00", fio_erase_flash); void fio_erase_flash(s32 pageNum) {
osFlashSectorErase(pageNum * 128);
}