From cb68d5844f88ce36797305ce8bb0ae79cae10d2d Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 10 Oct 2025 21:31:38 +0300 Subject: [PATCH] Override initial native display with RTG option --- cfgfile.cpp | 6 ++++++ gfxboard.cpp | 35 +++++++++++++++++++++++++++++++++++ include/gfxboard.h | 1 + include/options.h | 1 + main.cpp | 8 ++++++++ od-win32/picasso96_win.cpp | 1 + od-win32/resources/resource.h | 1 + od-win32/resources/winuae.rc | 5 +++-- od-win32/win32gui.cpp | 22 ++++++++++++++++++++-- 9 files changed, 76 insertions(+), 4 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index ee953513..d839748a 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -2911,6 +2911,11 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) _tcscat(tmp2, _T(",")); _tcscat(tmp2 + _tcslen(tmp2), _T("noautoswitch")); } + if (rbc->initial_active) { + if (tmp2) + _tcscat(tmp2, _T(",")); + _tcscat(tmp2 + _tcslen(tmp2), _T("initial")); + } if (tmp2[0]) { if (i > 0) _stprintf(tmp, _T("gfxcard%d_options"), i + 1); @@ -6292,6 +6297,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH xfree(s); } rbc->autoswitch = !cfgfile_option_find(value, _T("noautoswitch")); + rbc->initial_active = cfgfile_option_find(value, _T("initial")); if (cfgfile_option_find(value, _T("autoswitch"))) { rbc->autoswitch = true; } diff --git a/gfxboard.cpp b/gfxboard.cpp index b4b90cca..2929093d 100644 --- a/gfxboard.cpp +++ b/gfxboard.cpp @@ -568,6 +568,7 @@ static struct rtggfxboard rtggfxboards[MAX_RTG_BOARDS]; static struct rtggfxboard *only_gfx_board; static int rtg_visible[MAX_AMIGADISPLAYS]; static int rtg_initial[MAX_AMIGADISPLAYS]; +static int initial_done; static int total_active_gfx_boards; static int vram_ram_a8; static DisplaySurface fakesurface; @@ -995,6 +996,21 @@ static void gfxboard_hsync_handler(void) pcemglue_hsync(); } +static void init_initial(struct rtggfxboard *gb) +{ + if (initial_done) { + return; + } + if (gb->vram && gb->rbc->initial_active && rtg_visible[gb->monitor_id] < 0 && rtg_initial[gb->monitor_id] >= 0) { + int init = rtg_initial[gb->monitor_id]; + if (gfxboard_toggle(gb->monitor_id, 0, 0) >= 0) { + initial_done = 1; + } else { + rtg_initial[gb->monitor_id] = init; + } + } +} + static void reinit_vram(struct rtggfxboard *gb, uaecptr vram, bool direct) { if (vram == gb->gfxmem_bank->start) @@ -1707,6 +1723,8 @@ void gfxboard_vsync_handler(bool full_redraw_required, bool redraw_required) struct amigadisplay *ad = &adisplays[gb->monitor_id]; struct picasso96_state_struct *state = &picasso96_state[gb->monitor_id]; + init_initial(gb); + if (gb->func) { if (gb->userdata) { @@ -3591,6 +3609,23 @@ void gfxboard_reset (void) } } +void gfxboard_reset_init(void) +{ + initial_done = 1; + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + struct rtgboardconfig *rbc = &currprefs.rtgboards[i]; + if (rbc->initial_active) { + rtg_initial[rbc->monitor_id] = i; + if (rbc->monitor_id == 0) { + struct amigadisplay *ad = &adisplays[0]; + ad->picasso_on = 1; + ad->picasso_requested_on = 1; + initial_done = 0; + } + } + } +} + static uae_u32 REGPARAM2 gfxboards_lget_regs (uaecptr addr) { struct rtggfxboard *gb = getgfxboard(addr); diff --git a/include/gfxboard.h b/include/gfxboard.h index 36e9e575..4b1c30a6 100644 --- a/include/gfxboard.h +++ b/include/gfxboard.h @@ -31,6 +31,7 @@ extern int gfxboard_get_index_from_id(int); extern int gfxboard_get_id_from_index(int); extern bool gfxboard_switch_away(int monid); extern int gfxboard_monitor_visible(int monid); +extern void gfxboard_reset_init(void); extern bool gfxboard_allocate_slot(int, int); extern void gfxboard_free_slot(int); diff --git a/include/options.h b/include/options.h index 40bf9983..26e24a28 100644 --- a/include/options.h +++ b/include/options.h @@ -444,6 +444,7 @@ struct rtgboardconfig int device_order; int monitor_id; bool autoswitch; + bool initial_active; }; struct boardloadfile { diff --git a/main.cpp b/main.cpp index 12aec965..e2f69ed6 100644 --- a/main.cpp +++ b/main.cpp @@ -482,8 +482,16 @@ void fixup_prefs (struct uae_prefs *p, bool userconfig) } #endif + bool initial_monitor = false; for (int i = 0; i < MAX_RTG_BOARDS; i++) { struct rtgboardconfig *rbc = &p->rtgboards[i]; + if (rbc->initial_active) { + if (initial_monitor) { + rbc->initial_active = false; + error_log(_T("Only one graphics card can be initial active.")); + } + initial_monitor = true; + } if (rbc->monitor_id > 0 && p->monitoremu_mon == rbc->monitor_id) { error_log(_T("Video port monitor %d was allocated for graphics card %d."), rbc->monitor_id + 1, i + 1); p->monitoremu_mon = 0; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index b1c2a90b..7da38688 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -6269,6 +6269,7 @@ static void picasso_reset2(int monid) struct amigadisplay *ad = &adisplays[i]; ad->picasso_requested_on = false; } + gfxboard_reset_init(); unlockrtg(); } diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 3adbc1fb..ab00c79e 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -1277,6 +1277,7 @@ #define IDC_INPUTMAPOUTM 1802 #define IDC_RTG_SWITCHER 1802 #define IDC_INFOBOX_TEXT1 1803 +#define IDC_RTG_INITIAL_MONITOR 1803 #define IDC_INFOBOX_TEXT3 1804 #define IDC_CD_EJECT 1804 #define IDC_CD_TEXT 1805 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index d0d93b88..9c57cda3 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -1288,8 +1288,9 @@ BEGIN CTEXT "Aspect ratio:",IDC_STATIC,282,212,83,10,SS_CENTERIMAGE COMBOBOX IDC_RTG_SCALE_ASPECTRATIO,282,227,84,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP CONTROL "Native/RTG autoswitch",IDC_RTG_SWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,130,95,10 - COMBOBOX IDC_MONITOREMU_ACTIVEMON,312,62,65,65,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - LTEXT "Active output:",IDC_STATIC,245,62,62,10,NOT WS_VISIBLE,WS_EX_RIGHT + COMBOBOX IDC_MONITOREMU_ACTIVEMON,316,37,65,65,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP + LTEXT "Active output:",IDC_STATIC,249,37,62,10,NOT WS_VISIBLE,WS_EX_RIGHT + CONTROL "Override initial native chipset display",IDC_RTG_INITIAL_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,249,63,131,10 END IDD_INPUTMAP DIALOGEX 0, 0, 421, 293 diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 0396217b..361b2371 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -11621,6 +11621,11 @@ static void enable_for_expansiondlg(HWND hDlg) ew(hDlg, IDC_RTG_VBINTERRUPT, rtg3); ew(hDlg, IDC_RTG_THREAD, rtg3 && en); ew(hDlg, IDC_RTG_HWSPRITE, rtg3); + ew(hDlg, IDC_RTG_INITIAL_MONITOR, rtg5); + if (!rtg5) { + CheckDlgButton(hDlg, IDC_RTG_INITIAL_MONITOR, FALSE); + rbc->initial_active = false; + } ew(hDlg, IDC_RTG_SWITCHER, rbc->rtgmem_size > 0 && !gfxboard_get_switcher(rbc)); } @@ -11737,6 +11742,7 @@ static void values_to_expansiondlg(HWND hDlg) CheckDlgButton(hDlg, IDC_RTG_HWSPRITE, workprefs.rtg_hardwaresprite); CheckDlgButton(hDlg, IDC_RTG_THREAD, workprefs.rtg_multithread); CheckDlgButton(hDlg, IDC_RTG_SWITCHER, rbc->rtgmem_size > 0 && (rbc->autoswitch || gfxboard_get_switcher(rbc) || rbc->rtgmem_type < GFXBOARD_HARDWARE)); + CheckDlgButton(hDlg, IDC_RTG_INITIAL_MONITOR, rbc->rtgmem_size > 0 && rbc->initial_active); xSendDlgItemMessage(hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_SETCURSEL, (workprefs.win32_rtgscaleaspectratio == 0) ? 0 : @@ -11772,12 +11778,12 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP } xSendDlgItemMessage(hDlg, IDC_MONITOREMU_MON, CB_RESETCONTENT, 0, 0); -#if 0 - xSendDlgItemMessage(hDlg, IDC_MONITOREMU_ACTIVEMON, CB_RESETCONTENT, 0, 0); for (int i = 0; i < MAX_AMIGAMONITORS; i++) { _stprintf(tmp, _T("%d"), i + 1); xSendDlgItemMessage(hDlg, IDC_MONITOREMU_MON, CB_ADDSTRING, 0, (LPARAM)tmp); } +#if 0 + xSendDlgItemMessage(hDlg, IDC_MONITOREMU_ACTIVEMON, CB_RESETCONTENT, 0, 0); xSendDlgItemMessage(hDlg, IDC_MONITOREMU_ACTIVEMON, CB_ADDSTRING, 0, _T("Chipset")); xSendDlgItemMessage(hDlg, IDC_MONITOREMU_ACTIVEMON, CB_ADDSTRING, 0, _T("RTG #1")); xSendDlgItemMessage(hDlg, IDC_MONITOREMU_ACTIVEMON, CB_ADDSTRING, 0, _T("RTG #2")); @@ -11901,6 +11907,18 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP rbc->autoswitch = ischecked(hDlg, IDC_RTG_SWITCHER); break; } + case IDC_RTG_INITIAL_MONITOR: + { + struct rtgboardconfig *rbc = &workprefs.rtgboards[gui_rtg_index]; + bool checked = ischecked(hDlg, IDC_RTG_INITIAL_MONITOR); + if (checked) { + for (int i = 0; i < MAX_RTG_BOARDS; i++) { + workprefs.rtgboards[i].initial_active = false; + } + } + rbc->initial_active = checked; + break; + } } if (HIWORD (wParam) == CBN_SELENDOK || HIWORD (wParam) == CBN_KILLFOCUS || HIWORD (wParam) == CBN_EDITCHANGE) { uae_u32 mask = workprefs.picasso96_modeflags; -- 2.47.3