From df9e7aa4d22ff276babf22233113269e0d42488d Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Thu, 25 Jul 2024 00:05:39 -0400 Subject: [PATCH] g/j2: do the same, just have to set the global values from the progress menus --- goal_src/jak1/pc/pckernel-common.gc | 11 +---- goal_src/jak1/pc/pckernel-h.gc | 9 +--- goal_src/jak1/pc/pckernel-impl.gc | 27 +++++++----- goal_src/jak1/pc/pckernel.gc | 12 ++++++ goal_src/jak1/pc/progress-pc.gc | 14 +++---- 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 | 16 ++++---- 9 files changed, 87 insertions(+), 69 deletions(-) diff --git a/goal_src/jak1/pc/pckernel-common.gc b/goal_src/jak1/pc/pckernel-common.gc index 1c282dfc89..31db8e0180 100644 --- a/goal_src/jak1/pc/pckernel-common.gc +++ b/goal_src/jak1/pc/pckernel-common.gc @@ -551,8 +551,7 @@ (("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))) - (("memcard-play-hints") (set! (-> obj memcard-play-hints) (file-stream-read-symbol 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))) @@ -630,8 +629,7 @@ (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)) - (format file " (memcard-play-hints ~A)~%" (-> obj memcard-play-hints)) + (format file " (memcard-vibration? ~A)~%" (-> obj memcard-vibration?)) 0) (defmethod write-to-file ((obj pc-settings) (filename string)) @@ -667,11 +665,6 @@ ;; any post-operations that need to be done after loading (set! (-> obj keyboard-enabled?) (pc-get-keyboard-enabled?)) (update-mouse-controls! 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 new pc-settings ((allocation symbol) (type-to-make type)) diff --git a/goal_src/jak1/pc/pckernel-h.gc b/goal_src/jak1/pc/pckernel-h.gc index ae5a8a28fd..d0c9061cf1 100644 --- a/goal_src/jak1/pc/pckernel-h.gc +++ b/goal_src/jak1/pc/pckernel-h.gc @@ -198,8 +198,7 @@ (memcard-volume-sfx float) (memcard-volume-music float) (memcard-volume-dialog float) - (memcard-vibration symbol) - (memcard-play-hints symbol) + (memcard-vibration? symbol) ) (:methods (new (symbol type) _type_) @@ -397,12 +396,6 @@ (set! (-> obj subtitle-speaker?) 'auto) (reset-camera obj call-handlers) (set! (-> obj territory) -1) ;; auto - ;; 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-camera ((obj pc-settings) (call-handlers symbol)) 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 c5a4d20544..cf2ac8e1dc 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) @@ -433,6 +443,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* @@ -466,6 +477,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 2921ce052d..3fd402c0f3 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -1473,19 +1473,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) (&-> *pc-settings* memcard-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) (&-> *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! (-> *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) (&-> *pc-settings* memcard-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)) @@ -1506,7 +1506,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) (&-> *pc-settings* memcard-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?)) 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 4465b16a31..266577f57a 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)) @@ -756,6 +758,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)) @@ -807,6 +810,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 add2fabc8f..59dacc8d26 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) @@ -105,13 +105,13 @@ (&-> *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) + (&-> *pc-settings* memcard-volume-sfx) ) (set! (-> (the-as menu-slider-option (-> *sound-options* options 1)) value-to-modify) - (&-> *setting-control* user-default music-volume) + (&-> *pc-settings* memcard-volume-music) ) (set! (-> (the-as menu-slider-option (-> *sound-options* options 2)) value-to-modify) - (&-> *setting-control* user-default dialog-volume) + (&-> *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)