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

Segfault on startup #333

Closed
ibara opened this issue Jul 19, 2019 · 16 comments
Closed

Segfault on startup #333

ibara opened this issue Jul 19, 2019 · 16 comments
Assignees
Labels
Milestone

Comments

@ibara
Copy link

ibara commented Jul 19, 2019

Upon launching the game on OpenBSD, OpenDUNE immediately segfaults.
gdb backtrace attached.

opendune-gdb.txt

@miniupnp
Copy link
Contributor

miniupnp commented Apr 9, 2020

that is strange... there must be something strange happening in Sprites_GetSprite()

@miniupnp
Copy link
Contributor

miniupnp commented Apr 9, 2020

there is definitively an issue in Sprites_GetSprite() :
you have :

         src = 0xa1d203b8c14 <error: Cannot access memory at address 0xa1d203b8c14>
         dst = 0x0
         buffer = 0xa1d1fc48c00 "\a"

I have :

(gdb) print src
$1 = (const uint8 *) 0x808595722 ""
(gdb) print dst
$2 = (uint8 *) 0x0
(gdb) print buffer
$3 = (uint8 *) 0x808595700 "\a"

For MOUSE.SHP and i = 0, src should be 0x22 (34) bytes after buffer.

@miniupnp
Copy link
Contributor

miniupnp commented Apr 9, 2020

@ibara could you check that you have the right data files ?

and also build with this patch : miniupnp@d88507b

@miniupnp miniupnp added the bug label Apr 9, 2020
@miniupnp miniupnp added this to the 1.0 milestone Apr 9, 2020
@miniupnp
Copy link
Contributor

miniupnp commented Apr 9, 2020

see #326

@ibara
Copy link
Author

ibara commented Apr 9, 2020

Hello. That did not help. How can I check that I have the right data files?

@miniupnp
Copy link
Contributor

SHA1 (ATRE.PAK) = be9d932a7a7fea7b7924a8c3dec0dda068a8a819
SHA1 (DUNE.PAK) = bb1e0fd6b03bb83345563e424ee4c21b225ae43a
SHA1 (DUNE2.EXE) = 2255fd970a6df94c1c5e4b713933ecb528941e14
SHA1 (DUNE2.ICO) = e1dc5645de9f1602100996bedcf34516a787f123
SHA1 (ENGLISH.PAK) = 0b83d8ce004267f00407fe022ea4737b4cfe28a6
SHA1 (FINALE.PAK) = 1906a7e86e2af60721777db1611515737b9fd35c
SHA1 (FRENCH.PAK) = ab76d065add42ce4821f56dac4b3e3cc189b0a9a
SHA1 (GERMAN.PAK) = fa91d4d15938725f5e9f906a9c4a14242b923736
SHA1 (HARK.PAK) = 3f041c33a466da38e69e81df50e8768bfd06fc22
SHA1 (INTRO.PAK) = f44fac9940edcca0d0e45ed78b9ea709a7e074ca
SHA1 (INTROVOC.PAK) = 5bf08ae85be8c6dcfcf748d02d6ebe9aeded501b
SHA1 (MENTAT.PAK) = f01a90012a31f58c9e26a2f35088d03d3b044a24
SHA1 (MERC.PAK) = 97621250c5ceafaa93b7071dab3aa30f3fd5a05a
SHA1 (ONETIME.DAT) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (ORDOS.PAK) = 350b4e308e86bfb81eac6d2f30577e2e47acd07b
SHA1 (SCENARIO.PAK) = c94774c479cdca2cedc4c61318c857e5431a8233
SHA1 (SETUP.EXE) = 3b6177d3d020d51f01864a4285380370ad03574d
SHA1 (SETUPENG.DIP) = 64cbea7da013fe4ca0bac4ce44680d5dff086570
SHA1 (SETUPFRE.DIP) = 78985dd34cfe668778aa5516ca69fe40c81b5c3d
SHA1 (SETUPGER.DIP) = b0cd660b6017b2eb700235566bdaafdff3b3c9b0
SHA1 (SOUND.PAK) = 7a95bdb74809106ebebbecb549c5a08529670444
SHA1 (VOC.PAK) = 2b5e1d29ce521cf1c5bf671a11b744efc5a17199

@miniupnp
Copy link
Contributor

@ibara MOUSE.SHP should start by :

(gdb) x/20h buffer
0x808595700:      0x0007  0x0020  0x0000  0x0085  0x0000  0x00db  0x0000  0x011f
0x808595710:      0x0000  0x0177  0x0000  0x01b9  0x0000  0x020d  0x0000  0x0257
0x808595720:      0x0000  0x0000  0x1010  0x1000

@ibara
Copy link
Author

ibara commented Apr 10, 2020

OK my DUNE2.EXE checksum doesn't match. Everything else does. So I am going to presume that might be the problem, as you've noted before.

@ibara
Copy link
Author

ibara commented Apr 10, 2020

I just needed to apply the 1.07 patch. Still a segfault though. Will look into it...

@miniupnp
Copy link
Contributor

DUNE2.EXE is not used by OpenDUNE. Have you checked the buffer ?

@miniupnp miniupnp self-assigned this Nov 21, 2020
@chadjoan
Copy link

I am also experiencing a segfault in Sprites_GetSprite that seems MOUSE.SHP related.

Here is the backtrace:

Thread 1 "opendune" received signal SIGSEGV, Segmentation fault.
Sprites_Load (filename=0x5555555f6d3f "MOUSE.SHP") at /home/chad/downloads/games/DuneII/OpenDUNE/src/sprites.c:101
101                     Debug("Sprites %-12s %3d : 0x%04x %2dx%2d %2d %5d %5d\n", filename, i,
(gdb) bt
#0  Sprites_Load (filename=0x5555555f6d3f "MOUSE.SHP") at /home/chad/downloads/games/DuneII/OpenDUNE/src/sprites.c:101
#1  0x00005555555978f0 in Sprites_Init () at /home/chad/downloads/games/DuneII/OpenDUNE/src/sprites.c:478
#2  0x0000555555565b9c in GameLoop_Main () at /home/chad/downloads/games/DuneII/OpenDUNE/src/opendune.c:912
#3  main (argc=<optimized out>, argv=<optimized out>) at /home/chad/downloads/games/DuneII/OpenDUNE/src/opendune.c:1362

Here is the full GDB session: opendune_backtrace_mouseshp.txt

This is on commit 411c3a9. I configured with ./configure --with-asound --without-pulse --with-sdl2 --enable-debug and am running this on Gentoo Linux.

These gamefiles play in DOSBOX (v0.74-3). I can get into the first mission just fine.

If the MOUSE.SHP file is wrong, I suggest that the code print some diagnostic information instead of segfaulting. Something like "Invalid or unexpected MOUSE.SHP file: Expected 'X' after ABC (at byte 0xNN), instead got 'Y'". This would make the problem (slightly) less mysterious for the player/user and maybe provide more usable information to put into bug reports. Though it does make me wonder if there is more than one version of the game with different MOUSE.SHP files. If that's the case, it should either parse the other file variant successfully or let us know that we have some incompatible variant of the original game files (and we're out of luck until someone makes a PR or whatever that adds the feature).

I would attach the MOUSE.SHP file, but I can't find it. I am noticing that the earlier comment with all of the files and their SHA1 hashes doesn't have a MOUSE.SHP in its list either. Is it inside one of the .PAK files? I'm reluctant to upload all of my game files because it might violate some copyright/DMCA/whatever law, but if you can tell me which file to upload, I imagine it would be acceptable to just upload that one file, and maybe that would help with repro.

Thanks!

@glx22
Copy link
Member

glx22 commented Oct 25, 2021

All files are inside .PAK. And files from version 1.07 are required.

@chadjoan
Copy link

My Dune version was 1.0

I couldn't find a v1.0->1.07 patch easily enough (1.07 official to 1.07 unofficial yes, or 1.01 to 1.07, but no 1.0 to 1.07), so I downloaded some gamefiles that were already patched to 1.07. That worked; OpenDUNE starts with those gamefiles.

I suggest leaving the bug open until the segfault is replaced with an error message that explains this.

This issue is, to my knowledge, the only thing explaining how to fix this problem. That is, of course, assuming there aren't other causes of segfaults... ;)

@miniupnp
Copy link
Contributor

please send me the 1.0 files via some way.
my email is miniupnp AT free DOT fr

@chadjoan
Copy link

I sent you an email. Thank you!

miniupnp added a commit to miniupnp/OpenDUNE that referenced this issue Nov 4, 2021
miniupnp added a commit to miniupnp/OpenDUNE that referenced this issue Nov 4, 2021
HERALD.CPS
MISC.CPS
AND.CPS
TITLE.CPS

see OpenDUNE#333
@miniupnp
Copy link
Contributor

miniupnp commented Nov 4, 2021

@chadjoan I introduced some compatibility with Dune v1.0 files.

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

No branches or pull requests

4 participants