Opened 4 years ago

Closed 4 years ago

#11319 closed defect (fixed)

[GNU/Linux aarch64] ["toon" engine] Toonstruck crashes on "Start new game"

Reported by: vanfanel Owned by: antoniou79
Priority: normal Component: Engine: Toon
Version: Keywords: segmentation fault, new game
Cc: antoniou79 Game: Toonstruck

Description

Hi there,

I usually build an aarch64 version of Scummvm (not so exotic, since ARM is going aarch64 anyway).
Thing is, Toonstruck works well on x86_64 but not on aarch64, where it crashes when I click on the "Start a New game" option of the menu.
This is what gdb has to say:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./scummvm...done.
(gdb) r
Starting program: /home/pi/scummvm/scummvm 

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fbdcd51c0 (LWP 5531)]
[New Thread 0x7fbd4d41c0 (LWP 5532)]
[New Thread 0x7fbccd31c0 (LWP 5533)]
WARNING: Could not find theme 'scummremastered' falling back to builtin!
User picked target 'toon' (gameid 'toon')...
  Looking for a plugin supporting this gameid... Toonstruck
  Starting 'Toonstruck'

Thread 1 "scummvm" received signal SIGSEGV, Segmentation fault.
__memcpy_generic () at ../sysdeps/aarch64/multiarch/../memcpy.S:170
170	../sysdeps/aarch64/multiarch/../memcpy.S: No such file or directory.
(gdb) 
(gdb) bt
#0  __memcpy_generic () at ../sysdeps/aarch64/multiarch/../memcpy.S:170
#1  0x0000007fbdef88b8 in Toon::ToonEngine::setPaletteEntries (this=0x5555cf4590, palette=0x0, offset=1, num=128)
    at engines/toon/toon.cpp:1387
#2  0x0000007fbdee0264 in Toon::Picture::setupPalette (this=0x5556983d00) at engines/toon/picture.cpp:155
#3  0x0000007fbdef9544 in Toon::ToonEngine::loadScene (this=0x5555cf4590, SceneId=4, forGameLoad=false)
    at engines/toon/toon.cpp:1538
#4  0x0000007fbdf00958 in Toon::ToonEngine::newGame (this=0x5555cf4590) at engines/toon/toon.cpp:3198
#5  0x0000007fbdef7580 in Toon::ToonEngine::run (this=0x5555cf4590) at engines/toon/toon.cpp:1143
#6  0x00000055556be9e0 in runGame (plugin=0x5555b312f0, system=..., edebuglevels=...) at base/main.cpp:280
#7  0x00000055556bf768 in scummvm_main (argc=1, argv=0x7ffffff5c8) at base/main.cpp:562
#8  0x00000055556bc960 in main (argc=1, argv=0x7ffffff5c8) at backends/platform/sdl/posix/posix-main.cpp:45

So, it seems that

Toon::ToonEngine::setPaletteEntries

is receiving a palette pointing to 0x0, and this is a problem on aarch64 but not in x86_64, for some reason.
My guess is that game logic should not pass a 0x0 pointer to this function, but I am just guessing here.

Change History (2)

comment:1 by antoniou79, 4 years ago

Cc: antoniou79 added
Keywords: segmentation fault new game added

This would happen only if a required data file is not found or is corrupted or failed to be loaded properly in the game's resources. The pertinent data file in this case is a .CPS file that resides in the ACT1\PAL1LAN\PAL1LAN.PAK file for the scene (id: 4).

I've pushed a commit to at least prevent the specific segmentation fault, as well as warn about a missing PAK file (and exit if that PAK file is a required scene file):
https://github.com/scummvm/scummvm/commit/573c10f0c8848570d9f6ef3d9c29304c9e70266a

Please provide feedback if this fixed the situation for you.

comment:2 by antoniou79, 4 years ago

Owner: set to antoniou79
Resolution: fixed
Status: newclosed

Closing this as resolved, since the ticket creator wrote in the forum that the issue is now fixed for them.

Quote:

Thanks everyone who answered here. The game is now working nicely on the Pi3b+ in 64bit mode after updating libraries and gcc compiler, and re-building latest stable version of scummvm! Thanks for your ideas

https://forums.scummvm.org/viewtopic.php?p=88612#p88612

Note: See TracTickets for help on using tickets.