clementgallet / libTAS

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

RPCS3 freezes on startup #280

Closed thegamingrestoration closed 4 years ago

thegamingrestoration commented 4 years ago

Using the latest version of RPCS3 (0.0.7-9004-6944e180 Alpha) https://rpcs3.net/download

Using the OpenGL renderer, the LLVM Recompiler and the OpenAL audio backend, the game starts but doesn't advance past frame 0. I tried using different options, but the only one that lets the game start is "Uncontrolled Time". Here's the output from gdb:

libTAS
Interim commit b536a95 built on 2019-10-25
Starting program: rpcs3 KDE_DEBUG=1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Attempt 2: Couldn't connect to socket.
Attempt 3: Couldn't connect to socket.
Attempt 4: Connected.
[New Thread 0x7fff6d192700 (LWP 16199)]
[New Thread 0x7fff675a1700 (LWP 16200)]
[New Thread 0x7fff66b9a700 (LWP 16201)]
[Thread 0x7fff66b9a700 (LWP 16201) exited]
[New Thread 0x7fff66b9a700 (LWP 16202)]
[New Thread 0x7fff65b98700 (LWP 16203)]
[New Thread 0x7fff65397700 (LWP 16204)]
[New Thread 0x7fff64a9b700 (LWP 16205)]
[New Thread 0x7fff57fff700 (LWP 16206)]
[New Thread 0x7fff577fe700 (LWP 16207)]
[New Thread 0x7fff56ffd700 (LWP 16208)]
[New Thread 0x7fff567fc700 (LWP 16209)]
[New Thread 0x7fff55ffb700 (LWP 16210)]
[New Thread 0x7fff557fa700 (LWP 16211)]
[New Thread 0x7fff54ff9700 (LWP 16212)]
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
[New Thread 0x7fff31f1a700 (LWP 16213)]
[New Thread 0x7fff31719700 (LWP 16214)]
QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.
[New Thread 0x7fff30f18700 (LWP 16215)]
[New Thread 0x7fff27fff700 (LWP 16216)]
[New Thread 0x7fff25c4a700 (LWP 16217)]
[New Thread 0x7fff25449700 (LWP 16218)]
[New Thread 0x7fff24c48700 (LWP 16219)]
[New Thread 0x7fff0bfff700 (LWP 16220)]
[New Thread 0x7fff03fff700 (LWP 16221)]
[New Thread 0x7fff0b7fe700 (LWP 16222)]
[New Thread 0x7fff0affd700 (LWP 16223)]
[New Thread 0x7fff0a7fc700 (LWP 16224)]
[New Thread 0x7fff09ffb700 (LWP 16225)]
[New Thread 0x7fff097fa700 (LWP 16226)]
[New Thread 0x7fff277fe700 (LWP 16227)]
[New Thread 0x7fff26ffd700 (LWP 16228)]
[New Thread 0x7fff267fc700 (LWP 16229)]
[New Thread 0x7fff08ff9700 (LWP 16230)]
[New Thread 0x7fff037fe700 (LWP 16231)]
[New Thread 0x7fff02ffd700 (LWP 16232)]
[New Thread 0x7fff027fc700 (LWP 16233)]
[New Thread 0x7fff01ffb700 (LWP 16234)]
[Thread 0x7fff02ffd700 (LWP 16232) exited]
[Thread 0x7fff26ffd700 (LWP 16228) exited]
[Thread 0x7fff01ffb700 (LWP 16234) exited]
[Thread 0x7fff08ff9700 (LWP 16230) exited]
[Thread 0x7fff027fc700 (LWP 16233) exited]
[Thread 0x7fff277fe700 (LWP 16227) exited]
[Thread 0x7fff267fc700 (LWP 16229) exited]
[Thread 0x7fff037fe700 (LWP 16231) exited]
[New Thread 0x7fff037fe700 (LWP 16235)]
[New Thread 0x7fff01ffb700 (LWP 16236)]
[New Thread 0x7fff027fc700 (LWP 16237)]
[New Thread 0x7fff02ffd700 (LWP 16238)]
[New Thread 0x7ffe94ffc700 (LWP 16239)]

Thread 18 "PPU[0x1000000] " received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff30f18700 (LWP 16215)]
0x00000000405e5629 in ?? ()

Please let me know if you need any more info.

clementgallet commented 4 years ago

RPCS3 is using Qt as its frontend, so it is likely it won't work on the current version (Hotline Miami is using Qt and I couldn't make it to work). They don't seem to offer another frontend.

Also, it would greatly help libTAS if we would be able to only open the game window. I'm seing a --no-gui command-line option, but it gives me the following error: QWidget: Must construct a QApplication before a QWidget. Did you manage to launch the game window only?

thegamingrestoration commented 4 years ago

Yes, I managed to open the emulator with the following command: /home/x/.config/rpcs3/dev_hdd0/game/ARTPS3001/USRDIR/EBOOT.BIN --no-gui And now the emulator freezes in the first frame (1 instead of 0), without showing any errors:

Attempt 1: Connected.
[libTAS f:1] Thread 35138 (main) glClear call.
[libTAS f:1] Thread 35138 (main) glClear call.
[libTAS f:1] Thread 35138 (main) myglBlitFramebuffer call.
[libTAS f:1] Thread 35138 (main) glDrawArrays call.
[libTAS f:1] Thread 35138 (main) myglMultiDrawArrays call.
[libTAS f:1] Thread 35138 (main) glDrawArrays call.
[libTAS f:1] Thread 35138 (main) glDrawArrays call.
[libTAS f:1] Thread 35138 (main) myglMultiDrawArrays call.
[libTAS f:1] Thread 35138 (main) glDrawArrays call.
[libTAS f:1] Thread 35138 (main) glDrawArrays call.
[libTAS f:1] Thread 35138 (main) glDrawArrays call.
[libTAS f:1] Thread 35138 (main) glXSwapBuffers call.
InfamousKnight commented 4 years ago

If there is a freeze, check uncontrolled time, debug - print categories - time get and see what function(s) pop up. Next enable those functions in runtime - timetracking

On Fri, Oct 25, 2019, 7:39 AM thegamingrestoration notifications@github.com wrote:

Yes, I managed to open the emulator with the following command: /home/x/.config/rpcs3/dev_hdd0/game/ARTPS3001/USRDIR/EBOOT.BIN --no-gui And now the emulator freezes in the first frame (1 instead of 0), without showing any errors:

Attempt 1: Connected. [libTAS f:1] Thread 35138 (main) glClear call. [libTAS f:1] Thread 35138 (main) glClear call. [libTAS f:1] Thread 35138 (main) myglBlitFramebuffer call. [libTAS f:1] Thread 35138 (main) glDrawArrays call. [libTAS f:1] Thread 35138 (main) myglMultiDrawArrays call. [libTAS f:1] Thread 35138 (main) glDrawArrays call. [libTAS f:1] Thread 35138 (main) glDrawArrays call. [libTAS f:1] Thread 35138 (main) myglMultiDrawArrays call. [libTAS f:1] Thread 35138 (main) glDrawArrays call. [libTAS f:1] Thread 35138 (main) glDrawArrays call. [libTAS f:1] Thread 35138 (main) glDrawArrays call. [libTAS f:1] Thread 35138 (main) glXSwapBuffers call.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/280?email_source=notifications&email_token=AAT4W4KETI6B6FQ4SFNHJKDQQLLHFA5CNFSM4JFBECL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECIC6CA#issuecomment-546320136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4LUTBNDSH7ZCVCOUN3QQLLHFANCNFSM4JFBECLQ .

thegamingrestoration commented 4 years ago

Ok, I read the Time Get calls, enabled time(), clock_gettime() and SDL_GetTicks(), and ran the emulator again (without Uncontrolled Time). Now I can see the emulator's FPS counter, but everything freezes after the third frame. The gdp output is slightly different but it still doesn't show up any errors:

Starting program: rpcs3 /home/x/.config/rpcs3/dev_hdd0/game/ARTPS3001/USRDIR/EBOOT.BIN --no-gui
Attempt 1: Couldn't connect to socket.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Attempt 2: Couldn't connect to socket.
Attempt 3: Connected.
[New Thread 0x7fff6d192700 (LWP 47040)]
[New Thread 0x7fff675a1700 (LWP 47041)]
[New Thread 0x7fff66b9a700 (LWP 47042)]
[Thread 0x7fff66b9a700 (LWP 47042) exited]
[New Thread 0x7fff66b9a700 (LWP 47043)]
[New Thread 0x7fff65b98700 (LWP 47044)]
[New Thread 0x7fff65397700 (LWP 47045)]
[New Thread 0x7fff64b96700 (LWP 47046)]
[New Thread 0x7fff5e831700 (LWP 47047)]
[New Thread 0x7fff5e030700 (LWP 47048)]
[New Thread 0x7fff5d82f700 (LWP 47049)]
[New Thread 0x7fff5d02e700 (LWP 47050)]
[New Thread 0x7fff5c82d700 (LWP 47051)]
[New Thread 0x7fff3bfff700 (LWP 47052)]
[New Thread 0x7fff3b7fe700 (LWP 47053)]
[New Thread 0x7fff3affd700 (LWP 47054)]
[New Thread 0x7fff3a7fc700 (LWP 47055)]
[New Thread 0x7fff39ffb700 (LWP 47056)]
[New Thread 0x7fff5ffff700 (LWP 47057)]
[New Thread 0x7fff5f7fe700 (LWP 47058)]
[New Thread 0x7fff397fa700 (LWP 47059)]
[New Thread 0x7fff38ff9700 (LWP 47060)]
[New Thread 0x7fff0ffff700 (LWP 47061)]
[New Thread 0x7fff0f7fe700 (LWP 47062)]
[New Thread 0x7fff0effd700 (LWP 47063)]
[New Thread 0x7fff0e7fc700 (LWP 47064)]
[Thread 0x7fff0ffff700 (LWP 47061) exited]
[Thread 0x7fff0effd700 (LWP 47063) exited]
[Thread 0x7fff38ff9700 (LWP 47060) exited]
[Thread 0x7fff0e7fc700 (LWP 47064) exited]
[Thread 0x7fff397fa700 (LWP 47059) exited]
[Thread 0x7fff5f7fe700 (LWP 47058) exited]
[Thread 0x7fff5ffff700 (LWP 47057) exited]
[Thread 0x7fff0f7fe700 (LWP 47062) exited]
[New Thread 0x7fff0e7fc700 (LWP 47065)]
[New Thread 0x7fff0f7fe700 (LWP 47066)]
[New Thread 0x7fff0effd700 (LWP 47067)]
[New Thread 0x7fff0ffff700 (LWP 47068)]
[Thread 0x7fff0ffff700 (LWP 47068) exited]
[Thread 0x7fff0f7fe700 (LWP 47066) exited]
InfamousKnight commented 4 years ago

Is it advancing time in any way on the libtas window? Sometimes the frame counter freezes but its still advancing time.

Another thing you can try is debug - keep first thread. This same thing happened with midnight club 2 wine

On Fri, Oct 25, 2019, 10:18 AM thegamingrestoration < notifications@github.com> wrote:

Ok, after I read the Time Get calls, I enabled time(), clock_gettime() and SDL_GetTicks(), and ran the emulator again (without Uncontrolled Time). Now I can see the emulator's FPS counter, but everything freezes after the third frame. The gdp output is slightly different but it still doesn't show up any errors:

Starting program: rpcs3 /home/x/.config/rpcs3/dev_hdd0/game/ARTPS3001/USRDIR/EBOOT.BIN --no-gui Attempt 1: Couldn't connect to socket. [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Attempt 2: Couldn't connect to socket. Attempt 3: Connected. [New Thread 0x7fff6d192700 (LWP 47040)] [New Thread 0x7fff675a1700 (LWP 47041)] [New Thread 0x7fff66b9a700 (LWP 47042)] [Thread 0x7fff66b9a700 (LWP 47042) exited] [New Thread 0x7fff66b9a700 (LWP 47043)] [New Thread 0x7fff65b98700 (LWP 47044)] [New Thread 0x7fff65397700 (LWP 47045)] [New Thread 0x7fff64b96700 (LWP 47046)] [New Thread 0x7fff5e831700 (LWP 47047)] [New Thread 0x7fff5e030700 (LWP 47048)] [New Thread 0x7fff5d82f700 (LWP 47049)] [New Thread 0x7fff5d02e700 (LWP 47050)] [New Thread 0x7fff5c82d700 (LWP 47051)] [New Thread 0x7fff3bfff700 (LWP 47052)] [New Thread 0x7fff3b7fe700 (LWP 47053)] [New Thread 0x7fff3affd700 (LWP 47054)] [New Thread 0x7fff3a7fc700 (LWP 47055)] [New Thread 0x7fff39ffb700 (LWP 47056)] [New Thread 0x7fff5ffff700 (LWP 47057)] [New Thread 0x7fff5f7fe700 (LWP 47058)] [New Thread 0x7fff397fa700 (LWP 47059)] [New Thread 0x7fff38ff9700 (LWP 47060)] [New Thread 0x7fff0ffff700 (LWP 47061)] [New Thread 0x7fff0f7fe700 (LWP 47062)] [New Thread 0x7fff0effd700 (LWP 47063)] [New Thread 0x7fff0e7fc700 (LWP 47064)] [Thread 0x7fff0ffff700 (LWP 47061) exited] [Thread 0x7fff0effd700 (LWP 47063) exited] [Thread 0x7fff38ff9700 (LWP 47060) exited] [Thread 0x7fff0e7fc700 (LWP 47064) exited] [Thread 0x7fff397fa700 (LWP 47059) exited] [Thread 0x7fff5f7fe700 (LWP 47058) exited] [Thread 0x7fff5ffff700 (LWP 47057) exited] [Thread 0x7fff0f7fe700 (LWP 47062) exited] [New Thread 0x7fff0e7fc700 (LWP 47065)] [New Thread 0x7fff0f7fe700 (LWP 47066)] [New Thread 0x7fff0effd700 (LWP 47067)] [New Thread 0x7fff0ffff700 (LWP 47068)] [Thread 0x7fff0ffff700 (LWP 47068) exited] [Thread 0x7fff0f7fe700 (LWP 47066) exited]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/280?email_source=notifications&email_token=AAT4W4O4KZPCP5QVCLNWTJ3QQL525A5CNFSM4JFBECL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECIP4NI#issuecomment-546373173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4LFUTE6KDUUWTLXG6LQQL525ANCNFSM4JFBECLQ .

thegamingrestoration commented 4 years ago

Good news! The emulator works after enabling "Keep main first thread", even without the --nogui parameter.

The problem is that.. it works only when I move the mouse. Every time I stop moving it, both the emulator and frame counter freeze, same thing with the sound.

Here's a small demonstration: https://gfycat.com/dopeyhalfdormouse

Also, the keyboard works ingame, but it doesn't register any input on libTAS, and the mouse stays at 0:0 all the time.

Maybe the Qt libraries are interfering with the recording? LibTAS seems to recognize all the necessary components:

Video support: unknown (OpenGL 4.3 Core profile)
Audio support: yes (OpenAL)
Keyboard support: default (xevents)
Mouse support: default (xevents)
Joystick support: unknown

(I can't use the gdb debugger to get more info, it crashes the emulator)

InfamousKnight commented 4 years ago

Have you checked runtime - asynchronous - xevent?

On Fri, Oct 25, 2019, 2:41 PM thegamingrestoration notifications@github.com wrote:

Good news! The emulator works after enabling "Keep main first thread", even without the --nogui parameter.

The problem is that.. it works only when I move the mouse. Every time I stop moving it, both the emulator and frame counter freeze, same thing with the sound.

Here's a small demonstration: https://gfycat.com/dopeyhalfdormouse

Also, the keyboard works ingame, but it doesn't register any input on libTAS, and the mouse stays at 0:0 all the time.

Maybe the Qt libraries are interfering with the recording? LibTAS seems to recognize all the necessary components:

Video support: unknown (OpenGL 4.3 Core profile) Audio support: yes (OpenAL) Keyboard support: default (xevents) Mouse support: default (xevents) Joystick support: unknown

(I can't use the gdb debugger to get more info, it crashes the emulator)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/280?email_source=notifications&email_token=AAT4W4K6NCS5RJO7MLJ7NTDQQM4W7A5CNFSM4JFBECL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECJGYDA#issuecomment-546466828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4L35AV6HEZFL3PW6ETQQM4W7ANCNFSM4JFBECLQ .

thegamingrestoration commented 4 years ago

Yes, same thing unfortunately.

Have you checked runtime - asynchronous - xevent?

InfamousKnight commented 4 years ago

Well, its nice to see it runs through libtas.

Have you tested encodes yet? If that works fine, we can at least use it for segmented runs with frame advance and slow downs to make it easier.

On Fri, Oct 25, 2019, 5:54 PM thegamingrestoration notifications@github.com wrote:

Yes, same thing unfortunately.

Have you checked runtime - asynchronous - xevent?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/280?email_source=notifications&email_token=AAT4W4J7JI4B3VQZJLTWJPTQQNTJPA5CNFSM4JFBECL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECJVGEI#issuecomment-546525969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4L5VRMKENAYQMIXKU3QQNTJPANCNFSM4JFBECLQ .

clementgallet commented 4 years ago

There are still problems with threading, but you should be able to run with "Runtime > Time Tracking > clock_gettime()" and "Runtime > Debug > Time tracking all threads > clock_gettime()" with commit 90a2e39d946741fbad3a0034b812f7558e073875. The latter option can cause desyncs.

thegamingrestoration commented 4 years ago

Awesome! It works now! It's a bit unstable (probably the emulator's fault, the --no-gui parameter is not very well implemented), and some games run much slower; but otherwise the input,sound and video encoding work perfectly.

The only remaining issue is that libTAS is unable to play movie recordings. Whenever I try to play an ltm file I can see my keyboard inputs onscreen, but they don't register in the emulator.

InfamousKnight commented 4 years ago

Yeah, it runs slow because libtas is using a software renderer. If you turn that off, it will run at its native speed, but save states will likely crash. So the fact that frame advance works, means that its technically a tas.

On Sat, Oct 26, 2019, 1:52 PM thegamingrestoration notifications@github.com wrote:

Awesome! It works now! It's a bit unstable (probably the emulator's fault, the --no-gui parameter is not very well implemented), and some games run much slower; but otherwise the input,sound and video encoding work perfectly.

The only remaining issue is that libTAS is unable to play movie recordings. Whenever I try to play an ltm file I can see my keyboard inputs onscreen, but they don't register in the emulator.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clementgallet/libTAS/issues/280?email_source=notifications&email_token=AAT4W4LM5R5HXTQMYQ7UWE3QQR7U5A5CNFSM4JFBECL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKNM6I#issuecomment-546625145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAT4W4IVHXFHZMHQ7TLKCD3QQR7U5ANCNFSM4JFBECLQ .

thegamingrestoration commented 4 years ago

I had the software rendering setting disabled the whole time. libTAS is definitely slowing down the emulator, and whenever I click on Stop, libTAS suddenly disconnects from the emulator, and the emulator runs fast again. I think there's something wrong with the way libTAS handles the wait calls, but that's probably what @clementgallet meant with problems with threading.

clementgallet commented 4 years ago

Keyboard inputs should work after commit 0a7744cbd411aa6d4bae0e5742a3dad38436524d

Yeah, mesa OpenGL software rendering does not support OpenGL 4.3, which is required by RPCS3. As a consequence, it is likely we won't be able to use libTAS savestates.

thegamingrestoration commented 4 years ago

Thank you so much, recordings now work properly :) And I'm sure this will also fix other games & emulators that rely on xcb events.