git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3398 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-06-09 21:29:54 +00:00
parent 6f845b8bb0
commit 24e0f8926c
2 changed files with 8 additions and 39 deletions

View File

@ -25,7 +25,6 @@ Config g_Config;
Config::Config() Config::Config()
{ {
memset(this, 0, sizeof(Config));
} }
void Config::Load() void Config::Load()

View File

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#include "Globals.h" #include "Globals.h"
#include <vector> #include <vector>
@ -143,6 +140,9 @@ static int s_fps = 0;
static int s_targetwidth; // Size of render buffer FBO. static int s_targetwidth; // Size of render buffer FBO.
static int s_targetheight; static int s_targetheight;
#ifndef _WIN32
int OSDChoice = 0 , OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
#endif
namespace { namespace {
@ -187,12 +187,9 @@ void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
} }
} // namespace } // namespace
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Init functions // Init functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
bool Renderer::Init() bool Renderer::Init()
{ {
bool bSuccess = true; bool bSuccess = true;
@ -551,12 +548,9 @@ bool Renderer::InitializeGL()
return GL_REPORT_ERROR() == GL_NO_ERROR; return GL_REPORT_ERROR() == GL_NO_ERROR;
} }
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
// Return the rendering window width and height // Return the rendering window width and height
// ------------------------
int Renderer::GetTargetWidth() int Renderer::GetTargetWidth()
{ {
return (s_bNativeResolution || g_Config.b2xResolution) ? return (s_bNativeResolution || g_Config.b2xResolution) ?
@ -579,12 +573,10 @@ float Renderer::GetTargetScaleY()
return (float)GetTargetHeight() / (float)EFB_HEIGHT; return (float)GetTargetHeight() / (float)EFB_HEIGHT;
} }
/////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Various supporting functions // Various supporting functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void Renderer::SetRenderTarget(GLuint targ) void Renderer::SetRenderTarget(GLuint targ)
{ {
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB,
@ -677,9 +669,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
s_blendMode = newval; s_blendMode = newval;
} }
//////////////////////////////////////////////////////////////////////////////////////////
// Apply AA if enabled // Apply AA if enabled
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
GLuint Renderer::ResolveAndGetRenderTarget(const TRectangle &source_rect) GLuint Renderer::ResolveAndGetRenderTarget(const TRectangle &source_rect)
{ {
if (s_MSAASamples > 1) if (s_MSAASamples > 1)
@ -737,10 +727,9 @@ GLuint Renderer::ResolveAndGetDepthTarget(const TRectangle &source_rect)
return s_DepthTarget; return s_DepthTarget;
} }
} }
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Function: This function handles the OpenGL glScissor() function // Function: This function handles the OpenGL glScissor() function
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg() // Call browser: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg()
@ -751,7 +740,6 @@ GLuint Renderer::ResolveAndGetDepthTarget(const TRectangle &source_rect)
// Renderer::GetTargetHeight() = the fixed ini file setting // Renderer::GetTargetHeight() = the fixed ini file setting
// donkopunchstania - it appears scissorBR is the bottom right pixel inside the scissor box // donkopunchstania - it appears scissorBR is the bottom right pixel inside the scissor box
// therefore the width and height are (scissorBR + 1) - scissorTL // therefore the width and height are (scissorBR + 1) - scissorTL
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
bool Renderer::SetScissorRect() bool Renderer::SetScissorRect()
{ {
int xoff = bpmem.scissorOffset.x * 2 - 342; int xoff = bpmem.scissorOffset.x * 2 - 342;
@ -795,9 +783,7 @@ bool Renderer::SetScissorRect()
return false; return false;
} }
//////////////////////////////////////////////////////////////////////////////////////////
// Aspect ratio functions // Aspect ratio functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ComputeBackbufferRectangle(TRectangle *rc) void ComputeBackbufferRectangle(TRectangle *rc)
{ {
float FloatGLWidth = (float)OpenGL_GetBackbufferWidth(); float FloatGLWidth = (float)OpenGL_GetBackbufferWidth();
@ -862,12 +848,11 @@ void ComputeBackbufferRectangle(TRectangle *rc)
rc->right = XOffset + ceil(FloatGLWidth); rc->right = XOffset + ceil(FloatGLWidth);
rc->bottom = YOffset + ceil(FloatGLHeight); rc->bottom = YOffset + ceil(FloatGLHeight);
} }
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// This function has the final picture if the XFB functions are not used. We adjust the aspect ratio here. // This function has the final picture if the XFB functions are not used. We
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // adjust the aspect ratio here.
void Renderer::Swap(const TRectangle& rc) void Renderer::Swap(const TRectangle& rc)
{ {
OpenGL_Update(); // just updates the render window position and the backbuffer size OpenGL_Update(); // just updates the render window position and the backbuffer size
@ -983,18 +968,12 @@ void Renderer::Swap(const TRectangle& rc)
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
TextureMngr::DisableStage(0); TextureMngr::DisableStage(0);
} }
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Wireframe // Wireframe
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
if (g_Config.bWireFrame) if (g_Config.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Save screenshot // Save screenshot
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
if (s_bScreenshot) if (s_bScreenshot)
{ {
// Select source // Select source
@ -1014,11 +993,8 @@ void Renderer::Swap(const TRectangle& rc)
// It should not be necessary to read from the window backbuffer beyond this point // It should not be necessary to read from the window backbuffer beyond this point
if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1) if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Frame dumps are handled a little differently in Windows // Frame dumps are handled a little differently in Windows
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32 #ifdef _WIN32
if (g_Config.bDumpFrames) if (g_Config.bDumpFrames)
{ {
@ -1193,12 +1169,9 @@ void Renderer::SwapBuffers()
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
} }
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Create On-Screen-Messages // Create On-Screen-Messages
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void Renderer::DrawDebugText() void Renderer::DrawDebugText()
{ {
// Reset viewport for drawing text // Reset viewport for drawing text
@ -1387,12 +1360,9 @@ void Renderer::RenderText(const char* pstr, int left, int top, u32 color)
1 - top * 2.0f / (float)nBackbufferHeight, 1 - top * 2.0f / (float)nBackbufferHeight,
0, nBackbufferWidth, nBackbufferHeight); 0, nBackbufferWidth, nBackbufferHeight);
} }
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Save screenshot // Save screenshot
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void Renderer::SetScreenshot(const char *filename) void Renderer::SetScreenshot(const char *filename)
{ {
s_criticalScreenshot.Enter(); s_criticalScreenshot.Enter();