OpenRakis / Spice86

Reverse engineer and rewrite real mode DOS programs!
Apache License 2.0
215 stars 18 forks source link

Pause handling #792

Closed JorisVanEijden closed 1 month ago

JorisVanEijden commented 1 month ago

Description of Changes

Centralize and inject the PauseHandler so all threads, except Main and UI, can be paused.

Rationale behind Changes

I wanted to trigger a pause from my override code and then be able to resume it from the UI.

Suggested Testing Steps

Play games, pause, debug, breakpoint, etc.

maximilien-noal commented 1 month ago

LGTM. I only requested a documentation change.

I still need to properly test this tomorrow night.

maximilien-noal commented 1 month ago

I just noticed that the UI will freeze if Dune is launched:

image

I can't show performance information for example. Video rendering is run, but nothing is shown.

Debug mode, command line args:

-d false -s -a "ADP220 SBP2227" -e "/home/max/Jeux/Dune/DNCDPRG.EXE"

On master, I don't get this behavior.

JorisVanEijden commented 1 month ago

I just noticed that the UI will freeze if Dune is launched:

Debug mode, command line args:

-d false -s -a "ADP220 SBP2227" -e "/home/max/Jeux/Dune/DNCDPRG.EXE"

On master, I don't get this behavior.

I can't reproduce :(

On a Debug build with -d false -s -a "ADP220 SBP2227" -e "C:\Games\DuneCD\Dncdprg.exe":

image

maximilien-noal commented 1 month ago

I can't reproduce :(

On my Xubuntu linux laptop, it works only if I don't attach the .NET Debugger.

In other words, a regular debug session is not possible.

I'll just assume it's a problem on my end and approve this PR. I saw that it works; just not with a .NET debugger attached.

JorisVanEijden commented 1 month ago

Debugger issue traced to a thread sync issue with the linux thread scheduler. Worked around by adding a Thread.Sleep(0)