bool DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread) { m_hWnd = hWnd; m_bWii = bWii; m_bDSPThread = bDSPThread; m_InitMixer = false; std::string irom_file = File::GetUserPath(D_GCUSER_IDX) + DSP_IROM; std::string coef_file = File::GetUserPath(D_GCUSER_IDX) + DSP_COEF; if (!File::Exists(irom_file)) irom_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_IROM; if (!File::Exists(coef_file)) coef_file = File::GetSysDirectory() + GC_SYS_DIR DIR_SEP DSP_COEF; if (!DSPCore_Init(irom_file.c_str(), coef_file.c_str(), AudioCommon::UseJIT())) return false; g_dsp.cpu_ram = Memory::GetPointer(0); DSPCore_Reset(); m_bIsRunning = true; InitInstructionTable(); if (m_bDSPThread) m_hDSPThread = std::thread(dsp_thread, this); Host_RefreshDSPDebuggerWindow(); return true; }
void WriteCR(u16 val) { // reset if (val & 1) { INFO_LOG(DSPLLE,"DSP_CONTROL RESET"); DSPCore_Reset(); val &= ~1; } // init else if (val == 4) { // HAX! // OSInitAudioSystem ucode should send this mail - not dsp core itself INFO_LOG(DSPLLE,"DSP_CONTROL INIT"); init_hax = true; val |= 0x800; } // update cr g_dsp.cr = val; }
u16 gdsp_mbox_read_l(u8 mbx) { const u32 value = Common::AtomicLoadAcquire(g_dsp.mbox[mbx]); Common::AtomicStoreRelease(g_dsp.mbox[mbx], value & ~0x80000000); if (init_hax && mbx) { init_hax = false; DSPCore_Reset(); return 0x4348; } #if defined(_DEBUG) || defined(DEBUGFAST) if (mbx == GDSP_MBOX_DSP) { INFO_LOG(DSP_MAIL, "DSP(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc); } else { INFO_LOG(DSP_MAIL, "CPU(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_CPU), g_dsp.pc); } #endif return (u16)value; }
bool DSPLLE::Initialize(bool bWii, bool bDSPThread) { requestDisableThread = false; DSPInitOptions opts; if (!FillDSPInitOptions(&opts)) return false; if (!DSPCore_Init(opts)) return false; // needs to be after DSPCore_Init for the dspjit ptr if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive() || Core::g_want_determinism || !g_dsp_jit) { bDSPThread = false; } m_bWii = bWii; m_bDSPThread = bDSPThread; // DSPLLE directly accesses the fastmem arena. // TODO: The fastmem arena is only supposed to be used by the JIT: // among other issues, its size is only 1GB on 32-bit targets. g_dsp.cpu_ram = Memory::physical_base; DSPCore_Reset(); InitInstructionTable(); if (bDSPThread) { m_bIsRunning.Set(true); m_hDSPThread = std::thread(DSPThread, this); } Host_RefreshDSPDebuggerWindow(); return true; }