Skip to content

Commit 09ce0d0

Browse files
author
Niko
committed
LOAD full defrag
1 parent 0de8ca3 commit 09ce0d0

File tree

9 files changed

+54
-30
lines changed

9 files changed

+54
-30
lines changed

decompile/General/AltMods/ModsMain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ void ModsMain()
4949
// HOWL defrag Block1
5050
(int)howl_VolumeGet - (int)Mods3_EndOfFile,
5151

52-
// LOAD defrag Block1
53-
(int)LOAD_Hub_ReadFile - (int)Mods4_EndOfFile,
52+
// LOAD defrag Block1 (potentially join with MAIN_AAA_Block2)
53+
(int)MainDB_GetClipSize - (int)Mods4_EndOfFile,
5454

5555
// VehPtr defrag Block1
5656
(int)VehPickState_NewState - (int)Mods5_EndOfFile,

decompile/General/LOAD/LOAD_00_36_Callback_Overlay_Generic.c renamed to decompile/General/LOAD/LOAD_00_50_FULL.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
#include "LOAD_34_AppendQueue.c"
3838
#include "LOAD_35_CDRequestCallback.c"
3939
#include "LOAD_36_NextQueuedFile.c"
40+
#include "LOAD_37_Hub_ReadFile.c"
41+
#include "LOAD_38_Hub_SwapNow.c"
42+
#include "LOAD_39_Hub_Main.c"
43+
#include "LOAD_40_OvrLOD.c"
44+
#include "LOAD_41_OvrEndRace.c"
45+
#include "LOAD_42_OvrThreads.c"
46+
#include "LOAD_43_GetAdvPackIndex.c"
47+
#include "LOAD_44_TenStages.c"
48+
#include "LOAD_45_TalkingMask.c"
49+
#include "LOAD_46_LevelFile.c"
50+
#include "LOAD_47_IsOpen_RacingOrBattle.c"
51+
#include "LOAD_48_IsOpen_MainMenu.c"
52+
#include "LOAD_49_IsOpen_AdvHub.c"
53+
#include "LOAD_50_IsOpen_Podiums.c"
4054

4155
#if defined (USE_ALTMODS)
4256
#include "../AltMods/Mods4.c"

decompile/General/LOAD/LOAD_04_Callback_Overlay_233.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,15 @@ void DECOMP_LOAD_Callback_Overlay_233(void)
44
{
55
sdata->load_inProgress = 0;
66
sdata->gGT->overlayIndex_Threads = 3;
7+
8+
// My bad, this wasn't safe to relocate -- Niko
9+
// Patch call to LOAD_Hub_ReadFile from CS_Thread_UseOpcode
10+
#ifndef REBUILD_PS1
11+
#define JAL(dest) (((unsigned long)dest & 0x3FFFFFF) >> 2 | 0xC000000)
12+
void DECOMP_LOAD_Hub_ReadFile();
13+
if(*(int*)0x800ad368 == 0xC00CBFF)
14+
*(int*)0x800ad368 = JAL(DECOMP_LOAD_Hub_ReadFile);
15+
#endif
16+
717
return;
818
}

decompile/General/LOAD/LOAD_39_Hub_Main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void DECOMP_LOAD_Hub_Main(int bigfilePtr)
2222
)
2323
{
2424
gGT->bool_AdvHub_NeedToSwapLEV = 0;
25-
LOAD_Hub_SwapNow();
25+
DECOMP_LOAD_Hub_SwapNow();
2626
}
2727
}
2828

@@ -34,7 +34,7 @@ void DECOMP_LOAD_Hub_Main(int bigfilePtr)
3434
unsigned int currLevelID = gGT->levelID - 0x19;
3535
if (currLevelID >= 5) return;
3636

37-
LOAD_Hub_ReadFile(
37+
DECOMP_LOAD_Hub_ReadFile(
3838
bigfilePtr,
3939
rdata.MetaDataHubs[currLevelID].connectedHub_LevID[nextLevelID - 1],
4040
3 - gGT->activeMempackIndex

decompile/General/MAIN/MainFrame_01_ResetDB.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void DECOMP_MainFrame_ResetDB(struct GameTracker* gGT)
1313
#ifndef REBUILD_PS1
1414
// check if new adv hub should be loaded,
1515
// this was a random place for ND to put it
16-
LOAD_Hub_Main(sdata->ptrBigfile1);
16+
DECOMP_LOAD_Hub_Main(sdata->ptrBigfile1);
1717
#endif
1818

1919
#ifndef REBUILD_PC

decompile/General/MAIN/MainFrame_08_RenderFrame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ void RenderAllHUD(struct GameTracker* gGT)
848848
#ifndef REBUILD_PS1
849849
gGT->overlayTransition--;
850850
if(gGT->overlayTransition == 1)
851-
LOAD_OvrThreads(2);
851+
DECOMP_LOAD_OvrThreads(2);
852852
#endif
853853
}
854854

decompile/General/MAIN/MainMain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ u_int DECOMP_main()
127127

128128
#ifdef USE_LANG
129129
if ((gGT->gameMode2 & LNG_CHANGE) != 0) {
130-
LOAD_LangFile(sdata->ptrBigfileCdPos_2, gGT->langIndex);
130+
DECOMP_LOAD_LangFile(sdata->ptrBigfileCdPos_2, gGT->langIndex);
131131
gGT->gameMode2 &= ~(LNG_CHANGE);
132132
}
133133
#endif

decompile/General/Vehicle/VehBirth_7_NonGhost.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void DECOMP_VehBirth_NonGhost(struct Thread* t, int index)
2828
// Patch call to VehPhysProc_SlamWall_Init from COLL
2929
#ifndef REBUILD_PS1
3030
#define JAL(dest) (((unsigned long)dest & 0x3FFFFFF) >> 2 | 0xC000000)
31+
if(*(int*)0x800214bc == 0xC018EF5)
3132
*(int*)0x800214bc = JAL(DECOMP_VehPhysProc_SlamWall_Init);
3233
#endif
3334

decompile/buildList.txt

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// 509 = 978-469, "comm... - //comm..."
2-
// 509+43+36+27+38+14+18+35+46+12+7+6+9+2+1+1+2+2+3+3+2+4+2+3+3+16+3+47 = 887 rewritten so far
2+
// 509+43+50+27+38+14+18+35+46+12+7+6+9+2+1+1+2+2+3+3+2+4+2+3+3+16+3+47 = 887 rewritten so far
33
// 509 for every 'common' and ','
44
// additions for every file that has multiple functions,
55
// 43 for HOWL block
6-
// 36 for LOAD block
6+
// 50 for LOAD block
77
// 27 for VehPtr block
88
// 38 for 230_Block1
99
// 14 for 230_Block2
@@ -795,17 +795,17 @@ common, exe, LIST_Init, 0x0, General/LIST/LIST_8_Ini
795795
// LOAD (complete?)
796796
// ====================================================================================================================
797797
// for individual byteBudget.bat calculation (note, mods must be disabled for byteBudget.bat):
798-
// * comment the LOAD_00_36_Callback_Overlay_Generic line below
798+
// * comment the LOAD_00_50_FULL line below
799799
// * uncomment the block of individual files below
800800
// * disable USE_DEFRAG in common.h
801801
// for defrag & Mods4.c (required for /AltMods):
802-
// * uncomment the LOAD_00_36_Callback_Overlay_Generic line below
802+
// * uncomment the LOAD_00_50_FULL line below
803803
// * comment the block of individual files below
804804
// * enable USE_DEFRAG in common.h
805805

806-
common, exe, LOAD_Callback_Overlay_Generic, 0x0, General/LOAD/LOAD_00_36_Callback_Overlay_Generic.c // 00 to 33
806+
common, exe, LOAD_Callback_Overlay_Generic, 0x0, General/LOAD/LOAD_00_50_FULL.c // 00 to 50
807807

808-
//LOAD_00_36_Callback_Overlay_Generic starts here ---v
808+
//LOAD_00_50_FULL starts here ---v
809809
//common, exe, LOAD_Callback_Overlay_Generic, 0x0, General/LOAD/LOAD_00_Callback_Overlay_Generic.c
810810
//common, exe, LOAD_Callback_Overlay_230, 0x0, General/LOAD/LOAD_01_Callback_Overlay_230.c
811811
//common, exe, LOAD_Callback_Overlay_231, 0x0, General/LOAD/LOAD_02_Callback_Overlay_231.c
@@ -828,7 +828,7 @@ common, exe, LOAD_Callback_Overlay_Generic, 0x0, General/LOAD/LOAD_00_36
828828
//common, exe, LOAD_VramFile, 0x0, General/LOAD/LOAD_19_VramFile.c
829829
//common, exe, LOAD_ReadFileASyncCallback, 0x0, General/LOAD/LOAD_20_ReadFileASyncCallback.c
830830
//common, exe, LOAD_ReadFile, 0x0, General/LOAD/LOAD_21_ReadFile.c
831-
//common, exe, LOAD_XnfFile, 0x0, General/LOAD/LOAD_22_XnfFile.c
831+
//common, exe, LOAD_XnfFile, 0x0, General/LOAD/LOAD_22_XnfFile.c
832832
//common, exe, LOAD_FindFile, 0x0, General/LOAD/LOAD_23_FindFile.c
833833
//common, exe, LOAD_HowlHeaderSectors, 0x0, General/LOAD/LOAD_24_HowlHeaderSectors.c
834834
//common, exe, LOAD_HowlCallback, 0x0, General/LOAD/LOAD_25_HowlCallback.c
@@ -843,22 +843,21 @@ common, exe, LOAD_Callback_Overlay_Generic, 0x0, General/LOAD/LOAD_00_36
843843
//common, exe, LOAD_AppendQueue, 0x0, General/LOAD/LOAD_34_AppendQueue.c
844844
//common, exe, LOAD_CDRequestCallback, 0x0, General/LOAD/LOAD_35_CDRequestCallback.c
845845
//common, exe, LOAD_NextQueuedFile, 0x0, General/LOAD/LOAD_36_NextQueuedFile.c
846-
//LOAD_00_36_Callback_Overlay_Generic ends here ---^
847-
848-
common, exe, LOAD_Hub_ReadFile, 0x0, General/LOAD/LOAD_37_Hub_ReadFile.c
849-
common, exe, LOAD_Hub_SwapNow, 0x0, General/LOAD/LOAD_38_Hub_SwapNow.c
850-
common, exe, LOAD_Hub_Main, 0x0, General/LOAD/LOAD_39_Hub_Main.c
851-
common, exe, LOAD_OvrLOD, 0x0, General/LOAD/LOAD_40_OvrLOD.c
852-
common, exe, LOAD_OvrEndRace, 0x0, General/LOAD/LOAD_41_OvrEndRace.c
853-
common, exe, LOAD_OvrThreads, 0x0, General/LOAD/LOAD_42_OvrThreads.c
854-
common, exe, LOAD_GetAdvPackIndex, 0x0, General/LOAD/LOAD_43_GetAdvPackIndex.c
855-
common, exe, LOAD_TenStages, 0x0, General/LOAD/LOAD_44_TenStages.c
856-
common, exe, LOAD_TalkingMask, 0x0, General/LOAD/LOAD_45_TalkingMask.c
857-
common, exe, LOAD_LevelFile, 0x0, General/LOAD/LOAD_46_LevelFile.c
858-
common, exe, LOAD_IsOpen_RacingOrBattle, 0x0, General/LOAD/LOAD_47_IsOpen_RacingOrBattle.c
859-
common, exe, LOAD_IsOpen_MainMenu, 0x0, General/LOAD/LOAD_48_IsOpen_MainMenu.c
860-
common, exe, LOAD_IsOpen_AdvHub, 0x0, General/LOAD/LOAD_49_IsOpen_AdvHub.c
861-
common, exe, LOAD_IsOpen_Podiums, 0x0, General/LOAD/LOAD_50_IsOpen_Podiums.c
846+
//common, exe, LOAD_Hub_ReadFile, 0x0, General/LOAD/LOAD_37_Hub_ReadFile.c
847+
//common, exe, LOAD_Hub_SwapNow, 0x0, General/LOAD/LOAD_38_Hub_SwapNow.c
848+
//common, exe, LOAD_Hub_Main, 0x0, General/LOAD/LOAD_39_Hub_Main.c
849+
//common, exe, LOAD_OvrLOD, 0x0, General/LOAD/LOAD_40_OvrLOD.c
850+
//common, exe, LOAD_OvrEndRace, 0x0, General/LOAD/LOAD_41_OvrEndRace.c
851+
//common, exe, LOAD_OvrThreads, 0x0, General/LOAD/LOAD_42_OvrThreads.c
852+
//common, exe, LOAD_GetAdvPackIndex, 0x0, General/LOAD/LOAD_43_GetAdvPackIndex.c
853+
//common, exe, LOAD_TenStages, 0x0, General/LOAD/LOAD_44_TenStages.c
854+
//common, exe, LOAD_TalkingMask, 0x0, General/LOAD/LOAD_45_TalkingMask.c
855+
//common, exe, LOAD_LevelFile, 0x0, General/LOAD/LOAD_46_LevelFile.c
856+
//common, exe, LOAD_IsOpen_RacingOrBattle, 0x0, General/LOAD/LOAD_47_IsOpen_RacingOrBattle.c
857+
//common, exe, LOAD_IsOpen_MainMenu, 0x0, General/LOAD/LOAD_48_IsOpen_MainMenu.c
858+
//common, exe, LOAD_IsOpen_AdvHub, 0x0, General/LOAD/LOAD_49_IsOpen_AdvHub.c
859+
//common, exe, LOAD_IsOpen_Podiums, 0x0, General/LOAD/LOAD_50_IsOpen_Podiums.c
860+
//LOAD_00_50_FULL ends here ---^
862861

863862
// ====================================================================================================================
864863
// MAIN (stubbed for this file)

0 commit comments

Comments
 (0)