mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 14:20:07 +00:00
60db0e5ef9
This updates `fmt` to the latest version and moves to just being a copy of their repo to make updating easier (no editing their cmake / figuring out which files to minimally include). The motivation for this is now that we switched to C++ 20, there were a ton of deprecated function usages that is going away in future compiler versions. This gets rid of all those warnings.
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#include "game_count.h"
|
|
|
|
#include "LinkedWordReader.h"
|
|
|
|
#include "decompiler/ObjectFile/ObjectFileDB.h"
|
|
|
|
#include "fmt/core.h"
|
|
|
|
namespace decompiler {
|
|
GameCountResult process_game_count(ObjectFileData& data) {
|
|
GameCountResult result;
|
|
auto& words = data.linked_data.words_by_seg.at(0);
|
|
auto reader = LinkedWordReader(&words);
|
|
auto type = reader.get_type_tag();
|
|
ASSERT(type == "game-count-info");
|
|
auto length = reader.get_word<s32>();
|
|
|
|
for (s32 i = 0; i < length; i++) {
|
|
GameCountResult::CountInfo info;
|
|
info.money_count = reader.get_word<s32>();
|
|
info.buzzer_count = reader.get_word<s32>();
|
|
result.info.push_back(info);
|
|
}
|
|
|
|
result.mystery_data[0] = reader.get_word<u32>();
|
|
result.mystery_data[1] = reader.get_word<u32>();
|
|
ASSERT(reader.words_left() == 0);
|
|
return result;
|
|
}
|
|
|
|
std::string write_game_count(const GameCountResult& result) {
|
|
std::string str;
|
|
str +=
|
|
";; this file contains money/buzzer counts for each level.\n;; The last pair is unknown data "
|
|
"and possibly a bug that it is included\n\n";
|
|
|
|
for (auto& x : result.info) {
|
|
str += fmt::format("(:money {} :buzzer {})\n", x.money_count, x.buzzer_count);
|
|
}
|
|
|
|
str += fmt::format("(:unknown-1 {} :unknown-2 {})\n", result.mystery_data[0],
|
|
result.mystery_data[1]);
|
|
return str;
|
|
}
|
|
} // namespace decompiler
|