Fix compiler warnings

This commit is contained in:
Maschell 2020-06-17 14:36:41 +02:00
parent bcbab81885
commit 161102a82c
3 changed files with 14 additions and 13 deletions

View File

@ -37,6 +37,7 @@ WUPS_PLUGIN_AUTHOR("Maschell");
WUPS_PLUGIN_LICENSE("GPL"); WUPS_PLUGIN_LICENSE("GPL");
#define UPPER_TITLE_ID_HOMEBREW 0x0005000F #define UPPER_TITLE_ID_HOMEBREW 0x0005000F
#define TITLE_ID_HOMEBREW_MASK (((uint64_t) UPPER_TITLE_ID_HOMEBREW) << 16)
char gIconCache[65580] __attribute__((section(".data"))); char gIconCache[65580] __attribute__((section(".data")));
ACPMetaXml gLaunchXML __attribute__((section(".data"))); ACPMetaXml gLaunchXML __attribute__((section(".data")));
@ -165,7 +166,7 @@ DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t *outTitleCount,
// System apps don't have a splash screen. // System apps don't have a splash screen.
template_title.appType = MCP_APP_TYPE_SYSTEM_APPS; template_title.appType = MCP_APP_TYPE_SYSTEM_APPS;
} }
template_title.titleId = UPPER_TITLE_ID_HOMEBREW << 16 | gFileInfos[j].lowerTitleID; template_title.titleId = TITLE_ID_HOMEBREW_MASK | gFileInfos[j].lowerTitleID;
template_title.titleVersion = 1; template_title.titleVersion = 1;
template_title.groupId = 0x400; template_title.groupId = 0x400;
@ -193,7 +194,7 @@ DECL_FUNCTION(int32_t, MCP_GetTitleInfoByTitleAndDevice, uint32_t mcp_handle, ui
char buffer[25]; char buffer[25];
snprintf(buffer, 25, "/custom/%08X%08X", titleid_upper, titleid_lower_2); snprintf(buffer, 25, "/custom/%08X%08X", titleid_upper, titleid_lower_2);
strcpy(template_title.path, buffer); strcpy(template_title.path, buffer);
template_title.titleId = UPPER_TITLE_ID_HOMEBREW << 16 | titleid_lower_1; template_title.titleId = TITLE_ID_HOMEBREW_MASK | titleid_lower_1;
memcpy(title, &(template_title), sizeof(MCPTitleListType)); memcpy(title, &(template_title), sizeof(MCPTitleListType));
return 0; return 0;
} }
@ -213,7 +214,7 @@ typedef struct __attribute((packed)) {
int32_t getRPXInfoForID(uint32_t id, romfs_fileInfo *info); int32_t getRPXInfoForID(uint32_t id, romfs_fileInfo *info);
DECL_FUNCTION(int32_t, ACPCheckTitleLaunchByTitleListTypeEx, MCPTitleListType *title, uint32_t u2) { DECL_FUNCTION(int32_t, ACPCheckTitleLaunchByTitleListTypeEx, MCPTitleListType *title, uint32_t u2) {
if ((title->titleId & (UPPER_TITLE_ID_HOMEBREW << 16)) == (UPPER_TITLE_ID_HOMEBREW << 16)) { if ((title->titleId & TITLE_ID_HOMEBREW_MASK) == TITLE_ID_HOMEBREW_MASK) {
int32_t id = getIDByLowerTitleID(title->titleId & 0xFFFFFFFF); int32_t id = getIDByLowerTitleID(title->titleId & 0xFFFFFFFF);
if (id > 0) { if (id > 0) {
DEBUG_FUNCTION_LINE("Started homebrew\n"); DEBUG_FUNCTION_LINE("Started homebrew\n");
@ -261,10 +262,10 @@ DECL_FUNCTION(int32_t, ACPCheckTitleLaunchByTitleListTypeEx, MCPTitleListType *t
} }
DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path, const char *mode, int *handle, int error) { DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path, const char *mode, int *handle, int error) {
char *start = "/vol/storage_mlc01/sys/title/0005000F"; const char *start = "/vol/storage_mlc01/sys/title/0005000F";
char *icon = ".tga"; const char *icon = ".tga";
char *iconTex = "iconTex.tga"; const char *iconTex = "iconTex.tga";
char *sound = ".btsnd"; const char *sound = ".btsnd";
if (StringTools::EndsWith(path, icon) || StringTools::EndsWith(path, sound)) { if (StringTools::EndsWith(path, icon) || StringTools::EndsWith(path, sound)) {
if (strncmp(path, start, strlen(start)) == 0) { if (strncmp(path, start, strlen(start)) == 0) {
@ -325,7 +326,7 @@ DECL_FUNCTION(FSStatus, FSCloseFile, FSClient *client, FSCmdBlock *block, FSFile
DECL_FUNCTION(FSStatus, FSReadFile, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags) { DECL_FUNCTION(FSStatus, FSReadFile, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags) {
if (handle == 0x13371337) { if (handle == 0x13371337) {
int cpySize = size * count; uint32_t cpySize = size * count;
if (sizeof(gIconCache) < cpySize) { if (sizeof(gIconCache) < cpySize) {
cpySize = sizeof(gIconCache); cpySize = sizeof(gIconCache);
} }

View File

@ -16,13 +16,13 @@ int readFile(int slot, uint8_t *buffer, uint32_t size) {
return read(info->fd, buffer, size); return read(info->fd, buffer, size);
} else { } else {
int startValue = info->strm.total_out; int startValue = info->strm.total_out;
int newSize = 0; uint32_t newSize = 0;
int ret = 0; int ret = 0;
//DEBUG_FUNCTION_LINE("We want to read %d\n", size); //DEBUG_FUNCTION_LINE("We want to read %d\n", size);
//DEBUG_FUNCTION_LINE("startValue %d \n",startValue); //DEBUG_FUNCTION_LINE("startValue %d \n",startValue);
do { do {
int CHUNK = 0x1000; int CHUNK = 0x1000;
int nextOut = CHUNK; uint32_t nextOut = CHUNK;
if (nextOut > size) { if (nextOut > size) {
nextOut = size; nextOut = size;
} }
@ -69,7 +69,7 @@ int readFile(int slot, uint8_t *buffer, uint32_t size) {
return ret; return ret;
} }
int canBeWritten = CHUNK - info->strm.avail_out; //int canBeWritten = CHUNK - info->strm.avail_out;
//DEBUG_FUNCTION_LINE("canBeWritten = %d\n",canBeWritten); //DEBUG_FUNCTION_LINE("canBeWritten = %d\n",canBeWritten);
newSize = info->strm.total_out - startValue; newSize = info->strm.total_out - startValue;
@ -151,7 +151,7 @@ bool initCompressedFileReadInformation(fileReadInformation *info) {
} }
int32_t loadFileIntoBuffer(uint32_t id, char *filepath, char *buffer, int sizeToRead) { int32_t loadFileIntoBuffer(uint32_t id, const char *filepath, char *buffer, int sizeToRead) {
if (!mountRomfs(id)) { if (!mountRomfs(id)) {
return -1; return -1;
} }

View File

@ -26,7 +26,7 @@ bool DeInitFile(int slot);
void DeInitAllFiles(); void DeInitAllFiles();
int32_t loadFileIntoBuffer(uint32_t id, char *filepath, char *buffer, int sizeToRead); int32_t loadFileIntoBuffer(uint32_t id, const char *filepath, char *buffer, int sizeToRead);
int32_t FSOpenFile_for_ID(uint32_t id, const char *filepath, int *handle); int32_t FSOpenFile_for_ID(uint32_t id, const char *filepath, int *handle);