Skip to content

Commit

Permalink
set up fake iso system class
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziemas committed May 1, 2024
1 parent a642e31 commit b8b5f9f
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 8 deletions.
5 changes: 5 additions & 0 deletions game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,13 @@ set(RUNTIME_SOURCE
overlord/jak2/streamlist.cpp
overlord/jak2/vag.cpp
overlord/jak3/start.cpp
overlord/jak3/iso_fake.cpp
overlord/jak3/iso.cpp
overlord/jak3/overlord.cpp
overlord/jak3/pagemanager.cpp
overlord/jak3/ramdisk.cpp
overlord/jak3/sbank.cpp
overlord/jak3/srpc.cpp
overlord/jak3/ssound.cpp
overlord/jak3/vblank_handler.cpp
runtime.cpp
Expand Down
4 changes: 2 additions & 2 deletions game/overlord/jak3/basefile.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

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

Expand All @@ -11,9 +12,8 @@ class CBaseFile {
virtual EIsoStatus SyncRead() = 0;
virtual void Close() = 0;

/* unk return values */
/* unk return values */
virtual void Unk1() = 0;
virtual void Unk2() = 0;
};
} // namespace jak3

26 changes: 26 additions & 0 deletions game/overlord/jak3/iso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

#include <cstring>

#include "common/log/log.h"

#include "game/common/dgo_rpc_types.h"
#include "game/overlord/jak3/basefilesystem.h"
#include "game/overlord/jak3/iso_fake.h"

namespace jak3 {
using namespace iop;
Expand All @@ -12,6 +16,27 @@ static ISO_LoadDGO s_LoadDGO;
int s_nSyncMbx;
CBaseFileSystem* g_pFileSystem;
MsgPacket s_MsgPacket_NotOnStackSync[2];
RPC_Dgo_Cmd s_aISO_RPCBuf[1];

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

static u32 DGOThread() {
sceSifQueueData dq;
sceSifServeData serve;

CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab3, RPC_DGO, s_aISO_RPCBuf, sizeof(s_aISO_RPCBuf), nullptr, nullptr,
&dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

return 0;
}

/* COMPLETE */
void InitDriver() {
Expand Down Expand Up @@ -47,6 +72,7 @@ int InitISOFS(const char* fs_mode, const char* loading_sceeen) {

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

return s_nISOInitFlag;
}
Expand Down
1 change: 1 addition & 0 deletions game/overlord/jak3/iso.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ struct ISO_Msg : ISO_Hdr {};

struct ISO_LoadDGO : ISO_Msg {};

int InitISOFS(const char* fs_mode, const char* loading_sceeen);
} // namespace jak3
36 changes: 36 additions & 0 deletions game/overlord/jak3/iso_fake.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "iso_fake.h"

namespace jak3 {
CFakeISOCDFileSystem g_FakeISOCDFileSystem;

int CFakeISOCDFileSystem::Init() {
return 0;
}

void CFakeISOCDFileSystem::PollDrive() {}

const ISOFileDef* CFakeISOCDFileSystem::Find(const char* name) {
return nullptr;
}

const ISOFileDef* CFakeISOCDFileSystem::FindIN(const char* name) {
return nullptr;
}

int CFakeISOCDFileSystem::GetLength(const ISOFileDef* def) {
return 0;
}

int CFakeISOCDFileSystem::Open(const ISOFileDef* def, int offset, EFileComp mode) {
return 0;
}

int CFakeISOCDFileSystem::OpenWad(const ISOFileDef* def, int offset) {
return 0;
}

VagDirEntryJak3* CFakeISOCDFileSystem::FindVagFile(const char* name) {
return nullptr;
}

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

#include "basefile.h"
#include "basefilesystem.h"

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

namespace jak3 {
class CFakeISOCDFileSystem : public CBaseFileSystem {
int Init() override;
void PollDrive() override;
const ISOFileDef* Find(const char* name) override;
const ISOFileDef* FindIN(const char* name) override;
int GetLength(const ISOFileDef* def) override;
int Open(const ISOFileDef* def, int offset, EFileComp mode) override;
int OpenWad(const ISOFileDef* def, int offset) override;
VagDirEntryJak3* FindVagFile(const char* name) override;
};

class CFakeISOCDFile : public CBaseFile {
EIsoStatus BeginRead(ISOBuffer*) override;
EIsoStatus SyncRead() override;
void Close() override;

/* unk return values */
void Unk1() override;
void Unk2() override;
};

extern CFakeISOCDFileSystem g_FakeISOCDFileSystem;

} // namespace jak3

#endif // ISO_FAKE_H_
2 changes: 1 addition & 1 deletion game/overlord/jak3/iso_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct VagDirJak3 {
u32 version;
u32 count;
VagDirEntryJak3 entries[0];
} dir;
};

struct VagDirEntry {};

Expand Down
3 changes: 2 additions & 1 deletion game/overlord/jak3/ramdisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ u32 Thread_Server() {
CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab2, RPC_Ramdisk, gRamDisk_RPCBUF, nullptr, nullptr, &dq);
sceSifRegisterRpc(&serve, 0xfab2, RPC_Ramdisk, gRamDisk_RPCBUF, sizeof(gRamDisk_RPCBUF), nullptr,
nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

Expand Down
6 changes: 4 additions & 2 deletions game/overlord/jak3/srpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ u32 Thread_Player() {
CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab0, RPC_Player, s_anSRPC_PlayerBuf, nullptr, nullptr, &dq);
sceSifRegisterRpc(&serve, 0xfab0, RPC_Player, s_anSRPC_PlayerBuf, sizeof(s_anSRPC_PlayerBuf),
nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

Expand All @@ -44,7 +45,8 @@ u32 Thread_Loader() {
CpuDisableIntr();
sceSifInitRpc(0);
sceSifSetRpcQueue(&dq, GetThreadId());
sceSifRegisterRpc(&serve, 0xfab1, RPC_Loader, s_anSRPC_LoaderBuf, nullptr, nullptr, &dq);
sceSifRegisterRpc(&serve, 0xfab1, RPC_Loader, s_anSRPC_LoaderBuf, sizeof(s_anSRPC_LoaderBuf),
nullptr, nullptr, &dq);
CpuEnableIntr();
sceSifRpcLoop(&dq);

Expand Down
3 changes: 2 additions & 1 deletion game/overlord/jak3/start.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <cstdio>
#include <cstring>

#include "iso.h"
#include "overlord.h"
#include "ramdisk.h"
#include "sbank.h"
Expand Down Expand Up @@ -70,7 +71,7 @@ int start_overlord(int argc, const char* const* argp) {
return 1;
}

//CDvdDriver::Initialize(&g_DvdDriver);
// CDvdDriver::Initialize(&g_DvdDriver);
InitISOFS(argp[1], argp[2]);

StartThread(g_nServerThreadID, 0);
Expand Down
6 changes: 5 additions & 1 deletion game/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include "common/common_types.h"

#ifdef OS_POSIX
#include <unistd.h>

Expand Down Expand Up @@ -78,6 +79,7 @@
#include "game/overlord/jak2/stream.h"
#include "game/overlord/jak2/streamlist.h"
#include "game/overlord/jak2/vag.h"
#include "game/overlord/jak3/overlord.h"
#include "game/system/Deci2Server.h"
#include "game/system/iop_thread.h"
#include "sce/deci2.h"
Expand Down Expand Up @@ -323,9 +325,11 @@ void iop_runner(SystemThreadInterface& iface, GameVersion version) {
jak1::start_overlord_wrapper(iop.overlord_argc, iop.overlord_argv, &complete);
break;
case GameVersion::Jak2:
case GameVersion::Jak3: // TODO: jak3 using jak2's overlord.
jak2::start_overlord_wrapper(iop.overlord_argc, iop.overlord_argv, &complete);
break;
case GameVersion::Jak3:
jak3::start_overlord_wrapper(iop.overlord_argc, iop.overlord_argv, &complete);
break;
default:
ASSERT_NOT_REACHED();
}
Expand Down

0 comments on commit b8b5f9f

Please sign in to comment.