This is an automated email from the git hooks/post-receive script. ecsv-guest pushed a commit to branch experimental in repository wxmupen64plus.
commit 0b7dfd42955fcd9d8e4527514a6bdfd87943be06 Author: Sven Eckelmann <[email protected]> Date: Mon May 16 19:20:33 2011 +0200 Imported Upstream version 0.1+20110516 --- gamespanel.cpp | 30 ++++++++-- gamespanel.h | 1 + main.cpp | 25 ++++++--- mupen64plusplus/MupenAPIpp.cpp | 14 ++--- mupen64plusplus/MupenAPIpp.h | 7 ++- wscript | 5 +- wxMupen64Plus.mk | 8 +-- wxvidext.cpp | 125 +++++++++++++++++++++++++++++++++++++---- wxvidext.h | 2 + 9 files changed, 177 insertions(+), 40 deletions(-) diff --git a/gamespanel.cpp b/gamespanel.cpp index 38c6a12..a52fb18 100644 --- a/gamespanel.cpp +++ b/gamespanel.cpp @@ -43,6 +43,7 @@ #include <wx/statbmp.h> #include <wx/frame.h> #include <wx/glcanvas.h> +#include <wx/display.h> #include <stdexcept> #include <map> @@ -318,11 +319,11 @@ void GamesPanel::populateList() void GamesPanel::initGLCanvas() { Freeze(); - m_item_list->Hide(); - m_dir_picker->Hide(); m_canvas = VidExt_InitGLCanvas(m_center_panel); if (m_canvas != NULL) { + m_item_list->Hide(); + m_dir_picker->Hide(); m_list_sizer->Add(m_canvas, 1, wxEXPAND | wxALL, 5); m_list_sizer->SetSizeHints(m_canvas); m_center_panel->Layout(); @@ -345,6 +346,7 @@ void GamesPanel::initGLCanvas() void GamesPanel::cleanGLCanvas() { + VidExt_AsyncCleanup(); if (m_canvas) { Freeze(); @@ -442,6 +444,7 @@ void GamesPanel::onPlay(wxCommandEvent& evt) m_width_param = config[n]->getParamWithName("ScreenWidth"); m_height_param = config[n]->getParamWithName("ScreenHeight"); + m_fullscreen_param = config[n]->getParamWithName("Fullscreen"); break; } } @@ -455,9 +458,26 @@ void GamesPanel::onPlay(wxCommandEvent& evt) m_previous_width = m_width_param->getIntValue(); m_previous_height = m_height_param->getIntValue(); - // maximize (but keep aspect ratio) - m_width_param->setIntValue(m_center_panel->GetSize().GetHeight()*1.33f); - m_height_param->setIntValue(m_center_panel->GetSize().GetHeight()); + if (m_fullscreen_param->getBoolValue()) + { + int displayID = wxDisplay::GetFromWindow( wxGetApp().GetTopWindow() ); + if (displayID == wxNOT_FOUND) + { + wxMessageBox( _("An internal error occurred : can't determine on which display the frame is") ); + return; + } + wxDisplay display(displayID); + + // maximize (but keep aspect ratio) + m_width_param->setIntValue(display.GetGeometry().GetHeight()*1.33f); + m_height_param->setIntValue(display.GetGeometry().GetHeight()); + } + else + { + // maximize (but keep aspect ratio) + m_width_param->setIntValue(m_center_panel->GetSize().GetHeight()*1.33f); + m_height_param->setIntValue(m_center_panel->GetSize().GetHeight()); + } } long item = m_item_list->GetNextItem(-1, diff --git a/gamespanel.h b/gamespanel.h index c26fb67..87da941 100644 --- a/gamespanel.h +++ b/gamespanel.h @@ -51,6 +51,7 @@ class GamesPanel : public wxPanel, public IConfigurationPanel, public IEmuStateL int m_previous_width, m_previous_height; ConfigParam* m_width_param; ConfigParam* m_height_param; + ConfigParam* m_fullscreen_param; /** Callback to sort the list */ static int wxCALLBACK wxListCompareFunction(long item1, long item2, wxIntPtr sortData); diff --git a/main.cpp b/main.cpp index 917c6c1..4409182 100644 --- a/main.cpp +++ b/main.cpp @@ -28,6 +28,7 @@ #include <wx/filedlg.h> #include <wx/html/htmlwin.h> #include <wx/progdlg.h> +#include <wx/artprov.h> #include "mupen64plusplus/MupenAPI.h" #include "mupen64plusplus/MupenAPIpp.h" @@ -43,6 +44,11 @@ #include <algorithm> #include "sdlhelper.h" +#ifdef __WXGTK__ +#include <Xlib.h> +//int XInitThreads(); +#endif + const bool g_Verbose = false; const char* DEFAULT_VIDEO_PLUGIN = "mupen64plus-video-rice"; @@ -93,6 +99,10 @@ int main(int argc, char** argv) { wxDISABLE_DEBUG_SUPPORT(); +#ifdef __WXGTK__ + XInitThreads(); +#endif + MupenFrontendApp* app = new MupenFrontendApp(); wxApp::SetInstance(app); return wxEntry(argc, argv); @@ -182,6 +192,7 @@ bool MupenFrontendApp::OnInit() } // end while m_frame = new wxFrame(NULL, -1, "Mupen64Plus", wxDefaultPosition, wxSize(1024, 640)); + SetTopWindow(m_frame); wxInitAllImageHandlers(); if (not makeToolbar(plugins, 0)) return false; @@ -676,13 +687,13 @@ bool MupenFrontendApp::makeToolbar(int plugins, int selectedSection) m_frame->SetIcon( icon_mupen ); #endif - assert(icon_mupen.IsOk()); - assert(icon_input.IsOk()); - assert(icon_cpu.IsOk()); - assert(icon_audio.IsOk()); - assert(icon_plugins.IsOk()); - assert(icon_video.IsOk()); - assert(icon_other.IsOk()); + if (not icon_mupen.IsOk()) icon_mupen = wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, wxSize(32,32)); + if (not icon_input.IsOk()) icon_input = wxArtProvider::GetBitmap(wxART_ERROR, wxART_OTHER, wxSize(32,32)); + if (not icon_cpu.IsOk()) icon_cpu = wxArtProvider::GetBitmap(wxART_ERROR, wxART_OTHER, wxSize(32,32)); + if (not icon_audio.IsOk()) icon_audio = wxArtProvider::GetBitmap(wxART_ERROR, wxART_OTHER, wxSize(32,32)); + if (not icon_plugins.IsOk()) icon_plugins = wxArtProvider::GetBitmap(wxART_ERROR, wxART_OTHER, wxSize(32,32)); + if (not icon_video.IsOk()) icon_video = wxArtProvider::GetBitmap(wxART_ERROR, wxART_OTHER, wxSize(32,32)); + if (not icon_other.IsOk()) icon_other = wxArtProvider::GetBitmap(wxART_ERROR, wxART_OTHER, wxSize(32,32)); wxToolBarToolBase* t = m_toolbar->AddRadioTool(wxID_ANY, _("Games"), icon_mupen, icon_mupen); m_toolbar_items.push_back(GraphicalSection::createGamesSection(t)); diff --git a/mupen64plusplus/MupenAPIpp.cpp b/mupen64plusplus/MupenAPIpp.cpp index d9b4656..b2fe902 100644 --- a/mupen64plusplus/MupenAPIpp.cpp +++ b/mupen64plusplus/MupenAPIpp.cpp @@ -288,13 +288,13 @@ void Mupen64PlusPlus::loadRom(wxString filename, bool attachPlugins, wxProgressD const int rom_size = thefile.Length() + 1024*2 /* in case the OS reports the size inaccurately */; char* rom_buf = new char[rom_size]; wxMemoryOutputStream memoryImage(rom_buf, rom_size); -//#ifdef __WXMSW__ + + int total = 0; + { const int BUFFER_SIZE = 1024*20; char buffer[BUFFER_SIZE]; size_t size; - - int total = 0; int t = 0; //printf("Will read ROM\n"); @@ -302,7 +302,6 @@ void Mupen64PlusPlus::loadRom(wxString filename, bool attachPlugins, wxProgressD { size = input.Read(buffer, BUFFER_SIZE).LastRead(); - total += size; t++; if (t > 100) @@ -325,16 +324,11 @@ void Mupen64PlusPlus::loadRom(wxString filename, bool attachPlugins, wxProgressD } while (size > 0 and not input.Eof() and input.IsOk() and input.CanRead()); } -//#else -// input.Read(memoryImage); -//#endif - -// if (dialog != NULL) dialog->Update(50); wxStreamBuffer* buffer = memoryImage.GetOutputStreamBuffer(); m_curr_rom_size = buffer->GetBufferSize(); - m64p_error result = ::openRom(buffer->GetBufferSize(), buffer->GetBufferStart()); + m64p_error result = ::openRom(total, buffer->GetBufferStart()); delete[] rom_buf; diff --git a/mupen64plusplus/MupenAPIpp.h b/mupen64plusplus/MupenAPIpp.h index 66f6a95..70f7b05 100644 --- a/mupen64plusplus/MupenAPIpp.h +++ b/mupen64plusplus/MupenAPIpp.h @@ -436,8 +436,13 @@ public: * @return same as Mupen64PlusPlus::loadPlugins */ int reloadPlugins(); - + + // TODO: make it configurable whether to use video extension +#ifdef __WXGTK__ + bool useVideoExtension() { return false; } +#else bool useVideoExtension() { return true; } +#endif }; #endif diff --git a/wscript b/wscript index 40d8e9d..3f56a79 100644 --- a/wscript +++ b/wscript @@ -144,8 +144,11 @@ def build(bld): else: # For other unices + build_flags += ['-I/usr/include/X11'] osal_src += ['mupen64plusplus/osal_dynamiclib_unix.c', 'mupen64plusplus/osal_files_unix.c'] - link_flags += ['-lGL', '-ldl'] + link_flags += ['-lGL', '-ldl', '-lX11'] + + link_flags += ['-ldl'] # install target data_dir = bld.path.find_dir('data') diff --git a/wxMupen64Plus.mk b/wxMupen64Plus.mk index b4690a7..6287621 100644 --- a/wxMupen64Plus.mk +++ b/wxMupen64Plus.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=mmg -Date :=04/30/11 +Date :=05/09/11 CodeLitePath :="/Users/mmg/Library/Application Support/codelite" LinkerName :=g++ ArchiveTool :=ar rcus @@ -37,9 +37,9 @@ ArchiveOutputSwitch := PreprocessOnlySwitch :=-E ObjectsFileList :="/Users/mmg/Workspace_CL/wxMupen64Plus/wxMupen64Plus.txt" MakeDirCommand :=mkdir -p -CmpOptions :=-Wall -g $(shell /usr/local/bin/wx-config-2.9 --cxxflags --unicode=yes --debug=yes core,base,gl) -arch i386 $(shell /usr/local/bin/sdl-config --cflags) -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk $(Preprocessors) -C_CmpOptions :=-Wall -g $(shell /usr/local/bin/wx-config-2.9 --cxxflags --unicode=yes --debug=yes core,base,gl) -arch i386 $(shell /usr/local/bin/sdl-config --cflags) -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk $(Preprocessors) -LinkOptions := -mwindows $(shell /usr/local/bin/wx-config-2.9 --debug=yes --unicode=yes --libs core,base,gl,html) -arch i386 $(shell /usr/local/bin/sdl-config --libs) -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk +CmpOptions :=-Wall -g $(shell /usr/local/bin/wx-config-2.9 --cxxflags --unicode=yes --debug=yes) -arch i386 $(shell /usr/local/bin/sdl-config --cflags) -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk $(Preprocessors) +C_CmpOptions :=-Wall -g $(shell /usr/local/bin/wx-config-2.9 --cxxflags --unicode=yes --debug=yes) -arch i386 $(shell /usr/local/bin/sdl-config --cflags) -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk $(Preprocessors) +LinkOptions := -mwindows $(shell /usr/local/bin/wx-config-2.9 --debug=yes --libs --unicode=yes) -arch i386 $(shell /usr/local/bin/sdl-config --libs) -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk IncludePath := $(IncludeSwitch). $(IncludeSwitch)/Developer/hg/mupen64plus/mupen64plus-core/src/api $(IncludeSwitch)/Developer/hg/mupen64plus/mupen64plus-core/src RcIncludePath := Libs := diff --git a/wxvidext.cpp b/wxvidext.cpp index 0100e76..9ad4a46 100644 --- a/wxvidext.cpp +++ b/wxvidext.cpp @@ -264,8 +264,15 @@ int BasicGLPane::getHeight() return GetSize().y; } -//wxFrame* frame = NULL; BasicGLPane* glPane = NULL; + +wxDialog* fullscreen_frame = NULL; + +#ifdef __WXMAC__ +// work around wx bug +wxFrame* fullscreen_helper_frame = NULL; +#endif + bool fullscreen = false; bool doublebuffer = true; @@ -286,6 +293,7 @@ m64p_error VidExt_Init() m64p_error VidExt_Quit() { printf(">>>>>>>>>>>> WX: VidExt_Quit\n"); + wxCommandEvent evt(wxMUPEN_CLEAN_GL_CANVAS, -1); wxGetApp().AddPendingEvent(evt); /* @@ -301,6 +309,24 @@ m64p_error VidExt_Quit() return M64ERR_SUCCESS; } +void VidExt_AsyncCleanup() +{ + if (fullscreen_frame != NULL) + { +#ifdef __WXMAC__ + fullscreen_helper_frame->ShowFullScreen(false); + fullscreen_helper_frame->Destroy(); + fullscreen_helper_frame = NULL; +#endif + +#ifndef __WXMAC__ + fullscreen_frame->ShowFullScreen(false); +#endif + fullscreen_frame->Destroy(); + fullscreen_frame = NULL; + } +} + m64p_error VidExt_ListFullscreenModes(m64p_2d_size *SizeArray, int *NumSizes) { printf(">>>>>>>>>>>> WX: VidExt_ListFullscreenModes\n"); @@ -410,12 +436,17 @@ wxGLCanvas* VidExt_InitGLCanvas(wxWindow* parent) WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing) WX_GL_SAMPLES // 4 for 2x2 antialising supersampling on most graphics cards */ - - // TODO: make more parameters configurable? + +#ifdef __WXGTK__ + // Mr Linux is more picky (at least for me, I guess YMMV) + int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0}; +#else + // TODO: make more parameters configurable? int args[] = {WX_GL_RGBA, WX_GL_BUFFER_SIZE, buffersize, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, depthsize, /*WX_GL_MIN_RED, redsize, WX_GL_MIN_GREEN, greensize, WX_GL_MIN_BLUE, bluesize,*/ 0}; - +#endif + if (not wxGLCanvas::IsDisplaySupported(args)) { wxMessageBox( _("Sorry, your system does not support the selected video configuration") ); @@ -425,12 +456,22 @@ wxGLCanvas* VidExt_InitGLCanvas(wxWindow* parent) if (fullscreen) { - wxFrame* frame = new wxFrame(NULL, wxID_ANY, "Mupen64Plus", wxDefaultPosition, wxDefaultSize, - wxSYSTEM_MENU | wxFRAME_FLOAT_ON_PARENT | wxFRAME_TOOL_WINDOW); - glPane = new BasicGLPane(frame, args); - frame->Maximize(); - //frame->ShowFullScreen(true, wxFULLSCREEN_NOMENUBAR); - frame->Show(); +#ifdef __WXMAC__ + fullscreen_helper_frame = new wxFrame(NULL, wxID_ANY, "Mupen64Plus"); + fullscreen_helper_frame->ShowFullScreen(true, wxFULLSCREEN_NOMENUBAR); +#endif + + fullscreen_frame = new wxDialog(NULL, wxID_ANY, "Mupen64Plus", wxDefaultPosition, wxDefaultSize, + wxSTAY_ON_TOP);//wxSYSTEM_MENU | wxFRAME_FLOAT_ON_PARENT | wxFRAME_TOOL_WINDOW); + glPane = new BasicGLPane(fullscreen_frame, args); + +#ifdef __WXMAC__ + fullscreen_frame->Maximize(); + fullscreen_frame->Show(); +#else + fullscreen_frame->ShowFullScreen(true, wxFULLSCREEN_NOMENUBAR); +#endif + glPane->SetFocus(); return NULL; } else @@ -581,8 +622,68 @@ void* VidExt_GL_GetProcAddress(const char* Proc) out = (void*)glXGetProcAddress((const GLubyte*)Proc); #else - // FIXME: silly way to fix VidExt_GL_GetProcAddress - if (strcmp(Proc, "glActiveTexture") == 0) + // FIXME: silly way to fix VidExt_GL_GetProcAddress on OSX + if (strcmp(Proc, "glClientActiveTextureARB") == 0) + { + out = (void*)&glClientActiveTextureARB; + } + else if (strcmp(Proc, "glCombinerParameterfvNV") == 0) + { + out = (void*)&glCombinerParameterfvNV; + } + else if (strcmp(Proc, "glFinalCombinerInputNV") == 0) + { + out = (void*)&glFinalCombinerInputNV; + } + else if (strcmp(Proc, "glCombinerOutputNV") == 0) + { + out = (void*)&glCombinerOutputNV; + } + else if (strcmp(Proc, "glCombinerInputNV") == 0) + { + out = (void*)&glCombinerInputNV; + } + else if (strcmp(Proc, "glCombinerParameteriNV") == 0) + { + out = (void*)&glCombinerParameteriNV; + } + else if (strcmp(Proc, "glActiveTextureARB") == 0) + { + out = (void*)&glActiveTextureARB; + } + else if (strcmp(Proc, "glMultiTexCoord2f") == 0) + { + out = (void*)&glMultiTexCoord2f; + } + else if (strcmp(Proc, "glMultiTexCoord2fv") == 0) + { + out = (void*)&glMultiTexCoord2fv; + } + else if (strcmp(Proc, "glDeleteProgramsARB") == 0) + { + out = (void*)&glDeleteProgramsARB; + } + else if (strcmp(Proc, "glProgramStringARB") == 0) + { + out = (void*)&glProgramStringARB; + } + else if (strcmp(Proc, "glBindProgramARB") == 0) + { + out = (void*)&glBindProgramARB; + } + else if (strcmp(Proc, "glGenProgramsARB") == 0) + { + out = (void*)&glGenProgramsARB; + } + else if (strcmp(Proc, "glProgramEnvParameter4fvARB") == 0) + { + out = (void*)&glProgramEnvParameter4fvARB; + } + else if (strcmp(Proc, "glFogCoordPointerEXT") == 0) + { + out = (void*)&glFogCoordPointerEXT; + } + else if (strcmp(Proc, "glActiveTexture") == 0) { out = (void*)&glActiveTexture; } diff --git a/wxvidext.h b/wxvidext.h index 33e663f..3e378bd 100644 --- a/wxvidext.h +++ b/wxvidext.h @@ -39,6 +39,8 @@ m64p_error VidExt_GL_SwapBuffers(void); m64p_error installWxVideoExtension(); wxGLCanvas* VidExt_InitGLCanvas(wxWindow* parent); + void VidExt_InitedGLCanvas(); +void VidExt_AsyncCleanup(); #endif // VIDEO_EXTENSION_H -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/wxmupen64plus.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

