Some code clean up, and take care of some compiler warnings.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5090 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-20 04:18:19 +00:00
parent f74b5463d5
commit 154bc956ad
11 changed files with 484 additions and 514 deletions

View File

@ -265,11 +265,6 @@ void ProcessXEvents(void)
{ {
XNextEvent(dpy, &event); XNextEvent(dpy, &event);
switch(event.type) { switch(event.type) {
case KeyRelease:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask))
Host_Message(WM_USER_STOP);
break;
case KeyPress: case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0); key = XLookupKeysym((XKeyEvent*)&event, 0);
if (key == XK_Escape) if (key == XK_Escape)
@ -570,8 +565,6 @@ THREAD_RETURN EmuThread(void *pArg)
return 0; return 0;
} }
// Set or get the running state // Set or get the running state
void SetState(EState _State) void SetState(EState _State)

View File

@ -23,11 +23,12 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#ifdef __linux__ #include "Common.h" // Common
#if defined HAVE_X11 && HAVE_X11
#include <X11/Xlib.h> #include <X11/Xlib.h>
#endif #endif
#include "Common.h" // Common
#include "CPUDetect.h" #include "CPUDetect.h"
#include "IniFile.h" #include "IniFile.h"
#include "FileUtil.h" #include "FileUtil.h"
@ -475,7 +476,7 @@ bool DolphinApp::OnInit()
// Set main parent window // Set main parent window
SetTopWindow(main_frame); SetTopWindow(main_frame);
#if defined __linux__ #if defined HAVE_X11 && HAVE_X11
XInitThreads(); XInitThreads();
#endif #endif
return true; return true;

View File

@ -36,8 +36,6 @@
extern int frameCount; extern int frameCount;
extern int OSDChoice, OSDTime, OSDInternalW, OSDInternalH; extern int OSDChoice, OSDTime, OSDInternalW, OSDInternalH;
static int s_fps=0;
// Renderer really isn't a very good name for this class - it's more like "Misc". // Renderer really isn't a very good name for this class - it's more like "Misc".
// The long term goal is to get rid of this class and replace it with others that make // The long term goal is to get rid of this class and replace it with others that make
// more sense. // more sense.

View File

@ -50,6 +50,8 @@
#include "debugger/debugger.h" #include "debugger/debugger.h"
int s_fps=0;
static int s_target_width; static int s_target_width;
static int s_target_height; static int s_target_height;

View File

@ -84,10 +84,8 @@ void OpenGL_SetWindowText(const char *text)
// TODO convert text to unicode and change SetWindowTextA to SetWindowText // TODO convert text to unicode and change SetWindowTextA to SetWindowText
SetWindowTextA(EmuWindow::GetWnd(), text); SetWindowTextA(EmuWindow::GetWnd(), text);
#elif defined(HAVE_X11) && HAVE_X11 // GLX #elif defined(HAVE_X11) && HAVE_X11 // GLX
/** // Tell X to ask the window manager to set the window title. (X
* Tell X to ask the window manager to set the window title. (X // itself doesn't provide window title functionality.)
* itself doesn't provide window title functionality.)
*/
XStoreName(GLWin.dpy, GLWin.win, text); XStoreName(GLWin.dpy, GLWin.win, text);
#endif #endif
} }
@ -562,57 +560,35 @@ void OpenGL_Update()
// We just check all of our events here // We just check all of our events here
XEvent event; XEvent event;
KeySym key; KeySym key;
static bool ShiftPressed = false;
static bool ControlPressed = false;
static int FKeyPressed = -1;
int num_events; int num_events;
for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) { for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) {
XNextEvent(GLWin.dpy, &event); XNextEvent(GLWin.dpy, &event);
switch(event.type) { switch(event.type) {
case KeyRelease:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9) {
g_VideoInitialize.pKeyPress(FKeyPressed, ShiftPressed, ControlPressed);
FKeyPressed = -1;
} else {
if(key == XK_Shift_L || key == XK_Shift_R)
ShiftPressed = false;
else if(key == XK_Control_L || key == XK_Control_R)
ControlPressed = false;
}
break;
case KeyPress: case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0); key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9) if(key >= XK_F1 && key <= XK_F9)
{ {
if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask)) if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask))
FKeyPressed = 0x1b; g_VideoInitialize.pKeyPress(0x1b, False, False);
else else
FKeyPressed = key - 0xff4e; g_VideoInitialize.pKeyPress(key - 0xff4e,
(event.xkey.state & ShiftMask) == ShiftMask,
(event.xkey.state & ControlMask) == ControlMask);
} }
else if (key == XK_Escape) else if (key == XK_Escape)
{ {
if (GLWin.fs) if (GLWin.fs)
{ {
ToggleFullscreenMode(); ToggleFullscreenMode();
XEvent event; XEvent mapevent;
do { do {
XMaskEvent(GLWin.dpy, StructureNotifyMask, &event); XMaskEvent(GLWin.dpy, StructureNotifyMask, &mapevent);
} while ( (event.type != MapNotify) || (event.xmap.event != GLWin.win) ); } while ( (mapevent.type != MapNotify) || (mapevent.xmap.event != GLWin.win) );
} }
g_VideoInitialize.pKeyPress(0x1c, ShiftPressed, ControlPressed); g_VideoInitialize.pKeyPress(0x1c, False, False);
} }
else if (key == XK_Return && ((event.xkey.state & Mod1Mask) == Mod1Mask)) else if (key == XK_Return && ((event.xkey.state & Mod1Mask) == Mod1Mask))
ToggleFullscreenMode(); ToggleFullscreenMode();
else {
if(key == XK_Shift_L || key == XK_Shift_R)
ShiftPressed = true;
else if(key == XK_Control_L || key == XK_Control_R)
ControlPressed = true;
}
break;
case ButtonPress:
case ButtonRelease:
break; break;
case FocusIn: case FocusIn:
if (g_Config.bHideCursor) if (g_Config.bHideCursor)

View File

@ -53,7 +53,6 @@ void SetPSConstant4f(int const_number, float f1, float f2, float f3, float f4)
if (lastPSconstants[const_number][0] != f1 || lastPSconstants[const_number][1] != f2 || if (lastPSconstants[const_number][0] != f1 || lastPSconstants[const_number][1] != f2 ||
lastPSconstants[const_number][2] != f3 || lastPSconstants[const_number][3] != f4) lastPSconstants[const_number][2] != f3 || lastPSconstants[const_number][3] != f4)
{ {
const float f[4] = {f1, f2, f3, f4};
glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f1, f2, f3, f4); glProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f1, f2, f3, f4);
lastPSconstants[const_number][0] = f1; lastPSconstants[const_number][0] = f1;
lastPSconstants[const_number][1] = f2; lastPSconstants[const_number][1] = f2;

View File

@ -74,6 +74,8 @@
// Declarations and definitions // Declarations and definitions
// ---------------------------- // ----------------------------
int s_fps=0;
CGcontext g_cgcontext; CGcontext g_cgcontext;
CGprofile g_cgvProf; CGprofile g_cgvProf;
CGprofile g_cgfProf; CGprofile g_cgfProf;

View File

@ -361,7 +361,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_srcTexture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_srcTexture);
// TODO: make this less slow. (How?) // TODO: make this less slow. (How?)
if(s_srcTextureWidth == (GLsizei)srcFmtWidth && s_srcTextureHeight == (GLsizei)srcHeight) if((GLsizei)s_srcTextureWidth == (GLsizei)srcFmtWidth && (GLsizei)s_srcTextureHeight == (GLsizei)srcHeight)
{ {
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0,0,0,s_srcTextureWidth, s_srcTextureHeight, GL_BGRA, GL_UNSIGNED_BYTE, srcAddr); glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0,0,0,s_srcTextureWidth, s_srcTextureHeight, GL_BGRA, GL_UNSIGNED_BYTE, srcAddr);
} }

View File

@ -262,7 +262,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
u64 texHash; u64 texHash;
u32 FullFormat = tex_format; u32 FullFormat = tex_format;
if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2)) if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2))
u32 FullFormat = (tex_format | (tlutfmt << 16)); FullFormat = (tex_format | (tlutfmt << 16));
if (g_ActiveConfig.bSafeTextureCache || g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures) if (g_ActiveConfig.bSafeTextureCache || g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures)
{ {
if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2)) if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2))
@ -299,7 +299,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
if (!g_ActiveConfig.bSafeTextureCache) if (!g_ActiveConfig.bSafeTextureCache)
hash_value = ((u32 *)ptr)[0]; hash_value = ((u32 *)ptr)[0];
if (entry.isRenderTarget || ((address == entry.addr) && (hash_value == entry.hash) && FullFormat == entry.fmt)) if (entry.isRenderTarget || ((address == entry.addr) && (hash_value == entry.hash) && (int) FullFormat == entry.fmt))
{ {
entry.frameCount = frameCount; entry.frameCount = frameCount;
glEnable(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D); glEnable(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D);
@ -317,7 +317,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
// Let's reload the new texture data into the same texture, // Let's reload the new texture data into the same texture,
// instead of destroying it and having to create a new one. // instead of destroying it and having to create a new one.
// Might speed up movie playback very, very slightly. // Might speed up movie playback very, very slightly.
if (width == entry.w && height == entry.h && FullFormat == entry.fmt) if (width == entry.w && height == entry.h && (int) FullFormat == entry.fmt)
{ {
glBindTexture(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D, entry.texture); glBindTexture(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D, entry.texture);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
@ -344,7 +344,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
int oldWidth = width; int oldWidth = width;
int oldHeight = height; int oldHeight = height;
sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, texHash, tex_format); sprintf(texPathTemp, "%s_%08x_%i", globals->unique_id, (unsigned int) texHash, tex_format);
dfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp); dfmt = HiresTextures::GetHiresTex(texPathTemp, &width, &height, tex_format, temp);
if (dfmt != PC_TEX_FMT_NONE) if (dfmt != PC_TEX_FMT_NONE)
@ -492,7 +492,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
bCheckedDumpDir = true; bCheckedDumpDir = true;
} }
sprintf(szTemp, "%s/%s_%08x_%i.tga",szDir, uniqueId, texHash, tex_format); sprintf(szTemp, "%s/%s_%08x_%i.tga",szDir, uniqueId, (unsigned int) texHash, tex_format);
if (!File::Exists(szTemp)) if (!File::Exists(szTemp))
{ {
SaveTexture(szTemp, target, entry.texture, expandedWidth, expandedHeight); SaveTexture(szTemp, target, entry.texture, expandedWidth, expandedHeight);
@ -648,7 +648,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
{ {
_assert_(entry.texture); _assert_(entry.texture);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
if (entry.w == w && entry.h == h && entry.isRectangle && entry.fmt == copyfmt) if (entry.w == w && entry.h == h && entry.isRectangle && entry.fmt == (int) copyfmt)
{ {
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture);
// for some reason mario sunshine errors here... // for some reason mario sunshine errors here...

View File

@ -299,7 +299,6 @@ void Flush()
// finally bind // finally bind
int groupStart = 0;
if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid); if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid);
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here. if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here.