OpenGL Plugin: code cleanup trying to follow code style wiki and updated copyright date

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2850 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox
2009-04-03 14:35:49 +00:00
parent 41058700c9
commit 6736898486
38 changed files with 329 additions and 282 deletions
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,9 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// ---------------------------------------------------------------------------------------
// includes
// -------------
#include "Globals.h"
#include "Profiler.h"
#include "Config.h"
@@ -37,9 +34,10 @@
#include "XFB.h"
#include "main.h"
// ---------------------------------------------------------------------------------------
// ----------------------------------------------
// State translation lookup tables
// -------------
// Reference: Yet Another Gamecube Documentation
// ----------------------------------------------
static const GLenum glCmpFuncs[8] = {
GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS
@@ -56,16 +54,16 @@ void BPInit()
bpmem.bpMask = 0xFFFFFF;
}
//////////////////////////////////////////////////////////////////////////////////////
// Write to bpmem
// ----------------------------------------------------------------------------------------------------------
// Write to the BreakPoint Memory
/* ------------------
Called:
At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg
TODO:
Turn into function table. The (future) DL jit can then call the functions directly,
Turn into function table. The (future) DisplayList (DL) jit can then call the functions directly,
getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\
just stuff geometry in them and don't put state changes there.
// ------------------ */
just stuff geometry in them and don't put state changes there. */
// ----------------------------------------------------------------------------------------------------------
void BPWritten(int addr, int changes, int newval)
{
switch (addr)
@@ -183,48 +181,28 @@ void BPWritten(int addr, int changes, int newval)
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
/*
Logic Operation Blend Modes
--------------------
0: GL_CLEAR
1: GL_AND
2: GL_AND_REVERSE
3: GL_COPY [Super Smash. Bro. Melee, NES Zelda I, NES Zelda II]
4: GL_AND_INVERTED
5: GL_NOOP
6: GL_XOR
7: GL_OR [Zelda: TP]
8: GL_NOR
9: GL_EQUIV
10: GL_INVERT
11: GL_OR_REVERSE
12: GL_COPY_INVERTED
13: GL_OR_INVERTED
14: GL_NAND
15: GL_SET
*/
// LogicOp Blending
if (changes & 2) {
// Set LogicOp Blending Mode
if (changes & 2)
{
SETSTAT(stats.logicOpMode, bpmem.blendmode.logicopenable != 0 ? bpmem.blendmode.logicmode : stats.logicOpMode);
if (bpmem.blendmode.logicopenable)
{
glEnable(GL_COLOR_LOGIC_OP);
// PanicAlert("Logic Op Blend : %i", bpmem.blendmode.logicmode);
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
}
else
glDisable(GL_COLOR_LOGIC_OP);
}
// Dithering
if (changes & 4) {
// Set Dithering Mode
if (changes & 4)
{
SETSTAT(stats.dither, bpmem.blendmode.dither);
if (bpmem.blendmode.dither) glEnable(GL_DITHER);
else glDisable(GL_DITHER);
}
// Blending
// Set Blending Mode
if (changes & 0xFE1)
{
SETSTAT(stats.srcFactor, bpmem.blendmode.srcfactor);
@@ -232,7 +210,7 @@ void BPWritten(int addr, int changes, int newval)
Renderer::SetBlendMode(false);
}
// Color Mask
// Set Color Mask
if (changes & 0x18)
{
SETSTAT(stats.alphaUpdate, bpmem.blendmode.alphaupdate);
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _BPSTRUCTS_H
#define _BPSTRUCTS_H
#ifndef _BPSTRUCTS_H_
#define _BPSTRUCTS_H_
#include "BPMemory.h"
@@ -24,4 +24,4 @@ void BPInit();
void LoadBPReg(u32 value0);
void BPReload();
#endif
#endif // _BPSTRUCTS_H_
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
+4 -4
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _PLUGIN_VIDEOOGL_CONFIG_H
#define _PLUGIN_VIDEOOGL_CONFIG_H
#ifndef _PLUGIN_VIDEOOGL_CONFIG_H_
#define _PLUGIN_VIDEOOGL_CONFIG_H_
#include "Common.h"
@@ -107,4 +107,4 @@ private:
extern Config g_Config;
#endif // _PLUGIN_VIDEOOGL_CONFIG_H
#endif // _PLUGIN_VIDEOOGL_CONFIG_H_
@@ -15,17 +15,17 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "../Globals.h" // The precompiled header
#include "IniFile.h" // Common
#include "../Config.h" // Config settings
#include "IniFile.h"
#include "Debugger.h"
#include "../Config.h"
#include "../Globals.h"
extern int gPreset;
extern int g_Preset;
BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_CLOSE(CDebugger::OnClose)
EVT_CHECKBOX(ID_SAVETOFILE,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_SHOWCONSOLE,CDebugger::GeneralSettings)
EVT_CHECKBOX(ID_INFOLOG,CDebugger::GeneralSettings)
@@ -61,7 +61,7 @@ void CDebugger::OnClose(wxCloseEvent& event)
void CDebugger::DoShowConsole()
{
ConsoleListener* console = LogManager::GetInstance()->getConsoleListener();
if(m_Check[1]->IsChecked() && console->IsOpen())
if (m_Check[1]->IsChecked() && console->IsOpen())
console->Open();
else
console->Close();
@@ -75,21 +75,25 @@ void CDebugger::SaveSettings() const
// TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window
// TODO: get the screen resolution and make limits from that
if(GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000)
if (GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000
&& GetSize().GetHeight() < 1000)
{
file.Set("VideoWindow", "x", GetPosition().x);
file.Set("VideoWindow", "y", GetPosition().y);
file.Set("VideoWindow", "w", GetSize().GetWidth());
file.Set("VideoWindow", "h", GetSize().GetHeight());
}
file.Set("VideoWindow", "WriteToFile", m_Check[0]->IsChecked());
file.Set("VideoWindow", "Console", m_Check[1]->IsChecked());
g_Config.iLog = bInfoLog ? CONF_LOG : 0;
g_Config.iLog |= bPrimLog ? CONF_PRIMLOG : 0;
g_Config.iLog |= bSaveTextures ? CONF_SAVETEXTURES : 0;
g_Config.iLog |= bSaveTargets ? CONF_SAVETARGETS : 0;
g_Config.iLog |= bSaveShaders ? CONF_SAVESHADERS : 0;
file.Set("VideoWindow", "ConfBits", g_Config.iLog);
file.Save(DEBUGGER_CONFIG_FILE);
@@ -142,6 +146,7 @@ void CDebugger::CreateGUIControls()
m_Check[4] = new wxCheckBox(m_MainPanel, ID_SAVETEXTURES, wxT("Save Textures"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[5] = new wxCheckBox(m_MainPanel, ID_SAVETARGETS, wxT("Save Targets"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Check[6] = new wxCheckBox(m_MainPanel, ID_SAVESHADERS, wxT("Save Shaders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
for (int i = 0; i < NUM_OPTIONS-ID_SAVETOFILE; ++i)
sOptions->Add(m_Check[i], 0, 0, 5);
@@ -153,7 +158,6 @@ void CDebugger::CreateGUIControls()
Fit();
}
//////////////////////////////////////////////////////////////////////////
// General settings
void CDebugger::GeneralSettings(wxCommandEvent& event)
{
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __CDebugger_h__
#define __CDebugger_h__
#ifndef _CDEBUGGER_H_
#define _CDEBUGGER_H_
#include <wx/wx.h>
#include <wx/notebook.h>
@@ -30,7 +30,7 @@ class CDebugger : public wxDialog
public:
CDebugger(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("OGL Debug"),
const wxString &title = wxT("OGL Debugguer"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
@@ -61,7 +61,6 @@ private:
enum
{
ID_MAINPANEL = 2000,
ID_SAVETOFILE,
ID_SHOWCONSOLE,
ID_INFOLOG,
@@ -76,4 +75,5 @@ private:
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif
#endif // _CDEBUGGER_H_
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -66,11 +66,13 @@ void OpenGL_SwapBuffers()
#endif
}
u32 OpenGL_GetBackbufferWidth() {
u32 OpenGL_GetBackbufferWidth()
{
return s_backbuffer_width;
}
u32 OpenGL_GetBackbufferHeight() {
u32 OpenGL_GetBackbufferHeight()
{
return s_backbuffer_height;
}
+4 -4
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLINIT_H
#define _GLINIT_H
#ifndef _GLINIT_H_
#define _GLINIT_H_
#if defined GLTEST && GLTEST
#include "nGLUtil.h"
@@ -149,4 +149,4 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#endif // GLTEST ??
#endif // include braces
#endif // _GLINIT_H_
+36 -11
View File
@@ -1,5 +1,22 @@
#ifndef _GLWINDOW_H
#define _GLWINDOW_H
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLWINDOW_H_
#define _GLWINDOW_H_
#include <vector>
#include "Common.h"
@@ -24,14 +41,16 @@
#else
#include <GL/gl.h>
#endif
enum OGL_Props {
enum OGL_Props
{
OGL_FULLSCREEN,
OGL_KEEPRATIO,
OGL_HIDECURSOR,
OGL_PROP_COUNT
};
struct res {
struct res
{
u32 x;
u32 y;
};
@@ -52,16 +71,19 @@ protected:
EventHandler* eventHandler;
res origRes, currFullRes, currWinRes;
static std::vector<res> fullResolutions;
virtual void SetRender(u32 x, u32 y) {
virtual void SetRender(u32 x, u32 y)
{
xRender = x;
yRender = y;
}
static const std::vector<res>& getFsResolutions() {
static const std::vector<res>& getFsResolutions()
{
return fullResolutions;
}
static void addFSResolution(res fsr) {
static void addFSResolution(res fsr)
{
fullResolutions.push_back(fsr);
}
public:
@@ -98,19 +120,22 @@ public:
u32 GetXwin() {return xWin;}
u32 GetYwin() {return yWin;}
void SetWinSize(u32 x, u32 y) {
void SetWinSize(u32 x, u32 y)
{
xWin = x;
yWin = y;
}
int GetYoff() {return yOffset;}
int GetXoff() {return xOffset;}
void SetOffset(int x, int y) {
void SetOffset(int x, int y)
{
yOffset = y;
xOffset = x;
}
void SetMax(float x, float y) {
void SetMax(float x, float y)
{
yMax = y;
xMax = x;
}
@@ -142,4 +167,4 @@ public:
// resolution iter
};
#endif
#endif // _GLWINDOW_H_
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __OGL_CONFIGDIALOG_h__
#define __OGL_CONFIGDIALOG_h__
#ifndef _OGL_CONFIGDIALOG_H_
#define _OGL_CONFIGDIALOG_H_
#include <wx/wx.h>
#include <wx/dialog.h>
@@ -183,4 +183,4 @@ class ConfigDialog : public wxDialog
void AdvancedSettingsChanged(wxCommandEvent& event);
};
#endif
#endif // _OGL_CONFIGDIALOG_H_
+4 -4
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _GLOBALS_H
#define _GLOBALS_H
#ifndef _GLOBALS_H_
#define _GLOBALS_H_
#include "Common.h"
#include "Config.h"
@@ -27,4 +27,4 @@
// A global plugin specification
extern PLUGIN_GLOBALS* globals;
#endif // _GLOBALS_H
#endif // _GLOBALS_H_
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -77,9 +77,8 @@ GLVertexFormat::GLVertexFormat()
{
#ifdef USE_JIT
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
if (m_compiledCode) {
if (m_compiledCode)
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
}
#endif
}
@@ -102,10 +101,9 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
vertex_stride = _vtx_decl.stride;
using namespace Gen;
if (_vtx_decl.stride & 3) {
// We will not allow vertex components causing uneven strides.
// We will not allow vertex components causing uneven strides.
if (_vtx_decl.stride & 3)
PanicAlert("Uneven vertex stride: %i", _vtx_decl.stride);
}
#ifdef USE_JIT
Gen::XEmitter emit(m_compiledCode);
@@ -114,7 +112,8 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
emit.CallCdeclFunction4_I(glVertexPointer, 3, GL_FLOAT, _vtx_decl.stride, 0);
if (_vtx_decl.num_normals >= 1) {
if (_vtx_decl.num_normals >= 1)
{
emit.CallCdeclFunction3_I(glNormalPointer, VarToGL(_vtx_decl.normal_gl_type), _vtx_decl.stride, _vtx_decl.normal_offset[0]);
if (_vtx_decl.num_normals == 3) {
emit.CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, _vtx_decl.normal_gl_size, VarToGL(_vtx_decl.normal_gl_type), GL_TRUE, _vtx_decl.stride, _vtx_decl.normal_offset[1]);
@@ -122,8 +121,10 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
}
}
for (int i = 0; i < 2; i++) {
if (_vtx_decl.color_offset[i] != -1) {
for (int i = 0; i < 2; i++)
{
if (_vtx_decl.color_offset[i] != -1)
{
if (i == 0)
emit.CallCdeclFunction4_I(glColorPointer, 4, GL_UNSIGNED_BYTE, _vtx_decl.stride, _vtx_decl.color_offset[i]);
else
@@ -160,15 +161,13 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
}
}
if (_vtx_decl.posmtx_offset != -1) {
if (_vtx_decl.posmtx_offset != -1)
emit.CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_FALSE, _vtx_decl.stride, _vtx_decl.posmtx_offset);
}
emit.ABI_EmitEpilogue(6);
if (emit.GetCodePtr() - (u8*)m_compiledCode > COMPILED_CODE_SIZE)
{
Crash();
}
#endif
this->vtx_decl = _vtx_decl;
@@ -215,11 +214,13 @@ void GLVertexFormat::SetupVertexPointers() const {
void GLVertexFormat::EnableComponents(u32 components)
{
if (s_prevcomponents != components) {
if (s_prevcomponents != components)
{
VertexManager::Flush();
// matrices
if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX)) {
if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX))
{
if (components & VB_HAS_POSMTXIDX)
glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB);
else
@@ -227,13 +228,15 @@ void GLVertexFormat::EnableComponents(u32 components)
}
// normals
if ((components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0)) {
if ((components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0))
{
if (components & VB_HAS_NRM0)
glEnableClientState(GL_NORMAL_ARRAY);
else
glDisableClientState(GL_NORMAL_ARRAY);
}
if ((components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1)) {
if ((components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1))
{
if (components & VB_HAS_NRM1) {
glEnableVertexAttribArray(SHADER_NORM1_ATTRIB);
glEnableVertexAttribArray(SHADER_NORM2_ATTRIB);
@@ -245,8 +248,10 @@ void GLVertexFormat::EnableComponents(u32 components)
}
// color
for (int i = 0; i < 2; ++i) {
if ((components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i))) {
for (int i = 0; i < 2; ++i)
{
if ((components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i)))
{
if (components & (VB_HAS_COL0 << 0))
glEnableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY);
else
@@ -255,34 +260,34 @@ void GLVertexFormat::EnableComponents(u32 components)
}
// tex
if (!g_Config.bDisableTexturing) {
for (int i = 0; i < 8; ++i) {
if ((components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i))) {
glClientActiveTexture(GL_TEXTURE0 + i);
if (components & (VB_HAS_UV0 << i))
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
else
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
}
}
else // Disable Texturing
for (int i = 0; i < 8; ++i)
{
for (int i = 0; i < 8; ++i) {
if ((components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)) && !g_Config.bDisableTexturing)
{
glClientActiveTexture(GL_TEXTURE0 + i);
if (components & (VB_HAS_UV0 << i))
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
else
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
else
{
glClientActiveTexture(GL_TEXTURE0 + i);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
}
// Disable Lighting
// TODO - move to better spot
if (g_Config.bDisableLighting) {
// TODO - Is this a good spot for this code?
if (g_Config.bDisableLighting)
{
for (int i = 0; i < xfregs.nNumChans; i++)
{
xfregs.colChans[i].alpha.enablelighting = false;
xfregs.colChans[i].color.enablelighting = false;
}
}
s_prevcomponents = components;
}
}
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,11 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <windows.h>
#include <wx/wx.h>
@@ -28,27 +23,19 @@
#include <wx/dialog.h>
#include <wx/aboutdlg.h>
#include "../Globals.h" // Local
#include "../Globals.h"
#include "../Config.h"
#include "main.h"
#include "Win32.h"
#include "OnScreenDisplay.h" // for AddMessage
#include "OnScreenDisplay.h"
#include "StringUtil.h" // Common: For StringFromFormat
//////////////////////////////////
#include "StringUtil.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
//void OpenConsole();
//void CloseConsole();
HINSTANCE g_hInstance;
// ------------------------------------------------------
// WxWidgets
// ---------------
#if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp
{
@@ -106,12 +93,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
void DoDllDebugger();
extern bool gShowDebugger;
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// ----------------------
// The rendering window
// ¯¯¯¯¯¯¯¯¯¯
// ----------------------
namespace EmuWindow
{
@@ -373,7 +358,7 @@ void Close()
// ------------------------------------------
// Set the size of the child or main window
// ------------------
// ------------------------------------------
void SetSize(int width, int height)
{
RECT rc = {0, 0, width, height};
@@ -391,4 +376,3 @@ void SetSize(int width, int height)
}
} // EmuWindow
////////////////////////////////////
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _WIN32_H_
#define _WIN32_H_
#pragma once
#include "stdafx.h"
@@ -31,3 +34,5 @@ namespace EmuWindow
void Close();
void SetSize(int displayWidth, int displayHeight);
}
#endif // _WIN32_H_
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _OSD_H
#define _OSD_H
#ifndef _OSD_H_
#define _OSD_H_
namespace OSD
{
@@ -27,5 +27,5 @@ void DrawMessages(); // draw the current messages on the screen. Only call once
} // namespace
#endif
#endif // _OSD_H_
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _PIXELSHADERCACHE_H_
#define _PIXELSHADERCACHE_H_
#include <map>
#include <string>
@@ -63,3 +66,5 @@ public:
static GLuint GetColorMatrixProgram();
};
#endif // _PIXELSHADERCACHE_H_
+29 -26
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -1120,26 +1120,32 @@ void Renderer::Swap(const TRectangle& rc)
u8 *data = (u8 *) malloc(3 * w * h);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_BGR, GL_UNSIGNED_BYTE, data);
if (glGetError() == GL_NO_ERROR) {
if (!s_bLastFrameDumped) {
if (glGetError() == GL_NO_ERROR)
{
if (!s_bLastFrameDumped)
{
s_bAVIDumping = AVIDump::Start(EmuWindow::GetChildParentWnd(), w, h);
if (!s_bAVIDumping) {
if (!s_bAVIDumping)
PanicAlert("Error dumping frames to AVI.");
} else {
else
{
char msg [255];
sprintf(msg, "Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, w, h);
OSD::AddMessage(msg, 2000);
}
}
if (s_bAVIDumping) {
if (s_bAVIDumping)
AVIDump::AddFrame((char *) data);
}
s_bLastFrameDumped = true;
}
free(data);
s_criticalScreenshot.Leave();
} else {
if(s_bLastFrameDumped && s_bAVIDumping) {
}
else
{
if(s_bLastFrameDumped && s_bAVIDumping)
{
AVIDump::Stop();
s_bAVIDumping = false;
}
@@ -1199,8 +1205,6 @@ void Renderer::Swap(const TRectangle& rc)
// Renderer::SetZBufferRender();
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight());
}
////////////////////////////////////////////////
void Renderer::DrawDebugText()
{
@@ -1210,10 +1214,9 @@ void Renderer::DrawDebugText()
char debugtext_buffer[8192];
char *p = debugtext_buffer;
p[0] = 0;
if (g_Config.bShowFPS)
{
p+=sprintf(p, "FPS: %d\n", s_fps);
}
if (g_Config.bShowEFBCopyRegions)
{
@@ -1331,9 +1334,9 @@ void Renderer::DrawDebugText()
Renderer::RenderText(debugtext_buffer, 20, 20, 0xFF00FFFF);
}
//////////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------------------------------------
// We can now draw whatever we want on top of the picture. Then we copy the final picture to the output.
// ----------------------
// -------------------------------------------------------------------------------------------------------
void Renderer::SwapBuffers()
{
// Count FPS.
@@ -1357,7 +1360,6 @@ void Renderer::SwapBuffers()
DrawDebugText();
OSD::DrawMessages();
// -----------------------------
#if defined(DVPROFILE)
if (g_bWriteProfile) {
@@ -1391,8 +1393,10 @@ void Renderer::SwapBuffers()
// Render to the framebuffer.
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, s_uFramebuffer);
if (nZBufferRender > 0) {
if (--nZBufferRender == 0) {
if (nZBufferRender > 0)
{
if (--nZBufferRender == 0)
{
// turn off
nZBufferRender = 0;
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
@@ -1400,6 +1404,7 @@ void Renderer::SwapBuffers()
Renderer::SetRenderMode(RM_Normal); // turn off any zwrites
}
}
GL_REPORT_ERRORD();
}
@@ -1456,15 +1461,15 @@ void Renderer::FlipImageData(u8 *data, int w, int h)
}
}
//////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------------------------------------------------
// Function: This function does not have the final picture. Use Renderer::Swap() to adjust the final picture.
// Call schedule: Called from VertexShaderManager
// ----------------------
// ------------------------------------------------------------------------------------------------------------
void UpdateViewport()
{
// -----------------------------------------------------------------------
// ---------
// Logging
// ------------------
// ---------
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
// [0] = width/2
// [1] = height/2
@@ -1477,7 +1482,7 @@ void UpdateViewport()
rawViewport[3]-rawViewport[0]-342, rawViewport[4]+rawViewport[1]-342,
2 * rawViewport[0], 2 * rawViewport[1],
(rawViewport[5] - rawViewport[2]) / 16777215.0f, rawViewport[5] / 16777215.0f);*/
// --------------------------
// --------
int scissorXOff = bpmem.scissorOffset.x * 2 - 342;
int scissorYOff = bpmem.scissorOffset.y * 2 - 342;
@@ -1485,14 +1490,12 @@ void UpdateViewport()
float MValueX = Renderer::GetTargetScaleX();
float MValueY = Renderer::GetTargetScaleY();
// -----------------------------------------------------------------------
// Stretch picture with increased internal resolution
// ------------------
int GLx = (int)ceil((xfregs.rawViewport[3] - xfregs.rawViewport[0] - 342 - scissorXOff) * MValueX);
int GLy = (int)ceil(Renderer::GetTargetHeight() - ((int)(xfregs.rawViewport[4] - xfregs.rawViewport[1] - 342 - scissorYOff)) * MValueY);
int GLWidth = (int)ceil(abs((int)(2 * xfregs.rawViewport[0])) * MValueX);
int GLHeight = (int)ceil(abs((int)(2 * xfregs.rawViewport[1])) * MValueY);
// -------------------------------------
// Update the view port
glViewport(GLx, GLy, GLWidth, GLHeight);

Some files were not shown because too many files have changed in this diff Show More