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 b54c4ba
Show file tree
Hide file tree
Showing 16 changed files with 306 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_
64 changes: 64 additions & 0 deletions game/overlord/jak3/iso.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "iso.h"

#include <cstring>

#include "game/overlord/jak3/basefilesystem.h"

namespace jak3 {
using namespace iop;

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

/* COMPLETE */
void InitDriver() {
if (g_pFileSystem->Init() == 0) {
s_nISOInitFlag = 0;
}

SendMbx(s_nSyncMbx, &s_MsgPacket_NotOnStackSync[0]);
}

/* TODO unfinished */
static int LookMbx() {
MsgPacket* pkt;

int ret = PollMbx(&pkt, s_nSyncMbx);
if (ret != KE_MBOX_NOMSG) {
// FIXME
}

return ret != KE_MBOX_NOMSG;
}

/* COMPLETE */
static void WaitMbx(int mbx) {
MsgPacket* pkt;
ReceiveMbx(&pkt, mbx);
}

/* TODO unfinished */
int InitISOFS(const char* fs_mode, const char* loading_sceeen) {
ThreadParam thp;
MbxParam mbx;

memset(&s_LoadDGO, 0, sizeof(s_LoadDGO));
s_nISOInitFlag = 1;

return s_nISOInitFlag;
}

/* COMPLETE */
const ISOFileDef* FindISOFile(char* name) {
return g_pFileSystem->Find(name);
}

/* COMPLETE */
s32 GetISOFileLength(const ISOFileDef* fd) {
return g_pFileSystem->GetLength(fd);
}

} // namespace jak3
24 changes: 24 additions & 0 deletions game/overlord/jak3/iso.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include "game/sce/iop.h"

namespace jak3 {

struct ISOBuffer {
void AdjustDataLength(int);
void AdvanceCurrentData(int);
};

struct ISO_Hdr {
iop::MsgPacket msg;

void SetActive();
void SetUnk1();
void SetUnk2();
};

struct ISO_Msg : ISO_Hdr {};

struct ISO_LoadDGO : ISO_Msg {};

} // namespace jak3
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
9 changes: 9 additions & 0 deletions game/overlord/jak3/ramdisk.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include "common/common_types.h"

namespace jak3 {

u32 Thread_Server();

}
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_
54 changes: 54 additions & 0 deletions game/overlord/jak3/srpc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "srpc.h"

#include "common/log/log.h"

#include "game/sce/iop.h"

namespace jak3 {
using namespace iop;

constexpr int SRPC_MESSAGE_SIZE = 0x50;
constexpr int SRPC_MESSAGE_COUNT = 128;

static u8 s_anSRPC_PlayerBuf[SRPC_MESSAGE_SIZE * SRPC_MESSAGE_COUNT];
static u8 s_anSRPC_LoaderBuf[SRPC_MESSAGE_SIZE];

static void* RPC_Player(u32 fno, void* data, int size) {
lg::error("RPC_PLAYER UNIMPLEMENTED");
return nullptr;
}

static void* RPC_Loader(u32 fno, void* data, int size) {
lg::error("RPC_LOADER UNIMPLEMENTED");
return nullptr;
}

u32 Thread_Player() {
sceSifQueueData dq;
sceSifServeData serve;

CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab0, RPC_Player, s_anSRPC_PlayerBuf, nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

return 0;
}

u32 Thread_Loader() {
sceSifQueueData dq;
sceSifServeData serve;

CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab1, RPC_Loader, s_anSRPC_LoaderBuf, nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

return 0;
}

} // namespace jak3
10 changes: 10 additions & 0 deletions game/overlord/jak3/srpc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "common/common_types.h"

namespace jak3 {

u32 Thread_Player();
u32 Thread_Loader();

}
39 changes: 39 additions & 0 deletions game/overlord/jak3/ssound.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once

#include "common/common_types.h"

#include "game/overlord/jak3/overlord.h"

namespace jak3 {

struct Curve {
s32 p1;
s32 p2;
s32 p3;
s32 p4;
};

struct SoundPlayParams {
u16 mask;
s16 pitch_mod;
s16 bend;
s16 fo_min;
s16 fo_max;
s8 fo_curve;
s8 priority;
s32 volume;
Vec3 trans;
u8 group;
u8 reg[3];
};

struct SoundInfo {
char name[16];
s32 id;
u32 sound_handle;
s32 auto_volume;
s32 auto_time;
SoundPlayParams params;
};

} // namespace jak3
Loading

0 comments on commit b54c4ba

Please sign in to comment.