decomp3: loader-h, capture-h, math-camera-h, math-camera, connect, gs, texture-h (#3333)

This commit is contained in:
Hat Kid
2024-01-25 15:44:26 +01:00
committed by GitHub
parent 3a2c57c091
commit 0ea718a5ee
22 changed files with 11393 additions and 684 deletions
File diff suppressed because it is too large Load Diff
@@ -9,5 +9,6 @@
[32, "vector"],
[48, "vector"]
],
"rotate-vector-to-vector": [[16, "quaternion"]]
"rotate-vector-to-vector": [[16, "quaternion"]],
"init-for-transform": [[192, "vector"]]
}
@@ -122,5 +122,33 @@
[15, "gp", "(inline-array vector4)"]
],
"(method 9 clock)": [[47, "v1", "float"]],
"service-cpads": [[[207, 311], "s3", "pad-buttons"]]
"service-cpads": [[[207, 311], "s3", "pad-buttons"]],
"(method 3 connection-pers)": [[97, "f0", "float"]],
"(method 0 engine-pers)": [
[32, "v1", "pointer"],
[23, "v1", "pointer"],
[26, "v1", "pointer"],
[24, "v1", "(pointer pointer)"]
],
"(method 0 engine)": [
[44, "v1", "pointer"],
[47, "v1", "pointer"],
[53, "v1", "connectable"],
[65, "v1", "connectable"]
],
"(method 21 engine)": [[8, "a0", "connection"]],
"(method 20 engine)": [[8, "a0", "connection"]],
"(method 19 engine)": [[8, "a0", "connection"]],
"(method 15 engine)": [[[0, 36], "v1", "connection"]],
"(method 13 engine)": [
[[0, 25], "s4", "connection"],
[13, "t9", "(function object object object object object)"]
],
"(method 12 engine)": [
[[0, 25], "s4", "connection"],
[13, "t9", "(function object object object object object)"]
],
"(method 9 connection)": [[8, "a0", "pointer"]],
"(method 10 connection)": [[8, "a0", "pointer"]],
"(method 11 connection)": [[5, "a1", "pointer"]]
}
+712
View File
@@ -5,5 +5,717 @@
;; name in dgo: connect
;; dgos: GAME
#|@file
This extremely confusing "connection system" allows the connection between
"engines" and "processes". Basically, a process can "register" itself with any number of "engines".
The "engines" can then iterate through all the connected processes. If a process is destroyed, it will
be removed from all engines. It is okay to connect a process to multiple engines, or even to the same engine
multiple times.
Some example uses:
- a "foreground-engine" has connections to all foreground objects that need to be drawn on each frame.
- when a process wants to change a game setting, it opens a connection to the settings engine to request a change.
when the process is killed (or it stops requesting the change), the setting change is reverted.
A "connection" is really just a function that gets called when the engine runs, or a set of parameters that the engine can iterate through.
|#
(declare-type engine basic)
;; DECOMP BEGINS
(deftype connectable (structure)
"A connectable is the linked-list node part of a connection.
The connections themselves are owned by the engine.
The `next0`/`prev0` references are used for how this belongs in the connectable list
belonging to the [[engine]]. These terminate on special nodes stored in the engine:
`alive-list`/`alive-list-end` for the active connections, and `dead-list`/`dead-list-end`
for the inactive.
The `next1`/`prev1` references are used to build a linked list _per process_.
The head of this list is the inline connectable in process and it ends with `#f`.
This is a bit confusing at first, but these belong to two linked lists...
These terminate on both ends with `#f`."
((next0 connectable)
(prev0 connectable)
(next1 connectable)
(prev1 connectable)
)
)
(deftype connection (connectable)
"This is the actual data for the connection.
It may be used in multiple ways, but the most common is to use `param0` as a function.
It receives `param1`, `param2`, `param3`, and the engine as the arguments.
In some cases, the return value is checked for `'dead`."
((param0 basic)
(param1 basic)
(param2 int32)
(param3 int32)
(quad uint128 2 :overlay-at next0)
)
(:methods
(get-engine (connection) engine)
(get-process (connection) process)
(belongs-to-engine? (connection engine) symbol)
(belongs-to-process? (connection process) symbol)
(move-to-dead (connection) connection)
)
)
(deftype engine (basic)
"An engine is a collection of connections.
You can iterate over the connections, or run them.
The engine is dynamically sized based on how many connections it can store.
New for Jak 2: You can use a child class of [[connection]]."
((name symbol)
(engine-time time-frame :offset 16)
(allocated-length int16 :offset 10)
(length int16 :offset 8)
(element-type type :offset 12)
(alive-list connectable :inline)
(alive-list-end connectable :inline)
(dead-list connectable :inline)
(dead-list-end connectable :inline)
(data connection :inline :dynamic)
)
(:methods
(new (symbol type symbol int type) _type_)
(inspect-all-connections (engine) engine)
(apply-to-connections (engine (function connectable none)) int)
(apply-to-connections-reverse (engine (function connectable none)) int)
(execute-connections (engine object) int)
(execute-connections-and-move-to-dead (engine object) int)
(execute-connections-if-needed (engine object) int)
(add-connection (engine process object object object object) connection)
(remove-from-process (engine process) int)
(remove-matching (engine (function connection engine symbol)) int)
(remove-all (engine) int)
(remove-by-param0 (engine object) int)
(remove-by-param1 (engine int) int)
(remove-by-param2 (engine int) int)
(get-first-connectable (engine) connectable)
(get-last-connectable (engine) connectable)
(get-next-connectable (_type_ connectable) connectable)
(get-prev-connectable (_type_ connectable) connectable)
)
)
(defmethod belongs-to-process? ((this connection) (arg0 process))
"Does this connection belong to the given process?"
(= arg0 (get-process this))
)
(defmethod print ((this connection))
(format
#t
"#<connection (~A ~A ~A ~A) @ #x~X>"
(-> this param0)
(-> this param1)
(-> this param2)
(-> this param3)
this
)
this
)
;; WARN: Return type mismatch pointer vs engine.
(defmethod get-engine ((this connection))
"Get the engine for this connection. This must be used on a live connection."
(while (-> (the-as connectable this) prev0)
(nop!)
(nop!)
(set! this (the-as connection (-> (the-as connectable this) prev0)))
)
(the-as engine (&+ (the-as pointer this) -28))
)
;; WARN: Return type mismatch pointer vs process.
(defmethod get-process ((this connection))
"Get the process for this connection."
(while (-> (the-as connectable this) prev1)
(nop!)
(nop!)
(set! this (the-as connection (-> (the-as connectable this) prev1)))
)
(the-as process (&+ (the-as pointer this) -108))
)
(defmethod belongs-to-engine? ((this connection) (arg0 engine))
"Check to see if this connection is located in the data section of the engine.
This works on dead or alive connections."
(and (< (the-as int arg0) (the-as int this))
(< (the-as int this) (the-as int (&+
(&+ (the-as pointer arg0) (-> arg0 type size))
(* (-> arg0 allocated-length) (the-as int (-> arg0 element-type size)))
)
)
)
)
)
(defmethod get-first-connectable ((this engine))
(-> this alive-list next0)
)
(defmethod get-last-connectable ((this engine))
(-> this alive-list-end)
)
(defmethod get-next-connectable ((this engine) (arg0 connectable))
(-> arg0 next0)
)
(defmethod get-prev-connectable ((this engine) (arg0 connectable))
(-> arg0 prev0)
)
(defmethod new engine ((allocation symbol) (type-to-make type) (arg0 symbol) (arg1 int) (arg2 type))
(let ((v0-0
(object-new
allocation
type-to-make
(the-as int (+ (-> type-to-make size) (* (the-as uint arg1) (-> arg2 size))))
)
)
)
(set! (-> v0-0 allocated-length) arg1)
(set! (-> v0-0 length) 0)
(set! (-> v0-0 name) arg0)
(set! (-> v0-0 element-type) arg2)
(set! (-> v0-0 alive-list next0) (-> v0-0 alive-list-end))
(set! (-> v0-0 alive-list prev0) #f)
(set! (-> v0-0 alive-list next1) #f)
(set! (-> v0-0 alive-list prev1) #f)
(set! (-> v0-0 alive-list-end next0) #f)
(set! (-> v0-0 alive-list-end prev0) (-> v0-0 alive-list))
(set! (-> v0-0 alive-list-end next1) #f)
(set! (-> v0-0 alive-list-end prev1) #f)
(set! (-> v0-0 dead-list next0) (the-as connectable (-> v0-0 data)))
(set! (-> v0-0 dead-list prev0) #f)
(set! (-> v0-0 dead-list next1) #f)
(set! (-> v0-0 dead-list prev1) #f)
(set! (-> v0-0 dead-list-end next0) #f)
(set! (-> v0-0 dead-list-end prev0)
(the-as connectable (+ (+ (* (the-as uint (+ arg1 -1)) (-> arg2 size)) 92) (the-as uint v0-0)))
)
(set! (-> v0-0 dead-list-end next1) #f)
(set! (-> v0-0 dead-list-end prev1) #f)
(let ((v1-9 (the-as object (-> v0-0 data))))
(set! (-> v0-0 data 0 prev0) (-> v0-0 dead-list))
(set! (-> v0-0 data 0 next0) (the-as connectable (&+ (the-as pointer v1-9) (-> arg2 size))))
(let ((v1-10 (the-as object (&+ (the-as pointer v1-9) (-> arg2 size)))))
(let ((a0-6 1)
(a1-3 (+ arg1 -2))
)
(while (>= a1-3 a0-6)
(set! (-> (the-as connectable v1-10) prev0)
(the-as connectable (&- (the-as pointer v1-10) (the-as uint (-> arg2 size))))
)
;; og:preserve-this cast changed to (pointer pointer)
(set! (-> (the-as (pointer pointer) v1-10)) (&+ (the-as pointer v1-10) (-> arg2 size)))
(set! v1-10 (&+ (the-as pointer v1-10) (-> arg2 size)))
(+! a0-6 1)
)
)
(set! (-> (the-as connectable v1-10) prev0)
(the-as connectable (&- (the-as pointer v1-10) (the-as uint (-> arg2 size))))
)
;; og:preserve-this cast changed to (pointer collectable)
(set! (-> (the-as (pointer connectable) v1-10)) (-> v0-0 dead-list-end))
)
)
v0-0
)
)
(defmethod print ((this engine))
(format #t "#<~A ~A @ #x~X>" (-> this type) (-> this name) this)
this
)
(defmethod length ((this engine))
(-> this length)
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this engine))
(the-as int (+ (-> this type size) (* (-> this allocated-length) (the-as int (-> this element-type size)))))
)
(defmethod apply-to-connections ((this engine) (arg0 (function connectable none)))
"Apply arg0 to all connections for the engine.
It's okay to have arg0 remove the connection."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(arg0 a0-1)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
(defmethod apply-to-connections-reverse ((this engine) (arg0 (function connectable none)))
"Apply arg0 to all connections, reverse order.
Do not use arg0 to remove yourself from the list."
(let ((s4-0 (-> this alive-list-end prev0)))
(while (!= s4-0 (-> this alive-list))
(arg0 s4-0)
(set! s4-0 (-> s4-0 prev0))
)
)
0
)
(defmethod execute-connections ((this engine) (arg0 object))
"Run the engine!"
(set! (-> this engine-time) (-> *display* real-clock frame-counter))
(let ((s4-0 (the-as connection (-> this alive-list-end prev0))))
(while (!= s4-0 (-> this alive-list))
((the-as (function object object object object object) (-> s4-0 param0))
(-> s4-0 param1)
(-> s4-0 param2)
(-> s4-0 param3)
arg0
)
(set! s4-0 (the-as connection (-> s4-0 prev0)))
)
)
0
)
(defmethod execute-connections-and-move-to-dead ((this engine) (arg0 object))
"Run the engine! If any objects return `'dead`, remove them."
(set! (-> this engine-time) (-> *display* real-clock frame-counter))
(let ((s4-0 (the-as connection (-> this alive-list-end prev0))))
(while (!= s4-0 (-> this alive-list))
(let ((v1-3 ((the-as (function object object object object object) (-> s4-0 param0))
(-> s4-0 param1)
(-> s4-0 param2)
(-> s4-0 param3)
arg0
)
)
)
(set! s4-0 (the-as connection (-> s4-0 prev0)))
(if (= v1-3 'dead)
((method-of-type connection move-to-dead) (the-as connection (-> s4-0 next0)))
)
)
)
)
0
)
(defmethod execute-connections-if-needed ((this engine) (arg0 object))
"Execute connections, but only if it hasn't been done on this frame."
(if (!= (-> *display* real-clock frame-counter) (-> this engine-time))
(execute-connections this arg0)
)
0
)
(defun connection-process-apply ((arg0 process) (arg1 (function object none)))
"Apply a function to all connectables of a process."
(when arg0
(let ((s5-0 (-> arg0 connection-list next1)))
(while s5-0
(arg1 s5-0)
(set! s5-0 (-> s5-0 next1))
)
)
#f
)
)
(defmethod inspect-all-connections ((this engine))
"inspect all of the connections."
(let ((gp-0 *kernel-symbol-warnings*))
(set! *kernel-symbol-warnings* #f)
(let* ((s4-0 (-> this alive-list next0))
(s3-0 (-> s4-0 next0))
)
(while (!= s4-0 (-> this alive-list-end))
(format
#t
"from process ~A:~%~`connection`I"
((method-of-type connection get-process) (the-as connection s4-0))
s4-0
)
(set! s4-0 s3-0)
(set! s3-0 (-> s3-0 next0))
)
)
(set! *kernel-symbol-warnings* gp-0)
)
this
)
(defmethod add-connection ((this engine) (arg0 process) (arg1 object) (arg2 object) (arg3 object) (arg4 object))
"Add a connection between this engine and a given process."
(let ((v1-0 (the-as connection (-> this dead-list next0))))
(when (not (or (not arg0) (= v1-0 (-> this dead-list-end))))
(set! (-> v1-0 param0) (the-as basic arg1))
(set! (-> v1-0 param1) (the-as basic arg2))
(set! (-> v1-0 param2) (the-as int arg3))
(set! (-> v1-0 param3) (the-as int arg4))
(set! (-> this dead-list next0) (-> v1-0 next0))
(set! (-> v1-0 next0 prev0) (-> this dead-list))
(set! (-> v1-0 next0) (-> this alive-list next0))
(set! (-> v1-0 next0 prev0) v1-0)
(set! (-> v1-0 prev0) (-> this alive-list))
(set! (-> this alive-list next0) v1-0)
(set! (-> v1-0 next1) (-> arg0 connection-list next1))
(if (-> v1-0 next1)
(set! (-> v1-0 next1 prev1) v1-0)
)
(set! (-> v1-0 prev1) (-> arg0 connection-list))
(set! (-> arg0 connection-list next1) v1-0)
(+! (-> this length) 1)
v1-0
)
)
)
(defmethod move-to-dead ((this connection))
"Move this connection from the alive list to the dead list."
(let ((v1-1 (get-engine this)))
(set! (-> this prev0 next0) (-> this next0))
(set! (-> this next0 prev0) (-> this prev0))
(set! (-> this prev1 next1) (-> this next1))
(if (-> this next1)
(set! (-> this next1 prev1) (-> this prev1))
)
(set! (-> this next0) (-> v1-1 dead-list next0))
(set! (-> this next0 prev0) this)
(set! (-> this prev0) (-> v1-1 dead-list))
(set! (-> v1-1 dead-list next0) this)
(+! (-> v1-1 length) -1)
)
this
)
(defun process-disconnect ((arg0 process))
"Disconnect all connections for the given process."
(when arg0
(let ((gp-0 (-> arg0 connection-list next1)))
(while gp-0
((method-of-type connection move-to-dead) (the-as connection gp-0))
(set! gp-0 (-> gp-0 next1))
)
)
)
0
)
(defmethod remove-from-process ((this engine) (arg0 process))
"Remove all connections from process for this engine."
(when arg0
(let ((s5-0 (-> arg0 connection-list next1)))
(while s5-0
(if ((method-of-type connection belongs-to-engine?) (the-as connection s5-0) this)
((method-of-type connection move-to-dead) (the-as connection s5-0))
)
(set! s5-0 (-> s5-0 next1))
)
)
)
0
)
(defmethod remove-matching ((this engine) (arg0 (function connection engine symbol)))
"Call the given function on each connection and the engine.
If it returns truthy, `move-to-dead` that connection."
(let* ((s4-0 (-> this alive-list next0))
(s3-0 (-> s4-0 next0))
)
(while (!= s4-0 (-> this alive-list-end))
(if (arg0 (the-as connection s4-0) this)
((method-of-type connection move-to-dead) (the-as connection s4-0))
)
(set! s4-0 s3-0)
(set! s3-0 (-> s3-0 next0))
)
)
0
)
(defmethod remove-all ((this engine))
"Remove all connections from an engine."
(let* ((a0-1 (-> this alive-list next0))
(s5-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
((method-of-type connection move-to-dead) (the-as connection a0-1))
(set! a0-1 s5-0)
(set! s5-0 (-> s5-0 next0))
)
)
0
)
(defmethod remove-by-param0 ((this engine) (arg0 object))
"Remove all connections with param0 matching arg0."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(if (= (-> (the-as connection a0-1) param0) arg0)
((method-of-type connection move-to-dead) (the-as connection a0-1))
)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
(defmethod remove-by-param1 ((this engine) (arg0 int))
"Remove all connections with param1 matching arg0."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(if (= (-> (the-as connection a0-1) param1) arg0)
((method-of-type connection move-to-dead) (the-as connection a0-1))
)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
(defmethod remove-by-param2 ((this engine) (arg0 int))
"Remove all connections with param2 matching arg0."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(if (= (-> (the-as connection a0-1) param2) arg0)
((method-of-type connection move-to-dead) (the-as connection a0-1))
)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
(deftype connection-pers (structure)
"This is another engine system, very similar to the first, but not specific to a process.
Each connection has a `key`, which is like the process, but unlike normal engine,
the key's don't track which engine-pers they belong to.
Unlike [[engine]], users can use [[engine-pers]] as a parent class."
((next connection-pers)
(key object)
(update-time time-frame)
(param object 4)
(param-int32 int32 4 :overlay-at (-> param 0))
(param-int64 int64 2 :overlay-at (-> param 0))
(param-float float 4 :overlay-at (-> param 0))
(param-quat uint128 :overlay-at (-> param 0))
)
)
(deftype engine-pers (basic)
((name symbol)
(length int16)
(allocated-length int16)
(element-type type)
(execute-time time-frame)
(alive-list connection-pers)
(dead-list connection-pers)
(data connection-pers :inline :dynamic)
)
(:methods
(new (symbol type symbol int type) _type_)
(schedule-callback (_type_ object time-frame) connection-pers)
(kill-callback (_type_ connection-pers) none)
(kill-by-key (_type_ object) none)
(kill-matching (_type_ (function engine-pers connection-pers object object symbol) object object) none)
(update-callback (_type_) none)
(run-pending-updates! (_type_ time-frame) none)
)
)
(defmethod new engine-pers ((allocation symbol) (type-to-make type) (arg0 symbol) (arg1 int) (arg2 type))
(let ((v0-0 (object-new
allocation
type-to-make
(the-as int (+ (-> type-to-make size) (* (the-as uint arg1) (-> arg2 size))))
)
)
)
(set! (-> v0-0 allocated-length) arg1)
(set! (-> v0-0 length) 0)
(set! (-> v0-0 name) arg0)
(set! (-> v0-0 element-type) arg2)
(set! (-> v0-0 alive-list) #f)
(set! (-> v0-0 dead-list) (the-as connection-pers (-> v0-0 data)))
(let ((v1-3 (the-as object (-> v0-0 data))))
(dotimes (a0-1 arg1)
(set! (-> (the-as (pointer uint32) v1-3) 0) (the-as uint (&+ (the-as pointer v1-3) (-> arg2 size))))
(set! v1-3 (&+ (the-as pointer v1-3) (-> arg2 size)))
)
(set! (-> (the-as (pointer symbol) (&- (the-as pointer v1-3) (the-as uint (-> arg2 size))))) #f)
)
v0-0
)
)
(defmethod length ((this engine-pers))
(-> this length)
)
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this engine-pers))
(the-as int (+ (-> this type size) (* (-> this allocated-length) (the-as int (-> this element-type size)))))
)
(defmethod schedule-callback ((this engine-pers) (arg0 object) (arg1 time-frame))
"Get a connection for this key.
If no connection exists, add it.
Schedule an update to happen in arg1 seconds."
(local-vars (v0-0 connection-pers))
(let ((v1-0 (-> this alive-list)))
(while v1-0
(when (= arg0 (-> v1-0 key))
(set! v0-0 v1-0)
(goto cfg-8)
)
(set! v1-0 (-> v1-0 next))
)
)
(set! v0-0 (-> this dead-list))
(when v0-0
(set! (-> this dead-list) (-> v0-0 next))
(set! (-> v0-0 next) (-> this alive-list))
(set! (-> this alive-list) v0-0)
(+! (-> this length) 1)
(set! (-> v0-0 key) arg0)
(set! (-> v0-0 param-quat) (the-as uint128 0))
0
)
(label cfg-8)
(if v0-0
(set! (-> v0-0 update-time) (+ (-> this execute-time) arg1))
)
v0-0
)
(defmethod kill-callback ((this engine-pers) (arg0 connection-pers))
"Called when a connection is removed."
0
(none)
)
(defmethod update-callback ((this engine-pers))
"Called when a connection is run.
Users can override this as needed."
0
(none)
)
(defmethod kill-by-key ((this engine-pers) (arg0 object))
"Remove connections with this key, calling `kill-callback`."
(let ((s4-0 (&-> this alive-list))
(s2-0 (-> this alive-list))
)
(while s2-0
(let ((s3-0 (-> s2-0 next)))
(cond
((!= arg0 (-> s2-0 key))
(set! s4-0 (&-> s2-0 next))
)
(else
(kill-callback this s2-0)
(set! (-> s4-0 0) (-> s2-0 next))
(set! (-> s2-0 next) (-> this dead-list))
(set! (-> this dead-list) s2-0)
(+! (-> this length) -1)
)
)
(set! s2-0 s3-0)
)
)
)
0
(none)
)
(defmethod kill-matching ((this engine-pers)
(arg0 (function engine-pers connection-pers object object symbol))
(arg1 object)
(arg2 object)
)
"Call the given function on each connection. If it returns truthy, kill that connection."
(let ((s2-0 (&-> this alive-list))
(s0-0 (-> this alive-list))
)
(while s0-0
(let ((s1-0 (-> s0-0 next)))
(cond
((not (arg0 this s0-0 arg1 arg2))
(set! s2-0 (&-> s0-0 next))
)
(else
(kill-callback this s0-0)
(set! (-> s2-0 0) (-> s0-0 next))
(set! (-> s0-0 next) (-> this dead-list))
(set! (-> this dead-list) s0-0)
(+! (-> this length) -1)
)
)
(set! s0-0 s1-0)
)
)
)
0
(none)
)
(defmethod run-pending-updates! ((this engine-pers) (arg0 time-frame))
"Run updates if they scheduled. If something is found that has no pending update, kill it.
Note that we won't kill things on this call if they fail to update their `update-time`.
They will survive until the next call to `run-pending-updates`!
(or you can modify their `update-time` before that to prevent them from being killed.)"
(let ((s4-0 (-> this execute-time))
(s2-0 (&-> this alive-list))
(s1-0 (-> this alive-list))
)
(while s1-0
(let ((s3-0 (-> s1-0 next)))
(cond
((>= (-> s1-0 update-time) s4-0)
(update-callback this)
(set! s2-0 (&-> s1-0 next))
)
(else
(kill-callback this s1-0)
(set! (-> s2-0 0) (-> s1-0 next))
(set! (-> s1-0 next) (-> this dead-list))
(set! (-> this dead-list) s1-0)
(+! (-> this length) -1)
)
)
(set! s1-0 s3-0)
)
)
)
(set! (-> this execute-time) arg0)
0
(none)
)
@@ -43,34 +43,6 @@
)
;; ---task-manager-mask
;; +++task-mask
(defenum task-mask
:type uint32
:bitfield #t
(task0 0)
(task1 1)
(task2 2)
(task3 3)
(task4 4)
(task5 5)
(task6 6)
(task7 7)
(done 8)
(dummy0 9)
(dummy1 10)
(vehicle 11)
(special 12)
(primary0 13)
(ctywide 14)
(never 15)
(movie0 16)
(movie1 17)
(movie2 18)
)
;; ---task-mask
;; DECOMP BEGINS
(defun-debug game-task->string ((task game-task))
+973
View File
@@ -5,5 +5,978 @@
;; name in dgo: gs
;; dgos: GAME
;; +++gs-psm
(defenum gs-psm
:bitfield #f
:type uint8
(ct32 0)
(ct24 1)
(ct16 2)
(ct16s 10)
(mt8 19)
(mt4 20)
(mt8h 27)
(mt4hl 36)
(mt4hh 44)
(mz32 48)
(mz24 49)
(mz16 50)
(mz16s 58)
)
;; ---gs-psm
;; +++gs-reg
(defenum gs-reg
:type uint8
(prim 0)
(rgbaq 1)
(st 2)
(uv 3)
(xyzf2 4)
(xyz2 5)
(tex0-1 6)
(tex0-2 7)
(clamp-1 8)
(clamp-2 9)
(fog 10)
(xyzf3 12)
(xyz3 13)
(tex1-1 20)
(tex1-2 21)
(tex2-1 22)
(tex2-2 23)
(xyoffset-1 24)
(xyoffset-2 25)
(prmodecont 26)
(prmode 27)
(texclut 28)
(scanmsk 34)
(miptbp1-1 52)
(miptbp1-2 53)
(miptbp2-1 54)
(miptbp2-2 55)
(texa 59)
(fogcol 61)
(texflush 63)
(scissor-1 64)
(scissor-2 65)
(alpha-1 66)
(alpha-2 67)
(dimx 68)
(dthe 69)
(colclamp 70)
(test-1 71)
(test-2 72)
(pabe 73)
(fba-1 74)
(fba-2 75)
(frame-1 76)
(frame-2 77)
(zbuf-1 78)
(zbuf-2 79)
(bitbltbuf 80)
(trxpos 81)
(trxreg 82)
(trxdir 83)
(hwreg 84)
(signal 96)
(finish 97)
(label 98)
(hack 127)
)
;; ---gs-reg
;; +++gs-reg64
(defenum gs-reg64
:type uint64
:copy-entries gs-reg
)
;; ---gs-reg64
;; +++gs-reg32
(defenum gs-reg32
:type uint32
:copy-entries gs-reg
)
;; ---gs-reg32
;; +++gs-prim-type
(defenum gs-prim-type
:type uint8
(point 0)
(line 1)
(line-strip 2)
(tri 3)
(tri-strip 4)
(tri-fan 5)
(sprite 6)
)
;; ---gs-prim-type
;; +++gs-atest
(defenum gs-atest
:type uint8
(never 0)
(always 1)
(less 2)
(less-equal 3)
(equal 4)
(greater-equal 5)
(greater 6)
(not-equal 7)
)
;; ---gs-atest
;; +++gs-ztest
(defenum gs-ztest
:type uint8
(never 0)
(always 1)
(greater-equal 2)
(greater 3)
)
;; ---gs-ztest
;; +++gs-tex-wrap-mode
(defenum gs-tex-wrap-mode
:type uint8
(repeat 0)
(clamp 1)
(region-clamp 2)
(region-repeat 3)
)
;; ---gs-tex-wrap-mode
;; +++gif-flag
(defenum gif-flag
:type uint8
(packed 0)
(reg-list 1)
(image 2)
(disable 3)
)
;; ---gif-flag
;; +++gif-reg-id
(defenum gif-reg-id
:type uint8
(prim 0)
(rgbaq 1)
(st 2)
(uv 3)
(xyzf2 4)
(xyz2 5)
(tex0-1 6)
(tex0-2 7)
(clamp-1 8)
(clamp-2 9)
(fog 10)
(xyzf3 12)
(xyz3 13)
(a+d 14)
(nop 15)
)
;; ---gif-reg-id
(defconstant GIF_REGS_ALL_AD
(new 'static 'gif-tag-regs
:regs0 (gif-reg-id a+d)
:regs1 (gif-reg-id a+d)
:regs2 (gif-reg-id a+d)
:regs3 (gif-reg-id a+d)
:regs4 (gif-reg-id a+d)
:regs5 (gif-reg-id a+d)
:regs6 (gif-reg-id a+d)
:regs7 (gif-reg-id a+d)
:regs8 (gif-reg-id a+d)
:regs9 (gif-reg-id a+d)
:regs10 (gif-reg-id a+d)
:regs11 (gif-reg-id a+d)
:regs12 (gif-reg-id a+d)
:regs13 (gif-reg-id a+d)
:regs14 (gif-reg-id a+d)
:regs15 (gif-reg-id a+d)
)
)
;; DECOMP BEGINS
(deftype gs-pmode (uint64)
((en1 uint8 :offset 0 :size 1)
(en2 uint8 :offset 1 :size 1)
(crtmd uint8 :offset 2 :size 3)
(mmod uint8 :offset 5 :size 1)
(amod uint8 :offset 6 :size 1)
(slbg uint8 :offset 7 :size 1)
(alp uint8 :offset 8 :size 8)
)
)
(deftype gs-smode2 (uint64)
((int uint8 :offset 0 :size 1)
(ffmd uint8 :offset 1 :size 1)
(dpms uint8 :offset 2 :size 2)
)
)
(defun psm-size ((arg0 gs-psm))
"Convert texture format to some type of size."
(cond
((= arg0 (gs-psm mt8))
64
)
((= arg0 (gs-psm mt4))
32
)
((or (= arg0 (gs-psm ct16)) (= arg0 (gs-psm ct16s)) (= arg0 (gs-psm mz16)) (= arg0 (gs-psm mz16s)))
128
)
(else
256
)
)
)
(defun psm-page-height ((arg0 gs-psm))
"Convert texture format to some type of page height."
(cond
((= arg0 (gs-psm mt8))
64
)
((= arg0 (gs-psm mt4))
128
)
((or (= arg0 (gs-psm ct16)) (= arg0 (gs-psm ct16s)) (= arg0 (gs-psm mz16)) (= arg0 (gs-psm mz16s)))
64
)
(else
32
)
)
)
(defun psm->string ((arg0 gs-psm))
"Get the name of a texture format."
(case arg0
(((gs-psm ct24))
"ct24"
)
(((gs-psm mt4))
"mt4"
)
(((gs-psm ct32))
"ct32"
)
(((gs-psm mz16s))
"mz16s"
)
(((gs-psm ct16s))
"ct16s"
)
(((gs-psm mt8))
"mt8"
)
(((gs-psm mt8h))
"mt8h"
)
(((gs-psm mz16))
"mz16"
)
(((gs-psm mz24))
"mz24"
)
(((gs-psm mt4hh))
"mt4hh"
)
(((gs-psm ct16))
"ct16"
)
(((gs-psm mt4hl))
"mt4hl"
)
(((gs-psm mz32))
"mz32"
)
(else
"*unknown*"
)
)
)
(deftype gs-display-fb (uint64)
((fbp uint16 :offset 0 :size 9)
(fbw uint8 :offset 9 :size 6)
(psm gs-psm :offset 15 :size 5)
(dbx uint16 :offset 32 :size 11)
(dby uint16 :offset 43 :size 11)
)
)
(deftype gs-display (uint64)
"the GS's DISPLAY registers make settings for the display position on the screen regarding
information on Rectangular Area Read Output Circuit n for the PCRTC.
write-only"
((dx uint16 :offset 0 :size 12)
(dy uint16 :offset 12 :size 11)
(magh uint8 :offset 23 :size 4)
(magv uint8 :offset 27 :size 2)
(dw uint16 :offset 32 :size 12)
(dh uint16 :offset 44 :size 11)
)
)
(deftype gs-bgcolor (uint64)
"The GS's BGCOLOR register sets the background color of the PCRTC with RGB value.
write-only"
((r uint8 :offset 0 :size 8)
(g uint8 :offset 8 :size 8)
(b uint8 :offset 16 :size 8)
)
)
(deftype gs-csr (uint64)
"The GS's CSR register sets and obtains various GS statuses.
read-write. The fields have different effects depending on whether they're being read from
or written to.
Bits 5 and 6 (0x20 and 0x40) should be zero."
((signal uint8 :offset 0 :size 1)
(finish uint8 :offset 1 :size 1)
(hsint uint8 :offset 2 :size 1)
(vsint uint8 :offset 3 :size 1)
(edwint uint8 :offset 4 :size 1)
(flush uint8 :offset 8 :size 1)
(reset uint8 :offset 9 :size 1)
(nfield uint8 :offset 12 :size 1)
(field uint8 :offset 13 :size 1)
(fifo uint8 :offset 14 :size 2)
(rev uint8 :offset 16 :size 8)
(id uint8 :offset 24 :size 8)
)
)
(deftype gs-bank (structure)
"Memory layout of the GS's privileged registers (mapped to EE memory).
It is missing the SIGLBLID/LABELID register at 4224 (useless anyway?)"
((pmode gs-pmode)
(smode2 gs-smode2 :offset 32)
(dspfb1 gs-display-fb :offset 112)
(display1 gs-display :offset 128)
(dspfb2 gs-display-fb :offset 144)
(display2 gs-display :offset 160)
(extbuf uint64 :offset 176)
(extdata uint64 :offset 192)
(extwrite uint64 :offset 208)
(bgcolor gs-bgcolor :offset 224)
(csr gs-csr :offset 4096)
(imr uint64 :offset 4112)
(busdir uint64 :offset 4160)
)
)
(deftype gs-frame (uint64)
((fbp uint16 :offset 0 :size 9)
(fbw uint8 :offset 16 :size 6)
(psm gs-psm :offset 24 :size 6)
(fbmsk uint32 :offset 32 :size 32)
)
)
(deftype gs-zbuf (uint64)
"The GS's ZBUF registers make various settings regarding Z buffer."
((zbp uint16 :offset 0 :size 9)
(psm gs-psm :offset 24 :size 4)
(zmsk uint8 :offset 32 :size 1)
)
)
(deftype gs-xy-offset (uint64)
"The GS's XYOFFSET registers set the offset value for converting from the primitive coordinate
system to the window coordinate system."
((ofx uint16 :offset 0 :size 16)
(ofy uint16 :offset 32 :size 16)
)
)
(deftype gs-scissor (uint64)
"The GS's SCISSOR registers specify the scissoring area. The coordinate values for
the upper-left/lower-right points of the enabled drawing area are specified by the window
coordinate system."
((scax0 uint16 :offset 0 :size 11)
(scax1 uint16 :offset 16 :size 11)
(scay0 uint16 :offset 32 :size 11)
(scay1 uint16 :offset 48 :size 11)
)
)
(deftype gs-prmode-cont (uint64)
"The GS's PRMODECONT register sets whether to use primitive attributes (IIP, TME, FGE, ABE,
AA1, FST, CTXT, FIX) specified by the PRMODE register or the PRIM register."
((ac uint8 :offset 0 :size 1)
)
)
(deftype gs-color-clamp (uint64)
"The GS's COLCLAMP register stores settings as to whether clamping for the RGB value of the
pixel is performed."
((clamp uint8 :offset 0 :size 1)
)
)
(deftype gs-dthe (uint64)
"The GS's DTHE register stores settings for dithering (performed/not performed)."
((dthe uint8 :offset 0 :size 1)
)
)
(deftype gs-test (uint64)
"The GS's TEST register performs settings related to the pixel test."
((ate uint8 :offset 0 :size 1)
(atst gs-atest :offset 1 :size 3)
(aref uint8 :offset 4 :size 8)
(afail uint8 :offset 12 :size 2)
(date uint8 :offset 14 :size 1)
(datm uint8 :offset 15 :size 1)
(zte uint8 :offset 16 :size 1)
(ztst gs-ztest :offset 17 :size 2)
)
)
(deftype gs-prim (uint64)
((prim gs-prim-type :offset 0 :size 3)
(iip uint8 :offset 3 :size 1)
(tme uint8 :offset 4 :size 1)
(fge uint8 :offset 5 :size 1)
(abe uint8 :offset 6 :size 1)
(aa1 uint8 :offset 7 :size 1)
(fst uint8 :offset 8 :size 1)
(ctxt uint8 :offset 9 :size 1)
(fix uint8 :offset 10 :size 1)
)
)
(deftype gs-rgbaq (uint64)
"The GS's RGBAQ register sets the RGBA value of the vertex and the Q value of the normalized
texture coordinates."
((r uint8 :offset 0 :size 8)
(g uint8 :offset 8 :size 8)
(b uint8 :offset 16 :size 8)
(a uint8 :offset 24 :size 8)
(q float :offset 32 :size 32)
)
)
(deftype gs-xyz (uint64)
((x uint16 :offset 0 :size 16)
(y uint16 :offset 16 :size 16)
(z uint32 :offset 32 :size 32)
)
)
(deftype gs-uv (uint64)
"The GS's UV register specifies the texel coordinate (UV) values of the vertex."
((u uint16 :offset 0 :size 16)
(v uint16 :offset 16 :size 16)
)
)
(deftype gs-st (uint64)
"The GS's ST register sets the S and T values of the vertex texture coordinates.
The value Q is specified by the RGBAQ register."
((s float :offset 0 :size 32)
(t float :offset 32 :size 32)
)
)
(deftype gs-xyzf (uint64)
((x uint16 :offset 0 :size 16)
(y uint16 :offset 16 :size 16)
(z uint32 :offset 32 :size 24)
(f uint8 :offset 56 :size 8)
)
)
(deftype gs-adcmd (structure)
((word uint32 4)
(quad uint128 :overlay-at (-> word 0))
(data uint64 :overlay-at (-> word 0))
(cmds gs-reg64 :overlay-at (-> word 2))
(cmd uint8 :overlay-at (-> word 2))
(x uint32 :overlay-at (-> word 0))
(y uint32 :overlay-at (-> word 1))
(z uint32 :overlay-at (-> word 2))
(w uint32 :overlay-at (-> word 3))
)
)
(deftype gs-trxpos (uint64)
"The GS's TRXPOS register specifies the position and
scanning direction of the rectangular area
in each buffer where buffer transmission is performed."
((ssax uint16 :offset 0 :size 11)
(ssay uint16 :offset 16 :size 11)
(dsax uint16 :offset 32 :size 11)
(dsay uint16 :offset 48 :size 11)
(dir uint8 :offset 59 :size 2)
)
)
(deftype gs-trxreg (uint64)
"The GS's TRXREG register specifies the size of the rectangular area, where the transmission
between buffers is implemented, in units of pixels.
The pixel mode must be the one set by the BITBLTBUF register."
((rrw uint16 :offset 0 :size 12)
(rrh uint16 :offset 32 :size 12)
)
)
(deftype gs-trxdir (uint64)
"The GS's TRXDIR register specifies the transmission direction in the transmission between
buffers, and activates transmission.
Appropriate settings must be made by the BITBLTBUF/TRXPOS/TRXREG before activating
the transmission."
((xdir uint8 :offset 0 :size 2)
)
)
(deftype gs-bitbltbuf (uint64)
"The GS's BITBLTBUF register stores buffer-related settings for transmission source and
destination during transmission between buffers."
((sbp uint16 :offset 0 :size 14)
(sbw uint8 :offset 16 :size 6)
(spsm uint8 :offset 24 :size 6)
(dbp uint16 :offset 32 :size 14)
(dbw uint8 :offset 48 :size 6)
(dpsm gs-psm :offset 56 :size 6)
)
)
(deftype gs-tex0 (uint64)
"The GS's TEX0 registers set various kinds of information regarding the textures to be used."
((tbp0 uint16 :offset 0 :size 14)
(tbw uint8 :offset 14 :size 6)
(psm uint8 :offset 20 :size 6)
(tw uint8 :offset 26 :size 4)
(th uint8 :offset 30 :size 4)
(tcc uint8 :offset 34 :size 1)
(tfx uint8 :offset 35 :size 2)
(cbp uint16 :offset 37 :size 14)
(cpsm uint8 :offset 51 :size 4)
(csm uint8 :offset 55 :size 1)
(csa uint8 :offset 56 :size 5)
(cld uint8 :offset 61 :size 3)
)
)
(deftype gs-tex1 (uint64)
"The GS's TEX1 registers set information on the sampling method of the textures."
((lcm uint8 :offset 0 :size 1)
(mxl uint8 :offset 2 :size 3)
(mmag uint8 :offset 5 :size 1)
(mmin uint8 :offset 6 :size 3)
(mtba uint8 :offset 9 :size 1)
(l uint8 :offset 19 :size 2)
(k int16 :offset 32 :size 12)
)
)
(deftype gs-texa (uint64)
"The GS's TEXA register sets the Alpha value to be referred to when the Alpha value of the
texture is not an 8-bit value."
((ta0 uint8 :offset 0 :size 8)
(aem uint8 :offset 15 :size 1)
(ta1 uint8 :offset 32 :size 8)
)
)
(deftype gs-texclut (uint64)
"The GS's TEXCLUT register specifies the CLUT position in the buffer when the CLUT storage mode
is CSM=1 (CSM2 mode)."
((cbw uint8 :offset 0 :size 6)
(cou uint8 :offset 6 :size 6)
(cov uint16 :offset 12 :size 10)
)
)
(deftype gs-miptbp (uint64)
"the GS's MIPTBP registers set the buffer pointer and buffer width of textures when performing
MIPMAP. MIPTBP1 sets levels 1 to 3, MIPTBP2 sets levels 4 to 6."
((tbp1 uint16 :offset 0 :size 14)
(tbw1 uint8 :offset 14 :size 6)
(tbp2 uint16 :offset 20 :size 14)
(tbw2 uint8 :offset 34 :size 6)
(tbp3 uint16 :offset 40 :size 14)
(tbw3 uint8 :offset 54 :size 6)
)
)
(deftype gs-alpha (uint64)
((a uint8 :offset 0 :size 2)
(b uint8 :offset 2 :size 2)
(c uint8 :offset 4 :size 2)
(d uint8 :offset 6 :size 2)
(fix uint8 :offset 32 :size 8)
)
)
(deftype gs-clamp (uint64)
((wms gs-tex-wrap-mode :offset 0 :size 2)
(wmt gs-tex-wrap-mode :offset 2 :size 2)
(minu uint16 :offset 4 :size 10)
(maxu uint16 :offset 14 :size 10)
(minv uint16 :offset 24 :size 10)
(maxv uint16 :offset 34 :size 10)
)
)
(deftype gs-fog (uint64)
((f uint8 :offset 56 :size 8)
)
)
(deftype gs-fogcol (uint64)
((fcr uint8 :offset 0 :size 8)
(fcg uint8 :offset 8 :size 8)
(fcb uint8 :offset 16 :size 8)
)
)
(deftype gif-ctrl (uint32)
((rst uint8 :offset 0 :size 1)
(pse uint8 :offset 3 :size 1)
)
)
(deftype gif-mode (uint32)
((m3r uint8 :offset 0 :size 1)
(imt uint8 :offset 2 :size 1)
)
)
(deftype gif-stat (uint32)
((m3r uint8 :offset 0 :size 1)
(m3p uint8 :offset 1 :size 1)
(imt uint8 :offset 2 :size 1)
(pse uint8 :offset 3 :size 1)
(ip3 uint8 :offset 5 :size 1)
(p3q uint8 :offset 6 :size 1)
(p2q uint8 :offset 7 :size 1)
(p1q uint8 :offset 8 :size 1)
(oph uint8 :offset 9 :size 1)
(apath uint8 :offset 10 :size 2)
(dir uint8 :offset 12 :size 1)
(fqc uint8 :offset 24 :size 5)
)
)
(deftype gif-cnt (uint32)
((loopcnt uint16 :offset 0 :size 15)
(regcnt uint8 :offset 16 :size 4)
(vuaddr uint16 :offset 20 :size 10)
)
)
(deftype gif-p3cnt (uint32)
((p3cnt uint16 :offset 0 :size 15)
)
)
(deftype gif-p3tag (uint32)
((loopcnt uint16 :offset 0 :size 15)
(eop uint8 :offset 15 :size 1)
)
)
(deftype gif-bank (structure)
((ctrl gif-ctrl :offset 0)
(mode gif-mode :offset 16)
(stat gif-stat :offset 32)
(tag0 uint32 :offset 64)
(tag1 uint32 :offset 80)
(tag2 uint32 :offset 96)
(tag3 uint32 :offset 112)
(cnt gif-cnt :offset 128)
(p3cnt gif-p3cnt :offset 144)
(p3tag gif-p3tag :offset 160)
)
)
(deftype gif-tag-prim (uint32)
((id uint16 :offset 0 :size 14)
(pre uint8 :offset 14 :size 1)
(prim gs-prim :offset 15 :size 11)
(flg gif-flag :offset 26 :size 2)
(nreg uint8 :offset 28 :size 4)
)
)
(deftype gif-tag-count (uint32)
((nloop uint16 :offset 0 :size 15)
(eop uint8 :offset 15 :size 1)
)
)
(deftype gif-tag64 (uint64)
((nloop uint16 :offset 0 :size 15)
(eop uint8 :offset 15 :size 1)
(id uint16 :offset 32 :size 14)
(pre uint8 :offset 46 :size 1)
(prim gs-prim :offset 47 :size 11)
(flg gif-flag :offset 58 :size 2)
(nreg uint8 :offset 60 :size 4)
)
)
(deftype gif-tag (uint128)
((nloop uint16 :offset 0 :size 15)
(eop uint8 :offset 15 :size 1)
(id uint16 :offset 32 :size 14)
(pre uint8 :offset 46 :size 1)
(prim uint16 :offset 47 :size 11)
(flg gif-flag :offset 58 :size 2)
(nreg uint8 :offset 60 :size 4)
(regs0 gif-reg-id :offset 64 :size 4)
(regs1 gif-reg-id :offset 68 :size 4)
(regs2 gif-reg-id :offset 72 :size 4)
(regs3 gif-reg-id :offset 76 :size 4)
(regs4 gif-reg-id :offset 80 :size 4)
(regs5 gif-reg-id :offset 84 :size 4)
(regs6 gif-reg-id :offset 88 :size 4)
(regs7 gif-reg-id :offset 92 :size 4)
(regs8 gif-reg-id :offset 96 :size 4)
(regs9 gif-reg-id :offset 100 :size 4)
(regs10 gif-reg-id :offset 104 :size 4)
(regs11 gif-reg-id :offset 108 :size 4)
(regs12 gif-reg-id :offset 112 :size 4)
(regs13 gif-reg-id :offset 116 :size 4)
(regs14 gif-reg-id :offset 120 :size 4)
(regs15 gif-reg-id :offset 124 :size 4)
)
)
(deftype gif-tag-regs (uint64)
((regs0 gif-reg-id :offset 0 :size 4)
(regs1 gif-reg-id :offset 4 :size 4)
(regs2 gif-reg-id :offset 8 :size 4)
(regs3 gif-reg-id :offset 12 :size 4)
(regs4 gif-reg-id :offset 16 :size 4)
(regs5 gif-reg-id :offset 20 :size 4)
(regs6 gif-reg-id :offset 24 :size 4)
(regs7 gif-reg-id :offset 28 :size 4)
(regs8 gif-reg-id :offset 32 :size 4)
(regs9 gif-reg-id :offset 36 :size 4)
(regs10 gif-reg-id :offset 40 :size 4)
(regs11 gif-reg-id :offset 44 :size 4)
(regs12 gif-reg-id :offset 48 :size 4)
(regs13 gif-reg-id :offset 52 :size 4)
(regs14 gif-reg-id :offset 56 :size 4)
(regs15 gif-reg-id :offset 60 :size 4)
)
)
(deftype gif-tag-regs-32 (uint32)
((regs0 gif-reg-id :offset 0 :size 4)
(regs1 gif-reg-id :offset 4 :size 4)
(regs2 gif-reg-id :offset 8 :size 4)
(regs3 gif-reg-id :offset 12 :size 4)
(regs4 gif-reg-id :offset 16 :size 4)
(regs5 gif-reg-id :offset 20 :size 4)
(regs6 gif-reg-id :offset 24 :size 4)
(regs7 gif-reg-id :offset 28 :size 4))
)
;; we unfortunately kind of need this
(defmacro gif-tag->static-array (tag regs)
"Allocates a new static array of two uint64's making up the gif-tag and the tag registers"
`(new 'static 'array uint64 2 ,tag ,regs)
)
(defmacro gif-prim (prim-type)
`(new 'static 'gs-prim :prim (gs-prim-type ,prim-type) :iip 1 :abe 1)
)
(defmacro gs-reg-list (&rest reg-ids)
"Generate a giftag register descriptor list from reg-ids."
(let ((reg-count (length reg-ids)))
(when (> (length reg-ids) 16)
(ferror "too many regs passed to gs-reg-list")
)
(let ((list-to-splice '())
(cur-lst reg-ids)
(i -1))
;; this is questionable.
(while (and (not (null? cur-lst)) (< i 15))
(push! list-to-splice (cons 'gif-reg-id (cons (car cur-lst) '())))
(push! list-to-splice (string->symbol-format ":regs{}" (inc! i)))
(pop! cur-lst)
)
`(new 'static 'gif-tag-regs
,@list-to-splice
)
)
#| ;; the opengoal compiler does not have enough constant propagation for this for now
(let ((i -1))
`(the-as gif-tag-regs (logior ,@(apply (lambda (x)
`(shl (the-as uint (gif-reg-id ,x)) ,(* 4 (inc! i)))
) reg-ids)
))
)|#
)
)
(deftype gs-gif-tag (structure)
((qword uint128)
(tag gif-tag64 :overlay-at qword)
(regs gif-tag-regs :offset 8)
(dword uint64 2 :overlay-at qword)
(word uint32 4 :overlay-at qword)
)
)
;; WARN: Return type mismatch object vs gif-tag.
(define *fog-color* (new 'static 'rgba :r #x80))
(deftype gif-packet (basic)
"Unused type for building a dynamically sized gif packet."
((reg-count int32)
(gif-tag gs-gif-tag :inline)
(gif-tag0 uint128 :overlay-at (-> gif-tag qword))
(args uint64 1)
)
(:methods
(new (symbol type int) _type_)
)
)
(defmethod new gif-packet ((allocation symbol) (type-to-make type) (arg0 int))
(object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* (+ arg0 -1) 8))))
)
(defun open-gif-packet ((arg0 gif-packet))
"Initialize an existing gif-packet for 0 registers."
(set! (-> arg0 reg-count) 0)
(set! (-> arg0 gif-tag regs) (new 'static 'gif-tag-regs))
arg0
)
;; WARN: Return type mismatch gif-packet vs none.
(defun add-reg-gif-packet ((arg0 gif-packet) (arg1 int) (arg2 int))
"Add a register + value to the packet."
(let ((v1-0 (-> arg0 gif-tag)))
(logior! (-> v1-0 regs) (ash arg1 (* (-> arg0 reg-count) 4)))
)
(set! (-> (&-> arg0 args (-> arg0 reg-count)) 0) (the-as uint arg2))
(+! (-> arg0 reg-count) 1)
(none)
)
(defun close-gif-packet ((arg0 gif-packet) (arg1 int))
"Finish adding registers."
(set! (-> arg0 gif-tag tag)
(new 'static 'gif-tag64 :nloop #x1 :flg (gif-flag reg-list) :eop arg1 :nreg (-> arg0 reg-count))
)
arg0
)
(deftype draw-context (basic)
((orgx int32)
(orgy int32)
(orgz int32)
(width int32)
(height int32)
(color rgba 4)
)
(:methods
(new (symbol type int int int int rgba) _type_)
)
)
(defmethod new draw-context ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int) (arg2 int) (arg3 int) (arg4 rgba))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> v0-0 orgx) arg0)
(set! (-> v0-0 orgy) arg1)
(set! (-> v0-0 orgz) #xffffff)
(set! (-> v0-0 width) arg2)
(set! (-> v0-0 height) arg3)
(set! (-> v0-0 color 0) arg4)
v0-0
)
)
(defun draw-context-set-xy ((arg0 draw-context) (arg1 int) (arg2 int))
"Set the origin of the draw context."
(set! (-> arg0 orgx) arg1)
(set! (-> arg0 orgy) arg2)
(none)
)
(deftype gs-packed-rgba (vector4w)
((r int32 :overlay-at (-> data 0))
(g int32 :overlay-at (-> data 1))
(b int32 :overlay-at (-> data 2))
(a int32 :overlay-at (-> data 3))
)
)
(deftype gs-packed-xyzw (vector)
((ix int32 :overlay-at (-> data 0))
(iy int32 :overlay-at (-> data 1))
(iz int32 :overlay-at (-> data 2))
(iw int32 :overlay-at (-> data 3))
)
)
(deftype gs-packed-stq (vector)
((tex-s float :overlay-at (-> data 0))
(tex-t float :overlay-at (-> data 1))
(tex-q float :overlay-at (-> data 2))
)
)
(deftype gs-packed-uv (vector)
((u int16 :overlay-at (-> data 0))
(v int16 :overlay-at (-> data 1))
)
)
(deftype gs-packed-gt (structure)
((stq gs-packed-stq :inline :offset 0)
(rgba gs-packed-rgba :inline :offset 16)
(xyzw gs-packed-xyzw :inline :offset 32)
)
)
(deftype gs-packed-gt4 (structure)
((data gs-packed-gt 4 :inline)
)
)
+110
View File
@@ -5,5 +5,115 @@
;; name in dgo: math-camera-h
;; dgos: GAME
#|@file
The "math-camera" is responsible for computing the projection matrix used in the renderer
from the position of the in-game camera. It also computes some other common camera info.
See cam-update.gc for how the game camera updates the math-camera.
It also contains some GIF stuff, but these seem to be wrong/unused.
Some of the code here may be extremely old and unused, but this does compute the camera projection
matrix used almost everywhere.
|#
;; DECOMP BEGINS
(deftype vis-gif-tag (structure)
"Unused."
((fog0 uint32)
(strip uint32)
(regs uint32)
(fan uint32)
)
)
(deftype cull-info (structure)
"Also seems unused."
((x-fact float)
(y-fact float)
(z-fact float)
(cam-radius float)
(cam-x float)
(cam-y float)
(xz-dir-ax float)
(xz-dir-az float)
(xz-dir-bx float)
(xz-dir-bz float)
(xz-cross-ab float)
(yz-dir-ay float)
(yz-dir-az float)
(yz-dir-by float)
(yz-dir-bz float)
(yz-cross-ab float)
)
:allow-misaligned
)
(deftype math-camera (basic)
((d meters)
(f meters)
(fov degrees)
(x-ratio float)
(y-ratio float)
(x-pix float)
(x-clip float)
(x-clip-ratio-in float)
(x-clip-ratio-over float)
(y-pix float)
(y-clip float)
(y-clip-ratio-in float)
(y-clip-ratio-over float)
(cull-info cull-info :inline)
(fog-start meters)
(fog-end meters)
(fog-max float)
(fog-min float)
(reset int32)
(smooth-step float)
(smooth-t float)
(perspective matrix :inline)
(isometric matrix :inline)
(sprite-2d matrix :inline)
(sprite-2d-hvdf vector :inline)
(camera-rot matrix :inline)
(inv-camera-rot matrix :inline)
(inv-camera-rot-smooth matrix :inline)
(inv-camera-rot-smooth-from quaternion :inline)
(camera-temp matrix :inline)
(prev-camera-temp matrix :inline)
(prev-inv-camera-rot matrix :inline)
(prev-trans vector :inline)
(hmge-scale vector :inline)
(inv-hmge-scale vector :inline)
(hvdf-off vector :inline)
(guard vector :inline)
(vis-gifs vis-gif-tag 4)
(giftex uint128 :overlay-at (-> vis-gifs 0))
(gifgr uint128 :offset 864)
(giftex-trans uint128 :offset 880)
(gifgr-trans uint128 :offset 896)
(pfog0 float)
(pfog1 float)
(trans vector :inline)
(plane plane 4 :inline)
(guard-plane plane 4 :inline)
(shrub-mat matrix :inline)
(quat-other quaternion :inline)
(trans-other vector :inline)
(shrub-mat-other matrix :inline)
(camera-temp-other matrix :inline)
(camera-rot-other matrix :inline)
(camera-rot-other-sky matrix :inline)
(camera-rot-other-sprite matrix :inline)
(inv-camera-rot-other matrix :inline)
(plane-other plane 4 :inline)
(guard-plane-other plane 4 :inline)
(mirror-trans vector :inline)
(mirror-normal vector :inline)
(fov-correction-factor float)
)
(:methods
(new (symbol type) _type_)
)
)
+682
View File
@@ -5,5 +5,687 @@
;; name in dgo: math-camera
;; dgos: GAME
#|@file
;;;;;;;;;;;;;;;;;;;;
math camera basics
;;;;;;;;;;;;;;;;;;;;
the math camera computes the perspective matrix, hvdf offset, and hmge scale.
multiplying a point by the perspective matrix, doing the persepctive divide, then adding hvdf offset gives you:
H : horizontal position (in GS coordinates)
V : vertical position (in GS coordinates)
D : depth (as a 24-bit integer for the z buffer)
F : fog
Multiplying by hmge then checking the clipping flags can be used to see if a point is outside the view frustum.
The "camera-temp" matrix is the perspective matrix multplied by the camera tranformation and is used
renderers that want a single matrix.
|#
(define-extern sprite-distorter-generate-tables (function none))
;; DECOMP BEGINS
(deftype fog-corrector (structure)
"The math-camera matrices are used to compute fogging values, which are a per-vertex uint8 that
tells the GS how 'foggy' the color should be. This should be proportional to how far away the vertex
is. There is a scaling factor applied so the fog intensity isn't affected by the field of view angle.
The fog-corrector stores a fog-end fog-start value that is corrected for the field of view.
The actual correction factor is computed in cam-update.gc.
Without this corrector, the fogginess of the world would change as the FOV changes
(for example, when Jak gets on the zoomer, the FOV changes slightly)."
((fog-end float)
(fog-start float)
)
)
;; WARN: Return type mismatch float vs none.
(defun fog-corrector-setup ((arg0 fog-corrector) (arg1 math-camera))
"Set the fog corrector based on the supplied math-camera."
(set! (-> arg0 fog-end) (* (-> arg1 fog-end) (-> arg1 fov-correction-factor)))
(set! (-> arg0 fog-start) (* (-> arg1 fog-start) (-> arg1 fov-correction-factor)))
(none)
)
(define *math-camera-fog-correction* (new 'global 'fog-corrector))
;; ERROR: Failed store: (s.w! a0-43 v1-54) at op 457
;; ERROR: Failed store: (s.w! (+ a0-43 4) a1-9) at op 461
;; ERROR: Failed store: (s.w! (+ a0-43 8) a1-10) at op 463
;; ERROR: Failed store: (s.w! (+ a0-43 12) a1-11) at op 465
(defun update-math-camera ((arg0 math-camera) (arg1 symbol) (arg2 symbol) (arg3 float))
"Compute some one-time camera constants.
These should only change when changing aspect ratio."
(local-vars (sv-16 float))
(set! (-> arg0 x-ratio) (tan (* 0.5 arg3)))
(if (= arg2 'aspect4x3)
(set! (-> arg0 y-ratio) (* 0.75 (-> arg0 x-ratio)))
(set! (-> arg0 y-ratio) (* 0.5625 (-> arg0 x-ratio)))
)
;; TODO pckernel
;; og:preserve-this
;; (with-pc
;; (cond
;; ((-> *pc-settings* use-vis?)
;; ;; using game vis, cannot allow seeing more of the view
;; ;; crops excess aspect ratio at the top and bottom
;; ;(set! (-> arg0 y-ratio) (* (1/ (-> *pc-settings* aspect-ratio)) (-> arg0 x-ratio)))
;; )
;; ((real-movie?)
;; ;; this mess is just so that we can force the original 16x9 cropping during cutscenes.
;; (if (<= (-> *pc-settings* aspect-ratio) ASPECT_16X9)
;; (set! (-> arg0 y-ratio) (* (1/ (-> *pc-settings* aspect-ratio)) (-> arg0 x-ratio)))
;; (begin
;; (set! (-> arg0 y-ratio) (* (1/ ASPECT_16X9) (-> arg0 x-ratio)))
;; (*! (-> arg0 x-ratio) (/ (-> *pc-settings* aspect-ratio) ASPECT_16X9))
;; )
;; )
;; )
;; (else
;; ;; not using game vis, allow *extended* aspect ratios
;; ;; there is no vertical cropping, and you can see more of the sides
;; (set! (-> arg0 y-ratio) (* (1/ ASPECT_4X3) (-> arg0 x-ratio))) ;; same cropping as 4x3
;; (*! (-> arg0 x-ratio) (/ (-> *pc-settings* aspect-ratio) ASPECT_4X3)) ;; extend fov! shows more on the sides.
;; )
;; )
;; )
(let ((f1-3 (-> arg0 x-ratio))
(f0-7 (-> arg0 y-ratio))
(v1-6 (-> arg0 cull-info))
)
(/ (+ 1.0 (* 4.0 f1-3 f1-3)) (+ 1.0 (* f1-3 f1-3)))
(let ((f2-5 (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (+ 1.0 (* f0-7 f0-7)))))
(set! (-> v1-6 x-fact) (/ (+ 1.0 (* 4.0 f1-3 f1-3)) (* f1-3 (sqrtf (+ 1.0 (* 16.0 f1-3 f1-3))))))
(set! (-> v1-6 y-fact) (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (* f0-7 (sqrtf (+ 1.0 (* 16.0 f0-7 f0-7))))))
(set! (-> v1-6 z-fact) (sqrtf (+ (* (+ -4.0 f2-5) (+ -4.0 f2-5) f0-7 f0-7) (* (+ -1.0 f2-5) (+ -1.0 f2-5)))))
)
(let* ((f2-11 (* f1-3 (-> arg0 d)))
(f1-5 (* f0-7 (-> arg0 d)))
(f0-10 (+ (* f2-11 f2-11) (* f1-5 f1-5)))
(f1-8 (-> arg0 d))
)
(set! (-> v1-6 cam-radius) (sqrtf (+ f0-10 (* f1-8 f1-8))))
)
(let* ((f1-12 (* (-> arg0 d) (-> arg0 x-ratio)))
(f0-14 (-> arg0 d))
(f2-13 (* 4.0 f1-12))
(f3-21 (-> arg0 d))
)
(let ((f4-21 (/ 1.0 (sqrtf (+ (* f1-12 f1-12) (* f0-14 f0-14)))))
(f5-11 (/ 1.0 (sqrtf (+ (* f2-13 f2-13) (* f3-21 f3-21)))))
)
(set! (-> v1-6 xz-dir-ax) (* f1-12 f4-21))
(set! (-> v1-6 xz-dir-az) (* f0-14 f4-21))
(set! (-> v1-6 xz-dir-bx) (* f2-13 f5-11))
(set! (-> v1-6 xz-dir-bz) (* f3-21 f5-11))
)
(set! (-> v1-6 xz-cross-ab) (- (* f1-12 f3-21) (* f0-14 f2-13)))
)
(let* ((f1-15 (* (-> arg0 d) (-> arg0 y-ratio)))
(f0-18 (-> arg0 d))
(f2-15 (* 4.0 f1-15))
(f3-22 (-> arg0 d))
)
(let ((f4-26 (/ 1.0 (sqrtf (+ (* f1-15 f1-15) (* f0-18 f0-18)))))
(f5-16 (/ 1.0 (sqrtf (+ (* f2-15 f2-15) (* f3-22 f3-22)))))
)
(set! (-> v1-6 yz-dir-ay) (* f1-15 f4-26))
(set! (-> v1-6 yz-dir-az) (* f0-18 f4-26))
(set! (-> v1-6 yz-dir-by) (* f2-15 f5-16))
(set! (-> v1-6 yz-dir-bz) (* f3-22 f5-16))
)
(set! (-> v1-6 yz-cross-ab) (- (* f1-15 f3-22) (* f0-18 f2-15)))
)
)
(fog-corrector-setup *math-camera-fog-correction* arg0)
(matrix-identity! (-> arg0 camera-rot))
(let ((f0-21 100.0)
(f2-16 16760631.0)
)
16777115.0
(let ((f30-0 (/ (* (-> arg0 d) (- (-> arg0 fog-min) (-> arg0 fog-max)))
(- (-> *math-camera-fog-correction* fog-end) (-> *math-camera-fog-correction* fog-start))
)
)
(f1-21 (* -0.5 (- f2-16 f0-21)))
)
(let ((f4-34 (/ f1-21 (* (-> arg0 d) (- (-> arg0 f) (-> arg0 d)))))
(f3-30 (-> arg0 fov-correction-factor))
)
(set! (-> arg0 perspective rvec x) (* f3-30 (- (/ (-> arg0 x-pix) (* (-> arg0 x-ratio) (-> arg0 d))))))
(set! (-> arg0 perspective uvec y) (* f3-30 (- (/ (-> arg0 y-pix) (* (-> arg0 y-ratio) (-> arg0 d))))))
(set! (-> arg0 perspective fvec z) (* f3-30 (+ (-> arg0 f) (-> arg0 d)) f4-34))
(set! (-> arg0 perspective fvec w) (* (/ f3-30 (-> arg0 d)) f30-0))
(set! (-> arg0 perspective trans z) (* -2.0 f4-34 (-> arg0 f) (-> arg0 d) f3-30))
)
(let ((f24-0 2048.0)
(f26-0 2048.0)
(f28-0 (/ (- (* (-> *math-camera-fog-correction* fog-end) (-> arg0 fog-max))
(* (-> *math-camera-fog-correction* fog-start) (-> arg0 fog-min))
)
(- (-> *math-camera-fog-correction* fog-end) (-> *math-camera-fog-correction* fog-start))
)
)
)
(let ((f22-0 (* 0.5 (+ f2-16 f0-21))))
(set! (-> arg0 hmge-scale x) (/ 1.0 (-> arg0 x-clip)))
(set! (-> arg0 hmge-scale y) (/ 1.0 (-> arg0 y-clip)))
(set! (-> arg0 hmge-scale z) (/ 1.0 f1-21))
(set! (-> arg0 hmge-scale w) (/ 1.0 f30-0))
(set! (-> arg0 inv-hmge-scale x) (-> arg0 x-clip))
(set! (-> arg0 inv-hmge-scale y) (-> arg0 y-clip))
(set! (-> arg0 inv-hmge-scale z) f1-21)
(set! (-> arg0 inv-hmge-scale w) f30-0)
(cond
((or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
(set! (-> arg0 hvdf-off x) f24-0)
(set! (-> arg0 hvdf-off y) f26-0)
)
(else
(let* ((v1-32 (-> *screen-shot-work* count))
(a0-36 (-> *screen-shot-work* size))
(f0-34 (the float a0-36))
(f20-0 (/ (the float (mod v1-32 a0-36)) f0-34))
)
(set! sv-16 (/ (the float (/ v1-32 a0-36)) f0-34))
(format 0 "~f ~f~%" f20-0 sv-16)
(set! (-> arg0 hvdf-off x) (- f24-0 f20-0))
)
(set! (-> arg0 hvdf-off y) (- f26-0 sv-16))
)
)
(set! (-> arg0 hvdf-off z) f22-0)
(set! (-> arg0 hvdf-off w) f28-0)
(set! (-> arg0 guard x) (/ (-> arg0 x-clip) (-> arg0 x-pix)))
(set! (-> arg0 guard y) (/ (-> arg0 y-clip) (-> arg0 y-pix)))
(set! (-> arg0 guard z) 1.0)
(set! (-> arg0 guard w) 1.0)
(set! (-> arg0 isometric trans z) (- 16777215.0 f22-0))
;; og:preserve-this PC HACK!
;; for whatever reason, the font render ends up computing a depth #x1000000 instead of
;; #xffffffff, which overflows the 24-bit z buffer.
;; cheating this by 1 bit seems to fix it.
(#when PC_PORT
;; #x4b002032 -> #x4b002031
(set! (-> arg0 isometric vector 3 z) (the-as float (- (the-as int (-> arg0 isometric vector 3 z)) 1)))
)
)
(set! (-> arg0 isometric trans w) f30-0)
(let ((f1-28 (-> arg0 perspective rvec x))
(f2-19 (-> arg0 perspective uvec y))
(f0-48 (* -1.9996 (-> arg0 perspective rvec x)))
)
(let ((v1-39 (-> arg0 sprite-2d)))
(set! (-> v1-39 rvec x) f0-48)
(set! (-> v1-39 rvec y) 0.0)
(set! (-> v1-39 rvec z) 0.0)
(set! (-> v1-39 rvec w) 0.0)
)
(set-vector! (-> arg0 sprite-2d uvec) 0.0 (- (* (/ f2-19 f1-28) f0-48)) 0.0 0.0)
(set-vector! (-> arg0 sprite-2d fvec) 0.0 0.0 (- f0-48) 0.0)
(set-vector! (-> arg0 sprite-2d trans) 0.0 0.0 (* 500000000.0 f0-48) (* 60.0 f0-48 (-> arg0 pfog0)))
)
(set! (-> arg0 sprite-2d-hvdf quad) (-> arg0 hvdf-off quad))
(set! (-> arg0 sprite-2d-hvdf x) 2048.0)
(set! (-> arg0 sprite-2d-hvdf y) 2048.0)
(set! (-> arg0 sprite-2d-hvdf z) (-> arg0 hvdf-off z))
(set! (-> arg0 pfog0) f30-0)
(set! (-> arg0 pfog1) f28-0)
)
)
)
0
;; garbage giftags
(make-u128 0 (shl #x301ec000 32))
(make-u128 0 (shl #x303ec000 32))
(let ((v1-54 (-> arg0 pfog0)))
(let ((a0-42 (-> arg0 vis-gifs)))
(set! (-> a0-42 0) (the-as vis-gif-tag v1-54))
(set! (-> a0-42 1) (the-as vis-gif-tag #x301e4000))
(set! (-> a0-42 2) (the-as vis-gif-tag 1042))
(set! (-> a0-42 3) (the-as vis-gif-tag #x301ec000))
)
;; og:preserve-this
#|
(let ((a0-43 (&-> arg0 gifgr)))
(s.w! a0-43 v1-54)
(let ((a1-9 (make-u128 0 (shl #x20164000 32))))
(s.w! (+ a0-43 4) a1-9)
)
(let ((a1-10 65))
(s.w! (+ a0-43 8) a1-10)
)
(let ((a1-11 #x301ec000))
(s.w! (+ a0-43 12) a1-11)
)
)
|#
(let ((a0-44 (-> arg0 vis-gifs)))
(set! (-> a0-44 0) (the-as vis-gif-tag v1-54))
(set! (-> a0-44 1) (the-as vis-gif-tag #x303e4000))
(set! (-> a0-44 2) (the-as vis-gif-tag 1042))
(set! (-> a0-44 3) (the-as vis-gif-tag #x303ec000))
)
(let ((a0-45 (-> arg0 vis-gifs)))
(set! (-> a0-45 0) (the-as vis-gif-tag v1-54))
(set! (-> a0-45 1) (the-as vis-gif-tag #x303e4000))
(set! (-> a0-45 2) (the-as vis-gif-tag 1042))
(set! (-> a0-45 3) (the-as vis-gif-tag #x303ec000))
)
)
(if (nonzero? sprite-distorter-generate-tables)
(sprite-distorter-generate-tables)
)
arg0
)
(defmethod new math-camera ((allocation symbol) (type-to-make type))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> gp-0 d) 1024.0)
(set! (-> gp-0 f) 40960000.0)
(set! (-> gp-0 fov) 11650.845)
(set! (-> gp-0 x-pix) 256.0)
(set! (-> gp-0 x-clip) 512.0)
(set! (-> gp-0 y-pix) 208.0)
(set! (-> gp-0 y-clip) 416.0)
(set! (-> gp-0 fog-start) 40960.0)
(set! (-> gp-0 fog-end) 819200.0)
(set! (-> gp-0 fog-max) 255.0)
(set! (-> gp-0 fog-min) 150.0)
(matrix-identity! (-> gp-0 inv-camera-rot))
(matrix-identity! (-> gp-0 camera-rot))
(vector-reset! (-> gp-0 trans))
(quaternion-identity! (-> gp-0 quat-other))
(set-vector! (-> gp-0 trans-other) 0.0 0.0 0.0 1.0)
(matrix-identity! (-> gp-0 inv-camera-rot-other))
(matrix-identity! (-> gp-0 camera-rot-other))
(matrix-identity! (-> gp-0 camera-temp-other))
(set! (-> gp-0 isometric rvec x) 1.0)
(set! (-> gp-0 isometric uvec y) 0.5)
(set! (-> gp-0 isometric fvec z) -1.0)
(set! (-> gp-0 reset) 1)
(set! (-> gp-0 smooth-step) 0.0)
(set! (-> gp-0 smooth-t) 0.0)
(update-math-camera gp-0 'ntsc 'aspect4x3 (-> gp-0 fov))
)
)
(define *math-camera* (new 'global 'math-camera))
(defun math-cam-start-smoothing ((arg0 float) (arg1 float))
"Unused camera smoothing."
(set! (-> *math-camera* smooth-step) (/ 1.0 arg0))
(set! (-> *math-camera* smooth-t) arg1)
(matrix->quaternion (-> *math-camera* inv-camera-rot-smooth-from) (-> *math-camera* inv-camera-rot-smooth))
)
(defun move-target-from-pad ((arg0 transform) (arg1 int))
"Unused function to adjust trans based on inputs from the pad.
This function must be extremely old because it takes a non-quaternion transform,
and all [[target]] stuff uses quaternions."
(let ((s4-0 (new-stack-vector0)))
(set! (-> s4-0 x) (cond
((cpad-hold? arg1 circle)
-80.0
)
((cpad-hold? arg1 square)
80.0
)
(else
0.0
)
)
)
(set! (-> s4-0 y) 0.0)
(set! (-> s4-0 z) (cond
((cpad-hold? arg1 down)
-80.0
)
((cpad-hold? arg1 up)
80.0
)
(else
0.0
)
)
)
(set! (-> s4-0 w) 1.0)
(let ((a0-5 (new-stack-vector0))
(s3-0 (new 'stack-no-clear 'matrix))
)
(set! (-> s3-0 rvec quad) (the-as uint128 0))
(set! (-> s3-0 uvec quad) (the-as uint128 0))
(set! (-> s3-0 fvec quad) (the-as uint128 0))
(set! (-> s3-0 trans quad) (the-as uint128 0))
(vector-negate! a0-5 (-> arg0 rot))
(matrix-rotate-zyx! s3-0 (-> arg0 rot))
(vector-matrix*! s4-0 s4-0 s3-0)
)
(vector+! (-> arg0 trans) (-> arg0 trans) s4-0)
)
(set! (-> arg0 trans w) 1.0)
(if (cpad-hold? arg1 r1)
(+! (-> arg0 trans y) 80.0)
)
(if (cpad-hold? arg1 r2)
(+! (-> arg0 trans y) -80.0)
)
(if (cpad-hold? arg1 x)
(+! (-> arg0 rot x) 546.13336)
)
(if (cpad-hold? arg1 triangle)
(+! (-> arg0 rot x) -546.13336)
)
(if (cpad-hold? arg1 left)
(+! (-> arg0 rot y) 546.13336)
)
(if (cpad-hold? arg1 right)
(+! (-> arg0 rot y) -546.13336)
)
arg0
)
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
(defun transform-point-vector! ((arg0 vector) (arg1 vector))
"Apply camera transformation to a point. Return true if it is visible or not.
This returns the point in GS coords, but as float instead of int, so it's
not really useful. See [[transform-point-qword!]] for more details."
(local-vars (v1-2 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
0
(let ((v1-1 *math-camera*))
(.lvf vf24 (&-> v1-1 camera-temp rvec quad))
(.lvf vf25 (&-> v1-1 camera-temp uvec quad))
(.lvf vf26 (&-> v1-1 camera-temp fvec quad))
(.lvf vf27 (&-> v1-1 camera-temp trans quad))
(.lvf vf29 (&-> v1-1 hmge-scale quad))
(.lvf vf30 (&-> v1-1 hvdf-off quad))
)
(.lvf vf28 (&-> arg1 quad))
(.mul.x.vf acc vf24 vf28)
(.add.mul.y.vf acc vf25 vf28 acc)
(.add.mul.z.vf acc vf26 vf28 acc)
(.add.mul.w.vf vf28 vf27 vf0 acc)
(.add.w.vf vf23 vf0 vf0)
(.mul.vf vf31 vf28 vf29)
;; og:preserve-this
;;(TODO.VCLIP vf31 vf31)
(let ((clip (vu-clip vf31 0)))
(.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11)
(.wait.vf)
;;(.cfc2.i v1-7 Clipping)
(.mul.vf vf28 vf28 Q :mask #b111)
(.mul.vf vf23 vf23 Q)
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(.svf (&-> arg0 quad) vf28)
(not (logtest? clip 63))
)
)
)
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
(defun transform-point-qword! ((arg0 vector4w) (arg1 vector))
"Apply camera transformation to point, returning fixed point 28.4 position
that can be given to the GS directly."
(local-vars (v1-2 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
0
(let ((v1-1 *math-camera*))
(.lvf vf24 (&-> v1-1 camera-temp rvec quad))
(.lvf vf25 (&-> v1-1 camera-temp uvec quad))
(.lvf vf26 (&-> v1-1 camera-temp fvec quad))
(.lvf vf27 (&-> v1-1 camera-temp trans quad))
(.lvf vf29 (&-> v1-1 hmge-scale quad))
(.lvf vf30 (&-> v1-1 hvdf-off quad))
)
(.lvf vf28 (&-> arg1 quad))
(.mul.x.vf acc vf24 vf28)
(.add.mul.y.vf acc vf25 vf28 acc)
(.add.mul.z.vf acc vf26 vf28 acc)
(.add.mul.w.vf vf28 vf27 vf0 acc)
(.add.w.vf vf23 vf0 vf0)
(.mul.vf vf31 vf28 vf29)
;; og:preserve-this
;; (TODO.VCLIP vf31 vf31)
(let ((clip (vu-clip vf31 0)))
(.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11)
(.wait.vf)
;; (.cfc2.i v1-2 Clipping)
(.mul.vf vf28 vf28 Q :mask #b111)
(.mul.vf vf23 vf23 Q)
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(vftoi4.xyzw vf28 vf28)
(.svf (&-> arg0 quad) vf28)
(not (logtest? clip 63))
)
)
)
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
(defun transform-point-vector-scale! ((arg0 vector) (arg1 vector))
"Similar to transform-point-qword! but returns the scale factor instead."
(local-vars (v0-0 float) (v1-2 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
0
(let ((v1-1 *math-camera*))
(.lvf vf24 (&-> v1-1 camera-temp rvec quad))
(.lvf vf25 (&-> v1-1 camera-temp uvec quad))
(.lvf vf26 (&-> v1-1 camera-temp fvec quad))
(.lvf vf27 (&-> v1-1 camera-temp trans quad))
(.lvf vf29 (&-> v1-1 hmge-scale quad))
(.lvf vf30 (&-> v1-1 hvdf-off quad))
)
(.lvf vf28 (&-> arg1 quad))
(.mul.x.vf acc vf24 vf28)
(.add.mul.y.vf acc vf25 vf28 acc)
(.add.mul.z.vf acc vf26 vf28 acc)
(.add.mul.w.vf vf28 vf27 vf0 acc)
(.add.w.vf vf23 vf0 vf0)
(.mul.vf vf31 vf28 vf29)
;; og:preserve-this
;; (TODO.VCLIP vf31 vf31)
(.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11)
(.wait.vf)
;; (.cfc2.i v1-2 Clipping)
(.mul.vf vf28 vf28 Q :mask #b111)
(.mul.vf vf23 vf23 Q)
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(.svf (&-> arg0 quad) vf28)
;; (not (logtest? v1-2 63))
(.mov v0-0 vf23)
v0-0
)
)
;; WARN: Return type mismatch vector vs none.
(defun reverse-transform-point! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
"Likely transform arg3 from screen space to world coords, using arg1/arg2 for... something."
(let* ((v1-1 (-> *math-camera* perspective))
(s2-0 (-> *math-camera* camera-rot))
(f30-0 (* (/ (-> v1-1 fvec w) (-> v1-1 rvec x)) (-> *math-camera* hmge-scale w)))
(f28-0 (* (/ (-> v1-1 fvec w) (-> v1-1 uvec y)) (-> *math-camera* hmge-scale w)))
(s4-0 (vector-rotate*! (new 'stack-no-clear 'vector) arg2 s2-0))
(v1-3 (vector-matrix*! (new 'stack-no-clear 'vector) arg1 s2-0))
(f0-8 (/ (+ (* (-> s4-0 x) (-> v1-3 x)) (* (-> s4-0 y) (-> v1-3 y)) (* (-> s4-0 z) (-> v1-3 z)))
(+ (* (-> s4-0 x) (-> arg3 x) f30-0) (* (-> s4-0 y) (-> arg3 y) f28-0) (-> s4-0 z))
)
)
(f1-16 (* (-> arg3 x) f0-8 f30-0))
(f2-9 (* (-> arg3 y) f0-8 f28-0))
(t9-2 vector-matrix*!)
(a0-5 arg0)
(a1-3 (new 'stack-no-clear 'vector))
)
(set! (-> a1-3 x) f1-16)
(set! (-> a1-3 y) f2-9)
(set! (-> a1-3 z) f0-8)
(set! (-> a1-3 w) 1.0)
(t9-2 a0-5 a1-3 (-> *math-camera* inv-camera-rot))
)
(none)
)
(defun init-for-transform ((arg0 matrix))
"Sets up VU0 registers with camera info.
This is probably a very old function and it's only used by camera debug.
It stashes some data in vector float registers that must be there before calling transform-float-point."
(local-vars (v1-14 float))
(rlet ((vf1 :class vf)
(vf17 :class vf)
(vf18 :class vf)
(vf19 :class vf)
(vf2 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(let ((gp-0 (new-stack-matrix0))
(s5-0 (new-stack-matrix0))
(s4-0 (new 'stack 'vector4s-3))
(s3-0 (new-stack-vector0))
(s2-0 (new 'stack 'vector4s-3))
)
(matrix*! s5-0 arg0 (-> *math-camera* camera-temp))
(matrix-3x3-inverse-transpose! gp-0 arg0)
(set-vector! s3-0 0.4 0.4 0.4 1.0)
(let ((v1-4 (-> s4-0 data)))
(set! (-> v1-4 0) 1.0)
(set! (-> v1-4 1) 1.0)
(set! (-> v1-4 2) 1.0)
(set! (-> v1-4 3) 1.0)
)
(let ((v1-5 (&-> s4-0 data 4)))
(set! (-> v1-5 0) 0.0)
(set! (-> v1-5 1) 0.0)
(set! (-> v1-5 2) 0.0)
(set! (-> v1-5 3) 1.0)
)
(let ((v1-6 (&-> s4-0 data 8)))
(set! (-> v1-6 0) 0.0)
(set! (-> v1-6 1) 0.0)
(set! (-> v1-6 2) 0.0)
(set! (-> v1-6 3) 1.0)
)
(let ((v1-7 (-> s2-0 data)))
(set! (-> v1-7 0) 1.0)
(set! (-> v1-7 1) 0.0)
(set! (-> v1-7 2) 0.0)
(set! (-> v1-7 3) 1.0)
)
(let ((v1-8 (&-> s2-0 data 4)))
(set! (-> v1-8 0) 0.0)
(set! (-> v1-8 1) 1.0)
(set! (-> v1-8 2) 0.0)
(set! (-> v1-8 3) 1.0)
)
(let ((v1-9 (&-> s2-0 data 8)))
(set! (-> v1-9 0) 0.0)
(set! (-> v1-9 1) 0.0)
(set! (-> v1-9 2) 1.0)
(set! (-> v1-9 3) 1.0)
)
(.lvf vf7 (&-> *math-camera* hmge-scale quad))
(.lvf vf8 (&-> *math-camera* hvdf-off quad))
(.lvf vf9 (&-> *math-camera* giftex))
(let ((v1-13 255))
(.mov vf6 v1-13)
)
;; og:preserve-this
;; (.mov v1-14 vf6)
(.itof.vf vf6 vf6)
(.svf (&-> *transform-regs* vf7) vf7)
(.svf (&-> *transform-regs* vf8) vf8)
(.svf (&-> *transform-regs* vf9) vf9)
(.svf (&-> *transform-regs* vf6) vf6)
(set! (-> *transform-regs* vf1) (-> s5-0 rvec quad))
(set! (-> *transform-regs* vf2) (-> s5-0 uvec quad))
(set! (-> *transform-regs* vf3) (-> s5-0 fvec quad))
(set! (-> *transform-regs* vf4) (-> s5-0 trans quad))
(set! (-> *transform-regs* vf17) (-> gp-0 rvec quad))
(set! (-> *transform-regs* vf18) (-> gp-0 uvec quad))
(set! (-> *transform-regs* vf19) (-> gp-0 fvec quad))
(set! (-> *transform-regs* vf23) (-> s2-0 quad 0))
(set! (-> *transform-regs* vf24) (-> s2-0 quad 1))
(set! (-> *transform-regs* vf25) (-> s2-0 quad 2))
(set! (-> *transform-regs* vf27) (-> s4-0 quad 0))
(set! (-> *transform-regs* vf28) (-> s4-0 quad 1))
(set! (-> *transform-regs* vf29) (-> s4-0 quad 2))
(set! (-> *transform-regs* vf26) (-> s3-0 quad))
;; (.lvf vf1 (&-> s5-0 rvec quad))
;; (.lvf vf2 (&-> s5-0 uvec quad))
;; (.lvf vf3 (&-> s5-0 fvec quad))
;; (.lvf vf4 (&-> s5-0 trans quad))
;; (.lvf vf17 (&-> gp-0 rvec quad))
;; (.lvf vf18 (&-> gp-0 uvec quad))
;; (.lvf vf19 (&-> gp-0 fvec quad))
;; (.lvf vf23 (&-> s2-0 quad 0))
;; (.lvf vf24 (&-> s2-0 quad 1))
;; (.lvf vf25 (&-> s2-0 quad 2))
;; (.lvf vf27 (&-> s4-0 quad 0))
;; (.lvf vf28 (&-> s4-0 quad 1))
;; (.lvf vf29 (&-> s4-0 quad 2))
;; (.lvf vf26 (&-> s3-0 quad))
)
(none)
)
)
File diff suppressed because it is too large Load Diff
+637
View File
@@ -8,12 +8,607 @@
;; +++tpage-category
(defenum tpage-category
:type int8
(tpage-cat0 0)
(tpage-cat1 1)
(tpage-cat2 2)
(tpage-cat3 3)
(tpage-cat4 4)
(tpage-cat5 5)
(tpage-cat6 6)
(tpage-cat7 7)
(tpage-cat8 8)
(sky 9)
(tpage-cat10 10)
)
;; ---tpage-category
;; +++bucket-id
(defenum bucket-id
:type int32
(bucket0 0)
(bucket1 1)
(bucket2 2)
(bucket3 3)
(tex-lcom-sky-pre 4)
(bucket5 5)
(bucket6 6)
(bucket7 7)
(bucket8 8)
(bucket9 9)
(bucket10 10)
(bucket11 11)
(bucket12 12)
(bucket13 13)
(bucket14 14)
(bucket15 15)
(bucket16 16)
(bucket17 17)
(bucket18 18)
(bucket19 19)
(bucket20 20)
(bucket21 21)
(bucket22 22)
(bucket23 23)
(bucket24 24)
(bucket25 25)
(bucket26 26)
(bucket27 27)
(bucket28 28)
(bucket29 29)
(bucket30 30)
(bucket31 31)
(bucket32 32)
(bucket33 33)
(bucket34 34)
(bucket35 35)
(bucket36 36)
(bucket37 37)
(bucket38 38)
(bucket39 39)
(bucket40 40)
(bucket41 41)
(bucket42 42)
(bucket43 43)
(bucket44 44)
(bucket45 45)
(bucket46 46)
(bucket47 47)
(bucket48 48)
(bucket49 49)
(bucket50 50)
(bucket51 51)
(bucket52 52)
(bucket53 53)
(bucket54 54)
(bucket55 55)
(bucket56 56)
(bucket57 57)
(bucket58 58)
(bucket59 59)
(bucket60 60)
(bucket61 61)
(bucket62 62)
(bucket63 63)
(bucket64 64)
(bucket65 65)
(bucket66 66)
(bucket67 67)
(bucket68 68)
(bucket69 69)
(bucket70 70)
(bucket71 71)
(bucket72 72)
(bucket73 73)
(bucket74 74)
(bucket75 75)
(bucket76 76)
(bucket77 77)
(bucket78 78)
(bucket79 79)
(bucket80 80)
(bucket81 81)
(bucket82 82)
(bucket83 83)
(bucket84 84)
(bucket85 85)
(bucket86 86)
(bucket87 87)
(bucket88 88)
(bucket89 89)
(bucket90 90)
(bucket91 91)
(bucket92 92)
(bucket93 93)
(bucket94 94)
(bucket95 95)
(bucket96 96)
(bucket97 97)
(bucket98 98)
(bucket99 99)
(bucket100 100)
(bucket101 101)
(bucket102 102)
(bucket103 103)
(bucket104 104)
(bucket105 105)
(bucket106 106)
(bucket107 107)
(bucket108 108)
(bucket109 109)
(bucket110 110)
(bucket111 111)
(bucket112 112)
(bucket113 113)
(bucket114 114)
(bucket115 115)
(bucket116 116)
(bucket117 117)
(bucket118 118)
(bucket119 119)
(bucket120 120)
(bucket121 121)
(bucket122 122)
(bucket123 123)
(bucket124 124)
(bucket125 125)
(bucket126 126)
(bucket127 127)
(bucket128 128)
(bucket129 129)
(bucket130 130)
(bucket131 131)
(bucket132 132)
(bucket133 133)
(bucket134 134)
(bucket135 135)
(bucket136 136)
(bucket137 137)
(bucket138 138)
(bucket139 139)
(bucket140 140)
(bucket141 141)
(bucket142 142)
(bucket143 143)
(bucket144 144)
(bucket145 145)
(bucket146 146)
(bucket147 147)
(bucket148 148)
(bucket149 149)
(bucket150 150)
(bucket151 151)
(bucket152 152)
(bucket153 153)
(bucket154 154)
(bucket155 155)
(bucket156 156)
(bucket157 157)
(bucket158 158)
(bucket159 159)
(bucket160 160)
(bucket161 161)
(bucket162 162)
(bucket163 163)
(bucket164 164)
(bucket165 165)
(bucket166 166)
(bucket167 167)
(bucket168 168)
(bucket169 169)
(bucket170 170)
(bucket171 171)
(bucket172 172)
(bucket173 173)
(bucket174 174)
(bucket175 175)
(bucket176 176)
(bucket177 177)
(bucket178 178)
(bucket179 179)
(bucket180 180)
(bucket181 181)
(bucket182 182)
(bucket183 183)
(bucket184 184)
(bucket185 185)
(bucket186 186)
(bucket187 187)
(bucket188 188)
(bucket189 189)
(bucket190 190)
(bucket191 191)
(bucket192 192)
(bucket193 193)
(bucket194 194)
(bucket195 195)
(bucket196 196)
(bucket197 197)
(bucket198 198)
(bucket199 199)
(bucket200 200)
(bucket201 201)
(bucket202 202)
(bucket203 203)
(bucket204 204)
(bucket205 205)
(bucket206 206)
(bucket207 207)
(bucket208 208)
(bucket209 209)
(bucket210 210)
(bucket211 211)
(bucket212 212)
(bucket213 213)
(bucket214 214)
(bucket215 215)
(bucket216 216)
(bucket217 217)
(bucket218 218)
(bucket219 219)
(bucket220 220)
(bucket221 221)
(bucket222 222)
(bucket223 223)
(bucket224 224)
(bucket225 225)
(bucket226 226)
(bucket227 227)
(bucket228 228)
(bucket229 229)
(bucket230 230)
(bucket231 231)
(bucket232 232)
(bucket233 233)
(bucket234 234)
(bucket235 235)
(bucket236 236)
(bucket237 237)
(bucket238 238)
(bucket239 239)
(bucket240 240)
(bucket241 241)
(bucket242 242)
(bucket243 243)
(bucket244 244)
(bucket245 245)
(bucket246 246)
(bucket247 247)
(bucket248 248)
(bucket249 249)
(bucket250 250)
(bucket251 251)
(bucket252 252)
(bucket253 253)
(bucket254 254)
(bucket255 255)
(bucket256 256)
(bucket257 257)
(bucket258 258)
(bucket259 259)
(bucket260 260)
(bucket261 261)
(bucket262 262)
(bucket263 263)
(bucket264 264)
(bucket265 265)
(bucket266 266)
(bucket267 267)
(bucket268 268)
(bucket269 269)
(bucket270 270)
(bucket271 271)
(bucket272 272)
(bucket273 273)
(bucket274 274)
(bucket275 275)
(bucket276 276)
(bucket277 277)
(bucket278 278)
(bucket279 279)
(bucket280 280)
(bucket281 281)
(bucket282 282)
(bucket283 283)
(bucket284 284)
(bucket285 285)
(bucket286 286)
(bucket287 287)
(bucket288 288)
(bucket289 289)
(bucket290 290)
(bucket291 291)
(bucket292 292)
(bucket293 293)
(bucket294 294)
(bucket295 295)
(bucket296 296)
(bucket297 297)
(bucket298 298)
(bucket299 299)
(bucket300 300)
(bucket301 301)
(bucket302 302)
(bucket303 303)
(bucket304 304)
(bucket305 305)
(bucket306 306)
(bucket307 307)
(bucket308 308)
(bucket309 309)
(bucket310 310)
(bucket311 311)
(bucket312 312)
(bucket313 313)
(bucket314 314)
(bucket315 315)
(bucket316 316)
(bucket317 317)
(bucket318 318)
(bucket319 319)
(bucket320 320)
(bucket321 321)
(bucket322 322)
(bucket323 323)
(bucket324 324)
(bucket325 325)
(bucket326 326)
(bucket327 327)
(bucket328 328)
(bucket329 329)
(bucket330 330)
(bucket331 331)
(bucket332 332)
(bucket333 333)
(bucket334 334)
(bucket335 335)
(bucket336 336)
(bucket337 337)
(bucket338 338)
(bucket339 339)
(bucket340 340)
(bucket341 341)
(bucket342 342)
(bucket343 343)
(bucket344 344)
(bucket345 345)
(bucket346 346)
(bucket347 347)
(bucket348 348)
(bucket349 349)
(bucket350 350)
(bucket351 351)
(bucket352 352)
(bucket353 353)
(bucket354 354)
(bucket355 355)
(bucket356 356)
(bucket357 357)
(bucket358 358)
(bucket359 359)
(bucket360 360)
(bucket361 361)
(bucket362 362)
(bucket363 363)
(bucket364 364)
(bucket365 365)
(bucket366 366)
(bucket367 367)
(bucket368 368)
(bucket369 369)
(bucket370 370)
(bucket371 371)
(bucket372 372)
(bucket373 373)
(bucket374 374)
(bucket375 375)
(bucket376 376)
(bucket377 377)
(bucket378 378)
(bucket379 379)
(bucket380 380)
(bucket381 381)
(bucket382 382)
(bucket383 383)
(bucket384 384)
(bucket385 385)
(bucket386 386)
(bucket387 387)
(bucket388 388)
(bucket389 389)
(bucket390 390)
(bucket391 391)
(bucket392 392)
(bucket393 393)
(bucket394 394)
(bucket395 395)
(bucket396 396)
(bucket397 397)
(bucket398 398)
(bucket399 399)
(bucket400 400)
(bucket401 401)
(bucket402 402)
(bucket403 403)
(bucket404 404)
(bucket405 405)
(bucket406 406)
(bucket407 407)
(bucket408 408)
(bucket409 409)
(bucket410 410)
(bucket411 411)
(bucket412 412)
(bucket413 413)
(bucket414 414)
(bucket415 415)
(bucket416 416)
(bucket417 417)
(bucket418 418)
(bucket419 419)
(bucket420 420)
(bucket421 421)
(bucket422 422)
(bucket423 423)
(bucket424 424)
(bucket425 425)
(bucket426 426)
(bucket427 427)
(bucket428 428)
(bucket429 429)
(bucket430 430)
(bucket431 431)
(bucket432 432)
(bucket433 433)
(bucket434 434)
(bucket435 435)
(bucket436 436)
(bucket437 437)
(bucket438 438)
(bucket439 439)
(bucket440 440)
(bucket441 441)
(bucket442 442)
(bucket443 443)
(bucket444 444)
(bucket445 445)
(bucket446 446)
(bucket447 447)
(bucket448 448)
(bucket449 449)
(bucket450 450)
(bucket451 451)
(bucket452 452)
(bucket453 453)
(bucket454 454)
(bucket455 455)
(bucket456 456)
(bucket457 457)
(bucket458 458)
(bucket459 459)
(bucket460 460)
(bucket461 461)
(bucket462 462)
(bucket463 463)
(bucket464 464)
(bucket465 465)
(bucket466 466)
(bucket467 467)
(bucket468 468)
(bucket469 469)
(bucket470 470)
(bucket471 471)
(bucket472 472)
(bucket473 473)
(bucket474 474)
(bucket475 475)
(bucket476 476)
(bucket477 477)
(bucket478 478)
(bucket479 479)
(bucket480 480)
(bucket481 481)
(bucket482 482)
(bucket483 483)
(bucket484 484)
(bucket485 485)
(bucket486 486)
(bucket487 487)
(bucket488 488)
(bucket489 489)
(bucket490 490)
(bucket491 491)
(bucket492 492)
(bucket493 493)
(bucket494 494)
(bucket495 495)
(bucket496 496)
(bucket497 497)
(bucket498 498)
(bucket499 499)
(bucket500 500)
(bucket501 501)
(bucket502 502)
(bucket503 503)
(bucket504 504)
(bucket505 505)
(bucket506 506)
(bucket507 507)
(bucket508 508)
(bucket509 509)
(bucket510 510)
(bucket511 511)
(bucket512 512)
(bucket513 513)
(bucket514 514)
(bucket515 515)
(bucket516 516)
(bucket517 517)
(bucket518 518)
(bucket519 519)
(bucket520 520)
(bucket521 521)
(bucket522 522)
(bucket523 523)
(bucket524 524)
(bucket525 525)
(bucket526 526)
(bucket527 527)
(bucket528 528)
(bucket529 529)
(bucket530 530)
(bucket531 531)
(bucket532 532)
(bucket533 533)
(bucket534 534)
(bucket535 535)
(bucket536 536)
(bucket537 537)
(bucket538 538)
(bucket539 539)
(bucket540 540)
(bucket541 541)
(bucket542 542)
(bucket543 543)
(bucket544 544)
(bucket545 545)
(bucket546 546)
(bucket547 547)
(bucket548 548)
(bucket549 549)
(bucket550 550)
(bucket551 551)
(bucket552 552)
(bucket553 553)
(bucket554 554)
(bucket555 555)
(bucket556 556)
(bucket557 557)
(bucket558 558)
(bucket559 559)
(bucket560 560)
(bucket561 561)
(bucket562 562)
(bucket563 563)
(bucket564 564)
(bucket565 565)
(bucket566 566)
(bucket567 567)
(bucket568 568)
(bucket569 569)
(bucket570 570)
(bucket571 571)
(bucket572 572)
(bucket573 573)
(bucket574 574)
(bucket575 575)
(bucket576 576)
(bucket577 577)
(bucket578 578)
(bucket579 579)
(bucket580 580)
(bucket581 581)
(bucket582 582)
(bucket583 583)
(debug-no-zbuf2 584)
)
;; ---bucket-id
@@ -64,6 +659,48 @@
)
;; ---vu1-renderer-mask
;; +++tpage-category-u32
(defenum tpage-category-u32
:type uint32
:copy-entries tpage-category
)
;; ---tpage-category-u32
;; +++texture-enable-mask
(defenum texture-enable-mask
:type uint64
:bitfield #t
(tex0 0)
(tex1 1)
(tex2 2)
(tex3 3)
(tex4 4)
(tex5 5)
(tex6 6)
(tex7 7)
(sky 8)
(tex9 9)
(tex10 10)
(tex11 11)
(tex12 12)
(tex13 13)
(tex14 14)
(tex15 15)
(tex16 16)
)
;; ---texture-enable-mask
;; +++texture-enable-mask-u32
(defenum texture-enable-mask-u32
:type uint32
:bitfield #t
:copy-entries texture-enable-mask
)
;; ---texture-enable-mask-u32
;; DECOMP BEGINS
(deftype dma-foreground-sink (basic)
+108
View File
@@ -5,5 +5,113 @@
;; name in dgo: level-h
;; dgos: GAME
;; +++vis-info-flag
(defenum vis-info-flag
:type uint32
:bitfield #t
(dummy0 0)
(dummy1 1)
(dummy2 2)
(dummy3 3)
(dummy4 4)
(dummy5 5)
(dummy6 6)
(dummy7 7)
(dummy8 8)
(dummy9 9)
(dummy10 10)
(dummy11 11)
(dummy12 12)
(dummy13 13)
(dummy14 14)
(dummy15 15)
(dummy16 16)
(dummy17 17)
(dummy18 18)
(dummy19 19)
(dummy20 20)
(dummy21 21)
(dummy22 22)
(dummy23 23)
(dummy24 24)
(dummy25 25)
(dummy26 26)
(dummy27 27)
(dummy28 28)
(in-iop 29)
(loading 30)
(vis-valid 31)
)
;; ---vis-info-flag
;; +++load-buffer-mode
(defenum load-buffer-mode
:type uint32
(small-edge 0)
(small-center 1)
(medium 2)
(large 3)
(borrow 4)
(ten 10)
)
;; ---load-buffer-mode
;; +++task-mask
(defenum task-mask
:type uint32
:bitfield #t
(task0 0)
(task1 1)
(task2 2)
(task3 3)
(task4 4)
(task5 5)
(task6 6)
(task7 7)
(done 8)
(dummy0 9)
(dummy1 10)
(vehicle 11)
(special 12)
(primary0 13)
(ctywide 14)
(never 15)
(movie0 16)
(movie1 17)
(movie2 18)
)
;; ---task-mask
;; +++bigmap-id
(defenum bigmap-id
:type uint32
(bigmap-id-0 0)
(bigmap-id-1 1)
(bigmap-id-2 2)
(bigmap-id-3 3)
(bigmap-id-4 4)
(bigmap-id-5 5)
(bigmap-id-6 6)
(bigmap-id-7 7)
(bigmap-id-8 8)
(bigmap-id-9 9)
(bigmap-id-10 10)
(bigmap-id-11 11)
(bigmap-id-12 12)
(bigmap-id-13 13)
(bigmap-id-14 14)
(bigmap-id-15 15)
(bigmap-id-16 16)
(bigmap-id-17 17)
(bigmap-id-18 18)
(bigmap-id-19 19)
(bigmap-id-20 20)
)
;; ---bigmap-id
;; DECOMP BEGINS
+195
View File
@@ -5,5 +5,200 @@
;; name in dgo: loader-h
;; dgos: GAME
(declare-type spool-anim basic)
(declare-type art-joint-anim art-element)
(declare-type external-art-buffer basic)
(declare-type process-drawable process)
(define-extern external-art-buffer-init (function external-art-buffer int))
(define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable))
(declare-type art basic)
(declare-type art-group art)
(define-extern *stack-top* pointer)
;; DECOMP BEGINS
(deftype load-dir (basic)
"`load-dir` is an array of references to loaded things.
It's used to handle art groups that are loaded as part of a level load."
((lev level)
(string-array (array string))
(data-array (array basic))
)
(:methods
(new (symbol type int level) _type_)
(load-to-heap-by-name (_type_ string symbol kheap int) art-group)
(set-loaded-art (_type_ art-group) art-group)
)
)
(deftype load-dir-art-group (load-dir)
"Specialization of load-dir for `art-group`s."
((art-group-array (array art-group) :overlay-at data-array)
)
(:methods
(new (symbol type int level) _type_)
)
)
(defmethod new load-dir ((allocation symbol) (type-to-make type) (arg0 int) (arg1 level))
(let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> s4-0 lev) arg1)
(set! (-> s4-0 string-array)
(the-as (array string) ((method-of-type array new) allocation array string arg0))
)
(set! (-> s4-0 string-array length) 0)
(set! (-> s4-0 data-array) (the-as (array basic) ((method-of-type array new) allocation array basic arg0)))
(set! (-> s4-0 data-array length) 0)
s4-0
)
)
;; WARN: Return type mismatch load-dir vs load-dir-art-group.
(defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (arg0 int) (arg1 level))
(let ((v0-0 ((method-of-type load-dir new) allocation type-to-make arg0 arg1)))
(set! (-> v0-0 data-array content-type) art-group)
(the-as load-dir-art-group v0-0)
)
)
(deftype external-art-buffer (basic)
"An `external-art-buffer` is a buffer that streamed files use."
((index int32)
(other external-art-buffer)
(status symbol)
(locked? symbol)
(login? symbol)
(frame-lock symbol)
(init-heap (function external-art-buffer object))
(heap kheap :inline)
(pending-load-file string)
(pending-load-file-part int32)
(pending-load-file-owner handle)
(pending-load-file-priority float)
(load-file string)
(load-file-part int32)
(load-file-owner handle)
(load-file-priority float)
(buf pointer)
(len int32)
(art-group art-group)
(art-data uint32 :overlay-at art-group)
)
(:methods
(new (symbol type int function symbol) _type_)
(set-pending-file (_type_ string int handle float) int)
(update (_type_) int)
(inactive? (_type_) symbol)
(file-status (_type_ string int) symbol)
(link-file (_type_ art-group) art-group)
(unlink-file (_type_ art-group) int)
(unlock! (_type_) int)
)
)
(defmethod new external-art-buffer ((allocation symbol) (type-to-make type) (arg0 int) (arg1 function) (arg2 symbol))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> v0-0 index) arg0)
(set! (-> v0-0 init-heap) (the-as (function external-art-buffer object) arg1))
(set! (-> v0-0 login?) arg2)
(set! (-> v0-0 load-file) #f)
(set! (-> v0-0 load-file-part) -1)
(set! (-> v0-0 load-file-owner) (the-as handle #f))
(set! (-> v0-0 load-file-priority) 100000000.0)
(set! (-> v0-0 pending-load-file) #f)
(set! (-> v0-0 pending-load-file-part) -1)
(set! (-> v0-0 pending-load-file-owner) (the-as handle #f))
(set! (-> v0-0 pending-load-file-priority) 100000000.0)
(set! (-> v0-0 art-group) #f)
(set! (-> v0-0 status) 'initialize)
(set! (-> v0-0 locked?) #f)
(set! (-> v0-0 other) #f)
v0-0
)
)
(deftype spool-anim (basic)
"A `spool-anim` is metadata for an animation that will be loaded in chunks
to a pair of external-art-buffers."
((name string :offset 16)
(anim-name string)
(buffer external-art-buffer :overlay-at anim-name)
(parts int32)
(hint-id int32 :overlay-at parts)
(priority float)
(owner handle)
(command-list pair)
)
)
(deftype external-art-control (basic)
"The `external-art-control` manages loading chunks from `spool-anim`s to `external-art-buffer`."
((buffer external-art-buffer 2)
(rec spool-anim 3 :inline)
(spool-lock handle)
(reserve-buffer external-art-buffer)
(reserve-buffer-count int16)
(dma-reserve-buffer-count int16)
(active-stream string)
(queue-stream (array spool-anim))
(frame-mask uint32)
(dma-reserve-heap kheap :inline)
)
(:methods
(new (symbol type) _type_)
(update (_type_ symbol) int)
(clear-rec (_type_) int)
(spool-push (_type_ string int process float) int)
(file-status (_type_ string int) symbol)
(reserve-alloc (_type_) kheap)
(reserve-free (_type_ kheap) int)
(none-reserved? (_type_) symbol)
)
)
(defmethod new external-art-control ((allocation symbol) (type-to-make type))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(dotimes (s4-0 2)
(set! (-> gp-0 buffer s4-0)
((method-of-type external-art-buffer new) allocation external-art-buffer s4-0 external-art-buffer-init #t)
)
)
(set! (-> gp-0 buffer 0 other) (-> gp-0 buffer 1))
(set! (-> gp-0 buffer 1 other) (-> gp-0 buffer 0))
(dotimes (v1-9 3)
(set! (-> gp-0 rec v1-9 name) #f)
(set! (-> gp-0 rec v1-9 priority) 100000000.0)
(set! (-> gp-0 rec v1-9 owner) (the-as handle #f))
)
(set! (-> gp-0 spool-lock) (the-as handle #f))
(set! (-> gp-0 reserve-buffer) #f)
(set! (-> gp-0 active-stream) #f)
(set! (-> gp-0 queue-stream) (new 'global 'boxed-array spool-anim 4))
(dotimes (s5-1 (-> gp-0 queue-stream allocated-length))
(set! (-> gp-0 queue-stream s5-1) (new 'global 'spool-anim))
)
(set! (-> gp-0 queue-stream length) 0)
gp-0
)
)
(deftype subtitle-range (basic)
((start-frame float)
(end-frame float)
(message basic 12)
)
)
(deftype subtitle-image (basic)
((width uint16)
(height uint16)
(palette rgba 16 :offset 16)
(data uint8 :dynamic)
)
)
(define-extern *art-control* external-art-control)
+41
View File
@@ -7,3 +7,44 @@
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(deftype gs-store-image-packet (structure)
((vifcode vif-tag 4)
(giftag uint128)
(bitbltbuf uint64)
(bitbltbuf-addr uint64)
(trxpos uint64)
(trxpos-addr uint64)
(trxreg uint64)
(trxreg-addr uint64)
(finish uint64)
(finish-addr uint64)
(trxdir uint64)
(trxdir-addr uint64)
)
)
(deftype screen-shot-work (structure)
((count int16)
(size int16)
(name string)
(highres-enable symbol)
(hud-enable symbol)
)
)
(define *screen-shot-work* (new 'global 'screen-shot-work))
(set! (-> *screen-shot-work* count) -1)
(set! (-> *screen-shot-work* size) -1)
(set! (-> *screen-shot-work* highres-enable) #f)
(set! (-> *screen-shot-work* hud-enable) #f)
(define *image-name* (new 'global 'string 32 (the-as string #f)))
+3 -1
View File
@@ -27,16 +27,18 @@
(defenum language-enum
:type int64
:type uint8
(english 0)
(french 1)
(german 2)
(spanish 3)
(italian 4)
(commentary 5)
(japanese 6)
(korean 7)
(russian 8)
(portuguese 9)
(dutch 10)
(uk-english 11)
)
+856
View File
@@ -0,0 +1,856 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type connectable
(deftype connectable (structure)
((next0 connectable)
(prev0 connectable)
(next1 connectable)
(prev1 connectable)
)
)
;; definition for method 3 of type connectable
(defmethod inspect ((this connectable))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'connectable)
(format #t "~1Tnext0: ~`connectable`P~%" (-> this next0))
(format #t "~1Tprev0: ~`connectable`P~%" (-> this prev0))
(format #t "~1Tnext1: ~`connectable`P~%" (-> this next1))
(format #t "~1Tprev1: ~`connectable`P~%" (-> this prev1))
(label cfg-4)
this
)
;; definition of type connection
(deftype connection (connectable)
"This is the actual data for the connection.
It may be used in multiple ways, but the most common is to use `param0` as a function.
It receives `param1`, `param2`, `param3`, and the engine as the arguments.
In some cases, the return value is checked for `'dead`."
((param0 basic)
(param1 basic)
(param2 int32)
(param3 int32)
(quad uint128 2 :overlay-at next0)
)
(:methods
(get-engine (connection) engine)
(get-process (connection) process)
(belongs-to-engine? (connection engine) symbol)
(belongs-to-process? (connection process) symbol)
(move-to-dead (connection) connection)
)
)
;; definition for method 3 of type connection
(defmethod inspect ((this connection))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'connection)
(format #t "~1Tnext0: ~`connectable`P~%" (-> this next0))
(format #t "~1Tprev0: ~`connectable`P~%" (-> this prev0))
(format #t "~1Tnext1: ~`connectable`P~%" (-> this next1))
(format #t "~1Tprev1: ~`connectable`P~%" (-> this prev1))
(format #t "~1Tparam0: ~A~%" (-> this param0))
(format #t "~1Tparam1: ~A~%" (-> this param1))
(format #t "~1Tparam2: ~A~%" (-> this param2))
(format #t "~1Tparam3: ~A~%" (-> this param3))
(format #t "~1Tquad[2] @ #x~X~%" (&-> this next0))
(label cfg-4)
this
)
;; definition of type engine
(deftype engine (basic)
"An engine is a collection of connections.
You can iterate over the connections, or run them.
The engine is dynamically sized based on how many connections it can store.
New for Jak 2: You can use a child class of [[connection]]."
((name symbol)
(engine-time time-frame :offset 16)
(allocated-length int16 :offset 10)
(length int16 :offset 8)
(element-type type :offset 12)
(alive-list connectable :inline)
(alive-list-end connectable :inline)
(dead-list connectable :inline)
(dead-list-end connectable :inline)
(data connection :inline :dynamic)
)
(:methods
(new (symbol type symbol int type) _type_)
(inspect-all-connections (engine) engine)
(apply-to-connections (engine (function connectable none)) int)
(apply-to-connections-reverse (engine (function connectable none)) int)
(execute-connections (engine object) int)
(execute-connections-and-move-to-dead (engine object) int)
(execute-connections-if-needed (engine object) int)
(add-connection (engine process object object object object) connection)
(remove-from-process (engine process) int)
(remove-matching (engine (function connection engine symbol)) int)
(remove-all (engine) int)
(remove-by-param0 (engine object) int)
(remove-by-param1 (engine int) int)
(remove-by-param2 (engine int) int)
(get-first-connectable (engine) connectable)
(get-last-connectable (engine) connectable)
(get-next-connectable (_type_ connectable) connectable)
(get-prev-connectable (_type_ connectable) connectable)
)
)
;; definition for method 12 of type connection
(defmethod belongs-to-process? ((this connection) (arg0 process))
"Does this connection belong to the given process?"
(= arg0 (get-process this))
)
;; definition for method 2 of type connection
(defmethod print ((this connection))
(format
#t
"#<connection (~A ~A ~A ~A) @ #x~X>"
(-> this param0)
(-> this param1)
(-> this param2)
(-> this param3)
this
)
this
)
;; definition for method 9 of type connection
;; WARN: Return type mismatch pointer vs engine.
(defmethod get-engine ((this connection))
"Get the engine for this connection. This must be used on a live connection."
(while (-> (the-as connectable this) prev0)
(nop!)
(nop!)
(set! this (the-as connection (-> (the-as connectable this) prev0)))
)
(the-as engine (&+ (the-as pointer this) -28))
)
;; definition for method 10 of type connection
;; WARN: Return type mismatch pointer vs process.
(defmethod get-process ((this connection))
"Get the process for this connection."
(while (-> (the-as connectable this) prev1)
(nop!)
(nop!)
(set! this (the-as connection (-> (the-as connectable this) prev1)))
)
(the-as process (&+ (the-as pointer this) -108))
)
;; definition for method 11 of type connection
(defmethod belongs-to-engine? ((this connection) (arg0 engine))
"Check to see if this connection is located in the data section of the engine.
This works on dead or alive connections."
(and (< (the-as int arg0) (the-as int this))
(< (the-as int this) (the-as int (&+
(&+ (the-as pointer arg0) (-> arg0 type size))
(* (-> arg0 allocated-length) (the-as int (-> arg0 element-type size)))
)
)
)
)
)
;; definition for method 22 of type engine
(defmethod get-first-connectable ((this engine))
(-> this alive-list next0)
)
;; definition for method 23 of type engine
(defmethod get-last-connectable ((this engine))
(-> this alive-list-end)
)
;; definition for method 24 of type engine
(defmethod get-next-connectable ((this engine) (arg0 connectable))
(-> arg0 next0)
)
;; definition for method 25 of type engine
(defmethod get-prev-connectable ((this engine) (arg0 connectable))
(-> arg0 prev0)
)
;; definition for method 0 of type engine
(defmethod new engine ((allocation symbol) (type-to-make type) (arg0 symbol) (arg1 int) (arg2 type))
(let ((v0-0
(object-new
allocation
type-to-make
(the-as int (+ (-> type-to-make size) (* (the-as uint arg1) (-> arg2 size))))
)
)
)
(set! (-> v0-0 allocated-length) arg1)
(set! (-> v0-0 length) 0)
(set! (-> v0-0 name) arg0)
(set! (-> v0-0 element-type) arg2)
(set! (-> v0-0 alive-list next0) (-> v0-0 alive-list-end))
(set! (-> v0-0 alive-list prev0) #f)
(set! (-> v0-0 alive-list next1) #f)
(set! (-> v0-0 alive-list prev1) #f)
(set! (-> v0-0 alive-list-end next0) #f)
(set! (-> v0-0 alive-list-end prev0) (-> v0-0 alive-list))
(set! (-> v0-0 alive-list-end next1) #f)
(set! (-> v0-0 alive-list-end prev1) #f)
(set! (-> v0-0 dead-list next0) (the-as connectable (-> v0-0 data)))
(set! (-> v0-0 dead-list prev0) #f)
(set! (-> v0-0 dead-list next1) #f)
(set! (-> v0-0 dead-list prev1) #f)
(set! (-> v0-0 dead-list-end next0) #f)
(set! (-> v0-0 dead-list-end prev0)
(the-as connectable (+ (+ (* (the-as uint (+ arg1 -1)) (-> arg2 size)) 92) (the-as uint v0-0)))
)
(set! (-> v0-0 dead-list-end next1) #f)
(set! (-> v0-0 dead-list-end prev1) #f)
(let ((v1-9 (the-as object (-> v0-0 data))))
(set! (-> v0-0 data 0 prev0) (-> v0-0 dead-list))
(set! (-> v0-0 data 0 next0) (the-as connectable (&+ (the-as pointer v1-9) (-> arg2 size))))
(let ((v1-10 (the-as object (&+ (the-as pointer v1-9) (-> arg2 size)))))
(let ((a0-6 1)
(a1-3 (+ arg1 -2))
)
(while (>= a1-3 a0-6)
(set! (-> (the-as connectable v1-10) prev0)
(the-as connectable (&- (the-as pointer v1-10) (the-as uint (-> arg2 size))))
)
(set! (-> (the-as (pointer int32) v1-10)) (&+ (the-as pointer v1-10) (-> arg2 size)))
(set! v1-10 (&+ (the-as pointer v1-10) (-> arg2 size)))
(+! a0-6 1)
)
)
(set! (-> (the-as connectable v1-10) prev0)
(the-as connectable (&- (the-as pointer v1-10) (the-as uint (-> arg2 size))))
)
(set! (-> (the-as (pointer int32) v1-10)) (-> v0-0 dead-list-end))
)
)
v0-0
)
)
;; definition for method 2 of type engine
(defmethod print ((this engine))
(format #t "#<~A ~A @ #x~X>" (-> this type) (-> this name) this)
this
)
;; definition for method 3 of type engine
(defmethod inspect ((this engine))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tname: ~A~%" (-> this name))
(format #t "~Tengine-time: ~D~%" (-> this engine-time))
(format #t "~Tallocated-length: ~D~%" (-> this allocated-length))
(format #t "~Tlength: ~D~%" (-> this length))
(format #t "~Telement-type: ~A~%" (-> this element-type))
(format #t "~Talive-list:~%")
(let ((s5-0 *print-column*))
(set! *print-column* (+ *print-column* 64))
(inspect (-> this alive-list))
(set! *print-column* s5-0)
)
(format #t "~Talive-list-end:~%")
(let ((s5-1 *print-column*))
(set! *print-column* (+ *print-column* 64))
(inspect (-> this alive-list-end))
(set! *print-column* s5-1)
)
(format #t "~Tdead-list:~%")
(let ((s5-2 *print-column*))
(set! *print-column* (+ *print-column* 64))
(inspect (-> this dead-list))
(set! *print-column* s5-2)
)
(format #t "~Tdead-list-end:~%")
(let ((s5-3 *print-column*))
(set! *print-column* (+ *print-column* 64))
(inspect (-> this dead-list-end))
(set! *print-column* s5-3)
)
(format #t "~Tdata[~D]: @ #x~X~%" (-> this allocated-length) (-> this data))
this
)
;; definition for method 4 of type engine
(defmethod length ((this engine))
(-> this length)
)
;; definition for method 5 of type engine
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this engine))
(the-as int (+ (-> this type size) (* (-> this allocated-length) (the-as int (-> this element-type size)))))
)
;; definition for method 10 of type engine
(defmethod apply-to-connections ((this engine) (arg0 (function connectable none)))
"Apply arg0 to all connections for the engine.
It's okay to have arg0 remove the connection."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(arg0 a0-1)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
;; definition for method 11 of type engine
(defmethod apply-to-connections-reverse ((this engine) (arg0 (function connectable none)))
"Apply arg0 to all connections, reverse order.
Do not use arg0 to remove yourself from the list."
(let ((s4-0 (-> this alive-list-end prev0)))
(while (!= s4-0 (-> this alive-list))
(arg0 s4-0)
(set! s4-0 (-> s4-0 prev0))
)
)
0
)
;; definition for method 12 of type engine
(defmethod execute-connections ((this engine) (arg0 object))
"Run the engine!"
(set! (-> this engine-time) (-> *display* real-clock frame-counter))
(let ((s4-0 (the-as connection (-> this alive-list-end prev0))))
(while (!= s4-0 (-> this alive-list))
((the-as (function object object object object object) (-> s4-0 param0))
(-> s4-0 param1)
(-> s4-0 param2)
(-> s4-0 param3)
arg0
)
(set! s4-0 (the-as connection (-> s4-0 prev0)))
)
)
0
)
;; definition for method 13 of type engine
(defmethod execute-connections-and-move-to-dead ((this engine) (arg0 object))
"Run the engine! If any objects return `'dead`, remove them."
(set! (-> this engine-time) (-> *display* real-clock frame-counter))
(let ((s4-0 (the-as connection (-> this alive-list-end prev0))))
(while (!= s4-0 (-> this alive-list))
(let ((v1-3 ((the-as (function object object object object object) (-> s4-0 param0))
(-> s4-0 param1)
(-> s4-0 param2)
(-> s4-0 param3)
arg0
)
)
)
(set! s4-0 (the-as connection (-> s4-0 prev0)))
(if (= v1-3 'dead)
((method-of-type connection move-to-dead) (the-as connection (-> s4-0 next0)))
)
)
)
)
0
)
;; definition for method 14 of type engine
(defmethod execute-connections-if-needed ((this engine) (arg0 object))
"Execute connections, but only if it hasn't been done on this frame."
(if (!= (-> *display* real-clock frame-counter) (-> this engine-time))
(execute-connections this arg0)
)
0
)
;; definition for function connection-process-apply
(defun connection-process-apply ((arg0 process) (arg1 (function object none)))
"Apply a function to all connectables of a process."
(when arg0
(let ((s5-0 (-> arg0 connection-list next1)))
(while s5-0
(arg1 s5-0)
(set! s5-0 (-> s5-0 next1))
)
)
#f
)
)
;; definition for method 9 of type engine
(defmethod inspect-all-connections ((this engine))
"inspect all of the connections."
(let ((gp-0 *kernel-symbol-warnings*))
(set! *kernel-symbol-warnings* #f)
(let* ((s4-0 (-> this alive-list next0))
(s3-0 (-> s4-0 next0))
)
(while (!= s4-0 (-> this alive-list-end))
(format
#t
"from process ~A:~%~`connection`I"
((method-of-type connection get-process) (the-as connection s4-0))
s4-0
)
(set! s4-0 s3-0)
(set! s3-0 (-> s3-0 next0))
)
)
(set! *kernel-symbol-warnings* gp-0)
)
this
)
;; definition for method 15 of type engine
(defmethod add-connection ((this engine) (arg0 process) (arg1 object) (arg2 object) (arg3 object) (arg4 object))
"Add a connection between this engine and a given process."
(let ((v1-0 (the-as connection (-> this dead-list next0))))
(when (not (or (not arg0) (= v1-0 (-> this dead-list-end))))
(set! (-> v1-0 param0) (the-as basic arg1))
(set! (-> v1-0 param1) (the-as basic arg2))
(set! (-> v1-0 param2) (the-as int arg3))
(set! (-> v1-0 param3) (the-as int arg4))
(set! (-> this dead-list next0) (-> v1-0 next0))
(set! (-> v1-0 next0 prev0) (-> this dead-list))
(set! (-> v1-0 next0) (-> this alive-list next0))
(set! (-> v1-0 next0 prev0) v1-0)
(set! (-> v1-0 prev0) (-> this alive-list))
(set! (-> this alive-list next0) v1-0)
(set! (-> v1-0 next1) (-> arg0 connection-list next1))
(if (-> v1-0 next1)
(set! (-> v1-0 next1 prev1) v1-0)
)
(set! (-> v1-0 prev1) (-> arg0 connection-list))
(set! (-> arg0 connection-list next1) v1-0)
(+! (-> this length) 1)
v1-0
)
)
)
;; definition for method 13 of type connection
(defmethod move-to-dead ((this connection))
"Move this connection from the alive list to the dead list."
(let ((v1-1 (get-engine this)))
(set! (-> this prev0 next0) (-> this next0))
(set! (-> this next0 prev0) (-> this prev0))
(set! (-> this prev1 next1) (-> this next1))
(if (-> this next1)
(set! (-> this next1 prev1) (-> this prev1))
)
(set! (-> this next0) (-> v1-1 dead-list next0))
(set! (-> this next0 prev0) this)
(set! (-> this prev0) (-> v1-1 dead-list))
(set! (-> v1-1 dead-list next0) this)
(+! (-> v1-1 length) -1)
)
this
)
;; definition for function process-disconnect
(defun process-disconnect ((arg0 process))
"Disconnect all connections for the given process."
(when arg0
(let ((gp-0 (-> arg0 connection-list next1)))
(while gp-0
((method-of-type connection move-to-dead) (the-as connection gp-0))
(set! gp-0 (-> gp-0 next1))
)
)
)
0
)
;; definition for method 16 of type engine
(defmethod remove-from-process ((this engine) (arg0 process))
"Remove all connections from process for this engine."
(when arg0
(let ((s5-0 (-> arg0 connection-list next1)))
(while s5-0
(if ((method-of-type connection belongs-to-engine?) (the-as connection s5-0) this)
((method-of-type connection move-to-dead) (the-as connection s5-0))
)
(set! s5-0 (-> s5-0 next1))
)
)
)
0
)
;; definition for method 17 of type engine
(defmethod remove-matching ((this engine) (arg0 (function connection engine symbol)))
"Call the given function on each connection and the engine.
If it returns truthy, `move-to-dead` that connection."
(let* ((s4-0 (-> this alive-list next0))
(s3-0 (-> s4-0 next0))
)
(while (!= s4-0 (-> this alive-list-end))
(if (arg0 (the-as connection s4-0) this)
((method-of-type connection move-to-dead) (the-as connection s4-0))
)
(set! s4-0 s3-0)
(set! s3-0 (-> s3-0 next0))
)
)
0
)
;; definition for method 18 of type engine
(defmethod remove-all ((this engine))
"Remove all connections from an engine."
(let* ((a0-1 (-> this alive-list next0))
(s5-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
((method-of-type connection move-to-dead) (the-as connection a0-1))
(set! a0-1 s5-0)
(set! s5-0 (-> s5-0 next0))
)
)
0
)
;; definition for method 19 of type engine
(defmethod remove-by-param0 ((this engine) (arg0 object))
"Remove all connections with param0 matching arg0."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(if (= (-> (the-as connection a0-1) param0) arg0)
((method-of-type connection move-to-dead) (the-as connection a0-1))
)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
;; definition for method 20 of type engine
(defmethod remove-by-param1 ((this engine) (arg0 int))
"Remove all connections with param1 matching arg0."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(if (= (-> (the-as connection a0-1) param1) arg0)
((method-of-type connection move-to-dead) (the-as connection a0-1))
)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
;; definition for method 21 of type engine
(defmethod remove-by-param2 ((this engine) (arg0 int))
"Remove all connections with param2 matching arg0."
(let* ((a0-1 (-> this alive-list next0))
(s4-0 (-> a0-1 next0))
)
(while (!= a0-1 (-> this alive-list-end))
(if (= (-> (the-as connection a0-1) param2) arg0)
((method-of-type connection move-to-dead) (the-as connection a0-1))
)
(set! a0-1 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
;; definition of type connection-pers
(deftype connection-pers (structure)
"This is another engine system, very similar to the first, but not specific to a process.
Each connection has a `key`, which is like the process, but unlike normal engine,
the key's don't track which engine-pers they belong to.
Unlike [[engine]], users can use [[engine-pers]] as a parent class."
((next connection-pers)
(key object)
(update-time time-frame)
(param object 4)
(param-int32 int32 4 :overlay-at (-> param 0))
(param-int64 int64 2 :overlay-at (-> param 0))
(param-float float 4 :overlay-at (-> param 0))
(param-quat uint128 :overlay-at (-> param 0))
)
)
;; definition for method 3 of type connection-pers
;; INFO: Used lq/sq
(defmethod inspect ((this connection-pers))
(when (not this)
(set! this this)
(goto cfg-16)
)
(format #t "[~8x] ~A~%" this 'connection-pers)
(format #t "~1Tnext: #<connection-pers @ #x~X>~%" (-> this next))
(format #t "~1Tkey: ~A~%" (-> this key))
(format #t "~1Tupdate-time: ~D~%" (-> this update-time))
(format #t "~1Tparam[4] @ #x~X~%" (-> this param))
(dotimes (s5-0 4)
(format #t "~T [~D]~1Tparam: ~A~%" s5-0 (-> this param s5-0))
)
(format #t "~1Tparam-int32[4] @ #x~X~%" (-> this param))
(dotimes (s5-1 4)
(format #t "~T [~D]~1Tparam-int32: ~D~%" s5-1 (-> this param s5-1))
)
(format #t "~1Tparam-int64[2] @ #x~X~%" (-> this param))
(dotimes (s5-2 2)
(format #t "~T [~D]~1Tparam-int64: ~D~%" s5-2 (-> this param-int64 s5-2))
)
(format #t "~1Tparam-float[4] @ #x~X~%" (-> this param))
(dotimes (s5-3 4)
(format #t "~T [~D]~1Tparam-float: ~f~%" s5-3 (the-as float (-> this param s5-3)))
)
(format #t "~1Tparam-quat: #x~X~%" (-> this param-quat))
(label cfg-16)
this
)
;; definition of type engine-pers
(deftype engine-pers (basic)
((name symbol)
(length int16)
(allocated-length int16)
(element-type type)
(execute-time time-frame)
(alive-list connection-pers)
(dead-list connection-pers)
(data connection-pers :inline :dynamic)
)
(:methods
(new (symbol type symbol int type) _type_)
(schedule-callback (_type_ object time-frame) connection-pers)
(kill-callback (_type_ connection-pers) none)
(kill-by-key (_type_ object) none)
(kill-matching (_type_ (function engine-pers connection-pers object object symbol) object object) none)
(update-callback (_type_) none)
(run-pending-updates! (_type_ time-frame) none)
)
)
;; definition for method 3 of type engine-pers
(defmethod inspect ((this engine-pers))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tname: ~A~%" (-> this name))
(format #t "~1Tlength: ~D~%" (-> this length))
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
(format #t "~1Telement-type: ~A~%" (-> this element-type))
(format #t "~1Texecute-time: ~D~%" (-> this execute-time))
(format #t "~1Talive-list: #<connection-pers @ #x~X>~%" (-> this alive-list))
(format #t "~1Tdead-list: #<connection-pers @ #x~X>~%" (-> this dead-list))
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
(label cfg-4)
this
)
;; definition for method 0 of type engine-pers
(defmethod new engine-pers ((allocation symbol) (type-to-make type) (arg0 symbol) (arg1 int) (arg2 type))
(let ((v0-0 (object-new
allocation
type-to-make
(the-as int (+ (-> type-to-make size) (* (the-as uint arg1) (-> arg2 size))))
)
)
)
(set! (-> v0-0 allocated-length) arg1)
(set! (-> v0-0 length) 0)
(set! (-> v0-0 name) arg0)
(set! (-> v0-0 element-type) arg2)
(set! (-> v0-0 alive-list) #f)
(set! (-> v0-0 dead-list) (the-as connection-pers (-> v0-0 data)))
(let ((v1-3 (the-as object (-> v0-0 data))))
(dotimes (a0-1 arg1)
(set! (-> (the-as (pointer pointer) v1-3) 0) (&+ (the-as pointer v1-3) (-> arg2 size)))
(set! v1-3 (&+ (the-as pointer v1-3) (-> arg2 size)))
)
(set! (-> (the-as (pointer int32) (&- (the-as pointer v1-3) (the-as uint (-> arg2 size))))) #f)
)
v0-0
)
)
;; definition for method 4 of type engine-pers
(defmethod length ((this engine-pers))
(-> this length)
)
;; definition for method 5 of type engine-pers
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this engine-pers))
(the-as int (+ (-> this type size) (* (-> this allocated-length) (the-as int (-> this element-type size)))))
)
;; definition for method 9 of type engine-pers
;; INFO: Used lq/sq
(defmethod schedule-callback ((this engine-pers) (arg0 object) (arg1 time-frame))
"Get a connection for this key.
If no connection exists, add it.
Schedule an update to happen in arg1 seconds."
(local-vars (v0-0 connection-pers))
(let ((v1-0 (-> this alive-list)))
(while v1-0
(when (= arg0 (-> v1-0 key))
(set! v0-0 v1-0)
(goto cfg-8)
)
(set! v1-0 (-> v1-0 next))
)
)
(set! v0-0 (-> this dead-list))
(when v0-0
(set! (-> this dead-list) (-> v0-0 next))
(set! (-> v0-0 next) (-> this alive-list))
(set! (-> this alive-list) v0-0)
(+! (-> this length) 1)
(set! (-> v0-0 key) arg0)
(set! (-> v0-0 param-quat) (the-as uint128 0))
0
)
(label cfg-8)
(if v0-0
(set! (-> v0-0 update-time) (+ (-> this execute-time) arg1))
)
v0-0
)
;; definition for method 10 of type engine-pers
;; WARN: Return type mismatch int vs none.
(defmethod kill-callback ((this engine-pers) (arg0 connection-pers))
"Called when a connection is removed."
0
(none)
)
;; definition for method 13 of type engine-pers
;; WARN: Return type mismatch int vs none.
(defmethod update-callback ((this engine-pers))
"Called when a connection is run.
Users can override this as needed."
0
(none)
)
;; definition for method 11 of type engine-pers
;; WARN: Return type mismatch int vs none.
(defmethod kill-by-key ((this engine-pers) (arg0 object))
"Remove connections with this key, calling `kill-callback`."
(let ((s4-0 (&-> this alive-list))
(s2-0 (-> this alive-list))
)
(while s2-0
(let ((s3-0 (-> s2-0 next)))
(cond
((!= arg0 (-> s2-0 key))
(set! s4-0 (&-> s2-0 next))
)
(else
(kill-callback this s2-0)
(set! (-> s4-0 0) (-> s2-0 next))
(set! (-> s2-0 next) (-> this dead-list))
(set! (-> this dead-list) s2-0)
(+! (-> this length) -1)
)
)
(set! s2-0 s3-0)
)
)
)
0
(none)
)
;; definition for method 12 of type engine-pers
;; WARN: Return type mismatch int vs none.
(defmethod kill-matching ((this engine-pers)
(arg0 (function engine-pers connection-pers object object symbol))
(arg1 object)
(arg2 object)
)
"Call the given function on each connection. If it returns truthy, kill that connection."
(let ((s2-0 (&-> this alive-list))
(s0-0 (-> this alive-list))
)
(while s0-0
(let ((s1-0 (-> s0-0 next)))
(cond
((not (arg0 this s0-0 arg1 arg2))
(set! s2-0 (&-> s0-0 next))
)
(else
(kill-callback this s0-0)
(set! (-> s2-0 0) (-> s0-0 next))
(set! (-> s0-0 next) (-> this dead-list))
(set! (-> this dead-list) s0-0)
(+! (-> this length) -1)
)
)
(set! s0-0 s1-0)
)
)
)
0
(none)
)
;; definition for method 14 of type engine-pers
;; WARN: Return type mismatch int vs none.
(defmethod run-pending-updates! ((this engine-pers) (arg0 time-frame))
"Run updates if they scheduled. If something is found that has no pending update, kill it.
Note that we won't kill things on this call if they fail to update their `update-time`.
They will survive until the next call to `run-pending-updates`!
(or you can modify their `update-time` before that to prevent them from being killed.)"
(let ((s4-0 (-> this execute-time))
(s2-0 (&-> this alive-list))
(s1-0 (-> this alive-list))
)
(while s1-0
(let ((s3-0 (-> s1-0 next)))
(cond
((>= (-> s1-0 update-time) s4-0)
(update-callback this)
(set! s2-0 (&-> s1-0 next))
)
(else
(kill-callback this s1-0)
(set! (-> s2-0 0) (-> s1-0 next))
(set! (-> s1-0 next) (-> this dead-list))
(set! (-> this dead-list) s1-0)
(+! (-> this length) -1)
)
)
(set! s1-0 s3-0)
)
)
)
(set! (-> this execute-time) arg0)
0
(none)
)
;; failed to figure out what this is:
0
File diff suppressed because it is too large Load Diff
+226
View File
@@ -0,0 +1,226 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type vis-gif-tag
(deftype vis-gif-tag (structure)
"Unused."
((fog0 uint32)
(strip uint32)
(regs uint32)
(fan uint32)
)
)
;; definition for method 3 of type vis-gif-tag
(defmethod inspect ((this vis-gif-tag))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'vis-gif-tag)
(format #t "~1Tfog0: ~D~%" (-> this fog0))
(format #t "~1Tstrip: ~D~%" (-> this strip))
(format #t "~1Tregs: ~D~%" (-> this regs))
(format #t "~1Tfan: ~D~%" (-> this fan))
(label cfg-4)
this
)
;; definition of type cull-info
(deftype cull-info (structure)
"Also seems unused."
((x-fact float)
(y-fact float)
(z-fact float)
(cam-radius float)
(cam-x float)
(cam-y float)
(xz-dir-ax float)
(xz-dir-az float)
(xz-dir-bx float)
(xz-dir-bz float)
(xz-cross-ab float)
(yz-dir-ay float)
(yz-dir-az float)
(yz-dir-by float)
(yz-dir-bz float)
(yz-cross-ab float)
)
:allow-misaligned
)
;; definition for method 3 of type cull-info
(defmethod inspect ((this cull-info))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'cull-info)
(format #t "~1Tx-fact: ~f~%" (-> this x-fact))
(format #t "~1Ty-fact: ~f~%" (-> this y-fact))
(format #t "~1Tz-fact: ~f~%" (-> this z-fact))
(format #t "~1Tcam-radius: ~f~%" (-> this cam-radius))
(format #t "~1Tcam-x: ~f~%" (-> this cam-x))
(format #t "~1Tcam-y: ~f~%" (-> this cam-y))
(format #t "~1Txz-dir-ax: ~f~%" (-> this xz-dir-ax))
(format #t "~1Txz-dir-az: ~f~%" (-> this xz-dir-az))
(format #t "~1Txz-dir-bx: ~f~%" (-> this xz-dir-bx))
(format #t "~1Txz-dir-bz: ~f~%" (-> this xz-dir-bz))
(format #t "~1Txz-cross-ab: ~f~%" (-> this xz-cross-ab))
(format #t "~1Tyz-dir-ay: ~f~%" (-> this yz-dir-ay))
(format #t "~1Tyz-dir-az: ~f~%" (-> this yz-dir-az))
(format #t "~1Tyz-dir-by: ~f~%" (-> this yz-dir-by))
(format #t "~1Tyz-dir-bz: ~f~%" (-> this yz-dir-bz))
(format #t "~1Tyz-cross-ab: ~f~%" (-> this yz-cross-ab))
(label cfg-4)
this
)
;; definition of type math-camera
(deftype math-camera (basic)
((d meters)
(f meters)
(fov degrees)
(x-ratio float)
(y-ratio float)
(x-pix float)
(x-clip float)
(x-clip-ratio-in float)
(x-clip-ratio-over float)
(y-pix float)
(y-clip float)
(y-clip-ratio-in float)
(y-clip-ratio-over float)
(cull-info cull-info :inline)
(fog-start meters)
(fog-end meters)
(fog-max float)
(fog-min float)
(reset int32)
(smooth-step float)
(smooth-t float)
(perspective matrix :inline)
(isometric matrix :inline)
(sprite-2d matrix :inline)
(sprite-2d-hvdf vector :inline)
(camera-rot matrix :inline)
(inv-camera-rot matrix :inline)
(inv-camera-rot-smooth matrix :inline)
(inv-camera-rot-smooth-from quaternion :inline)
(camera-temp matrix :inline)
(prev-camera-temp matrix :inline)
(prev-inv-camera-rot matrix :inline)
(prev-trans vector :inline)
(hmge-scale vector :inline)
(inv-hmge-scale vector :inline)
(hvdf-off vector :inline)
(guard vector :inline)
(vis-gifs vis-gif-tag 4)
(giftex uint128 :overlay-at (-> vis-gifs 0))
(gifgr uint128 :offset 864)
(giftex-trans uint128 :offset 880)
(gifgr-trans uint128 :offset 896)
(pfog0 float)
(pfog1 float)
(trans vector :inline)
(plane plane 4 :inline)
(guard-plane plane 4 :inline)
(shrub-mat matrix :inline)
(quat-other quaternion :inline)
(trans-other vector :inline)
(shrub-mat-other matrix :inline)
(camera-temp-other matrix :inline)
(camera-rot-other matrix :inline)
(camera-rot-other-sky matrix :inline)
(camera-rot-other-sprite matrix :inline)
(inv-camera-rot-other matrix :inline)
(plane-other plane 4 :inline)
(guard-plane-other plane 4 :inline)
(mirror-trans vector :inline)
(mirror-normal vector :inline)
(fov-correction-factor float)
)
(:methods
(new (symbol type) _type_)
)
)
;; definition for method 3 of type math-camera
;; INFO: Used lq/sq
(defmethod inspect ((this math-camera))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Td: (meters ~m)~%" (-> this d))
(format #t "~1Tf: (meters ~m)~%" (-> this f))
(format #t "~1Tfov: (deg ~r)~%" (-> this fov))
(format #t "~1Tx-ratio: ~f~%" (-> this x-ratio))
(format #t "~1Ty-ratio: ~f~%" (-> this y-ratio))
(format #t "~1Tx-pix: ~f~%" (-> this x-pix))
(format #t "~1Tx-clip: ~f~%" (-> this x-clip))
(format #t "~1Tx-clip-ratio-in: ~f~%" (-> this x-clip-ratio-in))
(format #t "~1Tx-clip-ratio-over: ~f~%" (-> this x-clip-ratio-over))
(format #t "~1Ty-pix: ~f~%" (-> this y-pix))
(format #t "~1Ty-clip: ~f~%" (-> this y-clip))
(format #t "~1Ty-clip-ratio-in: ~f~%" (-> this y-clip-ratio-in))
(format #t "~1Ty-clip-ratio-over: ~f~%" (-> this y-clip-ratio-over))
(format #t "~1Tcull-info: #<cull-info @ #x~X>~%" (-> this cull-info))
(format #t "~1Tfog-start: (meters ~m)~%" (-> this fog-start))
(format #t "~1Tfog-end: (meters ~m)~%" (-> this fog-end))
(format #t "~1Tfog-max: ~f~%" (-> this fog-max))
(format #t "~1Tfog-min: ~f~%" (-> this fog-min))
(format #t "~1Treset: ~D~%" (-> this reset))
(format #t "~1Tsmooth-step: ~f~%" (-> this smooth-step))
(format #t "~1Tsmooth-t: ~f~%" (-> this smooth-t))
(format #t "~1Tperspective: #<matrix @ #x~X>~%" (-> this perspective))
(format #t "~1Tisometric: #<matrix @ #x~X>~%" (-> this isometric))
(format #t "~1Tsprite-2d: #<matrix @ #x~X>~%" (-> this sprite-2d))
(format #t "~1Tsprite-2d-hvdf: #<vector @ #x~X>~%" (-> this sprite-2d-hvdf))
(format #t "~1Tcamera-rot: #<matrix @ #x~X>~%" (-> this camera-rot))
(format #t "~1Tinv-camera-rot: #<matrix @ #x~X>~%" (-> this inv-camera-rot))
(format #t "~1Tinv-camera-rot-smooth: #<matrix @ #x~X>~%" (-> this inv-camera-rot-smooth))
(format #t "~1Tinv-camera-rot-smooth-from: #<quaternion @ #x~X>~%" (-> this inv-camera-rot-smooth-from))
(format #t "~1Tcamera-temp: #<matrix @ #x~X>~%" (-> this camera-temp))
(format #t "~1Tprev-camera-temp: #<matrix @ #x~X>~%" (-> this prev-camera-temp))
(format #t "~1Tprev-inv-camera-rot: #<matrix @ #x~X>~%" (-> this prev-inv-camera-rot))
(format #t "~1Tprev-trans: ~`vector`P~%" (-> this prev-trans))
(format #t "~1Thmge-scale: #<vector @ #x~X>~%" (-> this hmge-scale))
(format #t "~1Tinv-hmge-scale: #<vector @ #x~X>~%" (-> this inv-hmge-scale))
(format #t "~1Thvdf-off: #<vector @ #x~X>~%" (-> this hvdf-off))
(format #t "~1Tguard: #<vector @ #x~X>~%" (-> this guard))
(format #t "~1Tvis-gifs[4] @ #x~X~%" (-> this vis-gifs))
(format #t "~1Tgiftex: ~D~%" (-> this giftex))
(format #t "~1Tgifgr: ~D~%" (-> this gifgr))
(format #t "~1Tgiftex-trans: ~D~%" (-> this giftex-trans))
(format #t "~1Tgifgr-trans: ~D~%" (-> this gifgr-trans))
(format #t "~1Tpfog0: ~f~%" (-> this pfog0))
(format #t "~1Tpfog1: ~f~%" (-> this pfog1))
(format #t "~1Ttrans: ~`vector`P~%" (-> this trans))
(format #t "~1Tplane[4] @ #x~X~%" (-> this plane))
(format #t "~1Tguard-plane[4] @ #x~X~%" (-> this guard-plane))
(format #t "~1Tshrub-mat: #<matrix @ #x~X>~%" (-> this shrub-mat))
(format #t "~1Tquat-other: #<quaternion @ #x~X>~%" (-> this quat-other))
(format #t "~1Ttrans-other: #<vector @ #x~X>~%" (-> this trans-other))
(format #t "~1Tshrub-mat-other: #<matrix @ #x~X>~%" (-> this shrub-mat-other))
(format #t "~1Tcamera-temp-other: #<matrix @ #x~X>~%" (-> this camera-temp-other))
(format #t "~1Tcamera-rot-other: #<matrix @ #x~X>~%" (-> this camera-rot-other))
(format #t "~1Tcamera-rot-other-sky: #<matrix @ #x~X>~%" (-> this camera-rot-other-sky))
(format #t "~1Tcamera-rot-other-sprite: #<matrix @ #x~X>~%" (-> this camera-rot-other-sprite))
(format #t "~1Tinv-camera-rot-other: #<matrix @ #x~X>~%" (-> this inv-camera-rot-other))
(format #t "~1Tplane-other[4] @ #x~X~%" (-> this plane-other))
(format #t "~1Tguard-plane-other[4] @ #x~X~%" (-> this guard-plane-other))
(format #t "~1Tmirror-trans: #<vector @ #x~X>~%" (-> this mirror-trans))
(format #t "~1Tmirror-normal: #<vector @ #x~X>~%" (-> this mirror-normal))
(format #t "~1Tfov-correction-factor: ~f~%" (-> this fov-correction-factor))
(label cfg-4)
this
)
;; failed to figure out what this is:
0
+646
View File
@@ -0,0 +1,646 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type fog-corrector
(deftype fog-corrector (structure)
"The math-camera matrices are used to compute fogging values, which are a per-vertex uint8 that
tells the GS how 'foggy' the color should be. This should be proportional to how far away the vertex
is. There is a scaling factor applied so the fog intensity isn't affected by the field of view angle.
The fog-corrector stores a fog-end fog-start value that is corrected for the field of view.
The actual correction factor is computed in cam-update.gc.
Without this corrector, the fogginess of the world would change as the FOV changes
(for example, when Jak gets on the zoomer, the FOV changes slightly)."
((fog-end float)
(fog-start float)
)
)
;; definition for method 3 of type fog-corrector
(defmethod inspect ((this fog-corrector))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'fog-corrector)
(format #t "~1Tfog-end: ~f~%" (-> this fog-end))
(format #t "~1Tfog-start: ~f~%" (-> this fog-start))
(label cfg-4)
this
)
;; definition for function fog-corrector-setup
;; WARN: Return type mismatch float vs none.
(defun fog-corrector-setup ((arg0 fog-corrector) (arg1 math-camera))
"Set the fog corrector based on the supplied math-camera."
(set! (-> arg0 fog-end) (* (-> arg1 fog-end) (-> arg1 fov-correction-factor)))
(set! (-> arg0 fog-start) (* (-> arg1 fog-start) (-> arg1 fov-correction-factor)))
(none)
)
;; definition for symbol *math-camera-fog-correction*, type fog-corrector
(define *math-camera-fog-correction* (new 'global 'fog-corrector))
;; definition for function update-math-camera
;; INFO: Used lq/sq
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; WARN: Stack slot offset 16 signed mismatch
;; ERROR: Failed store: (s.w! a0-43 v1-54) at op 457
;; ERROR: Failed store: (s.w! (+ a0-43 4) a1-9) at op 461
;; ERROR: Failed store: (s.w! (+ a0-43 8) a1-10) at op 463
;; ERROR: Failed store: (s.w! (+ a0-43 12) a1-11) at op 465
(defun update-math-camera ((arg0 math-camera) (arg1 symbol) (arg2 symbol) (arg3 float))
"Compute some one-time camera constants.
These should only change when changing aspect ratio."
(local-vars (sv-16 float))
(set! (-> arg0 x-ratio) (tan (* 0.5 arg3)))
(if (= arg2 'aspect4x3)
(set! (-> arg0 y-ratio) (* 0.75 (-> arg0 x-ratio)))
(set! (-> arg0 y-ratio) (* 0.5625 (-> arg0 x-ratio)))
)
(let ((f1-3 (-> arg0 x-ratio))
(f0-7 (-> arg0 y-ratio))
(v1-6 (-> arg0 cull-info))
)
(/ (+ 1.0 (* 4.0 f1-3 f1-3)) (+ 1.0 (* f1-3 f1-3)))
(let ((f2-5 (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (+ 1.0 (* f0-7 f0-7)))))
(set! (-> v1-6 x-fact) (/ (+ 1.0 (* 4.0 f1-3 f1-3)) (* f1-3 (sqrtf (+ 1.0 (* 16.0 f1-3 f1-3))))))
(set! (-> v1-6 y-fact) (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (* f0-7 (sqrtf (+ 1.0 (* 16.0 f0-7 f0-7))))))
(set! (-> v1-6 z-fact) (sqrtf (+ (* (+ -4.0 f2-5) (+ -4.0 f2-5) f0-7 f0-7) (* (+ -1.0 f2-5) (+ -1.0 f2-5)))))
)
(let* ((f2-11 (* f1-3 (-> arg0 d)))
(f1-5 (* f0-7 (-> arg0 d)))
(f0-10 (+ (* f2-11 f2-11) (* f1-5 f1-5)))
(f1-8 (-> arg0 d))
)
(set! (-> v1-6 cam-radius) (sqrtf (+ f0-10 (* f1-8 f1-8))))
)
(let* ((f1-12 (* (-> arg0 d) (-> arg0 x-ratio)))
(f0-14 (-> arg0 d))
(f2-13 (* 4.0 f1-12))
(f3-21 (-> arg0 d))
)
(let ((f4-21 (/ 1.0 (sqrtf (+ (* f1-12 f1-12) (* f0-14 f0-14)))))
(f5-11 (/ 1.0 (sqrtf (+ (* f2-13 f2-13) (* f3-21 f3-21)))))
)
(set! (-> v1-6 xz-dir-ax) (* f1-12 f4-21))
(set! (-> v1-6 xz-dir-az) (* f0-14 f4-21))
(set! (-> v1-6 xz-dir-bx) (* f2-13 f5-11))
(set! (-> v1-6 xz-dir-bz) (* f3-21 f5-11))
)
(set! (-> v1-6 xz-cross-ab) (- (* f1-12 f3-21) (* f0-14 f2-13)))
)
(let* ((f1-15 (* (-> arg0 d) (-> arg0 y-ratio)))
(f0-18 (-> arg0 d))
(f2-15 (* 4.0 f1-15))
(f3-22 (-> arg0 d))
)
(let ((f4-26 (/ 1.0 (sqrtf (+ (* f1-15 f1-15) (* f0-18 f0-18)))))
(f5-16 (/ 1.0 (sqrtf (+ (* f2-15 f2-15) (* f3-22 f3-22)))))
)
(set! (-> v1-6 yz-dir-ay) (* f1-15 f4-26))
(set! (-> v1-6 yz-dir-az) (* f0-18 f4-26))
(set! (-> v1-6 yz-dir-by) (* f2-15 f5-16))
(set! (-> v1-6 yz-dir-bz) (* f3-22 f5-16))
)
(set! (-> v1-6 yz-cross-ab) (- (* f1-15 f3-22) (* f0-18 f2-15)))
)
)
(fog-corrector-setup *math-camera-fog-correction* arg0)
(matrix-identity! (-> arg0 camera-rot))
(let ((f0-21 100.0)
(f2-16 16760631.0)
)
16777115.0
(let ((f30-0 (/ (* (-> arg0 d) (- (-> arg0 fog-min) (-> arg0 fog-max)))
(- (-> *math-camera-fog-correction* fog-end) (-> *math-camera-fog-correction* fog-start))
)
)
(f1-21 (* -0.5 (- f2-16 f0-21)))
)
(let ((f4-34 (/ f1-21 (* (-> arg0 d) (- (-> arg0 f) (-> arg0 d)))))
(f3-30 (-> arg0 fov-correction-factor))
)
(set! (-> arg0 perspective rvec x) (* f3-30 (- (/ (-> arg0 x-pix) (* (-> arg0 x-ratio) (-> arg0 d))))))
(set! (-> arg0 perspective uvec y) (* f3-30 (- (/ (-> arg0 y-pix) (* (-> arg0 y-ratio) (-> arg0 d))))))
(set! (-> arg0 perspective fvec z) (* f3-30 (+ (-> arg0 f) (-> arg0 d)) f4-34))
(set! (-> arg0 perspective fvec w) (* (/ f3-30 (-> arg0 d)) f30-0))
(set! (-> arg0 perspective trans z) (* -2.0 f4-34 (-> arg0 f) (-> arg0 d) f3-30))
)
(let ((f24-0 2048.0)
(f26-0 2048.0)
(f28-0 (/ (- (* (-> *math-camera-fog-correction* fog-end) (-> arg0 fog-max))
(* (-> *math-camera-fog-correction* fog-start) (-> arg0 fog-min))
)
(- (-> *math-camera-fog-correction* fog-end) (-> *math-camera-fog-correction* fog-start))
)
)
)
(let ((f22-0 (* 0.5 (+ f2-16 f0-21))))
(set! (-> arg0 hmge-scale x) (/ 1.0 (-> arg0 x-clip)))
(set! (-> arg0 hmge-scale y) (/ 1.0 (-> arg0 y-clip)))
(set! (-> arg0 hmge-scale z) (/ 1.0 f1-21))
(set! (-> arg0 hmge-scale w) (/ 1.0 f30-0))
(set! (-> arg0 inv-hmge-scale x) (-> arg0 x-clip))
(set! (-> arg0 inv-hmge-scale y) (-> arg0 y-clip))
(set! (-> arg0 inv-hmge-scale z) f1-21)
(set! (-> arg0 inv-hmge-scale w) f30-0)
(cond
((or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
(set! (-> arg0 hvdf-off x) f24-0)
(set! (-> arg0 hvdf-off y) f26-0)
)
(else
(let* ((v1-32 (-> *screen-shot-work* count))
(a0-36 (-> *screen-shot-work* size))
(f0-34 (the float a0-36))
(f20-0 (/ (the float (mod v1-32 a0-36)) f0-34))
)
(set! sv-16 (/ (the float (/ v1-32 a0-36)) f0-34))
(format 0 "~f ~f~%" f20-0 sv-16)
(set! (-> arg0 hvdf-off x) (- f24-0 f20-0))
)
(set! (-> arg0 hvdf-off y) (- f26-0 sv-16))
)
)
(set! (-> arg0 hvdf-off z) f22-0)
(set! (-> arg0 hvdf-off w) f28-0)
(set! (-> arg0 guard x) (/ (-> arg0 x-clip) (-> arg0 x-pix)))
(set! (-> arg0 guard y) (/ (-> arg0 y-clip) (-> arg0 y-pix)))
(set! (-> arg0 guard z) 1.0)
(set! (-> arg0 guard w) 1.0)
(set! (-> arg0 isometric trans z) (- 16777215.0 f22-0))
)
(set! (-> arg0 isometric trans w) f30-0)
(let ((f1-28 (-> arg0 perspective rvec x))
(f2-19 (-> arg0 perspective uvec y))
(f0-48 (* -1.9996 (-> arg0 perspective rvec x)))
)
(let ((v1-39 (-> arg0 sprite-2d)))
(set! (-> v1-39 rvec x) f0-48)
(set! (-> v1-39 rvec y) 0.0)
(set! (-> v1-39 rvec z) 0.0)
(set! (-> v1-39 rvec w) 0.0)
)
(set-vector! (-> arg0 sprite-2d uvec) 0.0 (- (* (/ f2-19 f1-28) f0-48)) 0.0 0.0)
(set-vector! (-> arg0 sprite-2d fvec) 0.0 0.0 (- f0-48) 0.0)
(set-vector! (-> arg0 sprite-2d trans) 0.0 0.0 (* 500000000.0 f0-48) (* 60.0 f0-48 (-> arg0 pfog0)))
)
(set! (-> arg0 sprite-2d-hvdf quad) (-> arg0 hvdf-off quad))
(set! (-> arg0 sprite-2d-hvdf x) 2048.0)
(set! (-> arg0 sprite-2d-hvdf y) 2048.0)
(set! (-> arg0 sprite-2d-hvdf z) (-> arg0 hvdf-off z))
(set! (-> arg0 pfog0) f30-0)
(set! (-> arg0 pfog1) f28-0)
)
)
)
0
(make-u128 0 (shl #x301ec000 32))
(make-u128 0 (shl #x303ec000 32))
(let ((v1-54 (-> arg0 pfog0)))
(let ((a0-42 (-> arg0 vis-gifs)))
(set! (-> a0-42 0) (the-as vis-gif-tag v1-54))
(set! (-> a0-42 1) (the-as vis-gif-tag #x301e4000))
(set! (-> a0-42 2) (the-as vis-gif-tag 1042))
(set! (-> a0-42 3) (the-as vis-gif-tag #x301ec000))
)
(let ((a0-43 (&-> arg0 gifgr)))
(s.w! a0-43 v1-54)
(let ((a1-9 (make-u128 0 (shl #x20164000 32))))
(s.w! (+ a0-43 4) a1-9)
)
(let ((a1-10 65))
(s.w! (+ a0-43 8) a1-10)
)
(let ((a1-11 #x301ec000))
(s.w! (+ a0-43 12) a1-11)
)
)
(let ((a0-44 (-> arg0 vis-gifs)))
(set! (-> a0-44 0) (the-as vis-gif-tag v1-54))
(set! (-> a0-44 1) (the-as vis-gif-tag #x303e4000))
(set! (-> a0-44 2) (the-as vis-gif-tag 1042))
(set! (-> a0-44 3) (the-as vis-gif-tag #x303ec000))
)
(let ((a0-45 (-> arg0 vis-gifs)))
(set! (-> a0-45 0) (the-as vis-gif-tag v1-54))
(set! (-> a0-45 1) (the-as vis-gif-tag #x303e4000))
(set! (-> a0-45 2) (the-as vis-gif-tag 1042))
(set! (-> a0-45 3) (the-as vis-gif-tag #x303ec000))
)
)
(if (nonzero? sprite-distorter-generate-tables)
(sprite-distorter-generate-tables)
)
arg0
)
;; definition for method 0 of type math-camera
(defmethod new math-camera ((allocation symbol) (type-to-make type))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> gp-0 d) 1024.0)
(set! (-> gp-0 f) 40960000.0)
(set! (-> gp-0 fov) 11650.845)
(set! (-> gp-0 x-pix) 256.0)
(set! (-> gp-0 x-clip) 512.0)
(set! (-> gp-0 y-pix) 208.0)
(set! (-> gp-0 y-clip) 416.0)
(set! (-> gp-0 fog-start) 40960.0)
(set! (-> gp-0 fog-end) 819200.0)
(set! (-> gp-0 fog-max) 255.0)
(set! (-> gp-0 fog-min) 150.0)
(matrix-identity! (-> gp-0 inv-camera-rot))
(matrix-identity! (-> gp-0 camera-rot))
(vector-reset! (-> gp-0 trans))
(quaternion-identity! (-> gp-0 quat-other))
(set-vector! (-> gp-0 trans-other) 0.0 0.0 0.0 1.0)
(matrix-identity! (-> gp-0 inv-camera-rot-other))
(matrix-identity! (-> gp-0 camera-rot-other))
(matrix-identity! (-> gp-0 camera-temp-other))
(set! (-> gp-0 isometric rvec x) 1.0)
(set! (-> gp-0 isometric uvec y) 0.5)
(set! (-> gp-0 isometric fvec z) -1.0)
(set! (-> gp-0 reset) 1)
(set! (-> gp-0 smooth-step) 0.0)
(set! (-> gp-0 smooth-t) 0.0)
(update-math-camera gp-0 'ntsc 'aspect4x3 (-> gp-0 fov))
)
)
;; definition for symbol *math-camera*, type math-camera
(define *math-camera* (new 'global 'math-camera))
;; definition for function math-cam-start-smoothing
(defun math-cam-start-smoothing ((arg0 float) (arg1 float))
"Unused camera smoothing."
(set! (-> *math-camera* smooth-step) (/ 1.0 arg0))
(set! (-> *math-camera* smooth-t) arg1)
(matrix->quaternion (-> *math-camera* inv-camera-rot-smooth-from) (-> *math-camera* inv-camera-rot-smooth))
)
;; definition for function move-target-from-pad
;; INFO: Used lq/sq
(defun move-target-from-pad ((arg0 transform) (arg1 int))
"Unused function to adjust trans based on inputs from the pad.
This function must be extremely old because it takes a non-quaternion transform,
and all [[target]] stuff uses quaternions."
(let ((s4-0 (new-stack-vector0)))
(set! (-> s4-0 x) (cond
((cpad-hold? arg1 circle)
-80.0
)
((cpad-hold? arg1 square)
80.0
)
(else
0.0
)
)
)
(set! (-> s4-0 y) 0.0)
(set! (-> s4-0 z) (cond
((cpad-hold? arg1 down)
-80.0
)
((cpad-hold? arg1 up)
80.0
)
(else
0.0
)
)
)
(set! (-> s4-0 w) 1.0)
(let ((a0-5 (new-stack-vector0))
(s3-0 (new 'stack-no-clear 'matrix))
)
(set! (-> s3-0 rvec quad) (the-as uint128 0))
(set! (-> s3-0 uvec quad) (the-as uint128 0))
(set! (-> s3-0 fvec quad) (the-as uint128 0))
(set! (-> s3-0 trans quad) (the-as uint128 0))
(vector-negate! a0-5 (-> arg0 rot))
(matrix-rotate-zyx! s3-0 (-> arg0 rot))
(vector-matrix*! s4-0 s4-0 s3-0)
)
(vector+! (-> arg0 trans) (-> arg0 trans) s4-0)
)
(set! (-> arg0 trans w) 1.0)
(if (cpad-hold? arg1 r1)
(+! (-> arg0 trans y) 80.0)
)
(if (cpad-hold? arg1 r2)
(+! (-> arg0 trans y) -80.0)
)
(if (cpad-hold? arg1 x)
(+! (-> arg0 rot x) 546.13336)
)
(if (cpad-hold? arg1 triangle)
(+! (-> arg0 rot x) -546.13336)
)
(if (cpad-hold? arg1 left)
(+! (-> arg0 rot y) 546.13336)
)
(if (cpad-hold? arg1 right)
(+! (-> arg0 rot y) -546.13336)
)
arg0
)
;; definition for function transform-point-vector!
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
(defun transform-point-vector! ((arg0 vector) (arg1 vector))
"Apply camera transformation to a point. Return true if it is visible or not.
This returns the point in GS coords, but as float instead of int, so it's
not really useful. See [[transform-point-qword!]] for more details."
(local-vars (v1-2 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
0
(let ((v1-1 *math-camera*))
(.lvf vf24 (&-> v1-1 camera-temp rvec quad))
(.lvf vf25 (&-> v1-1 camera-temp uvec quad))
(.lvf vf26 (&-> v1-1 camera-temp fvec quad))
(.lvf vf27 (&-> v1-1 camera-temp trans quad))
(.lvf vf29 (&-> v1-1 hmge-scale quad))
(.lvf vf30 (&-> v1-1 hvdf-off quad))
)
(.lvf vf28 (&-> arg1 quad))
(.mul.x.vf acc vf24 vf28)
(.add.mul.y.vf acc vf25 vf28 acc)
(.add.mul.z.vf acc vf26 vf28 acc)
(.add.mul.w.vf vf28 vf27 vf0 acc)
(.add.w.vf vf23 vf0 vf0)
(.mul.vf vf31 vf28 vf29)
(TODO.VCLIP vf31 vf31)
(.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11)
(.wait.vf)
(.cfc2.i v1-2 Clipping)
(.mul.vf vf28 vf28 Q :mask #b111)
(.mul.vf vf23 vf23 Q)
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(.svf (&-> arg0 quad) vf28)
(not (logtest? v1-2 63))
)
)
;; definition for function transform-point-qword!
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
(defun transform-point-qword! ((arg0 vector4w) (arg1 vector))
"Apply camera transformation to point, returning fixed point 28.4 position
that can be given to the GS directly."
(local-vars (v1-2 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
0
(let ((v1-1 *math-camera*))
(.lvf vf24 (&-> v1-1 camera-temp rvec quad))
(.lvf vf25 (&-> v1-1 camera-temp uvec quad))
(.lvf vf26 (&-> v1-1 camera-temp fvec quad))
(.lvf vf27 (&-> v1-1 camera-temp trans quad))
(.lvf vf29 (&-> v1-1 hmge-scale quad))
(.lvf vf30 (&-> v1-1 hvdf-off quad))
)
(.lvf vf28 (&-> arg1 quad))
(.mul.x.vf acc vf24 vf28)
(.add.mul.y.vf acc vf25 vf28 acc)
(.add.mul.z.vf acc vf26 vf28 acc)
(.add.mul.w.vf vf28 vf27 vf0 acc)
(.add.w.vf vf23 vf0 vf0)
(.mul.vf vf31 vf28 vf29)
(TODO.VCLIP vf31 vf31)
(.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11)
(.wait.vf)
(.cfc2.i v1-2 Clipping)
(.mul.vf vf28 vf28 Q :mask #b111)
(.mul.vf vf23 vf23 Q)
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(vftoi4.xyzw vf28 vf28)
(.svf (&-> arg0 quad) vf28)
(not (logtest? v1-2 63))
)
)
;; definition for function transform-point-vector-scale!
;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP]
;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping]
(defun transform-point-vector-scale! ((arg0 vector) (arg1 vector))
"Similar to transform-point-qword! but returns the scale factor instead."
(local-vars (v0-0 float) (v1-2 int))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
0
(let ((v1-1 *math-camera*))
(.lvf vf24 (&-> v1-1 camera-temp rvec quad))
(.lvf vf25 (&-> v1-1 camera-temp uvec quad))
(.lvf vf26 (&-> v1-1 camera-temp fvec quad))
(.lvf vf27 (&-> v1-1 camera-temp trans quad))
(.lvf vf29 (&-> v1-1 hmge-scale quad))
(.lvf vf30 (&-> v1-1 hvdf-off quad))
)
(.lvf vf28 (&-> arg1 quad))
(.mul.x.vf acc vf24 vf28)
(.add.mul.y.vf acc vf25 vf28 acc)
(.add.mul.z.vf acc vf26 vf28 acc)
(.add.mul.w.vf vf28 vf27 vf0 acc)
(.add.w.vf vf23 vf0 vf0)
(.mul.vf vf31 vf28 vf29)
(TODO.VCLIP vf31 vf31)
(.div.vf Q vf0 vf31 :fsf #b11 :ftf #b11)
(.wait.vf)
(.cfc2.i v1-2 Clipping)
(.mul.vf vf28 vf28 Q :mask #b111)
(.mul.vf vf23 vf23 Q)
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(.svf (&-> arg0 quad) vf28)
(not (logtest? v1-2 63))
(.mov v0-0 vf23)
v0-0
)
)
;; definition for function reverse-transform-point!
;; WARN: Return type mismatch vector vs none.
(defun reverse-transform-point! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
"Likely transform arg3 from screen space to world coords, using arg1/arg2 for... something."
(let* ((v1-1 (-> *math-camera* perspective))
(s2-0 (-> *math-camera* camera-rot))
(f30-0 (* (/ (-> v1-1 fvec w) (-> v1-1 rvec x)) (-> *math-camera* hmge-scale w)))
(f28-0 (* (/ (-> v1-1 fvec w) (-> v1-1 uvec y)) (-> *math-camera* hmge-scale w)))
(s4-0 (vector-rotate*! (new 'stack-no-clear 'vector) arg2 s2-0))
(v1-3 (vector-matrix*! (new 'stack-no-clear 'vector) arg1 s2-0))
(f0-8 (/ (+ (* (-> s4-0 x) (-> v1-3 x)) (* (-> s4-0 y) (-> v1-3 y)) (* (-> s4-0 z) (-> v1-3 z)))
(+ (* (-> s4-0 x) (-> arg3 x) f30-0) (* (-> s4-0 y) (-> arg3 y) f28-0) (-> s4-0 z))
)
)
(f1-16 (* (-> arg3 x) f0-8 f30-0))
(f2-9 (* (-> arg3 y) f0-8 f28-0))
(t9-2 vector-matrix*!)
(a0-5 arg0)
(a1-3 (new 'stack-no-clear 'vector))
)
(set! (-> a1-3 x) f1-16)
(set! (-> a1-3 y) f2-9)
(set! (-> a1-3 z) f0-8)
(set! (-> a1-3 w) 1.0)
(t9-2 a0-5 a1-3 (-> *math-camera* inv-camera-rot))
)
(none)
)
;; definition for function init-for-transform
;; INFO: Used lq/sq
;; WARN: Return type mismatch symbol vs none.
(defun init-for-transform ((arg0 matrix))
"Sets up VU0 registers with camera info.
This is probably a very old function and it's only used by camera debug.
It stashes some data in vector float registers that must be there before calling transform-float-point."
(local-vars (v1-14 float))
(rlet ((vf1 :class vf)
(vf17 :class vf)
(vf18 :class vf)
(vf19 :class vf)
(vf2 :class vf)
(vf23 :class vf)
(vf24 :class vf)
(vf25 :class vf)
(vf26 :class vf)
(vf27 :class vf)
(vf28 :class vf)
(vf29 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(let ((gp-0 (new 'stack-no-clear 'matrix)))
(set! (-> gp-0 rvec quad) (the-as uint128 0))
(set! (-> gp-0 uvec quad) (the-as uint128 0))
(set! (-> gp-0 fvec quad) (the-as uint128 0))
(set! (-> gp-0 trans quad) (the-as uint128 0))
(let ((s5-0 (new 'stack-no-clear 'matrix)))
(set! (-> s5-0 rvec quad) (the-as uint128 0))
(set! (-> s5-0 uvec quad) (the-as uint128 0))
(set! (-> s5-0 fvec quad) (the-as uint128 0))
(set! (-> s5-0 trans quad) (the-as uint128 0))
(let ((s4-0 (new 'stack 'vector4s-3))
(s3-0 (new-stack-vector0))
)
(let ((s2-0 (new 'stack 'vector4s-3)))
(matrix*! s5-0 arg0 (-> *math-camera* camera-temp))
(matrix-3x3-inverse-transpose! gp-0 arg0)
(set-vector! s3-0 0.4 0.4 0.4 1.0)
(let ((v1-4 (-> s4-0 data)))
(set! (-> v1-4 0) 1.0)
(set! (-> v1-4 1) 1.0)
(set! (-> v1-4 2) 1.0)
(set! (-> v1-4 3) 1.0)
)
(let ((v1-5 (&-> s4-0 data 4)))
(set! (-> v1-5 0) 0.0)
(set! (-> v1-5 1) 0.0)
(set! (-> v1-5 2) 0.0)
(set! (-> v1-5 3) 1.0)
)
(let ((v1-6 (&-> s4-0 data 8)))
(set! (-> v1-6 0) 0.0)
(set! (-> v1-6 1) 0.0)
(set! (-> v1-6 2) 0.0)
(set! (-> v1-6 3) 1.0)
)
(let ((v1-7 (-> s2-0 data)))
(set! (-> v1-7 0) 1.0)
(set! (-> v1-7 1) 0.0)
(set! (-> v1-7 2) 0.0)
(set! (-> v1-7 3) 1.0)
)
(let ((v1-8 (&-> s2-0 data 4)))
(set! (-> v1-8 0) 0.0)
(set! (-> v1-8 1) 1.0)
(set! (-> v1-8 2) 0.0)
(set! (-> v1-8 3) 1.0)
)
(let ((v1-9 (&-> s2-0 data 8)))
(set! (-> v1-9 0) 0.0)
(set! (-> v1-9 1) 0.0)
(set! (-> v1-9 2) 1.0)
(set! (-> v1-9 3) 1.0)
)
(.lvf vf7 (&-> *math-camera* hmge-scale quad))
(.lvf vf8 (&-> *math-camera* hvdf-off quad))
(.lvf vf9 (&-> *math-camera* giftex))
(let ((v1-13 255))
(.mov vf6 v1-13)
)
(.mov v1-14 vf6)
(.itof.vf vf6 vf6)
(.lvf vf1 (&-> s5-0 rvec quad))
(.lvf vf2 (&-> s5-0 uvec quad))
(.lvf vf3 (&-> s5-0 fvec quad))
(.lvf vf4 (&-> s5-0 trans quad))
(.lvf vf17 (&-> gp-0 rvec quad))
(.lvf vf18 (&-> gp-0 uvec quad))
(.lvf vf19 (&-> gp-0 fvec quad))
(.lvf vf23 (&-> s2-0 quad 0))
(.lvf vf24 (&-> s2-0 quad 1))
(.lvf vf25 (&-> s2-0 quad 2))
)
(.lvf vf27 (&-> s4-0 quad 0))
(.lvf vf28 (&-> s4-0 quad 1))
(.lvf vf29 (&-> s4-0 quad 2))
(.lvf vf26 (&-> s3-0 quad))
)
)
)
(none)
)
)
File diff suppressed because it is too large Load Diff
+302
View File
@@ -0,0 +1,302 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type load-dir
(deftype load-dir (basic)
"`load-dir` is an array of references to loaded things.
It's used to handle art groups that are loaded as part of a level load."
((lev level)
(string-array (array string))
(data-array (array basic))
)
(:methods
(new (symbol type int level) _type_)
(load-to-heap-by-name (_type_ string symbol kheap int) art-group)
(set-loaded-art (_type_ art-group) art-group)
)
)
;; definition of type load-dir-art-group
(deftype load-dir-art-group (load-dir)
"Specialization of load-dir for `art-group`s."
((art-group-array (array art-group) :overlay-at data-array)
)
(:methods
(new (symbol type int level) _type_)
)
)
;; definition for method 0 of type load-dir
(defmethod new load-dir ((allocation symbol) (type-to-make type) (arg0 int) (arg1 level))
(let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> s4-0 lev) arg1)
(set! (-> s4-0 string-array)
(the-as (array string) ((method-of-type array new) allocation array string arg0))
)
(set! (-> s4-0 string-array length) 0)
(set! (-> s4-0 data-array) (the-as (array basic) ((method-of-type array new) allocation array basic arg0)))
(set! (-> s4-0 data-array length) 0)
s4-0
)
)
;; definition for method 0 of type load-dir-art-group
;; WARN: Return type mismatch load-dir vs load-dir-art-group.
(defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (arg0 int) (arg1 level))
(let ((v0-0 ((method-of-type load-dir new) allocation type-to-make arg0 arg1)))
(set! (-> v0-0 data-array content-type) art-group)
(the-as load-dir-art-group v0-0)
)
)
;; definition of type external-art-buffer
(deftype external-art-buffer (basic)
"An `external-art-buffer` is a buffer that streamed files use."
((index int32)
(other external-art-buffer)
(status symbol)
(locked? symbol)
(login? symbol)
(frame-lock symbol)
(init-heap (function external-art-buffer object))
(heap kheap :inline)
(pending-load-file string)
(pending-load-file-part int32)
(pending-load-file-owner handle)
(pending-load-file-priority float)
(load-file string)
(load-file-part int32)
(load-file-owner handle)
(load-file-priority float)
(buf pointer)
(len int32)
(art-group art-group)
(art-data uint32 :overlay-at art-group)
)
(:methods
(new (symbol type int function symbol) _type_)
(set-pending-file (_type_ string int handle float) int)
(update (_type_) int)
(inactive? (_type_) symbol)
(file-status (_type_ string int) symbol)
(link-file (_type_ art-group) art-group)
(unlink-file (_type_ art-group) int)
(unlock! (_type_) int)
)
)
;; definition for method 3 of type external-art-buffer
(defmethod inspect ((this external-art-buffer))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tindex: ~D~%" (-> this index))
(format #t "~1Tother: ~A~%" (-> this other))
(format #t "~1Tstatus: ~A~%" (-> this status))
(format #t "~1Tlocked?: ~A~%" (-> this locked?))
(format #t "~1Tlogin?: ~A~%" (-> this login?))
(format #t "~1Tframe-lock: ~A~%" (-> this frame-lock))
(format #t "~1Tinit-heap: ~A~%" (-> this init-heap))
(format #t "~1Theap: #<kheap @ #x~X>~%" (-> this heap))
(format #t "~1Tpending-load-file: ~A~%" (-> this pending-load-file))
(format #t "~1Tpending-load-file-part: ~D~%" (-> this pending-load-file-part))
(format #t "~1Tpending-load-file-owner: ~D~%" (-> this pending-load-file-owner))
(format #t "~1Tpending-load-file-priority: ~f~%" (-> this pending-load-file-priority))
(format #t "~1Tload-file: ~A~%" (-> this load-file))
(format #t "~1Tload-file-part: ~D~%" (-> this load-file-part))
(format #t "~1Tload-file-owner: ~D~%" (-> this load-file-owner))
(format #t "~1Tload-file-priority: ~f~%" (-> this load-file-priority))
(format #t "~1Tbuf: #x~X~%" (-> this buf))
(format #t "~1Tlen: ~D~%" (-> this len))
(format #t "~1Tart-group: ~A~%" (-> this art-group))
(format #t "~1Tart-data: #x~X~%" (-> this art-group))
(label cfg-4)
this
)
;; definition for method 0 of type external-art-buffer
(defmethod new external-art-buffer ((allocation symbol) (type-to-make type) (arg0 int) (arg1 function) (arg2 symbol))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> v0-0 index) arg0)
(set! (-> v0-0 init-heap) (the-as (function external-art-buffer object) arg1))
(set! (-> v0-0 login?) arg2)
(set! (-> v0-0 load-file) #f)
(set! (-> v0-0 load-file-part) -1)
(set! (-> v0-0 load-file-owner) (the-as handle #f))
(set! (-> v0-0 load-file-priority) 100000000.0)
(set! (-> v0-0 pending-load-file) #f)
(set! (-> v0-0 pending-load-file-part) -1)
(set! (-> v0-0 pending-load-file-owner) (the-as handle #f))
(set! (-> v0-0 pending-load-file-priority) 100000000.0)
(set! (-> v0-0 art-group) #f)
(set! (-> v0-0 status) 'initialize)
(set! (-> v0-0 locked?) #f)
(set! (-> v0-0 other) #f)
v0-0
)
)
;; definition of type spool-anim
(deftype spool-anim (basic)
"A `spool-anim` is metadata for an animation that will be loaded in chunks
to a pair of external-art-buffers."
((name string :offset 16)
(anim-name string)
(buffer external-art-buffer :overlay-at anim-name)
(parts int32)
(hint-id int32 :overlay-at parts)
(priority float)
(owner handle)
(command-list pair)
)
)
;; definition for method 3 of type spool-anim
(defmethod inspect ((this spool-anim))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tname: ~A~%" (-> this name))
(format #t "~1Tanim-name: ~A~%" (-> this anim-name))
(format #t "~1Tparts: ~D~%" (-> this parts))
(format #t "~1Thint-id: ~D~%" (-> this parts))
(format #t "~1Tpriority: ~f~%" (-> this priority))
(format #t "~1Towner: ~D~%" (-> this owner))
(format #t "~1Tcommand-list: ~A~%" (-> this command-list))
(label cfg-4)
this
)
;; definition of type external-art-control
(deftype external-art-control (basic)
"The `external-art-control` manages loading chunks from `spool-anim`s to `external-art-buffer`."
((buffer external-art-buffer 2)
(rec spool-anim 3 :inline)
(spool-lock handle)
(reserve-buffer external-art-buffer)
(reserve-buffer-count int16)
(dma-reserve-buffer-count int16)
(active-stream string)
(queue-stream (array spool-anim))
(frame-mask uint32)
(dma-reserve-heap kheap :inline)
)
(:methods
(new (symbol type) _type_)
(update (_type_ symbol) int)
(clear-rec (_type_) int)
(spool-push (_type_ string int process float) int)
(file-status (_type_ string int) symbol)
(reserve-alloc (_type_) kheap)
(reserve-free (_type_ kheap) int)
(none-reserved? (_type_) symbol)
)
)
;; definition for method 3 of type external-art-control
(defmethod inspect ((this external-art-control))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tbuffer[2] @ #x~X~%" (-> this buffer))
(format #t "~1Trec[3] @ #x~X~%" (-> this rec))
(format #t "~1Tspool-lock: ~D~%" (-> this spool-lock))
(format #t "~1Treserve-buffer: ~A~%" (-> this reserve-buffer))
(format #t "~1Treserve-buffer-count: ~D~%" (-> this reserve-buffer-count))
(format #t "~1Tdma-reserve-buffer-count: ~D~%" (-> this dma-reserve-buffer-count))
(format #t "~1Tactive-stream: ~A~%" (-> this active-stream))
(format #t "~1Tqueue-stream: ~A~%" (-> this queue-stream))
(format #t "~1Tframe-mask: ~D~%" (-> this frame-mask))
(format #t "~1Tdma-reserve-heap: #<kheap @ #x~X>~%" (-> this dma-reserve-heap))
(label cfg-4)
this
)
;; definition for method 0 of type external-art-control
(defmethod new external-art-control ((allocation symbol) (type-to-make type))
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(dotimes (s4-0 2)
(set! (-> gp-0 buffer s4-0)
((method-of-type external-art-buffer new) allocation external-art-buffer s4-0 external-art-buffer-init #t)
)
)
(set! (-> gp-0 buffer 0 other) (-> gp-0 buffer 1))
(set! (-> gp-0 buffer 1 other) (-> gp-0 buffer 0))
(dotimes (v1-9 3)
(set! (-> gp-0 rec v1-9 name) #f)
(set! (-> gp-0 rec v1-9 priority) 100000000.0)
(set! (-> gp-0 rec v1-9 owner) (the-as handle #f))
)
(set! (-> gp-0 spool-lock) (the-as handle #f))
(set! (-> gp-0 reserve-buffer) #f)
(set! (-> gp-0 active-stream) #f)
(set! (-> gp-0 queue-stream) (new 'global 'boxed-array spool-anim 4))
(dotimes (s5-1 (-> gp-0 queue-stream allocated-length))
(set! (-> gp-0 queue-stream s5-1) (new 'global 'spool-anim))
)
(set! (-> gp-0 queue-stream length) 0)
gp-0
)
)
;; definition of type subtitle-range
(deftype subtitle-range (basic)
((start-frame float)
(end-frame float)
(message basic 12)
)
)
;; definition for method 3 of type subtitle-range
(defmethod inspect ((this subtitle-range))
(when (not this)
(set! this this)
(goto cfg-7)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tstart-frame: ~f~%" (-> this start-frame))
(format #t "~1Tend-frame: ~f~%" (-> this end-frame))
(format #t "~1Tmessage[12] @ #x~X~%" (-> this message))
(dotimes (s5-0 12)
(format #t "~T [~D]~1Tmessage: ~`object`P~%" s5-0 (-> this message s5-0))
)
(label cfg-7)
this
)
;; definition of type subtitle-image
(deftype subtitle-image (basic)
((width uint16)
(height uint16)
(palette rgba 16 :offset 16)
(data uint8 :dynamic)
)
)
;; definition for method 3 of type subtitle-image
(defmethod inspect ((this subtitle-image))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Twidth: ~D~%" (-> this width))
(format #t "~1Theight: ~D~%" (-> this height))
(format #t "~1Tpalette[16] @ #x~X~%" (-> this palette))
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
(label cfg-4)
this
)
;; failed to figure out what this is:
0
+97
View File
@@ -0,0 +1,97 @@
;;-*-Lisp-*-
(in-package goal)
;; this file is debug only
(declare-file (debug))
;; definition of type gs-store-image-packet
(deftype gs-store-image-packet (structure)
((vifcode vif-tag 4)
(giftag uint128)
(bitbltbuf uint64)
(bitbltbuf-addr uint64)
(trxpos uint64)
(trxpos-addr uint64)
(trxreg uint64)
(trxreg-addr uint64)
(finish uint64)
(finish-addr uint64)
(trxdir uint64)
(trxdir-addr uint64)
)
)
;; definition for method 3 of type gs-store-image-packet
;; INFO: Used lq/sq
(defmethod inspect ((this gs-store-image-packet))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'gs-store-image-packet)
(format #t "~1Tvifcode[4] @ #x~X~%" (-> this vifcode))
(format #t "~1Tgiftag: ~D~%" (-> this giftag))
(format #t "~1Tbitbltbuf: ~D~%" (-> this bitbltbuf))
(format #t "~1Tbitbltbuf-addr: ~D~%" (-> this bitbltbuf-addr))
(format #t "~1Ttrxpos: ~D~%" (-> this trxpos))
(format #t "~1Ttrxpos-addr: ~D~%" (-> this trxpos-addr))
(format #t "~1Ttrxreg: ~D~%" (-> this trxreg))
(format #t "~1Ttrxreg-addr: ~D~%" (-> this trxreg-addr))
(format #t "~1Tfinish: ~D~%" (-> this finish))
(format #t "~1Tfinish-addr: ~D~%" (-> this finish-addr))
(format #t "~1Ttrxdir: ~D~%" (-> this trxdir))
(format #t "~1Ttrxdir-addr: ~D~%" (-> this trxdir-addr))
(label cfg-4)
this
)
;; definition of type screen-shot-work
(deftype screen-shot-work (structure)
((count int16)
(size int16)
(name string)
(highres-enable symbol)
(hud-enable symbol)
)
)
;; definition for method 3 of type screen-shot-work
(defmethod inspect ((this screen-shot-work))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'screen-shot-work)
(format #t "~1Tcount: ~D~%" (-> this count))
(format #t "~1Tsize: ~D~%" (-> this size))
(format #t "~1Tname: ~A~%" (-> this name))
(format #t "~1Thighres-enable: ~A~%" (-> this highres-enable))
(format #t "~1Thud-enable: ~A~%" (-> this hud-enable))
(label cfg-4)
this
)
;; definition for symbol *screen-shot-work*, type screen-shot-work
(define *screen-shot-work* (new 'global 'screen-shot-work))
;; failed to figure out what this is:
(set! (-> *screen-shot-work* count) -1)
;; failed to figure out what this is:
(set! (-> *screen-shot-work* size) -1)
;; failed to figure out what this is:
(set! (-> *screen-shot-work* highres-enable) #f)
;; failed to figure out what this is:
(set! (-> *screen-shot-work* hud-enable) #f)
;; definition for symbol *image-name*, type string
(define *image-name* (new 'global 'string 32 (the-as string #f)))
;; failed to figure out what this is:
0
+9 -1
View File
@@ -41,7 +41,15 @@
// timer
"(method 9 clock)",
// pad
"service-cpads"
"service-cpads",
// connect
"(method 0 engine)",
"(method 0 engine-pers)",
// math-camera
"update-math-camera",
"transform-point-vector!",
"transform-point-qword!",
"transform-point-vector-scale!"
],
"skip_compile_states": {}