Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: cl+sv: make an exported function in HL modding bases that will return compile-time tables with the required content #490

Open
SmileyAG opened this issue Jan 7, 2024 · 1 comment

Comments

@SmileyAG
Copy link
Collaborator

SmileyAG commented Jan 7, 2024

This is needed in the future to support BXT by modders themself in their SDKs

Most likely this will be an exported global variable with our custom structure, in which we will store the following elements:

  • classname (e.g. CBasePlayer)
  • name (e.g. m_rgAmmoLast)
  • offset (e.g. 4919 (0x1337 in hex))
  • size (e.g. 32)

Macro for export:

#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __attribute__ ((visibility("default")))
#endif
@SmileyAG SmileyAG self-assigned this Jan 7, 2024
@SmileyAG SmileyAG changed the title Transfer from storing offsets from the required class variables Transfer the offsets from the required class variables Jan 7, 2024
@SmileyAG SmileyAG changed the title Transfer the offsets from the required class variables Transfer the offsets from the required class variables in some a global variable Jan 7, 2024
@SmileyAG SmileyAG changed the title Transfer the offsets from the required class variables in some a global variable Transfer the offsets for the required class variables in some a global variable from modification that support us Jan 7, 2024
@SmileyAG SmileyAG changed the title Transfer the offsets for the required class variables in some a global variable from modification that support us Read the class name, member name and offsets from some a global variable by modification that support us Jan 7, 2024
@SmileyAG SmileyAG changed the title Read the class name, member name and offsets from some a global variable by modification that support us Read the class name, member name, offset and size from our specified global variable by modification that support us Jan 7, 2024
@SmileyAG SmileyAG removed their assignment Jan 7, 2024
@SmileyAG
Copy link
Collaborator Author

While I was doing #494 issue, I thought that it would be possible to simply export save data of classes and get access to them by symbols, which would to solve issue of server-side offsets for half that surely

Although we still have to came up with concept of our linked list for the rest stuff and I think it should look like this:

typedef struct bxt_data_s
{
    char *classname; // CBasePlayer
    char *name; // m_rgAmmoLast
    unsigned int offset; // 0x1337
    unsigned int size; // 32
    BXT_FIELDTYPE type; // FIELD_INTEGER
    struct bxt_data_s *next;
} bxt_data_t;

BXT_FIELDTYPE is inherited from FIELDTYPE:

typedef enum _fieldtypes
{
FIELD_FLOAT = 0, // Any floating point value
FIELD_STRING, // A string ID (return from ALLOC_STRING)
FIELD_ENTITY, // An entity offset (EOFFSET)
FIELD_CLASSPTR, // CBaseEntity *
FIELD_EHANDLE, // Entity handle
FIELD_EVARS, // EVARS *
FIELD_EDICT, // edict_t *, or edict_t * (same thing)
FIELD_VECTOR, // Any vector
FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically)
FIELD_POINTER, // Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER
FIELD_INTEGER, // Any integer or enum
FIELD_FUNCTION, // A class function pointer (Think, Use, etc)
FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression
FIELD_SHORT, // 2 byte integer
FIELD_CHARACTER, // a byte
FIELD_TIME, // a floating point time (these are fixed up automatically too!)
FIELD_MODELNAME, // Engine string that is a model name (needs precache)
FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache)
FIELD_TYPECOUNT, // MUST BE LAST
} FIELDTYPE;

@SmileyAG SmileyAG changed the title Read the class name, member name, offset and size from our specified global variable by modification that support us api: cl+sv: make an exported function in HL modding bases that will return compile-time tables with the required content Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant