From 668f623256c6da6fe7d40aff07593ea3bc4feca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=97=B1=20PixelyIon?= Date: Tue, 3 Nov 2020 15:14:09 +0530 Subject: [PATCH] Implement Exceptional Signal Handler + Fix Destruction Behavior An exceptional signal handler allows us to convert an OS signal into a C++ exception, this allows us to alleviate a lot of crashes that would otherwise occur from signals being thrown during execution of games and be able to handle them gracefully. --- .idea/codeStyles/Project.xml | 4 +- .idea/compiler.xml | 6 + .idea/discord.xml | 2 +- .idea/inspectionProfiles/Project_Default.xml | 51 ++++++- .idea/kotlinc.xml | 6 + .idea/misc.xml | 2 +- .../Controller_Configuration.xml | 8 +- .idea/runConfigurations/Setting.xml | 8 +- .idea/scopes/SkylineNative.xml | 2 +- app/CMakeLists.txt | 2 + app/src/main/cpp/emu_jni.cpp | 64 +++++---- app/src/main/cpp/skyline/audio.cpp | 4 + app/src/main/cpp/skyline/audio.h | 2 + app/src/main/cpp/skyline/audio/common.h | 2 +- app/src/main/cpp/skyline/audio/track.h | 1 + app/src/main/cpp/skyline/common.cpp | 64 +-------- app/src/main/cpp/skyline/common.h | 63 ++------ .../{audio => common}/circular_buffer.h | 2 +- .../skyline/{gpu => common}/circular_queue.h | 4 +- app/src/main/cpp/skyline/common/settings.cpp | 65 +++++++++ app/src/main/cpp/skyline/common/settings.h | 50 +++++++ app/src/main/cpp/skyline/common/signal.cpp | 136 ++++++++++++++++++ app/src/main/cpp/skyline/common/signal.h | 66 +++++++++ app/src/main/cpp/skyline/gpu.h | 2 +- app/src/main/cpp/skyline/gpu/gpfifo.cpp | 33 ++++- app/src/main/cpp/skyline/gpu/gpfifo.h | 4 +- .../cpp/skyline/gpu/presentation_engine.cpp | 10 +- .../cpp/skyline/gpu/presentation_engine.h | 2 +- app/src/main/cpp/skyline/jvm.cpp | 15 +- app/src/main/cpp/skyline/kernel/memory.cpp | 5 + app/src/main/cpp/skyline/kernel/memory.h | 2 + app/src/main/cpp/skyline/kernel/svc.cpp | 53 +++---- .../cpp/skyline/kernel/types/KProcess.cpp | 7 +- .../main/cpp/skyline/kernel/types/KProcess.h | 16 ++- .../skyline/kernel/types/KSharedMemory.cpp | 2 +- .../main/cpp/skyline/kernel/types/KThread.cpp | 67 +++++---- .../main/cpp/skyline/kernel/types/KThread.h | 22 ++- app/src/main/cpp/skyline/nce.cpp | 111 ++++++++------ app/src/main/cpp/skyline/nce.h | 8 +- app/src/main/cpp/skyline/nce/guest.h | 4 + app/src/main/cpp/skyline/os.cpp | 3 +- app/src/main/cpp/skyline/os.h | 1 - .../cpp/skyline/services/account/IProfile.cpp | 1 + .../am/controller/ICommonStateGetter.cpp | 1 + .../java/emu/skyline/EmulationActivity.kt | 21 +-- 45 files changed, 692 insertions(+), 312 deletions(-) create mode 100644 .idea/compiler.xml create mode 100644 .idea/kotlinc.xml rename app/src/main/cpp/skyline/{audio => common}/circular_buffer.h (99%) rename app/src/main/cpp/skyline/{gpu => common}/circular_queue.h (97%) create mode 100644 app/src/main/cpp/skyline/common/settings.cpp create mode 100644 app/src/main/cpp/skyline/common/settings.h create mode 100644 app/src/main/cpp/skyline/common/signal.cpp create mode 100644 app/src/main/cpp/skyline/common/signal.h diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 410dc16c..2cb7b162 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -82,8 +82,8 @@ - - + + diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 00000000..61a9130c --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml index 78159505..0bf47d29 100644 --- a/.idea/discord.xml +++ b/.idea/discord.xml @@ -2,6 +2,6 @@ - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index dde74879..98e42156 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -175,6 +175,7 @@ + @@ -226,6 +227,7 @@ + @@ -257,6 +259,8 @@ + + @@ -280,6 +284,7 @@ + @@ -407,11 +412,13 @@ + + @@ -561,6 +568,7 @@ + @@ -672,7 +680,7 @@ - + @@ -825,6 +833,7 @@ + @@ -931,10 +940,12 @@ + + @@ -1283,7 +1294,9 @@ + + @@ -1324,6 +1337,7 @@ + @@ -1360,9 +1374,11 @@ + + @@ -1639,6 +1655,7 @@ + @@ -1654,11 +1671,14 @@ + + + @@ -1694,6 +1714,7 @@ + @@ -1782,6 +1803,7 @@ + @@ -1799,6 +1821,7 @@ + @@ -1807,6 +1830,10 @@ + + + + @@ -1958,6 +1985,7 @@ + @@ -1966,6 +1994,7 @@ + @@ -1978,6 +2007,8 @@ + + @@ -1986,6 +2017,7 @@ + @@ -2071,8 +2103,10 @@ + + @@ -2130,6 +2164,7 @@ + @@ -2234,6 +2269,7 @@ + @@ -2342,6 +2378,7 @@ + @@ -2449,6 +2486,7 @@ + @@ -2462,23 +2500,31 @@ + + + + + + - + + + @@ -2527,6 +2573,7 @@ + - + diff --git a/.idea/runConfigurations/Controller_Configuration.xml b/.idea/runConfigurations/Controller_Configuration.xml index 2770de74..6bd03f50 100644 --- a/.idea/runConfigurations/Controller_Configuration.xml +++ b/.idea/runConfigurations/Controller_Configuration.xml @@ -1,11 +1,12 @@ - +