mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-13 15:18:37 +02:00
fix for crashes on TLS due to openorbis being W E I R D
This commit is contained in:
parent
c9c3762c8e
commit
cf2d3a15bc
3 changed files with 30 additions and 3 deletions
|
|
@ -196,7 +196,14 @@ struct Values {
|
||||||
linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
|
linkage, false, "dump_audio_commands", Category::Audio, Specialization::Default, false};
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
SwitchableSetting<bool> use_multi_core{linkage, true, "use_multi_core", Category::Core};
|
SwitchableSetting<bool> use_multi_core{linkage,
|
||||||
|
#ifdef __OPENORBIS__
|
||||||
|
// Re-enable once proper TLS support is added
|
||||||
|
false,
|
||||||
|
#else
|
||||||
|
true,
|
||||||
|
#endif
|
||||||
|
"use_multi_core", Category::Core};
|
||||||
SwitchableSetting<MemoryLayout, true> memory_layout_mode{linkage,
|
SwitchableSetting<MemoryLayout, true> memory_layout_mode{linkage,
|
||||||
MemoryLayout::Memory_4Gb,
|
MemoryLayout::Memory_4Gb,
|
||||||
"memory_layout_mode",
|
"memory_layout_mode",
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ struct Ucontext {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boost::container::static_vector<std::pair<void*, size_t>, 16> swap_regions;
|
static boost::container::static_vector<std::pair<void*, size_t>, 16> swap_regions;
|
||||||
|
extern "C" int sceKernelRemoveExceptionHandler(s32 sig_num);
|
||||||
static void SwapHandler(int sig, void* raw_context) {
|
static void SwapHandler(int sig, void* raw_context) {
|
||||||
auto& mctx = ((Orbis::Ucontext*)raw_context)->uc_mcontext;
|
auto& mctx = ((Orbis::Ucontext*)raw_context)->uc_mcontext;
|
||||||
if (std::ranges::find_if(swap_regions, [addr = mctx.mc_addr](auto const& e) {
|
if (std::ranges::find_if(swap_regions, [addr = mctx.mc_addr](auto const& e) {
|
||||||
|
|
@ -116,8 +117,8 @@ static void SwapHandler(int sig, void* raw_context) {
|
||||||
void* res = mmap(aligned_addr, page_size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
|
void* res = mmap(aligned_addr, page_size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||||
ASSERT(res != MAP_FAILED);
|
ASSERT(res != MAP_FAILED);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(HW_Memory, "fault in addr {:#x}", mctx.mc_addr);
|
LOG_ERROR(HW_Memory, "fault in addr {:#x} at {:#x}", mctx.mc_addr, mctx.mc_rip); // print caller address
|
||||||
sceSystemServiceLoadExec("EXIT", nullptr);
|
sceKernelRemoveExceptionHandler(SIGSEGV); // to not catch the next signal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void InitSwap() noexcept {
|
void InitSwap() noexcept {
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,10 @@ struct InputSubsystem::Impl {
|
||||||
#ifdef ENABLE_LIBUSB
|
#ifdef ENABLE_LIBUSB
|
||||||
RegisterEngine("gcpad", gcadapter);
|
RegisterEngine("gcpad", gcadapter);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
|
// TODO: Issue in PS4, crash for UDP_client
|
||||||
RegisterEngine("cemuhookudp", udp_client);
|
RegisterEngine("cemuhookudp", udp_client);
|
||||||
|
#endif
|
||||||
RegisterEngine("tas", tas_input);
|
RegisterEngine("tas", tas_input);
|
||||||
RegisterEngine("camera", camera);
|
RegisterEngine("camera", camera);
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|
@ -116,7 +119,9 @@ struct InputSubsystem::Impl {
|
||||||
#ifdef ENABLE_LIBUSB
|
#ifdef ENABLE_LIBUSB
|
||||||
UnregisterEngine(gcadapter);
|
UnregisterEngine(gcadapter);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
UnregisterEngine(udp_client);
|
UnregisterEngine(udp_client);
|
||||||
|
#endif
|
||||||
UnregisterEngine(tas_input);
|
UnregisterEngine(tas_input);
|
||||||
UnregisterEngine(camera);
|
UnregisterEngine(camera);
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|
@ -152,8 +157,10 @@ struct InputSubsystem::Impl {
|
||||||
auto gcadapter_devices = gcadapter->GetInputDevices();
|
auto gcadapter_devices = gcadapter->GetInputDevices();
|
||||||
devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
|
devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
auto udp_devices = udp_client->GetInputDevices();
|
auto udp_devices = udp_client->GetInputDevices();
|
||||||
devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
|
devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
auto joycon_devices = joycon->GetInputDevices();
|
auto joycon_devices = joycon->GetInputDevices();
|
||||||
devices.insert(devices.end(), joycon_devices.begin(), joycon_devices.end());
|
devices.insert(devices.end(), joycon_devices.begin(), joycon_devices.end());
|
||||||
|
|
@ -186,9 +193,11 @@ struct InputSubsystem::Impl {
|
||||||
return gcadapter;
|
return gcadapter;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
if (engine == udp_client->GetEngineName()) {
|
if (engine == udp_client->GetEngineName()) {
|
||||||
return udp_client;
|
return udp_client;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
if (engine == sdl->GetEngineName()) {
|
if (engine == sdl->GetEngineName()) {
|
||||||
return sdl;
|
return sdl;
|
||||||
|
|
@ -271,9 +280,11 @@ struct InputSubsystem::Impl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
if (engine == udp_client->GetEngineName()) {
|
if (engine == udp_client->GetEngineName()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (engine == tas_input->GetEngineName()) {
|
if (engine == tas_input->GetEngineName()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +311,9 @@ struct InputSubsystem::Impl {
|
||||||
#ifdef ENABLE_LIBUSB
|
#ifdef ENABLE_LIBUSB
|
||||||
gcadapter->BeginConfiguration();
|
gcadapter->BeginConfiguration();
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
udp_client->BeginConfiguration();
|
udp_client->BeginConfiguration();
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
sdl->BeginConfiguration();
|
sdl->BeginConfiguration();
|
||||||
joycon->BeginConfiguration();
|
joycon->BeginConfiguration();
|
||||||
|
|
@ -316,7 +329,9 @@ struct InputSubsystem::Impl {
|
||||||
#ifdef ENABLE_LIBUSB
|
#ifdef ENABLE_LIBUSB
|
||||||
gcadapter->EndConfiguration();
|
gcadapter->EndConfiguration();
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
udp_client->EndConfiguration();
|
udp_client->EndConfiguration();
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
sdl->EndConfiguration();
|
sdl->EndConfiguration();
|
||||||
joycon->EndConfiguration();
|
joycon->EndConfiguration();
|
||||||
|
|
@ -341,7 +356,9 @@ struct InputSubsystem::Impl {
|
||||||
std::shared_ptr<Mouse> mouse;
|
std::shared_ptr<Mouse> mouse;
|
||||||
std::shared_ptr<TouchScreen> touch_screen;
|
std::shared_ptr<TouchScreen> touch_screen;
|
||||||
std::shared_ptr<TasInput::Tas> tas_input;
|
std::shared_ptr<TasInput::Tas> tas_input;
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
|
std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
|
||||||
|
#endif
|
||||||
std::shared_ptr<Camera> camera;
|
std::shared_ptr<Camera> camera;
|
||||||
std::shared_ptr<VirtualAmiibo> virtual_amiibo;
|
std::shared_ptr<VirtualAmiibo> virtual_amiibo;
|
||||||
std::shared_ptr<VirtualGamepad> virtual_gamepad;
|
std::shared_ptr<VirtualGamepad> virtual_gamepad;
|
||||||
|
|
@ -470,7 +487,9 @@ bool InputSubsystem::IsStickInverted(const Common::ParamPackage& params) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputSubsystem::ReloadInputDevices() {
|
void InputSubsystem::ReloadInputDevices() {
|
||||||
|
#ifndef __OPENORBIS__
|
||||||
impl->udp_client.get()->ReloadSockets();
|
impl->udp_client.get()->ReloadSockets();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputSubsystem::BeginMapping(Polling::InputType type) {
|
void InputSubsystem::BeginMapping(Polling::InputType type) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue