video: Make subcarrier a vga_mode option instead of standalone

This commit is contained in:
misteraddons
2025-10-23 01:21:24 -06:00
committed by GitHub
parent 2efa6a87a8
commit 26c7564b5d
4 changed files with 10 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
key_menu_as_rgui=0 ; set to 1 to make the MENU key map to RGUI in Minimig (e.g. for Right Amiga)
forced_scandoubler=0 ; set to 1 to run scandoubler on VGA output always (depends on core).
;ypbpr=0 ; set to 1 for YPbPr on VGA output. (obsolete. see vga_mode)
vga_mode=rgb ; supported modes: rgb, ypbpr, svideo, cvbs. rgb is default.
vga_mode=rgb ; supported modes: rgb, ypbpr, svideo, cvbs, and subcarrier (for external rgb converters). rgb is default.
ntsc_mode=0 ; Only for S-Video and CVBS vga_mode. 0 - normal NTSC, 1 - PAL-60, 2 - PAL-M.
composite_sync=1 ; set to 1 for composite sync on HSync signal of VGA output.
vga_scaler=0 ; set to 1 to connect VGA to scaler output.

View File

@@ -48,7 +48,6 @@ static const ini_var_t ini_vars[] =
{ "VIDEO_MODE_NTSC", (void*)(cfg.video_conf_ntsc), STRING, 0, sizeof(cfg.video_conf_ntsc) - 1 },
{ "VIDEO_INFO", (void*)(&(cfg.video_info)), UINT8, 0, 10 },
{ "VSYNC_ADJUST", (void*)(&(cfg.vsync_adjust)), UINT8, 0, 2 },
{ "SUBCARRIER", (void*)(&(cfg.subcarrier)), UINT8, 0, 1 },
{ "HDMI_AUDIO_96K", (void*)(&(cfg.hdmi_audio_96k)), UINT8, 0, 1 },
{ "DVI_MODE", (void*)(&(cfg.dvi_mode)), UINT8, 0, 1 },
{ "HDMI_LIMITED", (void*)(&(cfg.hdmi_limited)), UINT8, 0, 2 },
@@ -583,7 +582,6 @@ void cfg_parse()
cfg.rumble = 1;
cfg.wheel_force = 50;
cfg.dvi_mode = 2;
cfg.subcarrier = 0;
cfg.lookahead = 2;
cfg.hdr = 0;
cfg.hdr_max_nits = 1000;
@@ -610,6 +608,12 @@ void cfg_parse()
if (!strcasecmp(cfg.vga_mode, "ypbpr")) cfg.vga_mode_int = 1;
if (!strcasecmp(cfg.vga_mode, "svideo")) cfg.vga_mode_int = 2;
if (!strcasecmp(cfg.vga_mode, "cvbs")) cfg.vga_mode_int = 3;
if (!strcasecmp(cfg.vga_mode, "subcarrier"))
{
cfg.vga_mode_int = 4;
cfg.csync = 1;
cfg.forced_scandoubler = 0;
}
}
}

1
cfg.h
View File

@@ -25,7 +25,6 @@ typedef struct {
float refresh_max;
uint8_t controller_info;
uint8_t vsync_adjust;
uint8_t subcarrier;
uint8_t kbd_nomouse;
uint8_t mouse_throttle;
uint8_t bootscreen;

View File

@@ -3018,7 +3018,7 @@ bool video_mode_select(uint32_t vtime, vmode_custom_t* out_mode)
static void set_yc_mode()
{
// Enable YC for S-Video/CVBS modes, or subcarrier for CXA2075 encoders
if (cfg.vga_mode_int >= 2 || (cfg.subcarrier && cfg.vga_mode_int == 0 && cfg.csync && !cfg.forced_scandoubler))
if (cfg.vga_mode_int >= 2)
{
float fps = current_video_info.vtime ? (100000000.f / current_video_info.vtime) : 0.f;
int pal = fps < 55.f;
@@ -3053,7 +3053,7 @@ static void set_yc_mode()
spi_uio_cmd_cont(UIO_SET_YC_PAR);
// For traditional S-Video/CVBS modes, enable YC processing
// For subcarrier-only modes (RGB+subcarrier or direct video), keep yc_en=0
bool is_subcarrier_only = (cfg.subcarrier && (cfg.direct_video || (cfg.vga_mode_int == 0 && cfg.csync && !cfg.forced_scandoubler)));
bool is_subcarrier_only = (cfg.vga_mode_int == 4);
uint16_t yc_config;
if (is_subcarrier_only) {
// Subcarrier-only: RGB mode with just PAL flag, yc_en=0
@@ -3070,7 +3070,7 @@ static void set_yc_mode()
spi_w(COLORBURST_RANGE);
spi_w(COLORBURST_RANGE >> 16);
// Case 6: Send subcarrier enable flag
uint16_t subcarrier_enable = (cfg.subcarrier && cfg.vga_mode_int == 0 && cfg.csync && !cfg.forced_scandoubler) ? 1 : 0;
uint16_t subcarrier_enable = (cfg.vga_mode_int == 4) ? 1 : 0;
printf("Sending subcarrier enable to FPGA: %d\n", subcarrier_enable);
spi_w(subcarrier_enable);
DisableIO();