summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-03-10 18:26:09 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-03-10 18:35:13 +0100
commit527a230c06a272a2cb058d6c90779295428ded43 (patch)
tree314c045d9f9afb91b1f07cf69e1086df2c61f7f4
parent96ac77abb5c4f8cd22135034c8a1270cf946ceca (diff)
contrib/npclient: prevent multiple game conflict
-rw-r--r--bin/NPClient.dllbin13824 -> 15872 bytes
-rw-r--r--bin/NPClient64.dllbin17408 -> 20992 bytes
-rw-r--r--contrib/npclient/npclient.c22
3 files changed, 19 insertions, 3 deletions
diff --git a/bin/NPClient.dll b/bin/NPClient.dll
index 912cd1a2..2b6961cf 100644
--- a/bin/NPClient.dll
+++ b/bin/NPClient.dll
Binary files differ
diff --git a/bin/NPClient64.dll b/bin/NPClient64.dll
index e8e01cfc..e560af52 100644
--- a/bin/NPClient64.dll
+++ b/bin/NPClient64.dll
Binary files differ
diff --git a/contrib/npclient/npclient.c b/contrib/npclient/npclient.c
index 7b2866f0..92de9ca7 100644
--- a/contrib/npclient/npclient.c
+++ b/contrib/npclient/npclient.c
@@ -14,7 +14,7 @@
#define UNUSED(var) (void)var
-//#define DEBUG
+#define DEBUG
typedef struct TFreeTrackData
{
@@ -55,6 +55,7 @@ typedef struct FTMemMap
#define NP_EXPORT(t) t NP_DECLSPEC __stdcall
#define NP_AXIS_MAX 16383
+static uint32_t volatile game_id_local;
static HANDLE hFTMemMap = 0;
static FTMemMap* pMemData = 0;
@@ -66,7 +67,17 @@ static FTMemMap* pMemData = 0;
#ifdef DEBUG
# include <stdio.h>
-# define dbg_report(...) do { if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fprintf(debug_stream, "\n"); fflush(debug_stream); } } while (0)
+# define dbg_report(...) \
+ do \
+ { \
+ if (debug_stream) \
+ { \
+ fprintf(debug_stream, __VA_ARGS__); \
+ fprintf(debug_stream, "\n"); \
+ fflush(debug_stream); \
+ } \
+ } while (0)
+
static FILE *debug_stream;
#else
# define dbg_report(...) do { (void)0; } while (0)
@@ -348,7 +359,9 @@ NP_EXPORT(int) NP_GetData(tir_data* data)
return NPCLIENT_STATUS_DISABLED;
}
- if (pMemData->GameId > 0 && pMemData->GameId == pMemData->GameId2)
+ if (game_id_local > 0 &&
+ pMemData->GameId == game_id_local &&
+ pMemData->GameId == pMemData->GameId2)
{
y = pMemData->data.Yaw * NP_AXIS_MAX / M_PI;
p = pMemData->data.Pitch * NP_AXIS_MAX / M_PI;
@@ -548,7 +561,10 @@ NP_EXPORT(int) NP_ReCenter(void)
NP_EXPORT(int) NP_RegisterProgramProfileID(unsigned short id)
{
if (FTCreateMapping())
+ {
pMemData->GameId = id;
+ game_id_local = id;
+ }
dbg_report("RegisterProgramProfileID request: %d\n", id);
return 0;
}