Vista: Fixed a couple of issues that came up while testing on windows vista

This commit is contained in:
Souryo 2016-01-16 12:29:17 -05:00
parent 291931a1b0
commit e4fa287e66
5 changed files with 23 additions and 13 deletions

View file

@ -7,4 +7,5 @@ class IRenderingDevice
public:
virtual void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height) = 0;
virtual void Render() = 0;
virtual void Reset() = 0;
};

View file

@ -133,14 +133,15 @@ void VideoDecoder::UpdateFrame(void *ppuOutputBuffer, HdPpuPixelInfo *hdPixelInf
void VideoDecoder::StartThread()
{
if(!Instance->_decodeThread) {
if(!_decodeThread) {
_stopFlag = false;
_frameChanged = false;
_frameCount = 0;
_waitForFrame.Reset();
_waitForRender.Reset();
Instance->_decodeThread.reset(new thread(&VideoDecoder::DecodeThread, Instance.get()));
Instance->_renderThread.reset(new thread(&VideoDecoder::RenderThread, Instance.get()));
_decodeThread.reset(new thread(&VideoDecoder::DecodeThread, this));
_renderThread.reset(new thread(&VideoDecoder::RenderThread, this));
}
}
@ -168,6 +169,7 @@ void VideoDecoder::StopThread()
void VideoDecoder::RenderThread()
{
_renderer->Reset();
while(!_stopFlag.load()) {
//Wait until a frame is ready, or until 16ms have passed (to allow UI to run at a minimum of 60fps)
_waitForRender.Wait(16);

View file

@ -34,7 +34,8 @@ namespace Mesen.GUI.Config
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\.nes", null, "Mesen");
} else {
//Unregister Mesen if Mesen was registered for .nes files
if(Registry.GetValue(@"HKEY_CURRENT_USER\Software\Classes\.nes", null, "").Equals("Mesen")) {
object regKey = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Classes\.nes", null, "");
if(regKey != null && regKey.Equals("Mesen")) {
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\.nes", null, "");
}
}

View file

@ -45,6 +45,12 @@ namespace NES
_screenWidth = width * scale;
_screenBufferSize = _screenHeight*_screenWidth;
Reset();
}
}
void Renderer::Reset()
{
_frameLock.Acquire();
CleanupDevice();
if(FAILED(InitDevice())) {
@ -52,7 +58,6 @@ namespace NES
}
_frameLock.Release();
}
}
void Renderer::CleanupDevice()
{

View file

@ -82,6 +82,7 @@ namespace NES {
Renderer(HWND hWnd);
~Renderer();
void Reset();
void Render();
void DisplayMessage(string title, string message);
void DisplayToast(shared_ptr<ToastInfo> toast);