2022-06-30 01:22:51 -04:00
|
|
|
;;-*-Lisp-*-
|
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: memcard-h.gc
|
|
|
|
;; name in dgo: memcard-h
|
|
|
|
;; dgos: ENGINE, GAME
|
|
|
|
|
2022-10-11 18:30:26 -04:00
|
|
|
;; +++mc-status-code
|
|
|
|
(defenum mc-status-code
|
|
|
|
:type uint32
|
|
|
|
(busy 0)
|
|
|
|
(ok 1)
|
|
|
|
(bad-handle 2)
|
|
|
|
(format-failed 3)
|
|
|
|
(internal-error 4)
|
|
|
|
(write-error 5)
|
|
|
|
(read-error 6)
|
|
|
|
(new-game 7)
|
|
|
|
(no-memory 8)
|
|
|
|
(no-card 9)
|
|
|
|
(no-last 10)
|
|
|
|
(no-format 11)
|
|
|
|
(no-file 12)
|
|
|
|
(no-save 13)
|
|
|
|
(no-space 14)
|
|
|
|
(bad-version 15)
|
|
|
|
(no-process 16)
|
|
|
|
(no-auto-save 17)
|
|
|
|
)
|
|
|
|
;; ---mc-status-code
|
|
|
|
|
|
|
|
|
2022-08-05 16:12:54 -04:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
2022-08-24 00:29:51 -04:00
|
|
|
(deftype mc-handle (int32)
|
|
|
|
()
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype mc-file-info (structure)
|
2023-10-29 23:20:02 -04:00
|
|
|
((present int32)
|
|
|
|
(blind-data float 16 :offset 4)
|
|
|
|
(blind-data-int8 int8 64 :overlay-at (-> blind-data 0))
|
|
|
|
(level-index int32 :overlay-at (-> blind-data 0))
|
|
|
|
(gem-count float :overlay-at (-> blind-data 1))
|
|
|
|
(skill-count float :overlay-at (-> blind-data 2))
|
|
|
|
(completion-percentage float :overlay-at (-> blind-data 3))
|
|
|
|
(minute uint8 :overlay-at (-> blind-data-int8 20))
|
|
|
|
(hour uint8 :overlay-at (-> blind-data-int8 21))
|
|
|
|
(week uint8 :overlay-at (-> blind-data-int8 22))
|
|
|
|
(day uint8 :overlay-at (-> blind-data-int8 23))
|
|
|
|
(month uint8 :overlay-at (-> blind-data-int8 24))
|
|
|
|
(year uint8 :overlay-at (-> blind-data-int8 25))
|
|
|
|
(game-time0 uint32 :overlay-at (-> blind-data 8))
|
|
|
|
(game-time1 uint32 :overlay-at (-> blind-data 9))
|
|
|
|
(secrets uint32 :overlay-at (-> blind-data 10))
|
|
|
|
(features uint32 :overlay-at (-> blind-data 11))
|
2022-08-24 00:29:51 -04:00
|
|
|
)
|
|
|
|
:pack-me
|
|
|
|
)
|
|
|
|
|
2022-09-27 19:44:20 -04:00
|
|
|
|
2022-08-24 00:29:51 -04:00
|
|
|
(deftype mc-slot-info (structure)
|
2023-10-29 23:20:02 -04:00
|
|
|
((handle int32)
|
|
|
|
(known int32)
|
|
|
|
(formatted int32)
|
|
|
|
(inited int32)
|
|
|
|
(last-file int32)
|
|
|
|
(mem-required int32)
|
|
|
|
(mem-actual int32)
|
|
|
|
(file mc-file-info 4 :inline)
|
2022-08-24 00:29:51 -04:00
|
|
|
)
|
2022-09-27 19:44:20 -04:00
|
|
|
:pack-me
|
2022-08-24 00:29:51 -04:00
|
|
|
)
|
|
|
|
|
2022-09-27 19:44:20 -04:00
|
|
|
|
2022-08-24 00:29:51 -04:00
|
|
|
(defun mc-sync ()
|
|
|
|
(let ((v0-0 0))
|
|
|
|
(while (zero? v0-0)
|
|
|
|
(mc-run)
|
2022-10-29 16:08:04 -04:00
|
|
|
(set! v0-0 (the-as int (mc-check-result)))
|
2022-08-24 00:29:51 -04:00
|
|
|
)
|
|
|
|
v0-0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun show-mc-info ((arg0 dma-buffer))
|
|
|
|
(let ((s5-0 (new 'stack-no-clear 'mc-slot-info)))
|
|
|
|
(dotimes (s4-0 2)
|
|
|
|
(mc-get-slot-info s4-0 s5-0)
|
|
|
|
(cond
|
|
|
|
((zero? (-> s5-0 known))
|
|
|
|
(format (clear *temp-string*) "SLOT ~D: EXAMINING SLOT~%" s4-0)
|
|
|
|
*temp-string*
|
|
|
|
)
|
|
|
|
((zero? (-> s5-0 handle))
|
|
|
|
(format (clear *temp-string*) "SLOT ~D: NO CARD~%" s4-0)
|
|
|
|
*temp-string*
|
|
|
|
)
|
|
|
|
((zero? (-> s5-0 formatted))
|
|
|
|
(format (clear *temp-string*) "SLOT ~D: CARD [~D] : NOT FORMATTED~%" s4-0 (-> s5-0 handle))
|
|
|
|
*temp-string*
|
|
|
|
)
|
|
|
|
((zero? (-> s5-0 inited))
|
|
|
|
(format
|
|
|
|
(clear *temp-string*)
|
|
|
|
"SLOT ~D: CARD [~D] : NO FILE [~D/~D]~%"
|
|
|
|
s4-0
|
|
|
|
(-> s5-0 handle)
|
|
|
|
(-> s5-0 mem-required)
|
|
|
|
(-> s5-0 mem-actual)
|
|
|
|
)
|
|
|
|
*temp-string*
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(format (clear *temp-string*) "SLOT ~D: CARD [~D] : " s4-0 (-> s5-0 handle))
|
|
|
|
*temp-string*
|
|
|
|
(format
|
|
|
|
*temp-string*
|
|
|
|
"SAVES ~D ~D ~D ~D : LAST ~D~%"
|
|
|
|
(-> s5-0 file 0 present)
|
|
|
|
(-> s5-0 file 1 present)
|
|
|
|
(-> s5-0 file 2 present)
|
|
|
|
(-> s5-0 file 3 present)
|
|
|
|
(-> s5-0 last-file)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2023-02-25 10:19:32 -05:00
|
|
|
(draw-string-xy *temp-string* arg0 32 (+ (* 12 s4-0) 8) (font-color red) (font-flags shadow))
|
2022-08-24 00:29:51 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|