diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index cffbbb020e..90f694b1d8 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -882,7 +882,7 @@ (heap-top pointer :offset-assert #x54) (heap-cur pointer :offset-assert #x58) (stack-frame-top stack-frame :offset-assert #x5c) - (connection-list connectable :inline :offset-assert #x60) + (connection-list connectable :inline :offset-assert #x60) ;; can be a connection (stack uint8 :dynamic :offset-assert #x70) ) (:methods @@ -5020,7 +5020,7 @@ ;; was manually done (deftype setting-data (structure) - ((border-mode basic :offset-assert 0) + ((border-mode symbol :offset-assert 0) (sfx-volume float :offset-assert 4) (music-volume float :offset-assert 8) (dialog-volume float :offset-assert 12) @@ -5029,8 +5029,8 @@ (language int64 :offset-assert 24) (screenx int32 :offset-assert 32) (screeny int32 :offset-assert 36) - (vibration basic :offset-assert 40) - (play-hints basic :offset-assert 44) + (vibration symbol :offset-assert 40) + (play-hints symbol :offset-assert 44) (movie (pointer process) :offset-assert 48) ;; special print (talking (pointer process) :offset-assert 52) ;; special print (spooling (pointer process) :offset-assert 56) ;; special print @@ -5039,21 +5039,21 @@ (video-mode symbol :offset-assert 68) (aspect-ratio symbol :offset-assert 72) ;; a guess but, anything besides this doesnt make sense (sound-flava uint8 :offset-assert 76) - (auto-save basic :offset-assert 80) + (auto-save symbol :offset-assert 80) (music-volume-movie float :offset-assert 84) (sfx-volume-movie float :offset-assert 88) - (music basic :offset-assert 92) + (music symbol :offset-assert 92) (bg-r float :offset-assert 96) (bg-g float :offset-assert 100) (bg-b float :offset-assert 104) (bg-a float :offset-assert 108) (bg-a-speed float :offset-assert 112) (bg-a-force float :offset-assert 116) - (allow-progress basic :offset-assert 120) - (allow-pause basic :offset-assert 124) + (allow-progress symbol :offset-assert 120) + (allow-pause symbol :offset-assert 124) (sound-flava-priority float :offset-assert 128) - (ocean-off basic :offset-assert 132) - (allow-look-around basic :offset-assert 136) + (ocean-off symbol :offset-assert 132) + (allow-look-around symbol :offset-assert 136) (ambient-volume float :offset-assert 140) (ambient-volume-movie float :offset-assert 144) (dialog-volume-hint float :offset-assert 148) @@ -5063,7 +5063,7 @@ :size-assert #xc4 :flag-assert #xa000000c4 (:methods - (dummy-9 () none 9) + (handle-pending-updates (_type_ engine) setting-data 9) ) ) @@ -5078,11 +5078,11 @@ :flag-assert #xe00000278 (:methods (new (symbol type int) _type_ 0) - (dummy-9 () none 9) - (dummy-10 (_type_ process symbol symbol float int) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) + (push-setting! (_type_ process (function object object object object object) object object object) none 9) + (set-setting! (_type_ process symbol symbol float int) none 10) + (clear-pending-settings-from-process (_type_ process symbol) none 11) + (copy-settings-from-target! (_type_) setting-data 12) + (update-per-frame-settings! (_type_) setting-data 13) ) ) @@ -16155,10 +16155,10 @@ ;; - Unknowns -;;(define-extern scf-get-volume object) ;; unknown type -;;(define-extern scf-get-language object) ;; unknown type -;;(define-extern scf-get-aspect object) ;; unknown type -;;(define-extern *boot-video-mode* object) ;; unknown type +(define-extern scf-get-volume (function int)) +(define-extern scf-get-language (function uint)) +(define-extern scf-get-aspect (function uint)) +(define-extern *boot-video-mode* int) ;; TODO - a guess ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 8de1d53d2e..f694812c13 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -691,10 +691,6 @@ "(method 11 drawable-inline-array-collide-fragment)": [ [[1, 5], "v1", "collide-fragment"] ], - - "generic-init-buffers": [ - [[39, 44], "v1", "dma-packet"] - ], "main-cheats": [ [1221, "t9", "(function cpu-thread function none)"] @@ -711,5 +707,67 @@ [[29, 55], "s2", "drawable-tree-tfrag"], [[121, 146], "s1", "drawable-inline-array-tfrag"], [[150, 151], "s1", "drawable-tree-instance-tie"] + ], + + "(method 11 setting-control)": [ + [[3, 25], "s4", "connection"] + ], + + "(method 9 setting-data)": [ + [[4, 345], "s3", "connection"], + [[9, 12], "v1", "symbol"], + [[14, 17], "v1", "symbol"], + [[19, 22], "v1", "symbol"], + [[24, 27], "v1", "symbol"], + [[29, 32], "v1", "symbol"], + [[33, 35], "a0", "int"], + [[40, 45], "a0", "uint"], + [[47, 49], "v1", "int"], + [[68, 71], "v1", "symbol"], + [[72, 78], "v1", "float"], + [[80, 83], "v1", "float"], + [[87, 90], "v1", "symbol"], + [[91, 97], "v1", "float"], + [[99, 102], "v1", "float"], + [[106, 109], "v1", "symbol"], + [[110, 116], "v1", "float"], + [[118, 121], "v1", "float"], + [[125, 128], "v1", "symbol"], + [[129, 135], "v1", "float"], + [[137, 140], "v1", "float"], + [[144, 147], "v1", "symbol"], + [[148, 154], "v1", "float"], + [[156, 159], "v1", "float"], + [[163, 166], "v1", "symbol"], + [[167, 173], "v1", "float"], + [[175, 178], "v1", "float"], + [[182, 185], "v1", "symbol"], + [[186, 192], "v1", "float"], + [[194, 197], "v1", "float"], + [[201, 204], "v1", "symbol"], + [[205, 211], "v1", "float"], + [[213, 216], "v1", "float"], + [[220, 223], "v1", "float"], + [[224, 226], "v1", "int"], + [[226, 229], "v1", "float"], + [[233, 236], "v1", "float"], + [[240, 243], "v1", "float"], + [[247, 250], "v1", "float"], + [[254, 257], "v1", "float"], + [[261, 264], "v1", "float"], + [[268, 271], "v1", "float"], + [[275, 277], "v1", "int"], + [[280, 282], "v1", "symbol"], + [[285, 287], "v1", "symbol"], + [[290, 293], "v1", "symbol"], + [[295, 298], "v1", "symbol"], + [[300, 303], "v1", "symbol"], + [[305, 308], "v1", "(pointer progress)"], + [[310, 313], "v1", "(pointer progress)"], + [[315, 318], "v1", "(pointer progress)"], + [[325, 328], "v1", "(pointer progress)"], + [[330, 333], "v1", "symbol"], + [[334, 337], "a0", "int"], + [[341, 344], "a0", "uint"] ] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 47852f8f21..4e480a9711 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -2095,5 +2095,11 @@ "s2-1":"current-drawable", "s1-0":"idx-in-drawable" } + }, + + "(method 9 setting-data)": { + "vars": { + "s3-0": ["conn", "connection"] + } } } diff --git a/goal_src/engine/game/settings-h.gc b/goal_src/engine/game/settings-h.gc index 88c37a7c45..314e76be89 100644 --- a/goal_src/engine/game/settings-h.gc +++ b/goal_src/engine/game/settings-h.gc @@ -7,50 +7,50 @@ ;; was manually done (deftype setting-data (structure) - ((border-mode basic :offset-assert 0) - (sfx-volume float :offset-assert 4) - (music-volume float :offset-assert 8) - (dialog-volume float :offset-assert 12) - (process-mask uint32 :offset-assert 16) - (common-page int32 :offset-assert 20) - (language int64 :offset-assert 24) - (screenx int32 :offset-assert 32) - (screeny int32 :offset-assert 36) - (vibration basic :offset-assert 40) - (play-hints basic :offset-assert 44) - (movie (pointer process) :offset-assert 48) ;; special print - (talking (pointer process) :offset-assert 52) ;; special print - (spooling (pointer process) :offset-assert 56) ;; special print - (hint (pointer process) :offset-assert 60) ;; special print - (ambient (pointer process) :offset-assert 64) ;; special print - (video-mode symbol :offset-assert 68) - (aspect-ratio symbol :offset-assert 72) - (sound-flava uint8 :offset-assert 76) - (auto-save basic :offset-assert 80) - (music-volume-movie float :offset-assert 84) - (sfx-volume-movie float :offset-assert 88) - (music basic :offset-assert 92) - (bg-r float :offset-assert 96) - (bg-g float :offset-assert 100) - (bg-b float :offset-assert 104) - (bg-a float :offset-assert 108) - (bg-a-speed float :offset-assert 112) - (bg-a-force float :offset-assert 116) - (allow-progress basic :offset-assert 120) - (allow-pause basic :offset-assert 124) - (sound-flava-priority float :offset-assert 128) - (ocean-off basic :offset-assert 132) - (allow-look-around basic :offset-assert 136) - (ambient-volume float :offset-assert 140) - (ambient-volume-movie float :offset-assert 144) - (dialog-volume-hint float :offset-assert 148) - (dummy uint32 11 :offset-assert 152) + ((border-mode symbol :offset-assert 0) + (sfx-volume float :offset-assert 4) + (music-volume float :offset-assert 8) + (dialog-volume float :offset-assert 12) + (process-mask uint32 :offset-assert 16) + (common-page int32 :offset-assert 20) + (language int64 :offset-assert 24) + (screenx int32 :offset-assert 32) + (screeny int32 :offset-assert 36) + (vibration symbol :offset-assert 40) + (play-hints symbol :offset-assert 44) + (movie (pointer process) :offset-assert 48) + (talking (pointer process) :offset-assert 52) + (spooling (pointer process) :offset-assert 56) + (hint (pointer process) :offset-assert 60) + (ambient (pointer process) :offset-assert 64) + (video-mode symbol :offset-assert 68) + (aspect-ratio symbol :offset-assert 72) + (sound-flava uint8 :offset-assert 76) + (auto-save symbol :offset-assert 80) + (music-volume-movie float :offset-assert 84) + (sfx-volume-movie float :offset-assert 88) + (music symbol :offset-assert 92) + (bg-r float :offset-assert 96) + (bg-g float :offset-assert 100) + (bg-b float :offset-assert 104) + (bg-a float :offset-assert 108) + (bg-a-speed float :offset-assert 112) + (bg-a-force float :offset-assert 116) + (allow-progress symbol :offset-assert 120) + (allow-pause symbol :offset-assert 124) + (sound-flava-priority float :offset-assert 128) + (ocean-off symbol :offset-assert 132) + (allow-look-around symbol :offset-assert 136) + (ambient-volume float :offset-assert 140) + (ambient-volume-movie float :offset-assert 144) + (dialog-volume-hint float :offset-assert 148) + (dummy uint32 11 :offset-assert 152) ) :method-count-assert 10 :size-assert #xc4 :flag-assert #xa000000c4 (:methods - (dummy-9 () none 9) + (handle-pending-updates (_type_ engine) setting-data 9) ) ) @@ -98,7 +98,7 @@ ) (deftype setting-control (basic) - ((current setting-data :inline :offset-assert 16) + ((current setting-data :inline :offset-assert 16) (target setting-data :inline :offset-assert 224) (default setting-data :inline :offset-assert 432) (engine engine :offset-assert 628) @@ -107,13 +107,13 @@ :size-assert #x278 :flag-assert #xe00000278 (:methods - (new (symbol type int) _type_ 0) - (dummy-9 () none 9) - (dummy-10 (_type_ process symbol symbol float int) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) - ) + (new (symbol type int) _type_ 0) + (push-setting! (_type_ process (function object object object object object) object object object) none 9) + (set-setting! (_type_ process symbol symbol float int) none 10) + (clear-pending-settings-from-process (_type_ process symbol) none 11) + (copy-settings-from-target! (_type_) setting-data 12) + (update-per-frame-settings! (_type_) setting-data 13) + ) ) (defmethod new setting-control ((allocation symbol) (type-to-make type) (max-connections int)) @@ -141,3 +141,11 @@ :size-assert #x8 :flag-assert #x900000008 ) + +(define-extern *setting-control* setting-control) + +;; TODO - defined in the kernel +(define-extern scf-get-volume (function int)) +(define-extern scf-get-language (function uint)) +(define-extern scf-get-aspect (function uint)) +(define-extern *boot-video-mode* int) diff --git a/goal_src/engine/game/settings.gc b/goal_src/engine/game/settings.gc index 4f3475ca56..10cb2b8604 100644 --- a/goal_src/engine/game/settings.gc +++ b/goal_src/engine/game/settings.gc @@ -5,5 +5,615 @@ ;; name in dgo: settings ;; dgos: GAME, ENGINE -;; TODO - for video -(define-extern *setting-control* setting-control) +;; definition for method 9 of type setting-data +(defmethod handle-pending-updates setting-data ((obj setting-data) (arg0 engine)) + "this goes through the list of pending setting changes in + the engine/connection list and updates the setting-data" + (let ((conn (the-as connection (-> arg0 alive-list-end))) + (s4-0 (-> arg0 alive-list-end prev0)) + ) + (while (!= (the-as connectable conn) (-> arg0 alive-list)) + (let ((v1-1 (-> conn param0))) + (cond + ((= v1-1 'border-mode) + (set! (-> obj border-mode) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'allow-look-around) + (set! (-> obj allow-look-around) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'ocean-off) + (set! (-> obj ocean-off) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'music) + (set! (-> obj music) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'process-mask) + (let ((v1-6 (-> conn param1))) + (cond + ((= (the-as symbol v1-6) 'set) + (set! + (-> obj process-mask) + (logior + (-> obj process-mask) + (the-as uint (the-as int (-> conn param3))) + ) + ) + ) + ((= v1-6 'clear) + (set! + (-> obj process-mask) + (logand + (-> obj process-mask) + (the-as uint (lognot (the-as uint (-> conn param3)))) + ) + ) + ) + ((= v1-6 'abs) + (set! + (-> obj process-mask) + (the-as uint (the-as int (-> conn param3))) + ) + ) + ) + ) + ) + ((= v1-1 'sfx-volume) + (when + (or + (zero? + (logand + (-> *kernel-context* prevent-from-run) + (process-mask progress) + ) + ) + (let ((v1-18 (get-process conn)) + (a0-22 *progress-process*) + ) + (= v1-18 (if a0-22 + (-> a0-22 0 self) + ) + ) + ) + ) + (let ((v1-20 (the-as symbol (-> conn param1)))) + (if (= v1-20 'rel) + (set! + (-> obj sfx-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume)) + ) + (set! (-> obj sfx-volume) (the-as float (-> conn param2))) + ) + ) + ) + ) + ((= v1-1 'music-volume) + (let ((v1-25 (the-as symbol (-> conn param1)))) + (if (= v1-25 'rel) + (set! + (-> obj music-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj music-volume)) + ) + (set! (-> obj music-volume) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'ambient-volume) + (let ((v1-30 (the-as symbol (-> conn param1)))) + (if (= v1-30 'rel) + (set! + (-> obj ambient-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj ambient-volume)) + ) + (set! (-> obj ambient-volume) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'dialog-volume) + (let ((v1-35 (the-as symbol (-> conn param1)))) + (if (= v1-35 'rel) + (set! + (-> obj dialog-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj dialog-volume)) + ) + (set! (-> obj dialog-volume) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'sfx-volume-movie) + (let ((v1-40 (the-as symbol (-> conn param1)))) + (if (= v1-40 'rel) + (set! + (-> obj sfx-volume-movie) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume-movie)) + ) + (set! (-> obj sfx-volume-movie) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'music-volume-movie) + (let ((v1-45 (the-as symbol (-> conn param1)))) + (if (= v1-45 'rel) + (set! + (-> obj music-volume-movie) + (* + (* 0.01 (the-as float (-> conn param2))) + (-> obj music-volume-movie) + ) + ) + (set! (-> obj music-volume-movie) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'ambient-volume-movie) + (let ((v1-50 (the-as symbol (-> conn param1)))) + (if (= v1-50 'rel) + (set! + (-> obj ambient-volume-movie) + (* + (* 0.01 (the-as float (-> conn param2))) + (-> obj ambient-volume-movie) + ) + ) + (set! (-> obj ambient-volume-movie) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'dialog-volume-hint) + (let ((v1-55 (the-as symbol (-> conn param1)))) + (if (= v1-55 'rel) + (set! + (-> obj dialog-volume-hint) + (* + (* 0.01 (the-as float (-> conn param2))) + (-> obj dialog-volume-hint) + ) + ) + (set! (-> obj dialog-volume-hint) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'sound-flava) + (when (>= (the-as float (-> conn param2)) (-> obj sound-flava-priority)) + (set! (-> obj sound-flava) (the-as uint (the-as int (-> conn param3)))) + (set! (-> obj sound-flava-priority) (the-as float (-> conn param2))) + ) + ) + ((= v1-1 'bg-r) + (set! (-> obj bg-r) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-g) + (set! (-> obj bg-g) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-b) + (set! (-> obj bg-b) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-a) + (set! (-> obj bg-a) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-a-speed) + (set! (-> obj bg-a-speed) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-a-force) + (set! (-> obj bg-a-force) (the-as float (-> conn param2))) + ) + ((= v1-1 'language) + (set! (-> obj language) (the-as int (-> conn param3))) + ) + ((= v1-1 'vibration) + (set! (-> obj vibration) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'auto-save) + (set! (-> obj auto-save) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'allow-pause) + (set! (-> obj allow-pause) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'allow-progress) + (set! (-> obj allow-progress) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'play-hints) + (set! (-> obj play-hints) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'movie) + (set! (-> obj movie) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'talking) + (set! (-> obj talking) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'spooling) + (set! (-> obj spooling) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'hint) + (set! (-> obj hint) (the-as (pointer process) (-> conn param1))) + ) + ((= v1-1 'ambient) + (set! (-> obj ambient) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'common-page) + (let ((v1-89 (-> conn param1))) + (cond + ((= (the-as symbol v1-89) 'set) + (set! + (-> obj common-page) + (logior (-> obj common-page) (the-as int (-> conn param3))) + ) + ) + ((= v1-89 'clear) + (set! + (-> obj common-page) + (logand + (-> obj common-page) + (the-as int (the-as uint (lognot (the-as uint (-> conn param3))))) + ) + ) + ) + ) + ) + ) + ) + ) + (set! conn (the-as connection s4-0)) + (set! s4-0 (-> (the-as connectable conn) prev0)) + ) + ) + obj + ) + +;; definition for method 9 of type setting-control +;; INFO: Return type mismatch int vs none. +(defmethod + push-setting! + setting-control + ((obj setting-control) + (arg0 process) + (arg1 (function object object object object object)) + (arg2 object) + (arg3 object) + (arg4 object) + ) + (add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4) + 0 + (none) + ) + +;; definition for method 10 of type setting-control +;; INFO: Return type mismatch int vs none. +(defmethod + set-setting! + setting-control + ((obj setting-control) + (arg0 process) + (arg1 symbol) + (arg2 symbol) + (arg3 float) + (arg4 int) + ) + (clear-pending-settings-from-process obj arg0 arg1) + (add-connection + (-> obj engine) + arg0 + (the-as (function object object object object object) arg1) + arg2 + arg3 + arg4 + ) + 0 + (none) + ) + +;; definition for method 11 of type setting-control +;; INFO: Return type mismatch int vs none. +(defmethod + clear-pending-settings-from-process + setting-control + ((obj setting-control) (arg0 process) (arg1 symbol)) + (when arg0 + (let ((s5-0 (-> obj engine)) + (s4-0 (-> arg0 connection-list next1)) + ) + (while s4-0 + (if + (and + ((method-of-type connection belongs-to-engine?) + (the-as connection s4-0) + s5-0 + ) + (or (= arg1 #t) (= arg1 (-> (the-as connection s4-0) param0))) + ) + ((method-of-type connection move-to-dead) (the-as connection s4-0)) + ) + (set! s4-0 (-> s4-0 next1)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type setting-control +(defmethod copy-settings-from-target! setting-control ((obj setting-control)) + (let ((gp-0 (-> obj current))) + (let ((s5-0 (-> obj target))) + (mem-copy! (the-as pointer s5-0) (the-as pointer (-> obj default)) 196) + (set! + (-> s5-0 ambient-volume) + (* (* 0.01 (-> obj default ambient-volume)) (-> obj default sfx-volume)) + ) + (handle-pending-updates s5-0 (-> obj engine)) + (set! (-> gp-0 border-mode) (-> s5-0 border-mode)) + (set! (-> gp-0 common-page) (-> s5-0 common-page)) + (set! (-> gp-0 vibration) (-> s5-0 vibration)) + (set! (-> gp-0 auto-save) (-> s5-0 auto-save)) + (set! (-> gp-0 play-hints) (-> s5-0 play-hints)) + (set! (-> gp-0 movie) (-> s5-0 movie)) + (set! (-> gp-0 talking) (-> s5-0 talking)) + (set! (-> gp-0 spooling) (-> s5-0 spooling)) + (set! (-> gp-0 hint) (-> s5-0 hint)) + (set! (-> gp-0 ambient) (-> s5-0 ambient)) + (set! (-> gp-0 allow-pause) (-> s5-0 allow-pause)) + (set! (-> gp-0 allow-progress) (-> s5-0 allow-progress)) + (set! (-> gp-0 allow-look-around) (-> s5-0 allow-look-around)) + (set! (-> gp-0 ocean-off) (-> s5-0 ocean-off)) + (set! (-> gp-0 ambient-volume-movie) (-> s5-0 ambient-volume-movie)) + (set! (-> gp-0 music-volume-movie) (-> s5-0 music-volume-movie)) + (set! (-> gp-0 sfx-volume-movie) (-> s5-0 sfx-volume-movie)) + (set! (-> gp-0 dialog-volume-hint) (-> s5-0 dialog-volume-hint)) + (set! (-> gp-0 process-mask) (-> s5-0 process-mask)) + ) + (set! + (-> *kernel-context* prevent-from-run) + (the-as process-mask (-> gp-0 process-mask)) + ) + gp-0 + ) + ) + +;; definition for method 13 of type setting-control +(defmethod update-per-frame-settings! setting-control ((obj setting-control)) + (copy-settings-from-target! obj) + (let ((gp-0 (-> obj current))) + (let ((s5-1 (-> obj target))) + (when *sound-player-enable* + (when (!= (-> gp-0 sfx-volume) (-> s5-1 sfx-volume)) + (set! + (-> gp-0 sfx-volume) + (seek + (-> gp-0 sfx-volume) + (-> s5-1 sfx-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 1) (-> gp-0 sfx-volume)) + ) + (when (!= (-> gp-0 music-volume) (-> s5-1 music-volume)) + (set! + (-> gp-0 music-volume) + (seek + (-> gp-0 music-volume) + (-> s5-1 music-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 2) (-> gp-0 music-volume)) + ) + (when (!= (-> gp-0 dialog-volume) (-> s5-1 dialog-volume)) + (set! + (-> gp-0 dialog-volume) + (seek + (-> gp-0 dialog-volume) + (-> s5-1 dialog-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 4) (-> gp-0 dialog-volume)) + ) + (when (!= (-> gp-0 ambient-volume) (-> s5-1 ambient-volume)) + (set! + (-> gp-0 ambient-volume) + (seek + (-> gp-0 ambient-volume) + (-> s5-1 ambient-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 16) (-> gp-0 ambient-volume)) + ) + ) + (when (!= (-> gp-0 language) (-> s5-1 language)) + (set! (-> gp-0 language) (-> s5-1 language)) + (set-language (-> gp-0 language)) + ) + (when + (and + (!= (-> s5-1 music) (-> gp-0 music)) + (and + (< 0.0 (-> *setting-control* current music-volume)) + (zero? (rpc-busy? 1)) + *sound-bank-1* + *sound-bank-2* + ) + ) + (cond + ((-> s5-1 music) + (format 0 "Load music ~A~%" (-> s5-1 music)) + (sound-music-load (string->sound-name (symbol->string (-> s5-1 music)))) + ) + (else + (format 0 "Unload music~%") + (sound-music-unload) + ) + ) + (set! (-> gp-0 music) (-> s5-1 music)) + ) + (set! + (-> s5-1 sound-flava) + (the-as + uint + (flava-lookup (-> gp-0 music) (the-as int (-> s5-1 sound-flava))) + ) + ) + (set! (-> gp-0 sound-flava) (-> s5-1 sound-flava)) + (if *sound-player-enable* + (sound-set-flava (-> gp-0 sound-flava)) + ) + (when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio)) + (set! (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio)) + (set-aspect-ratio (-> gp-0 aspect-ratio)) + ) + (when (!= (-> gp-0 video-mode) (-> s5-1 video-mode)) + (set! (-> gp-0 video-mode) (-> s5-1 video-mode)) + (set-video-mode (-> gp-0 video-mode)) + ) + (when (!= (-> gp-0 screenx) (-> s5-1 screenx)) + (set! (-> gp-0 screenx) (-> s5-1 screenx)) + (set! (-> *video-parms* display-dx) (/ (-> s5-1 screenx) 2)) + (set! (-> *video-parms* set-video-mode) #t) + ) + (when (!= (-> gp-0 screeny) (-> s5-1 screeny)) + (set! (-> gp-0 screeny) (-> s5-1 screeny)) + (set! (-> *video-parms* display-dy) (* (/ (-> s5-1 screeny) 2) 2)) + (set! (-> *video-parms* set-video-mode) #t) + ) + (set! (-> gp-0 bg-a-speed) (-> s5-1 bg-a-speed)) + (set! (-> gp-0 bg-a-force) (-> s5-1 bg-a-force)) + (set! (-> gp-0 bg-r) (-> s5-1 bg-r)) + (set! (-> gp-0 bg-g) (-> s5-1 bg-g)) + (set! (-> gp-0 bg-b) (-> s5-1 bg-b)) + (set! + (-> gp-0 bg-a) + (seek + (-> gp-0 bg-a) + (-> s5-1 bg-a) + (* (-> s5-1 bg-a-speed) (-> *display* seconds-per-frame)) + ) + ) + ) + (let ((v1-60 (-> *display* frames (-> *display* on-screen) display)) + (f0-39 (-> gp-0 bg-a)) + ) + (if (!= (-> gp-0 bg-a-force) 0.0) + (set! f0-39 (-> gp-0 bg-a-force)) + ) + (set! (-> v1-60 bgcolor r) (the int (* 255.0 (-> gp-0 bg-r)))) + (set! (-> v1-60 bgcolor g) (the int (* 255.0 (-> gp-0 bg-g)))) + (set! (-> v1-60 bgcolor b) (the int (* 255.0 (-> gp-0 bg-b)))) + (set! (-> v1-60 pmode alp) (the int (* 255.0 (- 1.0 f0-39)))) + ) + (set! (-> *level* border?) (-> gp-0 border-mode)) + (set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page)) + (set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration)) + (let ((v1-64 (-> gp-0 ocean-off))) + (cond + ((= v1-64 #t) + (set! *ocean-off* #t) + ) + ((= v1-64 'mid) + (set! *ocean-mid-off* #t) + ) + ((= v1-64 'near) + (set! *ocean-near-off* #t) + ) + ) + ) + gp-0 + ) + ) + +;; failed to figure out what this is: +(when (zero? *setting-control*) + (set! *setting-control* (new 'global 'setting-control 32)) + (let ((gp-0 (-> *setting-control* default)) + (s5-0 (-> *setting-control* current)) + ) + (let ((f0-2 (* 0.01 (the float (scf-get-volume))))) + (set! (-> gp-0 ocean-off) #f) + (set! (-> gp-0 allow-look-around) #t) + (set! (-> gp-0 border-mode) #f) + (set! + (-> gp-0 sfx-volume) + (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2))))) + ) + (set! + (-> gp-0 music-volume) + (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2))))) + ) + (set! + (-> gp-0 dialog-volume) + (the float (* 5 (the int (+ 0.5 (* 20.0 f0-2))))) + ) + (set! + (-> gp-0 ambient-volume) + (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2))))) + ) + (set! + (-> gp-0 sfx-volume-movie) + (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2))))) + ) + (set! + (-> gp-0 music-volume-movie) + (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2))))) + ) + (set! + (-> gp-0 ambient-volume-movie) + (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2))))) + ) + (set! + (-> gp-0 dialog-volume-hint) + (the float (* 5 (the int (+ 0.5 (* 16.0 f0-2))))) + ) + ) + (set! (-> gp-0 language) (the-as int (scf-get-language))) + (set! (-> gp-0 process-mask) (the-as uint 65)) + (set! (-> gp-0 screenx) 0) + (set! (-> gp-0 screeny) 0) + (set! (-> gp-0 vibration) #t) + (set! (-> gp-0 auto-save) #f) + (set! (-> gp-0 play-hints) #t) + (set! (-> gp-0 movie) (the-as (pointer process) #f)) + (set! (-> gp-0 talking) (the-as (pointer process) #f)) + (set! (-> gp-0 spooling) (the-as (pointer process) #f)) + (set! (-> gp-0 hint) (the-as (pointer process) #f)) + (set! (-> gp-0 ambient) (the-as (pointer process) #f)) + (set! (-> gp-0 sound-flava) (the-as uint 49)) + (set! (-> gp-0 sound-flava-priority) 0.0) + (set! (-> gp-0 music) #f) + (set! (-> gp-0 bg-a-speed) 8.0) + (set! (-> gp-0 allow-pause) #t) + (set! (-> gp-0 allow-progress) #t) + (let ((v1-27 (scf-get-aspect))) + (if (= v1-27 2) + (set! (-> gp-0 aspect-ratio) 'aspect16x9) + (set! (-> gp-0 aspect-ratio) 'aspect4x3) + ) + ) + (if (zero? *boot-video-mode*) + (set! (-> gp-0 video-mode) 'ntsc) + (set! (-> gp-0 video-mode) 'pal) + ) + (set! (-> s5-0 sfx-volume) (+ -1.0 (-> gp-0 sfx-volume))) + (set! (-> s5-0 music-volume) (+ -1.0 (-> gp-0 music-volume))) + (set! (-> s5-0 dialog-volume) (+ -1.0 (-> gp-0 dialog-volume))) + (set! (-> s5-0 ambient-volume) (+ -1.0 (-> gp-0 ambient-volume))) + (set! (-> s5-0 sfx-volume-movie) (-> gp-0 sfx-volume-movie)) + (set! (-> s5-0 music-volume-movie) (-> gp-0 music-volume-movie)) + (set! (-> s5-0 ambient-volume-movie) (-> gp-0 ambient-volume-movie)) + (set! (-> s5-0 dialog-volume-hint) (-> gp-0 dialog-volume-hint)) + (set! (-> s5-0 language) (+ (-> gp-0 language) -1)) + (set! (-> s5-0 aspect-ratio) #f) + (set! (-> s5-0 video-mode) #f) + (set! (-> s5-0 music) #f) + (set! (-> s5-0 bg-a-speed) (-> gp-0 bg-a-speed)) + (set! (-> s5-0 allow-pause) (-> gp-0 allow-pause)) + (set! (-> s5-0 allow-progress) (-> gp-0 allow-progress)) + (set! (-> s5-0 allow-look-around) (-> gp-0 allow-look-around)) + (set! (-> s5-0 ocean-off) (-> gp-0 ocean-off)) + ) + ) + + + + + + + + diff --git a/goal_src/engine/gfx/hw/video-h.gc b/goal_src/engine/gfx/hw/video-h.gc index da8a90e758..a86bb6620d 100644 --- a/goal_src/engine/gfx/hw/video-h.gc +++ b/goal_src/engine/gfx/hw/video-h.gc @@ -52,3 +52,6 @@ (define-extern get-aspect-ratio (function symbol)) ;; TODO - for video, actually defined in hud-classes though! (define-extern set-hud-aspect-ratio (function symbol symbol none)) +;; TODO - for settings +(define-extern set-aspect-ratio (function symbol none)) +(define-extern set-video-mode (function symbol none)) diff --git a/goal_src/engine/sound/gsound.gc b/goal_src/engine/sound/gsound.gc index e7612d1f0a..beb60fabdf 100644 --- a/goal_src/engine/sound/gsound.gc +++ b/goal_src/engine/sound/gsound.gc @@ -493,14 +493,13 @@ 0 ) -(define-extern *setting-control* setting-control) (defun sound-volume-off () "Set all sound volume to zero" (with-pp - (dummy-10 *setting-control* pp 'music-volume 'abs 0.0 0) - (dummy-10 *setting-control* pp 'sfx-volume 'abs 0.0 0) - (dummy-10 *setting-control* pp 'ambient-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'music-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'sfx-volume 'abs 0.0 0) + (set-setting! *setting-control* pp 'ambient-volume 'abs 0.0 0) ) 0 ) diff --git a/test/decompiler/reference/engine/game/settings-h_REF.gc b/test/decompiler/reference/engine/game/settings-h_REF.gc index a92482913e..d0ac2a5d6f 100644 --- a/test/decompiler/reference/engine/game/settings-h_REF.gc +++ b/test/decompiler/reference/engine/game/settings-h_REF.gc @@ -3,7 +3,7 @@ ;; definition of type setting-data (deftype setting-data (structure) - ((border-mode basic :offset-assert 0) + ((border-mode symbol :offset-assert 0) (sfx-volume float :offset-assert 4) (music-volume float :offset-assert 8) (dialog-volume float :offset-assert 12) @@ -12,8 +12,8 @@ (language int64 :offset-assert 24) (screenx int32 :offset-assert 32) (screeny int32 :offset-assert 36) - (vibration basic :offset-assert 40) - (play-hints basic :offset-assert 44) + (vibration symbol :offset-assert 40) + (play-hints symbol :offset-assert 44) (movie (pointer process) :offset-assert 48) (talking (pointer process) :offset-assert 52) (spooling (pointer process) :offset-assert 56) @@ -22,21 +22,21 @@ (video-mode symbol :offset-assert 68) (aspect-ratio symbol :offset-assert 72) (sound-flava uint8 :offset-assert 76) - (auto-save basic :offset-assert 80) + (auto-save symbol :offset-assert 80) (music-volume-movie float :offset-assert 84) (sfx-volume-movie float :offset-assert 88) - (music basic :offset-assert 92) + (music symbol :offset-assert 92) (bg-r float :offset-assert 96) (bg-g float :offset-assert 100) (bg-b float :offset-assert 104) (bg-a float :offset-assert 108) (bg-a-speed float :offset-assert 112) (bg-a-force float :offset-assert 116) - (allow-progress basic :offset-assert 120) - (allow-pause basic :offset-assert 124) + (allow-progress symbol :offset-assert 120) + (allow-pause symbol :offset-assert 124) (sound-flava-priority float :offset-assert 128) - (ocean-off basic :offset-assert 132) - (allow-look-around basic :offset-assert 136) + (ocean-off symbol :offset-assert 132) + (allow-look-around symbol :offset-assert 136) (ambient-volume float :offset-assert 140) (ambient-volume-movie float :offset-assert 144) (dialog-volume-hint float :offset-assert 148) @@ -46,7 +46,7 @@ :size-assert #xc4 :flag-assert #xa000000c4 (:methods - (dummy-9 () none 9) + (handle-pending-updates (_type_ engine) setting-data 9) ) ) @@ -151,11 +151,11 @@ :flag-assert #xe00000278 (:methods (new (symbol type int) _type_ 0) - (dummy-9 () none 9) - (dummy-10 (_type_ process symbol symbol float int) none 10) - (dummy-11 () none 11) - (dummy-12 () none 12) - (dummy-13 () none 13) + (push-setting! (_type_ process (function object object object object object) object object object) none 9) + (set-setting! (_type_ process symbol symbol float int) none 10) + (clear-pending-settings-from-process (_type_ process symbol) none 11) + (copy-settings-from-target! (_type_) setting-data 12) + (update-per-frame-settings! (_type_) setting-data 13) ) ) diff --git a/test/decompiler/reference/engine/game/settings_REF.gc b/test/decompiler/reference/engine/game/settings_REF.gc new file mode 100644 index 0000000000..39ac63e377 --- /dev/null +++ b/test/decompiler/reference/engine/game/settings_REF.gc @@ -0,0 +1,609 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type setting-data +(defmethod handle-pending-updates setting-data ((obj setting-data) (arg0 engine)) + (let ((conn (the-as connection (-> arg0 alive-list-end))) + (s4-0 (-> arg0 alive-list-end prev0)) + ) + (while (!= (the-as connectable conn) (-> arg0 alive-list)) + (let ((v1-1 (-> conn param0))) + (cond + ((= v1-1 'border-mode) + (set! (-> obj border-mode) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'allow-look-around) + (set! (-> obj allow-look-around) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'ocean-off) + (set! (-> obj ocean-off) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'music) + (set! (-> obj music) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'process-mask) + (let ((v1-6 (-> conn param1))) + (cond + ((= (the-as symbol v1-6) 'set) + (set! + (-> obj process-mask) + (logior + (-> obj process-mask) + (the-as uint (the-as int (-> conn param3))) + ) + ) + ) + ((= v1-6 'clear) + (set! + (-> obj process-mask) + (logand + (-> obj process-mask) + (the-as uint (lognot (the-as uint (-> conn param3)))) + ) + ) + ) + ((= v1-6 'abs) + (set! + (-> obj process-mask) + (the-as uint (the-as int (-> conn param3))) + ) + ) + ) + ) + ) + ((= v1-1 'sfx-volume) + (when + (or + (zero? + (logand + (-> *kernel-context* prevent-from-run) + (process-mask progress) + ) + ) + (let ((v1-18 (get-process conn)) + (a0-22 *progress-process*) + ) + (= v1-18 (if a0-22 + (-> a0-22 0 self) + ) + ) + ) + ) + (let ((v1-20 (the-as symbol (-> conn param1)))) + (if (= v1-20 'rel) + (set! + (-> obj sfx-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume)) + ) + (set! (-> obj sfx-volume) (the-as float (-> conn param2))) + ) + ) + ) + ) + ((= v1-1 'music-volume) + (let ((v1-25 (the-as symbol (-> conn param1)))) + (if (= v1-25 'rel) + (set! + (-> obj music-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj music-volume)) + ) + (set! (-> obj music-volume) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'ambient-volume) + (let ((v1-30 (the-as symbol (-> conn param1)))) + (if (= v1-30 'rel) + (set! + (-> obj ambient-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj ambient-volume)) + ) + (set! (-> obj ambient-volume) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'dialog-volume) + (let ((v1-35 (the-as symbol (-> conn param1)))) + (if (= v1-35 'rel) + (set! + (-> obj dialog-volume) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj dialog-volume)) + ) + (set! (-> obj dialog-volume) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'sfx-volume-movie) + (let ((v1-40 (the-as symbol (-> conn param1)))) + (if (= v1-40 'rel) + (set! + (-> obj sfx-volume-movie) + (* (* 0.01 (the-as float (-> conn param2))) (-> obj sfx-volume-movie)) + ) + (set! (-> obj sfx-volume-movie) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'music-volume-movie) + (let ((v1-45 (the-as symbol (-> conn param1)))) + (if (= v1-45 'rel) + (set! + (-> obj music-volume-movie) + (* + (* 0.01 (the-as float (-> conn param2))) + (-> obj music-volume-movie) + ) + ) + (set! (-> obj music-volume-movie) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'ambient-volume-movie) + (let ((v1-50 (the-as symbol (-> conn param1)))) + (if (= v1-50 'rel) + (set! + (-> obj ambient-volume-movie) + (* + (* 0.01 (the-as float (-> conn param2))) + (-> obj ambient-volume-movie) + ) + ) + (set! (-> obj ambient-volume-movie) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'dialog-volume-hint) + (let ((v1-55 (the-as symbol (-> conn param1)))) + (if (= v1-55 'rel) + (set! + (-> obj dialog-volume-hint) + (* + (* 0.01 (the-as float (-> conn param2))) + (-> obj dialog-volume-hint) + ) + ) + (set! (-> obj dialog-volume-hint) (the-as float (-> conn param2))) + ) + ) + ) + ((= v1-1 'sound-flava) + (when (>= (the-as float (-> conn param2)) (-> obj sound-flava-priority)) + (set! (-> obj sound-flava) (the-as uint (the-as int (-> conn param3)))) + (set! (-> obj sound-flava-priority) (the-as float (-> conn param2))) + ) + ) + ((= v1-1 'bg-r) + (set! (-> obj bg-r) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-g) + (set! (-> obj bg-g) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-b) + (set! (-> obj bg-b) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-a) + (set! (-> obj bg-a) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-a-speed) + (set! (-> obj bg-a-speed) (the-as float (-> conn param2))) + ) + ((= v1-1 'bg-a-force) + (set! (-> obj bg-a-force) (the-as float (-> conn param2))) + ) + ((= v1-1 'language) + (set! (-> obj language) (the-as int (-> conn param3))) + ) + ((= v1-1 'vibration) + (set! (-> obj vibration) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'auto-save) + (set! (-> obj auto-save) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'allow-pause) + (set! (-> obj allow-pause) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'allow-progress) + (set! (-> obj allow-progress) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'play-hints) + (set! (-> obj play-hints) (the-as symbol (-> conn param1))) + ) + ((= v1-1 'movie) + (set! (-> obj movie) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'talking) + (set! (-> obj talking) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'spooling) + (set! (-> obj spooling) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'hint) + (set! (-> obj hint) (the-as (pointer process) (-> conn param1))) + ) + ((= v1-1 'ambient) + (set! (-> obj ambient) (the-as (pointer progress) (-> conn param1))) + ) + ((= v1-1 'common-page) + (let ((v1-89 (-> conn param1))) + (cond + ((= (the-as symbol v1-89) 'set) + (set! + (-> obj common-page) + (logior (-> obj common-page) (the-as int (-> conn param3))) + ) + ) + ((= v1-89 'clear) + (set! + (-> obj common-page) + (logand + (-> obj common-page) + (the-as int (the-as uint (lognot (the-as uint (-> conn param3))))) + ) + ) + ) + ) + ) + ) + ) + ) + (set! conn (the-as connection s4-0)) + (set! s4-0 (-> (the-as connectable conn) prev0)) + ) + ) + obj + ) + +;; definition for method 9 of type setting-control +;; INFO: Return type mismatch int vs none. +(defmethod + push-setting! + setting-control + ((obj setting-control) + (arg0 process) + (arg1 (function object object object object object)) + (arg2 object) + (arg3 object) + (arg4 object) + ) + (add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4) + 0 + (none) + ) + +;; definition for method 10 of type setting-control +;; INFO: Return type mismatch int vs none. +(defmethod + set-setting! + setting-control + ((obj setting-control) + (arg0 process) + (arg1 symbol) + (arg2 symbol) + (arg3 float) + (arg4 int) + ) + (clear-pending-settings-from-process obj arg0 arg1) + (add-connection + (-> obj engine) + arg0 + (the-as (function object object object object object) arg1) + arg2 + arg3 + arg4 + ) + 0 + (none) + ) + +;; definition for method 11 of type setting-control +;; INFO: Return type mismatch int vs none. +(defmethod + clear-pending-settings-from-process + setting-control + ((obj setting-control) (arg0 process) (arg1 symbol)) + (when arg0 + (let ((s5-0 (-> obj engine)) + (s4-0 (-> arg0 connection-list next1)) + ) + (while s4-0 + (if + (and + ((method-of-type connection belongs-to-engine?) + (the-as connection s4-0) + s5-0 + ) + (or (= arg1 #t) (= arg1 (-> (the-as connection s4-0) param0))) + ) + ((method-of-type connection move-to-dead) (the-as connection s4-0)) + ) + (set! s4-0 (-> s4-0 next1)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type setting-control +(defmethod copy-settings-from-target! setting-control ((obj setting-control)) + (let ((gp-0 (-> obj current))) + (let ((s5-0 (-> obj target))) + (mem-copy! (the-as pointer s5-0) (the-as pointer (-> obj default)) 196) + (set! + (-> s5-0 ambient-volume) + (* (* 0.01 (-> obj default ambient-volume)) (-> obj default sfx-volume)) + ) + (handle-pending-updates s5-0 (-> obj engine)) + (set! (-> gp-0 border-mode) (-> s5-0 border-mode)) + (set! (-> gp-0 common-page) (-> s5-0 common-page)) + (set! (-> gp-0 vibration) (-> s5-0 vibration)) + (set! (-> gp-0 auto-save) (-> s5-0 auto-save)) + (set! (-> gp-0 play-hints) (-> s5-0 play-hints)) + (set! (-> gp-0 movie) (-> s5-0 movie)) + (set! (-> gp-0 talking) (-> s5-0 talking)) + (set! (-> gp-0 spooling) (-> s5-0 spooling)) + (set! (-> gp-0 hint) (-> s5-0 hint)) + (set! (-> gp-0 ambient) (-> s5-0 ambient)) + (set! (-> gp-0 allow-pause) (-> s5-0 allow-pause)) + (set! (-> gp-0 allow-progress) (-> s5-0 allow-progress)) + (set! (-> gp-0 allow-look-around) (-> s5-0 allow-look-around)) + (set! (-> gp-0 ocean-off) (-> s5-0 ocean-off)) + (set! (-> gp-0 ambient-volume-movie) (-> s5-0 ambient-volume-movie)) + (set! (-> gp-0 music-volume-movie) (-> s5-0 music-volume-movie)) + (set! (-> gp-0 sfx-volume-movie) (-> s5-0 sfx-volume-movie)) + (set! (-> gp-0 dialog-volume-hint) (-> s5-0 dialog-volume-hint)) + (set! (-> gp-0 process-mask) (-> s5-0 process-mask)) + ) + (set! + (-> *kernel-context* prevent-from-run) + (the-as process-mask (-> gp-0 process-mask)) + ) + gp-0 + ) + ) + +;; definition for method 13 of type setting-control +(defmethod update-per-frame-settings! setting-control ((obj setting-control)) + (copy-settings-from-target! obj) + (let ((gp-0 (-> obj current))) + (let ((s5-1 (-> obj target))) + (when *sound-player-enable* + (when (!= (-> gp-0 sfx-volume) (-> s5-1 sfx-volume)) + (set! + (-> gp-0 sfx-volume) + (seek + (-> gp-0 sfx-volume) + (-> s5-1 sfx-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 1) (-> gp-0 sfx-volume)) + ) + (when (!= (-> gp-0 music-volume) (-> s5-1 music-volume)) + (set! + (-> gp-0 music-volume) + (seek + (-> gp-0 music-volume) + (-> s5-1 music-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 2) (-> gp-0 music-volume)) + ) + (when (!= (-> gp-0 dialog-volume) (-> s5-1 dialog-volume)) + (set! + (-> gp-0 dialog-volume) + (seek + (-> gp-0 dialog-volume) + (-> s5-1 dialog-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 4) (-> gp-0 dialog-volume)) + ) + (when (!= (-> gp-0 ambient-volume) (-> s5-1 ambient-volume)) + (set! + (-> gp-0 ambient-volume) + (seek + (-> gp-0 ambient-volume) + (-> s5-1 ambient-volume) + (* 100.0 (-> *display* seconds-per-frame)) + ) + ) + (sound-set-volume (the-as uint 16) (-> gp-0 ambient-volume)) + ) + ) + (when (!= (-> gp-0 language) (-> s5-1 language)) + (set! (-> gp-0 language) (-> s5-1 language)) + (set-language (-> gp-0 language)) + ) + (when + (and + (!= (-> s5-1 music) (-> gp-0 music)) + (and + (< 0.0 (-> *setting-control* current music-volume)) + (zero? (rpc-busy? 1)) + *sound-bank-1* + *sound-bank-2* + ) + ) + (cond + ((-> s5-1 music) + (format 0 "Load music ~A~%" (-> s5-1 music)) + (sound-music-load (string->sound-name (symbol->string (-> s5-1 music)))) + ) + (else + (format 0 "Unload music~%") + (sound-music-unload) + ) + ) + (set! (-> gp-0 music) (-> s5-1 music)) + ) + (set! + (-> s5-1 sound-flava) + (the-as + uint + (flava-lookup (-> gp-0 music) (the-as int (-> s5-1 sound-flava))) + ) + ) + (set! (-> gp-0 sound-flava) (-> s5-1 sound-flava)) + (if *sound-player-enable* + (sound-set-flava (-> gp-0 sound-flava)) + ) + (when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio)) + (set! (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio)) + (set-aspect-ratio (-> gp-0 aspect-ratio)) + ) + (when (!= (-> gp-0 video-mode) (-> s5-1 video-mode)) + (set! (-> gp-0 video-mode) (-> s5-1 video-mode)) + (set-video-mode (-> gp-0 video-mode)) + ) + (when (!= (-> gp-0 screenx) (-> s5-1 screenx)) + (set! (-> gp-0 screenx) (-> s5-1 screenx)) + (set! (-> *video-parms* display-dx) (/ (-> s5-1 screenx) 2)) + (set! (-> *video-parms* set-video-mode) #t) + ) + (when (!= (-> gp-0 screeny) (-> s5-1 screeny)) + (set! (-> gp-0 screeny) (-> s5-1 screeny)) + (set! (-> *video-parms* display-dy) (* (/ (-> s5-1 screeny) 2) 2)) + (set! (-> *video-parms* set-video-mode) #t) + ) + (set! (-> gp-0 bg-a-speed) (-> s5-1 bg-a-speed)) + (set! (-> gp-0 bg-a-force) (-> s5-1 bg-a-force)) + (set! (-> gp-0 bg-r) (-> s5-1 bg-r)) + (set! (-> gp-0 bg-g) (-> s5-1 bg-g)) + (set! (-> gp-0 bg-b) (-> s5-1 bg-b)) + (set! + (-> gp-0 bg-a) + (seek + (-> gp-0 bg-a) + (-> s5-1 bg-a) + (* (-> s5-1 bg-a-speed) (-> *display* seconds-per-frame)) + ) + ) + ) + (let ((v1-60 (-> *display* frames (-> *display* on-screen) display)) + (f0-39 (-> gp-0 bg-a)) + ) + (if (!= (-> gp-0 bg-a-force) 0.0) + (set! f0-39 (-> gp-0 bg-a-force)) + ) + (set! (-> v1-60 bgcolor r) (the int (* 255.0 (-> gp-0 bg-r)))) + (set! (-> v1-60 bgcolor g) (the int (* 255.0 (-> gp-0 bg-g)))) + (set! (-> v1-60 bgcolor b) (the int (* 255.0 (-> gp-0 bg-b)))) + (set! (-> v1-60 pmode alp) (the int (* 255.0 (- 1.0 f0-39)))) + ) + (set! (-> *level* border?) (-> gp-0 border-mode)) + (set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page)) + (set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration)) + (let ((v1-64 (-> gp-0 ocean-off))) + (cond + ((= v1-64 #t) + (set! *ocean-off* #t) + ) + ((= v1-64 'mid) + (set! *ocean-mid-off* #t) + ) + ((= v1-64 'near) + (set! *ocean-near-off* #t) + ) + ) + ) + gp-0 + ) + ) + +;; failed to figure out what this is: +(when (zero? *setting-control*) + (set! *setting-control* (new 'global 'setting-control 32)) + (let ((gp-0 (-> *setting-control* default)) + (s5-0 (-> *setting-control* current)) + ) + (let ((f0-2 (* 0.01 (the float (scf-get-volume))))) + (set! (-> gp-0 ocean-off) #f) + (set! (-> gp-0 allow-look-around) #t) + (set! (-> gp-0 border-mode) #f) + (set! + (-> gp-0 sfx-volume) + (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2))))) + ) + (set! + (-> gp-0 music-volume) + (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2))))) + ) + (set! + (-> gp-0 dialog-volume) + (the float (* 5 (the int (+ 0.5 (* 20.0 f0-2))))) + ) + (set! + (-> gp-0 ambient-volume) + (the float (* 5 (the int (+ 0.5 (* 15.0 f0-2))))) + ) + (set! + (-> gp-0 sfx-volume-movie) + (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2))))) + ) + (set! + (-> gp-0 music-volume-movie) + (the float (* 5 (the int (+ 0.5 (* 13.0 f0-2))))) + ) + (set! + (-> gp-0 ambient-volume-movie) + (the float (* 5 (the int (+ 0.5 (* 11.0 f0-2))))) + ) + (set! + (-> gp-0 dialog-volume-hint) + (the float (* 5 (the int (+ 0.5 (* 16.0 f0-2))))) + ) + ) + (set! (-> gp-0 language) (the-as int (scf-get-language))) + (set! (-> gp-0 process-mask) (the-as uint 65)) + (set! (-> gp-0 screenx) 0) + (set! (-> gp-0 screeny) 0) + (set! (-> gp-0 vibration) #t) + (set! (-> gp-0 auto-save) #f) + (set! (-> gp-0 play-hints) #t) + (set! (-> gp-0 movie) (the-as (pointer process) #f)) + (set! (-> gp-0 talking) (the-as (pointer process) #f)) + (set! (-> gp-0 spooling) (the-as (pointer process) #f)) + (set! (-> gp-0 hint) (the-as (pointer process) #f)) + (set! (-> gp-0 ambient) (the-as (pointer process) #f)) + (set! (-> gp-0 sound-flava) (the-as uint 49)) + (set! (-> gp-0 sound-flava-priority) 0.0) + (set! (-> gp-0 music) #f) + (set! (-> gp-0 bg-a-speed) 8.0) + (set! (-> gp-0 allow-pause) #t) + (set! (-> gp-0 allow-progress) #t) + (let ((v1-27 (scf-get-aspect))) + (if (= v1-27 2) + (set! (-> gp-0 aspect-ratio) 'aspect16x9) + (set! (-> gp-0 aspect-ratio) 'aspect4x3) + ) + ) + (if (zero? *boot-video-mode*) + (set! (-> gp-0 video-mode) 'ntsc) + (set! (-> gp-0 video-mode) 'pal) + ) + (set! (-> s5-0 sfx-volume) (+ -1.0 (-> gp-0 sfx-volume))) + (set! (-> s5-0 music-volume) (+ -1.0 (-> gp-0 music-volume))) + (set! (-> s5-0 dialog-volume) (+ -1.0 (-> gp-0 dialog-volume))) + (set! (-> s5-0 ambient-volume) (+ -1.0 (-> gp-0 ambient-volume))) + (set! (-> s5-0 sfx-volume-movie) (-> gp-0 sfx-volume-movie)) + (set! (-> s5-0 music-volume-movie) (-> gp-0 music-volume-movie)) + (set! (-> s5-0 ambient-volume-movie) (-> gp-0 ambient-volume-movie)) + (set! (-> s5-0 dialog-volume-hint) (-> gp-0 dialog-volume-hint)) + (set! (-> s5-0 language) (+ (-> gp-0 language) -1)) + (set! (-> s5-0 aspect-ratio) #f) + (set! (-> s5-0 video-mode) #f) + (set! (-> s5-0 music) #f) + (set! (-> s5-0 bg-a-speed) (-> gp-0 bg-a-speed)) + (set! (-> s5-0 allow-pause) (-> gp-0 allow-pause)) + (set! (-> s5-0 allow-progress) (-> gp-0 allow-progress)) + (set! (-> s5-0 allow-look-around) (-> gp-0 allow-look-around)) + (set! (-> s5-0 ocean-off) (-> gp-0 ocean-off)) + ) + ) + + + +