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.
This commit is contained in:
◱ PixelyIon
2020-11-03 15:14:09 +05:30
committed by ◱ PixelyIon
parent 3cde568c51
commit 668f623256
45 changed files with 692 additions and 312 deletions

View File

@ -5,8 +5,8 @@
#include "jvm.h"
#include "presentation_engine.h"
extern skyline::u16 fps;
extern skyline::u32 frametime;
extern skyline::u16 Fps;
extern skyline::u32 FrameTime;
namespace skyline::gpu {
PresentationEngine::PresentationEngine(const DeviceState &state) : state(state), vsyncEvent(std::make_shared<kernel::type::KEvent>(state)), bufferEvent(std::make_shared<kernel::type::KEvent>(state)) {}
@ -29,7 +29,7 @@ namespace skyline::gpu {
if (!env->IsSameObject(newSurface, nullptr))
surface = env->NewGlobalRef(newSurface);
if (surface) {
window = ANativeWindow_fromSurface(state.jvm->GetEnv(), surface);
window = ANativeWindow_fromSurface(env, surface);
ANativeWindow_acquire(window);
resolution.width = static_cast<u32>(ANativeWindow_getWidth(window));
resolution.height = static_cast<u32>(ANativeWindow_getHeight(window));
@ -73,8 +73,8 @@ namespace skyline::gpu {
if (frameTimestamp) {
auto now{util::GetTimeNs()};
frametime = static_cast<u32>((now - frameTimestamp) / 10000); // frametime / 100 is the real ms value, this is to retain the first two decimals
fps = static_cast<u16>(constant::NsInSecond / (now - frameTimestamp));
FrameTime = static_cast<u32>((now - frameTimestamp) / 10000); // frametime / 100 is the real ms value, this is to retain the first two decimals
Fps = static_cast<u16>(constant::NsInSecond / (now - frameTimestamp));
frameTimestamp = now;
} else {