diff --git a/platforms/desktop-shared/emu.cpp b/platforms/desktop-shared/emu.cpp index 54fdac72..cd2a1dc6 100644 --- a/platforms/desktop-shared/emu.cpp +++ b/platforms/desktop-shared/emu.cpp @@ -383,7 +383,10 @@ void emu_set_overscan(int overscan) gearsystem->GetVideo()->SetOverscan(Video::OverscanTopBottom); break; case 2: - gearsystem->GetVideo()->SetOverscan(Video::OverscanFull); + gearsystem->GetVideo()->SetOverscan(Video::OverscanFull284); + break; + case 3: + gearsystem->GetVideo()->SetOverscan(Video::OverscanFull320); break; default: gearsystem->GetVideo()->SetOverscan(Video::OverscanDisabled); diff --git a/platforms/desktop-shared/gui.cpp b/platforms/desktop-shared/gui.cpp index e0595323..a3d256f1 100644 --- a/platforms/desktop-shared/gui.cpp +++ b/platforms/desktop-shared/gui.cpp @@ -115,7 +115,7 @@ void gui_init(void) emu_enable_bootrom_sms(config_emulator.sms_bootrom); emu_enable_bootrom_gg(config_emulator.gg_bootrom); emu_set_media_slot(config_emulator.media); - emu_set_overscan(config_debug.debug ? false : config_video.overscan); + emu_set_overscan(config_debug.debug ? 0 : config_video.overscan); emu_disable_ym2413(config_audio.ym2413 == 1); } @@ -650,10 +650,10 @@ static void main_menu(void) if (ImGui::BeginMenu("Overscan")) { - ImGui::PushItemWidth(120.0f); - if (ImGui::Combo("##overscan", &config_video.overscan, "Disabled\0Top+Bottom\0Full\0\0")) + ImGui::PushItemWidth(170.0f); + if (ImGui::Combo("##overscan", &config_video.overscan, "Disabled\0Top+Bottom\0Full (284 width)\0Full (320 width)\0\0")) { - emu_set_overscan(config_debug.debug ? false : config_video.overscan); + emu_set_overscan(config_debug.debug ? 0 : config_video.overscan); } ImGui::PopItemWidth(); ImGui::EndMenu(); @@ -849,7 +849,7 @@ static void main_menu(void) if (ImGui::MenuItem("Enable", "", &config_debug.debug)) { - emu_set_overscan(config_debug.debug ? false : config_video.overscan); + emu_set_overscan(config_debug.debug ? 0 : config_video.overscan); if (config_debug.debug) emu_debug_step(); diff --git a/platforms/libretro/libretro.cpp b/platforms/libretro/libretro.cpp index 3af5e9e5..6953a8cc 100644 --- a/platforms/libretro/libretro.cpp +++ b/platforms/libretro/libretro.cpp @@ -70,7 +70,7 @@ static const struct retro_variable vars[] = { { "gearsystem_mapper", "Mapper (restart); Auto|ROM|SEGA|Codemasters|Korean|MSX|Janggun|SG-1000" }, { "gearsystem_timing", "Refresh Rate (restart); Auto|NTSC (60 Hz)|PAL (50 Hz)" }, { "gearsystem_aspect_ratio", "Aspect Ratio (restart); 1:1 PAR|4:3 PAR|16:9 PAR" }, - { "gearsystem_overscan", "Overscan; Disabled|Top+Bottom|Full" }, + { "gearsystem_overscan", "Overscan; Disabled|Top+Bottom|Full (284 width)|Full (320 width)" }, { "gearsystem_bios_sms", "Master System BIOS (restart); Disabled|Enabled" }, { "gearsystem_bios_gg", "Game Gear BIOS (restart); Disabled|Enabled" }, { "gearsystem_ym2413", "YM2413 (restart); Auto|Disabled"}, @@ -436,8 +436,10 @@ static void check_variables(void) core->GetVideo()->SetOverscan(Video::OverscanDisabled); else if (strcmp(var.value, "Top+Bottom") == 0) core->GetVideo()->SetOverscan(Video::OverscanTopBottom); - else if (strcmp(var.value, "Full") == 0) - core->GetVideo()->SetOverscan(Video::OverscanFull); + else if (strcmp(var.value, "Full (284 width)") == 0) + core->GetVideo()->SetOverscan(Video::OverscanFull284); + else if (strcmp(var.value, "Full (320 width)") == 0) + core->GetVideo()->SetOverscan(Video::OverscanFull320); else core->GetVideo()->SetOverscan(Video::OverscanDisabled); } diff --git a/src/GearsystemCore.cpp b/src/GearsystemCore.cpp index d84c4168..441ed7e5 100644 --- a/src/GearsystemCore.cpp +++ b/src/GearsystemCore.cpp @@ -261,8 +261,10 @@ bool GearsystemCore::GetRuntimeInfo(GS_RuntimeInfo& runtime_info) runtime_info.screen_width = GS_RESOLUTION_SMS_WIDTH; runtime_info.screen_height = m_pVideo->IsExtendedMode224() ? GS_RESOLUTION_SMS_HEIGHT_EXTENDED : GS_RESOLUTION_SMS_HEIGHT; - if (m_pVideo->GetOverscan() == Video::OverscanFull) - runtime_info.screen_width = GS_RESOLUTION_SMS_WIDTH + (2 * GS_RESOLUTION_SMS_OVERSCAN_H); + if (m_pVideo->GetOverscan() == Video::OverscanFull284) + runtime_info.screen_width = GS_RESOLUTION_SMS_WIDTH + GS_RESOLUTION_SMS_OVERSCAN_H_284_L + GS_RESOLUTION_SMS_OVERSCAN_H_284_R; + if (m_pVideo->GetOverscan() == Video::OverscanFull320) + runtime_info.screen_width = GS_RESOLUTION_SMS_WIDTH + GS_RESOLUTION_SMS_OVERSCAN_H_320_L + GS_RESOLUTION_SMS_OVERSCAN_H_320_R; if (m_pVideo->GetOverscan() != Video::OverscanDisabled) runtime_info.screen_height = GS_RESOLUTION_SMS_HEIGHT + (2 * (m_pCartridge->IsPAL() ? GS_RESOLUTION_SMS_OVERSCAN_V_PAL : GS_RESOLUTION_SMS_OVERSCAN_V)); } diff --git a/src/Video.cpp b/src/Video.cpp index 18d1939e..d975e7a3 100644 --- a/src/Video.cpp +++ b/src/Video.cpp @@ -915,7 +915,7 @@ void Video::Render24bit(u16* srcFrameBuffer, u8* dstFrameBuffer, GS_Color_Format { int x = 0; int y = 0; - int overscan_h = 0; + int overscan_h_l = 0; int overscan_v = 0; int overscan_content_v = 0; int overscan_content_h = 0; @@ -943,11 +943,18 @@ void Video::Render24bit(u16* srcFrameBuffer, u8* dstFrameBuffer, GS_Color_Format overscan_total_height = overscan_content_v + (overscan_v * 2); } - if (overscan && (m_Overscan == OverscanFull)) + if (overscan && (m_Overscan == OverscanFull320)) { overscan_content_h = GS_RESOLUTION_MAX_WIDTH; - overscan_h = GS_RESOLUTION_SMS_OVERSCAN_H; - overscan_total_width = overscan_content_h + (overscan_h * 2); + overscan_h_l = GS_RESOLUTION_SMS_OVERSCAN_H_320_L; + overscan_total_width = overscan_content_h + overscan_h_l + GS_RESOLUTION_SMS_OVERSCAN_H_320_R; + } + + if (overscan && (m_Overscan == OverscanFull284)) + { + overscan_content_h = GS_RESOLUTION_MAX_WIDTH; + overscan_h_l = GS_RESOLUTION_SMS_OVERSCAN_H_284_L; + overscan_total_width = overscan_content_h + overscan_h_l + GS_RESOLUTION_SMS_OVERSCAN_H_284_R; } for (int i = 0, j = 0; j < buffer_size; j += 3) @@ -955,7 +962,7 @@ void Video::Render24bit(u16* srcFrameBuffer, u8* dstFrameBuffer, GS_Color_Format u16 src_color = 0; if (overscan_enabled) { - bool is_h_overscan = (overscan_h > 0) && (x < overscan_h || x >= (overscan_h + overscan_content_h)); + bool is_h_overscan = (overscan_h_l > 0) && (x < overscan_h_l || x >= (overscan_h_l + overscan_content_h)); bool is_v_overscan = (overscan_v > 0) && (y < overscan_v || y >= (overscan_v + overscan_content_v)); if (is_h_overscan || is_v_overscan) @@ -994,7 +1001,7 @@ void Video::Render16bit(u16* srcFrameBuffer, u8* dstFrameBuffer, GS_Color_Format { int x = 0; int y = 0; - int overscan_h = 0; + int overscan_h_l = 0; int overscan_v = 0; int overscan_content_v = 0; int overscan_content_h = 0; @@ -1040,11 +1047,18 @@ void Video::Render16bit(u16* srcFrameBuffer, u8* dstFrameBuffer, GS_Color_Format overscan_total_height = overscan_content_v + (overscan_v * 2); } - if (overscan && (m_Overscan == OverscanFull)) + if (overscan && (m_Overscan == OverscanFull320)) + { + overscan_content_h = GS_RESOLUTION_MAX_WIDTH; + overscan_h_l = GS_RESOLUTION_SMS_OVERSCAN_H_320_L; + overscan_total_width = overscan_content_h + overscan_h_l + GS_RESOLUTION_SMS_OVERSCAN_H_320_R; + } + + if (overscan && (m_Overscan == OverscanFull284)) { overscan_content_h = GS_RESOLUTION_MAX_WIDTH; - overscan_h = GS_RESOLUTION_SMS_OVERSCAN_H; - overscan_total_width = overscan_content_h + (overscan_h * 2); + overscan_h_l = GS_RESOLUTION_SMS_OVERSCAN_H_284_L; + overscan_total_width = overscan_content_h + overscan_h_l + GS_RESOLUTION_SMS_OVERSCAN_H_284_R; } for (int i = 0, j = 0; j < buffer_size; j += 2) @@ -1052,7 +1066,7 @@ void Video::Render16bit(u16* srcFrameBuffer, u8* dstFrameBuffer, GS_Color_Format u16 src_color = 0; if (overscan_enabled) { - bool is_h_overscan = (overscan_h > 0) && (x < overscan_h || x >= (overscan_h + overscan_content_h)); + bool is_h_overscan = (overscan_h_l > 0) && (x < overscan_h_l || x >= (overscan_h_l + overscan_content_h)); bool is_v_overscan = (overscan_v > 0) && (y < overscan_v || y >= (overscan_v + overscan_content_v)); if (is_h_overscan || is_v_overscan) diff --git a/src/Video.h b/src/Video.h index 52134435..9433b098 100644 --- a/src/Video.h +++ b/src/Video.h @@ -38,7 +38,8 @@ class Video { OverscanDisabled, OverscanTopBottom, - OverscanFull + OverscanFull284, + OverscanFull320 }; public: diff --git a/src/definitions.h b/src/definitions.h index 11db3894..15ed3658 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -98,7 +98,10 @@ typedef void (*RamChangedCallback) (void); #define GS_RESOLUTION_SMS_WIDTH 256 #define GS_RESOLUTION_SMS_HEIGHT 192 #define GS_RESOLUTION_SMS_HEIGHT_EXTENDED 224 -#define GS_RESOLUTION_SMS_OVERSCAN_H 32 +#define GS_RESOLUTION_SMS_OVERSCAN_H_320_L 32 +#define GS_RESOLUTION_SMS_OVERSCAN_H_320_R 32 +#define GS_RESOLUTION_SMS_OVERSCAN_H_284_L 13 +#define GS_RESOLUTION_SMS_OVERSCAN_H_284_R 15 #define GS_RESOLUTION_SMS_OVERSCAN_V 24 #define GS_RESOLUTION_SMS_OVERSCAN_V_PAL 48