Files
Tyler Wilding 1f6438e517 deps: update to SDL3 (#3852)
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.


![image](https://github.com/user-attachments/assets/48ff2985-d9ef-417a-b1f2-a25c74595935)

### 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
2025-03-02 16:36:22 -05:00

80 lines
2.9 KiB
Lua
Vendored
Generated

-- This code adapted from https://gitlab.com/saalen/highlight/-/wikis/Plug-Ins
-- first add a description of what the plug-in does
Description="Add wiki.libsdl.org reference links to HTML, LaTeX or RTF output"
-- define the plugin categories (ie. supported output formats; languages)
Categories = { "c", "c++" }
-- the syntaxUpdate function contains code related to syntax recognition
function syntaxUpdate(desc)
-- if the current file is not C/C++ file we exit
if desc~="C and C++" then
return
end
-- this function returns a qt-project reference link of the given token
function getURL(token)
-- generate the URL
url='https://wiki.libsdl.org/SDL3/'.. token
-- embed the URL in a hyperlink according to the output format
-- first HTML, then LaTeX and RTF
if (HL_OUTPUT== HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
return '<a class="hl" target="new" href="'
.. url .. '">'.. token .. '</a>'
elseif (HL_OUTPUT == HL_FORMAT_LATEX) then
return '\\href{'..url..'}{'..token..'}'
elseif (HL_OUTPUT == HL_FORMAT_RTF) then
return '{{\\field{\\*\\fldinst HYPERLINK "'
..url..'" }{\\fldrslt\\ul\\ulc0 '..token..'}}}'
end
end
-- the Decorate function will be invoked for every recognized token
function Decorate(token, state)
-- we are only interested in keywords, preprocessor or default items
if (state ~= HL_STANDARD and state ~= HL_KEYWORD and
state ~=HL_PREPROC) then
return
end
-- SDL keywords start with SDL_
-- if this pattern applies to the token, we return the URL
-- if we return nothing, the token is outputted as is
if ( (token == "Uint8") or (token == "Uint16") or (token == "Uint32") or (token == "Uint64") or
(token == "Sint8") or (token == "Sint16") or (token == "Sint32") or (token == "Sint64") or
(string.find(token, "SDL_") == 1) ) then
return getURL(token)
end
end
end
-- the themeUpdate function contains code related to the theme
function themeUpdate(desc)
-- the Injections table can be used to add style information to the theme
-- HTML: we add additional CSS style information to beautify hyperlinks,
-- they should have the same color as their surrounding tags
if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
Injections[#Injections+1]=
"a.hl, a.hl:visited {color:inherit;font-weight:inherit;text-decoration:none}"
-- LaTeX: hyperlinks require the hyperref package, so we add this here
-- the colorlinks and pdfborderstyle options remove ugly boxes in the output
elseif (HL_OUTPUT==HL_FORMAT_LATEX) then
Injections[#Injections+1]=
"\\usepackage[colorlinks=false, pdfborderstyle={/S/U/W 1}]{hyperref}"
end
end
-- let highlight load the chunks
Plugins={
{ Type="lang", Chunk=syntaxUpdate },
{ Type="theme", Chunk=themeUpdate },
}