Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial Port / Null Modem Games not working properly in WinUAE v5.2.0 compared to WinUAE v4.4 #295

Open
dekkit opened this issue Feb 26, 2024 · 10 comments

Comments

@dekkit
Copy link

dekkit commented Feb 26, 2024

Firstly thanks for all your incredible work on this emulator! Secondly, I recently installed InstallWinUAE5200_x64.msi on a Windows 10 machine (i3), and was struggling to get system link / Null Modem games to run properly.

Note: I am running two instances of WinUAE on the same machine.

Games would detect the serial link, progress to the game then randomly lose sync after anywhere from 20 seconds to a few minutes. Note: When i reboot and try the same games using version 4.4 of WinUAE they both sync up pretty much perfectly and seem to keep sync with each other for the duration of any system link games.

2 x Games Tested

  • Stunt Car Racer (adf)
  • Lotus Turbo 2 (adf)

WinUAE Settings
Config: A500
v1.3 ROM, OCS, 512 KB chip + 512KB slow ram
Cycle Accurate

Under Host -> IO Ports
Serial Port = WinUAE inter-process serial port [Master]
Checkboxes are:
Shared = OFF
RTS/CTS = OFF
Direct = ON
UAESerial.Device = OFF

...on the second instance of UAE running on the same machine (all settings the same)
Serial Port = WinUAE inter-process serial port [Slave]

Noting that the cpu utilisation on the windows PC doesn't seem to get above 5-20%

This behavior also sounds similar to the closed issue for v4.10.1 but seems to be occurring in the latest version:
#252

Being able to play null modem Amiga games is an excellent feature of WinUAE and it would be great to preserve this in future versions. I'm happy to help test any future releases.

FYI - If anyone else is looking for steps how to setup a system link / null modem game mode this is what i used:

  • Download WinUAE version 4.4 (x64) (for now)
  • Run 2 x instances of WinUAE
  • Set both instances to be cycle accurate and match the config.
  • Under Host -> Game Ports - select a distinct controller for each instance
  • Under Host -> IO Ports
    Instance 1 Serial Port = WinUAE inter-process serial port [Master]
    Instance 2 Serial Port = WinUAE inter-process serial port [Serial]

Make sure checkboxes for both instances are set to:
Shared = OFF
RTS/CTS = OFF
Direct = ON
UAESerial.Device = OFF

  • Under Host -> Pri. & Extensions
    Make sure checkboxes for both instances are set to:
    When active
    Run at priority = above normal
    Pause emulation = OFF
    Disable sound = OFF

When inactive
Run at priority = above normal
Pause emulation = OFF
Disable sound = OFF
Disable game controllers = OFF

@tonioni
Copy link
Owner

tonioni commented Mar 14, 2024

Do you see any log messages in either winuae log window when things go wrong? (run both winuae instances with -log command line parameter)

EDIT: Ignore above. Nothing interesting happens, game simply starts working strangely. No clues yet..

@tonioni
Copy link
Owner

tonioni commented Mar 16, 2024

Fixed. Serial port emulation was made too accurate (including overrun/overwriting old data that was not fetched quickly enough) but that does not work very well if received data is buffered (comes outside of emulation) which can return multiple bytes back to back. Now any serial mode except loopback does not allow new byte to arrive before previous one is read and serial receive interrupt bit is cleared.

@dekkit
Copy link
Author

dekkit commented Mar 18, 2024

Was about to start grabbing output logs and just realized youve already fixed it!

Excellent work! Will test on the next build, thank you for this!

As a side, is it possible to connect 2x PC each running UAE via serial over network by linking each IP address using the config settings somehow? (I couldn't find how to do this through my searches and reading the help file so it might be an unusual use case)

My next test to achieve something like this was trying this using something like netcat to redirect one to other (granted there maybe latency issues).

@tonioni
Copy link
Owner

tonioni commented Mar 19, 2024

Unfortunately network won't work (Not even LAN worked stable) because action null-modem cable serial linked games expect really small latency, few milliseconds max latency and multiple bytes transferred in single frame. They really hate data that has variable latency. Games designed to work with modem connection should work.

WinUAE had(?) IP link option in serial port box but I don't remember what happened with it. It wasn't very useful because almost all serial linked games lost sync sooner or later.

@dekkit
Copy link
Author

dekkit commented Mar 19, 2024

Makes sense - thanks again!

@rofl0r
Copy link
Contributor

rofl0r commented Mar 19, 2024

few milliseconds max latency and multiple bytes transferred in single frame

these days home-LANs typically have microsecond latency, even wifi typically stays at 0 ms in ping. i wonder if this would no longer be an issue with current equipment (spoiler: i use linux, not the sluggish windows).

@tonioni
Copy link
Owner

tonioni commented Mar 19, 2024

Of course LAN has very low latency but thats not the problem (back in the day I already had gigabit LAN when most had 100M). TCP/IP is the problem (OS does not really matter, don't reply stupid comments.). Maybe raw packets would work nicely in LAN but they have other issues. Also I don't think any of today's networking hardware or software is designed to transfer single bytes where bytes are sent one by one, with about 1-2ms delay between bytes.

Maybe it works in some situations, maybe not. Not my problem. I hate anything network related because debugging becomes x^10 more complex.

@rofl0r
Copy link
Contributor

rofl0r commented Mar 19, 2024

TCP/IP is the problem

for home LAN UDP would make more sense i guess. it's unlikely any packet gets lost there. you just fire and forget, no need to wait for ACK.

I hate anything network related because debugging becomes x^10 more complex.

oh, alright then. would you be open to accept a PR implementing this? (i'm not gonna do it, but someone else might).

@tonioni
Copy link
Owner

tonioni commented Mar 20, 2024

There is enet-network support hidden in serial port emulation. Which (at least when I did it years ago) was meant for something like that. Perhaps it already works after enabling it.

@dekkit
Copy link
Author

dekkit commented Jun 10, 2024

Fixed. Serial port emulation was made too accurate (including overrun/overwriting old data that was not fetched quickly enough) but that does not work very well if received data is buffered (comes outside of emulation) which can return multiple bytes back to back. Now any serial mode except loopback does not allow new byte to arrive before previous one is read and serial receive interrupt bit is cleared.

WinUAE v5.3.0 (WinUAE5300_x64)

Test Results - using single pc to emulate 2 x instances of Winuae (as per first post and settings)
Stunt Car = seems to be working great, played a single race (serial link) and it didn't lose sync at all. Even alt tabbing between each instance to keep both cars moving forward and on the track / crashing off the course.

Lotus Turbo 2 = serial game kicked off ok but would intermittently flicker "Paused" a few times (for barely a fraction of a second) before eventually losing sync and kicking both players back to the opening credits. I suspect this game might be more sensitive to data timing issues, very briefly pausing slave player until the data get back in sync - I recall seeing this this issue once or twice on v4.4 (i.e. rarely)

Example of the 'Pause' flicker (freeze frame)
image

Looking back at the screen shot i do notice the FPS bouncing around 50 (either slightly above or below) - if not that i do wonder if lotus was expecting to be locked in at a specific slower baud rate for data communication (i'm really just guessing tho)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants