mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 23:00:45 -04:00
Support "game count" and v4 objects (#140)
* generate object, but not supported in linker yet * add link and tests * update types
This commit is contained in:
@@ -27,14 +27,6 @@ struct LinkHeaderCommon {
|
||||
uint16_t version; // what version (2, 3, 4)
|
||||
};
|
||||
|
||||
// Header for link data used for V4
|
||||
struct LinkHeaderV4 {
|
||||
uint32_t type_tag; // always -1
|
||||
uint32_t length; // length of V2 link data found after object.
|
||||
uint32_t version; // always 4
|
||||
uint32_t code_size; // length of object data before link data starts
|
||||
};
|
||||
|
||||
// Per-segment info for V3 and V5 link data
|
||||
struct SegmentInfo {
|
||||
uint32_t relocs; // offset of relocation table
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "decompiler/data/tpage.h"
|
||||
#include "decompiler/data/game_text.h"
|
||||
#include "decompiler/data/StrFileReader.h"
|
||||
#include "decompiler/data/game_count.h"
|
||||
#include "LinkedObjectFileCreation.h"
|
||||
#include "decompiler/config.h"
|
||||
#include "third-party/minilzo/minilzo.h"
|
||||
@@ -715,6 +716,26 @@ std::string ObjectFileDB::process_game_text() {
|
||||
return write_game_text(text_by_language_by_id);
|
||||
}
|
||||
|
||||
std::string ObjectFileDB::process_game_count() {
|
||||
spdlog::info("- Finding game count file...");
|
||||
bool found = false;
|
||||
std::string result;
|
||||
|
||||
for_each_obj([&](ObjectFileData& data) {
|
||||
if (data.name_in_dgo == "game-cnt") {
|
||||
assert(!found);
|
||||
found = true;
|
||||
result = write_game_count(::process_game_count(data));
|
||||
}
|
||||
});
|
||||
|
||||
if (!found) {
|
||||
spdlog::warn("did not find game-cnt file");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ObjectFileDB::analyze_functions() {
|
||||
spdlog::info("- Analyzing Functions...");
|
||||
Timer timer;
|
||||
@@ -916,3 +937,10 @@ void ObjectFileDB::analyze_functions() {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void ObjectFileDB::dump_raw_objects(const std::string& output_dir) {
|
||||
for_each_obj([&](ObjectFileData& data) {
|
||||
auto dest = output_dir + "/" + data.to_unique_name();
|
||||
file_util::write_binary_file(dest, data.data.data(), data.data.size());
|
||||
});
|
||||
}
|
||||
@@ -55,11 +55,13 @@ class ObjectFileDB {
|
||||
void process_labels();
|
||||
void find_code();
|
||||
void find_and_write_scripts(const std::string& output_dir);
|
||||
void dump_raw_objects(const std::string& output_dir);
|
||||
|
||||
void write_object_file_words(const std::string& output_dir, bool dump_v3_only);
|
||||
void write_disassembly(const std::string& output_dir, bool disassemble_objects_without_functions);
|
||||
void analyze_functions();
|
||||
void process_tpages();
|
||||
std::string process_game_count();
|
||||
std::string process_game_text();
|
||||
|
||||
ObjectFileData& lookup_record(const ObjectFileRecord& rec);
|
||||
|
||||
Reference in New Issue
Block a user