fixed underrun buffer in hle on linux

made wiimote compile on linux again


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2093 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-02-03 22:06:18 +00:00
parent d8f4785772
commit bde4241e9e
7 changed files with 21 additions and 35 deletions

View File

@ -70,7 +70,7 @@ dirs = [
'Source/Plugins/Plugin_PadSimpleEvnt/Src', 'Source/Plugins/Plugin_PadSimpleEvnt/Src',
'Source/Plugins/Plugin_nJoy_SDL/Src', 'Source/Plugins/Plugin_nJoy_SDL/Src',
'Source/Plugins/Plugin_nJoy_Testing/Src', 'Source/Plugins/Plugin_nJoy_Testing/Src',
# 'Source/Plugins/Plugin_Wiimote/Src', 'Source/Plugins/Plugin_Wiimote/Src',
'Source/Core/DolphinWX/Src', 'Source/Core/DolphinWX/Src',
'Source/Core/DebuggerWX/Src', 'Source/Core/DebuggerWX/Src',
] ]

View File

@ -32,10 +32,10 @@ void AOSound::SoundLoop()
device = ao_open_live(default_driver, &format, NULL /* no options */); device = ao_open_live(default_driver, &format, NULL /* no options */);
if (device == NULL) { if (device == NULL) {
PanicAlert("DSP_HLE: Error opening AO device.\n"); PanicAlert("DSP_HLE: Error opening AO device.\n");
ao_shutdown(); ao_shutdown();
Stop(); Stop();
return; return;
} }
buf_size = format.bits/8 * format.channels * format.rate; buf_size = format.bits/8 * format.channels * format.rate;
@ -57,11 +57,14 @@ void *soundThread(void *args) {
} }
bool AOSound::Start() { bool AOSound::Start() {
memset(realtimeBuffer, 0, sizeof(realtimeBuffer)); memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
soundCriticalSection = new Common::CriticalSection(1);
thread = new Common::Thread(soundThread, (void *)this);
soundSyncEvent = new Common::Event(); soundSyncEvent = new Common::Event();
soundSyncEvent->Init(); soundSyncEvent->Init();
soundCriticalSection = new Common::CriticalSection(1);
thread = new Common::Thread(soundThread, (void *)this);
return true; return true;
} }

View File

@ -867,7 +867,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
DoExtensionConnectedDisconnected(); DoExtensionConnectedDisconnected();
/* It doesn't seem to be needed but shouldn't it at least take 25 ms to /* It doesn't seem to be needed but shouldn't it at least take 25 ms to
reconnect an extension after we disconnected another? */ reconnect an extension after we disconnected another? */
if(g_EmulatorRunning) Sleep(25); if(g_EmulatorRunning) sleep(25);
} }
// Update status // Update status

View File

@ -16,9 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes // Includes
// ŻŻŻŻŻŻŻŻŻŻ
#include <iostream> // System #include <iostream> // System
#include "wiiuse.h" // Externals #include "wiiuse.h" // Externals
@ -188,10 +186,10 @@ void handle_event(struct wiimote_t* wm)
frame->m_GaugeAccel[2]->SetValue(AccelZ); frame->m_GaugeAccel[2]->SetValue(AccelZ);
frame->m_TextIR->SetLabel(wxString::Format( frame->m_TextIR->SetLabel(wxString::Format(
"Cursor: %03u %03u\nDistance:%4.0f", wm->ir.x, wm->ir.y, wm->ir.z)); wxT("Cursor: %03u %03u\nDistance:%4.0f"), wm->ir.x, wm->ir.y, wm->ir.z));
frame->m_TextAccNeutralCurrent->SetLabel(wxString::Format( frame->m_TextAccNeutralCurrent->SetLabel(wxString::Format(
"Current: %03u %03u %03u", AccelX, AccelY, AccelZ)); wxT("Current: %03u %03u %03u"), AccelX, AccelY, AccelZ));
if(frame->m_bRecording) if(frame->m_bRecording)
Console::Print("Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", wm->accel.x, wm->accel.y, wm->accel.z); Console::Print("Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", wm->accel.x, wm->accel.y, wm->accel.z);

View File

@ -16,9 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes // Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include "Common.h" // Common #include "Common.h" // Common
#include "StringUtil.h" #include "StringUtil.h"
#include "ConsoleWindow.h" // For Start, Print, GetHwnd #include "ConsoleWindow.h" // For Start, Print, GetHwnd
@ -298,7 +296,7 @@ extern "C" void Wiimote_Update()
GetUpdateRate(); GetUpdateRate();
if (g_UpdateWriteScreen > g_UpdateRate) if (g_UpdateWriteScreen > g_UpdateRate)
{ {
frame->m_TextUpdateRate->SetLabel(wxString::Format("Update rate: %03i times/s", g_UpdateRate)); frame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate));
g_UpdateWriteScreen = 0; g_UpdateWriteScreen = 0;
} }
g_UpdateWriteScreen++; g_UpdateWriteScreen++;

View File

@ -18,25 +18,14 @@
#ifndef MAIN_H #ifndef MAIN_H
#define MAIN_H #define MAIN_H
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯
#include <iostream> // System #include <iostream> // System
////////////////////////////////
#ifdef _WIN32
////////////////////////////////////////////////////////////////////////////////////////// #define sleep(x) Sleep(x)
// Definitions #else
// ¯¯¯¯¯¯¯¯¯ #define sleep(x) usleep(x/1000)
#ifndef _WIN32
#define Sleep(x) usleep(x*1000)
#endif #endif
////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations // Declarations
// ¯¯¯¯¯¯¯¯¯
void DoInitialize(); void DoInitialize();
double GetDoubleTime(); double GetDoubleTime();
int GetUpdateRate(); int GetUpdateRate();

View File

@ -16,9 +16,7 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes // Includes
// ッッッッッッッッッッ
#include <iostream> // System #include <iostream> // System
#include "pluginspecs_wiimote.h" #include "pluginspecs_wiimote.h"
@ -412,7 +410,7 @@ void FlashLights(bool Connect)
{ {
if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[0], 1); if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[0], 1);
wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[0], WIIMOTE_LED_1 | WIIMOTE_LED_2 | WIIMOTE_LED_3 | WIIMOTE_LED_4); wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[0], WIIMOTE_LED_1 | WIIMOTE_LED_2 | WIIMOTE_LED_3 | WIIMOTE_LED_4);
Sleep(100); sleep(100);
if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[0], 0); if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[0], 0);
// End with light 1 or 4 // End with light 1 or 4