mirror of
https://github.com/open-goal/jak-project
synced 2026-06-22 09:05:44 -04:00
5e987cc0e2
Fixes #2545 Fixes #2546 Fixes #2547 Fixes #2548 Fixes #2549 Fixes #2550 Fixes #2551 Fixes #2552 Fixes #2553 Fixes #2554 Fixes #2555 Fixes #2556 Fixes #2557 Fixes #2558 Fixes #2559 Fixes #2560 Fixes #2561 Fixes #2562 Fixes #2563 Fixes #2564 Fixes #2565 Fixes #2567 Fixes #2566 Fixes #2568 Fixes #2569 Fixes #2570 Fixes #2522 Fixes #2571 --------- Co-authored-by: water <awaterford111445@gmail.com> Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
122 lines
2.8 KiB
C++
122 lines
2.8 KiB
C++
#include "overlord.h"
|
|
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
|
|
#include "game/overlord/common/sbank.h"
|
|
#include "game/overlord/jak1/ramdisk.h"
|
|
#include "game/overlord/jak2/iso.h"
|
|
#include "game/overlord/jak2/iso_queue.h"
|
|
#include "game/overlord/jak2/srpc.h"
|
|
#include "game/overlord/jak2/ssound.h"
|
|
#include "game/sce/iop.h"
|
|
|
|
namespace jak2 {
|
|
using namespace iop;
|
|
|
|
u8* ScratchPadMemoryBase;
|
|
|
|
namespace {
|
|
// believed unused global
|
|
s32 SndPlayThread;
|
|
} // namespace
|
|
|
|
/*!
|
|
* Entry point for the overlord. This runs InitISOFS, registers the vblank handler, and starts up
|
|
* the threads. It returns and assumes that the IOP kernel runs the threads.
|
|
*/
|
|
int start_overlord(int, const char* const*) {
|
|
sceSifInit();
|
|
sceSifInitRpc(0);
|
|
printf("IOP: =========Startup===(%x)====\n", 0);
|
|
// removed memory prints.
|
|
|
|
ScratchPadMemory = (u8*)AllocScratchPad(0);
|
|
ScratchPadMemoryBase = ScratchPadMemory;
|
|
// removed allocation check code.
|
|
|
|
InitBanks();
|
|
InitSound_overlord();
|
|
jak1::InitRamdisk(); // ramdisk believed unused.
|
|
RegisterVblankHandler(0, 0x20, VBlank_Handler, 0);
|
|
|
|
// ramdisk believed unused.
|
|
ThreadParam param;
|
|
param.entry = jak1::Thread_Server;
|
|
param.attr = TH_C;
|
|
param.initPriority = 0x7a;
|
|
param.stackSize = 0x800;
|
|
param.option = 0;
|
|
strcpy(param.name, "Server"); // added
|
|
auto thread_server = CreateThread(¶m);
|
|
if (thread_server <= 0) {
|
|
return 1;
|
|
}
|
|
|
|
param.entry = Thread_Player;
|
|
param.attr = TH_C;
|
|
param.initPriority = 100;
|
|
param.stackSize = 0x800;
|
|
param.option = 0;
|
|
strcpy(param.name, "Player"); // added
|
|
auto thread_player = CreateThread(¶m);
|
|
if (thread_player <= 0) {
|
|
return 1;
|
|
}
|
|
|
|
param.entry = Thread_Loader;
|
|
param.attr = 0x73;
|
|
param.initPriority = TH_C;
|
|
param.stackSize = 0x1000;
|
|
param.option = 0;
|
|
SndPlayThread = thread_player;
|
|
auto thread_loader = CreateThread(¶m);
|
|
if (thread_loader <= 0) {
|
|
return 1;
|
|
}
|
|
|
|
InitISOFS(/*argv[1], argv[2]*/);
|
|
StartThread(thread_server, 0);
|
|
StartThread(thread_player, 0);
|
|
StartThread(thread_loader, 0);
|
|
printf("IOP: =========After inits=============\n");
|
|
// removed memory printing code
|
|
|
|
return 0;
|
|
}
|
|
|
|
static s32 gargc;
|
|
static const char* const* gargv;
|
|
static bool* init_complete;
|
|
|
|
static u32 call_start() {
|
|
start_overlord(gargc, gargv);
|
|
*init_complete = true;
|
|
|
|
while (true) {
|
|
SleepThread();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int start_overlord_wrapper(int argc, const char* const* argv, bool* signal) {
|
|
ThreadParam param = {};
|
|
|
|
gargc = argc;
|
|
gargv = argv;
|
|
init_complete = signal;
|
|
|
|
param.attr = TH_C;
|
|
param.initPriority = 0;
|
|
param.stackSize = 0x800;
|
|
param.option = 0;
|
|
strcpy(param.name, "start"); // added for debug
|
|
param.entry = call_start;
|
|
|
|
auto start_thread = CreateThread(¶m);
|
|
StartThread(start_thread, 0);
|
|
|
|
return 0;
|
|
}
|
|
|
|
} // namespace jak2
|