sarah-walker-pcem / pcem

PCem
http://pcem-emulator.co.uk
GNU General Public License v2.0
1.54k stars 217 forks source link

Half-Life : Blue Shift fails to start #4

Open sarah-walker-pcem opened 3 years ago

sarah-walker-pcem commented 3 years ago

Describe the bug Half-Life : Blue Shift fails to start. Process stays running and can be seen in Task Manager, but the game never launches

To Reproduce Steps to reproduce the behavior:

  1. Launch Blue Shift from either the Start->Programs menu or from the CD autostart menu

Expected behavior The game running.

Emulator configuration

Host machine

sarah-walker-pcem commented 3 years ago

I initially investigated this during the v17 feature freeze. The hang is protection related; the game sets the CPU trap flag (enabling single step exceptions) and monitors the execution of a routine (checksum related?) in the exception handler. The exception handler will clear the trap flag if execution leaves a specific area, presumably from a desire to track only user and not system call execution, and sets a debug trap at the return address. PCem v17 doesn't emulate debug traps so this never fires.

I did experiment with adding debug trap support, which did cause the trap flag to get set again after the first system call, but it is later cleared again. More investigation is required; there is a state machine in the exception handler that I don't yet fully understand.

leilei- commented 3 years ago

Tribes 2 (released by Sierra in the same quarter) also has similar symptoms. The demo version seems to have a different point of failure however.