mirror of
https://github.com/open-goal/jak-project
synced 2026-06-07 03:58:11 -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
322 lines
7.8 KiB
Common Lisp
322 lines
7.8 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
#|
|
|
This file has the game-specific implementation of the pckernel (see pckernel-h.gc and pckernel.gc).
|
|
|#
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; constants
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
;; version: 0.2.0.0
|
|
(defconstant PC_KERNEL_VERSION (static-pckernel-version 0 2 0 0))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; types and enums
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
;; cheats
|
|
(defenum pc-cheats
|
|
:bitfield #t
|
|
:type uint64
|
|
(turbo-board)
|
|
(health-bars)
|
|
(vehicle-health-bars)
|
|
(vehicle-invuln)
|
|
(statistics)
|
|
(suck-in-all)
|
|
(music-player)
|
|
(no-textures)
|
|
(fast-movies)
|
|
(slow-movies)
|
|
(fast-speed)
|
|
(slow-speed)
|
|
(fast-travel)
|
|
(orb-tracker)
|
|
(real-time-of-day)
|
|
(city-peace)
|
|
(board-tricks)
|
|
(weather-bad)
|
|
(weather-good)
|
|
(hijack-lines)
|
|
)
|
|
|
|
;; pc enum for languages. this is the game's languages + custom ones.
|
|
(defenum pc-language
|
|
:type uint16
|
|
(english 0)
|
|
(french 1)
|
|
(german 2)
|
|
(spanish 3)
|
|
(italian 4)
|
|
(japanese 5)
|
|
(korean 6)
|
|
(uk-english 7)
|
|
;; custom
|
|
(portuguese 8)
|
|
(finnish 9)
|
|
(swedish 10)
|
|
(danish 11)
|
|
(norwegian 12)
|
|
(dutch 13)
|
|
(br-portuguese 14)
|
|
(hungarian 15)
|
|
(catalan 16)
|
|
(icelandic 17)
|
|
(polish 18)
|
|
(lithuanian 19)
|
|
(czech 20)
|
|
(croatian 21)
|
|
(galician 22)
|
|
|
|
(custom 999) ;; temp
|
|
)
|
|
|
|
;; The Jak 2 version of the pc-settings object.
|
|
(deftype pc-settings-jak2 (pc-settings)
|
|
(;; cheats
|
|
(cheats pc-cheats)
|
|
(cheats-revealed pc-cheats)
|
|
(cheats-purchased pc-cheats)
|
|
(cheats-unlocked pc-cheats)
|
|
(cheats-mask pc-cheats)
|
|
;; music
|
|
(music-unlocked bit-array)
|
|
(flava-unlocked symbol 6)
|
|
|
|
;; misc
|
|
(fast-airlock? symbol)
|
|
(fast-elevator? symbol)
|
|
(fast-progress? symbol)
|
|
(minimap-force-north symbol)
|
|
|
|
(stats statistics)
|
|
|
|
;; gfx
|
|
(smooth-minimap? symbol)
|
|
(hires-clouds? symbol)
|
|
|
|
;; other
|
|
(controller-led-status? symbol)
|
|
(controller-swap-r1-r2? symbol)
|
|
(speedrunner-mode-custom-bind uint32)
|
|
(memcard-subtitles? symbol)
|
|
|
|
(text-language pc-language) ;; language for game text
|
|
(subtitle-language pc-language)
|
|
)
|
|
|
|
(:methods
|
|
(eligible-for-fast-elevator? (_type_ process) symbol)
|
|
(get-airlock-speed (_type_) float)
|
|
(get-airlock-close-speed (_type_) float)
|
|
)
|
|
)
|
|
|
|
(define *pc-settings* (the pc-settings-jak2 #f))
|
|
(define *matrix-minimap-north* (quaternion->matrix (new 'static 'matrix) (quaternion-vector-angle! (new 'static 'quaternion) *y-vector* (degrees 180))))
|
|
|
|
|
|
;; jak 2 discord rpc structure
|
|
(deftype discord-info (structure)
|
|
((orb-count float)
|
|
(gem-count float)
|
|
(death-count int32)
|
|
(status string)
|
|
(level string)
|
|
(cutscene? symbol)
|
|
(time-of-day float)
|
|
(percent-complete float)
|
|
(focus-status uint32)
|
|
(task string) ;; currenly active game-task used for mission specific images
|
|
)
|
|
)
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; resets
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
(defmethod reset-misc ((obj pc-settings-jak2) (call-handlers symbol))
|
|
"Set the default misc settings"
|
|
|
|
((method-of-type pc-settings reset-misc) obj call-handlers)
|
|
|
|
(true! (-> obj fast-airlock?))
|
|
(true! (-> obj fast-elevator?))
|
|
(false! (-> obj fast-progress?))
|
|
(true! (-> obj smooth-minimap?))
|
|
(false! (-> obj minimap-force-north))
|
|
(false! (-> obj hires-clouds?))
|
|
(set! (-> obj speedrunner-mode-custom-bind) 0)
|
|
|
|
(cond
|
|
((and (= *default-territory* GAME_TERRITORY_SCEE) (= (-> obj text-language) (pc-language english)))
|
|
(set! (-> obj text-language) (pc-language uk-english))
|
|
(set! (-> obj subtitle-language) (pc-language uk-english))
|
|
)
|
|
((= *default-territory* GAME_TERRITORY_SCEI)
|
|
(set! (-> obj text-language) (pc-language japanese))
|
|
(set! (-> obj subtitle-language) (pc-language japanese))
|
|
)
|
|
((= *default-territory* GAME_TERRITORY_SCEK)
|
|
(set! (-> obj text-language) (pc-language korean))
|
|
(set! (-> obj subtitle-language) (pc-language korean))
|
|
)
|
|
(else
|
|
))
|
|
|
|
(set! (-> obj memcard-volume-sfx) 0.5)
|
|
(set! (-> obj memcard-volume-music) 0.4)
|
|
(set! (-> obj memcard-volume-dialog) 0.75)
|
|
(set! (-> obj memcard-vibration?) #t)
|
|
(set! (-> obj memcard-subtitles?) #f)
|
|
(set! (-> obj hinttitles?) #t)
|
|
0)
|
|
|
|
(defmethod reset-extra ((obj pc-settings-jak2) (call-handlers symbol))
|
|
"Set the default goodies settings"
|
|
|
|
((method-of-type pc-settings reset-extra) obj call-handlers)
|
|
|
|
(set! (-> obj cheats) (pc-cheats))
|
|
(set! (-> obj cheats-revealed) (pc-cheats))
|
|
(set! (-> obj cheats-purchased) (pc-cheats))
|
|
(set! (-> obj cheats-unlocked) (pc-cheats))
|
|
|
|
(clear-all! (-> obj music-unlocked))
|
|
(dotimes (i 6)
|
|
(set! (-> obj flava-unlocked i) #f))
|
|
|
|
(set! (-> obj stats) *statistics*)
|
|
(initialize (-> obj stats kill-stats))
|
|
0)
|
|
|
|
(defmethod reset-input ((obj pc-settings-jak2) (device symbol) (call-handlers symbol))
|
|
"Set the default input settings"
|
|
|
|
((method-of-type pc-settings reset-input) obj device call-handlers)
|
|
|
|
(when (or (= device 'all) (= device 'controller))
|
|
(set! (-> obj controller-led-status?) #t)
|
|
(set! (-> obj controller-swap-r1-r2?) #f)
|
|
)
|
|
0)
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;;;; other
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(define *hires-sky* #t)
|
|
(define *debug-region-color-alt* #t)
|
|
(define *debug-region-show-bsphere* #f)
|
|
(define *debug-region-hide-water* #t)
|
|
(define *debug-region-hide-empty* #t)
|
|
(define *fallback-text-lookup?* #t)
|
|
|
|
|
|
(defun pc-settings-save ()
|
|
(commit-to-file *pc-settings*)
|
|
)
|
|
|
|
(defun get-video-params () *video-params*)
|
|
|
|
|
|
|
|
;; for debugging
|
|
(defenum pc-pat-skip-hack
|
|
:bitfield #t
|
|
(noentity 0)
|
|
(nocamera 1)
|
|
(noedge 2)
|
|
(nogrind 3)
|
|
(nojak 4)
|
|
(noboard 5)
|
|
(nopilot 6)
|
|
(nolineofsight 16)
|
|
(unknowncamera 17)
|
|
(probe 24)
|
|
(nomech 25)
|
|
(noproj 26)
|
|
(noendlessfall 27)
|
|
(noprobe 28)
|
|
)
|
|
|
|
|
|
|
|
;; cheat stuff
|
|
|
|
(defenum pc-cheat-state-flag
|
|
:bitfield #t
|
|
:type uint8
|
|
(turbo-board) ;; should turbo board be used
|
|
(clear-time-mod)
|
|
)
|
|
|
|
(deftype pc-cheat-state (structure)
|
|
((progress-speed float)
|
|
(airlock-speed float)
|
|
(airlock-close-speed float)
|
|
(turbo-board-speed float)
|
|
(hijack-speech-chance float)
|
|
(flags pc-cheat-state-flag)
|
|
|
|
(sewer-valve-start-time time-frame)
|
|
(sewer-valve-end-time time-frame)
|
|
(sewer-valve-target-seconds int8)
|
|
(sewer-valve-on int8)
|
|
|
|
(kill-civvie-target int16)
|
|
(kill-car-target int16)
|
|
)
|
|
)
|
|
|
|
(define *pc-cheat-state* (new 'static 'pc-cheat-state
|
|
:progress-speed 1.5
|
|
:airlock-speed 1.75
|
|
:airlock-close-speed 1.75
|
|
:turbo-board-speed 1.5
|
|
:hijack-speech-chance 0.45
|
|
|
|
:sewer-valve-target-seconds 75
|
|
|
|
:kill-civvie-target 40
|
|
:kill-car-target 20
|
|
))
|
|
|
|
(defmacro cheat-state-flag? (&rest flags)
|
|
"are the specified flags enabled?"
|
|
`(logtest? (-> *pc-cheat-state* flags) (pc-cheat-state-flag ,@flags)))
|
|
|
|
(defmacro set-cheat-state-flag! (&rest flags)
|
|
"set the specified flags"
|
|
`(logior! (-> *pc-cheat-state* flags) (pc-cheat-state-flag ,@flags)))
|
|
(defmacro clear-cheat-state-flag! (&rest flags)
|
|
"clear the specified flags"
|
|
`(logclear! (-> *pc-cheat-state* flags) (pc-cheat-state-flag ,@flags)))
|
|
|
|
|
|
(defmacro give-cheat! (&rest cheats)
|
|
`(begin
|
|
(logior! (-> *pc-settings* cheats) (pc-cheats ,@cheats))
|
|
)
|
|
)
|
|
|
|
(defmacro lock-cheat! (&rest cheats)
|
|
`(begin
|
|
(logclear! (-> *pc-settings* cheats) (pc-cheats ,@cheats))
|
|
(logclear! (-> *pc-settings* cheats-purchased) (pc-cheats ,@cheats))
|
|
(logclear! (-> *pc-settings* cheats-unlocked) (pc-cheats ,@cheats))
|
|
(logclear! (-> *pc-settings* cheats-revealed) (pc-cheats ,@cheats))
|
|
)
|
|
)
|
|
|
|
|