Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions include/game_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Created By:
#include <cstdarg>
#include <vector>
#include <string>
#include "qmmapi.h"

typedef const char* (*msgname_t)(intptr_t msg);
typedef int (*vmsyscall_t)(uint8_t* membase, int cmd, int* args);
typedef void* (*apientry_t)(void* import);

// a list of all the mod messages used by QMM
enum qmm_mod_msg_t {
Expand Down Expand Up @@ -72,7 +72,8 @@ struct supportedgame_t {
msgname_t mod_msg_names; // pointer to a function that returns a string for a given mod message

vmsyscall_t vmsyscall; // pointer to a function that handles mod->engine calls from a VM (NULL = not required)
apientry_t apientry; // pointer to a function that handles GetGameAPI entry for a game
mod_dllEntry_t pfndllEntry; // pointer to a function that handles dllEntry entry for a game (NULL = not required)
mod_GetGameAPI_t pfnGetGameAPI; // pointer to a function that handles GetGameAPI entry for a game (NULL = not required)
int max_syscall_args; // max number of syscall args that this game needs (unused for now, but nice to have easily available)
int max_vmmain_args; // max number of vmmain args that this game needs (unused for now, but nice to have easily available)
std::vector<std::string> exe_hints; // array of hints that should appear in the executable filename to be considered a game match
Expand All @@ -89,7 +90,8 @@ extern supportedgame_t g_supportedgames[];
const char* game##_eng_msg_names(intptr_t msg); \
const char* game##_mod_msg_names(intptr_t msg); \
int game##_vmsyscall(uint8_t* membase, int cmd, int* args); \
void* game##_GetGameAPI(void* import)
void* game##_GetGameAPI(void* import); \
void game##_dllEntry(eng_syscall_t syscall)

// generate struct info for the short name, messages arrays, and message name functions
#define GEN_INFO(game) #game, game##_qmm_eng_msgs, game##_qmm_mod_msgs, game##_eng_msg_names, game##_mod_msg_names
Expand Down
20 changes: 20 additions & 0 deletions include/game_cod11mp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_COD11MP_H__
#define __QMM2_GAME_COD11MP_H__

// these import messages do not have an exact analogue in COD11MP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_COD11MP_H__
20 changes: 20 additions & 0 deletions include/game_codmp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_CODMP_H__
#define __QMM2_GAME_CODMP_H__

// these import messages do not have an exact analogue in CODMP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_CODMP_H__
20 changes: 20 additions & 0 deletions include/game_coduomp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_CODUOMP_H__
#define __QMM2_GAME_CODUOMP_H__

// these import messages do not have an exact analogue in CODUOMP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_CODUOMP_H__
20 changes: 20 additions & 0 deletions include/game_jamp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_JAMP_H__
#define __QMM2_GAME_JAMP_H__

// these import messages do not have an exact analogue in JAMP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_JAMP_H__
1 change: 1 addition & 0 deletions include/game_jasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ enum {
// helper for plugins to not need separate logic
G_LOCATE_GAME_DATA, // void (gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *clients, int sizeofGameClient)
G_GET_ENTITY_TOKEN, // qboolean (char *buffer, int bufferSize)
G_ARGS, // char* (void)
};

#endif // __QMM2_GAME_JASP_H__
20 changes: 20 additions & 0 deletions include/game_jk2mp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_JK2MP_H__
#define __QMM2_GAME_JK2MP_H__

// these import messages do not have an exact analogue in JK2MP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_JK2MP_H__
1 change: 1 addition & 0 deletions include/game_jk2sp.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ enum {
// helper for plugins to not need separate logic
G_LOCATE_GAME_DATA, // void (gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *clients, int sizeofGameClient)
G_GET_ENTITY_TOKEN, // qboolean (char *buffer, int bufferSize)
G_ARGS, // char* (void)
};

#endif // __QMM2_GAME_JK2SP_H__
39 changes: 39 additions & 0 deletions include/game_q3a.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_Q3A_H__
#define __QMM2_GAME_Q3A_H__

// these function ids are defined either in the g_syscalls.asm file or in qcommon.h from q3 source,
// but they do not appear in the enum in q3a/game/g_public.h
enum {
G_MEMSET = 100,
G_MEMCPY = 101,
G_STRNCPY = 102,
G_SIN = 103,
G_COS = 104,
G_ATAN2 = 105,
G_SQRT = 106,
G_MATRIXMULTIPLY = 107,
G_ANGLEVECTORS = 108,
G_PERPENDICULARVECTOR = 109,
G_FLOOR = 110,
G_CEIL = 111,
G_TESTPRINTINT = 112,
G_TESTPRINTFLOAT = 113
};

// these import messages do not have an exact analogue in Q3A
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_Q3A_H__
20 changes: 20 additions & 0 deletions include/game_rtcwmp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_RTCWMP_H__
#define __QMM2_GAME_RTCWMP_H__

// these import messages do not have an exact analogue in RTCWMP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_RTCWMP_H__
20 changes: 20 additions & 0 deletions include/game_rtcwsp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_RTCWSP_H__
#define __QMM2_GAME_RTCWSP_H__

// these import messages do not have an exact analogue in RTCWSP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_RTCWSP_H__
20 changes: 20 additions & 0 deletions include/game_sof2mp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_SOF2MP_H__
#define __QMM2_GAME_SOF2MP_H__

// these import messages do not have an exact analogue in SOF2MP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_SOF2MP_H__
40 changes: 40 additions & 0 deletions include/game_stvoyhm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_STVOYMP_H__
#define __QMM2_GAME_STVOYMP_H__


// these function ids are defined either in the g_syscalls.asm file or in qcommon.h from ioef source,
// but they do not appear in the enum in stvoyhm/game/g_public.h
enum {
G_MEMSET = 100,
G_MEMCPY = 101,
G_STRNCPY = 102,
G_SIN = 103,
G_COS = 104,
G_ATAN2 = 105,
G_SQRT = 106,
G_MATRIXMULTIPLY = 107,
G_ANGLEVECTORS = 108,
G_PERPENDICULARVECTOR = 109,
G_FLOOR = 110,
G_CEIL = 111,
G_TESTPRINTINT = 112,
G_TESTPRINTFLOAT = 113
};

// these import messages do not have an exact analogue in STVOYMP
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_STVOYMP_H__
1 change: 1 addition & 0 deletions include/game_stvoysp.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ enum {
// helper for plugins to not need separate logic
G_LOCATE_GAME_DATA, // void (gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *clients, int sizeofGameClient)
G_GET_ENTITY_TOKEN, // qboolean (char *buffer, int bufferSize)
G_ARGS, // char* (void)
};

#endif // __QMM2_GAME_STVOYSP_H__
20 changes: 20 additions & 0 deletions include/game_wet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
QMM2 - Q3 MultiMod 2
Copyright 2025
https://github.com/thecybermind/qmm2/
3-clause BSD license: https://opensource.org/license/bsd-3-clause

Created By:
Kevin Masterson < k.m.masterson@gmail.com >

*/

#ifndef __QMM2_GAME_WET_H__
#define __QMM2_GAME_WET_H__

// these import messages do not have an exact analogue in WET
enum {
G_ARGS = -100, // char* (void)
};

#endif // __QMM2_GAME_WET_H__
28 changes: 14 additions & 14 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ struct api_info_t {
void* orig_export = nullptr; // original export struct from mod
void* qmm_import = nullptr; // import struct that is hooked by QMM and given to the mod
void* qmm_export = nullptr; // export struct that is hooked by QMM and given to the engine
mod_vmMain_t orig_vmmain = nullptr; // pointer to wrapper vmMain function that calls actual mod func from orig_export
};

// store all currently-loaded game & game engine info
struct game_info_t {
eng_syscall_t pfnsyscall = nullptr;
supportedgame_t* game = nullptr;
bool isautodetected = false;
std::string exe_path;
std::string exe_dir;
std::string exe_file;
std::string qmm_path;
std::string qmm_dir;
std::string qmm_file;
void* qmm_module_ptr = nullptr;
std::string moddir;
std::string cfg_path;
api_info_t api_info;
eng_syscall_t pfnsyscall = nullptr; // game-specific wrapper for syscall. given to plugins and called by QMM
mod_vmMain_t pfnvmMain = nullptr; // game-specific wrapper for vmMain. given to plugins and called by QMM
supportedgame_t* game = nullptr; // loaded engine from supported games table from game_api.cpp
bool isautodetected = false; // was this engine auto-detected?
std::string exe_path; // full path of running server binary
std::string exe_dir; // directory of running server binary
std::string exe_file; // filename of running server binary
std::string qmm_path; // full path of qmm dll
std::string qmm_dir; // directory of qmm dll
std::string qmm_file; // filename of qmm dll
void* qmm_module_ptr = nullptr; // qmm module pointer
std::string moddir; // active mod dir
std::string cfg_path; // qmm config file path
api_info_t api_info; // some pointers utilized by GetGameAPI games
};

extern game_info_t g_gameinfo;
Expand Down
3 changes: 0 additions & 3 deletions include/mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Created By:
#include "qmmapi.h"
#include "qvm.h"

typedef void (*mod_dllEntry_t)(eng_syscall_t syscall);
typedef void* (*mod_GetGameAPI_t)(void* import);

struct mod_t {
void* dll = nullptr;
qvm_t qvm = {};
Expand Down
2 changes: 2 additions & 0 deletions include/qmmapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Created By:

typedef intptr_t (*eng_syscall_t)(intptr_t cmd, ...);
typedef intptr_t (*mod_vmMain_t)(intptr_t cmd, ...);
typedef void (*mod_dllEntry_t)(eng_syscall_t syscall);
typedef void* (*mod_GetGameAPI_t)(void* import);

// major interface version increases with change to the signature of QMM_Query, QMM_Attach, QMM_Detach, pluginfunc_t, or plugininfo_t
#define QMM_PIFV_MAJOR 4
Expand Down
Loading