Skip to content

Commit

Permalink
xex1tool: fix some clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Oct 30, 2024
1 parent e18f38b commit 3e214c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 0 additions & 2 deletions xdbf/xdbf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ namespace kernel {
namespace xam {
namespace xdbf {

constexpr uint32_t kXdbfMagicXdbf = 'XDBF';

bool XdbfFile::Read(const uint8_t* data, size_t data_size) {
if (!data || data_size <= sizeof(X_XDBF_HEADER)) {
return false;
Expand Down
12 changes: 7 additions & 5 deletions xdbf/xdbf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ namespace xdbf {
// https://github.com/oukiar/freestyledash/blob/master/Freestyle/Tools/XEX/SPA.h
// https://github.com/oukiar/freestyledash/blob/master/Freestyle/Tools/XEX/SPA.cpp

constexpr uint32_t kXdbfMagicXdbf = 0x46424458; // XDBF

enum class SpaID : uint64_t {
Xach = 'XACH',
Xstr = 'XSTR',
Xstc = 'XSTC',
Xthd = 'XTHD',
Xach = 0x48434158, // XACH
Xstr = 0x52545358, // XSTR
Xstc = 0x43545358, // XSTC
Xthd = 0x44485458, // XTHD
Title = 0x8000,
};

Expand Down Expand Up @@ -161,7 +163,7 @@ struct Entry {
class XdbfFile {
public:
XdbfFile() {
header_.magic = 'XDBF';
header_.magic = kXdbfMagicXdbf;
header_.version = 1;
}

Expand Down
17 changes: 9 additions & 8 deletions xex1tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <iostream>
#include <cstdio>
#include <filesystem>
#include <cinttypes>

#include "3rdparty/cxxopts.hpp"
#include "3rdparty/date.hpp"
Expand Down Expand Up @@ -98,9 +99,9 @@ void PrintImports(XEXFile& xex) {
{
auto& table_header = tables.at(libname);

printf("# %s v%d.%d.%d.%d\n# (min v%d.%d.%d.%d, %llu imports)\n", libname.c_str(),
printf("# %s v%d.%d.%d.%d\n# (min v%d.%d.%d.%d, %d imports)\n", libname.c_str(),
table_header.Version.Major, table_header.Version.Minor, table_header.Version.Build, table_header.Version.QFE,
table_header.VersionMin.Major, table_header.VersionMin.Minor, table_header.VersionMin.Build, table_header.VersionMin.QFE, lib.second.size());
table_header.VersionMin.Major, table_header.VersionMin.Minor, table_header.VersionMin.Build, table_header.VersionMin.QFE, int(lib.second.size()));

version = table_header.Version.Build;
}
Expand Down Expand Up @@ -603,13 +604,13 @@ void PrintInfo(XEXFile& xex, bool print_mem_pages)
// TODO: print these as strings!
if (time_range)
{
printf(" Start Date: %llX\n", (uint64_t)time_range->Start);
printf(" End Date: %llX\n", (uint64_t)time_range->End);
printf(" Start Date: %" PRIX64 "\n", (uint64_t)time_range->Start);
printf(" End Date: %" PRIX64 "\n", (uint64_t)time_range->End);
}
if (kv_privs)
{
printf(" KeyVault Mask: %llX\n", (uint64_t)kv_privs->Mask);
printf(" KeyVault Value: %llX\n", (uint64_t)kv_privs->Match);
printf(" KeyVault Mask: %" PRIX64 "\n", (uint64_t)kv_privs->Mask);
printf(" KeyVault Value: %" PRIX64 "\n", (uint64_t)kv_privs->Match);
}
// TODO: consoleID table
}
Expand Down Expand Up @@ -896,15 +897,15 @@ int main(int argc, char* argv[])

if (!result.count("positional"))
{
printf(options.help().c_str());
printf("%s", options.help().c_str());
return 0;
}

auto& positional = result["positional"].as<std::vector<std::string>>();

if (!positional.size())
{
printf(options.help().c_str());
printf("%s", options.help().c_str());
return 0;
}

Expand Down

0 comments on commit 3e214c6

Please sign in to comment.