fixes for decompiler, still need compiler fixes

This commit is contained in:
water
2022-10-10 20:18:20 -04:00
parent a409f9064e
commit e4a740c346
9 changed files with 2363 additions and 325 deletions
+27 -3
View File
@@ -6589,8 +6589,15 @@
:bitfield #f
(null 0)
(pause 257)
(text-x102 #x0102)
(text-x103 #x0103)
(text-x107 #x0107)
(progress-sound-music-volume 264)
(progress-sound-speech-volume 265)
(text-x10a #x010a)
(text-x10b #x010b)
(text-x10c #x010c)
(text-x10d #x010d)
(progress-on 270)
(progress-off 271)
(progress-move-dpad 272)
@@ -6622,6 +6629,7 @@
(progress-title-prompt 306)
(progress-quit 307)
(progress-root-show-map 308)
(text-x135 #x0135)
(progress-root-highscores 310)
(progress-highscores-1st 311)
(progress-highscores-2nd 312)
@@ -6633,6 +6641,10 @@
(progress-highscores-8th 318)
(progress-root-secrets 339)
(progress-secrets-unlocked 340)
(text-x155 #x0155)
(text-x156 #x0156)
(text-x157 #x0157)
(text-x158 #x0158)
(progress-main-secrets-hero-mode 345)
(progress-main-secrets-sceneplayer-1 346)
(progress-main-secrets-sceneplayer-2 347)
@@ -6641,13 +6653,25 @@
(progress-main-secrets-mega-scrapbook 350)
(progress-main-secrets-scrapbook-3 351)
(progress-main-secrets-levelselect 352)
(text-x160 #x0160)
(text-x161 #x0161)
(text-x162 #x0162)
(text-x163 #x0163)
(text-x164 #x0164)
(text-x165 #x0165)
(text-x166 #x0166)
(text-x167 #x0167)
(progress-secrets-orb-label 360)
(progress-root-missions 361)
(text-x16a #x016a)
(text-x16b #x016b)
(text-x16d #x016d)
(progress-root-restart-mission 366)
(progress-missions-icon-todo 367)
(progress-missions-icon-completed 368)
(progress-missions-none 369)
(progress-unknown-game 370)
(text-x173 #x0173)
(progress-unknown-square-to-reset 377)
(progress-unknown-oi1un23i13 380)
(progress-unknown-kjanskd 381)
@@ -20918,12 +20942,12 @@
((name game-text-id :offset-assert 4)
(scale float :offset-assert 8)
(unknown function :offset-assert 12)
(unknown-symbol symbol :offset 8)
;; This is gross if im correct
;; this HAS to have a bunch of `menu-option`s -- look at `(method 24 progress)` and `(method 25 progress)`
;; - i think it might just be that each menu "page" can have 8 menu-options on it?
;; but the drawing code also heavily implies it can also be a `hud-box` (finally the `box` name makes sense)
(box hud-box 1 :inline :offset-assert 16)
(options menu-option 8 :offset 16)
)
:method-count-assert 12
:size-assert #x30
@@ -21315,7 +21339,7 @@
((y-center int32 :offset-assert 4)
(y-space int32 :offset-assert 8)
(scale float :offset-assert 12)
(options menu-option :dynamic :offset-assert 16)
(options (array menu-option) :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
@@ -30069,7 +30093,7 @@
)
(define-extern progress-selected (function int int :behavior progress))
(define-extern draw-percent-bar (function int int float rgba none)) ;;
(define-extern draw-percent-bar (function int int float rgba none)) ;;
(define-extern draw-highlight (function int int float pointer))
(define-extern draw-busy-loading (function font-context float :behavior progress))
(define-extern draw-previous-next (function menu-highscores-option font-context symbol none))
+330 -217
View File
@@ -303,6 +303,64 @@ goos::Object decompile_value_array(const TypeSpec& elt_type,
return pretty_print::build_list(array_def);
}
goos::Object decompile_ref_array(const TypeSpec& elt_type,
int length,
int my_seg,
int offset_in_seg,
const std::vector<DecompilerLabel>& labels,
const std::vector<std::vector<LinkedWord>>& words,
const TypeSystem& ts,
const LinkedObjectFile* file,
GameVersion version,
const Field* field_for_errors,
const TypeSpec* actual_type_for_errors) {
std::vector<goos::Object> array_def = {
pretty_print::to_symbol(fmt::format("new 'static 'array {} {}", elt_type.print(), length))};
int end_elt = 0;
for (int elt = length; elt-- > 0;) {
auto& word = words.at(my_seg).at((offset_in_seg / 4) + elt);
if (word.kind() == LinkedWord::PLAIN_DATA && word.data == 0) {
continue;
}
end_elt = elt + 1;
break;
}
for (int elt = 0; elt < end_elt; elt++) {
auto& word = words.at(my_seg).at((offset_in_seg / 4) + elt);
if (word.kind() == LinkedWord::PTR) {
array_def.push_back(decompile_at_label(elt_type, labels.at(word.label_id()), labels, words,
ts, file, version));
} else if (word.kind() == LinkedWord::PLAIN_DATA && word.data == 0) {
// do nothing, the default is zero?
array_def.push_back(pretty_print::to_symbol("0"));
} else if (word.kind() == LinkedWord::SYM_PTR) {
if (word.symbol_name() == "#f" || word.symbol_name() == "#t") {
array_def.push_back(pretty_print::to_symbol(fmt::format("{}", word.symbol_name())));
} else {
array_def.push_back(pretty_print::to_symbol(fmt::format("'{}", word.symbol_name())));
}
} else if (word.kind() == LinkedWord::EMPTY_PTR) {
array_def.push_back(pretty_print::to_symbol("'()"));
} else {
if (field_for_errors && actual_type_for_errors) {
throw std::runtime_error(
fmt::format("Field {} in type {} offset {} did not have a proper reference for "
"array element {} k = {}",
field_for_errors->name(), actual_type_for_errors->print(),
field_for_errors->offset(), elt, (int)word.kind()));
} else {
throw std::runtime_error(
fmt::format("Failed to decompile_ref_array: offset {}, elt {}, type {}, k = {}",
offset_in_seg, elt, elt_type.print(), (int)word.kind()));
}
}
}
return pretty_print::build_list(array_def);
}
namespace {
float word_as_float(const LinkedWord& w) {
ASSERT(w.kind() == LinkedWord::PLAIN_DATA);
@@ -430,6 +488,90 @@ goos::Object decomp_ref_to_integer_array_guess_size(
all_words.at(start_label.target_segment), ts);
}
// TODO: add some disclaimer about this.
goos::Object decomp_ref_to_ref_array_guess_size(
const std::vector<DecompilerLabel>& labels,
int my_seg,
int offset_of_array,
const TypeSystem& ts,
const std::vector<std::vector<LinkedWord>>& all_words,
const LinkedObjectFile* file,
const TypeSpec& array_elt_type,
int stride) {
// verify types
auto elt_type_info = ts.lookup_type(array_elt_type);
ASSERT(stride == 4);
ASSERT(elt_type_info->is_reference());
// the input is the location of the data field.
// we expect that to be a label:
ASSERT((offset_of_array % 4) == 0);
// auto pointer_to_data = all_words.at(my_seg).at(offset_of_array / 4);
// ASSERT(pointer_to_data.kind() == LinkedWord::PTR);
// the data shouldn't have any labels in the middle of it, so we can find the end of the array
// by searching for the label after the start label.
// const auto& start_label = labels.at(pointer_to_data.label_id());
int end_label_idx =
index_of_closest_following_label_in_segment(offset_of_array, my_seg, labels);
int end_offset = all_words.at(my_seg).size() * 4;
if (end_label_idx < 0) {
lg::warn(
"Failed to find label: likely just an unimplemented case for when the data is the last "
"thing in the file.");
} else {
const auto& end_label = labels.at(end_label_idx);
end_offset = end_label.offset;
}
// see if we need to cheat it back 4 bytes for a type tag
while (end_offset >= 4) {
auto& last_word = all_words.at(my_seg).at((end_offset - 4) / 4);
if (last_word.kind() == LinkedWord::TYPE_PTR) {
end_offset -= 4;
} else if (last_word.kind() == LinkedWord::SYM_PTR) {
end_offset -= 4;
} else if (last_word.kind() == LinkedWord::PLAIN_DATA && last_word.data == 0) {
end_offset -= 4;
} else {
break;
}
}
// now we can figure out the size
int size_bytes = end_offset - offset_of_array;
int size_elts = size_bytes / stride; // 32 bytes per ocean-near-index
int leftover_bytes = size_bytes % stride;
// lg::print("Size is {} bytes ({} elts), with {} bytes left over\n", size_bytes,
// size_elts,leftover_bytes);
// if we have leftover, should verify that its all zeros, or that it's the type pointer
// of the next basic in the data section.
// ex:
// .word <data>
// .type <some-other-basic's type tag>
// L21: ; label some other basic
// <other basic's data>
int padding_start = end_offset - leftover_bytes;
int padding_end = end_offset;
for (int pad_byte_idx = padding_start; pad_byte_idx < padding_end; pad_byte_idx++) {
auto& word = all_words.at(my_seg).at(pad_byte_idx / 4);
switch (word.kind()) {
case LinkedWord::PLAIN_DATA:
ASSERT(word.get_byte(pad_byte_idx) == 0);
break;
case LinkedWord::TYPE_PTR:
break;
default:
ASSERT(false);
}
}
return decompile_ref_array(array_elt_type, size_elts, my_seg, offset_of_array, labels, all_words,
ts, file, file->version, nullptr, nullptr);
}
/*!
* Attempt to decompile a reference to an inline array, without knowing the size.
*/
@@ -994,255 +1136,226 @@ goos::Object decompile_structure(const TypeSpec& type,
}
}
if (all_zero) {
// special case for dynamic arrays at the end of a type
// TODO - this causes an assert in Type.hL240
// if (!(field_start == field_end && field.is_dynamic())) {
// // field has nothing in it, just skip it.
// continue;
//}
continue;
}
if (any_overlap) {
// for now, let's just skip fields that overlapped with the previous.
// eventually we should do something smarter here...
continue;
}
// first, let's see if it's a value or reference
auto field_type_info = ts.lookup_type_allow_partial_def(field.type());
if (!field_type_info->is_reference() && field.type() != TypeSpec("object")) {
// value type. need to get bytes.
ASSERT(!field.is_inline());
if (field.is_array()) {
// array of values.
auto len = field.array_size();
auto stride = ts.get_size_in_type(field) / len;
ASSERT(stride == field_type_info->get_size_in_memory());
field_defs_out.emplace_back(
field.name(), decompile_value_array(field.type(), field_type_info, len, stride,
field_start, obj_words, ts));
} else if (field.is_dynamic()) {
throw std::runtime_error(
fmt::format("Dynamic value field {} in static data type {} not yet implemented",
field.name(), actual_type.print()));
} else {
// TODO - this is getting a little unwieldly -- refactor this at some point
if (field.name() == "data" && type.print() == "ocean-near-indices") {
// first, get the label:
field_defs_out.emplace_back(
field.name(), ocean_near_indices_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "data" && type.print() == "ocean-mid-masks") {
field_defs_out.emplace_back(
field.name(), ocean_mid_masks_decompile(obj_words, labels, label.target_segment,
// TODO - this is getting a little unwieldly -- refactor this at some point
if (field.name() == "data" && type.print() == "ocean-near-indices") {
// first, get the label:
field_defs_out.emplace_back(
field.name(), ocean_near_indices_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "data" && type.print() == "ocean-mid-masks") {
field_defs_out.emplace_back(field.name(),
ocean_mid_masks_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "init-specs" && type.print() == "sparticle-launcher") {
field_defs_out.emplace_back(
field.name(), sp_field_init_spec_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "vertex" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_vertex_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "init-specs" && type.print() == "sparticle-launcher") {
field_defs_out.emplace_back(
field.name(), sp_field_init_spec_decompile(obj_words, labels, label.target_segment,
} else if (field.name() == "poly" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_poly_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "poly-array" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(
field.name(), nav_mesh_poly_arr_jak2_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "vertex" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_vertex_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "poly" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_poly_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "poly-array" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(field.name(), nav_mesh_poly_arr_jak2_decompile(
obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "nav-control-array" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(field.name(), nav_mesh_nav_control_arr_decompile(
obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "data" && type.print() == "xz-height-map" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(field.name(), xz_height_map_data_arr_decompile(
obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "route" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_route_arr_decompile(obj_words, labels, label.target_segment,
} else if (field.name() == "nav-control-array" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(
field.name(), nav_mesh_nav_control_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "data" && type.print() == "xz-height-map" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(
field.name(), xz_height_map_data_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "launcher" && type.print() == "sparticle-launch-group") {
field_defs_out.emplace_back(field.name(), sp_launch_grp_launcher_decompile(
obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "col-mesh-indexes" && type.print() == "ropebridge-tuning") {
field_defs_out.emplace_back(
field.name(), decomp_ref_to_integer_array_guess_size(
obj_words, labels, label.target_segment, field_start, ts, words,
file, TypeSpec("uint8"), 1));
} else if (field.name() == "probe-dirs" && type.print() == "lightning-probe-vars") {
field_defs_out.emplace_back(field.name(),
probe_dir_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else {
if (field.type().base_type() == "pointer") {
if (obj_words.at(field_start / 4).kind() != LinkedWord::SYM_PTR) {
continue;
}
if (obj_words.at(field_start / 4).symbol_name() != "#f") {
lg::warn("Got a weird symbol in a pointer field: {}",
obj_words.at(field_start / 4).symbol_name());
continue;
}
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("#f"));
} else {
if (obj_words.at(field_start / 4).kind() != LinkedWord::PLAIN_DATA) {
continue;
}
std::vector<u8> bytes_out;
for (int byte_idx = field_start; byte_idx < field_end; byte_idx++) {
bytes_out.push_back(obj_words.at(byte_idx / 4).get_byte(byte_idx % 4));
}
field_defs_out.emplace_back(field.name(), decompile_value(field.type(), bytes_out, ts));
}
}
} else if (field.name() == "route" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_route_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "launcher" && type.print() == "sparticle-launch-group") {
field_defs_out.emplace_back(
field.name(), sp_launch_grp_launcher_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file, version));
} else if (field.name() == "col-mesh-indexes" && type.print() == "ropebridge-tuning") {
field_defs_out.emplace_back(
field.name(), decomp_ref_to_integer_array_guess_size(
obj_words, labels, label.target_segment, field_start, ts, words, file,
TypeSpec("uint8"), 1));
} else if (field.name() == "probe-dirs" && type.print() == "lightning-probe-vars") {
field_defs_out.emplace_back(
field.name(), probe_dir_decompile(obj_words, labels, label.target_segment, field_start,
ts, words, file, version));
} else if (field.name() == "options" && type.print() == "menu-option-list") {
field_defs_out.emplace_back(
field.name(), decomp_ref_to_ref_array_guess_size(
labels, label.target_segment, field_start + offset_location, ts, words,
file, TypeSpec("array", {TypeSpec("menu-option")}), 4));
} else {
if (all_zero) {
// special case for dynamic arrays at the end of a type
continue;
}
} else {
if (!field.is_dynamic() && !field.is_array() && field.is_inline()) {
// inline structure!
DecompilerLabel fake_label;
fake_label.target_segment = label.target_segment;
// offset from real start of outer + field offset + tag, we want to fake that.
fake_label.offset = offset_location + field.offset() + field_type_info->get_offset();
fake_label.name = fmt::format("fake-label-{}-{}", actual_type.print(), field.name());
field_defs_out.emplace_back(
field.name(),
decompile_at_label(field.type(), fake_label, labels, words, ts, file, version));
} else if (!field.is_dynamic() && field.is_array() && field.is_inline()) {
// it's an inline array. let's figure out the len and stride
auto len = field.array_size();
auto total_size = ts.get_size_in_type(field);
auto stride = total_size / len;
ASSERT(stride * len == total_size);
ASSERT(stride == align(field_type_info->get_size_in_memory(),
field_type_info->get_inline_array_stride_alignment()));
// first, let's see if it's a value or reference
auto field_type_info = ts.lookup_type_allow_partial_def(field.type());
if (!field_type_info->is_reference() && field.type() != TypeSpec("object")) {
// value type. need to get bytes.
ASSERT(!field.is_inline());
if (field.is_array()) {
// array of values.
auto len = field.array_size();
auto stride = ts.get_size_in_type(field) / len;
ASSERT(stride == field_type_info->get_size_in_memory());
std::vector<goos::Object> array_def = {pretty_print::to_symbol(fmt::format(
"new 'static 'inline-array {} {}", field.type().print(), field.array_size()))};
for (int elt = 0; elt < len; elt++) {
field_defs_out.emplace_back(
field.name(), decompile_value_array(field.type(), field_type_info, len, stride,
field_start, obj_words, ts));
} else if (field.is_dynamic()) {
throw std::runtime_error(
fmt::format("Dynamic value field {} in static data type {} not yet implemented",
field.name(), actual_type.print()));
} else {
{
if (field.type().base_type() == "pointer") {
if (obj_words.at(field_start / 4).kind() != LinkedWord::SYM_PTR) {
continue;
}
if (obj_words.at(field_start / 4).symbol_name() != "#f") {
lg::warn("Got a weird symbol in a pointer field: {}",
obj_words.at(field_start / 4).symbol_name());
continue;
}
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("#f"));
} else {
if (obj_words.at(field_start / 4).kind() != LinkedWord::PLAIN_DATA) {
continue;
}
std::vector<u8> bytes_out;
for (int byte_idx = field_start; byte_idx < field_end; byte_idx++) {
bytes_out.push_back(obj_words.at(byte_idx / 4).get_byte(byte_idx % 4));
}
field_defs_out.emplace_back(field.name(),
decompile_value(field.type(), bytes_out, ts));
}
}
}
} else {
if (!field.is_dynamic() && !field.is_array() && field.is_inline()) {
// inline structure!
DecompilerLabel fake_label;
fake_label.target_segment = label.target_segment;
// offset from real start of outer + field offset + tag, we want to fake that.
fake_label.offset =
offset_location + field.offset() + field_type_info->get_offset() + stride * elt;
fake_label.name =
fmt::format("fake-label-{}-{}-elt-{}", actual_type.print(), field.name(), elt);
array_def.push_back(
fake_label.offset = offset_location + field.offset() + field_type_info->get_offset();
fake_label.name = fmt::format("fake-label-{}-{}", actual_type.print(), field.name());
field_defs_out.emplace_back(
field.name(),
decompile_at_label(field.type(), fake_label, labels, words, ts, file, version));
}
field_defs_out.emplace_back(field.name(), pretty_print::build_list(array_def));
} else if (!field.is_dynamic() && field.is_array() && !field.is_inline()) {
auto len = field.array_size();
auto total_size = ts.get_size_in_type(field);
auto stride = total_size / len;
ASSERT(stride * len == total_size);
ASSERT(stride == 4);
} else if (!field.is_dynamic() && field.is_array() && field.is_inline()) {
// it's an inline array. let's figure out the len and stride
auto len = field.array_size();
auto total_size = ts.get_size_in_type(field);
auto stride = total_size / len;
ASSERT(stride * len == total_size);
ASSERT(stride == align(field_type_info->get_size_in_memory(),
field_type_info->get_inline_array_stride_alignment()));
std::vector<goos::Object> array_def = {pretty_print::to_symbol(
fmt::format("new 'static 'array {} {}", field.type().print(), field.array_size()))};
int end_elt = 0;
for (int elt = len; elt-- > 0;) {
auto& word = obj_words.at((field_start / 4) + elt);
if (word.kind() == LinkedWord::PLAIN_DATA && word.data == 0) {
continue;
std::vector<goos::Object> array_def = {pretty_print::to_symbol(fmt::format(
"new 'static 'inline-array {} {}", field.type().print(), field.array_size()))};
for (int elt = 0; elt < len; elt++) {
DecompilerLabel fake_label;
fake_label.target_segment = label.target_segment;
// offset from real start of outer + field offset + tag, we want to fake that.
fake_label.offset =
offset_location + field.offset() + field_type_info->get_offset() + stride * elt;
fake_label.name =
fmt::format("fake-label-{}-{}-elt-{}", actual_type.print(), field.name(), elt);
array_def.push_back(
decompile_at_label(field.type(), fake_label, labels, words, ts, file, version));
}
end_elt = elt + 1;
break;
}
field_defs_out.emplace_back(field.name(), pretty_print::build_list(array_def));
} else if (!field.is_dynamic() && field.is_array() && !field.is_inline()) {
auto len = field.array_size();
auto total_size = ts.get_size_in_type(field);
auto stride = total_size / len;
ASSERT(stride * len == total_size);
ASSERT(stride == 4);
for (int elt = 0; elt < end_elt; elt++) {
auto& word = obj_words.at((field_start / 4) + elt);
int offset = field_start + offset_location;
auto array_def =
decompile_ref_array(field.type(), field.array_size(), label.target_segment, offset,
labels, words, ts, file, version, &field, &actual_type);
field_defs_out.emplace_back(field.name(), array_def);
} else if (field.is_dynamic() || field.is_array() || field.is_inline()) {
throw std::runtime_error(fmt::format(
"Dynamic/array/inline reference field {} type {} in static data not yet implemented",
field.name(), actual_type.print()));
} else {
// then we expect a label.
ASSERT(field_end - field_start == 4);
auto& word = obj_words.at(field_start / 4);
if (word.kind() == LinkedWord::PTR) {
array_def.push_back(decompile_at_label(field.type(), labels.at(word.label_id()), labels,
if (field.type() == TypeSpec("symbol")) {
continue;
}
if (field.type() == TypeSpec("object")) {
field_defs_out.emplace_back(
field.name(), decompile_at_label_guess_type(labels.at(word.label_id()), labels,
words, ts, file, version));
} else {
field_defs_out.emplace_back(
field.name(), decompile_at_label(field.type(), labels.at(word.label_id()), labels,
words, ts, file, version));
}
} else if (word.kind() == LinkedWord::PLAIN_DATA && word.data == 0) {
// do nothing, the default is zero?
array_def.push_back(pretty_print::to_symbol("0"));
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("0"));
} else if (word.kind() == LinkedWord::SYM_PTR) {
if (word.symbol_name() == "#f" || word.symbol_name() == "#t") {
array_def.push_back(pretty_print::to_symbol(fmt::format("{}", word.symbol_name())));
field_defs_out.emplace_back(
field.name(), pretty_print::to_symbol(fmt::format("{}", word.symbol_name())));
} else {
array_def.push_back(pretty_print::to_symbol(fmt::format("'{}", word.symbol_name())));
field_defs_out.emplace_back(
field.name(), pretty_print::to_symbol(fmt::format("'{}", word.symbol_name())));
}
} else if (word.kind() == LinkedWord::EMPTY_PTR) {
array_def.push_back(pretty_print::to_symbol("'()"));
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("'()"));
} else if (word.kind() == LinkedWord::TYPE_PTR) {
if (field.type() != TypeSpec("type")) {
throw std::runtime_error(fmt::format(
"Field {} in type {} offset {} had a reference to type {}, but the "
"type of the field is not type.",
field.name(), actual_type.print(), field.offset(), word.symbol_name()));
}
int method_count = ts.get_type_method_count(word.symbol_name());
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol(fmt::format(
"(type-ref {} :method-count {})",
word.symbol_name(), method_count)));
} else {
throw std::runtime_error(fmt::format(
"Field {} in type {} offset {} did not have a proper reference for "
"array element {} k = {}",
field.name(), actual_type.print(), field.offset(), elt, (int)word.kind()));
}
}
field_defs_out.emplace_back(field.name(), pretty_print::build_list(array_def));
} else if (field.is_dynamic() || field.is_array() || field.is_inline()) {
throw std::runtime_error(fmt::format(
"Dynamic/array/inline reference field {} type {} in static data not yet implemented",
field.name(), actual_type.print()));
} else {
// then we expect a label.
ASSERT(field_end - field_start == 4);
auto& word = obj_words.at(field_start / 4);
if (word.kind() == LinkedWord::PTR) {
if (field.type() == TypeSpec("symbol")) {
continue;
}
if (field.type() == TypeSpec("object")) {
field_defs_out.emplace_back(
field.name(),
decompile_at_label_guess_type(labels.at(word.label_id()), labels, words, ts, file, version));
} else {
field_defs_out.emplace_back(
field.name(), decompile_at_label(field.type(), labels.at(word.label_id()), labels,
words, ts, file, version));
}
} else if (word.kind() == LinkedWord::PLAIN_DATA && word.data == 0) {
// do nothing, the default is zero?
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("0"));
} else if (word.kind() == LinkedWord::SYM_PTR) {
if (word.symbol_name() == "#f" || word.symbol_name() == "#t") {
field_defs_out.emplace_back(
field.name(), pretty_print::to_symbol(fmt::format("{}", word.symbol_name())));
} else {
field_defs_out.emplace_back(
field.name(), pretty_print::to_symbol(fmt::format("'{}", word.symbol_name())));
}
} else if (word.kind() == LinkedWord::EMPTY_PTR) {
field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("'()"));
} else if (word.kind() == LinkedWord::TYPE_PTR) {
if (field.type() != TypeSpec("type")) {
throw std::runtime_error(
fmt::format("Field {} in type {} offset {} had a reference to type {}, but the "
"type of the field is not type.",
field.name(), actual_type.print(), field.offset(), word.symbol_name()));
fmt::format("Field {} in type {} offset {} did not have a proper reference",
field.name(), actual_type.print(), field.offset()));
}
int method_count = ts.get_type_method_count(word.symbol_name());
field_defs_out.emplace_back(
field.name(), pretty_print::to_symbol(fmt::format("(type-ref {} :method-count {})",
word.symbol_name(), method_count)));
} else {
throw std::runtime_error(
fmt::format("Field {} in type {} offset {} did not have a proper reference",
field.name(), actual_type.print(), field.offset()));
}
}
}
@@ -76,8 +76,8 @@
((name game-text-id :offset-assert 4)
(scale float :offset-assert 8)
(unknown function :offset-assert 12)
(unknown-symbol symbol :offset 8)
(box hud-box 1 :inline :offset-assert 16)
(options menu-option 8 :offset 16)
)
:method-count-assert 12
:size-assert #x30
@@ -428,10 +428,10 @@
(deftype menu-option-list (basic)
((y-center int32 :offset-assert 4)
(y-space int32 :offset-assert 8)
(scale float :offset-assert 12)
(options menu-option :dynamic :offset-assert 16)
((y-center int32 :offset-assert 4)
(y-space int32 :offset-assert 8)
(scale float :offset-assert 12)
(options (array menu-option) :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
File diff suppressed because it is too large Load Diff
+121 -7
View File
@@ -5,10 +5,9 @@
;; name in dgo: progress
;; dgos: ENGINE, GAME
(set! *progress-process* #f)
;; DECOMP BEGINS
;; definition of type progress-global-state
(deftype progress-global-state (basic)
((aspect-ratio-choice symbol :offset-assert 4)
(video-mode-choice symbol :offset-assert 8)
@@ -63,19 +62,25 @@
:flag-assert #x9000000e8
)
;; definition for symbol *progress-stack*, type (pointer uint8)
(define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800)))
;; definition for symbol *progress-process*, type (pointer progress)
(define *progress-process* (the-as (pointer progress) #f))
;; definition for symbol *progress-state*, type progress-global-state
(define *progress-state* (new 'static 'progress-global-state :which-slot -1 :last-slot-saved -1))
;; failed to figure out what this is:
(kmemopen global "mc-slot-info")
;; definition for symbol *progress-save-info*, type mc-slot-info
(define *progress-save-info* (new 'global 'mc-slot-info))
;; failed to figure out what this is:
(kmemclose)
;; definition for function min-max-wrap-around
(defun min-max-wrap-around ((arg0 int) (arg1 int) (arg2 int))
(let ((v1-2 (+ (- 1 arg1) arg2)))
(while (< arg0 arg1)
@@ -88,6 +93,7 @@
arg0
)
;; definition for function progress-intro-start
(defun progress-intro-start ((arg0 symbol))
(set! (-> *game-info* mode) 'play)
(if arg0
@@ -98,6 +104,7 @@
0
)
;; definition for method 24 of type progress
(defmethod init-defaults progress ((obj progress))
"Initialize default menu settings."
(set! (-> *progress-state* aspect-ratio-choice) (get-aspect-ratio))
@@ -203,6 +210,7 @@
(set-setting-by-param *setting-control* 'extra-bank '((force2 menu1)) 0 0)
)
;; definition of type hud-ring-cell
(deftype hud-ring-cell (process-drawable)
((parent-override (pointer progress) :offset 16)
(joint-idx int32 :offset-assert 200)
@@ -218,7 +226,24 @@
)
)
;; definition for method 3 of type hud-ring-cell
(defmethod inspect hud-ring-cell ((obj hud-ring-cell))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 obj)
)
(format #t "~2Tjoint-idx: ~D~%" (-> obj joint-idx))
(format #t "~2Tinit-angle: ~f~%" (-> obj init-angle))
(format #t "~2Tgraphic-index: ~D~%" (-> obj graphic-index))
(label cfg-4)
obj
)
;; definition for function hud-ring-cell-init-by-other
;; INFO: Used lq/sq
(defbehavior hud-ring-cell-init-by-other hud-ring-cell ((arg0 int) (arg1 float) (arg2 int))
(set! (-> self root) (new 'process 'trsqv))
(initialize-skeleton
@@ -287,6 +312,7 @@
(go-virtual idle)
)
;; failed to figure out what this is:
(defstate idle (hud-ring-cell)
:virtual #t
:code (behavior ()
@@ -377,6 +403,7 @@
)
)
;; definition for function progress-init-by-other
(defbehavior progress-init-by-other progress ((arg0 symbol))
(hide-hud #f)
(disable-level-text-file-loading)
@@ -437,6 +464,8 @@
(go-virtual come-in)
)
;; definition for function set-ring-position
;; INFO: Used lq/sq
(defun set-ring-position ((arg0 progress))
(let ((s3-0 (new-stack-vector0))
(s4-0 (new 'stack-no-clear 'vector))
@@ -460,6 +489,8 @@
)
)
;; definition for function activate-progress
;; WARN: Return type mismatch int vs none.
(defun activate-progress ((arg0 process) (arg1 symbol))
(when *target*
(when (progress-allowed?)
@@ -492,6 +523,7 @@
(none)
)
;; definition for method 10 of type progress
(defmethod deactivate progress ((obj progress))
(remove-setting-by-arg0 *setting-control* 'extra-bank)
((method-of-object *bigmap* bigmap-method-15))
@@ -504,6 +536,8 @@
(none)
)
;; definition for function deactivate-progress
;; WARN: Return type mismatch int vs none.
(defun deactivate-progress ()
(if *progress-process*
(deactivate (-> *progress-process* 0))
@@ -512,6 +546,8 @@
(none)
)
;; definition for function hide-progress-screen
;; WARN: Return type mismatch int vs none.
(defun hide-progress-screen ()
(if (and *progress-process* *progress-state* (!= (-> *progress-state* starting-state) 'title))
(set-next-state (-> *progress-process* 0) 'go-away 0)
@@ -520,6 +556,7 @@
(none)
)
;; definition for method 26 of type progress
(defmethod progress-method-26 progress ((obj progress))
(and *progress-process*
(-> *progress-process* 0 next-state)
@@ -527,6 +564,7 @@
)
)
;; definition for function progress-allowed?
(defun progress-allowed? ()
(not (or (-> *setting-control* user-current talking)
(-> *setting-control* user-current movie)
@@ -552,6 +590,7 @@
)
)
;; definition for method 27 of type progress
(defmethod can-go-back? progress ((obj progress))
(and (= (-> obj menu-transition) 0.0)
(not (-> obj selected-option))
@@ -576,6 +615,7 @@
)
)
;; definition for function menu-update-purchase-secrets
;; WARN: Return type mismatch symbol vs none.
(defun menu-update-purchase-secrets ((arg0 menu-secret-option))
(let* ((a1-1 (logtest? (-> *game-info* secrets) (game-secrets hero-mode)))
@@ -610,6 +650,7 @@
(none)
)
;; definition for method 28 of type progress
(defmethod progress-method-28 progress ((obj progress) (arg0 symbol))
(let ((v1-0 *progress-save-info*)
(v0-0 arg0)
@@ -707,6 +748,7 @@
)
)
;; definition for method 29 of type progress
(defmethod progress-method-29 progress ((obj progress))
(let ((v1-0 (-> obj state-pos)))
(cond
@@ -723,6 +765,7 @@
0
)
;; definition for method 30 of type progress
(defmethod progress-method-30 progress ((obj progress))
(let ((v1-0 (-> obj state-pos)))
(cond
@@ -746,6 +789,7 @@
0
)
;; definition for method 31 of type progress
(defmethod set-next-state progress ((obj progress) (arg0 symbol) (arg1 int))
"Set the next menu state specified by arg0 at the index specified by arg1."
(set! (-> *progress-state* clear-screen) #f)
@@ -792,6 +836,7 @@
0
)
;; definition for method 32 of type progress
(defmethod set-menu-options progress ((obj progress) (arg0 symbol))
"Set the menu options for the menu state specified by arg0."
(set! (-> obj current-options) #f)
@@ -999,13 +1044,15 @@
0
)
;; definition for method 25 of type progress
;; WARN: Return type mismatch int vs none.
(defmethod progress-method-25 progress ((obj progress))
(mc-get-slot-info 0 *progress-save-info*)
(when (-> obj current-options)
(let ((s5-0 (-> obj current-options options 0)))
(when (and s5-0 (= (-> obj menu-transition) 0.0))
(respond-progress
(the-as menu-option (-> s5-0 options (-> obj option-index)))
(the-as menu-option (-> s5-0 (-> obj option-index)))
obj
(and (= (-> obj menu-transition) 0.0) (-> obj selected-option))
)
@@ -1094,6 +1141,8 @@
(none)
)
;; definition for function progress-trans
;; WARN: Return type mismatch int vs none.
(defbehavior progress-trans progress ()
(cond
((and (= (-> self next) 'none)
@@ -1277,6 +1326,7 @@
(none)
)
;; definition for function begin-scan
(defun begin-scan ((arg0 hud-box) (arg1 progress))
(cond
((or (= (-> arg1 current) 'bigmap) (= (-> arg1 next) 'bigmap))
@@ -1311,6 +1361,7 @@
0
)
;; definition for function end-scan
(defun end-scan ((arg0 hud-box) (arg1 float))
(let* ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf))
(gp-0 (-> s5-0 base))
@@ -1334,6 +1385,24 @@
0
)
;; definition for function progress-post
;; INFO: Used lq/sq
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Stack slot offset 148 signed mismatch
;; WARN: Return type mismatch int vs none.
(defbehavior progress-post progress ()
(local-vars (sv-144 font-context) (sv-148 int) (sv-152 hud-box) (sv-156 symbol))
(when (-> self current-options)
@@ -1386,7 +1455,7 @@
)
)
(menu-option-method-10
(-> gp-0 options s4-1)
(-> gp-0 s4-1)
self
sv-144
s4-1
@@ -1442,6 +1511,7 @@
(none)
)
;; failed to figure out what this is:
(defstate come-in (progress)
:virtual #t
:enter (behavior ()
@@ -1486,6 +1556,7 @@
:post (the-as (function none :behavior progress) ja-post)
)
;; failed to figure out what this is:
(defstate idle (progress)
:virtual #t
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
@@ -1708,6 +1779,7 @@
:post progress-post
)
;; failed to figure out what this is:
(defstate go-away (progress)
:virtual #t
:enter (behavior ()
@@ -1751,6 +1823,7 @@
:post (the-as (function none :behavior progress) ja-post)
)
;; failed to figure out what this is:
(defstate gone (progress)
:virtual #t
:code (behavior ()
@@ -1768,11 +1841,13 @@
)
)
;; definition for method 9 of type menu-option
(defmethod respond-progress menu-option ((obj menu-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
0
)
;; definition for method 9 of type menu-on-off-option
(defmethod respond-progress menu-on-off-option ((obj menu-on-off-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* on-off-choice))
@@ -1823,6 +1898,7 @@
0
)
;; definition for method 9 of type menu-yes-no-option
(defmethod respond-progress menu-yes-no-option ((obj menu-yes-no-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
@@ -1864,6 +1940,7 @@
0
)
;; definition for method 9 of type menu-slider-option
(defmethod respond-progress menu-slider-option ((obj menu-slider-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (-> *bigmap* progress-minimap)
@@ -1946,6 +2023,7 @@
0
)
;; definition for method 9 of type menu-stereo-mode-sound-option
(defmethod respond-progress menu-stereo-mode-sound-option ((obj menu-stereo-mode-sound-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (-> *bigmap* progress-minimap)
@@ -1984,6 +2062,7 @@
0
)
;; definition for method 9 of type menu-main-menu-option
(defmethod respond-progress menu-main-menu-option ((obj menu-main-menu-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(cond
@@ -2079,6 +2158,7 @@
0
)
;; definition for method 9 of type menu-sub-menu-option
(defmethod respond-progress menu-sub-menu-option ((obj menu-sub-menu-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (and (-> *progress-state* secrets-unlocked)
@@ -2139,6 +2219,7 @@
0
)
;; definition for method 9 of type menu-unlocked-menu-option
(defmethod respond-progress menu-unlocked-menu-option ((obj menu-unlocked-menu-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((s4-0 (memcard-unlocked-secrets? #t)))
@@ -2280,6 +2361,7 @@
0
)
;; definition for method 9 of type menu-memcard-slot-option
(defmethod respond-progress menu-memcard-slot-option ((obj menu-memcard-slot-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(memcard-unlocked-secrets? #t)
@@ -2306,12 +2388,12 @@
)
((= (-> *progress-save-info* file (-> *progress-state* which-slot) present) 1)
(set! s5-0 #t)
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 box 0 min x)))
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 0)))
(set-next-state arg0 'already-exists 0)
)
(else
(set! s5-0 #t)
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 box 0 min x)))
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 0)))
(set-next-state arg0 'saving 0)
)
)
@@ -2325,6 +2407,7 @@
0
)
;; definition for method 9 of type menu-already-exists-option
(defmethod respond-progress menu-already-exists-option ((obj menu-already-exists-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((s4-0 (&-> *progress-state* yes-no-choice))
@@ -2367,6 +2450,7 @@
0
)
;; definition for method 9 of type menu-create-game-option
(defmethod respond-progress menu-create-game-option ((obj menu-create-game-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((s4-0 (&-> *progress-state* yes-no-choice))
@@ -2412,6 +2496,7 @@
0
)
;; definition for method 9 of type menu-insufficient-space-option
(defmethod respond-progress menu-insufficient-space-option ((obj menu-insufficient-space-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((s5-0 (&-> *progress-state* yes-no-choice))
@@ -2507,6 +2592,7 @@
0
)
;; definition for method 9 of type menu-secrets-insufficient-space-option
(defmethod respond-progress menu-secrets-insufficient-space-option ((obj menu-secrets-insufficient-space-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(&-> *progress-state* yes-no-choice)
@@ -2525,6 +2611,7 @@
0
)
;; definition for method 9 of type menu-video-mode-warning-option
(defmethod respond-progress menu-video-mode-warning-option ((obj menu-video-mode-warning-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
@@ -2563,6 +2650,7 @@
0
)
;; definition for method 9 of type menu-video-mode-ok-option
(defmethod respond-progress menu-video-mode-ok-option ((obj menu-video-mode-ok-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
@@ -2609,6 +2697,7 @@
0
)
;; definition for method 9 of type menu-progressive-mode-warning-option
(defmethod respond-progress menu-progressive-mode-warning-option ((obj menu-progressive-mode-warning-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
@@ -2654,6 +2743,7 @@
0
)
;; definition for method 9 of type menu-progressive-mode-ok-option
(defmethod respond-progress menu-progressive-mode-ok-option ((obj menu-progressive-mode-ok-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
@@ -2702,6 +2792,7 @@
0
)
;; definition for method 9 of type menu-card-removed-option
(defmethod respond-progress menu-card-removed-option ((obj menu-card-removed-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0))
@@ -2713,6 +2804,7 @@
0
)
;; definition for method 9 of type menu-insert-card-option
(defmethod respond-progress menu-insert-card-option ((obj menu-insert-card-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
*progress-save-info*
@@ -2730,6 +2822,7 @@
0
)
;; definition for method 9 of type menu-error-loading-option
(defmethod respond-progress menu-error-loading-option ((obj menu-error-loading-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0))
@@ -2741,6 +2834,7 @@
0
)
;; definition for method 9 of type menu-error-auto-saving-option
(defmethod respond-progress menu-error-auto-saving-option ((obj menu-error-auto-saving-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0))
@@ -2752,6 +2846,7 @@
0
)
;; definition for method 9 of type menu-error-disc-removed-option
(defmethod respond-progress menu-error-disc-removed-option ((obj menu-error-disc-removed-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0))
@@ -2765,6 +2860,7 @@
0
)
;; definition for method 9 of type menu-error-reading-option
(defmethod respond-progress menu-error-reading-option ((obj menu-error-reading-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0))
@@ -2776,6 +2872,7 @@
0
)
;; definition for method 9 of type menu-icon-info-option
(defmethod respond-progress menu-icon-info-option ((obj menu-icon-info-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(when (logtest? (pad-buttons confirm) (-> *cpad-list* cpads 0 button0-rel 0))
@@ -2787,6 +2884,7 @@
0
)
;; definition for method 9 of type menu-quit-option
(defmethod respond-progress menu-quit-option ((obj menu-quit-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((v1-1 (&-> *progress-state* yes-no-choice))
@@ -2831,6 +2929,7 @@
0
)
;; definition for method 9 of type menu-format-card-option
(defmethod respond-progress menu-format-card-option ((obj menu-format-card-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let ((s4-0 (&-> *progress-state* yes-no-choice))
@@ -2875,6 +2974,7 @@
0
)
;; definition for method 9 of type menu-select-start-option
;; WARN: disable def twice: 110. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defmethod respond-progress menu-select-start-option ((obj menu-select-start-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
@@ -2975,6 +3075,7 @@
0
)
;; definition for method 9 of type menu-select-scene-option
(defmethod respond-progress menu-select-scene-option ((obj menu-select-scene-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(set! (-> arg0 sliding-height) (seek-ease
@@ -3054,6 +3155,7 @@
0
)
;; definition for method 9 of type menu-bigmap-option
(defmethod respond-progress menu-bigmap-option ((obj menu-bigmap-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
((method-of-object *bigmap* bigmap-method-12))
@@ -3062,6 +3164,7 @@
0
)
;; definition for method 9 of type menu-missions-option
(defmethod respond-progress menu-missions-option ((obj menu-missions-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(set! (-> arg0 sliding-height) (seek-ease
@@ -3115,6 +3218,7 @@
0
)
;; definition for method 9 of type menu-highscores-option
(defmethod respond-progress menu-highscores-option ((obj menu-highscores-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(set! (-> arg0 sliding) (seek-ease
@@ -3186,6 +3290,7 @@
0
)
;; definition for method 9 of type menu-secret-option
(defmethod respond-progress menu-secret-option ((obj menu-secret-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(let* ((s5-1 (logtest? (-> *game-info* secrets) (game-secrets hero-mode)))
@@ -3308,6 +3413,7 @@
0
)
;; definition for method 9 of type menu-game-option
(defmethod respond-progress menu-game-option ((obj menu-game-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(-> *progress-state* game-options-vibrations)
@@ -3493,6 +3599,7 @@
0
)
;; definition for function update-center-screen
(defun update-center-screen ()
(with-pp
(let ((v1-0 #f))
@@ -3547,6 +3654,7 @@
)
)
;; definition for method 9 of type menu-graphic-option
(defmethod respond-progress menu-graphic-option ((obj menu-graphic-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(-> *progress-state* graphic-options-aspect-ratio)
@@ -3743,6 +3851,7 @@
0
)
;; definition for function update-restart-quit
(defun update-restart-quit ((arg0 menu-option) (arg1 progress) (arg2 symbol))
(let ((v1-1 (&-> *progress-state* yes-no-choice))
(gp-0 #f)
@@ -3783,6 +3892,7 @@
0
)
;; definition for method 9 of type menu-qr-option
(defmethod respond-progress menu-qr-option ((obj menu-qr-option) (arg0 progress) (arg1 object))
"Handle progress menu navigation logic."
(-> *progress-state* qr-options-restart)
@@ -3920,3 +4030,7 @@
)
0
)
+24
View File
@@ -11,8 +11,15 @@
:bitfield #f
(null 0)
(pause 257)
(text-x102 #x0102)
(text-x103 #x0103)
(text-x107 #x0107)
(progress-sound-music-volume 264)
(progress-sound-speech-volume 265)
(text-x10a #x010a)
(text-x10b #x010b)
(text-x10c #x010c)
(text-x10d #x010d)
(progress-on 270)
(progress-off 271)
(progress-move-dpad 272)
@@ -44,6 +51,7 @@
(progress-title-prompt 306)
(progress-quit 307)
(progress-root-show-map 308)
(text-x135 #x0135)
(progress-root-highscores 310)
(progress-highscores-1st 311)
(progress-highscores-2nd 312)
@@ -55,6 +63,10 @@
(progress-highscores-8th 318)
(progress-root-secrets 339)
(progress-secrets-unlocked 340)
(text-x155 #x0155)
(text-x156 #x0156)
(text-x157 #x0157)
(text-x158 #x0158)
(progress-main-secrets-hero-mode 345)
(progress-main-secrets-sceneplayer-1 346)
(progress-main-secrets-sceneplayer-2 347)
@@ -63,13 +75,25 @@
(progress-main-secrets-mega-scrapbook 350)
(progress-main-secrets-scrapbook-3 351)
(progress-main-secrets-levelselect 352)
(text-x160 #x0160)
(text-x161 #x0161)
(text-x162 #x0162)
(text-x163 #x0163)
(text-x164 #x0164)
(text-x165 #x0165)
(text-x166 #x0166)
(text-x167 #x0167)
(progress-secrets-orb-label 360)
(progress-root-missions 361)
(text-x16a #x016a)
(text-x16b #x016b)
(text-x16d #x016d)
(progress-root-restart-mission 366)
(progress-missions-icon-todo 367)
(progress-missions-icon-completed 368)
(progress-missions-none 369)
(progress-unknown-game 370)
(text-x173 #x0173)
(progress-unknown-square-to-reset 377)
(progress-unknown-oi1un23i13 380)
(progress-unknown-kjanskd 381)
+9 -9
View File
@@ -90,11 +90,11 @@
;; definition of type menu-option
(deftype menu-option (basic)
((name game-text-id :offset-assert 4)
(scale float :offset-assert 8)
(unknown function :offset-assert 12)
(box hud-box 1 :inline :offset-assert 16)
(options menu-option 8 :offset 16)
((name game-text-id :offset-assert 4)
(scale float :offset-assert 8)
(unknown function :offset-assert 12)
(unknown-symbol symbol :offset 8)
(box hud-box 1 :inline :offset-assert 16)
)
:method-count-assert 12
:size-assert #x30
@@ -1028,10 +1028,10 @@
;; definition of type menu-option-list
(deftype menu-option-list (basic)
((y-center int32 :offset-assert 4)
(y-space int32 :offset-assert 8)
(scale float :offset-assert 12)
(options menu-option :dynamic :offset-assert 16)
((y-center int32 :offset-assert 4)
(y-space int32 :offset-assert 8)
(scale float :offset-assert 12)
(options (array menu-option) :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1104,7 +1104,7 @@
(let ((s5-0 (-> obj current-options options 0)))
(when (and s5-0 (= (-> obj menu-transition) 0.0))
(respond-progress
(the-as menu-option (-> s5-0 options (-> obj option-index)))
(the-as menu-option (-> s5-0 (-> obj option-index)))
obj
(and (= (-> obj menu-transition) 0.0) (-> obj selected-option))
)
@@ -1507,7 +1507,7 @@
)
)
(menu-option-method-10
(-> gp-0 options s4-1)
(-> gp-0 s4-1)
self
sv-144
s4-1
@@ -2440,12 +2440,12 @@
)
((= (-> *progress-save-info* file (-> *progress-state* which-slot) present) 1)
(set! s5-0 #t)
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 box 0 min x)))
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 0)))
(set-next-state arg0 'already-exists 0)
)
(else
(set! s5-0 #t)
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 box 0 min x)))
(menu-update-purchase-secrets (the-as menu-secret-option (-> *secret-options* options 0 0)))
(set-next-state arg0 'saving 0)
)
)