mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 06:35:39 +00:00
A bit of cleanup to Core Init/Stop, Frame, and Main. Cleanup XAudio2 to attempt to fix the crash on stop(didn't help :p). For some reason CFrame::DoStop is called twice.(might be the issue)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7353 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e77059d30c
commit
41c98f982e
@ -18,136 +18,119 @@
|
|||||||
#include "AudioCommon.h"
|
#include "AudioCommon.h"
|
||||||
#include "XAudio2Stream.h"
|
#include "XAudio2Stream.h"
|
||||||
|
|
||||||
struct StreamingVoiceContext : public IXAudio2VoiceCallback
|
const int NUM_BUFFERS = 3;
|
||||||
|
const int SAMPLES_PER_BUFFER = 96;
|
||||||
|
|
||||||
|
const int NUM_CHANNELS = 2;
|
||||||
|
const int BUFFER_SIZE = SAMPLES_PER_BUFFER * NUM_CHANNELS;
|
||||||
|
const int BUFFER_SIZE_BYTES = BUFFER_SIZE * sizeof(s16);
|
||||||
|
|
||||||
|
void StreamingVoiceContext::SubmitBuffer(PBYTE buf_data)
|
||||||
{
|
{
|
||||||
IXAudio2SourceVoice* pSourceVoice;
|
XAUDIO2_BUFFER buf = {};
|
||||||
CMixer *m_mixer;
|
buf.AudioBytes = BUFFER_SIZE_BYTES;
|
||||||
Common::Event *soundSyncEvent;
|
buf.pContext = buf_data;
|
||||||
short *xaBuffer;
|
buf.pAudioData = buf_data;
|
||||||
|
|
||||||
StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event *pSyncEvent)
|
m_source_voice->SubmitSourceBuffer(&buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingVoiceContext::StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event& pSyncEvent)
|
||||||
|
: m_mixer(pMixer)
|
||||||
|
, m_sound_sync_event(pSyncEvent)
|
||||||
|
, xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]())
|
||||||
|
{
|
||||||
|
WAVEFORMATEXTENSIBLE wfx = {};
|
||||||
|
|
||||||
|
wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||||
|
wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
|
||||||
|
wfx.Format.nChannels = 2;
|
||||||
|
wfx.Format.wBitsPerSample = 16;
|
||||||
|
wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
|
||||||
|
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
|
||||||
|
wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
|
||||||
|
wfx.Samples.wValidBitsPerSample = 16;
|
||||||
|
wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
|
||||||
|
wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
|
||||||
|
|
||||||
|
// create source voice
|
||||||
|
HRESULT hr;
|
||||||
|
if (FAILED(hr = pXAudio2->CreateSourceVoice(&m_source_voice, &wfx.Format, XAUDIO2_VOICE_NOSRC, 1.0f, this)))
|
||||||
{
|
{
|
||||||
|
PanicAlertT("XAudio2 CreateSourceVoice failed: %#X", hr);
|
||||||
m_mixer = pMixer;
|
return;
|
||||||
soundSyncEvent = pSyncEvent;
|
|
||||||
|
|
||||||
WAVEFORMATEXTENSIBLE wfx;
|
|
||||||
|
|
||||||
memset(&wfx, 0, sizeof(WAVEFORMATEXTENSIBLE));
|
|
||||||
wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
|
||||||
wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
|
|
||||||
wfx.Format.nChannels = 2;
|
|
||||||
wfx.Format.wBitsPerSample = 16;
|
|
||||||
wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample/8;
|
|
||||||
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
|
|
||||||
wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
|
|
||||||
wfx.Samples.wValidBitsPerSample = 16;
|
|
||||||
wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
|
|
||||||
wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
|
|
||||||
|
|
||||||
// create source voice
|
|
||||||
HRESULT hr;
|
|
||||||
if(FAILED(hr = pXAudio2->CreateSourceVoice(&pSourceVoice, (WAVEFORMATEX*)&wfx, XAUDIO2_VOICE_NOSRC, 1.0f, this)))
|
|
||||||
PanicAlertT("XAudio2 CreateSourceVoice failed: %#X", hr);
|
|
||||||
|
|
||||||
pSourceVoice->FlushSourceBuffers();
|
|
||||||
pSourceVoice->Start();
|
|
||||||
|
|
||||||
xaBuffer = new s16[NUM_BUFFERS * BUFFER_SIZE];
|
|
||||||
memset(xaBuffer, 0, NUM_BUFFERS * BUFFER_SIZE_BYTES);
|
|
||||||
|
|
||||||
//start buffers with silence
|
|
||||||
for(int i=0; i < NUM_BUFFERS; i++)
|
|
||||||
{
|
|
||||||
XAUDIO2_BUFFER buf = {0};
|
|
||||||
buf.AudioBytes = BUFFER_SIZE_BYTES;
|
|
||||||
buf.pAudioData = (BYTE *) &xaBuffer[i * BUFFER_SIZE];
|
|
||||||
buf.pContext = (void *) buf.pAudioData;
|
|
||||||
|
|
||||||
pSourceVoice->SubmitSourceBuffer(&buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
~StreamingVoiceContext()
|
|
||||||
{
|
|
||||||
IXAudio2SourceVoice* temp = pSourceVoice;
|
|
||||||
pSourceVoice = NULL;
|
|
||||||
temp->FlushSourceBuffers();
|
|
||||||
temp->DestroyVoice();
|
|
||||||
safe_delete_array(xaBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StreamingVoiceContext::Stop() {
|
|
||||||
if (pSourceVoice)
|
|
||||||
pSourceVoice->Stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamingVoiceContext::Play() {
|
m_source_voice->Start();
|
||||||
if (pSourceVoice)
|
|
||||||
pSourceVoice->Start();
|
// start buffers with silence
|
||||||
|
for (int i = 0; i != NUM_BUFFERS; ++i)
|
||||||
|
SubmitBuffer(xaudio_buffer.get() + (i * BUFFER_SIZE_BYTES));
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingVoiceContext::~StreamingVoiceContext()
|
||||||
|
{
|
||||||
|
if (m_source_voice)
|
||||||
|
{
|
||||||
|
m_source_voice->Stop();
|
||||||
|
m_source_voice->DestroyVoice();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StreamingVoiceContext::Stop()
|
||||||
|
{
|
||||||
|
if (m_source_voice)
|
||||||
|
m_source_voice->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StreamingVoiceContext::Play()
|
||||||
|
{
|
||||||
|
if (m_source_voice)
|
||||||
|
m_source_voice->Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StreamingVoiceContext::OnBufferEnd(void* context)
|
||||||
|
{
|
||||||
|
// buffer end callback; gets SAMPLES_PER_BUFFER samples for a new buffer
|
||||||
|
|
||||||
|
if (!m_source_voice || !context)
|
||||||
|
return;
|
||||||
|
|
||||||
STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) {}
|
//m_sound_sync_event->Wait(); // sync
|
||||||
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
|
//m_sound_sync_event->Spin(); // or tight sync
|
||||||
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {}
|
|
||||||
STDMETHOD_(void, OnBufferStart) (void*) {}
|
|
||||||
STDMETHOD_(void, OnLoopEnd) (void*) {}
|
|
||||||
STDMETHOD_(void, OnStreamEnd) () {}
|
|
||||||
STDMETHOD_(void, OnBufferEnd) (void* context)
|
|
||||||
{ //
|
|
||||||
// buffer end callback; gets SAMPLES_PER_BUFFER samples for a new buffer
|
|
||||||
//
|
|
||||||
if( !pSourceVoice || !context) return;
|
|
||||||
|
|
||||||
//soundSyncEvent->Wait(); //sync
|
|
||||||
//soundSyncEvent->Spin(); //or tight sync
|
|
||||||
|
|
||||||
//if (!pSourceVoice) return;
|
m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER);
|
||||||
|
SubmitBuffer(static_cast<BYTE*>(context));
|
||||||
m_mixer->Mix((short *)context, SAMPLES_PER_BUFFER);
|
}
|
||||||
|
|
||||||
|
|
||||||
XAUDIO2_BUFFER buf = {0};
|
|
||||||
buf.AudioBytes = BUFFER_SIZE_BYTES;
|
|
||||||
buf.pAudioData = (byte*)context;
|
|
||||||
buf.pContext = context;
|
|
||||||
|
|
||||||
pSourceVoice->SubmitSourceBuffer(&buf);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
StreamingVoiceContext* pVoiceContext = 0;
|
|
||||||
|
|
||||||
bool XAudio2::Start()
|
bool XAudio2::Start()
|
||||||
{
|
{
|
||||||
// XAudio2 init
|
|
||||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if(FAILED(hr = XAudio2Create(&pXAudio2, 0, XAUDIO2_ANY_PROCESSOR))) //callback dosent seem to run on a speecific cpu anyways
|
|
||||||
{
|
|
||||||
PanicAlertT("XAudio2 init failed: %#X", hr);
|
|
||||||
CoUninitialize();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// XAudio2 master voice
|
// callback dosent seem to run on a speecific cpu anyways
|
||||||
// XAUDIO2_DEFAULT_CHANNELS instead of 2 for expansion?
|
IXAudio2* xaudptr;
|
||||||
if(FAILED(hr = pXAudio2->CreateMasteringVoice(&pMasteringVoice, 2, m_mixer->GetSampleRate())))
|
if (FAILED(hr = XAudio2Create(&xaudptr, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||||
{
|
{
|
||||||
PanicAlertT("XAudio2 master voice creation failed: %#X", hr);
|
PanicAlertT("XAudio2 init failed: %#X", hr);
|
||||||
safe_release(pXAudio2);
|
Stop();
|
||||||
CoUninitialize();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
m_xaudio2 = std::unique_ptr<IXAudio2, Releaser>(xaudptr);
|
||||||
|
|
||||||
|
// XAudio2 master voice
|
||||||
|
// XAUDIO2_DEFAULT_CHANNELS instead of 2 for expansion?
|
||||||
|
if (FAILED(hr = m_xaudio2->CreateMasteringVoice(&m_mastering_voice, 2, m_mixer->GetSampleRate())))
|
||||||
|
{
|
||||||
|
PanicAlertT("XAudio2 master voice creation failed: %#X", hr);
|
||||||
|
Stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
if (pMasteringVoice)
|
m_mastering_voice->SetVolume(m_volume);
|
||||||
pMasteringVoice->SetVolume(m_volume);
|
|
||||||
|
|
||||||
if (pXAudio2)
|
m_voice_context = std::unique_ptr<StreamingVoiceContext>
|
||||||
pVoiceContext = new StreamingVoiceContext(pXAudio2, m_mixer, &soundSyncEvent);
|
(new StreamingVoiceContext(m_xaudio2.get(), m_mixer, m_sound_sync_event));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -157,24 +140,22 @@ void XAudio2::SetVolume(int volume)
|
|||||||
//linear 1- .01
|
//linear 1- .01
|
||||||
m_volume = (float)volume / 100.f;
|
m_volume = (float)volume / 100.f;
|
||||||
|
|
||||||
if (pMasteringVoice)
|
if (m_mastering_voice)
|
||||||
pMasteringVoice->SetVolume(m_volume);
|
m_mastering_voice->SetVolume(m_volume);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//XAUDIO2_PERFORMANCE_DATA perfData;
|
|
||||||
//int xi = 0;
|
|
||||||
void XAudio2::Update()
|
void XAudio2::Update()
|
||||||
{
|
{
|
||||||
//soundSyncEvent.Set();
|
//m_sound_sync_event.Set();
|
||||||
|
|
||||||
//xi++;
|
//static int xi = 0;
|
||||||
//if (xi == 100000) {
|
//if (100000 == ++xi)
|
||||||
|
//{
|
||||||
// xi = 0;
|
// xi = 0;
|
||||||
|
// XAUDIO2_PERFORMANCE_DATA perfData;
|
||||||
// pXAudio2->GetPerformanceData(&perfData);
|
// pXAudio2->GetPerformanceData(&perfData);
|
||||||
// NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i",perfData.CurrentLatencyInSamples);
|
// NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples);
|
||||||
// NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i",perfData.GlitchesSinceEngineStarted);
|
// NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,26 +163,26 @@ void XAudio2::Clear(bool mute)
|
|||||||
{
|
{
|
||||||
m_muted = mute;
|
m_muted = mute;
|
||||||
|
|
||||||
if (pVoiceContext)
|
if (m_voice_context)
|
||||||
{
|
{
|
||||||
if (m_muted)
|
if (m_muted)
|
||||||
pVoiceContext->Stop();
|
m_voice_context->Stop();
|
||||||
else
|
else
|
||||||
pVoiceContext->Play();
|
m_voice_context->Play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XAudio2::Stop()
|
void XAudio2::Stop()
|
||||||
{
|
{
|
||||||
//soundSyncEvent.Set();
|
//m_sound_sync_event.Set();
|
||||||
|
|
||||||
safe_delete(pVoiceContext);
|
m_voice_context.reset();
|
||||||
pVoiceContext = NULL;
|
|
||||||
|
|
||||||
if(pMasteringVoice)
|
if (m_mastering_voice)
|
||||||
pMasteringVoice->DestroyVoice();
|
{
|
||||||
|
m_mastering_voice->DestroyVoice();
|
||||||
|
m_mastering_voice = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
safe_release(pXAudio2);
|
m_xaudio2.reset(); // release interface
|
||||||
pMasteringVoice = NULL;
|
|
||||||
CoUninitialize();
|
|
||||||
}
|
}
|
||||||
|
@ -23,59 +23,89 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
const int NUM_BUFFERS = 3;
|
struct StreamingVoiceContext : public IXAudio2VoiceCallback
|
||||||
const int SAMPLES_PER_BUFFER = 96;
|
{
|
||||||
|
private:
|
||||||
|
CMixer* const m_mixer;
|
||||||
|
Common::Event& m_sound_sync_event;
|
||||||
|
IXAudio2SourceVoice* m_source_voice;
|
||||||
|
std::unique_ptr<BYTE[]> xaudio_buffer;
|
||||||
|
|
||||||
const int NUM_CHANNELS = 2;
|
void SubmitBuffer(PBYTE buf_data);
|
||||||
const int BUFFER_SIZE = SAMPLES_PER_BUFFER * NUM_CHANNELS;
|
|
||||||
const int BUFFER_SIZE_BYTES = BUFFER_SIZE * sizeof(s16);
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event& pSyncEvent);
|
||||||
|
|
||||||
|
~StreamingVoiceContext();
|
||||||
|
|
||||||
|
void StreamingVoiceContext::Stop();
|
||||||
|
void StreamingVoiceContext::Play();
|
||||||
|
|
||||||
|
STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) {}
|
||||||
|
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
|
||||||
|
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {}
|
||||||
|
STDMETHOD_(void, OnBufferStart) (void*) {}
|
||||||
|
STDMETHOD_(void, OnLoopEnd) (void*) {}
|
||||||
|
STDMETHOD_(void, OnStreamEnd) () {}
|
||||||
|
|
||||||
#ifndef safe_delete_array
|
STDMETHOD_(void, OnBufferEnd) (void* context);
|
||||||
#define safe_delete_array(p) { if(p) { delete[] (p); (p)=NULL; } }
|
};
|
||||||
#endif
|
|
||||||
#ifndef safe_delete
|
|
||||||
#define safe_delete(a) if( (a) != NULL ) delete (a); (a) = NULL;
|
|
||||||
#endif
|
|
||||||
#ifndef safe_release
|
|
||||||
#define safe_release(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class XAudio2 : public SoundStream
|
class XAudio2 : public SoundStream
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
IXAudio2 *pXAudio2;
|
|
||||||
IXAudio2MasteringVoice *pMasteringVoice;
|
|
||||||
IXAudio2SourceVoice *pSourceVoice;
|
|
||||||
|
|
||||||
Common::Event soundSyncEvent;
|
class Releaser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template <typename R>
|
||||||
|
void operator()(R* ptr)
|
||||||
|
{
|
||||||
|
ptr->Release();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<IXAudio2, Releaser> m_xaudio2;
|
||||||
|
std::unique_ptr<StreamingVoiceContext> m_voice_context;
|
||||||
|
IXAudio2MasteringVoice *m_mastering_voice;
|
||||||
|
|
||||||
|
Common::Event m_sound_sync_event;
|
||||||
float m_volume;
|
float m_volume;
|
||||||
|
|
||||||
|
const bool m_cleanup_com;
|
||||||
|
|
||||||
bool Init();
|
|
||||||
public:
|
public:
|
||||||
XAudio2(CMixer *mixer)
|
XAudio2(CMixer *mixer)
|
||||||
: SoundStream(mixer),
|
: SoundStream(mixer)
|
||||||
pXAudio2(0),
|
, m_mastering_voice(nullptr)
|
||||||
pMasteringVoice(0),
|
, m_volume(1.0f)
|
||||||
pSourceVoice(0),
|
, m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
|
||||||
m_volume(1.0f) {}
|
{}
|
||||||
|
|
||||||
virtual ~XAudio2() {}
|
virtual ~XAudio2()
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
if (m_cleanup_com)
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool Start();
|
virtual bool Start();
|
||||||
virtual void SetVolume(int volume);
|
virtual void Stop();
|
||||||
virtual void Stop();
|
|
||||||
|
virtual void Update();
|
||||||
virtual void Clear(bool mute);
|
virtual void Clear(bool mute);
|
||||||
static bool isValid() { return true; }
|
virtual void SetVolume(int volume);
|
||||||
virtual bool usesMixer() const { return true; }
|
virtual bool usesMixer() const { return true; }
|
||||||
virtual void Update();
|
|
||||||
|
static bool isValid() { return true; }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XAudio2(CMixer *mixer, void *hWnd = NULL)
|
XAudio2(CMixer *mixer, void *hWnd = NULL)
|
||||||
: SoundStream(mixer)
|
: SoundStream(mixer)
|
||||||
|
@ -103,12 +103,12 @@ public:
|
|||||||
: m_count(count), m_waiting(0)
|
: m_count(count), m_waiting(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// block until "count" threads call Wait()
|
// block until "count" threads call Sync()
|
||||||
bool Wait()
|
bool Sync()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(m_mutex);
|
std::unique_lock<std::mutex> lk(m_mutex);
|
||||||
|
|
||||||
// TODO: broken when next round of Wait()s
|
// TODO: broken when next round of Sync()s
|
||||||
// is entered before all waiting threads return from the notify_all
|
// is entered before all waiting threads return from the notify_all
|
||||||
|
|
||||||
if (m_count == ++m_waiting)
|
if (m_count == ++m_waiting)
|
||||||
|
@ -80,9 +80,7 @@ volatile u32 DrawnFrame = 0;
|
|||||||
u32 DrawnVideo = 0;
|
u32 DrawnVideo = 0;
|
||||||
|
|
||||||
// Function forwarding
|
// Function forwarding
|
||||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
|
|
||||||
const char *Callback_ISOName(void);
|
const char *Callback_ISOName(void);
|
||||||
void Callback_DSPInterrupt();
|
|
||||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||||
|
|
||||||
// Function declarations
|
// Function declarations
|
||||||
@ -97,13 +95,12 @@ void *g_pWindowHandle = NULL;
|
|||||||
std::string g_stateFileName;
|
std::string g_stateFileName;
|
||||||
std::thread g_EmuThread;
|
std::thread g_EmuThread;
|
||||||
|
|
||||||
static std::thread cpuThread;
|
static std::thread g_cpu_thread;
|
||||||
|
|
||||||
SCoreStartupParameter g_CoreStartupParameter;
|
SCoreStartupParameter g_CoreStartupParameter;
|
||||||
|
|
||||||
// This event is set when the emuthread starts.
|
// This event is set when the emuthread starts.
|
||||||
Common::Barrier emuThreadGoing(2);
|
Common::Barrier emuThreadGoing(2);
|
||||||
Common::Barrier cpuRunloopQuit(2);
|
|
||||||
|
|
||||||
std::string GetStateFileName() { return g_stateFileName; }
|
std::string GetStateFileName() { return g_stateFileName; }
|
||||||
void SetStateFileName(std::string val) { g_stateFileName = val; }
|
void SetStateFileName(std::string val) { g_stateFileName = val; }
|
||||||
@ -124,19 +121,6 @@ bool PanicAlertToVideo(const char* text, bool yes_no)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayMessage(const std::string &message, int time_in_ms)
|
|
||||||
{
|
|
||||||
SCoreStartupParameter& _CoreParameter =
|
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter;
|
|
||||||
|
|
||||||
g_video_backend->Video_AddMessage(message.c_str(), time_in_ms);
|
|
||||||
if (_CoreParameter.bRenderToMain &&
|
|
||||||
SConfig::GetInstance().m_InterfaceStatusbar) {
|
|
||||||
Host_UpdateStatusBar(message.c_str());
|
|
||||||
} else
|
|
||||||
Host_UpdateTitle(message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayMessage(const char *message, int time_in_ms)
|
void DisplayMessage(const char *message, int time_in_ms)
|
||||||
{
|
{
|
||||||
SCoreStartupParameter& _CoreParameter =
|
SCoreStartupParameter& _CoreParameter =
|
||||||
@ -160,24 +144,19 @@ void *GetWindowHandle()
|
|||||||
return g_pWindowHandle;
|
return g_pWindowHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetRealWiimote()
|
bool IsRunning()
|
||||||
{
|
|
||||||
return g_bRealWiimote;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isRunning()
|
|
||||||
{
|
{
|
||||||
return (GetState() != CORE_UNINITIALIZED) || g_bHwInit;
|
return (GetState() != CORE_UNINITIALIZED) || g_bHwInit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsRunningInCurrentThread()
|
bool IsRunningInCurrentThread()
|
||||||
{
|
{
|
||||||
return isRunning() && ((!cpuThread.joinable()) || cpuThread.get_id() == std::this_thread::get_id());
|
return IsRunning() && ((!g_cpu_thread.joinable()) || g_cpu_thread.get_id() == std::this_thread::get_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsCPUThread()
|
bool IsCPUThread()
|
||||||
{
|
{
|
||||||
return ((!cpuThread.joinable()) || cpuThread.get_id() == std::this_thread::get_id());
|
return ((!g_cpu_thread.joinable()) || g_cpu_thread.get_id() == std::this_thread::get_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called from the GUI thread. See the booting call schedule in
|
// This is called from the GUI thread. See the booting call schedule in
|
||||||
@ -200,7 +179,6 @@ bool Init()
|
|||||||
INFO_LOG(OSREPORT, "CPU Thread separate = %s",
|
INFO_LOG(OSREPORT, "CPU Thread separate = %s",
|
||||||
g_CoreStartupParameter.bCPUThread ? "Yes" : "No");
|
g_CoreStartupParameter.bCPUThread ? "Yes" : "No");
|
||||||
|
|
||||||
Host_SetWaitCursor(true);
|
|
||||||
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
|
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
|
||||||
|
|
||||||
g_aspect_wide = _CoreParameter.bWii;
|
g_aspect_wide = _CoreParameter.bWii;
|
||||||
@ -219,7 +197,6 @@ bool Init()
|
|||||||
g_pWindowHandle = Host_GetRenderHandle();
|
g_pWindowHandle = Host_GetRenderHandle();
|
||||||
if (!g_video_backend->Initialize(g_pWindowHandle))
|
if (!g_video_backend->Initialize(g_pWindowHandle))
|
||||||
{
|
{
|
||||||
Host_SetWaitCursor(false);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +206,6 @@ bool Init()
|
|||||||
{
|
{
|
||||||
HW::Shutdown();
|
HW::Shutdown();
|
||||||
g_video_backend->Shutdown();
|
g_video_backend->Shutdown();
|
||||||
Host_SetWaitCursor(false);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Pad::Initialize(g_pWindowHandle);
|
Pad::Initialize(g_pWindowHandle);
|
||||||
@ -252,9 +228,7 @@ bool Init()
|
|||||||
g_EmuThread = std::thread(EmuThread);
|
g_EmuThread = std::thread(EmuThread);
|
||||||
|
|
||||||
// Wait until the emu thread is running
|
// Wait until the emu thread is running
|
||||||
emuThreadGoing.Wait();
|
emuThreadGoing.Sync();
|
||||||
|
|
||||||
Host_SetWaitCursor(false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -262,17 +236,18 @@ bool Init()
|
|||||||
// Called from GUI thread
|
// Called from GUI thread
|
||||||
void Stop() // - Hammertime!
|
void Stop() // - Hammertime!
|
||||||
{
|
{
|
||||||
const SCoreStartupParameter& _CoreParameter =
|
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter;
|
|
||||||
g_bStopping = true;
|
|
||||||
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_STOP);
|
|
||||||
|
|
||||||
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
|
|
||||||
|
|
||||||
Host_SetWaitCursor(true); // hourglass!
|
|
||||||
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
|
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const SCoreStartupParameter& _CoreParameter =
|
||||||
|
SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||||
|
|
||||||
|
g_bStopping = true;
|
||||||
|
|
||||||
|
g_video_backend->EmuStateChange(EMUSTATE_CHANGE_STOP);
|
||||||
|
|
||||||
|
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
|
||||||
|
|
||||||
// Stop the CPU
|
// Stop the CPU
|
||||||
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stop CPU").c_str());
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stop CPU").c_str());
|
||||||
PowerPC::Stop();
|
PowerPC::Stop();
|
||||||
@ -284,30 +259,23 @@ void Stop() // - Hammertime!
|
|||||||
// Video_EnterLoop() should now exit so that EmuThread()
|
// Video_EnterLoop() should now exit so that EmuThread()
|
||||||
// will continue concurrently with the rest of the commands
|
// will continue concurrently with the rest of the commands
|
||||||
// in this function. We no longer rely on Postmessage.
|
// in this function. We no longer rely on Postmessage.
|
||||||
INFO_LOG(CONSOLE, "%s", StopMessage(true,
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
|
||||||
"Wait for Video Loop to exit ...").c_str());
|
|
||||||
g_video_backend->Video_ExitLoop();
|
g_video_backend->Video_ExitLoop();
|
||||||
|
|
||||||
// Wait until the CPU finishes exiting the main run loop
|
|
||||||
cpuRunloopQuit.Wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping Emu thread ...").c_str());
|
||||||
|
|
||||||
|
g_EmuThread.join(); // Wait for emuthread to close.
|
||||||
|
|
||||||
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Main Emu thread stopped").c_str());
|
||||||
|
|
||||||
// Clear on screen messages that haven't expired
|
// Clear on screen messages that haven't expired
|
||||||
g_video_backend->Video_ClearMessages();
|
g_video_backend->Video_ClearMessages();
|
||||||
|
|
||||||
// Close the trace file
|
// Close the trace file
|
||||||
Core::StopTrace();
|
Core::StopTrace();
|
||||||
|
|
||||||
// Update mouse pointer
|
|
||||||
Host_SetWaitCursor(false);
|
|
||||||
|
|
||||||
INFO_LOG(CONSOLE, "%s",
|
|
||||||
StopMessage(true, "Stopping Emu thread ...").c_str());
|
|
||||||
g_EmuThread.join(); // Wait for emuthread to close.
|
|
||||||
|
|
||||||
INFO_LOG(CONSOLE, "%s",
|
|
||||||
StopMessage(true, "Main thread stopped").c_str());
|
|
||||||
|
|
||||||
// Stop audio thread - Actually this does nothing when using HLE
|
// Stop audio thread - Actually this does nothing when using HLE
|
||||||
// emulation, but stops the DSP Interpreter when using LLE emulation.
|
// emulation, but stops the DSP Interpreter when using LLE emulation.
|
||||||
DSP::GetDSPEmulator()->DSP_StopSoundStream();
|
DSP::GetDSPEmulator()->DSP_StopSoundStream();
|
||||||
@ -326,6 +294,8 @@ void Stop() // - Hammertime!
|
|||||||
SConfig::GetInstance().m_SYSCONF->Reload();
|
SConfig::GetInstance().m_SYSCONF->Reload();
|
||||||
|
|
||||||
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
|
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
|
||||||
|
|
||||||
|
g_bStopping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the CPU thread, which is a CPU + Video thread in Single Core mode.
|
// Create the CPU thread, which is a CPU + Video thread in Single Core mode.
|
||||||
@ -356,8 +326,6 @@ void CpuThread()
|
|||||||
// Enter CPU run loop. When we leave it - we are done.
|
// Enter CPU run loop. When we leave it - we are done.
|
||||||
CCPU::Run();
|
CCPU::Run();
|
||||||
|
|
||||||
cpuRunloopQuit.Wait();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +337,7 @@ void EmuThread()
|
|||||||
const SCoreStartupParameter& _CoreParameter =
|
const SCoreStartupParameter& _CoreParameter =
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter;
|
SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||||
|
|
||||||
Common::SetCurrentThreadName("Emuthread - starting");
|
Common::SetCurrentThreadName("Emuthread - Starting");
|
||||||
|
|
||||||
if (_CoreParameter.bLockThreads)
|
if (_CoreParameter.bLockThreads)
|
||||||
{
|
{
|
||||||
@ -379,8 +347,6 @@ void EmuThread()
|
|||||||
Common::SetCurrentThreadAffinity(2);
|
Common::SetCurrentThreadAffinity(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
emuThreadGoing.Wait();
|
|
||||||
|
|
||||||
DisplayMessage(cpu_info.brand_string, 8000);
|
DisplayMessage(cpu_info.brand_string, 8000);
|
||||||
DisplayMessage(cpu_info.Summarize(), 8000);
|
DisplayMessage(cpu_info.Summarize(), 8000);
|
||||||
DisplayMessage(_CoreParameter.m_strFilename, 3000);
|
DisplayMessage(_CoreParameter.m_strFilename, 3000);
|
||||||
@ -396,23 +362,29 @@ void EmuThread()
|
|||||||
else
|
else
|
||||||
PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
|
PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
|
||||||
|
|
||||||
// Spawn the CPU thread
|
// Update the window again because all stuff is initialized
|
||||||
_dbg_assert_(OSHLE, !cpuThread.joinable());
|
Host_UpdateDisasmDialog();
|
||||||
|
Host_UpdateMainFrame();
|
||||||
|
|
||||||
|
emuThreadGoing.Sync();
|
||||||
|
|
||||||
// ENTER THE VIDEO THREAD LOOP
|
// ENTER THE VIDEO THREAD LOOP
|
||||||
if (_CoreParameter.bCPUThread)
|
if (_CoreParameter.bCPUThread)
|
||||||
{
|
{
|
||||||
g_video_backend->Video_Prepare();
|
|
||||||
|
|
||||||
// This thread, after creating the EmuWindow, spawns a CPU
|
// This thread, after creating the EmuWindow, spawns a CPU
|
||||||
// thread, and then takes over and becomes the video thread
|
// thread, and then takes over and becomes the video thread
|
||||||
cpuThread = std::thread(CpuThread);
|
|
||||||
Common::SetCurrentThreadName("Video thread");
|
Common::SetCurrentThreadName("Video thread");
|
||||||
|
|
||||||
// Update the window again because all stuff is initialized
|
g_video_backend->Video_Prepare();
|
||||||
Host_UpdateDisasmDialog();
|
|
||||||
Host_UpdateMainFrame();
|
|
||||||
|
|
||||||
|
// Spawn the CPU thread
|
||||||
|
g_cpu_thread = std::thread(CpuThread);
|
||||||
|
|
||||||
|
// become the GPU thread
|
||||||
g_video_backend->Video_EnterLoop();
|
g_video_backend->Video_EnterLoop();
|
||||||
|
|
||||||
|
// We have now exited the Video Loop
|
||||||
|
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Video Loop Ended").c_str());
|
||||||
}
|
}
|
||||||
else // SingleCore mode
|
else // SingleCore mode
|
||||||
{
|
{
|
||||||
@ -421,44 +393,27 @@ void EmuThread()
|
|||||||
// waiting for the program to terminate. Without this extra
|
// waiting for the program to terminate. Without this extra
|
||||||
// thread, the video backend window hangs in single core mode
|
// thread, the video backend window hangs in single core mode
|
||||||
// because noone is pumping messages.
|
// because noone is pumping messages.
|
||||||
|
|
||||||
cpuThread = std::thread(CpuThread);
|
|
||||||
Common::SetCurrentThreadName("Emuthread - Idle");
|
Common::SetCurrentThreadName("Emuthread - Idle");
|
||||||
|
|
||||||
// Update the window again because all stuff is initialized
|
// Spawn the CPU+GPU thread
|
||||||
Host_UpdateDisasmDialog();
|
g_cpu_thread = std::thread(CpuThread);
|
||||||
Host_UpdateMainFrame();
|
|
||||||
|
|
||||||
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||||
{
|
{
|
||||||
g_video_backend->PeekMessages();
|
g_video_backend->PeekMessages();
|
||||||
Common::SleepCurrentThread(20);
|
Common::SleepCurrentThread(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for CpuThread to exit
|
|
||||||
INFO_LOG(CONSOLE, "%s", StopMessage(true,
|
|
||||||
"Stopping CPU-GPU thread ...").c_str());
|
|
||||||
cpuRunloopQuit.Wait();
|
|
||||||
INFO_LOG(CONSOLE, "%s", StopMessage(true,
|
|
||||||
"CPU thread stopped.").c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have now exited the Video Loop
|
// Wait for g_cpu_thread to exit
|
||||||
INFO_LOG(CONSOLE, "%s",
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping CPU-GPU thread ...").c_str());
|
||||||
StopMessage(false, "Stop() and Video Loop Ended").c_str());
|
|
||||||
|
|
||||||
// At this point, the CpuThread has already returned in SC mode.
|
g_cpu_thread.join();
|
||||||
// But it may still be waiting in Dual Core mode.
|
|
||||||
if (cpuThread.joinable())
|
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
|
||||||
{
|
|
||||||
// There is a CPU thread - join it.
|
|
||||||
cpuThread.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
VolumeHandler::EjectVolume();
|
VolumeHandler::EjectVolume();
|
||||||
FileMon::Close();
|
FileMon::Close();
|
||||||
|
|
||||||
g_bStopping = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set or get the running state
|
// Set or get the running state
|
||||||
@ -496,41 +451,37 @@ EState GetState()
|
|||||||
return CORE_UNINITIALIZED;
|
return CORE_UNINITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline std::string GenerateScreenshotName()
|
static std::string GenerateScreenshotName()
|
||||||
{
|
{
|
||||||
int index = 1;
|
const std::string& gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID();
|
||||||
std::string tempname, name;
|
std::string path = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
|
||||||
std::string gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID();
|
|
||||||
tempname = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
|
|
||||||
|
|
||||||
if (!File::CreateFullPath(tempname))
|
if (!File::CreateFullPath(path))
|
||||||
{
|
{
|
||||||
//fallback to old-style screenshots, without folder.
|
// fallback to old-style screenshots, without folder.
|
||||||
tempname = File::GetUserPath(D_SCREENSHOTS_IDX);
|
path = File::GetUserPath(D_SCREENSHOTS_IDX);
|
||||||
}
|
}
|
||||||
//append gameId, tempname only contains the folder here.
|
|
||||||
tempname += gameId;
|
|
||||||
|
|
||||||
do
|
//append gameId, path only contains the folder here.
|
||||||
name = StringFromFormat("%s-%d.png", tempname.c_str(), index++);
|
path += gameId;
|
||||||
while (File::Exists(name));
|
|
||||||
|
std::string name;
|
||||||
|
for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i)
|
||||||
|
{}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenShot(const std::string& name)
|
void SaveScreenShot()
|
||||||
{
|
{
|
||||||
bool bPaused = (GetState() == CORE_PAUSE);
|
const bool bPaused = (GetState() == CORE_PAUSE);
|
||||||
|
|
||||||
SetState(CORE_PAUSE);
|
SetState(CORE_PAUSE);
|
||||||
g_video_backend->Video_Screenshot(name.c_str());
|
|
||||||
if(!bPaused)
|
|
||||||
SetState(CORE_RUN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenShot()
|
g_video_backend->Video_Screenshot(GenerateScreenshotName().c_str());
|
||||||
{
|
|
||||||
ScreenShot(GenerateScreenshotName());
|
if (!bPaused)
|
||||||
|
SetState(CORE_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply Frame Limit and Display FPS info
|
// Apply Frame Limit and Display FPS info
|
||||||
@ -630,25 +581,19 @@ void VideoThrottle()
|
|||||||
// Executed from GPU thread
|
// Executed from GPU thread
|
||||||
// reports if a frame should be skipped or not
|
// reports if a frame should be skipped or not
|
||||||
// depending on the framelimit set
|
// depending on the framelimit set
|
||||||
bool report_slow(int skipped)
|
bool ShouldSkipFrame(int skipped)
|
||||||
{
|
{
|
||||||
u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1) ? SConfig::GetInstance().m_Framelimit * 5
|
const u32 TargetFPS = (SConfig::GetInstance().m_Framelimit > 1)
|
||||||
|
? SConfig::GetInstance().m_Framelimit * 5
|
||||||
: VideoInterface::TargetRefreshRate;
|
: VideoInterface::TargetRefreshRate;
|
||||||
u32 frames = Common::AtomicLoad(DrawnFrame);
|
const u32 frames = Common::AtomicLoad(DrawnFrame);
|
||||||
bool fps_slow = (Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS) ? false : true;
|
const bool fps_slow = !(Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS);
|
||||||
|
|
||||||
return fps_slow;
|
return fps_slow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Callbacks for backends / engine ---
|
// --- Callbacks for backends / engine ---
|
||||||
|
|
||||||
// Callback_VideoLog
|
|
||||||
// WARNING - THIS IS EXECUTED FROM VIDEO THREAD
|
|
||||||
void Callback_VideoLog(const char *_szMessage)
|
|
||||||
{
|
|
||||||
INFO_LOG(VIDEO, "%s", _szMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should be called from GPU thread when a frame is drawn
|
// Should be called from GPU thread when a frame is drawn
|
||||||
void Callback_VideoCopiedToXFB(bool video_update)
|
void Callback_VideoCopiedToXFB(bool video_update)
|
||||||
{
|
{
|
||||||
@ -657,36 +602,6 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
|||||||
Frame::FrameUpdate();
|
Frame::FrameUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the host for the window size
|
|
||||||
void Callback_VideoGetWindowSize(int& x, int& y, int& width, int& height)
|
|
||||||
{
|
|
||||||
Host_GetRenderWindowSize(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Suggest to the host that it sets the window to the given size.
|
|
||||||
// The host may or may not decide to do this depending on fullscreen or not.
|
|
||||||
// Sets width and height to the actual size of the window.
|
|
||||||
void Callback_VideoRequestWindowSize(int& width, int& height)
|
|
||||||
{
|
|
||||||
Host_RequestRenderWindowSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback_DSPLog
|
|
||||||
// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
|
|
||||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
|
|
||||||
{
|
|
||||||
GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, "%s", _szMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Callback_DSPInterrupt
|
|
||||||
// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
|
|
||||||
void Callback_DSPInterrupt()
|
|
||||||
{
|
|
||||||
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Callback_ISOName: Let the DSP emulator get the game name
|
// Callback_ISOName: Let the DSP emulator get the game name
|
||||||
//
|
//
|
||||||
const char *Callback_ISOName()
|
const char *Callback_ISOName()
|
||||||
@ -699,11 +614,4 @@ const char *Callback_ISOName()
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from ANY thread!
|
|
||||||
// Pass the message on to the host
|
|
||||||
void Callback_CoreMessage(int Id)
|
|
||||||
{
|
|
||||||
Host_Message(Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Core
|
} // Core
|
||||||
|
@ -34,76 +34,73 @@
|
|||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
|
||||||
void Callback_VideoLog(const char* _szMessage);
|
// Get core parameters
|
||||||
|
// TODO: kill, use SConfig instead
|
||||||
|
extern SCoreStartupParameter g_CoreStartupParameter;
|
||||||
|
|
||||||
void Callback_VideoCopiedToXFB(bool video_update);
|
void Callback_VideoCopiedToXFB(bool video_update);
|
||||||
void Callback_VideoGetWindowSize(int& x, int& y, int& width, int& height);
|
|
||||||
void Callback_VideoRequestWindowSize(int& width, int& height);
|
|
||||||
void Callback_CoreMessage(int Id);
|
|
||||||
|
|
||||||
enum EState
|
enum EState
|
||||||
{
|
{
|
||||||
CORE_UNINITIALIZED,
|
CORE_UNINITIALIZED,
|
||||||
CORE_PAUSE,
|
CORE_PAUSE,
|
||||||
CORE_RUN,
|
CORE_RUN,
|
||||||
CORE_STOPPING
|
CORE_STOPPING
|
||||||
};
|
};
|
||||||
|
|
||||||
// Init core
|
bool Init();
|
||||||
bool Init();
|
void Stop();
|
||||||
void Stop();
|
|
||||||
|
|
||||||
std::string StopMessage(bool, std::string);
|
std::string StopMessage(bool, std::string);
|
||||||
|
|
||||||
bool isRunning();
|
bool IsRunning();
|
||||||
bool IsRunningInCurrentThread(); // this tells us whether we are running in the cpu thread.
|
bool IsRunningInCurrentThread(); // this tells us whether we are running in the cpu thread.
|
||||||
bool IsCPUThread(); // this tells us whether we are the cpu thread.
|
bool IsCPUThread(); // this tells us whether we are the cpu thread.
|
||||||
|
|
||||||
void SetState(EState _State);
|
void SetState(EState _State);
|
||||||
EState GetState();
|
EState GetState();
|
||||||
|
|
||||||
void ScreenShot(const std::string& name);
|
void SaveScreenShot();
|
||||||
void ScreenShot();
|
|
||||||
|
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||||
|
|
||||||
|
void* GetWindowHandle();
|
||||||
|
|
||||||
// Get core parameters kill use SConfig instead
|
void StartTrace(bool write);
|
||||||
extern SCoreStartupParameter g_CoreStartupParameter;
|
|
||||||
|
|
||||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
// This displays messages in a user-visible way.
|
||||||
|
void DisplayMessage(const char *message, int time_in_ms);
|
||||||
|
|
||||||
void* GetWindowHandle();
|
inline void DisplayMessage(const std::string &message, int time_in_ms)
|
||||||
|
{
|
||||||
bool GetRealWiimote();
|
DisplayMessage(message.c_str(), time_in_ms);
|
||||||
|
}
|
||||||
extern bool bReadTrace;
|
|
||||||
extern bool bWriteTrace;
|
|
||||||
|
|
||||||
void StartTrace(bool write);
|
|
||||||
void DisplayMessage(const std::string &message, int time_in_ms); // This displays messages in a user-visible way.
|
|
||||||
void DisplayMessage(const char *message, int time_in_ms); // This displays messages in a user-visible way.
|
|
||||||
|
|
||||||
std::string GetStateFileName();
|
std::string GetStateFileName();
|
||||||
void SetStateFileName(std::string val);
|
void SetStateFileName(std::string val);
|
||||||
|
|
||||||
int SyncTrace();
|
int SyncTrace();
|
||||||
void SetBlockStart(u32 addr);
|
void SetBlockStart(u32 addr);
|
||||||
void StopTrace();
|
void StopTrace();
|
||||||
|
|
||||||
bool report_slow(int skipped);
|
bool ShouldSkipFrame(int skipped);
|
||||||
void VideoThrottle();
|
void VideoThrottle();
|
||||||
|
|
||||||
|
#ifdef RERECORDING
|
||||||
|
|
||||||
|
void FrameUpdate();
|
||||||
|
void FrameAdvance();
|
||||||
|
void FrameStepOnOff();
|
||||||
|
void WriteStatus();
|
||||||
|
void RerecordingStart();
|
||||||
|
void RerecordingStop();
|
||||||
|
void WindBack(int Counter);
|
||||||
|
|
||||||
|
extern int g_FrameCounter;
|
||||||
|
extern bool g_FrameStep;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------
|
|
||||||
#ifdef RERECORDING
|
|
||||||
// -----------------
|
|
||||||
void FrameUpdate();
|
|
||||||
void FrameAdvance();
|
|
||||||
void FrameStepOnOff();
|
|
||||||
void WriteStatus();
|
|
||||||
void RerecordingStart();
|
|
||||||
void RerecordingStop();
|
|
||||||
void WindBack(int Counter);
|
|
||||||
extern int g_FrameCounter;
|
|
||||||
extern bool g_FrameStep;
|
|
||||||
#endif
|
|
||||||
// ---------------------------
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,16 +101,14 @@ void STACKALIGN CheckGatherPipe()
|
|||||||
void Write8(const u8 _iValue, const u32 _iAddress)
|
void Write8(const u8 _iValue, const u32 _iAddress)
|
||||||
{
|
{
|
||||||
// LOG(GPFIFO, "GPFIFO #%x: 0x%02x",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue);
|
// LOG(GPFIFO, "GPFIFO #%x: 0x%02x",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue);
|
||||||
m_gatherPipe[m_gatherPipeCount] = _iValue;
|
FastWrite8(_iValue);
|
||||||
m_gatherPipeCount++;
|
|
||||||
CheckGatherPipe();
|
CheckGatherPipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write16(const u16 _iValue, const u32 _iAddress)
|
void Write16(const u16 _iValue, const u32 _iAddress)
|
||||||
{
|
{
|
||||||
// LOG(GPFIFO, "GPFIFO #%x: 0x%04x",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue);
|
// LOG(GPFIFO, "GPFIFO #%x: 0x%04x",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue);
|
||||||
*(u16*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap16(_iValue);
|
FastWrite16(_iValue);
|
||||||
m_gatherPipeCount += 2;
|
|
||||||
CheckGatherPipe();
|
CheckGatherPipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,22 +118,20 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
|||||||
// float floatvalue = *(float*)&_iValue;
|
// float floatvalue = *(float*)&_iValue;
|
||||||
// LOG(GPFIFO, "GPFIFO #%x: 0x%08x / %f",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue, floatvalue);
|
// LOG(GPFIFO, "GPFIFO #%x: 0x%08x / %f",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue, floatvalue);
|
||||||
//#endif
|
//#endif
|
||||||
*(u32*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap32(_iValue);
|
FastWrite32(_iValue);
|
||||||
m_gatherPipeCount += 4;
|
|
||||||
CheckGatherPipe();
|
CheckGatherPipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write64(const u64 _iValue, const u32 _iAddress)
|
void Write64(const u64 _iValue, const u32 _iAddress)
|
||||||
{
|
{
|
||||||
*(u64*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap64(_iValue);
|
FastWrite64(_iValue);
|
||||||
m_gatherPipeCount += 8;
|
|
||||||
CheckGatherPipe();
|
CheckGatherPipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastWrite8(const u8 _iValue)
|
void FastWrite8(const u8 _iValue)
|
||||||
{
|
{
|
||||||
m_gatherPipe[m_gatherPipeCount] = _iValue;
|
m_gatherPipe[m_gatherPipeCount] = _iValue;
|
||||||
m_gatherPipeCount++;
|
++m_gatherPipeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastWrite16(const u16 _iValue)
|
void FastWrite16(const u16 _iValue)
|
||||||
|
@ -347,7 +347,7 @@ static const MemoryView views[] =
|
|||||||
};
|
};
|
||||||
static const int num_views = sizeof(views) / sizeof(MemoryView);
|
static const int num_views = sizeof(views) / sizeof(MemoryView);
|
||||||
|
|
||||||
bool Init()
|
void Init()
|
||||||
{
|
{
|
||||||
bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii;
|
bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii;
|
||||||
bFakeVMEM = SConfig::GetInstance().m_LocalCoreStartupParameter.iTLBHack == 1;
|
bFakeVMEM = SConfig::GetInstance().m_LocalCoreStartupParameter.iTLBHack == 1;
|
||||||
@ -366,7 +366,6 @@ bool Init()
|
|||||||
INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirrors at 0 @ %p, 0x80000000 @ %p , 0xC0000000 @ %p)",
|
INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirrors at 0 @ %p, 0x80000000 @ %p , 0xC0000000 @ %p)",
|
||||||
m_pRAM, m_pPhysicalRAM, m_pVirtualCachedRAM, m_pVirtualUncachedRAM);
|
m_pRAM, m_pPhysicalRAM, m_pVirtualCachedRAM, m_pVirtualUncachedRAM);
|
||||||
m_IsInitialized = true;
|
m_IsInitialized = true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
@ -379,7 +378,7 @@ void DoState(PointerWrap &p)
|
|||||||
p.DoArray(m_pEXRAM, EXRAM_SIZE);
|
p.DoArray(m_pEXRAM, EXRAM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Shutdown()
|
void Shutdown()
|
||||||
{
|
{
|
||||||
m_IsInitialized = false;
|
m_IsInitialized = false;
|
||||||
u32 flags = 0;
|
u32 flags = 0;
|
||||||
@ -389,7 +388,6 @@ bool Shutdown()
|
|||||||
g_arena.ReleaseSpace();
|
g_arena.ReleaseSpace();
|
||||||
base = NULL;
|
base = NULL;
|
||||||
INFO_LOG(MEMMAP, "Memory system shut down.");
|
INFO_LOG(MEMMAP, "Memory system shut down.");
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
|
@ -83,8 +83,8 @@ enum
|
|||||||
|
|
||||||
// Init and Shutdown
|
// Init and Shutdown
|
||||||
bool IsInitialized();
|
bool IsInitialized();
|
||||||
bool Init();
|
void Init();
|
||||||
bool Shutdown();
|
void Shutdown();
|
||||||
void DoState(PointerWrap &p);
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
@ -45,7 +45,6 @@ void Host_NotifyMapLoaded();
|
|||||||
void Host_RefreshDSPDebuggerWindow();
|
void Host_RefreshDSPDebuggerWindow();
|
||||||
void Host_RequestRenderWindowSize(int width, int height);
|
void Host_RequestRenderWindowSize(int width, int height);
|
||||||
void Host_SetStartupDebuggingParameters();
|
void Host_SetStartupDebuggingParameters();
|
||||||
void Host_SetWaitCursor(bool enable);
|
|
||||||
void Host_SetWiiMoteConnectionState(int _State);
|
void Host_SetWiiMoteConnectionState(int _State);
|
||||||
void Host_ShowJitResults(unsigned int address);
|
void Host_ShowJitResults(unsigned int address);
|
||||||
void Host_SysMessage(const char *fmt, ...);
|
void Host_SysMessage(const char *fmt, ...);
|
||||||
|
@ -139,7 +139,7 @@ void FrameSkipping()
|
|||||||
std::lock_guard<std::mutex> lk(cs_frameSkip);
|
std::lock_guard<std::mutex> lk(cs_frameSkip);
|
||||||
|
|
||||||
g_frameSkipCounter++;
|
g_frameSkipCounter++;
|
||||||
if (g_frameSkipCounter > g_framesToSkip || Core::report_slow(g_frameSkipCounter) == false)
|
if (g_frameSkipCounter > g_framesToSkip || Core::ShouldSkipFrame(g_frameSkipCounter) == false)
|
||||||
g_frameSkipCounter = 0;
|
g_frameSkipCounter = 0;
|
||||||
|
|
||||||
g_video_backend->Video_SetRendering(!g_frameSkipCounter);
|
g_video_backend->Video_SetRendering(!g_frameSkipCounter);
|
||||||
@ -200,7 +200,7 @@ bool BeginRecordingInput(int controllers)
|
|||||||
if(File::Exists(g_recordFile))
|
if(File::Exists(g_recordFile))
|
||||||
File::Delete(g_recordFile);
|
File::Delete(g_recordFile);
|
||||||
|
|
||||||
if (Core::isRunning())
|
if (Core::IsRunning())
|
||||||
{
|
{
|
||||||
const std::string stateFilename = g_recordFile + ".sav";
|
const std::string stateFilename = g_recordFile + ".sav";
|
||||||
if(File::Exists(stateFilename))
|
if(File::Exists(stateFilename))
|
||||||
|
@ -151,35 +151,31 @@ CPanel::CPanel(
|
|||||||
case WIIMOTE_DISCONNECT:
|
case WIIMOTE_DISCONNECT:
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||||
{
|
{
|
||||||
if (main_frame->bNoWiimoteMsg)
|
const int wiimote_idx = lParam;
|
||||||
main_frame->bNoWiimoteMsg = false;
|
const int wiimote_num = wiimote_idx + 1;
|
||||||
|
|
||||||
|
//Auto reconnect if option is turned on.
|
||||||
|
//TODO: Make this only auto reconnect wiimotes that have the option activated.
|
||||||
|
SConfig::GetInstance().LoadSettingsWii();//Make sure we are using the newest settings.
|
||||||
|
if (SConfig::GetInstance().m_WiiAutoReconnect[wiimote_idx])
|
||||||
|
{
|
||||||
|
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
||||||
|
NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", wiimote_num);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int wiimote_idx = lParam;
|
// The Wiimote has been disconnected, we offer reconnect here.
|
||||||
int wiimote_num = wiimote_idx + 1;
|
wxMessageDialog *dlg = new wxMessageDialog(
|
||||||
//Auto reconnect if option is turned on.
|
this,
|
||||||
//TODO: Make this only auto reconnect wiimotes that have the option activated.
|
wxString::Format(_("Wiimote %i has been disconnected by system.\nMaybe this game doesn't support multi-wiimote,\nor maybe it is due to idle time out or other reason.\nDo you want to reconnect immediately?"), wiimote_num),
|
||||||
SConfig::GetInstance().LoadSettingsWii();//Make sure we are using the newest settings.
|
_("Reconnect Wiimote Confirm"),
|
||||||
if (SConfig::GetInstance().m_WiiAutoReconnect[wiimote_idx])
|
wxYES_NO | wxSTAY_ON_TOP | wxICON_INFORMATION, //wxICON_QUESTION,
|
||||||
{
|
wxDefaultPosition);
|
||||||
|
|
||||||
|
if (dlg->ShowModal() == wxID_YES)
|
||||||
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
||||||
NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", wiimote_num);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The Wiimote has been disconnected, we offer reconnect here.
|
|
||||||
wxMessageDialog *dlg = new wxMessageDialog(
|
|
||||||
this,
|
|
||||||
wxString::Format(_("Wiimote %i has been disconnected by system.\nMaybe this game doesn't support multi-wiimote,\nor maybe it is due to idle time out or other reason.\nDo you want to reconnect immediately?"), wiimote_num),
|
|
||||||
_("Reconnect Wiimote Confirm"),
|
|
||||||
wxYES_NO | wxSTAY_ON_TOP | wxICON_INFORMATION, //wxICON_QUESTION,
|
|
||||||
wxDefaultPosition);
|
|
||||||
|
|
||||||
if (dlg->ShowModal() == wxID_YES)
|
dlg->Destroy();
|
||||||
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
|
||||||
|
|
||||||
dlg->Destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,7 +337,6 @@ CFrame::CFrame(wxFrame* parent,
|
|||||||
long style)
|
long style)
|
||||||
: CRenderFrame(parent, id, title, pos, size, style)
|
: CRenderFrame(parent, id, title, pos, size, style)
|
||||||
, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
|
, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
|
||||||
, bRenderToMain(false), bNoWiimoteMsg(false)
|
|
||||||
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
|
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
|
||||||
, m_GameListCtrl(NULL), m_Panel(NULL)
|
, m_GameListCtrl(NULL), m_Panel(NULL)
|
||||||
, m_RenderFrame(NULL), m_RenderParent(NULL)
|
, m_RenderFrame(NULL), m_RenderParent(NULL)
|
||||||
@ -602,22 +597,10 @@ void CFrame::OnResize(wxSizeEvent& event)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (nMsg)
|
if (WM_SYSCOMMAND == nMsg && (SC_SCREENSAVE == wParam || SC_MONITORPOWER == wParam))
|
||||||
{
|
return 0;
|
||||||
case WM_SYSCOMMAND:
|
else
|
||||||
switch (wParam & 0xFFF0)
|
|
||||||
{
|
|
||||||
case SC_SCREENSAVE:
|
|
||||||
case SC_MONITORPOWER:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -887,7 +870,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||||||
DoStop();
|
DoStop();
|
||||||
// Screenshot hotkey
|
// Screenshot hotkey
|
||||||
else if (IsHotkey(event, HK_SCREENSHOT))
|
else if (IsHotkey(event, HK_SCREENSHOT))
|
||||||
Core::ScreenShot();
|
Core::SaveScreenShot();
|
||||||
// Wiimote connect and disconnect hotkeys
|
// Wiimote connect and disconnect hotkeys
|
||||||
else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
|
else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
|
||||||
WiimoteId = 0;
|
WiimoteId = 0;
|
||||||
|
@ -88,265 +88,265 @@ class CRenderFrame : public wxFrame
|
|||||||
|
|
||||||
class CFrame : public CRenderFrame
|
class CFrame : public CRenderFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFrame(wxFrame* parent,
|
CFrame(wxFrame* parent,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
const wxString& title = wxT("Dolphin"),
|
const wxString& title = wxT("Dolphin"),
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
bool _UseDebugger = false,
|
bool _UseDebugger = false,
|
||||||
bool _BatchMode = false,
|
bool _BatchMode = false,
|
||||||
bool ShowLogWindow = false,
|
bool ShowLogWindow = false,
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
||||||
|
|
||||||
virtual ~CFrame();
|
virtual ~CFrame();
|
||||||
|
|
||||||
void* GetRenderHandle()
|
void* GetRenderHandle()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return (void *)m_RenderParent->GetHandle();
|
return (void *)m_RenderParent->GetHandle();
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
|
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
|
||||||
#else
|
#else
|
||||||
return m_RenderParent;
|
return m_RenderParent;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// These have to be public
|
// These have to be public
|
||||||
CCodeWindow* g_pCodeWindow;
|
CCodeWindow* g_pCodeWindow;
|
||||||
NetPlaySetupDiag* g_NetPlaySetupDiag;
|
NetPlaySetupDiag* g_NetPlaySetupDiag;
|
||||||
wxCheatsWindow* g_CheatsWindow;
|
wxCheatsWindow* g_CheatsWindow;
|
||||||
void InitBitmaps();
|
|
||||||
void DoPause();
|
|
||||||
void DoStop();
|
|
||||||
void DoRecordingSave();
|
|
||||||
bool bRenderToMain;
|
|
||||||
bool bNoWiimoteMsg;
|
|
||||||
void UpdateGUI();
|
|
||||||
void UpdateGameList();
|
|
||||||
void ToggleLogWindow(bool bShow);
|
|
||||||
void ToggleLogConfigWindow(bool bShow);
|
|
||||||
void ToggleConsole(bool bShow);
|
|
||||||
void PostEvent(wxCommandEvent& event);
|
|
||||||
void StatusBarMessage(const char * Text, ...);
|
|
||||||
void ClearStatusBar();
|
|
||||||
void GetRenderWindowSize(int& x, int& y, int& width, int& height);
|
|
||||||
void OnRenderWindowSizeRequest(int width, int height);
|
|
||||||
void BootGame(const std::string& filename);
|
|
||||||
void OnRenderParentClose(wxCloseEvent& event);
|
|
||||||
void OnRenderParentMove(wxMoveEvent& event);
|
|
||||||
bool RendererHasFocus();
|
|
||||||
void DoFullscreen(bool bF);
|
|
||||||
void ToggleDisplayMode (bool bFullscreen);
|
|
||||||
static void ConnectWiimote(int wm_idx, bool connect);
|
|
||||||
|
|
||||||
const CGameListCtrl *GetGameListCtrl() const;
|
void InitBitmaps();
|
||||||
|
void DoPause();
|
||||||
|
void DoStop();
|
||||||
|
void DoRecordingSave();
|
||||||
|
void UpdateGUI();
|
||||||
|
void UpdateGameList();
|
||||||
|
void ToggleLogWindow(bool bShow);
|
||||||
|
void ToggleLogConfigWindow(bool bShow);
|
||||||
|
void ToggleConsole(bool bShow);
|
||||||
|
void PostEvent(wxCommandEvent& event);
|
||||||
|
void StatusBarMessage(const char * Text, ...);
|
||||||
|
void ClearStatusBar();
|
||||||
|
void GetRenderWindowSize(int& x, int& y, int& width, int& height);
|
||||||
|
void OnRenderWindowSizeRequest(int width, int height);
|
||||||
|
void BootGame(const std::string& filename);
|
||||||
|
void OnRenderParentClose(wxCloseEvent& event);
|
||||||
|
void OnRenderParentMove(wxMoveEvent& event);
|
||||||
|
bool RendererHasFocus();
|
||||||
|
void DoFullscreen(bool bF);
|
||||||
|
void ToggleDisplayMode (bool bFullscreen);
|
||||||
|
static void ConnectWiimote(int wm_idx, bool connect);
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
Common::Event panic_event;
|
|
||||||
bool bPanicResult;
|
|
||||||
std::recursive_mutex keystate_lock;
|
std::recursive_mutex keystate_lock;
|
||||||
#endif
|
const CGameListCtrl *GetGameListCtrl() const;
|
||||||
|
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
#ifdef __WXGTK__
|
||||||
X11Utils::XRRConfiguration *m_XRRConfig;
|
Common::Event panic_event;
|
||||||
#endif
|
bool bPanicResult;
|
||||||
|
std::mutex keystate_lock;
|
||||||
|
#endif
|
||||||
|
|
||||||
// AUI
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
wxAuiManager *m_Mgr;
|
X11Utils::XRRConfiguration *m_XRRConfig;
|
||||||
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
#endif
|
||||||
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
|
||||||
|
|
||||||
// Perspectives (Should find a way to make all of this private)
|
// AUI
|
||||||
void DoAddPage(wxWindow *Win, int i, bool Float);
|
wxAuiManager *m_Mgr;
|
||||||
void DoRemovePage(wxWindow *, bool bHide = true);
|
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
||||||
struct SPerspectives
|
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
||||||
{
|
|
||||||
std::string Name;
|
|
||||||
wxString Perspective;
|
|
||||||
std::vector<int> Width, Height;
|
|
||||||
};
|
|
||||||
std::vector<SPerspectives> Perspectives;
|
|
||||||
u32 ActivePerspective;
|
|
||||||
|
|
||||||
private:
|
// Perspectives (Should find a way to make all of this private)
|
||||||
CGameListCtrl* m_GameListCtrl;
|
void DoAddPage(wxWindow *Win, int i, bool Float);
|
||||||
wxPanel* m_Panel;
|
void DoRemovePage(wxWindow *, bool bHide = true);
|
||||||
CRenderFrame* m_RenderFrame;
|
struct SPerspectives
|
||||||
wxPanel* m_RenderParent;
|
{
|
||||||
CLogWindow* m_LogWindow;
|
std::string Name;
|
||||||
LogConfigWindow* m_LogConfigWindow;
|
wxString Perspective;
|
||||||
bool UseDebugger;
|
std::vector<int> Width, Height;
|
||||||
bool m_bBatchMode;
|
};
|
||||||
bool m_bEdit;
|
std::vector<SPerspectives> Perspectives;
|
||||||
bool m_bTabSplit;
|
u32 ActivePerspective;
|
||||||
bool m_bNoDocking;
|
|
||||||
bool m_bGameLoading;
|
|
||||||
|
|
||||||
std::vector<std::string> drives;
|
private:
|
||||||
|
CGameListCtrl* m_GameListCtrl;
|
||||||
|
wxPanel* m_Panel;
|
||||||
|
CRenderFrame* m_RenderFrame;
|
||||||
|
wxPanel* m_RenderParent;
|
||||||
|
CLogWindow* m_LogWindow;
|
||||||
|
LogConfigWindow* m_LogConfigWindow;
|
||||||
|
bool UseDebugger;
|
||||||
|
bool m_bBatchMode;
|
||||||
|
bool m_bEdit;
|
||||||
|
bool m_bTabSplit;
|
||||||
|
bool m_bNoDocking;
|
||||||
|
bool m_bGameLoading;
|
||||||
|
|
||||||
enum EToolbar
|
std::vector<std::string> drives;
|
||||||
{
|
|
||||||
Toolbar_FileOpen,
|
|
||||||
Toolbar_Refresh,
|
|
||||||
Toolbar_Browse,
|
|
||||||
Toolbar_Play,
|
|
||||||
Toolbar_Stop,
|
|
||||||
Toolbar_Pause,
|
|
||||||
Toolbar_Screenshot,
|
|
||||||
Toolbar_FullScreen,
|
|
||||||
Toolbar_ConfigMain,
|
|
||||||
Toolbar_ConfigGFX,
|
|
||||||
Toolbar_ConfigDSP,
|
|
||||||
Toolbar_ConfigPAD,
|
|
||||||
Toolbar_Wiimote,
|
|
||||||
Toolbar_Help,
|
|
||||||
EToolbar_Max
|
|
||||||
};
|
|
||||||
|
|
||||||
enum EBitmapsThemes
|
enum EToolbar
|
||||||
{
|
{
|
||||||
BOOMY,
|
Toolbar_FileOpen,
|
||||||
VISTA,
|
Toolbar_Refresh,
|
||||||
XPLASTIK,
|
Toolbar_Browse,
|
||||||
KDE,
|
Toolbar_Play,
|
||||||
THEMES_MAX
|
Toolbar_Stop,
|
||||||
};
|
Toolbar_Pause,
|
||||||
|
Toolbar_Screenshot,
|
||||||
|
Toolbar_FullScreen,
|
||||||
|
Toolbar_ConfigMain,
|
||||||
|
Toolbar_ConfigGFX,
|
||||||
|
Toolbar_ConfigDSP,
|
||||||
|
Toolbar_ConfigPAD,
|
||||||
|
Toolbar_Wiimote,
|
||||||
|
Toolbar_Help,
|
||||||
|
EToolbar_Max
|
||||||
|
};
|
||||||
|
|
||||||
wxBitmap m_Bitmaps[EToolbar_Max];
|
enum EBitmapsThemes
|
||||||
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
{
|
||||||
|
BOOMY,
|
||||||
|
VISTA,
|
||||||
|
XPLASTIK,
|
||||||
|
KDE,
|
||||||
|
THEMES_MAX
|
||||||
|
};
|
||||||
|
|
||||||
void PopulateToolbar(wxAuiToolBar* toolBar);
|
wxBitmap m_Bitmaps[EToolbar_Max];
|
||||||
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
||||||
void RecreateToolbar();
|
|
||||||
void CreateMenu();
|
|
||||||
|
|
||||||
// Utility
|
void PopulateToolbar(wxAuiToolBar* toolBar);
|
||||||
wxString GetMenuLabel(int Id);
|
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
||||||
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
void RecreateToolbar();
|
||||||
wxAuiNotebook * GetNotebookFromId(u32 NBId);
|
void CreateMenu();
|
||||||
int GetNotebookCount();
|
|
||||||
wxAuiNotebook *CreateEmptyNotebook();
|
|
||||||
|
|
||||||
// Perspectives
|
// Utility
|
||||||
void AddRemoveBlankPage();
|
wxString GetMenuLabel(int Id);
|
||||||
void OnNotebookPageClose(wxAuiNotebookEvent& event);
|
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
||||||
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
|
wxAuiNotebook * GetNotebookFromId(u32 NBId);
|
||||||
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
|
int GetNotebookCount();
|
||||||
void OnFloatWindow(wxCommandEvent& event);
|
wxAuiNotebook *CreateEmptyNotebook();
|
||||||
void ToggleFloatWindow(int Id);
|
|
||||||
void OnTab(wxAuiNotebookEvent& event);
|
// Perspectives
|
||||||
int GetNotebookAffiliation(wxWindowID Id);
|
void AddRemoveBlankPage();
|
||||||
void ClosePages();
|
void OnNotebookPageClose(wxAuiNotebookEvent& event);
|
||||||
void CloseAllNotebooks();
|
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
|
||||||
void TogglePane();
|
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
|
||||||
void SetPaneSize();
|
void OnFloatWindow(wxCommandEvent& event);
|
||||||
void ResetToolbarStyle();
|
void ToggleFloatWindow(int Id);
|
||||||
void TogglePaneStyle(bool On, int EventId);
|
void OnTab(wxAuiNotebookEvent& event);
|
||||||
void ToggleNotebookStyle(bool On, long Style);
|
int GetNotebookAffiliation(wxWindowID Id);
|
||||||
void ResizeConsole();
|
void ClosePages();
|
||||||
// Float window
|
void CloseAllNotebooks();
|
||||||
void DoUnfloatPage(int Id);
|
void TogglePane();
|
||||||
void OnFloatingPageClosed(wxCloseEvent& event);
|
void SetPaneSize();
|
||||||
void OnFloatingPageSize(wxSizeEvent& event);
|
void ResetToolbarStyle();
|
||||||
void DoFloatNotebookPage(wxWindowID Id);
|
void TogglePaneStyle(bool On, int EventId);
|
||||||
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
|
void ToggleNotebookStyle(bool On, long Style);
|
||||||
const wxString& title = wxT(""),
|
void ResizeConsole();
|
||||||
wxWindow * = NULL);
|
// Float window
|
||||||
wxString AuiFullscreen, AuiCurrent;
|
void DoUnfloatPage(int Id);
|
||||||
void AddPane();
|
void OnFloatingPageClosed(wxCloseEvent& event);
|
||||||
void UpdateCurrentPerspective();
|
void OnFloatingPageSize(wxSizeEvent& event);
|
||||||
void SaveIniPerspectives();
|
void DoFloatNotebookPage(wxWindowID Id);
|
||||||
void LoadIniPerspectives();
|
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
|
||||||
void OnPaneClose(wxAuiManagerEvent& evt);
|
const wxString& title = wxT(""),
|
||||||
void ReloadPanes();
|
wxWindow * = NULL);
|
||||||
void DoLoadPerspective();
|
wxString AuiFullscreen, AuiCurrent;
|
||||||
void OnDropDownToolbarSelect(wxCommandEvent& event);
|
void AddPane();
|
||||||
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
|
void UpdateCurrentPerspective();
|
||||||
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
|
void SaveIniPerspectives();
|
||||||
void OnSelectPerspective(wxCommandEvent& event);
|
void LoadIniPerspectives();
|
||||||
|
void OnPaneClose(wxAuiManagerEvent& evt);
|
||||||
|
void ReloadPanes();
|
||||||
|
void DoLoadPerspective();
|
||||||
|
void OnDropDownToolbarSelect(wxCommandEvent& event);
|
||||||
|
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
|
||||||
|
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
|
||||||
|
void OnSelectPerspective(wxCommandEvent& event);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Override window proc for tricks like screensaver disabling
|
// Override window proc for tricks like screensaver disabling
|
||||||
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
#endif
|
#endif
|
||||||
// Event functions
|
// Event functions
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnHelp(wxCommandEvent& event);
|
void OnHelp(wxCommandEvent& event);
|
||||||
void OnToolBar(wxCommandEvent& event);
|
void OnToolBar(wxCommandEvent& event);
|
||||||
void OnAuiToolBar(wxAuiToolBarEvent& event);
|
void OnAuiToolBar(wxAuiToolBarEvent& event);
|
||||||
|
|
||||||
void OnOpen(wxCommandEvent& event); // File menu
|
void OnOpen(wxCommandEvent& event); // File menu
|
||||||
void DoOpen(bool Boot);
|
void DoOpen(bool Boot);
|
||||||
void OnRefresh(wxCommandEvent& event);
|
void OnRefresh(wxCommandEvent& event);
|
||||||
void OnBrowse(wxCommandEvent& event);
|
void OnBrowse(wxCommandEvent& event);
|
||||||
void OnBootDrive(wxCommandEvent& event);
|
void OnBootDrive(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnPlay(wxCommandEvent& event); // Emulation
|
void OnPlay(wxCommandEvent& event); // Emulation
|
||||||
void OnStop(wxCommandEvent& event);
|
void OnStop(wxCommandEvent& event);
|
||||||
void OnReset(wxCommandEvent& event);
|
void OnReset(wxCommandEvent& event);
|
||||||
void OnRecord(wxCommandEvent& event);
|
void OnRecord(wxCommandEvent& event);
|
||||||
void OnPlayRecording(wxCommandEvent& event);
|
void OnPlayRecording(wxCommandEvent& event);
|
||||||
void OnRecordExport(wxCommandEvent& event);
|
void OnRecordExport(wxCommandEvent& event);
|
||||||
void OnRecordReadOnly(wxCommandEvent& event);
|
void OnRecordReadOnly(wxCommandEvent& event);
|
||||||
void OnChangeDisc(wxCommandEvent& event);
|
void OnChangeDisc(wxCommandEvent& event);
|
||||||
void OnScreenshot(wxCommandEvent& event);
|
void OnScreenshot(wxCommandEvent& event);
|
||||||
void OnActive(wxActivateEvent& event);
|
void OnActive(wxActivateEvent& event);
|
||||||
void OnClose(wxCloseEvent &event);
|
void OnClose(wxCloseEvent &event);
|
||||||
void OnLoadState(wxCommandEvent& event);
|
void OnLoadState(wxCommandEvent& event);
|
||||||
void OnSaveState(wxCommandEvent& event);
|
void OnSaveState(wxCommandEvent& event);
|
||||||
void OnLoadStateFromFile(wxCommandEvent& event);
|
void OnLoadStateFromFile(wxCommandEvent& event);
|
||||||
void OnSaveStateToFile(wxCommandEvent& event);
|
void OnSaveStateToFile(wxCommandEvent& event);
|
||||||
void OnLoadLastState(wxCommandEvent& event);
|
void OnLoadLastState(wxCommandEvent& event);
|
||||||
void OnUndoLoadState(wxCommandEvent& event);
|
void OnUndoLoadState(wxCommandEvent& event);
|
||||||
void OnUndoSaveState(wxCommandEvent& event);
|
void OnUndoSaveState(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnFrameSkip(wxCommandEvent& event);
|
void OnFrameSkip(wxCommandEvent& event);
|
||||||
void OnFrameStep(wxCommandEvent& event);
|
void OnFrameStep(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnConfigMain(wxCommandEvent& event); // Options
|
void OnConfigMain(wxCommandEvent& event); // Options
|
||||||
void OnConfigGFX(wxCommandEvent& event);
|
void OnConfigGFX(wxCommandEvent& event);
|
||||||
void OnConfigDSP(wxCommandEvent& event);
|
void OnConfigDSP(wxCommandEvent& event);
|
||||||
void OnConfigPAD(wxCommandEvent& event);
|
void OnConfigPAD(wxCommandEvent& event);
|
||||||
void OnConfigWiimote(wxCommandEvent& event);
|
void OnConfigWiimote(wxCommandEvent& event);
|
||||||
void OnConfigHotkey(wxCommandEvent& event);
|
void OnConfigHotkey(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnToggleFullscreen(wxCommandEvent& event);
|
void OnToggleFullscreen(wxCommandEvent& event);
|
||||||
void OnToggleDualCore(wxCommandEvent& event);
|
void OnToggleDualCore(wxCommandEvent& event);
|
||||||
void OnToggleSkipIdle(wxCommandEvent& event);
|
void OnToggleSkipIdle(wxCommandEvent& event);
|
||||||
void OnToggleThrottle(wxCommandEvent& event);
|
void OnToggleThrottle(wxCommandEvent& event);
|
||||||
void OnManagerResize(wxAuiManagerEvent& event);
|
void OnManagerResize(wxAuiManagerEvent& event);
|
||||||
void OnMove(wxMoveEvent& event);
|
void OnMove(wxMoveEvent& event);
|
||||||
void OnResize(wxSizeEvent& event);
|
void OnResize(wxSizeEvent& event);
|
||||||
void OnToggleToolbar(wxCommandEvent& event);
|
void OnToggleToolbar(wxCommandEvent& event);
|
||||||
void DoToggleToolbar(bool);
|
void DoToggleToolbar(bool);
|
||||||
void OnToggleStatusbar(wxCommandEvent& event);
|
void OnToggleStatusbar(wxCommandEvent& event);
|
||||||
void OnToggleWindow(wxCommandEvent& event);
|
void OnToggleWindow(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnKeyDown(wxKeyEvent& event); // Keyboard
|
void OnKeyDown(wxKeyEvent& event); // Keyboard
|
||||||
void OnKeyUp(wxKeyEvent& event);
|
void OnKeyUp(wxKeyEvent& event);
|
||||||
|
|
||||||
void OnMouse(wxMouseEvent& event); // Mouse
|
void OnMouse(wxMouseEvent& event); // Mouse
|
||||||
|
|
||||||
void OnHostMessage(wxCommandEvent& event);
|
void OnHostMessage(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnMemcard(wxCommandEvent& event); // Misc
|
void OnMemcard(wxCommandEvent& event); // Misc
|
||||||
void OnImportSave(wxCommandEvent& event);
|
void OnImportSave(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnNetPlay(wxCommandEvent& event);
|
void OnNetPlay(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnShow_CheatsWindow(wxCommandEvent& event);
|
void OnShow_CheatsWindow(wxCommandEvent& event);
|
||||||
void OnLoadWiiMenu(wxCommandEvent& event);
|
void OnLoadWiiMenu(wxCommandEvent& event);
|
||||||
void OnConnectWiimote(wxCommandEvent& event);
|
void OnConnectWiimote(wxCommandEvent& event);
|
||||||
void GameListChanged(wxCommandEvent& event);
|
void GameListChanged(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
||||||
void OnRenderParentResize(wxSizeEvent& event);
|
void OnRenderParentResize(wxSizeEvent& event);
|
||||||
bool RendererIsFullscreen();
|
bool RendererIsFullscreen();
|
||||||
void StartGame(const std::string& filename);
|
void StartGame(const std::string& filename);
|
||||||
|
|
||||||
// Event table
|
// Event table
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
int GetCmdForHotkey(unsigned int key);
|
int GetCmdForHotkey(unsigned int key);
|
||||||
|
@ -922,6 +922,8 @@ void CFrame::StartGame(const std::string& filename)
|
|||||||
m_RenderFrame->Show();
|
m_RenderFrame->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
if (!BootManager::BootCore(filename))
|
if (!BootManager::BootCore(filename))
|
||||||
{
|
{
|
||||||
// Destroy the renderer frame when not rendering to main
|
// Destroy the renderer frame when not rendering to main
|
||||||
@ -971,6 +973,8 @@ void CFrame::StartGame(const std::string& filename)
|
|||||||
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
||||||
(wxObject*)0, this);
|
(wxObject*)0, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxEndBusyCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrame::OnBootDrive(wxCommandEvent& event)
|
void CFrame::OnBootDrive(wxCommandEvent& event)
|
||||||
@ -978,7 +982,6 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
|
|||||||
BootGame(drives[event.GetId()-IDM_DRIVE1]);
|
BootGame(drives[event.GetId()-IDM_DRIVE1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Refresh the file list and browse for a favorites directory
|
// Refresh the file list and browse for a favorites directory
|
||||||
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
@ -994,7 +997,7 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
|||||||
// Create screenshot
|
// Create screenshot
|
||||||
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
|
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
Core::ScreenShot();
|
Core::SaveScreenShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause the emulation
|
// Pause the emulation
|
||||||
@ -1048,7 +1051,9 @@ void CFrame::DoStop()
|
|||||||
if(Frame::IsPlayingInput() || Frame::IsRecordingInput())
|
if(Frame::IsPlayingInput() || Frame::IsRecordingInput())
|
||||||
Frame::EndPlayInput(false);
|
Frame::EndPlayInput(false);
|
||||||
|
|
||||||
|
wxBeginBusyCursor();
|
||||||
BootManager::Stop();
|
BootManager::Stop();
|
||||||
|
wxEndBusyCursor();
|
||||||
|
|
||||||
#if defined(HAVE_XDG_SCREENSAVER) && HAVE_XDG_SCREENSAVER
|
#if defined(HAVE_XDG_SCREENSAVER) && HAVE_XDG_SCREENSAVER
|
||||||
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
|
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
|
||||||
@ -1353,7 +1358,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
|
|||||||
|
|
||||||
void CFrame::ConnectWiimote(int wm_idx, bool connect)
|
void CFrame::ConnectWiimote(int wm_idx, bool connect)
|
||||||
{
|
{
|
||||||
if (Core::isRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
if (Core::IsRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||||
{
|
{
|
||||||
GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
|
GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
|
||||||
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
|
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
|
||||||
@ -1461,7 +1466,7 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
|
|||||||
void CFrame::UpdateGUI()
|
void CFrame::UpdateGUI()
|
||||||
{
|
{
|
||||||
// Save status
|
// Save status
|
||||||
bool Initialized = Core::isRunning();
|
bool Initialized = Core::IsRunning();
|
||||||
bool Running = Core::GetState() == Core::CORE_RUN;
|
bool Running = Core::GetState() == Core::CORE_RUN;
|
||||||
bool Paused = Core::GetState() == Core::CORE_PAUSE;
|
bool Paused = Core::GetState() == Core::CORE_PAUSE;
|
||||||
|
|
||||||
|
@ -51,10 +51,6 @@
|
|||||||
|
|
||||||
IMPLEMENT_APP(DolphinApp)
|
IMPLEMENT_APP(DolphinApp)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(DolphinApp, wxApp)
|
|
||||||
EVT_TIMER(wxID_ANY, DolphinApp::AfterInit)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
bool wxMsgAlert(const char*, const char*, bool, int);
|
bool wxMsgAlert(const char*, const char*, bool, int);
|
||||||
std::string wxStringTranslator(const char *);
|
std::string wxStringTranslator(const char *);
|
||||||
@ -325,12 +321,6 @@ bool DolphinApp::OnInit()
|
|||||||
SetTopWindow(main_frame);
|
SetTopWindow(main_frame);
|
||||||
main_frame->SetMinSize(wxSize(400, 300));
|
main_frame->SetMinSize(wxSize(400, 300));
|
||||||
|
|
||||||
// Postpone final actions until event handler is running.
|
|
||||||
// Updating the game list makes use of wxProgressDialog which may
|
|
||||||
// only be run after OnInit() when the event handler is running.
|
|
||||||
m_afterinit = new wxTimer(this, wxID_ANY);
|
|
||||||
m_afterinit->Start(1, wxTIMER_ONE_SHOT);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,15 +329,12 @@ void DolphinApp::MacOpenFile(const wxString &fileName)
|
|||||||
FileToLoad = fileName;
|
FileToLoad = fileName;
|
||||||
LoadFile = true;
|
LoadFile = true;
|
||||||
|
|
||||||
if (m_afterinit == NULL)
|
if (IsMainLoopRunning())
|
||||||
main_frame->BootGame(std::string(FileToLoad.mb_str()));
|
main_frame->BootGame(std::string(FileToLoad.mb_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
|
int DolphinApp::MainLoop()
|
||||||
{
|
{
|
||||||
delete m_afterinit;
|
|
||||||
m_afterinit = NULL;
|
|
||||||
|
|
||||||
if (!BatchMode)
|
if (!BatchMode)
|
||||||
main_frame->UpdateGameList();
|
main_frame->UpdateGameList();
|
||||||
|
|
||||||
@ -375,6 +362,8 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return wxApp::MainLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinApp::InitLanguageSupport()
|
void DolphinApp::InitLanguageSupport()
|
||||||
@ -582,7 +571,7 @@ void Host_UpdateBreakPointView()
|
|||||||
bool Host_GetKeyState(int keycode)
|
bool Host_GetKeyState(int keycode)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return GetAsyncKeyState(keycode);
|
return (0 != GetAsyncKeyState(keycode));
|
||||||
#elif defined __WXGTK__
|
#elif defined __WXGTK__
|
||||||
std::unique_lock<std::recursive_mutex> lk(main_frame->keystate_lock, std::try_to_lock);
|
std::unique_lock<std::recursive_mutex> lk(main_frame->keystate_lock, std::try_to_lock);
|
||||||
if (!lk.owns_lock())
|
if (!lk.owns_lock())
|
||||||
@ -627,14 +616,6 @@ void Host_SetStartupDebuggingParameters()
|
|||||||
StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_SetWaitCursor(bool enable)
|
|
||||||
{
|
|
||||||
if (enable)
|
|
||||||
wxBeginBusyCursor();
|
|
||||||
else
|
|
||||||
wxEndBusyCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Host_UpdateStatusBar(const char* _pText, int Field)
|
void Host_UpdateStatusBar(const char* _pText, int Field)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||||
|
@ -35,15 +35,12 @@ private:
|
|||||||
void InitLanguageSupport();
|
void InitLanguageSupport();
|
||||||
void MacOpenFile(const wxString &fileName);
|
void MacOpenFile(const wxString &fileName);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
|
|
||||||
wxTimer *m_afterinit;
|
|
||||||
bool BatchMode;
|
bool BatchMode;
|
||||||
bool LoadFile;
|
bool LoadFile;
|
||||||
wxString FileToLoad;
|
wxString FileToLoad;
|
||||||
wxLocale *m_locale;
|
wxLocale *m_locale;
|
||||||
|
|
||||||
void AfterInit(wxTimerEvent& WXUNUSED(event));
|
int MainLoop();
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_APP(DolphinApp);
|
DECLARE_APP(DolphinApp);
|
||||||
|
@ -146,7 +146,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||||||
|
|
||||||
// If a game from the game list is running, show the game specific config; show the default config otherwise
|
// If a game from the game list is running, show the game specific config; show the default config otherwise
|
||||||
cur_profile = 0;
|
cur_profile = 0;
|
||||||
if (Core::isRunning())
|
if (Core::IsRunning())
|
||||||
{
|
{
|
||||||
// Search which ISO has been started
|
// Search which ISO has been started
|
||||||
for (long index = GameListCtrl->GetNextItem(-1); index != -1; index = GameListCtrl->GetNextItem(index))
|
for (long index = GameListCtrl->GetNextItem(-1); index != -1; index = GameListCtrl->GetNextItem(index))
|
||||||
@ -196,7 +196,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||||||
|
|
||||||
profile_cb->Select(cur_profile);
|
profile_cb->Select(cur_profile);
|
||||||
_connect_macro_(profile_cb, VideoConfigDiag::Event_OnProfileChange, wxEVT_COMMAND_CHOICE_SELECTED, this);
|
_connect_macro_(profile_cb, VideoConfigDiag::Event_OnProfileChange, wxEVT_COMMAND_CHOICE_SELECTED, this);
|
||||||
profile_cb->Enable(!Core::isRunning());
|
profile_cb->Enable(!Core::IsRunning());
|
||||||
|
|
||||||
// adapter // for D3D only
|
// adapter // for D3D only
|
||||||
if (vconfig.backend_info.Adapters.size())
|
if (vconfig.backend_info.Adapters.size())
|
||||||
@ -545,7 +545,7 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
|
|||||||
|
|
||||||
// If emulation hasn't started, yet, always update g_Config.
|
// If emulation hasn't started, yet, always update g_Config.
|
||||||
// Otherwise only update it if we're editing the currently running game's profile
|
// Otherwise only update it if we're editing the currently running game's profile
|
||||||
if (!Core::isRunning())
|
if (!Core::IsRunning())
|
||||||
{
|
{
|
||||||
g_Config = vconfig;
|
g_Config = vconfig;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "RenderBase.h"
|
#include "RenderBase.h"
|
||||||
#include "VideoBackendBase.h"
|
#include "VideoBackendBase.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
namespace EmuWindow
|
namespace EmuWindow
|
||||||
{
|
{
|
||||||
@ -190,7 +191,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||||||
if (m_hParent == NULL)
|
if (m_hParent == NULL)
|
||||||
{
|
{
|
||||||
// Stop the game
|
// Stop the game
|
||||||
PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0);
|
//PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
|
|||||||
// 3. Request window sizes which actually make the client area map to a common resolution
|
// 3. Request window sizes which actually make the client area map to a common resolution
|
||||||
HWND Ret;
|
HWND Ret;
|
||||||
int x=0, y=0, width=640, height=480;
|
int x=0, y=0, width=640, height=480;
|
||||||
Core::Callback_VideoGetWindowSize(x, y, width, height);
|
Host_GetRenderWindowSize(x, y, width, height);
|
||||||
|
|
||||||
// TODO: Don't show if fullscreen
|
// TODO: Don't show if fullscreen
|
||||||
Ret = OpenWindow(hParent, hInstance, width, height, title);
|
Ret = OpenWindow(hParent, hInstance, width, height, title);
|
||||||
|
@ -213,7 +213,7 @@ bool FifoCommandRunnable()
|
|||||||
"* Some other sort of bug\n\n"
|
"* Some other sort of bug\n\n"
|
||||||
"Dolphin will now likely crash or hang. Enjoy." , cmd_byte);
|
"Dolphin will now likely crash or hang. Enjoy." , cmd_byte);
|
||||||
Host_SysMessage(szTemp);
|
Host_SysMessage(szTemp);
|
||||||
Core::Callback_VideoLog(szTemp);
|
INFO_LOG(VIDEO, "%s", szTemp);
|
||||||
{
|
{
|
||||||
SCPFifoStruct &fifo = CommandProcessor::fifo;
|
SCPFifoStruct &fifo = CommandProcessor::fifo;
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ bool FifoCommandRunnable()
|
|||||||
,fifo.bFF_Breakpoint ? "true" : "false");
|
,fifo.bFF_Breakpoint ? "true" : "false");
|
||||||
|
|
||||||
Host_SysMessage(szTmp);
|
Host_SysMessage(szTmp);
|
||||||
Core::Callback_VideoLog(szTmp);
|
INFO_LOG(VIDEO, "%s", szTmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "Fifo.h"
|
#include "Fifo.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -318,6 +319,19 @@ void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::SetWindowSize(int width, int height)
|
||||||
|
{
|
||||||
|
if (width < 1)
|
||||||
|
width = 1;
|
||||||
|
if (height < 1)
|
||||||
|
height = 1;
|
||||||
|
|
||||||
|
// Scale the window size by the EFB scale.
|
||||||
|
CalculateTargetScale(width, height, width, height);
|
||||||
|
|
||||||
|
Host_RequestRenderWindowSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateViewport()
|
void UpdateViewport()
|
||||||
{
|
{
|
||||||
g_renderer->UpdateViewport();
|
g_renderer->UpdateViewport();
|
||||||
|
@ -84,6 +84,8 @@ public:
|
|||||||
static float GetXFBScaleX() { return xScale; }
|
static float GetXFBScaleX() { return xScale; }
|
||||||
static float GetXFBScaleY() { return yScale; }
|
static float GetXFBScaleY() { return yScale; }
|
||||||
|
|
||||||
|
static void SetWindowSize(int width, int height);
|
||||||
|
|
||||||
// EFB coordinate conversion functions
|
// EFB coordinate conversion functions
|
||||||
|
|
||||||
// Use this to convert a whole native EFB rect to backbuffer coordinates
|
// Use this to convert a whole native EFB rect to backbuffer coordinates
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "OnFrame.h"
|
#include "OnFrame.h"
|
||||||
#include "Television.h"
|
#include "Television.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
namespace DX11
|
namespace DX11
|
||||||
{
|
{
|
||||||
@ -321,7 +322,7 @@ Renderer::Renderer()
|
|||||||
int x, y, w_temp, h_temp;
|
int x, y, w_temp, h_temp;
|
||||||
s_blendMode = 0;
|
s_blendMode = 0;
|
||||||
|
|
||||||
Core::Callback_VideoGetWindowSize(x, y, w_temp, h_temp);
|
Host_GetRenderWindowSize(x, y, w_temp, h_temp);
|
||||||
|
|
||||||
D3D::Create(EmuWindow::GetWnd());
|
D3D::Create(EmuWindow::GetWnd());
|
||||||
|
|
||||||
@ -445,19 +446,6 @@ bool Renderer::CheckForResize()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetWindowSize(int width, int height)
|
|
||||||
{
|
|
||||||
if (width < 1)
|
|
||||||
width = 1;
|
|
||||||
if (height < 1)
|
|
||||||
height = 1;
|
|
||||||
|
|
||||||
// Scale the window size by the EFB scale.
|
|
||||||
CalculateTargetScale(width, height, width, height);
|
|
||||||
|
|
||||||
Core::Callback_VideoRequestWindowSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Renderer::SetScissorRect()
|
bool Renderer::SetScissorRect()
|
||||||
{
|
{
|
||||||
TargetRectangle rc;
|
TargetRectangle rc;
|
||||||
|
@ -51,7 +51,6 @@ public:
|
|||||||
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
||||||
|
|
||||||
static bool CheckForResize();
|
static bool CheckForResize();
|
||||||
static void SetWindowSize(int width, int height);
|
|
||||||
|
|
||||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
||||||
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "VertexLoaderManager.h"
|
#include "VertexLoaderManager.h"
|
||||||
#include "VertexShaderManager.h"
|
#include "VertexShaderManager.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
#include "Debugger/DebuggerPanel.h"
|
#include "Debugger/DebuggerPanel.h"
|
||||||
#include "DLCache.h"
|
#include "DLCache.h"
|
||||||
@ -204,7 +205,7 @@ void VideoBackend::Video_Prepare()
|
|||||||
DLCache::Init();
|
DLCache::Init();
|
||||||
|
|
||||||
// Tell the host that the window is ready
|
// Tell the host that the window is ready
|
||||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
Host_Message(WM_USER_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBackend::Shutdown()
|
void VideoBackend::Shutdown()
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
#include "VideoConfig.h"
|
#include "VideoConfig.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@ -258,7 +259,7 @@ Renderer::Renderer()
|
|||||||
// Multisample Anti-aliasing hasn't been implemented yet use supersamling instead
|
// Multisample Anti-aliasing hasn't been implemented yet use supersamling instead
|
||||||
int backbuffer_ms_mode = 0;
|
int backbuffer_ms_mode = 0;
|
||||||
|
|
||||||
Core::Callback_VideoGetWindowSize(x, y, w_temp, h_temp);
|
Host_GetRenderWindowSize(x, y, w_temp, h_temp);
|
||||||
|
|
||||||
for (fullScreenRes = 0; fullScreenRes < (int)D3D::GetAdapter(g_ActiveConfig.iAdapter).resolutions.size(); fullScreenRes++)
|
for (fullScreenRes = 0; fullScreenRes < (int)D3D::GetAdapter(g_ActiveConfig.iAdapter).resolutions.size(); fullScreenRes++)
|
||||||
{
|
{
|
||||||
@ -425,19 +426,6 @@ bool Renderer::CheckForResize()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetWindowSize(int width, int height)
|
|
||||||
{
|
|
||||||
if (width < 1)
|
|
||||||
width = 1;
|
|
||||||
if (height < 1)
|
|
||||||
height = 1;
|
|
||||||
|
|
||||||
// Scale the window size by the EFB scale.
|
|
||||||
CalculateTargetScale(width, height, width, height);
|
|
||||||
|
|
||||||
Core::Callback_VideoRequestWindowSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Renderer::SetScissorRect()
|
bool Renderer::SetScissorRect()
|
||||||
{
|
{
|
||||||
TargetRectangle rc;
|
TargetRectangle rc;
|
||||||
|
@ -47,7 +47,6 @@ public:
|
|||||||
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
||||||
|
|
||||||
static bool CheckForResize();
|
static bool CheckForResize();
|
||||||
static void SetWindowSize(int width, int height);
|
|
||||||
|
|
||||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
||||||
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "DLCache.h"
|
#include "DLCache.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
#include "ConfigManager.h"
|
#include "ConfigManager.h"
|
||||||
#include "VideoBackend.h"
|
#include "VideoBackend.h"
|
||||||
@ -185,7 +186,7 @@ void VideoBackend::Video_Prepare()
|
|||||||
DLCache::Init();
|
DLCache::Init();
|
||||||
|
|
||||||
// Notify the core that the video backend is ready
|
// Notify the core that the video backend is ready
|
||||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
Host_Message(WM_USER_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBackend::Shutdown()
|
void VideoBackend::Shutdown()
|
||||||
|
@ -296,7 +296,7 @@ void XEventThread()
|
|||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
if ((unsigned long) event.xclient.data.l[0] ==
|
if ((unsigned long) event.xclient.data.l[0] ==
|
||||||
XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", False))
|
XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", False))
|
||||||
Core::Callback_CoreMessage(WM_USER_STOP);
|
Host_Message(WM_USER_STOP);
|
||||||
if ((unsigned long) event.xclient.data.l[0] ==
|
if ((unsigned long) event.xclient.data.l[0] ==
|
||||||
XInternAtom(GLWin.evdpy, "RESIZE", False))
|
XInternAtom(GLWin.evdpy, "RESIZE", False))
|
||||||
XMoveResizeWindow(GLWin.evdpy, GLWin.win,
|
XMoveResizeWindow(GLWin.evdpy, GLWin.win,
|
||||||
@ -317,7 +317,7 @@ void XEventThread()
|
|||||||
bool OpenGL_Create(void *&window_handle)
|
bool OpenGL_Create(void *&window_handle)
|
||||||
{
|
{
|
||||||
int _tx, _ty, _twidth, _theight;
|
int _tx, _ty, _twidth, _theight;
|
||||||
Core::Callback_VideoGetWindowSize(_tx, _ty, _twidth, _theight);
|
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
|
||||||
|
|
||||||
// Control window size and picture scaling
|
// Control window size and picture scaling
|
||||||
s_backbuffer_width = _twidth;
|
s_backbuffer_width = _twidth;
|
||||||
@ -519,7 +519,7 @@ bool OpenGL_MakeCurrent()
|
|||||||
return wglMakeCurrent(hDC, hRC) ? true : false;
|
return wglMakeCurrent(hDC, hRC) ? true : false;
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
#if defined(HAVE_WX) && (HAVE_WX)
|
#if defined(HAVE_WX) && (HAVE_WX)
|
||||||
Core::Callback_VideoGetWindowSize(GLWin.x, GLWin.y,
|
Host_GetRenderWindowSize(GLWin.x, GLWin.y,
|
||||||
(int&)GLWin.width, (int&)GLWin.height);
|
(int&)GLWin.width, (int&)GLWin.height);
|
||||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y,
|
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y,
|
||||||
GLWin.width, GLWin.height);
|
GLWin.width, GLWin.height);
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "Debugger.h"
|
#include "Debugger.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
#include "OnFrame.h"
|
#include "OnFrame.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
#include "main.h" // Local
|
#include "main.h" // Local
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -1613,17 +1614,4 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetWindowSize(int width, int height)
|
|
||||||
{
|
|
||||||
if (width < 1)
|
|
||||||
width = 1;
|
|
||||||
if (height < 1)
|
|
||||||
height = 1;
|
|
||||||
|
|
||||||
// Scale the window size by the EFB scale.
|
|
||||||
CalculateTargetScale(width, height, width, height);
|
|
||||||
|
|
||||||
Core::Callback_VideoRequestWindowSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,6 @@ public:
|
|||||||
|
|
||||||
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
||||||
|
|
||||||
void SetWindowSize(int width, int height);
|
|
||||||
|
|
||||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
||||||
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
void SetPSConstant4fv(unsigned int const_number, const float *f);
|
||||||
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f);
|
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f);
|
||||||
|
@ -92,6 +92,7 @@ Make AA apply instantly during gameplay if possible
|
|||||||
#include "DLCache.h"
|
#include "DLCache.h"
|
||||||
#include "FramebufferManager.h"
|
#include "FramebufferManager.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "Host.h"
|
||||||
|
|
||||||
#include "VideoState.h"
|
#include "VideoState.h"
|
||||||
#include "VideoBackend.h"
|
#include "VideoBackend.h"
|
||||||
@ -211,7 +212,7 @@ void VideoBackend::Video_Prepare()
|
|||||||
DLCache::Init();
|
DLCache::Init();
|
||||||
|
|
||||||
// Notify the core that the video backend is ready
|
// Notify the core that the video backend is ready
|
||||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
Host_Message(WM_USER_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBackend::Shutdown()
|
void VideoBackend::Shutdown()
|
||||||
|
@ -69,7 +69,7 @@ bool VideoBackend::Initialize(void *&window_handle)
|
|||||||
|
|
||||||
if (!OpenGL_Create(window_handle))
|
if (!OpenGL_Create(window_handle))
|
||||||
{
|
{
|
||||||
Core::Callback_VideoLog("SWRenderer::Create failed\n");
|
INFO_LOG(VIDEO, "%s", "SWRenderer::Create failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user