diff --git a/game/overlord/jak3/basefile.h b/game/overlord/jak3/basefile.h index 6d6a2fe6c34..da71cfaa4eb 100644 --- a/game/overlord/jak3/basefile.h +++ b/game/overlord/jak3/basefile.h @@ -1,5 +1,4 @@ -#ifndef BASEFILE_H_ -#define BASEFILE_H_ +#pragma once #include "game/overlord/jak3/iso_structs.h" #include "game/overlord/jak3/overlord.h" @@ -18,4 +17,3 @@ class CBaseFile { }; } // namespace jak3 -#endif // BASEFILE_H_ diff --git a/game/overlord/jak3/basefilesystem.h b/game/overlord/jak3/basefilesystem.h index 2803428231f..18100f66e08 100644 --- a/game/overlord/jak3/basefilesystem.h +++ b/game/overlord/jak3/basefilesystem.h @@ -1,12 +1,11 @@ -#ifndef BASEFILESYSTEM_H_ -#define BASEFILESYSTEM_H_ +#pragma once #include "game/overlord/jak3/iso_structs.h" namespace jak3 { class CBaseFileSystem { public: - virtual void Init() = 0; + virtual int Init() = 0; virtual void PollDrive() = 0; virtual const ISOFileDef* Find(const char* name) = 0; virtual const ISOFileDef* FindIN(const char* name) = 0; @@ -16,5 +15,3 @@ class CBaseFileSystem { virtual VagDirEntryJak3* FindVagFile(const char* name) = 0; }; } // namespace jak3 - -#endif // BASEFILESYSTEM_H_ diff --git a/game/overlord/jak3/iso_structs.h b/game/overlord/jak3/iso_structs.h index 7af569aa763..8e3b997c286 100644 --- a/game/overlord/jak3/iso_structs.h +++ b/game/overlord/jak3/iso_structs.h @@ -1,5 +1,4 @@ -#ifndef ISO_STRUCTS_H_ -#define ISO_STRUCTS_H_ +#pragma once #include "common/common_types.h" @@ -29,9 +28,5 @@ struct VagDirJak3 { struct VagDirEntry {}; -struct ISOBuffer {}; - struct ISOFileDef {}; } // namespace jak3 - -#endif // ISO_STRUCTS_H_ diff --git a/game/overlord/jak3/overlord.h b/game/overlord/jak3/overlord.h index 8fae9fe51f2..15261e4a636 100644 --- a/game/overlord/jak3/overlord.h +++ b/game/overlord/jak3/overlord.h @@ -1,9 +1,15 @@ -#ifndef OVERLORD_H_ -#define OVERLORD_H_ +#pragma once #include +#include "common/common_types.h" + namespace jak3 { + +struct Vec3 { + s32 x, y, z; +}; + enum class EIsoStatus { Unk }; int start_overlord_wrapper(int argc, const char* const* argv, bool* signal); @@ -14,5 +20,3 @@ void InitSound(); int VBlank_Initialize(); } // namespace jak3 - -#endif diff --git a/game/overlord/jak3/pagemanager.h b/game/overlord/jak3/pagemanager.h index 6c5e5283d1b..8ac7cc5a2df 100644 --- a/game/overlord/jak3/pagemanager.h +++ b/game/overlord/jak3/pagemanager.h @@ -1,5 +1,4 @@ -#ifndef PAGEMANAGER_H_ -#define PAGEMANAGER_H_ +#pragma once #include "common/common_types.h" @@ -40,5 +39,3 @@ class CPageManager { }; } // namespace jak3 - -#endif // PAGEMANAGER_H_ diff --git a/game/overlord/jak3/ramdisk.cpp b/game/overlord/jak3/ramdisk.cpp index e69de29bb2d..43a960253e9 100644 --- a/game/overlord/jak3/ramdisk.cpp +++ b/game/overlord/jak3/ramdisk.cpp @@ -0,0 +1,33 @@ +#include "ramdisk.h" + +#include "common/log/log.h" + +#include "game/sce/iop.h" + +namespace jak3 { +using namespace iop; + +static u8 gRamDisk_RPCBUF[40]; + +static void* RPC_Ramdisk(u32 fno, void* data, int size) { + lg::error("RPC_RAMDISK UNIMPLEMENTED"); + return nullptr; +} + +void InitRamdisk() {} + +u32 Thread_Server() { + sceSifQueueData dq; + sceSifServeData serve; + + CpuDisableIntr(); + sceSifInitRpc(0); + sceSifSetRpcQueue(&dq, GetThreadId()); + sceSifRegisterRpc(&serve, 0xfab2, RPC_Ramdisk, gRamDisk_RPCBUF, nullptr, nullptr, &dq); + CpuEnableIntr(); + sceSifRpcLoop(&dq); + + return 0; +} + +} // namespace jak3 diff --git a/game/overlord/jak3/sbank.h b/game/overlord/jak3/sbank.h index 310f890ef34..69a41942380 100644 --- a/game/overlord/jak3/sbank.h +++ b/game/overlord/jak3/sbank.h @@ -1,5 +1,4 @@ -#ifndef SBANK_H_ -#define SBANK_H_ +#pragma once #include "common/common_types.h" @@ -18,5 +17,3 @@ struct SoundBankInfo { }; void InitBanks(); } // namespace jak3 - -#endif // SBANK_H_ diff --git a/game/overlord/jak3/start.cpp b/game/overlord/jak3/start.cpp index f53da86a3e8..4b1695b6d2b 100644 --- a/game/overlord/jak3/start.cpp +++ b/game/overlord/jak3/start.cpp @@ -2,13 +2,19 @@ #include #include "overlord.h" +#include "ramdisk.h" #include "sbank.h" +#include "game/overlord/jak3/srpc.h" #include "game/sce/iop.h" namespace jak3 { using namespace iop; +int g_nServerThreadID; +int g_nPlayerThreadID; +int g_nLoaderThreadID; + int start_overlord(int argc, const char* const* argp) { ThreadParam thp; @@ -31,6 +37,52 @@ int start_overlord(int argc, const char* const* argp) { InitSound(); VBlank_Initialize(); + thp.attr = TH_C; + thp.option = 0; + thp.entry = Thread_Server; + thp.stackSize = 0x800; + thp.initPriority = 59; + g_nServerThreadID = CreateThread(&thp); + if (g_nServerThreadID < 0) { + Panic(); + return 1; + } + + thp.attr = TH_C; + thp.option = 0; + thp.entry = Thread_Player; + thp.stackSize = 0xb00; + thp.initPriority = 54; + g_nPlayerThreadID = CreateThread(&thp); + if (g_nPlayerThreadID < 0) { + Panic(); + return 1; + } + + thp.attr = TH_C; + thp.option = 0; + thp.entry = Thread_Loader; + thp.stackSize = 0x900; + thp.initPriority = 58; + g_nLoaderThreadID = CreateThread(&thp); + if (g_nPlayerThreadID < 0) { + Panic(); + return 1; + } + + //CDvdDriver::Initialize(&g_DvdDriver); + InitISOFS(argp[1], argp[2]); + + StartThread(g_nServerThreadID, 0); + StartThread(g_nPlayerThreadID, 0); + StartThread(g_nLoaderThreadID, 0); + + printf("======== overlrd2.irx post-startup ========\n"); + // printf(" mem size: %lu\n", QueryMemSize()); + // printf("total mem free: %lu\n", QueryTotalFreeMemSize()); + // printf(" max mem free: %lu\n", QueryMaxFreeMemSize()); + // printf(" used: %lu\n", QueryMemSize() - QueryTotalFreeMemSize()); + return 0; } diff --git a/game/sce/iop.cpp b/game/sce/iop.cpp index fff38a8f145..15a5f94d279 100644 --- a/game/sce/iop.cpp +++ b/game/sce/iop.cpp @@ -193,6 +193,12 @@ s32 SendMbx(s32 mbxid, void* sendmsg) { return iop->kernel.SendMbx(mbxid, sendmsg); } +s32 ReceiveMbx(MsgPacket** recvmsg, int mbxid) { + ASSERT(false); + // TODO + return 0; +} + s32 PollMbx(MsgPacket** recvmsg, int mbxid) { return iop->kernel.PollMbx((void**)recvmsg, mbxid); } diff --git a/game/sce/iop.h b/game/sce/iop.h index 165e8f70744..b7426765665 100644 --- a/game/sce/iop.h +++ b/game/sce/iop.h @@ -131,6 +131,7 @@ int sceCdDiskReady(int mode); u32 sceSifSetDma(sceSifDmaData* sdd, int len); s32 SendMbx(int mbxid, void* sendmsg); +s32 ReceiveMbx(MsgPacket** recvmsg, int mbxid); s32 PollMbx(MsgPacket** recvmsg, int mbxid); s32 PeekMbx(s32 mbx); s32 CreateMbx(MbxParam* param);