Skip to content

Commit f93bf85

Browse files
committed
pc: support more systems
1 parent 3402c41 commit f93bf85

24 files changed

+328
-26
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
insert_final_newline = false
5+
trim_trailing_whitespace = true
6+
charset = utf-8
7+
8+
[*.{nix,md,MD,sh}]
9+
insert_final_newline = true
10+
end_of_line = lf
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.{c,C,h,H}]
15+
indent_style = tab
16+
indent_size = 4
17+
18+
[Makefile]
19+
insert_final_newline = true
20+
end_of_line = lf
21+
indent_style = tab

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ offset.txt
2525
comport.txt
2626
gcc_out.txt
2727
overlay.ld
28-
Makefile
28+
rebuild_PC/result
2929

3030
# Version tracker
3131
tools/updater/.version

decompile/General/232/232_35_AH_MaskHint_Update.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void DECOMP_AH_MaskHint_Update()
1515
sdata->AkuAkuHintState++;
1616
break;
1717

18-
case 1:
18+
case 1: {
1919
int absSpeedApprox = d->speedApprox;
2020
if(absSpeedApprox < 0) absSpeedApprox = -absSpeedApprox;
2121
if(absSpeedApprox > 0x31) return;
@@ -65,7 +65,7 @@ void DECOMP_AH_MaskHint_Update()
6565
D232.maskWarppadDelayFrames = FPS_DOUBLE(60);
6666

6767
sdata->AkuAkuHintState++;
68-
break;
68+
} break;
6969

7070
case 2:
7171

@@ -189,7 +189,7 @@ void DECOMP_AH_MaskHint_Update()
189189
// stay here forever stuck
190190
break;
191191

192-
case 4:
192+
case 4: {
193193
int lngIndex = 0;
194194
int boolFound = 0;
195195
short* ptrLngID = &D232.hintMenu_lngIndexArr[0];
@@ -270,7 +270,7 @@ void DECOMP_AH_MaskHint_Update()
270270
// show map again
271271
gGT->hudFlags &= ~(0x10);
272272
}
273-
break;
273+
} break;
274274

275275
case 5:
276276

decompile/General/GHOST/GhostReplay_ThTick.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void DECOMP_GhostReplay_ThTick(struct Thread *t)
316316
tape->packetID++;
317317
break;
318318

319-
case 0x81: // Animation
319+
case 0x81: { // Animation
320320
int numAnimFrames = DECOMP_INSTANCE_GetNumAnimFrames(inst, buffer[1]);
321321
inst->animIndex = (numAnimFrames < 1) ? 0 : buffer[1];
322322
inst->animFrame = (buffer[2] == 0 || numAnimFrames <= buffer[2])
@@ -333,7 +333,7 @@ void DECOMP_GhostReplay_ThTick(struct Thread *t)
333333
#endif
334334

335335
buffer += 3;
336-
break;
336+
} break;
337337

338338
case 0x82: // Boost
339339
if (

decompile/General/MAIN/MainDB_GetClipSize.c

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

3-
u_int DECOMP_MainDB_GetClipSize(u_int levelID, int numPlyrCurrGame)
3+
int DECOMP_MainDB_GetClipSize(u_int levelID, int numPlyrCurrGame)
44
{
55
if(levelID == PAPU_PYRAMID || levelID == POLAR_PASS)
66
if (2 < numPlyrCurrGame)

decompile/General/MEMPACK/MEMPACK_Init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <common.h>
2+
#include <inttypes.h>
23

34
#ifdef REBUILD_PC
45
// with 8mb expansion, we have bonus PrimMem
@@ -23,6 +24,11 @@ void DECOMP_MEMPACK_Init(int ramSize)
2324
// Visual Studio -> Properties -> Linker -> Advanced ->
2425
// Base Address, Randomized Base Address, Fixed Base Address
2526
ptrMempack->start = &memory[0];
27+
printf(
28+
"[CTR] Where does memory starts? (%s) %" PRIu32 "\n",
29+
(ptrMempack->start < 0x01000000 ? "GOOD" : "BAD"),
30+
ptrMempack->start
31+
);
2632
memset(memory, 0, 8*1024*1024);
2733

2834
ptrMempack->endOfAllocator = &memory[8*1024*1024 - 4];

decompile/General/RaceFlag/RaceFlag_t11_GetOT.c

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

3-
int DECOMP_RaceFlag_GetOT(void)
3+
u_int* DECOMP_RaceFlag_GetOT(void)
44
{
55
short sVar1;
66
int iVar2;
77
struct GameTracker* gGT = sdata->gGT;
88

9-
int* otDrawFirst_FarthestDepth;
10-
int* otDrawLast_ClosestDepth;
9+
u_int* otDrawFirst_FarthestDepth;
10+
u_int* otDrawLast_ClosestDepth;
1111

1212
otDrawFirst_FarthestDepth = &gGT->pushBuffer[0].ptrOT[0x3FF];
1313
otDrawLast_ClosestDepth = gGT->otSwapchainDB[gGT->swapchainIndex];
@@ -93,4 +93,4 @@ int DECOMP_RaceFlag_GetOT(void)
9393
}
9494

9595
return otDrawLast_ClosestDepth;
96-
}
96+
}

decompile/General/RaceFlag/RaceFlag_t13_DrawLoadingString.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void DECOMP_RaceFlag_DrawLoadingString(void)
1212
char *pbVar8;
1313
int iVar9;
1414
int iVar10;
15-
int uVar11;
15+
u_int *uVar11;
1616
char local_30;
1717
char local_2f;
1818

@@ -49,8 +49,10 @@ void DECOMP_RaceFlag_DrawLoadingString(void)
4949
iVar10 =
5050
(sdata->RaceFlag_Transition & 0xffff) -
5151
(
52-
((iVar3 << 0x10) >> 0x10) -
53-
((iVar3 << 0x10) >> 0x1f) >> 1
52+
(
53+
((iVar3 << 0x10) >> 0x10) -
54+
((iVar3 << 0x10) >> 0x1f)
55+
) >> 1
5456
);
5557

5658
iVar3 = FPS_HALF(sdata->RaceFlag_LoadingTextAnimFrame);

decompile/General/RaceFlag/RaceFlag_t14_DrawSelf.c

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

33
#ifdef REBUILD_PC
4-
int scratchpadBuf[0x1000];
4+
u_int scratchpadBuf[0x1000];
55
#endif
66

77
force_inline char RaceFlag_CalculateBrightness(u_int sine, u_char darkTile)
88
{
99
if (darkTile)
1010
{
11-
return sine * -55 + 0x140000 >> 0xD;
11+
return((sine * -55 + 0x140000) >> 0xD);
1212
}
13-
return sine * -125 + 0x1fe000 >> 0xD;
13+
return((sine * -125 + 0x1fe000) >> 0xD);
1414
}
1515

1616
void DECOMP_RaceFlag_DrawSelf()
@@ -20,7 +20,7 @@ void DECOMP_RaceFlag_DrawSelf()
2020
u_char toggle;
2121
short flagPos;
2222
u_long *ot;
23-
long *scratchpad;
23+
u_int *scratchpad;
2424
u_int screenlimit;
2525
u_int dimensions;
2626
int approx[2];
@@ -171,7 +171,7 @@ void DECOMP_RaceFlag_DrawSelf()
171171
#ifdef REBUILD_PC
172172
top = &scratchpadBuf[(toggle * 0x78 / 4) - 1];
173173
toggle = toggle ^ 1;
174-
bottom = &scratchpadBuf[(toggle * 0x78 / 4) - 0];
174+
bottom = &scratchpadBuf[(toggle * 0x78 / 4)];
175175
#else
176176
top = (u_int *)((0x1f800000 + toggle * 0x78) - 4);
177177
toggle = toggle ^ 1;
@@ -318,6 +318,7 @@ void DECOMP_RaceFlag_DrawSelf()
318318
setRGB1(p, colorLeft, colorLeft, colorLeft);
319319
setRGB3(p, colorLeft, colorLeft, colorLeft);
320320

321+
321322
// positions
322323
*(int *)&p->x0 = bottom[0];
323324
*(int *)&p->x2 = bottom[1];

decompile/General/zGlobal_SDATA.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#include <common.h>
77

8+
#if __GNUC__
9+
char memcardBytes[0x1680];
10+
#endif
11+
812
struct sData sdata_static =
913
{
1014
.langBufferSize = 0x3F04,
@@ -353,6 +357,9 @@ struct sData sdata_static =
353357
#if NO_BSS
354358
.ptrToMemcardBuffer1 = 0x800992e4,
355359
.ptrToMemcardBuffer2 = 0x800992e4,
360+
#elif __GNUC__
361+
.ptrToMemcardBuffer1 = &memcardBytes[0],
362+
.ptrToMemcardBuffer2 = &memcardBytes[0],
356363
#else
357364
.ptrToMemcardBuffer1 = &sdata_static.memcardBytes[0],
358365
.ptrToMemcardBuffer2 = &sdata_static.memcardBytes[0],

0 commit comments

Comments
 (0)