d/jak2: finish entity-table | sky-data | relocate | and the majority of default-menu (#1812)

* d/jak2: finish `entity-table`

* d/jak2: finish `sky-data`

* d/jak2: finish `relocate`

* d/jak2: halfway through `default-menu`

* d/jak2: 75% done `default-menu`....

* d/jak2: add `default-menu` to ref tests (partially)

* d/jak2: finish updating related code

* scripts: add tooling to automatically keep code from `all-types` up to date

* d/jak2: fixed vector types
This commit is contained in:
Tyler Wilding
2022-08-29 18:49:57 -04:00
committed by GitHub
parent 2272fecb1a
commit d176b294b9
57 changed files with 12534 additions and 1727 deletions
+2 -1
View File
@@ -10,7 +10,8 @@
"request": "launch",
"program": "${workspaceFolder}/scripts/gsrc/update-from-decomp.py",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}"
"cwd": "${workspaceFolder}",
"args": ["--game", "jak2", "--file", "sky-data"]
},
]
}
+8 -6
View File
@@ -83,10 +83,17 @@ tasks:
decomp:
cmds:
- '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/{{.DECOMP_CONFIG}}" "./iso_data" "./decompiler_out"'
decomp-file:
cmds:
- "{{.DECOMP_BIN_RELEASE_DIR}}/decompiler \"./decompiler/config/{{.DECOMP_CONFIG}}\" \"./iso_data\" \"./decompiler_out\" --config-override '{\"allowed_objects\": [\"{{.FILE}}\"]}'"
decomp-clean:
cmds:
- rm ./decompiler_out/**/*.asm
- rm ./decompiler_out/**/*disasm.gc
update-gsrc: # TODO - make this use git to update all files changed in _REF
cmds:
- task: decomp-file
- python ./scripts/gsrc/update-from-decomp.py --game "{{.GAME}}" --file {{.FILE}}
# TOOLS
analyze-ee-memory:
cmds:
@@ -108,15 +115,10 @@ tasks:
ignore_error: true
- python ./scripts/update_decomp_reference.py ./failures ./test/decompiler/reference/
- task: offline-tests
# find-label-types:
# cmds:
# - python ./scripts/next-decomp-file.py --files "{{.FILES}}"
# - task: decomp
# - python ./scripts/find-label-types.py --file "{{.FILES}}"
# check-gsrc-file:
# cmds:
# - python ./scripts/check-gsrc-file.py --files "{{.FILES}}"
type-test:
cmds:
- cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_filter="*MANUAL_TEST_TypeConsistencyWithBuildFirst*"'
- cmd: '{{.GOALCTEST_BIN_RELEASE_DIR}}/goalc-test --gtest_brief=0 --gtest_filter="*Jak2TypeConsistency*"'
ignore_error: true
+1
View File
@@ -29,6 +29,7 @@ Config read_config_file(const fs::path& path_to_config_file, const std::string&
Config config;
auto config_str = file_util::read_text_file(path_to_config_file);
auto cfg = parse_commented_json(config_str, path_to_config_file.string());
fmt::print("Config Overide: '{}'\n", override_json);
auto cfg_override = parse_commented_json(override_json, "");
cfg.update(cfg_override);
-1
View File
@@ -18887,7 +18887,6 @@
;; - Unknowns
;;(define-extern sky-base-polygons object) ;; unknown type
(define-extern sky-base-polygons (inline-array sky-vertex))
File diff suppressed because it is too large Load Diff
@@ -40,5 +40,188 @@
"settings": [
[6, "(function engine-pers connection-pers object object symbol)"]
],
"relocate": [[7, "(function sparticle-system sparticle-cpuinfo none)"]],
"default-menu": [
[3, "(function none)"],
[4, "(function none)"],
[5, "(function none)"],
[6, "(function none)"],
[7, "(function object debug-menu-msg symbol)"],
[8, "(function object)"],
[9, "(function object)"],
[10, "(function object)"],
[11, "(function object)"],
[12, "(function object)"],
[13, "(function object)"],
[14, "(function object)"],
[15, "(function object)"],
[16, "(function object debug-menu-msg target)"],
[18, "(function none)"],
[19, "(function none)"],
[20, "(function float)"],
[21, "(function none)"],
[22, "(function float)"],
[23, "(function object debug-menu-msg float float)"],
[24, "(function object debug-menu-msg float float)"],
[25, "(function symbol)"],
[26, "(function object debug-menu-msg float float)"],
[27, "(function object debug-menu-msg float float)"],
[28, "(function object debug-menu-msg float float)"],
[29, "(function object debug-menu-msg float float)"],
[30, "(function symbol)"],
[31, "(function vector)"],
[32, "(function object debug-menu-msg float float)"],
[33, "(function object debug-menu-msg float float)"],
[34, "(function object debug-menu-msg float float)"],
[35, "(function object debug-menu-msg float float)"],
[36, "(function symbol)"],
[37, "(function object debug-menu-msg float float)"],
[38, "(function object debug-menu-msg float float)"],
[39, "(function object debug-menu-msg float float)"],
[40, "(function object debug-menu-msg float float)"],
[41, "(function object debug-menu-msg float float)"],
[42, "(function object debug-menu-msg float float)"],
[43, "(function object debug-menu-msg float float)"],
[44, "(function object debug-menu-msg float float)"],
[45, "(function object debug-menu-msg float float)"],
[46, "(function object debug-menu-msg float float)"],
[47, "(function object debug-menu-msg float float)"],
[48, "(function object debug-menu-msg float float)"],
[49, "(function object debug-menu-msg float float)"],
[50, "(function object debug-menu-msg float float)"],
[51, "(function object debug-menu-msg float float)"],
[52, "(function object debug-menu-msg float float)"],
[53, "(function object debug-menu-msg float float)"],
[54, "(function object debug-menu-msg float float)"],
[55, "(function object debug-menu-msg float float)"],
[56, "(function object debug-menu-msg float float)"],
[57, "(function object debug-menu-msg float float)"],
[58, "(function object debug-menu-msg symbol)"],
[59, "(function object debug-menu-msg symbol)"],
[60, "(function object debug-menu-msg symbol)"],
[61, "(function object debug-menu-msg none)"],
[62, "(function object debug-menu-msg symbol)"],
[63, "(function process-mask)"],
[64, "(function symbol)"],
[65, "(function object debug-menu-msg symbol)"],
[66, "(function none)"],
[67, "(function none)"],
[68, "(function none)"],
[69, "(function none)"],
[70, "(function none)"],
[71, "(function none)"],
[72, "(function none)"],
[73, "(function none)"],
[74, "(function none)"],
[75, "(function none)"],
[76, "(function none)"],
[77, "(function none)"],
[78, "(function none)"],
[79, "(function symbol)"],
[80, "(function int)"],
[81, "(function quaternion)"],
[82, "(function quaternion)"],
[83, "(function object)"],
[84, "(function object)"],
[85, "(function game-feature)"],
[86, "(function object debug-menu-msg object)"],
[87, "(function object debug-menu-msg object)"],
[88, "(function object debug-menu-msg object)"],
[89, "(function object debug-menu-msg object)"],
[90, "(function object debug-menu-msg object)"],
[91, "(function object debug-menu-msg object)"],
[92, "(function object debug-menu-msg object)"],
[93, "(function object debug-menu-msg object)"],
[94, "(function object debug-menu-msg object)"],
[95, "(function object debug-menu-msg target)"],
[96, "(function none)"],
[97, "(function none)"],
[98, "(function none)"],
[99, "(function none)"],
[100, "(function none)"],
[101, "(function none)"],
[102, "(function none)"],
[103, "(function none)"],
[104, "(function none)"],
[105, "(function none)"],
[106, "(function none)"],
[107, "(function none)"],
[108, "(function none)"],
[109, "(function none)"],
[110, "(function object)"],
[111, "(function object)"],
[112, "(function object)"],
[113, "(function object)"],
[114, "(function object)"],
[115, "(function object)"],
[116, "(function object)"],
[117, "(function object)"],
[118, "(function none)"],
[119, "(function none)"],
[120, "(function object)"],
[121, "(function none)"],
[122, "(function none)"],
[123, "(function none)"],
[124, "(function none)"],
[125, "(function none)"],
[126, "(function texture-page-dir)"],
[127, "(function symbol)"],
[128, "(function object debug-menu-msg symbol)"],
[129, "(function object debug-menu-msg uint)"],
[130, "(function object debug-menu-msg uint)"],
[131, "(function object debug-menu-msg uint)"],
[132, "(function object debug-menu-msg symbol)"],
[133, "(function object debug-menu-msg uint)"],
[134, "(function object debug-menu-msg float float)"],
[135, "(function object debug-menu-msg float float)"],
[136, "(function object debug-menu-msg float float)"],
[137, "(function object debug-menu-msg float float)"],
[138, "(function none)"],
[139, "(function target)"],
[140, "(function none)"],
[141, "(function none)"],
[142, "(function object debug-menu-msg target)"],
[143, "(function none)"],
[144, "(function none)"],
[145, "(function none)"],
[146, "(function game-info)"],
[147, "(function game-info)"],
[148, "(function game-info)"],
[149, "(function object debug-menu-msg symbol)"],
[150, "(function object debug-menu-msg symbol)"],
[151, "(function none)"],
[152, "(function object)"],
[153, "(function int)"],
[154, "(function target)"],
[169, "(function symbol debug-menu-msg float float float)"],
[170, "(function symbol debug-menu-msg float float float)"],
[172, "(function symbol debug-menu-msg float float float)"],
[173, "(function symbol debug-menu-msg float float float)"],
[174, "(function symbol debug-menu-msg float float float)"],
[175, "(function symbol debug-menu-msg float float float)"],
[176, "(function symbol debug-menu-msg float float float)"],
[177, "(function symbol debug-menu-msg float float float)"],
[178, "(function symbol debug-menu-msg float float float)"],
[179, "(function symbol debug-menu-msg float float float)"],
[180, "(function symbol debug-menu-msg float float float)"],
[181, "(function symbol debug-menu-msg float float float)"],
[182, "(function symbol debug-menu-msg float float float)"],
[183, "(function symbol debug-menu-msg float float float)"],
[184, "(function symbol debug-menu-msg float float float)"],
[185, "(function symbol debug-menu-msg float float float)"],
[186, "(function symbol debug-menu-msg float float float)"],
[187, "(function symbol debug-menu-msg float float float)"],
[188, "(function symbol debug-menu-msg float float float)"],
[189, "(function none)"],
[190, "(function none)"],
[191, "(function symbol debug-menu-msg float float float)"],
[193, "(function symbol int object)"],
[198, "(function debug-menu debug-menu symbol)"],
[199, "(function debug-menu debug-menu symbol)"],
[200, "(function debug-menu debug-menu symbol)"],
[201, "(function debug-menu debug-menu symbol)"]
]
}
+7 -1
View File
@@ -188,7 +188,13 @@
"command-get-time",
"command-get-param",
"command-get-quoted-param",
"command-get-entity"
"command-get-entity",
// default-menu
"dm-scene-load-pick-func",
"debug-menu-make-continue-sub-menu",
"debug-menu-make-from-template",
"debug-menu-context-make-default-menus",
"debug-menu-make-task-menu"
],
// If format is used with the wrong number of arguments,
+14
View File
@@ -85,5 +85,19 @@
["L96", "vector4"],
["L95", "matrix"],
["L96", "vector4w"]
],
"sky-data": [
["L26", "(inline-array sky-vertex)", 12],
["L25", "(inline-array sky-vertex)", 12],
["L23", "(inline-array cloud-vertex)", 277],
["L21", "(inline-array haze-vertex)", 144]
],
"default-menu": [
["L6314", "(pointer uint64)", 1],
["L6313", "(pointer uint64)", 1],
["L6312", "(pointer uint64)", 1],
["L6311", "(pointer uint64)", 1],
["L6310", "(pointer uint64)", 1],
["L6309", "(pointer uint64)", 1]
]
}
+139 -1
View File
@@ -616,7 +616,7 @@
[[454, 467], "a0", "handle"],
[[455, 462], "v1", "handle"]
],
"(method 9 art)": [
"(method 9 art)": [
[9, "v1", "pointer"]
],
"(method 12 art-group)":[
@@ -698,6 +698,144 @@
// [58, "v1", "matrix"],
[[43, 49], "v1", "matrix"]
],
"init-haze-vert-array": [
[43, "a0", "cloud-vertex"],
[44, "v1", "cloud-vertex"]
],
"sky-make-sun-data": [[[7, 58], "s3", "sky-sun-data"]],
"(anon-function 7 relocate)": [
[3, "a0", "int"],
[8, "a0", "int"]
],
"(method 7 process)": [
[[47, 88], "v1", "connection"],
[[120, 124], "a0", "basic"],
[[127, 130], "a0", "basic"]
],
"(method 7 collide-shape-prim-group)": [[4, "v1", "pointer"]],
"all-texture-tweak-adjust": [[[35, 44], "s0", "adgif-shader"]],
"dm-float-field-tie-rvanish-func": [[[14, 45], "gp", "prototype-bucket-tie"]],
"dm-float-field-tie-vanish-far-func": [
[[14, 45], "gp", "prototype-bucket-tie"]
],
"build-instance-list": [
[33, "v1", "drawable-tree-instance-shrub"],
[85, "v1", "drawable-tree-instance-tie"]
],
"debug-menu-make-continue-sub-menu": [
[5, "v1", "symbol"],
[10, "v1", "level-load-info"],
[13, "v1", "level-load-info"],
[21, "v1", "continue-point"],
[47, "v1", "continue-point"],
[56, "v1", "continue-point"]
],
"(anon-function 191 default-menu)": [
[[30, 37], "s5", "adgif-shader"],
[[5, 25], "s4", "texture-id"]
],
"(anon-function 188 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 187 default-menu)": [
[[2, 13], "v1", "texture-id"],
[[18, 29], "a1", "adgif-shader"],
[34, "v1", "texture-id"],
[[42, 44], "v1", "adgif-shader"]
],
"(anon-function 186 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 185 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 184 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 183 default-menu)": [
[[2, 13], "v1", "texture-id"],
[[18, 29], "a1", "adgif-shader"],
[34, "v1", "texture-id"],
[[42, 44], "v1", "adgif-shader"]
],
"(anon-function 182 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 181 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 180 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 179 default-menu)": [
[[2, 13], "v1", "texture-id"],
[[18, 29], "a1", "adgif-shader"],
[34, "v1", "texture-id"],
[[42, 44], "v1", "adgif-shader"]
],
"(anon-function 178 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 177 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 176 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 175 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 174 default-menu)": [
[[3, 13], "v1", "texture-id"],
[[20, 28], "a1", "adgif-shader"],
[33, "v1", "texture-id"],
[41, "v1", "adgif-shader"]
],
"(anon-function 173 default-menu)": [
[[2, 13], "v1", "texture-id"],
[[18, 29], "a1", "adgif-shader"],
[34, "v1", "texture-id"],
[[42, 44], "v1", "adgif-shader"]
],
"(anon-function 172 default-menu)": [
[[2, 13], "v1", "texture-id"],
[[18, 29], "a1", "adgif-shader"],
[34, "v1", "texture-id"],
[[42, 44], "v1", "adgif-shader"]
],
// placeholder
"placeholder-do-not-add-below": []
}
+10 -14
View File
@@ -11,6 +11,7 @@
)
;; +++track-mode
(defenum track-mode
:bitfield #t
:type uint16
@@ -22,6 +23,7 @@
(no-rotate 5) ;; 32
(no-scale 6) ;; 64
)
;; ---track-mode
;; DECOMP BEGINS
@@ -78,6 +80,7 @@
)
)
(deftype try-to-look-at-info (basic)
((who uint64 :offset-assert 8)
(horz float :offset-assert 16)
@@ -125,20 +128,6 @@
)
)
(defmethod inspect joint-mod-wheel ((obj joint-mod-wheel))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tlast-position: #<vector @ #x~X>~%" (-> obj last-position))
(format #t "~1Tangle: ~f~%" (-> obj angle))
(format #t "~1Tprocess: ~A~%" (-> obj process))
(format #t "~1Twheel-radius: ~f~%" (-> obj wheel-radius))
(format #t "~1Twheel-axis: ~D~%" (-> obj wheel-axis))
(label cfg-4)
obj
)
(defun joint-mod-wheel-callback ((arg0 cspace) (arg1 transformq))
(let ((s4-0 (the-as joint-mod-wheel (-> arg0 param1))))
@@ -197,6 +186,7 @@
)
)
(defun joint-mod-set-local-callback ((arg0 cspace) (arg1 transformq))
(let ((v1-0 (the-as joint-mod-set-local (-> arg0 param1))))
(cond
@@ -259,6 +249,7 @@
)
)
(defun joint-mod-add-local-callback ((arg0 cspace) (arg1 transformq))
(let ((s4-0 (the-as joint-mod-add-local (-> arg0 param1))))
(when (-> s4-0 enable)
@@ -314,6 +305,7 @@
)
)
(defun joint-mod-set-world-callback ((arg0 cspace) (arg1 transformq))
(let ((v1-0 (the-as joint-mod-set-world (-> arg0 param1))))
(if (-> v1-0 enable)
@@ -354,6 +346,7 @@
)
)
(defun joint-mod-blend-local-callback ((arg0 cspace) (arg1 transformq))
(let ((gp-0 (the-as joint-mod-blend-local (-> arg0 param1))))
(cond
@@ -406,6 +399,7 @@
)
)
(defun joint-mod-spinner-callback ((arg0 cspace) (arg1 transformq))
(with-pp
(let ((gp-0 (the-as joint-mod-spinner (-> arg0 param1))))
@@ -456,6 +450,7 @@
)
)
(defun joint-mod-blend-world-callback ((arg0 cspace) (arg1 transformq))
(rlet ((vf0 :class vf)
(vf4 :class vf)
@@ -561,6 +556,7 @@
)
)
(defun joint-mod-rotate-local-callback ((arg0 cspace) (arg1 transformq))
(let ((v1-0 (the-as joint-mod-rotate-local (-> arg0 param1))))
(new 'stack-no-clear 'vector)
+16 -1
View File
@@ -20,6 +20,21 @@
(between 3)
)
(defenum camera-slave-options
:type uint32
:bitfield #t
(butt-cam)
(same-side)
(move-spherical)
(allow-z-rot)
(pitch-for-jump)
(collide)
(find-hidden-target)
(drag)
(line-of-sight)
(no-rotate)
(sticky-angle))
;; NOTE - for settings
(declare-type camera-slave process)
(define-extern cam-master-set-entity (function cam-setting-data none))
@@ -303,7 +318,7 @@
(circular-follow vector :inline :offset-assert 2256)
(max-angle-offset float :offset-assert 2272)
(max-angle-curr float :offset-assert 2276)
(options uint32 :offset-assert 2280)
(options camera-slave-options :offset-assert 2280)
(cam-entity entity :offset-assert 2284)
(butt-timer uint64 :offset-assert 2288)
(butt-seek basic :offset-assert 2296)
@@ -9,6 +9,7 @@
(deftype control-info (collide-shape-moving)
((unknown-qword00 vector :offset 12)
(unknown-float00 float :offset 528)
(unknown-surface00 surface :offset 3832)
(unknown-cpad-info00 cpad-info :offset 3848)
(unknown-time-frame00 time-frame :offset 4624)
+2 -2
View File
@@ -184,9 +184,9 @@
(deftype entity-info (basic)
((ptype type :offset-assert 4)
(package basic :offset-assert 8)
(package string :offset-assert 8)
(art-group pair :offset-assert 12)
(pool basic :offset-assert 16)
(pool symbol :offset-assert 16)
(heap-size int32 :offset-assert 20)
)
:method-count-assert 9
+216
View File
@@ -7,3 +7,219 @@
;; DECOMP BEGINS
(define *entity-info* (the-as (array entity-info) (new 'static 'boxed-array :type entity-info
(new 'static 'entity-info
:ptype (type-ref stadium-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref citywide-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctywide-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref tomb-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctyslumb-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctygena-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctyindb-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref jellyfish :method-count 167)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x10000
)
(new 'static 'entity-info
:ptype (type-ref widow :method-count 47)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x10000
)
(new 'static 'entity-info
:ptype (type-ref nav-graph :method-count 47)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref pal-electric-fan :method-count 23)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x6000
)
(new 'static 'entity-info
:ptype (type-ref lurker-pipe-lid :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctyn-lamp :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref burning-bush :method-count 35)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref sail-boat-a :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref barge :method-count 151)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref propa :method-count 35)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref city-window-a :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref cty-window-a :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref parking-spot :method-count 27)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref security-wall :method-count 27)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref cty-guard-turret :method-count 39)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref cty-fruit-stand :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref fruit-stand :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref torn :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref neon-baron :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x10000
)
)
)
)
(defun entity-info-lookup ((arg0 type))
"Given a type, return the [[entity-info]] from [[*entity-info*]] whos type
matches the `ptype` field. Set's `method 13` on said type that returns the `length`
off the [[entity-info]]
If nothing matches, set `method 13` to `#f` and return `#f`"
(the-as entity-info (cond
((nonzero? (-> arg0 method-table 13))
(-> arg0 method-table 13)
)
(else
(let ((v1-1 *entity-info*))
(dotimes (a1-0 (-> v1-1 length))
(when (= arg0 (-> v1-1 a1-0 ptype))
(set! (-> arg0 method-table 13) (the-as function (-> v1-1 a1-0)))
(return (the-as entity-info (-> v1-1 a1-0)))
)
)
)
(set! (-> arg0 method-table 13) #f)
(the-as basic #f)
)
)
)
)
+387
View File
@@ -7,3 +7,390 @@
;; DECOMP BEGINS
(defmethod relocate process ((obj process) (arg0 int))
(let ((v1-0 *kernel-context*))
(set! (-> v1-0 relocating-process) obj)
(set! (-> v1-0 relocating-min) (the-as int (&-> obj type)))
(set! (-> v1-0 relocating-max)
(the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj)))
)
(set! (-> v1-0 relocating-offset) arg0)
)
(&+! (-> obj ppointer 0) arg0)
(let ((v1-5 (-> obj entity)))
(if (and v1-5 (= (-> v1-5 extra process) obj))
(&+! (-> v1-5 extra process) arg0)
)
)
(let ((v1-7 (-> obj connection-list next1)))
(while (the-as connection v1-7)
(let ((a0-14 (-> v1-7 prev1)))
(if (and (>= (the-as int a0-14) (-> *kernel-context* relocating-min))
(< (the-as int a0-14) (-> *kernel-context* relocating-max))
)
(&+! (-> v1-7 prev1) arg0)
)
)
(let ((a0-19 (-> (the-as connection v1-7) param1)))
(if (and (>= a0-19 (-> *kernel-context* relocating-min)) (< a0-19 (-> *kernel-context* relocating-max)))
(+! (-> (the-as connection v1-7) param1) arg0)
)
)
(let ((a0-24 (-> (the-as connection v1-7) param2)))
(if (and (>= a0-24 (-> *kernel-context* relocating-min)) (< a0-24 (-> *kernel-context* relocating-max)))
(+! (-> (the-as connection v1-7) param2) arg0)
)
)
(let ((a0-29 (-> (the-as connection v1-7) param3)))
(if (and (>= a0-29 (-> *kernel-context* relocating-min)) (< a0-29 (-> *kernel-context* relocating-max)))
(+! (-> (the-as connection v1-7) param3) arg0)
)
)
(set! v1-7 (-> (the-as connection v1-7) next1))
)
)
(let ((v1-10 (-> obj self)))
(if (and (>= (the-as int v1-10) (-> *kernel-context* relocating-min))
(< (the-as int v1-10) (-> *kernel-context* relocating-max))
)
(&+! (-> obj self) arg0)
)
)
(let ((v1-15 (-> obj ppointer)))
(if (and (>= (the-as int v1-15) (-> *kernel-context* relocating-min))
(< (the-as int v1-15) (-> *kernel-context* relocating-max))
)
(&+! (-> obj ppointer) arg0)
)
)
(let ((s4-0 (&+ (-> obj heap-base) 4)))
(while (< (the-as int s4-0) (the-as int (-> obj heap-cur)))
(relocate s4-0 arg0)
(&+! s4-0 (logand -16 (+ (asize-of s4-0) 15)))
)
)
(&+! (-> obj main-thread) arg0)
(&+! (-> obj top-thread) arg0)
(&+! (-> obj heap-base) arg0)
(&+! (-> obj heap-cur) arg0)
(&+! (-> obj heap-top) arg0)
(let ((a2-4 (asize-of obj))
(a1-22 (&-> obj type))
)
(cond
((>= arg0 0)
(qmem-copy->! (&+ a1-22 arg0) a1-22 a2-4)
)
((< a2-4 2560)
(qmem-copy<-! (&+ a1-22 arg0) a1-22 a2-4)
)
(else
(ultimate-memcpy (&+ a1-22 arg0) a1-22 (the-as uint a2-4))
)
)
)
(set! (-> *kernel-context* relocating-process) #f)
(&+ obj arg0)
)
(defmethod relocate cpu-thread ((obj cpu-thread) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate process-drawable ((obj process-drawable) (arg0 int))
(let ((v1-0 *kernel-context*))
(set! (-> v1-0 relocating-process) obj)
(set! (-> v1-0 relocating-min) (the-as int (&-> obj type)))
(set! (-> v1-0 relocating-max)
(the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj)))
)
(set! (-> v1-0 relocating-offset) arg0)
)
(let ((a0-6 (-> obj nav)))
(if (and (nonzero? a0-6) a0-6)
(relocate a0-6 arg0)
)
)
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj node-list))
(&+! (-> obj node-list) arg0)
)
(if (nonzero? (-> obj draw))
(&+! (-> obj draw) arg0)
)
(if (nonzero? (-> obj skel))
(&+! (-> obj skel) arg0)
)
(if (nonzero? (-> obj align))
(&+! (-> obj align) arg0)
)
(if (nonzero? (-> obj path))
(&+! (-> obj path) arg0)
)
(if (nonzero? (-> obj vol))
(&+! (-> obj vol) arg0)
)
(if (nonzero? (-> obj fact))
(&+! (-> obj fact) arg0)
)
(if (nonzero? (-> obj link))
(&+! (-> obj link) arg0)
)
(if (nonzero? (-> obj part))
(&+! (-> obj part) arg0)
)
(if (nonzero? (-> obj water))
(&+! (-> obj water) arg0)
)
(if (nonzero? (-> obj sound))
(&+! (-> obj sound) arg0)
)
(if (nonzero? (-> obj carry))
(&+! (-> obj carry) arg0)
)
(if (nonzero? (-> obj rbody))
(&+! (-> obj rbody) arg0)
)
(the-as process-drawable ((method-of-type process relocate) obj arg0))
)
(defmethod relocate collide-shape ((obj collide-shape) (arg0 int))
(&+! (-> obj process) arg0)
(&+! (-> obj root-prim) arg0)
obj
)
(defmethod relocate collide-shape-moving ((obj collide-shape-moving) (arg0 int))
(if (-> obj dynam)
(&+! (-> obj dynam) arg0)
)
(the-as collide-shape-moving ((method-of-type collide-shape relocate) obj arg0))
)
(defmethod relocate collide-shape-prim ((obj collide-shape-prim) (arg0 int))
(&+! (-> obj cshape) arg0)
obj
)
(defmethod relocate collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 int))
(&+! (-> obj cshape) arg0)
(set! (-> obj child) (the-as (inline-array collide-shape) (&+ (the-as pointer (-> obj child)) arg0)))
obj
)
(defmethod relocate fact-info ((obj fact-info) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate draw-control ((obj draw-control) (arg0 int))
(&+! (-> obj skeleton) arg0)
(&+! (-> obj process) arg0)
(when (-> obj ripple)
(if (-> obj ripple query)
(&+! (-> obj ripple query) arg0)
)
(&+! (-> obj ripple) arg0)
)
(let ((v1-14 (-> obj shadow-ctrl)))
(if (and (>= (the-as int v1-14) (-> *kernel-context* relocating-min))
(< (the-as int v1-14) (-> *kernel-context* relocating-max))
)
(&+! (-> obj shadow-ctrl) arg0)
)
)
obj
)
(defmethod relocate joint-control ((obj joint-control) (arg0 int))
(if (-> obj effect)
(&+! (-> obj effect) arg0)
)
(if (-> obj top-anim)
(&+! (-> obj top-anim) arg0)
)
(+! (-> obj root-channel) arg0)
(countdown (v1-10 (-> obj allocated-length))
(&+! (-> obj channel v1-10 parent) arg0)
)
obj
)
(defmethod relocate cspace-array ((obj cspace-array) (arg0 int))
(countdown (v1-0 (-> obj length))
(let ((a2-2 (-> obj data v1-0)))
(if (-> a2-2 parent)
(&+! (-> a2-2 parent) arg0)
)
(&+! (-> a2-2 bone) arg0)
(let ((a3-6 (-> a2-2 param1)))
(if (and (>= (the-as int a3-6) (-> *kernel-context* relocating-min))
(< (the-as int a3-6) (-> *kernel-context* relocating-max))
)
(&+! (-> a2-2 param1) arg0)
)
)
(let ((a3-11 (-> a2-2 param2)))
(if (and (>= (the-as int a3-11) (-> *kernel-context* relocating-min))
(< (the-as int a3-11) (-> *kernel-context* relocating-max))
)
(&+! (-> a2-2 param2) arg0)
)
)
)
)
obj
)
(defmethod relocate path-control ((obj path-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate vol-control ((obj vol-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate water-control ((obj water-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate actor-link-info ((obj actor-link-info) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate align-control ((obj align-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate joint-mod ((obj joint-mod) (arg0 int))
(&+! (-> obj process) arg0)
(&+! (-> obj joint) arg0)
obj
)
(defmethod relocate joint-mod-wheel ((obj joint-mod-wheel) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate joint-mod-ik ((obj joint-mod-ik) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate effect-control ((obj effect-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
(defmethod relocate sparticle-launch-control ((obj sparticle-launch-control) (arg0 int))
(&+! (-> obj proc) arg0)
(countdown (v1-2 (-> obj length))
(let* ((a0-4 (-> obj data v1-2))
(a2-0 (-> a0-4 center))
)
(if (and (>= (the-as int a2-0) (-> *kernel-context* relocating-min))
(< (the-as int a2-0) (-> *kernel-context* relocating-max))
)
(&+! (-> a0-4 center) arg0)
)
)
)
(forall-particles-with-key
obj
(lambda ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(let ((v1-1 (-> *kernel-context* relocating-offset)))
(set! (-> arg1 key) (the-as sparticle-launch-control (+ (the-as int (-> arg1 key)) v1-1)))
(if (-> arg1 binding)
(set! (-> arg1 binding) (the-as sparticle-launch-state (+ (the-as int (-> arg1 binding)) v1-1)))
)
)
0
(none)
)
#t
#t
)
obj
)
(defmethod relocate camera-master ((obj camera-master) (arg0 int))
(if (nonzero? (-> obj water-drip))
(&+! (-> obj water-drip) arg0)
)
(the-as camera-master ((method-of-type process relocate) obj arg0))
)
(defmethod relocate time-of-day-proc ((obj time-of-day-proc) (arg0 int))
(if (nonzero? (-> obj sun))
(&+! (-> obj sun) arg0)
)
(if (nonzero? (-> obj green-sun))
(&+! (-> obj green-sun) arg0)
)
(if (nonzero? (-> obj moon))
(&+! (-> obj moon) arg0)
)
(the-as time-of-day-proc ((method-of-type process relocate) obj arg0))
)
(defmethod relocate part-tracker ((obj part-tracker) (arg0 int))
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj part))
(&+! (-> obj part) arg0)
)
(the-as part-tracker ((method-of-type process relocate) obj arg0))
)
(defmethod relocate part-spawner ((obj part-spawner) (arg0 int))
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj part))
(&+! (-> obj part) arg0)
)
(if (nonzero? (-> obj sound))
(&+! (-> obj sound) arg0)
)
(the-as part-spawner ((method-of-type process relocate) obj arg0))
)
(defmethod relocate lightning-tracker ((obj lightning-tracker) (arg0 int))
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj lightning))
(&+! (-> obj lightning) arg0)
)
(the-as lightning-tracker ((method-of-type process relocate) obj arg0))
)
(defmethod relocate manipy ((obj manipy) (arg0 int))
(if (nonzero? (-> obj joint 0))
(&+! (-> obj joint 0) arg0)
)
(if (nonzero? (-> obj joint 1))
(&+! (-> obj joint 1) arg0)
)
(if (nonzero? (-> obj joint 2))
(&+! (-> obj joint 2) arg0)
)
(if (nonzero? (-> obj joint 3))
(&+! (-> obj joint 3) arg0)
)
(the-as manipy ((method-of-type process-drawable relocate) obj arg0))
)
+174 -152
View File
@@ -68,8 +68,68 @@
(cf30 30)
)
(defenum game-feature
:type uint64
:bitfield #t
(unk-game-feature-01)
(unk-game-feature-02)
(unk-game-feature-03)
(unk-game-feature-04)
(unk-game-feature-05)
(unk-game-feature-06)
(gun-yellow)
(gun-red)
(gun-blue)
(gun-dark)
(board)
(carry)
(sidekick)
(darkjak)
(gun-upgrade-speed)
(gun-upgrade-ammo)
(gun-upgrade-damage)
(unk-game-feature-18)
(pass-red)
(pass-green)
(pass-yellow)
(unk-game-feature-22)
(darkjak-bomb0)
(darkjak-bomb1)
(darkjak-invinc)
(darkjak-giant)
(board-training))
(defenum game-secrets
:type uint32
:bitfield #t
(toggle-beard)
(hflip-screen)
(endless-ammo)
(invulnerable)
(endless-dark)
(scene-player-1)
(scene-player-2)
(scene-player-3)
(level-select)
(scrap-book-1)
(scrap-book-2)
(gungame-blue)
(gungame-dark)
(reverse-races)
(hero-mode)
(big-head)
(little-head))
(declare-type game-info basic)
(define-extern *game-info* game-info)
(declare-type process-drawable process)
(define-extern process-drawable-art-error (state string process-drawable))
(define-extern part-group-pointer? (function pointer symbol))
;; DECOMP BEGINS
(local-vars (gp-0 game-info))
(deftype game-bank (basic)
((life-max-default float :offset-assert 4)
(life-start-default float :offset-assert 8)
@@ -82,6 +142,7 @@
:flag-assert #x900000018
)
(define *GAME-bank* (new 'static 'game-bank
:life-max-default 99.0
:life-start-default 5.0
@@ -113,6 +174,7 @@
)
)
(deftype level-buffer-state (structure)
((name symbol :offset-assert 0)
(display? symbol :offset-assert 4)
@@ -125,6 +187,7 @@
:flag-assert #x900000010
)
(deftype load-state (basic)
((want level-buffer-state 6 :inline :offset-assert 4)
(want-sound symbol 3 :offset-assert 100)
@@ -154,25 +217,6 @@
)
)
(defmethod inspect load-state ((obj load-state))
(when (not obj)
(return obj)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Twant[6] @ #x~X~%" (-> obj want))
(dotimes (s5-0 6)
(format #t "~T [~D]~1Twant: ~`level-buffer-state`P~%" s5-0 (-> obj want s5-0))
)
(format #t "~1Twant-sound[3] @ #x~X~%" (-> obj want-sound))
(dotimes (s5-1 3)
(format #t "~T [~D]~1Twant-sound: ~`symbol`P~%" s5-1 (-> obj want-sound s5-1))
)
(format #t "~1Tvis-nick: ~A~%" (-> obj vis-nick))
(format #t "~1Tcommand-list: ~A~%" (-> obj command-list))
(format #t "~1Tobject-name[256] @ #x~X~%" (-> obj object-name))
(format #t "~1Tobject-status[256] @ #x~X~%" (-> obj object-status))
obj
)
(defmethod new load-state ((allocation symbol) (type-to-make type))
(reset! (object-new allocation type-to-make (the-as int (-> type-to-make size))))
@@ -201,126 +245,104 @@
)
)
(defmethod inspect continue-point ((obj continue-point))
(when (not obj)
(return obj)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tname: ~A~%" (-> obj name))
(format #t "~1Tlevel: ~A~%" (-> obj level))
(format #t "~1Tflags: ~D~%" (-> obj flags))
(format #t "~1Ttrans: ~`vector`P~%" (-> obj trans))
(format #t "~1Tquat: ~`vector`P~%" (-> obj quat))
(format #t "~1Tcamera-trans: ~`vector`P~%" (-> obj camera-trans))
(format #t "~1Tcamera-rot[9] @ #x~X~%" (-> obj camera-rot))
(format #t "~1Ton-goto: ~A~%" (-> obj on-goto))
(format #t "~1Tvis-nick: ~A~%" (-> obj vis-nick))
(format #t "~1Twant[6] @ #x~X~%" (-> obj want))
(dotimes (s5-0 6)
(format #t "~T [~D]~1Twant: ~`level-buffer-state`P~%" s5-0 (-> obj want s5-0))
)
(format #t "~1Twant-sound[3] @ #x~X~%" (-> obj want-sound))
(dotimes (s5-1 3)
(format #t "~T [~D]~1Twant-sound: ~`symbol`P~%" s5-1 (-> obj want-sound s5-1))
)
obj
)
(deftype game-info (basic)
((mode symbol :offset-assert 4)
(save-name string :offset-assert 8)
(life float :offset-assert 12)
(life-max float :offset-assert 16)
(money float :offset-assert 20)
(money-total float :offset-assert 24)
(money-per-level uint8 32 :offset-assert 28)
(deaths-per-level uint8 32 :offset-assert 60)
(buzzer-total float :offset-assert 92)
(fuel float :offset-assert 96)
(gem float :offset-assert 100)
(gem-total float :offset-assert 104)
(skill float :offset-assert 108)
(skill-total float :offset-assert 112)
(karma float :offset-assert 116)
(eco-pill-dark float :offset-assert 120)
(eco-pill-dark-total float :offset-assert 124)
(features uint64 :offset-assert 128)
(debug-features uint64 :offset-assert 136)
(secrets uint32 :offset-assert 144)
(unknown-pad1 uint32 :offset-assert 148)
(purchase-secrets uint32 :offset-assert 152)
(unknown-pad2 uint32 :offset-assert 156)
(gun-type int32 :offset-assert 160)
(gun-ammo float 4 :offset-assert 164)
(shield float :offset-assert 180)
(score float :offset-assert 184)
(score-owner uint64 :offset-assert 192)
(timer uint64 :offset-assert 200)
(timer-owner uint64 :offset-assert 208)
(timer-flash basic :offset-assert 216)
(counter float :offset-assert 220)
(counter-flash basic :offset-assert 224)
(attack-id uint32 :offset-assert 228)
(perm-list entity-perm-array :offset-assert 232)
(task-perm-list entity-perm-array :offset-assert 236)
(current-continue continue-point :offset-assert 240)
(last-continue continue-point :offset-assert 244)
(unknown-pad3 uint32 3 :offset-assert 248)
(task-counter uint32 :offset-assert 260)
(unknown-pad4 uint32 :offset-assert 264)
(level-opened uint8 32 :offset-assert 268)
(total-deaths int32 :offset-assert 300)
(continue-deaths int32 :offset-assert 304)
(task-deaths int32 :offset-assert 308)
(total-trys int32 :offset-assert 312)
(game-start-time time-frame :offset-assert 320)
(continue-time time-frame :offset-assert 328)
(death-time time-frame :offset-assert 336)
(hit-time time-frame :offset-assert 344)
(task-pickup-time time-frame :offset-assert 352)
(unknown-array1 (array uint64) :offset-assert 360)
(unknown-array2 (array uint64) :offset-assert 364)
(unknown-array3 (array uint64) :offset-assert 368)
(death-pos vector-array :offset 372)
(stop-watch-start uint64 :offset-assert 376)
(stop-watch-stop uint64 :offset-assert 384)
(blackout-time time-frame :offset-assert 392)
(letterbox-time time-frame :offset-assert 400)
(hint-play-time time-frame :offset-assert 408)
(display-text-time time-frame :offset-assert 416)
(display-text-handle uint64 :offset-assert 424)
(death-movie-tick int32 :offset-assert 432)
(want-auto-save symbol :offset-assert 436)
(auto-save-proc handle :offset-assert 440)
(auto-save-status mc-status-code :offset-assert 448)
(auto-save-card int32 :offset-assert 452)
(auto-save-which int32 :offset-assert 456)
(auto-save-count int32 :offset-assert 460)
(pov-camera-handle uint64 :offset-assert 464)
(other-camera-handle uint64 :offset-assert 472)
(controller uint64 2 :offset-assert 480)
(race-timer uint64 :offset-assert 496)
(race-current-lap-count int32 :offset-assert 504)
(race-total-lap-count int32 :offset-assert 508)
(race-position int32 :offset-assert 512)
(race-number-turbos int32 :offset-assert 516)
(bot-health uint32 3 :offset-assert 520)
(demo-state uint32 :offset-assert 532)
(wanted-flash basic :offset-assert 536)
(distance float :offset-assert 540)
(kiosk-timeout uint64 :offset-assert 544)
(pause-start-time time-frame :offset-assert 552)
(game-score (array highscore-info) :offset-assert 560)
(goal float :offset-assert 564)
(miss float :offset-assert 568)
(miss-max float :offset-assert 572)
(unknown-array4 (array uint64) :offset-assert 576)
(live-eco-pill-count int32 :offset-assert 580)
(live-gem-count int32 :offset-assert 584)
(air-supply float :offset-assert 588)
(homing-beacon int32 :offset-assert 592)
(dark-eco-pickup int32 :offset-assert 596)
(green-eco-pickup int32 :offset-assert 600)
((mode symbol :offset-assert 4)
(save-name string :offset-assert 8)
(life float :offset-assert 12)
(life-max float :offset-assert 16)
(money float :offset-assert 20)
(money-total float :offset-assert 24)
(money-per-level uint8 32 :offset-assert 28)
(deaths-per-level uint8 32 :offset-assert 60)
(buzzer-total float :offset-assert 92)
(fuel float :offset-assert 96)
(gem float :offset-assert 100)
(gem-total float :offset-assert 104)
(skill float :offset-assert 108)
(skill-total float :offset-assert 112)
(karma float :offset-assert 116)
(eco-pill-dark float :offset-assert 120)
(eco-pill-dark-total float :offset-assert 124)
(features game-feature :offset-assert 128)
(debug-features game-feature :offset-assert 136)
(secrets game-secrets :offset-assert 144)
(unknown-pad1 uint32 :offset-assert 148)
(purchase-secrets uint32 :offset-assert 152)
(unknown-pad2 uint32 :offset-assert 156)
(gun-type int32 :offset-assert 160)
(gun-ammo float 4 :offset-assert 164)
(shield float :offset-assert 180)
(score float :offset-assert 184)
(score-owner uint64 :offset-assert 192)
(timer uint64 :offset-assert 200)
(timer-owner uint64 :offset-assert 208)
(timer-flash basic :offset-assert 216)
(counter float :offset-assert 220)
(counter-flash basic :offset-assert 224)
(attack-id uint32 :offset-assert 228)
(perm-list entity-perm-array :offset-assert 232)
(task-perm-list entity-perm-array :offset-assert 236)
(current-continue continue-point :offset-assert 240)
(last-continue continue-point :offset-assert 244)
(unknown-pad3 array :offset-assert 248)
(unknown-pad4 array :offset-assert 252)
(unknown-pad5 array :offset-assert 256)
(task-counter uint32 :offset-assert 260)
(unknown-pad6 uint32 :offset-assert 264)
(level-opened uint8 32 :offset-assert 268)
(total-deaths int32 :offset-assert 300)
(continue-deaths int32 :offset-assert 304)
(task-deaths int32 :offset-assert 308)
(total-trys int32 :offset-assert 312)
(game-start-time time-frame :offset-assert 320)
(continue-time time-frame :offset-assert 328)
(death-time time-frame :offset-assert 336)
(hit-time time-frame :offset-assert 344)
(task-pickup-time time-frame :offset-assert 352)
(unknown-array1 (array uint64) :offset-assert 360)
(unknown-array2 (array uint64) :offset-assert 364)
(unknown-array3 (array uint64) :offset-assert 368)
(death-pos vector-array :offset 372)
(stop-watch-start uint64 :offset-assert 376)
(stop-watch-stop uint64 :offset-assert 384)
(blackout-time time-frame :offset-assert 392)
(letterbox-time time-frame :offset-assert 400)
(hint-play-time time-frame :offset-assert 408)
(display-text-time time-frame :offset-assert 416)
(display-text-handle uint64 :offset-assert 424)
(death-movie-tick int32 :offset-assert 432)
(want-auto-save symbol :offset-assert 436)
(auto-save-proc handle :offset-assert 440)
(auto-save-status mc-status-code :offset-assert 448)
(auto-save-card int32 :offset-assert 452)
(auto-save-which int32 :offset-assert 456)
(auto-save-count int32 :offset-assert 460)
(pov-camera-handle uint64 :offset-assert 464)
(other-camera-handle uint64 :offset-assert 472)
(controller uint64 2 :offset-assert 480)
(race-timer uint64 :offset-assert 496)
(race-current-lap-count int32 :offset-assert 504)
(race-total-lap-count int32 :offset-assert 508)
(race-position int32 :offset-assert 512)
(race-number-turbos int32 :offset-assert 516)
(bot-health uint32 3 :offset-assert 520)
(demo-state uint32 :offset-assert 532)
(wanted-flash basic :offset-assert 536)
(distance float :offset-assert 540)
(kiosk-timeout uint64 :offset-assert 544)
(pause-start-time time-frame :offset-assert 552)
(game-score (array highscore-info) :offset-assert 560)
(goal float :offset-assert 564)
(miss float :offset-assert 568)
(miss-max float :offset-assert 572)
(unknown-array4 (array uint64) :offset-assert 576)
(live-eco-pill-count int32 :offset-assert 580)
(live-gem-count int32 :offset-assert 584)
(air-supply float :offset-assert 588)
(homing-beacon int32 :offset-assert 592)
(dark-eco-pickup int32 :offset-assert 596)
(green-eco-pickup int32 :offset-assert 600)
)
:method-count-assert 31
:size-assert #x25c
@@ -336,8 +358,8 @@
(copy-perms-from-level! (_type_ level) none 16)
(copy-perms-to-level! (_type_ level) none 17)
(game-info-method-18 () none 18)
(game-info-method-19 () none 19)
(game-info-method-20 () none 20)
(get-current-continue-point (_type_) continue-point 19)
(get-continue-by-name (_type_ string) continue-point 20)
(set-continue! (_type_ basic) continue-point 21)
(game-info-method-22 () none 22)
(game-info-method-23 () none 23)
@@ -359,17 +381,17 @@
)
)
(define-extern *game-info* game-info)
(when (or (not *game-info*) (zero? *game-info*))
(let ((gp-0 (new 'static 'game-info :mode 'debug :current-continue #f :last-continue #f)))
(set! (-> gp-0 unknown-array1) (the-as (array uint64) (new 'global 'boxed-array uint64 110)))
(set! (-> gp-0 unknown-array4) (the-as (array uint64) (new 'global 'boxed-array uint64 110)))
(set! (-> gp-0 unknown-array2) (the-as (array uint64) (new 'global 'boxed-array uint64 32)))
(set! (-> gp-0 unknown-array3) (the-as (array uint64) (new 'global 'boxed-array uint64 32)))
(set! *game-info* gp-0)
)
)
(set! gp-0 (when (or (not *game-info*) (zero? *game-info*))
(set! gp-0 (new 'static 'game-info :mode 'debug :current-continue #f :last-continue #f))
(set! (-> gp-0 unknown-array1) (the-as (array uint64) (new 'global 'boxed-array uint64 110)))
(set! (-> gp-0 unknown-array4) (the-as (array uint64) (new 'global 'boxed-array uint64 110)))
(set! (-> gp-0 unknown-array2) (the-as (array uint64) (new 'global 'boxed-array uint64 32)))
(set! (-> gp-0 unknown-array3) (the-as (array uint64) (new 'global 'boxed-array uint64 32)))
(set! *game-info* gp-0)
gp-0
)
)
(declare-type process-drawable process)
(define-extern process-drawable-art-error (state string process-drawable))
(define-extern part-group-pointer? (function pointer symbol))
+104 -10
View File
@@ -5,6 +5,100 @@
;; name in dgo: main-h
;; dgos: ENGINE, GAME
;; +++strip-lines-controls
(defenum strip-lines-controls
:type int64
(none 0)
(strippable 1)
(convertible 2)
(good 3)
(edgeable 4)
(ordinary 8)
(color-mismatch 16)
(shader-mismatch 32)
(uv-mismatch 64)
(too-big 128)
(bad 240)
(all-edges 255)
(strips 256)
(frags 512))
;; ---strip-lines-controls
;; +++scene-controls
(defenum scene-controls
:type int64
(all-off 0)
(channel 1)
(anim-name 2)
(dma-size 4)
(bounds-spheres 8)
(actors 16)
(actor-marks 32)
(special-fma-spheres 64)
(all-on 95))
;; ---scene-controls
;; +++bot-marks-controls
(defenum bot-marks-controls
:type int64
(all-off 0)
(course-spots 1)
(task-spots 2)
(all-on 3))
;; ---bot-marks-controls
;; +++race-marks-controls
(defenum race-marks-controls
:type int64
(all-off 0)
(path0-red 1)
(path1-green 2)
(path2-blue 4)
(path3-yellow 8)
(path4-cyan 16)
(path5-violet 32)
(path6-orange 64)
(path7-black 128)
(all-paths-on 255))
;; ---race-marks-controls
;; +++race-selection
(defenum race-selection
:type int64
(kiera-class3 0)
(kiera-class2 1)
(kiera-class1 2)
(errol 3)
(bush-class3 4)
(bush-class2 5)
(bush-class1 6)
(bush-errol 7)
(bush-port 8)
(bush-class3-reverse 9)
(bush-class2-reverse 10)
(bush-class1-reverse 11))
;; ---race-selection
;; +++subdivide-setting
(defenum subdivide-setting
:type int64
(textured 0)
(outline 1)
(gouraud 2)
(hack 3))
;; ---subdivide-setting
;; +++ocean-height-hack
(defenum ocean-height-hack
:type int64
(zero 1)
(far-below 2)
(sewer-start 3)
(sewer-hi 4)
(sewer-med 5)
(sewer-lo 6))
;; ---ocean-height-hack
;; NOTE - for settings
(define-extern *master-exit* symbol)
@@ -64,7 +158,7 @@
(define *display-instance-info* #f)
(define *display-deci-count* #f)
(define *sync-dma* #f)
(define *display-strip-lines* 0)
(define *display-strip-lines* (the-as strip-lines-controls 0))
(define *display-battle-marks* #f)
(define *display-joint-axes* #f)
(define *display-nav-marks* #f)
@@ -106,18 +200,18 @@
'*stdcon*
)
)
(define *display-scene-control* 0)
(define *display-bot-marks* 0)
(define *display-race-marks* 0)
(define *display-scene-control* (the-as scene-controls 0))
(define *display-bot-marks* (the-as bot-marks-controls 0))
(define *display-race-marks* (the-as race-marks-controls 0))
(define *race-record-path* #f)
(define *select-race* 0)
(define *select-race* (the-as race-selection 0))
(define *select-race-path* 0)
(define *bot-record-path* -1)
(define *subdivide-draw-mode* 0)
(define *subdivide-scissor-draw-mode* 0)
(define *subdivide-foreground-draw-mode* 0)
(define *subdivide-ocean-draw-mode* 0)
(define *ocean-height-hack* 0)
(define *subdivide-draw-mode* (the-as subdivide-setting 0))
(define *subdivide-scissor-draw-mode* (the-as subdivide-setting 0))
(define *subdivide-foreground-draw-mode* (the-as subdivide-setting 0))
(define *subdivide-ocean-draw-mode* (the-as subdivide-setting 0))
(define *ocean-height-hack* (the-as ocean-height-hack 0))
;; Main Loop stuff
(define-perm *dproc* process #f) ;; the main display process
+10 -54
View File
@@ -56,59 +56,6 @@
(argf 0.0)
(setting (car s)))
(cond
; ((or (eq? setting 'border-mode)
; (eq? setting 'allow-look-around)
; (eq? setting 'ocean-off)
; (eq? setting 'music)
; (eq? setting 'vibration)
; (eq? setting 'auto-save)
; (eq? setting 'allow-pause)
; (eq? setting 'allow-progress)
; (eq? setting 'play-hints)
; (eq? setting 'movie)
; (eq? setting 'talking)
; (eq? setting 'spooling)
; (eq? setting 'hint)
; (eq? setting 'ambient)
; )
; (set! argb (car args))
; )
; ((or (eq? setting 'bg-r)
; (eq? setting 'bg-g)
; (eq? setting 'bg-b)
; (eq? setting 'bg-a)
; (eq? setting 'bg-a-speed)
; (eq? setting 'bg-a-force)
; )
; (set! argf (car args))
; )
; ((or (eq? setting 'language)
; )
; (set! argi (car args))
; )
; ((or (eq? setting 'sound-flava)
; )
; (set! argi (car args))
; (set! argf (cadr args))
; )
; ((or (eq? setting 'process-mask)
; (eq? setting 'common-page)
; )
; (set! argb (car args))
; (set! argi (cadr args))
; )
; ((or (eq? setting 'sfx-volume)
; (eq? setting 'music-volume)
; (eq? setting 'ambient-volume)
; (eq? setting 'dialog-volume)
; (eq? setting 'sfx-volume-movie)
; (eq? setting 'music-volume-movie)
; (eq? setting 'ambient-volume-movie)
; (eq? setting 'dialog-volume-hint)
; )
; (set! argb (car args))
; (set! argf (cadr args))
; )
(#t
(set! argb (car args))
(set! argf (cadr args))
@@ -147,7 +94,7 @@
(ambient (pointer process) :offset-assert 56)
(video-mode symbol :offset-assert 60)
(aspect-ratio symbol :offset-assert 64)
(unknown-uint32-02 uint32 :offset 68)
(unknown-uint32-00 uint32 :offset 68)
(auto-save symbol :offset 72)
(bg-r float :offset-assert 76)
(bg-g float :offset-assert 80)
@@ -239,6 +186,7 @@
)
)
(deftype cam-setting-data (structure)
((fov degrees :offset-assert 0)
(pov-handle handle :offset 16)
@@ -304,6 +252,7 @@
)
)
(deftype setting-control (basic)
((user-current user-setting-data :inline :offset-assert 16)
(user-target user-setting-data :inline :offset-assert 544)
@@ -338,6 +287,7 @@
)
)
(defmethod new setting-control ((allocation symbol) (type-to-make type) (arg0 int))
(let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> s4-0 engine) ((method-of-type engine new) allocation engine 'setting-control arg0 connection))
@@ -348,3 +298,9 @@
s4-0
)
)
0
+8 -6
View File
@@ -931,7 +931,7 @@
(set! (-> s5-0 play-hints) (-> s4-0 play-hints))
(set! (-> s5-0 sound-bank-load) (-> s4-0 sound-bank-load))
(set! (-> s5-0 subtitle) (-> s4-0 subtitle))
(set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) 1)
(set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) (game-secrets toggle-beard))
(not (-> s4-0 beard))
(-> s4-0 beard)
)
@@ -1203,8 +1203,8 @@
(set! (-> s5-0 aspect-ratio) (-> s4-0 aspect-ratio))
(set-aspect-ratio (-> s5-0 aspect-ratio))
)
(when (!= (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02))
(set! (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02))
(when (!= (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00))
(set! (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00))
(set! (-> *video-params* set-video-mode) (the-as basic #t))
)
(when (!= (-> s5-0 video-mode) (-> s4-0 video-mode))
@@ -1219,7 +1219,9 @@
(set! (-> s5-0 unknown-int32-02) (-> s4-0 unknown-int32-02))
(set! (-> *video-params* display-dy) (* (/ (-> s4-0 unknown-int32-02) 2) 2))
)
(set! (-> *blit-displays-work* horizontal-flip-flag) (the-as basic (logtest? (-> *game-info* secrets) 2)))
(set! (-> *blit-displays-work* horizontal-flip-flag)
(the-as basic (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)))
)
(set! (-> s5-0 allow-blackout) (-> s4-0 allow-blackout))
(set! (-> s5-0 bg-a-speed) (-> s4-0 bg-a-speed))
(set! (-> s5-0 bg-a-force) (-> s4-0 bg-a-force))
@@ -1421,7 +1423,7 @@
(set! (-> gp-0 language) (scf-get-language))
(set! (-> gp-0 subtitle-language) (-> gp-0 language))
(set! (-> gp-0 process-mask) (process-mask execute sleep))
(set! (-> gp-0 unknown-uint32-02) (the-as uint #f))
(set! (-> gp-0 unknown-uint32-00) (the-as uint #f))
(set! (-> gp-0 unknown-int32-01) 0)
(set! (-> gp-0 unknown-int32-02) 0)
(set! (-> gp-0 vibration)
@@ -1528,7 +1530,7 @@
(set! (-> s5-0 language) (+ (-> gp-0 language) -1))
(set! (-> s5-0 subtitle-language) (-> gp-0 subtitle-language))
(set! (-> s5-0 aspect-ratio) #f)
(set! (-> s5-0 unknown-uint32-02) (the-as uint #f))
(set! (-> s5-0 unknown-uint32-00) (the-as uint #f))
(set! (-> s5-0 video-mode) #f)
(set! (-> s5-0 music) #f)
(set! (-> s5-0 extra-bank) (the-as symbol '()))
+2 -2
View File
@@ -210,8 +210,8 @@
(time-until-random mood-weather :inline :offset-assert 80)
(time-until-random-min mood-weather :inline :offset-assert 88)
(time-until-random-max mood-weather :inline :offset-assert 96)
(display-flag basic :offset-assert 104)
(overide-weather-flag basic :offset-assert 108)
(display-flag symbol :offset-assert 104)
(overide-weather-flag symbol :offset-assert 108)
(overide mood-weather :inline :offset-assert 112)
(lightning-index int32 :offset-assert 120)
(lightning-val int32 :offset-assert 124)
+1 -1
View File
@@ -853,7 +853,7 @@
(set! (-> arg0 time-until-random-max fog) 72000.0)
(set! (-> arg0 overide cloud) 0.25)
(set! (-> arg0 overide fog) 0.0)
(set! (-> arg0 overide-weather-flag) (the-as basic #t))
(set! (-> arg0 overide-weather-flag) #t)
(set! (-> arg0 display-flag) #f)
(none)
)
+41 -25
View File
@@ -7,6 +7,22 @@
(declare-type sparticle-launch-control inline-array-class)
(defenum time-of-day-palette-id
:type uint32
:bitfield #t
(unk0 0) ;; 1
(unk1 1) ;; 2
(unk2 2) ;; 4
(unk3 3) ;; 8
(palette-0 4) ;; 16
(palette-1 5) ;; 32
(palette-2 6) ;; 64
(palette-3 7) ;; 128
(palette-4 8) ;; 256
(palette-5 9) ;; 512
(palette-6 10) ;; 1024
(palette-7 11) ;; 2048
)
;; DECOMP BEGINS
@@ -70,31 +86,31 @@
)
(deftype time-of-day-context (basic)
((interp float 6 :offset-assert 4)
(current-fog mood-fog :inline :offset-assert 32)
(current-sky-color vector :inline :offset-assert 80)
(current-env-color vector :inline :offset-assert 96)
(current-prt-color vector :inline :offset-assert 112)
(current-shadow-color vector :inline :offset-assert 128)
(light-group light-group 8 :inline :offset-assert 144)
(current-clouds mood-clouds :inline :offset-assert 1680)
(times vector 8 :inline :offset-assert 1696)
(title-light-group light-group :inline :offset-assert 1824)
(filter vector :inline :offset-assert 2016)
(filter-color vector :inline :offset-assert 2032)
(time float :offset-assert 2048)
(target-interp float :offset-assert 2052)
(erase-color rgba :offset-assert 2056)
(sky symbol :offset-assert 2060)
(use-camera-other basic :offset-assert 2064)
(title-updated symbol :offset-assert 2068)
(mode uint32 :offset-assert 2072)
(overide-enable basic :offset-assert 2076)
(overide-palette uint32 :offset-assert 2080)
(max-rain float :offset-assert 2084)
(fog-mult float :offset-assert 2088)
(exterior-level basic :offset-assert 2092)
(ocean-alpha float :offset-assert 2096)
((interp float 6 :offset-assert 4)
(current-fog mood-fog :inline :offset-assert 32)
(current-sky-color vector :inline :offset-assert 80)
(current-env-color vector :inline :offset-assert 96)
(current-prt-color vector :inline :offset-assert 112)
(current-shadow-color vector :inline :offset-assert 128)
(light-group light-group 8 :inline :offset-assert 144)
(current-clouds mood-clouds :inline :offset-assert 1680)
(times vector 8 :inline :offset-assert 1696)
(title-light-group light-group :inline :offset-assert 1824)
(filter vector :inline :offset-assert 2016)
(filter-color vector :inline :offset-assert 2032)
(time float :offset-assert 2048)
(target-interp float :offset-assert 2052)
(erase-color rgba :offset-assert 2056)
(sky symbol :offset-assert 2060)
(use-camera-other basic :offset-assert 2064)
(title-updated symbol :offset-assert 2068)
(mode time-of-day-palette-id :offset-assert 2072)
(overide-enable symbol :offset-assert 2076)
(overide-palette time-of-day-palette-id :offset-assert 2080)
(max-rain float :offset-assert 2084)
(fog-mult float :offset-assert 2088)
(exterior-level basic :offset-assert 2092)
(ocean-alpha float :offset-assert 2096)
)
:method-count-assert 9
:size-assert #x834
+1 -1
View File
@@ -371,7 +371,7 @@
:size-assert #x38
:flag-assert #xb00000038
(:methods
(ocean-map-method-9 () none 9)
(set-height! (_type_ float) none 9)
(ocean-map-method-10 () none 10)
)
)
+715
View File
@@ -7,3 +7,718 @@
;; DECOMP BEGINS
(define *sky-work*
(new 'static 'sky-work
:adgif-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x1000000000008005 #xe)
)
:draw-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x502b400000008001 #x42421)
)
:draw-tmpl2 (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431)
)
:fog-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x902a400000008001 #x424242421)
)
:blend-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431)
)
:sprite-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x2003400000008001 #x55)
)
:sprite-tmpl2 (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x21 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x21 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x2003400000008010 #x55)
)
:sun-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -267.0 :y -267.0 :w 1.0)
(new 'static 'vector :x 267.0 :y 267.0)
)
:green-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -126.0 :y -126.0 :w 1.0)
(new 'static 'vector :x 126.0 :y 126.0)
)
:moon0-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -357.0 :y -357.0)
(new 'static 'vector :x 357.0 :y 357.0)
)
:moon1-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -1207.0 :y -1207.0 :w 1.0)
(new 'static 'vector :x 1207.0 :y 1207.0)
)
:moon2-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -232.0 :y -232.0)
(new 'static 'vector :x 232.0 :y 232.0)
)
:star-coords (new 'static 'inline-array vector 2 (new 'static 'vector :x -1.5 :y -1.5) (new 'static 'vector :x 1.5 :y 1.5))
:sun-colors (new 'static 'inline-array vector4w 2
(new 'static 'vector4w :x #xff :y 64 :w 64)
(new 'static 'vector4w :x #xff :y #xff :z #x80 :w 64)
)
:green-colors (new 'static 'inline-array vector4w 2
(new 'static 'vector4w :y #xc4 :w #x80)
(new 'static 'vector4w :x #xc4 :y #xff :z #xff :w #x80)
)
:moon-colors (new 'static 'inline-array vector4w 3
(new 'static 'vector4w :x 16 :y 32 :z 64 :w 96)
(new 'static 'vector4w :x 16 :y 32 :z 64 :w 64)
(new 'static 'vector4w :x 80 :y 80 :z 80 :w #x80)
)
:st-coords (new 'static 'inline-array vector 2 (new 'static 'vector :z 1.0) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0))
:random (new 'static 'inline-array vector4w 8
(new 'static 'vector4w :x #x181920 :y #x141516 :z #x101112 :w #x234567)
(new 'static 'vector4w :x #x878237 :y #x48778 :z #x489197 :w #x893830)
(new 'static 'vector4w :x #x24762 :y #x289278 :z #x724781 :w #x712983)
(new 'static 'vector4w :x #x176128 :y #x387487 :z #x780983 :w #x723176)
(new 'static 'vector4w :x #x987239 :y #x699872 :z #x987165 :w #x982397)
(new 'static 'vector4w :x #x723897 :y #x238723 :z #x987293 :w #x102981)
(new 'static 'vector4w :x #x387528 :y #x723099 :z #x140983 :w #x874310)
(new 'static 'vector4w :x #x2387 :y #x129818 :z #x219810 :w #x623790)
)
:giftag-base (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3002c00000008001 #x412))
:giftag-haze (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3026c00000008001 #x412))
:giftag-roof (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x302ec00000008001 #x412))
:giftag-ocean (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x301ec00000008001 #x412))
:draw-vortex #f
)
)
(define sky-base-polygons (new 'static 'inline-array sky-vertex 12
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
)
)
(define sky-roof-polygons (new 'static 'inline-array sky-vertex 12
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
)
)
(define *cloud-vert-array* (new 'static 'cloud-vert-array))
(define *cloud-poly* (new 'static 'inline-array cloud-vertex 277
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
)
)
(defun init-cloud-vert-array ()
(let ((gp-0 *cloud-vert-array*))
(dotimes (s5-0 10)
(dotimes (s4-0 10)
(let ((s3-0 (-> gp-0 data (+ (* 10 s5-0) s4-0))))
(set! (-> s3-0 pos x) (* 2.0 (+ -4.5 (the float s4-0))))
(set! (-> s3-0 pos z) (* 2.0 (+ -4.5 (the float s5-0))))
(set! (-> s3-0 pos y)
(fmin (cos (* 182.04445 (* 10.0 (-> s3-0 pos x)))) (cos (* 182.04445 (* 10.0 (-> s3-0 pos z)))))
)
(set-vector! (-> s3-0 stq) (* 0.25 (the float (+ s4-0 -4))) (* 0.25 (the float (+ s5-0 -4))) 1.0 1.0)
(set! (-> s3-0 nrm quad) (-> s3-0 pos quad))
(set! (-> s3-0 nrm y) (+ 1.0 (-> s3-0 nrm y)))
(vector-normalize! (-> s3-0 nrm) 1.0)
(vector-negate! (-> s3-0 nrm2) (-> s3-0 nrm))
(cond
((or (zero? s5-0) (= s5-0 9) (zero? s4-0) (= s4-0 9))
(set! (-> s3-0 col w) 0.0)
(set! (-> s3-0 col2 w) 0.0)
)
((or (= s5-0 1) (= s5-0 8) (= s4-0 1) (= s4-0 8))
(set! (-> s3-0 col w) 48.0)
(set! (-> s3-0 col2 w) 48.0)
)
(else
(set! (-> s3-0 col w) 128.0)
(set! (-> s3-0 col2 w) 128.0)
)
)
)
)
)
)
#f
)
(init-cloud-vert-array)
(define *haze-vert-array* (new 'static 'haze-vert-array))
(define *haze-poly* (new 'static 'inline-array haze-vertex 144
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
)
)
(defun init-haze-vert-array ()
(let ((gp-0 *haze-vert-array*))
(dotimes (s5-0 36)
(let ((s4-0 (-> gp-0 data s5-0)))
(set! (-> s4-0 pos x) (* 9.0 (sin (* 182.04445 (* 10.0 (the float s5-0))))))
(set! (-> s4-0 pos z) (* 9.0 (cos (* 182.04445 (* 10.0 (the float s5-0))))))
(set! (-> s4-0 pos y) 0.0)
(set! (-> (the-as cloud-vertex (-> s4-0 nrm)) pos quad) (-> (the-as cloud-vertex (-> s4-0 pos)) pos quad))
(set! (-> s4-0 nrm y) (+ 1.0 (-> s4-0 nrm y)))
(vector-normalize! (-> s4-0 nrm) 1.0)
)
)
)
#f
)
(init-haze-vert-array)
(defmethod init-sun-data! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float))
"Sets the sun related upload data - the sun, halo and aurora"
(let ((v1-0 (logand arg0 1)))
(set! (-> obj upload-data sun v1-0 r-sun) arg1)
(set! (-> obj upload-data sun v1-0 r-halo) arg2)
(set! (-> obj upload-data sun v1-0 r-aurora) arg3)
)
0
(none)
)
(defmethod init-orbit-settings! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float))
(set! (-> obj orbit arg0 high-noon) arg1)
(set! (-> obj orbit arg0 tilt) (* 0.017453292 arg2))
(set! (-> obj orbit arg0 rise) (* 0.017453292 arg3))
(set! (-> obj orbit arg0 dist) arg4)
(set! (-> obj orbit arg0 min-halo) arg5)
(set! (-> obj orbit arg0 max-halo) arg6)
0
(none)
)
(defun sky-make-sun-data ((arg0 sky-work) (arg1 int) (arg2 float))
"Initialize `upload-data` with [[sky-sun-data]] in [[*sky-work*]]"
(let* ((s4-0 (-> arg0 orbit arg1))
(s3-0 (the-as sky-sun-data (+ (the-as uint (-> arg0 upload-data)) (* arg1 64))))
(f0-1 (- arg2 (-> s4-0 high-noon)))
(f30-0 (* 2730.6667 f0-1))
(f28-0 (* (sin f30-0) (-> s4-0 dist)))
(f30-1 (cos f30-0))
)
(let* ((f24-0 (* f30-1 (-> s4-0 dist)))
(f26-0 (* f24-0 (cos-rad (-> s4-0 tilt))))
(f24-1 (* f24-0 (sin-rad (-> s4-0 tilt))))
(f22-0 (sin-rad (-> s4-0 rise)))
(f0-10 (cos-rad (-> s4-0 rise)))
)
(set! (-> s3-0 pos z) (- (+ (* f28-0 f0-10) (* f24-1 f22-0))))
(set! (-> s3-0 pos y) f26-0)
(set! (-> s3-0 pos x) (- (* f24-1 f0-10) (* f28-0 f22-0)))
)
(let ((f0-14 (if (< f30-1 0.0)
0.0
f30-1
)
)
)
(set! (-> arg0 upload-data sun arg1 r-aurora)
(+ (* (-> s4-0 min-halo) (- 1.0 f0-14)) (* (-> s4-0 max-halo) f0-14))
)
)
)
0
(none)
)
(defun sky-make-moon-data ((arg0 sky-work) (arg1 float))
"Initialize `upload-data` with [[sky-moon-data]] in [[*sky-work*]]"
(let* ((s5-0 (-> arg0 orbit 2))
(gp-0 (-> arg0 upload-data moon))
(f0-1 (- arg1 (-> s5-0 high-noon)))
(f28-0 (* 2730.6667 f0-1))
(f30-0 (* (sin f28-0) (-> s5-0 dist)))
(f26-0 (* (cos f28-0) (-> s5-0 dist)))
(f28-1 (* f26-0 (cos-rad (-> s5-0 tilt))))
(f26-1 (* f26-0 (sin-rad (-> s5-0 tilt))))
(f24-0 (sin-rad (-> s5-0 rise)))
(f0-10 (cos-rad (-> s5-0 rise)))
)
(set! (-> gp-0 pos z) (- (+ (* f30-0 f0-10) (* f26-1 f24-0))))
(set! (-> gp-0 pos y) f28-1)
(set! (-> gp-0 pos x) (- (* f26-1 f0-10) (* f30-0 f24-0)))
)
0
(none)
)
(init-sun-data! *sky-work* 0 60.0 200.0 300.0)
(init-sun-data! *sky-work* 1 15.0 20.0 300.0)
(init-orbit-settings! *sky-work* 0 12.5 -20.0 90.0 9950.0 300.0 300.0)
(init-orbit-settings! *sky-work* 1 4.0 0.0 90.0 9950.0 300.0 300.0)
(init-orbit-settings! *sky-work* 2 0.5 -40.0 90.0 9950.0 300.0 300.0)
+33 -21
View File
@@ -18,6 +18,7 @@
:flag-assert #x900000010
)
(deftype sky-color-day (structure)
((hour sky-color-hour 24 :inline :offset-assert 0)
)
@@ -26,6 +27,7 @@
:flag-assert #x900000180
)
(deftype sky-sun-data (structure)
((data uint128 4 :offset-assert 0)
(pos vector :inline :offset 0)
@@ -44,6 +46,7 @@
:flag-assert #x900000040
)
(deftype sky-moon-data (structure)
((data uint128 2 :offset-assert 0)
(pos vector :inline :offset 0)
@@ -54,6 +57,7 @@
:flag-assert #x900000020
)
(deftype sky-orbit (structure)
((high-noon float :offset-assert 0)
(tilt float :offset-assert 4)
@@ -68,6 +72,7 @@
:flag-assert #x900000018
)
(deftype sky-upload-data (structure)
((data uint128 10 :offset-assert 0)
(sun sky-sun-data 2 :inline :offset 0)
@@ -78,6 +83,7 @@
:flag-assert #x9000000a0
)
(deftype sky-vertex (structure)
((pos vector :inline :offset-assert 0)
(stq vector :inline :offset-assert 16)
@@ -88,15 +94,8 @@
:flag-assert #x900000030
)
(defmethod inspect sky-vertex ((obj sky-vertex))
(format #t "sky-vertex [~X]:~%" obj)
(format #t "~TPos: [~F ~F ~F ~F]~%" (-> obj pos x) (-> obj pos y) (-> obj pos z) (-> obj pos w))
(format #t "~TSTQ: [~F ~F ~F ~F]~%" (-> obj stq x) (-> obj stq y) (-> obj stq z) (-> obj stq w))
(format #t "~TCol: [~F ~F ~F ~F]~%" (-> obj col x) (-> obj col y) (-> obj col z) (-> obj col w))
obj
)
;; definition of type cloud-vertex
(deftype cloud-vertex (structure)
((pos vector :inline :offset-assert 0)
(stq vector :inline :offset-assert 16)
@@ -111,6 +110,7 @@
:flag-assert #x900000070
)
(deftype cloud-vert-array (structure)
((data cloud-vertex 100 :inline :offset-assert 0)
)
@@ -119,6 +119,7 @@
:flag-assert #x900002bc0
)
(deftype haze-vertex (structure)
((pos vector :inline :offset-assert 0)
(nrm vector :inline :offset-assert 16)
@@ -129,6 +130,7 @@
:flag-assert #x900000030
)
(deftype haze-vert-array (structure)
((data haze-vertex 36 :inline :offset-assert 0)
)
@@ -137,6 +139,7 @@
:flag-assert #x9000006c0
)
(deftype cloud-lights (structure)
((sun0-normal vector :inline :offset-assert 0)
(sun1-normal vector :inline :offset-assert 16)
@@ -156,6 +159,7 @@
:flag-assert #x90000009c
)
(deftype haze-lights (structure)
((sun0-normal vector :inline :offset-assert 0)
(sun1-normal vector :inline :offset-assert 16)
@@ -173,6 +177,7 @@
:flag-assert #x90000007c
)
(deftype sky-work (structure)
((adgif-tmpl dma-gif-packet :inline :offset-assert 0)
(draw-tmpl dma-gif-packet :inline :offset-assert 32)
@@ -187,12 +192,12 @@
(moon1-coords vector 2 :inline :offset-assert 320)
(moon2-coords vector 2 :inline :offset-assert 352)
(star-coords vector 2 :inline :offset-assert 384)
(sun-colors vector 2 :inline :offset-assert 416)
(green-colors vector 2 :inline :offset-assert 448)
(moon-colors vector 3 :inline :offset-assert 480)
(star-colors vector 16 :inline :offset-assert 528)
(sun-colors vector4w 2 :inline :offset-assert 416)
(green-colors vector4w 2 :inline :offset-assert 448)
(moon-colors vector4w 3 :inline :offset-assert 480)
(star-colors vector4w 16 :inline :offset-assert 528)
(st-coords vector 2 :inline :offset-assert 784)
(random vector 8 :inline :offset-assert 816)
(random vector4w 8 :inline :offset-assert 816)
(giftag-base dma-gif :inline :offset-assert 944)
(giftag-haze dma-gif :inline :offset-assert 960)
(giftag-roof dma-gif :inline :offset-assert 976)
@@ -204,12 +209,12 @@
(off-t uint16 :offset-assert 1062)
(orbit sky-orbit 3 :inline :offset-assert 1064)
(upload-data sky-upload-data :inline :offset-assert 1168)
(ambi-color vector :inline :offset-assert 1328)
(ambi-color-lower vector :inline :offset-assert 1344)
(sun0-color vector :inline :offset-assert 1360)
(sun1-color vector :inline :offset-assert 1376)
(moon-color vector :inline :offset-assert 1392)
(sun0-color-lower vector :inline :offset-assert 1408)
(ambi-color vector4w :inline :offset-assert 1328)
(ambi-color-lower vector4w :inline :offset-assert 1344)
(sun0-color vector4w :inline :offset-assert 1360)
(sun1-color vector4w :inline :offset-assert 1376)
(moon-color vector4w :inline :offset-assert 1392)
(sun0-color-lower vector4w :inline :offset-assert 1408)
(cam-mat matrix :inline :offset-assert 1424)
(star-mat matrix :inline :offset-assert 1488)
(vec0 vector4w :inline :offset-assert 1552)
@@ -224,8 +229,8 @@
:size-assert #x2760
:flag-assert #x2500002760
(:methods
(sky-work-method-9 () none 9)
(sky-work-method-10 () none 10)
(init-sun-data! (_type_ int float float float) none 9)
(init-orbit-settings! (_type_ int float float float float float float) none 10)
(sky-work-method-11 () none 11)
(sky-work-method-12 () none 12)
(sky-work-method-13 () none 13)
@@ -254,3 +259,10 @@
(sky-work-method-36 () none 36)
)
)
0
@@ -29,6 +29,11 @@
(set-conerot 20)
)
;; NOTE - for relocate
(declare-type sparticle-system basic)
(declare-type sparticle-cpuinfo structure)
(declare-type sparticle-launch-control inline-array-class)
(define-extern forall-particles-with-key (function sparticle-launch-control (function sparticle-system sparticle-cpuinfo none) symbol symbol none))
;; DECOMP BEGINS
@@ -181,7 +181,7 @@
)
(deftype texture-link (structure)
((next shader-ptr :offset-assert 0)
((next shader-ptr 1 :offset-assert 0)
)
:method-count-assert 9
:size-assert #x4
+1 -1
View File
@@ -236,7 +236,7 @@
(vis-self-index int32 :offset-assert 2440)
(vis-adj-index int32 :offset-assert 2444)
(vis-buffer uint8 2048 :offset-assert 2448)
(mem-usage-block basic :offset-assert 4496)
(mem-usage-block memory-usage-block :offset-assert 4496)
(mem-usage int32 :offset-assert 4500)
(code-memory-start pointer :offset-assert 4504)
(code-memory-end pointer :offset-assert 4508)
+4 -2
View File
@@ -126,12 +126,14 @@
(defbehavior want-to-gun? process ((arg0 target) (arg1 symbol))
(local-vars (v1-36 symbol))
(and (logtest? (-> arg0 game features) 32)
(and (logtest? (-> arg0 game features) (game-feature unk-game-feature-06))
(>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1))
(zero? (logand (focus-status fs1 fs6 fs18 fs21 fs22 fs30) (-> arg0 focus-status)))
(zero? (logand (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control unknown-surface00 flags)))
(zero? (logand (state-flags sf18) (-> arg0 state-flags)))
(logtest? (logand (-> *setting-control* user-current features) 960) (-> arg0 game features))
(logtest? (the-as game-feature (logand (-> *setting-control* user-current features) 960))
(-> arg0 game features)
)
(or (zero? (logand (-> arg0 control unknown-surface00 flags) (surface-flag duck))) (can-exit-duck?))
(or (zero? (logand (focus-status fs20) (-> arg0 focus-status))) (-> arg0 pilot gun?))
(or arg1
+5 -5
View File
@@ -32,11 +32,11 @@
;; screen shot settings.
(deftype screen-shot-work (structure)
((count int16 :offset-assert 0)
(size int16 :offset-assert 2)
(name basic :offset-assert 4)
(highres-enable basic :offset-assert 8)
(hud-enable basic :offset-assert 12)
((count int16 :offset-assert 0)
(size int16 :offset-assert 2)
(name string :offset-assert 4)
(highres-enable symbol :offset-assert 8)
(hud-enable symbol :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
-57
View File
@@ -1,57 +0,0 @@
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--file")
args = parser.parse_args()
import re
labels_with_no_type = []
file_path = "decompiler_out/jak1/{}_disasm.gc".format(args.file)
with open(file_path) as f:
# Find all
content = f.readlines()
for line in content:
labels_with_no_type = labels_with_no_type + re.findall(r'L\d+', line)
# dedup list
labels_with_no_type = list(dict.fromkeys(labels_with_no_type))
# let's go try to identify the types from the IR2 file if we can
label_lines = []
file_path = "decompiler_out/jak1/{}_ir2.asm".format(args.file)
with open(file_path) as f:
# Find all
content = f.readlines()
prev_line = ""
next_label_will_be_lambda = False
for i, line in enumerate(content):
if ".function (anon-function" in line:
next_label_will_be_lambda = True
if line.startswith("L"):
for label in labels_with_no_type:
if line.startswith("{}:".format(label)):
# If we were expecting a lambda
if next_label_will_be_lambda:
label_lines.append("[\"{}\", \"_lambda_\", true]".format(label))
labels_with_no_type.remove(label)
next_label_will_be_lambda = False
break
# special case for pairs
if "(offset 2)" in line:
label_lines.append("[\"{}\", \"pair\", true]".format(label))
labels_with_no_type.remove(label)
break
# Check if the previous line has a `.type`
prev_line = content[i-1]
if ".type" in prev_line:
the_type = prev_line.split(".type ")[1].strip()
label_lines.append("[\"{}\", \"{}\", true]".format(label, the_type))
labels_with_no_type.remove(label)
break
# Print out the labels
print("Here are the labels I couldn't find a type for:")
for label in labels_with_no_type:
print("- {}".format(label))
print("And here are the ones I could:")
print(",\n".join(label_lines))
@@ -0,0 +1,92 @@
from utils import get_alltypes_path_from_game, get_gsrc_path_from_filename
class AllTypesUpdateBlock:
def __init__(self):
self.data = []
self.file_name = ""
self.block_id = ""
def __str__(self):
return "{}:{}:{}...".format(self.file_name, self.block_id, self.data[0:20])
def update_alltypes_named_blocks(game_name):
block_dict = {}
# Step 1: Get the blocks
get_all_blocks(game_name, block_dict)
# Step 2: Update the blocks (group by file name to minimize file IO operations)
update_all_blocks(game_name, block_dict)
def get_all_blocks(game_name, block_dict):
with open(get_alltypes_path_from_game(game_name)) as f:
lines = f.readlines()
i = 0
while i < len(lines):
line = lines[i]
if line.startswith(";; +++") and ":" in line:
info = line.replace(";; +++", "")
file_name, block_id = info.split(":")
new_block = AllTypesUpdateBlock()
new_block.file_name = file_name
new_block.block_id = block_id
# Loop until we find the end of the block, collecting the lines as we go
while i < len(lines):
i = i + 1
next_line = lines[i]
if next_line.startswith(";; ---"):
break
new_block.data.append(next_line)
# Add to the dictionary
if file_name not in block_dict:
block_dict[file_name] = [new_block]
else:
block_dict[file_name].append(new_block)
else:
i = i + 1
def update_all_blocks(game_name, block_dict):
for file_name, blocks in block_dict.items():
# Get the file's lines
path = get_gsrc_path_from_filename(game_name, file_name)
lines = []
final_lines = []
with open(path) as f:
lines = f.readlines()
# Iterate through lines, (before ;; decomp begins) and update the blocks if we find them
i = 0
while i < len(lines):
line = lines[i]
if line.lower().startswith(";; decomp begins"):
final_lines.append(line)
# Add all the rest of the lines until the end
while i + 1 < len(lines):
i = i + 1
next_line = lines[i]
final_lines.append(next_line)
break
if line.startswith(";; +++"):
final_lines.append(line)
block_id = line.split(";; +++")[1]
# Look to see if we actually have that block
for block in blocks:
if block.block_id == block_id:
# if we found the block, write the data, then proceed ahead until the end
for block_line in block.data:
final_lines.append(block_line)
while i + 1 < len(lines):
i = i + 1
next_line = lines[i]
if next_line.startswith(";; ---"):
final_lines.append(next_line)
i = i + 1
break
break
else:
final_lines.append(line)
i = i + 1
# Update the file contents
with open(path, "w") as f:
f.writelines(final_lines)
@@ -0,0 +1,808 @@
import re
from rapidfuzz import fuzz
# TODO - rename and refactor all usages, it's not _always_ a comment anymore!
# RetainedCode or something
class CommentMeta:
def __init__(self):
self.data = ""
self.symbol_before = None
self.symbol_inline = None
self.symbol_after = None
self.symbol_padding_before = None
self.symbol_padding_after = None
# NOTE - maybe holding more than just 1 line before/after might help?
self.code_before = None
self.code_after = None
self.code_padding_before = None
self.code_padding_after = None
self.line_num_in_form = None # None == top level
self.containing_form = None # none - top level
self.containing_form_kind = None # function|method|behaviour
self.containing_form_func_name = None # or the method/behaviour
self.containing_form_type = None
self.inline = False
self.code_in_line = None # only for inline comments
self.line_in_file = None # a worst-case scenario fallback
def __str__(self):
return "{}:{}:{}".format(self.data, self.symbol_before, self.symbol_after)
def debug_nice_formatted_code(val):
if val is None:
return None
return val.strip()[0:20]
# returns (symbol | None, padding)
def backtrack_for_symbol(lines, index):
padding = 0
for i in range(index - 1, 0, -1):
tline = lines[i].strip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1), padding
elif (
not tline.strip() == "" and not tline.strip().startswith(";")
) or "decomp begins" in tline.lower():
# we hit a non empty line (but it wasn't a symbol!)
return None, padding
elif tline.strip() == "":
padding = padding + 1
return None, padding
def symbol_on_line(line):
tline = line.lstrip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1)
return None
def lookahead_for_symbol(lines, index):
padding = 0
for i in range(index + 1, len(lines), 1):
tline = lines[i].lstrip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1), padding
elif (
not tline.strip() == "" and not tline.strip().startswith(";")
) or "decomp begins" in tline.lower():
# we hit a non empty line (but it wasn't a symbol!)
return None, padding
elif tline.strip() == "":
padding = padding + 1
return None, padding
def backtrack_for_code(lines, index):
padding = 0
for i in range(index - 1, 0, -1):
line = lines[i]
if line.strip() == "":
padding = padding + 1
continue
elif "decomp begins" in line.lower():
return None, padding
elif line.lstrip().startswith(";"):
continue
return line, padding
def lookahead_for_code(lines, index):
padding = 0
for i in range(index + 1, len(lines), 1):
line = lines[i]
if line.strip() == "":
padding = padding + 1
continue
elif "decomp begins" in line.lower():
return None, padding
elif line.lstrip().startswith(";"):
continue
return line, padding
# returns form, or none
def is_line_start_of_form(line):
if line.rstrip().startswith(";"):
return None
matches = re.search(r"\(\s*([^\s.]*)\s+", line)
if matches is not None:
return line
return None
def has_form_ended(stack, line):
# if the stack is empty, return true
line_before_comment = line.partition(";")[0]
for char in line_before_comment:
if char == "(":
stack.append(char)
elif char == ")":
if len(stack) == 0:
# unbalanced parens?
return True
stack.pop()
if len(stack) == 0:
return True
else:
if len(stack) == 0:
return True
return False
def append_form_metadata(comment, form_start_line):
func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_start_line)
if func_matches is not None:
comment.containing_form_kind = "function"
comment.containing_form_func_name = func_matches.group(1)
comment.containing_form_type = None
return
behavior_matches = re.search(
r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_start_line
)
if behavior_matches is not None:
comment.containing_form_kind = "behavior"
comment.containing_form_func_name = behavior_matches.group(1)
comment.containing_form_type = behavior_matches.group(2)
return
method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_start_line)
if method_matches is not None:
comment.containing_form_kind = "method"
comment.containing_form_func_name = method_matches.group(1)
comment.containing_form_type = method_matches.group(2)
return
comment.containing_form_kind = "unknown"
comment.containing_form_func_name = None
comment.containing_form_type = None
def process_original_lines(lines):
comments = []
debug_lines = []
# track if we are inside a define*/defun/defmethod/deftype/defstate
within_form = None
line_num_in_form = None
form_paren_stack = []
found_output = False
i = 0
while i < len(lines):
debug_lines.append(lines[i])
tline = lines[i].lstrip()
if "decomp begins" in tline.lower():
found_output = True
i = i + 1
continue
if not found_output:
i = i + 1
continue
# actually process code
if within_form is None:
# lets see if we are now in one
within_form = is_line_start_of_form(lines[i])
if within_form is not None:
line_num_in_form = 0
if has_form_ended(form_paren_stack, lines[i]):
within_form = None
form_paren_stack = []
elif within_form is not None:
# check if the form has ended by counting parens
if has_form_ended(form_paren_stack, lines[i]):
within_form = None
form_paren_stack = []
line_num_in_form = 0
else:
line_num_in_form = line_num_in_form + 1
if tline.startswith(";") or tline.startswith("#|"):
# treat decomp deviation blocks as essentially comments as well, so include them in a block comment if appropriate
# this is done because there is nothing to match them against (if a comment is inside them for example)
# so we have to copy them in full
in_deviation_block = False
if "decomp deviation" in tline.lower() or tline.startswith("#|"):
in_deviation_block = True
current_comment = CommentMeta()
current_comment.line_in_file = i
current_comment.data = lines[i]
(
current_comment.symbol_before,
current_comment.symbol_padding_before,
) = backtrack_for_symbol(lines, i)
(
current_comment.code_before,
current_comment.code_padding_before,
) = backtrack_for_code(lines, i)
current_comment.containing_form = within_form
if within_form is not None:
append_form_metadata(current_comment, within_form)
current_comment.line_num_in_form = line_num_in_form
current_comment.inline = False
# look ahead to handle block comments
if i + 1 < len(lines):
next_line = lines[i + 1]
if "decomp deviation" in next_line.lower() or next_line.startswith("|#"):
in_deviation_block = False
while i + 1 < len(lines) and (
in_deviation_block
or next_line.lstrip().startswith(";")
or next_line.lstrip().startswith("|#")
):
debug_lines.append(lines[i + 1])
i = i + 1
current_comment.data = current_comment.data + next_line
if i + 1 < len(lines):
next_line = lines[i + 1]
if "decomp deviation" in next_line.lower() or next_line.startswith(
"|#"
):
in_deviation_block = False
(
current_comment.symbol_after,
current_comment.symbol_padding_after,
) = lookahead_for_symbol(lines, i)
(
current_comment.code_after,
current_comment.code_padding_after,
) = lookahead_for_code(lines, i)
comments.append(current_comment)
debug_lines.append(
";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format(
current_comment.symbol_before,
current_comment.symbol_padding_before,
current_comment.symbol_after,
current_comment.symbol_padding_after,
debug_nice_formatted_code(current_comment.code_before),
current_comment.code_padding_before,
debug_nice_formatted_code(current_comment.code_after),
current_comment.code_padding_after,
)
)
debug_lines.append(
";; [DEBUG]: in_form - {}...:{}\n".format(
debug_nice_formatted_code(current_comment.containing_form),
current_comment.line_num_in_form,
)
)
# inline comments
# TODO - cleanup duplication
elif ";" in tline:
current_comment = CommentMeta()
current_comment.line_in_file = i
current_comment.data = ";" + tline.partition(";")[2]
(
current_comment.symbol_before,
current_comment.symbol_padding_before,
) = backtrack_for_symbol(lines, i)
(
current_comment.symbol_after,
current_comment.symbol_padding_after,
) = lookahead_for_symbol(lines, i)
(
current_comment.code_before,
current_comment.code_padding_before,
) = backtrack_for_code(lines, i)
(
current_comment.code_after,
current_comment.code_padding_after,
) = lookahead_for_code(lines, i)
current_comment.containing_form = within_form
if within_form is not None:
append_form_metadata(current_comment, within_form)
current_comment.line_num_in_form = line_num_in_form
current_comment.symbol_inline = symbol_on_line(tline)
current_comment.inline = True
current_comment.code_in_line = tline.partition(";")[0]
comments.append(current_comment)
debug_lines.append(
";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format(
current_comment.symbol_before,
current_comment.symbol_padding_before,
current_comment.symbol_after,
current_comment.symbol_padding_after,
debug_nice_formatted_code(current_comment.code_before),
current_comment.code_padding_before,
debug_nice_formatted_code(current_comment.code_after),
current_comment.code_padding_after,
)
)
debug_lines.append(
";; [DEBUG]: in_form - {}...:{} || inline_code - {}...\n".format(
debug_nice_formatted_code(current_comment.containing_form),
current_comment.line_num_in_form,
debug_nice_formatted_code(current_comment.code_in_line),
)
)
i = i + 1
return comments, debug_lines
def get_symbol_at_line(line):
tline = line.strip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1)
return None
def relevant_symbol_comments_for_line_before(line):
symbol = get_symbol_at_line(line)
if symbol is None:
return []
# Loop through comments, finding any that match the symbol
# they WILL be placed, so we can remove them from our list now
i = 0
relevant_comments = []
while i < len(comments):
comment = comments[i]
if comment.symbol_after == symbol:
relevant_comments.append(comment)
comments.pop(i)
else:
i = i + 1
return relevant_comments
def padding_before_comment(comment):
if comment.containing_form is None:
if comment.symbol_after is not None:
return "\n" * comment.symbol_padding_after
return ""
def relevant_symbol_comments_for_inline(line):
symbol = get_symbol_at_line(line)
if symbol is None:
return []
# Loop through comments, finding any that match the symbol
# they WILL be placed, so we can remove them from our list now
i = 0
relevant_comments = []
while i < len(comments):
comment = comments[i]
if comment.symbol_inline == symbol:
relevant_comments.append(comment)
comments.pop(i)
else:
i = i + 1
return relevant_comments
def padding_after_comment(comment):
if comment.containing_form is None:
if comment.symbol_before is not None:
return "\n" * comment.symbol_padding_before
return ""
def relevant_symbol_comments_for_line_after(line):
symbol = get_symbol_at_line(line)
if symbol is None:
return []
# Loop through comments, finding any that match the symbol
# they WILL be placed, so we can remove them from our list now
i = 0
relevant_comments = []
while i < len(comments):
comment = comments[i]
# if we can, we prefer to put comments before not after (more accurate re-creation)
if comment.symbol_after is None and comment.symbol_before == symbol:
relevant_comments.append(comment)
comments.pop(i)
else:
i = i + 1
return relevant_comments
# the first half of the defmethod/etc lines (before arg list) is less likely to change
# so we want to split it to weight it more heavily
def split_def_line(line):
first_part = ""
second_part = ""
for index, char in enumerate(line):
if char == "(":
if index == 0:
first_part = first_part + char
else:
second_part = second_part + char
continue
else:
if second_part != "":
second_part = second_part + char
else:
first_part = first_part + char
return first_part, second_part
def get_form_metadata(form_def_line):
func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_def_line)
if func_matches is not None:
return "function", func_matches.group(1), None
behavior_matches = re.search(r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_def_line)
if behavior_matches is not None:
return "behavior", behavior_matches.group(1), behavior_matches.group(2)
method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_def_line)
if method_matches is not None:
return "method", method_matches.group(1), method_matches.group(2)
return "unknown", None, None
built_in_method_names = [
"new",
"delete",
"print",
"inspect",
"length",
"asize-of",
"copy",
"relocate",
"memusage",
]
def different_method_names(form_func_name, comment_form_func_name):
if (
comment_form_func_name not in built_in_method_names
and form_func_name not in built_in_method_names
):
return False
return form_func_name != comment_form_func_name
def get_relevant_form_comments(form_def_line):
form_kind, form_func_name, form_type = get_form_metadata(form_def_line)
code_def_part, code_rest = split_def_line(form_def_line)
relevant_comments = []
i = 0
while i < len(comments):
comment = comments[i]
if comment.containing_form is None:
i = i + 1
continue
(
comment_form_kind,
comment_form_func_name,
comment_form_type,
) = get_form_metadata(comment.containing_form)
# First disqualify the form if it's obviously unrelated
if comment_form_kind != "unknown":
if form_kind != comment_form_kind:
i = i + 1
continue
elif form_kind == "function" and comment_form_func_name != form_func_name:
i = i + 1
continue
elif form_kind == "behavior" and comment_form_func_name != form_func_name:
i = i + 1
continue
elif form_kind == "method" and (
comment_form_type != form_type
or different_method_names(form_func_name, comment_form_func_name)
):
i = i + 1
continue
# Evaluate it's score (comments and current def line)
def_part, rest = split_def_line(comment.containing_form)
def_score = fuzz.ratio(code_def_part, def_part) * 0.65
if def_score == 65.0 and form_kind != "unknown":
relevant_comments.append(comment)
comments.pop(i)
continue
rest_score = fuzz.ratio(code_rest, rest) * 0.35
combined_score = def_score + rest_score
threshold = 50.0
if combined_score < threshold:
i = i + 1
continue
# Now, let's look at ALL other def lines yet to come from the decomp output
# if any are a better match, don't add the comment yet -- we'll add it when we get there!
# TODO - remove lines from the list as we find them so speed this up
found_better_form = False
for decomp_def_line in decomp_form_def_lines:
line_form_kind, line_form_func_name, line_form_type = get_form_metadata(
decomp_def_line
)
if form_kind != "unknown":
if form_kind != line_form_kind:
continue
elif form_kind == "function" and line_form_func_name != form_func_name:
continue
elif form_kind == "behavior" and line_form_func_name != form_func_name:
continue
elif form_kind == "method" and (
line_form_type != form_type
or different_method_names(form_func_name, line_form_func_name)
):
continue
def_part, rest = split_def_line(decomp_def_line)
def_score = fuzz.ratio(code_def_part, def_part) * 0.65
if def_score == 65.0 and form_kind != "unknown":
found_better_form = True
break
rest_score = fuzz.ratio(code_rest, rest) * 0.35
if combined_score < def_score + rest_score:
found_better_form = True
break
# TODO otherwise? still test?
if found_better_form:
i = i + 1
continue
relevant_comments.append(comment)
comments.pop(i)
return relevant_comments
# Simple fuzz ratio, but removes obvious outliers like empty lines / lines with only a paren
def score_alg(line1, line2):
tline1 = line1.strip()
tline2 = line2.strip()
if tline1 == "" or tline1 == ")" or tline1 == "(":
return -1
if tline2 == "" or tline2 == ")" or tline2 == "(":
return -1
return fuzz.ratio(tline1, tline2)
# TODO - improvement on comparison - a higher score on a longer line == better? some sort of weighting approach here too?
def merge_retained_code_and_new_code(gsrc_path, decomp_lines, final_lines):
decomp_started = False
with open(gsrc_path) as f:
lines = f.readlines()
within_form = None
line_num_in_form = None
form_paren_stack = []
for line in lines:
if "[DEBUG]" in line:
continue
if line.lower().lstrip().startswith(";; decomp begins"):
decomp_started = True
final_lines.append(line)
break
if not decomp_started:
final_lines.append(line)
continue
i = 0
while i < len(decomp_lines):
line = decomp_lines[i]
# Otherwise, its a part of the output we have to be more careful about
# For every line in the decompiled output, we scan our comment list to see if anything matches
# if it does, we insert it appropriately and remove the comment from the list
#
# This is the main source of inefficiency, but the process gets progressively faster as comments are eliminated
if within_form is None:
# lets see if we are now in one
within_form = is_line_start_of_form(line)
# TODO - check line for symbol matches?
if within_form is not None:
line_num_in_form = 0
if has_form_ended(form_paren_stack, line):
within_form = None
form_paren_stack = []
else:
# Get all of the lines of the form at once
form_start = decomp_lines[i]
form_lines = [form_start]
while i < len(decomp_lines):
i = i + 1
line = decomp_lines[i]
if has_form_ended(form_paren_stack, line):
within_form = None
form_paren_stack = []
break
else:
form_lines.append(line)
# Add any comments needed to the form contents
# - first we get all comments that have match well with the form's start line (ie. defmethod ....)
form_comments = get_relevant_form_comments(form_start)
# - for each comment, let's find which line matches it the best,
# if NONE exceed the threshold (if both match the same, pick the first), we default to the line offset
for comment in form_comments:
highest_score = -1
index_to_insert = -1
threshold = 50.0
place_kind = None
for index, form_line in enumerate(form_lines):
# skip any comments that were previously added
if form_line.lstrip().startswith(";"):
continue
if comment.code_in_line is not None:
score = score_alg(form_line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = index
highest_score = score
place_kind = "inline"
if comment.code_before is not None:
score = score_alg(form_line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = index
highest_score = score
place_comment_after = True
place_kind = "next_line"
if comment.code_after is not None:
score = score_alg(form_line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = index
highest_score = score
place_comment_after = False
place_kind = "before_line"
# add the comment!
if index_to_insert == -1:
if comment.inline:
form_lines[comment.line_num_in_form] = (
form_lines[index_to_insert].rstrip()
+ " "
+ comment.data
)
else:
form_lines.insert(
comment.line_num_in_form, comment.data
)
elif comment.inline:
form_index = index_to_insert
if place_kind == "next_line":
form_index = index_to_insert + 1
form_lines[form_index] = (
form_lines[form_index].rstrip() + " " + comment.data
)
elif place_kind == "next_line":
form_lines.insert(
index_to_insert + 1,
padding_before_comment(comment) + comment.data,
)
else:
form_lines.insert(
index_to_insert,
padding_after_comment(comment) + comment.data,
)
# Add the lines to the final output
for form_line in form_lines:
final_lines.append(form_line)
# Otherwise, we are at the top-level!
if within_form is None:
before_comments = relevant_symbol_comments_for_line_before(line)
for comment in before_comments:
final_lines.append(padding_before_comment(comment) + comment.data)
inline_comments = relevant_symbol_comments_for_inline(line)
if len(inline_comments) > 0:
comment_str = ""
for comment in inline_comments:
comment_str = comment_str + comment.data.strip()
comment_str = comment_str.replace(";", "")
final_lines.append(
"{} ;; {}".format(line.rstrip(), comment_str.strip())
)
else:
final_lines.append(line)
after_comments = relevant_symbol_comments_for_line_after(line)
for comment in after_comments:
final_lines.append(padding_after_comment(comment) + comment.data)
# next line
i = i + 1
def handle_dangling_blocks(comments, final_lines, debug_lines):
for comment in comments:
within_form = None
line_num_in_form = None
form_paren_stack = []
found_output = True
i = 0
index_to_insert = -1
highest_score = -1
place_comment_after = True
threshold = 50.0
while i < len(final_lines):
debug_lines.append(final_lines[i])
tline = final_lines[i].lstrip()
if "decomp begins" in tline.lower():
found_output = True
i = i + 1
continue
if not found_output:
i = i + 1
continue
line = final_lines[i]
# We can try to claw back a bit of efficiency by skipping the inside of forms
if within_form is not None:
# check if the form has ended by counting parens
if has_form_ended(form_paren_stack, line):
if comment.code_in_line is not None:
score = score_alg(line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
if comment.code_before is not None:
score = score_alg(line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = True
if comment.code_after is not None:
score = score_alg(line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = False
within_form = None
form_paren_stack = []
line_num_in_form = 0
else:
line_num_in_form = line_num_in_form + 1
else:
# lets see if we are now in a form
within_form = is_line_start_of_form(line)
if within_form is not None:
if comment.code_in_line is not None:
score = score_alg(line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
if comment.code_before is not None:
score = score_alg(line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = True
if comment.code_after is not None:
score = score_alg(line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = False
line_num_in_form = 0
else:
# just normal code, check it
if comment.code_in_line is not None:
score = score_alg(line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
if comment.code_before is not None:
score = score_alg(line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = True
if comment.code_after is not None:
score = score_alg(line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = False
i = i + 1
# end of while loop
# add the comment!
if index_to_insert == -1:
if comment.inline:
final_lines[comment.line_in_file] = (
final_lines[comment.line_in_file].rstrip() + " " + comment.data
)
else:
final_lines.insert(comment.line_in_file, comment.data)
elif comment.inline:
final_lines[index_to_insert] = (
final_lines[index_to_insert].rstrip() + " " + comment.data
)
elif place_comment_after:
final_lines.insert(
index_to_insert + 1,
padding_before_comment(comment) + comment.data,
)
else:
final_lines.insert(
index_to_insert,
padding_after_comment(comment) + comment.data,
)
+20 -803
View File
@@ -36,41 +36,14 @@
# - there are likely ways to make this more efficient
import argparse
import re
from rapidfuzz import fuzz
from code_retention.all_types_retention import update_alltypes_named_blocks
from utils import get_gsrc_path_from_filename
# TODO - rename and refactor all usages, it's not _always_ a comment anymore!
# RetainedCode or something
class CommentMeta:
def __init__(self):
self.data = ""
self.symbol_before = None
self.symbol_inline = None
self.symbol_after = None
self.symbol_padding_before = None
self.symbol_padding_after = None
# NOTE - maybe holding more than just 1 line before/after might help?
self.code_before = None
self.code_after = None
self.code_padding_before = None
self.code_padding_after = None
self.line_num_in_form = None # None == top level
self.containing_form = None # none - top level
self.containing_form_kind = None # function|method|behaviour
self.containing_form_func_name = None # or the method/behaviour
self.containing_form_type = None
self.inline = False
self.code_in_line = None # only for inline comments
self.line_in_file = None # a worst-case scenario fallback
def __str__(self):
return "{}:{}:{}".format(self.data, self.symbol_before, self.symbol_after)
from code_retention.code_retention import *
parser = argparse.ArgumentParser("update-from-decomp")
parser.add_argument("--game", help="The name of the game", type=str)
parser.add_argument("--file", help="The name of the file", type=str)
parser.add_argument("--preserve", help="Attempt to preserve comments and marked blocks", action="store_true")
parser.add_argument(
"--debug", help="Output debug metadata on every block", action="store_true"
)
@@ -81,149 +54,12 @@ args = parser.parse_args()
gsrc_path = get_gsrc_path_from_filename(args.game, args.file)
# Step 1 - Find and update all named blocks from all-types (useful for enums)
update_alltypes_named_blocks(args.game)
comments = []
debug_lines = []
def debug_nice_formatted_code(val):
if val is None:
return None
return val.strip()[0:20]
# returns (symbol | None, padding)
def backtrack_for_symbol(lines, index):
padding = 0
for i in range(index - 1, 0, -1):
tline = lines[i].strip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1), padding
elif (
not tline.strip() == "" and not tline.strip().startswith(";")
) or "decomp begins" in tline.lower():
# we hit a non empty line (but it wasn't a symbol!)
return None, padding
elif tline.strip() == "":
padding = padding + 1
return None, padding
def symbol_on_line(line):
tline = line.lstrip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1)
return None
def lookahead_for_symbol(lines, index):
padding = 0
for i in range(index + 1, len(lines), 1):
tline = lines[i].lstrip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1), padding
elif (
not tline.strip() == "" and not tline.strip().startswith(";")
) or "decomp begins" in tline.lower():
# we hit a non empty line (but it wasn't a symbol!)
return None, padding
elif tline.strip() == "":
padding = padding + 1
return None, padding
def backtrack_for_code(lines, index):
padding = 0
for i in range(index - 1, 0, -1):
line = lines[i]
if line.strip() == "":
padding = padding + 1
continue
elif "decomp begins" in line.lower():
return None, padding
elif line.lstrip().startswith(";"):
continue
return line, padding
def lookahead_for_code(lines, index):
padding = 0
for i in range(index + 1, len(lines), 1):
line = lines[i]
if line.strip() == "":
padding = padding + 1
continue
elif "decomp begins" in line.lower():
return None, padding
elif line.lstrip().startswith(";"):
continue
return line, padding
# returns form, or none
def is_line_start_of_form(line):
if line.rstrip().startswith(";"):
return None
matches = re.search(r"\(\s*([^\s.]*)\s+", line)
if matches is not None:
return line
return None
def has_form_ended(stack, line):
# if the stack is empty, return true
line_before_comment = line.partition(";")[0]
for char in line_before_comment:
if char == "(":
stack.append(char)
elif char == ")":
if len(stack) == 0:
# unbalanced parens?
return True
stack.pop()
if len(stack) == 0:
return True
else:
if len(stack) == 0:
return True
return False
def append_form_metadata(comment, form_start_line):
func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_start_line)
if func_matches is not None:
comment.containing_form_kind = "function"
comment.containing_form_func_name = func_matches.group(1)
comment.containing_form_type = None
return
behavior_matches = re.search(
r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_start_line
)
if behavior_matches is not None:
comment.containing_form_kind = "behavior"
comment.containing_form_func_name = behavior_matches.group(1)
comment.containing_form_type = behavior_matches.group(2)
return
method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_start_line)
if method_matches is not None:
comment.containing_form_kind = "method"
comment.containing_form_func_name = method_matches.group(1)
comment.containing_form_type = method_matches.group(2)
return
comment.containing_form_kind = "unknown"
comment.containing_form_func_name = None
comment.containing_form_type = None
decomp_ignore_forms = []
decomp_ignore_forms = ["defmethod inspect"]
decomp_ignore_errors = False
with open(gsrc_path) as f:
@@ -239,160 +75,8 @@ with open(gsrc_path) as f:
if "og:ignore-form" in line:
decomp_ignore_forms.append(line.partition("ignore-form:")[2].strip())
lines.append(line)
# track if we are inside a define*/defun/defmethod/deftype/defstate
within_form = None
line_num_in_form = None
form_paren_stack = []
found_output = False
i = 0
while i < len(lines):
debug_lines.append(lines[i])
tline = lines[i].lstrip()
if "decomp begins" in tline.lower():
found_output = True
i = i + 1
continue
if not found_output:
i = i + 1
continue
# actually process code
if within_form is None:
# lets see if we are now in one
within_form = is_line_start_of_form(lines[i])
if within_form is not None:
line_num_in_form = 0
if has_form_ended(form_paren_stack, lines[i]):
within_form = None
form_paren_stack = []
elif within_form is not None:
# check if the form has ended by counting parens
if has_form_ended(form_paren_stack, lines[i]):
within_form = None
form_paren_stack = []
line_num_in_form = 0
else:
line_num_in_form = line_num_in_form + 1
if tline.startswith(";") or tline.startswith("#|"):
# treat decomp deviation blocks as essentially comments as well, so include them in a block comment if appropriate
# this is done because there is nothing to match them against (if a comment is inside them for example)
# so we have to copy them in full
in_deviation_block = False
if "decomp deviation" in tline.lower() or tline.startswith("#|"):
in_deviation_block = True
current_comment = CommentMeta()
current_comment.line_in_file = i
current_comment.data = lines[i]
(
current_comment.symbol_before,
current_comment.symbol_padding_before,
) = backtrack_for_symbol(lines, i)
(
current_comment.code_before,
current_comment.code_padding_before,
) = backtrack_for_code(lines, i)
current_comment.containing_form = within_form
if within_form is not None:
append_form_metadata(current_comment, within_form)
current_comment.line_num_in_form = line_num_in_form
current_comment.inline = False
# look ahead to handle block comments
if i + 1 < len(lines):
next_line = lines[i + 1]
if "decomp deviation" in next_line.lower() or next_line.startswith("|#"):
in_deviation_block = False
while i + 1 < len(lines) and (
in_deviation_block
or next_line.lstrip().startswith(";")
or next_line.lstrip().startswith("|#")
):
debug_lines.append(lines[i + 1])
i = i + 1
current_comment.data = current_comment.data + next_line
if i + 1 < len(lines):
next_line = lines[i + 1]
if "decomp deviation" in next_line.lower() or next_line.startswith(
"|#"
):
in_deviation_block = False
(
current_comment.symbol_after,
current_comment.symbol_padding_after,
) = lookahead_for_symbol(lines, i)
(
current_comment.code_after,
current_comment.code_padding_after,
) = lookahead_for_code(lines, i)
comments.append(current_comment)
debug_lines.append(
";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format(
current_comment.symbol_before,
current_comment.symbol_padding_before,
current_comment.symbol_after,
current_comment.symbol_padding_after,
debug_nice_formatted_code(current_comment.code_before),
current_comment.code_padding_before,
debug_nice_formatted_code(current_comment.code_after),
current_comment.code_padding_after,
)
)
debug_lines.append(
";; [DEBUG]: in_form - {}...:{}\n".format(
debug_nice_formatted_code(current_comment.containing_form),
current_comment.line_num_in_form,
)
)
# inline comments
# TODO - cleanup duplication
elif ";" in tline:
current_comment = CommentMeta()
current_comment.line_in_file = i
current_comment.data = ";" + tline.partition(";")[2]
(
current_comment.symbol_before,
current_comment.symbol_padding_before,
) = backtrack_for_symbol(lines, i)
(
current_comment.symbol_after,
current_comment.symbol_padding_after,
) = lookahead_for_symbol(lines, i)
(
current_comment.code_before,
current_comment.code_padding_before,
) = backtrack_for_code(lines, i)
(
current_comment.code_after,
current_comment.code_padding_after,
) = lookahead_for_code(lines, i)
current_comment.containing_form = within_form
if within_form is not None:
append_form_metadata(current_comment, within_form)
current_comment.line_num_in_form = line_num_in_form
current_comment.symbol_inline = symbol_on_line(tline)
current_comment.inline = True
current_comment.code_in_line = tline.partition(";")[0]
comments.append(current_comment)
debug_lines.append(
";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format(
current_comment.symbol_before,
current_comment.symbol_padding_before,
current_comment.symbol_after,
current_comment.symbol_padding_after,
debug_nice_formatted_code(current_comment.code_before),
current_comment.code_padding_before,
debug_nice_formatted_code(current_comment.code_after),
current_comment.code_padding_after,
)
)
debug_lines.append(
";; [DEBUG]: in_form - {}...:{} || inline_code - {}...\n".format(
debug_nice_formatted_code(current_comment.containing_form),
current_comment.line_num_in_form,
debug_nice_formatted_code(current_comment.code_in_line),
)
)
i = i + 1
if args.preserve:
comments, debug_lines = process_original_lines(lines)
if args.debug:
with open(gsrc_path, "w") as f:
@@ -428,7 +112,6 @@ def should_ignore_line(line):
return False
# TODO - check for existance probably
decomp_file_path = "./decompiler_out/{}/{}_disasm.gc".format(args.game, args.file)
with open(decomp_file_path) as f:
lines = f.readlines()
@@ -476,491 +159,25 @@ with open(decomp_file_path) as f:
# Step 3: Start merging the new code + comments
final_lines = []
decomp_started = False
def get_symbol_at_line(line):
tline = line.strip()
matches = re.search(
r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline
)
if matches is not None:
return matches.group(1)
return None
def relevant_symbol_comments_for_line_before(line):
symbol = get_symbol_at_line(line)
if symbol is None:
return []
# Loop through comments, finding any that match the symbol
# they WILL be placed, so we can remove them from our list now
i = 0
relevant_comments = []
while i < len(comments):
comment = comments[i]
if comment.symbol_after == symbol:
relevant_comments.append(comment)
comments.pop(i)
else:
i = i + 1
return relevant_comments
def padding_before_comment(comment):
if comment.containing_form is None:
if comment.symbol_after is not None:
return "\n" * comment.symbol_padding_after
return ""
def relevant_symbol_comments_for_inline(line):
symbol = get_symbol_at_line(line)
if symbol is None:
return []
# Loop through comments, finding any that match the symbol
# they WILL be placed, so we can remove them from our list now
i = 0
relevant_comments = []
while i < len(comments):
comment = comments[i]
if comment.symbol_inline == symbol:
relevant_comments.append(comment)
comments.pop(i)
else:
i = i + 1
return relevant_comments
def padding_after_comment(comment):
if comment.containing_form is None:
if comment.symbol_before is not None:
return "\n" * comment.symbol_padding_before
return ""
def relevant_symbol_comments_for_line_after(line):
symbol = get_symbol_at_line(line)
if symbol is None:
return []
# Loop through comments, finding any that match the symbol
# they WILL be placed, so we can remove them from our list now
i = 0
relevant_comments = []
while i < len(comments):
comment = comments[i]
# if we can, we prefer to put comments before not after (more accurate re-creation)
if comment.symbol_after is None and comment.symbol_before == symbol:
relevant_comments.append(comment)
comments.pop(i)
else:
i = i + 1
return relevant_comments
# the first half of the defmethod/etc lines (before arg list) is less likely to change
# so we want to split it to weight it more heavily
def split_def_line(line):
first_part = ""
second_part = ""
for index, char in enumerate(line):
if char == "(":
if index == 0:
first_part = first_part + char
else:
second_part = second_part + char
continue
else:
if second_part != "":
second_part = second_part + char
else:
first_part = first_part + char
return first_part, second_part
def get_form_metadata(form_def_line):
func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_def_line)
if func_matches is not None:
return "function", func_matches.group(1), None
behavior_matches = re.search(r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_def_line)
if behavior_matches is not None:
return "behavior", behavior_matches.group(1), behavior_matches.group(2)
method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_def_line)
if method_matches is not None:
return "method", method_matches.group(1), method_matches.group(2)
return "unknown", None, None
built_in_method_names = [
"new",
"delete",
"print",
"inspect",
"length",
"asize-of",
"copy",
"relocate",
"memusage",
]
def different_method_names(form_func_name, comment_form_func_name):
if (
comment_form_func_name not in built_in_method_names
and form_func_name not in built_in_method_names
):
return False
return form_func_name != comment_form_func_name
def get_relevant_form_comments(form_def_line):
form_kind, form_func_name, form_type = get_form_metadata(form_def_line)
code_def_part, code_rest = split_def_line(form_def_line)
relevant_comments = []
i = 0
while i < len(comments):
comment = comments[i]
if comment.containing_form is None:
i = i + 1
continue
(
comment_form_kind,
comment_form_func_name,
comment_form_type,
) = get_form_metadata(comment.containing_form)
# First disqualify the form if it's obviously unrelated
if comment_form_kind != "unknown":
if form_kind != comment_form_kind:
i = i + 1
continue
elif form_kind == "function" and comment_form_func_name != form_func_name:
i = i + 1
continue
elif form_kind == "behavior" and comment_form_func_name != form_func_name:
i = i + 1
continue
elif form_kind == "method" and (
comment_form_type != form_type
or different_method_names(form_func_name, comment_form_func_name)
):
i = i + 1
continue
# Evaluate it's score (comments and current def line)
def_part, rest = split_def_line(comment.containing_form)
def_score = fuzz.ratio(code_def_part, def_part) * 0.65
if def_score == 65.0 and form_kind != "unknown":
relevant_comments.append(comment)
comments.pop(i)
continue
rest_score = fuzz.ratio(code_rest, rest) * 0.35
combined_score = def_score + rest_score
threshold = 50.0
if combined_score < threshold:
i = i + 1
continue
# Now, let's look at ALL other def lines yet to come from the decomp output
# if any are a better match, don't add the comment yet -- we'll add it when we get there!
# TODO - remove lines from the list as we find them so speed this up
found_better_form = False
for decomp_def_line in decomp_form_def_lines:
line_form_kind, line_form_func_name, line_form_type = get_form_metadata(
decomp_def_line
)
if form_kind != "unknown":
if form_kind != line_form_kind:
continue
elif form_kind == "function" and line_form_func_name != form_func_name:
continue
elif form_kind == "behavior" and line_form_func_name != form_func_name:
continue
elif form_kind == "method" and (
line_form_type != form_type
or different_method_names(form_func_name, line_form_func_name)
):
continue
def_part, rest = split_def_line(decomp_def_line)
def_score = fuzz.ratio(code_def_part, def_part) * 0.65
if def_score == 65.0 and form_kind != "unknown":
found_better_form = True
break
rest_score = fuzz.ratio(code_rest, rest) * 0.35
if combined_score < def_score + rest_score:
found_better_form = True
break
# TODO otherwise? still test?
if found_better_form:
i = i + 1
continue
relevant_comments.append(comment)
comments.pop(i)
return relevant_comments
# Simple fuzz ratio, but removes obvious outliers like empty lines / lines with only a paren
def score_alg(line1, line2):
tline1 = line1.strip()
tline2 = line2.strip()
if tline1 == "" or tline1 == ")" or tline1 == "(":
return -1
if tline2 == "" or tline2 == ")" or tline2 == "(":
return -1
return fuzz.ratio(tline1, tline2)
# TODO - improvement on comparison - a higher score on a longer line == better? some sort of weighting approach here too?
with open(gsrc_path) as f:
lines = f.readlines()
within_form = None
line_num_in_form = None
form_paren_stack = []
for line in lines:
if "[DEBUG]" in line:
continue
if line.lower().lstrip().startswith(";; decomp begins"):
decomp_started = True
if args.preserve:
merge_retained_code_and_new_code(gsrc_path, decomp_lines, final_lines)
else:
with open(gsrc_path) as f:
lines = f.readlines()
for line in lines:
final_lines.append(line)
break
if not decomp_started:
if line.lower().startswith(";; decomp begins"):
break
for line in decomp_lines:
final_lines.append(line)
continue
i = 0
while i < len(decomp_lines):
line = decomp_lines[i]
# Otherwise, its a part of the output we have to be more careful about
# For every line in the decompiled output, we scan our comment list to see if anything matches
# if it does, we insert it appropriately and remove the comment from the list
#
# This is the main source of inefficiency, but the process gets progressively faster as comments are eliminated
if within_form is None:
# lets see if we are now in one
within_form = is_line_start_of_form(line)
# TODO - check line for symbol matches?
if within_form is not None:
line_num_in_form = 0
if has_form_ended(form_paren_stack, line):
within_form = None
form_paren_stack = []
else:
# Get all of the lines of the form at once
form_start = decomp_lines[i]
form_lines = [form_start]
while i < len(decomp_lines):
i = i + 1
line = decomp_lines[i]
if has_form_ended(form_paren_stack, line):
within_form = None
form_paren_stack = []
break
else:
form_lines.append(line)
# Add any comments needed to the form contents
# - first we get all comments that have match well with the form's start line (ie. defmethod ....)
form_comments = get_relevant_form_comments(form_start)
# - for each comment, let's find which line matches it the best,
# if NONE exceed the threshold (if both match the same, pick the first), we default to the line offset
for comment in form_comments:
highest_score = -1
index_to_insert = -1
threshold = 50.0
place_kind = None
for index, form_line in enumerate(form_lines):
# skip any comments that were previously added
if form_line.lstrip().startswith(";"):
continue
if comment.code_in_line is not None:
score = score_alg(form_line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = index
highest_score = score
place_kind = "inline"
if comment.code_before is not None:
score = score_alg(form_line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = index
highest_score = score
place_comment_after = True
place_kind = "next_line"
if comment.code_after is not None:
score = score_alg(form_line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = index
highest_score = score
place_comment_after = False
place_kind = "before_line"
# add the comment!
if index_to_insert == -1:
if comment.inline:
form_lines[comment.line_num_in_form] = (
form_lines[index_to_insert].rstrip()
+ " "
+ comment.data
)
else:
form_lines.insert(
comment.line_num_in_form, comment.data
)
elif comment.inline:
form_index = index_to_insert
if place_kind == "next_line":
form_index = index_to_insert + 1
form_lines[form_index] = (
form_lines[form_index].rstrip() + " " + comment.data
)
elif place_kind == "next_line":
form_lines.insert(
index_to_insert + 1,
padding_before_comment(comment) + comment.data,
)
else:
form_lines.insert(
index_to_insert,
padding_after_comment(comment) + comment.data,
)
# Add the lines to the final output
for form_line in form_lines:
final_lines.append(form_line)
# Otherwise, we are at the top-level!
if within_form is None:
before_comments = relevant_symbol_comments_for_line_before(line)
for comment in before_comments:
final_lines.append(padding_before_comment(comment) + comment.data)
inline_comments = relevant_symbol_comments_for_inline(line)
if len(inline_comments) > 0:
comment_str = ""
for comment in inline_comments:
comment_str = comment_str + comment.data.strip()
comment_str = comment_str.replace(";", "")
final_lines.append(
"{} ;; {}".format(line.rstrip(), comment_str.strip())
)
else:
final_lines.append(line)
after_comments = relevant_symbol_comments_for_line_after(line)
for comment in after_comments:
final_lines.append(padding_after_comment(comment) + comment.data)
# next line
i = i + 1
# Step 3.b: Handle any remaining top level comments
# If we can't find a code line that meets a threshold, default to their line number
# - Why is this done after: if a comment is associated with nothing but code, we have no
# guarantee where it should go, so we have to wait until all code is populated
# This is SUPER inefficient, so hopefully we've processed nearly all comments by this point
for comment in comments:
within_form = None
line_num_in_form = None
form_paren_stack = []
found_output = True
i = 0
index_to_insert = -1
highest_score = -1
place_comment_after = True
threshold = 50.0
while i < len(final_lines):
debug_lines.append(final_lines[i])
tline = final_lines[i].lstrip()
if "decomp begins" in tline.lower():
found_output = True
i = i + 1
continue
if not found_output:
i = i + 1
continue
line = final_lines[i]
# We can try to claw back a bit of efficiency by skipping the inside of forms
if within_form is not None:
# check if the form has ended by counting parens
if has_form_ended(form_paren_stack, line):
if comment.code_in_line is not None:
score = score_alg(line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
if comment.code_before is not None:
score = score_alg(line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = True
if comment.code_after is not None:
score = score_alg(line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = False
within_form = None
form_paren_stack = []
line_num_in_form = 0
else:
line_num_in_form = line_num_in_form + 1
else:
# lets see if we are now in a form
within_form = is_line_start_of_form(line)
if within_form is not None:
if comment.code_in_line is not None:
score = score_alg(line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
if comment.code_before is not None:
score = score_alg(line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = True
if comment.code_after is not None:
score = score_alg(line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = False
line_num_in_form = 0
else:
# just normal code, check it
if comment.code_in_line is not None:
score = score_alg(line, comment.code_in_line)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
if comment.code_before is not None:
score = score_alg(line, comment.code_before)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = True
if comment.code_after is not None:
score = score_alg(line, comment.code_after)
if score >= threshold and score > highest_score:
index_to_insert = i
highest_score = score
place_comment_after = False
i = i + 1
# end of while loop
# add the comment!
if index_to_insert == -1:
if comment.inline:
final_lines[comment.line_in_file] = (
final_lines[comment.line_in_file].rstrip() + " " + comment.data
)
else:
final_lines.insert(comment.line_in_file, comment.data)
elif comment.inline:
final_lines[index_to_insert] = (
final_lines[index_to_insert].rstrip() + " " + comment.data
)
elif place_comment_after:
final_lines.insert(
index_to_insert + 1,
padding_before_comment(comment) + comment.data,
)
else:
final_lines.insert(
index_to_insert,
padding_after_comment(comment) + comment.data,
)
if args.preserve:
handle_dangling_blocks(comments, final_lines, debug_lines)
# Step 4: Write it out
with open(gsrc_path, "w") as f:
+6
View File
@@ -29,3 +29,9 @@ def get_gsrc_path_from_filename(game_name, file_name):
print("{} couldn't find in /goal_src/{}!".format(file_name, game_name))
exit(1)
return path
def get_alltypes_path_from_game(game_name):
if game_name == "jak1":
return "./decompiler/config/all-types.gc"
else:
return "./decompiler/config/jak2/all-types.gc"
-4
View File
@@ -2154,7 +2154,3 @@
;; failed to figure out what this is:
(kmemclose)
+1 -5
View File
@@ -446,7 +446,7 @@
(circular-follow vector :inline :offset-assert 2256)
(max-angle-offset float :offset-assert 2272)
(max-angle-curr float :offset-assert 2276)
(options uint32 :offset-assert 2280)
(options camera-slave-options :offset-assert 2280)
(cam-entity entity :offset-assert 2284)
(butt-timer uint64 :offset-assert 2288)
(butt-seek basic :offset-assert 2296)
@@ -664,7 +664,3 @@
;; failed to figure out what this is:
0
+1 -4
View File
@@ -4,6 +4,7 @@
;; definition of type control-info
(deftype control-info (collide-shape-moving)
((unknown-qword00 vector :offset 12)
(unknown-float00 float :offset 528)
(unknown-surface00 surface :offset 3832)
(unknown-cpad-info00 cpad-info :offset 3848)
(unknown-time-frame00 time-frame :offset 4624)
@@ -19,7 +20,3 @@
;; failed to figure out what this is:
0
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -345,11 +345,11 @@
;; definition of type entity-info
(deftype entity-info (basic)
((ptype type :offset-assert 4)
(package basic :offset-assert 8)
(art-group pair :offset-assert 12)
(pool basic :offset-assert 16)
(heap-size int32 :offset-assert 20)
((ptype type :offset-assert 4)
(package string :offset-assert 8)
(art-group pair :offset-assert 12)
(pool symbol :offset-assert 16)
(heap-size int32 :offset-assert 20)
)
:method-count-assert 9
:size-assert #x18
+218
View File
@@ -0,0 +1,218 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *entity-info*, type (array entity-info)
(define *entity-info* (the-as (array entity-info) (new 'static 'boxed-array :type entity-info
(new 'static 'entity-info
:ptype (type-ref stadium-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref citywide-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctywide-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref tomb-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctyslumb-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctygena-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctyindb-part :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref jellyfish :method-count 167)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x10000
)
(new 'static 'entity-info
:ptype (type-ref widow :method-count 47)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x10000
)
(new 'static 'entity-info
:ptype (type-ref nav-graph :method-count 47)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref pal-electric-fan :method-count 23)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x6000
)
(new 'static 'entity-info
:ptype (type-ref lurker-pipe-lid :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref ctyn-lamp :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref burning-bush :method-count 35)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref sail-boat-a :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref barge :method-count 151)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref propa :method-count 35)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref city-window-a :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref cty-window-a :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref parking-spot :method-count 27)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref security-wall :method-count 27)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref cty-guard-turret :method-count 39)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref cty-fruit-stand :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref fruit-stand :method-count 31)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref torn :method-count 179)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x4000
)
(new 'static 'entity-info
:ptype (type-ref neon-baron :method-count 19)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
:heap-size #x10000
)
)
)
)
;; definition for function entity-info-lookup
;; INFO: Return type mismatch basic vs entity-info.
(defun entity-info-lookup ((arg0 type))
"Given a type, return the [[entity-info]] from [[*entity-info*]] whos type
matches the `ptype` field. Set's `method 13` on said type that returns the `length`
off the [[entity-info]]
If nothing matches, set `method 13` to `#f` and return `#f`"
(the-as entity-info (cond
((nonzero? (-> arg0 method-table 13))
(-> arg0 method-table 13)
)
(else
(let ((v1-1 *entity-info*))
(dotimes (a1-0 (-> v1-1 length))
(when (= arg0 (-> v1-1 a1-0 ptype))
(set! (-> arg0 method-table 13) (the-as function (-> v1-1 a1-0)))
(return (the-as entity-info (-> v1-1 a1-0)))
)
)
)
(set! (-> arg0 method-table 13) #f)
(the-as basic #f)
)
)
)
)
+421
View File
@@ -0,0 +1,421 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 7 of type process
(defmethod relocate process ((obj process) (arg0 int))
(let ((v1-0 *kernel-context*))
(set! (-> v1-0 relocating-process) obj)
(set! (-> v1-0 relocating-min) (the-as int (&-> obj type)))
(set! (-> v1-0 relocating-max)
(the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj)))
)
(set! (-> v1-0 relocating-offset) arg0)
)
(&+! (-> obj ppointer 0) arg0)
(let ((v1-5 (-> obj entity)))
(if (and v1-5 (= (-> v1-5 extra process) obj))
(&+! (-> v1-5 extra process) arg0)
)
)
(let ((v1-7 (-> obj connection-list next1)))
(while (the-as connection v1-7)
(let ((a0-14 (-> v1-7 prev1)))
(if (and (>= (the-as int a0-14) (-> *kernel-context* relocating-min))
(< (the-as int a0-14) (-> *kernel-context* relocating-max))
)
(&+! (-> v1-7 prev1) arg0)
)
)
(let ((a0-19 (-> (the-as connection v1-7) param1)))
(if (and (>= a0-19 (-> *kernel-context* relocating-min)) (< a0-19 (-> *kernel-context* relocating-max)))
(+! (-> (the-as connection v1-7) param1) arg0)
)
)
(let ((a0-24 (-> (the-as connection v1-7) param2)))
(if (and (>= a0-24 (-> *kernel-context* relocating-min)) (< a0-24 (-> *kernel-context* relocating-max)))
(+! (-> (the-as connection v1-7) param2) arg0)
)
)
(let ((a0-29 (-> (the-as connection v1-7) param3)))
(if (and (>= a0-29 (-> *kernel-context* relocating-min)) (< a0-29 (-> *kernel-context* relocating-max)))
(+! (-> (the-as connection v1-7) param3) arg0)
)
)
(set! v1-7 (-> (the-as connection v1-7) next1))
)
)
(let ((v1-10 (-> obj self)))
(if (and (>= (the-as int v1-10) (-> *kernel-context* relocating-min))
(< (the-as int v1-10) (-> *kernel-context* relocating-max))
)
(&+! (-> obj self) arg0)
)
)
(let ((v1-15 (-> obj ppointer)))
(if (and (>= (the-as int v1-15) (-> *kernel-context* relocating-min))
(< (the-as int v1-15) (-> *kernel-context* relocating-max))
)
(&+! (-> obj ppointer) arg0)
)
)
(let ((s4-0 (&+ (-> obj heap-base) 4)))
(while (< (the-as int s4-0) (the-as int (-> obj heap-cur)))
(relocate s4-0 arg0)
(&+! s4-0 (logand -16 (+ (asize-of s4-0) 15)))
)
)
(&+! (-> obj main-thread) arg0)
(&+! (-> obj top-thread) arg0)
(&+! (-> obj heap-base) arg0)
(&+! (-> obj heap-cur) arg0)
(&+! (-> obj heap-top) arg0)
(let ((a2-4 (asize-of obj))
(a1-22 (&-> obj type))
)
(cond
((>= arg0 0)
(qmem-copy->! (&+ a1-22 arg0) a1-22 a2-4)
)
((< a2-4 2560)
(qmem-copy<-! (&+ a1-22 arg0) a1-22 a2-4)
)
(else
(ultimate-memcpy (&+ a1-22 arg0) a1-22 (the-as uint a2-4))
)
)
)
(set! (-> *kernel-context* relocating-process) #f)
(&+ obj arg0)
)
;; definition for method 7 of type cpu-thread
(defmethod relocate cpu-thread ((obj cpu-thread) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type process-drawable
;; INFO: Return type mismatch process vs process-drawable.
(defmethod relocate process-drawable ((obj process-drawable) (arg0 int))
(let ((v1-0 *kernel-context*))
(set! (-> v1-0 relocating-process) obj)
(set! (-> v1-0 relocating-min) (the-as int (&-> obj type)))
(set! (-> v1-0 relocating-max)
(the-as int (+ (+ (-> obj allocated-length) -4 (-> process size)) (the-as int obj)))
)
(set! (-> v1-0 relocating-offset) arg0)
)
(let ((a0-6 (-> obj nav)))
(if (and (nonzero? a0-6) a0-6)
(relocate a0-6 arg0)
)
)
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj node-list))
(&+! (-> obj node-list) arg0)
)
(if (nonzero? (-> obj draw))
(&+! (-> obj draw) arg0)
)
(if (nonzero? (-> obj skel))
(&+! (-> obj skel) arg0)
)
(if (nonzero? (-> obj align))
(&+! (-> obj align) arg0)
)
(if (nonzero? (-> obj path))
(&+! (-> obj path) arg0)
)
(if (nonzero? (-> obj vol))
(&+! (-> obj vol) arg0)
)
(if (nonzero? (-> obj fact))
(&+! (-> obj fact) arg0)
)
(if (nonzero? (-> obj link))
(&+! (-> obj link) arg0)
)
(if (nonzero? (-> obj part))
(&+! (-> obj part) arg0)
)
(if (nonzero? (-> obj water))
(&+! (-> obj water) arg0)
)
(if (nonzero? (-> obj sound))
(&+! (-> obj sound) arg0)
)
(if (nonzero? (-> obj carry))
(&+! (-> obj carry) arg0)
)
(if (nonzero? (-> obj rbody))
(&+! (-> obj rbody) arg0)
)
(the-as process-drawable ((method-of-type process relocate) obj arg0))
)
;; definition for method 7 of type collide-shape
(defmethod relocate collide-shape ((obj collide-shape) (arg0 int))
(&+! (-> obj process) arg0)
(&+! (-> obj root-prim) arg0)
obj
)
;; definition for method 7 of type collide-shape-moving
;; INFO: Return type mismatch collide-shape vs collide-shape-moving.
(defmethod relocate collide-shape-moving ((obj collide-shape-moving) (arg0 int))
(if (-> obj dynam)
(&+! (-> obj dynam) arg0)
)
(the-as collide-shape-moving ((method-of-type collide-shape relocate) obj arg0))
)
;; definition for method 7 of type collide-shape-prim
(defmethod relocate collide-shape-prim ((obj collide-shape-prim) (arg0 int))
(&+! (-> obj cshape) arg0)
obj
)
;; definition for method 7 of type collide-shape-prim-group
(defmethod relocate collide-shape-prim-group ((obj collide-shape-prim-group) (arg0 int))
(&+! (-> obj cshape) arg0)
(set! (-> obj child) (the-as (inline-array collide-shape) (&+ (the-as pointer (-> obj child)) arg0)))
obj
)
;; definition for method 7 of type fact-info
(defmethod relocate fact-info ((obj fact-info) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type draw-control
(defmethod relocate draw-control ((obj draw-control) (arg0 int))
(&+! (-> obj skeleton) arg0)
(&+! (-> obj process) arg0)
(when (-> obj ripple)
(if (-> obj ripple query)
(&+! (-> obj ripple query) arg0)
)
(&+! (-> obj ripple) arg0)
)
(let ((v1-14 (-> obj shadow-ctrl)))
(if (and (>= (the-as int v1-14) (-> *kernel-context* relocating-min))
(< (the-as int v1-14) (-> *kernel-context* relocating-max))
)
(&+! (-> obj shadow-ctrl) arg0)
)
)
obj
)
;; definition for method 7 of type joint-control
(defmethod relocate joint-control ((obj joint-control) (arg0 int))
(if (-> obj effect)
(&+! (-> obj effect) arg0)
)
(if (-> obj top-anim)
(&+! (-> obj top-anim) arg0)
)
(+! (-> obj root-channel) arg0)
(countdown (v1-10 (-> obj allocated-length))
(&+! (-> obj channel v1-10 parent) arg0)
)
obj
)
;; definition for method 7 of type cspace-array
(defmethod relocate cspace-array ((obj cspace-array) (arg0 int))
(countdown (v1-0 (-> obj length))
(let ((a2-2 (-> obj data v1-0)))
(if (-> a2-2 parent)
(&+! (-> a2-2 parent) arg0)
)
(&+! (-> a2-2 bone) arg0)
(let ((a3-6 (-> a2-2 param1)))
(if (and (>= (the-as int a3-6) (-> *kernel-context* relocating-min))
(< (the-as int a3-6) (-> *kernel-context* relocating-max))
)
(&+! (-> a2-2 param1) arg0)
)
)
(let ((a3-11 (-> a2-2 param2)))
(if (and (>= (the-as int a3-11) (-> *kernel-context* relocating-min))
(< (the-as int a3-11) (-> *kernel-context* relocating-max))
)
(&+! (-> a2-2 param2) arg0)
)
)
)
)
obj
)
;; definition for method 7 of type path-control
(defmethod relocate path-control ((obj path-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type vol-control
(defmethod relocate vol-control ((obj vol-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type water-control
(defmethod relocate water-control ((obj water-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type actor-link-info
(defmethod relocate actor-link-info ((obj actor-link-info) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type align-control
(defmethod relocate align-control ((obj align-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type joint-mod
(defmethod relocate joint-mod ((obj joint-mod) (arg0 int))
(&+! (-> obj process) arg0)
(&+! (-> obj joint) arg0)
obj
)
;; definition for method 7 of type joint-mod-wheel
(defmethod relocate joint-mod-wheel ((obj joint-mod-wheel) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type joint-mod-ik
(defmethod relocate joint-mod-ik ((obj joint-mod-ik) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type effect-control
(defmethod relocate effect-control ((obj effect-control) (arg0 int))
(&+! (-> obj process) arg0)
obj
)
;; definition for method 7 of type sparticle-launch-control
(defmethod relocate sparticle-launch-control ((obj sparticle-launch-control) (arg0 int))
(&+! (-> obj proc) arg0)
(countdown (v1-2 (-> obj length))
(let* ((a0-4 (-> obj data v1-2))
(a2-0 (-> a0-4 center))
)
(if (and (>= (the-as int a2-0) (-> *kernel-context* relocating-min))
(< (the-as int a2-0) (-> *kernel-context* relocating-max))
)
(&+! (-> a0-4 center) arg0)
)
)
)
(forall-particles-with-key
obj
(lambda ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(let ((v1-1 (-> *kernel-context* relocating-offset)))
(set! (-> arg1 key) (the-as sparticle-launch-control (+ (the-as int (-> arg1 key)) v1-1)))
(if (-> arg1 binding)
(set! (-> arg1 binding) (the-as sparticle-launch-state (+ (the-as int (-> arg1 binding)) v1-1)))
)
)
0
(none)
)
#t
#t
)
obj
)
;; definition for method 7 of type camera-master
;; INFO: Return type mismatch process vs camera-master.
(defmethod relocate camera-master ((obj camera-master) (arg0 int))
(if (nonzero? (-> obj water-drip))
(&+! (-> obj water-drip) arg0)
)
(the-as camera-master ((method-of-type process relocate) obj arg0))
)
;; definition for method 7 of type time-of-day-proc
;; INFO: Return type mismatch process vs time-of-day-proc.
(defmethod relocate time-of-day-proc ((obj time-of-day-proc) (arg0 int))
(if (nonzero? (-> obj sun))
(&+! (-> obj sun) arg0)
)
(if (nonzero? (-> obj green-sun))
(&+! (-> obj green-sun) arg0)
)
(if (nonzero? (-> obj moon))
(&+! (-> obj moon) arg0)
)
(the-as time-of-day-proc ((method-of-type process relocate) obj arg0))
)
;; definition for method 7 of type part-tracker
;; INFO: Return type mismatch process vs part-tracker.
(defmethod relocate part-tracker ((obj part-tracker) (arg0 int))
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj part))
(&+! (-> obj part) arg0)
)
(the-as part-tracker ((method-of-type process relocate) obj arg0))
)
;; definition for method 7 of type part-spawner
;; INFO: Return type mismatch process vs part-spawner.
(defmethod relocate part-spawner ((obj part-spawner) (arg0 int))
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj part))
(&+! (-> obj part) arg0)
)
(if (nonzero? (-> obj sound))
(&+! (-> obj sound) arg0)
)
(the-as part-spawner ((method-of-type process relocate) obj arg0))
)
;; definition for method 7 of type lightning-tracker
;; INFO: Return type mismatch process vs lightning-tracker.
(defmethod relocate lightning-tracker ((obj lightning-tracker) (arg0 int))
(if (nonzero? (-> obj root))
(&+! (-> obj root) arg0)
)
(if (nonzero? (-> obj lightning))
(&+! (-> obj lightning) arg0)
)
(the-as lightning-tracker ((method-of-type process relocate) obj arg0))
)
;; definition for method 7 of type manipy
;; INFO: Return type mismatch process-drawable vs manipy.
(defmethod relocate manipy ((obj manipy) (arg0 int))
(if (nonzero? (-> obj joint 0))
(&+! (-> obj joint 0) arg0)
)
(if (nonzero? (-> obj joint 1))
(&+! (-> obj joint 1) arg0)
)
(if (nonzero? (-> obj joint 2))
(&+! (-> obj joint 2) arg0)
)
(if (nonzero? (-> obj joint 3))
(&+! (-> obj joint 3) arg0)
)
(the-as manipy ((method-of-type process-drawable relocate) obj arg0))
)
+9 -7
View File
@@ -239,9 +239,9 @@
(karma float :offset-assert 116)
(eco-pill-dark float :offset-assert 120)
(eco-pill-dark-total float :offset-assert 124)
(features uint64 :offset-assert 128)
(debug-features uint64 :offset-assert 136)
(secrets uint32 :offset-assert 144)
(features game-feature :offset-assert 128)
(debug-features game-feature :offset-assert 136)
(secrets game-secrets :offset-assert 144)
(unknown-pad1 uint32 :offset-assert 148)
(purchase-secrets uint32 :offset-assert 152)
(unknown-pad2 uint32 :offset-assert 156)
@@ -260,9 +260,11 @@
(task-perm-list entity-perm-array :offset-assert 236)
(current-continue continue-point :offset-assert 240)
(last-continue continue-point :offset-assert 244)
(unknown-pad3 uint32 3 :offset-assert 248)
(unknown-pad3 array :offset-assert 248)
(unknown-pad4 array :offset-assert 252)
(unknown-pad5 array :offset-assert 256)
(task-counter uint32 :offset-assert 260)
(unknown-pad4 uint32 :offset-assert 264)
(unknown-pad6 uint32 :offset-assert 264)
(level-opened uint8 32 :offset-assert 268)
(total-deaths int32 :offset-assert 300)
(continue-deaths int32 :offset-assert 304)
@@ -331,8 +333,8 @@
(copy-perms-from-level! (_type_ level) none 16)
(copy-perms-to-level! (_type_ level) none 17)
(game-info-method-18 () none 18)
(game-info-method-19 () none 19)
(game-info-method-20 () none 20)
(get-current-continue-point (_type_) continue-point 19)
(get-continue-by-name (_type_ string) continue-point 20)
(set-continue! (_type_ basic) continue-point 21)
(game-info-method-22 () none 22)
(game-info-method-23 () none 23)
+20 -20
View File
@@ -160,8 +160,8 @@
;; definition for symbol *sync-dma*, type symbol
(define *sync-dma* #f)
;; definition for symbol *display-strip-lines*, type int
(define *display-strip-lines* 0)
;; definition for symbol *display-strip-lines*, type strip-lines-controls
(define *display-strip-lines* (the-as strip-lines-controls 0))
;; definition for symbol *display-battle-marks*, type symbol
(define *display-battle-marks* #f)
@@ -275,20 +275,20 @@
)
)
;; definition for symbol *display-scene-control*, type int
(define *display-scene-control* 0)
;; definition for symbol *display-scene-control*, type scene-controls
(define *display-scene-control* (the-as scene-controls 0))
;; definition for symbol *display-bot-marks*, type int
(define *display-bot-marks* 0)
;; definition for symbol *display-bot-marks*, type bot-marks-controls
(define *display-bot-marks* (the-as bot-marks-controls 0))
;; definition for symbol *display-race-marks*, type int
(define *display-race-marks* 0)
;; definition for symbol *display-race-marks*, type race-marks-controls
(define *display-race-marks* (the-as race-marks-controls 0))
;; definition for symbol *race-record-path*, type symbol
(define *race-record-path* #f)
;; definition for symbol *select-race*, type int
(define *select-race* 0)
;; definition for symbol *select-race*, type race-selection
(define *select-race* (the-as race-selection 0))
;; definition for symbol *select-race-path*, type int
(define *select-race-path* 0)
@@ -296,20 +296,20 @@
;; definition for symbol *bot-record-path*, type int
(define *bot-record-path* -1)
;; definition for symbol *subdivide-draw-mode*, type int
(define *subdivide-draw-mode* 0)
;; definition for symbol *subdivide-draw-mode*, type subdivide-setting
(define *subdivide-draw-mode* (the-as subdivide-setting 0))
;; definition for symbol *subdivide-scissor-draw-mode*, type int
(define *subdivide-scissor-draw-mode* 0)
;; definition for symbol *subdivide-scissor-draw-mode*, type subdivide-setting
(define *subdivide-scissor-draw-mode* (the-as subdivide-setting 0))
;; definition for symbol *subdivide-foreground-draw-mode*, type int
(define *subdivide-foreground-draw-mode* 0)
;; definition for symbol *subdivide-foreground-draw-mode*, type subdivide-setting
(define *subdivide-foreground-draw-mode* (the-as subdivide-setting 0))
;; definition for symbol *subdivide-ocean-draw-mode*, type int
(define *subdivide-ocean-draw-mode* 0)
;; definition for symbol *subdivide-ocean-draw-mode*, type subdivide-setting
(define *subdivide-ocean-draw-mode* (the-as subdivide-setting 0))
;; definition for symbol *ocean-height-hack*, type int
(define *ocean-height-hack* 0)
;; definition for symbol *ocean-height-hack*, type ocean-height-hack
(define *ocean-height-hack* (the-as ocean-height-hack 0))
;; definition (perm) for symbol *dproc*, type process
(define-perm *dproc* process #f)
+1 -1
View File
@@ -18,7 +18,7 @@
(ambient (pointer process) :offset-assert 56)
(video-mode symbol :offset-assert 60)
(aspect-ratio symbol :offset-assert 64)
(unknown-uint32-02 uint32 :offset 68)
(unknown-uint32-00 uint32 :offset 68)
(auto-save symbol :offset 72)
(bg-r float :offset-assert 76)
(bg-g float :offset-assert 80)
+8 -6
View File
@@ -944,7 +944,7 @@
(set! (-> s5-0 play-hints) (-> s4-0 play-hints))
(set! (-> s5-0 sound-bank-load) (-> s4-0 sound-bank-load))
(set! (-> s5-0 subtitle) (-> s4-0 subtitle))
(set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) 1)
(set! (-> s5-0 beard) (if (logtest? (-> *game-info* secrets) (game-secrets toggle-beard))
(not (-> s4-0 beard))
(-> s4-0 beard)
)
@@ -1218,8 +1218,8 @@
(set! (-> s5-0 aspect-ratio) (-> s4-0 aspect-ratio))
(set-aspect-ratio (-> s5-0 aspect-ratio))
)
(when (!= (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02))
(set! (-> s5-0 unknown-uint32-02) (-> s4-0 unknown-uint32-02))
(when (!= (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00))
(set! (-> s5-0 unknown-uint32-00) (-> s4-0 unknown-uint32-00))
(set! (-> *video-params* set-video-mode) (the-as basic #t))
)
(when (!= (-> s5-0 video-mode) (-> s4-0 video-mode))
@@ -1234,7 +1234,9 @@
(set! (-> s5-0 unknown-int32-02) (-> s4-0 unknown-int32-02))
(set! (-> *video-params* display-dy) (* (/ (-> s4-0 unknown-int32-02) 2) 2))
)
(set! (-> *blit-displays-work* horizontal-flip-flag) (the-as basic (logtest? (-> *game-info* secrets) 2)))
(set! (-> *blit-displays-work* horizontal-flip-flag)
(the-as basic (logtest? (-> *game-info* secrets) (game-secrets hflip-screen)))
)
(set! (-> s5-0 allow-blackout) (-> s4-0 allow-blackout))
(set! (-> s5-0 bg-a-speed) (-> s4-0 bg-a-speed))
(set! (-> s5-0 bg-a-force) (-> s4-0 bg-a-force))
@@ -1437,7 +1439,7 @@
(set! (-> gp-0 language) (scf-get-language))
(set! (-> gp-0 subtitle-language) (-> gp-0 language))
(set! (-> gp-0 process-mask) (process-mask execute sleep))
(set! (-> gp-0 unknown-uint32-02) (the-as uint #f))
(set! (-> gp-0 unknown-uint32-00) (the-as uint #f))
(set! (-> gp-0 unknown-int32-01) 0)
(set! (-> gp-0 unknown-int32-02) 0)
(set! (-> gp-0 vibration)
@@ -1544,7 +1546,7 @@
(set! (-> s5-0 language) (+ (-> gp-0 language) -1))
(set! (-> s5-0 subtitle-language) (-> gp-0 subtitle-language))
(set! (-> s5-0 aspect-ratio) #f)
(set! (-> s5-0 unknown-uint32-02) (the-as uint #f))
(set! (-> s5-0 unknown-uint32-00) (the-as uint #f))
(set! (-> s5-0 video-mode) #f)
(set! (-> s5-0 music) #f)
(set! (-> s5-0 extra-bank) (the-as symbol '()))
+2 -2
View File
@@ -506,8 +506,8 @@
(time-until-random mood-weather :inline :offset-assert 80)
(time-until-random-min mood-weather :inline :offset-assert 88)
(time-until-random-max mood-weather :inline :offset-assert 96)
(display-flag basic :offset-assert 104)
(overide-weather-flag basic :offset-assert 108)
(display-flag symbol :offset-assert 104)
(overide-weather-flag symbol :offset-assert 108)
(overide mood-weather :inline :offset-assert 112)
(lightning-index int32 :offset-assert 120)
(lightning-val int32 :offset-assert 124)
+1 -5
View File
@@ -879,7 +879,7 @@
(set! (-> arg0 time-until-random-max fog) 72000.0)
(set! (-> arg0 overide cloud) 0.25)
(set! (-> arg0 overide fog) 0.0)
(set! (-> arg0 overide-weather-flag) (the-as basic #t))
(set! (-> arg0 overide-weather-flag) #t)
(set! (-> arg0 display-flag) #f)
(none)
)
@@ -889,7 +889,3 @@
;; failed to figure out what this is:
(init-mood-control *mood-control*)
+25 -29
View File
@@ -137,31 +137,31 @@
;; definition of type time-of-day-context
(deftype time-of-day-context (basic)
((interp float 6 :offset-assert 4)
(current-fog mood-fog :inline :offset-assert 32)
(current-sky-color vector :inline :offset-assert 80)
(current-env-color vector :inline :offset-assert 96)
(current-prt-color vector :inline :offset-assert 112)
(current-shadow-color vector :inline :offset-assert 128)
(light-group light-group 8 :inline :offset-assert 144)
(current-clouds mood-clouds :inline :offset-assert 1680)
(times vector 8 :inline :offset-assert 1696)
(title-light-group light-group :inline :offset-assert 1824)
(filter vector :inline :offset-assert 2016)
(filter-color vector :inline :offset-assert 2032)
(time float :offset-assert 2048)
(target-interp float :offset-assert 2052)
(erase-color rgba :offset-assert 2056)
(sky symbol :offset-assert 2060)
(use-camera-other basic :offset-assert 2064)
(title-updated symbol :offset-assert 2068)
(mode uint32 :offset-assert 2072)
(overide-enable basic :offset-assert 2076)
(overide-palette uint32 :offset-assert 2080)
(max-rain float :offset-assert 2084)
(fog-mult float :offset-assert 2088)
(exterior-level basic :offset-assert 2092)
(ocean-alpha float :offset-assert 2096)
((interp float 6 :offset-assert 4)
(current-fog mood-fog :inline :offset-assert 32)
(current-sky-color vector :inline :offset-assert 80)
(current-env-color vector :inline :offset-assert 96)
(current-prt-color vector :inline :offset-assert 112)
(current-shadow-color vector :inline :offset-assert 128)
(light-group light-group 8 :inline :offset-assert 144)
(current-clouds mood-clouds :inline :offset-assert 1680)
(times vector 8 :inline :offset-assert 1696)
(title-light-group light-group :inline :offset-assert 1824)
(filter vector :inline :offset-assert 2016)
(filter-color vector :inline :offset-assert 2032)
(time float :offset-assert 2048)
(target-interp float :offset-assert 2052)
(erase-color rgba :offset-assert 2056)
(sky symbol :offset-assert 2060)
(use-camera-other basic :offset-assert 2064)
(title-updated symbol :offset-assert 2068)
(mode time-of-day-palette-id :offset-assert 2072)
(overide-enable symbol :offset-assert 2076)
(overide-palette time-of-day-palette-id :offset-assert 2080)
(max-rain float :offset-assert 2084)
(fog-mult float :offset-assert 2088)
(exterior-level basic :offset-assert 2092)
(ocean-alpha float :offset-assert 2096)
)
:method-count-assert 9
:size-assert #x834
@@ -236,7 +236,3 @@
;; failed to figure out what this is:
0
+1 -1
View File
@@ -869,7 +869,7 @@
:size-assert #x38
:flag-assert #xb00000038
(:methods
(ocean-map-method-9 () none 9)
(set-height! (_type_ float) none 9)
(ocean-map-method-10 () none 10)
)
)
+740
View File
@@ -0,0 +1,740 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *sky-work*, type sky-work
(define *sky-work*
(new 'static 'sky-work
:adgif-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x1000000000008005 #xe)
)
:draw-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x502b400000008001 #x42421)
)
:draw-tmpl2 (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431)
)
:fog-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #xa :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x902a400000008001 #x424242421)
)
:blend-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x50ab400000008001 #x43431)
)
:sprite-tmpl (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x3 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x3 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x2003400000008001 #x55)
)
:sprite-tmpl2 (new 'static 'dma-gif-packet
:dma-vif (new 'static 'dma-packet
:dma (new 'static 'dma-tag :qwc #x21 :id (dma-tag-id cnt))
:vif1 (new 'static 'vif-tag :imm #x21 :cmd (vif-cmd direct) :msk #x1)
)
:gif (new 'static 'array uint64 2 #x2003400000008010 #x55)
)
:sun-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -267.0 :y -267.0 :w 1.0)
(new 'static 'vector :x 267.0 :y 267.0)
)
:green-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -126.0 :y -126.0 :w 1.0)
(new 'static 'vector :x 126.0 :y 126.0)
)
:moon0-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -357.0 :y -357.0)
(new 'static 'vector :x 357.0 :y 357.0)
)
:moon1-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -1207.0 :y -1207.0 :w 1.0)
(new 'static 'vector :x 1207.0 :y 1207.0)
)
:moon2-coords (new 'static 'inline-array vector 2
(new 'static 'vector :x -232.0 :y -232.0)
(new 'static 'vector :x 232.0 :y 232.0)
)
:star-coords (new 'static 'inline-array vector 2 (new 'static 'vector :x -1.5 :y -1.5) (new 'static 'vector :x 1.5 :y 1.5))
:sun-colors (new 'static 'inline-array vector4w 2
(new 'static 'vector4w :x #xff :y 64 :w 64)
(new 'static 'vector4w :x #xff :y #xff :z #x80 :w 64)
)
:green-colors (new 'static 'inline-array vector4w 2
(new 'static 'vector4w :y #xc4 :w #x80)
(new 'static 'vector4w :x #xc4 :y #xff :z #xff :w #x80)
)
:moon-colors (new 'static 'inline-array vector4w 3
(new 'static 'vector4w :x 16 :y 32 :z 64 :w 96)
(new 'static 'vector4w :x 16 :y 32 :z 64 :w 64)
(new 'static 'vector4w :x 80 :y 80 :z 80 :w #x80)
)
:st-coords (new 'static 'inline-array vector 2 (new 'static 'vector :z 1.0) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0))
:random (new 'static 'inline-array vector4w 8
(new 'static 'vector4w :x #x181920 :y #x141516 :z #x101112 :w #x234567)
(new 'static 'vector4w :x #x878237 :y #x48778 :z #x489197 :w #x893830)
(new 'static 'vector4w :x #x24762 :y #x289278 :z #x724781 :w #x712983)
(new 'static 'vector4w :x #x176128 :y #x387487 :z #x780983 :w #x723176)
(new 'static 'vector4w :x #x987239 :y #x699872 :z #x987165 :w #x982397)
(new 'static 'vector4w :x #x723897 :y #x238723 :z #x987293 :w #x102981)
(new 'static 'vector4w :x #x387528 :y #x723099 :z #x140983 :w #x874310)
(new 'static 'vector4w :x #x2387 :y #x129818 :z #x219810 :w #x623790)
)
:giftag-base (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3002c00000008001 #x412))
:giftag-haze (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x3026c00000008001 #x412))
:giftag-roof (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x302ec00000008001 #x412))
:giftag-ocean (new 'static 'dma-gif :gif (new 'static 'array uint64 2 #x301ec00000008001 #x412))
:draw-vortex #f
)
)
;; definition for symbol sky-base-polygons, type (inline-array sky-vertex)
(define sky-base-polygons (new 'static 'inline-array sky-vertex 12
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y -40960000.0))
)
)
;; definition for symbol sky-roof-polygons, type (inline-array sky-vertex)
(define sky-roof-polygons (new 'static 'inline-array sky-vertex 12
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z 40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :x -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :z -40960000.0))
(new 'static 'sky-vertex :pos (new 'static 'vector :y 10240000.0))
)
)
;; definition for symbol *cloud-vert-array*, type cloud-vert-array
(define *cloud-vert-array* (new 'static 'cloud-vert-array))
;; definition for symbol *cloud-poly*, type (inline-array cloud-vertex)
(define *cloud-poly* (new 'static 'inline-array cloud-vertex 277
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
(new 'static 'cloud-vertex)
)
)
;; definition for function init-cloud-vert-array
;; INFO: Used lq/sq
(defun init-cloud-vert-array ()
(let ((gp-0 *cloud-vert-array*))
(dotimes (s5-0 10)
(dotimes (s4-0 10)
(let ((s3-0 (-> gp-0 data (+ (* 10 s5-0) s4-0))))
(set! (-> s3-0 pos x) (* 2.0 (+ -4.5 (the float s4-0))))
(set! (-> s3-0 pos z) (* 2.0 (+ -4.5 (the float s5-0))))
(set! (-> s3-0 pos y)
(fmin (cos (* 182.04445 (* 10.0 (-> s3-0 pos x)))) (cos (* 182.04445 (* 10.0 (-> s3-0 pos z)))))
)
(set-vector! (-> s3-0 stq) (* 0.25 (the float (+ s4-0 -4))) (* 0.25 (the float (+ s5-0 -4))) 1.0 1.0)
(set! (-> s3-0 nrm quad) (-> s3-0 pos quad))
(set! (-> s3-0 nrm y) (+ 1.0 (-> s3-0 nrm y)))
(vector-normalize! (-> s3-0 nrm) 1.0)
(vector-negate! (-> s3-0 nrm2) (-> s3-0 nrm))
(cond
((or (zero? s5-0) (= s5-0 9) (zero? s4-0) (= s4-0 9))
(set! (-> s3-0 col w) 0.0)
(set! (-> s3-0 col2 w) 0.0)
)
((or (= s5-0 1) (= s5-0 8) (= s4-0 1) (= s4-0 8))
(set! (-> s3-0 col w) 48.0)
(set! (-> s3-0 col2 w) 48.0)
)
(else
(set! (-> s3-0 col w) 128.0)
(set! (-> s3-0 col2 w) 128.0)
)
)
)
)
)
)
#f
)
;; failed to figure out what this is:
(init-cloud-vert-array)
;; definition for symbol *haze-vert-array*, type haze-vert-array
(define *haze-vert-array* (new 'static 'haze-vert-array))
;; definition for symbol *haze-poly*, type (inline-array haze-vertex)
(define *haze-poly* (new 'static 'inline-array haze-vertex 144
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
(new 'static 'haze-vertex)
)
)
;; definition for function init-haze-vert-array
;; INFO: Used lq/sq
(defun init-haze-vert-array ()
(let ((gp-0 *haze-vert-array*))
(dotimes (s5-0 36)
(let ((s4-0 (-> gp-0 data s5-0)))
(set! (-> s4-0 pos x) (* 9.0 (sin (* 182.04445 (* 10.0 (the float s5-0))))))
(set! (-> s4-0 pos z) (* 9.0 (cos (* 182.04445 (* 10.0 (the float s5-0))))))
(set! (-> s4-0 pos y) 0.0)
(set! (-> (the-as cloud-vertex (-> s4-0 nrm)) pos quad) (-> (the-as cloud-vertex (-> s4-0 pos)) pos quad))
(set! (-> s4-0 nrm y) (+ 1.0 (-> s4-0 nrm y)))
(vector-normalize! (-> s4-0 nrm) 1.0)
)
)
)
#f
)
;; failed to figure out what this is:
(init-haze-vert-array)
;; definition for method 9 of type sky-work
;; INFO: Return type mismatch int vs none.
(defmethod init-sun-data! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float))
"Sets the sun related upload data - the sun, halo and aurora"
(let ((v1-0 (logand arg0 1)))
(set! (-> obj upload-data sun v1-0 r-sun) arg1)
(set! (-> obj upload-data sun v1-0 r-halo) arg2)
(set! (-> obj upload-data sun v1-0 r-aurora) arg3)
)
0
(none)
)
;; definition for method 10 of type sky-work
;; INFO: Return type mismatch int vs none.
(defmethod init-orbit-settings! sky-work ((obj sky-work) (arg0 int) (arg1 float) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float))
(set! (-> obj orbit arg0 high-noon) arg1)
(set! (-> obj orbit arg0 tilt) (* 0.017453292 arg2))
(set! (-> obj orbit arg0 rise) (* 0.017453292 arg3))
(set! (-> obj orbit arg0 dist) arg4)
(set! (-> obj orbit arg0 min-halo) arg5)
(set! (-> obj orbit arg0 max-halo) arg6)
0
(none)
)
;; definition for function sky-make-sun-data
;; INFO: Return type mismatch int vs none.
(defun sky-make-sun-data ((arg0 sky-work) (arg1 int) (arg2 float))
"Initialize `upload-data` with [[sky-sun-data]] in [[*sky-work*]]"
(let* ((s4-0 (-> arg0 orbit arg1))
(s3-0 (the-as sky-sun-data (+ (the-as uint (-> arg0 upload-data)) (* arg1 64))))
(f0-1 (- arg2 (-> s4-0 high-noon)))
(f30-0 (* 2730.6667 f0-1))
(f28-0 (* (sin f30-0) (-> s4-0 dist)))
(f30-1 (cos f30-0))
)
(let* ((f24-0 (* f30-1 (-> s4-0 dist)))
(f26-0 (* f24-0 (cos-rad (-> s4-0 tilt))))
(f24-1 (* f24-0 (sin-rad (-> s4-0 tilt))))
(f22-0 (sin-rad (-> s4-0 rise)))
(f0-10 (cos-rad (-> s4-0 rise)))
)
(set! (-> s3-0 pos z) (- (+ (* f28-0 f0-10) (* f24-1 f22-0))))
(set! (-> s3-0 pos y) f26-0)
(set! (-> s3-0 pos x) (- (* f24-1 f0-10) (* f28-0 f22-0)))
)
(let ((f0-14 (if (< f30-1 0.0)
0.0
f30-1
)
)
)
(set! (-> arg0 upload-data sun arg1 r-aurora)
(+ (* (-> s4-0 min-halo) (- 1.0 f0-14)) (* (-> s4-0 max-halo) f0-14))
)
)
)
0
(none)
)
;; definition for function sky-make-moon-data
;; INFO: Return type mismatch int vs none.
(defun sky-make-moon-data ((arg0 sky-work) (arg1 float))
"Initialize `upload-data` with [[sky-moon-data]] in [[*sky-work*]]"
(let* ((s5-0 (-> arg0 orbit 2))
(gp-0 (-> arg0 upload-data moon))
(f0-1 (- arg1 (-> s5-0 high-noon)))
(f28-0 (* 2730.6667 f0-1))
(f30-0 (* (sin f28-0) (-> s5-0 dist)))
(f26-0 (* (cos f28-0) (-> s5-0 dist)))
(f28-1 (* f26-0 (cos-rad (-> s5-0 tilt))))
(f26-1 (* f26-0 (sin-rad (-> s5-0 tilt))))
(f24-0 (sin-rad (-> s5-0 rise)))
(f0-10 (cos-rad (-> s5-0 rise)))
)
(set! (-> gp-0 pos z) (- (+ (* f30-0 f0-10) (* f26-1 f24-0))))
(set! (-> gp-0 pos y) f28-1)
(set! (-> gp-0 pos x) (- (* f26-1 f0-10) (* f30-0 f24-0)))
)
0
(none)
)
;; failed to figure out what this is:
(init-sun-data! *sky-work* 0 60.0 200.0 300.0)
;; failed to figure out what this is:
(init-sun-data! *sky-work* 1 15.0 20.0 300.0)
;; failed to figure out what this is:
(init-orbit-settings! *sky-work* 0 12.5 -20.0 90.0 9950.0 300.0 300.0)
;; failed to figure out what this is:
(init-orbit-settings! *sky-work* 1 4.0 0.0 90.0 9950.0 300.0 300.0)
;; failed to figure out what this is:
(init-orbit-settings! *sky-work* 2 0.5 -40.0 90.0 9950.0 300.0 300.0)
+17 -21
View File
@@ -75,8 +75,8 @@
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'sky-sun-data)
(format #t "~1Tdata[4] @ #x~X~%" (-> obj data))
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> obj data))
(format #t "~1Tdata[4] @ #x~X~%" (-> obj pos))
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> obj pos))
(format #t "~1Tr-sun: ~f~%" (-> obj r-sun))
(format #t "~1Tr-halo: ~f~%" (-> obj r-halo))
(format #t "~1Tr-aurora: ~f~%" (-> obj r-aurora))
@@ -165,8 +165,8 @@
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'sky-upload-data)
(format #t "~1Tdata[10] @ #x~X~%" (-> obj data))
(format #t "~1Tsun[2] @ #x~X~%" (-> obj data))
(format #t "~1Tdata[10] @ #x~X~%" (-> obj sun))
(format #t "~1Tsun[2] @ #x~X~%" (-> obj sun))
(format #t "~1Tmoon: #<sky-moon-data @ #x~X>~%" (-> obj moon))
(label cfg-4)
obj
@@ -405,12 +405,12 @@
(moon1-coords vector 2 :inline :offset-assert 320)
(moon2-coords vector 2 :inline :offset-assert 352)
(star-coords vector 2 :inline :offset-assert 384)
(sun-colors vector 2 :inline :offset-assert 416)
(green-colors vector 2 :inline :offset-assert 448)
(moon-colors vector 3 :inline :offset-assert 480)
(star-colors vector 16 :inline :offset-assert 528)
(sun-colors vector4w 2 :inline :offset-assert 416)
(green-colors vector4w 2 :inline :offset-assert 448)
(moon-colors vector4w 3 :inline :offset-assert 480)
(star-colors vector4w 16 :inline :offset-assert 528)
(st-coords vector 2 :inline :offset-assert 784)
(random vector 8 :inline :offset-assert 816)
(random vector4w 8 :inline :offset-assert 816)
(giftag-base dma-gif :inline :offset-assert 944)
(giftag-haze dma-gif :inline :offset-assert 960)
(giftag-roof dma-gif :inline :offset-assert 976)
@@ -422,12 +422,12 @@
(off-t uint16 :offset-assert 1062)
(orbit sky-orbit 3 :inline :offset-assert 1064)
(upload-data sky-upload-data :inline :offset-assert 1168)
(ambi-color vector :inline :offset-assert 1328)
(ambi-color-lower vector :inline :offset-assert 1344)
(sun0-color vector :inline :offset-assert 1360)
(sun1-color vector :inline :offset-assert 1376)
(moon-color vector :inline :offset-assert 1392)
(sun0-color-lower vector :inline :offset-assert 1408)
(ambi-color vector4w :inline :offset-assert 1328)
(ambi-color-lower vector4w :inline :offset-assert 1344)
(sun0-color vector4w :inline :offset-assert 1360)
(sun1-color vector4w :inline :offset-assert 1376)
(moon-color vector4w :inline :offset-assert 1392)
(sun0-color-lower vector4w :inline :offset-assert 1408)
(cam-mat matrix :inline :offset-assert 1424)
(star-mat matrix :inline :offset-assert 1488)
(vec0 vector4w :inline :offset-assert 1552)
@@ -442,8 +442,8 @@
:size-assert #x2760
:flag-assert #x2500002760
(:methods
(sky-work-method-9 () none 9)
(sky-work-method-10 () none 10)
(init-sun-data! (_type_ int float float float) none 9)
(init-orbit-settings! (_type_ int float float float float float float) none 10)
(sky-work-method-11 () none 11)
(sky-work-method-12 () none 12)
(sky-work-method-13 () none 13)
@@ -531,7 +531,3 @@
;; failed to figure out what this is:
0
+2 -2
View File
@@ -338,7 +338,7 @@
;; definition of type texture-link
(deftype texture-link (structure)
((next shader-ptr :offset-assert 0)
((next shader-ptr 1 :offset-assert 0)
)
:method-count-assert 9
:size-assert #x4
@@ -352,7 +352,7 @@
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'texture-link)
(format #t "~1Tnext: #x~X~%" (-> obj next))
(format #t "~1Tnext: #x~X~%" (-> obj next 0))
(label cfg-4)
obj
)
+81 -83
View File
@@ -429,7 +429,7 @@
(vis-self-index int32 :offset-assert 2440)
(vis-adj-index int32 :offset-assert 2444)
(vis-buffer uint8 2048 :offset-assert 2448)
(mem-usage-block basic :offset-assert 4496)
(mem-usage-block memory-usage-block :offset-assert 4496)
(mem-usage int32 :offset-assert 4500)
(code-memory-start pointer :offset-assert 4504)
(code-memory-end pointer :offset-assert 4508)
@@ -746,9 +746,9 @@
)
(format #t "~1Tdraw-index-map[7] @ #x~X~%" (-> obj draw-index-map))
(format #t "~1Tload-order: ~D~%" (-> obj load-order))
(format #t "~1Tlevel[7] @ #x~X~%" (-> obj level))
(format #t "~1Tdata[7] @ #x~X~%" (-> obj level))
(format #t "~1Tlevel0: ~`level`P~%" (-> obj level))
(format #t "~1Tlevel[7] @ #x~X~%" (-> obj level0))
(format #t "~1Tdata[7] @ #x~X~%" (-> obj level0))
(format #t "~1Tlevel0: ~`level`P~%" (-> obj level0))
(format #t "~1Tlevel1: ~`level`P~%" (-> obj level1))
(format #t "~1Tlevel2: ~`level`P~%" (-> obj level2))
(format #t "~1Tlevel3: ~`level`P~%" (-> obj level3))
@@ -773,85 +773,83 @@
:play? #f
:sound-bank (new 'static 'array basic 4 #f #f #f #f)
:disk-load-timing? #f
:level (new 'static 'inline-array level 7
(new 'static 'level
:name #f
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
(new 'static 'level
:name #f
:index 1
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
(new 'static 'level
:name #f
:index 2
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
(new 'static 'level
:name #f
:index 3
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
(new 'static 'level
:name #f
:index 4
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
(new 'static 'level
:name #f
:index 5
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
(new 'static 'level
:name 'default
:index 6
:status 'reserved
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:bsp #f
:inside-boxes #f
:display? #f
:force-inside? #f
:linking #f
:level-type #f
)
:level0 (new 'static 'level
:name #f
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
:level1 (new 'static 'level
:name #f
:index 1
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
:level2 (new 'static 'level
:name #f
:index 2
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
:level3 (new 'static 'level
:name #f
:index 3
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
:level4 (new 'static 'level
:name #f
:index 4
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
:level5 (new 'static 'level
:name #f
:index 5
:status 'inactive
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:inside-boxes #f
:force-inside? #f
:linking #f
:level-type #f
)
:default-level (new 'static 'level
:name 'default
:index 6
:status 'reserved
:borrow-level (new 'static 'array basic 2 #f #f)
:borrow-from-level #f
:bsp #f
:inside-boxes #f
:display? #f
:force-inside? #f
:linking #f
:level-type #f
)
)
)
+4 -2
View File
@@ -464,12 +464,14 @@
;; definition for function want-to-gun?
(defbehavior want-to-gun? process ((arg0 target) (arg1 symbol))
(local-vars (v1-36 symbol))
(and (logtest? (-> arg0 game features) 32)
(and (logtest? (-> arg0 game features) (game-feature unk-game-feature-06))
(>= (- (-> self clock frame-counter) (-> arg0 gun gun-time)) (seconds 0.1))
(zero? (logand (focus-status fs1 fs6 fs18 fs21 fs22 fs30) (-> arg0 focus-status)))
(zero? (logand (surface-flag gun-inactive gun-hide gun-off) (-> arg0 control unknown-surface00 flags)))
(zero? (logand (state-flags sf18) (-> arg0 state-flags)))
(logtest? (logand (-> *setting-control* user-current features) 960) (-> arg0 game features))
(logtest? (the-as game-feature (logand (-> *setting-control* user-current features) 960))
(-> arg0 game features)
)
(or (zero? (logand (-> arg0 control unknown-surface00 flags) (surface-flag duck))) (can-exit-duck?))
(or (zero? (logand (focus-status fs20) (-> arg0 focus-status))) (-> arg0 pilot gun?))
(or arg1
+5 -8
View File
@@ -50,11 +50,11 @@
;; definition of type screen-shot-work
(deftype screen-shot-work (structure)
((count int16 :offset-assert 0)
(size int16 :offset-assert 2)
(name basic :offset-assert 4)
(highres-enable basic :offset-assert 8)
(hud-enable basic :offset-assert 12)
((count int16 :offset-assert 0)
(size int16 :offset-assert 2)
(name string :offset-assert 4)
(highres-enable symbol :offset-assert 8)
(hud-enable symbol :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
@@ -99,6 +99,3 @@
0
)
+15 -1
View File
@@ -45,7 +45,21 @@
"print-game-text",
// joint asm
"cspace<-parented-transformq-joint!", "(method 11 art-joint-anim-manager)", "make-joint-jump-tables",
// default menu
// - causes a decompiler hang
"dm-cam-setting-float",
"debug-menu-make-camera-menu", // requires the above, fine on it's own
// - delayed until game-info is better understood
"debug-menu-make-play-menu",
"debug-menu-make-task-sub-menu",
// - weird array accessing pattern, we never fixed it in jak 1
"all-texture-tweak-adjust",
"debug-menu-make-shader-menu", // requires the above, fine on it's own
// - process-spawn macro issues
"dm-scene-load-pick-func",
"popup-menu-context-make-default-menus",
"debug-menu-context-make-default-menus",
// placeholder
"i-hopefully-will-never-exist-dont-add-anything-after-me-please"
],