Fix a hang on stop on linux (why is that done better on linux ?? strange :P)
Fix what must have been a typo for Pikmin PAL CRC, the game still doesn't work though :( Fix a crash on stop in nJoy git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3821 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
8c466e1a62
commit
664f017fec
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Setup.h" // Common
|
#include "Setup.h" // Common
|
||||||
|
@ -285,12 +284,13 @@ THREAD_RETURN CpuThread(void *pArg)
|
||||||
CCPU::Run();
|
CCPU::Run();
|
||||||
cpuRunloopQuit.Set();
|
cpuRunloopQuit.Set();
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
gpuShutdownCall.Wait();
|
||||||
|
|
||||||
// Call video shutdown from the video thread in single core mode, which is the cpuThread
|
// Call video shutdown from the video thread in single core mode, which is the cpuThread
|
||||||
if (!_CoreParameter.bUseDualCore)
|
if (!_CoreParameter.bUseDualCore)
|
||||||
{
|
|
||||||
gpuShutdownCall.Wait();
|
|
||||||
Plugins.ShutdownVideoPlugin();
|
Plugins.ShutdownVideoPlugin();
|
||||||
}
|
#endif
|
||||||
|
|
||||||
gpuShutdownCall.Shutdown();
|
gpuShutdownCall.Shutdown();
|
||||||
|
|
||||||
|
@ -443,10 +443,10 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||||
}
|
}
|
||||||
else // SingleCore mode
|
else // SingleCore mode
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
// the spawned CPU Thread is the... CPU thread but it also does the graphics.
|
// the spawned CPU Thread is the... CPU thread but it also does the graphics.
|
||||||
// the EmuThread is thus an idle thread, which sleeps and wait for the emu to terminate.
|
// the EmuThread is thus an idle thread, which sleeps and wait for the emu to terminate.
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
cpuThread = new Common::Thread(CpuThread, pArg);
|
cpuThread = new Common::Thread(CpuThread, pArg);
|
||||||
Common::SetCurrentThreadName("Emuthread - Idle");
|
Common::SetCurrentThreadName("Emuthread - Idle");
|
||||||
|
|
||||||
|
@ -459,7 +459,8 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||||
Common::SleepCurrentThread(20);
|
Common::SleepCurrentThread(20);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// In single-core mode, the Emulation main thread is also the CPU thread
|
// On unix platforms, the Emulation main thread IS the CPU & video thread
|
||||||
|
// So there's only one thread, imho, that's much better than on windows :P
|
||||||
CpuThread(pArg);
|
CpuThread(pArg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -476,12 +477,17 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||||
HW::Shutdown();
|
HW::Shutdown();
|
||||||
Plugins.ShutdownPlugins();
|
Plugins.ShutdownPlugins();
|
||||||
|
|
||||||
// Call video shutdown from the video thread in dual core mode (EmuThread)
|
#ifdef _WIN32
|
||||||
|
gpuShutdownCall.Set();
|
||||||
|
|
||||||
|
// Call video shutdown from the video thread, in dual core mode it's the EmuThread
|
||||||
// Or set an event in Single Core mode, to call the shutdown from the cpuThread
|
// Or set an event in Single Core mode, to call the shutdown from the cpuThread
|
||||||
if (_CoreParameter.bUseDualCore)
|
if (_CoreParameter.bUseDualCore)
|
||||||
Plugins.ShutdownVideoPlugin();
|
Plugins.ShutdownVideoPlugin();
|
||||||
else
|
#else
|
||||||
gpuShutdownCall.Set();
|
// On unix platforms, the EmuThread is ALWAYS the video thread
|
||||||
|
Plugins.ShutdownVideoPlugin();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cpuThread)
|
if (cpuThread)
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,7 +185,7 @@ private:
|
||||||
switch (m_CRC)
|
switch (m_CRC)
|
||||||
{
|
{
|
||||||
case 0x42f64ac4: // Luigi
|
case 0x42f64ac4: // Luigi
|
||||||
case 0x0267d05a: // http://forums.dolphin-emu.com/thread-2134.html Pikmin PAL
|
case 0x267fd05a: // Pikmin PAL
|
||||||
case 0x4be6a5cb: // AC, Pikmin
|
case 0x4be6a5cb: // AC, Pikmin
|
||||||
case 0x088e38a5: // IPL - JAP
|
case 0x088e38a5: // IPL - JAP
|
||||||
case 0xd73338cf: // IPL
|
case 0xd73338cf: // IPL
|
||||||
|
|
|
@ -114,7 +114,7 @@ void UpdateSampleCounters10(ZeldaVoicePB &PB)
|
||||||
void CUCode_Zelda::RenderVoice_PCM16(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
|
void CUCode_Zelda::RenderVoice_PCM16(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
|
||||||
{
|
{
|
||||||
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
|
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
|
||||||
int rem_samples = _RealSize;
|
u32 rem_samples = _RealSize;
|
||||||
if (PB.KeyOff)
|
if (PB.KeyOff)
|
||||||
goto clear_buffer;
|
goto clear_buffer;
|
||||||
if (PB.NeedsReset)
|
if (PB.NeedsReset)
|
||||||
|
@ -130,7 +130,7 @@ reached_end:
|
||||||
if (!PB.RepeatMode) {
|
if (!PB.RepeatMode) {
|
||||||
// One shot - play zeros the rest of the buffer.
|
// One shot - play zeros the rest of the buffer.
|
||||||
clear_buffer:
|
clear_buffer:
|
||||||
for (int i = 0; i < rem_samples; i++)
|
for (u32 i = 0; i < rem_samples; i++)
|
||||||
*_Buffer++ = 0;
|
*_Buffer++ = 0;
|
||||||
PB.KeyOff = 1;
|
PB.KeyOff = 1;
|
||||||
return;
|
return;
|
||||||
|
@ -146,13 +146,13 @@ clear_buffer:
|
||||||
if (PB.RemLength < rem_samples)
|
if (PB.RemLength < rem_samples)
|
||||||
{
|
{
|
||||||
// finish-up loop
|
// finish-up loop
|
||||||
for (int i = 0; i < PB.RemLength; i++)
|
for (u32 i = 0; i < PB.RemLength; i++)
|
||||||
*_Buffer++ = Common::swap16(*read_ptr++);
|
*_Buffer++ = Common::swap16(*read_ptr++);
|
||||||
rem_samples -= PB.RemLength;
|
rem_samples -= PB.RemLength;
|
||||||
goto reached_end;
|
goto reached_end;
|
||||||
}
|
}
|
||||||
// main render loop
|
// main render loop
|
||||||
for (int i = 0; i < rem_samples; i++)
|
for (u32 i = 0; i < rem_samples; i++)
|
||||||
*_Buffer++ = Common::swap16(*read_ptr++);
|
*_Buffer++ = Common::swap16(*read_ptr++);
|
||||||
|
|
||||||
PB.RemLength -= rem_samples;
|
PB.RemLength -= rem_samples;
|
||||||
|
@ -171,7 +171,7 @@ void UpdateSampleCounters8(ZeldaVoicePB &PB)
|
||||||
void CUCode_Zelda::RenderVoice_PCM8(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
|
void CUCode_Zelda::RenderVoice_PCM8(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
|
||||||
{
|
{
|
||||||
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
|
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
|
||||||
int rem_samples = _RealSize;
|
u32 rem_samples = _RealSize;
|
||||||
if (PB.KeyOff)
|
if (PB.KeyOff)
|
||||||
goto clear_buffer;
|
goto clear_buffer;
|
||||||
if (PB.NeedsReset)
|
if (PB.NeedsReset)
|
||||||
|
@ -188,7 +188,7 @@ reached_end:
|
||||||
{
|
{
|
||||||
// One shot - play zeros the rest of the buffer.
|
// One shot - play zeros the rest of the buffer.
|
||||||
clear_buffer:
|
clear_buffer:
|
||||||
for (int i = 0; i < rem_samples; i++)
|
for (u32 i = 0; i < rem_samples; i++)
|
||||||
*_Buffer++ = 0;
|
*_Buffer++ = 0;
|
||||||
PB.KeyOff = 1;
|
PB.KeyOff = 1;
|
||||||
return;
|
return;
|
||||||
|
@ -205,13 +205,13 @@ clear_buffer:
|
||||||
if (PB.RemLength < rem_samples)
|
if (PB.RemLength < rem_samples)
|
||||||
{
|
{
|
||||||
// finish-up loop
|
// finish-up loop
|
||||||
for (int i = 0; i < PB.RemLength; i++)
|
for (u32 i = 0; i < PB.RemLength; i++)
|
||||||
*_Buffer++ = (s8)(*read_ptr++) << 8;
|
*_Buffer++ = (s8)(*read_ptr++) << 8;
|
||||||
rem_samples -= PB.RemLength;
|
rem_samples -= PB.RemLength;
|
||||||
goto reached_end;
|
goto reached_end;
|
||||||
}
|
}
|
||||||
// main render loop
|
// main render loop
|
||||||
for (int i = 0; i < rem_samples; i++)
|
for (u32 i = 0; i < rem_samples; i++)
|
||||||
*_Buffer++ = (s8)(*read_ptr++) << 8;
|
*_Buffer++ = (s8)(*read_ptr++) << 8;
|
||||||
|
|
||||||
PB.RemLength -= rem_samples;
|
PB.RemLength -= rem_samples;
|
||||||
|
@ -356,7 +356,7 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer);
|
||||||
void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
|
void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
|
||||||
{
|
{
|
||||||
// Decoder0x21 starts here.
|
// Decoder0x21 starts here.
|
||||||
int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
|
u32 _RealSize = SizeForResampling(PB, _Size, PB.RatioInt);
|
||||||
|
|
||||||
// Decoder0x21Core starts here.
|
// Decoder0x21Core starts here.
|
||||||
u32 AX0 = _RealSize;
|
u32 AX0 = _RealSize;
|
||||||
|
@ -440,7 +440,7 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer)
|
||||||
const u8 *source = g_dspInitialize.pGetMemoryPointer(0x80000000);
|
const u8 *source = g_dspInitialize.pGetMemoryPointer(0x80000000);
|
||||||
const u16 *src = (u16 *)(source + (ACC0 & ram_mask));
|
const u16 *src = (u16 *)(source + (ACC0 & ram_mask));
|
||||||
|
|
||||||
for (int i = 0; i < (ACC1 >> 16); i++) {
|
for (u32 i = 0; i < (ACC1 >> 16); i++) {
|
||||||
_Buffer[i] = Common::swap16(src[i]);
|
_Buffer[i] = Common::swap16(src[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
|
||||||
case 0x088e38a5: // IPL - JAP
|
case 0x088e38a5: // IPL - JAP
|
||||||
case 0xd73338cf: // IPL
|
case 0xd73338cf: // IPL
|
||||||
case 0x42f64ac4: // Luigi
|
case 0x42f64ac4: // Luigi
|
||||||
case 0x0267d05a: // http://forums.dolphin-emu.com/thread-2134.html Pikmin PAL
|
case 0x267fd05a: // Pikmin PAL
|
||||||
case 0x4be6a5cb: // AC, Pikmin
|
case 0x4be6a5cb: // AC, Pikmin
|
||||||
INFO_LOG(DSPHLE, "CRC %08x: JAC (early Zelda) ucode chosen", _CRC);
|
INFO_LOG(DSPHLE, "CRC %08x: JAC (early Zelda) ucode chosen", _CRC);
|
||||||
return new CUCode_Zelda(_rMailHandler, _CRC);
|
return new CUCode_Zelda(_rMailHandler, _CRC);
|
||||||
|
|
|
@ -302,12 +302,20 @@ void Shutdown()
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DEBUG_QUIT();
|
DEBUG_QUIT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Free DInput before closing SDL, or get a crash !
|
||||||
|
FreeDirectInput();
|
||||||
|
#elif defined(__linux__)
|
||||||
|
close(fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Don't shutdown the gamepad if the configuration window is still showing
|
// Don't shutdown the gamepad if the configuration window is still showing
|
||||||
// Todo: Coordinate with the Wiimote plugin, SDL_Quit() will remove the pad for it to
|
// Todo: Coordinate with the Wiimote plugin, SDL_Quit() will remove the pad for it to
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
if (m_ConfigFrame) return;
|
if (m_ConfigFrame) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Close all devices carefully. We must check that we are not accessing any undefined
|
/* Close all devices carefully. We must check that we are not accessing any undefined
|
||||||
vector elements or any bad devices */
|
vector elements or any bad devices */
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
|
@ -331,12 +339,6 @@ void Shutdown()
|
||||||
|
|
||||||
// Remove the pointer to the initialize data
|
// Remove the pointer to the initialize data
|
||||||
g_PADInitialize = NULL;
|
g_PADInitialize = NULL;
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
FreeDirectInput();
|
|
||||||
#elif defined(__linux__)
|
|
||||||
close(fd);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue