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

Won't run on Linux #618

Closed LiamDawe closed 4 years ago

LiamDawe commented 4 years ago

Hi, just tried the latest release download but it seems the paths it looks in are messed up?

It seems to be looking two folders backwards. Example, I have it here:

/home/liam/Downloads/cdogs/bin/cdogs-sdl

But it looks for the data folders/files in:

/home/liam/Downloads/

Instead of:

/home/liam/Downloads/cdogs/

Is there anywhere in a config file where I can adjust where it's looking for them?

Edit: Okay, odd. I ran it in terminal, first doing cd into the "data" folder and then ran the executable and it works. Heh. Ideally though, the pathing needs sorting properly and an easy way to change it through a config file would be great!

cxong commented 4 years ago

How did you install the game? Via a repo or from the direct download? And did you run bin/cdogs-sdl directly, or via a shortcut, or from another path?

hemebond commented 4 years ago

I just cloned from repo and built it using make.sh. Running src/cdogs-sdl from the root of the repo clone fails:

~/Workspace/cdogs-sdl$ src/cdogs-sdl
C-Dogs SDL v0.7.0
20191101-094433 INFO  [MAIN ] [files.c:651] SetupConfigDir(): Creating config dir /home/james/.config/cdogs-sdl/... 
20191101-094433 INFO  [MAIN ] [files.c:656] SetupConfigDir(): Config dir already exists.
Error loading config '/home/james/.config/cdogs-sdl/options.cnf'
Error loading autosave '/home/james/.config/cdogs-sdl/autosave.json'
20191101-094433 INFO  [MAIN ] [cdogs.c:160] main(): Command line (1 args): src/cdogs-sdl
20191101-094433 INFO  [MAIN ] [cdogs.c:189] main(): data dir(/home/james/Workspace)
20191101-094433 INFO  [MAIN ] [cdogs.c:190] main(): config dir(/home/james/.config/cdogs-sdl/)
20191101-094433 ERROR [MAIN ] [sounds.c:256] SoundLoadMusic(): Cannot open music dir /home/james/Workspace/music/menu: No such file or directory
20191101-094433 ERROR [MAIN ] [sounds.c:256] SoundLoadMusic(): Cannot open music dir /home/james/Workspace/music/briefing: No such file or directory
20191101-094433 ERROR [MAIN ] [sounds.c:256] SoundLoadMusic(): Cannot open music dir /home/james/Workspace/music/game: No such file or directory
20191101-094433 ERROR [INPUT] [joystick.c:46] JoyInit(): cannot load controller mappings file: Invalid RWops
20191101-094433 ERROR [INPUT] [joystick.c:52] JoyInit(): cannot load button mappings file: Cannot open file
20191101-094433 INFO  [INPUT] [joystick.c:60] JoyInit(): 0 controllers found
20191101-094434 INFO  [GFX  ] [grafx.c:119] GraphicsInitialize(): graphics mode(320x240 2x)
Error reading JSON file '/home/james/Workspace/graphics/font.json'
20191101-094434 ERROR [MAIN ] [font_utils.c:40] FontLoadFromJSON(): Error parsing font JSON '/home/james/Workspace/graphics/font.json'
Error reading JSON file '/home/james/Workspace/graphics/font.json'
20191101-094434 ERROR [MAIN ] [font_utils.c:40] FontLoadFromJSON(): Error parsing font JSON '/home/james/Workspace/graphics/font.json'
20191101-094434 ERROR [MAIN ] [particle.c:69] ParticleClassesInit(): Error: cannot load particles file /home/james/Workspace/data/particles.json
20191101-094434 ERROR [MAIN ] [ammo.c:84] AmmoInitialize(): Error: cannot load ammo file /home/james/Workspace/data/ammo.json
20191101-094434 ERROR [MAP  ] [weapon_class.c:554] BulletAndWeaponInitialize(): Error: cannot load bullets file /home/james/Workspace/data/bullets.json
20191101-094434 ERROR [MAIN ] [character_class.c:233] CharacterClassesInitialize(): cannot load characters file /home/james/Workspace/data/character_classes.json
20191101-094434 ERROR [MAIN ] [player_template.c:106] PlayerTemplatesLoad(): loading player templates 'players.cnf'
20191101-094434 ERROR [MAIN ] [pickup_class.c:182] PickupClassesInit(): Error: cannot load pickups file /home/james/Workspace/data/pickups.json
20191101-094434 ERROR [MAIN ] [map_object.c:249] MapObjectsInit(): Error: cannot load map objects file /home/james/Workspace/data/map_objects.json
Error: cannot load /home/james/Workspace/doc/CREDITS
20191101-094434 INFO  [MAIN ] [campaigns.c:103] LoadAllCampaigns(): Load campaigns from dir /home/james/Workspace/missions...
Cannot load campaigns from path /home/james/Workspace/missions
20191101-094434 INFO  [MAIN ] [campaigns.c:111] LoadAllCampaigns(): Load dogfights from dir /home/james/Workspace/dogfights...
Cannot load campaigns from path /home/james/Workspace/dogfights
20191101-094434 INFO  [MAIN ] [campaigns.c:118] LoadAllCampaigns(): Load quick play...
20191101-094434 INFO  [MAIN ] [cdogs.c:267] main(): Starting game
Floating point exception

However running from the data directory works:

~/Workspace/cdogs-sdl/data$ ../src/cdogs-sdl
C-Dogs SDL v0.7.0
20191101-094518 INFO  [MAIN ] [files.c:651] SetupConfigDir(): Creating config dir /home/james/.config/cdogs-sdl/... 
20191101-094518 INFO  [MAIN ] [files.c:656] SetupConfigDir(): Config dir already exists.
Error loading config '/home/james/.config/cdogs-sdl/options.cnf'
Error loading autosave '/home/james/.config/cdogs-sdl/autosave.json'
20191101-094518 INFO  [MAIN ] [cdogs.c:160] main(): Command line (1 args): ../src/cdogs-sdl
20191101-094519 INFO  [MAIN ] [cdogs.c:189] main(): data dir(/home/james/Workspace/cdogs-sdl)
20191101-094519 INFO  [MAIN ] [cdogs.c:190] main(): config dir(/home/james/.config/cdogs-sdl/)
20191101-094519 INFO  [INPUT] [joystick.c:60] JoyInit(): 0 controllers found
20191101-094519 INFO  [GFX  ] [grafx.c:119] GraphicsInitialize(): graphics mode(320x240 2x)
20191101-094521 ERROR [MAIN ] [player_template.c:106] PlayerTemplatesLoad(): loading player templates 'players.cnf'
20191101-094521 INFO  [MAIN ] [campaigns.c:103] LoadAllCampaigns(): Load campaigns from dir /home/james/Workspace/cdogs-sdl/missions...
20191101-094521 INFO  [MAIN ] [campaigns.c:111] LoadAllCampaigns(): Load dogfights from dir /home/james/Workspace/cdogs-sdl/dogfights...
20191101-094521 INFO  [MAIN ] [campaigns.c:118] LoadAllCampaigns(): Load quick play...
20191101-094521 INFO  [MAIN ] [cdogs.c:267] main(): Starting game
20191101-094521 INFO  [MAIN ] [campaigns.c:217] CampaignSeedRandom(): Seeding with 0
20191101-094521 INFO  [MAIN ] [campaigns.c:217] CampaignSeedRandom(): Seeding with 0
cxong commented 4 years ago

I see, got it. You can also run it from the src/ folder because the data directory is relative by default - you can change it via the CDOGS_DATA_DIR cmake parameter. This shouldn't be a problem for distributions, as these are set to OS-appropriate values, or via the shortcuts created by installers.