diff --git a/desmume/ChangeLog b/desmume/ChangeLog index 233d01c25..418550a8e 100644 --- a/desmume/ChangeLog +++ b/desmume/ChangeLog @@ -67,6 +67,7 @@ - Rewrite all debug tools (autoupdate work now) [CrazyMax] - Add AVI output [zeromus] - Remove multithreading from user interface after finding several synchronization issues [zeromus] + - Rewrite input core & replace config input dialog [CrazyMax] 0.7.3 -> 0.8 Cocoa: diff --git a/desmume/src/common.cpp b/desmume/src/common.cpp index 4a64128a5..b21a6b11e 100644 --- a/desmume/src/common.cpp +++ b/desmume/src/common.cpp @@ -53,6 +53,13 @@ void GetINIPath() } } +void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file) +{ + char temp[256] = ""; + sprintf(temp, "%d", val); + WritePrivateProfileString(appname, keyname, temp, file); +} + #endif u8 reverseBitsInByte(u8 x) diff --git a/desmume/src/common.h b/desmume/src/common.h index 5d9527cbd..af85aa4ac 100644 --- a/desmume/src/common.h +++ b/desmume/src/common.h @@ -36,6 +36,7 @@ extern HINSTANCE hAppInst; extern char IniName[MAX_PATH]; extern void GetINIPath(); +extern void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file); #endif extern u8 reverseBitsInByte(u8 x); diff --git a/desmume/src/windows/ConfigKeys.cpp b/desmume/src/windows/ConfigKeys.cpp deleted file mode 100644 index ab9830133..000000000 --- a/desmume/src/windows/ConfigKeys.cpp +++ /dev/null @@ -1,490 +0,0 @@ -/* - Copyright (C) 2006-2007 Normmatt - - This file is part of DeSmuME - - DeSmuME 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; either version 2 of the License, or - (at your option) any later version. - - DeSmuME 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 for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#define DIRECTINPUT_VERSION 0x0800 - -#include -#include -#include -#include -#include -#include -#include "directx/dinput.h" - -#include "CWindow.h" -#include "ConfigKeys.h" - -#include "../debug.h" -#include "../common.h" -#include "resource.h" - -const char *tabkeytext[52] = {"0","1","2","3","4","5","6","7","8","9","A","B","C", -"D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X", -"Y","Z","SPACE","UP","DOWN","LEFT","RIGHT","TAB","SHIFT","DEL","INSERT","HOME","END","ENTER", -"Joystick UP","Joystick DOWN","Joystick LEFT","Joystick RIGHT"}; - -DWORD dds_up=37; -DWORD dds_down=38; -DWORD dds_left=39; -DWORD dds_right=40; - -DWORD dds_a=31; -DWORD dds_b=11; -DWORD dds_x=16; -DWORD dds_y=17; - -DWORD dds_l=12; -DWORD dds_r=23; - -DWORD dds_select=36; -DWORD dds_start=47; - -DWORD dds_debug=13; - -extern DWORD ds_up; -extern DWORD ds_down; -extern DWORD ds_left; -extern DWORD ds_right; -extern DWORD ds_a; -extern DWORD ds_b; -extern DWORD ds_x; -extern DWORD ds_y; -extern DWORD ds_l; -extern DWORD ds_r; -extern DWORD ds_select; -extern DWORD ds_start; - -#define KEY_UP ds_up -#define KEY_DOWN ds_down -#define KEY_LEFT ds_left -#define KEY_RIGHT ds_right -#define KEY_X ds_x -#define KEY_Y ds_y -#define KEY_A ds_a -#define KEY_B ds_b -#define KEY_L ds_l -#define KEY_R ds_r -#define KEY_START ds_start -#define KEY_SELECT ds_select -#define KEY_DEBUG ds_debug - -/* DirectInput stuff */ -char g_cDIBuf[512]; -LPDIRECTINPUT8 g_pDI; -LPDIRECTINPUTDEVICE8 g_pKeyboard; -LPDIRECTINPUTDEVICE8 g_pJoystick; -DIDEVCAPS g_DIJoycap; - -void ReadConfig(void) -{ - FILE *fp; - int i; - - i=GetPrivateProfileInt("Keys","Key_A",31, IniName); - KEY_A = i; - - i=GetPrivateProfileInt("Keys","Key_B",11, IniName); - KEY_B = i; - - i=GetPrivateProfileInt("Keys","Key_SELECT",36, IniName); - KEY_SELECT = i; - - i=GetPrivateProfileInt("Keys","Key_START",13, IniName); - if(i==13) - KEY_START = 47; - else - KEY_START = i; - - i=GetPrivateProfileInt("Keys","Key_RIGHT",40, IniName); - KEY_RIGHT = i; - - i=GetPrivateProfileInt("Keys","Key_LEFT",39, IniName); - KEY_LEFT = i; - - i=GetPrivateProfileInt("Keys","Key_UP",37, IniName); - KEY_UP = i; - - i=GetPrivateProfileInt("Keys","Key_DOWN",38, IniName); - KEY_DOWN = i; - - i=GetPrivateProfileInt("Keys","Key_R",23, IniName); - KEY_R = i; - - i=GetPrivateProfileInt("Keys","Key_L",12, IniName); - KEY_L = i; - - i=GetPrivateProfileInt("Keys","Key_X",16, IniName); - KEY_X = i; - - i=GetPrivateProfileInt("Keys","Key_Y",17, IniName); - KEY_Y = i; - - /*i=GetPrivateProfileInt("Keys","Key_DEBUG",13, IniName); - KEY_DEBUG = i;*/ -} - -void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file) -{ - char temp[256] = ""; - sprintf(temp, "%d", val); - WritePrivateProfileString(appname, keyname, temp, file); -} - -void WriteConfig(void) -{ - FILE *fp; - int i; - - WritePrivateProfileInt("Keys","Key_A",KEY_A,IniName); - WritePrivateProfileInt("Keys","Key_B",KEY_B,IniName); - WritePrivateProfileInt("Keys","Key_SELECT",KEY_SELECT,IniName); - - if(KEY_START==47) - WritePrivateProfileInt("Keys","Key_START",13,IniName); - else - WritePrivateProfileInt("Keys","Key_START",KEY_START,IniName); - - WritePrivateProfileInt("Keys","Key_RIGHT",KEY_RIGHT,IniName); - WritePrivateProfileInt("Keys","Key_LEFT",KEY_LEFT,IniName); - WritePrivateProfileInt("Keys","Key_UP",KEY_UP,IniName); - WritePrivateProfileInt("Keys","Key_DOWN",KEY_DOWN,IniName); - WritePrivateProfileInt("Keys","Key_R",KEY_R,IniName); - WritePrivateProfileInt("Keys","Key_L",KEY_L,IniName); - WritePrivateProfileInt("Keys","Key_X",KEY_X,IniName); - WritePrivateProfileInt("Keys","Key_Y",KEY_Y,IniName); - /*WritePrivateProfileInt("Keys","Key_DEBUG",KEY_DEBUG,IniName);*/ -} - -void dsDefaultKeys(void) -{ - KEY_A=dds_a; - KEY_B=dds_b; - KEY_SELECT=dds_select; - KEY_START=dds_start; - KEY_RIGHT=dds_right; - KEY_LEFT=dds_left; - KEY_UP=dds_up; - KEY_DOWN=dds_down; - KEY_R=dds_r; - KEY_L=dds_l; - KEY_X=dds_x; - KEY_Y=dds_y; - //KEY_DEBUG=dds_debug; -} - -DWORD key_combos[12]={ -IDC_COMBO1, -IDC_COMBO2, -IDC_COMBO3, -IDC_COMBO4, -IDC_COMBO5, -IDC_COMBO6, -IDC_COMBO7, -IDC_COMBO8, -IDC_COMBO9, -IDC_COMBO10, -IDC_COMBO11, -IDC_COMBO12}; - -#if 1 -BOOL CALLBACK ConfigView_Proc(HWND dialog,UINT komunikat,WPARAM wparam,LPARAM lparam) -{ - int i,j; - char tempstring[256]; - switch(komunikat) - { - case WM_INITDIALOG: - ReadConfig(); - if (g_pKeyboard) - for(i=0;i<48;i++) - for(j=0;j<12;j++) - SendDlgItemMessage(dialog,key_combos[j],CB_ADDSTRING,0,(LPARAM)tabkeytext[i]); - if (g_pJoystick) - { - for(i=0;i<4;i++) - for(j=0;j<12;j++) - SendDlgItemMessage(dialog,key_combos[j],CB_ADDSTRING,0,(LPARAM)tabkeytext[i+48]); - for(i=0;idwType & DIDFT_AXIS ) - { - DIPROPRANGE diprg; - diprg.diph.dwSize = sizeof(DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYID; - diprg.diph.dwObj = pdidoi->dwType; - diprg.lMin = -3; - diprg.lMax = 3; - - if( FAILED(IDirectInputDevice8_SetProperty(g_pJoystick,DIPROP_RANGE,&diprg.diph))) - return DIENUM_STOP; - } - return DIENUM_CONTINUE; -} -HRESULT Input_Init(HWND hwnd) -{ - HRESULT hr; - int res; - - ReadConfig(); - g_pKeyboard=NULL; g_pJoystick=NULL; - - if(!FAILED(DirectInput8Create(GetModuleHandle(NULL),DIRECTINPUT_VERSION,IID_IDirectInput8,(void**)&g_pDI,NULL))) - { - //******************* Keyboard - res=0; - if (FAILED(IDirectInput8_CreateDevice(g_pDI,GUID_SysKeyboard,&g_pKeyboard,NULL))) res=-1; - else - if (FAILED(IDirectInputDevice8_SetDataFormat(g_pKeyboard,&c_dfDIKeyboard))) res=-1; - else - if (FAILED(IDirectInputDevice8_SetCooperativeLevel(g_pKeyboard,hwnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE))) res=-1; - if (res!=0) - { - if(g_pKeyboard) IDirectInputDevice8_Release(g_pKeyboard); - g_pKeyboard=NULL; - } - - //******************** Joystick - res=0; - if(FAILED(IDirectInput8_CreateDevice(g_pDI,GUID_Joystick,&g_pJoystick,NULL))) res=-1; - else - if(FAILED(IDirectInputDevice8_SetDataFormat(g_pJoystick,&c_dfDIJoystick2))) res=-1; - else - if(FAILED(IDirectInputDevice8_SetCooperativeLevel(g_pJoystick,hwnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE))) res=-1; - if (res!=0) - { - if(g_pJoystick) IDirectInputDevice8_Release(g_pJoystick); - g_pJoystick=NULL; - } - else - { - IDirectInputDevice8_EnumObjects(g_pJoystick,JoyObjects,(VOID*)hwnd,DIDFT_ALL); - memset(&g_DIJoycap,0,sizeof(DIDEVCAPS)); - g_DIJoycap.dwSize=sizeof(DIDEVCAPS); - IDirectInputDevice8_GetCapabilities(g_pJoystick,&g_DIJoycap); - } - } - else return E_FAIL; - - if ((g_pKeyboard==NULL)&&(g_pJoystick==NULL)) - { - Input_DeInit(); - return E_FAIL; - } - return S_OK; -} - -HRESULT Input_DeInit() -{ - if (g_pDI) - { - HRESULT hr; - if (g_pKeyboard) - { - hr=IDirectInputDevice8_Unacquire(g_pKeyboard); -#ifdef DEBUG - if (FAILED(hr)) LOG("DINPUT: error keyboard unacquire (0x%08X)\n",hr); -#endif - hr=IDirectInputDevice8_Release(g_pKeyboard); -#ifdef DEBUG - if (FAILED(hr)) LOG("DINPUT: error keyboard release (0x%08X)\n",hr); -#endif - g_pKeyboard=NULL; - } - if (g_pJoystick) - { - hr=IDirectInputDevice8_Unacquire(g_pJoystick); -#ifdef DEBUG - if (FAILED(hr)) LOG("DINPUT: error joystick unacquire (0x%08X)\n",hr); -#endif - hr=IDirectInputDevice8_Release(g_pJoystick); -#ifdef DEBUG - if (FAILED(hr)) LOG("DINPUT: error joystick release (0x%08X)\n",hr); -#endif - g_pJoystick=NULL; - } - IDirectInput8_Release(g_pDI); - g_pDI=NULL; - } - return S_OK; -} - -void Input_Process() -{ - HRESULT hr; - DIJOYSTATE2 JoyStatus; - - long source,psource; - - memset(g_cDIBuf,0,sizeof(g_cDIBuf)); - if(g_pKeyboard) - { - hr=IDirectInputDevice8_GetDeviceState(g_pKeyboard,256,g_cDIBuf); - if (FAILED(hr)) IDirectInputDevice8_Acquire(g_pKeyboard); - } - - if(g_pJoystick) - { - hr=IDirectInputDevice8_Poll(g_pJoystick); - if (FAILED(hr)) IDirectInputDevice8_Acquire(g_pJoystick); - else - { - hr=IDirectInputDevice8_GetDeviceState(g_pJoystick,sizeof(JoyStatus),&JoyStatus); - if (FAILED(hr)) hr=IDirectInputDevice8_Acquire(g_pJoystick); - else - { - if (JoyStatus.lX<-1) g_cDIBuf[258]=-128; - if (JoyStatus.lX>1) g_cDIBuf[259]=-128; - if (JoyStatus.lY<-1) g_cDIBuf[256]=-128; - if (JoyStatus.lY>1) g_cDIBuf[257]=-128; - - if (JoyStatus.rgdwPOV[0]==0) g_cDIBuf[256]=-128; - if (JoyStatus.rgdwPOV[0]==4500) { g_cDIBuf[256]=-128; g_cDIBuf[259]=-128;} - if (JoyStatus.rgdwPOV[0]==9000) g_cDIBuf[259]=-128; - if (JoyStatus.rgdwPOV[0]==13500) { g_cDIBuf[259]=-128; g_cDIBuf[257]=-128;} - if (JoyStatus.rgdwPOV[0]==18000) g_cDIBuf[257]=-128; - if (JoyStatus.rgdwPOV[0]==22500) { g_cDIBuf[257]=-128; g_cDIBuf[258]=-128;} - if (JoyStatus.rgdwPOV[0]==27000) g_cDIBuf[258]=-128; - if (JoyStatus.rgdwPOV[0]==31500) { g_cDIBuf[258]=-128; g_cDIBuf[256]=-128;} - memcpy(g_cDIBuf+260,JoyStatus.rgbButtons,sizeof(JoyStatus.rgbButtons)); - } - } - } -} - -//============================================================ New config dialog -//============================================================ -//============================================================ -//============================================================ -//============================================================ -//============================================================ -//============================================================ -//============================================================ -#if 0 -bool CALLBACK InputConfigDlgProc( HWND hDlg, - UINT uMessage, - WPARAM wParam, - LPARAM lParam) -{ - switch (uMessage) - { - case WM_INITDIALOG: - return true; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: - EndDialog(hDlg, IDOK); - break; - - case IDCANCEL: - EndDialog(hDlg, IDOK); - break; - } - return true; - } - - //return false; - return DefWindowProc( hDlg, uMessage, wParam, lParam); -} -#endif -void InputConfig(HWND hwnd) -{ - //DialogBox(hAppInst,MAKEINTRESOURCE(IDD_INPUT), hwnd, (DLGPROC) InputConfigDlgProc); - DialogBox(hAppInst,MAKEINTRESOURCE(IDD_CONFIG), hwnd, (DLGPROC) ConfigView_Proc); -} - diff --git a/desmume/src/windows/ConfigKeys.h b/desmume/src/windows/ConfigKeys.h deleted file mode 100644 index 9d29b31fe..000000000 --- a/desmume/src/windows/ConfigKeys.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2006-2007 Normmatt - - This file is part of DeSmuME - - DeSmuME 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; either version 2 of the License, or - (at your option) any later version. - - DeSmuME 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 for more details. - - You should have received a copy of the GNU General Public License - along with DeSmuME; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef CONFIGKEYS_H -#define CONFIGKEYS_H - -#define DIRECTINPUT_VERSION 0x0800 -#include "directx/dinput.h" - -#include "common.h" - -extern const DWORD tabkey[48]; -extern DWORD ds_up; -extern DWORD ds_down; -extern DWORD ds_left; -extern DWORD ds_right; -extern DWORD ds_a; -extern DWORD ds_b; -extern DWORD ds_x; -extern DWORD ds_y; -extern DWORD ds_l; -extern DWORD ds_r; -extern DWORD ds_select; -extern DWORD ds_start; -extern DWORD ds_debug; - -extern char g_cDIBuf[512]; -extern LPDIRECTINPUT8 g_pDI; -extern LPDIRECTINPUTDEVICE8 g_pKeyboard; -extern LPDIRECTINPUTDEVICE8 g_pJoystick; - -void ReadConfig (void); -HRESULT Input_Init (HWND hwnd); -HRESULT Input_DeInit (void); -void Input_Process (void); - -//BOOL CALLBACK ConfigView_Proc(HWND dialog,UINT komunikat,WPARAM wparam,LPARAM lparam); -void InputConfig(HWND hwnd); -void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file); - -#endif diff --git a/desmume/src/windows/DeSmuME_2005.vcproj b/desmume/src/windows/DeSmuME_2005.vcproj index f2dbc2f8b..c0beaf722 100644 --- a/desmume/src/windows/DeSmuME_2005.vcproj +++ b/desmume/src/windows/DeSmuME_2005.vcproj @@ -567,14 +567,6 @@ RelativePath=".\colorctrl.h" > - - - - @@ -623,6 +615,14 @@ RelativePath=".\ginfo.h" > + + + + diff --git a/desmume/src/windows/DeSmuME_2008.vcproj b/desmume/src/windows/DeSmuME_2008.vcproj index a6edaf3cc..bf386ac21 100644 --- a/desmume/src/windows/DeSmuME_2008.vcproj +++ b/desmume/src/windows/DeSmuME_2008.vcproj @@ -782,10 +782,6 @@ RelativePath=".\colorctrl.cpp" > - - @@ -810,6 +806,10 @@ RelativePath=".\ginfo.cpp" > + + @@ -892,10 +892,6 @@ RelativePath=".\colorctrl.h" > - - @@ -916,6 +912,10 @@ RelativePath=".\ginfo.h" > + + diff --git a/desmume/src/windows/DeSmuME_Intel.icproj b/desmume/src/windows/DeSmuME_Intel.icproj index d81598842..39a8c06e0 100644 --- a/desmume/src/windows/DeSmuME_Intel.icproj +++ b/desmume/src/windows/DeSmuME_Intel.icproj @@ -5,7 +5,7 @@ Name="DeSmuME_Intel" ProjectGUID="{F26376D4-B1A6-4ACC-9B2C-5CB92B9E7B80}" VCNestedProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}" - VCNestedProjectCRC32="4086597408" + VCNestedProjectCRC32="3618436881" VCNestedProjectFileName="DeSmuME_Intel.vcproj"> + + + + + + - + Name="VCManagedResourceCompilerTool"/> + Name="PreLinkEventTool"/> + + + + + Name="VCFxCopTool"/> + Name="VCAppVerifierTool"/> - - - + + + + + + - + Name="VCManagedResourceCompilerTool"/> + Name="PreLinkEventTool"/> + + + + + Name="VCFxCopTool"/> + Name="VCAppVerifierTool"/> - - - @@ -133,119 +157,145 @@ OutputDirectory="$(SolutionDir)\__bins" IntermediateDirectory="$(SolutionDir)\.Intel\$(ConfigurationName)\$(PlatformName)" ConfigurationType="1" - WholeProgramOptimization="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"/> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + WholeProgramOptimization="1"/> + + + + + + - + Name="VCManagedResourceCompilerTool"/> + Name="PreLinkEventTool"/> + + + + + Name="VCFxCopTool"/> + Name="VCAppVerifierTool"/> - - - + + + + + + - + Name="VCManagedResourceCompilerTool"/> + Name="PreLinkEventTool"/> + + + + + Name="VCFxCopTool"/> + Name="VCAppVerifierTool"/> - - - @@ -254,430 +304,605 @@ OutputDirectory="$(SolutionDir)\__bins" IntermediateDirectory="$(SolutionDir)\.Intel\$(ConfigurationName)\$(PlatformName)" ConfigurationType="1" - WholeProgramOptimization="1" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"/> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + WholeProgramOptimization="1"/> + + + + + + - + Name="VCManagedResourceCompilerTool"/> + Name="PreLinkEventTool"/> + + + + + Name="VCFxCopTool"/> + Name="VCAppVerifierTool"/> - - - + + + + + + - + Name="VCManagedResourceCompilerTool"/> + Name="PreLinkEventTool"/> + + + + + Name="VCFxCopTool"/> + Name="VCAppVerifierTool"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/desmume/src/windows/DeSmuME_Intel.vcproj b/desmume/src/windows/DeSmuME_Intel.vcproj index 8f31bfd8f..477846ba0 100644 --- a/desmume/src/windows/DeSmuME_Intel.vcproj +++ b/desmume/src/windows/DeSmuME_Intel.vcproj @@ -1,7 +1,7 @@ - - @@ -812,6 +808,10 @@ RelativePath=".\ginfo.cpp" > + + @@ -894,10 +894,6 @@ RelativePath=".\colorctrl.h" > - - @@ -918,6 +914,10 @@ RelativePath=".\ginfo.h" > + + diff --git a/desmume/src/windows/FirmConfig.cpp b/desmume/src/windows/FirmConfig.cpp index d71b09523..6b03fcd08 100644 --- a/desmume/src/windows/FirmConfig.cpp +++ b/desmume/src/windows/FirmConfig.cpp @@ -29,7 +29,6 @@ #include "resource.h" #include "FirmConfig.h" -#include "ConfigKeys.h" #include "../debug.h" #include "../common.h" diff --git a/desmume/src/windows/inputdx.cpp b/desmume/src/windows/inputdx.cpp new file mode 100644 index 000000000..8c880918e --- /dev/null +++ b/desmume/src/windows/inputdx.cpp @@ -0,0 +1,574 @@ +/* Copyright (C) 2006 yopyop + yopyop156@ifrance.com + yopyop156.ifrance.com + + Copyright (C) 2006-2008 DeSmuME team + + This file is part of DeSmuME + + DeSmuME 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; either version 2 of the License, or + (at your option) any later version. + + DeSmuME 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 for more details. + + You should have received a copy of the GNU General Public License + along with DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#define DIRECTINPUT_VERSION 0x0800 + +#include "inputdx.h" +#include "directx\dinput.h" +#include "..\mem.h" +#include "..\debug.h" +#include "..\MMU.h" +#include "..\common.h" +#include "resource.h" + +// ==================================================== emu input +// ======================================================================= +#define IDD_INPUT_TIMER 1000000 + +const char *DIkeysNames[0xEF] = +{ + "N/A", + // Main keyboard 0x01 + "ESC", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "BSPACE", + "Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "Enter", + "LCtrl", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "\'", "GRAVE", "LShift", "\\", + "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "RShift", + // Numeric keypad 0x37 + "Num *", + // Main keyboard 0x38 + "LAlt", "SPACE", "~CAP", + "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", + // Numeric keypad 0x45 + "NumLock", "Scrool", "Num 7", "Num 8", "Num 9", + "Num -", "Num 4", "Num 5", "Num 6", "Num +", + "Num 1", "Num 2", "Num 3", "Num 0", "Num .", + // Reserved 0x54 + "", "", + // non US keyboards 0x56 + "oem", + // func keyboard 0x57 + "F11", "F12", + // Reserved 0x59 + "", "", "", "", "", "", "", "", "", "", "", + // PC98 0x64 + "F13", "F14", "F15", + // Reserved 0x67 + "", "", "", "", "", "", "", "", "", + // Japanise 0x70 + "KANA", + // Reserved 0x71 + "", "", + // Brazilian 0x73 + "ABNT_C1", + // Reserved 0x74 + "", "", "", "", "", + // Japanise 0x79 + "Convert", + // Reserved 0x7A + "", + // Japanise 0x7B + "Noconvert", + // Reserved 0x7C + "", + // Japanise 0x7D + "Yen", + // Brazilian 0x7E + "ABNT_C2", + // Reserved 0x7F + "", "", "", "", "", "", "", "", "", "", "", "", "", "", + // PC98 0x8D + "N =", + // Reserved 0x8E + "", "", + // ext 0x90 + "PTrack", + // PC98 0x91 + "AT", "Colon", "Underline", + // Japanise 0x94 + "Kanji", + // PC98 0x95 + "Stop", + // Japanise 0x96 + "AX", "Unlab", + // Reseved 0x98 + "", + // ext 0x99 + "NTrack", + // Reserved 0x9A + "", "", + // Numeric keypad 0x9C + "Num enter", "RCtrl", + // Reserved 0x9E + "", "", + // ext 0xA0 + "Mute", "Calc", "Play", + // Reserved 0xA3 + "", + // ext 0xA4 + "Stop", + // Reserved 0xA5 + "", "", "", "", "", "", "", "", "", + // ext 0xAE + "Vol-", + // Reserved 0xAF + "", + // ext 0xB0 + "Vol+", + // Reserved 0xB1 + "", + // Web 0xB2 + "Web Home", + // Numeric keypad (PC98) 0xB3 + "Num ,", + // Reserved 0xB4 + "", + // Numeric keypad 0xB5 + "Num /", + // Reserved 0xB6 + "", + // Main keyboard 0xB7 + "SysRq", "RAlt", + // Reserved 0xB9 + "", "", "", "", "", "", "", "", "", "", "", "", + // Main keyboard 0xC5 + "Pause", + // Reserved 0xC6 + "", + // Main keyboard 0xC7 + "Home", "Up", "PgUp", + // Reserved 0xCA + "", + // Main keyboard 0xCB + "Left", + // Reserved 0xCC + "", + // Main keyboard 0xCD + "Right", + // Reserved 0xCE + "", + // Main keyboard 0xCF + "End", "Down", "PgDn", "Insert", "Delete", + // Reserved 0xD4 + "", "", "", "", "", "", "", "", + // Main keyboard 0xDB + "LWin", "RWin", "App", "Power", "Sleep", + // Reversed 0xE0 + "", "", "", + // Main keyboard 0xE3 + "Wake", + // Reversed 0xE4 + "", + // Web 0xE5 + "Web Search", "Web Favorites", "Web Refresh", "Web Stop", "Web Forward", "Web Back", + "My Computer", "Mail", "Media Select" + // 0xEE +}; +const char *DIJoyNames[0x04] = { "JUp", "JDown", "JLeft", "JRight" }; + +char *keyPadNames [MAXKEYPAD] = { "A", "B", "SELECT", "START", + "RIGHT", "LEFT", "UP", "DOWN", + "R", "L", "X", "Y", "DEBUG", "FOLD", "POWER" }; + +u16 keyPadDefs[MAXKEYPAD] = {DIK_X, DIK_Z, DIK_RSHIFT, DIK_RETURN, DIK_RIGHT, + DIK_LEFT, DIK_UP, DIK_DOWN, DIK_W, DIK_Q, + DIK_S, DIK_A, 0x00, DIK_BACKSPACE, DIK_PAUSE}; + +const int inputIDs[15]={ IDC_EDIT06, IDC_EDIT05, IDC_EDIT11, IDC_EDIT12, IDC_EDIT03, IDC_EDIT02, IDC_EDIT01, + IDC_EDIT04, IDC_EDIT10, IDC_EDIT09, IDC_EDIT08, IDC_EDIT07, IDC_EDIT14, IDC_EDIT13, + IDC_EDIT15}; + + +u16 keyPad[15]; +extern INPUTCLASS *input; + +// ==================================================== Config Input +INPUTCLASS *inputCfg = NULL; +HWND g_hWnd = NULL; +static int pressed; +static bool tab; +u16 tempKeyPad[MAXKEYPAD]; + +void InputConfigDIProc(BOOL paused, LPSTR buf) +{ + int t; + int i; + + if (pressed == 0) + { + for (t=0; t<512; t++) + { + if (t == DIK_ESCAPE) continue; + if (t == DIK_TAB) continue; + if (t == DIK_LMENU) continue; + if (t == DIK_F1) continue; + if (t == DIK_F2) continue; + if (t == DIK_F3) continue; + if (t == DIK_F4) continue; + if (t == DIK_F5) continue; + if (t == DIK_F6) continue; + if (t == DIK_F7) continue; + if (t == DIK_F8) continue; + if (t == DIK_F9) continue; + if (t == DIK_F10) continue; + if (t == DIK_F11) continue; + if (t == DIK_F12) continue; + if (t == DIK_NUMLOCK) continue; + + if (buf[t] & 0x80) + { + pressed = t; + break; + } + } + } + else + { + if ((pressed == DIK_LSHIFT) && ((buf[DIK_TAB] & 0x80))) tab = true; + if ((pressed == DIK_RSHIFT) && ((buf[DIK_TAB] & 0x80))) tab = true; + + if (!(buf[pressed] & 0x80)) + { + if (!tab) + { + if (pressed>255) + { + if (pressed>255 && pressed<260) + { + SetWindowText(GetFocus(), DIJoyNames[pressed-256]); + } + else + { + char buf[20]; + memset(buf, 0, sizeof(buf)); + wsprintf(buf, "JB%02i", pressed-259); + SetWindowText(GetFocus(), buf); + } + } + else + { + SetWindowText(GetFocus(), DIkeysNames[pressed]); + } + for (i=0; i255) + { + if (tempKeyPad[i]>255 && tempKeyPad[i]<260) + { + SetWindowText(GetDlgItem(hDlg, inputIDs[i]), DIJoyNames[tempKeyPad[i]-256]); + } + else + { + char buf[20]; + memset(buf, 0, sizeof(buf)); + wsprintf(buf, "JB%02i", tempKeyPad[i]-259); + SetWindowText(GetDlgItem(hDlg, inputIDs[i]), buf); + } + } + else + SetWindowText(GetDlgItem(hDlg, inputIDs[i]), DIkeysNames[tempKeyPad[i]]); + } + + if (!inputCfg->Init(hDlg, &InputConfigDIProc)) + printlog("Input config: Error initialize DirectInput\n"); + SetTimer(hDlg, IDD_INPUT_TIMER, 100, NULL); + return true; + + case WM_TIMER: + inputCfg->process(); + return true; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDOK: + if (GetFocus() == GetDlgItem(hDlg, IDOK)) + { + for (int t=0; t255) + { + if (!input->JoystickEnabled()) + { + keyPad[i] = keyPadDefs[i]; + } + } + } +} + +void NDS_inputPost(BOOL paused, LPSTR buf) +{ + if (paused) return; + + u16 pad = (0 | + ((~buf[keyPad[0]] & 0x80) >> 7) | + ((~buf[keyPad[1]] & 0x80) >> 6) | + ((~buf[keyPad[2]] & 0x80) >> 5) | + ((~buf[keyPad[3]] & 0x80) >> 4) | + ((~buf[keyPad[4]] & 0x80) >> 3) | + ((~buf[keyPad[5]] & 0x80) >> 2) | + ((~buf[keyPad[6]] & 0x80) >> 1) | + ((~buf[keyPad[7]] & 0x80)) | + ((~buf[keyPad[8]] & 0x80) << 1) | + ((~buf[keyPad[9]] & 0x80) << 2)) ; + + ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] = (u16)pad; + ((u16 *)MMU.ARM7_REG)[0x130>>1] = (u16)pad; + + u16 padExt = (((u16 *)MMU.ARM7_REG)[0x136>>1] & 0x00F0) | + ((~buf[keyPad[10]] & 0x80) >> 7) | + ((~buf[keyPad[11]] & 0x80) >> 6) | + ((~buf[keyPad[12]] & 0x80) >> 4) | + 0x0034; + + ((u16 *)MMU.ARM7_REG)[0x136>>1] = (u16)padExt; + + // TODO: low power IRQ +} + +// TODO +// ==================================================== GUI input +// ======================================================================= + + +// ==================================================== INPUTCLASS +// =============================================================== +// =============================================================== +// =============================================================== +INPUTCLASS::INPUTCLASS() +{ + hParentWnd = NULL; + inputProc = NULL; +} + +INPUTCLASS::~INPUTCLASS() +{ + if (pDI != NULL) + { + if (pKeyboard != NULL) + { + IDirectInputDevice8_Unacquire(pKeyboard); + IDirectInputDevice8_Release(pKeyboard); + pKeyboard = NULL; + } + + if (pJoystick != NULL) + { + IDirectInputDevice8_Unacquire(pJoystick); + IDirectInputDevice8_Release(pJoystick); + pJoystick = NULL; + } + } +} + +BOOL INPUTCLASS::Init(HWND hParentWnd, INPUTPROC inputProc) +{ + if (hParentWnd == NULL) return FALSE; + if (inputProc == NULL) return FALSE; + + this->hParentWnd = hParentWnd; + + pDI = NULL; + pKeyboard = NULL; + pJoystick = NULL; + memset(cDIBuf, 0, sizeof(cDIBuf)); + + if(FAILED(DirectInput8Create(GetModuleHandle(NULL),DIRECTINPUT_VERSION,IID_IDirectInput8,(void**)&pDI,NULL))) + return FALSE; + + if (!FAILED(IDirectInput8_CreateDevice(pDI,GUID_SysKeyboard,&pKeyboard,NULL))) + { + if (!FAILED(IDirectInputDevice8_SetDataFormat(pKeyboard,&c_dfDIKeyboard))) + { + if (FAILED(IDirectInputDevice8_SetCooperativeLevel(pKeyboard,hParentWnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE))) + { + IDirectInputDevice8_Release(pKeyboard); + pKeyboard = NULL; + } + } + else + { + IDirectInputDevice8_Release(pKeyboard); + pKeyboard = NULL; + } + } + + if (!FAILED(IDirectInput8_CreateDevice(pDI,GUID_Joystick,&pJoystick,NULL))) + { + if(!FAILED(IDirectInputDevice8_SetDataFormat(pJoystick,&c_dfDIJoystick2))) + { + if(FAILED(IDirectInputDevice8_SetCooperativeLevel(pJoystick,hParentWnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE))) + { + IDirectInputDevice8_Release(pJoystick); + pJoystick = NULL; + } + else + { + memset(&DIJoycap,0,sizeof(DIDEVCAPS)); + DIJoycap.dwSize=sizeof(DIDEVCAPS); + IDirectInputDevice8_GetCapabilities(pJoystick,&DIJoycap); + } + } + else + { + IDirectInputDevice8_Release(pJoystick); + pJoystick = NULL; + } + } + + if (pKeyboard == NULL && pJoystick == NULL) return FALSE; + + this->inputProc = inputProc; + +#if 1 + if (pKeyboard != NULL) printlog("DirectX Input: keyboard is initialised\n"); + if (pJoystick != NULL) printlog("DirectX Input: joystick is initialised\n"); +#endif + paused = FALSE; + + return TRUE; +} + +BOOL INPUTCLASS::JoystickEnabled() +{ + return (pJoystick==NULL?FALSE:TRUE); +} + +void INPUTCLASS::process() +{ + HRESULT hr; + + if (paused) return; + if (inputProc == NULL) return; + + if (pKeyboard) + { + hr=IDirectInputDevice8_GetDeviceState(pKeyboard,256,cDIBuf); + if (FAILED(hr)) + { + //printlog("DInput: keyboard acquire\n"); + IDirectInputDevice8_Acquire(pKeyboard); + } + } + + if (pJoystick) + { + DIJOYSTATE2 JoyStatus; + + hr=IDirectInputDevice8_Poll(pJoystick); + if (FAILED(hr)) IDirectInputDevice8_Acquire(pJoystick); + else + { + hr=IDirectInputDevice8_GetDeviceState(pJoystick,sizeof(JoyStatus),&JoyStatus); + if (FAILED(hr)) hr=IDirectInputDevice8_Acquire(pJoystick); + else + { + memset(cDIBuf+255,0,sizeof(cDIBuf)-255); + //TODO: analog + //if (JoyStatus.lX<-1) cDIBuf[258]=-128; + //if (JoyStatus.lX>1) cDIBuf[259]=-128; + //if (JoyStatus.lY<-1) cDIBuf[256]=-128; + //if (JoyStatus.lY>1) cDIBuf[257]=-128; + + if (JoyStatus.rgdwPOV[0]==0) cDIBuf[256]=-128; + if (JoyStatus.rgdwPOV[0]==4500) { cDIBuf[256]=-128; cDIBuf[259]=-128;} + if (JoyStatus.rgdwPOV[0]==9000) cDIBuf[259]=-128; + if (JoyStatus.rgdwPOV[0]==13500) { cDIBuf[259]=-128; cDIBuf[257]=-128;} + if (JoyStatus.rgdwPOV[0]==18000) cDIBuf[257]=-128; + if (JoyStatus.rgdwPOV[0]==22500) { cDIBuf[257]=-128; cDIBuf[258]=-128;} + if (JoyStatus.rgdwPOV[0]==27000) cDIBuf[258]=-128; + if (JoyStatus.rgdwPOV[0]==31500) { cDIBuf[258]=-128; cDIBuf[256]=-128;} + memcpy(cDIBuf+260,JoyStatus.rgbButtons,sizeof(JoyStatus.rgbButtons)); + } + } + } + + this->inputProc(paused, (LPSTR)&cDIBuf); +} +// ==================================================== END INPUTCLASS \ No newline at end of file diff --git a/desmume/src/windows/inputdx.h b/desmume/src/windows/inputdx.h new file mode 100644 index 000000000..234fc8520 --- /dev/null +++ b/desmume/src/windows/inputdx.h @@ -0,0 +1,63 @@ +/* Copyright (C) 2006 yopyop + yopyop156@ifrance.com + yopyop156.ifrance.com + + Copyright (C) 2006-2008 DeSmuME team + + This file is part of DeSmuME + + DeSmuME 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; either version 2 of the License, or + (at your option) any later version. + + DeSmuME 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 for more details. + + You should have received a copy of the GNU General Public License + along with DeSmuME; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _INPUT_DX_ +#define _INPUT_DX_ + +#define DIRECTINPUT_VERSION 0x0800 +#include +#include "..\types.h" +#include "directx\dinput.h" + +#define MAXKEYPAD 15 + +typedef void (*INPUTPROC)(BOOL, LPSTR); + +class INPUTCLASS +{ +private: + HWND hParentWnd; + BOOL paused; + + char cDIBuf[512]; + LPDIRECTINPUT8 pDI; + LPDIRECTINPUTDEVICE8 pKeyboard; + LPDIRECTINPUTDEVICE8 pJoystick; + DIDEVCAPS DIJoycap; + + INPUTPROC inputProc; + +public: + INPUTCLASS(); + ~INPUTCLASS(); + BOOL Init(HWND hParentWnd, INPUTPROC inputProc); + BOOL JoystickEnabled(); + void process(); +}; + +// ========== emu input +extern void InputConfig(HWND hwnd); +extern void NDS_inputInit(); +extern void NDS_inputPost(BOOL paused, LPSTR buf); +extern u16 keyPad[MAXKEYPAD]; +#endif \ No newline at end of file diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index fe0be7156..bdf487fb9 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -46,7 +46,7 @@ #include "mapview.h" #include "matrixview.h" #include "lightview.h" -#include "ConfigKeys.h" +#include "inputdx.h" #include "FirmConfig.h" #include "AboutBox.h" #include "OGLRender.h" @@ -77,7 +77,7 @@ void DRV_AviVideoUpdate(const u16* buffer); CRITICAL_SECTION win_sync; volatile int win_sound_samplecounter = 0; -//===================== Init DirectDraw +//===================== DirectDraw vars LPDIRECTDRAW7 lpDDraw=NULL; LPDIRECTDRAWSURFACE7 lpPrimarySurface=NULL; LPDIRECTDRAWSURFACE7 lpBackSurface=NULL; @@ -85,6 +85,9 @@ DDSURFACEDESC2 ddsd; LPDIRECTDRAWCLIPPER lpDDClipPrimary=NULL; LPDIRECTDRAWCLIPPER lpDDClipBack=NULL; +//===================== Input vars +INPUTCLASS *input = NULL; + /* The compact flash disk image file */ static const char *bad_glob_cflash_disk_image_file; static char cflash_filename_buffer[512]; @@ -143,12 +146,6 @@ HMENU menu; HANDLE runthread_ready=INVALID_HANDLE_VALUE; HANDLE runthread=INVALID_HANDLE_VALUE; -const DWORD DI_tabkey[48] = {DIK_0,DIK_1,DIK_2,DIK_3,DIK_4,DIK_5,DIK_6,DIK_7,DIK_8,DIK_9,DIK_A,DIK_B,DIK_C, - DIK_D,DIK_E,DIK_F,DIK_G,DIK_H,DIK_I,DIK_J,DIK_K,DIK_L,DIK_M,DIK_N,DIK_O,DIK_P, - DIK_Q,DIK_R,DIK_S,DIK_T,DIK_U,DIK_V,DIK_W,DIK_X,DIK_Y,DIK_Z,DIK_SPACE,DIK_UP, - DIK_DOWN,DIK_LEFT,DIK_RIGHT,DIK_TAB,DIK_LSHIFT,DIK_DELETE,DIK_INSERT,DIK_HOME, - DIK_END,DIK_RETURN}; -DWORD ds_up,ds_down,ds_left,ds_right,ds_a,ds_b,ds_x,ds_y,ds_l,ds_r,ds_select,ds_start,ds_debug; //static char IniName[MAX_PATH]; int sndcoretype=SNDCORE_DIRECTX; int sndbuffersize=735*4; @@ -483,49 +480,6 @@ void translateXY(s32 *x, s32*y) // END Rotation definitions -void Input_Post() -{ - char txt[255]; - BOOL bPressed; - HRESULT hr; - WORD keys[13][3]={{ds_a,0xFFFE,0x01},{ds_b,0xFFFD,0x02},{ds_select,0xFFFB,0x04},{ds_start,0xFFF7,0x08}, - {ds_right,0xFFEF,0x10},{ds_left,0xFFDF,0x20},{ds_up,0xFFBF,0x40},{ds_down,0xFF7F,0x80}, - {ds_r,0xFEFF,0x100},{ds_l,0xFDFF,0x200}, - {ds_x,0xFFFE,0x01},{ds_y,0xFFFD,0x02},{ds_debug,0xFFFB,0x04}}; - int i; - - for (i=0; i<10; i++) - { - bPressed=FALSE; - if (keys[i][0]<48) - if (g_cDIBuf[DI_tabkey[keys[i][0]]]&0x80) bPressed=TRUE; - if (keys[i][0]>=48) - if (g_cDIBuf[208+keys[i][0]]&0x80) bPressed=TRUE; - if (bPressed) - { - ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1]&=keys[i][1]; - ((u16 *)MMU.ARM7_REG)[0x130>>1]&=keys[i][1]; - } - else - { - ((u16 *)ARM9Mem.ARM9_REG)[0x130>>1]|=keys[i][2]; - ((u16 *)MMU.ARM7_REG)[0x130>>1]|=keys[i][2]; - } - } - for (i=10; i<13; i++) - { - bPressed=FALSE; - if (keys[i][0]<48) - if (g_cDIBuf[DI_tabkey[keys[i][0]]]&0x80) bPressed=TRUE; - if (keys[i][0]>=48) - if (g_cDIBuf[208+keys[i][0]]&0x80) bPressed=TRUE; - if (bPressed) - ((u16 *)MMU.ARM7_REG)[0x136>>1]&=keys[i][1]; - else - ((u16 *)MMU.ARM7_REG)[0x136>>1]|=keys[i][2]; - } -} - int CreateDDrawBuffers() { if (lpDDClipPrimary!=NULL) IDirectDraw7_Release(lpDDClipPrimary); @@ -754,11 +708,9 @@ DWORD WINAPI run( LPVOID lpParameter) DRV_AviSoundUpdate(SPU_core->outbuf,spu_core_samples); DRV_AviVideoUpdate((u16*)GPU_screen); - Input_Process(); - Input_Post(); - if (!skipnextframe) { + input->process(); Display(); fpsframecount++; @@ -1097,7 +1049,13 @@ int WINAPI WinMain (HINSTANCE hThisInstance, printlog("Init NDS\n"); - Input_Init(MainWindow->getHWnd()); + input = new INPUTCLASS(); + if (!input->Init(MainWindow->getHWnd(), &NDS_inputPost)) + { + MessageBox(NULL, "Error DXInput init\n", "DeSmuME", MB_OK); + exit(-1); + } + NDS_inputInit(); ViewDisasm_ARM7 = new TOOLSCLASS(hThisInstance, IDD_DESASSEMBLEUR_VIEWER7, (DLGPROC) ViewDisasm_ARM7Proc); ViewDisasm_ARM9 = new TOOLSCLASS(hThisInstance, IDD_DESASSEMBLEUR_VIEWER9, (DLGPROC) ViewDisasm_ARM9Proc); @@ -1263,16 +1221,11 @@ int WINAPI WinMain (HINSTANCE hThisInstance, DRV_AviEnd(); //------SHUTDOWN - { - HRESULT hr=Input_DeInit(); -#ifdef DEBUG - if(FAILED(hr)) LOG("DirectInput deinit failed (0x%08X)\n",hr); - else LOG("DirectInput deinit\n"); -#endif - } + #ifdef DEBUG LogStop(); #endif + if (input!=NULL) delete input; if (ViewLights!=NULL) delete ViewLights; if (ViewMatrices!=NULL) delete ViewMatrices; if (ViewOAM!=NULL) delete ViewOAM;