Skip to content

Commit af6de53

Browse files
authored
jak1/jak2: Persist sound settings, play-hints, subtitles and vibration settings in pc-settings instead of the memory card file (#3612)
In the original game, they had no choice but to use the memory card file as their method of persisting settings. We are not limited by such things. It's inconvenient to have to load your save-file when launching the game to initialize these settings to your liking, it's also confusing behaviour to even some players that have played the game heavily for over a decade. We can do better by globally saving these settings to the `pc-settings` file instead. Originally I only migrated the volume settings, then i figured it would be nice to also have play-hints and subtitles settings persisted. More could debatably be moved (language is a big one...) but these were the low hanging fruit. I also reduced the default volumes as that is something else that has come up a few times.
1 parent c72a086 commit af6de53

File tree

11 files changed

+193
-80
lines changed

11 files changed

+193
-80
lines changed

goal_src/jak1/engine/game/game-save.gc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,14 +594,16 @@
594594
;; loop over all tags
595595
(while (< (the-as int save-data) (the-as int (+ (+ (-> save length) 76) (the-as int save))))
596596
(let ((a0-1 (-> save-data elt-type)))
597+
;; og:preserve-this Moved these settings to pc-settings
597598
(cond
598-
((= a0-1 (game-save-elt sfx-volume)) (set! (-> *setting-control* default sfx-volume) (-> save-data user-float0)))
599-
((= a0-1 (game-save-elt music-volume)) (set! (-> *setting-control* default music-volume) (-> save-data user-float0)))
600-
((= a0-1 (game-save-elt dialog-volume)) (set! (-> *setting-control* default dialog-volume) (-> save-data user-float0)))
599+
;; ((= a0-1 (game-save-elt sfx-volume)) (set! (-> *setting-control* default sfx-volume) (-> save-data user-float0)))
600+
;; ((= a0-1 (game-save-elt music-volume)) (set! (-> *setting-control* default music-volume) (-> save-data user-float0)))
601+
;; ((= a0-1 (game-save-elt dialog-volume)) (set! (-> *setting-control* default dialog-volume) (-> save-data user-float0)))
601602
((= a0-1 (game-save-elt language))
602603
(set! (-> *setting-control* default language) (the-as language-enum (-> save-data user-uint64))))
603-
((= a0-1 (game-save-elt vibration)) (set! (-> *setting-control* default vibration) (= (-> save-data user-uint64) 1)))
604-
((= a0-1 (game-save-elt play-hints)) (set! (-> *setting-control* default play-hints) (= (-> save-data user-uint64) 1)))))
604+
;; ((= a0-1 (game-save-elt vibration)) (set! (-> *setting-control* default vibration) (= (-> save-data user-uint64) 1)))
605+
;; ((= a0-1 (game-save-elt play-hints)) (set! (-> *setting-control* default play-hints) (= (-> save-data user-uint64) 1)))
606+
(else (format 0 "PC PORT: Skipping setting from game save, its stored in the pc-settings now"))))
605607
(set! save-data
606608
(the-as game-save-tag
607609
(&+ (the-as pointer save-data) (logand -16 (+ (* (the-as int (-> save-data elt-size)) (-> save-data elt-count)) 31)))))))

goal_src/jak1/pc/pckernel-common.gc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@
539539
(("controller-led-brightness") (set! (-> obj controller-led-brightness) (file-stream-read-float file)))
540540
(("controller-led-min-brightness") (set! (-> obj controller-led-min-brightness) (file-stream-read-float file)))
541541
(("controller-led-max-brightness") (set! (-> obj controller-led-max-brightness) (file-stream-read-float file)))
542+
(("memcard-volume-sfx") (set! (-> obj memcard-volume-sfx) (file-stream-read-float file)))
543+
(("memcard-volume-music") (set! (-> obj memcard-volume-music) (file-stream-read-float file)))
544+
(("memcard-volume-dialog") (set! (-> obj memcard-volume-dialog) (file-stream-read-float file)))
545+
(("memcard-vibration?") (set! (-> obj memcard-vibration?) (file-stream-read-symbol file)))
542546
;; debug
543547
(("debug-font-scale") (set! (-> obj debug-font-scale) (file-stream-read-float file)))
544548
(("debug-font-scale-auto?") (set! (-> obj debug-font-scale-auto?) (file-stream-read-symbol file)))
@@ -611,6 +615,10 @@
611615
(format file " (game-language ~D)~%" (get-game-language obj))
612616
(format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?))
613617
(format file " (territory ~D)~%" (-> obj territory))
618+
(format file " (memcard-volume-sfx ~f)~%" (-> obj memcard-volume-sfx))
619+
(format file " (memcard-volume-music ~f)~%" (-> obj memcard-volume-music))
620+
(format file " (memcard-volume-dialog ~f)~%" (-> obj memcard-volume-dialog))
621+
(format file " (memcard-vibration? ~A)~%" (-> obj memcard-vibration?))
614622
0)
615623

616624
(defmethod write-to-file ((obj pc-settings) (filename string))

goal_src/jak1/pc/pckernel-h.gc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@
193193
(discord-rpc? symbol) ;; enable discord rich presence integration
194194
(speedrunner-mode? symbol) ;; enable speedrunner mode
195195
(flava-hack int64)
196-
;; TODO - save/restore original settings (language/sound/etc)
196+
;; settings originally stored in the game save
197+
;; now stored in pc-settings
198+
(memcard-volume-sfx float)
199+
(memcard-volume-music float)
200+
(memcard-volume-dialog float)
201+
(memcard-vibration? symbol)
197202
)
198203
(:methods
199204
(new (symbol type) _type_)

goal_src/jak1/pc/pckernel-impl.gc

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@
6767

6868
;; The Jak 1 version of the pc-settings object.
6969
(deftype pc-settings-jak1 (pc-settings)
70-
((cheats pc-cheats)
71-
(cheats-known pc-cheats)
72-
(skip-movies? symbol) ;; if on, enable cutscene skipping
73-
(subtitles? symbol) ;; if on, cutscene subtitles will show up
74-
(text-language pc-language) ;; language for game text
75-
(subtitle-language pc-language) ;; language for subtitles
76-
(money-starburst? symbol) ;; add a starburst to the money
77-
(extra-hud? symbol) ;; extra hud elements.
78-
(secrets pc-game-secrets :inline) ;; hidden goodies and additional secrets!
79-
(scenes-seen uint8 PC_SPOOL_LOG_LENGTH) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?)
70+
((cheats pc-cheats)
71+
(cheats-known pc-cheats)
72+
(skip-movies? symbol) ;; if on, enable cutscene skipping
73+
(subtitles? symbol) ;; if on, cutscene subtitles will show up
74+
(text-language pc-language) ;; language for game text
75+
(subtitle-language pc-language) ;; language for subtitles
76+
(money-starburst? symbol) ;; add a starburst to the money
77+
(extra-hud? symbol) ;; extra hud elements.
78+
(secrets pc-game-secrets :inline) ;; hidden goodies and additional secrets!
79+
(scenes-seen uint8 PC_SPOOL_LOG_LENGTH) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?)
80+
(memcard-play-hints? symbol)
8081
))
8182

8283
(define *pc-settings* (the pc-settings-jak1 #f))
@@ -131,6 +132,12 @@
131132
(else))
132133
(set! (-> obj money-starburst?) #f)
133134
(set! (-> obj extra-hud?) #f)
135+
;; original settings, minus 25 to be a bit more conservative
136+
(set! (-> obj memcard-volume-sfx) 50.0)
137+
(set! (-> obj memcard-volume-music) 40.0)
138+
(set! (-> obj memcard-volume-dialog) 75.0)
139+
(set! (-> obj memcard-vibration?) #t)
140+
(set! (-> obj memcard-play-hints?) #t)
134141
0)
135142

136143
(defmethod reset-extra ((obj pc-settings-jak1) (call-handlers symbol))

goal_src/jak1/pc/pckernel.gc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
;;;; methods
1515
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1616

17+
(defmethod initialize ((obj pc-settings-jak1))
18+
"initial initialize method to be run after allocating"
19+
((method-of-type pc-settings initialize) obj)
20+
(set! (-> *setting-control* default sfx-volume) (-> obj memcard-volume-sfx))
21+
(set! (-> *setting-control* default music-volume) (-> obj memcard-volume-music))
22+
(set! (-> *setting-control* default dialog-volume) (-> obj memcard-volume-dialog))
23+
(set! (-> *setting-control* default vibration) (-> obj memcard-vibration?))
24+
(set! (-> *setting-control* default play-hints) (-> obj memcard-play-hints?))
25+
obj)
26+
1727
(defmethod set-game-setting! ((obj pc-settings-jak1) (setting symbol) (value symbol))
1828
(case setting
1929
(('video-mode)
@@ -434,6 +444,7 @@
434444
(("subtitle-language") (set! (-> obj subtitle-language) (the-as pc-language (file-stream-read-int file))))
435445
(("text-language") (set! (-> obj text-language) (the-as pc-language (file-stream-read-int file))))
436446
(("scenes-seen") (dotimes (i PC_SPOOL_LOG_LENGTH) (set! (-> obj scenes-seen i) (file-stream-read-int file))))
447+
(("memcard-play-hints?") (set! (-> obj memcard-play-hints?) (file-stream-read-symbol file)))
437448
(("secrets")
438449
(dosettings (file)
439450
(case-str *pc-temp-string*
@@ -467,6 +478,7 @@
467478
(format file " (subtitles? ~A)~%" (-> obj subtitles?))
468479
(format file " (subtitle-language ~D)~%" (-> obj subtitle-language))
469480
(format file " (text-language ~D)~%" (-> obj text-language))
481+
(format file " (memcard-play-hints? ~A)~%" (-> obj memcard-play-hints?))
470482
#|
471483
(format file " (scenes-seen")
472484
(dotimes (i PC_SPOOL_LOG_LENGTH)

goal_src/jak1/pc/progress-pc.gc

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@
225225
:name (text-id input-options)
226226
:scale #t
227227
:param3 (game-option-menu input-options))
228-
(new 'static 'game-option :option-type (game-option-type on-off) :name (text-id play-hints) :scale #t)
228+
(new 'static 'game-option :option-type (game-option-type on-off) :name (text-id play-hints) :scale #t
229+
:on-confirm
230+
(lambda ()
231+
(set! (-> *setting-control* default play-hints) (-> *pc-settings* memcard-play-hints?))))
229232
(new 'static 'game-option :option-type (game-option-type on-off) :name (text-id subtitles) :scale #t)
230233
(new 'static 'game-option :option-type (game-option-type on-off) :name (text-id hinttitles) :scale #t)
231234
(new 'static 'game-option :option-type (game-option-type language) :name (text-id language) :scale #t)
@@ -297,23 +300,35 @@
297300
:scale #t
298301
:param1 0.0
299302
:param2 100.0
300-
:slider-step-size 1.0)
303+
:slider-step-size 1.0
304+
:on-confirm
305+
(lambda ((val object))
306+
(set! (-> *setting-control* default sfx-volume) (-> *pc-settings* memcard-volume-sfx))
307+
(none)))
301308
(new 'static
302309
'game-option
303310
:option-type (game-option-type slider)
304311
:name (text-id music-volume)
305312
:scale #t
306313
:param1 0.0
307314
:param2 100.0
308-
:slider-step-size 1.0)
315+
:slider-step-size 1.0
316+
:on-confirm
317+
(lambda ((val object))
318+
(set! (-> *setting-control* default music-volume) (-> *pc-settings* memcard-volume-music))
319+
(none)))
309320
(new 'static
310321
'game-option
311322
:option-type (game-option-type slider)
312323
:name (text-id speech-volume)
313324
:scale #t
314325
:param1 0.0
315326
:param2 100.0
316-
:slider-step-size 1.0)
327+
:slider-step-size 1.0
328+
:on-confirm
329+
(lambda ((val object))
330+
(set! (-> *setting-control* default dialog-volume) (-> *pc-settings* memcard-volume-dialog))
331+
(none)))
317332
;(new 'static 'game-option :option-type (game-option-type on-off) :name (text-id music-fadein) :scale #t)
318333
(new 'static 'game-option :option-type (game-option-type button) :name (text-id back) :scale #t)))
319334

@@ -371,7 +386,10 @@
371386
:scale #t
372387
:option-disabled-func
373388
(lambda ()
374-
(not (pc-current-controller-has-rumble?))))
389+
(not (pc-current-controller-has-rumble?)))
390+
:on-confirm
391+
(lambda ()
392+
(set! (-> *setting-control* default vibration) (-> *pc-settings* memcard-vibration?))))
375393
(new 'static
376394
'game-option
377395
:option-type (game-option-type slider)
@@ -2025,19 +2043,19 @@
20252043
(set! (-> *progress-state* video-mode-choice) (get-video-mode))
20262044
(set! (-> *progress-state* yes-no-choice) #f)
20272045
;; set variable pointers
2028-
(set! (-> *game-options* 1 value-to-modify) (&-> *setting-control* default play-hints))
2046+
(set! (-> *game-options* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?))
20292047
(set! (-> *game-options* 2 value-to-modify) (&-> *setting-control* default language))
2030-
(set! (-> *game-options-japan* 0 value-to-modify) (&-> *setting-control* default vibration))
2031-
(set! (-> *game-options-japan* 1 value-to-modify) (&-> *setting-control* default play-hints))
2032-
(set! (-> *game-options-demo* 0 value-to-modify) (&-> *setting-control* default vibration))
2033-
(set! (-> *game-options-demo* 1 value-to-modify) (&-> *setting-control* default play-hints))
2048+
(set! (-> *game-options-japan* 0 value-to-modify) (&-> *pc-settings* memcard-vibration?))
2049+
(set! (-> *game-options-japan* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?))
2050+
(set! (-> *game-options-demo* 0 value-to-modify) (&-> *pc-settings* memcard-vibration?))
2051+
(set! (-> *game-options-demo* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?))
20342052
(set! (-> *graphic-options* 1 value-to-modify) (&-> *progress-state* aspect-ratio-choice))
20352053
(set! (-> *sound-options* 0 value-to-modify) (&-> *setting-control* default sfx-volume))
20362054
(set! (-> *sound-options* 1 value-to-modify) (&-> *setting-control* default music-volume))
20372055
(set! (-> *sound-options* 2 value-to-modify) (&-> *setting-control* default dialog-volume))
20382056
(set! (-> *yes-no-options* 0 value-to-modify) (&-> *progress-state* yes-no-choice))
20392057
;; our options!
2040-
(set! (-> *game-options-pc* 1 value-to-modify) (&-> *setting-control* default play-hints))
2058+
(set! (-> *game-options-pc* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?))
20412059
(set! (-> *game-options-pc* 2 value-to-modify) (&-> *pc-settings* subtitles?))
20422060
(set! (-> *game-options-pc* 3 value-to-modify) (&-> *pc-settings* hinttitles?))
20432061
(set! (-> *game-options-pc* 4 value-to-modify) (&-> *setting-control* default language))
@@ -2057,7 +2075,7 @@
20572075
(set! (-> *camera-options* 2 value-to-modify) (&-> *pc-settings* third-camera-h-inverted?))
20582076
(set! (-> *camera-options* 3 value-to-modify) (&-> *pc-settings* third-camera-v-inverted?))
20592077
;; input options
2060-
(set! (-> *controller-options* 1 value-to-modify) (&-> *setting-control* default vibration))
2078+
(set! (-> *controller-options* 1 value-to-modify) (&-> *pc-settings* memcard-vibration?))
20612079
(set! (-> *controller-options* 2 value-to-modify) (&-> *pc-settings* stick-deadzone))
20622080
(set! (-> *controller-options* 3 value-to-modify) (&-> *pc-settings* ignore-controller-win-unfocused?))
20632081
(set! (-> *controller-options* 4 value-to-modify) (&-> *pc-settings* controller-led-hp?))
@@ -2075,9 +2093,9 @@
20752093
(set! (-> *gfx-ps2-options* 2 value-to-modify) (&-> *pc-settings* ps2-parts?))
20762094
(set! (-> *gfx-ps2-options* 3 value-to-modify) (&-> *pc-settings* force-envmap?))
20772095
(set! (-> *gfx-ps2-options* 4 value-to-modify) (&-> *pc-settings* ps2-actor-vis?))
2078-
(set! (-> *sound-options-pc* 0 value-to-modify) (&-> *setting-control* default sfx-volume))
2079-
(set! (-> *sound-options-pc* 1 value-to-modify) (&-> *setting-control* default music-volume))
2080-
(set! (-> *sound-options-pc* 2 value-to-modify) (&-> *setting-control* default dialog-volume))
2096+
(set! (-> *sound-options-pc* 0 value-to-modify) (&-> *pc-settings* memcard-volume-sfx))
2097+
(set! (-> *sound-options-pc* 1 value-to-modify) (&-> *pc-settings* memcard-volume-music))
2098+
(set! (-> *sound-options-pc* 2 value-to-modify) (&-> *pc-settings* memcard-volume-dialog))
20812099
(dotimes (i (1- (-> *cheats* length)))
20822100
(set! (-> *cheats* i value-to-modify) (&-> *progress-carousell* symbol-backup)))
20832101
;(set! (-> *sound-options-pc* 3 value-to-modify) (&-> *pc-settings* music-fadein?))

goal_src/jak2/engine/game/game-save.gc

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,21 +1103,22 @@
11031103
(let ((v1-0 (the-as object (-> arg0 tag))))
11041104
(while (< (the-as int v1-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length))))
11051105
(case (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-type)
1106-
(((game-save-elt sfx-volume))
1107-
(set! (-> *setting-control* user-default sfx-volume)
1108-
(-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)
1109-
)
1110-
)
1111-
(((game-save-elt music-volume))
1112-
(set! (-> *setting-control* user-default music-volume)
1113-
(-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)
1114-
)
1115-
)
1116-
(((game-save-elt dialog-volume))
1117-
(set! (-> *setting-control* user-default dialog-volume)
1118-
(-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)
1119-
)
1120-
)
1106+
;; og:preserve-this Moved saving these settings to pc-settings
1107+
;; (((game-save-elt sfx-volume))
1108+
;; (set! (-> *setting-control* user-default sfx-volume)
1109+
;; (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)
1110+
;; )
1111+
;; )
1112+
;; (((game-save-elt music-volume))
1113+
;; (set! (-> *setting-control* user-default music-volume)
1114+
;; (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)
1115+
;; )
1116+
;; )
1117+
;; (((game-save-elt dialog-volume))
1118+
;; (set! (-> *setting-control* user-default dialog-volume)
1119+
;; (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)
1120+
;; )
1121+
;; )
11211122
(((game-save-elt language))
11221123
(set! (-> *setting-control* user-default language)
11231124
(the-as language-enum (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64))
@@ -1133,16 +1134,16 @@
11331134
(the-as int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64))
11341135
)
11351136
)
1136-
(((game-save-elt vibration))
1137-
(set! (-> *setting-control* user-default vibration)
1138-
(= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1)
1139-
)
1140-
)
1141-
(((game-save-elt subtitle))
1142-
(set! (-> *setting-control* user-default subtitle)
1143-
(= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1)
1144-
)
1145-
)
1137+
;; (((game-save-elt vibration))
1138+
;; (set! (-> *setting-control* user-default vibration)
1139+
;; (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1)
1140+
;; )
1141+
;; )
1142+
;; (((game-save-elt subtitle))
1143+
;; (set! (-> *setting-control* user-default subtitle)
1144+
;; (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1)
1145+
;; )
1146+
;; )
11461147
(((game-save-elt camera-stick-dir))
11471148
(set! (-> *setting-control* user-default camera-stick-dir)
11481149
(= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1)
@@ -1163,6 +1164,7 @@
11631164
(the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0))
11641165
)
11651166
)
1167+
(else (format 0 "PC PORT: Skipping setting from game save, its stored in the pc-settings now"))
11661168
)
11671169
(set! v1-0 (&+
11681170
(the-as pointer v1-0)

goal_src/jak2/pc/pckernel-impl.gc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
;; other
102102
(controller-led-status? symbol)
103103
(speedrunner-mode-custom-bind uint32)
104+
(memcard-subtitles? symbol)
104105

105106
(text-language pc-language) ;; language for game text
106107
)
@@ -161,6 +162,12 @@
161162
)
162163
(else
163164
))
165+
166+
(set! (-> obj memcard-volume-sfx) 0.5)
167+
(set! (-> obj memcard-volume-music) 0.4)
168+
(set! (-> obj memcard-volume-dialog) 0.75)
169+
(set! (-> obj memcard-vibration?) #t)
170+
(set! (-> obj memcard-subtitles?) #f)
164171
0)
165172

166173
(defmethod reset-extra ((obj pc-settings-jak2) (call-handlers symbol))

0 commit comments

Comments
 (0)