Skip to content

Commit

Permalink
start all rpc threads
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziemas committed May 1, 2024
1 parent b8b5f9f commit 4cf0a1d
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 4 deletions.
1 change: 1 addition & 0 deletions game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ set(RUNTIME_SOURCE
overlord/jak3/sbank.cpp
overlord/jak3/srpc.cpp
overlord/jak3/ssound.cpp
overlord/jak3/stream.cpp
overlord/jak3/vblank_handler.cpp
runtime.cpp
sce/deci2.cpp
Expand Down
38 changes: 34 additions & 4 deletions game/overlord/jak3/iso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
#include "game/common/dgo_rpc_types.h"
#include "game/overlord/jak3/basefilesystem.h"
#include "game/overlord/jak3/iso_fake.h"
#include "game/overlord/jak3/stream.h"

namespace jak3 {
using namespace iop;

CBaseFileSystem* g_pFileSystem;
int g_nDGOThreadID;
int g_nSTRThreadID;
int g_nPlayThreadID;

static int s_nISOInitFlag;
static ISO_LoadDGO s_LoadDGO;
int s_nSyncMbx;
CBaseFileSystem* g_pFileSystem;
MsgPacket s_MsgPacket_NotOnStackSync[2];
RPC_Dgo_Cmd s_aISO_RPCBuf[1];
static int s_nSyncMbx;
static MsgPacket s_MsgPacket_NotOnStackSync[2];
static RPC_Dgo_Cmd s_aISO_RPCBuf[1];

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

thp.attr = TH_C;
thp.entry = DGOThread;
thp.initPriority = 0x38;
thp.option = 0;
thp.stackSize = 0x900;
g_nDGOThreadID = CreateThread(&thp);

thp.attr = TH_C;
thp.entry = STRThread;
thp.initPriority = 0x39;
thp.option = 0;
thp.stackSize = 0x900;
g_nSTRThreadID = CreateThread(&thp);

thp.attr = TH_C;
thp.entry = PLAYThread;
thp.initPriority = 0x35;
thp.option = 0;
thp.stackSize = 0x900;
g_nPlayThreadID = CreateThread(&thp);

StartThread(g_nDGOThreadID, 0);
StartThread(g_nSTRThreadID, 0);
StartThread(g_nPlayThreadID, 0);

return s_nISOInitFlag;
}

Expand Down
54 changes: 54 additions & 0 deletions game/overlord/jak3/stream.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "common/common_types.h"
#include "common/log/log.h"

#include "game/common/str_rpc_types.h"
#include "game/sce/iop.h"

namespace jak3 {
using namespace iop;

static RPC_Str_Cmd_Jak2 sRPCBuf[1];
static RPC_Str_Cmd_Jak2 sRPCBuf2[4];

static void* RPC_STR(unsigned int /*fno*/, void* _cmd, int /*y*/);
static void* RPC_PLAY(unsigned int /*fno*/, void* _cmd, int size);

u32 STRThread() {
sceSifQueueData dq;
sceSifServeData serve;

CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab4, RPC_STR, sRPCBuf, sizeof(sRPCBuf), nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

return 0;
}

u32 PLAYThread() {
sceSifQueueData dq;
sceSifServeData serve;

CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab5, RPC_PLAY, sRPCBuf2, sizeof(sRPCBuf2), nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

return 0;
}

static void* RPC_STR(unsigned int /*fno*/, void* _cmd, int /*y*/) {
lg::error("RPC_STR UNIMPLEMENTED");
return nullptr;
}

static void* RPC_PLAY(unsigned int /*fno*/, void* _cmd, int size) {
lg::error("RPC_PLAY UNIMPLEMENTED");
return nullptr;
}

} // namespace jak3
11 changes: 11 additions & 0 deletions game/overlord/jak3/stream.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef STREAM_H_
#define STREAM_H_

#include "common/common_types.h"

namespace jak3 {
u32 STRThread();
u32 PLAYThread();
} // namespace jak3

#endif // STREAM_H_

0 comments on commit 4cf0a1d

Please sign in to comment.