Files
jak-project/game/overlord/iso_api.cpp
T
water111 19b8bb81c9 Add the STR RPC to overlord and game code (#134)
* work in progress streaming rpc, simple test is working

* actually add the test

* debug windows failure

* windows fix maybe

* windows 2

* use str-load-status

* update types
2020-11-22 12:59:55 -05:00

70 lines
1.9 KiB
C++

#include "iso_api.h"
#include "game/sce/iop.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
using namespace iop;
/*!
* Load a File to IOP memory (blocking)
*/
s32 LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) {
// printf("[OVERLORD] LoadISOFileToIOP %s, %d/%d bytes\n", file->name, length, file->size);
spdlog::debug("[OVERLORD] LoadISOFileToIOP {}, {}/{} bytes", file->name, length, file->size);
IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_IOP_CMD_ID;
cmd.messagebox_to_reply = 0;
cmd.thread_id = GetThreadId();
cmd.file_record = file;
cmd.dest_addr = (u8*)addr;
cmd.length = length;
SendMbx(iso_mbx, &cmd);
SleepThread();
if (cmd.status) {
cmd.length_to_copy = 0;
}
return cmd.length_to_copy;
}
/*!
* Load a File to IOP memory (blocking)
*/
s32 LoadISOFileToEE(FileRecord* file, uint32_t addr, uint32_t length) {
// printf("[OVERLORD] LoadISOFileToEE %s, %d/%d bytes\n", file->name, length, file->size);
spdlog::debug("[OVERLORD] LoadISOFileToEE {}, {}/{} bytes", file->name, length, file->size);
IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_EE_CMD_ID;
cmd.messagebox_to_reply = 0;
cmd.thread_id = GetThreadId();
cmd.file_record = file;
cmd.dest_addr = (u8*)(u64)addr;
cmd.length = length;
SendMbx(iso_mbx, &cmd);
SleepThread();
if (cmd.status) {
cmd.length_to_copy = 0;
}
return cmd.length_to_copy;
}
s32 LoadISOFileChunkToEE(FileRecord* file, uint32_t dest_addr, uint32_t length, uint32_t offset) {
spdlog::debug("[OVERLORD] LoadISOFileChunkToEE {} : {} offset {}\n", file->name, length, offset);
IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_EE_OFFSET_CMD_ID;
cmd.messagebox_to_reply = 0;
cmd.thread_id = GetThreadId();
cmd.file_record = file;
cmd.dest_addr = (u8*)(u64)dest_addr;
cmd.length = length;
cmd.offset = offset;
SendMbx(iso_mbx, &cmd);
SleepThread();
if (cmd.status) {
cmd.length_to_copy = 0;
}
return cmd.length_to_copy;
}