ams: use util::SNPrintf over std:: (size/linker improvements)
This commit is contained in:
@@ -970,7 +970,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
fs::FileHandle file;
|
||||
{
|
||||
char path[fs::EntryNameLengthMax + 1];
|
||||
std::snprintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/%02x%02x%02x%02x%02x%02x%02x%02x.txt", program_id.value,
|
||||
util::SNPrintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/%02x%02x%02x%02x%02x%02x%02x%02x.txt", program_id.value,
|
||||
build_id[0], build_id[1], build_id[2], build_id[3], build_id[4], build_id[5], build_id[6], build_id[7]);
|
||||
if (R_FAILED(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Read))) {
|
||||
return false;
|
||||
@@ -1009,7 +1009,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
fs::FileHandle file;
|
||||
{
|
||||
char path[fs::EntryNameLengthMax + 1];
|
||||
std::snprintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/toggles.txt", program_id.value);
|
||||
util::SNPrintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/toggles.txt", program_id.value);
|
||||
if (R_FAILED(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Read))) {
|
||||
/* No file presence is allowed. */
|
||||
return true;
|
||||
@@ -1046,7 +1046,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
fs::FileHandle file;
|
||||
{
|
||||
char path[fs::EntryNameLengthMax + 1];
|
||||
std::snprintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/toggles.txt", program_id.value);
|
||||
util::SNPrintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/cheats/toggles.txt", program_id.value);
|
||||
fs::DeleteFile(path);
|
||||
fs::CreateFile(path, 0);
|
||||
if (R_FAILED(fs::OpenFile(std::addressof(file), path, fs::OpenMode_Write | fs::OpenMode_AllowAppend))) {
|
||||
@@ -1061,7 +1061,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
/* Save all non-master cheats. */
|
||||
for (size_t i = 1; i < MaxCheatCount; i++) {
|
||||
if (this->cheat_entries[i].definition.num_opcodes != 0) {
|
||||
std::snprintf(buf, sizeof(buf), "[%s]\n", this->cheat_entries[i].definition.readable_name);
|
||||
util::SNPrintf(buf, sizeof(buf), "[%s]\n", this->cheat_entries[i].definition.readable_name);
|
||||
const size_t name_len = std::strlen(buf);
|
||||
if (R_SUCCEEDED(fs::WriteFile(file, offset, buf, name_len, fs::WriteOption::Flush))) {
|
||||
offset += name_len;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
fs::FileHandle log_file;
|
||||
{
|
||||
char log_path[fs::EntryNameLengthMax + 1];
|
||||
std::snprintf(log_path, sizeof(log_path), "sdmc:/atmosphere/cheat_vm_logs/%08x.log", log_id);
|
||||
util::SNPrintf(log_path, sizeof(log_path), "sdmc:/atmosphere/cheat_vm_logs/%08x.log", log_id);
|
||||
if (R_FAILED(fs::OpenFile(std::addressof(log_file), log_path, fs::OpenMode_Write | fs::OpenMode_AllowAppend))) {
|
||||
return;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
}
|
||||
|
||||
char log_value[18];
|
||||
std::snprintf(log_value, sizeof(log_value), "%016lx\n", value);
|
||||
util::SNPrintf(log_value, sizeof(log_value), "%016lx\n", value);
|
||||
fs::WriteFile(log_file, log_offset, log_value, std::strlen(log_value), fs::WriteOption::Flush);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace ams::dmnt::cheat::impl {
|
||||
{
|
||||
std::va_list vl;
|
||||
va_start(vl, format);
|
||||
std::vsnprintf(this->debug_log_format_buf, sizeof(this->debug_log_format_buf) - 1, format, vl);
|
||||
util::VSNPrintf(this->debug_log_format_buf, sizeof(this->debug_log_format_buf) - 1, format, vl);
|
||||
va_end(vl);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user