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 "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;
|
||||
CMixer *m_mixer;
|
||||
Common::Event *soundSyncEvent;
|
||||
short *xaBuffer;
|
||||
XAUDIO2_BUFFER buf = {};
|
||||
buf.AudioBytes = BUFFER_SIZE_BYTES;
|
||||
buf.pContext = buf_data;
|
||||
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)))
|
||||
{
|
||||
|
||||
m_mixer = pMixer;
|
||||
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();
|
||||
PanicAlertT("XAudio2 CreateSourceVoice failed: %#X", hr);
|
||||
return;
|
||||
}
|
||||
|
||||
void StreamingVoiceContext::Play() {
|
||||
if (pSourceVoice)
|
||||
pSourceVoice->Start();
|
||||
m_source_voice->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) {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
|
||||
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
|
||||
//m_sound_sync_event->Wait(); // sync
|
||||
//m_sound_sync_event->Spin(); // or tight sync
|
||||
|
||||
//if (!pSourceVoice) return;
|
||||
|
||||
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;
|
||||
m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER);
|
||||
SubmitBuffer(static_cast<BYTE*>(context));
|
||||
}
|
||||
|
||||
bool XAudio2::Start()
|
||||
{
|
||||
// XAudio2 init
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
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
|
||||
// XAUDIO2_DEFAULT_CHANNELS instead of 2 for expansion?
|
||||
if(FAILED(hr = pXAudio2->CreateMasteringVoice(&pMasteringVoice, 2, m_mixer->GetSampleRate())))
|
||||
{
|
||||
PanicAlertT("XAudio2 master voice creation failed: %#X", hr);
|
||||
safe_release(pXAudio2);
|
||||
CoUninitialize();
|
||||
// callback dosent seem to run on a speecific cpu anyways
|
||||
IXAudio2* xaudptr;
|
||||
if (FAILED(hr = XAudio2Create(&xaudptr, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||
{
|
||||
PanicAlertT("XAudio2 init failed: %#X", hr);
|
||||
Stop();
|
||||
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
|
||||
if (pMasteringVoice)
|
||||
pMasteringVoice->SetVolume(m_volume);
|
||||
m_mastering_voice->SetVolume(m_volume);
|
||||
|
||||
if (pXAudio2)
|
||||
pVoiceContext = new StreamingVoiceContext(pXAudio2, m_mixer, &soundSyncEvent);
|
||||
m_voice_context = std::unique_ptr<StreamingVoiceContext>
|
||||
(new StreamingVoiceContext(m_xaudio2.get(), m_mixer, m_sound_sync_event));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -157,24 +140,22 @@ void XAudio2::SetVolume(int volume)
|
|||
//linear 1- .01
|
||||
m_volume = (float)volume / 100.f;
|
||||
|
||||
if (pMasteringVoice)
|
||||
pMasteringVoice->SetVolume(m_volume);
|
||||
|
||||
if (m_mastering_voice)
|
||||
m_mastering_voice->SetVolume(m_volume);
|
||||
}
|
||||
|
||||
|
||||
//XAUDIO2_PERFORMANCE_DATA perfData;
|
||||
//int xi = 0;
|
||||
void XAudio2::Update()
|
||||
{
|
||||
//soundSyncEvent.Set();
|
||||
//m_sound_sync_event.Set();
|
||||
|
||||
//xi++;
|
||||
//if (xi == 100000) {
|
||||
//static int xi = 0;
|
||||
//if (100000 == ++xi)
|
||||
//{
|
||||
// xi = 0;
|
||||
// XAUDIO2_PERFORMANCE_DATA perfData;
|
||||
// pXAudio2->GetPerformanceData(&perfData);
|
||||
// NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i",perfData.CurrentLatencyInSamples);
|
||||
// NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i",perfData.GlitchesSinceEngineStarted);
|
||||
// NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples);
|
||||
// NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted);
|
||||
//}
|
||||
}
|
||||
|
||||
|
@ -182,26 +163,26 @@ void XAudio2::Clear(bool mute)
|
|||
{
|
||||
m_muted = mute;
|
||||
|
||||
if (pVoiceContext)
|
||||
if (m_voice_context)
|
||||
{
|
||||
if (m_muted)
|
||||
pVoiceContext->Stop();
|
||||
m_voice_context->Stop();
|
||||
else
|
||||
pVoiceContext->Play();
|
||||
m_voice_context->Play();
|
||||
}
|
||||
}
|
||||
|
||||
void XAudio2::Stop()
|
||||
{
|
||||
//soundSyncEvent.Set();
|
||||
//m_sound_sync_event.Set();
|
||||
|
||||
safe_delete(pVoiceContext);
|
||||
pVoiceContext = NULL;
|
||||
m_voice_context.reset();
|
||||
|
||||
if(pMasteringVoice)
|
||||
pMasteringVoice->DestroyVoice();
|
||||
if (m_mastering_voice)
|
||||
{
|
||||
m_mastering_voice->DestroyVoice();
|
||||
m_mastering_voice = nullptr;
|
||||
}
|
||||
|
||||
safe_release(pXAudio2);
|
||||
pMasteringVoice = NULL;
|
||||
CoUninitialize();
|
||||
m_xaudio2.reset(); // release interface
|
||||
}
|
||||
|
|
|
@ -23,59 +23,89 @@
|
|||
#ifdef _WIN32
|
||||
#include "Thread.h"
|
||||
#include <xaudio2.h>
|
||||
#include <memory>
|
||||
|
||||
const int NUM_BUFFERS = 3;
|
||||
const int SAMPLES_PER_BUFFER = 96;
|
||||
struct StreamingVoiceContext : public IXAudio2VoiceCallback
|
||||
{
|
||||
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;
|
||||
const int BUFFER_SIZE = SAMPLES_PER_BUFFER * NUM_CHANNELS;
|
||||
const int BUFFER_SIZE_BYTES = BUFFER_SIZE * sizeof(s16);
|
||||
void SubmitBuffer(PBYTE buf_data);
|
||||
|
||||
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
|
||||
#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
|
||||
|
||||
STDMETHOD_(void, OnBufferEnd) (void* context);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class XAudio2 : public SoundStream
|
||||
{
|
||||
#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;
|
||||
|
||||
const bool m_cleanup_com;
|
||||
|
||||
bool Init();
|
||||
public:
|
||||
XAudio2(CMixer *mixer)
|
||||
: SoundStream(mixer),
|
||||
pXAudio2(0),
|
||||
pMasteringVoice(0),
|
||||
pSourceVoice(0),
|
||||
m_volume(1.0f) {}
|
||||
: SoundStream(mixer)
|
||||
, m_mastering_voice(nullptr)
|
||||
, m_volume(1.0f)
|
||||
, m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
|
||||
{}
|
||||
|
||||
virtual ~XAudio2() {}
|
||||
virtual ~XAudio2()
|
||||
{
|
||||
Stop();
|
||||
if (m_cleanup_com)
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
virtual bool Start();
|
||||
virtual void SetVolume(int volume);
|
||||
virtual void Stop();
|
||||
virtual void Stop();
|
||||
|
||||
virtual void Update();
|
||||
virtual void Clear(bool mute);
|
||||
static bool isValid() { return true; }
|
||||
virtual bool usesMixer() const { return true; }
|
||||
virtual void Update();
|
||||
virtual void SetVolume(int volume);
|
||||
virtual bool usesMixer() const { return true; }
|
||||
|
||||
static bool isValid() { return true; }
|
||||
|
||||
#else
|
||||
|
||||
public:
|
||||
XAudio2(CMixer *mixer, void *hWnd = NULL)
|
||||
: SoundStream(mixer)
|
||||
|
|
|
@ -103,12 +103,12 @@ public:
|
|||
: m_count(count), m_waiting(0)
|
||||
{}
|
||||
|
||||
// block until "count" threads call Wait()
|
||||
bool Wait()
|
||||
// block until "count" threads call Sync()
|
||||
bool Sync()
|
||||
{
|
||||
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
|
||||
|
||||
if (m_count == ++m_waiting)
|
||||
|
|
|
@ -80,9 +80,7 @@ volatile u32 DrawnFrame = 0;
|
|||
u32 DrawnVideo = 0;
|
||||
|
||||
// Function forwarding
|
||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
|
||||
const char *Callback_ISOName(void);
|
||||
void Callback_DSPInterrupt();
|
||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
// Function declarations
|
||||
|
@ -97,13 +95,12 @@ void *g_pWindowHandle = NULL;
|
|||
std::string g_stateFileName;
|
||||
std::thread g_EmuThread;
|
||||
|
||||
static std::thread cpuThread;
|
||||
static std::thread g_cpu_thread;
|
||||
|
||||
SCoreStartupParameter g_CoreStartupParameter;
|
||||
|
||||
// This event is set when the emuthread starts.
|
||||
Common::Barrier emuThreadGoing(2);
|
||||
Common::Barrier cpuRunloopQuit(2);
|
||||
|
||||
std::string GetStateFileName() { return g_stateFileName; }
|
||||
void SetStateFileName(std::string val) { g_stateFileName = val; }
|
||||
|
@ -124,19 +121,6 @@ bool PanicAlertToVideo(const char* text, bool yes_no)
|
|||
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)
|
||||
{
|
||||
SCoreStartupParameter& _CoreParameter =
|
||||
|
@ -160,24 +144,19 @@ void *GetWindowHandle()
|
|||
return g_pWindowHandle;
|
||||
}
|
||||
|
||||
bool GetRealWiimote()
|
||||
{
|
||||
return g_bRealWiimote;
|
||||
}
|
||||
|
||||
bool isRunning()
|
||||
bool IsRunning()
|
||||
{
|
||||
return (GetState() != CORE_UNINITIALIZED) || g_bHwInit;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
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
|
||||
|
@ -200,7 +179,6 @@ bool Init()
|
|||
INFO_LOG(OSREPORT, "CPU Thread separate = %s",
|
||||
g_CoreStartupParameter.bCPUThread ? "Yes" : "No");
|
||||
|
||||
Host_SetWaitCursor(true);
|
||||
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
|
||||
|
||||
g_aspect_wide = _CoreParameter.bWii;
|
||||
|
@ -219,7 +197,6 @@ bool Init()
|
|||
g_pWindowHandle = Host_GetRenderHandle();
|
||||
if (!g_video_backend->Initialize(g_pWindowHandle))
|
||||
{
|
||||
Host_SetWaitCursor(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -229,7 +206,6 @@ bool Init()
|
|||
{
|
||||
HW::Shutdown();
|
||||
g_video_backend->Shutdown();
|
||||
Host_SetWaitCursor(false);
|
||||
return false;
|
||||
}
|
||||
Pad::Initialize(g_pWindowHandle);
|
||||
|
@ -252,9 +228,7 @@ bool Init()
|
|||
g_EmuThread = std::thread(EmuThread);
|
||||
|
||||
// Wait until the emu thread is running
|
||||
emuThreadGoing.Wait();
|
||||
|
||||
Host_SetWaitCursor(false);
|
||||
emuThreadGoing.Sync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -262,17 +236,18 @@ bool Init()
|
|||
// Called from GUI thread
|
||||
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)
|
||||
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
|
||||
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stop CPU").c_str());
|
||||
PowerPC::Stop();
|
||||
|
@ -284,30 +259,23 @@ void Stop() // - Hammertime!
|
|||
// Video_EnterLoop() should now exit so that EmuThread()
|
||||
// will continue concurrently with the rest of the commands
|
||||
// in this function. We no longer rely on Postmessage.
|
||||
INFO_LOG(CONSOLE, "%s", StopMessage(true,
|
||||
"Wait for Video Loop to exit ...").c_str());
|
||||
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
|
||||
|
||||
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
|
||||
g_video_backend->Video_ClearMessages();
|
||||
|
||||
// Close the trace file
|
||||
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
|
||||
// emulation, but stops the DSP Interpreter when using LLE emulation.
|
||||
DSP::GetDSPEmulator()->DSP_StopSoundStream();
|
||||
|
@ -326,6 +294,8 @@ void Stop() // - Hammertime!
|
|||
SConfig::GetInstance().m_SYSCONF->Reload();
|
||||
|
||||
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.
|
||||
|
@ -356,8 +326,6 @@ void CpuThread()
|
|||
// Enter CPU run loop. When we leave it - we are done.
|
||||
CCPU::Run();
|
||||
|
||||
cpuRunloopQuit.Wait();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -369,7 +337,7 @@ void EmuThread()
|
|||
const SCoreStartupParameter& _CoreParameter =
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
Common::SetCurrentThreadName("Emuthread - starting");
|
||||
Common::SetCurrentThreadName("Emuthread - Starting");
|
||||
|
||||
if (_CoreParameter.bLockThreads)
|
||||
{
|
||||
|
@ -379,8 +347,6 @@ void EmuThread()
|
|||
Common::SetCurrentThreadAffinity(2);
|
||||
}
|
||||
|
||||
emuThreadGoing.Wait();
|
||||
|
||||
DisplayMessage(cpu_info.brand_string, 8000);
|
||||
DisplayMessage(cpu_info.Summarize(), 8000);
|
||||
DisplayMessage(_CoreParameter.m_strFilename, 3000);
|
||||
|
@ -396,23 +362,29 @@ void EmuThread()
|
|||
else
|
||||
PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
|
||||
|
||||
// Spawn the CPU thread
|
||||
_dbg_assert_(OSHLE, !cpuThread.joinable());
|
||||
// Update the window again because all stuff is initialized
|
||||
Host_UpdateDisasmDialog();
|
||||
Host_UpdateMainFrame();
|
||||
|
||||
emuThreadGoing.Sync();
|
||||
|
||||
// ENTER THE VIDEO THREAD LOOP
|
||||
if (_CoreParameter.bCPUThread)
|
||||
{
|
||||
g_video_backend->Video_Prepare();
|
||||
|
||||
// This thread, after creating the EmuWindow, spawns a CPU
|
||||
// thread, and then takes over and becomes the video thread
|
||||
cpuThread = std::thread(CpuThread);
|
||||
Common::SetCurrentThreadName("Video thread");
|
||||
|
||||
// Update the window again because all stuff is initialized
|
||||
Host_UpdateDisasmDialog();
|
||||
Host_UpdateMainFrame();
|
||||
g_video_backend->Video_Prepare();
|
||||
|
||||
// Spawn the CPU thread
|
||||
g_cpu_thread = std::thread(CpuThread);
|
||||
|
||||
// become the GPU thread
|
||||
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
|
||||
{
|
||||
|
@ -421,44 +393,27 @@ void EmuThread()
|
|||
// waiting for the program to terminate. Without this extra
|
||||
// thread, the video backend window hangs in single core mode
|
||||
// because noone is pumping messages.
|
||||
|
||||
cpuThread = std::thread(CpuThread);
|
||||
Common::SetCurrentThreadName("Emuthread - Idle");
|
||||
|
||||
// Update the window again because all stuff is initialized
|
||||
Host_UpdateDisasmDialog();
|
||||
Host_UpdateMainFrame();
|
||||
// Spawn the CPU+GPU thread
|
||||
g_cpu_thread = std::thread(CpuThread);
|
||||
|
||||
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||
{
|
||||
g_video_backend->PeekMessages();
|
||||
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
|
||||
INFO_LOG(CONSOLE, "%s",
|
||||
StopMessage(false, "Stop() and Video Loop Ended").c_str());
|
||||
// Wait for g_cpu_thread to exit
|
||||
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping CPU-GPU thread ...").c_str());
|
||||
|
||||
// At this point, the CpuThread has already returned in SC mode.
|
||||
// But it may still be waiting in Dual Core mode.
|
||||
if (cpuThread.joinable())
|
||||
{
|
||||
// There is a CPU thread - join it.
|
||||
cpuThread.join();
|
||||
}
|
||||
g_cpu_thread.join();
|
||||
|
||||
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
|
||||
|
||||
VolumeHandler::EjectVolume();
|
||||
FileMon::Close();
|
||||
|
||||
g_bStopping = false;
|
||||
}
|
||||
|
||||
// Set or get the running state
|
||||
|
@ -496,41 +451,37 @@ EState GetState()
|
|||
return CORE_UNINITIALIZED;
|
||||
}
|
||||
|
||||
static inline std::string GenerateScreenshotName()
|
||||
static std::string GenerateScreenshotName()
|
||||
{
|
||||
int index = 1;
|
||||
std::string tempname, name;
|
||||
std::string gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID();
|
||||
tempname = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
|
||||
const std::string& gameId = SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID();
|
||||
std::string path = File::GetUserPath(D_SCREENSHOTS_IDX) + gameId + DIR_SEP_CHR;
|
||||
|
||||
if (!File::CreateFullPath(tempname))
|
||||
if (!File::CreateFullPath(path))
|
||||
{
|
||||
//fallback to old-style screenshots, without folder.
|
||||
tempname = File::GetUserPath(D_SCREENSHOTS_IDX);
|
||||
// fallback to old-style screenshots, without folder.
|
||||
path = File::GetUserPath(D_SCREENSHOTS_IDX);
|
||||
}
|
||||
//append gameId, tempname only contains the folder here.
|
||||
tempname += gameId;
|
||||
|
||||
do
|
||||
name = StringFromFormat("%s-%d.png", tempname.c_str(), index++);
|
||||
while (File::Exists(name));
|
||||
//append gameId, path only contains the folder here.
|
||||
path += gameId;
|
||||
|
||||
std::string name;
|
||||
for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i)
|
||||
{}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
void ScreenShot(const std::string& name)
|
||||
void SaveScreenShot()
|
||||
{
|
||||
bool bPaused = (GetState() == CORE_PAUSE);
|
||||
const bool bPaused = (GetState() == CORE_PAUSE);
|
||||
|
||||
SetState(CORE_PAUSE);
|
||||
g_video_backend->Video_Screenshot(name.c_str());
|
||||
if(!bPaused)
|
||||
SetState(CORE_RUN);
|
||||
}
|
||||
|
||||
void ScreenShot()
|
||||
{
|
||||
ScreenShot(GenerateScreenshotName());
|
||||
g_video_backend->Video_Screenshot(GenerateScreenshotName().c_str());
|
||||
|
||||
if (!bPaused)
|
||||
SetState(CORE_RUN);
|
||||
}
|
||||
|
||||
// Apply Frame Limit and Display FPS info
|
||||
|
@ -630,25 +581,19 @@ void VideoThrottle()
|
|||
// Executed from GPU thread
|
||||
// reports if a frame should be skipped or not
|
||||
// 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;
|
||||
u32 frames = Common::AtomicLoad(DrawnFrame);
|
||||
bool fps_slow = (Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS) ? false : true;
|
||||
const u32 frames = Common::AtomicLoad(DrawnFrame);
|
||||
const bool fps_slow = !(Timer.GetTimeDifference() < (frames + skipped) * 1000 / TargetFPS);
|
||||
|
||||
return fps_slow;
|
||||
}
|
||||
|
||||
// --- 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
|
||||
void Callback_VideoCopiedToXFB(bool video_update)
|
||||
{
|
||||
|
@ -657,36 +602,6 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
|||
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
|
||||
//
|
||||
const char *Callback_ISOName()
|
||||
|
@ -699,11 +614,4 @@ const char *Callback_ISOName()
|
|||
return "";
|
||||
}
|
||||
|
||||
// Called from ANY thread!
|
||||
// Pass the message on to the host
|
||||
void Callback_CoreMessage(int Id)
|
||||
{
|
||||
Host_Message(Id);
|
||||
}
|
||||
|
||||
} // Core
|
||||
|
|
|
@ -34,76 +34,73 @@
|
|||
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_VideoGetWindowSize(int& x, int& y, int& width, int& height);
|
||||
void Callback_VideoRequestWindowSize(int& width, int& height);
|
||||
void Callback_CoreMessage(int Id);
|
||||
|
||||
enum EState
|
||||
{
|
||||
CORE_UNINITIALIZED,
|
||||
CORE_PAUSE,
|
||||
CORE_RUN,
|
||||
CORE_STOPPING
|
||||
};
|
||||
enum EState
|
||||
{
|
||||
CORE_UNINITIALIZED,
|
||||
CORE_PAUSE,
|
||||
CORE_RUN,
|
||||
CORE_STOPPING
|
||||
};
|
||||
|
||||
// Init core
|
||||
bool Init();
|
||||
void Stop();
|
||||
bool Init();
|
||||
void Stop();
|
||||
|
||||
std::string StopMessage(bool, std::string);
|
||||
std::string StopMessage(bool, std::string);
|
||||
|
||||
bool isRunning();
|
||||
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 IsRunning();
|
||||
bool IsRunningInCurrentThread(); // this tells us whether we are running in the cpu thread.
|
||||
bool IsCPUThread(); // this tells us whether we are the cpu thread.
|
||||
|
||||
void SetState(EState _State);
|
||||
EState GetState();
|
||||
void SetState(EState _State);
|
||||
EState GetState();
|
||||
|
||||
void ScreenShot(const std::string& name);
|
||||
void ScreenShot();
|
||||
void SaveScreenShot();
|
||||
|
||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
void* GetWindowHandle();
|
||||
|
||||
// Get core parameters kill use SConfig instead
|
||||
extern SCoreStartupParameter g_CoreStartupParameter;
|
||||
void StartTrace(bool write);
|
||||
|
||||
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();
|
||||
|
||||
bool GetRealWiimote();
|
||||
|
||||
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.
|
||||
inline void DisplayMessage(const std::string &message, int time_in_ms)
|
||||
{
|
||||
DisplayMessage(message.c_str(), time_in_ms);
|
||||
}
|
||||
|
||||
std::string GetStateFileName();
|
||||
void SetStateFileName(std::string val);
|
||||
std::string GetStateFileName();
|
||||
void SetStateFileName(std::string val);
|
||||
|
||||
int SyncTrace();
|
||||
void SetBlockStart(u32 addr);
|
||||
void StopTrace();
|
||||
int SyncTrace();
|
||||
void SetBlockStart(u32 addr);
|
||||
void StopTrace();
|
||||
|
||||
bool report_slow(int skipped);
|
||||
void VideoThrottle();
|
||||
bool ShouldSkipFrame(int skipped);
|
||||
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
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,16 +101,14 @@ void STACKALIGN CheckGatherPipe()
|
|||
void Write8(const u8 _iValue, const u32 _iAddress)
|
||||
{
|
||||
// LOG(GPFIFO, "GPFIFO #%x: 0x%02x",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue);
|
||||
m_gatherPipe[m_gatherPipeCount] = _iValue;
|
||||
m_gatherPipeCount++;
|
||||
FastWrite8(_iValue);
|
||||
CheckGatherPipe();
|
||||
}
|
||||
|
||||
void Write16(const u16 _iValue, const u32 _iAddress)
|
||||
{
|
||||
// LOG(GPFIFO, "GPFIFO #%x: 0x%04x",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue);
|
||||
*(u16*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap16(_iValue);
|
||||
m_gatherPipeCount += 2;
|
||||
FastWrite16(_iValue);
|
||||
CheckGatherPipe();
|
||||
}
|
||||
|
||||
|
@ -120,22 +118,20 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
|||
// float floatvalue = *(float*)&_iValue;
|
||||
// LOG(GPFIFO, "GPFIFO #%x: 0x%08x / %f",ProcessorInterface::Fifo_CPUWritePointer+m_gatherPipeCount, _iValue, floatvalue);
|
||||
//#endif
|
||||
*(u32*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap32(_iValue);
|
||||
m_gatherPipeCount += 4;
|
||||
FastWrite32(_iValue);
|
||||
CheckGatherPipe();
|
||||
}
|
||||
|
||||
void Write64(const u64 _iValue, const u32 _iAddress)
|
||||
{
|
||||
*(u64*)(&m_gatherPipe[m_gatherPipeCount]) = Common::swap64(_iValue);
|
||||
m_gatherPipeCount += 8;
|
||||
FastWrite64(_iValue);
|
||||
CheckGatherPipe();
|
||||
}
|
||||
|
||||
void FastWrite8(const u8 _iValue)
|
||||
{
|
||||
m_gatherPipe[m_gatherPipeCount] = _iValue;
|
||||
m_gatherPipeCount++;
|
||||
++m_gatherPipeCount;
|
||||
}
|
||||
|
||||
void FastWrite16(const u16 _iValue)
|
||||
|
|
|
@ -347,7 +347,7 @@ static const MemoryView views[] =
|
|||
};
|
||||
static const int num_views = sizeof(views) / sizeof(MemoryView);
|
||||
|
||||
bool Init()
|
||||
void Init()
|
||||
{
|
||||
bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii;
|
||||
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)",
|
||||
m_pRAM, m_pPhysicalRAM, m_pVirtualCachedRAM, m_pVirtualUncachedRAM);
|
||||
m_IsInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
|
@ -379,7 +378,7 @@ void DoState(PointerWrap &p)
|
|||
p.DoArray(m_pEXRAM, EXRAM_SIZE);
|
||||
}
|
||||
|
||||
bool Shutdown()
|
||||
void Shutdown()
|
||||
{
|
||||
m_IsInitialized = false;
|
||||
u32 flags = 0;
|
||||
|
@ -389,7 +388,6 @@ bool Shutdown()
|
|||
g_arena.ReleaseSpace();
|
||||
base = NULL;
|
||||
INFO_LOG(MEMMAP, "Memory system shut down.");
|
||||
return true;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
|
|
|
@ -83,8 +83,8 @@ enum
|
|||
|
||||
// Init and Shutdown
|
||||
bool IsInitialized();
|
||||
bool Init();
|
||||
bool Shutdown();
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
void Clear();
|
||||
|
|
|
@ -45,7 +45,6 @@ void Host_NotifyMapLoaded();
|
|||
void Host_RefreshDSPDebuggerWindow();
|
||||
void Host_RequestRenderWindowSize(int width, int height);
|
||||
void Host_SetStartupDebuggingParameters();
|
||||
void Host_SetWaitCursor(bool enable);
|
||||
void Host_SetWiiMoteConnectionState(int _State);
|
||||
void Host_ShowJitResults(unsigned int address);
|
||||
void Host_SysMessage(const char *fmt, ...);
|
||||
|
|
|
@ -139,7 +139,7 @@ void FrameSkipping()
|
|||
std::lock_guard<std::mutex> lk(cs_frameSkip);
|
||||
|
||||
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_video_backend->Video_SetRendering(!g_frameSkipCounter);
|
||||
|
@ -200,7 +200,7 @@ bool BeginRecordingInput(int controllers)
|
|||
if(File::Exists(g_recordFile))
|
||||
File::Delete(g_recordFile);
|
||||
|
||||
if (Core::isRunning())
|
||||
if (Core::IsRunning())
|
||||
{
|
||||
const std::string stateFilename = g_recordFile + ".sav";
|
||||
if(File::Exists(stateFilename))
|
||||
|
|
|
@ -151,35 +151,31 @@ CPanel::CPanel(
|
|||
case WIIMOTE_DISCONNECT:
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
||||
{
|
||||
if (main_frame->bNoWiimoteMsg)
|
||||
main_frame->bNoWiimoteMsg = false;
|
||||
const int wiimote_idx = lParam;
|
||||
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
|
||||
{
|
||||
int wiimote_idx = lParam;
|
||||
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])
|
||||
{
|
||||
// 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)
|
||||
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)
|
||||
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
|
||||
|
||||
dlg->Destroy();
|
||||
}
|
||||
dlg->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +337,6 @@ CFrame::CFrame(wxFrame* parent,
|
|||
long style)
|
||||
: CRenderFrame(parent, id, title, pos, size, style)
|
||||
, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
|
||||
, bRenderToMain(false), bNoWiimoteMsg(false)
|
||||
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
|
||||
, m_GameListCtrl(NULL), m_Panel(NULL)
|
||||
, m_RenderFrame(NULL), m_RenderParent(NULL)
|
||||
|
@ -602,22 +597,10 @@ void CFrame::OnResize(wxSizeEvent& event)
|
|||
#ifdef _WIN32
|
||||
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
switch (nMsg)
|
||||
{
|
||||
case WM_SYSCOMMAND:
|
||||
switch (wParam & 0xFFF0)
|
||||
{
|
||||
case SC_SCREENSAVE:
|
||||
case SC_MONITORPOWER:
|
||||
break;
|
||||
default:
|
||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (WM_SYSCOMMAND == nMsg && (SC_SCREENSAVE == wParam || SC_MONITORPOWER == wParam))
|
||||
return 0;
|
||||
else
|
||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -887,7 +870,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||
DoStop();
|
||||
// Screenshot hotkey
|
||||
else if (IsHotkey(event, HK_SCREENSHOT))
|
||||
Core::ScreenShot();
|
||||
Core::SaveScreenShot();
|
||||
// Wiimote connect and disconnect hotkeys
|
||||
else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
|
||||
WiimoteId = 0;
|
||||
|
|
|
@ -88,265 +88,265 @@ class CRenderFrame : public wxFrame
|
|||
|
||||
class CFrame : public CRenderFrame
|
||||
{
|
||||
public:
|
||||
CFrame(wxFrame* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = wxT("Dolphin"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
bool _UseDebugger = false,
|
||||
bool _BatchMode = false,
|
||||
bool ShowLogWindow = false,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
public:
|
||||
CFrame(wxFrame* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = wxT("Dolphin"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
bool _UseDebugger = false,
|
||||
bool _BatchMode = false,
|
||||
bool ShowLogWindow = false,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
|
||||
virtual ~CFrame();
|
||||
virtual ~CFrame();
|
||||
|
||||
void* GetRenderHandle()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (void *)m_RenderParent->GetHandle();
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
|
||||
#else
|
||||
return m_RenderParent;
|
||||
#endif
|
||||
}
|
||||
void* GetRenderHandle()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (void *)m_RenderParent->GetHandle();
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
|
||||
#else
|
||||
return m_RenderParent;
|
||||
#endif
|
||||
}
|
||||
|
||||
// These have to be public
|
||||
CCodeWindow* g_pCodeWindow;
|
||||
NetPlaySetupDiag* g_NetPlaySetupDiag;
|
||||
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);
|
||||
// These have to be public
|
||||
CCodeWindow* g_pCodeWindow;
|
||||
NetPlaySetupDiag* g_NetPlaySetupDiag;
|
||||
wxCheatsWindow* g_CheatsWindow;
|
||||
|
||||
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;
|
||||
#endif
|
||||
const CGameListCtrl *GetGameListCtrl() const;
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
X11Utils::XRRConfiguration *m_XRRConfig;
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
Common::Event panic_event;
|
||||
bool bPanicResult;
|
||||
std::mutex keystate_lock;
|
||||
#endif
|
||||
|
||||
// AUI
|
||||
wxAuiManager *m_Mgr;
|
||||
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
||||
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
X11Utils::XRRConfiguration *m_XRRConfig;
|
||||
#endif
|
||||
|
||||
// Perspectives (Should find a way to make all of this private)
|
||||
void DoAddPage(wxWindow *Win, int i, bool Float);
|
||||
void DoRemovePage(wxWindow *, bool bHide = true);
|
||||
struct SPerspectives
|
||||
{
|
||||
std::string Name;
|
||||
wxString Perspective;
|
||||
std::vector<int> Width, Height;
|
||||
};
|
||||
std::vector<SPerspectives> Perspectives;
|
||||
u32 ActivePerspective;
|
||||
// AUI
|
||||
wxAuiManager *m_Mgr;
|
||||
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
||||
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
||||
|
||||
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;
|
||||
// Perspectives (Should find a way to make all of this private)
|
||||
void DoAddPage(wxWindow *Win, int i, bool Float);
|
||||
void DoRemovePage(wxWindow *, bool bHide = true);
|
||||
struct SPerspectives
|
||||
{
|
||||
std::string Name;
|
||||
wxString Perspective;
|
||||
std::vector<int> Width, Height;
|
||||
};
|
||||
std::vector<SPerspectives> Perspectives;
|
||||
u32 ActivePerspective;
|
||||
|
||||
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
|
||||
{
|
||||
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
|
||||
};
|
||||
std::vector<std::string> drives;
|
||||
|
||||
enum EBitmapsThemes
|
||||
{
|
||||
BOOMY,
|
||||
VISTA,
|
||||
XPLASTIK,
|
||||
KDE,
|
||||
THEMES_MAX
|
||||
};
|
||||
enum EToolbar
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
wxBitmap m_Bitmaps[EToolbar_Max];
|
||||
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
||||
enum EBitmapsThemes
|
||||
{
|
||||
BOOMY,
|
||||
VISTA,
|
||||
XPLASTIK,
|
||||
KDE,
|
||||
THEMES_MAX
|
||||
};
|
||||
|
||||
void PopulateToolbar(wxAuiToolBar* toolBar);
|
||||
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
||||
void RecreateToolbar();
|
||||
void CreateMenu();
|
||||
wxBitmap m_Bitmaps[EToolbar_Max];
|
||||
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
||||
|
||||
// Utility
|
||||
wxString GetMenuLabel(int Id);
|
||||
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
||||
wxAuiNotebook * GetNotebookFromId(u32 NBId);
|
||||
int GetNotebookCount();
|
||||
wxAuiNotebook *CreateEmptyNotebook();
|
||||
void PopulateToolbar(wxAuiToolBar* toolBar);
|
||||
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
||||
void RecreateToolbar();
|
||||
void CreateMenu();
|
||||
|
||||
// Perspectives
|
||||
void AddRemoveBlankPage();
|
||||
void OnNotebookPageClose(wxAuiNotebookEvent& event);
|
||||
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
|
||||
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
|
||||
void OnFloatWindow(wxCommandEvent& event);
|
||||
void ToggleFloatWindow(int Id);
|
||||
void OnTab(wxAuiNotebookEvent& event);
|
||||
int GetNotebookAffiliation(wxWindowID Id);
|
||||
void ClosePages();
|
||||
void CloseAllNotebooks();
|
||||
void TogglePane();
|
||||
void SetPaneSize();
|
||||
void ResetToolbarStyle();
|
||||
void TogglePaneStyle(bool On, int EventId);
|
||||
void ToggleNotebookStyle(bool On, long Style);
|
||||
void ResizeConsole();
|
||||
// Float window
|
||||
void DoUnfloatPage(int Id);
|
||||
void OnFloatingPageClosed(wxCloseEvent& event);
|
||||
void OnFloatingPageSize(wxSizeEvent& event);
|
||||
void DoFloatNotebookPage(wxWindowID Id);
|
||||
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
|
||||
const wxString& title = wxT(""),
|
||||
wxWindow * = NULL);
|
||||
wxString AuiFullscreen, AuiCurrent;
|
||||
void AddPane();
|
||||
void UpdateCurrentPerspective();
|
||||
void SaveIniPerspectives();
|
||||
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);
|
||||
// Utility
|
||||
wxString GetMenuLabel(int Id);
|
||||
wxWindow * GetNotebookPageFromId(wxWindowID Id);
|
||||
wxAuiNotebook * GetNotebookFromId(u32 NBId);
|
||||
int GetNotebookCount();
|
||||
wxAuiNotebook *CreateEmptyNotebook();
|
||||
|
||||
// Perspectives
|
||||
void AddRemoveBlankPage();
|
||||
void OnNotebookPageClose(wxAuiNotebookEvent& event);
|
||||
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
|
||||
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
|
||||
void OnFloatWindow(wxCommandEvent& event);
|
||||
void ToggleFloatWindow(int Id);
|
||||
void OnTab(wxAuiNotebookEvent& event);
|
||||
int GetNotebookAffiliation(wxWindowID Id);
|
||||
void ClosePages();
|
||||
void CloseAllNotebooks();
|
||||
void TogglePane();
|
||||
void SetPaneSize();
|
||||
void ResetToolbarStyle();
|
||||
void TogglePaneStyle(bool On, int EventId);
|
||||
void ToggleNotebookStyle(bool On, long Style);
|
||||
void ResizeConsole();
|
||||
// Float window
|
||||
void DoUnfloatPage(int Id);
|
||||
void OnFloatingPageClosed(wxCloseEvent& event);
|
||||
void OnFloatingPageSize(wxSizeEvent& event);
|
||||
void DoFloatNotebookPage(wxWindowID Id);
|
||||
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
|
||||
const wxString& title = wxT(""),
|
||||
wxWindow * = NULL);
|
||||
wxString AuiFullscreen, AuiCurrent;
|
||||
void AddPane();
|
||||
void UpdateCurrentPerspective();
|
||||
void SaveIniPerspectives();
|
||||
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
|
||||
// Override window proc for tricks like screensaver disabling
|
||||
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
// Override window proc for tricks like screensaver disabling
|
||||
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif
|
||||
// Event functions
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnToolBar(wxCommandEvent& event);
|
||||
void OnAuiToolBar(wxAuiToolBarEvent& event);
|
||||
// Event functions
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnToolBar(wxCommandEvent& event);
|
||||
void OnAuiToolBar(wxAuiToolBarEvent& event);
|
||||
|
||||
void OnOpen(wxCommandEvent& event); // File menu
|
||||
void DoOpen(bool Boot);
|
||||
void OnRefresh(wxCommandEvent& event);
|
||||
void OnBrowse(wxCommandEvent& event);
|
||||
void OnBootDrive(wxCommandEvent& event);
|
||||
void OnOpen(wxCommandEvent& event); // File menu
|
||||
void DoOpen(bool Boot);
|
||||
void OnRefresh(wxCommandEvent& event);
|
||||
void OnBrowse(wxCommandEvent& event);
|
||||
void OnBootDrive(wxCommandEvent& event);
|
||||
|
||||
void OnPlay(wxCommandEvent& event); // Emulation
|
||||
void OnStop(wxCommandEvent& event);
|
||||
void OnReset(wxCommandEvent& event);
|
||||
void OnRecord(wxCommandEvent& event);
|
||||
void OnPlayRecording(wxCommandEvent& event);
|
||||
void OnRecordExport(wxCommandEvent& event);
|
||||
void OnRecordReadOnly(wxCommandEvent& event);
|
||||
void OnChangeDisc(wxCommandEvent& event);
|
||||
void OnScreenshot(wxCommandEvent& event);
|
||||
void OnActive(wxActivateEvent& event);
|
||||
void OnClose(wxCloseEvent &event);
|
||||
void OnLoadState(wxCommandEvent& event);
|
||||
void OnSaveState(wxCommandEvent& event);
|
||||
void OnLoadStateFromFile(wxCommandEvent& event);
|
||||
void OnSaveStateToFile(wxCommandEvent& event);
|
||||
void OnLoadLastState(wxCommandEvent& event);
|
||||
void OnUndoLoadState(wxCommandEvent& event);
|
||||
void OnUndoSaveState(wxCommandEvent& event);
|
||||
void OnPlay(wxCommandEvent& event); // Emulation
|
||||
void OnStop(wxCommandEvent& event);
|
||||
void OnReset(wxCommandEvent& event);
|
||||
void OnRecord(wxCommandEvent& event);
|
||||
void OnPlayRecording(wxCommandEvent& event);
|
||||
void OnRecordExport(wxCommandEvent& event);
|
||||
void OnRecordReadOnly(wxCommandEvent& event);
|
||||
void OnChangeDisc(wxCommandEvent& event);
|
||||
void OnScreenshot(wxCommandEvent& event);
|
||||
void OnActive(wxActivateEvent& event);
|
||||
void OnClose(wxCloseEvent &event);
|
||||
void OnLoadState(wxCommandEvent& event);
|
||||
void OnSaveState(wxCommandEvent& event);
|
||||
void OnLoadStateFromFile(wxCommandEvent& event);
|
||||
void OnSaveStateToFile(wxCommandEvent& event);
|
||||
void OnLoadLastState(wxCommandEvent& event);
|
||||
void OnUndoLoadState(wxCommandEvent& event);
|
||||
void OnUndoSaveState(wxCommandEvent& event);
|
||||
|
||||
void OnFrameSkip(wxCommandEvent& event);
|
||||
void OnFrameStep(wxCommandEvent& event);
|
||||
void OnFrameSkip(wxCommandEvent& event);
|
||||
void OnFrameStep(wxCommandEvent& event);
|
||||
|
||||
void OnConfigMain(wxCommandEvent& event); // Options
|
||||
void OnConfigGFX(wxCommandEvent& event);
|
||||
void OnConfigDSP(wxCommandEvent& event);
|
||||
void OnConfigPAD(wxCommandEvent& event);
|
||||
void OnConfigWiimote(wxCommandEvent& event);
|
||||
void OnConfigHotkey(wxCommandEvent& event);
|
||||
void OnConfigMain(wxCommandEvent& event); // Options
|
||||
void OnConfigGFX(wxCommandEvent& event);
|
||||
void OnConfigDSP(wxCommandEvent& event);
|
||||
void OnConfigPAD(wxCommandEvent& event);
|
||||
void OnConfigWiimote(wxCommandEvent& event);
|
||||
void OnConfigHotkey(wxCommandEvent& event);
|
||||
|
||||
void OnToggleFullscreen(wxCommandEvent& event);
|
||||
void OnToggleDualCore(wxCommandEvent& event);
|
||||
void OnToggleSkipIdle(wxCommandEvent& event);
|
||||
void OnToggleThrottle(wxCommandEvent& event);
|
||||
void OnManagerResize(wxAuiManagerEvent& event);
|
||||
void OnMove(wxMoveEvent& event);
|
||||
void OnResize(wxSizeEvent& event);
|
||||
void OnToggleToolbar(wxCommandEvent& event);
|
||||
void DoToggleToolbar(bool);
|
||||
void OnToggleStatusbar(wxCommandEvent& event);
|
||||
void OnToggleWindow(wxCommandEvent& event);
|
||||
void OnToggleFullscreen(wxCommandEvent& event);
|
||||
void OnToggleDualCore(wxCommandEvent& event);
|
||||
void OnToggleSkipIdle(wxCommandEvent& event);
|
||||
void OnToggleThrottle(wxCommandEvent& event);
|
||||
void OnManagerResize(wxAuiManagerEvent& event);
|
||||
void OnMove(wxMoveEvent& event);
|
||||
void OnResize(wxSizeEvent& event);
|
||||
void OnToggleToolbar(wxCommandEvent& event);
|
||||
void DoToggleToolbar(bool);
|
||||
void OnToggleStatusbar(wxCommandEvent& event);
|
||||
void OnToggleWindow(wxCommandEvent& event);
|
||||
|
||||
void OnKeyDown(wxKeyEvent& event); // Keyboard
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event); // Keyboard
|
||||
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 OnImportSave(wxCommandEvent& event);
|
||||
void OnMemcard(wxCommandEvent& event); // Misc
|
||||
void OnImportSave(wxCommandEvent& event);
|
||||
|
||||
void OnNetPlay(wxCommandEvent& event);
|
||||
void OnNetPlay(wxCommandEvent& event);
|
||||
|
||||
void OnShow_CheatsWindow(wxCommandEvent& event);
|
||||
void OnLoadWiiMenu(wxCommandEvent& event);
|
||||
void OnConnectWiimote(wxCommandEvent& event);
|
||||
void GameListChanged(wxCommandEvent& event);
|
||||
void OnShow_CheatsWindow(wxCommandEvent& event);
|
||||
void OnLoadWiiMenu(wxCommandEvent& event);
|
||||
void OnConnectWiimote(wxCommandEvent& event);
|
||||
void GameListChanged(wxCommandEvent& event);
|
||||
|
||||
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
||||
void OnRenderParentResize(wxSizeEvent& event);
|
||||
bool RendererIsFullscreen();
|
||||
void StartGame(const std::string& filename);
|
||||
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
||||
void OnRenderParentResize(wxSizeEvent& event);
|
||||
bool RendererIsFullscreen();
|
||||
void StartGame(const std::string& filename);
|
||||
|
||||
// Event table
|
||||
DECLARE_EVENT_TABLE();
|
||||
// Event table
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
int GetCmdForHotkey(unsigned int key);
|
||||
|
|
|
@ -922,6 +922,8 @@ void CFrame::StartGame(const std::string& filename)
|
|||
m_RenderFrame->Show();
|
||||
}
|
||||
|
||||
wxBeginBusyCursor();
|
||||
|
||||
if (!BootManager::BootCore(filename))
|
||||
{
|
||||
// Destroy the renderer frame when not rendering to main
|
||||
|
@ -971,6 +973,8 @@ void CFrame::StartGame(const std::string& filename)
|
|||
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
||||
(wxObject*)0, this);
|
||||
}
|
||||
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
|
||||
void CFrame::OnBootDrive(wxCommandEvent& event)
|
||||
|
@ -978,7 +982,6 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
|
|||
BootGame(drives[event.GetId()-IDM_DRIVE1]);
|
||||
}
|
||||
|
||||
|
||||
// Refresh the file list and browse for a favorites directory
|
||||
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
|
@ -994,7 +997,7 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
|||
// Create screenshot
|
||||
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Core::ScreenShot();
|
||||
Core::SaveScreenShot();
|
||||
}
|
||||
|
||||
// Pause the emulation
|
||||
|
@ -1048,7 +1051,9 @@ void CFrame::DoStop()
|
|||
if(Frame::IsPlayingInput() || Frame::IsRecordingInput())
|
||||
Frame::EndPlayInput(false);
|
||||
|
||||
wxBeginBusyCursor();
|
||||
BootManager::Stop();
|
||||
wxEndBusyCursor();
|
||||
|
||||
#if defined(HAVE_XDG_SCREENSAVER) && HAVE_XDG_SCREENSAVER
|
||||
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
|
||||
|
@ -1353,7 +1358,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
|
|||
|
||||
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);
|
||||
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
|
||||
|
@ -1461,7 +1466,7 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
|
|||
void CFrame::UpdateGUI()
|
||||
{
|
||||
// Save status
|
||||
bool Initialized = Core::isRunning();
|
||||
bool Initialized = Core::IsRunning();
|
||||
bool Running = Core::GetState() == Core::CORE_RUN;
|
||||
bool Paused = Core::GetState() == Core::CORE_PAUSE;
|
||||
|
||||
|
|
|
@ -51,10 +51,6 @@
|
|||
|
||||
IMPLEMENT_APP(DolphinApp)
|
||||
|
||||
BEGIN_EVENT_TABLE(DolphinApp, wxApp)
|
||||
EVT_TIMER(wxID_ANY, DolphinApp::AfterInit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
bool wxMsgAlert(const char*, const char*, bool, int);
|
||||
std::string wxStringTranslator(const char *);
|
||||
|
@ -325,12 +321,6 @@ bool DolphinApp::OnInit()
|
|||
SetTopWindow(main_frame);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -339,15 +329,12 @@ void DolphinApp::MacOpenFile(const wxString &fileName)
|
|||
FileToLoad = fileName;
|
||||
LoadFile = true;
|
||||
|
||||
if (m_afterinit == NULL)
|
||||
if (IsMainLoopRunning())
|
||||
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)
|
||||
main_frame->UpdateGameList();
|
||||
|
||||
|
@ -375,6 +362,8 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return wxApp::MainLoop();
|
||||
}
|
||||
|
||||
void DolphinApp::InitLanguageSupport()
|
||||
|
@ -582,7 +571,7 @@ void Host_UpdateBreakPointView()
|
|||
bool Host_GetKeyState(int keycode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return GetAsyncKeyState(keycode);
|
||||
return (0 != GetAsyncKeyState(keycode));
|
||||
#elif defined __WXGTK__
|
||||
std::unique_lock<std::recursive_mutex> lk(main_frame->keystate_lock, std::try_to_lock);
|
||||
if (!lk.owns_lock())
|
||||
|
@ -627,14 +616,6 @@ void Host_SetStartupDebuggingParameters()
|
|||
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)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||
|
|
|
@ -35,15 +35,12 @@ private:
|
|||
void InitLanguageSupport();
|
||||
void MacOpenFile(const wxString &fileName);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
wxTimer *m_afterinit;
|
||||
bool BatchMode;
|
||||
bool LoadFile;
|
||||
wxString FileToLoad;
|
||||
wxLocale *m_locale;
|
||||
|
||||
void AfterInit(wxTimerEvent& WXUNUSED(event));
|
||||
int MainLoop();
|
||||
};
|
||||
|
||||
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
|
||||
cur_profile = 0;
|
||||
if (Core::isRunning())
|
||||
if (Core::IsRunning())
|
||||
{
|
||||
// Search which ISO has been started
|
||||
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);
|
||||
_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
|
||||
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.
|
||||
// Otherwise only update it if we're editing the currently running game's profile
|
||||
if (!Core::isRunning())
|
||||
if (!Core::IsRunning())
|
||||
{
|
||||
g_Config = vconfig;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "RenderBase.h"
|
||||
#include "VideoBackendBase.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
|
||||
namespace EmuWindow
|
||||
{
|
||||
|
@ -190,7 +191,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
|||
if (m_hParent == NULL)
|
||||
{
|
||||
// Stop the game
|
||||
PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0);
|
||||
//PostMessage(m_hParent, WM_USER, WM_USER_STOP, 0);
|
||||
}
|
||||
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
|
||||
HWND Ret;
|
||||
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
|
||||
Ret = OpenWindow(hParent, hInstance, width, height, title);
|
||||
|
|
|
@ -213,7 +213,7 @@ bool FifoCommandRunnable()
|
|||
"* Some other sort of bug\n\n"
|
||||
"Dolphin will now likely crash or hang. Enjoy." , cmd_byte);
|
||||
Host_SysMessage(szTemp);
|
||||
Core::Callback_VideoLog(szTemp);
|
||||
INFO_LOG(VIDEO, "%s", szTemp);
|
||||
{
|
||||
SCPFifoStruct &fifo = CommandProcessor::fifo;
|
||||
|
||||
|
@ -238,7 +238,7 @@ bool FifoCommandRunnable()
|
|||
,fifo.bFF_Breakpoint ? "true" : "false");
|
||||
|
||||
Host_SysMessage(szTmp);
|
||||
Core::Callback_VideoLog(szTmp);
|
||||
INFO_LOG(VIDEO, "%s", szTmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "Fifo.h"
|
||||
#include "Timer.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include <cmath>
|
||||
#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()
|
||||
{
|
||||
g_renderer->UpdateViewport();
|
||||
|
|
|
@ -84,6 +84,8 @@ public:
|
|||
static float GetXFBScaleX() { return xScale; }
|
||||
static float GetXFBScaleY() { return yScale; }
|
||||
|
||||
static void SetWindowSize(int width, int height);
|
||||
|
||||
// EFB coordinate conversion functions
|
||||
|
||||
// Use this to convert a whole native EFB rect to backbuffer coordinates
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "Core.h"
|
||||
#include "OnFrame.h"
|
||||
#include "Television.h"
|
||||
#include "Host.h"
|
||||
|
||||
namespace DX11
|
||||
{
|
||||
|
@ -321,7 +322,7 @@ Renderer::Renderer()
|
|||
int x, y, w_temp, h_temp;
|
||||
s_blendMode = 0;
|
||||
|
||||
Core::Callback_VideoGetWindowSize(x, y, w_temp, h_temp);
|
||||
Host_GetRenderWindowSize(x, y, w_temp, h_temp);
|
||||
|
||||
D3D::Create(EmuWindow::GetWnd());
|
||||
|
||||
|
@ -445,19 +446,6 @@ bool Renderer::CheckForResize()
|
|||
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()
|
||||
{
|
||||
TargetRectangle rc;
|
||||
|
|
|
@ -51,7 +51,6 @@ public:
|
|||
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
||||
|
||||
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 SetPSConstant4fv(unsigned int const_number, const float *f);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "VertexLoaderManager.h"
|
||||
#include "VertexShaderManager.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "Debugger/DebuggerPanel.h"
|
||||
#include "DLCache.h"
|
||||
|
@ -204,7 +205,7 @@ void VideoBackend::Video_Prepare()
|
|||
DLCache::Init();
|
||||
|
||||
// Tell the host that the window is ready
|
||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "Thread.h"
|
||||
#include "Timer.h"
|
||||
#include "Statistics.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "VideoConfig.h"
|
||||
#include "main.h"
|
||||
|
@ -258,7 +259,7 @@ Renderer::Renderer()
|
|||
// Multisample Anti-aliasing hasn't been implemented yet use supersamling instead
|
||||
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++)
|
||||
{
|
||||
|
@ -425,19 +426,6 @@ bool Renderer::CheckForResize()
|
|||
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()
|
||||
{
|
||||
TargetRectangle rc;
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc);
|
||||
|
||||
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 SetPSConstant4fv(unsigned int const_number, const float *f);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "DLCache.h"
|
||||
#include "IniFile.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "VideoBackend.h"
|
||||
|
@ -185,7 +186,7 @@ void VideoBackend::Video_Prepare()
|
|||
DLCache::Init();
|
||||
|
||||
// Notify the core that the video backend is ready
|
||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
|
|
|
@ -296,7 +296,7 @@ void XEventThread()
|
|||
case ClientMessage:
|
||||
if ((unsigned long) event.xclient.data.l[0] ==
|
||||
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] ==
|
||||
XInternAtom(GLWin.evdpy, "RESIZE", False))
|
||||
XMoveResizeWindow(GLWin.evdpy, GLWin.win,
|
||||
|
@ -317,7 +317,7 @@ void XEventThread()
|
|||
bool OpenGL_Create(void *&window_handle)
|
||||
{
|
||||
int _tx, _ty, _twidth, _theight;
|
||||
Core::Callback_VideoGetWindowSize(_tx, _ty, _twidth, _theight);
|
||||
Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight);
|
||||
|
||||
// Control window size and picture scaling
|
||||
s_backbuffer_width = _twidth;
|
||||
|
@ -519,7 +519,7 @@ bool OpenGL_MakeCurrent()
|
|||
return wglMakeCurrent(hDC, hRC) ? true : false;
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
#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);
|
||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y,
|
||||
GLWin.width, GLWin.height);
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "Debugger.h"
|
||||
#include "Core.h"
|
||||
#include "OnFrame.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "main.h" // Local
|
||||
#ifdef _WIN32
|
||||
|
@ -1613,17 +1614,4 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
|
|||
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);
|
||||
|
||||
void SetWindowSize(int width, int height);
|
||||
|
||||
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4);
|
||||
void SetPSConstant4fv(unsigned int const_number, 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 "FramebufferManager.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "VideoState.h"
|
||||
#include "VideoBackend.h"
|
||||
|
@ -211,7 +212,7 @@ void VideoBackend::Video_Prepare()
|
|||
DLCache::Init();
|
||||
|
||||
// Notify the core that the video backend is ready
|
||||
Core::Callback_CoreMessage(WM_USER_CREATE);
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
|
|
|
@ -69,7 +69,7 @@ bool VideoBackend::Initialize(void *&window_handle)
|
|||
|
||||
if (!OpenGL_Create(window_handle))
|
||||
{
|
||||
Core::Callback_VideoLog("SWRenderer::Create failed\n");
|
||||
INFO_LOG(VIDEO, "%s", "SWRenderer::Create failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue