From 8672ab4372ce9a205592578c567f061bf869968d Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 23 Jul 2024 21:01:12 -0400 Subject: [PATCH] add Get24LocalFromPC --- src/app/core/common.cc | 9 +++++++++ src/app/core/common.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/app/core/common.cc b/src/app/core/common.cc index ec79a9bf..36c217a2 100644 --- a/src/app/core/common.cc +++ b/src/app/core/common.cc @@ -174,6 +174,15 @@ uint16_t ldle16b_i(uint8_t const *const p_arr, size_t const p_index) { // Initialize the static member std::stack ImGuiIdIssuer::idStack; +int Get24LocalFromPC(uint8_t *data, int addr, bool pc) { + int ret = (PcToSnes(addr) & 0xFF0000) | (data[addr + 1] << 8) | data[addr]; + if (pc) { + return SnesToPc(ret); + } else { + return ret; + } +} + } // namespace core } // namespace app } // namespace yaze diff --git a/src/app/core/common.h b/src/app/core/common.h index a7ff5389..f14e2093 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -220,6 +220,8 @@ struct FolderItem { typedef struct FolderItem FolderItem; +int Get24LocalFromPC(uint8_t *data, int addr, bool pc = true); + } // namespace core } // namespace app } // namespace yaze