OpenSWE1R / openswe1r

An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
https://openswe1r.github.io/
GNU General Public License v2.0
313 stars 26 forks source link

Crash on game menu : UC_MEM_READ_UNMAPPED after IDirectDrawSurface4__32 ? #124

Closed Nicob75 closed 6 years ago

Nicob75 commented 6 years ago

Hi,

I'm Nicolas, a huge fan of SWEP1R and I was really curious about this project. Congrats for all the great work already ! So I tried to build, install and launch it (Ubuntu 16.04 on an MSI GE60). It seems to start pretty well, it even shows the game menu (choice between Single Player Tournament/Free Play, Multiplayer, Settings and Quit). But if I wait a little bit (btw approx 2 and 5 secs) it crashes with this trace :

... p 0xD910000 a 0x0 b 0xC07FFDCC c 0x1 d 0x0 640 x 480 (pitch: 1280); bpp = 16; at 0x0D9DC000 Stack at 0xC07FFDB0; returning EAX: 0x00000000 29081 Emulation at 431C71 ('IDirectDrawSurface4__25') from 431C71

p 0xD910000 a 0x0 Stack at 0xC07FFE50; returning EAX: 0x00000000 29082 Emulation at 431CE0 ('IDirectDrawSurface4__32') from 431CE0

Unicorn-Engine error of type 19 at 0x24, size = 0x1 EIP: 0x00422E30 ESP: 0xC07FFE54 EBP: 0x00000000 EAX: 0xC07FFEAC EBX: 0x0D066000 ECX: 0x00000001 EDX: 0x0000008F ESI: 0x00000000 EDI: 0x00000000 EFLAGS: 0x00000000 FPSW: 0xC084 FPCW: 0x0200 FPTAG: 0xFFFF FP0: 0x80000000000000000000 FP1: 0x40079380000000000000 FP2: 0x40079800000000000000 FP3: 0x40059400000000000000 FP4: 0x3FFF8000007F00000000 FP5: 0x4009B940000000000000 FP6: 0x40099FC0000000000000 FP7: 0x00000000000000000000 Emulation returned 422E30 Stack [0] = 0 Stack [1] = 0 Stack [2] = 0 Stack [3] = 40000000 Stack [4] = 18 Stack [5] = 0 Stack [6] = 0 ... Stack [99] = 0 openswe1r: /media/nico/DATA/Nicolas/DVLPT/C/openswe1r/emulation.c:159: UcErrorHook: Assertion `false' failed. Abandon (core dumped)

When looking in the code of emulation.c:159 I see : UC_MEM_READ_UNMAPPED = 19, // Unmapped memory is read from

So I think it's not enough information but who knows, any idea why this kind of SEGFAULT is happening ? And if indeed not enough, what info would you need to analyse it ?

JayFoxRox commented 6 years ago

I don't think we have enough information to help yet.

I think this might be related to a faulty installation of the game (wrong filenames / case differences). You could try running with ./openswe1r | grep Failed to see if opening some of the files might fail (a lot of audio/wav related failures are to be expected as the game searches for files in various folders before finding the right one; other failures are not expected).

Edit: I was indeed able to reproduce this issue by removing my "data/wavs" folder. Make absolutely sure that all file- and foldernames from the games disc (or webdemo) are in lowercase

It could also be related to a version of the game I did not see yet (such as localizations mentioned in issue 61). Those versions might use different features which are not working yet.

Or it might simply be bugs in OpenSWE1R.

I'd suggest joining our gitter chat channel for support. The link can be found in the beginning of the README.

Nicob75 commented 6 years ago

1) REPLY TO PREVIOUS MESSAGE

You were right, I tried it and got a lot of error messages for the resources (audio/images) with your command :

Failed to open file ('.\data\racer.tab' as './data/racer.tab') Failed to open file ('.\data\config\current\video.cfg' as './data/config/current/video.cfg') Failed to open file ('.\data\config\current\video.cfg' as './data/config/current/video.cfg') Failed to open file ('.\data\config\current\audio.cfg' as './data/config/current/audio.cfg') Failed to open file ('.\data\config\current\audio.cfg' as './data/config/current/audio.cfg') Failed to open file ('.\data\sounds.map' as './data/sounds.map') Failed to open file ('.\data\wavs\11K\ex-lrg1.wav' as './data/wavs/11k/ex-lrg1.wav') Failed to open file ('.\data\wavs\11K\Voice\ex-lrg1.wav' as './data/wavs/11k/voice/ex-lrg1.wav') Failed to open file ('.\data\wavs\22K\Voice\ex-lrg1.wav' as './data/wavs/22k/voice/ex-lrg1.wav') Failed to open file ('.\data\wavs\Music\ex-lrg1.wav' as './data/wavs/music/ex-lrg1.wav') Failed to open file ('.\data\wavs\Voice\ex-lrg1.wav' as './data/wavs/voice/ex-lrg1.wav') ... Failed to open file ('.\data\wavs\Music\sfx_crash_wood.wav' as './data/wavs/music/sfx_crash_wood.wav') Failed to open file ('.\data\wavs\Voice\sfx_crash_wood.wav' as './data/wavs/voice/sfx_crash_wood.wav') Failed to open file ('.\data\config\current\force.cfg' as './data/config/current/force.cfg') Failed to open file ('.\data\config\current\force.cfg' as './data/config/current/force.cfg') Failed to open file ('.\data\config\default\control.map' as './data/config/default/control.map') Failed to open file ('.\data\config\current\current_control.map' as './data/config/current/current_control.map') Failed to open file ('.\data\config\current\current_control.map' as './data/config/current/current_control.map') Failed to open file ('data\images\hline.tga' as 'data/images/hline.tga') Failed to open file ('data\images\vline.tga' as 'data/images/vline.tga') Failed to open file ('.\data\player\tgfd.dat' as './data/player/tgfd.dat') Failed to open file ('.\data\player\tgfd.dat' as './data/player/tgfd.dat') openswe1r: /media/nico/DATA/Nicolas/DVLPT/C/openswe1r/main.c:3537: UnknownImport: Assertion `false' failed.

I noticed the issue with the uppercase and fixed it (where I saw it) but apparently there's an issue with the paths (windows VS linux paths like ? '/' VS '\' ?).

What version are you using ? Mine is french 1.0. Well, I also tried with a fixed .exe (my installation is not brand new).

I don't think I can be much help but I just let a message on the chat.

2) INSTALLING THE DEMO VERSION => OK

I then tried with the "Installing the demo version" instructions and it worked (it is slow of course, but it works! I say congrats one more time, you did a really good job!).

3) INSTALLING FROM DISC => KO

Then I followed the "Installing from disc" instructions but it did not work.

In the execution trace I spotted :

hWnd 0x14D lpText 0x4BC2A6 ('Error: Please reinstall program from CD-ROM. Press OK to exit to desktop.') lpCaption 0x4BC30E ('BAD INSTALL') uType 0x10 Stack at 0xC07FFA68; returning EAX: 0x00000002 172 Emulation at 426409 ('MessageBoxA') from 426409

And when launching with "| grep Failed" I get only one line :

Failed to open file ('.\data\racer.tab' as './data/racer.tab')

So it can be similar to the first issue.

JayFoxRox commented 6 years ago

I've also addressed some of these things on gitter. But I'll also respond here for the record:

I noticed the issue with the uppercase and fixed it (where I saw it) but apparently there's an issue with the paths (windows VS linux paths like ? '/' VS '\' ?).

Failed to open file ('.\data\player\tgfd.dat' as './data/player/tgfd.dat') means that the game tried to open ".\data\player\tgfd.dat" (with windows path seperators), but OpenSWE1R translated it to "./data/player/tgfd.dat" (which has cross-platform path seperators). So there shouldn't be an issue.

`openswe1r: /media/nico/DATA/Nicolas/DVLPT/C/openswe1r/main.c:3537: UnknownImport: Assertion 'false' failed.

That line implies that the game went further that time, but running with grep unfortunately hides which import is missing. Note that there was an issue with certain configurations which could have caused an UnknownImport to be hit. It has been fixed today in #119

If that didn't solve it, please post a log again, but this time without grep.

What version are you using ? Mine is french 1.0. Well, I also tried with a fixed .exe (my installation is not brand new).

This could be an issue, refer to #61 (more on this below)

it is slow of course, but it works!

try running: cmake -DUSE_VM=ON .. before running make in the "build/" folder and follow the instructions in uc_kvm_loader.asm That will activate KVM, which should result in full-speed gameplay. You might need to enable hardware virtualization in your bios or install kernel modules.

"Error: Please reinstall program from CD-ROM. Press OK to exit to desktop"

Please post a longer log for this and respond your version information to https://github.com/OpenSWE1R/openswe1r/issues/61#issuecomment-354209692 I have suspicions that each localization uses a different CD name or copy protection.

Also make sure you are using the latest version of OpenSWE1R. CD emulation was only added 2 days ago in #109

Failed to open file ('.\data\racer.tab' as './data/racer.tab')

That is normal. That file is not included with the game.

~~I'm not sure what that file is supposed to contain. It was probably used during development or it might be generated sometime during gameplay. For now, don't worry about this particular file missing.~~

If you have a non-english version of the game this file should exist as it contains the translation table. I'm not sure yet if this is required (the game might potentially fall back to english?)

JayFoxRox commented 6 years ago

I'll close this issue as it's quite outdated. Please open a new issue if you still run into issues.