dmnt: Fix debug log for cheats

This commit is contained in:
german77 2024-02-04 12:39:07 -06:00 committed by SciresM
parent 000e382c42
commit 615f8a3ef3

View file

@ -46,8 +46,11 @@ namespace ams::dmnt::cheat::impl {
void CheatVirtualMachine::OpenDebugLogFile() { void CheatVirtualMachine::OpenDebugLogFile() {
#ifdef DMNT_CHEAT_VM_DEBUG_LOG #ifdef DMNT_CHEAT_VM_DEBUG_LOG
CloseDebugLogFile(); CloseDebugLogFile();
R_ABORT_UNLESS(fs::OpenFile(std::addressof(m_debug_log_file), "sdmc:/atmosphere/cheat_vm_logs/debug_log.txt")); fs::EnsureDirectory("sdmc:/atmosphere/cheat_vm_logs");
fs::CreateFile("sdmc:/atmosphere/cheat_vm_logs/debug_log.txt", 0);
R_ABORT_UNLESS(fs::OpenFile(std::addressof(m_debug_log_file), "sdmc:/atmosphere/cheat_vm_logs/debug_log.txt", fs::OpenMode_Write | fs::OpenMode_AllowAppend));
m_debug_log_file_offset = 0; m_debug_log_file_offset = 0;
m_has_debug_log_file = true;
#endif #endif
} }
@ -80,7 +83,8 @@ namespace ams::dmnt::cheat::impl {
fmt_len += 1; fmt_len += 1;
} }
fs::WriteFile(m_debug_log_file, m_debug_log_offset, m_debug_log_format_buf, fmt_len, fs::WriteOption::Flush); fs::WriteFile(m_debug_log_file, m_debug_log_file_offset, m_debug_log_format_buf, fmt_len, fs::WriteOption::Flush);
m_debug_log_file_offset += fmt_len;
#else #else
AMS_UNUSED(format); AMS_UNUSED(format);
#endif #endif