Skip to content

Commit 4cf0a1d

Browse files
committed
start all rpc threads
1 parent b8b5f9f commit 4cf0a1d

File tree

4 files changed

+100
-4
lines changed

4 files changed

+100
-4
lines changed

game/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ set(RUNTIME_SOURCE
260260
overlord/jak3/sbank.cpp
261261
overlord/jak3/srpc.cpp
262262
overlord/jak3/ssound.cpp
263+
overlord/jak3/stream.cpp
263264
overlord/jak3/vblank_handler.cpp
264265
runtime.cpp
265266
sce/deci2.cpp

game/overlord/jak3/iso.cpp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
#include "game/common/dgo_rpc_types.h"
88
#include "game/overlord/jak3/basefilesystem.h"
99
#include "game/overlord/jak3/iso_fake.h"
10+
#include "game/overlord/jak3/stream.h"
1011

1112
namespace jak3 {
1213
using namespace iop;
1314

15+
CBaseFileSystem* g_pFileSystem;
16+
int g_nDGOThreadID;
17+
int g_nSTRThreadID;
18+
int g_nPlayThreadID;
19+
1420
static int s_nISOInitFlag;
1521
static ISO_LoadDGO s_LoadDGO;
16-
int s_nSyncMbx;
17-
CBaseFileSystem* g_pFileSystem;
18-
MsgPacket s_MsgPacket_NotOnStackSync[2];
19-
RPC_Dgo_Cmd s_aISO_RPCBuf[1];
22+
static int s_nSyncMbx;
23+
static MsgPacket s_MsgPacket_NotOnStackSync[2];
24+
static RPC_Dgo_Cmd s_aISO_RPCBuf[1];
2025

2126
static void* RPC_DGO(u32 fno, void* data, int size) {
2227
lg::error("RPC_DGO UNIMPLEMENTED");
@@ -74,6 +79,31 @@ int InitISOFS(const char* fs_mode, const char* loading_sceeen) {
7479
s_nISOInitFlag = 1;
7580
g_pFileSystem = &g_FakeISOCDFileSystem;
7681

82+
thp.attr = TH_C;
83+
thp.entry = DGOThread;
84+
thp.initPriority = 0x38;
85+
thp.option = 0;
86+
thp.stackSize = 0x900;
87+
g_nDGOThreadID = CreateThread(&thp);
88+
89+
thp.attr = TH_C;
90+
thp.entry = STRThread;
91+
thp.initPriority = 0x39;
92+
thp.option = 0;
93+
thp.stackSize = 0x900;
94+
g_nSTRThreadID = CreateThread(&thp);
95+
96+
thp.attr = TH_C;
97+
thp.entry = PLAYThread;
98+
thp.initPriority = 0x35;
99+
thp.option = 0;
100+
thp.stackSize = 0x900;
101+
g_nPlayThreadID = CreateThread(&thp);
102+
103+
StartThread(g_nDGOThreadID, 0);
104+
StartThread(g_nSTRThreadID, 0);
105+
StartThread(g_nPlayThreadID, 0);
106+
77107
return s_nISOInitFlag;
78108
}
79109

game/overlord/jak3/stream.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include "common/common_types.h"
2+
#include "common/log/log.h"
3+
4+
#include "game/common/str_rpc_types.h"
5+
#include "game/sce/iop.h"
6+
7+
namespace jak3 {
8+
using namespace iop;
9+
10+
static RPC_Str_Cmd_Jak2 sRPCBuf[1];
11+
static RPC_Str_Cmd_Jak2 sRPCBuf2[4];
12+
13+
static void* RPC_STR(unsigned int /*fno*/, void* _cmd, int /*y*/);
14+
static void* RPC_PLAY(unsigned int /*fno*/, void* _cmd, int size);
15+
16+
u32 STRThread() {
17+
sceSifQueueData dq;
18+
sceSifServeData serve;
19+
20+
CpuDisableIntr();
21+
sceSifInitRpc(0);
22+
sceSifSetRpcQueue(&dq, GetThreadId());
23+
sceSifRegisterRpc(&serve, 0xfab4, RPC_STR, sRPCBuf, sizeof(sRPCBuf), nullptr, nullptr, &dq);
24+
CpuEnableIntr();
25+
sceSifRpcLoop(&dq);
26+
27+
return 0;
28+
}
29+
30+
u32 PLAYThread() {
31+
sceSifQueueData dq;
32+
sceSifServeData serve;
33+
34+
CpuDisableIntr();
35+
sceSifInitRpc(0);
36+
sceSifSetRpcQueue(&dq, GetThreadId());
37+
sceSifRegisterRpc(&serve, 0xfab5, RPC_PLAY, sRPCBuf2, sizeof(sRPCBuf2), nullptr, nullptr, &dq);
38+
CpuEnableIntr();
39+
sceSifRpcLoop(&dq);
40+
41+
return 0;
42+
}
43+
44+
static void* RPC_STR(unsigned int /*fno*/, void* _cmd, int /*y*/) {
45+
lg::error("RPC_STR UNIMPLEMENTED");
46+
return nullptr;
47+
}
48+
49+
static void* RPC_PLAY(unsigned int /*fno*/, void* _cmd, int size) {
50+
lg::error("RPC_PLAY UNIMPLEMENTED");
51+
return nullptr;
52+
}
53+
54+
} // namespace jak3

game/overlord/jak3/stream.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef STREAM_H_
2+
#define STREAM_H_
3+
4+
#include "common/common_types.h"
5+
6+
namespace jak3 {
7+
u32 STRThread();
8+
u32 PLAYThread();
9+
} // namespace jak3
10+
11+
#endif // STREAM_H_

0 commit comments

Comments
 (0)