New Wiimote Plugin: Added a real wiimote io_write queue like the old plugin. A combination of locks and lack of a write queue were the cause of the real wiimote slowdown. - new plugin should work as good as the old one with real wiimotes now.(but still lacking a pairup button) Other stuff: Disabled execution of Gecko Codes when Dolphin has cheats disabled.(fixes issue 2971) Allow the range of an input to be increased to 500% (will make ps3 controller's tilt more usable)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5993 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-07-29 10:21:48 +00:00
parent 25accdec23
commit b70f134c88
5 changed files with 159 additions and 34 deletions

View File

@ -665,6 +665,10 @@
RelativePath=".\Src\ExtendedTrace.h"
>
</File>
<File
RelativePath=".\Src\FifoQueue.h"
>
</File>
<File
RelativePath=".\Src\FileSearch.cpp"
>

View File

@ -0,0 +1,101 @@
#ifndef _FIFO_QUEUE_H_
#define _FIFO_QUEUE_H_
// a simple lockless thread-safe,
// single reader, single writer queue
namespace Common
{
template <typename T>
class FifoQueue
{
public:
FifoQueue()
{
m_write_ptr = m_read_ptr = new ElementPtr();
}
~FifoQueue()
{
// this will empty out the whole queue
delete m_read_ptr;
}
bool Empty() const // true if the queue is empty
{
return (m_read_ptr == m_write_ptr);
}
void Push(const T& t)
{
// create the element, add it to the queue
m_write_ptr->current = new T(t);
// set the next pointer to a new element ptr
// then advance the write pointer
m_write_ptr = m_write_ptr->next = new ElementPtr();
}
bool Pop(T& t)
{
// if write pointer points to the same element, queue is empty
if (m_read_ptr == m_write_ptr)
return false;
// get the element from out of the queue
t = *m_read_ptr->current;
ElementPtr *const tmpptr = m_read_ptr;
// advance the read pointer
m_read_ptr = m_read_ptr->next;
// set the next element to NULL to stop the recursive deletion
tmpptr->next = NULL;
delete tmpptr; // this also deletes the element
return true;
}
bool Peek(T& t)
{
// if write pointer points to the same element, queue is empty
if (m_read_ptr == m_write_ptr)
return false;
// get the element from out of the queue
t = *m_read_ptr->current;
return true;
}
private:
// stores a pointer to element at front of queue
// and a pointer to the next ElementPtr
class ElementPtr
{
public:
ElementPtr() : current(NULL), next(NULL) {}
~ElementPtr()
{
if (current)
{
delete current;
// recusion ftw
if (next)
delete next;
}
}
T *volatile current;
ElementPtr *volatile next;
};
ElementPtr *volatile m_write_ptr;
ElementPtr *volatile m_read_ptr;
};
}
#endif

View File

@ -3,6 +3,7 @@
#include "Thread.h"
#include "HW/Memmap.h"
#include "ConfigManager.h"
#include "vector"
@ -142,6 +143,8 @@ bool RunGeckoCode(GeckoCode& gecko_code)
bool RunActiveCodes()
{
if (false == SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats)
return true;
if (false == active_codes_lock.TryEnter())
return true;

View File

@ -533,7 +533,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser( wxWindow* const parent, w
button_sizer->Add(add_button, 1, 0, 5);
}
range_slider = new wxSlider( parent, -1, SLIDER_TICK_COUNT, 0, SLIDER_TICK_COUNT * 2, wxDefaultPosition, wxDefaultSize, wxSL_TOP | wxSL_LABELS /*| wxSL_AUTOTICKS*/ );
range_slider = new wxSlider( parent, -1, SLIDER_TICK_COUNT, 0, SLIDER_TICK_COUNT * 5, wxDefaultPosition, wxDefaultSize, wxSL_TOP | wxSL_LABELS /*| wxSL_AUTOTICKS*/ );
range_slider->SetValue( control_reference->range * SLIDER_TICK_COUNT );