From e35251ac748974db1760d29161306d36d830dc92 Mon Sep 17 00:00:00 2001 From: offtkp Date: Tue, 24 Oct 2023 15:50:10 +0300 Subject: [PATCH 1/4] Minor hydra gl interface fixup --- src/hydra_core.cpp | 12 +++++++----- third_party/hydra_core | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/hydra_core.cpp b/src/hydra_core.cpp index 3c809dc34..25da67538 100644 --- a/src/hydra_core.cpp +++ b/src/hydra_core.cpp @@ -18,8 +18,8 @@ class HC_GLOBAL HydraCore final : public hydra::IBase, public hydra::IOpenGlRend void setOutputSize(hydra::Size size) override; // IOpenGlRendered + void resetContext() override; void setFbo(unsigned handle) override; - void setContext(void* context) override; void setGetProcAddress(void* function) override; // IFrontendDriven @@ -34,6 +34,7 @@ class HC_GLOBAL HydraCore final : public hydra::IBase, public hydra::IOpenGlRend RendererGL* renderer; void (*pollInputCallback)() = nullptr; int32_t (*checkButtonCallback)(uint32_t player, hydra::ButtonType button) = nullptr; + void* getProcAddress = nullptr; }; HydraCore::HydraCore() : emulator(new Emulator) { @@ -100,13 +101,13 @@ hydra::Size HydraCore::getNativeSize() { return {400, 480}; } // Size doesn't matter as the glBlitFramebuffer call is commented out for the core void HydraCore::setOutputSize(hydra::Size size) {} -void HydraCore::setGetProcAddress(void* function) { +void HydraCore::resetContext() { #ifdef __ANDROID__ - if (!gladLoadGLES2Loader(reinterpret_cast(function))) { + if (!gladLoadGLES2Loader(reinterpret_cast(getProcAddress))) { Helpers::panic("OpenGL ES init failed"); } #else - if (!gladLoadGLLoader(reinterpret_cast(function))) { + if (!gladLoadGLLoader(reinterpret_cast(getProcAddress))) { Helpers::panic("OpenGL init failed"); } #endif @@ -114,9 +115,10 @@ void HydraCore::setGetProcAddress(void* function) { emulator->initGraphicsContext(nullptr); } -void HydraCore::setContext(void*) {} void HydraCore::setFbo(unsigned handle) { renderer->setFBO(handle); } +void HydraCore::setGetProcAddress(void* function) { getProcAddress = function; } + void HydraCore::setPollInputCallback(void (*callback)()) { pollInputCallback = callback; } void HydraCore::setCheckButtonCallback(int32_t (*callback)(uint32_t player, hydra::ButtonType button)) { checkButtonCallback = callback; } diff --git a/third_party/hydra_core b/third_party/hydra_core index e4cc6b0fc..28311efe6 160000 --- a/third_party/hydra_core +++ b/third_party/hydra_core @@ -1 +1 @@ -Subproject commit e4cc6b0fc224583e509bc3472a4c11eafb69c041 +Subproject commit 28311efe6e96af0b192f07179fe87dadab479041 From 9e30e6a14c6625a2c2f88ffba54d131e9d119fef Mon Sep 17 00:00:00 2001 From: offtkp Date: Tue, 24 Oct 2023 18:34:27 +0300 Subject: [PATCH 2/4] destroyContext function stub --- src/hydra_core.cpp | 3 +++ third_party/hydra_core | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hydra_core.cpp b/src/hydra_core.cpp index 25da67538..793e3abfa 100644 --- a/src/hydra_core.cpp +++ b/src/hydra_core.cpp @@ -19,6 +19,7 @@ class HC_GLOBAL HydraCore final : public hydra::IBase, public hydra::IOpenGlRend // IOpenGlRendered void resetContext() override; + void destroyContext() override; void setFbo(unsigned handle) override; void setGetProcAddress(void* function) override; @@ -115,6 +116,8 @@ void HydraCore::resetContext() { emulator->initGraphicsContext(nullptr); } +void HydraCore::destroyContext() {} + void HydraCore::setFbo(unsigned handle) { renderer->setFBO(handle); } void HydraCore::setGetProcAddress(void* function) { getProcAddress = function; } diff --git a/third_party/hydra_core b/third_party/hydra_core index 28311efe6..1cdb1eda5 160000 --- a/third_party/hydra_core +++ b/third_party/hydra_core @@ -1 +1 @@ -Subproject commit 28311efe6e96af0b192f07179fe87dadab479041 +Subproject commit 1cdb1eda5f368481e216416a119c85664e8c72ab From 7345e2e2553c96055a0527f11abc9386cf1b7de4 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:09:14 +0300 Subject: [PATCH 3/4] Update hydra_core.cpp --- src/hydra_core.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hydra_core.cpp b/src/hydra_core.cpp index 793e3abfa..6d1a9a1da 100644 --- a/src/hydra_core.cpp +++ b/src/hydra_core.cpp @@ -90,7 +90,6 @@ void HydraCore::runFrame() { } hid.updateInputs(emulator->getTicks()); - emulator->runFrame(); } @@ -116,16 +115,14 @@ void HydraCore::resetContext() { emulator->initGraphicsContext(nullptr); } -void HydraCore::destroyContext() {} - +void HydraCore::destroyContext() { emulator.deinitGraphicsContext(); } void HydraCore::setFbo(unsigned handle) { renderer->setFBO(handle); } - void HydraCore::setGetProcAddress(void* function) { getProcAddress = function; } void HydraCore::setPollInputCallback(void (*callback)()) { pollInputCallback = callback; } void HydraCore::setCheckButtonCallback(int32_t (*callback)(uint32_t player, hydra::ButtonType button)) { checkButtonCallback = callback; } -HC_API hydra::IBase* createEmulator() { return new HydraCore; } +HC_API hydra::IBase* createEmulator() { return new HydraCore(); } HC_API void destroyEmulator(hydra::IBase* emulator) { delete emulator; } HC_API const char* getInfo(hydra::InfoType type) { @@ -145,4 +142,4 @@ HC_API const char* getInfo(hydra::InfoType type) { default: return nullptr; } -} \ No newline at end of file +} From f48359f6304aec1264ae3019b7e11d010f79a374 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:23:31 +0300 Subject: [PATCH 4/4] Fix derp --- src/hydra_core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hydra_core.cpp b/src/hydra_core.cpp index 6d1a9a1da..3ecf70194 100644 --- a/src/hydra_core.cpp +++ b/src/hydra_core.cpp @@ -115,7 +115,7 @@ void HydraCore::resetContext() { emulator->initGraphicsContext(nullptr); } -void HydraCore::destroyContext() { emulator.deinitGraphicsContext(); } +void HydraCore::destroyContext() { emulator->deinitGraphicsContext(); } void HydraCore::setFbo(unsigned handle) { renderer->setFBO(handle); } void HydraCore::setGetProcAddress(void* function) { getProcAddress = function; }