nakee's work on dolphin events. Also get wxw out of logmanager. This commit wants your comments

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1875 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2009-01-15 06:48:15 +00:00
parent aced3c00fd
commit ba8c2aa7e4
83 changed files with 1293 additions and 1657 deletions

View File

@ -98,7 +98,7 @@ void OpenGL_SetSize(u32 width, u32 height) {
}
void OpenGL_SetWindowText(const char *text)
void OpenGL_SetWindowText(const char *text)
{
#if USE_SDL
SDL_WM_SetCaption(text, NULL);
@ -113,7 +113,7 @@ void OpenGL_SetWindowText(const char *text)
* 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);
XStoreName(GLWin.dpy, GLWin.win, text);
#endif
}
@ -130,7 +130,7 @@ unsigned int Callback_PeekMessages()
DispatchMessage(&msg);
}
return TRUE;
#else
#else
return FALSE;
#endif
}
@ -147,7 +147,7 @@ void UpdateFPSDisplay(const char *text)
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
// ------------------
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
{
// --------------------------------------------
// Check for fullscreen mode
@ -238,12 +238,12 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
wxSize size(_iwidth, _iheight);
if (!g_Config.renderToMainframe ||
if (!g_Config.renderToMainframe ||
g_VideoInitialize.pWindowHandle == NULL) {
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
-1, _("Dolphin"), wxPoint(0,0), size);
} else {
GLWin.frame = new wxFrame((wxWindow *)NULL,
GLWin.frame = new wxFrame((wxWindow *)NULL,
-1, _("Dolphin"), wxPoint(0,0), size);
}
GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args,
@ -280,7 +280,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
g_VideoInitialize.pSysMessage("failed to create window");
return false;
}
GLuint PixelFormat; // Holds The Results After Searching For A Match
DWORD dwExStyle; // Window Extended Style
DWORD dwStyle; // Window Style
@ -387,18 +387,18 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
// attributes for a single buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
None};
// attributes for a double buffered visual in RGBA format with at least
// attributes for a double buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None };
GLWin.dpy = XOpenDisplay(0);
@ -563,7 +563,7 @@ bool OpenGL_MakeCurrent()
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
ERROR_LOG("GLWin Depth %d", GLWin.depth);
if (glXIsDirect(GLWin.dpy, GLWin.ctx))
if (glXIsDirect(GLWin.dpy, GLWin.ctx))
ERROR_LOG("you have Direct Rendering!");
else
ERROR_LOG("no Direct Rendering possible!");
@ -657,10 +657,10 @@ void OpenGL_Update()
break;
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9)
if(key >= XK_F1 && key <= XK_F9)
FKeyPressed = key - 0xff4e;
else {
if(key == XK_Shift_L || key == XK_Shift_R)
if(key == XK_Shift_L || key == XK_Shift_R)
ShiftPressed = true;
else if(key == XK_Control_L || key == XK_Control_R)
ControlPressed = true;
@ -685,8 +685,8 @@ void OpenGL_Update()
rcWindow.bottom = GLWin.height;
break;
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though
Video_Shutdown(); // Calling from here since returning false does nothing
return;
Shutdown(); // Calling from here since returning false does nothing
return;
break;
default:
//TODO: Should we put the event back if we don't handle it?
@ -709,7 +709,7 @@ void OpenGL_Update()
// ------------------
/* MValueX and MValueY will be used in
TextureMngr and VertexShaderManager: Rescale textures on resolution changes
BPStructs.cpp: Control glScissor()
BPStructs.cpp: Control glScissor()
*/
// ------------------
float FactorW = 640.0f / (float)nBackbufferWidth;
@ -731,7 +731,7 @@ void OpenGL_Update()
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
}
// tell the debugger
gleft = rcWindow.left; gright = rcWindow.right;
gtop = rcWindow.top; gbottom = rcWindow.bottom;

View File

@ -8,9 +8,9 @@
#include "Config.h"
#include "pluginspecs_video.h"
#include <GL/glew.h>
#include <GLew/glew.h>
#if defined(__APPLE__)
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
@ -38,16 +38,17 @@ class GLWindow {
protected:
res origRes, currFullRes, currWinRes;
EventHandler* eventHandler;
res origRes, currFullRes, currWinRes;
std::vector<res> fullResolutions;
std::vector<res> winResolutions;
virtual void SetRender(u32 x, u32 y) {
xRender = x;
yRender = y;
}
public:
virtual void SwapBuffers() {};
virtual void SetWindowText(const char *text) {};
virtual bool PeekMessages() {return false;};
@ -55,15 +56,15 @@ public:
virtual bool MakeCurrent() {return false;};
virtual void updateDim() {
if (GetProperty(OGL_FULLSCREEN))
if (GetProperty(OGL_FULLSCREEN))
SetWinSize(currFullRes.x, currFullRes.y);
else
SetWinSize(currWinRes.x, currWinRes.y);
float FactorX = 640.0f / (float)GetXwin();
float FactorY = 480.0f / (float)GetYwin();
float Max = (FactorX < FactorY) ? FactorX : FactorY;
if(GetProperty(OGL_STRETCHTOFIT)) {
SetMax(1.0f / FactorX, 1.0f / FactorY);
SetOffset(0,0);
@ -74,8 +75,9 @@ public:
}
}
bool GetProperty(OGL_Props prop) {return properties[prop];}
virtual bool SetProperty(OGL_Props prop, bool value)
void SetEventHandler(EventHandler *eh) { eventHandler = eh;}
bool GetProperty(OGL_Props prop) {return properties[prop];}
virtual bool SetProperty(OGL_Props prop, bool value)
{return properties[prop] = value;}
u32 GetXrender() {return xRender;}
@ -84,8 +86,8 @@ public:
u32 GetXwin() {return xWin;}
u32 GetYwin() {return yWin;}
void SetWinSize(u32 x, u32 y) {
xWin = x;
yWin = y;
xWin = x;
yWin = y;
}
int GetYoff() {return yOffset;}
@ -102,16 +104,16 @@ public:
float GetXmax() {return xMax;}
float GetYmax() {return yMax;}
static bool valid() { return false;}
GLWindow() {
// Load defaults
sscanf(g_Config.iFSResolution, "%dx%d",
sscanf(g_Config.iFSResolution, "%dx%d",
&currFullRes.x, &currFullRes.y);
sscanf(g_Config.iWindowedRes, "%dx%d",
sscanf(g_Config.iWindowedRes, "%dx%d",
&currWinRes.x, &currWinRes.y);
SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen);

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
# can we import path in one place?
@ -47,7 +47,7 @@ else:
files += [
'main.cpp',
'GLUtil.cpp',
]
]
if gfxenv['HAVE_WX']:
files += [
'GUI/ConfigDlg.cpp',
@ -79,11 +79,11 @@ if sys.platform == 'darwin':
Return()
else:
if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')):
if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')):
print name + " must have opengl and glu to be build"
Return()
if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'):
if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'):
print name + " must have cg and cggl to be build"
Return()
@ -101,7 +101,7 @@ conf.Finish()
if gfxenv['GLTEST']:
if gfxenv['HAVE_XXF86VM']:
files += [
files += [
'X11Window.cpp',
]

View File

@ -1,7 +1,5 @@
#include "X11Window.h"
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
X11Window::X11Window() : GLWindow() {
XVisualInfo *vi;
@ -175,7 +173,6 @@ bool X11Window::PeekMessages() {
// Taken from sfml code
void X11Window::ProcessEvent(XEvent WinEvent) {
// static EventHandler *eventHandler = EventHandler::GetInstance();
switch (WinEvent.type) {
case KeyPress :

View File

@ -69,7 +69,7 @@ void DllDebugger(HWND _hParent, bool Show)
{
m_frame->DoShow();
}
else if(!m_frame && Show)
else if(!m_frame && Show)
{
m_frame = new CDebugger(NULL);
m_frame->Show();
@ -91,11 +91,11 @@ void DoDllDebugger() { }
#endif
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)");
#else
#ifndef _DEBUG
@ -125,9 +125,9 @@ void DllConfig(HWND _hParent)
dmi.dmSize = sizeof(dmi);
std::string resos[100];
int i = 0;
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{
{
char szBuffer[100];
sprintf(szBuffer,"%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
std::string strBuffer(szBuffer);
@ -157,9 +157,9 @@ void DllConfig(HWND _hParent)
g_Config.Load();
frame.ShowModal();
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\
HAVE_XXF86VM && defined(HAVE_WX) && HAVE_WX
ConfigDialog frame(NULL);
g_Config.Load();
int glxMajorVersion, glxMinorVersion;
@ -176,9 +176,9 @@ void DllConfig(HWND _hParent)
bestMode = 0;
XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes);
int px = 0, py = 0;
if (modeNum > 0 && modes != NULL)
if (modeNum > 0 && modes != NULL)
{
for (int i = 0; i < modeNum; i++)
for (int i = 0; i < modeNum; i++)
{
if(px != modes[i]->hdisplay && py != modes[i]->vdisplay)
{
@ -200,11 +200,8 @@ void DllConfig(HWND _hParent)
//////////////////////////////////////////////////////////////////////////////////////////
// Initialize video
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Video_Initialize(SVideoInitialize* _pVideoInitialize)
void Initialize(void *init)
{
// When will this happen?
if (_pVideoInitialize == NULL) return;
// --------------------------------------------------
/* Dolphin currently crashes if the dll is loaded when a game is started so we close the
debugger and open it again after loading
@ -214,12 +211,13 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
if(m_frame)
{
m_frame->EndModal(0); wxEntryCleanup();
}//use wxUninitialize() if you don't want GUI
}//use wxUninitialize() if you don't want GUI
*/
// --------------------------------------------------
// --------------------------------------------------
frameCount = 0;
g_VideoInitialize = *_pVideoInitialize; // Create a shortcut to _pVideoInitialize that can also update it
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it
InitLUTs();
InitXFBConvTables();
g_Config.Load();
@ -238,7 +236,7 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
Renderer::AddMessage("Dolphin OpenGL Video Plugin" ,5000);
}
void Video_DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode) {
//#ifdef _WIN32
// What is this code doing here?
// if (!wglMakeCurrent(hDC,hRC)) {
@ -249,7 +247,7 @@ void Video_DoState(unsigned char **ptr, int mode) {
// cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
//#elif defined(HAVE_X11) && HAVE_X11
// glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
//#endif
//#endif
#ifndef _WIN32
// WHY is this here??
OpenGL_MakeCurrent();
@ -293,7 +291,7 @@ void Video_Prepare(void)
TextureConverter::Init();
}
void Video_Shutdown(void)
void Shutdown(void)
{
TextureConverter::Shutdown();
VertexLoaderManager::Shutdown();
@ -309,7 +307,7 @@ void Video_Shutdown(void)
OpenGL_Shutdown();
}
void Video_Stop(void)
void Video_Stop(void)
{
Fifo_Stop();
}
@ -334,7 +332,7 @@ void DebugLog(const char* _fmt, ...)
#endif
}
bool ScreenShot(TCHAR *File)
bool ScreenShot(TCHAR *File)
{
char str[64];
int left = 200, top = 15;

View File

@ -67,6 +67,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize,
if (! glWin)
return false;
glWin->SetEventHandler((EventHandler *)globals->eventHandler);
return true;
}