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
This commit is contained in:
Sonicadvance1 2008-07-22 11:16:45 +00:00
parent ec3067e0e1
commit a626888508
7 changed files with 88 additions and 59 deletions

View File

@ -1,6 +1,6 @@
import os 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: if False:
ccflags += ' -fomit-frame-pointer' ccflags += ' -fomit-frame-pointer'
@ -26,6 +26,7 @@ dirs = ["Source/Core/Common/Src",
"Source/Plugins/Plugin_DSP_NULL/Src", "Source/Plugins/Plugin_DSP_NULL/Src",
"Source/Plugins/Plugin_DSP_LLE/Src", "Source/Plugins/Plugin_DSP_LLE/Src",
"Source/Plugins/Plugin_PadSimple/Src", "Source/Plugins/Plugin_PadSimple/Src",
"Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL",
"Source/Core/DolphinWX/src", "Source/Core/DolphinWX/src",
] ]

View File

@ -1,12 +1,16 @@
Import('env') Import('env')
files = ["LogWindow.cpp", files = ["LogWindow.cpp",
"BreakPointDlg.cpp",
"BreakpointView.cpp", "BreakpointView.cpp",
"CodeView.cpp", "CodeView.cpp",
"BreakpointWindow.cpp", "BreakpointWindow.cpp",
"CodeWindow.cpp", "CodeWindow.cpp",
"CodeView.cpp", "CodeView.cpp",
"Debugger.cpp", "Debugger.cpp",
"MemoryCheckDlg.cpp",
"MemoryView.cpp",
"MemoryWindow.cpp",
"RegisterWindow.cpp", "RegisterWindow.cpp",
"RegisterView.cpp", "RegisterView.cpp",
] ]

View File

@ -151,7 +151,7 @@ wxString NiceSizeFormat(s64 _size)
const char* sizes[] = {"b", "KB", "MB", "GB", "TB", "PB", "EB"}; const char* sizes[] = {"b", "KB", "MB", "GB", "TB", "PB", "EB"};
int s = 0; int s = 0;
int frac = 0; int frac = 0;
while (_size > (s64)1024) while (_size > (s64)1024)
{ {
s++; s++;
@ -162,9 +162,9 @@ wxString NiceSizeFormat(s64 _size)
float f = (float)_size + ((float)frac / 1024.0f); float f = (float)_size + ((float)frac / 1024.0f);
wxString NiceString; wxString NiceString;
wxString tempstring; char tempstr[32];
tempstring = wxString::FromAscii("%3.1f %s"); // Gotta convert to wxString first or else it complains sprintf(tempstr,"%3.1f %s", f, sizes[s]);
NiceString.Printf(tempstring, f, sizes[s]); NiceString = wxString::FromAscii(tempstr);
return(NiceString); return(NiceString);
} }

View File

@ -13,4 +13,4 @@ files = ["disassemble.cpp",
"Tools.cpp", "Tools.cpp",
] ]
#env.Append(LINKFLAGS = "-symbolic") #env.Append(LINKFLAGS = "-symbolic")
env.SharedLibrary(output, files) env.SharedLibrary(output, files, LIBS = ["common"])

View File

@ -2,4 +2,5 @@ Import('env')
output = "../../../../Binary/linux/Plugins/padsimple.so" output = "../../../../Binary/linux/Plugins/padsimple.so"
files = ["main.cpp", 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"])

View File

@ -43,11 +43,12 @@ DInput dinput;
#else #else
#include <X11/Xlib.h> #include <SDL.h>
#include <X11/Xutil.h> SDL_Joystick *joy;
#include <X11/keysym.h> int numaxes = 0;
int numbuttons = 0;
int numballs = 0;
Display* GXdsp;
#endif #endif
// controls // controls
@ -217,8 +218,35 @@ void DllAbout(HWND _hParent)
aboutDlg.DoModal(_hParent); aboutDlg.DoModal(_hParent);
#endif #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) void DllConfig(HWND _hParent)
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -228,6 +256,8 @@ void DllConfig(HWND _hParent)
configDlg.DoModal(_hParent); configDlg.DoModal(_hParent);
SaveConfig(); SaveConfig();
#else
SDL_Inputinit();
#endif #endif
} }
@ -242,7 +272,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize)
#ifdef _WIN32 #ifdef _WIN32
dinput.Init((HWND)g_PADInitialize.hWnd); dinput.Init((HWND)g_PADInitialize.hWnd);
#else #else
GXdsp = (Display*)g_PADInitialize.hWnd; SDL_Inputinit();
#endif #endif
LoadConfig(); LoadConfig();
@ -256,6 +286,10 @@ void PAD_Shutdown()
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
dinput.Free(); dinput.Free();
#else
// Close if opened
if(SDL_JoystickOpened(0))
SDL_JoystickClose(joy);
#endif #endif
SaveConfig(); SaveConfig();
} }
@ -435,7 +469,7 @@ void XInput_Read(int _numPAD, SPADStatus* _pPADStatus)
#endif #endif
int a = 0;
#ifndef _WIN32 #ifndef _WIN32
// The graphics plugin in the PCSX2 design leaves a lot of the window processing to the pad plugin, weirdly enough. // 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) void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
@ -445,59 +479,47 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
{ {
return; return;
} }
SDL_JoystickUpdate();
// This code is from Zerofrog's pcsx2 pad plugin for(int a = 0;a < numbuttons;a++)
XEvent E;
//int keyPress=0, keyRelease=0;
KeySym key;
// keyboard input
while (XPending(GXdsp) > 0)
{ {
XNextEvent(GXdsp, &E); if(SDL_JoystickGetButton(joy, a))
switch (E.type)
{ {
case KeyPress: switch(a)
//_KeyPress(pad, XLookupKeysym((XKeyEvent *)&E, 0)); break; {
key = XLookupKeysym((XKeyEvent*)&E, 0); case 0://A
/* _pPADStatus->button |= PAD_BUTTON_A;
for (i = 0; i < PADKEYS; i++) { _pPADStatus->analogA = 255;
if (key == conf.keys[pad][i]) { break;
keyPress |= (1<<i); case 1://B
keyRelease&=~(1<<i); _pPADStatus->button |= PAD_BUTTON_B;
break; _pPADStatus->analogB = 255;
} break;
}*/ case 2://X
break; _pPADStatus->button |= PAD_BUTTON_Y;
break;
case KeyRelease: case 3://Y
key = XLookupKeysym((XKeyEvent*)&E, 0); _pPADStatus->button |= PAD_BUTTON_X;
/* break;
//_KeyRelease(pad, XLookupKeysym((XKeyEvent *)&E, 0)); case 5://RB
for (i=0; i<PADKEYS; i++) { _pPADStatus->button |= PAD_TRIGGER_Z;
if (key == conf.keys[pad][i]) { break;
keyPress&=~(1<<i); case 6://Start
keyRelease|= (1<<i); _pPADStatus->button |= PAD_BUTTON_START;
break; break;
} }
}*/
break;
case FocusIn:
XAutoRepeatOff(GXdsp);
break;
case FocusOut:
XAutoRepeatOn(GXdsp);
break;
} }
} }
} }
#endif #endif
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
connected |= 1;
return connected;
}
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus) void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
{ {
// check if all is okay // check if all is okay

View File

@ -242,7 +242,8 @@ void Decode(void)
if (Cmd&0x80) if (Cmd&0x80)
{ {
// load vertices // load vertices
u16 numVertices = g_pDataReader->Read16(); u16 numVertices = g_pDataReader->Read16();
printf("numVertices %d\n",numVertices);
if( numVertices > 0 ) { if( numVertices > 0 ) {
g_VertexLoaders[Cmd & GX_VAT_MASK].RunVertices((Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices); g_VertexLoaders[Cmd & GX_VAT_MASK].RunVertices((Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices);
} }