mirror of
https://github.com/open-goal/jak-project
synced 2026-07-10 15:14:15 -04:00
766b328c97
* Accept player RPC commands in overlord * Remove the .projectile file I use emacs for everything so I don't want it to only look at the goal code. * Fill out most of the unique player structs * Decompile most of ssound.c * Silence some spam * Comment out WaitSema instance * Add a file with definitions for snd_ functions Makes it compile without commenting them out. Maybe it'd be nice to maintain the original API usage in overlord for similarity and shim them to whatever API the player uses. * Make SoundBank statically sized again. Didn't realise this was used in an array. MSVC should be happy again. Not sure what the actual size of these should be. * Fix logic issue * Finish RPC Loader * More RPC_Player * Play RPC command * All the RPC commands added * Call Music/Bank loaders * audio: add almost all `.MUS` and `.SBK` files to build process * Include TWEAKVAL in build output * Load banks and music tweaks * Comment out spam * Sound struct unk -> is music * Also test if empty1.sbk was found For the sake of tests. * Get rid of PC_DEBUG_SOUND_ENABLE Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
109 lines
2.8 KiB
C++
109 lines
2.8 KiB
C++
#include "iso_api.h"
|
|
#include "game/overlord/srpc.h"
|
|
#include "game/sce/iop.h"
|
|
#include "common/log/log.h"
|
|
#include "sbank.h"
|
|
#include "common/util/Assert.h"
|
|
|
|
using namespace iop;
|
|
|
|
/*!
|
|
* Load a File to IOP memory (blocking)
|
|
*/
|
|
s32 LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) {
|
|
lg::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) {
|
|
lg::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) {
|
|
lg::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;
|
|
}
|
|
|
|
/*!
|
|
* Send a command to the ISO thread to load a sound bank. This will sleep the calling thread
|
|
* until the load has completed.
|
|
*/
|
|
void LoadSoundBank(const char* bank_name, SoundBank* bank) {
|
|
(void)bank;
|
|
ASSERT(strlen(bank_name) < 16);
|
|
SoundBankLoadCommand cmd;
|
|
cmd.cmd_id = LOAD_SOUND_BANK;
|
|
cmd.messagebox_to_reply = 0;
|
|
cmd.thread_id = GetThreadId();
|
|
strcpy(cmd.bank_name, bank_name);
|
|
cmd.bank = bank;
|
|
SendMbx(iso_mbx, &cmd);
|
|
SleepThread(); // wait for finish.
|
|
}
|
|
|
|
void LoadMusic(const char* music_name, s32* bank) {
|
|
ASSERT(strlen(music_name) < 16);
|
|
MusicLoadCommand cmd;
|
|
cmd.cmd_id = LOAD_MUSIC;
|
|
cmd.messagebox_to_reply = 0;
|
|
cmd.thread_id = GetThreadId();
|
|
strcpy(cmd.music_name, music_name);
|
|
cmd.music_handle = bank;
|
|
SendMbx(iso_mbx, &cmd);
|
|
SleepThread();
|
|
|
|
for (int i = 0; i < gMusicTweakInfo.TweakCount; i++) {
|
|
if (!strcmp(gMusicTweakInfo.MusicTweak[i].MusicName, music_name)) {
|
|
gMusicTweak = gMusicTweakInfo.MusicTweak[i].VolumeAdjust;
|
|
return;
|
|
}
|
|
}
|
|
|
|
gMusicTweak = 0x80;
|
|
}
|