Skip to content

Commit

Permalink
[Payload] Treat all warnings as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeIsAStar authored and MikeIsAStar committed Jan 26, 2024
1 parent 4223ad4 commit a7bb71f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
4 changes: 4 additions & 0 deletions payload/import/mkwItem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace mkw::Item
{

#if RMC

enum class ItemBox {
GreenShell = 0x00,
RedShell = 0x01,
Expand Down Expand Up @@ -273,4 +275,6 @@ static ItemBox ItemObjectToItemBox(ItemObject itemObject)
}
}

#endif

} // namespace mkw::Item
4 changes: 4 additions & 0 deletions payload/import/mkwRegistry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace mkw::Registry
{

#if RMC

enum class Character {
Mario = 0x00,
BabyPeach = 0x01,
Expand Down Expand Up @@ -195,4 +197,6 @@ static bool IsBattleCourse(Course course)
return course >= Course::DelfinoPier && course <= Course::N64Skyscraper;
}

#endif

} // namespace mkw::Registry
2 changes: 1 addition & 1 deletion payload/make-payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def build(game):
if key != "Title":
flags.append("-D" + key + "=" + value)

flags += ["-g", "-Os", "-fPIE", "-std=c++20", "-n", "-fno-rtti", "-fno-exceptions", "-ffunction-sections", "-fdata-sections", "-Wl,--gc-sections", "-Wno-address-of-packed-member"]
flags += ["-g", "-Os", "-fPIE", "-std=c++20", '-Wall', '-Werror', "-n", "-fno-rtti", "-fno-exceptions", "-ffunction-sections", "-fdata-sections", "-Wl,--gc-sections", "-Wno-address-of-packed-member"]
flags += extra_build_flags

out_path = os.path.join("build", game["Title"])
Expand Down
10 changes: 5 additions & 5 deletions payload/wwfcError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ char* HandleWWFCErrorMessage(char* strstrResult, const char* command)
}

// TODO: Convert UTF-8 to UTF-16 properly
int i = 0;
for (; value[i] != '\0' && i < (sizeof(s_wwfcErrorMsg) / sizeof(u16)) - 1;
i++) {
s_wwfcErrorMsg[i] = value[i];
size_t n = 0;
for (; value[n] != '\0' && n < (sizeof(s_wwfcErrorMsg) / sizeof(u16)) - 1;
n++) {
s_wwfcErrorMsg[n] = value[n];
}
s_wwfcErrorMsg[i] = '\0';
s_wwfcErrorMsg[n] = '\0';

s_wwfcErrorCode = error;

Expand Down
12 changes: 6 additions & 6 deletions payload/wwfcLogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,17 @@ static u64 DecodeUintString(const char* str, u32 bitCount)
{
u64 value = 0;

for (int i = 0; i < (bitCount >> 2); i++) {
for (u32 n = 0; n < (bitCount >> 2); n++) {
u8 nybble = 0;
if (str[i] >= '0' && str[i] <= '9') {
nybble = str[i] - '0';
} else if (str[i] >= 'a' && str[i] <= 'f') {
nybble = (str[i] - 'a') + 0xA;
if (str[n] >= '0' && str[n] <= '9') {
nybble = str[n] - '0';
} else if (str[n] >= 'a' && str[n] <= 'f') {
nybble = (str[n] - 'a') + 0xA;
} else {
return 0;
}

value |= u64(nybble) << ((bitCount - 4) - i * 4);
value |= u64(nybble) << ((bitCount - 4) - n * 4);
}

return value;
Expand Down

0 comments on commit a7bb71f

Please sign in to comment.