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:
water111
2020-11-24 20:48:38 -05:00
committed by GitHub
parent d8b1feaa3d
commit 09142d1712
45 changed files with 533 additions and 184 deletions
+28
View File
@@ -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());
});
}