1 |
#ifndef ONI_SYMBOLS_H |
2 |
#define ONI_SYMBOLS_H |
3 |
#include "stdint.h" |
4 |
#include <stdio.h> |
5 |
#include "Oni.h" |
6 |
#include "Oni_GL.h" |
7 |
#include "Oni_Character.h" |
8 |
#include "BFW_ScriptLang.h" |
9 |
|
10 |
|
11 |
//Define variables of Oni: #define VARNAME (*((TYPE*)ADDRESS)) |
12 |
|
13 |
// AIs are deaf (ger: "taub") |
14 |
#define ai2_deaf (*((onibool*)0x005ec0c1)) |
15 |
|
16 |
// Option "debug" ... but what does it do? |
17 |
#define AKgDebug_DebugMaps (*((char*)0x002b2204)) |
18 |
|
19 |
// Option "debugfiles" ... but what does it do? |
20 |
#define BFgDebugFileEnable (*((bool*)0x0055c8d0)) |
21 |
|
22 |
// Parameter 1 to COrTextArea_Print. Context pointer? |
23 |
#define COgConsoleLines (*((uint32_t*)0x005cb468)) |
24 |
|
25 |
// Command line instance |
26 |
#define COgCommandLine (*((void**)0x00571b74)) |
27 |
|
28 |
|
29 |
// Default console text color |
30 |
#define COgDefaultTextShade (*((uint32_t*)0x00533f70)) |
31 |
|
32 |
// Default console text shadow color |
33 |
#define COgDefaultTextShadow (*((uint32_t*)0x00533f74)) |
34 |
|
35 |
// Console text fade timeout |
36 |
#define COgFadeTimeValue (*((uint32_t*)0x00533f68)) |
37 |
|
38 |
// Game termination flag (ONiRunGame loops on it). |
39 |
#define ONgTerminateGame (*((UUtBool*)0x00630ffd)) |
40 |
|
41 |
// Window manager is running (drawing and updating windows). |
42 |
#define WMgActive (*((UUtBool*)0x005e99a0)) |
43 |
|
44 |
// Set by WinMain, used by UUrPlatform_Initialize and ONrPlatform_Initialize, |
45 |
// which copies it into ONgPlatformData. |
46 |
#define ONgInstance (*((HINSTANCE*)0x0061f9e4)) |
47 |
|
48 |
// Keeps initial gamma ramp value (before any change). |
49 |
#define GLgInitialGammaRamp (((M3tWin32GammaRamp*)0x0055fdfc)) |
50 |
|
51 |
// Nonzero when gamma ramp was successfully read into GLgInitialGammaRamp. |
52 |
#define GLgGammaRampValid (*((int*)0x005603fc)) |
53 |
|
54 |
// OpenGL: list of pointers to opengl32.dll functions (and a few functions from GL extensions) |
55 |
#define gl_api (*((gl_api_t**)0x00560604)) |
56 |
|
57 |
// OpenGL render engine descriptor (resolutions, flags, context methods) |
58 |
#define gl (*((gl_engine_t**)0x00560600)) |
59 |
|
60 |
// Initial display mode (saved by gl_library_is_loaded). |
61 |
#define GLgInitialMode (*((DEVMODE*)0x0055fd60)) |
62 |
|
63 |
// False to prevent Oni from changing display settings (however Bink |
64 |
// player does not respect this setting). |
65 |
#define M3gResolutionSwitch (*((char*)0x00531634)) |
66 |
|
67 |
// Startup.txt file handle |
68 |
#define ONgFileStartup (*((FILE**)0x005711b8)) |
69 |
|
70 |
// Current GameState |
71 |
#define ONgGameState (*((GameState**)0x005ece7c)) |
72 |
|
73 |
// Current ONtPlatformData |
74 |
#define ONgPlatformData (*((ONtPlatformData*)0x00631008)) |
75 |
|
76 |
// Load non levelX_final-files yes/no |
77 |
#define opt_ignore_private_data (*((char*)0x006370f0)) |
78 |
|
79 |
// Play sound yes/no |
80 |
#define opt_sound (*((char*)0x006370fc)) |
81 |
|
82 |
// Option "findsounds" ... but what does it do? |
83 |
#define SSgSearchOnDisk (*((bool*)0x005eb758)) |
84 |
|
85 |
// OBJgTriggerVolume_Visible - bsl var to show trigger volumes |
86 |
#define OBJgTriggerVolume_Visible (*((bool*)0x005ec6c4)) |
87 |
|
88 |
//#define OBJgFlag_DrawFlags (*((void*)0x005ec624)) |
89 |
//#define OBJgFlag_ViewPrefix (*((void*)0x005ec650)) |
90 |
//#define OBJgFlag_DrawNameDistance (*((void*)0x005ec634)) |
91 |
|
92 |
// Method signature for script (BSL) functions |
93 |
typedef uint16_t ( ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); |
94 |
|
95 |
// Used by function definition below: OBJrObjectType_EnumerateObjects |
96 |
typedef char ( ONICALL *OBJtEnumCallback_Object)(void *inObject, int inUserData); |
97 |
|
98 |
|
99 |
|
100 |
#define DefFunc( type, name, callingconvention, args, address) typedef type ( callingconvention * _##name ) args; static _##name name = (_##name)address |
101 |
|
102 |
// Orig timing functions, replaced by DDrMachineTime_* if option "usegettickcount" is enabled |
103 |
DefFunc(int64_t, UUrMachineTime_High, ONICALL, (), 0x04026480); |
104 |
DefFunc(double, UUrMachineTime_High_Frequency, ONICALL, (), 0x040264b0); |
105 |
DefFunc(int64_t, UUrMachineTime_Sixtieths, ONICALL, (), 0x040263e0); |
106 |
|
107 |
// Code to initialize platform stuff (like disabling system key combination Alt+Tab) |
108 |
DefFunc(void, UUrPlatform_Initialize, ONICALL, (), 0x04026010); |
109 |
DefFunc(void, UUrPlatform_Terminate, ONICALL, (), 0x04026310); |
110 |
|
111 |
// Oni's file access methods |
112 |
DefFunc(FILE*, oni_fopen, __cdecl, (const char*, const char*), 0x0051ea9f); |
113 |
DefFunc(int, oni_fprintf, __cdecl, (FILE*, const char*, ...), 0x0051ebbf); |
114 |
DefFunc(int, oni_fflush, __cdecl, (FILE*), 0x0051eab2); |
115 |
|
116 |
// Oni's main method? |
117 |
DefFunc(void, ONiMain, __cdecl, (int ArgCount, char *ArgList[]), 0x004d3280); |
118 |
|
119 |
// Initialization code, used to hook in windowed modes |
120 |
DefFunc(short, ONrPlatform_Initialize, ONICALL, (ONtPlatformData *PlatformData), 0x0050f670); |
121 |
DefFunc(LRESULT, ONrPlatform_WindowProc, CALLBACK, (HWND Window, UINT Message, WPARAM WParam, LPARAM LParam), 0x0050f7a0); |
122 |
|
123 |
// Retrieves a list of resolutions, replaced by "daodan_enumerate_valid_display_modes" |
124 |
DefFunc(unsigned int, gl_enumerate_valid_display_modes, ONICALL, (M3tDisplayMode modes[16]), 0x004083a0); |
125 |
DefFunc(int, gl_platform_set_pixel_format, ONICALL, (HDC hdc), 0x00407b50); |
126 |
|
127 |
// Original graphics initialization/cleanup functions patched to use |
128 |
// DD_GLrPlatform_Initialize/DD_GLrPlatform_Dispoose instead if daodangl is used. |
129 |
DefFunc(UUtBool, gl_platform_initialize, ONICALL, (void), 0x00407da0); |
130 |
DefFunc(void, gl_platform_dispose, ONICALL, (void), 0x408210); |
131 |
|
132 |
// Retrieve gamma value from settings |
133 |
DefFunc(float, ONrPersist_GetGamma, ONICALL, (), 0x0050f450); |
134 |
|
135 |
// Retrieve if the game was completed |
136 |
DefFunc(uint8_t, ONrPersist_GetWonGame, ONICALL, (), 0x0050f660); |
137 |
|
138 |
// Print a message to the startup.txt log |
139 |
DefFunc(void, UUrStartupMessage, __cdecl, (const char* fmt, ...), 0x00424860); |
140 |
|
141 |
// Probably to spawn a new character |
142 |
DefFunc(int16_t, ONrGameState_NewCharacter, ONICALL, (void* CHAR, void* AISA, void* flag, uint32_t* list_location), 0x004dac50); |
143 |
|
144 |
// Remove character |
145 |
DefFunc(void, ONrGameState_DeleteCharacter, ONICALL, (Character *inCharacter), 0x004DC480); |
146 |
|
147 |
DefFunc(void, ONrGameState_Timer_Start, ONICALL, (char* function, int time), 0x004FD370); |
148 |
|
149 |
// Get active (player?) character |
150 |
DefFunc(ActiveCharacter*, ONrGetActiveCharacter, ONICALL, (void* CharacterPtr), 0x004f1180); |
151 |
|
152 |
DefFunc(uint32_t, ONrCharacter_GetHealthShade, ONICALL, (uint32_t health, uint32_t maxhealth), 0x004EF450); |
153 |
DefFunc(void, ONrCharacter_NewAnimationHook, ONICALL, (Character *ioCharacter, ActiveCharacter *ioActiveCharacter), 0x004E97A0); |
154 |
DefFunc(void, ONrCharacter_SetAnimationExternal, ONICALL, (Character *ioCharacter, short state, void* animation, int interpolation), 0x004EB340); |
155 |
DefFunc(void, ONrCharacter_SetHitPoints, ONICALL, (Character *ioCharacter, uint32_t inHitPoints), 0x004EB220); |
156 |
DefFunc(void, ONrCharacter_SetCharacterClass, ONICALL, (Character* Char, ONCC* Class), 0x004D7C30); |
157 |
DefFunc(void, ONrCorpse_Create, ONICALL, (Character* Character), 0x004EF340); |
158 |
|
159 |
|
160 |
// Print message to console |
161 |
DefFunc(void, COrTextArea_Print, ONICALL, (uint32_t area, uint32_t priority, uint32_t textshade, uint32_t textshadowshade, const char* text, uint32_t unk_alwaws_0, uint32_t fadetime), 0x00431340); |
162 |
DefFunc(int16_t, COrTextArea_Resize, ONICALL, (void* inTextArea, UUtRect* inBounds, int16_t inNumTextEntries), 0x00431460); |
163 |
|
164 |
// Original cheat function |
165 |
DefFunc(uint8_t, ONrCheater, ONICALL, (uint32_t cheat), 0x004f5c30); |
166 |
|
167 |
// ? |
168 |
DefFunc(int, AUrMessageBox, __cdecl, (int Buttons, char *Message, ...), 0x004378c0); |
169 |
DefFunc(char*, SSrMessage_Find, ONICALL, (char* message_key), 0x0047F550); |
170 |
DefFunc(void, ONiGameState_FindAutoPromptMessage, ONICALL, (char* Note, void* ptr), 0x004FDBE0); |
171 |
|
172 |
// Register a BSL function with a return type |
173 |
DefFunc(uint16_t, SLrScript_Command_Register_ReturnType, ONICALL, (char* name, char* desc, char* argfmt, sl_type type, sl_func callback), 0x00477b20); |
174 |
|
175 |
// Register a BSL function without a return value |
176 |
DefFunc(uint16_t, SLrScript_Command_Register_Void, ONICALL, (char* name, char* desc, char* argfmt, sl_func callback), 0x00477b40); |
177 |
|
178 |
// Register a global BSL variable |
179 |
DefFunc(uint16_t, SLrGlobalVariable_Register_Bool, ONICALL, (char* name, char* desc, UUtBool* data), 0x00477f50); |
180 |
DefFunc(uint16_t, SLrGlobalVariable_Register_Int32, ONICALL, (char* name, char* desc, int32_t* data), 0x00477e30); |
181 |
DefFunc(uint16_t, SLrGlobalVariable_Register_Float, ONICALL, (char* name, char* desc, float* data), 0x00477ec0); |
182 |
DefFunc(uint16_t, SLrGlobalVariable_Register_String, ONICALL, (char* name, char* desc, char* data), 0x00477fe0); |
183 |
|
184 |
// Print message to console ? |
185 |
DefFunc(int, COrMessage_Print, ONICALL, (char* Message, char* Key, void* noidea), 0x004304B0); |
186 |
DefFunc(UUtBool, COrCommand_Execute, ONICALL, (char* command), 0x004317D0); |
187 |
|
188 |
DefFunc(void, COrConsole_StatusLine_Display, ONICALL, (), 0x00431E70); |
189 |
|
190 |
// Get pointer to specified data instance |
191 |
DefFunc(int16_t, TMrInstance_GetDataPtr, ONICALL, (int tag, char* name, void* pointer), 0x004232E0); |
192 |
|
193 |
// Get name of data instance pointed to |
194 |
DefFunc(char*, TMrInstance_GetInstanceName, ONICALL, (void* InstancePointer), 0x00423D90); |
195 |
|
196 |
DefFunc(short, TMrInstance_GetDataPtr_ByNumber, ONICALL, (int tag, int number, void** out), 0x00423680); |
197 |
DefFunc(uint32_t, TMrInstance_GetTagCount, ONICALL, (int tag), 0x004236F0); |
198 |
|
199 |
// Draw text on the screen |
200 |
DefFunc(int16_t, TSrContext_DrawText, ONICALL, (uint32_t TSrContext, char* Text, char alpha, uint32_t usuallyzero, void* pRect), 0x0042DF00); |
201 |
DefFunc(int16_t, TSrContext_New, ONICALL, (void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext), 0x0042EA30); |
202 |
DefFunc(int16_t, TSrContext_SetFontSize, ONICALL, (void* ioTextContext, uint16_t inSize), 0x0042ED50); |
203 |
DefFunc(int16_t, TSrContext_SetShade, ONICALL, (void* ioTextContext, uint32_t inShade), 0x0042EE50); |
204 |
|
205 |
DefFunc(uint16_t, TRrAnimation_GetDuration, ONICALL, (void* Animation), 0x00428740); |
206 |
DefFunc(uint16_t, TRrAnimation_GetTo, ONICALL, (void* Animation), 0x00428730); |
207 |
DefFunc(uint16_t, TRrAnimation_GetFrom, ONICALL, (void* Animation), 0x00428720); |
208 |
|
209 |
DefFunc(uint16_t, iSetCharacterClass, ONICALL, (sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret), 0x004D99D0); |
210 |
DefFunc(uint16_t, AI2iScript_Spawn, ONICALL, (sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret), 0x004B4780); |
211 |
DefFunc(void, AI2rSmite, ONICALL, (Character *inCharacter, UUtBool inSpareCharacter), 0x0048BDA0); |
212 |
//NOT USED: DefFunc(void*, OBJrObjectType_GetObject_ByNumber, ONICALL, (int inObjectType, int inIndex), ); |
213 |
//NOT USED: DefFunc(int, OBJiObjectGroup_GetNumObjects, ONICALL, (void *inObjectGroup), ); |
214 |
|
215 |
DefFunc(int, OBJrObjectType_EnumerateObjects, ONICALL, (int inObjectType, OBJtEnumCallback_Object inEnumCallback, int inUserData), 0x004D0080); |
216 |
//DefFunc(void, OBJrTriggerVolume_IntersectsCharacter, ONICALL, (), 0x004cc680); |
217 |
|
218 |
DefFunc(void, OBJrDoor_Open, ONICALL, (DoorObject *inObject, Character *inCharacter), 0x004C26C0); |
219 |
DefFunc(void, OBJrDoor_ForceOpen, ONICALL, (short id), 0x004C1EE0); |
220 |
DefFunc(short, OBJrConsole_OnActivate, ONICALL, (void *inObject, Character *inCharacter), 0x004C0880); |
221 |
DefFunc(void*, OBJrConsole_GetByID, ONICALL, (short ID), 0x004C0950); |
222 |
|
223 |
|
224 |
DefFunc(void, ONiDrawWeaponSight, ONICALL, (Character* Char), 0x004E1900); |
225 |
DefFunc(void, AI2rDisplayDebuggingInfo, ONICALL, (Character* Char), 0x0048C5F0); |
226 |
DefFunc(uint32_t, M3rTextureMap_New, ONICALL, (short width, short height, int type, int allocated, int flags, char* name, void** output), 0x0041EB00); |
227 |
DefFunc(void, M3rDraw_BigBitmap, ONICALL, (M3tTextureMap_Big* inBigBitmap, const M3tPointScreen *inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha), 0x0041f6e0); |
228 |
DefFunc(void, M3rDraw_Bitmap, ONICALL, (void* inBitmap, const M3tPointScreen* inDestPoint, UUtUns16 inWidth, UUtUns16 inHeight, UUtUns32 inShade, UUtUns16 inAlpha), 0x0041f4a0); |
229 |
/* |
230 |
DefFunc(void, M3rGeom_Line_Light, ONICALL, (), 0x0041f440); |
231 |
DefFunc(void, M3rMatrixStack_Push, ONICALL, (), 0x0041baa0); |
232 |
DefFunc(void, M3rMatrixStack_Get, ONICALL, (), 0x0041bb20); |
233 |
DefFunc(void, M3rMatrixStack_Pop, ONICALL, (), 0x0041bb30); |
234 |
DefFunc(void, M3rMatrixStack_Identity, ONICALL, (), 0x0041bba0); |
235 |
DefFunc(void, M3rMatrixStack_Rotate, ONICALL, (), 0x0041bbe0); |
236 |
DefFunc(void, M3rMatrixStack_UniformScale, ONICALL, (), 0x0041bc20); |
237 |
DefFunc(void, M3rMatrixStack_Translate, ONICALL, (), 0x0041bc40); |
238 |
DefFunc(void, M3rMatrixStack_Multiply, ONICALL, (), 0x0041bc70); |
239 |
DefFunc(void, M3rGeom_State_Commit, ONICALL, (), 0x0041e870); |
240 |
|
241 |
DefFunc(void, MUrPoint_Distance, ONICALL, (), 0x00433270); |
242 |
*/ |
243 |
|
244 |
// Make a dialog element (in)visible and change its position |
245 |
DefFunc(void, WMrWindow_SetVisible, ONICALL, (WMtWindow* window, int visibility), 0x00475a10); |
246 |
DefFunc(void, WMrWindow_SetLocation, ONICALL, (WMtWindow* window, int x, int y), 0x004756d0); |
247 |
|
248 |
// Plays movie using Bink blitting method (ie., non-OpenGL blitting). |
249 |
DefFunc(void, ONrMovie_Play, ONICALL, (const char* movie, int unknown), 0x004d5580); |
250 |
|
251 |
// Sets minimum and maximum values for a slider control. |
252 |
DefFunc(void, WMrSlider_SetRange, ONICALL, (WMtWindow* window, int min_value, int max_value), 0x00472650); |
253 |
|
254 |
// Enables or disables window. |
255 |
DefFunc(void, WMrWindow_SetEnabled, ONICALL, (WMtWindow* window, UUtBool enabled), 0x00475580); |
256 |
|
257 |
// Sets gamma to specified factor (0.0 .. 1.0). |
258 |
DefFunc(void, M3rSetGamma, ONICALL, (float factor), 0x00407a60); |
259 |
|
260 |
// Resets gl_api pointers, unloads OPENGL32.DLL. |
261 |
DefFunc(void, gl_unload_library, ONICALL, (void), 0x0040ac40); |
262 |
|
263 |
// Notifies platform-specific local input implementation about internal (ie., |
264 |
// real) input mode change. |
265 |
DefFunc(void, LIrPlatform_Mode_Set, ONICALL, (unsigned int active_mode), 0x00402cf0); |
266 |
|
267 |
// Terminates platform-specific local-input. |
268 |
DefFunc(void, LIrPlatform_Terminate, ONICALL, (void), 0x00403620); |
269 |
|
270 |
#undef DefFunc |
271 |
|
272 |
#endif |