From c6fdeb7b23f72b356b58a4573e51fc4ddf6db9ab Mon Sep 17 00:00:00 2001
From: Tony Wasserka <NeoBrainX@gmail.com>
Date: Fri, 11 Jul 2014 19:40:34 +0200
Subject: [PATCH] Renderer: Fix component order in bottom framebuffer.

---
 src/video_core/renderer_opengl/renderer_opengl.cpp | 2 +-
 src/video_core/renderer_opengl/renderer_opengl.h   | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index c549f47440..047c691850 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -124,7 +124,7 @@ void RendererOpenGL::RenderXFB(const common::Rect& src_rect, const common::Rect&
     // Update textures with contents of XFB in RAM - bottom
     glBindTexture(GL_TEXTURE_2D, m_xfb_texture_bottom);
     glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight,
-        GL_RGB, GL_UNSIGNED_BYTE, m_xfb_bottom_flipped);
+        GL_BGR, GL_UNSIGNED_BYTE, m_xfb_bottom_flipped);
     glBindTexture(GL_TEXTURE_2D, 0);
 
     // Render target is destination framebuffer
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index dd811cad63..30f4febe05 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -84,7 +84,6 @@ private:
     // "Flipped" framebuffers translate scanlines from native 3DS left-to-right to top-to-bottom
     // as OpenGL expects them in a texture. There probably is a more efficient way of doing this:
 
-    u8 m_xfb_top_flipped[VideoCore::kScreenTopWidth * VideoCore::kScreenTopWidth * 4]; 
-    u8 m_xfb_bottom_flipped[VideoCore::kScreenTopWidth * VideoCore::kScreenTopWidth * 4];   
-
-};
\ No newline at end of file
+    u8 m_xfb_top_flipped[VideoCore::kScreenTopWidth * VideoCore::kScreenTopHeight * 4];
+    u8 m_xfb_bottom_flipped[VideoCore::kScreenBottomWidth * VideoCore::kScreenBottomHeight * 4];
+};