bochs-emu / Bochs

Bochs - Cross Platform x86 Emulator Project
https://bochs.sourceforge.io/
GNU Lesser General Public License v2.1
875 stars 102 forks source link

Wrong output in Ragdoll Masters with Voodoo 3 in 32 bpp mode #348

Closed Vort closed 3 weeks ago

Vort commented 1 month ago

When Ragdoll Masters game is launched with Voodoo 3 card in 32 bpp video mode, corrupted image appears and logs starts to fill up with Pixel format conversion not supported yet messages.

Reproduction steps:

  1. Switch resolution to 1152x864x32;
  2. Unpack RagdollMasters_3_1.zip and launch Ragdoll Masters v3.1.exe.

bochs_ragdoll_32bpp

Here is my primitive implementation, just in case, it should be rewritten properly:

diff --git a/bochs/iodev/display/banshee.cc b/bochs/iodev/display/banshee.cc
index dd2d2b9e7..bdfa9a114 100644
--- a/bochs/iodev/display/banshee.cc
+++ b/bochs/iodev/display/banshee.cc
@@ -2049,6 +2049,22 @@ void bx_banshee_c::blt_screen_to_screen()
       src_ptr += spitch;
       dst_ptr += dpitch;
     } while (--nrows);
+  } else if (BLT.src_fmt == 3 && BLT.dst_fmt == 5) {
+    int spxsize = 2;
+    src_ptr += (sy * abs(spitch) + sx * spxsize);
+    nrows = h;
+    do {
+      src_ptr1 = src_ptr;
+      dst_ptr1 = dst_ptr;
+      ncols = w;
+      do {
+        BLT.rop_fn[0](dst_ptr1, (Bit8u*)&v->fbi.pen[*(Bit16u*)src_ptr1], dpitch, spitch, abs(dpxsize), 1);
+        src_ptr1 += spxsize;
+        dst_ptr1 += dpxsize;
+      } while (--ncols);
+      src_ptr += spitch;
+      dst_ptr += dpitch;
+    } while (--nrows);
   } else {
     src_ptr += (sy * abs(spitch) + sx * abs(dpxsize) + bkw_adj);
     BLT.rop_fn[0](dst_ptr + bkw_adj, src_ptr, dpitch, spitch, w * abs(dpxsize), h); 

Version: f5e3dd9

vruppert commented 3 weeks ago

I have now applied your code with some required, but untested big endian code.

Vort commented 3 weeks ago

Thanks. I think more generalized approach will be needed eventually. But until more test cases are found, such copy-paste will be fine as well.