Skip to content

Commit

Permalink
* Do not use WriteProcMem in HkIClientImpl::CDPClientProxy__GetLinkSa…
Browse files Browse the repository at this point in the history
…turation (oliverpechey#12)

- Using it in this function wastes an insane amount of cpu cycles and causes high server load with e.g. a lot of loot in space
- Should be fine to use memcpy here, since the variable already has been written to with WriteProcMem on startup
- Tested successfully on Windows 7
  • Loading branch information
Schmackbolzen authored Jun 30, 2020
1 parent 6fe2170 commit cd596b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/HkCbIClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ double HkIClientImpl::CDPClientProxy__GetLinkSaturation(uint iClientID)
// ISERVER_LOGARG_UI(iClientID);

char *tmp;
WriteProcMem(&tmp, &Client, 4);
WriteProcMem(&Client, &OldClient, 4);
memcpy(&tmp, &Client, 4);
memcpy(&Client, &OldClient, 4);
double dRet = HookClient->CDPClientProxy__GetLinkSaturation(iClientID);
WriteProcMem(&Client, &tmp, 4);
memcpy(&Client, &tmp, 4);

return dRet;
}
Expand Down

0 comments on commit cd596b3

Please sign in to comment.