From af6de539b5c814a36b303581e4e02d5b11787c87 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 31 Jul 2024 00:01:18 -0400 Subject: [PATCH] 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. --- goal_src/jak1/engine/game/game-save.gc | 12 ++-- goal_src/jak1/pc/pckernel-common.gc | 8 +++ goal_src/jak1/pc/pckernel-h.gc | 7 ++- goal_src/jak1/pc/pckernel-impl.gc | 27 +++++--- goal_src/jak1/pc/pckernel.gc | 12 ++++ goal_src/jak1/pc/progress-pc.gc | 48 +++++++++----- goal_src/jak2/engine/game/game-save.gc | 52 ++++++++-------- goal_src/jak2/pc/pckernel-impl.gc | 7 +++ goal_src/jak2/pc/pckernel.gc | 8 ++- goal_src/jak2/pc/progress/progress-pc.gc | 30 ++++----- .../jak2/pc/progress/progress-static-pc.gc | 62 ++++++++++++++++--- 11 files changed, 193 insertions(+), 80 deletions(-) diff --git a/goal_src/jak1/engine/game/game-save.gc b/goal_src/jak1/engine/game/game-save.gc index 0096693b0b..84db8e75d0 100644 --- a/goal_src/jak1/engine/game/game-save.gc +++ b/goal_src/jak1/engine/game/game-save.gc @@ -594,14 +594,16 @@ ;; loop over all tags (while (< (the-as int save-data) (the-as int (+ (+ (-> save length) 76) (the-as int save)))) (let ((a0-1 (-> save-data elt-type))) + ;; og:preserve-this Moved these settings to pc-settings (cond - ((= a0-1 (game-save-elt sfx-volume)) (set! (-> *setting-control* default sfx-volume) (-> save-data user-float0))) - ((= a0-1 (game-save-elt music-volume)) (set! (-> *setting-control* default music-volume) (-> save-data user-float0))) - ((= a0-1 (game-save-elt dialog-volume)) (set! (-> *setting-control* default dialog-volume) (-> save-data user-float0))) + ;; ((= a0-1 (game-save-elt sfx-volume)) (set! (-> *setting-control* default sfx-volume) (-> save-data user-float0))) + ;; ((= a0-1 (game-save-elt music-volume)) (set! (-> *setting-control* default music-volume) (-> save-data user-float0))) + ;; ((= a0-1 (game-save-elt dialog-volume)) (set! (-> *setting-control* default dialog-volume) (-> save-data user-float0))) ((= a0-1 (game-save-elt language)) (set! (-> *setting-control* default language) (the-as language-enum (-> save-data user-uint64)))) - ((= a0-1 (game-save-elt vibration)) (set! (-> *setting-control* default vibration) (= (-> save-data user-uint64) 1))) - ((= a0-1 (game-save-elt play-hints)) (set! (-> *setting-control* default play-hints) (= (-> save-data user-uint64) 1))))) + ;; ((= a0-1 (game-save-elt vibration)) (set! (-> *setting-control* default vibration) (= (-> save-data user-uint64) 1))) + ;; ((= a0-1 (game-save-elt play-hints)) (set! (-> *setting-control* default play-hints) (= (-> save-data user-uint64) 1))) + (else (format 0 "PC PORT: Skipping setting from game save, its stored in the pc-settings now")))) (set! save-data (the-as game-save-tag (&+ (the-as pointer save-data) (logand -16 (+ (* (the-as int (-> save-data elt-size)) (-> save-data elt-count)) 31))))))) diff --git a/goal_src/jak1/pc/pckernel-common.gc b/goal_src/jak1/pc/pckernel-common.gc index 6007a2ade2..a01708a818 100644 --- a/goal_src/jak1/pc/pckernel-common.gc +++ b/goal_src/jak1/pc/pckernel-common.gc @@ -539,6 +539,10 @@ (("controller-led-brightness") (set! (-> obj controller-led-brightness) (file-stream-read-float file))) (("controller-led-min-brightness") (set! (-> obj controller-led-min-brightness) (file-stream-read-float file))) (("controller-led-max-brightness") (set! (-> obj controller-led-max-brightness) (file-stream-read-float file))) + (("memcard-volume-sfx") (set! (-> obj memcard-volume-sfx) (file-stream-read-float file))) + (("memcard-volume-music") (set! (-> obj memcard-volume-music) (file-stream-read-float file))) + (("memcard-volume-dialog") (set! (-> obj memcard-volume-dialog) (file-stream-read-float file))) + (("memcard-vibration?") (set! (-> obj memcard-vibration?) (file-stream-read-symbol file))) ;; debug (("debug-font-scale") (set! (-> obj debug-font-scale) (file-stream-read-float file))) (("debug-font-scale-auto?") (set! (-> obj debug-font-scale-auto?) (file-stream-read-symbol file))) @@ -611,6 +615,10 @@ (format file " (game-language ~D)~%" (get-game-language obj)) (format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?)) (format file " (territory ~D)~%" (-> obj territory)) + (format file " (memcard-volume-sfx ~f)~%" (-> obj memcard-volume-sfx)) + (format file " (memcard-volume-music ~f)~%" (-> obj memcard-volume-music)) + (format file " (memcard-volume-dialog ~f)~%" (-> obj memcard-volume-dialog)) + (format file " (memcard-vibration? ~A)~%" (-> obj memcard-vibration?)) 0) (defmethod write-to-file ((obj pc-settings) (filename string)) diff --git a/goal_src/jak1/pc/pckernel-h.gc b/goal_src/jak1/pc/pckernel-h.gc index 3039062ac2..5077ecb4d5 100644 --- a/goal_src/jak1/pc/pckernel-h.gc +++ b/goal_src/jak1/pc/pckernel-h.gc @@ -193,7 +193,12 @@ (discord-rpc? symbol) ;; enable discord rich presence integration (speedrunner-mode? symbol) ;; enable speedrunner mode (flava-hack int64) - ;; TODO - save/restore original settings (language/sound/etc) + ;; settings originally stored in the game save + ;; now stored in pc-settings + (memcard-volume-sfx float) + (memcard-volume-music float) + (memcard-volume-dialog float) + (memcard-vibration? symbol) ) (:methods (new (symbol type) _type_) diff --git a/goal_src/jak1/pc/pckernel-impl.gc b/goal_src/jak1/pc/pckernel-impl.gc index 3e61cd0222..d913cd9417 100644 --- a/goal_src/jak1/pc/pckernel-impl.gc +++ b/goal_src/jak1/pc/pckernel-impl.gc @@ -67,16 +67,17 @@ ;; 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?) + ((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?) + (memcard-play-hints? symbol) )) (define *pc-settings* (the pc-settings-jak1 #f)) @@ -131,6 +132,12 @@ (else)) (set! (-> obj money-starburst?) #f) (set! (-> obj extra-hud?) #f) + ;; original settings, minus 25 to be a bit more conservative + (set! (-> obj memcard-volume-sfx) 50.0) + (set! (-> obj memcard-volume-music) 40.0) + (set! (-> obj memcard-volume-dialog) 75.0) + (set! (-> obj memcard-vibration?) #t) + (set! (-> obj memcard-play-hints?) #t) 0) (defmethod reset-extra ((obj pc-settings-jak1) (call-handlers symbol)) diff --git a/goal_src/jak1/pc/pckernel.gc b/goal_src/jak1/pc/pckernel.gc index 57840b3362..9b0fbae175 100644 --- a/goal_src/jak1/pc/pckernel.gc +++ b/goal_src/jak1/pc/pckernel.gc @@ -14,6 +14,16 @@ ;;;; methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defmethod initialize ((obj pc-settings-jak1)) + "initial initialize method to be run after allocating" + ((method-of-type pc-settings initialize) obj) + (set! (-> *setting-control* default sfx-volume) (-> obj memcard-volume-sfx)) + (set! (-> *setting-control* default music-volume) (-> obj memcard-volume-music)) + (set! (-> *setting-control* default dialog-volume) (-> obj memcard-volume-dialog)) + (set! (-> *setting-control* default vibration) (-> obj memcard-vibration?)) + (set! (-> *setting-control* default play-hints) (-> obj memcard-play-hints?)) + obj) + (defmethod set-game-setting! ((obj pc-settings-jak1) (setting symbol) (value symbol)) (case setting (('video-mode) @@ -434,6 +444,7 @@ (("subtitle-language") (set! (-> obj subtitle-language) (the-as pc-language (file-stream-read-int file)))) (("text-language") (set! (-> obj text-language) (the-as pc-language (file-stream-read-int file)))) (("scenes-seen") (dotimes (i PC_SPOOL_LOG_LENGTH) (set! (-> obj scenes-seen i) (file-stream-read-int file)))) + (("memcard-play-hints?") (set! (-> obj memcard-play-hints?) (file-stream-read-symbol file))) (("secrets") (dosettings (file) (case-str *pc-temp-string* @@ -467,6 +478,7 @@ (format file " (subtitles? ~A)~%" (-> obj subtitles?)) (format file " (subtitle-language ~D)~%" (-> obj subtitle-language)) (format file " (text-language ~D)~%" (-> obj text-language)) + (format file " (memcard-play-hints? ~A)~%" (-> obj memcard-play-hints?)) #| (format file " (scenes-seen") (dotimes (i PC_SPOOL_LOG_LENGTH) diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index f65df43562..df48efbbfc 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -225,7 +225,10 @@ :name (text-id input-options) :scale #t :param3 (game-option-menu input-options)) - (new 'static 'game-option :option-type (game-option-type on-off) :name (text-id play-hints) :scale #t) + (new 'static 'game-option :option-type (game-option-type on-off) :name (text-id play-hints) :scale #t + :on-confirm + (lambda () + (set! (-> *setting-control* default play-hints) (-> *pc-settings* memcard-play-hints?)))) (new 'static 'game-option :option-type (game-option-type on-off) :name (text-id subtitles) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (text-id hinttitles) :scale #t) (new 'static 'game-option :option-type (game-option-type language) :name (text-id language) :scale #t) @@ -297,7 +300,11 @@ :scale #t :param1 0.0 :param2 100.0 - :slider-step-size 1.0) + :slider-step-size 1.0 + :on-confirm + (lambda ((val object)) + (set! (-> *setting-control* default sfx-volume) (-> *pc-settings* memcard-volume-sfx)) + (none))) (new 'static 'game-option :option-type (game-option-type slider) @@ -305,7 +312,11 @@ :scale #t :param1 0.0 :param2 100.0 - :slider-step-size 1.0) + :slider-step-size 1.0 + :on-confirm + (lambda ((val object)) + (set! (-> *setting-control* default music-volume) (-> *pc-settings* memcard-volume-music)) + (none))) (new 'static 'game-option :option-type (game-option-type slider) @@ -313,7 +324,11 @@ :scale #t :param1 0.0 :param2 100.0 - :slider-step-size 1.0) + :slider-step-size 1.0 + :on-confirm + (lambda ((val object)) + (set! (-> *setting-control* default dialog-volume) (-> *pc-settings* memcard-volume-dialog)) + (none))) ;(new 'static 'game-option :option-type (game-option-type on-off) :name (text-id music-fadein) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (text-id back) :scale #t))) @@ -371,7 +386,10 @@ :scale #t :option-disabled-func (lambda () - (not (pc-current-controller-has-rumble?)))) + (not (pc-current-controller-has-rumble?))) + :on-confirm + (lambda () + (set! (-> *setting-control* default vibration) (-> *pc-settings* memcard-vibration?)))) (new 'static 'game-option :option-type (game-option-type slider) @@ -2025,19 +2043,19 @@ (set! (-> *progress-state* video-mode-choice) (get-video-mode)) (set! (-> *progress-state* yes-no-choice) #f) ;; set variable pointers - (set! (-> *game-options* 1 value-to-modify) (&-> *setting-control* default play-hints)) + (set! (-> *game-options* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?)) (set! (-> *game-options* 2 value-to-modify) (&-> *setting-control* default language)) - (set! (-> *game-options-japan* 0 value-to-modify) (&-> *setting-control* default vibration)) - (set! (-> *game-options-japan* 1 value-to-modify) (&-> *setting-control* default play-hints)) - (set! (-> *game-options-demo* 0 value-to-modify) (&-> *setting-control* default vibration)) - (set! (-> *game-options-demo* 1 value-to-modify) (&-> *setting-control* default play-hints)) + (set! (-> *game-options-japan* 0 value-to-modify) (&-> *pc-settings* memcard-vibration?)) + (set! (-> *game-options-japan* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?)) + (set! (-> *game-options-demo* 0 value-to-modify) (&-> *pc-settings* memcard-vibration?)) + (set! (-> *game-options-demo* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?)) (set! (-> *graphic-options* 1 value-to-modify) (&-> *progress-state* aspect-ratio-choice)) (set! (-> *sound-options* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) (set! (-> *sound-options* 1 value-to-modify) (&-> *setting-control* default music-volume)) (set! (-> *sound-options* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) (set! (-> *yes-no-options* 0 value-to-modify) (&-> *progress-state* yes-no-choice)) ;; our options! - (set! (-> *game-options-pc* 1 value-to-modify) (&-> *setting-control* default play-hints)) + (set! (-> *game-options-pc* 1 value-to-modify) (&-> *pc-settings* memcard-play-hints?)) (set! (-> *game-options-pc* 2 value-to-modify) (&-> *pc-settings* subtitles?)) (set! (-> *game-options-pc* 3 value-to-modify) (&-> *pc-settings* hinttitles?)) (set! (-> *game-options-pc* 4 value-to-modify) (&-> *setting-control* default language)) @@ -2057,7 +2075,7 @@ (set! (-> *camera-options* 2 value-to-modify) (&-> *pc-settings* third-camera-h-inverted?)) (set! (-> *camera-options* 3 value-to-modify) (&-> *pc-settings* third-camera-v-inverted?)) ;; input options - (set! (-> *controller-options* 1 value-to-modify) (&-> *setting-control* default vibration)) + (set! (-> *controller-options* 1 value-to-modify) (&-> *pc-settings* memcard-vibration?)) (set! (-> *controller-options* 2 value-to-modify) (&-> *pc-settings* stick-deadzone)) (set! (-> *controller-options* 3 value-to-modify) (&-> *pc-settings* ignore-controller-win-unfocused?)) (set! (-> *controller-options* 4 value-to-modify) (&-> *pc-settings* controller-led-hp?)) @@ -2075,9 +2093,9 @@ (set! (-> *gfx-ps2-options* 2 value-to-modify) (&-> *pc-settings* ps2-parts?)) (set! (-> *gfx-ps2-options* 3 value-to-modify) (&-> *pc-settings* force-envmap?)) (set! (-> *gfx-ps2-options* 4 value-to-modify) (&-> *pc-settings* ps2-actor-vis?)) - (set! (-> *sound-options-pc* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) - (set! (-> *sound-options-pc* 1 value-to-modify) (&-> *setting-control* default music-volume)) - (set! (-> *sound-options-pc* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) + (set! (-> *sound-options-pc* 0 value-to-modify) (&-> *pc-settings* memcard-volume-sfx)) + (set! (-> *sound-options-pc* 1 value-to-modify) (&-> *pc-settings* memcard-volume-music)) + (set! (-> *sound-options-pc* 2 value-to-modify) (&-> *pc-settings* memcard-volume-dialog)) (dotimes (i (1- (-> *cheats* length))) (set! (-> *cheats* i value-to-modify) (&-> *progress-carousell* symbol-backup))) ;(set! (-> *sound-options-pc* 3 value-to-modify) (&-> *pc-settings* music-fadein?)) diff --git a/goal_src/jak2/engine/game/game-save.gc b/goal_src/jak2/engine/game/game-save.gc index 17036d7d74..99d722c6a6 100644 --- a/goal_src/jak2/engine/game/game-save.gc +++ b/goal_src/jak2/engine/game/game-save.gc @@ -1103,21 +1103,22 @@ (let ((v1-0 (the-as object (-> arg0 tag)))) (while (< (the-as int v1-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length)))) (case (-> (the-as (inline-array game-save-tag) v1-0) 0 elt-type) - (((game-save-elt sfx-volume)) - (set! (-> *setting-control* user-default sfx-volume) - (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) - ) - ) - (((game-save-elt music-volume)) - (set! (-> *setting-control* user-default music-volume) - (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) - ) - ) - (((game-save-elt dialog-volume)) - (set! (-> *setting-control* user-default dialog-volume) - (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) - ) - ) + ;; og:preserve-this Moved saving these settings to pc-settings + ;; (((game-save-elt sfx-volume)) + ;; (set! (-> *setting-control* user-default sfx-volume) + ;; (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ;; ) + ;; ) + ;; (((game-save-elt music-volume)) + ;; (set! (-> *setting-control* user-default music-volume) + ;; (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ;; ) + ;; ) + ;; (((game-save-elt dialog-volume)) + ;; (set! (-> *setting-control* user-default dialog-volume) + ;; (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0) + ;; ) + ;; ) (((game-save-elt language)) (set! (-> *setting-control* user-default language) (the-as language-enum (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) @@ -1133,16 +1134,16 @@ (the-as int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64)) ) ) - (((game-save-elt vibration)) - (set! (-> *setting-control* user-default vibration) - (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) - ) - ) - (((game-save-elt subtitle)) - (set! (-> *setting-control* user-default subtitle) - (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) - ) - ) + ;; (((game-save-elt vibration)) + ;; (set! (-> *setting-control* user-default vibration) + ;; (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ;; ) + ;; ) + ;; (((game-save-elt subtitle)) + ;; (set! (-> *setting-control* user-default subtitle) + ;; (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) + ;; ) + ;; ) (((game-save-elt camera-stick-dir)) (set! (-> *setting-control* user-default camera-stick-dir) (= (-> (the-as (inline-array game-save-tag) v1-0) 0 user-uint64) 1) @@ -1163,6 +1164,7 @@ (the int (-> (the-as (inline-array game-save-tag) v1-0) 0 user-float0)) ) ) + (else (format 0 "PC PORT: Skipping setting from game save, its stored in the pc-settings now")) ) (set! v1-0 (&+ (the-as pointer v1-0) diff --git a/goal_src/jak2/pc/pckernel-impl.gc b/goal_src/jak2/pc/pckernel-impl.gc index f6b6534a19..bbaf5b584e 100644 --- a/goal_src/jak2/pc/pckernel-impl.gc +++ b/goal_src/jak2/pc/pckernel-impl.gc @@ -101,6 +101,7 @@ ;; other (controller-led-status? symbol) (speedrunner-mode-custom-bind uint32) + (memcard-subtitles? symbol) (text-language pc-language) ;; language for game text ) @@ -161,6 +162,12 @@ ) (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) 0) (defmethod reset-extra ((obj pc-settings-jak2) (call-handlers symbol)) diff --git a/goal_src/jak2/pc/pckernel.gc b/goal_src/jak2/pc/pckernel.gc index 4f84d95acb..e8a6fb928f 100644 --- a/goal_src/jak2/pc/pckernel.gc +++ b/goal_src/jak2/pc/pckernel.gc @@ -314,12 +314,14 @@ ;;;; methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (defmethod initialize ((obj pc-settings-jak2)) "initial initialize method to be run after allocating" - (set! (-> obj music-unlocked) (new 'global 'bit-array (-> *music-player-tracks* length))) ((method-of-type pc-settings initialize) obj) + (set! (-> *setting-control* user-default sfx-volume) (-> obj memcard-volume-sfx)) + (set! (-> *setting-control* user-default music-volume) (-> obj memcard-volume-music)) + (set! (-> *setting-control* user-default dialog-volume) (-> obj memcard-volume-dialog)) + (set! (-> *setting-control* user-default vibration) (-> obj memcard-vibration?)) obj) (defmethod set-game-setting! ((obj pc-settings-jak2) (setting symbol) (value symbol)) @@ -764,6 +766,7 @@ (("cheats-purchased") (set! (-> obj cheats-purchased) (the-as pc-cheats (file-stream-read-int file)))) (("cheats-unlocked") (set! (-> obj cheats-unlocked) (the-as pc-cheats (file-stream-read-int file)))) (("cheats-backup") (file-stream-read-int file)) ;; TODO - Don't remove this, parsing code can't handle unexpected keys + (("memcard-subtitles?") (set! (-> obj memcard-subtitles?) (file-stream-read-symbol file))) (("music-unlocked") (dotimes (i (/ (align64 (-> obj music-unlocked length)) 64)) (bit-array<-int64 (-> obj music-unlocked) (* i 64) (file-stream-read-int file)) @@ -815,6 +818,7 @@ (format file " (cheats-revealed #x~x)~%" (-> obj cheats-revealed)) (format file " (cheats-purchased #x~x)~%" (-> obj cheats-purchased)) (format file " (cheats-unlocked #x~x)~%" (-> obj cheats-unlocked)) + (format file " (memcard-subtitles? ~A)~%" (-> obj memcard-subtitles?)) (format file " (music-unlocked") (dotimes (i (/ (align64 (-> obj music-unlocked length)) 64)) diff --git a/goal_src/jak2/pc/progress/progress-pc.gc b/goal_src/jak2/pc/progress/progress-pc.gc index f58685bb10..34485484a1 100644 --- a/goal_src/jak2/pc/progress/progress-pc.gc +++ b/goal_src/jak2/pc/progress/progress-pc.gc @@ -57,8 +57,8 @@ (set! (-> *progress-state* color-flash-counter) 0) (set! (-> *progress-state* game-options-item-selected) 0) (set! (-> *progress-state* game-options-item-picked) #f) - (set! (-> *progress-state* game-options-vibrations) (-> *setting-control* user-default vibration)) - (set! (-> *progress-state* game-options-subtitles) (-> *setting-control* user-default subtitle)) + (set! (-> *progress-state* game-options-vibrations) (-> *pc-settings* memcard-vibration?)) + (set! (-> *progress-state* game-options-subtitles) (-> *pc-settings* memcard-subtitles?)) (set! (-> *progress-state* game-options-language-index) (the-as int (-> *setting-control* user-default language)) ) @@ -81,7 +81,7 @@ (set! (-> obj sliding-off) 1.0) (set! (-> obj scanlines-alpha) 0.0) (set! (-> (the-as menu-on-off-game-vibrations-option (-> *game-options* options 0)) value-to-modify) - (&-> *setting-control* user-default vibration) + (&-> *pc-settings* memcard-vibration?) ) (set! (-> (the-as menu-on-off-game-subtitles-option (-> *game-options* options 1)) value-to-modify) (&-> *setting-control* user-default subtitle) @@ -93,10 +93,10 @@ (set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-transition) #f) (set! (-> (the-as menu-language-option (-> *game-options* options 2)) language-x-offset) 0) (set! (-> (the-as menu-on-off-option (-> *game-options-japan* options 0)) value-to-modify) - (&-> *setting-control* user-default vibration) + (&-> *pc-settings* memcard-vibration?) ) (set! (-> (the-as menu-on-off-option (-> *game-options-demo* options 0)) value-to-modify) - (&-> *setting-control* user-default vibration) + (&-> *pc-settings* memcard-vibration?) ) (set! (-> (the-as menu-on-off-option (-> *graphic-options* options 2)) value-to-modify) (&-> *setting-control* user-default use-progressive-scan) @@ -104,15 +104,15 @@ (set! (-> (the-as menu-on-off-option (-> *graphic-title-options-pal* options 2)) value-to-modify) (&-> *setting-control* user-default use-progressive-scan) ) - (set! (-> (the-as menu-slider-option (-> *sound-options* options 0)) value-to-modify) - (&-> *setting-control* user-default sfx-volume) - ) - (set! (-> (the-as menu-slider-option (-> *sound-options* options 1)) value-to-modify) - (&-> *setting-control* user-default music-volume) - ) - (set! (-> (the-as menu-slider-option (-> *sound-options* options 2)) value-to-modify) - (&-> *setting-control* user-default dialog-volume) - ) + ;; (set! (-> (the-as menu-slider-option (-> *sound-options* options 0)) value-to-modify) + ;; (&-> *pc-settings* memcard-volume-sfx) + ;; ) + ;; (set! (-> (the-as menu-slider-option (-> *sound-options* options 1)) value-to-modify) + ;; (&-> *pc-settings* memcard-volume-music) + ;; ) + ;; (set! (-> (the-as menu-slider-option (-> *sound-options* options 2)) value-to-modify) + ;; (&-> *pc-settings* memcard-volume-dialog) + ;; ) (set! (-> (the-as menu-missions-option (-> *missions-options* options 0)) task-line-index) 0) (set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0) @@ -183,7 +183,7 @@ (set! (-> obj current-options) *graphic-options-pc*) ) (('sound-options) - (set! (-> obj current-options) *sound-options*) + (set! (-> obj current-options) *sound-options-pc*) ) (('select-load 'select-save) (set! (-> obj current-options) *load-save-options*) diff --git a/goal_src/jak2/pc/progress/progress-static-pc.gc b/goal_src/jak2/pc/progress/progress-static-pc.gc index 253117b774..8b9d3cda27 100644 --- a/goal_src/jak2/pc/progress/progress-static-pc.gc +++ b/goal_src/jak2/pc/progress/progress-static-pc.gc @@ -6,9 +6,6 @@ Additional PC port specific file for overriding/expanding the progress menu This gives us more freedom to write code how we want. |# -;; in jak 2, the options dont have to be all-caps anymore! -;; encode controller/display names - current bug waiting to happen - (define *title-pc* (new 'static 'menu-option-list :y-center #xc6 @@ -39,6 +36,52 @@ This gives us more freedom to write code how we want. ) ) +(define *sound-options-pc* + (progress-new-generic-scrolling-page (text-id progress-root-sound-options) + (new 'static 'menu-generic-slider-option + :name (text-id progress-sound-sfx-volume) + :min-value 0.0 + :max-value 1.0 + :step 0.01 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* memcard-volume-sfx)) + :on-confirm (lambda ((val float)) + (set! (-> *pc-settings* memcard-volume-sfx) val) + (pc-settings-save) + (set! (-> *setting-control* user-default sfx-volume) val))) + (new 'static 'menu-generic-slider-option + :name (text-id progress-sound-music-volume) + :min-value 0.0 + :max-value 1.0 + :step 0.01 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* memcard-volume-music)) + :on-confirm (lambda ((val float)) + (set! (-> *pc-settings* memcard-volume-music) val) + (pc-settings-save) + (set! (-> *setting-control* user-default music-volume) val))) + (new 'static 'menu-generic-slider-option + :name (text-id progress-sound-speech-volume) + :min-value 0.0 + :max-value 1.0 + :step 0.01 + :show-decimal? #t + :get-value-fn (lambda () (-> *pc-settings* memcard-volume-dialog)) + :on-confirm (lambda ((val float)) + (set! (-> *pc-settings* memcard-volume-dialog) val) + (pc-settings-save) + (set! (-> *setting-control* user-default dialog-volume) val))) + (new 'static 'menu-generic-carousel-option + :name (text-id progress-sound-format) + :get-max-size-fn (lambda () 3) + :get-item-label-fn (lambda ((index int)) + (case index + ((0) (lookup-text! *common-text* (text-id progress-sound-mono) #f)) + ((1) (lookup-text! *common-text* (text-id progress-sound-stereo) #f)) + ((2) (lookup-text! *common-text* (text-id progress-sound-surround) #f)))) + :get-item-index-fn (lambda () (-> *setting-control* user-default stereo-mode)) + :on-confirm (lambda ((index int) (the-progress progress)) (set! (-> *setting-control* user-default stereo-mode) index))))) + (define *options-pc* (new 'static 'menu-option-list :y-center #xc6 :y-space 30 @@ -138,7 +181,10 @@ This gives us more freedom to write code how we want. :truthy-text (text-id progress-on) :falsey-text (text-id progress-off) :get-value-fn (lambda () (-> *setting-control* user-default vibration)) - :on-confirm (lambda ((val symbol)) (set! (-> *setting-control* user-default vibration) val))) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* memcard-vibration?) val) + (pc-settings-save) + (set! (-> *setting-control* user-default vibration) val))) (new 'static 'menu-generic-slider-option :name (text-id progress-controller-options-analog-deadzone) :min-value 0.0 @@ -285,7 +331,10 @@ This gives us more freedom to write code how we want. :truthy-text (text-id progress-on) :falsey-text (text-id progress-off) :get-value-fn (lambda () (-> *setting-control* user-default subtitle)) - :on-confirm (lambda ((val symbol)) (set! (-> *setting-control* user-default subtitle) val)))) + :on-confirm (lambda ((val symbol)) + (set! (-> *pc-settings* memcard-subtitles?) val) + (pc-settings-save) + (set! (-> *setting-control* user-default subtitle) val)))) (defmacro game-options-pc-subtitle-language () `(new 'static 'menu-generic-carousel-option @@ -334,7 +383,6 @@ This gives us more freedom to write code how we want. :on-confirm (lambda ((index int) (the-progress progress)) (set! (-> *pc-settings* text-language) (the-as pc-language index)) ;; NOTE - this doesn't actually work (naughty dog tried it too in their progress code) - ;; fix it eventually (load-level-text-files (the-as int (-> *pc-settings* text-language))) (pc-settings-save)))) @@ -427,7 +475,7 @@ This gives us more freedom to write code how we want. (define *graphic-options-pc* (progress-new-generic-scrolling-page (text-id progress-root-graphic-options) - ;; NOTE/TODO - this doesn't following the established generic menu pattern + ;; NOTE/TODO - this doesn't follow the established generic menu pattern ;; a generic scrolling list menu component should be created (similar to menu-generic-details-page) ;; so the code can be localized to functions instead of scattered around in a bunch of switch statements (new 'static 'menu-generic-to-resolutions-option