12typedef SFMod *(*RegisterModFunc)(
void *);
21 FreeLibrary((HMODULE)modHandle);
28 const char *filename = strrchr(path,
'\\');
29 return (filename) ? (filename + 1) : path;
34 HMODULE modHandle = LoadLibrary(modPath);
37 log_error(
"| - Failed to load mod library (X_X)");
49 log_error(
"| - Failed to get address of InitModule (X_X)");
57 snprintf(warn,
sizeof(warn),
58 "| - Failed to Initialize %s has erroneous mod data. (0_0)",
61 log_error(
"| - Failed to get address of RegisterMod (X_X)");
70 snprintf(infomsg,
sizeof(infomsg),
"| - [Initialized Mod: %s (Ver. %s)]",
78 char currentDir[MAX_PATH];
79 GetCurrentDirectory(MAX_PATH, currentDir);
81 char modDirectory[MAX_PATH];
82 snprintf(modDirectory,
sizeof(modDirectory),
"%s\\%s", currentDir,
85 WIN32_FIND_DATA findFileData;
86 char searchPath[MAX_PATH];
87 snprintf(searchPath,
sizeof(searchPath),
"%s\\*.sfm", modDirectory);
89 HANDLE hFind = FindFirstFile(searchPath, &findFileData);
90 if (hFind != INVALID_HANDLE_VALUE)
94 char modPath[MAX_PATH];
95 snprintf(modPath,
sizeof(modPath),
"%s\\%s", modDirectory,
96 findFileData.cFileName);
98 }
while (FindNextFile(hFind, &findFileData) != 0);
103 char msgbuf[MAX_PATH];
104 snprintf(msgbuf,
sizeof(msgbuf),
105 "| - Failed to find mods in directory: %s", modDirectory);
113 static char info_str[256];
114 snprintf(info_str,
sizeof(info_str),
115 "| - %d Mods Initialized with %d error(s)",
g_mod_count,
void log_info(const char *message)
void log_warning(const char *message)
void log_error(const char *message)
void load_all_mods(const char *subfolder, void *pFrameworkAPI)
SFMod *(* RegisterModFunc)(void *)
void(* InitModuleFunc)(void *)
void load_mod(const char *modPath, void *pFrameworkAPI)
const char * get_filename(const char *path)
void cleanup(void *modHandle)
SpellforceSpellFramework frameworkAPI
Represents the Spellforce Spell Framework API.This structure serves as the central interface for inte...