diff --git a/desmume/src/addons/guitarGrip.cpp b/desmume/src/addons/guitarGrip.cpp index cfa3cd3d2..e49dcc0d7 100644 --- a/desmume/src/addons/guitarGrip.cpp +++ b/desmume/src/addons/guitarGrip.cpp @@ -1,5 +1,4 @@ -/* Copyright (C) 2009 CrazyMax - Copyright (C) 2009 DeSmuME team +/* Copyright (C) 2009-2010 DeSmuME team This file is part of DeSmuME @@ -38,20 +37,18 @@ static u8 guitarGrip_read08(u32 adr) { //INFO("GuitarGrip: read 08 at 0x%08X\n", adr); if (adr == 0x0A000000) return (~guitarKeyStatus); - return (0xFF); + else if(adr&1) return 0xFF; + else return 0xF9; } static u16 guitarGrip_read16(u32 adr) { //INFO("GuitarGrip: read 16 at 0x%08X\n", adr); - if (adr == 0x080000BE) return (0xF9FF); - if (adr == 0x0801FFFE) return (0xF9FF); - - return (0xFFFF); + return 0xF9FF; } static u32 guitarGrip_read32(u32 adr) { //INFO("GuitarGrip: read 32 at 0x%08X\n", adr); - return (0xFFFFFFFF); + return (0xF9FFF9FF); } static void guitarGrip_info(char *info) { strcpy(info, "Guitar Grip for Guitar Hero games"); } diff --git a/desmume/src/addons/none.cpp b/desmume/src/addons/none.cpp index a1cee0f2d..1fbad5e5a 100644 --- a/desmume/src/addons/none.cpp +++ b/desmume/src/addons/none.cpp @@ -1,4 +1,5 @@ -/* Copyright (C) 2009-2010 DeSmuME team +/* Copyright (C) 2009 CrazyMax + Copyright (C) 2009 DeSmuME team This file is part of DeSmuME @@ -17,9 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "../addons.h" -#include "../NDSSystem.h" +#include static BOOL None_init(void) { return (TRUE); } static void None_reset(void) {} @@ -28,40 +28,9 @@ static void None_config(void) {} static void None_write08(u32 adr, u8 val) {} static void None_write16(u32 adr, u16 val) {} static void None_write32(u32 adr, u32 val) {} -static u8 None_read08(u32 adr) -{ - if (adr > 0x09FFFFFF) - { - if ((adr & 0x0000FFFF) > MMU_new.backupDevice.data.size()) return 0xFF; - return MMU_new.backupDevice.data[adr & 0x0000FFFF]; - } - if ((adr - 0x08000000) > gameInfo.romsize) return 0xFF; - - return T1ReadByte((u8*)gameInfo.romdata, adr - 0x08000000); -} -static u16 None_read16(u32 adr) -{ - if (adr > 0x09FFFFFF) - { - if ((adr & 0x0000FFFF) > MMU_new.backupDevice.data.size()) return 0xFFFF; - return (u16)MMU_new.backupDevice.data[adr & 0x0000FFFF]; - } - if ((adr - 0x08000000) > gameInfo.romsize) return 0xFFFF; - - return T1ReadWord((u8*)gameInfo.romdata, adr - 0x08000000); -} -static u32 None_read32(u32 adr) -{ - if (adr > 0x09FFFFFF) - { - if ((adr & 0x0000FFFF) > MMU_new.backupDevice.data.size()) return 0xFFFFFFFF; - return (u32)MMU_new.backupDevice.data[adr & 0x0000FFFF]; - } - - if ((adr - 0x08000000) > gameInfo.romsize) return 0xFFFFFFFF; - - return T1ReadLong((u8*)gameInfo.romdata, adr - 0x08000000); -} +static u8 None_read08(u32 adr){ return (0xFF); } +static u16 None_read16(u32 adr){ return (0xFFFF); } +static u32 None_read32(u32 adr){ return (0xFFFFFFFF); } static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); } ADDONINTERFACE addonNone = { diff --git a/desmume/src/addons/piano.cpp b/desmume/src/addons/piano.cpp index 38d7d53e9..794f55041 100644 --- a/desmume/src/addons/piano.cpp +++ b/desmume/src/addons/piano.cpp @@ -46,7 +46,7 @@ static void piano_write32(u32 adr, u32 val) extern int currFrameCounter; static u8 piano_read08(u32 adr) { - //INFO("piano: read 08 at 0x%08X\n", adr); + //printf("piano: read 08 at 0x%08X\n", adr); //the actual keyboard output @@ -75,22 +75,18 @@ static u8 piano_read08(u32 adr) if(adr == 0x09FFFFFE) return ~(pianoKeyStatus&0xFF); if(adr == 0x09FFFFFF) return ~((pianoKeyStatus>>8)&0xFF); - return (0xFF); + if(adr&1) return 0x07; + else return 0x00; } static u16 piano_read16(u32 adr) { - //LOG("piano: read 16 at 0x%08X\n", adr); - - //sufficient for the device to be identified - if(adr == 0x080000BE) return (0x07FF); - if(adr == 0x0801FFFE) return (0x07FF); - - return (0xFFFF); + //printf("piano: read 16 at 0x%08X\n", adr); + return 0x07FF; } static u32 piano_read32(u32 adr) { - //LOG("piano: read 32 at 0x%08X\n", adr); - return (0xFFFFFFFF); + //printf("piano: read 32 at 0x%08X\n", adr); + return 0x07FF07FF; } static void piano_info(char *info) { strcpy(info, "Piano for EasyPiano"); } diff --git a/desmume/src/addons/rumblepak.cpp b/desmume/src/addons/rumblepak.cpp index eb7f2aec6..6d650d7b6 100644 --- a/desmume/src/addons/rumblepak.cpp +++ b/desmume/src/addons/rumblepak.cpp @@ -1,5 +1,4 @@ -/* Copyright (C) 2009 CrazyMax - Copyright (C) 2009 DeSmuME team +/* Copyright (C) 2009-2010 DeSmuME team This file is part of DeSmuME @@ -65,20 +64,18 @@ static void RumblePak_write32(u32 adr, u32 val) static u8 RumblePak_read08(u32 adr) { - return (0xFF); + if(adr&1) return 0xFF; + else return 0xFD; } static u16 RumblePak_read16(u32 adr) { - u16 val = ( (adr & 0x1FFFF) >> 1 ) & 0xFFFD; - if (adr == 0x0801FFFE) val = 0x005D; // hack!!! anybody have docs for RumblePak? - - return ((u16)val); + return 0xFFFD; } static u32 RumblePak_read32(u32 adr) { - return (0xFFFFFFFF); + return 0xFFFDFFFD; } static void RumblePak_info(char *info) diff --git a/desmume/src/windows/directx/directx.7z b/desmume/src/windows/directx/directx.7z index fdbe3d66d..24927e7fc 100644 Binary files a/desmume/src/windows/directx/directx.7z and b/desmume/src/windows/directx/directx.7z differ diff --git a/desmume/src/windows/inputdx.cpp b/desmume/src/windows/inputdx.cpp index 8a3c59d80..f22e1a297 100644 --- a/desmume/src/windows/inputdx.cpp +++ b/desmume/src/windows/inputdx.cpp @@ -2444,6 +2444,8 @@ void S9xWinScanJoypads () ////#endif //} +#include "directx/xinput.h" + void input_feedback(BOOL enable) { @@ -2459,6 +2461,30 @@ void input_feedback(BOOL enable) else JoystickF[C].pEffect->Stop(); } + + //use xinput if it is available!! + //but try lazy initializing xinput so that the dll is not required + { + static DWORD ( WINAPI *_XInputSetState)(DWORD,XINPUT_VIBRATION*) = NULL; + static bool xinput_tried = false; + if(!xinput_tried) + { + xinput_tried = true; + HMODULE lib = LoadLibrary("xinput1_3.dll"); + if(lib) + { + _XInputSetState = (DWORD (WINAPI *)(DWORD,XINPUT_VIBRATION*))GetProcAddress(lib,"XInputSetState"); + } + } + if(_XInputSetState) + { + XINPUT_VIBRATION vib; + vib.wLeftMotorSpeed = enable?65535:0; + vib.wRightMotorSpeed = enable?65535:0; + for(int i=0;i<4;i++) + _XInputSetState(0,&vib); + } + } }