drfiemost / Hurrican

A fork of Hurrican, freeware jump and shoot game created by Poke53280, with SDL2 enabled by default, support for libopenmpt and CRT simulation
MIT License
7 stars 2 forks source link

Issues with gamepad control (and one unrelated) #6

Closed s1eve-mcdichae1 closed 2 years ago

s1eve-mcdichae1 commented 2 years ago

I have compiled this on Raspberry Pi 4 Model B 2GB RAM, running RetroPie 4.7.19 (updated from their 4.7.1 image built on Raspberry Pi OS Lite, and dist-upgraded recently), with:

sudo apt -y install libsdl2-image-dev libsdl2-mixer-dev libepoxy-dev cmake git
cd
git clone --recursive https://github.com/drfiemost/Hurrican.git
cd Hurrican/Hurrican
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

I then run it with:

./hurrican --pathdata ..

It seems to run well with keyboard controls, but some issues arise when I set Player one to use gamepad control ("0:Logitech Gamepad F710"):

1: there is no "pause" or "menu" button mapped to the gamepad. Once I begin a game, I cannot exit without pressing [Esc] on the keyboard (well, I guess I can also wait till I lose all my lives and return to the menu that way.) This is less than ideal, as ultimately I would like to get this set up as a gaming console with only the gamepad for user inputs, and not even have* a keyboard attached.

2: the instructions in the tutorial level, that (presumably) should read:

"You can move left and right by pressing 'Joypad left' or 'Joypad right'. You can crouch by pressing 'Joypad down'."

...instead render as:

"You can move left and right by pressing 'Joypad left' or 'Joypad leftJoypad right'. You can crouch by pressing 'Joypad leftJoypad rightJoypad down'."

This extends to all the action buttons as well, for example "Press 'button 2' to fire" becomes "Press 'Joypad leftJoypad rightJoypad downJoypad upJoypad downbutton 1button 2' to fire." Note: "down-up-down," presumably because in the control setup they're listed "...crouch (down), look up (up), look down (down again), ...".

Issue not present with keyboard control, keys such as "Right", "Down", "Left Alt" render correctly.

3: the tutorial level crashes with a Segmentation fault, in the same place every time (just after the destructible wall where the smartbomb is demonstrated.) Issue not present with keyboard control, I can complete the tutorial level that way.

4: (not gamepad related) additionally, the -PS <path> / --pathsave <path> parameter does not seem to be working. No matter where I set it to, it says it can't be found, and then uses /home/pi/.config/hurrican and /home/pi/.local/share/hurrican regardless:

pi@retropie:~/Hurrican/Hurrican/build $ ./hurrican --pathdata .. --pathsave /home/pi/temp
Data path set to ..
ERROR: could not find save path /home/pi/temp
--> Using external config path '/home/pi/.config/hurrican' <--
--> Using external storage path '..' <--
--> Using save path '/home/pi/.local/share/hurrican' <--

Even if I set it to one of those (they do exist, and they're owned pi:pi), it says:

pi@retropie:~/Hurrican/Hurrican/build $ ./hurrican --pathdata .. --pathsave /home/pi/.config/hurrican
Data path set to ..
ERROR: could not find save path /home/pi/.config/hurrican
--> Using external config path '/home/pi/.config/hurrican' <--
--> Using external storage path '..' <--
--> Using save path '/home/pi/.local/share/hurrican' <--

I can get around this by symlinking those dirs to my preferred location, (and launch with a pushd to that location for the Game_Log.txt saved to cwd), but I thought it worth mentioning.

drfiemost commented 2 years ago

It would be better to have a separate issue for each problem, also a backtrace of the segmentation fault would help.

As for the save path problem it can be fixed by replacing fs::create_directory in Main.cpp:249 with fs::is_directory, as it is done for the data path.

s1eve-mcdichae1 commented 2 years ago

It would be better to have a separate issue for each problem,

sure, should I resubmit these separately or do you just mean for in the future?

also a backtrace of the segmentation fault would help.

I'll work on that. I've heard of it but never done one before. Presumably it will output a log file, which I will then share with you?

As for the save path problem it can be fixed by replacing fs::create_directory in Main.cpp:249 with fs::is_directory, as it is done for the data path.

Great, I'll check it out, thanks!

drfiemost commented 2 years ago

sure, should I resubmit these separately or do you just mean for in the future?

Please do it now, it makes it easier to keep track of the progress.

I'll work on that. I've heard of it but never done one before. Presumably it will output a log file, which I will then share with you?

You should recompile with debug symbols, passing -DCMAKE_BUILD_TYPE=Debug, and then run gdb, i.e.

gdb --args ./hurrican --pathdata ..

it will print a stack trace on the console when the program crashes. It will run quite slower, hope the Raspberry can handle the task.

s1eve-mcdichae1 commented 2 years ago

Understood. Closing this one, will resubmit separate once I get the backtrace.

s1eve-mcdichae1 commented 2 years ago

gdb --args ./hurrican --pathdata ..

Just that? When I type that (after deleting & recreating build/ and compiling the Debug version) the game does not start, and I only get:

pi@retropie:~/Hurrican/Hurrican/build $ gdb --args ./hurrican --pathdata ..
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./hurrican...done.
(gdb)

...did I do something wrong?