1 |
#ifndef ONI_SYMBOLS_H |
2 |
#define ONI_SYMBOLS_H |
3 |
#include "bool.h" |
4 |
#include <stdio.h> |
5 |
#include "oni_gl.h" |
6 |
#include "Oni_Character.h" |
7 |
#include "BFW_ScriptLang.h" |
8 |
#define DefVar(type, name, address) extern type* _##name |
9 |
//variables |
10 |
|
11 |
///BADBAD DONT DO THIS |
12 |
extern onibool* _ai2_deaf; |
13 |
extern char* _AKgDebug_DebugMaps; |
14 |
extern HINSTANCE* _g_Instance; |
15 |
extern ONtPlatformData* _ONgPlatformData; |
16 |
extern char* _opt_ignore_private_data; |
17 |
extern char* _opt_sound; |
18 |
|
19 |
//DO THIS INSTEAD! |
20 |
DefVar( GameState* , ONgGameState , 0x005ece7c ); |
21 |
|
22 |
DefVar( bool, BFgDebugFileEnable, 0x0055c8d0 ); |
23 |
DefVar( bool, SSgSearchOnDisk, 0x005eb758); |
24 |
DefVar( char, M3gResolutionSwitch, 0x00531634); |
25 |
DefVar( gl_engine_t*, gl_eng, 0x00560600 ); |
26 |
DefVar( gl_api_t*, gl_api, 0x00560604 ); |
27 |
DefVar( WORD*, gl_gamma_ramp, 0x0055fdfc ); |
28 |
DefVar( int, gl_gamma_ramp_valid, 0x005603fc ); |
29 |
DefVar( uint32_t, COgConsoleLines , 0x005cb468 ); |
30 |
DefVar( uint32_t, COgFadeTimeValue , 0x00533f68 ); |
31 |
DefVar( uint32_t, COgDefaultTextShade , 0x00533f70 ); |
32 |
DefVar( uint32_t, COgDefaultTextShadow , 0x00533f74 ); |
33 |
DefVar( FILE*, ONgFileStartup , 0x005711b8 ); |
34 |
|
35 |
#undef DefVar |
36 |
//Yes, I'm aware that there are a few ways this could go wrong |
37 |
//but in the interests of neatness and not having to go through and rename all the variables |
38 |
//and use annoying dereferencing, this will do. |
39 |
|
40 |
//...too bad there is no way to nest #defines... |
41 |
#define AKgDebug_DebugMaps (*_AKgDebug_DebugMaps) |
42 |
#define ai2_deaf (*_ai2_deaf) |
43 |
#define g_Instance (*_g_Instance) |
44 |
#define M3gResolutionSwitch (*_M3gResolutionSwitch) |
45 |
#define ONgGameState (*_ONgGameState) |
46 |
#define ONgPlatformData (*_ONgPlatformData) |
47 |
#define opt_ignore_private_data (*_opt_ignore_private_data) |
48 |
#define opt_sound (*_opt_sound) |
49 |
#define BFgDebugFileEnable (*_BFgDebugFileEnable) |
50 |
#define SSgSearchOnDisk (*_SSgSearchOnDisk) |
51 |
#define gl_gamma_ramp (*_gl_gamma_ramp) |
52 |
#define gl_gamma_ramp_valid (*_gl_gamma_ramp_valid) |
53 |
#define gl_api (*_gl_api) |
54 |
#define gl_eng (*_gl_eng) |
55 |
#define COgConsoleLines (*_COgConsoleLines) |
56 |
#define COgFadeTimeValue (*_COgFadeTimeValue) |
57 |
#define COgDefaultTextShade (*_COgDefaultTextShade) |
58 |
#define COgDefaultTextShadow (*_COgDefaultTextShadow) |
59 |
#define ONgFileStartup (*_ONgFileStartup) |
60 |
#undef $ |
61 |
|
62 |
//functions |
63 |
//__fastcall isn't neccessary if you specify the correct calling convention. |
64 |
typedef int64_t ( *_UUrMachineTime_High)(); |
65 |
typedef double ( *_UUrMachineTime_High_Frequency)(); |
66 |
typedef int64_t ( *_UUrMachineTime_Sixtieths)(); |
67 |
typedef void ( *_UUrPlatform_Initialize)(); |
68 |
typedef void ( *_UUrPlatform_Terminate)(); |
69 |
|
70 |
typedef FILE* ( __cdecl *_oni_fopen)(const char*, const char*); |
71 |
typedef int ( __cdecl *_oni_fprintf)(FILE*, const char*, ...); |
72 |
typedef int ( __cdecl *_oni_fflush)(FILE*); |
73 |
|
74 |
typedef void ( __cdecl *_ONiMain)(int ArgCount, char *ArgList[]); |
75 |
typedef short ( *_ONrPlatform_Initialize)(ONtPlatformData *PlatformData); |
76 |
typedef LRESULT ( CALLBACK *_ONrPlatform_WindowProc)(HWND Window, UINT Message, |
77 |
WPARAM WParam, LPARAM LParam); |
78 |
typedef unsigned int ( *_gl_enumerate_valid_display_modes)(M3tDisplayMode modes[16]); |
79 |
typedef int ( *_gl_platform_set_pixel_format)(HDC hdc); |
80 |
typedef int ( *_gl_platform_initialize)(); |
81 |
|
82 |
typedef float ( *_ONrPersist_GetGamma)(); |
83 |
typedef uint8_t ( *_ONrPersist_GetWonGame)(); |
84 |
|
85 |
typedef void ( __cdecl *_UUrStartupMessage)(const char* fmt, ...); |
86 |
typedef int16_t ( *_ONrGameState_NewCharacter)(void* CHAR, void* AISA, |
87 |
void* flag, uint32_t* list_location); |
88 |
typedef ActiveCharacter* ( *_ONrGetActiveCharacter)(void* CharacterPtr); |
89 |
//int16_t ONICALL ONrGameState_GetPlayerCharacter(); |
90 |
|
91 |
typedef void ( *_COrTextArea_Print)(uint32_t area, uint32_t priority, |
92 |
uint32_t textshade, uint32_t textshadowshade, |
93 |
const char* text, uint32_t unk_alwaws_0, uint32_t fadetime); |
94 |
typedef uint8_t ( *_ONrCheater)(uint32_t cheat); |
95 |
typedef int ( __cdecl *_AUrMessageBox)(int Buttons, char *Message, ...); |
96 |
typedef char* ( *_SSrMessage_Find)(char* message_key); //Returns a prompt message from a message key |
97 |
typedef void ( *_ONiGameState_FindAutoPromptMessage)(char* Note, void* ptr); |
98 |
|
99 |
typedef uint16_t (ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); |
100 |
typedef uint16_t (ONICALL *_SLrScript_Command_Register_ReturnType)(char* name, char* desc, char* argfmt, sl_type type, sl_func callback); |
101 |
typedef uint16_t (ONICALL *_SLrScript_Command_Register_Void)(char* name, char* desc, char* argfmt, sl_func callback); |
102 |
typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Int32)(char* name, char* desc, int32_t* data); |
103 |
typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Float)(char* name, char* desc, float* data); |
104 |
typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_String)(char* name, char* desc, char* data); |
105 |
|
106 |
typedef int ( *_COrMessage_Print)(char* Message, char* Key, void* noidea); |
107 |
|
108 |
typedef int16_t ( *_TMrInstance_GetDataPtr)(int tag, char* name, void* pointer); |
109 |
typedef char* ( *_TMrInstance_GetInstanceName)(void* InstancePointer); |
110 |
|
111 |
typedef int16_t ( *_TSrContext_DrawText)(uint32_t TSrContext, char* Text, int alpha, uint32_t usuallyzero, void* pRect); |
112 |
//int16_t TSrContext_New ( TSFF*, size 7, ??? 1, ??? 1, ??? 0, TSrContext*); |
113 |
typedef int16_t ( *_TSrContext_New)( void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext); |
114 |
|
115 |
//yes im cheating so badly. |
116 |
typedef uint16_t ( *_iSetCharacterClass)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); |
117 |
|
118 |
#define ExtFunc(name) extern _##name name |
119 |
ExtFunc(SLrScript_Command_Register_ReturnType); |
120 |
ExtFunc(SLrScript_Command_Register_Void); |
121 |
ExtFunc(SLrGlobalVariable_Register_Int32); |
122 |
ExtFunc(SLrGlobalVariable_Register_Float); |
123 |
ExtFunc(SLrGlobalVariable_Register_String); |
124 |
|
125 |
|
126 |
extern _UUrMachineTime_High UUrMachineTime_High; |
127 |
extern _UUrMachineTime_High_Frequency UUrMachineTime_High_Frequency; |
128 |
extern _UUrMachineTime_Sixtieths UUrMachineTime_Sixtieths; |
129 |
extern _UUrPlatform_Initialize UUrPlatform_Initialize; |
130 |
extern _UUrPlatform_Terminate UUrPlatform_Terminate; |
131 |
|
132 |
extern _oni_fopen oni_fopen; |
133 |
extern _oni_fprintf oni_fprintf; |
134 |
extern _oni_fflush oni_fflush; |
135 |
|
136 |
extern _ONiMain ONiMain; |
137 |
extern _ONrPlatform_Initialize ONrPlatform_Initialize; |
138 |
extern _ONrPlatform_WindowProc ONrPlatform_WindowProc; |
139 |
|
140 |
ExtFunc(COrMessage_Print); |
141 |
|
142 |
ExtFunc(TMrInstance_GetDataPtr); |
143 |
ExtFunc(TMrInstance_GetInstanceName); |
144 |
|
145 |
ExtFunc(gl_enumerate_valid_display_modes); |
146 |
ExtFunc(gl_platform_set_pixel_format); |
147 |
ExtFunc(gl_platform_initialize); |
148 |
ExtFunc(ONrPersist_GetGamma); |
149 |
ExtFunc(ONrPersist_GetWonGame); |
150 |
ExtFunc(UUrStartupMessage); |
151 |
|
152 |
ExtFunc(ONrGameState_NewCharacter); |
153 |
ExtFunc(ONrGetActiveCharacter); |
154 |
|
155 |
ExtFunc(iSetCharacterClass); |
156 |
|
157 |
ExtFunc(COrTextArea_Print); |
158 |
|
159 |
ExtFunc(ONrCheater); |
160 |
ExtFunc(AUrMessageBox); |
161 |
|
162 |
ExtFunc(SSrMessage_Find); |
163 |
ExtFunc(ONiGameState_FindAutoPromptMessage); |
164 |
|
165 |
ExtFunc(TSrContext_DrawText); |
166 |
ExtFunc(TSrContext_New); |
167 |
#endif |