diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bf17de..4de1056 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_CXX_STANDARD 23) # ImHexQb # -project(imhexqb VERSION 1.0.5) +project(imhexqb VERSION 1.0.6) # Include ImHex cmake module # set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ImHex) diff --git a/source/qb/ChecksumDictionary.cpp b/source/qb/ChecksumDictionary.cpp index c94fdb1..008eb6d 100644 --- a/source/qb/ChecksumDictionary.cpp +++ b/source/qb/ChecksumDictionary.cpp @@ -2,7 +2,7 @@ #include ChecksumDictionary::ChecksumDictionary() { - dictionary = std::map(); + dictionary = std::map(); } std::string ChecksumDictionary::getDictionaryPath() { @@ -31,10 +31,10 @@ ChecksumDictionary ChecksumDictionary::load(const std::string& path) { nlohmann::basic_json json = nlohmann::json::parse(buf.str()); if (!json.contains("checksums")) { - json["checksums"] = std::map(); + json["checksums"] = std::map(); } - std::map dict = json["checksums"]; + std::map dict = json["checksums"]; return ChecksumDictionary(dict); } @@ -49,16 +49,16 @@ void ChecksumDictionary::save(const std::string& path) { data.close(); } -void ChecksumDictionary::populate(uint32_t value, std::string name) { +void ChecksumDictionary::populate(uint64_t value, const std::string& name) { dictionary.insert({value, name}); } -bool ChecksumDictionary::contains(uint32_t value) { +bool ChecksumDictionary::contains(uint64_t value) { return dictionary.contains(value); } -std::string ChecksumDictionary::resolve(uint32_t checksum) { +std::string ChecksumDictionary::resolve(uint64_t checksum) { return dictionary[checksum]; } -ChecksumDictionary::ChecksumDictionary(const std::map &dictionary) : dictionary(dictionary) {} \ No newline at end of file +ChecksumDictionary::ChecksumDictionary(const std::map &dictionary) : dictionary(dictionary) {} \ No newline at end of file diff --git a/source/qb/ChecksumDictionary.h b/source/qb/ChecksumDictionary.h index 1e8e865..eca84a5 100644 --- a/source/qb/ChecksumDictionary.h +++ b/source/qb/ChecksumDictionary.h @@ -9,17 +9,17 @@ class ChecksumDictionary { public: ChecksumDictionary(); - explicit ChecksumDictionary(const std::map &dictionary); + explicit ChecksumDictionary(const std::map &dictionary); static std::string getDictionaryPath(); static ChecksumDictionary load(const std::string& path); void save(const std::string& path); - void populate(uint32_t value, std::string name); - bool contains(uint32_t value); - std::string resolve(uint32_t checksum); + void populate(uint64_t value, const std::string& name); + bool contains(uint64_t value); + std::string resolve(uint64_t checksum); private: - std::map dictionary; + std::map dictionary; }; diff --git a/source/qb/QbRecompiler.cpp b/source/qb/QbRecompiler.cpp index d4f692a..7ed7195 100644 --- a/source/qb/QbRecompiler.cpp +++ b/source/qb/QbRecompiler.cpp @@ -978,7 +978,12 @@ std::vector QbRecompiler::compile(std::string &source, ChecksumDictionary &s bytes.push_back(((checksum) >> 16) & 0xFF); bytes.push_back(((checksum) >> 24) & 0xFF); - symbols.populate(checksum, checksum_name); + unsigned long reversed = ((unsigned long)(checksum & 0xFF) << 24) | + ((unsigned long)((checksum >> 8) & 0xFF) << 16) | + ((unsigned long)((checksum >> 16) & 0xFF) << 8) | + ((unsigned long)((checksum >> 24) & 0xFF)); + + symbols.populate(reversed, checksum_name); index++;