pumpitupdev / pumptools

A collection of tools to run Pump It Up games.
The Unlicense
22 stars 7 forks source link

Xwayland support #60

Open Xeeynamo opened 1 year ago

Xeeynamo commented 1 year ago

Feature request

Is your feature request related to a problem? Please describe.

Later titles such as Pump It Up Prime do not work on Wayland paired with Xwayland. The problem lies in sub_80698F0 (prime 1.22), where if DisplayHeight(disp, DefaultScreen(disp)) is greater than 719 then the engine insists on calling XF86VidModeSetViewPort from XFree86-VidModeExtension to force setting a specific resolution. This is not supported in Wayland. You will find the log at the bottom of this issue.

NOTE: While this issue is similar to #21, the consequence of a different environment leads to a very different outcome.

Describe the solution you'd like

In the game code there is the following check if ( !byte_A00ED34 && screens[default_screen].height > 719 ). Maybe patching that 719 as 32767 might help.

Describe alternatives you've considered

A dirty, cheap solution is to add the following piece of code in gfx.c XOpenDisplay :

  int* dispHeight = &DisplayHeight(res, DefaultScreen(res));
  if (*dispHeight > 719) {
    *dispHeight = 480;
  }

Mocking XF86VidModeSetViewPort to avoid the call to be made seems to not be possible.

Additional context

[M][2023/9/24-15:8:13:389][patch-gfx][gfx.c:75] XCreateWindow
[I][2023/9/24-15:8:13:389][patch-gfx][gfx.c:95] XCreateWindow(disp:0xed585b0, wnd:1016, x:0, y:0, w:640, h:480, border:0, depth:24, class:1, visual:248930128, valuemask:280A, attributes:0xffc17e94)
[I][2023/9/24-15:8:13:389][patch-gfx][gfx.c:112] XCreateWindow was successful!
[M][2023/9/24-15:8:13:392][patch-gfx][gfx.c:175] XMapRaised
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  151 (XFree86-VidModeExtension)
  Minor opcode of failed request:  12 (XF86VidModeSetViewPort)
  Value in failed request:  0x3f8
  Serial number of failed request:  42
  Current serial number in output stream:  50
[E][2023/9/24-15:8:13:495][patch-sigsegv][sigsegv.c:18] ===================
[E][2023/9/24-15:8:13:495][patch-sigsegv][sigsegv.c:19] !!!!! SIGSEGV !!!!!
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:28] Backtrace (30 frames):
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/hook.so(+0xb0a4) [0xf7e6f0a4]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/hook.so(+0x167a7) [0xf7e7a7a7]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] linux-gate.so.1(__kernel_sigreturn+0) [0xf7f35590]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /lib/i386-linux-gnu/libpthread.so.0(pthread_kill+0x16) [0xf74c3406]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/piu() [0x80bf357]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /lib/i386-linux-gnu/libc.so.6(+0x304e3) [0xf77664e3]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /lib/i386-linux-gnu/libc.so.6(+0x305c1) [0xf77665c1]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(+0x39ad9) [0xf750ead9]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(_XError+0x11a) [0xf750ec0a]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(+0x36866) [0xf750b866]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(+0x3691f) [0xf750b91f]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(_XEventsQueued+0x6b) [0xf750c36b]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(_XFlush+0x33) [0xf750c653]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(_XGetRequest+0x69) [0xf750f2d9]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libX11.so.6(XCreateGC+0x8d) [0xf74e9d3d]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX_mesa.so.0(+0x3e89e) [0xf62aa89e]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX_mesa.so.0(+0x3c734) [0xf62a8734]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX_mesa.so.0(+0x3de67) [0xf62a9e67]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX_mesa.so.0(+0x2f984) [0xf629b984]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX_mesa.so.0(+0x2fb06) [0xf629bb06]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX.so.0(+0x205f) [0xf748505f]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX.so.0(+0x2ab5) [0xf7485ab5]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /usr/lib/i386-linux-gnu/libGLX.so.0(+0x40ad) [0xf74870ad]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/piu() [0x8069c41]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/piu() [0x80c2cb7]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/piu() [0x8053947]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/hook.so(trap_main+0xfc) [0xf7e6adc8]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0xf774efa1]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/hook.so(__libc_start_main+0x89) [0xf7e6aeb6]
[E][2023/9/24-15:8:13:496][patch-sigsegv][sigsegv.c:31] /app/piu() [0x80569bd]