@@ -13,35 +13,21 @@ namespace jak3 {
1313using namespace iop ;
1414
1515CBaseFileSystem* g_pFileSystem;
16+ int g_nISOThreadID;
1617int g_nDGOThreadID;
1718int g_nSTRThreadID;
1819int g_nPlayThreadID;
20+ int g_nISOMbx;
1921
2022static int s_nISOInitFlag;
2123static ISO_LoadDGO s_LoadDGO;
2224static int s_nSyncMbx;
2325static MsgPacket s_MsgPacket_NotOnStackSync[2 ];
2426static RPC_Dgo_Cmd s_aISO_RPCBuf[1 ];
27+ static int s_nDGOMbx;
2528
26- static void * RPC_DGO (u32 fno, void * data, int size) {
27- lg::error (" RPC_DGO UNIMPLEMENTED" );
28- return nullptr ;
29- }
30-
31- static u32 DGOThread () {
32- sceSifQueueData dq;
33- sceSifServeData serve;
34-
35- CpuDisableIntr ();
36- sceSifInitRpc (0 );
37- sceSifSetRpcQueue (&dq, GetThreadId ());
38- sceSifRegisterRpc (&serve, 0xfab3 , RPC_DGO, s_aISO_RPCBuf, sizeof (s_aISO_RPCBuf), nullptr , nullptr ,
39- &dq);
40- CpuEnableIntr ();
41- sceSifRpcLoop (&dq);
42-
43- return 0 ;
44- }
29+ static u32 DGOThread ();
30+ u32 ISOThread ();
4531
4632/* COMPLETE */
4733void InitDriver () {
@@ -79,6 +65,25 @@ int InitISOFS(const char* fs_mode, const char* loading_sceeen) {
7965 s_nISOInitFlag = 1 ;
8066 g_pFileSystem = &g_FakeISOCDFileSystem;
8167
68+ mbx.attr = 0 ;
69+ mbx.option = 0 ;
70+ g_nISOMbx = CreateMbx (&mbx);
71+
72+ mbx.attr = 0 ;
73+ mbx.option = 0 ;
74+ s_nDGOMbx = CreateMbx (&mbx);
75+
76+ mbx.attr = 0 ;
77+ mbx.option = 0 ;
78+ s_nSyncMbx = CreateMbx (&mbx);
79+
80+ thp.attr = TH_C;
81+ thp.entry = ISOThread;
82+ thp.initPriority = 0x37 ;
83+ thp.option = 0 ;
84+ thp.stackSize = 0x1100 ;
85+ g_nISOThreadID = CreateThread (&thp);
86+
8287 thp.attr = TH_C;
8388 thp.entry = DGOThread;
8489 thp.initPriority = 0x38 ;
@@ -100,13 +105,76 @@ int InitISOFS(const char* fs_mode, const char* loading_sceeen) {
100105 thp.stackSize = 0x900 ;
101106 g_nPlayThreadID = CreateThread (&thp);
102107
108+ StartThread (g_nISOThreadID, 0 );
103109 StartThread (g_nDGOThreadID, 0 );
104110 StartThread (g_nSTRThreadID, 0 );
105111 StartThread (g_nPlayThreadID, 0 );
106112
107113 return s_nISOInitFlag;
108114}
109115
116+ u32 ISOThread () {
117+ while (true ) {
118+ DelayThread (4000 );
119+ }
120+
121+ return 0 ;
122+ }
123+
124+ static void ISO_LoadDGO (RPC_Dgo_Cmd* msg);
125+ static void ISO_LoadNextDGO (RPC_Dgo_Cmd* msg);
126+ static void ISO_CancelDGO (RPC_Dgo_Cmd* msg);
127+
128+ static void * RPC_DGO (u32 fno, void * data, int size) {
129+ auto * msg = static_cast <RPC_Dgo_Cmd*>(data);
130+
131+ switch (fno) {
132+ case 0 :
133+ ISO_LoadDGO (msg);
134+ break ;
135+ case 1 :
136+ ISO_LoadNextDGO (msg);
137+ break ;
138+ case 2 :
139+ ISO_CancelDGO (msg);
140+ break ;
141+ default :
142+ msg->result = 1 ;
143+ break ;
144+ }
145+ return data;
146+ }
147+
148+ static u32 DGOThread () {
149+ sceSifQueueData dq;
150+ sceSifServeData serve;
151+
152+ CpuDisableIntr ();
153+ sceSifInitRpc (0 );
154+ sceSifSetRpcQueue (&dq, GetThreadId ());
155+ sceSifRegisterRpc (&serve, 0xfab3 , RPC_DGO, s_aISO_RPCBuf, sizeof (s_aISO_RPCBuf), nullptr , nullptr ,
156+ &dq);
157+ CpuEnableIntr ();
158+ sceSifRpcLoop (&dq);
159+
160+ return 0 ;
161+ }
162+
163+ static void ISO_LoadDGO (RPC_Dgo_Cmd* msg) {
164+ auto * def = g_pFileSystem->Find (msg->name );
165+ if (def == nullptr ) {
166+ msg->result = 1 ;
167+ return ;
168+ }
169+
170+ msg->buffer1 = msg->buffer_heap_top ;
171+ msg->result = 0 ;
172+ }
173+
174+ static void ISO_LoadNextDGO (RPC_Dgo_Cmd* msg) {}
175+
176+ static void ISO_CancelDGO (RPC_Dgo_Cmd* msg) {}
177+
110178/* COMPLETE */
111179const ISOFileDef* FindISOFile (char * name) {
112180 return g_pFileSystem->Find (name);
0 commit comments