SADX Mod Loader: Difference between revisions
Appearance
Adding initial SADX Mod Loader page + documentation. |
Added missing methods. |
||
| Line 9: | Line 9: | ||
HelperFunctions helperFunctions = | HelperFunctions helperFunctions = | ||
{ | { | ||
ModLoaderVer, | |||
&RegisterStartPosition, | |||
&ClearStartPositionList, | |||
&RegisterFieldStartPosition, | |||
&ClearFieldStartPositionList, | |||
&RegisterPathList, | |||
&ClearPathListList, | |||
&RegisterCharacterPVM, | |||
&ClearCharacterPVMList, | |||
&RegisterCommonObjectPVM, | |||
&ClearCommonObjectPVMList, | |||
&RegisterTrialLevel, | |||
&ClearTrialLevelList, | |||
&RegisterTrialSubgame, | |||
&ClearTrialSubgameList, | |||
&GetMainSavePath, | |||
&GetChaoSavePath, | |||
&GetReplaceablePath, | |||
&_ReplaceFile, | |||
&SetWindowTitle, | |||
&RegisterSoundList, | |||
&RegisterMusicFile, | |||
&LoadEXEData, | |||
&LoadDLLData, | |||
&_ReplaceFileForce, | |||
&PushScaleUI, | |||
&PopScaleUI, | |||
&SetScaleFillMode, | |||
&GetScaleFillMode, | |||
&ReplaceTexture, | |||
&MipmapBlacklistGBIX, | |||
&RegisterEnglishVoiceDuration, | |||
&RegisterJapaneseVoiceDuration, | |||
&RegisterCharacterWelds, | |||
&loaderSettings, | |||
&modList, | |||
&weightFuncs, | |||
&RegisterVoice, | |||
&PushInterpolationFix, | |||
&PopInterpolationFix, | |||
&RegisterPermanentTexlist, | |||
&ExpandPVMList, | |||
&UnreplaceFile, | |||
&PrintDebugUnicode, | |||
&PrintDebugLocal, | |||
&PrintDebugCodepage, | |||
&GetFileModIndex, | |||
&ReplaceFileAtIndex | |||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 543: | Line 548: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
TEX_PVMTABLE* ExpandPVMList(TEX_PVMTABLE* sourcepvmlist, const TEX_PVMTABLE &newpvmentry) | TEX_PVMTABLE* ExpandPVMList(TEX_PVMTABLE* sourcepvmlist, const TEX_PVMTABLE &newpvmentry) | ||
</syntaxhighlight> | |||
==== Example ==== | |||
<syntaxhighlight lang="cpp"> | |||
</syntaxhighlight> | |||
<hr> | |||
=== Unreplace File === | |||
<syntaxhighlight lang="cpp"> | |||
void UnreplaceFile(const char* file) | |||
</syntaxhighlight> | |||
==== Example ==== | |||
<syntaxhighlight lang="cpp"> | |||
</syntaxhighlight> | |||
<hr> | |||
=== Print Debug Unicode === | |||
<syntaxhighlight lang="cpp"> | |||
void PrintDebugUnicode(char* utf8) | |||
</syntaxhighlight> | |||
==== Example ==== | |||
<syntaxhighlight lang="cpp"> | |||
</syntaxhighlight> | |||
<hr> | |||
=== Print Debug Local === | |||
<syntaxhighlight lang="cpp"> | |||
void PrintDebugLocal(char* buf) | |||
</syntaxhighlight> | |||
==== Example ==== | |||
<syntaxhighlight lang="cpp"> | |||
</syntaxhighlight> | |||
<hr> | |||
=== Print Debug Codepage === | |||
<syntaxhighlight lang="cpp"> | |||
void PrintDebugCodepage(char* buf, unsigned int source_cp) | |||
</syntaxhighlight> | |||
==== Example ==== | |||
<syntaxhighlight lang="cpp"> | |||
</syntaxhighlight> | |||
<hr> | |||
=== Get File Mod Index === | |||
<syntaxhighlight lang="cpp"> | |||
int GetFileModIndex(const char* path) | |||
</syntaxhighlight> | |||
==== Example ==== | |||
<syntaxhighlight lang="cpp"> | |||
</syntaxhighlight> | |||
<hr> | |||
=== Replace File At Index === | |||
<syntaxhighlight lang="cpp"> | |||
void ReplaceFileAtIndex(const char* src, const char* dst, int modIndex) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 14:41, 4 October 2025
HelperFunctions API
Struct
Below is the initialized version of the HelperFunctions struct. For the definition of the struct, you can find that in SADXModInfo.h
HelperFunctions helperFunctions =
{
ModLoaderVer,
&RegisterStartPosition,
&ClearStartPositionList,
&RegisterFieldStartPosition,
&ClearFieldStartPositionList,
&RegisterPathList,
&ClearPathListList,
&RegisterCharacterPVM,
&ClearCharacterPVMList,
&RegisterCommonObjectPVM,
&ClearCommonObjectPVMList,
&RegisterTrialLevel,
&ClearTrialLevelList,
&RegisterTrialSubgame,
&ClearTrialSubgameList,
&GetMainSavePath,
&GetChaoSavePath,
&GetReplaceablePath,
&_ReplaceFile,
&SetWindowTitle,
&RegisterSoundList,
&RegisterMusicFile,
&LoadEXEData,
&LoadDLLData,
&_ReplaceFileForce,
&PushScaleUI,
&PopScaleUI,
&SetScaleFillMode,
&GetScaleFillMode,
&ReplaceTexture,
&MipmapBlacklistGBIX,
&RegisterEnglishVoiceDuration,
&RegisterJapaneseVoiceDuration,
&RegisterCharacterWelds,
&loaderSettings,
&modList,
&weightFuncs,
&RegisterVoice,
&PushInterpolationFix,
&PopInterpolationFix,
&RegisterPermanentTexlist,
&ExpandPVMList,
&UnreplaceFile,
&PrintDebugUnicode,
&PrintDebugLocal,
&PrintDebugCodepage,
&GetFileModIndex,
&ReplaceFileAtIndex
};
Properties
Mod Loader Version
int ModLoaderVer;
This returns the version of the mod loader. This can be used to check if the user has an old version of the mod loader that may not have functionality your mod requires.
Example
if (globalHelperFunctions.ModLoaderVer <= 10)
PrintDebug("This Mod Loader is way out of date.\n");
Mod Loader Settings
LoaderSettings loaderSettings;
Example
Mod List
std::vector<Mod> modlist;
Example
Weight Functions
BasicWeightFuncs weightFuncs;
Example
Functions
Register Start Position
static void RegisterStartPosition(unsigned char character, const StartPosition& position)
Registers a new Start Position for the specified character.
Example
StartPosition myStageStartPos = {
1, // Level ID
0, // Act ID
{ 100.0f, 200.0f, 100.0f }, // Position
0 // Y Rotation
};
// We pass our StagePosition variable as a pointer to this function
// and we have specified Sonic, so the level for this ID would now use
// our StartPosition instead of the original.
globalHelperFunctions.RegisterStartPosition(Characters_Sonic, &myStageStartPos);
Clear Start Position List
static void ClearStartPositionList(unsigned char character)
Clears the Start Positions for the specified character.
Example
// Running this inside of your mod's Init export would
// clear all of Sonic's Start Positions for his stages.
globalHelperFunctions.ClearStartPositionList(Characters_Sonic);
Register Field Position
static void RegisterFieldStartPosition(unsigned char character, const FieldStartPosition& position)
Example
Clear Field Start Position List
static void ClearFieldStartPositionList(unsigned char character)
Example
Register Path List
static void RegisterPathList(const PathDataPtr& paths)
Example
Clear Path List List
static void ClearPathListList()
Example
Register Character PVM
static void RegisterCharacterPVM(unsigned char character, const PVMEntry& pvm)
Example
Clear Character PVM List
static void ClearCharacterPVMList(unsigned char character)
Example
Register Common Object PVM
static void RegisterCommonObjectPVM(const PVMEntry& pvm)
Example
Clear Common Object PVM List
static void ClearCommonObjectPVMList()
Example
Register Trial Level
static void RegisterTrialLevel(unsigned char character, const TrialLevelListEntry& level)
Example
Clear Trial Level List
static void ClearTrialLevelList(unsigned char character)
Example
Register Trial Subgame
static void RegisterTrialSubgame(unsigned char character, const TrialLevelListEntry& level)
Example
Clear Trial Subgame List
static void ClearTrialSubgameList(unsigned char character)
Example
Get Main Save Path
static const char* GetMainSavePath()
Example
Get Chao Save Path
static const char* GetChaoSavePath()
Example
Get Replaceable Path
const char* __cdecl GetReplaceablePath(const char* path)
Example
Replace File
void _ReplaceFile(const char* src, const char* dst)
Example
Set Window Title
void SetWindowTitle(const char* title)
Example
Register Sound List
int RegisterSoundList(const SoundList& list)
Example
Register Music File
int RegisterMusicFile(const MusicInfo& track)
Example
Load EXE Data
void LoadEXEData(const wchar_t* filename, const wchar_t* mod_dir)
Example
Load DLL Data
void LoadDLLData(const wchar_t* filename, const wchar_t* mod_dir)
Example
Replace File Force
void _ReplaceFileForce(const char* src, const char* dst)
Example
Push Scale UI
void PushScaleUI(uiscale::Align align, bool is_background, float ratio_h, float ratio_v)
Example
Pop Scale UI
void PopScaleUI()
Example
Set Scale Fill Mode
void SetScaleFillMode(uiscale::FillMode mode)
Example
Get Scale Fill Mode
uiscale::FillMode GetScaleFillMode()
Example
Replace Texture
void ReplaceTexture(const char* pvm_name, const char* tex_name, const char* file_path, uint32_t gbix, uint32_t width, uint32_t height)
Example
Mipmap Blacklist GBIX
void MipmapBlacklistGBIX(Uint32 index)
Example
Register English Voice Duration
void RegisterEnglishVoiceDuration(const uint16_t voiceID, const uint16_t duration)
Example
Register Japanese Voice Duration
void RegisterJapaneseVoiceDuration(const uint16_t voiceID, const uint16_t duration)
Example
Register Character Welds
void RegisterCharacterWelds(const uint8_t character, const char* iniPath)
Example
Register Voice
uint16_t RegisterVoice(const char* fileJP, const char* fileEN, uint16_t durationJP, uint16_t durationEN)
Example
Push Interpolation Fix
void PushInterpolationFix()
Example
Pop Interpolation Fix
void PopInterpolationFix()
Example
Register Permanent Texlist
void RegisterPermanentTexlist(NJS_TEXLIST* texlist)
Example
Unreplace File
void UnreplaceFile(const char* file)
Example
Expand PVM List
TEX_PVMTABLE* ExpandPVMList(TEX_PVMTABLE* sourcepvmlist, const TEX_PVMTABLE &newpvmentry)
Example
Unreplace File
void UnreplaceFile(const char* file)
Example
Print Debug Unicode
void PrintDebugUnicode(char* utf8)
Example
Print Debug Local
void PrintDebugLocal(char* buf)
Example
Print Debug Codepage
void PrintDebugCodepage(char* buf, unsigned int source_cp)
Example
Get File Mod Index
int GetFileModIndex(const char* path)
Example
Replace File At Index
void ReplaceFileAtIndex(const char* src, const char* dst, int modIndex)