-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSA2ModInfo.h
131 lines (118 loc) · 4.61 KB
/
SA2ModInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* SA2 Mod Loader.
* Mod metadata structures.
*/
#ifndef SA2MODLOADER_SA2MODINFO_H
#define SA2MODLOADER_SA2MODINFO_H
#include "SA2Structs.h"
static const int ModLoaderVer = 8;
struct PatchInfo
{
void* address;
const void* data;
int datasize;
};
struct PatchList
{
const PatchInfo* Patches;
int Count;
};
struct PointerInfo
{
void* address;
void* data;
};
struct PointerList
{
const PointerInfo* Pointers;
int Count;
};
#define patchdecl(address,data) { (void*)address, arrayptrandsize(data) }
#define ptrdecl(address,data) { (void*)address, (void*)data }
#undef ReplaceFile // WinAPI function
struct HelperFunctions
{
// The version of the structure.
int Version;
// Registers a start position for a character.
void(__cdecl* RegisterStartPosition)(unsigned char character, const StartPosition& position);
// Clears the list of registered start positions for a character.
void(__cdecl* ClearStartPositionList)(unsigned char character);
// Registers a 2P intro position for a character.
void(__cdecl* Register2PIntroPosition)(unsigned char character, const LevelEndPosition& position);
// Clears the list of registered 2P intro positions for a character.
void(__cdecl* Clear2PIntroPositionList)(unsigned char character);
// Returns the path where main game save files are stored.
// Requires version >= 4.
const char* (__cdecl* GetMainSavePath)();
// Returns the path where Chao save files are stored.
// Requires version >= 4.
const char* (__cdecl* GetChaoSavePath)();
// Registers an end position for a character.
// Requires version >= 5.
void(__cdecl* RegisterEndPosition)(unsigned char character, const StartPosition& position);
// Clears the list of registered end positions for a character.
// Requires version >= 5.
void(__cdecl* ClearEndPositionList)(unsigned char character);
// Registers an end position for missions 2 and 3 for a character.
// Requires version >= 5.
void(__cdecl* RegisterMission23EndPosition)(unsigned char character, const LevelEndPosition& position);
// Clears the list of registered end positions for missions 2 and 3 for a character.
// Requires version >= 5.
void(__cdecl* ClearMission23EndPositionList)(unsigned char character);
// Replaces data exported from the Data DLL with your own data.
// Requires version >= 6.
void(__cdecl* HookExport)(LPCSTR exportName, const void* newdata);
/**
* @brief Gets the real path to a replaceable file.
*
* If your mod contains files in its SYSTEM folder that it loads manually,
* you can use this function to retrieve the full path to the file. This
* allows other mods to replace this file without any extra work from you.
* Requires version >= 7.
*
* @param path The file path (e.g "resource\\gd_PC\\my_cool_file.bin")
* @return The replaced path to the file.
*/
const char* (__cdecl* GetReplaceablePath)(const char* path);
// Replaces the source file with the destination file.
// Requires version >= 7.
void(__cdecl* ReplaceFile)(const char* src, const char* dst);
// Sets the window title.
// Requires version >= 7.
void(__cdecl* SetWindowTitle)(const wchar_t* title);
// Sets the size of the debug font, defaults to 12.
// Requires version >= 8
void(__cdecl* SetDebugFontSize)(float size);
// Sets the argb color of the debug font, defaults to 0xFFBFBFBF.
// Requires version >= 8
void(__cdecl* SetDebugFontColor)(int color);
// Displays a string on screen at a specific location (using NJM_LOCATION)
// Example: DisplayDebugString(NJM_LOCATION(x, y), "string");
// Requires version >= 8
void(__cdecl* DisplayDebugString)(int loc, const char* str);
// Displays a formatted string on screen at a specific location (using NJM_LOCATION)
// Requires version >= 8
void(__cdecl* DisplayDebugStringFormatted)(int loc, const char* Format, ...);
// Displays a number on screen at a specific location (using NJM_LOCATION)
// If the number of digits is superior, it will add leading zeroes.
// Example: DisplayDebugNumber(NJM_LOCATION(x, y), 123, 5); will display 00123.
// Requires version >= 8
void(__cdecl* DisplayDebugNumber)(int loc, int value, int numdigits);
};
typedef void(__cdecl* ModInitFunc)(const char* path, const HelperFunctions& helperFunctions);
typedef void(__cdecl* ModEvent)();
struct ModInfo
{
int Version;
void(__cdecl* Init)(const char* path, const HelperFunctions& helperFunctions);
const PatchInfo* Patches;
int PatchCount;
const PointerInfo* Jumps;
int JumpCount;
const PointerInfo* Calls;
int CallCount;
const PointerInfo* Pointers;
int PointerCount;
};
#endif // SA2MODLOADER_SA2MODINFO_H