about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-04-19 21:04:02 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-04-19 21:04:02 +0200
commitbc3cfe82cf886083f22d91826c10cacae618311d (patch)
treec9366645ef004e9f0da70490b5ebd65e0bc5e9fb /src
parent6ccac8ab5a5bfea6ad8ef7b8dfc1ba4fd1b722dc (diff)
downloadbox64-bc3cfe82cf886083f22d91826c10cacae618311d.tar.gz
box64-bc3cfe82cf886083f22d91826c10cacae618311d.zip
[BOX32][WRAPPER] Added a workaround on XF86VidModeGetAllModeLines for 12 labors of Hercules 6
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/wrappedlibxxf86vm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/wrapped32/wrappedlibxxf86vm.c b/src/wrapped32/wrappedlibxxf86vm.c
index 8bd229e2..8d386bb7 100644
--- a/src/wrapped32/wrappedlibxxf86vm.c
+++ b/src/wrapped32/wrappedlibxxf86vm.c
@@ -43,13 +43,18 @@ EXPORT int my32_XF86VidModeGetAllModeLines(x64emu_t* emu, void* dpy, int screen,
 {
     my_XF86VidModeModeInfo_t** infos_l;
     int ret = my->XF86VidModeGetAllModeLines(dpy, screen, num, &infos_l);
-    *infos = to_ptrv(infos_l);
-    ptr_t* small = from_ptrv(*infos);
-    // shrink the array, the structure is fine
-    for(int i=0; i<*num; ++i)
-        small[i] = to_ptrv(infos_l[i]);
-    // mark the end
-    small[*num] = 0;
+    if(*num>0) {
+printf_log(LOG_INFO, "XF86VidModeGetAllModeLines return %d, with *num=%d\n", ret, *num);
+        *infos = to_ptrv(infos_l);
+        ptr_t* small = from_ptrv(*infos);
+        // shrink the array, the structure is fine
+        for(int i=0; i<*num; ++i)
+            small[i] = to_ptrv(infos_l[i]);
+        // no need to mark the end
+        //small[*num] = 0;
+        if(*num==1)
+            small[1] = small[0];    // duplicate the mode if only 1 exit (for Hercules6)
+    }
     return ret;
 }