summaryrefslogtreecommitdiffhomepage
path: root/src/sst.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-12-25 11:03:50 +0000
committerMichael Smith <mikesmiffy128@gmail.com>2022-12-25 11:03:50 +0000
commit9a09c605402e6ff74f93f7fe7afc50ccc785acc3 (patch)
tree0a098cecec7e0787023df9ad4c2f6d915817bdea /src/sst.c
parentf6fb10a7d3bfb59a729ee4b7a9368632ab52077a (diff)
Add basic mouse input scaling
Diffstat (limited to 'src/sst.c')
-rw-r--r--src/sst.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/sst.c b/src/sst.c
index a7eb331..d159c8e 100644
--- a/src/sst.c
+++ b/src/sst.c
@@ -266,22 +266,23 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) {
}
factory_engine = enginef; factory_server = serverf;
+#ifdef _WIN32
+ void *inputsystemlib = GetModuleHandleW(L"inputsystem.dll");
+#else
+ // TODO(linux): assuming the above doesn't apply to this; check if it does!
+ // ... actually, there's a good chance this assumption is now wrong!
+ void *inputsystemlib = dlopen("bin/libinputsystem.so",
+ RTLD_NOW | RLTD_NOLOAD);
+ if (inputsystemlib) dlclose(inputsystemlib); // blegh
+#endif
+ if (!inputsystemlib) {
+ errmsg_warndl("couldn't get the input system library");
+ }
+ else if (!(factory_inputsystem = (ifacefactory)os_dlsym(inputsystemlib,
+ "CreateInterface"))) {
+ errmsg_warndl("couldn't get input system's CreateInterface");
+ }
if (!engineapi_init(ifacever)) return false;
-
- const void **p = vtable_firstdiff;
- if (GAMETYPE_MATCHES(Portal2)) *p++ = (void *)&nop_p_v; // ClientFullyConnect
- *p++ = (void *)&nop_p_v; // ClientDisconnect
- *p++ = (void *)&nop_pp_v; // ClientPutInServer
- *p++ = (void *)&SetCommandClient; // SetCommandClient
- *p++ = (void *)&nop_p_v; // ClientSettingsChanged
- *p++ = (void *)&nop_5pi_i; // ClientConnect
- *p++ = ifacever > 1 ? (void *)&nop_pp_i : (void *)&nop_p_i; // ClientCommand
- // remaining stuff here is backwards compatible, so added unconditionally
- *p++ = (void *)&nop_pp_i; // NetworkIDValidated
- *p++ = (void *)&nop_ipipp_v; // OnQueryCvarValueFinished (002+)
- *p++ = (void *)&nop_p_v; // OnEdictAllocated
- *p = (void *)&nop_p_v; // OnEdictFreed
-
#ifdef _WIN32
clientlib = GetModuleHandleW(gameinfo_clientlib);
#else
@@ -298,22 +299,20 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) {
"CreateInterface"))) {
errmsg_warndl("couldn't get client's CreateInterface");
}
-#ifdef _WIN32
- void *inputsystemlib = GetModuleHandleW(L"inputsystem.dll");
-#else
- // TODO(linux): assuming the above doesn't apply to this; check if it does!
- // ... actually, there's a good chance this assumption is now wrong!
- void *inputsystemlib = dlopen("bin/libinputsystem.so",
- RTLD_NOW | RLTD_NOLOAD);
- if (inputsystemlib) dlclose(inputsystemlib); // blegh
-#endif
- if (!inputsystemlib) {
- errmsg_warndl("couldn't get the input system library");
- }
- else if (!(factory_inputsystem = (ifacefactory)os_dlsym(inputsystemlib,
- "CreateInterface"))) {
- errmsg_warndl("couldn't get input system's CreateInterface");
- }
+
+ const void **p = vtable_firstdiff;
+ if (GAMETYPE_MATCHES(Portal2)) *p++ = (void *)&nop_p_v; // ClientFullyConnect
+ *p++ = (void *)&nop_p_v; // ClientDisconnect
+ *p++ = (void *)&nop_pp_v; // ClientPutInServer
+ *p++ = (void *)&SetCommandClient; // SetCommandClient
+ *p++ = (void *)&nop_p_v; // ClientSettingsChanged
+ *p++ = (void *)&nop_5pi_i; // ClientConnect
+ *p++ = ifacever > 1 ? (void *)&nop_pp_i : (void *)&nop_p_i; // ClientCommand
+ // remaining stuff here is backwards compatible, so added unconditionally
+ *p++ = (void *)&nop_pp_i; // NetworkIDValidated
+ *p++ = (void *)&nop_ipipp_v; // OnQueryCvarValueFinished (002+)
+ *p++ = (void *)&nop_p_v; // OnEdictAllocated
+ *p = (void *)&nop_p_v; // OnEdictFreed
// NOTE: this is technically redundant for early versions but I CBA writing
// a version check; it's easier to just do this unilaterally.
@@ -467,7 +466,7 @@ static const void *vtable[MAX_VTABLE_FUNCS] = {
(void *)&GetPluginDescription,
(void *)&nop_p_v, // LevelInit
(void *)&nop_pii_v, // ServerActivate
- (void *)&GameFrame, // GameFrame
+ (void *)&GameFrame,
(void *)&nop_v_v, // LevelShutdown
(void *)&ClientActive
// At this point, Alien Swarm and Portal 2 add ClientFullyConnect, so we