clementgallet / libTAS

GNU/Linux software to (hopefully) give TAS tools to games
GNU General Public License v3.0
493 stars 58 forks source link

[Wine] Gamemaker 8.1 compatibility #252

Open clementgallet opened 5 years ago

clementgallet commented 5 years ago

I can almost get Gamemaker8.1 games to be able to be TAS'd (like IWBTB in the first post) in libtas with wine on commit 3f385b3aa2fbd86c9ad93a7e2d6a1ffa6477a522 but it's caught on a few points. fwiw i'm using manjaro, and tested with both a 32bit and 64bit wine prefix.

In the code block below i kept getting the last message repeating infinitely, so I enabled "events" in Runtime->Debug->Print Categories to see what event it was stalling on which is included in the first line:

[libTAS f:0] Thread 25724 (main) XIfEvent call.
[libTAS f:0] Thread 25724 (main) ERROR:     waited too long for an event

It basically just repeats those two lines until you force stop/kill it.

However I found out I can get past this point by enabling Runtime->Debug->Native Events

After native events is enabled there's spam of tons of different X{} calls if event printing is still enabled, but every gamemaker8.1 game successfully manages to boot up. However it occasionally gets stuck on Frame 1, after going through the normal Loading window if it's enabled, without showing the main window so it needs to be quickly unpaused and paused again to show up.

After unpausing and pausing again it can progress as normal until the game tries to create a save file, or write anywhere i guess. In some games that is clicking on "new game"; others try to create a file near initial startup. When that happens the following messages get spammed in the log about 5 times and hard crashes:

wine client error:34: write: Bad file descriptor
0034:err:seh:raise_exception Exception frame is not in stack limits => unable to dispatch exception.

This happens regardless of whether Runtime->Prevent writing to disk is checked and unchecked.

On one of the games where the file doesn't get created until new game is clicked I tested out navigating around the main menu. In hourglass menu movement is done by holding down for one frame and the input is processed on the next frame when it is released. In libTAS it sometimes takes more than 3 frames of holding down the button before it finally processes that it is held down, sometimes 2 frames, sometimes 1, and sometimes it will never work, it's pretty random. Additionally when trying to play back the movie none of the inputs were detected.

Setting audio to ALSA fully disables audio and doesn't improve anything. Runtime->Recycle Threads unchecking/checking didn't seem to help at all either.

IWBTB doesn't seem to get past frame 2 and just freezes with no further information. Dark blue runs and allows you to enter the game and move around but seems to freeze indefinitely on frame 212 or so regardless of where you are, and input doesn't sync up properly on playback. NANG doesn't detect mouse input which is needed for the main menu but doesn't crash. distorted travesty 3 which is what i've been TASing in hourglass for a while won't crash unless you select new game on the title screen. There's probably an excessive amount more GM8.1 games that can be found on delicious-fruit for testing if needed.

Originally posted by @xelivous in https://github.com/clementgallet/libTAS/issues/54#issuecomment-508982660

clementgallet commented 5 years ago

First, I suspect you have an older wine version than mine, because my version pulls events using XCheckIfEvent(). Here's my version, what is yours?

$ wine --version
wine-4.0 (Debian 4.0-2)

Wine is probably waiting for event that was filtered by libTAS. By enabling Runtime->Debug->Native Events, you loose the capacity to send inputs deterministically, as well as record/playback inputs.

I only tested distorted travesty 3 for now, but I didn't have problems on New Game. I will test other games.

xelivous commented 5 years ago

i'm generally on the bleeding edge of wine to test regressions and see what works, so i'm using wine-4.12.1 as my default wine on my system, a few days ago i would've been on wine-4.12. I then use lutris/etc to manage game-specific wine versions, along with a custom command to run things with steam's latest proton occasionally.

clementgallet commented 5 years ago

Ok, nice. That's still weird because checking 4.12 source code, I find the same XCheckIfEvent, but I didn't look much into it.

By testing NANG, I realized that the game only updates the screen (in main menu) when it receives an Expose event (even if it's using OpenGL rendering), so I will try pushing an Expose event after each frame boundary, which may solve one of the issues.

InfamousKnight commented 5 years ago

I havent managed to get distorted travesty 3 working on my part. It says invalid floating point operation and then crashes after loading screen before the game begins. As in doesn't even show the menu or osd.

I upgraded to latest wine on manjaro which is wine-4.11 which manjaro claims is the latest.

How did you get wine-4.12.1? I'm pretty sure mine is outdated. I tried upgrading to the lastest with pacman -S wine and yay -S wine and both claim 4.11 is latest.

clementgallet commented 5 years ago

I removed the Expose message. Setting the games to the correct framerate (30) made them work. Mouse is working in NANG (you have to enable it in libTAS Input menu), but softlock at the loading of the first stage. FileIO debug shows this:

[libTAS f:1576] Thread 6465        __xstat64 call with path /home/clement/.wine/dosdevices/z:/home/clement/Games/Not Another Needle Game 1.12/Music/ICU_-_UltraEdit-32_12.10kg.ogg
[libTAS f:1576] Thread 6465        __fxstat64 call with fd 37
[libTAS f:1576] Thread 6465        __xstat64 call with path /home/clement/.wine/dosdevices/z:/home/clement/Games/Not Another Needle Game 1.12/Music/ICU_-_UltraEdit-32_12.10kg.ogg
[libTAS f:1576] Thread 6465        __fxstat64 call with fd 40
[libTAS f:1576] Thread 6465        __fxstat64 call with fd 40
clementgallet commented 5 years ago

This softlock was fixed in 695fb5a82f763fe3fc2d0af5064c3c8dce4d738a

InfamousKnight commented 5 years ago

I actually figured out how to get wine-12-1 on arch btw. Still, dt3 gets loads and then some floating point error.

InfamousKnight commented 5 years ago

Distorted travesty 3 outputs this when I run it under libtas(I have tested outside of libtas) and the log shows this: Interim commit ce77077 built on 2019-07-11 qt5ct: using qt5ct plugin qt5ct: D-Bus global menu: no [libTAS f:0] Thread 0 (main) Skipping libtas init Attempt 1: Connected. 0009:fixme:thread:GetThreadUILanguage : stub, returning default language. 0009:fixme:nls:GetThreadPreferredUILanguages 00000038, 0x34d794, (nil) 0x34d7bc 0009:fixme:nls:get_dummy_preferred_ui_language (0x38 0x34d794 (nil) 0x34d7bc) returning a dummy value (current locale) 0009:fixme:nls:GetThreadPreferredUILanguages 00000038, 0x34d794, 0xcca680 0x34d7bc 0009:fixme:nls:get_dummy_preferred_ui_language (0x38 0x34d794 0xcca680 0x34d7bc) returning a dummy value (current locale) 0009:fixme:dwmapi:DwmEnableMMCSS (1) stub

It crashes at the last line. I did google search that error and found this: https://forum.winehq.org/viewtopic.php?t=31087&p=117783

Pretty similar, but I tried googling before I asked here again. It says an invalid floating point error.

Any ideas?

clementgallet commented 5 years ago

Could you output the floating point error it shows? It doesn't seem the log is related to the crash.

InfamousKnight commented 5 years ago

And how would I do that? If I start and attach gdb, it would just not connect. I also bought a new computer with i7 core and need to install manjaro again.

On Wed, Jul 17, 2019, 11:42 AM Clément Gallet notifications@github.com wrote:

Could you output the floating point error it shows? It doesn't seem the log is related to the crash.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/252?email_source=notifications&email_token=AAT4W4P5FLJIDMCPFG675ATP744VRA5CNFSM4H7D25Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2E2FPI#issuecomment-512336573, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT4W4K5IJIB5M67MBV6MIDP744VRANCNFSM4H7D25ZQ .

clementgallet commented 5 years ago

How do you know it is a floating point error?

InfamousKnight commented 5 years ago

Because the pop up error says invalid floating point.

On Wed, Jul 17, 2019, 6:03 PM Clément Gallet notifications@github.com wrote:

How do you know it is a floating point error?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/252?email_source=notifications&email_token=AAT4W4KAMMBJOODC3KADZU3P76JMDA5CNFSM4H7D25Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2GXAKI#issuecomment-512585769, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT4W4MQEJJAVUMUJOBBFCDP76JMDANCNFSM4H7D25ZQ .

clementgallet commented 5 years ago

Ok, so can I have the exact message that is printed?

InfamousKnight commented 5 years ago

Do you want a screen shot of it?

On Wed, Jul 17, 2019, 6:43 PM Clément Gallet notifications@github.com wrote:

Ok, so can I have the exact message that is printed?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/252?email_source=notifications&email_token=AAT4W4JB2IOS7ETC5YGAHQLP76OARA5CNFSM4H7D25Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2GZMXI#issuecomment-512595549, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT4W4NFU7PM6LFKZVKD6JLP76OARANCNFSM4H7D25ZQ .

clementgallet commented 5 years ago

Yes please

InfamousKnight commented 5 years ago

https://ibb.co/3TJdqTK

xelivous commented 5 years ago

I had some time to look into this again this weekend. I tried setting up my own 18.04 ubuntu image (and wanted to die dealing with the terrible default everything) in virtualbox to see if it had better compatibility at all as you seem to test it in there, and nothing I did on my native manjaro installation managed to get DT3 to run past the initial report I made.

I installed wine-devel from the built-in repositories (which i think was wine-3.6) and no matter what I tried I also got the floating point error that InfamousKnight got, just by running the game itself with wine (not in libTAS) despite not getting it on manjaro ever. So I have a feeling that the floating point issue is not related to libTAS at all but some kind of wine dependency error.

I couldn't get it to work with my hand-made installation, so I then tried using the image from #259 as a base to see if it worked any better. This time I installed wine-devel from the wineHQ repositories since that image didn't have wine either (which installed wine-4.13 fwiw). There was no improvements and it still had a floating point error when running with just Wine.

So I started debugging it a little more. I used WINEDEBUG=warn+all and Dark Blue which is the simplest out of the games. Couldn't really see anything that would be helpful in this situation, although perhaps it's something to do with virtualbox only supporting opengl2.1. Here's my log of trying to run it.. It gets a popup of "Unexpected error occured when running the game" in-between lines 801 and 802.

Likewise here's my log when running DT3 it gets the same "Unexpected error" popup, and it gets the "Invalid floating point operation" popup. The order that it gets them in seems arbitrary as sometimes one is before the other and other times the other one is first. Directly after line 963 is when they pop up.

If you'd like me to look into any other options to test that might help out let me know. My only guess as to why the games work fine on my host OS compared to the guest OS is due to openGL support and/or virtualbox being buggy. I don't know if InfamousKnight is using a VM or not but if they are then this would likely be their problem. I might look into a vmware installation next to see if that improves the situation at all. Doesn't really change that I can't get libTAS to get past the infinitely looping events even on the latest commits on my host OS though.

InfamousKnight commented 5 years ago

Im using native install.

On Sun, Aug 11, 2019, 9:16 PM xelivous notifications@github.com wrote:

I had some time to look into this again this weekend. I tried setting up my own 18.04 ubuntu image (and wanted to die dealing with the terrible default everything) in virtualbox to see if it had better compatibility at all as you seem to test it in there, and nothing I did on my native manjaro installation managed to get DT3 to run past the initial report I made.

I installed wine-devel from the built-in repositories (which i think was wine-3.6) and no matter what I tried I also got the floating point error that InfamousKnight got, just by running the game itself with wine (not in libTAS) despite not getting it on manjaro ever. So I have a feeling that the floating point issue is not related to libTAS at all but some kind of wine dependency error.

I couldn't get it to work with my hand-made installation, so I then tried using the image from #259 https://github.com/clementgallet/libTAS/issues/259 as a base to see if it worked any better. This time I installed wine-devel from the wineHQ repositories since that image didn't have wine either (which installed wine-4.13 fwiw). There was no improvements and it still had a floating point error when running with just Wine.

So I started debugging it a little more. I used WINEDEBUG=warn+all and Dark Blue which is the simplest out of the games. Couldn't really see anything that would be helpful in this situation, although perhaps it's something to do with virtualbox only supporting opengl2.1. Here's my log of trying to run it. https://pastebin.com/BdHsHWrf. It gets a popup of "Unexpected error occured when running the game" in-between lines 801 and 802.

Likewise here's my log when running DT3 https://pastebin.com/ULgnhD6L it gets the same "Unexpected error" popup, and it gets the "Invalid floating point operation" popup. The order that it gets them in seems arbitrary as sometimes one is before the other and other times the other one is first. Directly after line 963 is when they pop up.

If you'd like me to look into any other options to test that might help out let me know. My only guess as to why the games work fine on my host OS compared to the guest OS is due to openGL support and/or virtualbox being buggy. I don't know if InfamousKnight is using a VM or not but if they are then this would likely be their problem. I might look into a vmware installation next to see if that improves the situation at all. Doesn't really change that I can't get libTAS to get past the infinitely looping events even on the latest commits on my host OS though.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/252?email_source=notifications&email_token=AAT4W4NZXQDNDSTOXMMO75LQEC2VVA5CNFSM4H7D25Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4BM56I#issuecomment-520277753, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT4W4PJDJITYI66UKRMRR3QEC2VVANCNFSM4H7D25ZQ .

InfamousKnight commented 5 years ago

Using latest commit as of writing this, downloading from appveyor on Ubuntu 18.04 trying to run distorted traversty 3, and it doesn't even connect:

sean@sean-HP-Pavilion-Laptop-15-cs0xxx:~$ libTAS sh: printf: I/O error /usr/bin/wine: error while loading shared libraries: libswresample.so.2: cannot open shared object file: No such file or directory Attempt 1: Couldn't connect to socket. Attempt 2: Couldn't connect to socket. Attempt 3: Couldn't connect to socket. Attempt 4: Couldn't connect to socket. Attempt 5: Couldn't connect to socket. Attempt 6: Couldn't connect to socket. Attempt 7: Couldn't connect to socket. Attempt 8: Couldn't connect to socket. Attempt 9: Couldn't connect to socket. Attempt 10: Couldn't connect to socket. The connection to the game was lost. Exiting

I tried to install libswresample2 but it says its already installed.

clementgallet commented 5 years ago

Did you install the i386 version (libswresample2:i386)?

InfamousKnight commented 5 years ago

No, I installed it, and the game runs if Debug-native events is enabled. There seems to be a softlock, if I enable Uncontrolled time, a black screen and nothing else, if I enable native events, it softlocks 9 frames in.

clementgallet commented 5 years ago

I don't understand, you are getting the libswresample.so.2: cannot open shared object file only when Native events is unchecked? Could you double-check that? Edit: I misunderstood what you wrote. So it did fix it. Did you set the framerate to 30?

InfamousKnight commented 5 years ago

Setting the framerate to 30 fixed it and now it runs! I guess we can say arch is not recommended for the time being.

And you need clockgettime enabled to avoid a softlock

clementgallet commented 3 years ago

SIGFPE comes from this backtrace:

#0  0x79b63978 in lp_build_tgsi_info (tokens=<optimized out>, info=<optimized out>) at ../src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:590
#1  0x7971356c in llvmpipe_create_fs_state (pipe=0x7c17f3d0, templ=0x32edd4) at ../src/gallium/drivers/llvmpipe/lp_state_fs.c:3597
#2  0x796590ba in ureg_create_shader (ureg=0x7bf4d890, pipe=0x7c17f3d0, so=0x0) at ../src/gallium/auxiliary/tgsi/tgsi_ureg.c:2155
#3  0x7965cb65 in ureg_create_shader_with_so_and_destroy (so=0x0, pipe=0x7c17f3d0, p=0x7bf4d890) at ../src/gallium/auxiliary/tgsi/tgsi_ureg.h:148
#4  ureg_create_shader_and_destroy (pipe=0x7c17f3d0, p=0x7bf4d890) at ../src/gallium/auxiliary/tgsi/tgsi_ureg.h:157
#5  util_make_fragment_tex_shader_writemask (pipe=0x7c17f3d0, tex_target=TGSI_TEXTURE_1D, interp_mode=TGSI_INTERPOLATE_LINEAR, writemask=15, 
    stype=TGSI_RETURN_TYPE_UINT, dtype=TGSI_RETURN_TYPE_SINT, load_level_zero=true, use_txf=false) at ../src/gallium/auxiliary/util/u_simple_shaders.c:354
#6  0x7965ce1a in util_make_fragment_tex_shader (pipe=0x7c17f3d0, tex_target=TGSI_TEXTURE_1D, interp_mode=TGSI_INTERPOLATE_LINEAR, 
    stype=TGSI_RETURN_TYPE_UINT, dtype=TGSI_RETURN_TYPE_SINT, load_level_zero=true, use_txf=false) at ../src/gallium/auxiliary/util/u_simple_shaders.c:372
#7  0x79b47f35 in blitter_get_fs_texfetch_col (ctx=ctx@entry=0x7c1a8300, src_format=src_format@entry=PIPE_FORMAT_R32_UINT, 
    dst_format=dst_format@entry=PIPE_FORMAT_R32_SINT, target=PIPE_TEXTURE_1D, src_nr_samples=1, dst_nr_samples=1, filter=0, use_txf=false)
    at ../src/gallium/auxiliary/util/u_blitter.c:1017
#8  0x79b48f16 in util_blitter_cache_all_shaders (blitter=0x7c1a8300) at ../src/gallium/auxiliary/util/u_blitter.c:1245
#9  0x796f1c0f in llvmpipe_create_context (screen=0x7c20e870, priv=0x0, flags=8) at ../src/gallium/drivers/llvmpipe/lp_context.c:257
#10 0x79166017 in st_api_create_context (stapi=0x7a4b6f60 <st_gl_api>, smapi=0x7c20b650, attribs=0x32f340, error=0x32f33c, shared_stctxi=0x0)
    at ../src/mesa/state_tracker/st_manager.c:928
#11 0x7915a73d in dri_create_context (api=API_OPENGL_COMPAT, visual=0x7bf03550, cPriv=0x7c1497c0, ctx_config=0x32f420, error=0x32f488, 
    sharedContextPrivate=0x0) at ../src/gallium/frontends/dri/dri_context.c:163
#12 0x796126e0 in driCreateContextAttribs (screen=0x7c209580, api=0, config=0x7bf03550, shared=0x0, num_attribs=0, attribs=0x0, error=0x32f488, 
    data=0x7c1496d0) at ../src/mesa/drivers/dri/common/dri_util.c:475
#13 0x7961287f in driCreateNewContextForAPI (data=0x7c1496d0, shared=0x0, config=0x7bf03550, api=0, screen=0x7c209580)
    at ../src/mesa/drivers/dri/common/dri_util.c:505
#14 driCreateNewContext (screen=0x7c209580, config=0x7bf03550, shared=0x0, data=0x7c1496d0) at ../src/mesa/drivers/dri/common/dri_util.c:513
#15 0x7c4f4a57 in ?? () from /usr/lib/i386-linux-gnu/libGLX_mesa.so.0
#16 0x7c4f7068 in ?? () from /usr/lib/i386-linux-gnu/libGLX_mesa.so.0
#17 0x7c4f7433 in ?? () from /usr/lib/i386-linux-gnu/libGLX_mesa.so.0
#18 0x7c54aa18 in glXCreateContext () from /usr/lib/i386-linux-gnu/libGLX.so.0
#19 0x7e0f3562 in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/winex11.drv.so
#20 0x7bcb90f4 in RtlRunOnceExecuteOnce () from /usr/lib/wine/../i386-linux-gnu/wine/ntdll.dll.so
#21 0x7b07e0a9 in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/kernelbase.dll.so
--Type <RET> for more, q to quit, c to continue without paging--
#22 0x7e0f51cf in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/winex11.drv.so
#23 0x7e0e3ebe in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/winex11.drv.so
#24 0x7f79551e in __wine_get_wgl_driver () from /usr/lib/wine/../i386-linux-gnu/wine/gdi32.dll.so
#25 0x7e46c6b7 in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/wined3d.dll.so
#26 0x7e4b6496 in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/wined3d.dll.so
#27 0x7e529bbe in wined3d_create () from /usr/lib/wine/../i386-linux-gnu/wine/wined3d.dll.so
#28 0x7e5c5cb9 in ?? () from /usr/lib/wine/../i386-linux-gnu/wine/d3d8.dll.so
#29 0x7e5bc4ec in Direct3DCreate8 () from /usr/lib/wine/../i386-linux-gnu/wine/d3d8.dll.so
#30 0x00510fe0 in ?? ()
#31 0x0061ee79 in ?? ()
#32 0x00627e04 in ?? ()

There is already reported in this: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3096

This is llvm-specific, running without software rendering works.