diff options
author | lunarsoap5 <40438826+lunarsoap5@users.noreply.github.com> | 2021-12-12 02:01:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-12 02:01:21 -0600 |
commit | b4588a89b18e0beadf7b2350474745f7deebd344 (patch) | |
tree | 02a3f0104b8fcbadcd6ec0f6e6b553894e3ad3ff | |
parent | 639d694442c572f5c7f085d75bcb3bb995c6187e (diff) |
Added function definitions for replacing checks stored in .arc files.arcReplacementFunctions
33 files changed, 1379 insertions, 1382 deletions
diff --git a/include/gc_wii/OSCache.h b/include/gc_wii/OSCache.h index c26a394..eabdd89 100644 --- a/include/gc_wii/OSCache.h +++ b/include/gc_wii/OSCache.h @@ -11,29 +11,27 @@ #include <cstdint> -namespace libtp::gc_wii::os_cache -{ - extern "C" - { - // DCEnable - // DCInvalidateRange - void DCFlushRange( void* startAddr, uint32_t nBytes ); - // DCStoreRange - // DCFlushRangeNoSync - // DCStoreRangeNoSync - // DCZeroRange - void ICInvalidateRange( void* startAddr, uint32_t nBytes ); - // ICFlashInvalidate - // ICEnable - // __LCEnable - // LCEnable - // LCDisable - // LCStoreBlocks - // LCStoreData - // LCQueueWait - // L2GlobalInvalidate - // DMAErrorHandler - // __OSCacheInit - } -} // namespace libtp::gc_wii::os_cache +namespace libtp::gc_wii::os_cache { +extern "C" { +// DCEnable +// DCInvalidateRange +void DCFlushRange(void *startAddr, uint32_t nBytes); +// DCStoreRange +// DCFlushRangeNoSync +// DCStoreRangeNoSync +// DCZeroRange +void ICInvalidateRange(void *startAddr, uint32_t nBytes); +// ICFlashInvalidate +// ICEnable +// __LCEnable +// LCEnable +// LCDisable +// LCStoreBlocks +// LCStoreData +// LCQueueWait +// L2GlobalInvalidate +// DMAErrorHandler +// __OSCacheInit +} +} // namespace libtp::gc_wii::os_cache #endif
\ No newline at end of file diff --git a/include/gc_wii/OSModule.h b/include/gc_wii/OSModule.h index b08b5d9..47654d5 100644 --- a/include/gc_wii/OSModule.h +++ b/include/gc_wii/OSModule.h @@ -11,19 +11,17 @@ #include <cstdint> -namespace libtp::gc_wii::os_module -{ - struct OSModuleInfo - { - uint32_t id; - OSModuleInfo* next; - OSModuleInfo* prev; - uint32_t numSections; - uint32_t sectionInfoOffset; - uint32_t nameOffset; - uint32_t nameSize; - uint32_t version; - } __attribute__( ( __packed__ ) ); +namespace libtp::gc_wii::os_module { +struct OSModuleInfo { + uint32_t id; + OSModuleInfo *next; + OSModuleInfo *prev; + uint32_t numSections; + uint32_t sectionInfoOffset; + uint32_t nameOffset; + uint32_t nameSize; + uint32_t version; +} __attribute__((__packed__)); -} // namespace libtp::gc_wii::os_module +} // namespace libtp::gc_wii::os_module #endif
\ No newline at end of file diff --git a/include/gc_wii/card.h b/include/gc_wii/card.h index ea1a36a..8f301b4 100644 --- a/include/gc_wii/card.h +++ b/include/gc_wii/card.h @@ -14,8 +14,8 @@ #define CARD_SLOT_A 0 #define CARD_SLOT_B 1 -#define CARD_BLOCK_SIZE ( 8 * 1024 ) -#define CARD_WORKAREA_SIZE ( 5 * 8 * 1024 ) +#define CARD_BLOCK_SIZE (8 * 1024) +#define CARD_WORKAREA_SIZE (5 * 8 * 1024) #define CARD_MAX_FILE 127 #define CARD_ENCODE_ANSI 0u @@ -49,296 +49,327 @@ #define CARD_READ_SIZE 512 -namespace libtp::gc_wii::card -{ - struct CARDFileInfo - { - int32_t chan; - int32_t fileNo; - - uint32_t offset; - uint16_t iBlock; - uint16_t cBlock; - } __attribute__( ( __packed__ ) ); - - struct CARDStat - { - // read-only (Set by CARDGetStatus) - uint8_t fileName[CARD_FILENAME_MAX]; - uint32_t length; - uint32_t time; - uint8_t gameName[4]; - uint8_t company[2]; - uint8_t gameVersion; - - // read/write - uint8_t bannerFormat; - uint32_t iconAddr; - uint16_t iconFormat; - uint16_t iconSpeed; - uint32_t commentAddr; - - // read-only (Set by CARDSetStatus/CARDGetStatus) - uint32_t offsetBanner; - uint32_t offsetBannerTlut; - uint32_t offsetIcon[CARD_ICON_MAX]; - uint32_t offsetIconTlut; - uint32_t offsetData; - } __attribute__( ( __packed__ ) ); - - struct CARDBlock - { - uint8_t unk[0x110]; - } __attribute__( ( __packed__ ) ); - - typedef void ( *CARDCallback )( int32_t chan, int32_t result ); - - extern "C" - { - // Variables - /** - * @brief No decent description at this time - */ - extern CARDBlock __CARDBlock[2]; // One for each memory card slot - - // Functions - /** - * @brief Initializes memory card API control blocks. Must be called once before using any other CARD API functions. - */ - void CARDInit( void ); - - /** - * @brief Checks for the file system consistency of the memory card and repair it if possible. - * - * @param chan EXI channel number - */ - int32_t CARDCheck( int32_t chan ); - - // int32_t CARDCheckAsync( int32_t chan, CARDCallback callback ); - // int32_t CARDCreate( int32_t chan, char* fileName, u32 size, CARDFileInfo* fileInfo ); - // int32_t CARDCreateAsync( int32_t chan, char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback ); - // int32_t CARDDelete( int32_t chan, char* fileName ); - // int32_t CARDDeleteAsync( int32_t chan, char* fileName, CARDCallback callback ); - // int32_t CARDFastDelete( int32_t chan, int32_t fileNo ); - // int32_t CARDFastDeleteAsync( int32_t chan, int32_t fileNo, CARDCallback callback ); - // int32_t CARDFastOpen( int32_t chan, int32_t fileNo, CARDFileInfo* fileInfo ); - // int32_t CARDFormat( int32_t chan ); - // int32_t CARDFormatAsync( int32_t chan, CARDCallback callback ); - // int32_t CARDFreeBlocks( int32_t chan, int32_t* byteNotUsed, int32_t* filesNotUsed ); - // int32_t CARDGetResultCode( int32_t chan ); - // int32_t CARDGetEncoding( int32_t chan, u16* encode ); - // int32_t CARDGetStatus( int32_t chan, int32_t fileNo, CARDStat* stat ); - - // int32_t CARDMountAsync( int32_t chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback ); - /** - * @brief Mounts a memory card synchronously. - * - * @param chan EXI channel number - * @param workArea pointer to the work area to be used while a memory card is in use. - * The work area must be 32 byte aligned and must be larger than or equal to CARD_WORKAREA_SIZE. - * @param detachCallback callback function to be called when the memory card is removed from the slot. - */ - int32_t CARDMount( int32_t chan, void* workArea, CARDCallback detachCallback ); - - /** - * @brief Unmounts a memory card Synchronously. - * - * The work area specified by CARDMount() or CARDMountAsync() is also released. - * The function returns CARD_RESULT_READY if the memory card is successfully unmounted. - * - * @param chan EXI channel number - */ - int32_t CARDUnmount( int32_t chan ); - - /** - * @brief Opens a file. - * - * @param chan EXI channel number - * @param fileName pointer to file name to be opened - * @param fileInfo pointer to file info to be used - */ - int32_t CARDOpen( int32_t chan, char* fileName, CARDFileInfo* fileInfo ); - - // bool CARDProbe( int32_t chan ); - - /** - * @brief This function verifies whether a memory card (of any type) is inserted in the specified slot. - * - * The memory card size returned, in megabits, will be 4, 8, 16, 32, 64, or 128 Mb. - * The sector size returned, in bytes, will be 8, 16, 32, 64, or 128 KB. A game program must support memory cards whose - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param memSize Pointer to s32 object to store the memory card size, in megabits. Specify NULL if it is not - * necessary. - * @param sectorSize Pointer to s32 object to store the memory card sector size, in bytes. Specify NULL if it is not - * necessary. - */ - int32_t CARDProbeEx( int32_t chan, int32_t* memSize, int32_t* sectorSize ); - // int32_t CARDRename( int32_t chan, char* oldName, char* newName ); - // int32_t CARDRenameAsync( int32_t chan, char* oldName, char* newName, CARDCallback callback ); - // int32_t CARDSetStatus( int32_t chan, int32_t fileNo, CARDStat* stat ); - // int32_t CARDSetStatusAsync( int32_t chan, int32_t fileNo, CARDStat* stat, CARDCallback callback ); - - /** - * @brief Closes a file. - * - * @param fileInfo file info of the file to be closed - */ - int32_t CARDClose( CARDFileInfo* fileInfo ); - - /** - * @brief Reads data from a file synchronously. - * - * - * @param fileInfo file info of the file to be read - * @param buf buffer address (32 bytes aligned) - * @param length number of bytes to be read (multiple of CARD_READ_SIZE) - * @param offset file position at which to start the read (multiple of CARD_READ_SIZE) - */ - int32_t CARDRead( CARDFileInfo* fileInfo, void* addr, int32_t length, int32_t offset ); - - // int32_t CARDReadAsync( CARDFileInfo* fileInfo, void* addr, int32_t length, int32_t offset, CARDCallback callback ); - - /** - * @brief Writes data to a file synchronously. - * - * @param fileInfo file info of the file to be written - * @param buf buffer address (32 bytes aligned) - * @param length number of bytes to write. The length must be multiple of the card sector size returned by - * CARDGetSectorSize. - * @param offset file position at which to start the read. The offset must be multiple of the card sector size returned - * by CARDGetSectorSize. - */ - int32_t CARDWrite( CARDFileInfo* fileInfo, void* addr, int32_t length, int32_t offset ); - // int32_t CARDWriteAsync( CARDFileInfo* fileInfo, void* addr, int32_t length, int32_t offset, CARDCallback callback ); - - // Internal CARD functions; Use with caution - /** - * @brief Default CARDCallback function to be used when the user did not specify one - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param result Return value of the most recent CARD function (This description may be incorrect) - */ - void __CARDDefaultApiCallback( int32_t chan, int32_t result ); - - /** - * @brief Callback function to resume the current thread after the most resent asynchronous CARD function has finished - * its operation - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param result Return value of the most recent CARD function (This description may be incorrect) - */ - void __CARDSyncCallback( int32_t chan, int32_t result ); - - /** - * @brief Gets the control block for the desired memory card slot - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param card Output for the pointer to the current card block (Struct for this not defined yet) - */ - int32_t __CARDGetControlBlock( int32_t chan, void** card ); - - /** - * @brief Puts the control block for the desired memory card slot - * - * @param card Pointer to the current card block (Struct for this not defined yet) - * @param result Return value of the most recent CARD function (This description may be incorrect) - */ - int32_t __CARDPutControlBlock( void* card, int32_t result ); - - /** - * @brief Suspends the current thread until the most resent asynchronous CARD function has finished its operation - * - * @param chan Slot number (0: slot A, 1: slot B). - */ - int32_t __CARDSync( int32_t chan ); - - /** - * @brief Updates the fat block section for a specific file on the memory card (This description may be incorrect) - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param fatBlock Fat block section to be updated (Struct for this not defined yet) - * @param callback Callback function - */ - int32_t __CARDUpdateFatBlock( int32_t chan, void* fatBlock, CARDCallback callback ); - - /** - * @brief Gets the directly block for a specified file on the memory card (This description may be incorrect) - * - * @param card Pointer to the current card block (Struct for this not defined yet) - */ - void* __CARDGetDirBlock( void* card ); - - /** - * @brief Updates the directly block for a specified file on the memory card (This description may be incorrect) - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param callback Callback function - */ - int32_t __CARDUpdateDir( int32_t chan, CARDCallback callback ); - - /** - * @brief Determines if the file name of the file in the current directly block is the same as the fileName parameter - * - * @param dirBlock Pointer the directly block for a specified file on the memory card (This description may be - * incorrect) (Struct for this not defined yet) - * @param fileName Internal name for the desired file on the memory card - */ - bool __CARDCompareFileName( void* dirBlock, const char* fileName ); - - /** - * @brief Determines if the current file on the memory card can be accessed - * - * @param card Pointer to the current card block (Struct for this not defined yet) - * @param dirBlock Pointer the directly block for a specified file on the memory card (This description may be - * incorrect) (Struct for this not defined yet) - */ - int32_t __CARDAccess( void* card, void* dirBlock ); - } - - // Manually written functions - /** - * @brief Frees the fat blocks for a specific file (This description may be incorrect) - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param block Starting block - * @param Callback Callback function - */ - int32_t __CARDFreeBlock( int32_t chan, uint16_t block, CARDCallback callback ); - - /** - * @brief Callback to be called when a file is ready to be deleted (This description may be incorrect) - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param result Return value of the most recent CARD function (This description may be incorrect) - */ - void DeleteCallback( int32_t chan, int32_t result ); - - /** - * @brief Gets the file number of the desired file on the memory card - * - * @param card Pointer to the current card block (Struct for this not defined yet) - * @param fileName Internal name for the desired file on the memory card - * @param fileNo Output for the index to the desired file on the memory card - */ - int32_t __CARDGetFileNo( void* card, const char* fileName, int32_t* fileNo ); - - /** - * @brief Deletes a file asynchronously - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param fileName Internal name for the desired file on the memory card - * @param callback Callback function to be notified of the result - */ - int32_t CARDDeleteAsync( int32_t chan, const char* fileName, CARDCallback callback ); - - /** - * @brief Deletes a file synchronously - * - * @param chan Slot number (0: slot A, 1: slot B). - * @param fileName Internal name for the desired file on the memory card - */ - int32_t CARDDelete( int32_t chan, const char* fileName ); -} // namespace libtp::gc_wii::card +namespace libtp::gc_wii::card { +struct CARDFileInfo { + int32_t chan; + int32_t fileNo; + + uint32_t offset; + uint16_t iBlock; + uint16_t cBlock; +} __attribute__((__packed__)); + +struct CARDStat { + // read-only (Set by CARDGetStatus) + uint8_t fileName[CARD_FILENAME_MAX]; + uint32_t length; + uint32_t time; + uint8_t gameName[4]; + uint8_t company[2]; + uint8_t gameVersion; + + // read/write + uint8_t bannerFormat; + uint32_t iconAddr; + uint16_t iconFormat; + uint16_t iconSpeed; + uint32_t commentAddr; + + // read-only (Set by CARDSetStatus/CARDGetStatus) + uint32_t offsetBanner; + uint32_t offsetBannerTlut; + uint32_t offsetIcon[CARD_ICON_MAX]; + uint32_t offsetIconTlut; + uint32_t offsetData; +} __attribute__((__packed__)); + +struct CARDBlock { + uint8_t unk[0x110]; +} __attribute__((__packed__)); + +typedef void (*CARDCallback)(int32_t chan, int32_t result); + +extern "C" { +// Variables +/** + * @brief No decent description at this time + */ +extern CARDBlock __CARDBlock[2]; // One for each memory card slot + +// Functions +/** + * @brief Initializes memory card API control blocks. Must be called once + * before using any other CARD API functions. + */ +void CARDInit(void); + +/** + * @brief Checks for the file system consistency of the memory card and repair + * it if possible. + * + * @param chan EXI channel number + */ +int32_t CARDCheck(int32_t chan); + +// int32_t CARDCheckAsync( int32_t chan, CARDCallback callback ); +// int32_t CARDCreate( int32_t chan, char* fileName, u32 size, CARDFileInfo* +// fileInfo ); int32_t CARDCreateAsync( int32_t chan, char* fileName, u32 size, +// CARDFileInfo* fileInfo, CARDCallback callback ); int32_t CARDDelete( int32_t +// chan, char* fileName ); int32_t CARDDeleteAsync( int32_t chan, char* +// fileName, CARDCallback callback ); int32_t CARDFastDelete( int32_t chan, +// int32_t fileNo ); int32_t CARDFastDeleteAsync( int32_t chan, int32_t fileNo, +// CARDCallback callback ); int32_t CARDFastOpen( int32_t chan, int32_t fileNo, +// CARDFileInfo* fileInfo ); int32_t CARDFormat( int32_t chan ); int32_t +// CARDFormatAsync( int32_t chan, CARDCallback callback ); int32_t +// CARDFreeBlocks( int32_t chan, int32_t* byteNotUsed, int32_t* filesNotUsed ); +// int32_t CARDGetResultCode( int32_t chan ); +// int32_t CARDGetEncoding( int32_t chan, u16* encode ); +// int32_t CARDGetStatus( int32_t chan, int32_t fileNo, CARDStat* stat ); + +// int32_t CARDMountAsync( int32_t chan, void* workArea, CARDCallback +// detachCallback, CARDCallback attachCallback ); +/** + * @brief Mounts a memory card synchronously. + * + * @param chan EXI channel number + * @param workArea pointer to the work area to be used while a memory card is + * in use. The work area must be 32 byte aligned and must be larger than or + * equal to CARD_WORKAREA_SIZE. + * @param detachCallback callback function to be called when the memory card is + * removed from the slot. + */ +int32_t CARDMount(int32_t chan, void *workArea, CARDCallback detachCallback); + +/** + * @brief Unmounts a memory card Synchronously. + * + * The work area specified by CARDMount() or CARDMountAsync() is also released. + * The function returns CARD_RESULT_READY if the memory card is successfully + * unmounted. + * + * @param chan EXI channel number + */ +int32_t CARDUnmount(int32_t chan); + +/** + * @brief Opens a file. + * + * @param chan EXI channel number + * @param fileName pointer to file name to be opened + * @param fileInfo pointer to file info to be used + */ +int32_t CARDOpen(int32_t chan, char *fileName, CARDFileInfo *fileInfo); + +// bool CARDProbe( int32_t chan ); + +/** + * @brief This function verifies whether a memory card (of any type) is + * inserted in the specified slot. + * + * The memory card size returned, in megabits, will be 4, 8, 16, 32, 64, or 128 + * Mb. The sector size returned, in bytes, will be 8, 16, 32, 64, or 128 KB. A + * game program must support memory cards whose + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param memSize Pointer to s32 object to store the memory card size, in + * megabits. Specify NULL if it is not necessary. + * @param sectorSize Pointer to s32 object to store the memory card sector + * size, in bytes. Specify NULL if it is not necessary. + */ +int32_t CARDProbeEx(int32_t chan, int32_t *memSize, int32_t *sectorSize); +// int32_t CARDRename( int32_t chan, char* oldName, char* newName ); +// int32_t CARDRenameAsync( int32_t chan, char* oldName, char* newName, +// CARDCallback callback ); int32_t CARDSetStatus( int32_t chan, int32_t fileNo, +// CARDStat* stat ); int32_t CARDSetStatusAsync( int32_t chan, int32_t fileNo, +// CARDStat* stat, CARDCallback callback ); + +/** + * @brief Closes a file. + * + * @param fileInfo file info of the file to be closed + */ +int32_t CARDClose(CARDFileInfo *fileInfo); + +/** + * @brief Reads data from a file synchronously. + * + * + * @param fileInfo file info of the file to be read + * @param buf buffer address (32 bytes aligned) + * @param length number of bytes to be read (multiple of CARD_READ_SIZE) + * @param offset file position at which to start the read (multiple of + * CARD_READ_SIZE) + */ +int32_t CARDRead(CARDFileInfo *fileInfo, void *addr, int32_t length, + int32_t offset); + +// int32_t CARDReadAsync( CARDFileInfo* fileInfo, void* addr, int32_t length, +// int32_t offset, CARDCallback callback ); + +/** + * @brief Writes data to a file synchronously. + * + * @param fileInfo file info of the file to be written + * @param buf buffer address (32 bytes aligned) + * @param length number of bytes to write. The length must be multiple of the + * card sector size returned by CARDGetSectorSize. + * @param offset file position at which to start the read. The offset must be + * multiple of the card sector size returned by CARDGetSectorSize. + */ +int32_t CARDWrite(CARDFileInfo *fileInfo, void *addr, int32_t length, + int32_t offset); +// int32_t CARDWriteAsync( CARDFileInfo* fileInfo, void* addr, int32_t length, +// int32_t offset, CARDCallback callback ); + +// Internal CARD functions; Use with caution +/** + * @brief Default CARDCallback function to be used when the user did not + * specify one + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param result Return value of the most recent CARD function (This + * description may be incorrect) + */ +void __CARDDefaultApiCallback(int32_t chan, int32_t result); + +/** + * @brief Callback function to resume the current thread after the most resent + * asynchronous CARD function has finished its operation + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param result Return value of the most recent CARD function (This + * description may be incorrect) + */ +void __CARDSyncCallback(int32_t chan, int32_t result); + +/** + * @brief Gets the control block for the desired memory card slot + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param card Output for the pointer to the current card block (Struct for + * this not defined yet) + */ +int32_t __CARDGetControlBlock(int32_t chan, void **card); + +/** + * @brief Puts the control block for the desired memory card slot + * + * @param card Pointer to the current card block (Struct for this not defined + * yet) + * @param result Return value of the most recent CARD function (This + * description may be incorrect) + */ +int32_t __CARDPutControlBlock(void *card, int32_t result); + +/** + * @brief Suspends the current thread until the most resent asynchronous CARD + * function has finished its operation + * + * @param chan Slot number (0: slot A, 1: slot B). + */ +int32_t __CARDSync(int32_t chan); + +/** + * @brief Updates the fat block section for a specific file on the memory card + * (This description may be incorrect) + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param fatBlock Fat block section to be updated (Struct for this not defined + * yet) + * @param callback Callback function + */ +int32_t __CARDUpdateFatBlock(int32_t chan, void *fatBlock, + CARDCallback callback); + +/** + * @brief Gets the directly block for a specified file on the memory card (This + * description may be incorrect) + * + * @param card Pointer to the current card block (Struct for this not defined + * yet) + */ +void *__CARDGetDirBlock(void *card); + +/** + * @brief Updates the directly block for a specified file on the memory card + * (This description may be incorrect) + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param callback Callback function + */ +int32_t __CARDUpdateDir(int32_t chan, CARDCallback callback); + +/** + * @brief Determines if the file name of the file in the current directly block + * is the same as the fileName parameter + * + * @param dirBlock Pointer the directly block for a specified file on the + * memory card (This description may be incorrect) (Struct for this not defined + * yet) + * @param fileName Internal name for the desired file on the memory card + */ +bool __CARDCompareFileName(void *dirBlock, const char *fileName); + +/** + * @brief Determines if the current file on the memory card can be accessed + * + * @param card Pointer to the current card block (Struct for this not defined + * yet) + * @param dirBlock Pointer the directly block for a specified file on the + * memory card (This description may be incorrect) (Struct for this not defined + * yet) + */ +int32_t __CARDAccess(void *card, void *dirBlock); +} + +// Manually written functions +/** + * @brief Frees the fat blocks for a specific file (This description may be + * incorrect) + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param block Starting block + * @param Callback Callback function + */ +int32_t __CARDFreeBlock(int32_t chan, uint16_t block, CARDCallback callback); + +/** + * @brief Callback to be called when a file is ready to be deleted (This + * description may be incorrect) + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param result Return value of the most recent CARD function (This + * description may be incorrect) + */ +void DeleteCallback(int32_t chan, int32_t result); + +/** + * @brief Gets the file number of the desired file on the memory card + * + * @param card Pointer to the current card block (Struct for this not defined + * yet) + * @param fileName Internal name for the desired file on the memory card + * @param fileNo Output for the index to the desired file on the memory card + */ +int32_t __CARDGetFileNo(void *card, const char *fileName, int32_t *fileNo); + +/** + * @brief Deletes a file asynchronously + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param fileName Internal name for the desired file on the memory card + * @param callback Callback function to be notified of the result + */ +int32_t CARDDeleteAsync(int32_t chan, const char *fileName, + CARDCallback callback); + +/** + * @brief Deletes a file synchronously + * + * @param chan Slot number (0: slot A, 1: slot B). + * @param fileName Internal name for the desired file on the memory card + */ +int32_t CARDDelete(int32_t chan, const char *fileName); +} // namespace libtp::gc_wii::card #endif
\ No newline at end of file diff --git a/include/gc_wii/dvdfs.h b/include/gc_wii/dvdfs.h new file mode 100644 index 0000000..f140f74 --- /dev/null +++ b/include/gc_wii/dvdfs.h @@ -0,0 +1,18 @@ +/** @file dvdfs.h
+ * @brief Holds functions that use the dvd files
+ *
+ *
+ * @author Zephiles
+ * @bug No known bugs.
+ */
+#ifndef GC_WII_DVDFS_H
+#define GC_WII_DVDFS_H
+
+#include <cstdint>
+
+namespace libtp::gc_wii::dvdfs {
+extern "C" {
+int32_t DVDConvertPathToEntrynum(const char *fileName);
+}
+} // namespace libtp::gc_wii::dvdfs
+#endif
\ No newline at end of file diff --git a/include/tp/JFWSystem.h b/include/tp/JFWSystem.h index 121d258..d7c1025 100644 --- a/include/tp/JFWSystem.h +++ b/include/tp/JFWSystem.h @@ -8,41 +8,38 @@ #ifndef TP_JFWSYSTEM_H #define TP_JFWSYSTEM_H -// Dedicated console line used to print messages wtihout relying on the Console Class from libtp +// Dedicated console line used to print messages wtihout relying on the Console +// Class from libtp #define JFW_DEBUG_LINE 24 #include <cstdint> -namespace libtp::tp::jfw_system -{ - struct ConsoleLine - { - bool showLine; - char line[61]; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::jfw_system { +struct ConsoleLine { + bool showLine; + char line[61]; +} __attribute__((__packed__)); - /** - * @brief SystemConsole variables which is normally used for debugging - * - * @todo Fill missing vars. - * @todo Get exact size. - */ - struct SystemConsole - { - uint8_t unk_0[0x60]; - uint8_t consoleColor[4]; // rgba - uint8_t unk_64[0x4]; - bool consoleEnabled; - uint8_t unk_69[3]; - ConsoleLine consoleLine[25]; // Should figure out the total amount of lines - // at some point - } __attribute__( ( __packed__ ) ); +/** + * @brief SystemConsole variables which is normally used for debugging + * + * @todo Fill missing vars. + * @todo Get exact size. + */ +struct SystemConsole { + uint8_t unk_0[0x60]; + uint8_t consoleColor[4]; // rgba + uint8_t unk_64[0x4]; + bool consoleEnabled; + uint8_t unk_69[3]; + ConsoleLine consoleLine[25]; // Should figure out the total amount of lines + // at some point +} __attribute__((__packed__)); - static_assert( sizeof( ConsoleLine ) == 0x3E ); +static_assert(sizeof(ConsoleLine) == 0x3E); - extern "C" - { - extern SystemConsole* systemConsole; - } -} // namespace libtp::tp::jfw_system +extern "C" { +extern SystemConsole *systemConsole; +} +} // namespace libtp::tp::jfw_system #endif
\ No newline at end of file diff --git a/include/tp/JKRDvdRipper.h b/include/tp/JKRDvdRipper.h new file mode 100644 index 0000000..3887e6f --- /dev/null +++ b/include/tp/JKRDvdRipper.h @@ -0,0 +1,19 @@ +/** @file JKRDvdRipper.h
+ * @brief Contains function definitions that read data from the game disc.
+ *
+ * @author Lunar Soap
+ * @bug No known bugs.
+ */
+#ifndef TP_JKRDVDRIPPER_H
+#define TP_JKRDVDRIPPER_H
+
+#include <cstdint>
+
+namespace libtp::tp::JKRDvdRipper {
+extern "C" {
+void *loadToMainRAM2(int32_t fileIndex, uint8_t *unk2, uint32_t jkrExpandSwitch,
+ uint32_t unk4, void *jkrHeap, uint32_t eAllocDirection,
+ uint32_t unk7, int32_t *unk8, uint32_t *unk9);
+}
+} // namespace libtp::tp::JKRDvdRipper
+#endif
\ No newline at end of file diff --git a/include/tp/JKRExpHeap.h b/include/tp/JKRExpHeap.h index 7c77f0a..65f8a42 100644 --- a/include/tp/JKRExpHeap.h +++ b/include/tp/JKRExpHeap.h @@ -9,25 +9,23 @@ #include <cstdint> -namespace libtp::tp::jkr_exp_heap -{ - extern "C" - { - /** - * @brief Allocates a number of bytes in a given heap - * - * @param heap The heap pointer - * @param size The number of bytes to be allocated - */ - void* do_alloc_JKRExpHeap( void* heap, uint32_t size, int32_t unk3 ); +namespace libtp::tp::jkr_exp_heap { +extern "C" { +/** + * @brief Allocates a number of bytes in a given heap + * + * @param heap The heap pointer + * @param size The number of bytes to be allocated + */ +void *do_alloc_JKRExpHeap(void *heap, uint32_t size, int32_t unk3); - /** - * @brief Frees a number of bytes in a given heap - * - * @param heap The heap pointer - * @param size The number of bytes to be freed - */ - void do_free_JKRExpHeap( void* heap, void* ptr ); - } -} // namespace libtp::tp::jkr_exp_heap +/** + * @brief Frees a number of bytes in a given heap + * + * @param heap The heap pointer + * @param size The number of bytes to be freed + */ +void do_free_JKRExpHeap(void *heap, void *ptr); +} +} // namespace libtp::tp::jkr_exp_heap #endif
\ No newline at end of file diff --git a/include/tp/Z2SceneMgr.h b/include/tp/Z2SceneMgr.h index 4d84f5a..aae3ce3 100644 --- a/include/tp/Z2SceneMgr.h +++ b/include/tp/Z2SceneMgr.h @@ -11,32 +11,24 @@ #include <cstdint> -namespace libtp::tp::z2audiolib::z2scenemgr -{ - struct Z2SceneMgr; +namespace libtp::tp::z2audiolib::z2scenemgr { +struct Z2SceneMgr; - /** - *@todo Move JAISoundID to its own file - */ - struct JAISoundID - { - uint32_t id; - }; +/** + *@todo Move JAISoundID to its own file + */ +struct JAISoundID { + uint32_t id; +}; - extern "C" - { - /** - * @brief sceneChange is called when the game changes the BGM playing - */ - void sceneChange( Z2SceneMgr* sceneMgr, - JAISoundID id, - uint8_t SeWave1, - uint8_t SeWave2, - uint8_t BgmWave1, - uint8_t BgmWave2, - uint8_t DemoWave, - bool param_7 ); - }; -} // namespace libtp::tp::z2audiolib::z2scenemgr +extern "C" { +/** + * @brief sceneChange is called when the game changes the BGM playing + */ +void sceneChange(Z2SceneMgr *sceneMgr, JAISoundID id, uint8_t SeWave1, + uint8_t SeWave2, uint8_t BgmWave1, uint8_t BgmWave2, + uint8_t DemoWave, bool param_7); +}; +} // namespace libtp::tp::z2audiolib::z2scenemgr #endif
\ No newline at end of file diff --git a/include/tp/Z2SeqMgr.h b/include/tp/Z2SeqMgr.h index 3e0b497..a51377a 100644 --- a/include/tp/Z2SeqMgr.h +++ b/include/tp/Z2SeqMgr.h @@ -10,14 +10,12 @@ #include <cstdint> -namespace libtp::tp::z2audiolib::z2seqmgr -{ - struct Z2SeqMgr; +namespace libtp::tp::z2audiolib::z2seqmgr { +struct Z2SeqMgr; - extern "C" - { - void startBattleBgm( Z2SeqMgr* seqMgr, bool param_1 ); - } -} // namespace libtp::tp::z2audiolib::z2seqmgr +extern "C" { +void startBattleBgm(Z2SeqMgr *seqMgr, bool param_1); +} +} // namespace libtp::tp::z2audiolib::z2seqmgr #endif
\ No newline at end of file diff --git a/include/tp/control.h b/include/tp/control.h index e3d56a1..1f2731b 100644 --- a/include/tp/control.h +++ b/include/tp/control.h @@ -10,11 +10,9 @@ #include <cstdint>
-namespace libtp::tp::control
-{
- extern "C"
- {
- bool render( void* TControl );
- }
-} // namespace libtp::tp::control
+namespace libtp::tp::control {
+extern "C" {
+bool render(void *TControl);
+}
+} // namespace libtp::tp::control
#endif
\ No newline at end of file diff --git a/include/tp/d_a_alink.h b/include/tp/d_a_alink.h index 6865c60..350eaf4 100644 --- a/include/tp/d_a_alink.h +++ b/include/tp/d_a_alink.h @@ -16,145 +16,141 @@ #include "tp/d_com_inf_game.h" -namespace libtp::tp::d_a_alink -{ - /** - * @brief These values define the speed of various climbing actions - * - * @todo Fill missing vars. - */ - struct ClimbVars - { - uint8_t unk_0[0x28]; - float ladderClimbInitSpeed; - uint8_t unk_2c[0x4]; - float ladderReachTopClimbUpSpeed; - uint8_t unk_30[0x4]; - float ladderTopStartClimbDownSpeed; - uint8_t unk_34[0x4]; - float ladderBottomGetOffSpeed; - uint8_t unk_38[0x8]; - float ladderClimbSpeed; - uint8_t unk_40[0x10]; - float wallClimbHorizontalSpeed; - uint8_t unk_58[0x4]; - float wallClimbVerticalSpeed; - uint8_t unk_5c[0x4]; - } __attribute__( ( __packed__ ) ); - - static_assert( sizeof( ClimbVars ) == 0x70 ); - - /** - * @brief These values contain the values for Link's state - * - * @todo Fill missing vars. - */ - struct LinkStatus - { - uint8_t unk_0[0xA2]; - uint8_t status; - } __attribute__( ( __packed__ ) ); - - extern "C" - { - /** - * @brief Checks if dComIfG_gameInfo.curentStage is equal to name - * - * @return Bool if the stages match - */ - bool checkStageName( const char* name ); - - /** - * @brief Runs when Link is about to walk on magnetic wall/ceiling - */ - void setStickData(); - - /** - * @brief Determines whether Link is in heavy state (Iron boots, Ball and - *Chain, ...) - * - * @return Bool whether Link is, if he is some actions might be restricted - */ - bool checkHeavyStateOn( int32_t unk1, int32_t unk2 ); - - /** - * @brief Initializes the animation that causes Link to transform - * - * @return Bool if link is transforming - */ - bool procCoMetamorphoseInit( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Checks whether a chest-rupee doesn't fit in Link's wallet - * - * @param unk1 Unknown pointer (perhaps to the treasure struct?) - * @param item Item id (1 through 7) - * - * @return True if the rupee doesn't fit in Links wallet, otherwise false - */ - bool checkTreasureRupeeReturn( void* unk1, int32_t item ); - - /** - * @brief Checks to see if Link is in an event (cutscene/animation/etc.) - * - * @return False if he isnt, True if he is. - */ - bool checkEventRun( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Checks to see if Link is currently snowboarding - * - * @return Bool if he is or isn't - */ - bool checkBoardRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Checks to see if Link is currently riding in a canoe - * - * @return Bool if he is or isn't - */ - bool checkCanoeRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Checks to see if Link is currently riding on Epona - * - * @return Bool if he is or isn't - */ - bool checkHorseRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Checks to see if Link is currently riding on a boar - * - * @return Bool if he is or isn't - */ - bool checkBoarRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Checks to see if Link is currently riding on the spinner - * - * @return Bool if he is or isn't - */ - bool checkSpinnerRide( tp::d_com_inf_game::LinkMapVars* linkMapPtr ); - - /** - * @brief Runs when delivering the final blow to Ganondorf - */ - bool procGanonFinishInit( void* d_a_alink ); - - /** - * @brief Runs when delivering the final blow to Ganondorf - */ - bool procGanonFinish( void* d_a_alink ); - - /** - * @brief Checks to see if an eventBit for the currently active save is set. - * - * @param flag Offset+Flag - */ - bool dComIfGs_isEventBit( uint16_t flag ); - - extern ClimbVars climbVars; - extern LinkStatus* linkStatus; - } -} // namespace libtp::tp::d_a_alink +namespace libtp::tp::d_a_alink { +/** + * @brief These values define the speed of various climbing actions + * + * @todo Fill missing vars. + */ +struct ClimbVars { + uint8_t unk_0[0x28]; + float ladderClimbInitSpeed; + uint8_t unk_2c[0x4]; + float ladderReachTopClimbUpSpeed; + uint8_t unk_30[0x4]; + float ladderTopStartClimbDownSpeed; + uint8_t unk_34[0x4]; + float ladderBottomGetOffSpeed; + uint8_t unk_38[0x8]; + float ladderClimbSpeed; + uint8_t unk_40[0x10]; + float wallClimbHorizontalSpeed; + uint8_t unk_58[0x4]; + float wallClimbVerticalSpeed; + uint8_t unk_5c[0x4]; +} __attribute__((__packed__)); + +static_assert(sizeof(ClimbVars) == 0x70); + +/** + * @brief These values contain the values for Link's state + * + * @todo Fill missing vars. + */ +struct LinkStatus { + uint8_t unk_0[0xA2]; + uint8_t status; +} __attribute__((__packed__)); + +extern "C" { +/** + * @brief Checks if dComIfG_gameInfo.curentStage is equal to name + * + * @return Bool if the stages match + */ +bool checkStageName(const char *name); + +/** + * @brief Runs when Link is about to walk on magnetic wall/ceiling + */ +void setStickData(); + +/** + * @brief Determines whether Link is in heavy state (Iron boots, Ball and + *Chain, ...) + * + * @return Bool whether Link is, if he is some actions might be restricted + */ +bool checkHeavyStateOn(int32_t unk1, int32_t unk2); + +/** + * @brief Initializes the animation that causes Link to transform + * + * @return Bool if link is transforming + */ +bool procCoMetamorphoseInit(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Checks whether a chest-rupee doesn't fit in Link's wallet + * + * @param unk1 Unknown pointer (perhaps to the treasure struct?) + * @param item Item id (1 through 7) + * + * @return True if the rupee doesn't fit in Links wallet, otherwise false + */ +bool checkTreasureRupeeReturn(void *unk1, int32_t item); + +/** + * @brief Checks to see if Link is in an event (cutscene/animation/etc.) + * + * @return False if he isnt, True if he is. + */ +bool checkEventRun(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Checks to see if Link is currently snowboarding + * + * @return Bool if he is or isn't + */ +bool checkBoardRide(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Checks to see if Link is currently riding in a canoe + * + * @return Bool if he is or isn't + */ +bool checkCanoeRide(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Checks to see if Link is currently riding on Epona + * + * @return Bool if he is or isn't + */ +bool checkHorseRide(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Checks to see if Link is currently riding on a boar + * + * @return Bool if he is or isn't + */ +bool checkBoarRide(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Checks to see if Link is currently riding on the spinner + * + * @return Bool if he is or isn't + */ +bool checkSpinnerRide(tp::d_com_inf_game::LinkMapVars *linkMapPtr); + +/** + * @brief Runs when delivering the final blow to Ganondorf + */ +bool procGanonFinishInit(void *d_a_alink); + +/** + * @brief Runs when delivering the final blow to Ganondorf + */ +bool procGanonFinish(void *d_a_alink); + +/** + * @brief Checks to see if an eventBit for the currently active save is set. + * + * @param flag Offset+Flag + */ +bool dComIfGs_isEventBit(uint16_t flag); + +extern ClimbVars climbVars; +extern LinkStatus *linkStatus; +} +} // namespace libtp::tp::d_a_alink #endif
\ No newline at end of file diff --git a/include/tp/d_a_shop_item_static.h b/include/tp/d_a_shop_item_static.h index 80ab328..c99d91c 100644 --- a/include/tp/d_a_shop_item_static.h +++ b/include/tp/d_a_shop_item_static.h @@ -13,63 +13,60 @@ #include <cstdint> -namespace libtp::tp::d_a_shop_item_static -{ - enum ShopItemDataIndex : uint8_t - { - Sold_Out = 0x0, - Lantern_Oil = 0x1, // Item Id = 0x66 - Red_Potion = 0x2, // Item Id = 0x61 - Milk = 0x3, // Item Id = 0x64 - Sera_Bottle = 0x4, // Item Id = 0x65 - Arrows = 0x5, // Item Id = 0xE to 0x10 - Wooden_Shield = 0x6, // Item Id = 0x2B - Hylian_Shield = 0x7, // Item Id = 0x2C - Bombs = 0x8, // Item Id = 0xA to 0xD - Bomb_Bag_Water_Bombs = 0x9, // Item Id = 0x71 -- Uses Water Bomb model - Bomb_Bag_Bomblings = 0xA, // Item Id = 0x72 -- Uses Bombling model - Empty_Bomb_Bag = 0xB, // Item Id = 0x50 -- Possibly handles multiple different bomb bags - Giant_Bomb_Bag = 0xC, // Item Id = 0x4F - Land_Mine = 0xD, // Unused in getShopArcname - Bottle = 0xE, // Unused in getShopArcname - Bee_Larva = 0xF, // Item Id = 0x76 - Slingshot = 0x10, // Item Id = 0x4B - Blue_Potion = 0x11, // Item Id = 0x63 - Hawkeye = 0x12, // Item Id = 0x3E - Magic_Armor = 0x13, // Item Id = 0x30 - Magic_Armor_Sold_Out = 0x14, - Green_Potion = 0x15, // Item Id = 0x62 - Jovani_Bottle = 0x16, // Item Id = 0x75 - }; +namespace libtp::tp::d_a_shop_item_static { +enum ShopItemDataIndex : uint8_t { + Sold_Out = 0x0, + Lantern_Oil = 0x1, // Item Id = 0x66 + Red_Potion = 0x2, // Item Id = 0x61 + Milk = 0x3, // Item Id = 0x64 + Sera_Bottle = 0x4, // Item Id = 0x65 + Arrows = 0x5, // Item Id = 0xE to 0x10 + Wooden_Shield = 0x6, // Item Id = 0x2B + Hylian_Shield = 0x7, // Item Id = 0x2C + Bombs = 0x8, // Item Id = 0xA to 0xD + Bomb_Bag_Water_Bombs = 0x9, // Item Id = 0x71 -- Uses Water Bomb model + Bomb_Bag_Bomblings = 0xA, // Item Id = 0x72 -- Uses Bombling model + Empty_Bomb_Bag = + 0xB, // Item Id = 0x50 -- Possibly handles multiple different bomb bags + Giant_Bomb_Bag = 0xC, // Item Id = 0x4F + Land_Mine = 0xD, // Unused in getShopArcname + Bottle = 0xE, // Unused in getShopArcname + Bee_Larva = 0xF, // Item Id = 0x76 + Slingshot = 0x10, // Item Id = 0x4B + Blue_Potion = 0x11, // Item Id = 0x63 + Hawkeye = 0x12, // Item Id = 0x3E + Magic_Armor = 0x13, // Item Id = 0x30 + Magic_Armor_Sold_Out = 0x14, + Green_Potion = 0x15, // Item Id = 0x62 + Jovani_Bottle = 0x16, // Item Id = 0x75 +}; - struct ShopItemData - { - const char* arcName; - int16_t modelResIdx; - int16_t wBtkResIdx; - int16_t unk_8; - int16_t wBckResIdx; - int16_t unk_C; - int16_t wBrkResIdx; - int16_t wBtpResIdx; - int16_t unk_12; - float posY; - float scale; - int16_t wRot[4]; - uint32_t mFlags; - uint8_t mShadowSize; - uint8_t mCollisionH; - uint8_t mCollisionR; - uint8_t tevFrm; - uint8_t btpFrm; - uint8_t unk_2D[3]; - } __attribute__( ( __packed__ ) ); +struct ShopItemData { + const char *arcName; + int16_t modelResIdx; + int16_t wBtkResIdx; + int16_t unk_8; + int16_t wBckResIdx; + int16_t unk_C; + int16_t wBrkResIdx; + int16_t wBtpResIdx; + int16_t unk_12; + float posY; + float scale; + int16_t wRot[4]; + uint32_t mFlags; + uint8_t mShadowSize; + uint8_t mCollisionH; + uint8_t mCollisionR; + uint8_t tevFrm; + uint8_t btpFrm; + uint8_t unk_2D[3]; +} __attribute__((__packed__)); - static_assert( sizeof( ShopItemData ) == 0x30 ); +static_assert(sizeof(ShopItemData) == 0x30); - extern "C" - { - extern ShopItemData shopItemData[23]; // mData__12daShopItem_c - } -} // namespace libtp::tp::d_a_shop_item_static +extern "C" { +extern ShopItemData shopItemData[23]; // mData__12daShopItem_c +} +} // namespace libtp::tp::d_a_shop_item_static #endif
\ No newline at end of file diff --git a/include/tp/d_com_inf_game.h b/include/tp/d_com_inf_game.h index b8bd382..c1e2910 100644 --- a/include/tp/d_com_inf_game.h +++ b/include/tp/d_com_inf_game.h @@ -16,131 +16,127 @@ #include "tp/evt_control.h" -namespace libtp::tp::d_com_inf_game -{ - /** - * @brief Holds 1:1 save-file data - * - * @todo Fill missing vars. - * @todo Make bitfields actual bitwise variables for easier access. - *(https://en.cppreference.com/w/cpp/language/bit_field) - */ - struct ScratchPad - { - uint8_t wQuestLogData[0x7F0]; - uint8_t eventBits[0x150]; // Bitfield (QuestLogOffset - 7F0) - uint8_t miniGameBits[0x18]; // Bitfield - } __attribute__( ( __packed__ ) ); - static_assert( sizeof( ScratchPad ) == 0x958 ); +namespace libtp::tp::d_com_inf_game { +/** + * @brief Holds 1:1 save-file data + * + * @todo Fill missing vars. + * @todo Make bitfields actual bitwise variables for easier access. + *(https://en.cppreference.com/w/cpp/language/bit_field) + */ +struct ScratchPad { + uint8_t wQuestLogData[0x7F0]; + uint8_t eventBits[0x150]; // Bitfield (QuestLogOffset - 7F0) + uint8_t miniGameBits[0x18]; // Bitfield +} __attribute__((__packed__)); +static_assert(sizeof(ScratchPad) == 0x958); - /** - * @brief Holds information about the current stage - * - * @todo Fill missing vars. - * @todo Get exact size. - */ - struct CurrentStageVars - { - char currentStage[8]; - int16_t currentSpawnPoint; - uint8_t unknown[4]; - } __attribute__( ( __packed__ ) ); +/** + * @brief Holds information about the current stage + * + * @todo Fill missing vars. + * @todo Get exact size. + */ +struct CurrentStageVars { + char currentStage[8]; + int16_t currentSpawnPoint; + uint8_t unknown[4]; +} __attribute__((__packed__)); - /** - * @brief Holds information about the next stage - * - * @todo Fill missing vars. - * @todo Get exact size. - */ - struct NextStageVars - { - char nextStage[8]; - uint8_t isVoidorWarp; - uint8_t nextSpawnPoint; - uint8_t nextRoom; - uint8_t nextState; - uint8_t unk1; - uint8_t unk2; - uint8_t triggerLoad; - uint8_t fadeType; - } __attribute__( ( __packed__ ) ); +/** + * @brief Holds information about the next stage + * + * @todo Fill missing vars. + * @todo Get exact size. + */ +struct NextStageVars { + char nextStage[8]; + uint8_t isVoidorWarp; + uint8_t nextSpawnPoint; + uint8_t nextRoom; + uint8_t nextState; + uint8_t unk1; + uint8_t unk2; + uint8_t triggerLoad; + uint8_t fadeType; +} __attribute__((__packed__)); - /** - * @brief Cutscene and event control system - * - * @todo Fill missing vars. - */ - struct EventSystem - { - uint8_t unk00[0x13]; - uint16_t immediateControl; - uint8_t unk_00[0x4]; - uint8_t nextEventID; - uint8_t unk1A[0xD1]; - uint8_t currentEventID; - uint8_t unk_ec[0x14]; - libtp::tp::evt_control::csSkipFunction* onSkip; // This will run when trying to skip; if null it's unskippable - uint8_t unk_104[0xC]; - uint32_t fadeOnSkip; // If > 0 the screen will fade when skipping - } __attribute__( ( __packed__ ) ); +/** + * @brief Cutscene and event control system + * + * @todo Fill missing vars. + */ +struct EventSystem { + uint8_t unk00[0x13]; + uint16_t immediateControl; + uint8_t unk_00[0x4]; + uint8_t nextEventID; + uint8_t unk1A[0xD1]; + uint8_t currentEventID; + uint8_t unk_ec[0x14]; + libtp::tp::evt_control::csSkipFunction + *onSkip; // This will run when trying to skip; if null it's unskippable + uint8_t unk_104[0xC]; + uint32_t fadeOnSkip; // If > 0 the screen will fade when skipping +} __attribute__((__packed__)); - /** - * @brief Holds data about Links position on the current map - * - * @todo Fill missing vars. - * @todo Get exact size. - */ - struct LinkMapVars - { - uint8_t unk_0[0x4D0]; - float pos[3]; - } __attribute__( ( __packed__ ) ); +/** + * @brief Holds data about Links position on the current map + * + * @todo Fill missing vars. + * @todo Get exact size. + */ +struct LinkMapVars { + uint8_t unk_0[0x4D0]; + float pos[3]; +} __attribute__((__packed__)); - /** - * @brief GameInfo Structure holding general and most crucial game - *information - * - * @todo Fill missing vars - */ - struct GameInfo - { - ScratchPad scratchPad; // 0 - 957 - uint8_t localAreaNodes[0x20]; // 958 - 977 holds flags about the current area - uint8_t unk_978[0x450]; // 978 - DC7 - uint8_t respawnCutscene; // DC8 - DC8 - uint8_t unkdc9[0xA]; // dc9 - dd2 - uint8_t respawnAnimation; // dd3 - dd3 - uint8_t unkdd4[0x402C]; // dd4 - 4DFF - char currentStage[8]; // 4E00 - 4E07 - uint8_t unk_4e08[6]; // 4E08 - 4E0D - NextStageVars nextStageVars; // 4E0E - 4E1b - uint8_t unk_4e1c[0xAA]; // 4E19 - 4EC7 - EventSystem eventSystem; // 4EC8 - 4FDE - uint8_t unk_4fdd[0xDD0]; // 4FDD - 5DBF - LinkMapVars* linkMapPtr; // 5DA0 - 5DAB - uint8_t unk_5dac[0x18060]; - } __attribute__( ( __packed__ ) ); - static_assert( sizeof( GameInfo ) == 0x1DE10 ); +/** + * @brief GameInfo Structure holding general and most crucial game + *information + * + * @todo Fill missing vars + */ +struct GameInfo { + ScratchPad scratchPad; // 0 - 957 + uint8_t localAreaNodes[0x20]; // 958 - 977 holds flags about the current area + uint8_t unk_978[0x450]; // 978 - DC7 + uint8_t respawnCutscene; // DC8 - DC8 + uint8_t unkdc9[0xA]; // dc9 - dd2 + uint8_t respawnAnimation; // dd3 - dd3 + uint8_t unkdd4[0x402C]; // dd4 - 4DFF + char currentStage[8]; // 4E00 - 4E07 + uint8_t unk_4e08[6]; // 4E08 - 4E0D + NextStageVars nextStageVars; // 4E0E - 4E1b + uint8_t unk_4e1c[0xAA]; // 4E19 - 4EC7 + EventSystem eventSystem; // 4EC8 - 4FDE + uint8_t unk_4fdd[0xDD0]; // 4FDD - 5DBF + LinkMapVars *linkMapPtr; // 5DA0 - 5DAB + uint8_t unk_5dac[0x18060]; +} __attribute__((__packed__)); +static_assert(sizeof(GameInfo) == 0x1DE10); - extern "C" - { - extern GameInfo dComIfG_gameInfo; +extern "C" { +extern GameInfo dComIfG_gameInfo; - /** - * @brief Checks the current time and sets the proper layer based on the current layer. - * - * @param pLayer The pointer to the current layer. - */ - void dComIfG_get_timelayer( int32_t* pLayer ); +/** + * @brief Checks the current time and sets the proper layer based on the + * current layer. + * + * @param pLayer The pointer to the current layer. + */ +void dComIfG_get_timelayer(int32_t *pLayer); - /** - * @brief Returns the layer for the current stage after checking the appropriate flags. - * - * @param stageName The current stage. - * @param roomId The current room. - * @param layerOverride The initial layer to be returned. - */ - int32_t getLayerNo_common_common(const char* stageName, int32_t roomId, int32_t layerOverride); - } -} // namespace libtp::tp::d_com_inf_game +/** + * @brief Returns the layer for the current stage after checking the + * appropriate flags. + * + * @param stageName The current stage. + * @param roomId The current room. + * @param layerOverride The initial layer to be returned. + */ +int32_t getLayerNo_common_common(const char *stageName, int32_t roomId, + int32_t layerOverride); +} +} // namespace libtp::tp::d_com_inf_game #endif
\ No newline at end of file diff --git a/include/tp/d_item.h b/include/tp/d_item.h index 457486f..585021f 100644 --- a/include/tp/d_item.h +++ b/include/tp/d_item.h @@ -9,33 +9,32 @@ #include <cstdint> -namespace libtp::tp::d_item -{ - typedef void ( *ItemFunc )(); - typedef int32_t ( *ItemGetCheckFunc )(); +namespace libtp::tp::d_item { +typedef void (*ItemFunc)(); +typedef int32_t (*ItemGetCheckFunc)(); - extern "C" - { - /** - * @brief Unknown - * - * @param item Item id to check (?) - * @param defaultValue Default if unsuccessful - * - * @return Probably(!) the correct item id to use (for progressive items - *like clawshot) - */ - int32_t checkItemGet( uint8_t item, int32_t defaultValue ); +extern "C" { +/** + * @brief Unknown + * + * @param item Item id to check (?) + * @param defaultValue Default if unsuccessful + * + * @return Probably(!) the correct item id to use (for progressive items + *like clawshot) + */ +int32_t checkItemGet(uint8_t item, int32_t defaultValue); - /** - * @brief Initializes the dSv_player_get_item_c function with the current value - * - * @param item id of the item being recieved - */ - int32_t execItemGet( uint8_t item ); +/** + * @brief Initializes the dSv_player_get_item_c function with the current + *value + * + * @param item id of the item being recieved + */ +int32_t execItemGet(uint8_t item); - extern ItemFunc item_func_ptr[0x100]; - extern ItemGetCheckFunc item_getcheck_func_ptr[0x100]; - } -} // namespace libtp::tp::d_item +extern ItemFunc item_func_ptr[0x100]; +extern ItemGetCheckFunc item_getcheck_func_ptr[0x100]; +} +} // namespace libtp::tp::d_item #endif
\ No newline at end of file diff --git a/include/tp/d_item_data.h b/include/tp/d_item_data.h index 03b25bd..54e4a85 100644 --- a/include/tp/d_item_data.h +++ b/include/tp/d_item_data.h @@ -11,50 +11,46 @@ #include "tp/d_stage.h" -namespace libtp::tp::d_item_data -{ - struct ItemResource - { - const char* arcName; - int16_t modelResIdx; - int16_t btkResIdx; - int16_t bckResIdx; - int16_t brkResIdx; - int16_t btpResIdx; - uint8_t tevFrm; - uint8_t btpFrm; - int16_t ringTexResIdx; - int16_t unk_12[3]; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::d_item_data { +struct ItemResource { + const char *arcName; + int16_t modelResIdx; + int16_t btkResIdx; + int16_t bckResIdx; + int16_t brkResIdx; + int16_t btpResIdx; + uint8_t tevFrm; + uint8_t btpFrm; + int16_t ringTexResIdx; + int16_t unk_12[3]; +} __attribute__((__packed__)); - struct FieldItemRes - { - const char* arcName; - int16_t modelResIdx; - int16_t bckAnmResIdx; - int16_t brkAnmResIdx; - int16_t unk_a; - int16_t heapSize; - int16_t unk_e; - } __attribute__( ( __packed__ ) ); +struct FieldItemRes { + const char *arcName; + int16_t modelResIdx; + int16_t bckAnmResIdx; + int16_t brkAnmResIdx; + int16_t unk_a; + int16_t heapSize; + int16_t unk_e; +} __attribute__((__packed__)); - struct ItemInfo // d_item_data.h - { - uint8_t mShadowSize; - uint8_t mCollisionH; - uint8_t mCollisionR; - uint8_t mFlags; - } __attribute__( ( __packed__ ) ); +struct ItemInfo // d_item_data.h +{ + uint8_t mShadowSize; + uint8_t mCollisionH; + uint8_t mCollisionR; + uint8_t mFlags; +} __attribute__((__packed__)); - static_assert( sizeof( ItemResource ) == 0x18 ); - static_assert( sizeof( FieldItemRes ) == 0x10 ); - static_assert( sizeof( ItemInfo ) == 0x4 ); +static_assert(sizeof(ItemResource) == 0x18); +static_assert(sizeof(FieldItemRes) == 0x10); +static_assert(sizeof(ItemInfo) == 0x4); - extern "C" - { - extern ItemResource item_resource[255]; // 0x803AC5A0 in US - extern FieldItemRes field_item_res[255]; // 0x803ADD88 in US - extern ItemInfo item_info[255]; // 0x803AED78 in US - } -} // namespace libtp::tp::d_item_data +extern "C" { +extern ItemResource item_resource[255]; // 0x803AC5A0 in US +extern FieldItemRes field_item_res[255]; // 0x803ADD88 in US +extern ItemInfo item_info[255]; // 0x803AED78 in US +} +} // namespace libtp::tp::d_item_data #endif
\ No newline at end of file diff --git a/include/tp/d_kankyo.h b/include/tp/d_kankyo.h index 743cd81..55765a9 100644 --- a/include/tp/d_kankyo.h +++ b/include/tp/d_kankyo.h @@ -12,25 +12,22 @@ #include <cstdint> -namespace libtp::tp::d_kankyo -{ - /** - * @brief Environment infos - * - * @todo Fill missing vars. - */ - struct EnvLight - { - uint8_t unk_0[0x98C]; - uint8_t currentRoom; - uint8_t unk_98d[0x983]; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::d_kankyo { +/** + * @brief Environment infos + * + * @todo Fill missing vars. + */ +struct EnvLight { + uint8_t unk_0[0x98C]; + uint8_t currentRoom; + uint8_t unk_98d[0x983]; +} __attribute__((__packed__)); - static_assert( sizeof( EnvLight ) == 0x1310 ); +static_assert(sizeof(EnvLight) == 0x1310); - extern "C" - { - extern EnvLight env_light; - } -} // namespace libtp::tp::d_kankyo +extern "C" { +extern EnvLight env_light; +} +} // namespace libtp::tp::d_kankyo #endif
\ No newline at end of file diff --git a/include/tp/d_map_path_dmap.h b/include/tp/d_map_path_dmap.h index 18426a3..0199cdb 100644 --- a/include/tp/d_map_path_dmap.h +++ b/include/tp/d_map_path_dmap.h @@ -9,24 +9,22 @@ #include <cstdint> -namespace libtp::tp::d_map_path_dmap -{ - extern "C" - { - /** - * @brief Gets the current XYZ coordinates for Links current position - * - * @param posOut The 3 floats which will hold the respective X, Y and Z - *coordinate - */ - void getMapPlayerPos( float posOut[3] ); +namespace libtp::tp::d_map_path_dmap { +extern "C" { +/** + * @brief Gets the current XYZ coordinates for Links current position + * + * @param posOut The 3 floats which will hold the respective X, Y and Z + *coordinate + */ +void getMapPlayerPos(float posOut[3]); - /** - * @brief If Link is loaded on the stage, get the Y angle - * - * @return Int of Link's angle. - */ - uint32_t getMapPlayerAngleY(); - } -} // namespace libtp::tp::d_map_path_dmap +/** + * @brief If Link is loaded on the stage, get the Y angle + * + * @return Int of Link's angle. + */ +uint32_t getMapPlayerAngleY(); +} +} // namespace libtp::tp::d_map_path_dmap #endif
\ No newline at end of file diff --git a/include/tp/d_menu_collect.h b/include/tp/d_menu_collect.h index 2c74b76..6cf6b5c 100644 --- a/include/tp/d_menu_collect.h +++ b/include/tp/d_menu_collect.h @@ -7,16 +7,14 @@ #ifndef TP_D_MENU_COLLECT_H #define TP_D_MENU_COLLECT_H -namespace libtp::tp::d_menu_collect -{ - extern "C" - { - /** - * @brief Sets the maximum number of rupees - * - * Automatically gets the wallet size and fills it - */ - void setWalletMaxNum(); - } -} // namespace libtp::tp::d_menu_collect +namespace libtp::tp::d_menu_collect { +extern "C" { +/** + * @brief Sets the maximum number of rupees + * + * Automatically gets the wallet size and fills it + */ +void setWalletMaxNum(); +} +} // namespace libtp::tp::d_menu_collect #endif
\ No newline at end of file diff --git a/include/tp/d_meter2_info.h b/include/tp/d_meter2_info.h index 618100c..2d379f7 100644 --- a/include/tp/d_meter2_info.h +++ b/include/tp/d_meter2_info.h @@ -10,24 +10,21 @@ #include "tp/d_com_inf_game.h" -namespace libtp::tp::d_meter2_info -{ - struct G_Meter2_Info - { - uint8_t unk_0[0x10]; - tp::d_msg_object::StringDataTable* stringDataTable; - uint8_t unk_14[0xE4]; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::d_meter2_info { +struct G_Meter2_Info { + uint8_t unk_0[0x10]; + tp::d_msg_object::StringDataTable *stringDataTable; + uint8_t unk_14[0xE4]; +} __attribute__((__packed__)); - static_assert( sizeof( G_Meter2_Info ) == 0xF8 ); +static_assert(sizeof(G_Meter2_Info) == 0xF8); - extern "C" - { - /** - * @brief Gets a pointer to the transparancy of the Z button - */ - extern void* wZButtonPtr; - extern G_Meter2_Info g_meter2_info; - } -} // namespace libtp::tp::d_meter2_info +extern "C" { +/** + * @brief Gets a pointer to the transparancy of the Z button + */ +extern void *wZButtonPtr; +extern G_Meter2_Info g_meter2_info; +} +} // namespace libtp::tp::d_meter2_info #endif
\ No newline at end of file diff --git a/include/tp/d_msg_object.h b/include/tp/d_msg_object.h index 6853545..f46175c 100644 --- a/include/tp/d_msg_object.h +++ b/include/tp/d_msg_object.h @@ -1,5 +1,6 @@ /** @file d_msg_object.h - * @brief Contains some of the functions used in getting the values for a message + * @brief Contains some of the functions used in getting the values for a + *message * * @author Lunar Soap * @author Zephiles @@ -10,36 +11,33 @@ #include <cstdint> -namespace libtp::tp::d_msg_object -{ - struct StringDataTableEntry - { - uint32_t offsetToString; - uint16_t stringId; - uint8_t unk[0xE]; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::d_msg_object { +struct StringDataTableEntry { + uint32_t offsetToString; + uint16_t stringId; + uint8_t unk[0xE]; +} __attribute__((__packed__)); - struct StringDataTable - { - uint8_t unk_0[0x20]; - uint8_t unk_20[0x4]; - uint32_t stringsStartOffset; - uint16_t totalEntries; // Should always be 5000 - uint16_t entrySize; // Should always be 0x14 - uint8_t unk_2c[0x4]; - StringDataTableEntry entry[5000]; - } __attribute__( ( __packed__ ) ); +struct StringDataTable { + uint8_t unk_0[0x20]; + uint8_t unk_20[0x4]; + uint32_t stringsStartOffset; + uint16_t totalEntries; // Should always be 5000 + uint16_t entrySize; // Should always be 0x14 + uint8_t unk_2c[0x4]; + StringDataTableEntry entry[5000]; +} __attribute__((__packed__)); - static_assert( sizeof( StringDataTableEntry ) == 0x14 ); +static_assert(sizeof(StringDataTableEntry) == 0x14); - extern "C" - { - /** - * @param param_1 - Unknown - * @param itemIndex - The itemId of the item received + 0x65 - * @param param_3 - Unknown. I think it checks for a valid message but more research is needed - */ - void setMessageIndex( uint32_t param_1, uint32_t itemIndex, bool param_3 ); - } -} // namespace libtp::tp::d_msg_object +extern "C" { +/** + * @param param_1 - Unknown + * @param itemIndex - The itemId of the item received + 0x65 + * @param param_3 - Unknown. I think it checks for a valid message but more + * research is needed + */ +void setMessageIndex(uint32_t param_1, uint32_t itemIndex, bool param_3); +} +} // namespace libtp::tp::d_msg_object #endif
\ No newline at end of file diff --git a/include/tp/d_s_logo.h b/include/tp/d_s_logo.h new file mode 100644 index 0000000..c187a72 --- /dev/null +++ b/include/tp/d_s_logo.h @@ -0,0 +1,28 @@ +/** @file d_s_logo.h
+ * @brief Contains language definitions for different game regions
+ *
+ * @author Zephiles
+ * @bug No known bugs.
+ */
+#ifndef TP_D_S_LOGO_H
+#define TP_D_S_LOGO_H
+
+#include <cstdint>
+
+namespace libtp::tp::d_s_logo {
+enum class Languages : int32_t {
+ uk = 0, // English
+ de, // German
+ fr, // French
+ sp, // Spanish
+ it // Italian
+};
+
+extern "C" {
+#ifdef TP_EU
+// This function only exists in the PAL version
+Languages getPalLanguage2(void *dScnLogo_c); // dScnLogo_c is unused
+#endif
+}
+} // namespace libtp::tp::d_s_logo
+#endif
\ No newline at end of file diff --git a/include/tp/d_save.h b/include/tp/d_save.h index e14536c..6858a0d 100644 --- a/include/tp/d_save.h +++ b/include/tp/d_save.h @@ -2,7 +2,7 @@ * @brief Holds symbols of the d_save field * * @author AECX -* @author Lunar Soap + * @author Lunar Soap * @bug No known bugs. */ #ifndef TP_D_SAVE_H @@ -12,81 +12,80 @@ #include "d_com_inf_game.h" -namespace libtp::tp::d_save -{ - extern "C" - { - /** - * @brief Gets the maximum number of rupees - * - * Warning! If this function is manipulated to return a higher number than - *what - * the HUD can display (4 digits base 10) it causes serious issues (e.g. - *random crashes) - * - * @return Returns the maximum number of rupees Link can hold in his - *current wallet - */ - uint16_t getRupeeMax(); +namespace libtp::tp::d_save { +extern "C" { +/** + * @brief Gets the maximum number of rupees + * + * Warning! If this function is manipulated to return a higher number than + *what + * the HUD can display (4 digits base 10) it causes serious issues (e.g. + *random crashes) + * + * @return Returns the maximum number of rupees Link can hold in his + *current wallet + */ +uint16_t getRupeeMax(); - /** - * @brief Sets the current AreaNode for region-specific flags - * by loading it from the ScratchPad/QuestLog - * - * For more information about AreaNodes please refer to - * https://docs.google.com/spreadsheets/d/1OvlqH_OG_svcLZfuSDBjCLHFivcsBGpOD25o-_6vblA/edit#gid=0 - * - * @param gameInfoPtr Pointer to d_com_inf_game::gameInfo - * @param areaID ID of the current Area - */ - void getSave( d_com_inf_game::GameInfo* gameInfoPtr, int32_t areaID ); +/** + * @brief Sets the current AreaNode for region-specific flags + * by loading it from the ScratchPad/QuestLog + * + * For more information about AreaNodes please refer to + * https://docs.google.com/spreadsheets/d/1OvlqH_OG_svcLZfuSDBjCLHFivcsBGpOD25o-_6vblA/edit#gid=0 + * + * @param gameInfoPtr Pointer to d_com_inf_game::gameInfo + * @param areaID ID of the current Area + */ +void getSave(d_com_inf_game::GameInfo *gameInfoPtr, int32_t areaID); - /** - * @brief Puts the previously set AreaNode for region-specific flags back - * into the ScratchPad/QuestLog - * - * For more information about AreaNodes please refer to - * https://docs.google.com/spreadsheets/d/1OvlqH_OG_svcLZfuSDBjCLHFivcsBGpOD25o-_6vblA/edit#gid=0 - * - * @param gameInfoPtr Pointer to d_com_inf_game::gameInfo - * @param areaID ID of the current Area - */ - void putSave( d_com_inf_game::GameInfo* gameInfoPtr, int32_t areaID ); +/** + * @brief Puts the previously set AreaNode for region-specific flags back + * into the ScratchPad/QuestLog + * + * For more information about AreaNodes please refer to + * https://docs.google.com/spreadsheets/d/1OvlqH_OG_svcLZfuSDBjCLHFivcsBGpOD25o-_6vblA/edit#gid=0 + * + * @param gameInfoPtr Pointer to d_com_inf_game::gameInfo + * @param areaID ID of the current Area + */ +void putSave(d_com_inf_game::GameInfo *gameInfoPtr, int32_t areaID); - /** - * @brief Sets an eventBit for the currently active save - * - * @param eventPtr The pointer to the event bits. - * @param flag Offset+Flag - */ +/** + * @brief Sets an eventBit for the currently active save + * + * @param eventPtr The pointer to the event bits. + * @param flag Offset+Flag + */ - void onEventBit( uint8_t* eventPtr, uint16_t flag ); +void onEventBit(uint8_t *eventPtr, uint16_t flag); - /** - * @brief Unsets an eventBit for the currently active save - * - * @param eventPtr The pointer to the event bits. - * @param flag Offset+Flag - */ - void offEventBit( uint8_t* eventPtr, uint16_t flag ); +/** + * @brief Unsets an eventBit for the currently active save + * + * @param eventPtr The pointer to the event bits. + * @param flag Offset+Flag + */ +void offEventBit(uint8_t *eventPtr, uint16_t flag); - /** - * @brief Checks whether the player has cleared the specified twilight. - * - * @param playerStatusPtr The pointer to the PlayerStatus struct. - * @param twilightNode The twilight instance to be checked. - */ - bool isDarkClearLV( void* playerStatusPtr, int32_t twilightNode ); +/** + * @brief Checks whether the player has cleared the specified twilight. + * + * @param playerStatusPtr The pointer to the PlayerStatus struct. + * @param twilightNode The twilight instance to be checked. + */ +bool isDarkClearLV(void *playerStatusPtr, int32_t twilightNode); - /** - * @brief Checks whether or not Link has been transformed into wolf by a twilight CS - * - * @param playerStatusPtr The pointer to the PlayerStatus struct. - * @param twilightEvent The twilight cutscene event to be checked. - */ - bool isTransformLV( void* playerStatusPtr, int32_t twilightEvent ); +/** + * @brief Checks whether or not Link has been transformed into wolf by a + * twilight CS + * + * @param playerStatusPtr The pointer to the PlayerStatus struct. + * @param twilightEvent The twilight cutscene event to be checked. + */ +bool isTransformLV(void *playerStatusPtr, int32_t twilightEvent); - extern uint16_t saveBitLabels[0x336]; //saveBitLabels__16dSv_event_flag_c - } -} // namespace libtp::tp::d_save +extern uint16_t saveBitLabels[0x336]; // saveBitLabels__16dSv_event_flag_c +} +} // namespace libtp::tp::d_save #endif
\ No newline at end of file diff --git a/include/tp/d_stage.h b/include/tp/d_stage.h index d32ca73..d26039d 100644 --- a/include/tp/d_stage.h +++ b/include/tp/d_stage.h @@ -13,67 +13,72 @@ #include "tp/dzx.h" -namespace libtp::tp::d_stage -{ - extern "C" - { - /** - * @brief Used for treasure initialisation (not just chests) - * - * @return Returns the maximum number of rupees Link can hold in his - *current wallet - */ - void setTresure( void* unk1 ); // Yes they spell it Tresure +namespace libtp::tp::d_stage { +extern "C" { +/** + * @brief Used for treasure initialisation (not just chests) + * + * @return Returns the maximum number of rupees Link can hold in his + *current wallet + */ +void setTresure(void *unk1); // Yes they spell it Tresure - /** - * @brief Initialises TRES for a given room - * - * @param chunkTypeInfo Pointer to the TRES chunk metadata - */ - void roomTresureInit( void* unk1, dzx::ChunkTypeInfo* chunkTypeInfo, int32_t unk3, void* unk4 ); +/** + * @brief Initialises TRES for a given room + * + * @param chunkTypeInfo Pointer to the TRES chunk metadata + */ +void roomTresureInit(void *unk1, dzx::ChunkTypeInfo *chunkTypeInfo, + int32_t unk3, void *unk4); - /** - * @brief Initialises Actors, can run multiple times per load - Global Based on Room - * - * @param mStatus_roomControl Pointer to roomControl data (unknown) - * @param chunkTypeInfo Pointer to dzxHeader - * @param unk3 unknown - * @param unk4 unknown - */ - bool actorCommonLayerInit( void* mStatus_roomControl, dzx::ChunkTypeInfo* chunkTypeInfo, int32_t unk3, void* unk4 ); +/** + * @brief Initialises Actors, can run multiple times per load - Global Based on + * Room + * + * @param mStatus_roomControl Pointer to roomControl data (unknown) + * @param chunkTypeInfo Pointer to dzxHeader + * @param unk3 unknown + * @param unk4 unknown + */ +bool actorCommonLayerInit(void *mStatus_roomControl, + dzx::ChunkTypeInfo *chunkTypeInfo, int32_t unk3, + void *unk4); - /** - * @brief Initialises Actors for current layer, can run multiple times per load - * - * @param mStatus_roomControl Pointer to roomControl data (unknown) - * @param chunkTypeInfo Pointer to dzxHeader - * @param unk3 unknown - * @param unk4 unknown - */ - bool actorInit( void* mStatus_roomControl, dzx::ChunkTypeInfo* chunkTypeInfo, int32_t unk3, void* unk4 ); +/** + * @brief Initialises Actors for current layer, can run multiple times per load + * + * @param mStatus_roomControl Pointer to roomControl data (unknown) + * @param chunkTypeInfo Pointer to dzxHeader + * @param unk3 unknown + * @param unk4 unknown + */ +bool actorInit(void *mStatus_roomControl, dzx::ChunkTypeInfo *chunkTypeInfo, + int32_t unk3, void *unk4); - /** - * @brief Initialises Actors for global layer, can run multiple times per load - * - * @param mStatus_roomControl Pointer to roomControl data (unknown) - * @param chunkTypeInfo Pointer to dzxHeader - * @param unk3 unknown - * @param unk4 unknown - */ - bool actorInit_always( void* mStatus_roomControl, dzx::ChunkTypeInfo* chunkTypeInfo, int32_t unk3, void* unk4 ); +/** + * @brief Initialises Actors for global layer, can run multiple times per load + * + * @param mStatus_roomControl Pointer to roomControl data (unknown) + * @param chunkTypeInfo Pointer to dzxHeader + * @param unk3 unknown + * @param unk4 unknown + */ +bool actorInit_always(void *mStatus_roomControl, + dzx::ChunkTypeInfo *chunkTypeInfo, int32_t unk3, + void *unk4); - /** - * @brief Creates an actor - * - * @param Actor Actor Object - * @param ActorMemoryPtr ActorPRMClass allocated for this Actor - */ - void ActorCreate( dzx::ACTR* actor, dzx::ActorPRMClass* actorMemoryPtr ); +/** + * @brief Creates an actor + * + * @param Actor Actor Object + * @param ActorMemoryPtr ActorPRMClass allocated for this Actor + */ +void ActorCreate(dzx::ACTR *actor, dzx::ActorPRMClass *actorMemoryPtr); - /** - * @brief Pointer to roomControl data - */ - extern void* mStatus_roomControl; - } -} // namespace libtp::tp::d_stage +/** + * @brief Pointer to roomControl data + */ +extern void *mStatus_roomControl; +} +} // namespace libtp::tp::d_stage #endif
\ No newline at end of file diff --git a/include/tp/dynamic_link.h b/include/tp/dynamic_link.h index 8353ae7..834910a 100644 --- a/include/tp/dynamic_link.h +++ b/include/tp/dynamic_link.h @@ -11,22 +11,19 @@ #include "gc_wii/OSModule.h" -namespace libtp::tp::dynamic_link -{ - // Should try to fill in the variables at some point - struct DynamicModuleControl - { - uint8_t unk_0[0x10]; - gc_wii::os_module::OSModuleInfo* moduleInfo; - uint8_t unk_10[0x18]; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::dynamic_link { +// Should try to fill in the variables at some point +struct DynamicModuleControl { + uint8_t unk_0[0x10]; + gc_wii::os_module::OSModuleInfo *moduleInfo; + uint8_t unk_10[0x18]; +} __attribute__((__packed__)); - // This size may not be correct - static_assert( sizeof( DynamicModuleControl ) == 0x2C ); +// This size may not be correct +static_assert(sizeof(DynamicModuleControl) == 0x2C); - extern "C" - { - bool do_link( DynamicModuleControl* dmc ); - } -} // namespace libtp::tp::dynamic_link +extern "C" { +bool do_link(DynamicModuleControl *dmc); +} +} // namespace libtp::tp::dynamic_link #endif
\ No newline at end of file diff --git a/include/tp/dzx.h b/include/tp/dzx.h index 41ffc23..8d0ca2a 100644 --- a/include/tp/dzx.h +++ b/include/tp/dzx.h @@ -1,5 +1,6 @@ /** @file dzx.h - * @brief dzr related definitions and structs, mainly used for working with actors + * @brief dzr related definitions and structs, mainly used for working with + *actors * * @author AECX * @author Zephiles @@ -11,88 +12,82 @@ #include <cstdint> -namespace libtp::tp::dzx -{ - /** - * @brief Base class for most/all? Actors - */ - struct ACTR - { - char objectName[8]; - uint32_t parameters; - float pos[3]; - int16_t rot[2]; - uint16_t flag; - uint16_t enemyID; - } __attribute__( ( __packed__ ) ); +namespace libtp::tp::dzx { +/** + * @brief Base class for most/all? Actors + */ +struct ACTR { + char objectName[8]; + uint32_t parameters; + float pos[3]; + int16_t rot[2]; + uint16_t flag; + uint16_t enemyID; +} __attribute__((__packed__)); - /** - * @brief Holds information about an ACTR of type TRES - */ - struct TRES - { - char actorName[8]; - uint32_t flags; - float pos[3]; - int32_t angle; - uint8_t item; - uint8_t unk2[3]; // Seems to always be 0xFF - } __attribute__( ( __packed__ ) ); +/** + * @brief Holds information about an ACTR of type TRES + */ +struct TRES { + char actorName[8]; + uint32_t flags; + float pos[3]; + int32_t angle; + uint8_t item; + uint8_t unk2[3]; // Seems to always be 0xFF +} __attribute__((__packed__)); - /** - * @brief Holds information about field a item ACTR (i.e rupees) - */ - struct ITEM - { - char objectName[8]; - uint8_t paramOne; - uint8_t paramTwo; - uint8_t membitFlag; - uint8_t item; - float pos[3]; - int16_t rot[3]; - uint16_t enemyNum; - } __attribute__( ( __packed__ ) ); +/** + * @brief Holds information about field a item ACTR (i.e rupees) + */ +struct ITEM { + char objectName[8]; + uint8_t paramOne; + uint8_t paramTwo; + uint8_t membitFlag; + uint8_t item; + float pos[3]; + int16_t rot[3]; + uint16_t enemyNum; +} __attribute__((__packed__)); - /** - * @brief Holds information about the given dzx Chunktype - * - * Example: - * TRES - * 0001 - * 80401234 = 1 TRES Chunk at this address - */ - struct ChunkTypeInfo - { - char tag[4]; - uint32_t numChunks; - void* chunkDataPtr; - }; +/** + * @brief Holds information about the given dzx Chunktype + * + * Example: + * TRES + * 0001 + * 80401234 = 1 TRES Chunk at this address + */ +struct ChunkTypeInfo { + char tag[4]; + uint32_t numChunks; + void *chunkDataPtr; +}; - /** - * @brief Used for spawning actors - */ - struct ActorPRMClass - { - int32_t params; +/** + * @brief Used for spawning actors + */ +struct ActorPRMClass { + int32_t params; - float pos[3]; + float pos[3]; - uint16_t xRot; - uint16_t yRot; + uint16_t xRot; + uint16_t yRot; - uint16_t flag; - int16_t enemy_id; + uint16_t flag; + int16_t enemy_id; - uint8_t flags[9]; - uint8_t room_id; + uint8_t flags[9]; + uint8_t room_id; - uint8_t padding[2]; - } __attribute__( ( __packed__ ) ); + uint8_t padding[2]; +} __attribute__((__packed__)); - static_assert( sizeof( ACTR ) == 0x20 ); - static_assert( sizeof( TRES ) == 0x20 ); - static_assert( sizeof( ITEM ) == 0x20 ); - static_assert( sizeof( ChunkTypeInfo ) == 0xC ); -} // namespace libtp::tp::dzx +static_assert(sizeof(ACTR) == 0x20); +static_assert(sizeof(TRES) == 0x20); +static_assert(sizeof(ITEM) == 0x20); +static_assert(sizeof(ChunkTypeInfo) == 0xC); +} // namespace libtp::tp::dzx #endif
\ No newline at end of file diff --git a/include/tp/evt_control.h b/include/tp/evt_control.h index de08e05..7f57b7c 100644 --- a/include/tp/evt_control.h +++ b/include/tp/evt_control.h @@ -10,29 +10,27 @@ #include <cstdint> -namespace libtp::tp::evt_control -{ - /** - * @brief A function that runs when a cutscene skip is performed - * - * @param unk Unknown pointer - * @param unk2 Unknown integer - * @return Unknown use. - */ - typedef int32_t( csSkipFunction )( void* unk, int32_t unk2 ); - extern "C" - { - /** - * @brief Runs when attempting to skip a function - * - * @param eventPtr Current event - * @return Unknown use. - */ - int32_t skipper( void* eventPtr ); +namespace libtp::tp::evt_control { +/** + * @brief A function that runs when a cutscene skip is performed + * + * @param unk Unknown pointer + * @param unk2 Unknown integer + * @return Unknown use. + */ +typedef int32_t(csSkipFunction)(void *unk, int32_t unk2); +extern "C" { +/** + * @brief Runs when attempting to skip a function + * + * @param eventPtr Current event + * @return Unknown use. + */ +int32_t skipper(void *eventPtr); - int32_t defaultSkipStb( void* unk, int32_t unk2 ); +int32_t defaultSkipStb(void *unk, int32_t unk2); - csSkipFunction defaultSkipStb; - } -} // namespace libtp::tp::evt_control +csSkipFunction defaultSkipStb; +} +} // namespace libtp::tp::evt_control #endif
\ No newline at end of file diff --git a/include/tp/f_ap_game.h b/include/tp/f_ap_game.h index 405edc5..d0caa94 100644 --- a/include/tp/f_ap_game.h +++ b/include/tp/f_ap_game.h @@ -7,14 +7,12 @@ #ifndef TP_F_AP_GAME_H #define TP_F_AP_GAME_H -namespace libtp::tp::f_ap_game -{ - extern "C" - { - /** - * @brief Runs once per frame - */ - void fapGm_Execute(); - } -} // namespace libtp::tp::f_ap_game +namespace libtp::tp::f_ap_game { +extern "C" { +/** + * @brief Runs once per frame + */ +void fapGm_Execute(); +} +} // namespace libtp::tp::f_ap_game #endif
\ No newline at end of file diff --git a/include/tp/f_op_actor_mng.h b/include/tp/f_op_actor_mng.h index 82549e6..0aa5022 100644 --- a/include/tp/f_op_actor_mng.h +++ b/include/tp/f_op_actor_mng.h @@ -11,152 +11,122 @@ #include "tp/dzx.h" -namespace libtp::tp::f_op_actor_mng -{ - extern "C" - { - /** - * @brief Runs when Link receives an item from a person - * - * Only runs for Demo items which is indicated by Link turning towards the - *camera - * with the item floating above his hands - * - * @param pos XYZ of the current TRES - * @param item Item ID - * @param unk3 Unknown - * @param unk4 Unknown - * @param unk5 Unknown - * @param unk6 Unknown - * @param unk7 Unknown - * @return Unknown use. - */ - int32_t createItemForPresentDemo( const float pos[3], - int32_t item, - uint8_t unk3, - int32_t unk4, - int32_t unk5, - const float unk6[3], - const float unk7[3] ); +namespace libtp::tp::f_op_actor_mng { +extern "C" { +/** + * @brief Runs when Link receives an item from a person + * + * Only runs for Demo items which is indicated by Link turning towards the + *camera + * with the item floating above his hands + * + * @param pos XYZ of the current TRES + * @param item Item ID + * @param unk3 Unknown + * @param unk4 Unknown + * @param unk5 Unknown + * @param unk6 Unknown + * @param unk7 Unknown + * @return Unknown use. + */ +int32_t createItemForPresentDemo(const float pos[3], int32_t item, uint8_t unk3, + int32_t unk4, int32_t unk5, + const float unk6[3], const float unk7[3]); - /** - * @brief Runs when Link receives an item by opening a treasure chest - * - * Only runs for Demo items which is indicated by Link turning towards the - *camera - * with the item floating above his hands - * - * @param pos XYZ of the current TRES - * @param item Item ID - * @param unk3 Unknown - * @param unk4 Unknown - * @param unk5 Unknown - * @param unk6 Unknown - * @return Unknown use. - */ - int32_t createItemForTrBoxDemo( const float pos[3], - int32_t item, - int32_t unk3, - int32_t unk4, - const float unk5[3], - const float unk6[3] ); +/** + * @brief Runs when Link receives an item by opening a treasure chest + * + * Only runs for Demo items which is indicated by Link turning towards the + *camera + * with the item floating above his hands + * + * @param pos XYZ of the current TRES + * @param item Item ID + * @param unk3 Unknown + * @param unk4 Unknown + * @param unk5 Unknown + * @param unk6 Unknown + * @return Unknown use. + */ +int32_t createItemForTrBoxDemo(const float pos[3], int32_t item, int32_t unk3, + int32_t unk4, const float unk5[3], + const float unk6[3]); - /** - * @brief Runs when the game creates a boss specific item (heart container) - * - * Can only create Heart Pieces/Heart Containers since these share the same - *actor - * other item ids will render the item unobtainable because the game - *skips/aborts creation - * - * @param pos XYZ of the TRES - * @param item Item ID - * @param unk3 Unknown - * @param unk4 Unknown - * @param unk5 Unknown - * @param unk6 Unknown - * @param unk7 Unknown - * @param unk8 Unknown - * @return Unknown use. - */ - int32_t createItemForBoss( const float pos[3], - int32_t item, - int32_t unk3, - const float unk4[3], - const float unk5[3], - float unk6, - float unk7, - int32_t unk8 ); +/** + * @brief Runs when the game creates a boss specific item (heart container) + * + * Can only create Heart Pieces/Heart Containers since these share the same + *actor + * other item ids will render the item unobtainable because the game + *skips/aborts creation + * + * @param pos XYZ of the TRES + * @param item Item ID + * @param unk3 Unknown + * @param unk4 Unknown + * @param unk5 Unknown + * @param unk6 Unknown + * @param unk7 Unknown + * @param unk8 Unknown + * @return Unknown use. + */ +int32_t createItemForBoss(const float pos[3], int32_t item, int32_t unk3, + const float unk4[3], const float unk5[3], float unk6, + float unk7, int32_t unk8); - /** - * @brief Runs when the game creates a mini-boss specific item (e.g. - *Boomerang, Ball and Chain, etc.) - * - * Similar to the createItemForBoss function this, unfortunately, doesn't - *work with actors - * that weren't meant to be created via this function (although most items - **should* work) - * - * @param pos XYZ of the TRES - * @param item Item ID - * @param unk3 Unknown - * @param unk4 Unknown - * @param unk5 Unknown - * @param unk6 Unknown - * @param unk7 Unknown - * @return Unknown use. - */ - int32_t createItemForMidBoss( const float pos[3], - int32_t item, - int32_t unk3, - const float unk4[3], - const float unk5[3], - int32_t unk6, - int32_t unk7 ); +/** + * @brief Runs when the game creates a mini-boss specific item (e.g. + *Boomerang, Ball and Chain, etc.) + * + * Similar to the createItemForBoss function this, unfortunately, doesn't + *work with actors + * that weren't meant to be created via this function (although most items + **should* work) + * + * @param pos XYZ of the TRES + * @param item Item ID + * @param unk3 Unknown + * @param unk4 Unknown + * @param unk5 Unknown + * @param unk6 Unknown + * @param unk7 Unknown + * @return Unknown use. + */ +int32_t createItemForMidBoss(const float pos[3], int32_t item, int32_t unk3, + const float unk4[3], const float unk5[3], + int32_t unk6, int32_t unk7); - /** - * @brief Runs when Link picks up a minor item - * - * This function will immediately handle a item pick up for items - * that are not being presented with a Text Box and Link turning towards - *the camera - * - * @param pos XYZ of the TRES - * @param item Item ID - * @param unk3 Unknown - * @param unk4 Unknown - * @param unk5 Unknown - * @param unk6 Unknown - * @param unk7 Unknown - * @return Unknown use. - */ - int32_t createItemForDirectGet( const float pos[3], - int32_t item, - int32_t unk3, - const float unk4[3], - const float unk5[3], - float unk6, - float unk7 ); +/** + * @brief Runs when Link picks up a minor item + * + * This function will immediately handle a item pick up for items + * that are not being presented with a Text Box and Link turning towards + *the camera + * + * @param pos XYZ of the TRES + * @param item Item ID + * @param unk3 Unknown + * @param unk4 Unknown + * @param unk5 Unknown + * @param unk6 Unknown + * @param unk7 Unknown + * @return Unknown use. + */ +int32_t createItemForDirectGet(const float pos[3], int32_t item, int32_t unk3, + const float unk4[3], const float unk5[3], + float unk6, float unk7); - /** - * @brief Prepares the game for spawning an actor - */ - dzx::ActorPRMClass* CreateAppend( void ); +/** + * @brief Prepares the game for spawning an actor + */ +dzx::ActorPRMClass *CreateAppend(void); - int32_t createItemForSimpleDemo( const float pos[3], - int32_t item, - int32_t unk3, - const int16_t rot[3], - const float scale[3], - float unk6, - float unk7 ); - int32_t createItem( const float pos[3], - int32_t item, - int32_t itemPickupFlag, - int32_t roomNo, - const int16_t rot[3], - const float scale[3], - int32_t itemAction ); - } -} // namespace libtp::tp::f_op_actor_mng +int32_t createItemForSimpleDemo(const float pos[3], int32_t item, int32_t unk3, + const int16_t rot[3], const float scale[3], + float unk6, float unk7); +int32_t createItem(const float pos[3], int32_t item, int32_t itemPickupFlag, + int32_t roomNo, const int16_t rot[3], const float scale[3], + int32_t itemAction); +} +} // namespace libtp::tp::f_op_actor_mng #endif
\ No newline at end of file diff --git a/include/tp/f_op_scene_req.h b/include/tp/f_op_scene_req.h index 244823e..67bd433 100644 --- a/include/tp/f_op_scene_req.h +++ b/include/tp/f_op_scene_req.h @@ -9,12 +9,10 @@ #include <cstdint> -namespace libtp::tp::f_op_scene_req -{ - extern "C" - { - extern bool freezeActors; // Freezes all actors - extern int32_t isLoading; // Current loading status - } -} // namespace libtp::tp::f_op_scene_req +namespace libtp::tp::f_op_scene_req { +extern "C" { +extern bool freezeActors; // Freezes all actors +extern int32_t isLoading; // Current loading status +} +} // namespace libtp::tp::f_op_scene_req #endif
\ No newline at end of file diff --git a/include/tp/f_pc_node_req.h b/include/tp/f_pc_node_req.h index 0cde546..44108f1 100644 --- a/include/tp/f_pc_node_req.h +++ b/include/tp/f_pc_node_req.h @@ -9,12 +9,10 @@ #include <cstdint> -namespace libtp::tp::f_pc_node_req -{ - extern "C" - { - // TODO: Figure out full class structure and inheritance - extern void* l_fpcNdRq_Queue; - } -} // namespace libtp::tp::f_pc_node_req +namespace libtp::tp::f_pc_node_req { +extern "C" { +// TODO: Figure out full class structure and inheritance +extern void *l_fpcNdRq_Queue; +} +} // namespace libtp::tp::f_pc_node_req #endif
\ No newline at end of file diff --git a/include/tp/m_do_controller_pad.h b/include/tp/m_do_controller_pad.h index 7fa9660..d1f5f21 100644 --- a/include/tp/m_do_controller_pad.h +++ b/include/tp/m_do_controller_pad.h @@ -10,51 +10,47 @@ #include <cstdint> -namespace libtp::tp::m_do_controller_pad -{ - /** - * @brief Controller inputs - */ - enum PadInputs : uint32_t - { - Button_DPad_Left = 0x00000001, - Button_DPad_Right = 0x00000002, - Button_DPad_Down = 0x00000004, - Button_DPad_Up = 0x00000008, - Button_Z = 0x00000010, - Button_R = 0x00000020, - Button_L = 0x00000040, - Button_A = 0x00000100, - Button_B = 0x00000200, - Button_X = 0x00000400, - Button_Y = 0x00000800, - Button_Start = 0x00001000, - Stick_C_Left = 0x00010000, - Stick_C_Right = 0x00020000, - Stick_C_Down = 0x00040000, - Stick_C_Up = 0x00080000, - Stick_Left = 0x01000000, - Stick_Right = 0x02000000, - Stick_Down = 0x04000000, - Stick_Up = 0x08000000 - }; +namespace libtp::tp::m_do_controller_pad { +/** + * @brief Controller inputs + */ +enum PadInputs : uint32_t { + Button_DPad_Left = 0x00000001, + Button_DPad_Right = 0x00000002, + Button_DPad_Down = 0x00000004, + Button_DPad_Up = 0x00000008, + Button_Z = 0x00000010, + Button_R = 0x00000020, + Button_L = 0x00000040, + Button_A = 0x00000100, + Button_B = 0x00000200, + Button_X = 0x00000400, + Button_Y = 0x00000800, + Button_Start = 0x00001000, + Stick_C_Left = 0x00010000, + Stick_C_Right = 0x00020000, + Stick_C_Down = 0x00040000, + Stick_C_Up = 0x00080000, + Stick_Left = 0x01000000, + Stick_Right = 0x02000000, + Stick_Down = 0x04000000, + Stick_Up = 0x08000000 +}; - /** - * @todo Fill missing vars. - */ - struct CPadInfo - { - uint8_t unk_0[0x30]; - uint32_t buttonInput; - uint32_t buttonInputTrg; - uint8_t unk_38[0xC8]; - } __attribute__( ( __packed__ ) ); +/** + * @todo Fill missing vars. + */ +struct CPadInfo { + uint8_t unk_0[0x30]; + uint32_t buttonInput; + uint32_t buttonInputTrg; + uint8_t unk_38[0xC8]; +} __attribute__((__packed__)); - static_assert( sizeof( CPadInfo ) == 0x100 ); +static_assert(sizeof(CPadInfo) == 0x100); - extern "C" - { - extern CPadInfo cpadInfo; - } -} // namespace libtp::tp::m_do_controller_pad +extern "C" { +extern CPadInfo cpadInfo; +} +} // namespace libtp::tp::m_do_controller_pad #endif
\ No newline at end of file diff --git a/include/tp/m_do_ext.h b/include/tp/m_do_ext.h index 529a226..37e69ce 100644 --- a/include/tp/m_do_ext.h +++ b/include/tp/m_do_ext.h @@ -7,11 +7,9 @@ #ifndef TP_M_DO_EXT_H #define TP_M_DO_EXT_H -namespace libtp::tp::m_Do_ext -{ - extern "C" - { - extern void* archiveHeap; // Archive heap pointer - } -} // namespace libtp::tp::m_Do_ext +namespace libtp::tp::m_Do_ext { +extern "C" { +extern void *archiveHeap; // Archive heap pointer +} +} // namespace libtp::tp::m_Do_ext #endif
\ No newline at end of file diff --git a/include/tp/resource.h b/include/tp/resource.h index 7172126..a338c7f 100644 --- a/include/tp/resource.h +++ b/include/tp/resource.h @@ -8,30 +8,28 @@ #ifndef TP_RESOURCE_H #define TP_RESOURCE_H -namespace libtp::tp::resource -{ - extern "C" - { - /** - * @brief Parses through the current character - * - * @returns char to be processed - */ - char parseCharacter_1Byte( const char** text ); - } +namespace libtp::tp::resource { +extern "C" { +/** + * @brief Parses through the current character + * + * @returns char to be processed + */ +char parseCharacter_1Byte(const char **text); +} - // Macros for custom messages -#define MSG_BEGIN( name ) char* name = +// Macros for custom messages +#define MSG_BEGIN(name) char *name = -#define MSG_BEGIN_CONST( name ) const char* name = +#define MSG_BEGIN_CONST(name) const char *name = #define MSG_END() ; -#define MSG_SPEED( speed ) "\x1A\x05\x00\x00" speed +#define MSG_SPEED(speed) "\x1A\x05\x00\x00" speed -#define MSG_COLOR( id ) "\x1A\x06\xFF\x00\x00" id +#define MSG_COLOR(id) "\x1A\x06\xFF\x00\x00" id - // Message Text Color Values +// Message Text Color Values #define MSG_COLOR_WHITE "\x00" #define MSG_COLOR_RED "\x01" #define MSG_COLOR_GREEN "\x02" @@ -39,5 +37,5 @@ namespace libtp::tp::resource #define MSG_COLOR_YELLOW "\x04" #define MSG_COLOR_PURPLE "\x06" #define MSG_COLOR_ORANGE "\x08" -} // namespace libtp::tp::resource +} // namespace libtp::tp::resource #endif
\ No newline at end of file |