mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01:00
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:
parent
f74b5463d5
commit
154bc956ad
@ -265,11 +265,6 @@ void ProcessXEvents(void)
|
||||
{
|
||||
XNextEvent(dpy, &event);
|
||||
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:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if (key == XK_Escape)
|
||||
@ -570,8 +565,6 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Set or get the running state
|
||||
|
||||
void SetState(EState _State)
|
||||
|
@ -23,11 +23,12 @@
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include "Common.h" // Common
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "CPUDetect.h"
|
||||
#include "IniFile.h"
|
||||
#include "FileUtil.h"
|
||||
@ -475,7 +476,7 @@ bool DolphinApp::OnInit()
|
||||
|
||||
// Set main parent window
|
||||
SetTopWindow(main_frame);
|
||||
#if defined __linux__
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
XInitThreads();
|
||||
#endif
|
||||
return true;
|
||||
|
@ -36,8 +36,6 @@
|
||||
extern int frameCount;
|
||||
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".
|
||||
// The long term goal is to get rid of this class and replace it with others that make
|
||||
// more sense.
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
#include "debugger/debugger.h"
|
||||
|
||||
int s_fps=0;
|
||||
|
||||
static int s_target_width;
|
||||
static int s_target_height;
|
||||
|
||||
|
@ -84,10 +84,8 @@ void OpenGL_SetWindowText(const char *text)
|
||||
// TODO convert text to unicode and change SetWindowTextA to SetWindowText
|
||||
SetWindowTextA(EmuWindow::GetWnd(), text);
|
||||
#elif defined(HAVE_X11) && HAVE_X11 // GLX
|
||||
/**
|
||||
* Tell X to ask the window manager to set the window title. (X
|
||||
* itself doesn't provide window title functionality.)
|
||||
*/
|
||||
// Tell X to ask the window manager to set the window title. (X
|
||||
// itself doesn't provide window title functionality.)
|
||||
XStoreName(GLWin.dpy, GLWin.win, text);
|
||||
#endif
|
||||
}
|
||||
@ -562,57 +560,35 @@ void OpenGL_Update()
|
||||
// We just check all of our events here
|
||||
XEvent event;
|
||||
KeySym key;
|
||||
static bool ShiftPressed = false;
|
||||
static bool ControlPressed = false;
|
||||
static int FKeyPressed = -1;
|
||||
int num_events;
|
||||
for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) {
|
||||
XNextEvent(GLWin.dpy, &event);
|
||||
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:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if(key >= XK_F1 && key <= XK_F9)
|
||||
{
|
||||
if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask))
|
||||
FKeyPressed = 0x1b;
|
||||
g_VideoInitialize.pKeyPress(0x1b, False, False);
|
||||
else
|
||||
FKeyPressed = key - 0xff4e;
|
||||
g_VideoInitialize.pKeyPress(key - 0xff4e,
|
||||
(event.xkey.state & ShiftMask) == ShiftMask,
|
||||
(event.xkey.state & ControlMask) == ControlMask);
|
||||
}
|
||||
else if (key == XK_Escape)
|
||||
{
|
||||
if (GLWin.fs)
|
||||
{
|
||||
ToggleFullscreenMode();
|
||||
XEvent event;
|
||||
XEvent mapevent;
|
||||
do {
|
||||
XMaskEvent(GLWin.dpy, StructureNotifyMask, &event);
|
||||
} while ( (event.type != MapNotify) || (event.xmap.event != GLWin.win) );
|
||||
XMaskEvent(GLWin.dpy, StructureNotifyMask, &mapevent);
|
||||
} 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))
|
||||
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;
|
||||
case FocusIn:
|
||||
if (g_Config.bHideCursor)
|
||||
|
@ -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 ||
|
||||
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);
|
||||
lastPSconstants[const_number][0] = f1;
|
||||
lastPSconstants[const_number][1] = f2;
|
||||
|
@ -74,6 +74,8 @@
|
||||
|
||||
// Declarations and definitions
|
||||
// ----------------------------
|
||||
int s_fps=0;
|
||||
|
||||
CGcontext g_cgcontext;
|
||||
CGprofile g_cgvProf;
|
||||
CGprofile g_cgfProf;
|
||||
|
@ -361,7 +361,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_srcTexture);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
u64 texHash;
|
||||
u32 FullFormat = tex_format;
|
||||
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 ((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)
|
||||
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;
|
||||
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,
|
||||
// instead of destroying it and having to create a new one.
|
||||
// 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);
|
||||
GL_REPORT_ERRORD();
|
||||
@ -344,7 +344,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
int oldWidth = width;
|
||||
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);
|
||||
|
||||
if (dfmt != PC_TEX_FMT_NONE)
|
||||
@ -492,7 +492,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
||||
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))
|
||||
{
|
||||
SaveTexture(szTemp, target, entry.texture, expandedWidth, expandedHeight);
|
||||
@ -648,7 +648,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
|
||||
{
|
||||
_assert_(entry.texture);
|
||||
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);
|
||||
// for some reason mario sunshine errors here...
|
||||
|
@ -299,7 +299,6 @@ void Flush()
|
||||
|
||||
// finally bind
|
||||
|
||||
int groupStart = 0;
|
||||
if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid);
|
||||
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user