Core: Add GBA host interface

This commit is contained in:
Bonta 2021-07-04 13:09:46 +02:00
parent d849d56695
commit 2d744da68c
6 changed files with 41 additions and 0 deletions

View File

@ -173,6 +173,11 @@ void Host_TitleChanged()
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetOnTitleChanged()); env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetOnTitleChanged());
} }
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core)
{
return nullptr;
}
static bool MsgAlert(const char* caption, const char* text, bool yes_no, Common::MsgType style) 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 // If a panic alert happens very early in the execution of a game, we can crash here with

View File

@ -3,9 +3,12 @@
#pragma once #pragma once
#include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "Common/CommonTypes.h"
// Host - defines an interface for the emulator core to communicate back to the // Host - defines an interface for the emulator core to communicate back to the
// OS-specific layer // 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 // The host can be just a command line app that opens a window, or a full blown debugger
// interface. // 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<u32>& video_buffer) = 0;
};
enum class HostMessageID enum class HostMessageID
{ {
// Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on // 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_UpdateTitle(const std::string& title);
void Host_YieldToUI(); void Host_YieldToUI();
void Host_TitleChanged(); void Host_TitleChanged();
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core);

View File

@ -119,6 +119,11 @@ void Host_TitleChanged()
#endif #endif
} }
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core)
{
return nullptr;
}
static std::unique_ptr<Platform> GetPlatform(const optparse::Values& options) static std::unique_ptr<Platform> GetPlatform(const optparse::Values& options)
{ {
std::string platform_name = static_cast<const char*>(options.get("platform")); std::string platform_name = static_cast<const char*>(options.get("platform"));

View File

@ -229,3 +229,8 @@ void Host_TitleChanged()
Discord::UpdateDiscordPresence(); Discord::UpdateDiscordPresence();
#endif #endif
} }
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core)
{
return nullptr;
}

View File

@ -52,6 +52,10 @@ void Host_YieldToUI()
void Host_TitleChanged() void Host_TitleChanged()
{ {
} }
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core)
{
return nullptr;
}
bool Host_UIBlocksControllerState() bool Host_UIBlocksControllerState()
{ {
return false; return false;

View File

@ -56,3 +56,7 @@ void Host_YieldToUI()
void Host_TitleChanged() void Host_TitleChanged()
{ {
} }
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core)
{
return nullptr;
}