Porting to x64

From AlliedModders Wiki
Revision as of 17:35, 8 May 2024 by Mooshua (talk | contribs) (Initial draft of porting page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Many plugins are already compatible with the x64 architecture, but many that manipulate game memory (such as with hooks or patches) will require extensive revisions to run under the new 64-bit servers. Overall, if your plugin:

  • Uses the address natives or the Address type,
  • Uses dhooks
  • Uses sdkcalls or sdktools (not sdkhooks)

...you will need to update your plugin for 64 bits.

Extensions may be good to go with just a recompile for 64-bits, but some may need more extensives changes.

I'm having an issue!

Here are some things to check for that may be tripping you up:

  • The type you thought was an int was actually a size_t!
  • Passing pointers as ints when they should be void* (why would you do this??)
  • The calling convention has changed. Make sure to account for this in detours and patches. Make sure your prototypes are exactly correct!


Porting Plugins

Gamedata

All signatures will need to be updated, and likely many offsets. "linux" is for 32-bit linux and "linux64" is for 64-bit linux.

Todo: What is the equivalent for windows?

Address Natives

New address natives that support 64-bits are still under development

DHooks

DHooks does not support 64-bits at all for the time being. It will need heavy revisions to work under the new architecture, starting with better SourceHook support for the 64-bit architecture (see: hookmangen)

SDKCalls

SDKCalls will need to be updated to learn how to accept a thisptr. However, all non-raw calls (eg, those to entities or gamerules that does not require a thisptr) should be fine as long as none of the arguments are 64-bits (including 64-bit ints!)