mirror of
https://github.com/open-goal/jak-project
synced 2026-06-04 02:47:17 -04:00
1f6438e517
This PR updates to SDL3, and with it, adds a handful of new features. Everything seems to work but I'm going to look over the code once last time before merging, some of the API changes are hard to spot. Fixes #2773 ### Pressure sensitivity support for DS3 Controllers SDL3 adds pressure sensitivity support for DS3 controllers on windows. I have not tested on linux. The option is disabled by default. On windows you will need https://docs.nefarius.at/projects/DsHidMini/ and to be using SXS mode. ### DualSense and Xbox One Trigger Effects If enabled, Jak 2 will have certain trigger effects. They are: - xbox1: - small vibrate when collecting dark eco - big vibrate when changing to dark jak - vibrate when shooting gun, proportional to gun type - ps5: - resistance when changing to dark jak - different gun shooting effects - red (resistance) - yellow (weapon trigger) - blue (vibrates) - purple (less resistance) > **Gun Shooting effects are only enabled if the new "Swap R1 and R2" option is enabled** There are more effects that could be used in `dualsense_effects.cpp`, but I only exposed the ones I needed to OpenGOAL. If a modder wants to use some of the others and wires them up end-to-end, please consider contributing that upstream. ### New ImGUI Menu Added new imgui options for selecting the active controller, for those people that struggle to select the initial controller.  ### Testing The highlights of what I tested successfully: - display - [x] all mode switch permutations - [x] launch with all modes saved - [x] switch monitors / unplug monitor that was active, how does it handle it - [x] load with alternate monitor saved and all modes - [x] allowing hidpi doesnt break macos - controls - [x] keyboard and mouse still work - [x] pressure sensitivity on linux
76 lines
2.7 KiB
Python
Vendored
Generated
76 lines
2.7 KiB
Python
Vendored
Generated
#!/usr/bin/env python3
|
|
#
|
|
# This script renames SDL headers in the specified paths
|
|
|
|
import argparse
|
|
import pathlib
|
|
import re
|
|
|
|
|
|
def do_include_replacements(paths):
|
|
replacements = [
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_image.h(?:[\">])"), r"<SDL3_image/SDL_image.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_mixer.h(?:[\">])"), r"<SDL3_mixer/SDL_mixer.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_net.h(?:[\">])"), r"<SDL3_net/SDL_net.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_rtf.h(?:[\">])"), r"<SDL3_rtf/SDL_rtf.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_ttf.h(?:[\">])"), r"<SDL3_ttf/SDL_ttf.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_gamecontroller.h(?:[\">])"), r"<SDL3/SDL_gamepad.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?begin_code.h(?:[\">])"), r"<SDL3/SDL_begin_code.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?close_code.h(?:[\">])"), r"<SDL3/SDL_close_code.h>" ),
|
|
( re.compile(r"(?:[\"<])(?:SDL2/)?(SDL[_a-z0-9]*\.h)(?:[\">])"), r"<SDL3/\1>" )
|
|
]
|
|
for entry in paths:
|
|
path = pathlib.Path(entry)
|
|
if not path.exists():
|
|
print("{} does not exist, skipping".format(entry))
|
|
continue
|
|
|
|
replace_headers_in_path(path, replacements)
|
|
|
|
|
|
def replace_headers_in_file(file, replacements):
|
|
try:
|
|
with file.open("r", encoding="UTF-8", newline="") as rfp:
|
|
original = rfp.read()
|
|
contents = original
|
|
for regex, replacement in replacements:
|
|
contents = regex.sub(replacement, contents)
|
|
if contents != original:
|
|
with file.open("w", encoding="UTF-8", newline="") as wfp:
|
|
wfp.write(contents)
|
|
except UnicodeDecodeError:
|
|
print("%s is not text, skipping" % file)
|
|
except Exception as err:
|
|
print("%s" % err)
|
|
|
|
|
|
def replace_headers_in_dir(path, replacements):
|
|
for entry in path.glob("*"):
|
|
if entry.is_dir():
|
|
replace_headers_in_dir(entry, replacements)
|
|
else:
|
|
print("Processing %s" % entry)
|
|
replace_headers_in_file(entry, replacements)
|
|
|
|
|
|
def replace_headers_in_path(path, replacements):
|
|
if path.is_dir():
|
|
replace_headers_in_dir(path, replacements)
|
|
else:
|
|
replace_headers_in_file(path, replacements)
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(fromfile_prefix_chars='@', description="Rename #include's for SDL3.")
|
|
parser.add_argument("args", metavar="PATH", nargs="*", help="Input source file")
|
|
args = parser.parse_args()
|
|
|
|
try:
|
|
do_include_replacements(args.args)
|
|
except Exception as e:
|
|
print(e)
|
|
return 1
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|