mirror of
https://github.com/open-goal/jak-project
synced 2026-08-17 13:40:39 -04:00
89ccb8cbc7
* cleanup `main` * whitespace * start `progress` decomp pt1 * fill in more stuff * Update label_types.jsonc * run cheats * clang * make most of `progress` decompile * `progress` pt 2 * [decompiler] support dynamic format strings * Make `progress-draw` decompile and almost all `progress` * make clang shut up * fix unhandled format string * fix `progress-draw` * Update DecompilerTypeSystem.cpp * fix? * fixes * fix a few functions * make `language-enum` * warn on weird floats * fix minor pad bug * dump stuff in `progress` * make `progress-screen` enum * progress progress * update refs and fix stupid bug * trying to get it to work * it works!? * disable sound functions * fixes * final touches * tests * tests * add process allocations * use the right register for windows * another try for windows, counting is hard * one more try * use process allocations Co-authored-by: water <awaterford111445@gmail.com>
101 lines
3.2 KiB
Common Lisp
101 lines
3.2 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(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."
|
|
(let ((v0-0 0))
|
|
(while (zero? v0-0)
|
|
;; run the memory card state machine (in C Kernel)
|
|
(mc-run)
|
|
;; see if we got a good response
|
|
(set! v0-0 (mc-check-result))
|
|
)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
(defun show-mc-info ((dma-buf dma-buffer))
|
|
"Print mc info to the screen."
|
|
(let ((info (new 'stack-no-clear 'mc-slot-info)))
|
|
(dotimes (slot-idx 2)
|
|
(mc-get-slot-info slot-idx info)
|
|
(cond
|
|
((zero? (-> info known))
|
|
(format (clear *temp-string*) "SLOT ~D: EXAMINING SLOT~%" slot-idx)
|
|
)
|
|
((zero? (-> info handle))
|
|
(format (clear *temp-string*) "SLOT ~D: NO CARD~%" slot-idx)
|
|
)
|
|
((zero? (-> info formatted))
|
|
(format (clear *temp-string*) "SLOT ~D: CARD [~D] : NOT FORMATTED~%" slot-idx (-> info handle))
|
|
)
|
|
((zero? (-> info inited))
|
|
(format (clear *temp-string*) "SLOT ~D: CARD [~D] : NO FILE [~D/~D]~%"
|
|
slot-idx (-> info handle) (-> info mem-required) (-> info mem-actual))
|
|
)
|
|
(else
|
|
(format (clear *temp-string*) "SLOT ~D: CARD [~D] : " slot-idx (-> info handle))
|
|
(format *temp-string* "SAVES ~D ~D ~D ~D : LAST ~D~%"
|
|
(-> info file 0 present)
|
|
(-> info file 1 present)
|
|
(-> info file 2 present)
|
|
(-> info file 3 present)
|
|
(-> info last-file)
|
|
)
|
|
)
|
|
)
|
|
(draw-string-xy *temp-string* dma-buf 32 (+ (* 12 slot-idx) 8) (font-color orange-red) (font-flags shadow))
|
|
)
|
|
)
|
|
(none)
|
|
)
|