This commit is contained in:
Niko 2023-09-18 09:46:01 -04:00
parent 36d643a18f
commit ebcf789f68
18 changed files with 61 additions and 20 deletions

View File

@ -17,7 +17,7 @@ void DECOMP_howl_LoadHeader(char* filename)
if (alloc != 0)
{
// read sector #1 of HOWL, just for header
ret = LOAD_HowlOneSector(
ret = LOAD_HowlHeaderSectors(
&sdata->KartHWL_CdLoc, alloc, 0, 1);
if(
@ -45,7 +45,7 @@ void DECOMP_howl_LoadHeader(char* filename)
// if header needs a more sectors loaded,
// like CTR-U which needs 3 sectors
(
ret = LOAD_HowlOneSector(
ret = LOAD_HowlHeaderSectors(
&sdata->KartHWL_CdLoc, (int)alloc+0x800, 1, numSector-1),
ret != 0

View File

@ -0,0 +1,25 @@
#include <common.h>
int DECOMP_LOAD_HowlHeaderSectors(CdlFILE* cdlFileHWL, void* ptrDestination, int firstSector, int numSector)
{
CdlLOC loc;
CDSYS_SetMode_StreamData();
// If reading out of file bounds, quit
if ( ((firstSector+numSector)*0x800 - cdlFileHWL->size) >= 0x800 )
return 0;
CdIntToPos(CdPosToInt(&cdlFileHWL->pos) + firstSector, &loc);
char buf[8];
CdControl(CdlSetloc, &loc, buf);
if(CdRead(numSector, ptrDestination, 0x80) == 0)
return 0;
if(CdReadSync(0,0) != 0)
return 0;
return 1;
}

View File

@ -0,0 +1,14 @@
#include <common.h>
void DECOMP_LOAD_HowlCallback(char result)
{
// disable callback
CdReadCallback(0);
// definitely not bool: can be -1, 0, 1
if(result == CdlComplete)
sdata->boolLoadKartHWL = 0;
else
sdata->boolLoadKartHWL = -1;
}

View File

@ -371,7 +371,8 @@ common, exe, LOAD_VramFile, 0x0, General/LOAD/LOAD_A20_VramFile.c
common, exe, LOAD_ReadFile, 0x0, General/LOAD/LOAD_A22_ReadFile.c
common, exe, LOAD_ReadFile_NoCallback, 0x0, General/LOAD/LOAD_A23_ReadFile_NoCallback.c
common, exe, LOAD_FindFile, 0x0, General/LOAD/LOAD_A24_FindFile.c
// skip LOAD_HowlOneSector, LOAD_HowlCallback,
common, exe, LOAD_HowlHeaderSectors, 0x0, General/LOAD/LOAD_A25_HowlHeaderSectors.c
common, exe, LOAD_HowlCallback, 0x0, General/LOAD/LOAD_A26_HowlCallback.c
// skip LOAD_HowlSectorChainStart, LOAD_HowlSectorChainEnd
common, exe, LOAD_RunPtrMap, 0x0, General/LOAD/LOAD_A29_RunPtrMap.c
common, exe, LOAD_Robots2P, 0x0, General/LOAD/LOAD_A30_Robots2P.c

View File

@ -1933,7 +1933,7 @@ undefined4 FUN_80029b2c(undefined4 param_1)
// Give CdlFile of Kart.HWL,
// Give pointer of 0x800 allocation
// LOAD_HowlOneSector
// LOAD_HowlHeaderSectors
iVar1 = FUN_80032498(&DAT_80095e7c,piVar2,0,1),
iVar1 != 0
)
@ -1963,7 +1963,7 @@ undefined4 FUN_80029b2c(undefined4 param_1)
// so it loads after the last byte of sector
// asm - addiu a1,s1,0x800
// LOAD_HowlOneSector
// LOAD_HowlHeaderSectors
iVar3 = FUN_80032498(&DAT_80095e7c,piVar2 + 0x200,1,iVar3 + -1),
iVar3 != 0
)

View File

@ -892,11 +892,11 @@ uint FUN_80032438(char *param_1,CdlFILE *param_2)
// same as 80032594, but doesn't store params and calls CdReadSync
// only called from howl_LoadHeader
// param_1 is the address to CdlFile of Kart.HWL
// param_2 is allocation of 0x800 bytes
// param_2 is ptrDestination
// param_3 is firstSector
// param_4 is numSector
// LOAD_HowlOneSector
// LOAD_HowlHeaderSectors
undefined4 FUN_80032498(CdlLOC *param_1,u_long *param_2,int param_3,int param_4)
{
@ -943,7 +943,7 @@ undefined4 FUN_80032498(CdlLOC *param_1,u_long *param_2,int param_3,int param_4)
}
// howl cd reading callback
// LOAD_HowlCallback
void FUN_8003254c(char param_1)
{

View File

@ -533,7 +533,7 @@ void* LOAD_ReadFile_NoCallback(char* file, void* addr, int* size);
// these are the last howl functions ever
//LOAD_HowlOneSector()
//LOAD_HowlHeaderSectors()
//LOAD_HowlCallback()
//LOAD_HowlSectorChainStart()
//LOAD_HowlSectorChainEnd()

View File

@ -3703,7 +3703,8 @@ struct sData
short levelID;
// 8008d840
int boolLoadKartHWL; // I think???
// need to rename, can be -1, 0, 1
int boolLoadKartHWL;
// 8008d844
// save parameters so you can

View File

@ -350,7 +350,7 @@ LOAD_ReadFileASyncCallback = 0x800336dc;
LOAD_ReadFile = 0x80033780;
LOAD_ReadFile_NoCallback = 0x80033910;
LOAD_FindFile = 0x80033a04;
LOAD_HowlOneSector = 0x80033a64;
LOAD_HowlHeaderSectors = 0x80033a64;
LOAD_HowlCallback = 0x80033b18;
LOAD_HowlSectorChainStart = 0x80033b60;
LOAD_HowlSectorChainEnd = 0x80033c38;

View File

@ -342,7 +342,7 @@ LOAD_ReadFileASyncCallback = 0x800323f4;
LOAD_ReadFile = 0x80032498;
LOAD_ReadFile_NoCallback = 0x80032628;
LOAD_FindFile = 0x80032728;
LOAD_HowlOneSector = 0x80032788;
LOAD_HowlHeaderSectors = 0x80032788;
LOAD_HowlCallback = 0x8003283c;
LOAD_HowlSectorChainStart = 0x80032884;
LOAD_HowlSectorChainEnd = 0x8003295c;

View File

@ -353,7 +353,7 @@ LOAD_ReadFileASyncCallback = 0x80033d10;
LOAD_ReadFile = 0x80033db4;
LOAD_ReadFile_NoCallback = 0x80033f44;
LOAD_FindFile = 0x80034038;
LOAD_HowlOneSector = 0x80034098;
LOAD_HowlHeaderSectors = 0x80034098;
LOAD_HowlCallback = 0x8003414c;
LOAD_HowlSectorChainStart = 0x80034194;
LOAD_HowlSectorChainEnd = 0x8003426c;

View File

@ -328,7 +328,7 @@ LOAD_ReadFileASyncCallback = 0x800313fc;
LOAD_ReadFile = 0x800314b0;
LOAD_ReadFile_NoCallback = 0x8003165c;
LOAD_FindFile = 0x8003177c;
LOAD_HowlOneSector = 0x800317dc;
LOAD_HowlHeaderSectors = 0x800317dc;
LOAD_HowlCallback = 0x80031890;
LOAD_HowlSectorChainStart = 0x800318d8;
LOAD_HowlSectorChainEnd = 0x800319a4;

View File

@ -350,7 +350,7 @@ LOAD_ReadFileASyncCallback = 0x80032110;
LOAD_ReadFile = 0x800321b4;
LOAD_ReadFile_NoCallback = 0x80032344;
LOAD_FindFile = 0x80032438;
LOAD_HowlOneSector = 0x80032498;
LOAD_HowlHeaderSectors = 0x80032498;
LOAD_HowlCallback = 0x8003254c;
LOAD_HowlSectorChainStart = 0x80032594;
LOAD_HowlSectorChainEnd = 0x8003266c;

View File

@ -469,7 +469,7 @@
80033a04 LOAD_FindFile
80033a64 LOAD_HowlOneSector
80033a64 LOAD_HowlHeaderSectors
80033b18 LOAD_HowlCallback
80033b60 LOAD_HowlSectorChainStart
80033c38 LOAD_HowlSectorChainEnd

View File

@ -457,7 +457,7 @@
80032728 LOAD_FindFile
80032788 LOAD_HowlOneSector
80032788 LOAD_HowlHeaderSectors
8003283c LOAD_HowlCallback
80032884 LOAD_HowlSectorChainStart
8003295c LOAD_HowlSectorChainEnd

View File

@ -471,7 +471,7 @@
80034038 LOAD_FindFile
80034098 LOAD_HowlOneSector
80034098 LOAD_HowlHeaderSectors
8003414c LOAD_HowlCallback
80034194 LOAD_HowlSectorChainStart
8003426c LOAD_HowlSectorChainEnd

View File

@ -451,7 +451,7 @@
8003177c LOAD_FindFile
800317dc LOAD_HowlOneSector
800317dc LOAD_HowlHeaderSectors
80031890 LOAD_HowlCallback
800318d8 LOAD_HowlSectorChainStart
800319a4 LOAD_HowlSectorChainEnd

View File

@ -440,7 +440,7 @@
800321b4 LOAD_ReadFile // real ND name
80032344 LOAD_ReadFile_NoCallback
80032438 LOAD_FindFile
80032498 LOAD_HowlOneSector
80032498 LOAD_HowlHeaderSectors
8003254c LOAD_HowlCallback
80032594 LOAD_HowlSectorChainStart
8003266c LOAD_HowlSectorChainEnd