src/core1: improvments and renamings on various files, added some header files

neue Datei:     include/core1/eeprom.h
        neue Datei:     include/core1/pfsmanager.h
        neue Datei:     include/core1/ucode.h
        umbenannt:      src/core1/code_18110.c -> src/core1/eeprom.c
        umbenannt:      src/core1/code_10A00.c -> src/core1/pfsmanager.c
        umbenannt:      src/core1/code_13640.c -> src/core1/stub_13640.c
        umbenannt:      src/core1/code_1D590.c -> src/core1/stub_1D590.c
        umbenannt:      src/core1/code_18210.c -> src/core1/ucode.c
        umbenannt:      src/core1/code_EAF0.c -> src/core1/viewport.c
This commit is contained in:
mariob92
2024-10-08 18:29:28 +02:00
parent 6fb4f2b3f1
commit 737ccf97c3
40 changed files with 278 additions and 201 deletions

View File

@@ -164,11 +164,11 @@ segments:
- [0xF475C0, c, code_ABB0]
- [0xF49870, c, code_CE60]
- [0xF4AD70, c, code_E360]
- [0xF4B4C0, c, code_EAF0]
- [0xF4D3D0, c, code_10A00]
- [0xF4B4C0, c, viewport]
- [0xF4D3D0, c, pfsmanager]
- [0xF4E490, c, code_11AC0]
- [0xF4F890, c, rumblemanager]
- [0xF50010, c, code_13640]
- [0xF50010, c, stub_13640]
- [0xF50050, c, code_13680]
- [0xF500a0, c, overlaymanager]
- [0xF50360, c, code_13990]
@@ -177,12 +177,12 @@ segments:
- [0xF52140, c, code_15770]
- [0xF52500, c, code_15B30]
- [0xF53420, c, memory]
- [0xF54AE0, c, code_18110]
- [0xF54BE0, c, code_18210]
- [0xF54AE0, c, eeprom]
- [0xF54BE0, c, ucode]
- [0xF54CE0, c, code_18310]
- [0xF54D20, c, code_18350]
- [0xF58860, c, code_1BE90]
- [0xF59F60, c, code_1D590]
- [0xF59F60, c, stub_1D590]
- [0xF59F90, hasm, code_1D5C0]
- [0xF59FA0, c, code_1D5D0]
- [0xF5AD30, c, code_1E360]
@@ -376,8 +376,8 @@ segments:
- [0xF74C60, .data, code_ABB0]
- [0xF74C70, .data, code_CE60]
- [0xF74CE0, .data, code_E360]
- [0xF74DD0, .data, code_EAF0]
- [0xF74DE0, .data, code_10A00]
- [0xF74DD0, .data, viewport]
- [0xF74DE0, .data, pfsmanager]
- [0xF74DF0, .data, code_11AC0]
- [0xF75380, .data, overlaymanager]
- [0xF75620, .data, code_13990]
@@ -416,8 +416,8 @@ segments:
- [0xF76770, .rodata, code_72B0]
- [0xF76790, .rodata, code_7F60]
- [0xF767B0, .rodata, code_CE60]
- [0xF76A80, .rodata, code_EAF0]
- [0xF76B00, .rodata, code_10A00]
- [0xF76A80, .rodata, viewport]
- [0xF76B00, .rodata, pfsmanager]
- [0xF77210, .rodata, code_11AC0]
- [0xF77220, .rodata, rumblemanager]
- [0xF77230, .rodata, overlaymanager]
@@ -466,17 +466,17 @@ segments:
- [0xF791D0, .bss, code_ABB0]
- [0xF791D0, .bss, code_CE60]
- [0xF791D0, .bss, code_E360]
- [0xF791D0, .bss, code_EAF0]
- [0xF791D0, .bss, code_10A00]
- [0xF791D0, .bss, viewport]
- [0xF791D0, .bss, pfsmanager]
- [0xF791D0, .bss, code_11AC0]
- [0xF791D0, .bss, rumblemanager]
- [0xF791D0, .bss, code_13640]
- [0xF791D0, .bss, stub_13640]
- [0xF791D0, .bss, overlaymanager]
- [0xF791D0, .bss, code_13990]
- [0xF791D0, .bss, code_15770]
- [0xF791D0, .bss, code_15B30]
- [0xF791D0, .bss, memory]
- [0xF791D0, .bss, code_18210]
- [0xF791D0, .bss, ucode]
- [0xF791D0, .bss, code_1D5D0]
- [0xF791D0, .bss, code_1E360]
- [0xF791D0, .bss, os/initialize]

View File

@@ -165,11 +165,11 @@ segments:
- [0xF23E00, c, code_ABB0] #DONE
- [0xF260B0, c, code_CE60] #DONE
- [0xF275B0, c, code_E360] #DONE
- [0xF27D40, c, code_EAF0] #DONE
- [0xF29C50, c,code_10A00]
- [0xF27D40, c, viewport] #DONE
- [0xF29C50, c,pfsmanager]
- [0xF2AD10, c, code_11AC0] #DONE
- [0xF2C160, c, rumblemanager] #DONE
- [0xF2C890, c, code_13640] #DONE
- [0xF2C890, c, stub_13640] #DONE
- [0xF2C8D0, c, code_13680] #DONE
- [0xF2C920, c, overlaymanager] #DONE
- [0xF2CBE0, c, code_13990]
@@ -178,12 +178,12 @@ segments:
- [0xF2E9C0, c, code_15770] #DONE
- [0xF2ED80, c, code_15B30] #DONE
- [0xF2FCA0, c, memory] #DONE
- [0xF31360, c, code_18110] #DONE
- [0xF31460, c, code_18210] #DONE
- [0xF31360, c, eeprom] #DONE
- [0xF31460, c, ucode] #DONE
- [0xF31560, c, code_18310] #DONE
- [0xF315A0, c, code_18350] #DONE
- [0xF350E0, c, code_1BE90] #DONE
- [0xF367E0, c, code_1D590] #DONE
- [0xF367E0, c, stub_1D590] #DONE
- [0xF36810, hasm, code_1D5C0] #DONE
- [0xF36820, c, code_1D5D0] #DONE
- [0xF375B0, c, code_1E360] #DONE
@@ -377,8 +377,8 @@ segments:
- [0xF51430, .data, code_ABB0]
- [0xF51440, .data, code_CE60]
- [0xF514B0, .data, code_E360]
- [0xF51550, .data, code_EAF0]
- [0xF51560, .data, code_10A00]
- [0xF51550, .data, viewport]
- [0xF51560, .data, pfsmanager]
- [0xF51570, .data, code_11AC0]
- [0xF51B00, .data, overlaymanager]
- [0xF51DA0, .data, code_13990]
@@ -418,8 +418,8 @@ segments:
- [0xF52F10, .rodata, code_7F60]
- [0xF52F30, .rodata, code_9D30]
- [0xF52F50, .rodata, code_CE60]
- [0xF53220, .rodata, code_EAF0]
- [0xF532A0, .rodata, code_10A00]
- [0xF53220, .rodata, viewport]
- [0xF532A0, .rodata, pfsmanager]
- [0xF539B0, .rodata, code_11AC0]
- [0xF539C0, .rodata, rumblemanager]
- [0xF539D0, .rodata, overlaymanager]
@@ -467,17 +467,17 @@ segments:
- [0xF55960, .bss, code_ABB0]
- [0xF55960, .bss, code_CE60]
- [0xF55960, .bss, code_E360]
- [0xF55960, .bss, code_EAF0]
- [0xF55960, .bss, code_10A00]
- [0xF55960, .bss, viewport]
- [0xF55960, .bss, pfsmanager]
- [0xF55960, .bss, code_11AC0]
- [0xF55960, .bss, rumblemanager]
- [0xF55960, .bss, code_13640]
- [0xF55960, .bss, stub_13640]
- [0xF55960, .bss, overlaymanager]
- [0xF55960, .bss, code_13990]
- [0xF55960, .bss, code_15770]
- [0xF55960, .bss, code_15B30]
- [0xF55960, .bss, memory]
- [0xF55960, .bss, code_18210]
- [0xF55960, .bss, ucode]
- [0xF55960, .bss, code_1D5D0]
- [0xF55960, .bss, code_1E360]
- [0xF55960, .bss, os/initialize]

9
include/core1/eeprom.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef BANJO_KAZOOIE_EEPROM_H
#define BANJO_KAZOOIE_EEPROM_H
#include <ultra64.h>
s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count);
s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count);
#endif

View File

@@ -0,0 +1,71 @@
#ifndef BANJO_KAZOOIE_PFSMANAGER_H
#define BANJO_KAZOOIE_PFSMANAGER_H
#include <ultra64.h>
#include "bool.h"
typedef struct pfs_manager_face_buttons_s {
bool button_a;
bool button_b;
bool button_c_left;
bool button_c_up;
bool button_c_down;
bool button_c_right;
} PfsManagerFaceButtons;
typedef struct pfs_manager_side_buttons_s {
bool button_z;
bool button_l;
bool button_r;
};
typedef struct pfs_manager_controller_data {
union { s32 face_button[6]; PfsManagerFaceButtons face_button2; };
s32 side_button[3];
s32 unk24[4];
s32 start_button;
} PfsManagerControllerData;
typedef struct {
s16 unk0;
s16 unk2;
u16 unk4;
u16 unk6;
f32 unk8[2];
f32 joystick[2];
}Struct_core1_10A00_1;
f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2);
void pfsManager_getControllerFaceButtonState(s32 controller_index, s32 dst[6]);
void pfsManager_getFirstControllerFaceButtonState(s32 controller_index, s32 dst[6]);
s32 func_8024E5E8(s32 arg0, s32 arg1);
s32 func_8024E60C(s32 controller_index, s32 dst[3]);
s32 func_8024E640(s32 controller_index, s32 dst[3]);
f32 func_8024E668(s32 controller_index);
s32 controller_getStartButton(s32 controller_index);
s32 func_8024E698(s32 controller_index);
void func_8024E6E0(s32 controller_index, s32 *dst[4]);
void controller_getJoystick(s32 controller_index, f32 dst[2]);
void pfsManager_update(void);
void pfsManager_readData();
void pfsManager_entry(void *arg);
void pfsManager_init(void);
bool pfsManager_contErr(void);
void func_8024F150(void);
void func_8024F180(void);
void pfsManager_getStartReadData(void);
void func_8024F1F0(void);
void func_8024F224(void);
void func_8024F2E4(s32 arg0, Struct_core1_10A00_1 *arg1);
void func_8024F328(s32 controller_index, s32 arg1);
OSMesgQueue * pfsManager_getFrameReplyQ(void);
OSMesgQueue *pfsManager_getFrameMesgQ(void);
void func_8024F35C(s32 arg0);
bool pfsManager_isBusy(void);
int func_8024F3C4(int arg0);
OSContPad *func_8024F3F4(void);
void func_8024F400(void);
void func_8024F450(void);
void func_8024F4AC(void);
#endif

12
include/core1/ucode.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef BANJO_KAZOOIE_UCODE_H
#define BANJO_KAZOOIE_UCODE_H
#include <ultra64.h>
void ucode_load(void);
void ucode_stub1(void); // does nothing
void ucode_stub2(void); // performs dummy read on PI
s32 ucode_stub3(void); // returns always 0
void ucode_getPtrAndSize(void **ptr, u32 *size);
#endif

View File

@@ -509,7 +509,7 @@ f32 climbGetBottomY(void);
f32 climbGetTopY(void);
void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]);
void func_8024E55C(s32, s32 [6]);
void pfsManager_getControllerFaceButtonState(s32, s32 [6]);
void __spawnQueue_add_1(GenFunction_1, s32);
#define SPAWNQUEUE_ADD_1(method, arg0) __spawnQueue_add_1((GenFunction_1) (method), reinterpret_cast(s32, (arg0)))

View File

@@ -658,7 +658,7 @@ void chvilegame_update(Actor *this) {
}
if (this->state == 5) {
if (local->unkC == 7) {
func_8024E55C(0, sp30);
pfsManager_getControllerFaceButtonState(0, sp30);
if ((sp30[FACE_BUTTON(BUTTON_B)] > 0) && func_8038C2A8(local->vile_marker)) {
func_8038A068(this, 0xA);
}

View File

@@ -403,7 +403,7 @@ void func_803896FC(Actor *this){
sp58 = func_8038BE20(this->position);
sp54 = time_getDelta();
func_8024E55C(0, sp3C);
pfsManager_getControllerFaceButtonState(0, sp3C);
if(!this->volatile_initialized){
this->volatile_initialized = TRUE;

View File

@@ -446,7 +446,7 @@ void chsmmole_Update(Actor * this){
func_8028E668(this->position, 180.0f, -40.0f, 120.0f);
}//L80389B64
func_8024E55C(0,sp50); //get face buttons press counters
pfsManager_getControllerFaceButtonState(0,sp50); //get face buttons press counters
player_getPosition(sp44);
switch (this->state)
{

View File

@@ -77,7 +77,7 @@ void SM_func_8038A5D8(Actor *this){
this->initialized = TRUE;
}//L8038A650
func_8024E55C(0, sp44);
pfsManager_getControllerFaceButtonState(0, sp44);
switch (this->state)
{
case 1://L8038A688

View File

@@ -3,6 +3,8 @@
#include "variables.h"
#include "version.h"
#include "gc/gctransition.h"
#include "core1/eeprom.h"
#include "core1/ucode.h"
#define MAIN_THREAD_STACK_SIZE 0x17F0
@@ -70,7 +72,7 @@ void func_8023DA9C(s32 arg0){
if (D_8027A130 == 4){
dummy_func_802E35D0();
}
dummy_func_80255CD8();
ucode_stub1();
}
u32 globalTimer_getTimeMasked(u32 mask){
@@ -107,7 +109,7 @@ void core1_init(void) {
#if VERSION == VERSION_PAL
osTvType = 0;
#endif
func_80255C30();
ucode_load();
setBootMap(getDefaultBootMap());
rarezip_init(); //initialize decompressor's huft table
func_8024BE30();
@@ -158,7 +160,7 @@ void mainLoop(void){
rumbleManager_80250C08();
if(!mapSpecificFlags_validateCRC1()){
write_file_blocks(0, 0, 0x80397AD0, 0x40);
eeprom_writeBlocks(0, 0, 0x80397AD0, 0x40);
}
switch(D_8027A130){

View File

@@ -1,21 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void func_8025108C(s32 arg0);
/* .bss */
s32 D_802827F0;
/* .code */
s32 func_80251060(void){
return D_802827F0;
}
void func_8025106C(void){
func_8025108C(0);
}
void func_8025108C(s32 arg0){
D_802827F0 = arg0;
}

View File

@@ -1,28 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "save.h"
#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b))
// The round up divide is not technically needed, but will come in handy for modding
#define gameFile_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData),EEPROM_BLOCK_SIZE)
s32 write_file_blocks(s32 filenum, s32 blockOffset, u8 *buffer, s32 blockCount) {
s32 address = (filenum * gameFile_NUM_BLOCKS) + blockOffset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, blockCount * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}
s32 load_file_blocks(s32 filenum, s32 blockOffset, u8 *buffer, s32 blockCount) {
s32 address = (filenum * gameFile_NUM_BLOCKS) + blockOffset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, blockCount * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}

View File

@@ -1,32 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/* .bss */
u8 D_80283280[0x100];
s32 D_80283380;
s32 D_80283384;
s32 D_80283388;
void func_80255C30(void) {
D_80283384 = *(s32 *)0xA4000000 ^ -1;
D_80283388 = (D_80283384) ? 1 :0;
D_80283380 = *(s32 *)0xA4001000 ^ 6103;
D_80283388 |= (D_80283380) ? 2 :0;
if (D_80283388 == 0) {
piMgr_read(&D_80283280, 0xB0000B70, 0x100);
}
}
void dummy_func_80255CD8(void){}
void func_80255CE0(void){
osPiReadIo(0, NULL);
}
s32 func_80255D04(void){return 0;}
void func_80255D0C(u64 **ucode_ptr, u32 *ucode_size){
*ucode_ptr = &D_80283280;
*ucode_size = 0x100;
}

View File

@@ -1,15 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
void dummy_func_8025AFB0(void) {}
void dummy_func_8025AFB8(void) {}
void dummy_func_8025AFC0(Gfx **arg0, Mtx **arg1, Vtx **arg2) {}
s32 dummy_func_8025AFD0(void)
{
return 0;
}

View File

@@ -2,6 +2,7 @@
#include "functions.h"
#include "variables.h"
#include "version.h"
#include "core1/ucode.h"
typedef struct {
s32 unk0;
@@ -120,7 +121,7 @@ void func_80246744(OSMesg arg0){
}
void func_80246794(Struct_Core1_8C50_s * arg0){
func_80255D0C(&D_80275910.t.ucode_boot, &D_80275910.t.ucode_boot_size);
ucode_getPtrAndSize(&D_80275910.t.ucode_boot, &D_80275910.t.ucode_boot_size);
D_80275910.t.ucode = n_aspMainTextStart;
D_80275910.t.ucode_data = n_aspMainDataStart;
D_80275910.t.data_ptr = (void*) arg0->unk8;
@@ -134,7 +135,7 @@ void func_80246794(Struct_Core1_8C50_s * arg0){
}
void func_80246844(Struct_Core1_8C50_s * arg0){
func_80255D0C(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
ucode_getPtrAndSize(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
D_80275950.t.ucode = gSPF3DEX_fifoTextStart;
D_80275950.t.ucode_data = gSPF3DEX_fifoDataStart;
D_80275950.t.data_ptr = (void*) arg0->unk8;
@@ -152,7 +153,7 @@ void func_80246844(Struct_Core1_8C50_s * arg0){
}
void func_8024692C(Struct_Core1_8C50_s * arg0){
func_80255D0C(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
ucode_getPtrAndSize(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size);
D_80275950.t.ucode = gSPL3DEX_fifoTextStart;
D_80275950.t.ucode_data = gSPL3DEX_fifoDataStart;
D_80275950.t.data_ptr = (void*) arg0->unk8;

31
src/core1/eeprom.c Normal file
View File

@@ -0,0 +1,31 @@
#include <ultra64.h>
#include "core1/eeprom.h"
#include "core1/pfsmanager.h"
#include "save.h"
#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b))
// The round up divide is not technically needed, but will come in handy for modding
#define GAMEFILE_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData), EEPROM_BLOCK_SIZE)
s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count) {
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}
s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count) {
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
s32 ret;
func_8024F35C(3);
ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
func_8024F35C(0);
return ret;
}

View File

@@ -1,4 +1,5 @@
#include <ultra64.h>
#include "core1/pfsmanager.h"
#include "functions.h"
#include "variables.h"
@@ -6,8 +7,6 @@
#define PFSMANAGER_THREAD_STACK_SIZE 0x200
extern s32 D_803727F4;
extern struct {
u8 pad0[4];
s32 unk4;
@@ -15,22 +14,7 @@ extern struct {
s32 unkC;
} D_80379B90;
typedef struct {
s32 face_button[6];
s32 side_button[3];
s32 unk24[4];
s32 start_button;
}Struct_core1_10A00_0;
typedef struct {
s16 unk0;
s16 unk2;
u16 unk4;
u16 unk6;
f32 unk8[2];
f32 joystick[2];
}Struct_core1_10A00_1;
extern s32 D_803727F4;
extern s32 D_80276574;
/* .data */
@@ -41,13 +25,14 @@ extern s32 D_80276574;
s32 D_80275D30 = 0xED7BCDB7; //WHAT IS THIS?
s32 D_80275D34 = 0xF82DC7AC; //WHAT IS THIS?
#endif
s32 D_80275D38 = 0;
static s32 D_80275D38 = 0;
/* .bss */
UNK_TYPE(s32) D_802810E0[4][5];
u8 pfsManagerBitPattern;
Struct_core1_10A00_0 D_80281138[4];
Struct_core1_10A00_0 D_80281218;
PfsManagerControllerData D_80281138[4];
PfsManagerControllerData D_80281218;
Struct_core1_10A00_1 D_80281250[4];
OSMesg pfsManagerContPollingMsqBuf;
OSMesg pfsManagerContReplyMsgBuf;
@@ -66,13 +51,6 @@ OSMesgQueue D_802816E8;
OSMesg D_80281700[4];
u8 pad_D_80281710[1];
/* .h */
void func_8024F224(void);
void func_8024F35C(bool arg0);
void func_8024F450(void);
void func_8024F4AC(void);
/* .code */
f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) {
f32 phi_f2;
@@ -92,7 +70,7 @@ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) {
return phi_f2 *= arg0;
}
void func_8024E55C(s32 controller_index, s32 dst[6]){
void pfsManager_getControllerFaceButtonState(s32 controller_index, s32 dst[6]){
dst[FACE_BUTTON(BUTTON_A)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_A)];
dst[FACE_BUTTON(BUTTON_B)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_B)];
dst[FACE_BUTTON(BUTTON_C_LEFT)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_C_LEFT)];
@@ -101,7 +79,7 @@ void func_8024E55C(s32 controller_index, s32 dst[6]){
dst[FACE_BUTTON(BUTTON_C_RIGHT)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_C_RIGHT)];
}
void func_8024E5A8(s32 controller_index, s32 dst[6]){
void pfsManager_getFirstControllerFaceButtonState(s32 controller_index, s32 dst[6]){
dst[FACE_BUTTON(BUTTON_A)] = D_80281218.face_button[FACE_BUTTON(BUTTON_A)];
dst[FACE_BUTTON(BUTTON_B)] = D_80281218.face_button[FACE_BUTTON(BUTTON_B)];
dst[FACE_BUTTON(BUTTON_C_LEFT)] = D_80281218.face_button[FACE_BUTTON(BUTTON_C_LEFT)];
@@ -171,7 +149,9 @@ void pfsManager_update(void) {
if (func_8023E000() == 3) {
func_802E4384();
}
osSetThreadPri(0, 0x29);
D_802812D0.stick_x = pfsManagerContPadData[0].stick_x;
D_802812D0.stick_y = pfsManagerContPadData[0].stick_y;
D_802812D0.button = pfsManagerContPadData[0].button;
@@ -384,7 +364,7 @@ OSMesgQueue *pfsManager_getFrameMesgQ(void){
return &pfsManagerContPollingMsqQ;
}
void func_8024F35C(bool arg0){
void func_8024F35C(s32 arg0) {
if(!arg0)
func_8024F4AC();
else
@@ -411,7 +391,7 @@ OSContPad *func_8024F3F4(void){
void func_8024F400(void) {
D_80275D38 = TRUE;
osCreateMesgQueue(&D_802816E8, &D_80281700, 5);
osSendMesg(&D_802816E8, 0, 0);
osSendMesg(&D_802816E8, 0, OS_MESG_NOBLOCK);
}
void func_8024F450(void){
@@ -422,5 +402,5 @@ void func_8024F450(void){
}
void func_8024F4AC(void){
osSendMesg(&D_802816E8, 0, 0);
osSendMesg(&D_802816E8, NULL, OS_MESG_NOBLOCK);
}

19
src/core1/stub_13640.c Normal file
View File

@@ -0,0 +1,19 @@
#include <ultra64.h>
s32 stub_13640_get(void);
void stub_13640_init(void);
void stub_13640_set(s32 value);
static s32 sUnused;
s32 stubVar_13640_get(void) {
return sUnused;
}
void stub_13640_init(void) {
stub_13640_set(0);
}
void stub_13640_set(s32 arg0) {
sUnused = arg0;
}

6
src/core1/stub_1D590.c Normal file
View File

@@ -0,0 +1,6 @@
#include <ultra64.h>
void dummy_func_8025AFB0(void) {}
void dummy_func_8025AFB8(void) {}
void dummy_func_8025AFC0(Gfx **gfx, Mtx **mtx, Vtx **vtx) {}
s32 dummy_func_8025AFD0(void) { return 0; }

39
src/core1/ucode.c Normal file
View File

@@ -0,0 +1,39 @@
#include <ultra64.h>
#include <PR/rcp.h>
#include "core1/ucode.h"
#include "functions.h"
#include "variables.h"
#define UCODE_SIZE 256
static u8 sUcodeData[UCODE_SIZE];
static s32 D_80283380;
static s32 D_80283384;
static s32 D_80283388;
void ucode_load(void) {
D_80283384 = *(s32 *)PHYS_TO_K1(0x04000000) ^ -1;
D_80283388 = D_80283384 ? 0x01 : 0x00;
D_80283380 = *(s32 *)PHYS_TO_K1(0x04001000) ^ 0x17D7;
D_80283388 |= D_80283380 ? 0x02 : 0x00;
if (D_80283388 == 0) {
piMgr_read(&sUcodeData, 0xB0000B70, UCODE_SIZE);
}
}
void ucode_stub1(void) {}
void ucode_stub2(void) {
osPiReadIo(0, NULL);
}
s32 ucode_stub3(void) {
return 0;
}
void ucode_getPtrAndSize(void **ptr, u32 *size) {
*ptr = &sUcodeData;
*size = UCODE_SIZE;
}

View File

@@ -333,7 +333,7 @@ void func_802C4C14(Actor *this){
}
else{//L802C4D24
func_8024E60C(0, sp74);
func_8024E55C(0, sp5C);
pfsManager_getControllerFaceButtonState(0, sp5C);
controller_getJoystick(0, &sp54);
switch(this->state){
case 2:

View File

@@ -376,7 +376,7 @@ void chmole_update(Actor *this){
}
}
}//L802D9F34
func_8024E55C(0, sp50); // get face buttons press counters
pfsManager_getControllerFaceButtonState(0, sp50); // get face buttons press counters
switch(this->state){
case 1://L802D9F70
this->yaw_ideal = func_80329784(this);

View File

@@ -314,7 +314,7 @@ void chMumbo_update(Actor *this) {
&& func_8028F20C()
&& func_8028EFC8()
){
func_8024E55C(0, face_buttons);
pfsManager_getControllerFaceButtonState(0, face_buttons);
if(face_buttons[FACE_BUTTON(BUTTON_B)] == 1){
if (D_8037DDF0 == TRANSFORM_7_WISHWASHY) {
this->unk38_31 = 0;

View File

@@ -1013,7 +1013,7 @@ void func_802D5628(void){
D_8037DE08 -= time_getDelta();
}
else{//L802D5B24
func_8024E55C(0, sp50); //get button inputs
pfsManager_getControllerFaceButtonState(0, sp50); //get button inputs
if(sp50[FACE_BUTTON(BUTTON_B)] == 1){
func_80324C58();
func_802D6114();

View File

@@ -138,7 +138,7 @@ void func_802E35D8(void ) {
}
} else if (D_8037E8C0.unk14 == 3) {
sp38 = 0;
func_8024E55C(0, &sp40);
pfsManager_getControllerFaceButtonState(0, &sp40);
for(i = 0; i < 6; i++){
if (sp40[i] == 1) {
sp38++;

View File

@@ -487,7 +487,7 @@ void func_80319EA4(void) {
if(D_803830E0 == NULL)
return;
func_8024E55C(0, sp58);
pfsManager_getControllerFaceButtonState(0, sp58);
controller_getJoystick(0, sp4C);
for(phi_s0 = 0; phi_s0 < 4; phi_s0++){
gczoombox_update(D_803830E0->unk24[phi_s0]);

View File

@@ -6,6 +6,7 @@
#include "core2/anim/sprite.h"
#include <core2/file.h>
#include "core2/particle.h"
#include "core1/eeprom.h"
/* .data */
extern u8 D_80370250 = 0;
@@ -38,7 +39,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) {
return;
}
if (func_80320708() == 0) {
write_file_blocks(0, 0, 0x80BC7230, EEPROM_MAXBLOCKS);
eeprom_writeBlocks(0, 0, 0x80BC7230, EEPROM_MAXBLOCKS);
}
spawnQueue_unlock();
sky_draw(gdl, mptr, vptr);

View File

@@ -3,6 +3,7 @@
#include "variables.h"
#include "save.h"
#include "core1/eeprom.h"
typedef struct {
@@ -318,7 +319,7 @@ void __savedata_save_abilities(u8 *savedata){ //savedata_save_abilities
s32 savedata_8033CA2C(s32 filenum, SaveData *save_data){
s32 sp1C;
sp1C = load_file_blocks(filenum, 0, save_data, 0xF);
sp1C = eeprom_readBlocks(filenum, 0, save_data, 0xF);
if( sp1C
|| savedata_verify(0x78, save_data)
|| ((u8*)save_data)[baseOffset] != 0x11
@@ -331,7 +332,7 @@ s32 savedata_8033CA2C(s32 filenum, SaveData *save_data){
s32 savedata_8033CA9C(SaveData *savedata){
s32 sp1C;
sp1C = load_file_blocks(0, 0x3C, savedata, 0x4);
sp1C = eeprom_readBlocks(0, 0x3C, savedata, 0x4);
if( sp1C
|| savedata_verify(0x20, savedata)
){
@@ -384,7 +385,7 @@ void saveData_create(SaveData *savedata){
int savedata_8033CC98(s32 filenum, u8 *buffer){
int out;
out = write_file_blocks(filenum, 0, buffer, 0xF);
out = eeprom_writeBlocks(filenum, 0, buffer, 0xF);
if(out){
out = 1;
}
@@ -393,7 +394,7 @@ int savedata_8033CC98(s32 filenum, u8 *buffer){
int savedata_8033CCD0(s32 filenum){
int out;
out = write_file_blocks(filenum, 0, D_80383D18, 1);
out = eeprom_writeBlocks(filenum, 0, D_80383D18, 1);
if(out){
out = 1;
}
@@ -403,7 +404,7 @@ int savedata_8033CCD0(s32 filenum){
int savedata_8033CE40(u8 *buffer){
int out;
savedata_update_crc(buffer, sizeof(GlobalData));
out = write_file_blocks(0, 0x3C, buffer, 4);
out = eeprom_writeBlocks(0, 0x3C, buffer, 4);
if(out){
out = 1;
}

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core1/ucode.h"
f32 time_getDelta(void);
@@ -59,7 +60,7 @@ s32 item_adjustByDiff(enum item_e item, s32 diff, s32 no_hud){
oldVal = D_80385F30[item];
if(func_80255D04())
if(ucode_stub3())
diff = 0;
if(diff < 0){

View File

@@ -27,7 +27,7 @@ void func_80295448(void){
D_8037C310.unk0[0] = controller_getStartButton(0);
func_8024E60C(0, &D_8037C310.unk0[1]);
func_8024E6E0(0, &D_8037C310.unk0[4]);
func_8024E55C(0, &D_8037C310.unk0[8]);
pfsManager_getControllerFaceButtonState(0, &D_8037C310.unk0[8]);
for(i=0; i<0xE; i++){//L802954A8
D_8037C310.unk7E[i] = D_8037C310.unk70[i];
if(D_8037C310.unk70[i]){

View File

@@ -3,6 +3,7 @@
#include "variables.h"
#include "zoombox.h"
#include "core1/pfsmanager.h"
extern void func_803114D0(void );
extern int func_803114B0(void);
@@ -373,10 +374,10 @@ void gcdialog_update(void) {
ret = -1;
if (g_Dialog.u8.unk128_31 & 0x80) {
func_8024E5A8(0, controller_face_buttons);
pfsManager_getFirstControllerFaceButtonState(0, controller_face_buttons);
func_8024E640(0, controller_side_buttons);
} else {
func_8024E55C(0, controller_face_buttons);
pfsManager_getControllerFaceButtonState(0, controller_face_buttons);
func_8024E60C(0, controller_side_buttons);
}

View File

@@ -936,7 +936,7 @@ s32 gcPauseMenu_update(void) {
return 0;
}
func_8024E55C(0, face_button);
pfsManager_getControllerFaceButtonState(0, face_button);
controller_getJoystick(0, joystick);
func_8024E60C(0, sp60);
func_8024E6E0(0, sp50);

View File

@@ -4,13 +4,11 @@
#include "zoombox.h"
#include "ml/mtx.h"
#include <core1/viewport.h>
#include "core1/pfsmanager.h"
void func_80252330(f32, f32, f32);
extern f32 func_8033DDB8(void);
extern void func_8024E60C(s32, void *);
extern void func_8024E640(s32, void *);
extern void func_8024E5A8(s32, void *);
extern void func_80344090(BKSpriteDisplayData *self, s32 frame, Gfx **gfx);
BKSprite *func_8033B6C4(enum asset_e sprite_id, BKSpriteDisplayData **arg1);
@@ -881,11 +879,11 @@ void func_80316764(GcZoombox *this, s32 arg1) {
f32 pad0;
if (!this->unk1A4_10 ) {
func_8024E55C(0, sp38);
pfsManager_getControllerFaceButtonState(0, sp38);
func_8024E60C(0, sp2C);
phi_f0 = time_getDelta();
} else {
func_8024E5A8(0, sp38);
pfsManager_getFirstControllerFaceButtonState(0, sp38);
func_8024E640(0, sp2C);
phi_f0 = func_8033DDB8();
}
@@ -1067,12 +1065,12 @@ void gczoombox_update(GcZoombox *this){
return;
if( !this->unk1A4_10 ){
func_8024E55C(0, sp58);
pfsManager_getControllerFaceButtonState(0, sp58);
func_8024E60C(0, sp4C);
tmp_f0 = time_getDelta();
}
else{
func_8024E5A8(0, sp58);
pfsManager_getFirstControllerFaceButtonState(0, sp58);
func_8024E640(0, sp4C);
tmp_f0 = func_8033DDB8();
}

View File

@@ -4,8 +4,9 @@
#include "actor.h"
#include "prop.h"
#include "functions.h"
#include "ch/snacker.h"
#include "core1/eeprom.h"
#include "core1/ucode.h"
void spawnQueue_unlock(void);
void spawnQueue_lock(void);
@@ -396,7 +397,7 @@ void spawnQueue_reset(void){
break;
}
if(func_80255D04() == 0 || loaded_asm_file == 0 ){
if(ucode_stub3() == 0 || loaded_asm_file == 0 ){
func_8030578C();
}
func_80305990(1);
@@ -417,7 +418,7 @@ void spawnQueue_free(void){
void spawnQueue_func_802C39D4(void){
func_803268B4();
if(!levelSpecificFlags_validateCRC2()){
write_file_blocks(0, 0, 0x80749530, EEPROM_MAXBLOCKS);
eeprom_writeBlocks(0, 0, 0x80749530, EEPROM_MAXBLOCKS);
}
}

View File

@@ -120,7 +120,7 @@ void chBrentilda_update(Actor *this) {
func_8028E668(this->position, 280.0f, -40.0f, 160.0f);
this->yaw_ideal = (f32) func_80329784(this);
func_80328FB0(this, 3.0f);
func_8024E55C(0, sp78);
pfsManager_getControllerFaceButtonState(0, sp78);
player_getPosition(sp64);
temp_f0 = sp64[1] - this->position[1];
if ((temp_f0 > -100.0f) && (temp_f0 < 350.0f)) {

View File

@@ -1159,7 +1159,7 @@ void lair_func_8038E0B0(void) {
){
func_80319EA4();
func_8038C9D0();
func_8024E55C(0, sp48);
pfsManager_getControllerFaceButtonState(0, sp48);
func_8024E60C(0, sp3C);
if (D_8037DCB8->currFfMode < 3) {
player_getPosition(D_8037DCB8->playerPosition);

View File

@@ -468,7 +468,7 @@ void lair_func_8038F924(Actor *this) {
particleEmitter_emitN(sp54, 6);
}
}
func_8024E55C(0, sp7C);
pfsManager_getControllerFaceButtonState(0, sp7C);
func_8024E60C(0, sp6C);
func_8038EDBC(this);
switch(this->state){

View File

@@ -108,7 +108,7 @@ void func_803902B8(Actor *this) {
this->unk38_0 = sp58;
sp58 = ml_vec3f_within_distance(this->position, sp5C, 400.0f);
if (fileProgressFlag_get(sp54 + FILEPROG_AD_CHEATO_BLUEEGGS_UNLOCKED)) {
func_8024E55C(0, sp3C);
pfsManager_getControllerFaceButtonState(0, sp3C);
sp58 &= (sp3C[FACE_BUTTON(BUTTON_B)] == 1) || func_8028EC04();
}
if (sp58 && !*(s32 *)&this->local) {