]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Override initial native display with RTG option
authorToni Wilen <twilen@winuae.net>
Fri, 10 Oct 2025 18:31:38 +0000 (21:31 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 10 Oct 2025 18:31:38 +0000 (21:31 +0300)
cfgfile.cpp
gfxboard.cpp
include/gfxboard.h
include/options.h
main.cpp
od-win32/picasso96_win.cpp
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32gui.cpp

index ee953513760bc5e9e301b2eb2a4c01d1d04d2f99..d839748a5fac79889fb9d1a7989022c878e094d7 100644 (file)
@@ -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;
                        }
index b4b90cca7bcf8d9599bd6d285603a0d0a85a8b73..2929093d520338d4f180e651b9adbddefa694452 100644 (file)
@@ -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);
index 36e9e57543ae473afd200e1e29589998cee10ac6..4b1c30a6567d60fb8edf4f21a2c5962fff500de2 100644 (file)
@@ -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);
index 40bf99838d4e8a4c36f3edea04a197a8951a0c8f..26e24a28c68316581309e51fa76d504a7938e7cd 100644 (file)
@@ -444,6 +444,7 @@ struct rtgboardconfig
        int device_order;
        int monitor_id;
        bool autoswitch;
+       bool initial_active;
 };
 struct boardloadfile
 {
index 12aec9651042f36a060f6174aaaade83c21e36ef..e2f69ed667de4e4b1b5508e9976ecf933f512aa9 100644 (file)
--- 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;
index b1c2a90b5922d1c534b5eea47029e3594df47f20..7da386884bbee86325e7d8752daf51775c9e3fb3 100644 (file)
@@ -6269,6 +6269,7 @@ static void picasso_reset2(int monid)
                struct amigadisplay *ad = &adisplays[i];
                ad->picasso_requested_on = false;
        }
+       gfxboard_reset_init();
 
        unlockrtg();
 }
index 3adbc1fbec971503f1dc7487798b43214245c8ba..ab00c79ebc33302fc69b48354acf1eb17634b08d 100644 (file)
 #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
index d0d93b88e1d0742194b241bc8eabd104953bbc79..9c57cda30d53f334abd458828f757edd39be9ddb 100644 (file)
@@ -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
index 0396217b93dfcc07fe1d0ab9dcbbbb954313445b..361b237198c779fc3eee08911acc7b441d538d51 100644 (file)
@@ -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;