Files
jak-project/goal_src/jak1/pc/pckernel-impl.gc
T
Tyler Wilding d1a6c60eb8 game: disable keyboard input by default, give users a way to enable it via the imgui menu (#3295)
It was narrowed down recently that a lot of people have issues with the
controller input because of Steam Input working as intended. Steam Input
can be configured to replicate controller inputs as keyboard inputs (for
example, pressing X on your controller presses Enter on the keyboard).

This results in the problem of "jumping pauses the game" and similar
issues. This is a consequence of the intended behaviour of the game
listening to all input sources at the same time.

Since the vast majority of players are using controllers over keyboards,
it makes sense to disable the keyboard input by default to solve this
problem. However that makes things awkward for users that want to use
the keyboard (how do they enable the setting). The solution is a new
imgui option in the settings menu:
![Screenshot 2024-01-07
141224](https://github.com/open-goal/jak-project/assets/13153231/6f9ffa2d-be7a-433d-b698-15b70210e97e)

**Known issue that I don't care about** -- in Jak 1's menu code, since
the flags are controlled by pointers to values instead of a lambda like
in jak 2, the menu won't update live with the imgui option. This has no
functional impact and I don't care enough to fix it.

I also made the pc-settings.gc file persist on first load if the file
wasn't found. Hopefully this helps diagnose the support issues related
to the black screen.

# Why not just ignore the keyboard inputs for a period of time?

This won't work, the keyboard is polled every frame. Therefore if you
hold down the X button on your controller, steam is continuously
signaling that `Enter` is held down on the keyboard.

Yes it would be possible to completely disable the keyboard while the
controller is being used, but this defeats the purpose of creating an
input system that allows multiple input sources at the same time.

With an explicit option, not only can the user decide the behaviour they
want (do they want the keyboard ignored or simultaneously listened to)
but we avoid breaking strange edge-cases in usage leading to never
ending complexity:
- ie. imagine steam input sends events to the mouse, well you can't
disable the mouse while using the keyboard because most times people are
using mouse and keyboard
- ie. a user that wants to hold a direction with the keyboard and press
buttons on the controller in tandem (something i frequently do while
TAS'ing, to move in a perfect straight line)
2024-02-23 18:19:07 -05:00

226 lines
5.6 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: 1.10.4.0
(defconstant PC_KERNEL_VERSION (static-pckernel-version 1 10 4 0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; types and enums
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; cheats
(defconstant PC_CHEAT_MAX 18) ;; number of cheats
(defenum pc-cheats
:bitfield #t
:type uint64
(eco-green)
(eco-red)
(eco-blue)
(eco-yellow)
(invinc)
(sidekick-blue)
(tunes)
(sky)
(mirror)
(big-head)
(small-head)
(big-fist)
(no-tex)
(hard-rats)
(hero-mode)
(huge-head)
(big-head-npc)
(oh-my-goodness)
)
;; 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)
(uk-english 6)
;; custom
(portuguese 7)
(finnish 8)
(swedish 9)
(danish 10)
(norwegian 11)
(dutch 12)
(br-portuguese 13)
(hungarian 14)
(catalan 15)
(icelandic 16)
(korean 17)
(russian 18)
(polish 19)
(lithuanian 20)
(custom 999) ;; temp
)
;; concept arts
(defenum pc-jak1-concept-art
:bitfield #t
:type uint64
(test)
)
;; secrets and goodies
(deftype pc-game-secrets (structure)
((art pc-jak1-concept-art) ;; concept art unlocked
(music pc-music-log-entry PC_MUSIC_LOG_LENGTH :inline)
(hard-fish-hiscore int32)
(hard-rats? symbol) ;; enable this crap
(hard-rats-hiscore int32)
(hard-rats-hiwave int32)
(hero-mode? symbol) ;; unsure how this should work
(hud-map? symbol) ;; enable map in HUD/progress?
(hud-counters? symbol) ;; enable level orb counter/global buzzer counter?
(hud-watch? symbol) ;; a watch that tells the time of day!
(watch-12hr? symbol) ;; 12-hour clock toggle
)
:pack-me
)
;; The Jak 1 version of the pc-settings object.
(deftype pc-settings-jak1 (pc-settings)
(
(cheats pc-cheats)
(cheats-known pc-cheats)
(skip-movies? symbol) ;; if on, enable cutscene skipping
(subtitles? symbol) ;; if on, cutscene subtitles will show up
(text-language pc-language) ;; language for game text
(subtitle-language pc-language) ;; language for subtitles
(money-starburst? symbol) ;; add a starburst to the money
(extra-hud? symbol) ;; extra hud elements.
(secrets pc-game-secrets :inline) ;; hidden goodies and additional secrets!
(scenes-seen uint8 PC_SPOOL_LOG_LENGTH) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?)
)
)
(define *pc-settings* (the pc-settings-jak1 #f))
;; jak 1 discord rpc structure
(deftype discord-info (structure)
((fuel (pointer float))
(money-total (pointer float))
(buzzer-total (pointer float))
(deaths (pointer int32))
(status string)
(level string)
(cutscene? symbol)
(ogreboss? symbol)
(plant-boss? symbol)
(racer? symbol)
(flutflut? symbol)
(time-of-day (pointer float))
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; debug settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define *fallback-text-lookup?* #t)
(define *display-bug-report* #f)
(define *mood-override-debug* #f)
(define *mood-override-table* (new 'global 'inline-array 'float 8))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; resets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod reset-misc pc-settings-jak1 ((obj pc-settings-jak1) (call-handlers symbol))
"Set the default misc settings"
((method-of-type pc-settings reset-misc) obj call-handlers)
(set! (-> obj text-language) (the pc-language (scf-get-language)))
(set! (-> obj subtitle-language) (the pc-language (scf-get-language)))
(set! (-> obj skip-movies?) #t)
(set! (-> obj subtitles?) *debug-segment*)
(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))
)
(else
))
(set! (-> obj money-starburst?) #f)
(set! (-> obj extra-hud?) #f)
0)
(defmethod reset-extra pc-settings-jak1 ((obj pc-settings-jak1) (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-known) (pc-cheats))
(dotimes (i PC_SPOOL_LOG_LENGTH)
(set! (-> obj scenes-seen i) 0)
)
(dotimes (i PC_MUSIC_LOG_LENGTH)
(set! (-> obj secrets music i name) #f)
(set! (-> obj secrets music i flava-mask) 0)
)
(set! (-> obj secrets art) (pc-jak1-concept-art))
(set! (-> obj secrets hard-fish-hiscore) 0)
(set! (-> obj secrets hard-rats-hiscore) 0)
(set! (-> obj secrets hard-rats-hiwave) 0)
(set! (-> obj secrets hard-rats?) #f)
(set! (-> obj secrets hero-mode?) #f)
(set! (-> obj secrets hud-map?) #t)
(set! (-> obj secrets hud-counters?) #t)
(set! (-> obj secrets hud-watch?) #f)
(set! (-> obj secrets watch-12hr?) #f)
0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; other
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun get-video-params () *video-parms*)
;; for debugging
(defenum pc-pat-skip-hack
:bitfield #t
(noentity 0)
(nocamera 1)
(noedge 2)
(nolineofsight 12)
(unknowncamera 13)
)