From 2d744da68c31814ee3d5d3696aaa4d6bf5955a21 Mon Sep 17 00:00:00 2001 From: Bonta <40473493+Bonta0@users.noreply.github.com> Date: Sun, 4 Jul 2021 13:09:46 +0200 Subject: [PATCH] Core: Add GBA host interface --- Source/Android/jni/MainAndroid.cpp | 5 +++++ Source/Core/Core/Host.h | 18 ++++++++++++++++++ Source/Core/DolphinNoGUI/MainNoGUI.cpp | 5 +++++ Source/Core/DolphinQt/Host.cpp | 5 +++++ Source/DSPTool/StubHost.cpp | 4 ++++ Source/UnitTests/StubHost.cpp | 4 ++++ 6 files changed, 41 insertions(+) diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index e1066f1584..765bab1bcb 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -173,6 +173,11 @@ void Host_TitleChanged() env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetOnTitleChanged()); } +std::unique_ptr Host_CreateGBAHost(std::weak_ptr core) +{ + return nullptr; +} + static bool MsgAlert(const char* caption, const char* text, bool yes_no, Common::MsgType style) { // If a panic alert happens very early in the execution of a game, we can crash here with diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h index a66e36b360..dad850a5b2 100644 --- a/Source/Core/Core/Host.h +++ b/Source/Core/Core/Host.h @@ -3,9 +3,12 @@ #pragma once +#include #include #include +#include "Common/CommonTypes.h" + // Host - defines an interface for the emulator core to communicate back to the // OS-specific layer // @@ -23,6 +26,19 @@ // The host can be just a command line app that opens a window, or a full blown debugger // interface. +namespace HW::GBA +{ +class Core; +} // namespace HW::GBA + +class GBAHostInterface +{ +public: + virtual ~GBAHostInterface() = default; + virtual void GameChanged() = 0; + virtual void FrameEnded(const std::vector& video_buffer) = 0; +}; + enum class HostMessageID { // Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on @@ -47,3 +63,5 @@ void Host_UpdateMainFrame(); void Host_UpdateTitle(const std::string& title); void Host_YieldToUI(); void Host_TitleChanged(); + +std::unique_ptr Host_CreateGBAHost(std::weak_ptr core); diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 31ddb591bb..26b0e69a22 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -119,6 +119,11 @@ void Host_TitleChanged() #endif } +std::unique_ptr Host_CreateGBAHost(std::weak_ptr core) +{ + return nullptr; +} + static std::unique_ptr GetPlatform(const optparse::Values& options) { std::string platform_name = static_cast(options.get("platform")); diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index 29215f5bbe..61cbc7036d 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -229,3 +229,8 @@ void Host_TitleChanged() Discord::UpdateDiscordPresence(); #endif } + +std::unique_ptr Host_CreateGBAHost(std::weak_ptr core) +{ + return nullptr; +} diff --git a/Source/DSPTool/StubHost.cpp b/Source/DSPTool/StubHost.cpp index c782978fc7..de20be198f 100644 --- a/Source/DSPTool/StubHost.cpp +++ b/Source/DSPTool/StubHost.cpp @@ -52,6 +52,10 @@ void Host_YieldToUI() void Host_TitleChanged() { } +std::unique_ptr Host_CreateGBAHost(std::weak_ptr core) +{ + return nullptr; +} bool Host_UIBlocksControllerState() { return false; diff --git a/Source/UnitTests/StubHost.cpp b/Source/UnitTests/StubHost.cpp index ebb0915f31..233af18f79 100644 --- a/Source/UnitTests/StubHost.cpp +++ b/Source/UnitTests/StubHost.cpp @@ -56,3 +56,7 @@ void Host_YieldToUI() void Host_TitleChanged() { } +std::unique_ptr Host_CreateGBAHost(std::weak_ptr core) +{ + return nullptr; +}