Cavestory Mod API
Functions
PlatformLayer

Platform-specific functions. More...

Functions

CAVESTORY_MOD_API bool CSM_Platform_GetGameFilePath (const char *pDesiredSubpath, const char *pFileName, char *pOutputFilePath, char *pOutputFileName, const char *pFileNameFormat="*.*", void *pModPointer=NULL)
 Convert a file path into a mod file path. More...
 
CAVESTORY_MOD_API void CSM_Platform_GetProgramMode (CSM_ProgramMode *eModePtr)
 Get the current program mode. More...
 
CAVESTORY_MOD_API BOOL CSM_Platform_IsProgramMode (CSM_ProgramMode eMode)
 Check the current program mode. More...
 

Detailed Description

Platform-specific functions.

These functions assist with platform-specific features.

Function Documentation

◆ CSM_Platform_GetGameFilePath()

CAVESTORY_MOD_API bool CSM_Platform_GetGameFilePath ( const char *  pDesiredSubpath,
const char *  pFileName,
char *  pOutputFilePath,
char *  pOutputFileName,
const char *  pFileNameFormat = "*.*",
void *  pModPointer = NULL 
)

Convert a file path into a mod file path.

Parameters
pDesiredSubpathThe desired subpath. Example: 'Stage' will point towards 'mymod/Stage/myfile.png'
pFileNameThe buffer that holds the file name.
pOutputFilePathThe buffer that will hold the resulting absolute file path. Can be 'NULL'. This function assumes that this buffer can hold at least 260 characters.
pOutputFileNameThe buffer that will hold the resulting file base (excludes path & extension). Can be 'NULL'. This function assumes that this buffer can hold at least 260 characters.
pFileNameFormatThe format of the result filename.
pModPointerThe mod to use. Leave this as 'NULL' to use the currently loaded mod.
Returns
Returns true if pFileName already matches the output filepath result.

char pPath[260]; char pFilePath[260]; char pFileBase[260]; strcpy(pPath, "H:\\SomeOtherDirectory\\MyStageBmp.png");

CSM_Platform_GetGameFilePath("Stage", pPath, pFilePath, pFileBase, "Prt*");

CSM_Log("%s\r\n", pFilePath); // This will print out "G:/TheGameDirectory/data/Stage/PrtMyStageBmp.png" CSM_Log("%s\r\n", pFileBase); // This will print out "PrtMyStageBmp"

◆ CSM_Platform_GetProgramMode()

CAVESTORY_MOD_API void CSM_Platform_GetProgramMode ( CSM_ProgramMode eModePtr)

Get the current program mode.

Parameters
eModePtrA pointer to a 'CSM_ProgramMode' that will store the value.

◆ CSM_Platform_IsProgramMode()

CAVESTORY_MOD_API BOOL CSM_Platform_IsProgramMode ( CSM_ProgramMode  eMode)

Check the current program mode.

Parameters
eModeThe mode to check for.
Returns
Returns true if the program mode matches the provided mode, otherwise returns false.