Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::map to std::unordered_map for addresses as order is not important here #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion IHHook/HookMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "spdlog/spdlog.h"

namespace IHHook {
extern std::map<std::string, int64_t> addressSet;
extern std::unordered_map<std::string, uint64_t> addressSet;
}

//DEBUGNOW put this somewhere or CULL
Expand Down
6 changes: 3 additions & 3 deletions IHHook/IHHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace IHHook {

size_t RealBaseAddr;
bool isTargetExe = false;
std::map<std::string, int64_t> addressSet{};
std::unordered_map<std::string, uint64_t> addressSet{};
std::map<std::string, char*> patterns{};

terminate_function terminate_Original;
Expand Down Expand Up @@ -829,8 +829,8 @@ namespace IHHook {
std::string name = entry.first;
if (isTargetExe) {
spdlog::info("isTargetExe, rebasing addr {}", name);
int64_t addr = entry.second;
int64_t rebasedAddr = (addr - BaseAddr) + RealBaseAddr;
uint64_t addr = entry.second;
uint64_t rebasedAddr = (addr - BaseAddr) + RealBaseAddr;
addressSet[name] = rebasedAddr;
}
else {
Expand Down
3 changes: 2 additions & 1 deletion IHHook/hooks/mgsvtpp_adresses_1_0_15_3_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
// NO_USE - something we dont really want to use for whatever reason
// USING_CODE - using the default lapi code implementation instead of hooking

#include <unordered_map>
#include <map>

namespace IHHook {
std::map<std::string, int64_t> mgsvtpp_adresses_1_0_15_3_en{
std::unordered_map<std::string, uint64_t> mgsvtpp_adresses_1_0_15_3_en{
{"StrCode64", 0x14c1bd730},
{"PathCode64", 0x14c1bd5d0},//tex TODO need to verify naming and purpose. technically this is PathFileNameExt64, but given that PathCode - without ext is likely less used than PathCode would have been a better name for PathFileNameExt64
{"FNVHash32", 0x143f33a20},
Expand Down
2 changes: 1 addition & 1 deletion IHHook/hooks/mgsvtpp_adresses_1_0_15_3_jp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <map>

namespace IHHook {
std::map<std::string, int64_t> mgsvtpp_adresses_1_0_15_3_jp{
std::unordered_map<std::string, uint64_t> mgsvtpp_adresses_1_0_15_3_jp{
{"StrCode64", 0x14c96c490},
{"PathCode64", 0x14c96c160},
{"FNVHash32", 0x143f6ee50},
Expand Down
2 changes: 1 addition & 1 deletion IHHook/hooks/mgsvtpp_funcptr_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "mgsvtpp_func_typedefs.h"

extern std::map<std::string, int64_t> addressSet;
extern std::unordered_map<std::string, uint64_t> addressSet;

namespace IHHook {
void SetFuncPtrs() {
Expand Down