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
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",
]

View File

@ -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",
]

View File

@ -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);
}

View File

@ -13,4 +13,4 @@ files = ["disassemble.cpp",
"Tools.cpp",
]
#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"
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
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <SDL.h>
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<<i);
keyRelease&=~(1<<i);
break;
}
}*/
break;
case KeyRelease:
key = XLookupKeysym((XKeyEvent*)&E, 0);
/*
//_KeyRelease(pad, XLookupKeysym((XKeyEvent *)&E, 0));
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[pad][i]) {
keyPress&=~(1<<i);
keyRelease|= (1<<i);
break;
}
}*/
break;
case FocusIn:
XAutoRepeatOff(GXdsp);
break;
case FocusOut:
XAutoRepeatOn(GXdsp);
break;
switch(a)
{
case 0://A
_pPADStatus->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

View File

@ -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);
}