cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
887 stars 114 forks source link

Floating point exception on Raspberry Pi (ARM) #578

Closed jackwherry closed 5 years ago

jackwherry commented 5 years ago

Hardware: Raspberry Pi 2B OS: Raspbian (ARM build of Debian for Raspberry Pi devices)

I built this game successfully using the instructions provided in the wiki for Linux. All went well during the build process. However, when I attempted to run the game as per the instructions, a number of errors were printed to the console, finishing with a floating point exception.

Please tell me if I made a mistake building or running the game.

Console Messages:

C-Dogs SDL v0.6.9
INFO  [MAIN ] [files.c:639] SetupConfigDir(): Creating config dir /home/pi/.config/cdogs-sdl/... 
INFO  [MAIN ] [files.c:644] SetupConfigDir(): Config dir already exists.
Error loading config '/home/pi/.config/cdogs-sdl/options.cnf'
Error loading autosave '/home/pi/.config/cdogs-sdl/autosave.json'
INFO  [MAIN ] [cdogs.c:159] main(): Command line (1 args): src/cdogs-sdl
INFO  [MAIN ] [cdogs.c:188] main(): data dir(/home/pi)
INFO  [MAIN ] [cdogs.c:189] main(): config dir(/home/pi/.config/cdogs-sdl/)
ERROR [MAIN ] [gamedata.c:202] LoadSongList(): Cannot open music dir /home/pi/music/game: No such file or directory
ERROR [MAIN ] [gamedata.c:202] LoadSongList(): Cannot open music dir /home/pi/music/menu: No such file or directory
ERROR [INPUT] [joystick.c:47] JoyInit(): cannot load controller mappings file: Invalid RWops
ERROR [INPUT] [joystick.c:53] JoyInit(): cannot load button mappings file: Cannot open file
INFO  [INPUT] [joystick.c:60] JoyInit(): 0 controllers found
INFO  [GFX  ] [grafx.c:120] GraphicsInitialize(): graphics mode(320x240 2x)
Error reading JSON file '/home/pi/graphics/font.json'
ERROR [MAIN ] [font_utils.c:40] FontLoadFromJSON(): Error parsing font JSON '/home/pi/graphics/font.json'
ERROR [MAIN ] [particle.c:66] ParticleClassesInit(): Error: cannot load particles file /home/pi/data/particles.json
ERROR [MAIN ] [ammo.c:84] AmmoInitialize(): Error: cannot load ammo file /home/pi/data/ammo.json
ERROR [MAP  ] [weapon_class.c:535] BulletAndWeaponInitialize(): Error: cannot load bullets file /home/pi/data/bullets.json
ERROR [MAIN ] [character_class.c:130] CharacterClassesInitialize(): cannot load characters file /home/pi/data/character_classes.json
ERROR [MAIN ] [player_template.c:96] PlayerTemplatesLoad(): loading player templates 'players.cnf'
ERROR [MAIN ] [pickup_class.c:182] PickupClassesInit(): Error: cannot load pickups file /home/pi/data/pickups.json
ERROR [MAIN ] [map_object.c:234] MapObjectsInit(): Error: cannot load map objects file /home/pi/data/map_objects.json
Error: cannot load /home/pi/doc/CREDITS
INFO  [MAIN ] [campaigns.c:103] LoadAllCampaigns(): Load campaigns from dir /home/pi/missions...
Cannot load campaigns from path /home/pi/missions
INFO  [MAIN ] [campaigns.c:111] LoadAllCampaigns(): Load dogfights from dir /home/pi/dogfights...
Cannot load campaigns from path /home/pi/dogfights
INFO  [MAIN ] [campaigns.c:118] LoadAllCampaigns(): Load quick play...
INFO  [MAIN ] [cdogs.c:271] main(): Starting game
Floating point exception
cxong commented 5 years ago

are you able to debug the problem - either grab a core dump, or attempt to step through line by line and find the line of code that causes the exception? You can also turn up the logging level with --log=DEBUG which may help.

jackwherry commented 5 years ago

Thank you for the quick response. I’ll follow your suggestion to use the debug log option and will put it in GDB to see if I can find anything tomorrow when I have some more time.

cxong commented 5 years ago

oh I just looked at the log closer. It seems the game is having trouble loading its game data. Are they supposed to be in /home/pi? Perhaps you need to provide a suitable CDOGS_DATA_DIR when configuring the project with cmake.

jackwherry commented 5 years ago

Your most recent suggestion turned out to be correct! I was expecting the game to look in its parent directory (the repository) for data, but it looked in the home directory instead. When I moved all the data files to the home directory for a quick test, it worked perfectly (aside from being a little slow). Thanks again for your help!