36 lines
849 B
OCaml
36 lines
849 B
OCaml
open import "prelude.ml"
|
|
open import "../pretty.ml"
|
|
open import "../mem/decode.ml"
|
|
open import "../mem/int.ml"
|
|
open import "./item_equips.ml"
|
|
|
|
type save_context = SaveContext of {
|
|
rupees: s16,
|
|
child_equips: item_equips,
|
|
adult_equips: item_equips,
|
|
equips: item_equips
|
|
}
|
|
|
|
instance decode save_context begin
|
|
let decode addr = SaveContext {
|
|
rupees = decode (addr + 0x0034),
|
|
child_equips = decode (addr + 0x0040),
|
|
adult_equips = decode (addr + 0x004A),
|
|
equips = decode (addr + 0x0068)
|
|
}
|
|
end
|
|
|
|
instance prettyrecord save_context begin
|
|
let name _ = "SaveContext"
|
|
let fields (SaveContext x) =
|
|
[
|
|
("rupees", S x.rupees),
|
|
("child_equips", P x.child_equips),
|
|
("adult_equips", P x.adult_equips),
|
|
("equips", P x.equips)
|
|
]
|
|
end
|
|
|
|
instance pretty save_context begin
|
|
let pretty = pretty_from_record
|
|
end
|