You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: installer/main.c
+38-46Lines changed: 38 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -1,68 +1,61 @@
1
1
#include<iopheap.h>
2
2
#include<kernel.h>
3
-
#include<libcdvd.h>// For sceCd* functions if used (e.g. in system.c)
4
-
#include<libmc.h>// For mc* functions (e.g. in system.c)
5
-
#include<fileXio_rpc.h>// For fileXioDevctl, etc. (used in system.c)
6
-
#include<hdd-ioctl.h>// For HDDCTL_DEV9_SHUTDOWN (used here)
7
-
#include<loadfile.h>// For LoadExecPS2, SifLoadModule (if used directly, often in iop.c)
8
-
#include<malloc.h>// For memalign (used in system.c)
9
-
#include<sbv_patches.h>// For sbv_patch* (used in iop.c)
10
-
#include<sifcmd.h>// For SifInitRpc, SifExitRpc, etc.
3
+
#include<libcdvd.h>
4
+
#include<libmc.h>
5
+
#include<fileXio_rpc.h>
6
+
#include<hdd-ioctl.h>
7
+
#include<loadfile.h>
8
+
#include<malloc.h>
9
+
#include<sbv_patches.h>
10
+
#include<sifcmd.h>
11
11
#include<sifrpc.h>
12
-
#include<stdio.h>// For sprintf, printf (if DEBUG_PRINTF uses sio_printf, this might not be strictly needed for that)
13
-
#include<string.h>// For strcpy, strcmp, etc.
14
-
#include<wchar.h>// If any wide char functions were used by UI/Font (not directly in main.c usually)
12
+
#include<stdio.h>// For general C functions like sprintf, if not for sio_printf
13
+
#include<string.h>
14
+
#include<wchar.h>
15
15
16
-
#include<libgs.h>// For GS_BGCOLOUR and graphics init/deinit if used directly here
16
+
#include<libgs.h>
17
+
#include<sio.h>// <<< ADDED: For sio_init, even if DEBUG_TTY_FEEDBACK is off in main.h for DEBUG_PRINTF
17
18
18
19
// FMCB Project Specific Includes
19
-
#include"main.h"// Contains MainMenuEvents enum, extern g_Port/g_Slot, FMCB_INSTALLER_VERSION etc.
20
-
#include"iop.h"// For IopInitStart, IopDeinit, IOP_MOD_SET_MAIN
21
-
#include"pad.h"// For PadInitPads, PadDeinitPads (if not handled in UI)
22
-
#include"graphics.h"// For graphics functions (RedrawLoadingScreen, etc.)
23
-
#include"font.h"// For font handling (if used directly here)
24
-
25
-
// #include "libsecr.h" // libsecr functions are usually wrapped in system.c
26
-
// #include "mctools_rpc.h"// MCTools RPC functions are usually wrapped in system.c
27
-
#include"system.h"// For GetBootDeviceID, GetPs2Type, HDDCheckStatus, UpdateRegionalPaths, StartWorkerThread, StopWorkerThread, IsHDDBootingEnabled etc.
28
-
// #include "ReqSpaceCalc.h"// If used directly here
29
-
#include"UI.h"// For InitializeUI, DeinitializeUI, DisplayErrorMessage, etc.
30
-
#include"menu.h"// For MainMenu() and menu_opentuna_install() declarations
20
+
#include"main.h"
21
+
#include"iop.h"
22
+
#include"pad.h"
23
+
#include"graphics.h"
24
+
#include"font.h"
25
+
26
+
#include"system.h"
27
+
#include"UI.h"
28
+
#include"menu.h"
31
29
32
30
// --- Global Variable Definitions ---
33
-
// These are declared extern in main.h and used by other modules like menu_opentuna.c
34
-
intg_Port=0; // Default MC port (mc0)
35
-
intg_Slot=0; // Default MC slot (slot 0) - PS2 only has one slot per port controller
36
-
intIsHDDUnitConnected=0; // Tracks HDD status
31
+
intg_Port=0;
32
+
intg_Slot=0;
33
+
intIsHDDUnitConnected=0;
37
34
38
-
// Semaphores (defined here as they are fundamental to main's operation)
35
+
// Semaphores
39
36
intVBlankStartSema;
40
37
intInstallLockSema;
41
38
42
39
// --- Static Function Implementations ---
43
40
44
-
// VBlank Handler (from original main.c)
45
41
staticintVBlankStartHandler(intcause)
46
42
{
47
43
ee_sema_tsema_status;
48
44
iReferSemaStatus(VBlankStartSema, &sema_status);
49
45
if (sema_status.count<sema_status.max_count) {
50
46
iSignalSema(VBlankStartSema);
51
47
}
52
-
ExitHandler(); // From PS2SDK kernel.h
48
+
ExitHandler();
53
49
return0;
54
50
}
55
51
56
-
// Deinitialization services (from original main.c)
57
52
staticvoidDeinitServices(void)
58
53
{
59
54
DisableIntc(kINTC_VBLANK_START);
60
55
RemoveIntcHandler(kINTC_VBLANK_START, 0);
61
56
DeleteSema(VBlankStartSema);
62
57
DeleteSema(InstallLockSema);
63
-
64
-
IopDeinit(); // From iop.c
65
-
// PadDeinitPads(); // This is called within DeinitializeUI() in UI.c
58
+
IopDeinit();
66
59
}
67
60
68
61
// --- Main Application Entry Point ---
@@ -72,10 +65,12 @@ int main(int argc, char *argv[])
72
65
intresult_generic;
73
66
unsigned intFrameNum;
74
67
ee_sema_tsema_config;
75
-
intcurrent_event=MENU_EVENT_NONE; // Variable to hold event from MainMenu or submenus
68
+
intcurrent_event=MENU_EVENT_NONE;
76
69
70
+
// sio_init is called unconditionally, so <sio.h> must be included.
71
+
// The DEBUG_PRINTF macro in main.h will handle whether sio_printf actually outputs.
0 commit comments