Core: Convert logging over to fmt pt.2
Continues the core migration of logs up to the EXI handling code.
This commit is contained in:
parent
858d7612ef
commit
a0f9b041a0
|
@ -253,7 +253,7 @@ u32 AnalyzeCommand(const u8* data, DecodeMode mode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlert("FifoPlayer: Unknown Opcode (0x%x).\n", cmd);
|
PanicAlertFmt("FifoPlayer: Unknown Opcode ({:#x}).\n", cmd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -215,8 +215,8 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
|
||||||
|
|
||||||
if (header.fileId != FILE_ID || header.min_loader_version > VERSION_NUMBER)
|
if (header.fileId != FILE_ID || header.min_loader_version > VERSION_NUMBER)
|
||||||
{
|
{
|
||||||
CriticalAlertT(
|
CriticalAlertFmtT(
|
||||||
"The DFF's minimum loader version (%d) exceeds the version of this FIFO Player (%d)",
|
"The DFF's minimum loader version ({0}) exceeds the version of this FIFO Player ({1})",
|
||||||
header.min_loader_version, VERSION_NUMBER);
|
header.min_loader_version, VERSION_NUMBER);
|
||||||
file.Close();
|
file.Close();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -257,13 +257,13 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
|
||||||
if (header.mem1_size != Memory::GetRamSizeReal() ||
|
if (header.mem1_size != Memory::GetRamSizeReal() ||
|
||||||
header.mem2_size != Memory::GetExRamSizeReal())
|
header.mem2_size != Memory::GetExRamSizeReal())
|
||||||
{
|
{
|
||||||
CriticalAlertT("Emulated memory size mismatch!\n"
|
CriticalAlertFmtT("Emulated memory size mismatch!\n"
|
||||||
"Current: MEM1 %08X (%3d MiB), MEM2 %08X (%3d MiB)\n"
|
"Current: MEM1 {0:08X} ({1} MiB), MEM2 {2:08X} ({3} MiB)\n"
|
||||||
"DFF: MEM1 %08X (%3d MiB), MEM2 %08X (%3d MiB)",
|
"DFF: MEM1 {4:08X} ({5} MiB), MEM2 {6:08X} ({7} MiB)",
|
||||||
Memory::GetRamSizeReal(), Memory::GetRamSizeReal() / 0x100000,
|
Memory::GetRamSizeReal(), Memory::GetRamSizeReal() / 0x100000,
|
||||||
Memory::GetExRamSizeReal(), Memory::GetExRamSizeReal() / 0x100000,
|
Memory::GetExRamSizeReal(), Memory::GetExRamSizeReal() / 0x100000,
|
||||||
header.mem1_size, header.mem1_size / 0x100000, header.mem2_size,
|
header.mem1_size, header.mem1_size / 0x100000, header.mem2_size,
|
||||||
header.mem2_size / 0x100000);
|
header.mem2_size / 0x100000);
|
||||||
file.Close();
|
file.Close();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ public:
|
||||||
{
|
{
|
||||||
// NOTE: AdvanceFrame() will get stuck forever in Dual Core because the FIFO
|
// NOTE: AdvanceFrame() will get stuck forever in Dual Core because the FIFO
|
||||||
// is disabled by CPU::EnableStepping(true) so the frame never gets displayed.
|
// is disabled by CPU::EnableStepping(true) so the frame never gets displayed.
|
||||||
PanicAlertT("Cannot SingleStep the FIFO. Use Frame Advance instead.");
|
PanicAlertFmtT("Cannot SingleStep the FIFO. Use Frame Advance instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* GetName() const override { return "FifoPlayer"; }
|
const char* GetName() const override { return "FifoPlayer"; }
|
||||||
|
|
|
@ -82,8 +82,8 @@ void FifoRecorder::WriteGPCommand(const u8* data, u32 size)
|
||||||
// Make sure FifoPlayer's command analyzer agrees about the size of the command.
|
// Make sure FifoPlayer's command analyzer agrees about the size of the command.
|
||||||
if (analyzed_size != size)
|
if (analyzed_size != size)
|
||||||
{
|
{
|
||||||
PanicAlert("FifoRecorder: Expected command to be %i bytes long, we were given %i bytes",
|
PanicAlertFmt("FifoRecorder: Expected command to be {} bytes long, we were given {} bytes",
|
||||||
analyzed_size, size);
|
analyzed_size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy data to buffer
|
// Copy data to buffer
|
||||||
|
|
|
@ -121,7 +121,7 @@ void PatchFunctions()
|
||||||
s_hooked_addresses[addr] = i;
|
s_hooked_addresses[addr] = i;
|
||||||
PowerPC::ppcState.iCache.Invalidate(addr);
|
PowerPC::ppcState.iCache.Invalidate(addr);
|
||||||
}
|
}
|
||||||
INFO_LOG(OSHLE, "Patching %s %08x", os_patches[i].name, symbol->address);
|
INFO_LOG_FMT(OSHLE, "Patching {} {:08x}", os_patches[i].name, symbol->address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ void Execute(u32 current_pc, u32 hook_index)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlert("HLE system tried to call an undefined HLE function %i.", hook_index);
|
PanicAlertFmt("HLE system tried to call an undefined HLE function {}.", hook_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ void HLE_OSPanic()
|
||||||
StringPopBackIf(&error, '\n');
|
StringPopBackIf(&error, '\n');
|
||||||
StringPopBackIf(&msg, '\n');
|
StringPopBackIf(&msg, '\n');
|
||||||
|
|
||||||
PanicAlert("OSPanic: %s: %s", error.c_str(), msg.c_str());
|
PanicAlertFmt("OSPanic: {}: {}", error, msg);
|
||||||
ERROR_LOG(OSREPORT, "%08x->%08x| OSPanic: %s: %s", LR, PC, error.c_str(), msg.c_str());
|
ERROR_LOG_FMT(OSREPORT, "{:08x}->{:08x}| OSPanic: {}: {}", LR, PC, error, msg);
|
||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void HLE_GeneralDebugPrint(ParameterType parameter_type)
|
||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generalized function for printing formatted string using parameter list.
|
// Generalized function for printing formatted string using parameter list.
|
||||||
|
@ -103,24 +103,24 @@ void HLE_write_console()
|
||||||
std::string report_message = GetStringVA(4);
|
std::string report_message = GetStringVA(4);
|
||||||
if (PowerPC::HostIsRAMAddress(GPR(5)))
|
if (PowerPC::HostIsRAMAddress(GPR(5)))
|
||||||
{
|
{
|
||||||
u32 size = PowerPC::Read_U32(GPR(5));
|
const u32 size = PowerPC::Read_U32(GPR(5));
|
||||||
if (size > report_message.size())
|
if (size > report_message.size())
|
||||||
WARN_LOG(OSREPORT, "__write_console uses an invalid size of 0x%08x", size);
|
WARN_LOG_FMT(OSREPORT, "__write_console uses an invalid size of {:#010x}", size);
|
||||||
else if (size == 0)
|
else if (size == 0)
|
||||||
WARN_LOG(OSREPORT, "__write_console uses a size of zero");
|
WARN_LOG_FMT(OSREPORT, "__write_console uses a size of zero");
|
||||||
else
|
else
|
||||||
report_message = report_message.substr(0, size);
|
report_message = report_message.substr(0, size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(OSREPORT, "__write_console uses an unreachable size pointer");
|
ERROR_LOG_FMT(OSREPORT, "__write_console uses an unreachable size pointer");
|
||||||
}
|
}
|
||||||
|
|
||||||
StringPopBackIf(&report_message, '\n');
|
StringPopBackIf(&report_message, '\n');
|
||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log (v)dprintf message if fd is 1 (stdout) or 2 (stderr)
|
// Log (v)dprintf message if fd is 1 (stdout) or 2 (stderr)
|
||||||
|
@ -133,7 +133,7 @@ void HLE_LogDPrint(ParameterType parameter_type)
|
||||||
|
|
||||||
std::string report_message = GetStringVA(4, parameter_type);
|
std::string report_message = GetStringVA(4, parameter_type);
|
||||||
StringPopBackIf(&report_message, '\n');
|
StringPopBackIf(&report_message, '\n');
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log dprintf message
|
// Log dprintf message
|
||||||
|
@ -173,7 +173,7 @@ void HLE_LogFPrint(ParameterType parameter_type)
|
||||||
|
|
||||||
std::string report_message = GetStringVA(4, parameter_type);
|
std::string report_message = GetStringVA(4, parameter_type);
|
||||||
StringPopBackIf(&report_message, '\n');
|
StringPopBackIf(&report_message, '\n');
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG_FMT(OSREPORT, "{:08x}->{:08x}| {}", LR, PC, SHIFTJISToUTF8(report_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log fprintf message
|
// Log fprintf message
|
||||||
|
|
|
@ -42,7 +42,7 @@ u32 HLE::SystemVABI::VAListStruct::GetGPR(u32 gpr) const
|
||||||
{
|
{
|
||||||
if (gpr < 3 || gpr > 10)
|
if (gpr < 3 || gpr > 10)
|
||||||
{
|
{
|
||||||
ERROR_LOG(OSHLE, "VAListStruct at %08x doesn't have GPR%d!", m_address, gpr);
|
ERROR_LOG_FMT(OSHLE, "VAListStruct at {:08x} doesn't have GPR{}!", m_address, gpr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const u32 gpr_address = Common::AlignUp(GetGPRArea() + 4 * (gpr - 3), 4);
|
const u32 gpr_address = Common::AlignUp(GetGPRArea() + 4 * (gpr - 3), 4);
|
||||||
|
@ -53,7 +53,7 @@ double HLE::SystemVABI::VAListStruct::GetFPR(u32 fpr) const
|
||||||
{
|
{
|
||||||
if (!m_has_fpr_area || fpr < 1 || fpr > 8)
|
if (!m_has_fpr_area || fpr < 1 || fpr > 8)
|
||||||
{
|
{
|
||||||
ERROR_LOG(OSHLE, "VAListStruct at %08x doesn't have FPR%d!", m_address, fpr);
|
ERROR_LOG_FMT(OSHLE, "VAListStruct at {:08x} doesn't have FPR{}!", m_address, fpr);
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
const u32 fpr_address = Common::AlignUp(GetFPRArea() + 8 * (fpr - 1), 8);
|
const u32 fpr_address = Common::AlignUp(GetFPRArea() + 8 * (fpr - 1), 8);
|
||||||
|
|
|
@ -168,13 +168,13 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
|
|
||||||
if (s_control.AIINTMSK != tmp_ai_ctrl.AIINTMSK)
|
if (s_control.AIINTMSK != tmp_ai_ctrl.AIINTMSK)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "Change AIINTMSK to %d", tmp_ai_ctrl.AIINTMSK);
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "Change AIINTMSK to {}", tmp_ai_ctrl.AIINTMSK);
|
||||||
s_control.AIINTMSK = tmp_ai_ctrl.AIINTMSK;
|
s_control.AIINTMSK = tmp_ai_ctrl.AIINTMSK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_control.AIINTVLD != tmp_ai_ctrl.AIINTVLD)
|
if (s_control.AIINTVLD != tmp_ai_ctrl.AIINTVLD)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "Change AIINTVLD to %d", tmp_ai_ctrl.AIINTVLD);
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "Change AIINTVLD to {}", tmp_ai_ctrl.AIINTVLD);
|
||||||
s_control.AIINTVLD = tmp_ai_ctrl.AIINTVLD;
|
s_control.AIINTVLD = tmp_ai_ctrl.AIINTVLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
if (tmp_ai_ctrl.AISFR != s_control.AISFR)
|
if (tmp_ai_ctrl.AISFR != s_control.AISFR)
|
||||||
{
|
{
|
||||||
// AISFR rates below are intentionally inverted wrt yagcd
|
// AISFR rates below are intentionally inverted wrt yagcd
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmp_ai_ctrl.AISFR ? "48khz" : "32khz");
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "Change AISFR to {}",
|
||||||
|
tmp_ai_ctrl.AISFR ? "48khz" : "32khz");
|
||||||
s_control.AISFR = tmp_ai_ctrl.AISFR;
|
s_control.AISFR = tmp_ai_ctrl.AISFR;
|
||||||
s_ais_sample_rate = tmp_ai_ctrl.AISFR ? Get48KHzSampleRate() : Get32KHzSampleRate();
|
s_ais_sample_rate = tmp_ai_ctrl.AISFR ? Get48KHzSampleRate() : Get32KHzSampleRate();
|
||||||
g_sound_stream->GetMixer()->SetStreamInputSampleRate(s_ais_sample_rate);
|
g_sound_stream->GetMixer()->SetStreamInputSampleRate(s_ais_sample_rate);
|
||||||
|
@ -191,7 +192,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
// Set frequency of DMA
|
// Set frequency of DMA
|
||||||
if (tmp_ai_ctrl.AIDFR != s_control.AIDFR)
|
if (tmp_ai_ctrl.AIDFR != s_control.AIDFR)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmp_ai_ctrl.AIDFR ? "32khz" : "48khz");
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "Change AIDFR to {}",
|
||||||
|
tmp_ai_ctrl.AIDFR ? "32khz" : "48khz");
|
||||||
s_control.AIDFR = tmp_ai_ctrl.AIDFR;
|
s_control.AIDFR = tmp_ai_ctrl.AIDFR;
|
||||||
s_aid_sample_rate = tmp_ai_ctrl.AIDFR ? Get32KHzSampleRate() : Get48KHzSampleRate();
|
s_aid_sample_rate = tmp_ai_ctrl.AIDFR ? Get32KHzSampleRate() : Get48KHzSampleRate();
|
||||||
g_sound_stream->GetMixer()->SetDMAInputSampleRate(s_aid_sample_rate);
|
g_sound_stream->GetMixer()->SetDMAInputSampleRate(s_aid_sample_rate);
|
||||||
|
@ -200,7 +202,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
// Streaming counter
|
// Streaming counter
|
||||||
if (tmp_ai_ctrl.PSTAT != s_control.PSTAT)
|
if (tmp_ai_ctrl.PSTAT != s_control.PSTAT)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmp_ai_ctrl.PSTAT ? "start" : "stop");
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "{} streaming audio",
|
||||||
|
tmp_ai_ctrl.PSTAT ? "start" : "stop");
|
||||||
s_control.PSTAT = tmp_ai_ctrl.PSTAT;
|
s_control.PSTAT = tmp_ai_ctrl.PSTAT;
|
||||||
s_last_cpu_time = CoreTiming::GetTicks();
|
s_last_cpu_time = CoreTiming::GetTicks();
|
||||||
|
|
||||||
|
@ -211,14 +214,14 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
// AI Interrupt
|
// AI Interrupt
|
||||||
if (tmp_ai_ctrl.AIINT)
|
if (tmp_ai_ctrl.AIINT)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt");
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "Clear AIS Interrupt");
|
||||||
s_control.AIINT = 0;
|
s_control.AIINT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sample Count Reset
|
// Sample Count Reset
|
||||||
if (tmp_ai_ctrl.SCRESET)
|
if (tmp_ai_ctrl.SCRESET)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter");
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "Reset AIS sample counter");
|
||||||
s_sample_counter = 0;
|
s_sample_counter = 0;
|
||||||
|
|
||||||
s_last_cpu_time = CoreTiming::GetTicks();
|
s_last_cpu_time = CoreTiming::GetTicks();
|
||||||
|
@ -247,8 +250,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
|
|
||||||
mmio->Register(base | AI_INTERRUPT_TIMING, MMIO::DirectRead<u32>(&s_interrupt_timing),
|
mmio->Register(base | AI_INTERRUPT_TIMING, MMIO::DirectRead<u32>(&s_interrupt_timing),
|
||||||
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||||
DEBUG_LOG(AUDIO_INTERFACE, "AI_INTERRUPT_TIMING=%08x@%08x", val,
|
DEBUG_LOG_FMT(AUDIO_INTERFACE, "AI_INTERRUPT_TIMING={:08x} at PC: {:08x}", val,
|
||||||
PowerPC::ppcState.pc);
|
PowerPC::ppcState.pc);
|
||||||
s_interrupt_timing = val;
|
s_interrupt_timing = val;
|
||||||
CoreTiming::RemoveEvent(event_type_ai);
|
CoreTiming::RemoveEvent(event_type_ai);
|
||||||
CoreTiming::ScheduleEvent(GetAIPeriod(), event_type_ai);
|
CoreTiming::ScheduleEvent(GetAIPeriod(), event_type_ai);
|
||||||
|
|
|
@ -329,8 +329,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
s_dspState.pad = tmpControl.pad;
|
s_dspState.pad = tmpControl.pad;
|
||||||
if (s_dspState.pad != 0)
|
if (s_dspState.pad != 0)
|
||||||
{
|
{
|
||||||
PanicAlert(
|
PanicAlertFmt(
|
||||||
"DSPInterface (w) DSP state (CC00500A) gets a value with junk in the padding %08x",
|
"DSPInterface (w) DSP state (CC00500A) gets a value with junk in the padding {:08x}",
|
||||||
val);
|
val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,8 +359,8 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
s_audioDMA.current_source_address = s_audioDMA.SourceAddress;
|
s_audioDMA.current_source_address = s_audioDMA.SourceAddress;
|
||||||
s_audioDMA.remaining_blocks_count = s_audioDMA.AudioDMAControl.NumBlocks;
|
s_audioDMA.remaining_blocks_count = s_audioDMA.AudioDMAControl.NumBlocks;
|
||||||
|
|
||||||
INFO_LOG(AUDIO_INTERFACE, "Audio DMA configured: %i blocks from 0x%08x",
|
INFO_LOG_FMT(AUDIO_INTERFACE, "Audio DMA configured: {} blocks from {:#010x}",
|
||||||
s_audioDMA.AudioDMAControl.NumBlocks, s_audioDMA.SourceAddress);
|
s_audioDMA.AudioDMAControl.NumBlocks, s_audioDMA.SourceAddress);
|
||||||
|
|
||||||
// We make the samples ready as soon as possible
|
// We make the samples ready as soon as possible
|
||||||
void* address = Memory::GetPointer(s_audioDMA.SourceAddress);
|
void* address = Memory::GetPointer(s_audioDMA.SourceAddress);
|
||||||
|
@ -484,8 +484,8 @@ static void Do_ARAM_DMA()
|
||||||
if (s_arDMA.Cnt.dir)
|
if (s_arDMA.Cnt.dir)
|
||||||
{
|
{
|
||||||
// ARAM -> MRAM
|
// ARAM -> MRAM
|
||||||
DEBUG_LOG(DSPINTERFACE, "DMA %08x bytes from ARAM %08x to MRAM %08x PC: %08x",
|
DEBUG_LOG_FMT(DSPINTERFACE, "DMA {:08x} bytes from ARAM {:08x} to MRAM {:08x} PC: {:08x}",
|
||||||
s_arDMA.Cnt.count, s_arDMA.ARAddr, s_arDMA.MMAddr, PC);
|
s_arDMA.Cnt.count, s_arDMA.ARAddr, s_arDMA.MMAddr, PC);
|
||||||
|
|
||||||
// Outgoing data from ARAM is mirrored every 64MB (verified on real HW)
|
// Outgoing data from ARAM is mirrored every 64MB (verified on real HW)
|
||||||
s_arDMA.ARAddr &= 0x3ffffff;
|
s_arDMA.ARAddr &= 0x3ffffff;
|
||||||
|
@ -531,8 +531,8 @@ static void Do_ARAM_DMA()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// MRAM -> ARAM
|
// MRAM -> ARAM
|
||||||
DEBUG_LOG(DSPINTERFACE, "DMA %08x bytes from MRAM %08x to ARAM %08x PC: %08x",
|
DEBUG_LOG_FMT(DSPINTERFACE, "DMA {:08x} bytes from MRAM {:08x} to ARAM {:08x} PC: {:08x}",
|
||||||
s_arDMA.Cnt.count, s_arDMA.MMAddr, s_arDMA.ARAddr, PC);
|
s_arDMA.Cnt.count, s_arDMA.MMAddr, s_arDMA.ARAddr, PC);
|
||||||
|
|
||||||
// Incoming data into ARAM is mirrored every 64MB (verified on real HW)
|
// Incoming data into ARAM is mirrored every 64MB (verified on real HW)
|
||||||
s_arDMA.ARAddr &= 0x3ffffff;
|
s_arDMA.ARAddr &= 0x3ffffff;
|
||||||
|
|
|
@ -60,7 +60,7 @@ void DSPHLE::SendMailToDSP(u32 mail)
|
||||||
{
|
{
|
||||||
if (m_ucode != nullptr)
|
if (m_ucode != nullptr)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", mail);
|
DEBUG_LOG_FMT(DSP_MAIL, "CPU writes {:#010x}", mail);
|
||||||
m_ucode->HandleMail(mail);
|
m_ucode->HandleMail(mail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ void DSPHLE::DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlert("CPU can't write %08x to DSP mailbox", value);
|
PanicAlertFmt("CPU can't write {:08x} to DSP mailbox", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ void DSPHLE::DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlert("CPU can't write %08x to DSP mailbox", value);
|
PanicAlertFmt("CPU can't write {:08x} to DSP mailbox", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ void CMailHandler::PushMail(u32 mail, bool interrupt, int cycles_into_future)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Mails.emplace(mail, false);
|
m_Mails.emplace(mail, false);
|
||||||
DEBUG_LOG(DSP_MAIL, "DSP writes 0x%08x", mail);
|
DEBUG_LOG_FMT(DSP_MAIL, "DSP writes {:#010x}", mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 CMailHandler::ReadDSPMailboxHigh()
|
u16 CMailHandler::ReadDSPMailboxHigh()
|
||||||
|
@ -121,7 +121,7 @@ void CMailHandler::DoState(PointerWrap& p)
|
||||||
temp.emplace(value, interrupt);
|
temp.emplace(value, interrupt);
|
||||||
}
|
}
|
||||||
if (!m_Mails.empty())
|
if (!m_Mails.empty())
|
||||||
PanicAlert("CMailHandler::DoState - WTF?");
|
PanicAlertFmt("CMailHandler::DoState - WTF?");
|
||||||
|
|
||||||
// Restore queue.
|
// Restore queue.
|
||||||
for (int i = 0; i < sz; i++)
|
for (int i = 0; i < sz; i++)
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace DSP::HLE
|
||||||
{
|
{
|
||||||
AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc), m_cmdlist_size(0)
|
AXUCode::AXUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc), m_cmdlist_size(0)
|
||||||
{
|
{
|
||||||
INFO_LOG(DSPHLE, "Instantiating AXUCode: crc=%08x", crc);
|
INFO_LOG_FMT(DSPHLE, "Instantiating AXUCode: crc={:08x}", crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
AXUCode::~AXUCode()
|
AXUCode::~AXUCode()
|
||||||
|
@ -64,7 +64,7 @@ void AXUCode::LoadResamplingCoefficients()
|
||||||
if (fidx >= filenames.size())
|
if (fidx >= filenames.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
INFO_LOG(DSPHLE, "Loading polyphase resampling coeffs from %s", filename.c_str());
|
INFO_LOG_FMT(DSPHLE, "Loading polyphase resampling coeffs from {}", filename);
|
||||||
|
|
||||||
File::IOFile fp(filename, "rb");
|
File::IOFile fp(filename, "rb");
|
||||||
fp.ReadBytes(m_coeffs, 0x1000);
|
fp.ReadBytes(m_coeffs, 0x1000);
|
||||||
|
@ -106,10 +106,10 @@ void AXUCode::HandleCommandList()
|
||||||
u32 pb_addr = 0;
|
u32 pb_addr = 0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
INFO_LOG(DSPHLE, "Command list:");
|
INFO_LOG_FMT(DSPHLE, "Command list:");
|
||||||
for (u32 i = 0; m_cmdlist[i] != CMD_END; ++i)
|
for (u32 i = 0; m_cmdlist[i] != CMD_END; ++i)
|
||||||
INFO_LOG(DSPHLE, "%04x", m_cmdlist[i]);
|
INFO_LOG_FMT(DSPHLE, "{:04x}", m_cmdlist[i]);
|
||||||
INFO_LOG(DSPHLE, "-------------");
|
INFO_LOG_FMT(DSPHLE, "-------------");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 curr_idx = 0;
|
u32 curr_idx = 0;
|
||||||
|
@ -272,7 +272,7 @@ void AXUCode::HandleCommandList()
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DSPHLE, "Unknown command in AX command list: %04x", cmd);
|
ERROR_LOG_FMT(DSPHLE, "Unknown command in AX command list: {:04x}", cmd);
|
||||||
end = true;
|
end = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ void AXUCode::HandleMail(u32 mail)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPHLE, "Unknown mail sent to AX::HandleMail: %08x", mail);
|
ERROR_LOG_FMT(DSPHLE, "Unknown mail sent to AX::HandleMail: {:08x}", mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
next_is_cmdlist = set_next_is_cmdlist;
|
next_is_cmdlist = set_next_is_cmdlist;
|
||||||
|
@ -671,7 +671,7 @@ void AXUCode::CopyCmdList(u32 addr, u16 size)
|
||||||
{
|
{
|
||||||
if (size >= std::size(m_cmdlist))
|
if (size >= std::size(m_cmdlist))
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPHLE, "Command list at %08x is too large: size=%d", addr, size);
|
ERROR_LOG_FMT(DSPHLE, "Command list at {:08x} is too large: size={}", addr, size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ AXWiiUCode::AXWiiUCode(DSPHLE* dsphle, u32 crc) : AXUCode(dsphle, crc), m_last_m
|
||||||
for (u16& volume : m_last_aux_volumes)
|
for (u16& volume : m_last_aux_volumes)
|
||||||
volume = 0x8000;
|
volume = 0x8000;
|
||||||
|
|
||||||
INFO_LOG(DSPHLE, "Instantiating AXWiiUCode");
|
INFO_LOG_FMT(DSPHLE, "Instantiating AXWiiUCode");
|
||||||
|
|
||||||
m_old_axwii = (crc == 0xfa450138);
|
m_old_axwii = (crc == 0xfa450138);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace DSP::HLE
|
||||||
{
|
{
|
||||||
CARDUCode::CARDUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
CARDUCode::CARDUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
||||||
{
|
{
|
||||||
INFO_LOG(DSPHLE, "CARDUCode - initialized");
|
INFO_LOG_FMT(DSPHLE, "CARDUCode - initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
CARDUCode::~CARDUCode()
|
CARDUCode::~CARDUCode()
|
||||||
|
@ -44,7 +44,7 @@ void CARDUCode::HandleMail(u32 mail)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "CARDUCode - unknown command: %x", mail);
|
WARN_LOG_FMT(DSPHLE, "CARDUCode - unknown command: {:x}", mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mail_handler.PushMail(DSP_DONE);
|
m_mail_handler.PushMail(DSP_DONE);
|
||||||
|
|
|
@ -64,10 +64,10 @@ void ProcessGBACrypto(u32 address)
|
||||||
HLEMemory_Write_U32(dest_addr + 4, t3);
|
HLEMemory_Write_U32(dest_addr + 4, t3);
|
||||||
|
|
||||||
// Done!
|
// Done!
|
||||||
DEBUG_LOG(DSPHLE,
|
DEBUG_LOG_FMT(DSPHLE,
|
||||||
"\n%08x -> challenge: %08x, len: %08x, dest_addr: %08x, "
|
"\n{:08x} -> challenge: {:08x}, len: {:08x}, dest_addr: {:08x}, "
|
||||||
"palette: %08x, speed: %08x key: %08x, auth_code: %08x",
|
"palette: {:08x}, speed: {:08x} key: {:08x}, auth_code: {:08x}",
|
||||||
address, challenge, length, dest_addr, logo_palette, logo_speed_32, key, t3);
|
address, challenge, length, dest_addr, logo_palette, logo_speed_32, key, t3);
|
||||||
}
|
}
|
||||||
|
|
||||||
GBAUCode::GBAUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
GBAUCode::GBAUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
||||||
|
@ -126,13 +126,13 @@ void GBAUCode::HandleMail(u32 mail)
|
||||||
m_dsphle->SetUCode(UCODE_ROM);
|
m_dsphle->SetUCode(UCODE_ROM);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN_LOG(DSPHLE, "GBAUCode - unknown 0xcdd1 command: %08x", mail);
|
WARN_LOG_FMT(DSPHLE, "GBAUCode - unknown 0xcdd1 command: {:08x}", mail);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "GBAUCode - unknown command: %08x", mail);
|
WARN_LOG_FMT(DSPHLE, "GBAUCode - unknown command: {:08x}", mail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace DSP::HLE
|
} // namespace DSP::HLE
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace DSP::HLE
|
||||||
{
|
{
|
||||||
INITUCode::INITUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
INITUCode::INITUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
||||||
{
|
{
|
||||||
INFO_LOG(DSPHLE, "INITUCode - initialized");
|
INFO_LOG_FMT(DSPHLE, "INITUCode - initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
INITUCode::~INITUCode()
|
INITUCode::~INITUCode()
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace DSP::HLE
|
||||||
ROMUCode::ROMUCode(DSPHLE* dsphle, u32 crc)
|
ROMUCode::ROMUCode(DSPHLE* dsphle, u32 crc)
|
||||||
: UCodeInterface(dsphle, crc), m_current_ucode(), m_boot_task_num_steps(0), m_next_parameter(0)
|
: UCodeInterface(dsphle, crc), m_current_ucode(), m_boot_task_num_steps(0), m_next_parameter(0)
|
||||||
{
|
{
|
||||||
INFO_LOG(DSPHLE, "UCode_Rom - initialized");
|
INFO_LOG_FMT(DSPHLE, "UCode_Rom - initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
ROMUCode::~ROMUCode()
|
ROMUCode::~ROMUCode()
|
||||||
|
@ -73,8 +73,8 @@ void ROMUCode::HandleMail(u32 mail)
|
||||||
m_current_ucode.m_dmem_length = mail & 0xffff;
|
m_current_ucode.m_dmem_length = mail & 0xffff;
|
||||||
if (m_current_ucode.m_dmem_length)
|
if (m_current_ucode.m_dmem_length)
|
||||||
{
|
{
|
||||||
NOTICE_LOG(DSPHLE, "m_current_ucode.m_dmem_length = 0x%04x.",
|
NOTICE_LOG_FMT(DSPHLE, "m_current_ucode.m_dmem_length = {:#06x}.",
|
||||||
m_current_ucode.m_dmem_length);
|
m_current_ucode.m_dmem_length);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -109,13 +109,13 @@ void ROMUCode::BootUCode()
|
||||||
m_current_ucode.m_length, ector_crc);
|
m_current_ucode.m_length, ector_crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_current_ucode.m_ram_address);
|
INFO_LOG_FMT(DSPHLE, "CurrentUCode SOURCE Addr: {:#010x}", m_current_ucode.m_ram_address);
|
||||||
INFO_LOG(DSPHLE, "CurrentUCode Length: 0x%08x", m_current_ucode.m_length);
|
INFO_LOG_FMT(DSPHLE, "CurrentUCode Length: {:#010x}", m_current_ucode.m_length);
|
||||||
INFO_LOG(DSPHLE, "CurrentUCode DEST Addr: 0x%08x", m_current_ucode.m_imem_address);
|
INFO_LOG_FMT(DSPHLE, "CurrentUCode DEST Addr: {:#010x}", m_current_ucode.m_imem_address);
|
||||||
INFO_LOG(DSPHLE, "CurrentUCode DMEM Length: 0x%08x", m_current_ucode.m_dmem_length);
|
INFO_LOG_FMT(DSPHLE, "CurrentUCode DMEM Length: {:#010x}", m_current_ucode.m_dmem_length);
|
||||||
INFO_LOG(DSPHLE, "CurrentUCode init_vector: 0x%08x", m_current_ucode.m_start_pc);
|
INFO_LOG_FMT(DSPHLE, "CurrentUCode init_vector: {:#010x}", m_current_ucode.m_start_pc);
|
||||||
INFO_LOG(DSPHLE, "CurrentUCode CRC: 0x%08x", ector_crc);
|
INFO_LOG_FMT(DSPHLE, "CurrentUCode CRC: {:#010x}", ector_crc);
|
||||||
INFO_LOG(DSPHLE, "BootTask - done");
|
INFO_LOG_FMT(DSPHLE, "BootTask - done");
|
||||||
|
|
||||||
m_dsphle->SetUCode(ector_crc);
|
m_dsphle->SetUCode(ector_crc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,22 +190,22 @@ void UCodeInterface::PrepareBootUCode(u32 mail)
|
||||||
ector_crc);
|
ector_crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(DSPHLE, "PrepareBootUCode 0x%08x", ector_crc);
|
DEBUG_LOG_FMT(DSPHLE, "PrepareBootUCode {:#010x}", ector_crc);
|
||||||
DEBUG_LOG(DSPHLE, "DRAM -> MRAM: src %04x dst %08x size %04x", m_next_ucode.mram_dram_addr,
|
DEBUG_LOG_FMT(DSPHLE, "DRAM -> MRAM: src {:04x} dst {:08x} size {:04x}",
|
||||||
m_next_ucode.mram_dest_addr, m_next_ucode.mram_size);
|
m_next_ucode.mram_dram_addr, m_next_ucode.mram_dest_addr, m_next_ucode.mram_size);
|
||||||
DEBUG_LOG(DSPHLE, "MRAM -> IRAM: src %08x dst %04x size %04x startpc %04x",
|
DEBUG_LOG_FMT(DSPHLE, "MRAM -> IRAM: src {:08x} dst {:04x} size {:04x} startpc {:04x}",
|
||||||
m_next_ucode.iram_mram_addr, m_next_ucode.iram_dest, m_next_ucode.iram_size,
|
m_next_ucode.iram_mram_addr, m_next_ucode.iram_dest, m_next_ucode.iram_size,
|
||||||
m_next_ucode.iram_startpc);
|
m_next_ucode.iram_startpc);
|
||||||
DEBUG_LOG(DSPHLE, "MRAM -> DRAM: src %08x dst %04x size %04x", m_next_ucode.dram_mram_addr,
|
DEBUG_LOG_FMT(DSPHLE, "MRAM -> DRAM: src {:08x} dst {:04x} size {:04x}",
|
||||||
m_next_ucode.dram_dest, m_next_ucode.dram_size);
|
m_next_ucode.dram_mram_addr, m_next_ucode.dram_dest, m_next_ucode.dram_size);
|
||||||
|
|
||||||
if (m_next_ucode.mram_size)
|
if (m_next_ucode.mram_size)
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "Trying to boot new ucode with DRAM download - not implemented");
|
WARN_LOG_FMT(DSPHLE, "Trying to boot new ucode with DRAM download - not implemented");
|
||||||
}
|
}
|
||||||
if (m_next_ucode.dram_size)
|
if (m_next_ucode.dram_size)
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "Trying to boot new ucode with DRAM upload - not implemented");
|
WARN_LOG_FMT(DSPHLE, "Trying to boot new ucode with DRAM upload - not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dsphle->SwapUCode(ector_crc);
|
m_dsphle->SwapUCode(ector_crc);
|
||||||
|
@ -225,19 +225,19 @@ std::unique_ptr<UCodeInterface> UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)
|
||||||
switch (crc)
|
switch (crc)
|
||||||
{
|
{
|
||||||
case UCODE_ROM:
|
case UCODE_ROM:
|
||||||
INFO_LOG(DSPHLE, "Switching to ROM ucode");
|
INFO_LOG_FMT(DSPHLE, "Switching to ROM ucode");
|
||||||
return std::make_unique<ROMUCode>(dsphle, crc);
|
return std::make_unique<ROMUCode>(dsphle, crc);
|
||||||
|
|
||||||
case UCODE_INIT_AUDIO_SYSTEM:
|
case UCODE_INIT_AUDIO_SYSTEM:
|
||||||
INFO_LOG(DSPHLE, "Switching to INIT ucode");
|
INFO_LOG_FMT(DSPHLE, "Switching to INIT ucode");
|
||||||
return std::make_unique<INITUCode>(dsphle, crc);
|
return std::make_unique<INITUCode>(dsphle, crc);
|
||||||
|
|
||||||
case 0x65d6cc6f: // CARD
|
case 0x65d6cc6f: // CARD
|
||||||
INFO_LOG(DSPHLE, "Switching to CARD ucode");
|
INFO_LOG_FMT(DSPHLE, "Switching to CARD ucode");
|
||||||
return std::make_unique<CARDUCode>(dsphle, crc);
|
return std::make_unique<CARDUCode>(dsphle, crc);
|
||||||
|
|
||||||
case 0xdd7e72d5:
|
case 0xdd7e72d5:
|
||||||
INFO_LOG(DSPHLE, "Switching to GBA ucode");
|
INFO_LOG_FMT(DSPHLE, "Switching to GBA ucode");
|
||||||
return std::make_unique<GBAUCode>(dsphle, crc);
|
return std::make_unique<GBAUCode>(dsphle, crc);
|
||||||
|
|
||||||
case 0x3ad3b7ac: // Naruto 3, Paper Mario - The Thousand Year Door
|
case 0x3ad3b7ac: // Naruto 3, Paper Mario - The Thousand Year Door
|
||||||
|
@ -252,7 +252,7 @@ std::unique_ptr<UCodeInterface> UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)
|
||||||
// Zelda:OOT, Tony Hawk, Viewtiful Joe
|
// Zelda:OOT, Tony Hawk, Viewtiful Joe
|
||||||
case 0xe2136399: // Billy Hatcher, Dragon Ball Z, Mario Party 5, TMNT, 1080° Avalanche
|
case 0xe2136399: // Billy Hatcher, Dragon Ball Z, Mario Party 5, TMNT, 1080° Avalanche
|
||||||
case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy)
|
case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy)
|
||||||
INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", crc);
|
INFO_LOG_FMT(DSPHLE, "CRC {:08x}: AX ucode chosen", crc);
|
||||||
return std::make_unique<AXUCode>(dsphle, crc);
|
return std::make_unique<AXUCode>(dsphle, crc);
|
||||||
|
|
||||||
case 0x86840740: // Zelda WW - US
|
case 0x86840740: // Zelda WW - US
|
||||||
|
@ -277,24 +277,26 @@ std::unique_ptr<UCodeInterface> UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)
|
||||||
case 0xadbc06bd: // Elebits
|
case 0xadbc06bd: // Elebits
|
||||||
case 0x4cc52064: // Bleach: Versus Crusade
|
case 0x4cc52064: // Bleach: Versus Crusade
|
||||||
case 0xd9c4bf34: // WiiMenu
|
case 0xd9c4bf34: // WiiMenu
|
||||||
INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", crc);
|
INFO_LOG_FMT(DSPHLE, "CRC {:08x}: Wii - AXWii chosen", crc);
|
||||||
return std::make_unique<AXWiiUCode>(dsphle, crc);
|
return std::make_unique<AXWiiUCode>(dsphle, crc);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (wii)
|
if (wii)
|
||||||
{
|
{
|
||||||
PanicAlertT("This title might be incompatible with DSP HLE emulation. Try using LLE if this "
|
PanicAlertFmtT(
|
||||||
"is homebrew.\n\n"
|
"This title might be incompatible with DSP HLE emulation. Try using LLE if this "
|
||||||
"Unknown ucode (CRC = %08x) - forcing AXWii.",
|
"is homebrew.\n\n"
|
||||||
crc);
|
"Unknown ucode (CRC = {0:08x}) - forcing AXWii.",
|
||||||
|
crc);
|
||||||
return std::make_unique<AXWiiUCode>(dsphle, crc);
|
return std::make_unique<AXWiiUCode>(dsphle, crc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlertT("This title might be incompatible with DSP HLE emulation. Try using LLE if this "
|
PanicAlertFmtT(
|
||||||
"is homebrew.\n\n"
|
"This title might be incompatible with DSP HLE emulation. Try using LLE if this "
|
||||||
"DSPHLE: Unknown ucode (CRC = %08x) - forcing AX.",
|
"is homebrew.\n\n"
|
||||||
crc);
|
"DSPHLE: Unknown ucode (CRC = {0:08x}) - forcing AX.",
|
||||||
|
crc);
|
||||||
return std::make_unique<AXUCode>(dsphle, crc);
|
return std::make_unique<AXUCode>(dsphle, crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,12 +119,12 @@ ZeldaUCode::ZeldaUCode(DSPHLE* dsphle, u32 crc) : UCodeInterface(dsphle, crc)
|
||||||
{
|
{
|
||||||
auto it = UCODE_FLAGS.find(crc);
|
auto it = UCODE_FLAGS.find(crc);
|
||||||
if (it == UCODE_FLAGS.end())
|
if (it == UCODE_FLAGS.end())
|
||||||
PanicAlert("No flags definition found for Zelda CRC %08x", crc);
|
PanicAlertFmt("No flags definition found for Zelda CRC {:08x}", crc);
|
||||||
|
|
||||||
m_flags = it->second;
|
m_flags = it->second;
|
||||||
m_renderer.SetFlags(m_flags);
|
m_renderer.SetFlags(m_flags);
|
||||||
|
|
||||||
INFO_LOG(DSPHLE, "Zelda UCode loaded, crc=%08x, flags=%08x", crc, m_flags);
|
INFO_LOG_FMT(DSPHLE, "Zelda UCode loaded, crc={:08x}, flags={:08x}", crc, m_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeldaUCode::~ZeldaUCode()
|
ZeldaUCode::~ZeldaUCode()
|
||||||
|
@ -202,7 +202,7 @@ void ZeldaUCode::HandleMailDefault(u32 mail)
|
||||||
{
|
{
|
||||||
if ((mail >> 16) != 0xCDD1)
|
if ((mail >> 16) != 0xCDD1)
|
||||||
{
|
{
|
||||||
PanicAlert("Rendering end mail without prefix CDD1: %08x", mail);
|
PanicAlertFmt("Rendering end mail without prefix CDD1: {:08x}", mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mail & 0xFFFF)
|
switch (mail & 0xFFFF)
|
||||||
|
@ -210,13 +210,13 @@ void ZeldaUCode::HandleMailDefault(u32 mail)
|
||||||
case 1:
|
case 1:
|
||||||
m_cmd_can_execute = true;
|
m_cmd_can_execute = true;
|
||||||
RunPendingCommands();
|
RunPendingCommands();
|
||||||
NOTICE_LOG(DSPHLE, "UCode being replaced.");
|
NOTICE_LOG_FMT(DSPHLE, "UCode being replaced.");
|
||||||
m_upload_setup_in_progress = true;
|
m_upload_setup_in_progress = true;
|
||||||
SetMailState(MailState::WAITING);
|
SetMailState(MailState::WAITING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
NOTICE_LOG(DSPHLE, "UCode being rebooted to ROM.");
|
NOTICE_LOG_FMT(DSPHLE, "UCode being rebooted to ROM.");
|
||||||
SetMailState(MailState::HALTED);
|
SetMailState(MailState::HALTED);
|
||||||
m_dsphle->SetUCode(UCODE_ROM);
|
m_dsphle->SetUCode(UCODE_ROM);
|
||||||
break;
|
break;
|
||||||
|
@ -227,9 +227,10 @@ void ZeldaUCode::HandleMailDefault(u32 mail)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NOTICE_LOG(DSPHLE, "Unknown end rendering action. Halting.");
|
NOTICE_LOG_FMT(DSPHLE, "Unknown end rendering action. Halting.");
|
||||||
|
[[fallthrough]];
|
||||||
case 0:
|
case 0:
|
||||||
NOTICE_LOG(DSPHLE, "UCode asked to halt. Stopping any processing.");
|
NOTICE_LOG_FMT(DSPHLE, "UCode asked to halt. Stopping any processing.");
|
||||||
SetMailState(MailState::HALTED);
|
SetMailState(MailState::HALTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -242,8 +243,8 @@ void ZeldaUCode::HandleMailDefault(u32 mail)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NOTICE_LOG(DSPHLE, "Sync mail (%08x) received when rendering was not active. Halting.",
|
NOTICE_LOG_FMT(DSPHLE,
|
||||||
mail);
|
"Sync mail ({:08x}) received when rendering was not active. Halting.", mail);
|
||||||
SetMailState(MailState::HALTED);
|
SetMailState(MailState::HALTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +291,7 @@ void ZeldaUCode::HandleMailDefault(u32 mail)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MailState::HALTED:
|
case MailState::HALTED:
|
||||||
WARN_LOG(DSPHLE, "Received mail %08x while we're halted.", mail);
|
WARN_LOG_FMT(DSPHLE, "Received mail {:08x} while we're halted.", mail);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,8 +303,8 @@ void ZeldaUCode::HandleMailLight(u32 mail)
|
||||||
switch (m_mail_current_state)
|
switch (m_mail_current_state)
|
||||||
{
|
{
|
||||||
case MailState::WAITING:
|
case MailState::WAITING:
|
||||||
if (!(mail & 0x80000000))
|
if ((mail & 0x80000000) == 0)
|
||||||
PanicAlert("Mail received in waiting state has MSB=0: %08x", mail);
|
PanicAlertFmt("Mail received in waiting state has MSB=0: {:08x}", mail);
|
||||||
|
|
||||||
// Start of a command. We have to hardcode the number of mails required
|
// Start of a command. We have to hardcode the number of mails required
|
||||||
// for each command - the alternative is to rewrite command handling as
|
// for each command - the alternative is to rewrite command handling as
|
||||||
|
@ -336,7 +337,7 @@ void ZeldaUCode::HandleMailLight(u32 mail)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PanicAlert("Received unknown command in light protocol: %08x", mail);
|
PanicAlertFmt("Received unknown command in light protocol: {:08x}", mail);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_mail_expected_cmd_mails)
|
if (m_mail_expected_cmd_mails)
|
||||||
|
@ -362,7 +363,7 @@ void ZeldaUCode::HandleMailLight(u32 mail)
|
||||||
|
|
||||||
case MailState::RENDERING:
|
case MailState::RENDERING:
|
||||||
if (mail != 0)
|
if (mail != 0)
|
||||||
PanicAlert("Sync mail is not zero: %08x", mail);
|
PanicAlertFmt("Sync mail is not zero: {:08x}", mail);
|
||||||
|
|
||||||
// No per-voice syncing in the light protocol.
|
// No per-voice syncing in the light protocol.
|
||||||
m_sync_max_voice_id = 0xFFFFFFFF;
|
m_sync_max_voice_id = 0xFFFFFFFF;
|
||||||
|
@ -372,14 +373,13 @@ void ZeldaUCode::HandleMailLight(u32 mail)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MailState::HALTED:
|
case MailState::HALTED:
|
||||||
WARN_LOG(DSPHLE, "Received mail %08x while we're halted.", mail);
|
WARN_LOG_FMT(DSPHLE, "Received mail {:08x} while we're halted.", mail);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZeldaUCode::SetMailState(MailState new_state)
|
void ZeldaUCode::SetMailState(MailState new_state)
|
||||||
{
|
{
|
||||||
// WARN_LOG(DSPHLE, "MailState %d -> %d", m_mail_current_state, new_state);
|
|
||||||
m_mail_current_state = new_state;
|
m_mail_current_state = new_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ u32 ZeldaUCode::Read32()
|
||||||
{
|
{
|
||||||
if (m_read_offset == m_write_offset)
|
if (m_read_offset == m_write_offset)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPHLE, "Reading too many command params");
|
ERROR_LOG_FMT(DSPHLE, "Reading too many command params");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,13 +413,13 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
|
|
||||||
while (m_pending_commands_count)
|
while (m_pending_commands_count)
|
||||||
{
|
{
|
||||||
u32 cmd_mail = Read32();
|
const u32 cmd_mail = Read32();
|
||||||
if (!(cmd_mail & 0x80000000))
|
if ((cmd_mail & 0x80000000) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
u32 command = (cmd_mail >> 24) & 0x7f;
|
const u32 command = (cmd_mail >> 24) & 0x7f;
|
||||||
u32 sync = cmd_mail >> 16;
|
const u32 sync = cmd_mail >> 16;
|
||||||
u32 extra_data = cmd_mail & 0xFFFF;
|
const u32 extra_data = cmd_mail & 0xFFFF;
|
||||||
|
|
||||||
m_pending_commands_count--;
|
m_pending_commands_count--;
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
case 0x0F:
|
case 0x0F:
|
||||||
// NOP commands. Log anyway in case we encounter a new version
|
// NOP commands. Log anyway in case we encounter a new version
|
||||||
// where these are not NOPs anymore.
|
// where these are not NOPs anymore.
|
||||||
NOTICE_LOG(DSPHLE, "Received a NOP command: %d", command);
|
NOTICE_LOG_FMT(DSPHLE, "Received a NOP command: {}", command);
|
||||||
SendCommandAck(CommandAck::STANDARD, sync);
|
SendCommandAck(CommandAck::STANDARD, sync);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
// since it's going directly back to the dispatcher with no ack.
|
// since it's going directly back to the dispatcher with no ack.
|
||||||
if (m_flags & LIGHT_PROTOCOL)
|
if (m_flags & LIGHT_PROTOCOL)
|
||||||
{
|
{
|
||||||
PanicAlert("Received a 03 command on light protocol.");
|
PanicAlertFmt("Received a 03 command on light protocol.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SendCommandAck(CommandAck::STANDARD, sync);
|
SendCommandAck(CommandAck::STANDARD, sync);
|
||||||
|
@ -457,7 +457,7 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
//
|
//
|
||||||
// TODO: These are not crashes on light protocol, however I've never seen
|
// TODO: These are not crashes on light protocol, however I've never seen
|
||||||
// them used so far.
|
// them used so far.
|
||||||
NOTICE_LOG(DSPHLE, "Received a crashy command: %d", command);
|
NOTICE_LOG_FMT(DSPHLE, "Received a crashy command: {}", command);
|
||||||
SetMailState(MailState::HALTED);
|
SetMailState(MailState::HALTED);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -547,12 +547,12 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
else if (m_flags & WEIRD_CMD_0C)
|
else if (m_flags & WEIRD_CMD_0C)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
NOTICE_LOG(DSPHLE, "Received an unhandled 0C command, params: %08x %08x", Read32(),
|
NOTICE_LOG_FMT(DSPHLE, "Received an unhandled 0C command, params: {:08x} {:08x}", Read32(),
|
||||||
Read32());
|
Read32());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "Received a NOP 0C command. Flags=%08x", m_flags);
|
WARN_LOG_FMT(DSPHLE, "Received a NOP 0C command. Flags={:08x}", m_flags);
|
||||||
}
|
}
|
||||||
SendCommandAck(CommandAck::STANDARD, sync);
|
SendCommandAck(CommandAck::STANDARD, sync);
|
||||||
break;
|
break;
|
||||||
|
@ -561,12 +561,12 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
case 0x0D:
|
case 0x0D:
|
||||||
if (m_flags & NO_CMD_0D)
|
if (m_flags & NO_CMD_0D)
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "Received a 0D command which is NOP'd on this UCode.");
|
WARN_LOG_FMT(DSPHLE, "Received a 0D command which is NOP'd on this UCode.");
|
||||||
SendCommandAck(CommandAck::STANDARD, sync);
|
SendCommandAck(CommandAck::STANDARD, sync);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN_LOG(DSPHLE, "CMD0D: %08x", Read32());
|
WARN_LOG_FMT(DSPHLE, "CMD0D: {:08x}", Read32());
|
||||||
SendCommandAck(CommandAck::STANDARD, sync);
|
SendCommandAck(CommandAck::STANDARD, sync);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -574,14 +574,14 @@ void ZeldaUCode::RunPendingCommands()
|
||||||
// because the Wii does not have an ARAM, so it simulates it with MRAM
|
// because the Wii does not have an ARAM, so it simulates it with MRAM
|
||||||
// and DMAs.
|
// and DMAs.
|
||||||
case 0x0E:
|
case 0x0E:
|
||||||
if (!(m_flags & NO_ARAM))
|
if ((m_flags & NO_ARAM) == 0)
|
||||||
PanicAlert("Setting base ARAM addr on non Wii DAC.");
|
PanicAlertFmt("Setting base ARAM addr on non Wii DAC.");
|
||||||
m_renderer.SetARAMBaseAddr(Read32());
|
m_renderer.SetARAMBaseAddr(Read32());
|
||||||
SendCommandAck(CommandAck::STANDARD, sync);
|
SendCommandAck(CommandAck::STANDARD, sync);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NOTICE_LOG(DSPHLE, "Received a non-existing command (%d), halting.", command);
|
NOTICE_LOG_FMT(DSPHLE, "Received a non-existing command ({}), halting.", command);
|
||||||
SetMailState(MailState::HALTED);
|
SetMailState(MailState::HALTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ void ZeldaUCode::RenderAudio()
|
||||||
{
|
{
|
||||||
if (!RenderingInProgress())
|
if (!RenderingInProgress())
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE, "Trying to render audio while no rendering should be happening.");
|
WARN_LOG_FMT(DSPHLE, "Trying to render audio while no rendering should be happening.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -980,7 +980,7 @@ void ZeldaAudioRenderer::PrepareFrame()
|
||||||
// uses this AFAICT. PanicAlert to help me find places that use this.
|
// uses this AFAICT. PanicAlert to help me find places that use this.
|
||||||
#ifdef STRICT_ZELDA_HLE
|
#ifdef STRICT_ZELDA_HLE
|
||||||
if (!(m_flags & LIGHT_PROTOCOL) && (m_buf_back_left[0] != 0 || m_buf_back_right[0] != 0))
|
if (!(m_flags & LIGHT_PROTOCOL) && (m_buf_back_left[0] != 0 || m_buf_back_right[0] != 0))
|
||||||
PanicAlert("Zelda HLE using back mixing buffers");
|
PanicAlertFmt("Zelda HLE using back mixing buffers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Add reverb data from previous frame.
|
// Add reverb data from previous frame.
|
||||||
|
@ -1027,7 +1027,7 @@ void ZeldaAudioRenderer::ApplyReverb(bool post_rendering)
|
||||||
if (!m_reverb_pb_base_addr)
|
if (!m_reverb_pb_base_addr)
|
||||||
{
|
{
|
||||||
#ifdef STRICT_ZELDA_HLE
|
#ifdef STRICT_ZELDA_HLE
|
||||||
PanicAlert("Trying to apply reverb without available parameters.");
|
PanicAlertFmt("Trying to apply reverb without available parameters.");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1102,7 +1102,7 @@ void ZeldaAudioRenderer::ApplyReverb(bool post_rendering)
|
||||||
if (!dest_buffer)
|
if (!dest_buffer)
|
||||||
{
|
{
|
||||||
#ifdef STRICT_ZELDA_HLE
|
#ifdef STRICT_ZELDA_HLE
|
||||||
PanicAlert("RPB mixing to an unknown buffer: %04x", dest.buffer_id);
|
PanicAlertFmt("RPB mixing to an unknown buffer: {:04x}", dest.buffer_id);
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1292,7 @@ void ZeldaAudioRenderer::AddVoice(u16 voice_id)
|
||||||
if (!dst_buffer)
|
if (!dst_buffer)
|
||||||
{
|
{
|
||||||
#ifdef STRICT_ZELDA_HLE
|
#ifdef STRICT_ZELDA_HLE
|
||||||
PanicAlert("Mixing to an unmapped buffer: %04x", vpb.channels[i].id);
|
PanicAlertFmt("Mixing to an unmapped buffer: {:04x}", vpb.channels[i].id);
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1480,7 +1480,7 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PanicAlert("Using an unknown/unimplemented sample source: %04x", vpb->samples_source_type);
|
PanicAlertFmt("Using an unknown/unimplemented sample source: {:04x}", vpb->samples_source_type);
|
||||||
buffer->fill(0);
|
buffer->fill(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace DSP::LLE
|
||||||
{
|
{
|
||||||
void DSPPatches::Patch(std::size_t index)
|
void DSPPatches::Patch(std::size_t index)
|
||||||
{
|
{
|
||||||
PanicAlert("Patch functionality not supported in DSP module.");
|
PanicAlertFmt("Patch functionality not supported in DSP module.");
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPDebugInterface::DSPDebugInterface() = default;
|
DSPDebugInterface::DSPDebugInterface() = default;
|
||||||
|
@ -252,12 +252,12 @@ bool DSPDebugInterface::IsMemCheck(u32 address, size_t size) const
|
||||||
|
|
||||||
void DSPDebugInterface::ClearAllMemChecks()
|
void DSPDebugInterface::ClearAllMemChecks()
|
||||||
{
|
{
|
||||||
PanicAlert("MemCheck functionality not supported in DSP module.");
|
PanicAlertFmt("MemCheck functionality not supported in DSP module.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPDebugInterface::ToggleMemCheck(u32 address, bool read, bool write, bool log)
|
void DSPDebugInterface::ToggleMemCheck(u32 address, bool read, bool write, bool log)
|
||||||
{
|
{
|
||||||
PanicAlert("MemCheck functionality not supported in DSP module.");
|
PanicAlertFmt("MemCheck functionality not supported in DSP module.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================
|
// =======================================================
|
||||||
|
|
|
@ -81,7 +81,7 @@ void CodeLoaded(const u8* ptr, size_t size)
|
||||||
DSP::DumpDSPCode(ptr, size, g_dsp.iram_crc);
|
DSP::DumpDSPCode(ptr, size, g_dsp.iram_crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTICE_LOG(DSPLLE, "g_dsp.iram_crc: %08x", g_dsp.iram_crc);
|
NOTICE_LOG_FMT(DSPLLE, "g_dsp.iram_crc: {:08x}", g_dsp.iram_crc);
|
||||||
|
|
||||||
Symbols::Clear();
|
Symbols::Clear();
|
||||||
Symbols::AutoDisassembly(0x0, 0x1000);
|
Symbols::AutoDisassembly(0x0, 0x1000);
|
||||||
|
|
|
@ -129,8 +129,8 @@ static bool LoadDSPRom(u16* rom, const std::string& filename, u32 size_in_bytes)
|
||||||
|
|
||||||
if (bytes.size() != size_in_bytes)
|
if (bytes.size() != size_in_bytes)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPLLE, "%s has a wrong size (%zu, expected %u)", filename.c_str(), bytes.size(),
|
ERROR_LOG_FMT(DSPLLE, "{} has a wrong size ({}, expected {})", filename, bytes.size(),
|
||||||
size_in_bytes);
|
size_in_bytes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ void DSPLLE::DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value)
|
||||||
if (gdsp_mbox_peek(MAILBOX_CPU) & 0x80000000)
|
if (gdsp_mbox_peek(MAILBOX_CPU) & 0x80000000)
|
||||||
{
|
{
|
||||||
// the DSP didn't read the previous value
|
// the DSP didn't read the previous value
|
||||||
WARN_LOG(DSPLLE, "Mailbox isn't empty ... strange");
|
WARN_LOG_FMT(DSPLLE, "Mailbox isn't empty ... strange");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PROFILE
|
#if PROFILE
|
||||||
|
@ -278,7 +278,7 @@ void DSPLLE::DSP_WriteMailBoxHigh(bool cpu_mailbox, u16 value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPLLE, "CPU can't write to DSP mailbox");
|
ERROR_LOG_FMT(DSPLLE, "CPU can't write to DSP mailbox");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ void DSPLLE::DSP_WriteMailBoxLow(bool cpu_mailbox, u16 value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPLLE, "CPU can't write to DSP mailbox");
|
ERROR_LOG_FMT(DSPLLE, "CPU can't write to DSP mailbox");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,11 +86,10 @@ void AutoDisassembly(u16 start_addr, u16 end_addr)
|
||||||
std::string buf;
|
std::string buf;
|
||||||
if (!disasm.DisassembleOpcode(ptr, &addr, buf))
|
if (!disasm.DisassembleOpcode(ptr, &addr, buf))
|
||||||
{
|
{
|
||||||
ERROR_LOG(DSPLLE, "disasm failed at %04x", addr);
|
ERROR_LOG_FMT(DSPLLE, "disasm failed at {:04x}", addr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTICE_LOG(DSPLLE, "Added %04x %i %s", addr, line_counter, buf.c_str());
|
|
||||||
lines.push_back(buf);
|
lines.push_back(buf);
|
||||||
line_counter++;
|
line_counter++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "Core/HW/DVD/DVDInterface.h"
|
#include "Core/HW/DVD/DVDInterface.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cinttypes>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -266,10 +265,11 @@ static u32 AdvanceDTK(u32 maximum_samples, u32* samples_to_process)
|
||||||
{
|
{
|
||||||
if (s_audio_position >= s_current_start + s_current_length)
|
if (s_audio_position >= s_current_start + s_current_length)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(DVDINTERFACE,
|
DEBUG_LOG_FMT(DVDINTERFACE,
|
||||||
"AdvanceDTK: NextStart=%08" PRIx64 ", NextLength=%08x, "
|
"AdvanceDTK: NextStart={:08x}, NextLength={:08x}, "
|
||||||
"CurrentStart=%08" PRIx64 ", CurrentLength=%08x, AudioPos=%08" PRIx64,
|
"CurrentStart={:08x}, CurrentLength={:08x}, AudioPos={:08x}",
|
||||||
s_next_start, s_next_length, s_current_start, s_current_length, s_audio_position);
|
s_next_start, s_next_length, s_current_start, s_current_length,
|
||||||
|
s_audio_position);
|
||||||
|
|
||||||
s_audio_position = s_next_start;
|
s_audio_position = s_next_start;
|
||||||
s_current_start = s_next_start;
|
s_current_start = s_next_start;
|
||||||
|
@ -483,7 +483,7 @@ static void InsertDiscCallback(u64 userdata, s64 cyclesLate)
|
||||||
if (new_disc)
|
if (new_disc)
|
||||||
SetDisc(std::move(new_disc), {});
|
SetDisc(std::move(new_disc), {});
|
||||||
else
|
else
|
||||||
PanicAlertT("The disc that was about to be inserted couldn't be found.");
|
PanicAlertFmtT("The disc that was about to be inserted couldn't be found.");
|
||||||
|
|
||||||
s_disc_path_to_insert.clear();
|
s_disc_path_to_insert.clear();
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ void ChangeDisc(const std::string& new_path)
|
||||||
{
|
{
|
||||||
if (!s_disc_path_to_insert.empty())
|
if (!s_disc_path_to_insert.empty())
|
||||||
{
|
{
|
||||||
PanicAlertT("A disc is already about to be inserted.");
|
PanicAlertFmtT("A disc is already about to be inserted.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,25 +715,25 @@ static bool CheckReadPreconditions()
|
||||||
{
|
{
|
||||||
if (!IsDiscInside()) // Implies CoverOpened or NoMediumPresent
|
if (!IsDiscInside()) // Implies CoverOpened or NoMediumPresent
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "No disc inside.");
|
ERROR_LOG_FMT(DVDINTERFACE, "No disc inside.");
|
||||||
SetDriveError(DriveError::MediumNotPresent);
|
SetDriveError(DriveError::MediumNotPresent);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (s_drive_state == DriveState::DiscChangeDetected)
|
if (s_drive_state == DriveState::DiscChangeDetected)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Disc changed (motor stopped).");
|
ERROR_LOG_FMT(DVDINTERFACE, "Disc changed (motor stopped).");
|
||||||
SetDriveError(DriveError::MediumChanged);
|
SetDriveError(DriveError::MediumChanged);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (s_drive_state == DriveState::MotorStopped)
|
if (s_drive_state == DriveState::MotorStopped)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Motor stopped.");
|
ERROR_LOG_FMT(DVDINTERFACE, "Motor stopped.");
|
||||||
SetDriveError(DriveError::MotorStopped);
|
SetDriveError(DriveError::MotorStopped);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (s_drive_state == DriveState::DiscIdNotRead)
|
if (s_drive_state == DriveState::DiscIdNotRead)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Disc id not read.");
|
ERROR_LOG_FMT(DVDINTERFACE, "Disc id not read.");
|
||||||
SetDriveError(DriveError::NoDiscID);
|
SetDriveError(DriveError::NoDiscID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -759,8 +759,8 @@ static bool ExecuteReadCommand(u64 dvd_offset, u32 output_address, u32 dvd_lengt
|
||||||
|
|
||||||
if (dvd_length > output_length)
|
if (dvd_length > output_length)
|
||||||
{
|
{
|
||||||
WARN_LOG(DVDINTERFACE, "Detected an attempt to read more data from the DVD "
|
WARN_LOG_FMT(DVDINTERFACE, "Detected an attempt to read more data from the DVD "
|
||||||
"than what fits inside the out buffer. Clamping.");
|
"than what fits inside the out buffer. Clamping.");
|
||||||
dvd_length = output_length;
|
dvd_length = output_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,19 +809,19 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
Memory::Write_U32(0x20060526, s_DIMAR + 4); // Release date
|
Memory::Write_U32(0x20060526, s_DIMAR + 4); // Release date
|
||||||
Memory::Write_U32(0x41000000, s_DIMAR + 8); // Version
|
Memory::Write_U32(0x41000000, s_DIMAR + 8); // Version
|
||||||
|
|
||||||
INFO_LOG(DVDINTERFACE, "DVDLowInquiry (Buffer 0x%08x, 0x%x)", s_DIMAR, s_DILENGTH);
|
INFO_LOG_FMT(DVDINTERFACE, "DVDLowInquiry (Buffer {:#010x}, {:#x})", s_DIMAR, s_DILENGTH);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// GC-only patched drive firmware command, used by libogc
|
// GC-only patched drive firmware command, used by libogc
|
||||||
case DICommand::Unknown55:
|
case DICommand::Unknown55:
|
||||||
INFO_LOG(DVDINTERFACE, "SetExtension");
|
INFO_LOG_FMT(DVDINTERFACE, "SetExtension");
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::ReportKey:
|
case DICommand::ReportKey:
|
||||||
INFO_LOG(DVDINTERFACE, "DVDLowReportKey");
|
INFO_LOG_FMT(DVDINTERFACE, "DVDLowReportKey");
|
||||||
// Does not work on retail discs/drives
|
// Does not work on retail discs/drives
|
||||||
// Retail games send this command to see if they are running on real retail hw
|
// Retail games send this command to see if they are running on real retail hw
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
|
@ -835,24 +835,24 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
{
|
{
|
||||||
case 0x00: // Read Sector
|
case 0x00: // Read Sector
|
||||||
{
|
{
|
||||||
u64 iDVDOffset = static_cast<u64>(s_DICMDBUF[1]) << 2;
|
const u64 dvd_offset = static_cast<u64>(s_DICMDBUF[1]) << 2;
|
||||||
|
|
||||||
INFO_LOG(DVDINTERFACE,
|
INFO_LOG_FMT(
|
||||||
"Read: DVDOffset=%08" PRIx64
|
DVDINTERFACE,
|
||||||
", DMABuffer = %08x, SrcLength = %08x, DMALength = %08x",
|
"Read: DVDOffset={:08x}, DMABuffer = {:08x}, SrcLength = {:08x}, DMALength = {:08x}",
|
||||||
iDVDOffset, s_DIMAR, s_DICMDBUF[2], s_DILENGTH);
|
dvd_offset, s_DIMAR, s_DICMDBUF[2], s_DILENGTH);
|
||||||
|
|
||||||
if (s_drive_state == DriveState::ReadyNoReadsMade)
|
if (s_drive_state == DriveState::ReadyNoReadsMade)
|
||||||
SetDriveState(DriveState::Ready);
|
SetDriveState(DriveState::Ready);
|
||||||
|
|
||||||
command_handled_by_thread =
|
command_handled_by_thread =
|
||||||
ExecuteReadCommand(iDVDOffset, s_DIMAR, s_DICMDBUF[2], s_DILENGTH, DiscIO::PARTITION_NONE,
|
ExecuteReadCommand(dvd_offset, s_DIMAR, s_DICMDBUF[2], s_DILENGTH, DiscIO::PARTITION_NONE,
|
||||||
reply_type, &interrupt_type);
|
reply_type, &interrupt_type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x40: // Read DiscID
|
case 0x40: // Read DiscID
|
||||||
INFO_LOG(DVDINTERFACE, "Read DiscID: buffer %08x", s_DIMAR);
|
INFO_LOG_FMT(DVDINTERFACE, "Read DiscID: buffer {:08x}", s_DIMAR);
|
||||||
if (s_drive_state == DriveState::DiscIdNotRead)
|
if (s_drive_state == DriveState::DiscIdNotRead)
|
||||||
{
|
{
|
||||||
SetDriveState(DriveState::ReadyNoReadsMade);
|
SetDriveState(DriveState::ReadyNoReadsMade);
|
||||||
|
@ -870,7 +870,7 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DVDINTERFACE, "Unknown read subcommand: %08x", s_DICMDBUF[0]);
|
ERROR_LOG_FMT(DVDINTERFACE, "Unknown read subcommand: {:08x}", s_DICMDBUF[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -878,8 +878,8 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
// Used by both GC and Wii
|
// Used by both GC and Wii
|
||||||
case DICommand::Seek:
|
case DICommand::Seek:
|
||||||
// Currently unimplemented
|
// Currently unimplemented
|
||||||
INFO_LOG(DVDINTERFACE, "Seek: offset=%09" PRIx64 " (ignoring)",
|
INFO_LOG_FMT(DVDINTERFACE, "Seek: offset={:09x} (ignoring)",
|
||||||
static_cast<u64>(s_DICMDBUF[1]) << 2);
|
static_cast<u64>(s_DICMDBUF[1]) << 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
|
@ -887,16 +887,16 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
switch ((s_DICMDBUF[0] >> 16) & 0xFF)
|
switch ((s_DICMDBUF[0] >> 16) & 0xFF)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowReadDvdPhysical");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowReadDvdPhysical");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowReadDvdCopyright");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowReadDvdCopyright");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowReadDvdDiscKey");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowReadDvdDiscKey");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DVDINTERFACE, "Unknown 0xAD subcommand in %08x", s_DICMDBUF[0]);
|
ERROR_LOG_FMT(DVDINTERFACE, "Unknown 0xAD subcommand in {:08x}", s_DICMDBUF[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
|
@ -904,33 +904,33 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::ReadDVD:
|
case DICommand::ReadDVD:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowReadDvd");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowReadDvd");
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::ReadDVDConfig:
|
case DICommand::ReadDVDConfig:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowReadDvdConfig");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowReadDvdConfig");
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::StopLaser:
|
case DICommand::StopLaser:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowStopLaser");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowStopLaser");
|
||||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_STOP_LASER);
|
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_STOP_LASER);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::Offset:
|
case DICommand::Offset:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowOffset");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowOffset");
|
||||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_OFFSET);
|
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_OFFSET);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::ReadBCA:
|
case DICommand::ReadBCA:
|
||||||
WARN_LOG(DVDINTERFACE, "DVDLowReadDiskBca - supplying dummy data to appease NSMBW");
|
WARN_LOG_FMT(DVDINTERFACE, "DVDLowReadDiskBca - supplying dummy data to appease NSMBW");
|
||||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_READ_DISK_BCA);
|
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_READ_DISK_BCA);
|
||||||
// NSMBW checks that the first 0x33 bytes of the BCA are 0, then it expects a 1.
|
// NSMBW checks that the first 0x33 bytes of the BCA are 0, then it expects a 1.
|
||||||
// Most (all?) other games have 0x34 0's at the start of the BCA, but don't actually
|
// Most (all?) other games have 0x34 0's at the start of the BCA, but don't actually
|
||||||
|
@ -943,27 +943,27 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::RequestDiscStatus:
|
case DICommand::RequestDiscStatus:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowRequestDiscStatus");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowRequestDiscStatus");
|
||||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_REQUEST_DISC_STATUS);
|
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_REQUEST_DISC_STATUS);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::RequestRetryNumber:
|
case DICommand::RequestRetryNumber:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowRequestRetryNumber");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowRequestRetryNumber");
|
||||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_REQUEST_RETRY_NUMBER);
|
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_REQUEST_RETRY_NUMBER);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::SetMaximumRotation:
|
case DICommand::SetMaximumRotation:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowSetMaximumRotation");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowSetMaximumRotation");
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
// Wii-exclusive
|
// Wii-exclusive
|
||||||
case DICommand::SerMeasControl:
|
case DICommand::SerMeasControl:
|
||||||
ERROR_LOG(DVDINTERFACE, "DVDLowSerMeasControl");
|
ERROR_LOG_FMT(DVDINTERFACE, "DVDLowSerMeasControl");
|
||||||
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_SER_MEAS_CONTROL);
|
DolphinAnalytics::Instance().ReportGameQuirk(GameQuirk::USES_DVD_LOW_SER_MEAS_CONTROL);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
|
@ -979,7 +979,7 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
drive_state = static_cast<u32>(s_drive_state) - 1;
|
drive_state = static_cast<u32>(s_drive_state) - 1;
|
||||||
|
|
||||||
const u32 result = (drive_state << 24) | static_cast<u32>(s_error_code);
|
const u32 result = (drive_state << 24) | static_cast<u32>(s_error_code);
|
||||||
INFO_LOG(DVDINTERFACE, "Requesting error... (0x%08x)", result);
|
INFO_LOG_FMT(DVDINTERFACE, "Requesting error... ({:#010x})", result);
|
||||||
s_DIIMMBUF = result;
|
s_DIIMMBUF = result;
|
||||||
SetDriveError(DriveError::None);
|
SetDriveError(DriveError::None);
|
||||||
break;
|
break;
|
||||||
|
@ -993,15 +993,16 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
{
|
{
|
||||||
if (!CheckReadPreconditions())
|
if (!CheckReadPreconditions())
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Cannot play audio (command %08x)", s_DICMDBUF[0]);
|
ERROR_LOG_FMT(DVDINTERFACE, "Cannot play audio (command {:08x})", s_DICMDBUF[0]);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!s_enable_dtk)
|
if (!s_enable_dtk)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE,
|
ERROR_LOG_FMT(
|
||||||
"Attempted to change playing audio while audio is disabled! (%08x %08x %08x)",
|
DVDINTERFACE,
|
||||||
s_DICMDBUF[0], s_DICMDBUF[1], s_DICMDBUF[2]);
|
"Attempted to change playing audio while audio is disabled! ({:08x} {:08x} {:08x})",
|
||||||
|
s_DICMDBUF[0], s_DICMDBUF[1], s_DICMDBUF[2]);
|
||||||
SetDriveError(DriveError::NoAudioBuf);
|
SetDriveError(DriveError::NoAudioBuf);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1014,10 +1015,10 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
{
|
{
|
||||||
case 0x00:
|
case 0x00:
|
||||||
{
|
{
|
||||||
u64 offset = static_cast<u64>(s_DICMDBUF[1]) << 2;
|
const u64 offset = static_cast<u64>(s_DICMDBUF[1]) << 2;
|
||||||
u32 length = s_DICMDBUF[2];
|
const u32 length = s_DICMDBUF[2];
|
||||||
INFO_LOG(DVDINTERFACE, "(Audio) Start stream: offset: %08" PRIx64 " length: %08x", offset,
|
INFO_LOG_FMT(DVDINTERFACE, "(Audio) Start stream: offset: {:08x} length: {:08x}", offset,
|
||||||
length);
|
length);
|
||||||
|
|
||||||
if ((offset == 0) && (length == 0))
|
if ((offset == 0) && (length == 0))
|
||||||
{
|
{
|
||||||
|
@ -1039,13 +1040,13 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x01:
|
case 0x01:
|
||||||
INFO_LOG(DVDINTERFACE, "(Audio) Stop stream");
|
INFO_LOG_FMT(DVDINTERFACE, "(Audio) Stop stream");
|
||||||
s_stop_at_track_end = false;
|
s_stop_at_track_end = false;
|
||||||
s_stream = false;
|
s_stream = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DVDINTERFACE, "Invalid audio command! (%08x %08x %08x)", s_DICMDBUF[0],
|
ERROR_LOG_FMT(DVDINTERFACE, "Invalid audio command! ({:08x} {:08x} {:08x})", s_DICMDBUF[0],
|
||||||
s_DICMDBUF[1], s_DICMDBUF[2]);
|
s_DICMDBUF[1], s_DICMDBUF[2]);
|
||||||
SetDriveError(DriveError::InvalidAudioCommand);
|
SetDriveError(DriveError::InvalidAudioCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1058,14 +1059,14 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
{
|
{
|
||||||
if (!CheckReadPreconditions())
|
if (!CheckReadPreconditions())
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Attempted to request audio status in an invalid state!");
|
ERROR_LOG_FMT(DVDINTERFACE, "Attempted to request audio status in an invalid state!");
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s_enable_dtk)
|
if (!s_enable_dtk)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Attempted to request audio status while audio is disabled!");
|
ERROR_LOG_FMT(DVDINTERFACE, "Attempted to request audio status while audio is disabled!");
|
||||||
SetDriveError(DriveError::NoAudioBuf);
|
SetDriveError(DriveError::NoAudioBuf);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1074,32 +1075,33 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
switch (s_DICMDBUF[0] >> 16 & 0xFF)
|
switch (s_DICMDBUF[0] >> 16 & 0xFF)
|
||||||
{
|
{
|
||||||
case 0x00: // Returns streaming status
|
case 0x00: // Returns streaming status
|
||||||
INFO_LOG(DVDINTERFACE,
|
INFO_LOG_FMT(DVDINTERFACE,
|
||||||
"(Audio): Stream Status: Request Audio status "
|
"(Audio): Stream Status: Request Audio status "
|
||||||
"AudioPos:%08" PRIx64 "/%08" PRIx64 " "
|
"AudioPos:{:08x}/{:08x} "
|
||||||
"CurrentStart:%08" PRIx64 " CurrentLength:%08x",
|
"CurrentStart:{:08x} CurrentLength:{:08x}",
|
||||||
s_audio_position, s_current_start + s_current_length, s_current_start,
|
s_audio_position, s_current_start + s_current_length, s_current_start,
|
||||||
s_current_length);
|
s_current_length);
|
||||||
s_DIIMMBUF = (s_stream ? 1 : 0);
|
s_DIIMMBUF = (s_stream ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case 0x01: // Returns the current offset
|
case 0x01: // Returns the current offset
|
||||||
INFO_LOG(DVDINTERFACE, "(Audio): Stream Status: Request Audio status AudioPos:%08" PRIx64,
|
INFO_LOG_FMT(DVDINTERFACE, "(Audio): Stream Status: Request Audio status AudioPos:{:08x}",
|
||||||
s_audio_position);
|
s_audio_position);
|
||||||
s_DIIMMBUF = static_cast<u32>((s_audio_position & 0xffffffffffff8000ull) >> 2);
|
s_DIIMMBUF = static_cast<u32>((s_audio_position & 0xffffffffffff8000ull) >> 2);
|
||||||
break;
|
break;
|
||||||
case 0x02: // Returns the start offset
|
case 0x02: // Returns the start offset
|
||||||
INFO_LOG(DVDINTERFACE, "(Audio): Stream Status: Request Audio status CurrentStart:%08" PRIx64,
|
INFO_LOG_FMT(DVDINTERFACE, "(Audio): Stream Status: Request Audio status CurrentStart:{:08x}",
|
||||||
s_current_start);
|
s_current_start);
|
||||||
s_DIIMMBUF = static_cast<u32>(s_current_start >> 2);
|
s_DIIMMBUF = static_cast<u32>(s_current_start >> 2);
|
||||||
break;
|
break;
|
||||||
case 0x03: // Returns the total length
|
case 0x03: // Returns the total length
|
||||||
INFO_LOG(DVDINTERFACE, "(Audio): Stream Status: Request Audio status CurrentLength:%08x",
|
INFO_LOG_FMT(DVDINTERFACE,
|
||||||
s_current_length);
|
"(Audio): Stream Status: Request Audio status CurrentLength:{:08x}",
|
||||||
|
s_current_length);
|
||||||
s_DIIMMBUF = s_current_length;
|
s_DIIMMBUF = s_current_length;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DVDINTERFACE, "Invalid audio status command! (%08x %08x %08x)", s_DICMDBUF[0],
|
ERROR_LOG_FMT(DVDINTERFACE, "Invalid audio status command! ({:08x} {:08x} {:08x})",
|
||||||
s_DICMDBUF[1], s_DICMDBUF[2]);
|
s_DICMDBUF[0], s_DICMDBUF[1], s_DICMDBUF[2]);
|
||||||
SetDriveError(DriveError::InvalidAudioCommand);
|
SetDriveError(DriveError::InvalidAudioCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1112,7 +1114,7 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
{
|
{
|
||||||
const bool eject = (s_DICMDBUF[0] & (1 << 17));
|
const bool eject = (s_DICMDBUF[0] & (1 << 17));
|
||||||
const bool kill = (s_DICMDBUF[0] & (1 << 20));
|
const bool kill = (s_DICMDBUF[0] & (1 << 20));
|
||||||
INFO_LOG(DVDINTERFACE, "DVDLowStopMotor%s%s", eject ? " eject" : "", kill ? " kill!" : "");
|
INFO_LOG_FMT(DVDINTERFACE, "DVDLowStopMotor{}{}", eject ? " eject" : "", kill ? " kill!" : "");
|
||||||
|
|
||||||
if (s_drive_state == DriveState::Ready || s_drive_state == DriveState::ReadyNoReadsMade ||
|
if (s_drive_state == DriveState::Ready || s_drive_state == DriveState::ReadyNoReadsMade ||
|
||||||
s_drive_state == DriveState::DiscIdNotRead)
|
s_drive_state == DriveState::DiscIdNotRead)
|
||||||
|
@ -1147,14 +1149,15 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
// reads. Too early, and you get NoDiscID. Too late, and you get InvalidPeriod.
|
// reads. Too early, and you get NoDiscID. Too late, and you get InvalidPeriod.
|
||||||
if (!CheckReadPreconditions())
|
if (!CheckReadPreconditions())
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Attempted to change DTK configuration in an invalid state!");
|
ERROR_LOG_FMT(DVDINTERFACE, "Attempted to change DTK configuration in an invalid state!");
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_drive_state == DriveState::Ready)
|
if (s_drive_state == DriveState::Ready)
|
||||||
{
|
{
|
||||||
ERROR_LOG(DVDINTERFACE, "Attempted to change DTK configuration after a read has been made!");
|
ERROR_LOG_FMT(DVDINTERFACE,
|
||||||
|
"Attempted to change DTK configuration after a read has been made!");
|
||||||
SetDriveError(DriveError::InvalidPeriod);
|
SetDriveError(DriveError::InvalidPeriod);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1167,7 +1170,7 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
|
|
||||||
// GC-only patched drive firmware command, used by libogc
|
// GC-only patched drive firmware command, used by libogc
|
||||||
case DICommand::UnknownEE:
|
case DICommand::UnknownEE:
|
||||||
INFO_LOG(DVDINTERFACE, "SetStatus");
|
INFO_LOG_FMT(DVDINTERFACE, "SetStatus");
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1177,7 +1180,7 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
// This will appear as unknown commands, unless the check is re-instated to catch such data.
|
// This will appear as unknown commands, unless the check is re-instated to catch such data.
|
||||||
// Can only be used through direct access and only after unlocked.
|
// Can only be used through direct access and only after unlocked.
|
||||||
case DICommand::Debug:
|
case DICommand::Debug:
|
||||||
ERROR_LOG(DVDINTERFACE, "Unsupported DVD Drive debug command 0x%08x", s_DICMDBUF[0]);
|
ERROR_LOG_FMT(DVDINTERFACE, "Unsupported DVD Drive debug command {:#010x}", s_DICMDBUF[0]);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1189,24 +1192,24 @@ void ExecuteCommand(ReplyType reply_type)
|
||||||
{
|
{
|
||||||
if (s_DICMDBUF[0] == 0xFF014D41 && s_DICMDBUF[1] == 0x54534849 && s_DICMDBUF[2] == 0x54410200)
|
if (s_DICMDBUF[0] == 0xFF014D41 && s_DICMDBUF[1] == 0x54534849 && s_DICMDBUF[2] == 0x54410200)
|
||||||
{
|
{
|
||||||
INFO_LOG(DVDINTERFACE, "Unlock test 1 passed");
|
INFO_LOG_FMT(DVDINTERFACE, "Unlock test 1 passed");
|
||||||
}
|
}
|
||||||
else if (s_DICMDBUF[0] == 0xFF004456 && s_DICMDBUF[1] == 0x442D4741 &&
|
else if (s_DICMDBUF[0] == 0xFF004456 && s_DICMDBUF[1] == 0x442D4741 &&
|
||||||
s_DICMDBUF[2] == 0x4D450300)
|
s_DICMDBUF[2] == 0x4D450300)
|
||||||
{
|
{
|
||||||
INFO_LOG(DVDINTERFACE, "Unlock test 2 passed");
|
INFO_LOG_FMT(DVDINTERFACE, "Unlock test 2 passed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
INFO_LOG(DVDINTERFACE, "Unlock test failed");
|
INFO_LOG_FMT(DVDINTERFACE, "Unlock test failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(DVDINTERFACE, "Unknown command 0x%08x (Buffer 0x%08x, 0x%x)", s_DICMDBUF[0], s_DIMAR,
|
ERROR_LOG_FMT(DVDINTERFACE, "Unknown command {:#010x} (Buffer {:#010x}, {:#x})", s_DICMDBUF[0],
|
||||||
s_DILENGTH);
|
s_DIMAR, s_DILENGTH);
|
||||||
PanicAlertT("Unknown DVD command %08x - fatal error", s_DICMDBUF[0]);
|
PanicAlertFmtT("Unknown DVD command {:08x} - fatal error", s_DICMDBUF[0]);
|
||||||
SetDriveError(DriveError::InvalidCommand);
|
SetDriveError(DriveError::InvalidCommand);
|
||||||
interrupt_type = DIInterruptType::DEINT;
|
interrupt_type = DIInterruptType::DEINT;
|
||||||
break;
|
break;
|
||||||
|
@ -1245,9 +1248,9 @@ void AudioBufferConfig(bool enable_dtk, u8 dtk_buffer_length)
|
||||||
s_enable_dtk = enable_dtk;
|
s_enable_dtk = enable_dtk;
|
||||||
s_dtk_buffer_length = dtk_buffer_length;
|
s_dtk_buffer_length = dtk_buffer_length;
|
||||||
if (s_enable_dtk)
|
if (s_enable_dtk)
|
||||||
INFO_LOG(DVDINTERFACE, "DTK enabled: buffer size %d", s_dtk_buffer_length);
|
INFO_LOG_FMT(DVDINTERFACE, "DTK enabled: buffer size {}", s_dtk_buffer_length);
|
||||||
else
|
else
|
||||||
INFO_LOG(DVDINTERFACE, "DTK disabled");
|
INFO_LOG_FMT(DVDINTERFACE, "DTK disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
static u64 PackFinishExecutingCommandUserdata(ReplyType reply_type, DIInterruptType interrupt_type)
|
static u64 PackFinishExecutingCommandUserdata(ReplyType reply_type, DIInterruptType interrupt_type)
|
||||||
|
@ -1374,9 +1377,8 @@ static void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& parti
|
||||||
s_read_buffer_end_offset - STREAMING_BUFFER_SIZE :
|
s_read_buffer_end_offset - STREAMING_BUFFER_SIZE :
|
||||||
0;
|
0;
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE,
|
DEBUG_LOG_FMT(DVDINTERFACE, "Buffer: now={:#x} start time={:#x} end time={:#x}", current_time,
|
||||||
"Buffer: now=0x%" PRIx64 " start time=0x%" PRIx64 " end time=0x%" PRIx64,
|
s_read_buffer_start_time, s_read_buffer_end_time);
|
||||||
current_time, s_read_buffer_start_time, s_read_buffer_end_time);
|
|
||||||
|
|
||||||
if (current_time >= s_read_buffer_end_time)
|
if (current_time >= s_read_buffer_end_time)
|
||||||
{
|
{
|
||||||
|
@ -1404,12 +1406,11 @@ static void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& parti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE, "Buffer: start=0x%" PRIx64 " end=0x%" PRIx64 " avail=0x%" PRIx64,
|
DEBUG_LOG_FMT(DVDINTERFACE, "Buffer: start={:#x} end={:#x} avail={:#x}", buffer_start, buffer_end,
|
||||||
buffer_start, buffer_end, buffer_end - buffer_start);
|
buffer_end - buffer_start);
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE,
|
DEBUG_LOG_FMT(DVDINTERFACE, "Schedule reads: offset={:#x} length={:#x} address={:#x}", offset,
|
||||||
"Schedule reads: offset=0x%" PRIx64 " length=0x%" PRIx32 " address=0x%" PRIx32, offset,
|
length, output_address);
|
||||||
length, output_address);
|
|
||||||
|
|
||||||
s64 ticks_until_completion =
|
s64 ticks_until_completion =
|
||||||
READ_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000);
|
READ_COMMAND_LATENCY_US * (SystemTimers::GetTicksPerSecond() / 1000000);
|
||||||
|
@ -1461,8 +1462,8 @@ static void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& parti
|
||||||
ticks_until_completion += ticks_per_second * DVDMath::CalculateRotationalLatency(
|
ticks_until_completion += ticks_per_second * DVDMath::CalculateRotationalLatency(
|
||||||
dvd_offset, time_after_seek, wii_disc);
|
dvd_offset, time_after_seek, wii_disc);
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE, "Seek+read 0x%" PRIx32 " bytes @ 0x%" PRIx64 " ticks=%" PRId64,
|
DEBUG_LOG_FMT(DVDINTERFACE, "Seek+read {:#x} bytes @ {:#x} ticks={}", chunk_length, offset,
|
||||||
chunk_length, offset, ticks_until_completion);
|
ticks_until_completion);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1518,11 +1519,11 @@ static void ScheduleReads(u64 offset, u32 length, const DiscIO::Partition& parti
|
||||||
s_read_buffer_end_offset - s_read_buffer_start_offset, wii_disc));
|
s_read_buffer_end_offset - s_read_buffer_start_offset, wii_disc));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE,
|
DEBUG_LOG_FMT(DVDINTERFACE,
|
||||||
"Schedule reads: ECC blocks unbuffered=%d, buffered=%d, "
|
"Schedule reads: ECC blocks unbuffered={}, buffered={}, "
|
||||||
"ticks=%" PRId64 ", time=%" PRId64 " us",
|
"ticks={}, time={} us",
|
||||||
unbuffered_blocks, buffered_blocks, ticks_until_completion,
|
unbuffered_blocks, buffered_blocks, ticks_until_completion,
|
||||||
ticks_until_completion * 1000000 / SystemTimers::GetTicksPerSecond());
|
ticks_until_completion * 1000000 / SystemTimers::GetTicksPerSecond());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DVDInterface
|
} // namespace DVDInterface
|
||||||
|
|
|
@ -151,7 +151,7 @@ double CalculateRotationalLatency(u64 offset, double time, bool wii_disc)
|
||||||
|
|
||||||
const double result = angle_diff / MAX_ANGLE / rotations_per_second;
|
const double result = angle_diff / MAX_ANGLE / rotations_per_second;
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE, "Rotational latency: %lf ms", result * 1000);
|
DEBUG_LOG_FMT(DVDINTERFACE, "Rotational latency: {} ms", result * 1000);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,8 @@ double CalculateRawDiscReadTime(u64 offset, u64 length, bool wii_disc)
|
||||||
GC_DISC_INNER_READ_SPEED;
|
GC_DISC_INNER_READ_SPEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE, "Read 0x%" PRIx64 " @ 0x%" PRIx64 " @%lf mm: %lf us, %lf MiB/s", length,
|
DEBUG_LOG_FMT(DVDINTERFACE, "Read {:#x} @ {:#x} @{} mm: {} us, {} MiB/s", length, offset,
|
||||||
offset, physical_offset * 1000, length / speed * 1000 * 1000, speed / 1024 / 1024);
|
physical_offset * 1000, length / speed * 1000 * 1000, speed / 1024 / 1024);
|
||||||
|
|
||||||
return length / speed;
|
return length / speed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "Core/HW/DVD/DVDThread.h"
|
#include "Core/HW/DVD/DVDThread.h"
|
||||||
|
|
||||||
#include <cinttypes>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -159,7 +158,7 @@ void DoState(PointerWrap& p)
|
||||||
if (had_disc != HasDisc())
|
if (had_disc != HasDisc())
|
||||||
{
|
{
|
||||||
if (had_disc)
|
if (had_disc)
|
||||||
PanicAlertT("An inserted disc was expected but not found.");
|
PanicAlertFmtT("An inserted disc was expected but not found.");
|
||||||
else
|
else
|
||||||
s_disc.reset();
|
s_disc.reset();
|
||||||
}
|
}
|
||||||
|
@ -333,20 +332,20 @@ static void FinishRead(u64 id, s64 cycles_late)
|
||||||
const ReadRequest& request = result.first;
|
const ReadRequest& request = result.first;
|
||||||
const std::vector<u8>& buffer = result.second;
|
const std::vector<u8>& buffer = result.second;
|
||||||
|
|
||||||
DEBUG_LOG(DVDINTERFACE,
|
DEBUG_LOG_FMT(DVDINTERFACE,
|
||||||
"Disc has been read. Real time: %" PRIu64 " us. "
|
"Disc has been read. Real time: {} us. "
|
||||||
"Real time including delay: %" PRIu64 " us. "
|
"Real time including delay: {} us. "
|
||||||
"Emulated time including delay: %" PRIu64 " us.",
|
"Emulated time including delay: {} us.",
|
||||||
request.realtime_done_us - request.realtime_started_us,
|
request.realtime_done_us - request.realtime_started_us,
|
||||||
Common::Timer::GetTimeUs() - request.realtime_started_us,
|
Common::Timer::GetTimeUs() - request.realtime_started_us,
|
||||||
(CoreTiming::GetTicks() - request.time_started_ticks) /
|
(CoreTiming::GetTicks() - request.time_started_ticks) /
|
||||||
(SystemTimers::GetTicksPerSecond() / 1000000));
|
(SystemTimers::GetTicksPerSecond() / 1000000));
|
||||||
|
|
||||||
DVDInterface::DIInterruptType interrupt;
|
DVDInterface::DIInterruptType interrupt;
|
||||||
if (buffer.size() != request.length)
|
if (buffer.size() != request.length)
|
||||||
{
|
{
|
||||||
PanicAlertT("The disc could not be read (at 0x%" PRIx64 " - 0x%" PRIx64 ").",
|
PanicAlertFmtT("The disc could not be read (at {:#x} - {:#x}).", request.dvd_offset,
|
||||||
request.dvd_offset, request.dvd_offset + request.length);
|
request.dvd_offset + request.length);
|
||||||
|
|
||||||
DVDInterface::SetDriveError(DVDInterface::DriveError::BlockOOB);
|
DVDInterface::SetDriveError(DVDInterface::DriveError::BlockOOB);
|
||||||
interrupt = DVDInterface::DIInterruptType::DEINT;
|
interrupt = DVDInterface::DIInterruptType::DEINT;
|
||||||
|
|
|
@ -82,9 +82,9 @@ void Log(const DiscIO::Volume& volume, const DiscIO::Partition& partition, u64 o
|
||||||
const std::string path = file_info->GetPath();
|
const std::string path = file_info->GetPath();
|
||||||
const std::string log_string = fmt::format("{} kB {}", size_string, path);
|
const std::string log_string = fmt::format("{} kB {}", size_string, path);
|
||||||
if (IsSoundFile(path))
|
if (IsSoundFile(path))
|
||||||
INFO_LOG(FILEMON, "%s", log_string.c_str());
|
INFO_LOG_FMT(FILEMON, "{}", log_string);
|
||||||
else
|
else
|
||||||
WARN_LOG(FILEMON, "%s", log_string.c_str());
|
WARN_LOG_FMT(FILEMON, "{}", log_string);
|
||||||
|
|
||||||
// Update the last accessed file
|
// Update the last accessed file
|
||||||
s_previous_partition = partition;
|
s_previous_partition = partition;
|
||||||
|
|
|
@ -22,11 +22,11 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
|
|
||||||
if ((fd = open("/dev/tap0", O_RDWR)) < 0)
|
if ((fd = open("/dev/tap0", O_RDWR)) < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Couldn't open /dev/tap0, unable to init BBA");
|
ERROR_LOG_FMT(SP1, "Couldn't open /dev/tap0, unable to init BBA");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(SP1, "BBA initialized.");
|
INFO_LOG_FMT(SP1, "BBA initialized.");
|
||||||
return RecvInit();
|
return RecvInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,12 +48,13 @@ bool CEXIETHERNET::TAPNetworkInterface::IsActivated()
|
||||||
|
|
||||||
bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str());
|
INFO_LOG_FMT(SP1, "SendFrame {}\n{}", size, ArrayToString(frame, size, 0x10));
|
||||||
|
|
||||||
int writtenBytes = write(fd, frame, size);
|
const int written_bytes = write(fd, frame, size);
|
||||||
if ((u32)writtenBytes != size)
|
if (u32(written_bytes) != size)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "SendFrame(): expected to write %d bytes, instead wrote %d", size, writtenBytes);
|
ERROR_LOG_FMT(SP1, "SendFrame(): expected to write {} bytes, instead wrote {}", size,
|
||||||
|
written_bytes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -77,16 +78,16 @@ void CEXIETHERNET::TAPNetworkInterface::ReadThreadHandler(TAPNetworkInterface* s
|
||||||
if (select(self->fd + 1, &rfds, nullptr, nullptr, &timeout) <= 0)
|
if (select(self->fd + 1, &rfds, nullptr, nullptr, &timeout) <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int readBytes = read(self->fd, self->m_eth_ref->mRecvBuffer.get(), BBA_RECV_SIZE);
|
const int read_bytes = read(self->fd, self->m_eth_ref->mRecvBuffer.get(), BBA_RECV_SIZE);
|
||||||
if (readBytes < 0)
|
if (read_bytes < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Failed to read from BBA, err=%d", readBytes);
|
ERROR_LOG_FMT(SP1, "Failed to read from BBA, err={}", read_bytes);
|
||||||
}
|
}
|
||||||
else if (self->readEnabled.IsSet())
|
else if (self->readEnabled.IsSet())
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "Read data: %s",
|
INFO_LOG_FMT(SP1, "Read data: {}",
|
||||||
ArrayToString(self->m_eth_ref->mRecvBuffer.get(), readBytes, 0x10).c_str());
|
ArrayToString(self->m_eth_ref->mRecvBuffer.get(), read_bytes, 0x10));
|
||||||
self->m_eth_ref->mRecvBufferLength = readBytes;
|
self->m_eth_ref->mRecvBufferLength = read_bytes;
|
||||||
self->m_eth_ref->RecvHandlePacket();
|
self->m_eth_ref->RecvHandlePacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
namespace ExpansionInterface
|
namespace ExpansionInterface
|
||||||
{
|
{
|
||||||
#define NOTIMPLEMENTED(Name) \
|
#define NOTIMPLEMENTED(Name) \
|
||||||
NOTICE_LOG(SP1, "CEXIETHERNET::%s not implemented for your UNIX", Name);
|
NOTICE_LOG_FMT(SP1, "CEXIETHERNET::{} not implemented for your UNIX", Name);
|
||||||
|
|
||||||
bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
|
|
||||||
if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
|
if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Couldn't open /dev/net/tun, unable to init BBA");
|
ERROR_LOG_FMT(SP1, "Couldn't open /dev/net/tun, unable to init BBA");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
ERROR_LOG(SP1, "TUNSETIFF failed: Interface=%s err=%d", ifr.ifr_name, err);
|
ERROR_LOG_FMT(SP1, "TUNSETIFF failed: Interface={} err={}", ifr.ifr_name, err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
}
|
}
|
||||||
ioctl(fd, TUNSETNOCSUM, 1);
|
ioctl(fd, TUNSETNOCSUM, 1);
|
||||||
|
|
||||||
INFO_LOG(SP1, "BBA initialized with associated tap %s", ifr.ifr_name);
|
INFO_LOG_FMT(SP1, "BBA initialized with associated tap {}", ifr.ifr_name);
|
||||||
return RecvInit();
|
return RecvInit();
|
||||||
#else
|
#else
|
||||||
NOTIMPLEMENTED("Activate");
|
NOTIMPLEMENTED("Activate");
|
||||||
|
@ -105,12 +105,13 @@ bool CEXIETHERNET::TAPNetworkInterface::IsActivated()
|
||||||
bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
DEBUG_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str());
|
DEBUG_LOG_FMT(SP1, "SendFrame {}\n{}", size, ArrayToString(frame, size, 0x10));
|
||||||
|
|
||||||
int writtenBytes = write(fd, frame, size);
|
int writtenBytes = write(fd, frame, size);
|
||||||
if ((u32)writtenBytes != size)
|
if ((u32)writtenBytes != size)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "SendFrame(): expected to write %d bytes, instead wrote %d", size, writtenBytes);
|
ERROR_LOG_FMT(SP1, "SendFrame(): expected to write {} bytes, instead wrote {}", size,
|
||||||
|
writtenBytes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -142,12 +143,12 @@ void CEXIETHERNET::TAPNetworkInterface::ReadThreadHandler(TAPNetworkInterface* s
|
||||||
int readBytes = read(self->fd, self->m_eth_ref->mRecvBuffer.get(), BBA_RECV_SIZE);
|
int readBytes = read(self->fd, self->m_eth_ref->mRecvBuffer.get(), BBA_RECV_SIZE);
|
||||||
if (readBytes < 0)
|
if (readBytes < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Failed to read from BBA, err=%d", readBytes);
|
ERROR_LOG_FMT(SP1, "Failed to read from BBA, err={}", readBytes);
|
||||||
}
|
}
|
||||||
else if (self->readEnabled.IsSet())
|
else if (self->readEnabled.IsSet())
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "Read data: %s",
|
DEBUG_LOG_FMT(SP1, "Read data: {}",
|
||||||
ArrayToString(self->m_eth_ref->mRecvBuffer.get(), readBytes, 0x10).c_str());
|
ArrayToString(self->m_eth_ref->mRecvBuffer.get(), readBytes, 0x10));
|
||||||
self->m_eth_ref->mRecvBufferLength = readBytes;
|
self->m_eth_ref->mRecvBufferLength = readBytes;
|
||||||
self->m_eth_ref->RecvHandlePacket();
|
self->m_eth_ref->RecvHandlePacket();
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ bool OpenTAP(HANDLE& adapter, const std::basic_string<TCHAR>& device_guid)
|
||||||
|
|
||||||
if (adapter == INVALID_HANDLE_VALUE)
|
if (adapter == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "Failed to open TAP at %s", device_path.c_str());
|
INFO_LOG_FMT(SP1, "Failed to open TAP at {}", WStringToUTF8(device_path));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -179,21 +179,21 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
|
|
||||||
if (!Win32TAPHelper::GetGUIDs(device_guids))
|
if (!Win32TAPHelper::GetGUIDs(device_guids))
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Failed to find a TAP GUID");
|
ERROR_LOG_FMT(SP1, "Failed to find a TAP GUID");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < device_guids.size(); i++)
|
for (const auto& device_guid : device_guids)
|
||||||
{
|
{
|
||||||
if (Win32TAPHelper::OpenTAP(mHAdapter, device_guids.at(i)))
|
if (Win32TAPHelper::OpenTAP(mHAdapter, device_guid))
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "OPENED %s", device_guids.at(i).c_str());
|
INFO_LOG_FMT(SP1, "OPENED {}", WStringToUTF8(device_guid));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mHAdapter == INVALID_HANDLE_VALUE)
|
if (mHAdapter == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
PanicAlert("Failed to open any TAP");
|
PanicAlertFmt("Failed to open any TAP");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,16 +202,17 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION, &info, sizeof(info), &info, sizeof(info),
|
if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION, &info, sizeof(info), &info, sizeof(info),
|
||||||
&len, nullptr))
|
&len, nullptr))
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "TAP-Win32 Driver Version %d.%d %s", info[0], info[1], info[2] ? "(DEBUG)" : "");
|
INFO_LOG_FMT(SP1, "TAP-Win32 Driver Version {}.{} {}", info[0], info[1],
|
||||||
|
info[2] ? "(DEBUG)" : "");
|
||||||
}
|
}
|
||||||
if (!(info[0] > TAP_WIN32_MIN_MAJOR ||
|
if (!(info[0] > TAP_WIN32_MIN_MAJOR ||
|
||||||
(info[0] == TAP_WIN32_MIN_MAJOR && info[1] >= TAP_WIN32_MIN_MINOR)))
|
(info[0] == TAP_WIN32_MIN_MAJOR && info[1] >= TAP_WIN32_MIN_MINOR)))
|
||||||
{
|
{
|
||||||
PanicAlertT("ERROR: This version of Dolphin requires a TAP-Win32 driver"
|
PanicAlertFmtT("ERROR: This version of Dolphin requires a TAP-Win32 driver"
|
||||||
" that is at least version %d.%d -- If you recently upgraded your Dolphin"
|
" that is at least version {0}.{1} -- If you recently upgraded your Dolphin"
|
||||||
" distribution, a reboot is probably required at this point to get"
|
" distribution, a reboot is probably required at this point to get"
|
||||||
" Windows to see the new driver.",
|
" Windows to see the new driver.",
|
||||||
TAP_WIN32_MIN_MAJOR, TAP_WIN32_MIN_MINOR);
|
TAP_WIN32_MIN_MAJOR, TAP_WIN32_MIN_MINOR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,8 +221,8 @@ bool CEXIETHERNET::TAPNetworkInterface::Activate()
|
||||||
if (!DeviceIoControl(mHAdapter, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof(status), &status,
|
if (!DeviceIoControl(mHAdapter, TAP_IOCTL_SET_MEDIA_STATUS, &status, sizeof(status), &status,
|
||||||
sizeof(status), &len, nullptr))
|
sizeof(status), &len, nullptr))
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "WARNING: The TAP-Win32 driver rejected a"
|
ERROR_LOG_FMT(SP1, "WARNING: The TAP-Win32 driver rejected a"
|
||||||
"TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
|
"TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +284,7 @@ void CEXIETHERNET::TAPNetworkInterface::ReadThreadHandler(TAPNetworkInterface* s
|
||||||
// IO should be pending.
|
// IO should be pending.
|
||||||
if (GetLastError() != ERROR_IO_PENDING)
|
if (GetLastError() != ERROR_IO_PENDING)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "ReadFile failed (err=0x%X)", GetLastError());
|
ERROR_LOG_FMT(SP1, "ReadFile failed (err={:#x})", GetLastError());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,14 +296,14 @@ void CEXIETHERNET::TAPNetworkInterface::ReadThreadHandler(TAPNetworkInterface* s
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Something else went wrong.
|
// Something else went wrong.
|
||||||
ERROR_LOG(SP1, "GetOverlappedResult failed (err=0x%X)", GetLastError());
|
ERROR_LOG_FMT(SP1, "GetOverlappedResult failed (err={:#x})", GetLastError());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy to BBA buffer, and fire interrupt if enabled.
|
// Copy to BBA buffer, and fire interrupt if enabled.
|
||||||
DEBUG_LOG(SP1, "Received %u bytes:\n %s", transferred,
|
DEBUG_LOG_FMT(SP1, "Received {} bytes:\n {}", transferred,
|
||||||
ArrayToString(self->m_eth_ref->mRecvBuffer.get(), transferred, 0x10).c_str());
|
ArrayToString(self->m_eth_ref->mRecvBuffer.get(), transferred, 0x10));
|
||||||
if (self->readEnabled.IsSet())
|
if (self->readEnabled.IsSet())
|
||||||
{
|
{
|
||||||
self->m_eth_ref->mRecvBufferLength = transferred;
|
self->m_eth_ref->mRecvBufferLength = transferred;
|
||||||
|
@ -313,7 +314,7 @@ void CEXIETHERNET::TAPNetworkInterface::ReadThreadHandler(TAPNetworkInterface* s
|
||||||
|
|
||||||
bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "SendFrame %u bytes:\n%s", size, ArrayToString(frame, size, 0x10).c_str());
|
DEBUG_LOG_FMT(SP1, "SendFrame {} bytes:\n{}", size, ArrayToString(frame, size, 0x10));
|
||||||
|
|
||||||
// Check for a background write. We can't issue another one until this one has completed.
|
// Check for a background write. We can't issue another one until this one has completed.
|
||||||
DWORD transferred;
|
DWORD transferred;
|
||||||
|
@ -321,7 +322,7 @@ bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
||||||
{
|
{
|
||||||
// Wait for previous write to complete.
|
// Wait for previous write to complete.
|
||||||
if (!GetOverlappedResult(mHAdapter, &mWriteOverlapped, &transferred, TRUE))
|
if (!GetOverlappedResult(mHAdapter, &mWriteOverlapped, &transferred, TRUE))
|
||||||
ERROR_LOG(SP1, "GetOverlappedResult failed (err=0x%X)", GetLastError());
|
ERROR_LOG_FMT(SP1, "GetOverlappedResult failed (err={:#x})", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy to write buffer.
|
// Copy to write buffer.
|
||||||
|
@ -339,7 +340,7 @@ bool CEXIETHERNET::TAPNetworkInterface::SendFrame(const u8* frame, u32 size)
|
||||||
// IO should be pending.
|
// IO should be pending.
|
||||||
if (GetLastError() != ERROR_IO_PENDING)
|
if (GetLastError() != ERROR_IO_PENDING)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "WriteFile failed (err=0x%X)", GetLastError());
|
ERROR_LOG_FMT(SP1, "WriteFile failed (err={:#x})", GetLastError());
|
||||||
ResetEvent(mWriteOverlapped.hEvent);
|
ResetEvent(mWriteOverlapped.hEvent);
|
||||||
mWritePending = false;
|
mWritePending = false;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,7 +29,7 @@ bool CEXIETHERNET::XLinkNetworkInterface::Activate()
|
||||||
|
|
||||||
if (m_sf_socket.bind(sf::Socket::AnyPort) != sf::Socket::Done)
|
if (m_sf_socket.bind(sf::Socket::AnyPort) != sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Couldn't open XLink Kai UDP socket, unable to initialize BBA");
|
ERROR_LOG_FMT(SP1, "Couldn't open XLink Kai UDP socket, unable to initialize BBA");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ bool CEXIETHERNET::XLinkNetworkInterface::Activate()
|
||||||
const auto size = u32(cmd.length());
|
const auto size = u32(cmd.length());
|
||||||
memmove(buffer, cmd.c_str(), size);
|
memmove(buffer, cmd.c_str(), size);
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "SendCommandPayload %x\n%s", size, ArrayToString(buffer, size, 0x10).c_str());
|
DEBUG_LOG_FMT(SP1, "SendCommandPayload {:x}\n{}", size, ArrayToString(buffer, size, 0x10));
|
||||||
|
|
||||||
if (m_sf_socket.send(buffer, size, m_sf_recipient_ip, m_dest_port) != sf::Socket::Done)
|
if (m_sf_socket.send(buffer, size, m_sf_recipient_ip, m_dest_port) != sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Activate(): failed to send connect message to XLink Kai client");
|
ERROR_LOG_FMT(SP1, "Activate(): failed to send connect message to XLink Kai client");
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(SP1, "BBA initialized.");
|
INFO_LOG_FMT(SP1, "BBA initialized.");
|
||||||
|
|
||||||
return RecvInit();
|
return RecvInit();
|
||||||
}
|
}
|
||||||
|
@ -66,14 +66,14 @@ void CEXIETHERNET::XLinkNetworkInterface::Deactivate()
|
||||||
u8 buffer[255] = {};
|
u8 buffer[255] = {};
|
||||||
memmove(buffer, cmd.c_str(), size);
|
memmove(buffer, cmd.c_str(), size);
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "SendCommandPayload %x\n%s", size, ArrayToString(buffer, size, 0x10).c_str());
|
DEBUG_LOG_FMT(SP1, "SendCommandPayload {:x}\n{}", size, ArrayToString(buffer, size, 0x10));
|
||||||
|
|
||||||
if (m_sf_socket.send(buffer, size, m_sf_recipient_ip, m_dest_port) != sf::Socket::Done)
|
if (m_sf_socket.send(buffer, size, m_sf_recipient_ip, m_dest_port) != sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Deactivate(): failed to send disconnect message to XLink Kai client");
|
ERROR_LOG_FMT(SP1, "Deactivate(): failed to send disconnect message to XLink Kai client");
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTICE_LOG(SP1, "XLink Kai BBA deactivated");
|
NOTICE_LOG_FMT(SP1, "XLink Kai BBA deactivated");
|
||||||
|
|
||||||
m_bba_link_up = false;
|
m_bba_link_up = false;
|
||||||
|
|
||||||
|
@ -118,11 +118,12 @@ bool CEXIETHERNET::XLinkNetworkInterface::SendFrame(const u8* frame, u32 size)
|
||||||
size += 4;
|
size += 4;
|
||||||
|
|
||||||
// Only uncomment for debugging, the performance hit is too big otherwise
|
// Only uncomment for debugging, the performance hit is too big otherwise
|
||||||
// INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(m_out_frame, size, 0x10).c_str());
|
// INFO_LOG_FMT(SP1, "SendFrame {}\n{}", size, ArrayToString(m_out_frame, size, 0x10)));
|
||||||
|
|
||||||
if (m_sf_socket.send(m_out_frame, size, m_sf_recipient_ip, m_dest_port) != sf::Socket::Done)
|
if (m_sf_socket.send(m_out_frame, size, m_sf_recipient_ip, m_dest_port) != sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "SendFrame(): expected to write %u bytes, but failed, errno %d", size, errno);
|
ERROR_LOG_FMT(SP1, "SendFrame(): expected to write {} bytes, but failed, errno {}", size,
|
||||||
|
errno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -150,7 +151,7 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
port) != sf::Socket::Done &&
|
port) != sf::Socket::Done &&
|
||||||
self->m_bba_link_up)
|
self->m_bba_link_up)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Failed to read from BBA, err=%zu", bytes_read);
|
ERROR_LOG_FMT(SP1, "Failed to read from BBA, err={}", bytes_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure *anything* was recieved before going any further
|
// Make sure *anything* was recieved before going any further
|
||||||
|
@ -174,13 +175,13 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
// Check the frame size again after the header is removed
|
// Check the frame size again after the header is removed
|
||||||
if (bytes_read < 1)
|
if (bytes_read < 1)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Failed to read from BBA, err=%zu", bytes_read - 4);
|
ERROR_LOG_FMT(SP1, "Failed to read from BBA, err={}", bytes_read - 4);
|
||||||
}
|
}
|
||||||
else if (self->m_read_enabled.IsSet())
|
else if (self->m_read_enabled.IsSet())
|
||||||
{
|
{
|
||||||
// Only uncomment for debugging, the performance hit is too big otherwise
|
// Only uncomment for debugging, the performance hit is too big otherwise
|
||||||
// DEBUG_LOG(SP1, "Read data: %s", ArrayToString(self->m_eth_ref->mRecvBuffer.get(),
|
// DEBUG_LOG_FMT(SP1, "Read data: {}", ArrayToString(self->m_eth_ref->mRecvBuffer.get(),
|
||||||
// u32(bytes_read - 4), 0x10).c_str());
|
// u32(bytes_read - 4), 0x10));
|
||||||
self->m_eth_ref->mRecvBufferLength = u32(bytes_read - 4);
|
self->m_eth_ref->mRecvBufferLength = u32(bytes_read - 4);
|
||||||
self->m_eth_ref->RecvHandlePacket();
|
self->m_eth_ref->RecvHandlePacket();
|
||||||
}
|
}
|
||||||
|
@ -189,13 +190,13 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
// Otherwise we recieved control data or junk
|
// Otherwise we recieved control data or junk
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string control_msg(self->m_in_frame, self->m_in_frame + bytes_read);
|
const std::string control_msg(self->m_in_frame, self->m_in_frame + bytes_read);
|
||||||
INFO_LOG(SP1, "Received XLink Kai control data: %s", control_msg.c_str());
|
INFO_LOG_FMT(SP1, "Received XLink Kai control data: {}", control_msg);
|
||||||
|
|
||||||
// connected;identifier;
|
// connected;identifier;
|
||||||
if (StringBeginsWith(control_msg, "connected"))
|
if (StringBeginsWith(control_msg, "connected"))
|
||||||
{
|
{
|
||||||
NOTICE_LOG(SP1, "XLink Kai BBA connected");
|
NOTICE_LOG_FMT(SP1, "XLink Kai BBA connected");
|
||||||
OSD::AddMessage("XLink Kai BBA connected", 4500);
|
OSD::AddMessage("XLink Kai BBA connected", 4500);
|
||||||
|
|
||||||
self->m_bba_link_up = true;
|
self->m_bba_link_up = true;
|
||||||
|
@ -210,21 +211,21 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
u8 buffer[255] = {};
|
u8 buffer[255] = {};
|
||||||
memmove(buffer, cmd.data(), size);
|
memmove(buffer, cmd.data(), size);
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "SendCommandPayload %x\n%s", size,
|
DEBUG_LOG_FMT(SP1, "SendCommandPayload {:x}\n{}", size,
|
||||||
ArrayToString(buffer, size, 0x10).c_str());
|
ArrayToString(buffer, size, 0x10));
|
||||||
|
|
||||||
if (self->m_sf_socket.send(buffer, size, self->m_sf_recipient_ip, self->m_dest_port) !=
|
if (self->m_sf_socket.send(buffer, size, self->m_sf_recipient_ip, self->m_dest_port) !=
|
||||||
sf::Socket::Done)
|
sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1,
|
ERROR_LOG_FMT(
|
||||||
"ReadThreadHandler(): failed to send setting message to XLink Kai client");
|
SP1, "ReadThreadHandler(): failed to send setting message to XLink Kai client");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// disconnected;optional_identifier;optional_message;
|
// disconnected;optional_identifier;optional_message;
|
||||||
else if (StringBeginsWith(control_msg, "disconnected"))
|
else if (StringBeginsWith(control_msg, "disconnected"))
|
||||||
{
|
{
|
||||||
NOTICE_LOG(SP1, "XLink Kai BBA disconnected");
|
NOTICE_LOG_FMT(SP1, "XLink Kai BBA disconnected");
|
||||||
// Show OSD message for 15 seconds to make sure the user sees it
|
// Show OSD message for 15 seconds to make sure the user sees it
|
||||||
OSD::AddMessage("XLink Kai BBA disconnected", 15000);
|
OSD::AddMessage("XLink Kai BBA disconnected", 15000);
|
||||||
|
|
||||||
|
@ -245,17 +246,16 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
// keepalive;
|
// keepalive;
|
||||||
else if (StringBeginsWith(control_msg, "keepalive"))
|
else if (StringBeginsWith(control_msg, "keepalive"))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "XLink Kai BBA keepalive");
|
DEBUG_LOG_FMT(SP1, "XLink Kai BBA keepalive");
|
||||||
|
|
||||||
// Only uncomment for debugging, just clogs the log otherwise
|
// Only uncomment for debugging, just clogs the log otherwise
|
||||||
// INFO_LOG(SP1, "SendCommandPayload %x\n%s", 2, ArrayToString(m_in_frame, 2,
|
// INFO_LOG_FMT(SP1, "SendCommandPayload {:x}\n{}", 2, ArrayToString(m_in_frame, 2, 0x10));
|
||||||
// 0x10).c_str());
|
|
||||||
|
|
||||||
// Reply (using the message that came in!)
|
// Reply (using the message that came in!)
|
||||||
if (self->m_sf_socket.send(self->m_in_frame, 10, self->m_sf_recipient_ip,
|
if (self->m_sf_socket.send(self->m_in_frame, 10, self->m_sf_recipient_ip,
|
||||||
self->m_dest_port) != sf::Socket::Done)
|
self->m_dest_port) != sf::Socket::Done)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "ReadThreadHandler(): failed to reply to XLink Kai client keepalive");
|
ERROR_LOG_FMT(SP1, "ReadThreadHandler(): failed to reply to XLink Kai client keepalive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// message;message_text;
|
// message;message_text;
|
||||||
|
@ -263,7 +263,7 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
{
|
{
|
||||||
std::string msg = control_msg.substr(8, control_msg.length() - 1);
|
std::string msg = control_msg.substr(8, control_msg.length() - 1);
|
||||||
|
|
||||||
NOTICE_LOG(SP1, "XLink Kai message: %s", msg.c_str());
|
NOTICE_LOG_FMT(SP1, "XLink Kai message: {}", msg);
|
||||||
// Show OSD message for 15 seconds to make sure the user sees it
|
// Show OSD message for 15 seconds to make sure the user sees it
|
||||||
OSD::AddMessage(std::move(msg), 15000);
|
OSD::AddMessage(std::move(msg), 15000);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
{
|
{
|
||||||
std::string msg = control_msg.substr(5, control_msg.length() - 1);
|
std::string msg = control_msg.substr(5, control_msg.length() - 1);
|
||||||
|
|
||||||
NOTICE_LOG(SP1, "XLink Kai chat: %s", msg.c_str());
|
NOTICE_LOG_FMT(SP1, "XLink Kai chat: {}", msg);
|
||||||
OSD::AddMessage(std::move(msg), 5000);
|
OSD::AddMessage(std::move(msg), 5000);
|
||||||
}
|
}
|
||||||
// directmessage;message_text;
|
// directmessage;message_text;
|
||||||
|
@ -280,7 +280,7 @@ void CEXIETHERNET::XLinkNetworkInterface::ReadThreadHandler(
|
||||||
{
|
{
|
||||||
std::string msg = control_msg.substr(14, control_msg.length() - 1);
|
std::string msg = control_msg.substr(14, control_msg.length() - 1);
|
||||||
|
|
||||||
NOTICE_LOG(SP1, "XLink Kai direct message: %s", msg.c_str());
|
NOTICE_LOG_FMT(SP1, "XLink Kai direct message: {}", msg);
|
||||||
OSD::AddMessage(std::move(msg), 5000);
|
OSD::AddMessage(std::move(msg), 5000);
|
||||||
}
|
}
|
||||||
// else junk/unsupported control message
|
// else junk/unsupported control message
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/Logging/Log.h"
|
||||||
|
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/EXI/EXI.h"
|
#include "Core/HW/EXI/EXI.h"
|
||||||
|
@ -178,10 +179,10 @@ void CEXIChannel::AddDevice(std::unique_ptr<IEXIDevice> device, const int device
|
||||||
{
|
{
|
||||||
DEBUG_ASSERT(device_num < NUM_DEVICES);
|
DEBUG_ASSERT(device_num < NUM_DEVICES);
|
||||||
|
|
||||||
INFO_LOG(EXPANSIONINTERFACE,
|
INFO_LOG_FMT(EXPANSIONINTERFACE,
|
||||||
"Changing EXI channel %d, device %d to type %d (notify software: %s)",
|
"Changing EXI channel {}, device {} to type {} (notify software: {})", m_channel_id,
|
||||||
static_cast<int>(m_channel_id), device_num, static_cast<int>(device->m_device_type),
|
device_num, static_cast<int>(device->m_device_type),
|
||||||
notify_presence_changed ? "true" : "false");
|
notify_presence_changed ? "true" : "false");
|
||||||
|
|
||||||
// Replace it with the new one
|
// Replace it with the new one
|
||||||
m_devices[device_num] = std::move(device);
|
m_devices[device_num] = std::move(device);
|
||||||
|
|
|
@ -76,15 +76,14 @@ void CEXIAgp::LoadRom()
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string ext;
|
std::string ext;
|
||||||
std::string gbapath;
|
|
||||||
SplitPath(m_slot == 0 ? SConfig::GetInstance().m_strGbaCartA :
|
SplitPath(m_slot == 0 ? SConfig::GetInstance().m_strGbaCartA :
|
||||||
SConfig::GetInstance().m_strGbaCartB,
|
SConfig::GetInstance().m_strGbaCartB,
|
||||||
&path, &filename, &ext);
|
&path, &filename, &ext);
|
||||||
gbapath = path + filename;
|
const std::string gbapath = path + filename;
|
||||||
LoadFileToROM(gbapath + ext);
|
LoadFileToROM(gbapath + ext);
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "Loaded GBA rom: %s card: %d", gbapath.c_str(), m_slot);
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "Loaded GBA rom: {} card: {}", gbapath, m_slot);
|
||||||
LoadFileToEEPROM(gbapath + ".sav");
|
LoadFileToEEPROM(gbapath + ".sav");
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "Loaded GBA sav: %s card: %d", gbapath.c_str(), m_slot);
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "Loaded GBA sav: {} card: {}", gbapath, m_slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIAgp::LoadFileToROM(const std::string& filename)
|
void CEXIAgp::LoadFileToROM(const std::string& filename)
|
||||||
|
@ -272,7 +271,7 @@ void CEXIAgp::ImmWrite(u32 _uData, u32 _uSize)
|
||||||
|
|
||||||
u8 HashCmd;
|
u8 HashCmd;
|
||||||
u64 Mask;
|
u64 Mask;
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "AGP command %x", _uData);
|
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "AGP command {:x}", _uData);
|
||||||
switch (m_current_cmd)
|
switch (m_current_cmd)
|
||||||
{
|
{
|
||||||
case 0xAE020000: // set up 24 bit address for read 2 bytes
|
case 0xAE020000: // set up 24 bit address for read 2 bytes
|
||||||
|
|
|
@ -17,25 +17,25 @@ CEXIDummy::CEXIDummy(const std::string& name) : m_name{name}
|
||||||
|
|
||||||
void CEXIDummy::ImmWrite(u32 data, u32 size)
|
void CEXIDummy::ImmWrite(u32 data, u32 size)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_name.c_str(), data);
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "EXI DUMMY {} ImmWrite: {:08x}", m_name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CEXIDummy::ImmRead(u32 size)
|
u32 CEXIDummy::ImmRead(u32 size)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_name.c_str());
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "EXI DUMMY {} ImmRead", m_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIDummy::DMAWrite(u32 address, u32 size)
|
void CEXIDummy::DMAWrite(u32 address, u32 size)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device",
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "EXI DUMMY {} DMAWrite: {:08x} bytes, from {:08x} to device",
|
||||||
m_name.c_str(), size, address);
|
m_name, size, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIDummy::DMARead(u32 address, u32 size)
|
void CEXIDummy::DMARead(u32 address, u32 size)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x",
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "EXI DUMMY {} DMARead: {:08x} bytes, from device to {:08x}",
|
||||||
m_name.c_str(), size, address);
|
m_name, size, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEXIDummy::IsPresent() const
|
bool CEXIDummy::IsPresent() const
|
||||||
|
|
|
@ -46,7 +46,7 @@ CEXIETHERNET::CEXIETHERNET(BBADeviceType type)
|
||||||
{
|
{
|
||||||
case BBADeviceType::TAP:
|
case BBADeviceType::TAP:
|
||||||
m_network_interface = std::make_unique<TAPNetworkInterface>(this);
|
m_network_interface = std::make_unique<TAPNetworkInterface>(this);
|
||||||
INFO_LOG(SP1, "Created TAP physical network interface.");
|
INFO_LOG_FMT(SP1, "Created TAP physical network interface.");
|
||||||
break;
|
break;
|
||||||
case BBADeviceType::XLINK:
|
case BBADeviceType::XLINK:
|
||||||
// TODO start BBA with network link down, bring it up after "connected" response from XLink
|
// TODO start BBA with network link down, bring it up after "connected" response from XLink
|
||||||
|
@ -57,9 +57,10 @@ CEXIETHERNET::CEXIETHERNET(BBADeviceType type)
|
||||||
if (!StringBeginsWith(mac_addr_setting, "00:09:bf") &&
|
if (!StringBeginsWith(mac_addr_setting, "00:09:bf") &&
|
||||||
!StringBeginsWith(mac_addr_setting, "00:17:ab"))
|
!StringBeginsWith(mac_addr_setting, "00:17:ab"))
|
||||||
{
|
{
|
||||||
PanicAlertT("BBA MAC address %s invalid for XLink Kai. A valid Nintendo GameCube MAC address "
|
PanicAlertFmtT(
|
||||||
"must be used. Generate a new MAC address starting with 00:09:bf or 00:17:ab.",
|
"BBA MAC address {0} invalid for XLink Kai. A valid Nintendo GameCube MAC address "
|
||||||
mac_addr_setting.c_str());
|
"must be used. Generate a new MAC address starting with 00:09:bf or 00:17:ab.",
|
||||||
|
mac_addr_setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_client_mdentifier should be unique per connected emulator from the XLink kai client's
|
// m_client_mdentifier should be unique per connected emulator from the XLink kai client's
|
||||||
|
@ -67,8 +68,8 @@ CEXIETHERNET::CEXIETHERNET(BBADeviceType type)
|
||||||
m_network_interface = std::make_unique<XLinkNetworkInterface>(
|
m_network_interface = std::make_unique<XLinkNetworkInterface>(
|
||||||
this, SConfig::GetInstance().m_bba_xlink_ip, 34523,
|
this, SConfig::GetInstance().m_bba_xlink_ip, 34523,
|
||||||
"dolphin" + SConfig::GetInstance().m_bba_mac, SConfig::GetInstance().m_bba_xlink_chat_osd);
|
"dolphin" + SConfig::GetInstance().m_bba_mac, SConfig::GetInstance().m_bba_xlink_chat_osd);
|
||||||
INFO_LOG(SP1, "Created XLink Kai BBA network interface connection to %s:34523",
|
INFO_LOG_FMT(SP1, "Created XLink Kai BBA network interface connection to {}:34523",
|
||||||
SConfig::GetInstance().m_bba_xlink_ip.c_str());
|
SConfig::GetInstance().m_bba_xlink_ip);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,14 +124,15 @@ void CEXIETHERNET::ImmWrite(u32 data, u32 size)
|
||||||
transfer.address = (data >> 8) & 0xffff;
|
transfer.address = (data >> 8) & 0xffff;
|
||||||
transfer.direction = IsWriteCommand(data) ? transfer.WRITE : transfer.READ;
|
transfer.direction = IsWriteCommand(data) ? transfer.WRITE : transfer.READ;
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "%s %s %s %x", IsMXCommand(data) ? "mx " : "exi",
|
DEBUG_LOG_FMT(SP1, "{} {} {} {:x}", IsMXCommand(data) ? "mx " : "exi",
|
||||||
IsWriteCommand(data) ? "write" : "read ", GetRegisterName(), transfer.address);
|
IsWriteCommand(data) ? "write" : "read ", GetRegisterName(), transfer.address);
|
||||||
|
|
||||||
if (transfer.address == BBA_IOB && transfer.region == transfer.MX)
|
if (transfer.address == BBA_IOB && transfer.region == transfer.MX)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "Usage of BBA_IOB indicates that the rx packet descriptor has been corrupted. "
|
ERROR_LOG_FMT(SP1,
|
||||||
"Killing Dolphin...");
|
"Usage of BBA_IOB indicates that the rx packet descriptor has been corrupted. "
|
||||||
exit(0);
|
"Killing Dolphin...");
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// transfer has been setup
|
// transfer has been setup
|
||||||
|
@ -139,7 +141,7 @@ void CEXIETHERNET::ImmWrite(u32 data, u32 size)
|
||||||
|
|
||||||
// Reach here if we're actually writing data to the EXI or MX region.
|
// Reach here if we're actually writing data to the EXI or MX region.
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "%s write %0*x", transfer.region == transfer.MX ? "mx " : "exi", size * 2, data);
|
DEBUG_LOG_FMT(SP1, "{} write {:x}", transfer.region == transfer.MX ? "mx " : "exi", data);
|
||||||
|
|
||||||
if (transfer.region == transfer.EXI)
|
if (transfer.region == transfer.EXI)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +195,7 @@ u32 CEXIETHERNET::ImmRead(u32 size)
|
||||||
ret |= mBbaMem[transfer.address++] << (i * 8);
|
ret |= mBbaMem[transfer.address++] << (i * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(SP1, "imm r%i: %0*x", size, size * 2, ret);
|
DEBUG_LOG_FMT(SP1, "imm r{}: {:x}", size, ret);
|
||||||
|
|
||||||
ret <<= (4 - size) * 8;
|
ret <<= (4 - size) * 8;
|
||||||
|
|
||||||
|
@ -202,7 +204,7 @@ u32 CEXIETHERNET::ImmRead(u32 size)
|
||||||
|
|
||||||
void CEXIETHERNET::DMAWrite(u32 addr, u32 size)
|
void CEXIETHERNET::DMAWrite(u32 addr, u32 size)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "DMA write: %08x %x", addr, size);
|
DEBUG_LOG_FMT(SP1, "DMA write: {:08x} {:x}", addr, size);
|
||||||
|
|
||||||
if (transfer.region == transfer.MX && transfer.direction == transfer.WRITE &&
|
if (transfer.region == transfer.MX && transfer.direction == transfer.WRITE &&
|
||||||
transfer.address == BBA_WRTXFIFOD)
|
transfer.address == BBA_WRTXFIFOD)
|
||||||
|
@ -211,15 +213,15 @@ void CEXIETHERNET::DMAWrite(u32 addr, u32 size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "DMA write in %s %s mode - not implemented",
|
ERROR_LOG_FMT(SP1, "DMA write in {} {} mode - not implemented",
|
||||||
transfer.region == transfer.EXI ? "exi" : "mx",
|
transfer.region == transfer.EXI ? "exi" : "mx",
|
||||||
transfer.direction == transfer.READ ? "read" : "write");
|
transfer.direction == transfer.READ ? "read" : "write");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIETHERNET::DMARead(u32 addr, u32 size)
|
void CEXIETHERNET::DMARead(u32 addr, u32 size)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "DMA read: %08x %x", addr, size);
|
DEBUG_LOG_FMT(SP1, "DMA read: {:08x} {:x}", addr, size);
|
||||||
|
|
||||||
Memory::CopyToEmu(addr, &mBbaMem[transfer.address], size);
|
Memory::CopyToEmu(addr, &mBbaMem[transfer.address], size);
|
||||||
|
|
||||||
|
@ -334,36 +336,36 @@ void CEXIETHERNET::MXCommandHandler(u32 data, u32 size)
|
||||||
switch (transfer.address)
|
switch (transfer.address)
|
||||||
{
|
{
|
||||||
case BBA_NCRA:
|
case BBA_NCRA:
|
||||||
if (data & NCRA_RESET)
|
if ((data & NCRA_RESET) != 0)
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "Software reset");
|
INFO_LOG_FMT(SP1, "Software reset");
|
||||||
// MXSoftReset();
|
// MXSoftReset();
|
||||||
m_network_interface->Activate();
|
m_network_interface->Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mBbaMem[BBA_NCRA] & NCRA_SR) ^ (data & NCRA_SR))
|
if (((mBbaMem[BBA_NCRA] & NCRA_SR) ^ (data & NCRA_SR)) != 0)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "%s rx", (data & NCRA_SR) ? "start" : "stop");
|
DEBUG_LOG_FMT(SP1, "{} rx", (data & NCRA_SR) ? "start" : "stop");
|
||||||
|
|
||||||
if (data & NCRA_SR)
|
if ((data & NCRA_SR) != 0)
|
||||||
m_network_interface->RecvStart();
|
m_network_interface->RecvStart();
|
||||||
else
|
else
|
||||||
m_network_interface->RecvStop();
|
m_network_interface->RecvStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only start transfer if there isn't one currently running
|
// Only start transfer if there isn't one currently running
|
||||||
if (!(mBbaMem[BBA_NCRA] & (NCRA_ST0 | NCRA_ST1)))
|
if ((mBbaMem[BBA_NCRA] & (NCRA_ST0 | NCRA_ST1)) == 0)
|
||||||
{
|
{
|
||||||
// Technically transfer DMA status is kept in TXDMA - not implemented
|
// Technically transfer DMA status is kept in TXDMA - not implemented
|
||||||
|
|
||||||
if (data & NCRA_ST0)
|
if ((data & NCRA_ST0) != 0)
|
||||||
{
|
{
|
||||||
INFO_LOG(SP1, "start tx - local DMA");
|
INFO_LOG_FMT(SP1, "start tx - local DMA");
|
||||||
SendFromPacketBuffer();
|
SendFromPacketBuffer();
|
||||||
}
|
}
|
||||||
else if (data & NCRA_ST1)
|
else if ((data & NCRA_ST1) != 0)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(SP1, "start tx - direct FIFO");
|
DEBUG_LOG_FMT(SP1, "start tx - direct FIFO");
|
||||||
SendFromDirectFIFO();
|
SendFromDirectFIFO();
|
||||||
// Kind of a hack: send completes instantly, so we don't
|
// Kind of a hack: send completes instantly, so we don't
|
||||||
// actually write the "send in status" bit to the register
|
// actually write the "send in status" bit to the register
|
||||||
|
@ -426,7 +428,7 @@ void CEXIETHERNET::SendFromDirectFIFO()
|
||||||
|
|
||||||
void CEXIETHERNET::SendFromPacketBuffer()
|
void CEXIETHERNET::SendFromPacketBuffer()
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "tx packet buffer not implemented.");
|
ERROR_LOG_FMT(SP1, "tx packet buffer not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIETHERNET::SendComplete()
|
void CEXIETHERNET::SendComplete()
|
||||||
|
@ -523,11 +525,11 @@ bool CEXIETHERNET::RecvHandlePacket()
|
||||||
goto wait_for_next;
|
goto wait_for_next;
|
||||||
|
|
||||||
#ifdef BBA_TRACK_PAGE_PTRS
|
#ifdef BBA_TRACK_PAGE_PTRS
|
||||||
INFO_LOG(SP1, "RecvHandlePacket %x\n%s", mRecvBufferLength,
|
INFO_LOG_FMT(SP1, "RecvHandlePacket {:x}\n{}", mRecvBufferLength,
|
||||||
ArrayToString(mRecvBuffer, mRecvBufferLength, 0x100).c_str());
|
ArrayToString(mRecvBuffer, mRecvBufferLength, 0x100));
|
||||||
|
|
||||||
INFO_LOG(SP1, "%x %x %x %x", page_ptr(BBA_BP), page_ptr(BBA_RRP), page_ptr(BBA_RWP),
|
INFO_LOG_FMT(SP1, "{:x} {:x} {:x} {:x}", page_ptr(BBA_BP), page_ptr(BBA_RRP), page_ptr(BBA_RWP),
|
||||||
page_ptr(BBA_RHBP));
|
page_ptr(BBA_RHBP));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
write_ptr = ptr_from_page_ptr(BBA_RWP);
|
write_ptr = ptr_from_page_ptr(BBA_RWP);
|
||||||
|
@ -574,23 +576,23 @@ bool CEXIETHERNET::RecvHandlePacket()
|
||||||
inc_rwp();
|
inc_rwp();
|
||||||
|
|
||||||
#ifdef BBA_TRACK_PAGE_PTRS
|
#ifdef BBA_TRACK_PAGE_PTRS
|
||||||
INFO_LOG(SP1, "%x %x %x %x", page_ptr(BBA_BP), page_ptr(BBA_RRP), page_ptr(BBA_RWP),
|
INFO_LOG_FMT(SP1, "{:x} {:x} {:x} {:x}", page_ptr(BBA_BP), page_ptr(BBA_RRP), page_ptr(BBA_RWP),
|
||||||
page_ptr(BBA_RHBP));
|
page_ptr(BBA_RHBP));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Is the current frame multicast?
|
// Is the current frame multicast?
|
||||||
if (mRecvBuffer[0] & 0x01)
|
if ((mRecvBuffer[0] & 1) != 0)
|
||||||
status |= DESC_MF;
|
status |= DESC_MF;
|
||||||
|
|
||||||
if (status & DESC_BF)
|
if ((status & DESC_BF) != 0)
|
||||||
{
|
{
|
||||||
if (mBbaMem[BBA_MISC2] & MISC2_AUTORCVR)
|
if ((mBbaMem[BBA_MISC2] & MISC2_AUTORCVR) != 0)
|
||||||
{
|
{
|
||||||
*(u16*)&mBbaMem[BBA_RWP] = rwp_initial;
|
*(u16*)&mBbaMem[BBA_RWP] = rwp_initial;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR_LOG(SP1, "RBF while AUTORCVR == 0!");
|
ERROR_LOG_FMT(SP1, "RBF while AUTORCVR == 0!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +601,7 @@ bool CEXIETHERNET::RecvHandlePacket()
|
||||||
mBbaMem[BBA_LRPS] = status;
|
mBbaMem[BBA_LRPS] = status;
|
||||||
|
|
||||||
// Raise interrupt
|
// Raise interrupt
|
||||||
if (mBbaMem[BBA_IMR] & INT_R)
|
if ((mBbaMem[BBA_IMR] & INT_R) != 0)
|
||||||
{
|
{
|
||||||
mBbaMem[BBA_IR] |= INT_R;
|
mBbaMem[BBA_IR] |= INT_R;
|
||||||
|
|
||||||
|
@ -609,11 +611,11 @@ bool CEXIETHERNET::RecvHandlePacket()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This occurs if software is still processing the last raised recv interrupt
|
// This occurs if software is still processing the last raised recv interrupt
|
||||||
WARN_LOG(SP1, "NOT raising recv interrupt");
|
WARN_LOG_FMT(SP1, "NOT raising recv interrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_for_next:
|
wait_for_next:
|
||||||
if (mBbaMem[BBA_NCRA] & NCRA_SR)
|
if ((mBbaMem[BBA_NCRA] & NCRA_SR) != 0)
|
||||||
m_network_interface->RecvStart();
|
m_network_interface->RecvStart();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -221,7 +221,7 @@ void CEXIGecko::ImmReadWrite(u32& _uData, u32 _uSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(EXPANSIONINTERFACE, "Unknown USBGecko command %x", _uData);
|
ERROR_LOG_FMT(EXPANSIONINTERFACE, "Unknown USBGecko command {:x}", _uData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,8 @@ CEXIIPL::CEXIIPL()
|
||||||
// Descramble the encrypted section (contains BS1 and BS2)
|
// Descramble the encrypted section (contains BS1 and BS2)
|
||||||
Descrambler(&m_rom[0x100], 0x1afe00);
|
Descrambler(&m_rom[0x100], 0x1afe00);
|
||||||
// yay for null-terminated strings
|
// yay for null-terminated strings
|
||||||
INFO_LOG(BOOT, "Loaded bootrom: %s", &m_rom[0]);
|
const std::string_view name{reinterpret_cast<char*>(m_rom.get())};
|
||||||
|
INFO_LOG_FMT(BOOT, "Loaded bootrom: {}", name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -232,10 +233,10 @@ void CEXIIPL::LoadFontFile(const std::string& filename, u32 offset)
|
||||||
|
|
||||||
// Official Windows-1252 and Shift JIS fonts present on the IPL dumps are 0x2575 and 0x4a24d
|
// Official Windows-1252 and Shift JIS fonts present on the IPL dumps are 0x2575 and 0x4a24d
|
||||||
// bytes long respectively, so, determine the size of the font being loaded based on the offset
|
// bytes long respectively, so, determine the size of the font being loaded based on the offset
|
||||||
u64 fontsize = (offset == 0x1aff00) ? 0x4a24d : 0x2575;
|
const u64 fontsize = (offset == 0x1aff00) ? 0x4a24d : 0x2575;
|
||||||
|
|
||||||
INFO_LOG(BOOT, "Found IPL dump, loading %s font from %s",
|
INFO_LOG_FMT(BOOT, "Found IPL dump, loading {} font from {}",
|
||||||
((offset == 0x1aff00) ? "Shift JIS" : "Windows-1252"), (ipl_rom_path).c_str());
|
(offset == 0x1aff00) ? "Shift JIS" : "Windows-1252", ipl_rom_path);
|
||||||
|
|
||||||
stream.Seek(offset, 0);
|
stream.Seek(offset, 0);
|
||||||
stream.ReadBytes(&m_rom[offset], fontsize);
|
stream.ReadBytes(&m_rom[offset], fontsize);
|
||||||
|
@ -279,17 +280,18 @@ void CEXIIPL::TransferByte(u8& data)
|
||||||
// This is technically not very accurate :(
|
// This is technically not very accurate :(
|
||||||
UpdateRTC();
|
UpdateRTC();
|
||||||
|
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "IPL-DEV cmd %s %08x %02x",
|
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "IPL-DEV cmd {} {:08x} {:02x}",
|
||||||
m_command.is_write() ? "write" : "read", m_command.address(), m_command.low_bits());
|
m_command.is_write() ? "write" : "read", m_command.address(),
|
||||||
|
m_command.low_bits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Actually read or write a byte
|
// Actually read or write a byte
|
||||||
u32 address = m_command.address();
|
const u32 address = m_command.address();
|
||||||
|
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "IPL-DEV data %s %08x %02x",
|
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "IPL-DEV data {} {:08x} {:02x}",
|
||||||
m_command.is_write() ? "write" : "read", address, data);
|
m_command.is_write() ? "write" : "read", address, data);
|
||||||
|
|
||||||
#define IN_RANGE(x) (address >= x##_BASE && address < x##_BASE + x##_SIZE)
|
#define IN_RANGE(x) (address >= x##_BASE && address < x##_BASE + x##_SIZE)
|
||||||
#define DEV_ADDR(x) (address - x##_BASE)
|
#define DEV_ADDR(x) (address - x##_BASE)
|
||||||
|
@ -303,7 +305,7 @@ void CEXIIPL::TransferByte(u8& data)
|
||||||
|
|
||||||
if (data == '\r')
|
if (data == '\r')
|
||||||
{
|
{
|
||||||
NOTICE_LOG(OSREPORT, "%s", SHIFTJISToUTF8(m_buffer).c_str());
|
NOTICE_LOG_FMT(OSREPORT, "{}", SHIFTJISToUTF8(m_buffer));
|
||||||
m_buffer.clear();
|
m_buffer.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,13 +330,13 @@ void CEXIIPL::TransferByte(u8& data)
|
||||||
{
|
{
|
||||||
if (dev_addr >= 0x001FCF00)
|
if (dev_addr >= 0x001FCF00)
|
||||||
{
|
{
|
||||||
PanicAlertT("Error: Trying to access Windows-1252 fonts but they are not loaded. "
|
PanicAlertFmtT("Error: Trying to access Windows-1252 fonts but they are not loaded. "
|
||||||
"Games may not show fonts correctly, or crash.");
|
"Games may not show fonts correctly, or crash.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PanicAlertT("Error: Trying to access Shift JIS fonts but they are not loaded. "
|
PanicAlertFmtT("Error: Trying to access Shift JIS fonts but they are not loaded. "
|
||||||
"Games may not show fonts correctly, or crash.");
|
"Games may not show fonts correctly, or crash.");
|
||||||
}
|
}
|
||||||
// Don't be a nag
|
// Don't be a nag
|
||||||
m_fonts_loaded = true;
|
m_fonts_loaded = true;
|
||||||
|
@ -361,7 +363,7 @@ void CEXIIPL::TransferByte(u8& data)
|
||||||
// Seen being written to after reading 4 bytes from barnacle
|
// Seen being written to after reading 4 bytes from barnacle
|
||||||
break;
|
break;
|
||||||
case 0x4c:
|
case 0x4c:
|
||||||
DEBUG_LOG(OSREPORT, "UART Barnacle %x", data);
|
DEBUG_LOG_FMT(OSREPORT, "UART Barnacle {:x}", data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,7 +389,7 @@ void CEXIIPL::TransferByte(u8& data)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NOTICE_LOG(EXPANSIONINTERFACE, "IPL-DEV Accessing unknown device");
|
NOTICE_LOG_FMT(EXPANSIONINTERFACE, "IPL-DEV Accessing unknown device");
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DEV_ADDR_CURSOR
|
#undef DEV_ADDR_CURSOR
|
||||||
|
|
|
@ -199,7 +199,7 @@ void CEXIMemoryCard::SetupGciFolder(const Memcard::HeaderData& header_data)
|
||||||
{
|
{
|
||||||
if (File::Rename(strDirectoryName, strDirectoryName + ".original"))
|
if (File::Rename(strDirectoryName, strDirectoryName + ".original"))
|
||||||
{
|
{
|
||||||
PanicAlertT("%s was not a directory, moved to *.original", strDirectoryName.c_str());
|
PanicAlertFmtT("{0} was not a directory, moved to *.original", strDirectoryName);
|
||||||
if (migrate)
|
if (migrate)
|
||||||
MigrateFromMemcardFile(strDirectoryName + DIR_SEP, card_index);
|
MigrateFromMemcardFile(strDirectoryName + DIR_SEP, card_index);
|
||||||
else
|
else
|
||||||
|
@ -208,10 +208,10 @@ void CEXIMemoryCard::SetupGciFolder(const Memcard::HeaderData& header_data)
|
||||||
else // we tried but the user wants to crash
|
else // we tried but the user wants to crash
|
||||||
{
|
{
|
||||||
// TODO more user friendly abort
|
// TODO more user friendly abort
|
||||||
PanicAlertT("%s is not a directory, failed to move to *.original.\n Verify your "
|
PanicAlertFmtT("{0} is not a directory, failed to move to *.original.\n Verify your "
|
||||||
"write permissions or move the file outside of Dolphin",
|
"write permissions or move the file outside of Dolphin",
|
||||||
strDirectoryName.c_str());
|
strDirectoryName);
|
||||||
exit(0);
|
std::exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ bool CEXIMemoryCard::IsInterruptSet()
|
||||||
|
|
||||||
void CEXIMemoryCard::TransferByte(u8& byte)
|
void CEXIMemoryCard::TransferByte(u8& byte)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: > %02x", byte);
|
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "EXI MEMCARD: > {:02x}", byte);
|
||||||
if (m_uPosition == 0)
|
if (m_uPosition == 0)
|
||||||
{
|
{
|
||||||
command = byte; // first byte is command
|
command = byte; // first byte is command
|
||||||
|
@ -361,11 +361,11 @@ void CEXIMemoryCard::TransferByte(u8& byte)
|
||||||
case cmdPageProgram:
|
case cmdPageProgram:
|
||||||
case cmdExtraByteProgram:
|
case cmdExtraByteProgram:
|
||||||
case cmdChipErase:
|
case cmdChipErase:
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x at position 0. seems normal.",
|
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "EXI MEMCARD: command {:02x} at position 0. seems normal.",
|
||||||
command);
|
command);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x at position 0", command);
|
WARN_LOG_FMT(EXPANSIONINTERFACE, "EXI MEMCARD: command {:02x} at position 0", command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (command == cmdClearStatus)
|
if (command == cmdClearStatus)
|
||||||
|
@ -486,12 +486,12 @@ void CEXIMemoryCard::TransferByte(u8& byte)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WARN_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: unknown command byte %02x", byte);
|
WARN_LOG_FMT(EXPANSIONINTERFACE, "EXI MEMCARD: unknown command byte {:02x}", byte);
|
||||||
byte = 0xFF;
|
byte = 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_uPosition++;
|
m_uPosition++;
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: < %02x", byte);
|
DEBUG_LOG_FMT(EXPANSIONINTERFACE, "EXI MEMCARD: < {:02x}", byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIMemoryCard::DoState(PointerWrap& p)
|
void CEXIMemoryCard::DoState(PointerWrap& p)
|
||||||
|
@ -534,7 +534,7 @@ void CEXIMemoryCard::DMARead(u32 _uAddr, u32 _uSize)
|
||||||
|
|
||||||
if ((address + _uSize) % Memcard::BLOCK_SIZE == 0)
|
if ((address + _uSize) % Memcard::BLOCK_SIZE == 0)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "reading from block: %x", address / Memcard::BLOCK_SIZE);
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "reading from block: {:x}", address / Memcard::BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule transfer complete later based on read speed
|
// Schedule transfer complete later based on read speed
|
||||||
|
@ -550,7 +550,7 @@ void CEXIMemoryCard::DMAWrite(u32 _uAddr, u32 _uSize)
|
||||||
|
|
||||||
if (((address + _uSize) % Memcard::BLOCK_SIZE) == 0)
|
if (((address + _uSize) % Memcard::BLOCK_SIZE) == 0)
|
||||||
{
|
{
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "writing to block: %x", address / Memcard::BLOCK_SIZE);
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "writing to block: {:x}", address / Memcard::BLOCK_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule transfer complete later based on write speed
|
// Schedule transfer complete later based on write speed
|
||||||
|
|
|
@ -82,7 +82,7 @@ void CEXIMic::StreamStart()
|
||||||
u32 minimum_latency;
|
u32 minimum_latency;
|
||||||
if (cubeb_get_min_latency(m_cubeb_ctx.get(), ¶ms, &minimum_latency) != CUBEB_OK)
|
if (cubeb_get_min_latency(m_cubeb_ctx.get(), ¶ms, &minimum_latency) != CUBEB_OK)
|
||||||
{
|
{
|
||||||
WARN_LOG(EXPANSIONINTERFACE, "Error getting minimum latency");
|
WARN_LOG_FMT(EXPANSIONINTERFACE, "Error getting minimum latency");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cubeb_stream_init(m_cubeb_ctx.get(), &m_cubeb_stream, "Dolphin Emulated GameCube Microphone",
|
if (cubeb_stream_init(m_cubeb_ctx.get(), &m_cubeb_stream, "Dolphin Emulated GameCube Microphone",
|
||||||
|
@ -90,17 +90,17 @@ void CEXIMic::StreamStart()
|
||||||
std::max<u32>(buff_size_samples, minimum_latency), DataCallback,
|
std::max<u32>(buff_size_samples, minimum_latency), DataCallback,
|
||||||
state_callback, this) != CUBEB_OK)
|
state_callback, this) != CUBEB_OK)
|
||||||
{
|
{
|
||||||
ERROR_LOG(EXPANSIONINTERFACE, "Error initializing cubeb stream");
|
ERROR_LOG_FMT(EXPANSIONINTERFACE, "Error initializing cubeb stream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cubeb_stream_start(m_cubeb_stream) != CUBEB_OK)
|
if (cubeb_stream_start(m_cubeb_stream) != CUBEB_OK)
|
||||||
{
|
{
|
||||||
ERROR_LOG(EXPANSIONINTERFACE, "Error starting cubeb stream");
|
ERROR_LOG_FMT(EXPANSIONINTERFACE, "Error starting cubeb stream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(EXPANSIONINTERFACE, "started cubeb stream");
|
INFO_LOG_FMT(EXPANSIONINTERFACE, "started cubeb stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIMic::StreamStop()
|
void CEXIMic::StreamStop()
|
||||||
|
@ -108,7 +108,7 @@ void CEXIMic::StreamStop()
|
||||||
if (m_cubeb_stream)
|
if (m_cubeb_stream)
|
||||||
{
|
{
|
||||||
if (cubeb_stream_stop(m_cubeb_stream) != CUBEB_OK)
|
if (cubeb_stream_stop(m_cubeb_stream) != CUBEB_OK)
|
||||||
ERROR_LOG(EXPANSIONINTERFACE, "Error stopping cubeb stream");
|
ERROR_LOG_FMT(EXPANSIONINTERFACE, "Error stopping cubeb stream");
|
||||||
cubeb_stream_destroy(m_cubeb_stream);
|
cubeb_stream_destroy(m_cubeb_stream);
|
||||||
m_cubeb_stream = nullptr;
|
m_cubeb_stream = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ void CEXIMic::TransferByte(u8& byte)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG(EXPANSIONINTERFACE, "EXI MIC: unknown command byte %02x", command);
|
ERROR_LOG_FMT(EXPANSIONINTERFACE, "EXI MIC: unknown command byte {:02x}", command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,8 +184,8 @@ template <typename T>
|
||||||
ReadHandlingMethod<T>* InvalidRead()
|
ReadHandlingMethod<T>* InvalidRead()
|
||||||
{
|
{
|
||||||
return ComplexRead<T>([](u32 addr) {
|
return ComplexRead<T>([](u32 addr) {
|
||||||
ERROR_LOG(MEMMAP, "Trying to read %zu bits from an invalid MMIO (addr=%08x)", 8 * sizeof(T),
|
ERROR_LOG_FMT(MEMMAP, "Trying to read {} bits from an invalid MMIO (addr={:08x})",
|
||||||
addr);
|
8 * sizeof(T), addr);
|
||||||
return -1;
|
return -1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ template <typename T>
|
||||||
WriteHandlingMethod<T>* InvalidWrite()
|
WriteHandlingMethod<T>* InvalidWrite()
|
||||||
{
|
{
|
||||||
return ComplexWrite<T>([](u32 addr, T val) {
|
return ComplexWrite<T>([](u32 addr, T val) {
|
||||||
ERROR_LOG(MEMMAP, "Trying to write %zu bits to an invalid MMIO (addr=%08x, val=%08x)",
|
ERROR_LOG_FMT(MEMMAP, "Trying to write {} bits to an invalid MMIO (addr={:08x}, val={:08x})",
|
||||||
8 * sizeof(T), addr, (u32)val);
|
8 * sizeof(T), addr, val);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ void Init()
|
||||||
|
|
||||||
if (!*region.out_pointer)
|
if (!*region.out_pointer)
|
||||||
{
|
{
|
||||||
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
|
PanicAlertFmt("MemoryMap_Setup: Failed finding a memory base.");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ void Init()
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p", m_pRAM);
|
INFO_LOG_FMT(MEMMAP, "Memory system initialized. RAM at {}", fmt::ptr(m_pRAM));
|
||||||
m_IsInitialized = true;
|
m_IsInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ void UpdateLogicalMemory(const PowerPC::BatTable& dbat_table)
|
||||||
void* mapped_pointer = g_arena.CreateView(position, mapped_size, base);
|
void* mapped_pointer = g_arena.CreateView(position, mapped_size, base);
|
||||||
if (!mapped_pointer)
|
if (!mapped_pointer)
|
||||||
{
|
{
|
||||||
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
|
PanicAlertFmt("MemoryMap_Setup: Failed finding a memory base.");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
logical_mapped_entries.push_back({mapped_pointer, mapped_size});
|
logical_mapped_entries.push_back({mapped_pointer, mapped_size});
|
||||||
|
@ -418,7 +418,7 @@ void Shutdown()
|
||||||
}
|
}
|
||||||
g_arena.ReleaseSHMSegment();
|
g_arena.ReleaseSHMSegment();
|
||||||
mmio_mapping.reset();
|
mmio_mapping.reset();
|
||||||
INFO_LOG(MEMMAP, "Memory system shut down.");
|
INFO_LOG_FMT(MEMMAP, "Memory system shut down.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownFastmemArena()
|
void ShutdownFastmemArena()
|
||||||
|
@ -482,7 +482,7 @@ void CopyFromEmu(void* data, u32 address, size_t size)
|
||||||
void* pointer = GetPointerForRange(address, size);
|
void* pointer = GetPointerForRange(address, size);
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
{
|
{
|
||||||
PanicAlert("Invalid range in CopyFromEmu. %zx bytes from 0x%08x", size, address);
|
PanicAlertFmt("Invalid range in CopyFromEmu. {:x} bytes from {:#010x}", size, address);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(data, pointer, size);
|
memcpy(data, pointer, size);
|
||||||
|
@ -496,7 +496,7 @@ void CopyToEmu(u32 address, const void* data, size_t size)
|
||||||
void* pointer = GetPointerForRange(address, size);
|
void* pointer = GetPointerForRange(address, size);
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
{
|
{
|
||||||
PanicAlert("Invalid range in CopyToEmu. %zx bytes to 0x%08x", size, address);
|
PanicAlertFmt("Invalid range in CopyToEmu. {:x} bytes to {:#010x}", size, address);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(pointer, data, size);
|
memcpy(pointer, data, size);
|
||||||
|
@ -510,7 +510,7 @@ void Memset(u32 address, u8 value, size_t size)
|
||||||
void* pointer = GetPointerForRange(address, size);
|
void* pointer = GetPointerForRange(address, size);
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
{
|
{
|
||||||
PanicAlert("Invalid range in Memset. %zx bytes at 0x%08x", size, address);
|
PanicAlertFmt("Invalid range in Memset. {:x} bytes at {:#010x}", size, address);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(pointer, value, size);
|
memset(pointer, value, size);
|
||||||
|
@ -547,8 +547,7 @@ u8* GetPointer(u32 address)
|
||||||
return m_pEXRAM + (address & GetExRamMask());
|
return m_pEXRAM + (address & GetExRamMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
PanicAlert("Unknown Pointer 0x%08x PC 0x%08x LR 0x%08x", address, PC, LR);
|
PanicAlertFmt("Unknown Pointer {:#010x} PC {:#010x} LR {:#010x}", address, PC, LR);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "Common/Assert.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/DVD/DVDInterface.h"
|
#include "Core/HW/DVD/DVDInterface.h"
|
||||||
|
@ -109,16 +111,17 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
MMIO::DirectWrite<u32>(&Fifo_CPUWritePointer, 0xFFFFFFE0));
|
MMIO::DirectWrite<u32>(&Fifo_CPUWritePointer, 0xFFFFFFE0));
|
||||||
|
|
||||||
mmio->Register(base | PI_FIFO_RESET, MMIO::InvalidRead<u32>(),
|
mmio->Register(base | PI_FIFO_RESET, MMIO::InvalidRead<u32>(),
|
||||||
MMIO::ComplexWrite<u32>(
|
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||||
[](u32, u32 val) { WARN_LOG(PROCESSORINTERFACE, "Fifo reset (%08x)", val); }));
|
WARN_LOG_FMT(PROCESSORINTERFACE, "Fifo reset ({:08x})", val);
|
||||||
|
}));
|
||||||
|
|
||||||
mmio->Register(base | PI_RESET_CODE, MMIO::ComplexRead<u32>([](u32) {
|
mmio->Register(base | PI_RESET_CODE, MMIO::ComplexRead<u32>([](u32) {
|
||||||
DEBUG_LOG(PROCESSORINTERFACE, "Read PI_RESET_CODE: %08x", m_ResetCode);
|
DEBUG_LOG_FMT(PROCESSORINTERFACE, "Read PI_RESET_CODE: {:08x}", m_ResetCode);
|
||||||
return m_ResetCode;
|
return m_ResetCode;
|
||||||
}),
|
}),
|
||||||
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](u32, u32 val) {
|
||||||
m_ResetCode = val;
|
m_ResetCode = val;
|
||||||
INFO_LOG(PROCESSORINTERFACE, "Wrote PI_RESET_CODE: %08x", m_ResetCode);
|
INFO_LOG_FMT(PROCESSORINTERFACE, "Wrote PI_RESET_CODE: {:08x}", m_ResetCode);
|
||||||
if (!SConfig::GetInstance().bWii && ~m_ResetCode & 0x4)
|
if (!SConfig::GetInstance().bWii && ~m_ResetCode & 0x4)
|
||||||
{
|
{
|
||||||
DVDInterface::ResetDrive(true);
|
DVDInterface::ResetDrive(true);
|
||||||
|
@ -193,13 +196,14 @@ void SetInterrupt(u32 cause_mask, bool set)
|
||||||
|
|
||||||
if (set && !(m_InterruptCause & cause_mask))
|
if (set && !(m_InterruptCause & cause_mask))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (set)", Debug_GetInterruptName(cause_mask));
|
DEBUG_LOG_FMT(PROCESSORINTERFACE, "Setting Interrupt {} (set)",
|
||||||
|
Debug_GetInterruptName(cause_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!set && (m_InterruptCause & cause_mask))
|
if (!set && (m_InterruptCause & cause_mask))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (clear)",
|
DEBUG_LOG_FMT(PROCESSORINTERFACE, "Setting Interrupt {} (clear)",
|
||||||
Debug_GetInterruptName(cause_mask));
|
Debug_GetInterruptName(cause_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set)
|
if (set)
|
||||||
|
|
|
@ -63,7 +63,7 @@ void InitSRAM()
|
||||||
{
|
{
|
||||||
if (!file.ReadArray(&g_SRAM, 1))
|
if (!file.ReadArray(&g_SRAM, 1))
|
||||||
{
|
{
|
||||||
ERROR_LOG(EXPANSIONINTERFACE, "EXI IPL-DEV: Could not read all of SRAM");
|
ERROR_LOG_FMT(EXPANSIONINTERFACE, "EXI IPL-DEV: Could not read all of SRAM");
|
||||||
g_SRAM = sram_dump;
|
g_SRAM = sram_dump;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <cinttypes>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
@ -193,8 +192,8 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate)
|
||||||
const s64 max_fallback = config.iTimingVariance * 1000;
|
const s64 max_fallback = config.iTimingVariance * 1000;
|
||||||
if (std::abs(diff) > max_fallback)
|
if (std::abs(diff) > max_fallback)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(COMMON, "system too %s, %" PRIi64 " ms skipped", diff < 0 ? "slow" : "fast",
|
DEBUG_LOG_FMT(COMMON, "system too {}, {} ms skipped", diff < 0 ? "slow" : "fast",
|
||||||
std::abs(diff) - max_fallback);
|
std::abs(diff) - max_fallback);
|
||||||
last_time = time - max_fallback;
|
last_time = time - max_fallback;
|
||||||
}
|
}
|
||||||
else if (diff > 1000)
|
else if (diff > 1000)
|
||||||
|
|
|
@ -315,9 +315,9 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
base | VI_VERTICAL_BEAM_POSITION,
|
base | VI_VERTICAL_BEAM_POSITION,
|
||||||
MMIO::ComplexRead<u16>([](u32) { return 1 + (s_half_line_count) / 2; }),
|
MMIO::ComplexRead<u16>([](u32) { return 1 + (s_half_line_count) / 2; }),
|
||||||
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
||||||
WARN_LOG(VIDEOINTERFACE,
|
WARN_LOG_FMT(
|
||||||
"Changing vertical beam position to 0x%04x - not documented or implemented yet",
|
VIDEOINTERFACE,
|
||||||
val);
|
"Changing vertical beam position to {:#06x} - not documented or implemented yet", val);
|
||||||
}));
|
}));
|
||||||
mmio->Register(
|
mmio->Register(
|
||||||
base | VI_HORIZONTAL_BEAM_POSITION, MMIO::ComplexRead<u16>([](u32) {
|
base | VI_HORIZONTAL_BEAM_POSITION, MMIO::ComplexRead<u16>([](u32) {
|
||||||
|
@ -327,9 +327,10 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
return std::clamp<u16>(value, 1, m_HTiming0.HLW * 2);
|
return std::clamp<u16>(value, 1, m_HTiming0.HLW * 2);
|
||||||
}),
|
}),
|
||||||
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
||||||
WARN_LOG(VIDEOINTERFACE,
|
WARN_LOG_FMT(
|
||||||
"Changing horizontal beam position to 0x%04x - not documented or implemented yet",
|
VIDEOINTERFACE,
|
||||||
val);
|
"Changing horizontal beam position to {:#06x} - not documented or implemented yet",
|
||||||
|
val);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// The following MMIOs are interrupts related and update interrupt status
|
// The following MMIOs are interrupts related and update interrupt status
|
||||||
|
@ -363,13 +364,13 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
MMIO::ComplexRead<u16>([](u32) { return m_UnkAARegister >> 16; }),
|
MMIO::ComplexRead<u16>([](u32) { return m_UnkAARegister >> 16; }),
|
||||||
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
||||||
m_UnkAARegister = (m_UnkAARegister & 0x0000FFFF) | ((u32)val << 16);
|
m_UnkAARegister = (m_UnkAARegister & 0x0000FFFF) | ((u32)val << 16);
|
||||||
WARN_LOG(VIDEOINTERFACE, "Writing to the unknown AA register (hi)");
|
WARN_LOG_FMT(VIDEOINTERFACE, "Writing to the unknown AA register (hi)");
|
||||||
}));
|
}));
|
||||||
mmio->Register(base | VI_UNK_AA_REG_LO,
|
mmio->Register(base | VI_UNK_AA_REG_LO,
|
||||||
MMIO::ComplexRead<u16>([](u32) { return m_UnkAARegister & 0xFFFF; }),
|
MMIO::ComplexRead<u16>([](u32) { return m_UnkAARegister & 0xFFFF; }),
|
||||||
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
MMIO::ComplexWrite<u16>([](u32, u16 val) {
|
||||||
m_UnkAARegister = (m_UnkAARegister & 0xFFFF0000) | val;
|
m_UnkAARegister = (m_UnkAARegister & 0xFFFF0000) | val;
|
||||||
WARN_LOG(VIDEOINTERFACE, "Writing to the unknown AA register (lo)");
|
WARN_LOG_FMT(VIDEOINTERFACE, "Writing to the unknown AA register (lo)");
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Control register writes only updates some select bits, and additional
|
// Control register writes only updates some select bits, and additional
|
||||||
|
@ -744,16 +745,17 @@ static void LogField(FieldType field, u32 xfb_address)
|
||||||
|
|
||||||
const auto field_index = static_cast<size_t>(field);
|
const auto field_index = static_cast<size_t>(field);
|
||||||
|
|
||||||
DEBUG_LOG(VIDEOINTERFACE,
|
DEBUG_LOG_FMT(VIDEOINTERFACE,
|
||||||
"(VI->BeginField): Address: %.08X | WPL %u | STD %u | EQ %u | PRB %u | "
|
"(VI->BeginField): Address: {:08X} | WPL {} | STD {} | EQ {} | PRB {} | "
|
||||||
"ACV %u | PSB %u | Field %s",
|
"ACV {} | PSB {} | Field {}",
|
||||||
xfb_address, m_PictureConfiguration.WPL, m_PictureConfiguration.STD,
|
xfb_address, m_PictureConfiguration.WPL, m_PictureConfiguration.STD,
|
||||||
m_VerticalTimingRegister.EQU, vert_timing[field_index]->PRB,
|
m_VerticalTimingRegister.EQU, vert_timing[field_index]->PRB,
|
||||||
m_VerticalTimingRegister.ACV, vert_timing[field_index]->PSB,
|
m_VerticalTimingRegister.ACV, vert_timing[field_index]->PSB,
|
||||||
field_type_names[field_index]);
|
field_type_names[field_index]);
|
||||||
|
|
||||||
DEBUG_LOG(VIDEOINTERFACE, "HorizScaling: %04x | fbwidth %d | %u | %u", m_HorizontalScaling.Hex,
|
DEBUG_LOG_FMT(VIDEOINTERFACE, "HorizScaling: {:04x} | fbwidth {} | {} | {}",
|
||||||
m_FBWidth.Hex, GetTicksPerEvenField(), GetTicksPerOddField());
|
m_HorizontalScaling.Hex, m_FBWidth.Hex, GetTicksPerEvenField(),
|
||||||
|
GetTicksPerOddField());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BeginField(FieldType field, u64 ticks)
|
static void BeginField(FieldType field, u64 ticks)
|
||||||
|
|
|
@ -145,7 +145,7 @@ void Init()
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
INFO_LOG(WII_IPC, "Resetting ...");
|
INFO_LOG_FMT(WII_IPC, "Resetting ...");
|
||||||
InitState();
|
InitState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,22 +238,22 @@ void ClearX1()
|
||||||
ctrl.X1 = 0;
|
ctrl.X1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateAck(u32 _Address)
|
void GenerateAck(u32 address)
|
||||||
{
|
{
|
||||||
ctrl.Y2 = 1;
|
ctrl.Y2 = 1;
|
||||||
DEBUG_LOG(WII_IPC, "GenerateAck: %08x | %08x [R:%i A:%i E:%i]", ppc_msg, _Address, ctrl.Y1,
|
DEBUG_LOG_FMT(WII_IPC, "GenerateAck: {:08x} | {:08x} [R:{} A:{} E:{}]", ppc_msg, address, ctrl.Y1,
|
||||||
ctrl.Y2, ctrl.X1);
|
ctrl.Y2, ctrl.X1);
|
||||||
// Based on a hardware test, the IPC interrupt takes approximately 100 TB ticks to fire
|
// Based on a hardware test, the IPC interrupt takes approximately 100 TB ticks to fire
|
||||||
// after Y2 is seen in the control register.
|
// after Y2 is seen in the control register.
|
||||||
CoreTiming::ScheduleEvent(100 * SystemTimers::TIMER_RATIO, updateInterrupts);
|
CoreTiming::ScheduleEvent(100 * SystemTimers::TIMER_RATIO, updateInterrupts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateReply(u32 _Address)
|
void GenerateReply(u32 address)
|
||||||
{
|
{
|
||||||
arm_msg = _Address;
|
arm_msg = address;
|
||||||
ctrl.Y1 = 1;
|
ctrl.Y1 = 1;
|
||||||
DEBUG_LOG(WII_IPC, "GenerateReply: %08x | %08x [R:%i A:%i E:%i]", ppc_msg, _Address, ctrl.Y1,
|
DEBUG_LOG_FMT(WII_IPC, "GenerateReply: {:08x} | {:08x} [R:{} A:{} E:{}]", ppc_msg, address,
|
||||||
ctrl.Y2, ctrl.X1);
|
ctrl.Y1, ctrl.Y2, ctrl.X1);
|
||||||
// Based on a hardware test, the IPC interrupt takes approximately 100 TB ticks to fire
|
// Based on a hardware test, the IPC interrupt takes approximately 100 TB ticks to fire
|
||||||
// after Y1 is seen in the control register.
|
// after Y1 is seen in the control register.
|
||||||
CoreTiming::ScheduleEvent(100 * SystemTimers::TIMER_RATIO, updateInterrupts);
|
CoreTiming::ScheduleEvent(100 * SystemTimers::TIMER_RATIO, updateInterrupts);
|
||||||
|
|
|
@ -74,8 +74,8 @@ void DoState(PointerWrap& p);
|
||||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||||
|
|
||||||
void ClearX1();
|
void ClearX1();
|
||||||
void GenerateAck(u32 _Address);
|
void GenerateAck(u32 address);
|
||||||
void GenerateReply(u32 _Address);
|
void GenerateReply(u32 address);
|
||||||
|
|
||||||
bool IsReady();
|
bool IsReady();
|
||||||
} // namespace IOS
|
} // namespace IOS
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cinttypes>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <mbedtls/md5.h>
|
#include <mbedtls/md5.h>
|
||||||
|
@ -255,11 +254,12 @@ public:
|
||||||
std::array<u8, 0x10> iv = s_sd_initial_iv;
|
std::array<u8, 0x10> iv = s_sd_initial_iv;
|
||||||
m_iosc.Decrypt(IOS::HLE::IOSC::HANDLE_SD_KEY, iv.data(), reinterpret_cast<const u8*>(&header),
|
m_iosc.Decrypt(IOS::HLE::IOSC::HANDLE_SD_KEY, iv.data(), reinterpret_cast<const u8*>(&header),
|
||||||
sizeof(Header), reinterpret_cast<u8*>(&header), IOS::PID_ES);
|
sizeof(Header), reinterpret_cast<u8*>(&header), IOS::PID_ES);
|
||||||
u32 banner_size = header.banner_size;
|
const u32 banner_size = header.banner_size;
|
||||||
if ((banner_size < FULL_BNR_MIN) || (banner_size > FULL_BNR_MAX) ||
|
if ((banner_size < FULL_BNR_MIN) || (banner_size > FULL_BNR_MAX) ||
|
||||||
(((banner_size - BNR_SZ) % ICON_SZ) != 0))
|
(((banner_size - BNR_SZ) % ICON_SZ) != 0))
|
||||||
{
|
{
|
||||||
ERROR_LOG(CONSOLE, "Not a Wii save or read failure for file header size %x", banner_size);
|
ERROR_LOG_FMT(CONSOLE, "Not a Wii save or read failure for file header size {:x}",
|
||||||
|
banner_size);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,9 +269,9 @@ public:
|
||||||
mbedtls_md5_ret(reinterpret_cast<const u8*>(&header), sizeof(Header), md5_calc.data());
|
mbedtls_md5_ret(reinterpret_cast<const u8*>(&header), sizeof(Header), md5_calc.data());
|
||||||
if (md5_file != md5_calc)
|
if (md5_file != md5_calc)
|
||||||
{
|
{
|
||||||
ERROR_LOG(CONSOLE, "MD5 mismatch\n %016" PRIx64 "%016" PRIx64 " != %016" PRIx64 "%016" PRIx64,
|
ERROR_LOG_FMT(CONSOLE, "MD5 mismatch\n {:016x}{:016x} != {:016x}{:016x}",
|
||||||
Common::swap64(md5_file.data()), Common::swap64(md5_file.data() + 8),
|
Common::swap64(md5_file.data()), Common::swap64(md5_file.data() + 8),
|
||||||
Common::swap64(md5_calc.data()), Common::swap64(md5_calc.data() + 8));
|
Common::swap64(md5_calc.data()), Common::swap64(md5_calc.data() + 8));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return header;
|
return header;
|
||||||
|
@ -392,7 +392,7 @@ public:
|
||||||
|
|
||||||
if (!WriteSignatures())
|
if (!WriteSignatures())
|
||||||
{
|
{
|
||||||
ERROR_LOG(CORE, "WiiSave::WriteFiles: Failed to write signatures");
|
ERROR_LOG_FMT(CORE, "WiiSave::WriteFiles: Failed to write signatures");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -447,13 +447,14 @@ StoragePointer MakeDataBinStorage(IOS::HLE::IOSC* iosc, const std::string& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static bool Copy(const char* description, Storage* source, std::optional<T> (Storage::*read_fn)(),
|
static bool Copy(std::string_view description, Storage* source,
|
||||||
Storage* dest, bool (Storage::*write_fn)(const T&))
|
std::optional<T> (Storage::*read_fn)(), Storage* dest,
|
||||||
|
bool (Storage::*write_fn)(const T&))
|
||||||
{
|
{
|
||||||
const std::optional<T> data = (source->*read_fn)();
|
const std::optional<T> data = (source->*read_fn)();
|
||||||
if (data && (dest->*write_fn)(*data))
|
if (data && (dest->*write_fn)(*data))
|
||||||
return true;
|
return true;
|
||||||
ERROR_LOG(CORE, "WiiSave::Copy: Failed to %s %s", !data ? "read" : "write", description);
|
ERROR_LOG_FMT(CORE, "WiiSave::Copy: Failed to {} {}", !data ? "read" : "write", description);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +472,7 @@ bool Import(const std::string& data_bin_path, std::function<bool()> can_overwrit
|
||||||
const std::optional<Header> header = data_bin->ReadHeader();
|
const std::optional<Header> header = data_bin->ReadHeader();
|
||||||
if (!header)
|
if (!header)
|
||||||
{
|
{
|
||||||
ERROR_LOG(CORE, "WiiSave::Import: Failed to read header");
|
ERROR_LOG_FMT(CORE, "WiiSave::Import: Failed to read header");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto nand = MakeNandStorage(ios.GetFS().get(), header->tid);
|
const auto nand = MakeNandStorage(ios.GetFS().get(), header->tid);
|
||||||
|
|
Loading…
Reference in New Issue