mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-05-06 11:00:16 -05:00
Installer sounds and embedded player. (#29)
* Embedded player implementation. * Rework embedded sound player to support simultaneous playback. * Add more embedded sounds. * Update submodule. * Update. * Move engine initialization. * Use guest audio configuration values in embedded player. * Miniaudio submodule on dev branch. * Implement libvorbis. * Update resources submodule. --------- Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
This commit is contained in:
+17
-13
@@ -1,3 +1,4 @@
|
||||
#include <apu/embedded_player.h>
|
||||
#include <kernel/function.h>
|
||||
#include <kernel/heap.h>
|
||||
#include <kernel/memory.h>
|
||||
@@ -8,21 +9,24 @@
|
||||
|
||||
SWA_API void Game_PlaySound(const char* pName)
|
||||
{
|
||||
// TODO: use own sound player.
|
||||
if (InstallerWizard::s_isVisible)
|
||||
return;
|
||||
if (EmbeddedPlayer::s_isActive)
|
||||
{
|
||||
EmbeddedPlayer::Play(pName);
|
||||
}
|
||||
else
|
||||
{
|
||||
guest_stack_var<boost::anonymous_shared_ptr> soundPlayer;
|
||||
GuestToHostFunction<void>(sub_82B4DF50, soundPlayer.get(), ((be<uint32_t>*)g_memory.Translate(0x83367900))->get(), 7, 0, 0);
|
||||
|
||||
guest_stack_var<boost::anonymous_shared_ptr> soundPlayer;
|
||||
GuestToHostFunction<void>(sub_82B4DF50, soundPlayer.get(), ((be<uint32_t>*)g_memory.Translate(0x83367900))->get(), 7, 0, 0);
|
||||
auto soundPlayerVtable = (be<uint32_t>*)g_memory.Translate(*(be<uint32_t>*)soundPlayer->get());
|
||||
uint32_t virtualFunction = *(soundPlayerVtable + 1);
|
||||
|
||||
auto soundPlayerVtable = (be<uint32_t>*)g_memory.Translate(*(be<uint32_t>*)soundPlayer->get());
|
||||
uint32_t virtualFunction = *(soundPlayerVtable + 1);
|
||||
|
||||
size_t strLen = strlen(pName);
|
||||
void* strAllocation = g_userHeap.Alloc(strLen + 1);
|
||||
memcpy(strAllocation, pName, strLen + 1);
|
||||
GuestToHostFunction<void>(virtualFunction, soundPlayer->get(), strAllocation, 0);
|
||||
g_userHeap.Free(strAllocation);
|
||||
size_t strLen = strlen(pName);
|
||||
void *strAllocation = g_userHeap.Alloc(strLen + 1);
|
||||
memcpy(strAllocation, pName, strLen + 1);
|
||||
GuestToHostFunction<void>(virtualFunction, soundPlayer->get(), strAllocation, 0);
|
||||
g_userHeap.Free(strAllocation);
|
||||
}
|
||||
}
|
||||
|
||||
SWA_API void Window_SetFullscreen(bool isEnabled)
|
||||
|
||||
Reference in New Issue
Block a user