Warp back to 1983!!! (rev 1983, that is, not the year :P)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1997 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-01-23 21:28:55 +00:00
parent 7ecf884f9a
commit 70bc8167f8
29 changed files with 294 additions and 504 deletions

View File

@ -185,6 +185,8 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void DllConfig(HWND _hParent)
{
#ifdef _WIN32
// Start the pads so we can use them in the configuration and advanced controls
if(!emulator_running)
{
@ -195,10 +197,31 @@ void DllConfig(HWND _hParent)
emulator_running = false; // Set it back to false
}
g_Config.Load(); // Load settings
// We don't need a parent for this wxDialog
//wxWindow win;
//win.SetHWND(_hParent);
//ConfigBox frame(&win);
//win.SetHWND(0);
m_frame = new ConfigBox(NULL);
m_frame->ShowModal();
#else
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
return;
}
g_Config.Load(); // load settings
#if defined(HAVE_WX) && HAVE_WX
g_Config.Load(); // Load settings
m_frame = new ConfigBox(NULL);
m_frame->ShowModal();
ConfigBox frame(NULL);
frame.ShowModal();
#endif
#endif
}
@ -217,33 +240,29 @@ void Initialize(void *init)
{
// Debugging
//Console::Open();
SPADInitialize *_PADInitialize = (SPADInitialize*)init;
#ifndef INPUTCOMMON
Console::Print("Initialize: %i, %i\n", _PADInitialize->padNumber, SDL_WasInit(0));
#endif
//Console::Print("Initialize: %i\n", SDL_WasInit(0));
SPADInitialize _PADInitialize = *(SPADInitialize*)init;
emulator_running = true;
#ifdef _DEBUG
DEBUG_INIT();
#endif
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
the SDL_INIT_VIDEO flag to */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
{
#ifdef _WIN32
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
#else
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#endif
return;
}
#ifdef _WIN32
m_hWnd = (HWND)_PADInitialize->hWnd;
#endif
#ifndef INPUTCOMMON
/* SDL 1.3 use DirectInput instead of the old Microsoft Multimeda API, and with this we need
the SDL_INIT_VIDEO flag to */
if (!SDL_WasInit(0))
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
{
#ifdef _WIN32
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
#else
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#endif
return;
}
m_hWnd = (HWND)_PADInitialize.hWnd;
#endif
Search_Devices(); // Populate joyinfo for all attached devices
@ -256,18 +275,6 @@ void Initialize(void *init)
joystate[2].joy = SDL_JoystickOpen(PadMapping[2].ID);
if (PadMapping[3].enabled)
joystate[3].joy = SDL_JoystickOpen(PadMapping[3].ID);
//_PADInitialize->padNumber = 55;
/* Check if any of the pads failed to open. In Windows there is a strange "IDirectInputDevice2::
SetDataFormat() DirectX error -2147024809" after a few Open and Close */
if( (PadMapping[0].enabled && joystate[0].joy == NULL)
|| (PadMapping[1].enabled && joystate[1].joy == NULL)
|| (PadMapping[2].enabled && joystate[2].joy == NULL)
|| (PadMapping[3].enabled && joystate[3].joy == NULL))
{
_PADInitialize->padNumber = -1;
Console::Print("%s\n", SDL_GetError());
}
}
@ -295,7 +302,11 @@ int Search_Devices()
// Warn the user if no PadMapping are detected
if (numjoy == 0)
{
PanicAlert("No Joystick detected");
#ifdef _WIN32
//MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
#else
printf("No Joystick detected!\n");
#endif
return 0;
}
@ -339,7 +350,7 @@ int Search_Devices()
Called from: The Dolphin Core, ConfigBox::OnClose() */
void Shutdown()
{
Console::Print("Shutdown: %i\n", SDL_WasInit(0));
//Console::Print("Shutdown: %i\n", SDL_WasInit(0));
if (PadMapping[0].enabled && SDL_JoystickOpened(PadMapping[0].ID))
SDL_JoystickClose(joystate[0].joy);
@ -348,11 +359,9 @@ void Shutdown()
if (PadMapping[2].enabled && SDL_JoystickOpened(PadMapping[2].ID))
SDL_JoystickClose(joystate[2].joy);
if (PadMapping[3].enabled && SDL_JoystickOpened(PadMapping[3].ID))
SDL_JoystickClose(joystate[3].joy);
SDL_JoystickClose(joystate[3].joy);
#ifndef INPUTCOMMON
SDL_Quit();
#endif
SDL_Quit();
#ifdef _DEBUG
DEBUG_QUIT();
@ -544,14 +553,11 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
Console::ClearScreen();
Console::Print(
"Trigger type: %s Left:%04x Right:%04x Value:%i\n"
"D-Pad type: %s L:%i R:%i U:%i D:%i"
"Main stick x, y: %i %i",
"D-Pad type: %s L:%i R:%i U:%i D:%i",
(PadMapping[_numPAD].triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
TriggerLeft, TriggerRight, TriggerValue,
(PadMapping[_numPAD].controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
0, 0, 0, 0,
main_stick_x, main_stick_y
0, 0, 0, 0
);*/
}
@ -766,7 +772,7 @@ void GetJoyState(int controller)
ReadButton(controller, CTL_START);
//
if (PadMapping[controller].halfpress < Buttons)
if (PadMapping[controller].halfpress < joyinfo[controller].NumButtons)
joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, PadMapping[controller].halfpress);
// Check if we have an analog or digital joypad