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:
Darío
2024-12-12 16:17:12 -03:00
committed by GitHub
parent a56aca27be
commit 27eab0af66
14 changed files with 404 additions and 41 deletions
+17 -13
View File
@@ -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)