From 87d24dd29139de5d88f4f774269a39b595bbf32f Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Sun, 3 Jul 2022 22:27:55 +0100 Subject: [PATCH] add "disable autosave" option to menu and change memcard warning (#1592) * add "disable autosave" option to menu and change memcard warning * reduce duplication * fix test --- decompiler/config/all-types.gc | 8 +- game/assets/jak1/text/game_text_en.gs | 19 +- goal_src/jak1/engine/ui/progress-h.gc | 276 +++++++++--------- .../engine/ui/progress/progress-static.gc | 2 +- goal_src/jak1/engine/ui/text-h.gc | 2 + goal_src/jak1/levels/finalboss/robotboss.gc | 18 +- goal_src/jak1/pc/progress-pc.gc | 104 ++++++- 7 files changed, 263 insertions(+), 166 deletions(-) diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 0c0436ed01..6f6c8b943b 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1448,6 +1448,8 @@ (camera-controls-third-horz #x1005) (camera-controls-third-vert #x1006) (restore-defaults #x1007) + (disable-auto-save-query #x100d) + (disable-auto-save #x100e) (misc-options #x100f) (accessibility-options #x1010) (money-starburst #x1011) @@ -15714,6 +15716,8 @@ (credits) (quit-title) (flava-player) + (memcard-disable-auto-save) + (memcard-auto-save-disabled) ;; the last one! (max) @@ -26566,8 +26570,8 @@ (define-extern robotboss-set-dda (function none :behavior robotboss)) ;; TODO - what structure type does this return? (define-extern robotboss-cut-cam-exit (function none :behavior robotboss)) (define-extern robotboss-setup-for-hits (function int int object :behavior robotboss)) -(define-extern robotboss-yellow-eco-on (function entity-perm-status :behavior robotboss)) -(define-extern robotboss-yellow-eco-off (function entity-perm-status :behavior robotboss)) +(define-extern robotboss-yellow-eco-on (function none :behavior robotboss)) +(define-extern robotboss-yellow-eco-off (function none :behavior robotboss)) (define-extern robotboss-greenshot (function vector float int symbol none :behavior robotboss)) (define-extern robotboss-handler (function process int symbol event-message-block object :behavior robotboss)) (define-extern robotboss-darkecobomb (function vector float (pointer part-tracker) :behavior robotboss)) diff --git a/game/assets/jak1/text/game_text_en.gs b/game/assets/jak1/text/game_text_en.gs index 7c10a25ee1..2a5bcaf420 100644 --- a/game/assets/jak1/text/game_text_en.gs +++ b/game/assets/jak1/text/game_text_en.gs @@ -1,7 +1,20 @@ (group-name "common") -(language-id 0 6) ;; english and uk-english +(language-id 0 6) ;; this file is for both english and uk-english (text-version jak1-v2) +;; ----------------- +;; memcard overrides lol + +(#x0138 + "PLEASE DO NOT REMOVE OR INSERT ANY PERIPHERALS, TURN OFF YOUR SYSTEM OR SHUT DOWN THE GAME" + "PLEASE DO NOT REMOVE OR INSERT ANY PERIPHERALS, TURN OFF YOUR SYSTEM OR SHUT DOWN THE GAME" + ) + +(#x0161 + "WHILE THIS ICON IS ON SCREEN, DO NOT REMOVE OR INSERT ANY PERIPHERALS, TURN OFF YOUR SYSTEM OR SHUT DOWN THE GAME" + "WHILE THIS ICON IS ON SCREEN, DO NOT REMOVE OR INSERT ANY PERIPHERALS, TURN OFF YOUR SYSTEM OR SHUT DOWN THE GAME" + ) + ;; ----------------- ;; progress menu (insanity) @@ -22,6 +35,10 @@ (#x1007 "RESTORE DEFAULTS" "RESTORE DEFAULTS") +(#x100d "ARE YOU SURE YOU WANT TO DISABLE AUTO-SAVE?" + "ARE YOU SURE YOU WANT TO DISABLE AUTO-SAVE?") +(#x100e "DISABLE AUTO-SAVE" + "DISABLE AUTO-SAVE") (#x100f "MISCELLANEOUS" "MISCELLANEOUS") diff --git a/goal_src/jak1/engine/ui/progress-h.gc b/goal_src/jak1/engine/ui/progress-h.gc index d16e803fa4..ba12f32345 100644 --- a/goal_src/jak1/engine/ui/progress-h.gc +++ b/goal_src/jak1/engine/ui/progress-h.gc @@ -8,150 +8,152 @@ ;; PC port adds new menus and option types (#cond ((not PC_PORT) - (defenum progress-screen - :type int64 - (invalid -1) - (fuel-cell 0) - (money 1) - (buzzer 2) - (settings 3) - (game-settings 4) - (graphic-settings 5) - (sound-settings 6) - (memcard-no-space 7) - (memcard-not-inserted 8) - (memcard-not-formatted 9) - (memcard-format 10) - (memcard-data-exists 11) - (memcard-loading 12) - (memcard-saving 13) - (memcard-formatting 14) - (memcard-creating 15) - (load-game 16) - (save-game 17) - (save-game-title 18) - (memcard-insert 19) - (memcard-error-loading 20) - (memcard-error-saving 21) - (memcard-removed 22) - (memcard-no-data 23) - (memcard-error-formatting 24) - (memcard-error-creating 25) - (memcard-auto-save-error 26) - (title 27) - (settings-title 28) - (auto-save 29) - (pal-change-to-60hz 30) - (pal-now-60hz 31) - (no-disc 32) - (bad-disc 33) - (quit 34) - (max 35) - ) +(defenum progress-screen + :type int64 + (invalid -1) + (fuel-cell 0) + (money 1) + (buzzer 2) + (settings 3) + (game-settings 4) + (graphic-settings 5) + (sound-settings 6) + (memcard-no-space 7) + (memcard-not-inserted 8) + (memcard-not-formatted 9) + (memcard-format 10) + (memcard-data-exists 11) + (memcard-loading 12) + (memcard-saving 13) + (memcard-formatting 14) + (memcard-creating 15) + (load-game 16) + (save-game 17) + (save-game-title 18) + (memcard-insert 19) + (memcard-error-loading 20) + (memcard-error-saving 21) + (memcard-removed 22) + (memcard-no-data 23) + (memcard-error-formatting 24) + (memcard-error-creating 25) + (memcard-auto-save-error 26) + (title 27) + (settings-title 28) + (auto-save 29) + (pal-change-to-60hz 30) + (pal-now-60hz 31) + (no-disc 32) + (bad-disc 33) + (quit 34) + (max 35) + ) - (defenum game-option-type - :type uint64 - (slider 0) - (language 1) - (on-off 2) - (center-screen 3) - (aspect-ratio 4) - (video-mode 5) - (menu 6) - (yes-no 7) - (button 8) - ) +(defenum game-option-type + :type uint64 + (slider 0) + (language 1) + (on-off 2) + (center-screen 3) + (aspect-ratio 4) + (video-mode 5) + (menu 6) + (yes-no 7) + (button 8) + ) ) (#t - (defenum progress-screen - :type int64 - (invalid -1) - (fuel-cell 0) - (money 1) - (buzzer 2) - (settings 3) - (game-settings 4) - (graphic-settings 5) - (sound-settings 6) - (memcard-no-space 7) - (memcard-not-inserted 8) - (memcard-not-formatted 9) - (memcard-format 10) - (memcard-data-exists 11) - (memcard-loading 12) - (memcard-saving 13) - (memcard-formatting 14) - (memcard-creating 15) - (load-game 16) - (save-game 17) - (save-game-title 18) - (memcard-insert 19) - (memcard-error-loading 20) - (memcard-error-saving 21) - (memcard-removed 22) - (memcard-no-data 23) - (memcard-error-formatting 24) - (memcard-error-creating 25) - (memcard-auto-save-error 26) - (title 27) - (settings-title 28) - (auto-save 29) - (pal-change-to-60hz 30) - (pal-now-60hz 31) - (no-disc 32) - (bad-disc 33) - (quit 34) +(defenum progress-screen + :type int64 + (invalid -1) + (fuel-cell 0) + (money 1) + (buzzer 2) + (settings 3) + (game-settings 4) + (graphic-settings 5) + (sound-settings 6) + (memcard-no-space 7) + (memcard-not-inserted 8) + (memcard-not-formatted 9) + (memcard-format 10) + (memcard-data-exists 11) + (memcard-loading 12) + (memcard-saving 13) + (memcard-formatting 14) + (memcard-creating 15) + (load-game 16) + (save-game 17) + (save-game-title 18) + (memcard-insert 19) + (memcard-error-loading 20) + (memcard-error-saving 21) + (memcard-removed 22) + (memcard-no-data 23) + (memcard-error-formatting 24) + (memcard-error-creating 25) + (memcard-auto-save-error 26) + (title 27) + (settings-title 28) + (auto-save 29) + (pal-change-to-60hz 30) + (pal-now-60hz 31) + (no-disc 32) + (bad-disc 33) + (quit 34) - ;; extra screens for pc port - (camera-options) - (accessibility-options) - (game-ps2-options) - (misc-options) - (resolution) - (aspect-msg) - (aspect-ratio) - (gfx-ps2-options) - (secrets) - (hint-log) - (cheats) - (scrapbook) - (music-player) - (scene-player) - (credits) - (quit-title) - (flava-player) + ;; extra screens for pc port + (camera-options) + (accessibility-options) + (game-ps2-options) + (misc-options) + (resolution) + (aspect-msg) + (aspect-ratio) + (gfx-ps2-options) + (secrets) + (hint-log) + (cheats) + (scrapbook) + (music-player) + (scene-player) + (credits) + (quit-title) + (flava-player) + (memcard-disable-auto-save) + (memcard-auto-save-disabled) - ;; the last one! - (max) - ) + ;; the last one! + (max) + ) - (defenum game-option-type - :type uint64 - (slider 0) - (language 1) - (on-off 2) - (center-screen 3) - (aspect-ratio 4) - (video-mode 5) - (menu 6) - (yes-no 7) - (button 8) +(defenum game-option-type + :type uint64 + (slider 0) + (language 1) + (on-off 2) + (center-screen 3) + (aspect-ratio 4) + (video-mode 5) + (menu 6) + (yes-no 7) + (button 8) - ;; extra types for pc port - (normal-inverted) - (display-mode) - (msaa) - (frame-rate) - (lod-bg) - (lod-fg) - (resolution) - (aspect-new) - (language-subtitles) - (speaker) - (aspect-native) - (button-music) - (button-flava) - ) + ;; extra types for pc port + (normal-inverted) + (display-mode) + (msaa) + (frame-rate) + (lod-bg) + (lod-fg) + (resolution) + (aspect-new) + (language-subtitles) + (speaker) + (aspect-native) + (button-music) + (button-flava) + ) ) ) diff --git a/goal_src/jak1/engine/ui/progress/progress-static.gc b/goal_src/jak1/engine/ui/progress/progress-static.gc index bdbde6947c..a7be91aa82 100644 --- a/goal_src/jak1/engine/ui/progress/progress-static.gc +++ b/goal_src/jak1/engine/ui/progress/progress-static.gc @@ -151,7 +151,7 @@ ) ;; maps options to a progress screen -(define *options-remap* (new 'static 'boxed-array :type (array game-option) :length 0 :allocated-length (#if (not PC_PORT) 35 50))) +(define *options-remap* (new 'static 'boxed-array :type (array game-option) :length 0 :allocated-length (#if (not PC_PORT) 35 60))) ;; TODO probably an enum. ;; maps level-info indices to the appropriate offset in *level-task-data* diff --git a/goal_src/jak1/engine/ui/text-h.gc b/goal_src/jak1/engine/ui/text-h.gc index 9283fecf40..f65e3b3995 100644 --- a/goal_src/jak1/engine/ui/text-h.gc +++ b/goal_src/jak1/engine/ui/text-h.gc @@ -598,6 +598,8 @@ (camera-controls-third-horz #x1005) (camera-controls-third-vert #x1006) (restore-defaults #x1007) + (disable-auto-save-query #x100d) + (disable-auto-save #x100e) (misc-options #x100f) (accessibility-options #x1010) (money-starburst #x1011) diff --git a/goal_src/jak1/levels/finalboss/robotboss.gc b/goal_src/jak1/levels/finalboss/robotboss.gc index 5be604ab7c..e93493b335 100644 --- a/goal_src/jak1/levels/finalboss/robotboss.gc +++ b/goal_src/jak1/levels/finalboss/robotboss.gc @@ -246,32 +246,28 @@ (defbehavior robotboss-yellow-eco-off robotboss () -;; These logclears are not present in the orignal game, this is to patch the one frame of ghost yellow eco bug that can -;; occcur under certain conditions when robot-boss-yellow-eco-off is called. + ;; patches the one frame of ghost yellow eco bug that can + ;; occcur under certain conditions when robot-boss-yellow-eco-off is called. (#when PC_PORT (logclear! (-> self alts 7 extra perm status) (entity-perm-status bit-3)) (logclear! (-> self alts 8 extra perm status) (entity-perm-status bit-3)) (logclear! (-> self alts 9 extra perm status) (entity-perm-status bit-3)) (logclear! (-> self alts 10 extra perm status) (entity-perm-status bit-3)) - ) + ) (logior! (-> self alts 7 extra perm status) (entity-perm-status bit-9)) (logior! (-> self alts 8 extra perm status) (entity-perm-status bit-9)) (logior! (-> self alts 9 extra perm status) (entity-perm-status bit-9)) - (let ((v0-0 (logior (-> self alts 10 extra perm status) (entity-perm-status bit-9)))) - (set! (-> self alts 10 extra perm status) v0-0) - v0-0 - ) + (logior! (-> self alts 10 extra perm status) (entity-perm-status bit-9)) + (none) ) (defbehavior robotboss-yellow-eco-on robotboss () (logclear! (-> self alts 7 extra perm status) (entity-perm-status bit-9)) (logclear! (-> self alts 8 extra perm status) (entity-perm-status bit-9)) (logclear! (-> self alts 9 extra perm status) (entity-perm-status bit-9)) - (let ((v0-0 (logclear (-> self alts 10 extra perm status) (entity-perm-status bit-9)))) - (set! (-> self alts 10 extra perm status) v0-0) - v0-0 - ) + (logclear! (-> self alts 10 extra perm status) (entity-perm-status bit-9)) + (none) ) (defbehavior robotboss-anim-blend-loop robotboss ((arg0 art-joint-anim)) diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index d7a9d21594..75808bc58b 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -96,6 +96,18 @@ ;; pc menu defines +(define *main-options-auto-save* (new 'static 'boxed-array :type game-option + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id game-options) :scale #t :param3 (game-option-menu game-settings)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id graphic-options) :scale #t :param3 (game-option-menu graphic-settings)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id sound-options) :scale #t :param3 (game-option-menu sound-settings)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id load-game) :scale #t :param3 (game-option-menu load-game)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id save-game) :scale #t :param3 (game-option-menu save-game)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id disable-auto-save) :scale #t :param3 (game-option-menu memcard-disable-auto-save)) + (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id quit-game) :scale #t :param3 (game-option-menu quit)) + (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) + ) + ) + (define *game-options-pc* (new 'static 'boxed-array :type game-option ;(new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id vibrations) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id play-hints) :scale #t) @@ -582,17 +594,19 @@ (set! (-> *options-remap* (progress-screen bad-disc)) *ok-options*) (set! (-> *options-remap* (progress-screen quit)) *yes-no-options*) ;; our screens! - (set! (-> *options-remap* (progress-screen aspect-msg)) *yes-no-options*) - (set! (-> *options-remap* (progress-screen camera-options)) *camera-options*) - (set! (-> *options-remap* (progress-screen misc-options)) *misc-options*) - (set! (-> *options-remap* (progress-screen accessibility-options)) *accessibility-options*) - (set! (-> *options-remap* (progress-screen gfx-ps2-options)) *gfx-ps2-options*) - (set! (-> *options-remap* (progress-screen resolution)) *temp-options*) - (set! (-> *options-remap* (progress-screen aspect-ratio)) *aspect-ratio-options*) - (set! (-> *options-remap* (progress-screen quit-title)) *yes-no-options*) - (set! (-> *options-remap* (progress-screen secrets)) *secrets-options*) - (set! (-> *options-remap* (progress-screen music-player)) *music-player-options*) - (set! (-> *options-remap* (progress-screen flava-player)) *temp-options*) + (set! (-> *options-remap* (progress-screen aspect-msg)) *yes-no-options*) + (set! (-> *options-remap* (progress-screen camera-options)) *camera-options*) + (set! (-> *options-remap* (progress-screen misc-options)) *misc-options*) + (set! (-> *options-remap* (progress-screen accessibility-options)) *accessibility-options*) + (set! (-> *options-remap* (progress-screen gfx-ps2-options)) *gfx-ps2-options*) + (set! (-> *options-remap* (progress-screen resolution)) *temp-options*) + (set! (-> *options-remap* (progress-screen aspect-ratio)) *aspect-ratio-options*) + (set! (-> *options-remap* (progress-screen quit-title)) *yes-no-options*) + (set! (-> *options-remap* (progress-screen secrets)) *secrets-options*) + (set! (-> *options-remap* (progress-screen music-player)) *music-player-options*) + (set! (-> *options-remap* (progress-screen flava-player)) *temp-options*) + (set! (-> *options-remap* (progress-screen memcard-disable-auto-save)) *yes-no-options*) + (set! (-> *options-remap* (progress-screen memcard-auto-save-disabled)) *ok-options*) ;; set default params (set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio)) @@ -669,6 +683,11 @@ (((progress-screen flava-player)) (build-flava-player-options *progress-music*) ) + (((progress-screen settings)) + (if (-> *setting-control* default auto-save) + (set! (-> *options-remap* (progress-screen settings)) *main-options-auto-save*) + (set! (-> *options-remap* (progress-screen settings)) *main-options*)) + ) ) ;; run nav code (let ((options (-> *options-remap* (-> obj display-state)))) @@ -1056,7 +1075,7 @@ ;; restore default camera controls (reset-original-camera *pc-settings*) (sound-play "cursor-options") - ) + ) ) ;; other behaviors are hardcoded elsewhere because screw you. ) @@ -1371,6 +1390,7 @@ (progress-screen memcard-auto-save-error) (progress-screen memcard-removed) (progress-screen auto-save) + (progress-screen memcard-auto-save-disabled) ) (sound-play "cursor-options") (set! (-> obj next-display-state) (progress-screen invalid)) @@ -1455,6 +1475,19 @@ ) ) ) + (((progress-screen memcard-disable-auto-save)) + (cond + ((-> *progress-state* yes-no-choice) + (sound-play "start-options") + (set! (-> *setting-control* default auto-save) #f) + (set! (-> obj next-display-state) (progress-screen memcard-auto-save-disabled)) + ) + (else + (sound-play "cursor-options") + (set! (-> obj next-display-state) (progress-screen invalid)) + ) + ) + ) ) ) ) @@ -1790,6 +1823,39 @@ ) + +(defun draw-memcard-auto-save-disabled ((obj progress) (arg0 font-context)) + (set-scale! arg0 0.6) + (set-flags! arg0 (font-flags shadow kerning middle left large)) + (set-origin! arg0 (- 20 (-> obj left-x-offset)) 38) + (set-width! arg0 360) + (set-height! arg0 20) + (print-game-text-scaled (lookup-text! *common-text* (game-text-id autosave-disabled-title) #f) + (-> obj transition-percentage-invert) arg0 128) + (set! (-> arg0 origin y) 72.0) + (set-width! arg0 360) + (set-height! arg0 60) + (print-game-text-scaled (lookup-text! *common-text* (game-text-id autosave-disabled-msg) #f) + (-> obj transition-percentage-invert) arg0 128) + (set-scale! arg0 0.65) + (set! (-> arg0 origin y) 120.0) + (set-height! arg0 60) + (print-game-text-scaled (lookup-text! *common-text* (game-text-id continue?) #f) + (-> obj transition-percentage-invert) arg0 128) + + 0) + +(defun draw-memcard-disable-auto-save ((obj progress) (arg0 font-context)) + (set-origin! arg0 (- 50 (-> obj left-x-offset)) 70) + (set-scale! arg0 0.6) + (set-width! arg0 300) + (set-height! arg0 40) + (set-flags! arg0 (font-flags shadow kerning middle left large)) + (print-game-text-scaled (lookup-text! *common-text* (game-text-id disable-auto-save-query) #f) + (-> obj transition-percentage-invert) arg0 128) + + 0) + (defmethod draw-notice-screen progress ((obj progress)) (hide-progress-icons) (when *common-text* @@ -1855,6 +1921,12 @@ (((progress-screen quit) (progress-screen quit-title)) (draw-quit obj a1-1) ) + (((progress-screen memcard-disable-auto-save)) + (draw-memcard-disable-auto-save obj a1-1) + ) + (((progress-screen memcard-auto-save-disabled)) + (draw-memcard-auto-save-disabled obj a1-1) + ) ) ) ) @@ -1932,7 +2004,7 @@ (draw-notice-screen self) (draw-options self 192 0 0.82) ) - (((progress-screen memcard-no-data)) + (((progress-screen memcard-no-data) (progress-screen memcard-auto-save-disabled)) (draw-notice-screen self) (draw-options self 165 0 0.82) ) @@ -1963,7 +2035,9 @@ (draw-options self 170 0 0.82) ) ) - (((progress-screen quit) (progress-screen quit-title)) + (((progress-screen quit) + (progress-screen quit-title) + (progress-screen memcard-disable-auto-save)) (draw-notice-screen self) (draw-options self 110 0 0.82) ) @@ -2183,6 +2257,8 @@ (= v1-74 (progress-screen bad-disc)) (= v1-74 (progress-screen quit)) (= v1-74 (progress-screen quit-title)) + (= v1-74 (progress-screen memcard-auto-save-disabled)) + (= v1-74 (progress-screen memcard-disable-auto-save)) ) (respond-memcard self) )