summaryrefslogtreecommitdiff
path: root/src/modelinfo/ModelIndices.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-05-15 16:52:37 +0200
committeraap <aap@papnet.eu>2019-05-15 16:52:37 +0200
commit600bf0351476a5a21aabb5429132ddf7f52ac0b9 (patch)
treed8e48b3a581679e33830fb7c98ed69e1e242e2c2 /src/modelinfo/ModelIndices.cpp
first commit
Diffstat (limited to 'src/modelinfo/ModelIndices.cpp')
-rw-r--r--src/modelinfo/ModelIndices.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp
new file mode 100644
index 00000000..9a8aaead
--- /dev/null
+++ b/src/modelinfo/ModelIndices.cpp
@@ -0,0 +1,32 @@
+#include "common.h"
+#include "patcher.h"
+#include "ModelIndices.h"
+
+#define X(name, var, addr) int16 &var = *(int16*)addr;
+ MODELINDICES
+#undef X
+
+void
+InitModelIndices(void)
+{
+#define X(name, var, addr) var = -1;
+ MODELINDICES
+#undef X
+}
+
+void
+MatchModelString(const char *modelname, int16 id)
+{
+#define X(name, var, addr) \
+ if(strcmp(name, modelname) == 0){ \
+ var = id; \
+ return; \
+ }
+ MODELINDICES
+#undef X
+}
+
+STARTPATCHES
+ InjectHook(0x48EB60, InitModelIndices, PATCH_JUMP);
+ InjectHook(0x48F030, MatchModelString, PATCH_JUMP);
+ENDPATCHES