diff --git a/CommonLibSF/include/REL/ID.h b/CommonLibSF/include/REL/ID.h index 2604e678..50fe3e11 100644 --- a/CommonLibSF/include/REL/ID.h +++ b/CommonLibSF/include/REL/ID.h @@ -234,6 +234,7 @@ namespace REL static IDDatabase _instance; inline static std::atomic_bool _initialized{}; inline static std::mutex _initLock; + inline static bool _is_steam{}; database::memory_map _mmap; std::span _id2offset; Platform _platform{ Platform::kUnknown }; diff --git a/CommonLibSF/src/REL/ID.cpp b/CommonLibSF/src/REL/ID.cpp index 0b8bd578..7889efa2 100644 --- a/CommonLibSF/src/REL/ID.cpp +++ b/CommonLibSF/src/REL/ID.cpp @@ -5,10 +5,6 @@ namespace REL namespace database { constexpr auto LookUpDir = "Data\\SFSE\\Plugins"sv; - constexpr std::array VendorModule{ - std::make_pair("steam_api64"sv, IDDatabase::Platform::kSteam), - std::make_pair("Xcurl"sv, IDDatabase::Platform::kMsStore), - }; [[nodiscard]] std::uint64_t Offset2ID::operator()(std::size_t a_offset) const { @@ -173,11 +169,12 @@ namespace REL file /= std::format("{}\\versionlib-{}", database::LookUpDir, version.string("-")); _platform = Platform::kUnknown; - for (auto& [vendor, registered] : database::VendorModule) { - if (WinAPI::GetModuleHandle(vendor.data())) { - _platform = registered; - break; - } + if (WinAPI::GetModuleHandle(L"steam_api64")) { + _platform = Platform::kSteam; + _is_steam = true; + } + else { + _platform = Platform::kMsStore; } stl_assert(_platform != Platform::kUnknown, @@ -254,10 +251,10 @@ namespace REL "then it is likely that address library has not yet added support " "for this version of the game or this platform.\n" "Current version: {}\n" - "Current vendor module: {}"sv, + "Current platform: {}"sv, stl::utf16_to_utf8(a_filename).value_or(""s), a_version.string(), - database::VendorModule[std::to_underlying(_platform)].first), + _is_steam ? "Steam" : "Microsoft Store"), a_failOnError); } return true;