Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziemas committed Jan 26, 2024
1 parent 66563b1 commit fa4191b
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 26 deletions.
4 changes: 1 addition & 3 deletions game/overlord/jak3/basefile.h
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -18,4 +17,3 @@ class CBaseFile {
};
} // namespace jak3

#endif // BASEFILE_H_
7 changes: 2 additions & 5 deletions game/overlord/jak3/basefilesystem.h
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,5 +15,3 @@ class CBaseFileSystem {
virtual VagDirEntryJak3* FindVagFile(const char* name) = 0;
};
} // namespace jak3

#endif // BASEFILESYSTEM_H_
7 changes: 1 addition & 6 deletions game/overlord/jak3/iso_structs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef ISO_STRUCTS_H_
#define ISO_STRUCTS_H_
#pragma once

#include "common/common_types.h"

Expand Down Expand Up @@ -29,9 +28,5 @@ struct VagDirJak3 {

struct VagDirEntry {};

struct ISOBuffer {};

struct ISOFileDef {};
} // namespace jak3

#endif // ISO_STRUCTS_H_
12 changes: 8 additions & 4 deletions game/overlord/jak3/overlord.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#ifndef OVERLORD_H_
#define OVERLORD_H_
#pragma once

#include <cstddef>

#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);
Expand All @@ -14,5 +20,3 @@ void InitSound();

int VBlank_Initialize();
} // namespace jak3

#endif
5 changes: 1 addition & 4 deletions game/overlord/jak3/pagemanager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PAGEMANAGER_H_
#define PAGEMANAGER_H_
#pragma once

#include "common/common_types.h"

Expand Down Expand Up @@ -40,5 +39,3 @@ class CPageManager {
};

} // namespace jak3

#endif // PAGEMANAGER_H_
33 changes: 33 additions & 0 deletions game/overlord/jak3/ramdisk.cpp
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions game/overlord/jak3/sbank.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef SBANK_H_
#define SBANK_H_
#pragma once

#include "common/common_types.h"

Expand All @@ -18,5 +17,3 @@ struct SoundBankInfo {
};
void InitBanks();
} // namespace jak3

#endif // SBANK_H_
52 changes: 52 additions & 0 deletions game/overlord/jak3/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
#include <cstring>

#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;

Expand All @@ -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;
}

Expand Down
6 changes: 6 additions & 0 deletions game/sce/iop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions game/sce/iop.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fa4191b

Please sign in to comment.