rdbo / libmem

Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)
GNU Affero General Public License v3.0
784 stars 91 forks source link

Unify cross platform types and simplify types #82

Closed rdbo closed 1 year ago

rdbo commented 1 year ago

Some types could be unified across platforms. For example, the lm_pid_t for Windows is a DWORD (a.k.a unsigned int). On *nix, it is a pid_t (a.k.a int). They could be unified into a single type, like:

typedef lm_uint32_t lm_pid_t;

No need to have them differ on both platforms when they can be the same. This would also be easier for porting to other languages, since libmem would guarantee that type works everywhere.

rdbo commented 1 year ago

There types that are kind of hard to understand, like lm_bstring_t. These are simply unnecessary. lm_bstring_t -> lm_byte_t * (makes more sense) lm_voidptr_t -> lm_void_t *

Maybe the string and character should be simplified as well. After all, tchar_t and tstring_t are kind of weird:

#if LM_CHARSET == LM_CHARSET_UC
typedef lm_wchar_t lm_char_t;
#else
typedef lm_cchar_t lm_char_t;
#endif
typedef lm_char_t *lm_string_t;
rdbo commented 1 year ago

Unified types: d730d53268c661503c3ad0b68f12ab7d1f18d1ba

rdbo commented 1 year ago

Changed string types: 3b9801e6489cd5aca7e0599fcd24975f3d2502d8 and 4909cd0bc39be92c5af1c0fe1112b4c6fec74525