From a626888508e00c15cc4e7f4e34426478c06b5f45 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Tue, 22 Jul 2008 11:16:45 +0000 Subject: [PATCH] Linux: Now video is actually outputted. Changing padsimple in to SDL git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@54 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 3 +- Source/Core/DebuggerWX/src/SConscript | 4 + Source/Core/DolphinWX/src/GameListCtrl.cpp | 8 +- Source/Plugins/Plugin_DSP_LLE/Src/SConscript | 2 +- .../Plugins/Plugin_PadSimple/Src/SConscript | 3 +- Source/Plugins/Plugin_PadSimple/Src/main.cpp | 124 +++++++++++------- .../Plugin_VideoOGL/Src/OpcodeDecoding.cpp | 3 +- 7 files changed, 88 insertions(+), 59 deletions(-) diff --git a/SConstruct b/SConstruct index f7f2c06fd5..b94a36a0d4 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,6 @@ import os -ccflags = '-g -O2 -msse2 -Wall -DLOGGING -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' +ccflags = '-g -O3 -fno-strict-aliasing -fPIC -m64 -msse2 -Wall -DLOGGING -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' if False: ccflags += ' -fomit-frame-pointer' @@ -26,6 +26,7 @@ dirs = ["Source/Core/Common/Src", "Source/Plugins/Plugin_DSP_NULL/Src", "Source/Plugins/Plugin_DSP_LLE/Src", "Source/Plugins/Plugin_PadSimple/Src", + "Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL", "Source/Core/DolphinWX/src", ] diff --git a/Source/Core/DebuggerWX/src/SConscript b/Source/Core/DebuggerWX/src/SConscript index 6827bf2ff7..4615a805ed 100644 --- a/Source/Core/DebuggerWX/src/SConscript +++ b/Source/Core/DebuggerWX/src/SConscript @@ -1,12 +1,16 @@ Import('env') files = ["LogWindow.cpp", + "BreakPointDlg.cpp", "BreakpointView.cpp", "CodeView.cpp", "BreakpointWindow.cpp", "CodeWindow.cpp", "CodeView.cpp", "Debugger.cpp", + "MemoryCheckDlg.cpp", + "MemoryView.cpp", + "MemoryWindow.cpp", "RegisterWindow.cpp", "RegisterView.cpp", ] diff --git a/Source/Core/DolphinWX/src/GameListCtrl.cpp b/Source/Core/DolphinWX/src/GameListCtrl.cpp index 17391926a4..8aad0d7b4b 100644 --- a/Source/Core/DolphinWX/src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/src/GameListCtrl.cpp @@ -151,7 +151,7 @@ wxString NiceSizeFormat(s64 _size) const char* sizes[] = {"b", "KB", "MB", "GB", "TB", "PB", "EB"}; int s = 0; int frac = 0; - + while (_size > (s64)1024) { s++; @@ -162,9 +162,9 @@ wxString NiceSizeFormat(s64 _size) float f = (float)_size + ((float)frac / 1024.0f); wxString NiceString; - wxString tempstring; - tempstring = wxString::FromAscii("%3.1f %s"); // Gotta convert to wxString first or else it complains - NiceString.Printf(tempstring, f, sizes[s]); + char tempstr[32]; + sprintf(tempstr,"%3.1f %s", f, sizes[s]); + NiceString = wxString::FromAscii(tempstr); return(NiceString); } diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript index 3f2411f90c..a24b13f7f2 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript @@ -13,4 +13,4 @@ files = ["disassemble.cpp", "Tools.cpp", ] #env.Append(LINKFLAGS = "-symbolic") -env.SharedLibrary(output, files) +env.SharedLibrary(output, files, LIBS = ["common"]) diff --git a/Source/Plugins/Plugin_PadSimple/Src/SConscript b/Source/Plugins/Plugin_PadSimple/Src/SConscript index 737166986a..273592cb60 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/SConscript +++ b/Source/Plugins/Plugin_PadSimple/Src/SConscript @@ -2,4 +2,5 @@ Import('env') output = "../../../../Binary/linux/Plugins/padsimple.so" files = ["main.cpp", ] -env.SharedLibrary(output, files, LIBS=["common"]) +padenv=env.Copy(CXXFLAGS = " `pkg-config --cflags sdl`", LINKFLAGS = " `pkg-config --libs sdl`") +padenv.SharedLibrary(output, files, LIBS=["common"]) diff --git a/Source/Plugins/Plugin_PadSimple/Src/main.cpp b/Source/Plugins/Plugin_PadSimple/Src/main.cpp index 88fcdfd1cb..7c1e042ec8 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/main.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/main.cpp @@ -43,11 +43,12 @@ DInput dinput; #else -#include -#include -#include +#include +SDL_Joystick *joy; +int numaxes = 0; +int numbuttons = 0; +int numballs = 0; -Display* GXdsp; #endif // controls @@ -217,8 +218,35 @@ void DllAbout(HWND _hParent) aboutDlg.DoModal(_hParent); #endif } +void SDL_Inputinit() +{ + if ( SDL_Init(SDL_INIT_JOYSTICK) < 0 ) + { + printf("Unable to init SDL: %s\n", SDL_GetError()); + exit(1); + } + for(int a = 0; a < SDL_NumJoysticks();a ++) + printf("Name:%s\n",SDL_JoystickName(a)); + // Open joystick + joy=SDL_JoystickOpen(0); + + if(joy) + { + printf("Opened Joystick 0\n"); + printf("Name: %s\n", SDL_JoystickName(0)); + printf("Number of Axes: %d\n", SDL_JoystickNumAxes(joy)); + printf("Number of Buttons: %d\n", SDL_JoystickNumButtons(joy)); + printf("Number of Balls: %d\n", SDL_JoystickNumBalls(joy)); + numaxes = SDL_JoystickNumAxes(joy); + numbuttons = SDL_JoystickNumButtons(joy); + numballs = SDL_JoystickNumBalls(joy); + } + else + printf("Couldn't open Joystick 0\n"); +} + void DllConfig(HWND _hParent) { #ifdef _WIN32 @@ -228,6 +256,8 @@ void DllConfig(HWND _hParent) configDlg.DoModal(_hParent); SaveConfig(); +#else + SDL_Inputinit(); #endif } @@ -242,7 +272,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize) #ifdef _WIN32 dinput.Init((HWND)g_PADInitialize.hWnd); #else - GXdsp = (Display*)g_PADInitialize.hWnd; + SDL_Inputinit(); #endif LoadConfig(); @@ -256,6 +286,10 @@ void PAD_Shutdown() #endif #ifdef _WIN32 dinput.Free(); +#else + // Close if opened + if(SDL_JoystickOpened(0)) + SDL_JoystickClose(joy); #endif SaveConfig(); } @@ -435,7 +469,7 @@ void XInput_Read(int _numPAD, SPADStatus* _pPADStatus) #endif - +int a = 0; #ifndef _WIN32 // The graphics plugin in the PCSX2 design leaves a lot of the window processing to the pad plugin, weirdly enough. void X11_Read(int _numPAD, SPADStatus* _pPADStatus) @@ -445,59 +479,47 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus) { return; } - - // This code is from Zerofrog's pcsx2 pad plugin - XEvent E; - //int keyPress=0, keyRelease=0; - KeySym key; - - // keyboard input - while (XPending(GXdsp) > 0) + SDL_JoystickUpdate(); + for(int a = 0;a < numbuttons;a++) { - XNextEvent(GXdsp, &E); - - switch (E.type) + if(SDL_JoystickGetButton(joy, a)) { - case KeyPress: - //_KeyPress(pad, XLookupKeysym((XKeyEvent *)&E, 0)); break; - key = XLookupKeysym((XKeyEvent*)&E, 0); - /* - for (i = 0; i < PADKEYS; i++) { - if (key == conf.keys[pad][i]) { - keyPress |= (1<button |= PAD_BUTTON_A; + _pPADStatus->analogA = 255; + break; + case 1://B + _pPADStatus->button |= PAD_BUTTON_B; + _pPADStatus->analogB = 255; + break; + case 2://X + _pPADStatus->button |= PAD_BUTTON_Y; + break; + case 3://Y + _pPADStatus->button |= PAD_BUTTON_X; + break; + case 5://RB + _pPADStatus->button |= PAD_TRIGGER_Z; + break; + case 6://Start + _pPADStatus->button |= PAD_BUTTON_START; + break; + } } } + } #endif - +unsigned int PAD_GetAttachedPads() +{ + unsigned int connected = 0; + connected |= 1; + return connected; +} void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus) { // check if all is okay diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp index 5079cb9060..54c8a4c356 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp @@ -242,7 +242,8 @@ void Decode(void) if (Cmd&0x80) { // load vertices - u16 numVertices = g_pDataReader->Read16(); + u16 numVertices = g_pDataReader->Read16(); + printf("numVertices %d\n",numVertices); if( numVertices > 0 ) { g_VertexLoaders[Cmd & GX_VAT_MASK].RunVertices((Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices); }