UnleashedRecomp/UnleashedRecomp/exports.cpp
Skyth (Asilkan) 999fe3c4eb
Compiling and running on Linux. (#49)
* Current work trying to get it to compile.

* Update vcpkg.json baseline.

* vcpkg, memory mapped file.

* Bitscan forward.

* Fix localtime_s.

* FPS patches high res clock.

* Rename Window to GameWindow. Fix guest pointers.

* GetCurrentThreadID gone.

* Code cache pointers, RenderWindow type.

* Add Linux stubs.

* Refactor Config.

* Fix paths.

* Add linux-release config.

* FS fixes.

* Fix Windows compilation errors & unicode converter crash.

* Rename physical memory allocation functions to not clash with X11.

* Fix NULL character being added on RtlMultiByteToUnicodeN.

* Use std::exit.

* Add protection to memory on Linux.

* Convert majority of dependencies to submodules. (#48)

* Convert majority of dependencies to submodules.

* Don't compile header-only libraries.

* Fix a few incorrect data types.

* Fix config directory.

* Unicode fixes & sizeof asserts.

* Change the exit function to not call static destructors.

* Fix files picker.

* Add RelWithDebInfo preset for Linux.

* Implement OS Restart on Linux. (#50)

---------

Co-authored-by: Dario <dariosamo@gmail.com>
2024-12-17 18:10:17 +00:00

35 lines
1.1 KiB
C++

#include <apu/embedded_player.h>
#include <kernel/function.h>
#include <kernel/heap.h>
#include <kernel/memory.h>
#include <cpu/guest_stack_var.h>
#include <ui/installer_wizard.h>
#include <ui/game_window.h>
#include <api/boost/smart_ptr/shared_ptr.h>
SWA_API void Game_PlaySound(const char* pName)
{
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);
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);
}
}
SWA_API void Window_SetFullscreen(bool isEnabled)
{
GameWindow::SetFullscreen(isEnabled);
}