mirror of
https://github.com/libretro/Mesen.git
synced 2025-01-21 00:04:24 +00:00
Vista: Fixed a couple of issues that came up while testing on windows vista
This commit is contained in:
parent
291931a1b0
commit
e4fa287e66
@ -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;
|
||||
};
|
@ -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);
|
||||
|
@ -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, "");
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
namespace NES
|
||||
namespace NES
|
||||
{
|
||||
Renderer::Renderer(HWND hWnd)
|
||||
{
|
||||
@ -36,7 +36,7 @@ namespace NES
|
||||
{
|
||||
uint32_t scale = EmulationSettings::GetVideoScale();
|
||||
|
||||
if(_screenHeight != height*scale || _screenWidth != width*scale) {
|
||||
if(_screenHeight != height*scale || _screenWidth != width*scale) {
|
||||
_nesFrameHeight = height;
|
||||
_nesFrameWidth = width;
|
||||
_newFrameBufferSize = width*height;
|
||||
@ -44,16 +44,21 @@ namespace NES
|
||||
_screenHeight = height * scale;
|
||||
_screenWidth = width * scale;
|
||||
_screenBufferSize = _screenHeight*_screenWidth;
|
||||
|
||||
_frameLock.Acquire();
|
||||
CleanupDevice();
|
||||
if(FAILED(InitDevice())) {
|
||||
CleanupDevice();
|
||||
}
|
||||
_frameLock.Release();
|
||||
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::Reset()
|
||||
{
|
||||
_frameLock.Acquire();
|
||||
CleanupDevice();
|
||||
if(FAILED(InitDevice())) {
|
||||
CleanupDevice();
|
||||
}
|
||||
_frameLock.Release();
|
||||
}
|
||||
|
||||
void Renderer::CleanupDevice()
|
||||
{
|
||||
if(_pTexture) _pTexture->Release();
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user