mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
game: add SDL controller database (#1328)
* game: add SDL controller database * lint: formatting
This commit is contained in:
parent
5369932fcd
commit
0d4b5f8df4
26
.github/workflows/update-controller-db.yaml
vendored
Normal file
26
.github/workflows/update-controller-db.yaml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
name: Update Controller Database
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 16 * * 1" # every monday @ 12pm EST - https://crontab.guru/#0_16_*_*_1
|
||||
|
||||
jobs:
|
||||
update-controller-db:
|
||||
if: github.repository == 'open-goal/jak-project'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.BOT_PAT }}
|
||||
|
||||
- name: Get Latest DB
|
||||
run: |
|
||||
wget -O ./game/assets/sdl_controller_db.txt https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
|
||||
|
||||
- name: commit version bump
|
||||
uses: EndBug/add-and-commit@v8
|
||||
with:
|
||||
default_author: github_actor
|
||||
author_name: "OpenGOALBot"
|
||||
author_email: "OpenGOALBot@users.noreply.github.com"
|
||||
message: "Updating Controller Database"
|
|
@ -6,18 +6,21 @@ includes:
|
|||
tasks:
|
||||
# GENERAL
|
||||
extract-jak1:
|
||||
desc: "Extracts Jak 1 - NTSC - Black Label assets"
|
||||
preconditions:
|
||||
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/decompiler{{.EXE_FILE_EXTENSION}}
|
||||
msg: "Couldn't locate decompiler executable -- Have you compiled in release mode?"
|
||||
cmds:
|
||||
- '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/jak1_ntsc_black_label.jsonc" "./iso_data" "./decompiler_out" "decompile_code=false"'
|
||||
boot-game:
|
||||
desc: "Boots the game"
|
||||
preconditions:
|
||||
- sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
|
||||
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
|
||||
cmds:
|
||||
- "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -debug -v"
|
||||
run-game:
|
||||
desc: "Start the game's runtime"
|
||||
preconditions:
|
||||
- sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
|
||||
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
|
||||
|
@ -30,6 +33,7 @@ tasks:
|
|||
cmds:
|
||||
- "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso"
|
||||
repl:
|
||||
desc: "Start the REPL"
|
||||
env:
|
||||
OPENGOAL_DECOMP_DIR: "jak1/"
|
||||
preconditions:
|
||||
|
@ -39,6 +43,7 @@ tasks:
|
|||
- "{{.GOALC_BIN_RELEASE_DIR}}/goalc"
|
||||
# DEVELOPMENT
|
||||
format:
|
||||
desc: "Format code"
|
||||
cmds:
|
||||
- cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test -i
|
||||
# npm install -g prettier
|
||||
|
|
|
@ -5472,9 +5472,7 @@
|
|||
[168, "v1", "art-joint-anim"]
|
||||
],
|
||||
|
||||
"(code target-attack-uppercut)": [
|
||||
[39, "v1", "float"]
|
||||
],
|
||||
"(code target-attack-uppercut)": [[39, "v1", "float"]],
|
||||
|
||||
"mod-var-jump": [
|
||||
[77, "f0", "float"],
|
||||
|
|
1635
game/assets/sdl_controller_db.txt
Normal file
1635
game/assets/sdl_controller_db.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -8,6 +8,7 @@
|
|||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
#include "game/graphics/pipelines/opengl.h" // for GLFW macros
|
||||
#include <common/util/FileUtil.h>
|
||||
|
||||
namespace Pad {
|
||||
|
||||
|
@ -282,6 +283,9 @@ void check_gamepads() {
|
|||
}
|
||||
|
||||
void initialize() {
|
||||
std::string mapping_path =
|
||||
(file_util::get_jak_project_dir() / "game" / "assets" / "sdl_controller_db.txt").string();
|
||||
glfwUpdateGamepadMappings(file_util::read_text_file(mapping_path).c_str());
|
||||
check_gamepads();
|
||||
if (g_gamepads.gamepad_idx[0] == -1) {
|
||||
lg::info("No joysticks found.");
|
||||
|
|
Loading…
Reference in a new issue