Use <string.h> & <3ds/exheader.h>, fix some bugs, etc.

also fix all warnings and use -Werror
This commit is contained in:
TuxSH
2018-05-24 00:55:38 +02:00
parent e6b7dc1dc5
commit d28e961adc
85 changed files with 276 additions and 643 deletions

View File

@@ -1080,7 +1080,8 @@ static void Cheat_LoadCheatsIntoMemory(u64 titleId)
cheat = Cheat_AllocCheat();
}
}
strncpy(cheat->name, line, 39);
strncpy(cheat->name, line, 38);
cheat->name[38] = '\0';
}
}
} while (R_SUCCEEDED(res));
@@ -1225,7 +1226,7 @@ void RosalinaMenu_Cheats(void)
}
else
{
Draw_DrawFormattedString(10, 10, COLOR_TITLE, "ERROR: %08x", r);
Draw_DrawFormattedString(10, 10, COLOR_TITLE, "ERROR: %08lx", r);
Draw_DrawFormattedString(10, 30, COLOR_RED, failureReason);
}
Draw_FlushFramebuffer();

View File

@@ -103,7 +103,7 @@ void DebuggerMenu_EnableDebugger(void)
}
if(res != 0)
sprintf(buf, "Starting debugger... failed (0x%08x).", (u32)res);
sprintf(buf, "Starting debugger... failed (0x%08lx).", (u32)res);
done = true;
}
@@ -135,7 +135,7 @@ void DebuggerMenu_DisableDebugger(void)
}
if(res != 0)
sprintf(buf, "Failed to disable debugger (0x%08x).", (u32)res);
sprintf(buf, "Failed to disable debugger (0x%08lx).", (u32)res);
do
{

View File

@@ -78,7 +78,7 @@ void MiscellaneousMenu_SwitchBoot3dsxTargetTitle(void)
miscellaneousMenu.items[0].title = "Switch the hb. title to hblauncher_loader";
}
else if(R_FAILED(res))
sprintf(failureReason, "%08x", (u32)res);
sprintf(failureReason, "%08lx", (u32)res);
else
{
res = -1;
@@ -175,7 +175,7 @@ void MiscellaneousMenu_SaveSettings(void)
IFile file;
u64 total;
struct PACKED
struct PACKED ALIGN(4)
{
char magic[4];
u16 formatVersionMajor, formatVersionMinor;
@@ -227,7 +227,7 @@ void MiscellaneousMenu_SaveSettings(void)
if(R_SUCCEEDED(res))
Draw_DrawString(10, 30, COLOR_WHITE, "Operation succeeded.");
else
Draw_DrawFormattedString(10, 30, COLOR_WHITE, "Operation failed (0x%08x).", res);
Draw_DrawFormattedString(10, 30, COLOR_WHITE, "Operation failed (0x%08lx).", res);
Draw_FlushFramebuffer();
Draw_Unlock();
}
@@ -252,7 +252,7 @@ void MiscellaneousMenu_InputRedirection(void)
svcCloseHandle(inputRedirectionThreadStartedEvent);
if(res != 0)
sprintf(buf, "Failed to stop InputRedirection (0x%08x).", (u32)res);
sprintf(buf, "Failed to stop InputRedirection (0x%08lx).", (u32)res);
else
miscellaneousMenu.items[2].title = "Start InputRedirection";
}
@@ -308,7 +308,7 @@ void MiscellaneousMenu_InputRedirection(void)
}
if(res != 0)
sprintf(buf, "Starting InputRedirection... failed (0x%08x).", (u32)res);
sprintf(buf, "Starting InputRedirection... failed (0x%08lx).", (u32)res);
else
miscellaneousMenu.items[2].title = "Stop InputRedirection";

View File

@@ -50,7 +50,7 @@ void N3DSMenu_UpdateStatus(void)
svcGetSystemInfo(&L2CacheEnabled, 0x10001, 2);
N3DSMenu.items[0].title = L2CacheEnabled ? "Disable L2 cache" : "Enable L2 cache";
sprintf(clkRateBuf, "Set clock rate to %uMHz", clkRate != 268 ? 268 : (u32)higherClkRate);
sprintf(clkRateBuf, "Set clock rate to %luMHz", clkRate != 268 ? 268 : (u32)higherClkRate);
}
void N3DSMenu_ChangeClockRate(void)

View File

@@ -73,11 +73,11 @@ static inline int ProcessListMenu_FormatInfoLine(char *out, const ProcessInfo *i
else
{
checkbox = "(W) ";
sprintf(commentBuf, "Port: %d", GDB_PORT_BASE + id);
sprintf(commentBuf, "Port: %ld", GDB_PORT_BASE + id);
}
}
return sprintf(out, "%s%-4u %-8.8s %s", checkbox, info->pid, info->name, commentBuf); // Theoritically PIDs are 32-bit ints, but we'll only justify 4 digits
return sprintf(out, "%s%-4lu %-8.8s %s", checkbox, info->pid, info->name, commentBuf); // Theoritically PIDs are 32-bit ints, but we'll only justify 4 digits
}
static void ProcessListMenu_DumpMemory(const char *name, void *start, u32 size)