From 6b6c9372779c46ed880bbffbb2980a40e214e49a Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Fri, 24 Jun 2022 05:43:57 +0100 Subject: [PATCH] make 60FPS always the default and add frame rate option to settings (#1533) * fix ogre joints * "frame rate" menu in options * dont start game at non-60fps * clang * make hint subtitles option do stuff --- decompiler/config/all-types.gc | 3 +++ game/assets/jak1/text/game_text_en.gs | 7 ++++-- game/kernel/kscheme.cpp | 2 +- goal_src/engine/ui/text-h.gc | 3 +++ goal_src/game.gp | 2 +- goal_src/levels/ogre/ogreboss.gc | 2 +- goal_src/pc/pckernel-h.gc | 2 +- goal_src/pc/pckernel.gc | 2 ++ goal_src/pc/progress-pc.gc | 32 ++++++++++++++++++++++----- goal_src/pc/subtitle.gc | 13 +++++++---- 10 files changed, 53 insertions(+), 15 deletions(-) diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index b96a3ee1f1..e31ec33049 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1343,6 +1343,9 @@ (8-times #x1054) (16-times #x1055) (frame-rate #x1060) + (60fps #x1061) + (100fps #x1062) + (150fps #x1063) (lod-bg #x1070) (lod-fg #x1071) (lod-highest #x1072) diff --git a/game/assets/jak1/text/game_text_en.gs b/game/assets/jak1/text/game_text_en.gs index dceec5e460..7d24c7b4dc 100644 --- a/game/assets/jak1/text/game_text_en.gs +++ b/game/assets/jak1/text/game_text_en.gs @@ -80,8 +80,11 @@ (#x1055 "16X" "16X") -(#x1060 "FRAME RATE" - "FRAME RATE") +(#x1060 "FRAME RATE (EXPERIMENTAL)" + "FRAME RATE (EXPERIMENTAL)") +(#x1061 "60" "60") +(#x1062 "100" "100") +(#x1063 "150" "150") (#x1070 "LEVEL OF DETAIL (BACKGROUND)" "LEVEL OF DETAIL (BACKGROUND)") diff --git a/game/kernel/kscheme.cpp b/game/kernel/kscheme.cpp index ee7f20184f..ab13763564 100644 --- a/game/kernel/kscheme.cpp +++ b/game/kernel/kscheme.cpp @@ -2006,7 +2006,7 @@ s32 InitHeapAndSymbol() { method_set_symbol->value = 0; // set *boot-video-mode* - intern_from_c("*boot-video-mode*")->value = (u32)BootVideoMode; + intern_from_c("*boot-video-mode*")->value = 0; // (u32)BootVideoMode; lg::info("Initialized GOAL heap in {:.2} ms", heap_init_timer.getMs()); // load the kernel! diff --git a/goal_src/engine/ui/text-h.gc b/goal_src/engine/ui/text-h.gc index b9176f120d..90bb3ce279 100644 --- a/goal_src/engine/ui/text-h.gc +++ b/goal_src/engine/ui/text-h.gc @@ -493,6 +493,9 @@ (8-times #x1054) (16-times #x1055) (frame-rate #x1060) + (60fps #x1061) + (100fps #x1062) + (150fps #x1063) (lod-bg #x1070) (lod-fg #x1071) (lod-highest #x1072) diff --git a/goal_src/game.gp b/goal_src/game.gp index 5a511eae61..079399bff3 100644 --- a/goal_src/game.gp +++ b/goal_src/game.gp @@ -133,7 +133,7 @@ (define *game-directory* (get-environment-variable "OPENGOAL_DECOMP_DIR" :default "jak1/")) (when (user? dass) - (set! *game-directory* "jak1_pal/")) + (set! *game-directory* "jak1_us2/")) (defmacro copy-texture (tpage-id) "Copy a texture from the game, using the given tpage ID" diff --git a/goal_src/levels/ogre/ogreboss.gc b/goal_src/levels/ogre/ogreboss.gc index 0103ed19fa..6853b0965c 100644 --- a/goal_src/levels/ogre/ogreboss.gc +++ b/goal_src/levels/ogre/ogreboss.gc @@ -1255,7 +1255,7 @@ ;; TODO non U1 v1 compatibility!! (let ((gp-0 (new 'stack-no-clear 'ogreboss-missile-init-data))) (let ((s5-0 (new 'stack-no-clear 'vector))) - (set! (-> gp-0 src) (-> self node-list data 52 bone transform vector 3)) + (set! (-> gp-0 src) (-> self node-list data (#if *jak1-full-game* 50 52) bone transform vector 3)) (set! (-> gp-0 duration) (the-as time-frame (the int (* 300.0 (+ 1.25 (* -0.25 (-> self level)) (/ 0.5 (-> self difficulty)))))) ) diff --git a/goal_src/pc/pckernel-h.gc b/goal_src/pc/pckernel-h.gc index 0435de59e8..392cf0e374 100644 --- a/goal_src/pc/pckernel-h.gc +++ b/goal_src/pc/pckernel-h.gc @@ -29,7 +29,7 @@ (defglobalconstant PC_KERNEL_VERSION_BUILD #x0001) -(defglobalconstant PC_KERNEL_VERSION_REVISION #x0005) +(defglobalconstant PC_KERNEL_VERSION_REVISION #x0006) (defglobalconstant PC_KERNEL_VERSION_MINOR #x0005) (defglobalconstant PC_KERNEL_VERSION_MAJOR #x0001) diff --git a/goal_src/pc/pckernel.gc b/goal_src/pc/pckernel.gc index 431d0af1ff..243b49bd0d 100644 --- a/goal_src/pc/pckernel.gc +++ b/goal_src/pc/pckernel.gc @@ -708,6 +708,7 @@ ) (("aspect-auto") (set! (-> obj aspect-ratio-auto?) (file-stream-read-symbol file))) (("aspect-game") (set! (-> *setting-control* default aspect-ratio) (file-stream-read-symbol file))) + (("video-mode") (set! (-> *setting-control* default video-mode) (file-stream-read-symbol file))) (("display-mode") (set-display-mode! obj (file-stream-read-symbol file))) (("letterbox") (set! (-> obj letterbox?) (file-stream-read-symbol file))) (("vsync") (set! (-> obj vsync?) (file-stream-read-symbol file))) @@ -824,6 +825,7 @@ (format file " (aspect-test ~D ~D)~%" (-> obj aspect-custom-x) (-> obj aspect-custom-y)) (format file " (aspect-auto ~A)~%" (-> obj aspect-ratio-auto?)) (format file " (aspect-game ~A)~%" (-> *setting-control* default aspect-ratio)) + (format file " (video-mode ~A)~%" (-> *setting-control* default video-mode)) (format file " (display-mode ~A)~%" (-> obj display-mode)) (format file " (letterbox ~A)~%" (-> obj letterbox?)) (format file " (vsync ~A)~%" (-> obj vsync?)) diff --git a/goal_src/pc/progress-pc.gc b/goal_src/pc/progress-pc.gc index 6074463acc..ee68c969f7 100644 --- a/goal_src/pc/progress-pc.gc +++ b/goal_src/pc/progress-pc.gc @@ -85,6 +85,7 @@ (def-progress-carousell *carousell-lod-fg* (lod-high lod-low lod-ps2)) (def-progress-carousell *carousell-subtitle-language* (english french german spanish italian japanese)) (def-progress-carousell *carousell-speaker* (speaker-always speaker-never speaker-auto)) +(def-progress-carousell *carousell-frame-rate* (60fps 100fps 150fps)) @@ -94,7 +95,7 @@ (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 vibrations) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id play-hints) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id camera-options) :scale #t :param3 (game-option-menu camera-options)) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id accessibility-options) :scale #t :param3 (game-option-menu accessibility-options)) @@ -109,8 +110,8 @@ (new 'static 'game-option :option-type (game-option-type aspect-native) :name (game-text-id ps2-aspect-ratio) :scale #t) (new 'static 'game-option :option-type (game-option-type aspect-ratio) :name (game-text-id aspect-ratio-ps2) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id aspect-ratio) :scale #t :param3 (game-option-menu aspect-ratio)) - (new 'static 'game-option :option-type (game-option-type msaa) :name (game-text-id msaa) :scale #t) - ;(new 'static 'game-option :option-type (game-option-type frame-rate) :name (game-text-id frame-rate) :scale #t) + ;(new 'static 'game-option :option-type (game-option-type msaa) :name (game-text-id msaa) :scale #t) + (new 'static 'game-option :option-type (game-option-type frame-rate) :name (game-text-id frame-rate) :scale #t) (new 'static 'game-option :option-type (game-option-type menu) :name (game-text-id ps2-options) :scale #t :param3 (game-option-menu gfx-ps2-options)) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) @@ -584,11 +585,12 @@ (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* 0 value-to-modify) (&-> *setting-control* default vibration)) - (set! (-> *game-options-pc* 1 value-to-modify) (&-> *setting-control* default play-hints)) + ;(set! (-> *game-options-pc* 0 value-to-modify) (&-> *setting-control* default vibration)) + (set! (-> *game-options-pc* 0 value-to-modify) (&-> *setting-control* default play-hints)) (set! (-> *graphic-options-pc* 1 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-pc* 2 value-to-modify) (&-> *progress-carousell* aspect-native-choice)) (set! (-> *graphic-options-pc* 3 value-to-modify) (&-> *progress-state* aspect-ratio-choice)) + ;(set! (-> *graphic-options-pc* 5 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *graphic-options-pc* 5 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *misc-options* 0 value-to-modify) (&-> *pc-settings* discord-rpc?)) (set! (-> *camera-options* 0 value-to-modify) (&-> *pc-settings* first-camera-h-inverted?)) @@ -731,6 +733,7 @@ (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) + (game-option-type frame-rate) ) ;; a carousell like language (if (> (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) 0) @@ -842,6 +845,7 @@ (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) + (game-option-type frame-rate) ) ;; same thing as before. if at last, go to first. otherwise, keep going forward. (if (< (-> (the-as (pointer int) (-> options (-> obj option-index) value-to-modify))) (1- (length (-> *progress-carousell* current-carousell)))) @@ -1104,6 +1108,13 @@ (('auto) (set! (-> *progress-carousell* int-backup) 2)) ) ) + (((game-option-type frame-rate)) + (case (-> *setting-control* default video-mode) + (('ntsc 'pal) (set! (-> *progress-carousell* int-backup) 0)) + (('100fps) (set! (-> *progress-carousell* int-backup) 1)) + (('150fps) (set! (-> *progress-carousell* int-backup) 2)) + ) + ) ) (sound-play "select-option") (cpad-clear! 0 x) @@ -1127,6 +1138,7 @@ (((game-option-type lod-bg)) (set! (-> *progress-carousell* current-carousell) *carousell-lod-bg*)) (((game-option-type lod-fg)) (set! (-> *progress-carousell* current-carousell) *carousell-lod-bg*)) (((game-option-type speaker)) (set! (-> *progress-carousell* current-carousell) *carousell-speaker*)) + (((game-option-type frame-rate)) (set! (-> *progress-carousell* current-carousell) *carousell-frame-rate*)) (((game-option-type language-subtitles)) (set! (-> *progress-carousell* current-carousell) *carousell-subtitle-language*) (set! (-> *progress-carousell* selection) (the int (-> (the-as (pointer pc-subtitle-lang) (-> options (-> obj option-index) value-to-modify))))) @@ -1197,6 +1209,14 @@ ((2) (set! (-> *pc-settings* subtitle-speaker?) 'auto)) ) ) + (((game-option-type frame-rate)) + (case (-> *progress-carousell* int-backup) + ((0) (set! (-> *setting-control* default video-mode) 'ntsc)) + ((1) (set! (-> *setting-control* default video-mode) '100fps)) + ((2) (set! (-> *setting-control* default video-mode) '150fps)) + ) + (set-video-mode (-> *setting-control* default video-mode)) + ) ) ) ) @@ -1554,6 +1574,7 @@ (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) + (game-option-type frame-rate) ) ;; crunched down to one generic function. (progress-draw-carousell-from-string-list (-> *progress-carousell* current-carousell) font y-off (-> (the-as (pointer int) (-> options index value-to-modify)))) @@ -1647,6 +1668,7 @@ (game-option-type lod-bg) (game-option-type lod-fg) (game-option-type speaker) + (game-option-type frame-rate) (game-option-type normal-inverted) ) ;; slider and aspect ratio options just show their text diff --git a/goal_src/pc/subtitle.gc b/goal_src/pc/subtitle.gc index 8ab76d980b..82cddb8813 100644 --- a/goal_src/pc/subtitle.gc +++ b/goal_src/pc/subtitle.gc @@ -140,7 +140,8 @@ (text-id game-text-id) (cur-channel pc-subtitle-channel) - (want-subtitle subtitle-keyframe) ;; the subtitle we want to display + (want-subtitle subtitle-keyframe) ;; the subtitle we want to display + (hint-subtitle? symbol) ) (:methods @@ -522,9 +523,10 @@ ) -(defun subtitle? () +(defun subtitle? ((hinttitles? symbol)) "can a subtitle be displayed right now?" - (and (-> *pc-settings* subtitles?) ;; subtitles enabled + (and (or (and (not hinttitles?) (-> *pc-settings* subtitles?)) ;; subtitles enabled + (and hinttitles? (-> *pc-settings* hinttitles?))) (or *debug-segment* (= *master-mode* 'game)) ;; current mode is game, OR we are just debugging (not *progress-process*) ;; no progress open ) @@ -556,6 +558,7 @@ (load-level-subtitle-files 0) ;; reset params (set! (-> self want-subtitle) (the subtitle-keyframe #f)) + (set! (-> self hint-subtitle?) #f) (set! (-> self spool-name) #f) (set! (-> self cur-channel) (pc-subtitle-channel invalid)) @@ -597,6 +600,7 @@ (case (-> self cur-channel) (((pc-subtitle-channel movie)) ;; cutscenes. get our cutscene. + (set! (-> self hint-subtitle?) #f) (awhen (get-scene-by-name *subtitle-text* (-> self cur-channel) (-> self spool-name)) ;; find out position in the scene. @@ -618,6 +622,7 @@ ) (((pc-subtitle-channel hint) (pc-subtitle-channel hint-named)) ;; hint! find it. or else. + (set! (-> self hint-subtitle?) #t) (awhen (if (= (-> self cur-channel) (pc-subtitle-channel hint-named)) (get-scene-by-name *subtitle-text* (-> self cur-channel) (-> self spool-name)) (get-scene-by-text-id *subtitle-text* (-> self cur-channel) (-> self text-id)) @@ -663,7 +668,7 @@ (set-height! (-> self font) (the int (* (-> *SUBTITLE-bank* lines) 11))) (set-scale! (-> self font) (-> *SUBTITLE-bank* scale)) - (when (and (-> self want-subtitle) (subtitle?)) + (when (and (-> self want-subtitle) (subtitle? (-> self hint-subtitle?))) ;; we got a valid subtitle! render it. (hide-bottom-hud) (print-game-subtitle (subtitle-format self (-> self want-subtitle)) (-> self font) #f 128 22)