From 54719af08c25f38d5a632d067b2127642883eccc Mon Sep 17 00:00:00 2001 From: Laurence Muller Date: Sun, 5 Oct 2008 23:04:35 +0000 Subject: [PATCH] removed win32 gui from the plugin. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@783 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj | 36 - .../Plugin_nJoy_SDL/Res/Plugin_nJoy_SDL.rc | 189 ------ Source/Plugins/Plugin_nJoy_SDL/Res/resource.h | 64 -- Source/Plugins/Plugin_nJoy_SDL/Src/config.cpp | 623 ------------------ Source/Plugins/Plugin_nJoy_SDL/Src/config.h | 74 --- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp | 110 ++-- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h | 7 - 7 files changed, 39 insertions(+), 1064 deletions(-) delete mode 100644 Source/Plugins/Plugin_nJoy_SDL/Res/Plugin_nJoy_SDL.rc delete mode 100644 Source/Plugins/Plugin_nJoy_SDL/Res/resource.h delete mode 100644 Source/Plugins/Plugin_nJoy_SDL/Src/config.cpp delete mode 100644 Source/Plugins/Plugin_nJoy_SDL/Src/config.h diff --git a/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj b/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj index e9eeadc77e..d06f8f1608 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj +++ b/Source/Plugins/Plugin_nJoy_SDL/Plugin_nJoy_SDL.vcproj @@ -507,14 +507,6 @@ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > - - - - @@ -524,34 +516,6 @@ > - - - - - - - - - - - - diff --git a/Source/Plugins/Plugin_nJoy_SDL/Res/Plugin_nJoy_SDL.rc b/Source/Plugins/Plugin_nJoy_SDL/Res/Plugin_nJoy_SDL.rc deleted file mode 100644 index 1939637d8b..0000000000 --- a/Source/Plugins/Plugin_nJoy_SDL/Res/Plugin_nJoy_SDL.rc +++ /dev/null @@ -1,189 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Dutch (Netherlands) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLD) -#ifdef _WIN32 -LANGUAGE LANG_DUTCH, SUBLANG_DUTCH -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONFIG DIALOGEX 0, 0, 411, 282 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - COMBOBOX IDC_JOYNAME,8,18,317,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Controller:",IDC_STATIC,3,7,405,28 - CONTROL 102,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE | SS_SUNKEN,65,46,281,187 - CONTROL "Controller attached",IDC_JOYATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,330,19,73,10 - PUSHBUTTON "",IDC_SHOULDERL,46,50,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_B,350,50,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_SHOULDERR,350,66,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_Z,350,90,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_Y,350,106,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_X,350,150,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_A,350,173,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_SX,351,217,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_START,197,236,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_DPAD,46,183,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_MX,46,135,15,10,0,WS_EX_STATICEDGE - CTEXT "",IDTEXT_SHOULDERL,4,49,40,12,WS_BORDER - CTEXT "",IDTEXT_B,368,49,40,12,WS_BORDER - CTEXT "",IDTEXT_SHOULDERR,368,65,40,12,WS_BORDER - CTEXT "",IDTEXT_Z,368,89,40,12,WS_BORDER - CTEXT "",IDTEXT_Y,368,105,40,12,WS_BORDER - CTEXT "",IDTEXT_X,368,149,40,12,WS_BORDER - CTEXT "",IDTEXT_A,368,172,40,12,WS_BORDER - CTEXT "",IDTEXT_MX,4,134,40,12,WS_BORDER - CTEXT "",IDTEXT_DPAD,4,182,40,12,WS_BORDER - CTEXT "",IDTEXT_START,185,248,40,12,WS_BORDER - CTEXT "",IDTEXT_MY,3,157,40,12,WS_BORDER - LTEXT "X-axis",IDC_STATIC,4,124,20,8 - LTEXT "Y-axis",IDC_STATIC,4,147,20,8 - CTEXT "",IDTEXT_SX,368,216,40,12,WS_BORDER - CTEXT "",IDTEXT_SY,367,239,40,12,WS_BORDER - LTEXT "X-axis",IDC_STATIC,368,206,20,8 - LTEXT "Y-axis",IDC_STATIC,368,229,20,8 - PUSHBUTTON "",IDC_SY,351,240,15,10,0,WS_EX_STATICEDGE - PUSHBUTTON "",IDC_MY,46,158,15,10,0,WS_EX_STATICEDGE - GROUPBOX "Extra settings:",IDC_STATIC,69,236,103,43 - LTEXT "Deadzone",IDC_STATIC,77,248,33,8 - LTEXT "Half press",IDC_STATIC,77,263,33,8 - COMBOBOX IDC_DEADZONE,111,246,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "www.multigesture.net",IDC_STATIC,336,271,72,8 - COMBOBOX IDC_CONTROLTYPE,244,247,87,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Controller type:",IDC_STATIC,239,236,95,27 - PUSHBUTTON "",IDC_DPAD_DOWN,46,205,15,10,0,WS_EX_STATICEDGE - CTEXT "",IDTEXT_DPAD_DOWN,4,205,40,12,WS_BORDER - PUSHBUTTON "",IDC_DPAD_LEFT,45,228,15,10,0,WS_EX_STATICEDGE - CTEXT "",IDTEXT_DPAD_LEFT,3,227,40,12,WS_BORDER - PUSHBUTTON "",IDC_DPAD_RIGHT,45,251,15,10,0,WS_EX_STATICEDGE - CTEXT "",IDTEXT_DPAD_RIGHT,3,250,40,12,WS_BORDER - LTEXT "Up",IDC_DPAD_TEXT1,4,172,10,8 - LTEXT "Down",IDC_DPAD_TEXT2,4,195,19,8 - LTEXT "Left",IDC_DPAD_TEXT3,4,217,14,8 - LTEXT "Right",IDC_DPAD_TEXT4,4,240,18,8 - PUSHBUTTON "",IDC_HALFPRESS,153,263,15,10,0,WS_EX_STATICEDGE - CTEXT "",IDTEXT_HALFPRESS,111,261,40,12,WS_BORDER -END - -IDD_ABOUT DIALOGEX 0, 0, 133, 227 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION -CAPTION "About: nJoy Input Plugin" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,75,209,50,14 - CONTROL 104,IDC_STATIC,"Static",SS_BITMAP,0,0,133,37 - GROUPBOX "Plugin info:",IDC_STATIC,7,39,120,42 - GROUPBOX "Special thanks to:",IDC_STATIC,7,84,120,24 - GROUPBOX "Greetings to:",IDC_STATIC,7,112,120,95 - LTEXT "",IDC_ABOUT_TEXT,13,51,108,24 - LTEXT "F|RES and ector.",IDC_STATIC,13,95,108,8 - LTEXT "Static",IDC_ABOUT_TEXT2,13,123,111,82 - LTEXT "BETA RELEASE",IDC_ABOUT_TEXT3,10,211,62,13 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 3 - RIGHTMARGIN, 408 - TOPMARGIN, 7 - BOTTOMMARGIN, 279 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_BITMAP1 BITMAP "controller.bmp" -IDB_BITMAP2 BITMAP "njoy.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_CONFIG DLGINIT -BEGIN - IDC_CONTROLTYPE, 0x403, 9, 0 -0x6f4a, 0x7379, 0x6974, 0x6b63, "\000" - IDC_CONTROLTYPE, 0x403, 18, 0 -0x6f4a, 0x7379, 0x6974, 0x6b63, 0x2820, 0x6f6e, 0x6820, 0x7461, 0x0029, - - IDC_CONTROLTYPE, 0x403, 9, 0 -0x654b, 0x6279, 0x616f, 0x6472, "\000" - 0 -END - -#endif // Dutch (Netherlands) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Source/Plugins/Plugin_nJoy_SDL/Res/resource.h b/Source/Plugins/Plugin_nJoy_SDL/Res/resource.h deleted file mode 100644 index 3a2d62b2c1..0000000000 --- a/Source/Plugins/Plugin_nJoy_SDL/Res/resource.h +++ /dev/null @@ -1,64 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Plugin_nJoy_SDL.rc -// -#define IDD_CONFIG 101 -#define IDB_BITMAP1 102 -#define IDD_ABOUT 103 -#define IDB_BITMAP2 104 -#define IDC_JOYNAME 1001 -#define IDC_JOYATTACH 1002 -#define IDC_SHOULDERL 1010 -#define IDC_SHOULDERR 1011 -#define IDC_A 1012 -#define IDC_B 1013 -#define IDC_X 1014 -#define IDC_Y 1015 -#define IDC_Z 1016 -#define IDC_START 1017 -#define IDC_DPAD 1018 -#define IDC_MX 1019 -#define IDC_MY 1020 -#define IDC_SX 1021 -#define IDC_SY 1022 -#define IDC_DEADZONE 1023 -#define IDC_HALFPRESS 1024 -#define IDC_DPAD_DOWN 1025 -#define IDC_DPAD_LEFT 1026 -#define IDC_DPAD_RIGHT 1027 -#define IDC_ABOUT_TEXT 1032 -#define IDC_ABOUT_TEXT2 1033 -#define IDC_ABOUT_TEXT3 1034 -#define IDC_CONTROLTYPE 1036 -#define IDC_DPAD_TEXT1 1037 -#define IDC_DPAD_TEXT2 1038 -#define IDC_DPAD_TEXT3 1039 -#define IDC_DPAD_TEXT4 1040 -#define IDTEXT_SHOULDERL 2010 -#define IDTEXT_SHOULDERR 2011 -#define IDTEXT_A 2012 -#define IDTEXT_B 2013 -#define IDTEXT_X 2014 -#define IDTEXT_Y 2015 -#define IDTEXT_Z 2016 -#define IDTEXT_START 2017 -#define IDTEXT_DPAD 2018 -#define IDTEXT_MX 2019 -#define IDTEXT_MY 2020 -#define IDTEXT_SX 2021 -#define IDTEXT_SY 2022 -#define IDTEXT_HALFPRESS 2024 -#define IDTEXT_DPAD_DOWN 2025 -#define IDTEXT_DPAD_LEFT 2026 -#define IDTEXT_DPAD_RIGHT 2027 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1041 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/config.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/config.cpp deleted file mode 100644 index 93aed91b8f..0000000000 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/config.cpp +++ /dev/null @@ -1,623 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -// whole file... until we fix the GUI - - -#include "nJoy.h" - -#ifndef USE_WXWIDGETS -#ifdef _WIN32 - -extern CONTROLLER_INFO *joyinfo; -extern CONTROLLER_MAPPING joysticks[4]; -extern bool emulator_running; - -static const char* ControllerType[] = -{ - "Joystick (default)", - "Joystick (no hat)", - "Keyboard" -}; - -// Create dialog and pages -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -int OpenConfig(HINSTANCE hInst, HWND _hParent) -{ - PROPSHEETPAGE psp[4]; - PROPSHEETHEADER psh; - - psp[0].dwSize = sizeof(PROPSHEETPAGE); - psp[0].dwFlags = PSP_USETITLE; - psp[0].hInstance = hInst; - psp[0].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG); - psp[0].pszIcon = NULL; - psp[0].pfnDlgProc = (DLGPROC)ControllerTab1; - psp[0].pszTitle = "Controller 1"; - psp[0].lParam = 0; - - psp[1].dwSize = sizeof(PROPSHEETPAGE); - psp[1].dwFlags = PSP_USETITLE; - psp[1].hInstance = hInst; - psp[1].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG); - psp[1].pszIcon = NULL; - psp[1].pfnDlgProc = (DLGPROC)ControllerTab2; - psp[1].pszTitle = "Controller 2"; - psp[1].lParam = 0; - - psp[2].dwSize = sizeof(PROPSHEETPAGE); - psp[2].dwFlags = PSP_USETITLE; - psp[2].hInstance = hInst; - psp[2].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG); - psp[2].pszIcon = NULL; - psp[2].pfnDlgProc = (DLGPROC)ControllerTab3; - psp[2].pszTitle = "Controller 3"; - psp[2].lParam = 0; - - psp[3].dwSize = sizeof(PROPSHEETPAGE); - psp[3].dwFlags = PSP_USETITLE; - psp[3].hInstance = hInst; - psp[3].pszTemplate = MAKEINTRESOURCE(IDD_CONFIG); - psp[3].pszIcon = NULL; - psp[3].pfnDlgProc = (DLGPROC)ControllerTab4; - psp[3].pszTitle = "Controller 4"; - psp[3].lParam = 0; - - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP; - psh.hwndParent = _hParent; - psh.hInstance = hInst; - psh.pszIcon = NULL; - #ifndef _DEBUG - psh.pszCaption = (LPSTR) "Configure: nJoy v"INPUT_VERSION " Input Plugin"; - #else - psh.pszCaption = (LPSTR) "Configure: nJoy v"INPUT_VERSION " (Debug) Input Plugin"; - #endif - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.ppsp = (LPCPROPSHEETPAGE) &psp; - - return (int)(PropertySheet(&psh)); -} - -// Create Tab -// ŻŻŻŻŻŻŻŻŻŻ -BOOL APIENTRY ControllerTab1(HWND hDlg, UINT message, UINT wParam, LONG lParam) -{ - return ControllerTab(hDlg, message, wParam, lParam, 0); -} - -BOOL APIENTRY ControllerTab2(HWND hDlg, UINT message, UINT wParam, LONG lParam) -{ - return ControllerTab(hDlg, message, wParam, lParam, 1); -} - -BOOL APIENTRY ControllerTab3(HWND hDlg, UINT message, UINT wParam, LONG lParam) -{ - return ControllerTab(hDlg, message, wParam, lParam, 2); -} - -BOOL APIENTRY ControllerTab4(HWND hDlg, UINT message, UINT wParam, LONG lParam) -{ - return ControllerTab(hDlg, message, wParam, lParam, 3); -} - -// Create Controller Tab -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -BOOL ControllerTab(HWND hDlg, UINT message, UINT wParam, LONG lParam, int controller) -{ - switch (message) - { - case WM_INITDIALOG: - // Prevent user from changing the joystick while emulation is running - if(emulator_running) - { - ComboBox_Enable(GetDlgItem(hDlg, IDC_JOYNAME), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_JOYATTACH), FALSE); - ComboBox_Enable(GetDlgItem(hDlg, IDC_CONTROLTYPE), FALSE); - } - else - { - ComboBox_Enable(GetDlgItem(hDlg, IDC_JOYNAME), TRUE); - Button_Enable(GetDlgItem(hDlg, IDC_JOYATTACH), TRUE); - ComboBox_Enable(GetDlgItem(hDlg, IDC_CONTROLTYPE), TRUE); - } - - // Search for devices and add the to the device list - if(Search_Devices()) - { - HWND CB = GetDlgItem(hDlg, IDC_JOYNAME); - for(int x = 0; x < SDL_NumJoysticks(); x++) - { - SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast((LPCTSTR)joyinfo[x].Name)); - } - - CB = GetDlgItem(hDlg, IDC_CONTROLTYPE); - SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast((LPCTSTR)ControllerType[CTL_TYPE_JOYSTICK])); - SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast((LPCTSTR)ControllerType[CTL_TYPE_JOYSTICK_NO_HAT])); - //SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast((LPCTSTR)ControllerType[CTL_TYPE_KEYBOARD])); - - char buffer [8]; - CB = GetDlgItem(hDlg, IDC_DEADZONE); - SendMessage(CB, CB_RESETCONTENT, 0, 0); - for(int x = 1; x <= 100; x++) - { - sprintf (buffer, "%d %%", x); - SendMessage(CB, CB_ADDSTRING, 0, reinterpret_cast((LPCTSTR)buffer)); - } - - SetControllerAll(hDlg, controller); - return TRUE; - } - else - { - HWND CB = GetDlgItem(hDlg, IDC_JOYNAME); - SendMessage(CB, CB_ADDSTRING, 0, (LPARAM)"No Joystick detected!"); - SendMessage(CB, CB_SETCURSEL, 0, 0); - return FALSE; - } - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDC_JOYNAME: - { - // Selected a different joystick - if(HIWORD(wParam) == CBN_SELCHANGE) - { - joysticks[controller].ID = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_GETCURSEL, 0, 0); - } - return TRUE; - } - break; - - case IDC_CONTROLTYPE: - { - // Selected a different joystick - if(HIWORD(wParam) == CBN_SELCHANGE) - { - joysticks[controller].controllertype = (int)SendMessage(GetDlgItem(hDlg, IDC_CONTROLTYPE), CB_GETCURSEL, 0, 0); - UpdateVisibleItems(hDlg, joysticks[controller].controllertype); - } - return TRUE; - } - break; - - case IDC_SHOULDERL: - case IDC_SHOULDERR: - case IDC_A: - case IDC_B: - case IDC_X: - case IDC_Y: - case IDC_Z: - case IDC_START: - case IDC_HALFPRESS: - case IDC_DPAD_DOWN: - case IDC_DPAD_LEFT: - case IDC_DPAD_RIGHT: - { - GetButtons(hDlg, LOWORD(wParam), controller); - return TRUE; - } - break; - - case IDC_DPAD: - { - if(joysticks[controller].controllertype) - GetButtons(hDlg, LOWORD(wParam), controller); - else - GetHats(hDlg, LOWORD(wParam), controller); - return TRUE; - } - break; - - case IDC_SX: - case IDC_SY: - case IDC_MX: - case IDC_MY: - { - GetAxis(hDlg, LOWORD(wParam), controller); - return TRUE; - } - break; - } - break; - - case WM_DESTROY: - GetControllerAll(hDlg, controller); - break; - } - return FALSE; -} - -// Wait for button press -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -bool GetButtons(HWND hDlg, int buttonid, int controller) -{ - buttonid += 1000; - - SDL_Joystick *joy; - joy=SDL_JoystickOpen(joysticks[controller].ID); - - char format[128]; - int buttons = SDL_JoystickNumButtons(joy); - bool waiting = true; - bool succeed = false; - int pressed = 0; - - int counter1 = 0; - int counter2 = 10; - - sprintf(format, "[%d]", counter2); - SetDlgItemText(hDlg, buttonid, format); - - while(waiting) - { - SDL_JoystickUpdate(); - for(int b = 0; b < buttons; b++) - { - if(SDL_JoystickGetButton(joy, b)) - { - pressed = b; - waiting = false; - succeed = true; - break; - } - } - - counter1++; - if(counter1==100) - { - counter1=0; - counter2--; - - sprintf(format, "[%d]", counter2); - SetDlgItemText(hDlg, buttonid, format); - - if(counter2<0) - waiting = false; - } - Sleep(10); - } - - if(succeed) - sprintf(format, "%d", pressed); - else - sprintf(format, "-1", pressed); - SetDlgItemText(hDlg, buttonid, format); - - if(SDL_JoystickOpened(joysticks[controller].ID)) - SDL_JoystickClose(joy); - - return true; -} - -// Wait for D-Pad -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -bool GetHats(HWND hDlg, int buttonid, int controller) -{ - buttonid += 1000; - - SDL_Joystick *joy; - joy=SDL_JoystickOpen(joysticks[controller].ID); - - char format[128]; - int hats = SDL_JoystickNumHats(joy); - bool waiting = true; - bool succeed = false; - int pressed = 0; - - int counter1 = 0; - int counter2 = 10; - - sprintf(format, "[%d]", counter2); - SetDlgItemText(hDlg, buttonid, format); - - while(waiting) - { - SDL_JoystickUpdate(); - for(int b = 0; b < hats; b++) - { - if(SDL_JoystickGetHat(joy, b)) - { - pressed = b; - waiting = false; - succeed = true; - break; - } - } - - counter1++; - if(counter1==100) - { - counter1=0; - counter2--; - - sprintf(format, "[%d]", counter2); - SetDlgItemText(hDlg, buttonid, format); - - if(counter2<0) - waiting = false; - } - Sleep(10); - } - - if(succeed) - sprintf(format, "%d", pressed); - else - sprintf(format, "-1", pressed); - SetDlgItemText(hDlg, buttonid, format); - - if(SDL_JoystickOpened(joysticks[controller].ID)) - SDL_JoystickClose(joy); - - return true; -} - -// Wait for Analog -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -bool GetAxis(HWND hDlg, int buttonid, int controller) -{ - buttonid += 1000; - - SDL_Joystick *joy; - joy=SDL_JoystickOpen(joysticks[controller].ID); - - char format[128]; - int axes = SDL_JoystickNumAxes(joy); - bool waiting = true; - bool succeed = false; - int pressed = 0; - Sint16 value; - - int counter1 = 0; - int counter2 = 10; - - sprintf(format, "[%d]", counter2); - SetDlgItemText(hDlg, buttonid, format); - - while(waiting) - { - SDL_JoystickUpdate(); - for(int b = 0; b < axes; b++) - { - value = SDL_JoystickGetAxis(joy, b); - if(value < -10000 || value > 10000) - { - pressed = b; - waiting = false; - succeed = true; - break; - } - } - - counter1++; - if(counter1==100) - { - counter1=0; - counter2--; - - sprintf(format, "[%d]", counter2); - SetDlgItemText(hDlg, buttonid, format); - - if(counter2<0) - waiting = false; - } - Sleep(10); - } - - if(succeed) - sprintf(format, "%d", pressed); - else - sprintf(format, "-1", pressed); - SetDlgItemText(hDlg, buttonid, format); - - if(SDL_JoystickOpened(joysticks[controller].ID)) - SDL_JoystickClose(joy); - - return true; -} - -// Set dialog items -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void SetControllerAll(HWND hDlg, int controller) -{ - SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_SETCURSEL, joysticks[controller].ID, 0); - - SetButton(hDlg, IDTEXT_SHOULDERL, joysticks[controller].buttons[CTL_L_SHOULDER]); - SetButton(hDlg, IDTEXT_SHOULDERR, joysticks[controller].buttons[CTL_R_SHOULDER]); - SetButton(hDlg, IDTEXT_A, joysticks[controller].buttons[CTL_A_BUTTON]); - SetButton(hDlg, IDTEXT_B, joysticks[controller].buttons[CTL_B_BUTTON]); - SetButton(hDlg, IDTEXT_X, joysticks[controller].buttons[CTL_X_BUTTON]); - SetButton(hDlg, IDTEXT_Y, joysticks[controller].buttons[CTL_Y_BUTTON]); - SetButton(hDlg, IDTEXT_Z, joysticks[controller].buttons[CTL_Z_TRIGGER]); - SetButton(hDlg, IDTEXT_START, joysticks[controller].buttons[CTL_START]); - - SetButton(hDlg, IDTEXT_HALFPRESS, joysticks[controller].halfpress); - - SetButton(hDlg, IDTEXT_MX, joysticks[controller].axis[CTL_MAIN_X]); - SetButton(hDlg, IDTEXT_MY, joysticks[controller].axis[CTL_MAIN_Y]); - SetButton(hDlg, IDTEXT_SX, joysticks[controller].axis[CTL_SUB_X]); - SetButton(hDlg, IDTEXT_SY, joysticks[controller].axis[CTL_SUB_Y]); - - SendDlgItemMessage(hDlg, IDC_JOYATTACH, BM_SETCHECK, joysticks[controller].enabled, 0); - - SendMessage(GetDlgItem(hDlg, IDC_CONTROLTYPE), CB_SETCURSEL, joysticks[controller].controllertype, 0); - SendMessage(GetDlgItem(hDlg, IDC_DEADZONE), CB_SETCURSEL, joysticks[controller].deadzone, 0); - - UpdateVisibleItems(hDlg, joysticks[controller].controllertype); - - if(joysticks[controller].controllertype == CTL_TYPE_JOYSTICK) - SetButton(hDlg, IDTEXT_DPAD, joysticks[controller].dpad); - else - { - SetButton(hDlg, IDTEXT_DPAD, joysticks[controller].dpad2[CTL_D_PAD_UP]); - SetButton(hDlg, IDTEXT_DPAD_DOWN, joysticks[controller].dpad2[CTL_D_PAD_DOWN]); - SetButton(hDlg, IDTEXT_DPAD_LEFT, joysticks[controller].dpad2[CTL_D_PAD_LEFT]); - SetButton(hDlg, IDTEXT_DPAD_RIGHT, joysticks[controller].dpad2[CTL_D_PAD_RIGHT]); - } -} - -// Get dialog items -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void GetControllerAll(HWND hDlg, int controller) -{ - joysticks[controller].ID = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYNAME), CB_GETCURSEL, 0, 0); - - joysticks[controller].buttons[CTL_L_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERL); - joysticks[controller].buttons[CTL_R_SHOULDER] = GetButton(hDlg, IDTEXT_SHOULDERR); - joysticks[controller].buttons[CTL_A_BUTTON] = GetButton(hDlg, IDTEXT_A); - joysticks[controller].buttons[CTL_B_BUTTON] = GetButton(hDlg, IDTEXT_B); - joysticks[controller].buttons[CTL_X_BUTTON] = GetButton(hDlg, IDTEXT_X); - joysticks[controller].buttons[CTL_Y_BUTTON] = GetButton(hDlg, IDTEXT_Y); - joysticks[controller].buttons[CTL_Z_TRIGGER] = GetButton(hDlg, IDTEXT_Z); - joysticks[controller].buttons[CTL_START] = GetButton(hDlg, IDTEXT_START); - - joysticks[controller].halfpress = GetButton(hDlg, IDTEXT_HALFPRESS); - - if(joysticks[controller].controllertype == CTL_TYPE_JOYSTICK) - joysticks[controller].dpad = GetButton(hDlg, IDTEXT_DPAD); - else - { - joysticks[controller].dpad2[CTL_D_PAD_UP] = GetButton(hDlg, IDTEXT_DPAD); - joysticks[controller].dpad2[CTL_D_PAD_DOWN] = GetButton(hDlg, IDTEXT_DPAD_DOWN); - joysticks[controller].dpad2[CTL_D_PAD_LEFT] = GetButton(hDlg, IDTEXT_DPAD_LEFT); - joysticks[controller].dpad2[CTL_D_PAD_RIGHT] = GetButton(hDlg, IDTEXT_DPAD_RIGHT); - } - - joysticks[controller].axis[CTL_MAIN_X] = GetButton(hDlg, IDTEXT_MX); - joysticks[controller].axis[CTL_MAIN_Y] = GetButton(hDlg, IDTEXT_MY); - joysticks[controller].axis[CTL_SUB_X] = GetButton(hDlg, IDTEXT_SX); - joysticks[controller].axis[CTL_SUB_Y] = GetButton(hDlg, IDTEXT_SY); - - joysticks[controller].enabled = (int)SendMessage(GetDlgItem(hDlg, IDC_JOYATTACH), BM_GETCHECK, 0, 0); - - joysticks[controller].controllertype = (int)SendMessage(GetDlgItem(hDlg, IDC_CONTROLTYPE), CB_GETCURSEL, 0, 0); - joysticks[controller].deadzone = (int)SendMessage(GetDlgItem(hDlg, IDC_DEADZONE), CB_GETCURSEL, 0, 0); -} - -void UpdateVisibleItems(HWND hDlg, int controllertype) -{ - /* - if(controllertype == CTL_TYPE_KEYBOARD) - ComboBox_Enable(GetDlgItem(hDlg, IDC_JOYNAME), FALSE); - else - ComboBox_Enable(GetDlgItem(hDlg, IDC_JOYNAME), TRUE); - */ - - if(controllertype) - { - // 4 extra buttons - ShowWindow(GetDlgItem(hDlg, IDTEXT_DPAD_DOWN), TRUE); - ShowWindow(GetDlgItem(hDlg, IDTEXT_DPAD_LEFT), TRUE); - ShowWindow(GetDlgItem(hDlg, IDTEXT_DPAD_RIGHT), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_DOWN), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_LEFT), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_RIGHT), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT1), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT2), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT3), TRUE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT4), TRUE); - } - else - { - ShowWindow(GetDlgItem(hDlg, IDTEXT_DPAD_DOWN), FALSE); - ShowWindow(GetDlgItem(hDlg, IDTEXT_DPAD_LEFT), FALSE); - ShowWindow(GetDlgItem(hDlg, IDTEXT_DPAD_RIGHT), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_DOWN), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_LEFT), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_RIGHT), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT1), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT2), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT3), FALSE); - ShowWindow(GetDlgItem(hDlg, IDC_DPAD_TEXT4), FALSE); - } -} - -// Set text in static text item -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void SetButton(HWND hDlg, int item, int value) -{ - char format[8]; - sprintf(format, "%d", value); - SetDlgItemText(hDlg, item, format); -} - -// Get text from static text item -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -int GetButton(HWND hDlg, int item) -{ - char format[8]; - GetDlgItemText(hDlg, item, format, sizeof(format)); - return atoi(format); -} - -////////////////////////////////////////////////////////////////////////////////////////// -// About dialog functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - -void OpenAbout(HINSTANCE hInst, HWND _hParent) -{ - DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), _hParent, (DLGPROC)AboutDlg); -} - -BOOL CALLBACK AboutDlg(HWND abouthWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - char format[0xFFF]; - - switch (message) - { - case WM_INITDIALOG: - sprintf(format,"nJoy v"INPUT_VERSION" by Falcon4ever\n" - "Release: "RELDAY"/"RELMONTH"/"RELYEAR"\n" - "www.multigesture.net"); - SetDlgItemText(abouthWnd,IDC_ABOUT_TEXT,format); - - sprintf(format, THANKYOU); - SetDlgItemText(abouthWnd,IDC_ABOUT_TEXT2,format); - - sprintf(format, INPUT_STATE); - SetDlgItemText(abouthWnd,IDC_ABOUT_TEXT3,format); - break; - - case WM_COMMAND: - if (LOWORD(wParam) == IDOK) - { - EndDialog(abouthWnd, LOWORD(wParam)); - return TRUE; - } - break; - } - - return FALSE; -} -#endif -#endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/config.h b/Source/Plugins/Plugin_nJoy_SDL/Src/config.h deleted file mode 100644 index 998b965b1f..0000000000 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/config.h +++ /dev/null @@ -1,74 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////// -// Project description -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy -// Description: A Dolphin Compatible Input Plugin -// -// Author: Falcon4ever (nJoy@falcon4ever.com) -// Site: www.multigesture.net -// Copyright (C) 2003-2008 Dolphin Project. -// -////////////////////////////////////////////////////////////////////////////////////////// -// -// Licensetype: GNU General Public License (GPL) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. -// -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ -// -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ -// -////////////////////////////////////////////////////////////////////////////////////////// - -// whole file... until we fix the GUI -#ifndef USE_WXWIDGETS -#ifdef _WIN32 - -#include // includes basic windows functionality -#include -#include -#include // includes the common control header - -#include "../Res/resource.h" // includes GUI IDs - -////////////////////////////////////////////////////////////////////////////////////////// -// Config dialog functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - -int OpenConfig(HINSTANCE hInst, HWND _hParent); -BOOL ControllerTab(HWND hDlg, UINT message, UINT wParam, LONG lParam, int controller); -BOOL APIENTRY ControllerTab1(HWND hDlg, UINT message, UINT wParam, LONG lParam); -BOOL APIENTRY ControllerTab2(HWND hDlg, UINT message, UINT wParam, LONG lParam); -BOOL APIENTRY ControllerTab3(HWND hDlg, UINT message, UINT wParam, LONG lParam); -BOOL APIENTRY ControllerTab4(HWND hDlg, UINT message, UINT wParam, LONG lParam); - -bool GetButtons(HWND hDlg, int buttonid, int controller); -bool GetHats(HWND hDlg, int buttonid, int controller); -bool GetAxis(HWND hDlg, int buttonid, int controller); - -void UpdateVisibleItems(HWND hDlg, int controllertype); - -void GetControllerAll(HWND hDlg, int controller); -void SetControllerAll(HWND hDlg, int controller); - -int GetButton(HWND hDlg, int item); -void SetButton(HWND hDlg, int item, int value); - -////////////////////////////////////////////////////////////////////////////////////////// -// About dialog functions -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ - -void OpenAbout(HINSTANCE hInst, HWND _hParent); -BOOL CALLBACK AboutDlg(HWND abouthWnd, UINT message, WPARAM wParam, LPARAM lParam); - -#endif -#endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 7ce5e741d9..feae4d66f7 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -80,7 +80,6 @@ HRESULT SetDeviceForcesXY(); ////////////////////////////////////////////////////////////////////////////////////////// // wxWidgets // ŻŻŻŻŻŻŻŻŻ -#ifdef USE_WXWIDGETS class wxDLLApp : public wxApp { bool OnInit() @@ -91,7 +90,6 @@ class wxDLLApp : public wxApp IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); -#endif ////////////////////////////////////////////////////////////////////////////////////////// // DllMain @@ -100,10 +98,7 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle DWORD dwReason, // reason called LPVOID lpvReserved) // reserved -{ - - - #ifdef USE_WXWIDGETS +{ switch (dwReason) { case DLL_PROCESS_ATTACH: @@ -126,10 +121,7 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle default: break; } - #else - InitCommonControls(); - #endif - + nJoy_hInst = hinstDLL; return TRUE; } @@ -160,82 +152,58 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) // Call about dialog // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void DllAbout(HWND _hParent) -{ - #ifdef USE_WXWIDGETS - #ifdef _WIN32 - wxWindow win; - win.SetHWND((WXHWND)_hParent); - win.Enable(false); - - AboutBox frame(&win); - frame.ShowModal(); +{ + #ifdef _WIN32 + wxWindow win; + win.SetHWND((WXHWND)_hParent); + win.Enable(false); + + AboutBox frame(&win); + frame.ShowModal(); - win.Enable(true); - win.SetHWND(0); + win.Enable(true); + win.SetHWND(0); - #else - AboutBox frame(NULL); - frame.ShowModal(); - #endif #else - #ifdef _WIN32 - OpenAbout(nJoy_hInst, _hParent); - #endif + AboutBox frame(NULL); + frame.ShowModal(); #endif } // Call config dialog // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void DllConfig(HWND _hParent) -{ +{ + #ifdef _WIN32 + if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) + { + MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); + return; + } - #ifdef USE_WXWIDGETS - #ifdef _WIN32 - if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) - { - MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); - return; - } + LoadConfig(); // load settings - LoadConfig(); // load settings + wxWindow win; + win.SetHWND((WXHWND)_hParent); + win.Enable(false); + + ConfigBox frame(&win); + frame.ShowModal(); - wxWindow win; - win.SetHWND((WXHWND)_hParent); - win.Enable(false); - - ConfigBox frame(&win); - frame.ShowModal(); + win.Enable(true); + win.SetHWND(0); - win.Enable(true); - win.SetHWND(0); - - #else - if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) - { - printf("Could not initialize SDL! (%s)\n", SDL_GetError()); - return; - } - - LoadConfig(); // load settings - - ConfigBox frame(NULL); - frame.ShowModal(); - #endif #else - #ifdef _WIN32 - if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) - { - MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); - return; - } + if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) + { + printf("Could not initialize SDL! (%s)\n", SDL_GetError()); + return; + } - LoadConfig(); // load settings - if(OpenConfig(nJoy_hInst, _hParent)) - { - SaveConfig(); - } - LoadConfig(); // reload settings - #endif + LoadConfig(); // load settings + + ConfigBox frame(NULL); + frame.ShowModal(); #endif } diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h index 505d96eb84..9809df7d00 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h @@ -29,9 +29,6 @@ // ////////////////////////////////////////////////////////////////////////////////////////// -// Set this if you want to use the new wxWidgets GUI -#define USE_WXWIDGETS - // Set this if you want to use the rumble 'hack' for controller one //#define USE_RUMBLE_DINPUT_HACK @@ -64,12 +61,8 @@ #include #endif -#ifdef USE_WXWIDGETS #include "GUI/AboutBox.h" #include "GUI/ConfigBox.h" -#else -#include "config.h" -#endif #include "Common.h" #include "pluginspecs_pad.h"