2004-09-11 19:18:30 +00:00
|
|
|
#ifndef CONSOLE_H
|
|
|
|
#define CONSOLE_H
|
2004-09-12 20:15:18 +00:00
|
|
|
|
2004-08-24 22:41:42 +00:00
|
|
|
// ** console ** //
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ICONSOLE_OPENED=0,
|
|
|
|
ICONSOLE_CLOSED,
|
|
|
|
} _iconsole_modes;
|
|
|
|
|
|
|
|
// ** console parser ** //
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ICONSOLE_VAR_NONE=0,
|
|
|
|
ICONSOLE_VAR_BOOLEAN,
|
|
|
|
ICONSOLE_VAR_BYTE,
|
|
|
|
ICONSOLE_VAR_UINT16,
|
|
|
|
ICONSOLE_VAR_UINT32,
|
|
|
|
ICONSOLE_VAR_INT16,
|
|
|
|
ICONSOLE_VAR_INT32,
|
|
|
|
ICONSOLE_VAR_STRING,
|
|
|
|
ICONSOLE_VAR_POINTER,
|
2004-08-25 22:11:41 +00:00
|
|
|
ICONSOLE_VAR_REFERENCE,
|
2004-09-12 20:15:18 +00:00
|
|
|
ICONSOLE_VAR_UNKNOWN,
|
2004-08-24 22:41:42 +00:00
|
|
|
} _iconsole_var_types;
|
|
|
|
|
2004-09-12 20:15:18 +00:00
|
|
|
enum {
|
|
|
|
ICONSOLE_HOOK_ACCESS,
|
|
|
|
ICONSOLE_HOOK_BEFORE_CHANGE,
|
|
|
|
ICONSOLE_HOOK_BEFORE_EXEC,
|
|
|
|
ICONSOLE_HOOK_AFTER_CHANGE,
|
|
|
|
ICONSOLE_HOOK_AFTER_EXEC,
|
|
|
|
} _iconsole_hook_types;
|
|
|
|
|
2004-08-24 22:41:42 +00:00
|
|
|
typedef struct {
|
|
|
|
// -------------- //
|
|
|
|
void * addr;
|
|
|
|
byte * name;
|
|
|
|
// -------------- //
|
2004-09-12 20:15:18 +00:00
|
|
|
void * hook_access;
|
|
|
|
void * hook_before_exec;
|
|
|
|
void * hook_after_exec;
|
|
|
|
// -------------- //
|
2004-08-24 22:41:42 +00:00
|
|
|
void * _next;
|
|
|
|
} _iconsole_cmd;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
// --------------- //
|
|
|
|
void * addr;
|
2004-09-12 21:49:38 +00:00
|
|
|
const byte * name;
|
2004-08-24 22:41:42 +00:00
|
|
|
byte type;
|
|
|
|
// -------------- //
|
2004-09-12 20:15:18 +00:00
|
|
|
void * hook_access;
|
|
|
|
void * hook_before_change;
|
|
|
|
void * hook_after_change;
|
|
|
|
// -------------- //
|
2004-08-24 22:41:42 +00:00
|
|
|
void * _next;
|
|
|
|
bool _malloc;
|
|
|
|
} _iconsole_var;
|
|
|
|
|
2004-09-12 20:15:18 +00:00
|
|
|
// ** console parser ** //
|
|
|
|
|
|
|
|
_iconsole_cmd * _iconsole_cmds; // list of registred commands
|
|
|
|
_iconsole_var * _iconsole_vars; // list of registred vars
|
|
|
|
|
2004-08-25 22:11:41 +00:00
|
|
|
// ** console colors ** //
|
|
|
|
VARDEF byte _iconsole_color_default;
|
|
|
|
VARDEF byte _iconsole_color_error;
|
2004-09-14 16:30:33 +00:00
|
|
|
VARDEF byte _iconsole_color_warning;
|
2004-08-25 22:11:41 +00:00
|
|
|
VARDEF byte _iconsole_color_debug;
|
|
|
|
VARDEF byte _iconsole_color_commands;
|
|
|
|
|
2004-08-24 22:41:42 +00:00
|
|
|
// ** ttd.c functions ** //
|
2004-09-12 20:15:18 +00:00
|
|
|
|
2004-08-24 22:41:42 +00:00
|
|
|
void SetDebugString(const char *s);
|
|
|
|
|
|
|
|
// ** console functions ** //
|
|
|
|
|
|
|
|
void IConsoleClearCommand();
|
|
|
|
void IConsoleInit();
|
|
|
|
void IConsoleClear();
|
|
|
|
void IConsoleFree();
|
|
|
|
void IConsoleResize();
|
|
|
|
void IConsoleSwitch();
|
|
|
|
void IConsoleClose();
|
|
|
|
void IConsoleOpen();
|
|
|
|
|
2004-08-25 22:11:41 +00:00
|
|
|
// ** console cmd buffer ** //
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleCmdBufferAdd(const byte *cmd);
|
2004-08-25 22:11:41 +00:00
|
|
|
void IConsoleCmdBufferNavigate(signed char direction);
|
2004-08-24 22:41:42 +00:00
|
|
|
|
2004-08-25 22:11:41 +00:00
|
|
|
// ** console output ** //
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsolePrint(byte color_code, const byte* string);
|
2004-09-06 21:27:26 +00:00
|
|
|
void CDECL IConsolePrintF(byte color_code, const char *s, ...);
|
2004-08-24 22:41:42 +00:00
|
|
|
void IConsoleDebug(byte* string);
|
2004-09-14 16:30:33 +00:00
|
|
|
void IConsoleError(const byte* string);
|
2004-09-13 06:56:30 +00:00
|
|
|
void IConsoleWarning(const byte* string);
|
2004-08-24 22:41:42 +00:00
|
|
|
|
|
|
|
// *** Commands *** //
|
|
|
|
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleCmdRegister(const byte * name, void * addr);
|
2004-09-13 06:56:30 +00:00
|
|
|
_iconsole_cmd * IConsoleCmdGet(const byte * name);
|
2004-08-24 22:41:42 +00:00
|
|
|
|
|
|
|
// *** Variables *** //
|
|
|
|
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleVarRegister(const byte * name, void * addr, byte type);
|
2004-09-12 23:35:01 +00:00
|
|
|
void IConsoleVarMemRegister(const byte * name, byte type);
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleVarInsert(_iconsole_var * var, const byte * name);
|
|
|
|
_iconsole_var * IConsoleVarGet(const byte * name);
|
2004-08-24 22:41:42 +00:00
|
|
|
_iconsole_var * IConsoleVarAlloc(byte type);
|
|
|
|
void IConsoleVarFree(_iconsole_var * var);
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleVarSetString(_iconsole_var * var, const byte * string);
|
2004-08-24 22:41:42 +00:00
|
|
|
void IConsoleVarSetValue(_iconsole_var * var, int value);
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleVarDump(_iconsole_var * var, const byte * dump_desc);
|
2004-08-24 22:41:42 +00:00
|
|
|
|
|
|
|
// *** Parser *** //
|
|
|
|
|
2004-09-14 16:30:33 +00:00
|
|
|
void IConsoleCmdExec(const byte* cmdstr);
|
2004-09-11 19:18:30 +00:00
|
|
|
|
2004-09-12 20:15:18 +00:00
|
|
|
// ** console std lib ** //
|
|
|
|
void IConsoleStdLibRegister();
|
|
|
|
|
|
|
|
// ** hook code ** //
|
2004-09-12 21:49:38 +00:00
|
|
|
void IConsoleVarHook(const byte * name, byte type, void * proc);
|
|
|
|
void IConsoleCmdHook(const byte * name, byte type, void * proc);
|
2004-09-12 20:15:18 +00:00
|
|
|
bool IConsoleVarHookHandle(_iconsole_var * hook_var, byte type);
|
|
|
|
bool IConsoleCmdHookHandle(_iconsole_cmd * hook_cmd, byte type);
|
|
|
|
|
2004-09-11 19:18:30 +00:00
|
|
|
#endif /* CONSOLE_H */
|