refactor: Unify string hashing
> moved to util/utils.h
This commit is contained in:
+3
-12
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user