jak-project/goal_src/engine/ps2/memcard-h.gc

68 lines
2.1 KiB
Common Lisp
Raw Normal View History

;;-*-Lisp-*-
2020-09-04 14:44:23 -04:00
(in-package goal)
;; name: memcard-h.gc
;; name in dgo: memcard-h
;; dgos: GAME, ENGINE
(deftype mc-handle (int32)
()
:flag-assert #x900000004
)
(deftype mc-file-info (structure)
((present int32 :offset-assert 0)
(blind-data float 16 :offset-assert 4)
(blind-data-int8 int8 64 :offset 4)
(level-index int32 :offset 4)
(fuel-cell-count float :offset 8)
(money-count float :offset 12)
(buzzer-count float :offset 16)
(completion-percentage float :offset 20)
(minute uint8 :offset 24)
(hour uint8 :offset 25)
(week uint8 :offset 26)
(day uint8 :offset 27)
(month uint8 :offset 28)
(year uint8 :offset 29)
)
:pack-me
:method-count-assert 9
:size-assert #x44
:flag-assert #x900000044
)
(deftype mc-slot-info (structure)
((handle int32 :offset-assert 0)
(known int32 :offset-assert 4)
(formatted int32 :offset-assert 8)
(inited int32 :offset-assert 12)
(last-file int32 :offset-assert 16)
(mem-required int32 :offset-assert 20)
(mem-actual int32 :offset-assert 24)
(file mc-file-info 4 :inline :offset-assert 28)
)
:pack-me
:method-count-assert 9
:size-assert #x12c
:flag-assert #x90000012c
)
(defun mc-sync ()
"Block here, waiting for the memory card to finish being read/written.
Note - this will freeze the entire game, so this should not be used
outside of debugging."
(local-vars (v0-0 int))
(set! v0-0 0)
(while (zero? v0-0)
;; run the memory card state machine (in C Kenrel)
(mc-run)
;; see if we got a good response
(set! v0-0 (mc-check-result))
)
v0-0
)
;; TODO - show-mc-info - failed to decompile
;; WARN: Type Propagation failed: Failed to find a stack variable at offset 16
;; WARN: Type Propagation failed: Type analysis failed