Skip to content

Commit 10e409c

Browse files
author
Niko
committed
PCDRV progress
1 parent c20268d commit 10e409c

File tree

8 files changed

+35
-66
lines changed

8 files changed

+35
-66
lines changed

decompile/General/AltMods/PCDRV/pcdrv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ CdlFILE *pcCdSearchFile(CdlFILE *loc, const char *filename)
5656

5757
v1 = PCopen(&filename[1], PCDRV_MODE_READ);
5858

59-
// if Error: return 0;
60-
59+
#ifdef REBUILD_PC
6160
fileFD[fileCount] = v1;
61+
#else
62+
fileFD[fileCount] = fileCount;
63+
#endif
6264

6365
// max of 256 files
6466
// CTR has 40 files,

decompile/General/HOWL/h23_Bank_AssignSpuAddrs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ int DECOMP_Bank_AssignSpuAddrs()
55
int i;
66
int ret;
77

8+
// Make PS1 PCDRV boot,
9+
// will mean that sound does NOT load
10+
#ifdef USE_PCDRV
11+
#ifndef REBUILD_PC
12+
return 1;
13+
#endif
14+
#endif
15+
816
// if Stage 4: Complete
917
if(sdata->bankLoadStage == 4)
1018
{

decompile/General/HOWL/h31_howl_InitGlobals.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#include <common.h>
22

33
void DECOMP_howl_InitGlobals(char* filename)
4-
{
5-
// TEMPORARY
6-
#ifdef USE_PCDRV
7-
sdata->boolAudioEnabled = 0;
8-
return;
9-
#endif
10-
4+
{
115
if(sdata->boolAudioEnabled == 1) return;
126
sdata->boolAudioEnabled = 1;
137

decompile/General/HOWL/h34_howl_LoadHeader.c

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,6 @@ void DECOMP_howl_LoadHeader(char* filename)
1212
// allocate room for one sector
1313
alloc = DECOMP_MEMPACK_AllocMem(0x800/*, filename*/);
1414

15-
// PC
16-
#ifdef USE_PCDRV
17-
18-
#ifdef REBUILD_PC
19-
int v1;
20-
#else
21-
// because this API is STRANGE
22-
register int v1 asm("v1");
23-
#endif
24-
25-
v1 = PCopen("SOUNDS/KART.HWL", PCDRV_MODE_READ);
26-
int fd_kartHwl = v1;
27-
28-
v1 = PCread(fd_kartHwl, alloc, 0x800);
29-
30-
// allocate room for howlHeader + pointerTable
31-
howlHeaderSize = sizeof(struct HowlHeader) + alloc->headerSize;
32-
33-
// align up for sector size
34-
numSector = (howlHeaderSize + 0x800 - 1) >> 0xb;
35-
DECOMP_MEMPACK_ReallocMem(numSector << 0xb);
36-
37-
char* byteOffset = (char*)alloc;
38-
PCread(fd_kartHwl, &byteOffset[0x800], howlHeaderSize-0x800);
39-
40-
// allocate room for howlHeader + pointerTable
41-
howlHeaderSize = sizeof(struct HowlHeader) + alloc->headerSize;
42-
43-
// reallocate room just howlHeader + pointerTable,
44-
// deallocate sector-alignment padding
45-
DECOMP_MEMPACK_ReallocMem(howlHeaderSize);
46-
47-
return;
48-
49-
// PS1
50-
#else
51-
5215
if (DECOMP_LOAD_FindFile(filename, &sdata->KartHWL_CdFile) == 0)
5316
alloc = 0;
5417

@@ -58,7 +21,7 @@ void DECOMP_howl_LoadHeader(char* filename)
5821
ret = DECOMP_LOAD_HowlHeaderSectors(
5922
&sdata->KartHWL_CdFile,
6023
alloc, 0, 1);
61-
24+
6225
if(
6326
// confirm first sector loaded properly
6427
(ret != 0)
@@ -104,6 +67,4 @@ void DECOMP_howl_LoadHeader(char* filename)
10467
}
10568

10669
DECOMP_MEMPACK_PopState();
107-
108-
#endif
10970
}

decompile/General/LOAD/LOAD_23_FindFile.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,5 @@ int DECOMP_LOAD_FindFile(char* filename, CdlFILE* cdlFile)
88
DECOMP_CDSYS_SetMode_StreamData();
99
DECOMP_LOAD_StringToUpper(filename);
1010

11-
#ifdef USE_PCDRV
12-
// for KART.HWL, cause CdSearchFile wont give size
13-
cdlFile->size = 0xbae694;
14-
#endif
15-
1611
return (CdSearchFile(cdlFile, filename) != 0);
1712
}

decompile/General/LOAD/LOAD_24_HowlHeaderSectors.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
int DECOMP_LOAD_HowlHeaderSectors(CdlFILE* cdlFileHWL, void* ptrDestination, int firstSector, int numSector)
44
{
5-
6-
// PS1
7-
#ifndef USE_PCDRV
8-
95
CdlLOC loc;
106

117
DECOMP_CDSYS_SetMode_StreamData();
128

9+
#ifndef USE_PCDRV
1310
int sizeOver = ((firstSector + numSector) * 0x800 - cdlFileHWL->size);
1411

1512
// If reading out of file bounds, quit
1613
if (sizeOver >= 0x800 )
1714
return 0;
15+
#endif
1816

1917
CdIntToPos(CdPosToInt(&cdlFileHWL->pos) + firstSector, &loc);
2018

@@ -28,7 +26,4 @@ int DECOMP_LOAD_HowlHeaderSectors(CdlFILE* cdlFileHWL, void* ptrDestination, int
2826
return 0;
2927

3028
return 1;
31-
32-
#endif
33-
3429
}

decompile/General/LOAD/LOAD_26_HowlSectorChainStart.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#include <common.h>
22

33
int DECOMP_LOAD_HowlSectorChainStart(CdlFILE* cdlFileHWL, void* ptrDestination, int firstSector, int numSector)
4-
{
5-
#ifdef USE_PCDRV
6-
return 1;
7-
#endif
8-
4+
{
95
CdlLOC loc;
106

7+
// Make PS1 PCDRV boot,
8+
// will mean that sound does NOT load
9+
#ifdef USE_PCDRV
10+
#ifndef REBUILD_PC
11+
return 1;
12+
#endif
13+
#endif
14+
1115
if(numSector == 0)
1216
return 1;
1317

@@ -19,11 +23,13 @@ int DECOMP_LOAD_HowlSectorChainStart(CdlFILE* cdlFileHWL, void* ptrDestination,
1923

2024
DECOMP_CDSYS_SetMode_StreamData();
2125

26+
#ifndef USE_PCDRV
2227
int sizeOver = ((firstSector + numSector) * 0x800 - cdlFileHWL->size);
2328

2429
// If reading out of file bounds, quit
2530
if (sizeOver >= 0x800 )
2631
return 0;
32+
#endif
2733

2834
CdIntToPos(CdPosToInt(&cdlFileHWL->pos) + firstSector, &loc);
2935

decompile/General/LOAD/LOAD_27_HowlSectorChainEnd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ int DECOMP_LOAD_HowlSectorChainEnd()
66
int howlChainState = sdata->howlChainState;
77
howlChainParams = sdata->howlChainParams;
88

9+
// Make PS1 PCDRV boot,
10+
// will mean that sound does NOT load
11+
#ifdef USE_PCDRV
12+
#ifndef REBUILD_PC
13+
return 1;
14+
#endif
15+
#endif
16+
917
if(howlChainState == -1)
1018
{
1119
DECOMP_LOAD_HowlSectorChainStart(

0 commit comments

Comments
 (0)