mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
delete some junk from gl's main.cpp. fix potential crash if number of resolutions > 100 (hey, it may help someone in 2050 or so when we have 1Mx1M displays)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2334 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
98a86325ce
commit
731dec6889
@ -53,7 +53,6 @@
|
||||
#include "VideoState.h"
|
||||
///////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Definitions
|
||||
// --------------------------
|
||||
@ -64,15 +63,6 @@ PLUGIN_GLOBALS* globals;
|
||||
int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
|
||||
///////////////////////////////////////////////
|
||||
|
||||
|
||||
/* Create debugging window. There's currently a strange crash that occurs whe a game is loaded
|
||||
if the OpenGL plugin was loaded before. I'll try to fix that. Currently you may have to
|
||||
clsoe the window if it has auto started, and then restart it after the dll has loaded
|
||||
for the purpose of the game. At that point there is no need to use the same dll instance
|
||||
as the one that is rendering the game. However, that could be done.
|
||||
|
||||
Update: This crash seems to be gone for now. */
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
void DllDebugger(HWND _hParent, bool Show)
|
||||
{
|
||||
@ -101,26 +91,25 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
wxWindow *win = new wxWindow();
|
||||
win->SetHWND((WXHWND)_hParent);
|
||||
win->AdoptAttributesFromHWND();
|
||||
// win->Reparent(wxGetApp().GetTopWindow());
|
||||
|
||||
ConfigDialog *frame = new ConfigDialog(win);
|
||||
ConfigDialog *config_dialog = new ConfigDialog(win);
|
||||
|
||||
DWORD iModeNum = 0;
|
||||
DEVMODE dmi;
|
||||
ZeroMemory(&dmi, sizeof(dmi));
|
||||
dmi.dmSize = sizeof(dmi);
|
||||
std::string resos[100];
|
||||
std::vector<std::string> resos;
|
||||
resos.reserve(20);
|
||||
int i = 0;
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
@ -141,39 +130,41 @@ void DllConfig(HWND _hParent)
|
||||
b++;
|
||||
}
|
||||
// Add the resolution
|
||||
if (!resFound)
|
||||
if (!resFound && i < 100) // don't want to overflow resos array. not likely to happen, but you never know.
|
||||
{
|
||||
resos[i] = strBuffer;
|
||||
resos.push_back(strBuffer);
|
||||
i++;
|
||||
frame->AddFSReso(szBuffer);
|
||||
frame->AddWindowReso(szBuffer);
|
||||
config_dialog->AddFSReso(szBuffer);
|
||||
config_dialog->AddWindowReso(szBuffer);
|
||||
}
|
||||
ZeroMemory(&dmi, sizeof(dmi));
|
||||
}
|
||||
|
||||
// Check if at least one resolution was found. If we don't and the resolution array is empty
|
||||
// CreateGUIControls() will crash because the array is empty.
|
||||
if (frame->arrayStringFor_FullscreenCB.size() == 0)
|
||||
if (config_dialog->arrayStringFor_FullscreenCB.size() == 0)
|
||||
{
|
||||
frame->AddFSReso("<No resolutions found>");
|
||||
frame->AddWindowReso("<No resolutions found>");
|
||||
config_dialog->AddFSReso("<No resolutions found>");
|
||||
config_dialog->AddWindowReso("<No resolutions found>");
|
||||
}
|
||||
// ----------------------------
|
||||
|
||||
// Create the controls and show the window
|
||||
frame->CreateGUIControls();
|
||||
frame->Show();
|
||||
config_dialog->CreateGUIControls();
|
||||
config_dialog->Show();
|
||||
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
|
||||
ConfigDialog frame(NULL);
|
||||
// Hm, why does this code show it modally?
|
||||
config_dialog = new ConfigDialog(NULL);
|
||||
g_Config.Load();
|
||||
frame.ShowModal();
|
||||
config_dialog->ShowModal();
|
||||
delete config_dialog;
|
||||
config_dialog = NULL;
|
||||
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\
|
||||
HAVE_XXF86VM && defined(HAVE_WX) && HAVE_WX
|
||||
|
||||
ConfigDialog frame(NULL);
|
||||
ConfigDialog config_dialog(NULL);
|
||||
g_Config.Load();
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
@ -197,35 +188,22 @@ void DllConfig(HWND _hParent)
|
||||
{
|
||||
char temp[32];
|
||||
sprintf(temp,"%dx%d", modes[i]->hdisplay, modes[i]->vdisplay);
|
||||
frame.AddFSReso(temp);
|
||||
frame.AddWindowReso(temp);//Add same to Window ones, since they should be nearly all that's needed
|
||||
config_dialog.AddFSReso(temp);
|
||||
config_dialog.AddWindowReso(temp);//Add same to Window ones, since they should be nearly all that's needed
|
||||
px = modes[i]->hdisplay;//Used to remove repeating from different screen depths
|
||||
py = modes[i]->vdisplay;
|
||||
}
|
||||
}
|
||||
}
|
||||
XFree(modes);
|
||||
frame.ShowModal();
|
||||
|
||||
// Hm, why does this code show it modally?
|
||||
config_dialog.ShowModal();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Initialize(void *init)
|
||||
{
|
||||
//Console::Open(130, 5000);
|
||||
|
||||
// --------------------------------------------------
|
||||
/* Dolphin currently crashes if the dll is loaded when a game is started so we close the
|
||||
debugger and open it again after loading
|
||||
|
||||
Status: Currently it's working so no need for this */
|
||||
/*
|
||||
if(m_frame)
|
||||
{
|
||||
m_frame->EndModal(0); wxEntryCleanup();
|
||||
}//use wxUninitialize() if you don't want GUI
|
||||
*/
|
||||
// --------------------------------------------------
|
||||
|
||||
frameCount = 0;
|
||||
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
|
||||
g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it
|
||||
@ -238,6 +216,7 @@ void Initialize(void *init)
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
||||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||
|
||||
@ -248,17 +227,6 @@ void Initialize(void *init)
|
||||
}
|
||||
|
||||
void DoState(unsigned char **ptr, int mode) {
|
||||
//#ifdef _WIN32
|
||||
// What is this code doing here?
|
||||
// if (!wglMakeCurrent(hDC,hRC)) {
|
||||
// PanicAlert("Can't Activate The GL Rendering Context for saving");
|
||||
// return;
|
||||
// }
|
||||
//#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
// cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
|
||||
//#elif defined(HAVE_X11) && HAVE_X11
|
||||
// glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||
//#endif
|
||||
#ifndef _WIN32
|
||||
// WHY is this here??
|
||||
OpenGL_MakeCurrent();
|
||||
@ -346,7 +314,7 @@ void DebugLog(const char* _fmt, ...)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ScreenShot(TCHAR *File)
|
||||
unsigned int Video_Screenshot(TCHAR* _szFilename)
|
||||
{
|
||||
char str[64];
|
||||
int left = 200, top = 15;
|
||||
@ -357,23 +325,16 @@ bool ScreenShot(TCHAR *File)
|
||||
Renderer::RenderText(str, left, top, 0xffc0ffff);
|
||||
Renderer::RestoreGLState();
|
||||
|
||||
if (Renderer::SaveRenderTarget(File, 0)) {
|
||||
if (Renderer::SaveRenderTarget(_szFilename, 0))
|
||||
{
|
||||
char msg[255];
|
||||
sprintf(msg, "saved %s\n", File);
|
||||
sprintf(msg, "saved %s\n", _szFilename);
|
||||
Renderer::AddMessage(msg, 500);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int Video_Screenshot(TCHAR* _szFilename)
|
||||
{
|
||||
if (ScreenShot(_szFilename))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Video_UpdateXFB(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset, bool scheduling)
|
||||
{
|
||||
if (g_Config.bUseXFB && XFB_isInit())
|
||||
|
Loading…
Reference in New Issue
Block a user