Skip to content

Commit b4ba073

Browse files
author
Niko
committed
progress
1 parent f62a773 commit b4ba073

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

decompile/General/CDSYS/CDSYS_07_SpuCallbackIRQ.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ half.
1717
// from TOMB5
1818
// https://github.com/TOMB5/TOMB5/blob/master/EMULATOR/LIBSPU.H
1919
#define SPU_CDONLY 5
20-
SpuReadDecodedData(&sdata->SpuDecodedData[0], SPU_CDONLY);
20+
SpuReadDecodedData(&sdata->SpuDecodedBuf[0], SPU_CDONLY);
2121

2222
if(
2323
(sdata->XA_boolFinished == 0) &&

decompile/General/CDSYS/CDSYS_09_SpuEnableIRQ.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
void DECOMP_CDSYS_SpuEnableIRQ()
44
{
5-
int* ptr = &sdata->SpuDecodedData[0];
5+
// erase 0x400 bytes
6+
int* ptr = &sdata->SpuDecodedBuf[0];
67
for(int i = 0; i < 0x100; i++)
78
ptr[i] = 0;
89

decompile/General/CDSYS/CDSYS_11_SpuGetMaxSample.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,23 @@
22

33
void DECOMP_CDSYS_SpuGetMaxSample(void)
44
{
5-
int endIndex;
6-
int currIndex;
7-
int index2;
8-
5+
int index2;
96
short sample;
107
short max;
8+
max = 0;
119

12-
// if you are not using CD, quit
10+
#if 0 // impossible
1311
if (sdata->boolUseDisc == false) return;
14-
15-
// range {0x0 - 0x100}
16-
if (sdata->irqAddr == 0)
17-
{
18-
currIndex = 0;
19-
endIndex = 0x100;
20-
}
21-
// otherwise, range {0x100 - 0x200}
22-
else
23-
{
24-
currIndex = 0x100;
25-
endIndex = 0x200;
26-
}
12+
#endif
13+
14+
short* ptrSpuBuf =
15+
&sdata->SpuDecodedBuf[sdata->irqAddr];
2716

2817
// loop through region
29-
for (max = 0; currIndex < endIndex; currIndex++)
18+
for (int i = 0; i < 0x100; i++)
3019
{
3120
// absolute value
32-
sample = sdata->SpuDecodedData[currIndex];
21+
sample = ptrSpuBuf[i];
3322
if (sample < 0) sample = -sample;
3423

3524
// find max
@@ -57,9 +46,8 @@ void DECOMP_CDSYS_SpuGetMaxSample(void)
5746
// set max to zero
5847
sdata->XA_MaxSampleValInArr = 0;
5948

60-
currIndex = sdata->XA_SampleMaxIndex1;
49+
int currIndex = sdata->XA_SampleMaxIndex1;
6150
index2 = sdata->XA_SampleMaxIndex2;
62-
6351
if (index2 == 0) return;
6452

6553
for (; index2 != -1; index2--)

include/regionsEXE.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,9 +4508,9 @@ struct sData
45084508
// 80091198 -- JpnRetail
45094509
// see FUN_8001c8e4
45104510
#if BUILD == SepReview
4511-
short SpuDecodedData[0x800];
4511+
char SpuDecodedBuf[0x1000];
45124512
#elif BUILD >= UsaRetail
4513-
short SpuDecodedData[0x400];
4513+
char SpuDecodedBuf[0x800];
45144514
#endif
45154515

45164516
// 8008E528

0 commit comments

Comments
 (0)