Cleanup pass for CIC6105.c (#1371)

* IO_READ

* CIC6105.h

* CIC defines

* sRomInfoFaultClient

* CIC6105_Init

* CIC6105_Destroy

* hopefully final cleanup

* review

* bss

* bss
This commit is contained in:
Anghelo Carvajal 2023-09-24 06:23:44 -03:00 committed by GitHub
parent 2e87212038
commit a017b8f228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 62 additions and 39 deletions

21
include/CIC6105.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef CIC6105_H
#define CIC6105_H
#include "ultra64.h"
// IPL3 puts values in those addresses as part of the anti-piracy checks
#define CIC_ADDRESS_1 0x002FB1F4
#define CIC_ADDRESS_2 0x002FE1C0
void CIC6105_Noop1(void);
void CIC6105_Noop2(void);
void CIC6105_PrintRomInfo(void);
void CIC6105_AddRomInfoFaultPage(void);
void CIC6105_Destroy(void);
void CIC6105_Init(void);
extern s32 gCICAddr1Val;
extern s32 gCICAddr2Val;
#endif

8
include/build.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef BUILD_H
#define BUILD_H
extern char gBuildTeam[];
extern char gBuildDate[];
extern char gBuildMakeOption[];
#endif

View File

@ -34,13 +34,9 @@ void IrqMgr_HandlePRENMI500(IrqMgr* irqmgr);
void IrqMgr_HandleRetrace(IrqMgr* irqmgr);
void IrqMgr_ThreadEntry(IrqMgr* irqmgr);
void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount);
void CIC6105_Nop80081820(void);
void CIC6105_Nop80081828(void);
void CIC6105_PrintRomInfo(void);
void CIC6105_AddRomInfoFaultPage(void);
void CIC6105_RemoveRomInfoFaultPage(void);
void func_800818F4(void);
void osSyncPrintfUnused(const char* fmt, ...);
void rmonPrintf(const char* fmt, ...);
void RcpUtils_PrintRegisterStatus(void);

View File

@ -24,19 +24,12 @@ extern s32 sIrqMgrRetraceCount;
// extern UNK_TYPE4 D_80097524;
// extern u32 sRandInt;
extern char gBuildTeam[];
extern char gBuildDate[];
extern char gBuildMakeOption[];
extern u8 sYaz0DataBuffer[0x400];
extern u8* sYaz0CurDataEnd;
extern u32 sYaz0CurRomStart;
extern u32 sYaz0CurSize;
extern u8* sYaz0MaxPtr;
extern void* gYaz0DecompressDstEnd;
// extern UNK_TYPE4 D_8009BE30;
// extern UNK_TYPE4 D_8009BE34;
// extern FaultClient romInfoFaultClient;
// extern UNK_TYPE4 D_8009CD10;
extern u32 sRandFloat;

View File

@ -1,32 +1,33 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "CIC6105.h"
#include "build.h"
#include "fault.h"
UNK_TYPE4 D_8009BE30;
UNK_TYPE4 D_8009BE34;
FaultClient romInfoFaultClient;
s32 gCICAddr1Val;
s32 gCICAddr2Val;
FaultClient sRomInfoFaultClient;
void CIC6105_Nop80081820(void) {
void CIC6105_Noop1(void) {
}
void CIC6105_Nop80081828(void) {
void CIC6105_Noop2(void) {
}
void CIC6105_PrintRomInfo(void) {
FaultDrawer_DrawText(80, 200, "SP_STATUS %08x", HW_REG(SP_STATUS_REG, u32));
FaultDrawer_DrawText(80, 200, "SP_STATUS %08x", IO_READ(SP_STATUS_REG));
FaultDrawer_DrawText(40, 184, "ROM_F [Creator:%s]", gBuildTeam);
FaultDrawer_DrawText(56, 192, "[Date:%s]", gBuildDate);
}
void CIC6105_AddRomInfoFaultPage(void) {
Fault_AddClient(&romInfoFaultClient, (void*)CIC6105_PrintRomInfo, NULL, NULL);
Fault_AddClient(&sRomInfoFaultClient, (void*)CIC6105_PrintRomInfo, NULL, NULL);
}
void CIC6105_RemoveRomInfoFaultPage(void) {
Fault_RemoveClient(&romInfoFaultClient);
void CIC6105_Destroy(void) {
Fault_RemoveClient(&sRomInfoFaultClient);
}
void func_800818F4(void) {
D_8009BE30 = *(u32*)0xA02FB1F4;
D_8009BE34 = *(u32*)0xA02FE1C0;
void CIC6105_Init(void) {
gCICAddr1Val = IO_READ(CIC_ADDRESS_1);
gCICAddr2Val = IO_READ(CIC_ADDRESS_2);
}

View File

@ -3,6 +3,7 @@
#include "idle.h"
#include "stack.h"
#include "stackcheck.h"
#include "CIC6105.h"
#include "z64thread.h"
StackEntry sBootStackInfo;
@ -14,7 +15,7 @@ STACK(sBootStack, 0x400);
void bootproc(void) {
StackCheck_Init(&sBootStackInfo, sBootStack, STACK_TOP(sBootStack), 0, -1, "boot");
osMemSize = osGetMemSize();
func_800818F4();
CIC6105_Init();
osInitialize();
osUnmapTLBAll();
gCartHandle = osCartRomInit();

View File

@ -4,6 +4,7 @@
#include "irqmgr.h"
#include "padmgr.h"
#include "scheduler.h"
#include "CIC6105.h"
#include "stack.h"
#include "stackcheck.h"

View File

@ -4,6 +4,7 @@
* Description: Seahorse
*/
#include "prevent_bss_reordering.h"
#include "z_en_ot.h"
#include "objects/object_ot/object_ot.h"
#include "objects/gameplay_keep/gameplay_keep.h"

View File

@ -7,6 +7,7 @@
#include "z_title.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "CIC6105.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "misc/nintendo_rogo_static/nintendo_rogo_static.h"
@ -146,7 +147,7 @@ void ConsoleLogo_Destroy(GameState* thisx) {
Sram_InitSram(&this->state, &this->sramCtx);
ShrinkWindow_Destroy();
CIC6105_Nop80081828();
CIC6105_Noop2();
}
void ConsoleLogo_Init(GameState* thisx) {

View File

@ -40,12 +40,12 @@
0x800815CC:("IrqMgr_HandleRetrace",),
0x80081684:("IrqMgr_ThreadEntry",),
0x80081754:("IrqMgr_Init",),
0x80081820:("CIC6105_Nop80081820",),
0x80081828:("CIC6105_Nop80081828",),
0x80081820:("CIC6105_Noop1",),
0x80081828:("CIC6105_Noop2",),
0x80081830:("CIC6105_PrintRomInfo",),
0x8008189C:("CIC6105_AddRomInfoFaultPage",),
0x800818D0:("CIC6105_RemoveRomInfoFaultPage",),
0x800818F4:("func_800818F4",),
0x800818D0:("CIC6105_Destroy",),
0x800818F4:("CIC6105_Init",),
0x80081920:("osSyncPrintfUnused",),
0x8008193C:("osSyncPrintf",),
0x80081958:("rmonPrintf",),

View File

@ -310,9 +310,9 @@
0x8009BE18:("sYaz0CurSize","u32","",0x4),
0x8009BE1C:("sYaz0MaxPtr","u8*","",0x4),
0x8009BE20:("gYaz0DecompressDstEnd","void*","",0x4),
0x8009BE30:("D_8009BE30","UNK_TYPE4","",0x4),
0x8009BE34:("D_8009BE34","UNK_TYPE4","",0x4),
0x8009BE38:("romInfoFaultClient","FaultClient","",0x10),
0x8009BE30:("gCICAddr1Val","UNK_TYPE4","",0x4),
0x8009BE34:("gCICAddr2Val","UNK_TYPE4","",0x4),
0x8009BE38:("sRomInfoFaultClient","FaultClient","",0x10),
0x8009BE50:("sFaultInstance","FaultMgr*","",0x4),
0x8009BE54:("sFaultTimeTotal","f32","",0x4),
0x8009BE58:("faultCustomOptions","u32","",0x4),

View File

@ -37,12 +37,12 @@ asm/non_matchings/boot/irqmgr/IrqMgr_HandlePRENMI500.s,IrqMgr_HandlePRENMI500,0x
asm/non_matchings/boot/irqmgr/IrqMgr_HandleRetrace.s,IrqMgr_HandleRetrace,0x800815CC,0x2E
asm/non_matchings/boot/irqmgr/IrqMgr_ThreadEntry.s,IrqMgr_ThreadEntry,0x80081684,0x34
asm/non_matchings/boot/irqmgr/IrqMgr_Init.s,IrqMgr_Init,0x80081754,0x33
asm/non_matchings/boot/CIC6105/CIC6105_Nop80081820.s,CIC6105_Nop80081820,0x80081820,0x2
asm/non_matchings/boot/CIC6105/CIC6105_Nop80081828.s,CIC6105_Nop80081828,0x80081828,0x2
asm/non_matchings/boot/CIC6105/CIC6105_Noop1.s,CIC6105_Noop1,0x80081820,0x2
asm/non_matchings/boot/CIC6105/CIC6105_Noop2.s,CIC6105_Noop2,0x80081828,0x2
asm/non_matchings/boot/CIC6105/CIC6105_PrintRomInfo.s,CIC6105_PrintRomInfo,0x80081830,0x1B
asm/non_matchings/boot/CIC6105/CIC6105_AddRomInfoFaultPage.s,CIC6105_AddRomInfoFaultPage,0x8008189C,0xD
asm/non_matchings/boot/CIC6105/CIC6105_RemoveRomInfoFaultPage.s,CIC6105_RemoveRomInfoFaultPage,0x800818D0,0x9
asm/non_matchings/boot/CIC6105/func_800818F4.s,func_800818F4,0x800818F4,0xB
asm/non_matchings/boot/CIC6105/CIC6105_Destroy.s,CIC6105_Destroy,0x800818D0,0x9
asm/non_matchings/boot/CIC6105/CIC6105_Init.s,CIC6105_Init,0x800818F4,0xB
asm/non_matchings/boot/syncprintf/osSyncPrintfUnused.s,osSyncPrintfUnused,0x80081920,0x7
asm/non_matchings/boot/syncprintf/osSyncPrintf.s,osSyncPrintf,0x8008193C,0x7
asm/non_matchings/boot/syncprintf/rmonPrintf.s,rmonPrintf,0x80081958,0xA

1 asm/non_matchings/boot/boot_main/bootproc.s bootproc 0x80080060 0x3C
37 asm/non_matchings/boot/irqmgr/IrqMgr_HandleRetrace.s IrqMgr_HandleRetrace 0x800815CC 0x2E
38 asm/non_matchings/boot/irqmgr/IrqMgr_ThreadEntry.s IrqMgr_ThreadEntry 0x80081684 0x34
39 asm/non_matchings/boot/irqmgr/IrqMgr_Init.s IrqMgr_Init 0x80081754 0x33
40 asm/non_matchings/boot/CIC6105/CIC6105_Nop80081820.s asm/non_matchings/boot/CIC6105/CIC6105_Noop1.s CIC6105_Nop80081820 CIC6105_Noop1 0x80081820 0x2
41 asm/non_matchings/boot/CIC6105/CIC6105_Nop80081828.s asm/non_matchings/boot/CIC6105/CIC6105_Noop2.s CIC6105_Nop80081828 CIC6105_Noop2 0x80081828 0x2
42 asm/non_matchings/boot/CIC6105/CIC6105_PrintRomInfo.s CIC6105_PrintRomInfo 0x80081830 0x1B
43 asm/non_matchings/boot/CIC6105/CIC6105_AddRomInfoFaultPage.s CIC6105_AddRomInfoFaultPage 0x8008189C 0xD
44 asm/non_matchings/boot/CIC6105/CIC6105_RemoveRomInfoFaultPage.s asm/non_matchings/boot/CIC6105/CIC6105_Destroy.s CIC6105_RemoveRomInfoFaultPage CIC6105_Destroy 0x800818D0 0x9
45 asm/non_matchings/boot/CIC6105/func_800818F4.s asm/non_matchings/boot/CIC6105/CIC6105_Init.s func_800818F4 CIC6105_Init 0x800818F4 0xB
46 asm/non_matchings/boot/syncprintf/osSyncPrintfUnused.s osSyncPrintfUnused 0x80081920 0x7
47 asm/non_matchings/boot/syncprintf/osSyncPrintf.s osSyncPrintf 0x8008193C 0x7
48 asm/non_matchings/boot/syncprintf/rmonPrintf.s rmonPrintf 0x80081958 0xA