summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2026-03-28 14:30:24 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2026-03-30 19:02:11 -0500
commit2f4badc357b2c6f1570dfe14be65b226baed1baa (patch)
tree383342300172262c85bc982ded03254d75728ed6 /Source/Core
parent19157cacd52b6d4d63abc55028067fff5f097cca (diff)
HW/GBACore: Add some special handling for GBPlayer.
Set a fixed GBA-sized video buffer. Don't connect audio output to Mixer. Don't configure an SIODriver.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/GBACore.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/Source/Core/Core/HW/GBACore.cpp b/Source/Core/Core/HW/GBACore.cpp
index 09f56fed5b..f1d970510b 100644
--- a/Source/Core/Core/HW/GBACore.cpp
+++ b/Source/Core/Core/HW/GBACore.cpp
@@ -238,11 +238,15 @@ bool Core::Start(u64 gc_ticks)
m_gc_ticks_remainder = 0;
m_keys = 0;
- SetSIODriver();
+ if (m_device_number != Config::GBPLAYER_GBA_INDEX)
+ {
+ SetSIODriver();
+ SetAVStream();
+ }
+
SetVideoBuffer();
SetAudioBufferSize();
AddCallbacks();
- SetAVStream();
SetupEvent();
m_core->reset(m_core);
@@ -394,10 +398,28 @@ void Core::SetSIODriver()
void Core::SetVideoBuffer()
{
- u32 width, height;
- m_core->currentVideoSize(m_core, &width, &height);
- m_video_buffer.resize(width * height);
- m_core->setVideoBuffer(m_core, m_video_buffer.data(), width);
+ if (m_device_number == Config::GBPLAYER_GBA_INDEX)
+ {
+ // GBPlayer expects a GBA-sized video buffer even in GB mode.
+ // Clear it first to avoid stuck colors from the previous game on switch from GBA->GB.
+ m_video_buffer.clear();
+ m_video_buffer.resize(std::size_t{GBA_VIDEO_HORIZONTAL_PIXELS} * GBA_VIDEO_VERTICAL_PIXELS);
+
+ constexpr size_t GB_VIDEO_OFFSET = 1960;
+
+ m_core->setVideoBuffer(
+ m_core, m_video_buffer.data() + ((GetPlatform() == mPLATFORM_GBA) ? 0 : GB_VIDEO_OFFSET),
+ GBA_VIDEO_HORIZONTAL_PIXELS);
+ }
+ else
+ {
+ u32 width;
+ u32 height;
+ m_core->currentVideoSize(m_core, &width, &height);
+ m_video_buffer.resize(std::size_t{width} * height);
+ m_core->setVideoBuffer(m_core, m_video_buffer.data(), width);
+ }
+
if (auto host = m_host.lock())
host->GameChanged();
}