refactor: Unify string hashing

> moved to util/utils.h
This commit is contained in:
[ ]
2025-12-15 23:53:18 +09:00
parent 42689377e6
commit 7f63b77ab3
4 changed files with 32 additions and 36 deletions
+3 -12
View File
@@ -3,6 +3,7 @@
#include "util/detour.h"
#include "util/sigscan.h"
#include "util/libutils.h"
#include "util/utils.h"
#include <mmsystem.h>
@@ -106,22 +107,12 @@ void run(HINSTANCE hmodule)
namespace hooks::wmisc
{
static constexpr unsigned int by_model(const char *model, int h = 0)
{
return !model[h] ? 5381 : (by_model(model, h + 1) * 33) ^ model[h];
}
static constexpr unsigned int by_ext(const char *ext, int h = 0)
{
return !ext[h] ? 5381 : (by_ext(ext, h + 1) * 33) ^ ext[h];
}
void apply_performance_hacks(HINSTANCE hmodule, const char *model, const char *ext)
{
log_info("hooks::wmisc", "Enabling performance patches for {}-{}", model, ext);
switch (by_model(model))
switch (to_hash(model))
{
case by_model("LDJ"):
case to_hash("LDJ"):
thumbnail::run(hmodule);
msacm::run(hmodule);
break;