From 670ca7e993277178d09d2c5b131b51210d20a607 Mon Sep 17 00:00:00 2001 From: rog Date: Sat, 29 Dec 2012 02:43:36 -0500 Subject: [PATCH 1/5] Toggle wiimote status based on the actual status, instead of some dumb checkbox that is almost never even right. The checkbox is still wrong when starting emulation, but it's now purely cosmetic. Actually fixes issue 5594. --- Source/Core/DolphinWX/Src/FrameTools.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 9207144554..b79e890f3b 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1469,13 +1469,17 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect) wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1, connect ? wxT("Connected") : wxT("Disconnected"))); Core::DisplayMessage(msg.ToAscii(), 3000); + + // Wait for the wiimote to connect + while (GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->IsConnected() != connect) + {} Host_UpdateMainFrame(); } } void CFrame::OnConnectWiimote(wxCommandEvent& event) { - ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, event.IsChecked()); + ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, !GetUsbPointer()->AccessWiiMote((event.GetId() - IDM_CONNECT_WIIMOTE1) | 0x100)->IsConnected()); } // Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover From cd54d6efdd754afb5dadd763873fc9e635fc4ae5 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sat, 29 Dec 2012 22:26:09 +1300 Subject: [PATCH 2/5] Mismatched new/delete. --- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 28ce6106c7..204a1fc698 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -173,7 +173,7 @@ bool Wiimote::Read() return true; } - delete rpt.first; + delete[] rpt.first; return false; } From 30dd9c2e17c4b7dc5bf623f51e627ca1c0d0b940 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 29 Dec 2012 12:50:42 +0100 Subject: [PATCH 3/5] always calls glBindBuffer(0) after disabling vao --- .../Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp | 6 ++---- Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp | 4 ++-- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 8 +++----- Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp | 4 +--- .../Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp | 10 +++------- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp index 0220e54806..e7fb7ad7b7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp @@ -203,8 +203,8 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+4); // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); // EFB framebuffer is currently bound, make sure to clear its alpha value to 1.f glViewport(0, 0, m_targetWidth, m_targetHeight); @@ -360,9 +360,6 @@ void XFBSource::Draw(const MathUtil::Rectangle &sourcerc, }; glBindBuffer(GL_ARRAY_BUFFER, s_VBO); glBufferData(GL_ARRAY_BUFFER, 2*4*3*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - - // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); s_cached_sourcerc = sourcerc; s_cached_drawrc = drawrc; @@ -373,6 +370,7 @@ void XFBSource::Draw(const MathUtil::Rectangle &sourcerc, // TODO: this after merging with graphic_update glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); GL_REPORT_ERRORD(); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp b/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp index 5bebd76eb6..95c99ac78c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp @@ -181,8 +181,8 @@ RasterFont::RasterFont() glVertexAttribPointer(glGetAttribLocation(shader_program, "texturePosition"), 2, GL_FLOAT, 0, sizeof(GLfloat)*4, (GLfloat*)NULL+2); // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); } RasterFont::~RasterFont() @@ -276,8 +276,8 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta glDrawArrays(GL_TRIANGLES, 0, usage/4); // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); glUseProgram(0); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 15fa36046d..a2d0a94ee3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -503,8 +503,8 @@ Renderer::Renderer() glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+5); // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); glStencilFunc(GL_ALWAYS, 0, 0); glBlendFunc(GL_ONE, GL_ONE); @@ -704,8 +704,8 @@ void Renderer::DrawDebugInfo() glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6); // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); // Restore Line Size glLineWidth(lSize); @@ -1286,9 +1286,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO); glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - - // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); s_cached_targetRc = targetRc; } @@ -1299,6 +1296,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons // TODO: this after merging with graphic_update glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); if(applyShader) PixelShaderCache::DisableShader(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp index 40dac17df6..d90f651a82 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp @@ -357,9 +357,6 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo); glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); - vbo_it->second.targetSource = targetSource; } @@ -368,6 +365,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo // TODO: this after merging with graphic_update glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); GL_REPORT_ERRORD(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp index f45277f759..54a2e2464c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp @@ -176,8 +176,8 @@ void Init() glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL+2); // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); glGenRenderbuffersEXT(1, &s_dstRenderBuffer); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer); @@ -271,9 +271,6 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO ); glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); - s_cached_sourceRc = sourceRc; } @@ -282,6 +279,7 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar // TODO: this after merging with graphic_update glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); GL_REPORT_ERRORD(); @@ -454,9 +452,6 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO ); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*4*4, vertices, GL_STREAM_DRAW); - // TODO: this after merging with graphic_update - glBindBuffer(GL_ARRAY_BUFFER, 0); - s_cached_srcHeight = srcHeight; s_cached_srcWidth = srcWidth; } @@ -466,6 +461,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur // TODO: this after merging with graphic_update glBindVertexArray(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); GL_REPORT_ERRORD(); From 539bf405f2df07e84ac0d549c4553d0b1435d231 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sun, 30 Dec 2012 16:31:38 +1300 Subject: [PATCH 4/5] In memory of calc84. http://dolphin-emu.org --- Source/Core/Common/Src/x64Emitter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/Src/x64Emitter.cpp b/Source/Core/Common/Src/x64Emitter.cpp index 19e96478d1..5f8d0a66f1 100644 --- a/Source/Core/Common/Src/x64Emitter.cpp +++ b/Source/Core/Common/Src/x64Emitter.cpp @@ -1068,8 +1068,10 @@ void XEmitter::XOR (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(t void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2) { #ifdef _DEBUG +#ifndef _M_X64 _assert_msg_(DYNA_REC, !a1.IsSimpleReg() || !a2.IsSimpleReg() || a1.GetSimpleReg() != a2.GetSimpleReg(), "Redundant MOV @ %p - bug in JIT?", - code); + code); +#endif #endif WriteNormalOp(this, bits, nrmMOV, a1, a2); } From b4f30e549e033f27fa38b45a2b1d152a301c0813 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 29 Dec 2012 21:50:07 -0600 Subject: [PATCH 5/5] Missed a precision qualifier in a HWRasterizer shader. --- Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp index dba6f7f12c..a5609f51b2 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp @@ -62,7 +62,7 @@ namespace HwRasterizer "}\n"; // Clear shader static const char *fragclearText = - "uniform vec4 Color;\n" + "uniform " PREC " vec4 Color;\n" "void main() {\n" " gl_FragColor = Color;\n" "}\n";