From 5d2a46c1aded1a47926a7eab57f4ef2ea85e4aa8 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Wed, 8 Jul 2009 23:26:35 +0000 Subject: [PATCH] addons: - add Guitar Grip device; --- desmume/src/addons.cpp | 5 +- desmume/src/addons.h | 3 + desmume/src/addons/guitarGrip.cpp | 79 ++++++++++++++++++++++++ desmume/src/windows/DeSmuME_2005.vcproj | 4 ++ desmume/src/windows/DeSmuME_2008.vcproj | 4 ++ desmume/src/windows/gbaslot_config.cpp | 21 ++++++- desmume/src/windows/main.cpp | 2 + desmume/src/windows/resource.h | 5 ++ desmume/src/windows/resources.rc | Bin 681950 -> 683550 bytes 9 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 desmume/src/addons/guitarGrip.cpp diff --git a/desmume/src/addons.cpp b/desmume/src/addons.cpp index 3aadbc369..41100a168 100644 --- a/desmume/src/addons.cpp +++ b/desmume/src/addons.cpp @@ -40,13 +40,16 @@ extern ADDONINTERFACE addonNone; extern ADDONINTERFACE addonCFlash; extern ADDONINTERFACE addonRumblePak; extern ADDONINTERFACE addonGBAgame; +extern ADDONINTERFACE addonGuitarGrip; //extern ADDONINTERFACE addonExternalMic; ADDONINTERFACE addonList[NDS_ADDON_COUNT] = { addonNone, addonCFlash, addonRumblePak, - addonGBAgame}; + addonGBAgame, + addonGuitarGrip +}; ADDONINTERFACE addon = addonCFlash; // default none pak u8 addon_type = NDS_ADDON_CFLASH; diff --git a/desmume/src/addons.h b/desmume/src/addons.h index d011d2aee..4b6a7b2ff 100644 --- a/desmume/src/addons.h +++ b/desmume/src/addons.h @@ -65,6 +65,7 @@ enum { NDS_ADDON_CFLASH, // compact flash NDS_ADDON_RUMBLEPAK, // rumble pack NDS_ADDON_GBAGAME, // gba game in slot + NDS_ADDON_GUITARGRIP, // Guitar Grip //NDS_ADDON_EXTERNALMIC, NDS_ADDON_COUNT // use for counter addons - MUST TO BE LAST!!! }; @@ -90,4 +91,6 @@ extern void addonsClose(); // Shutdown addons extern void addonsReset(); // Reset addon extern BOOL addonsChangePak(u8 type); // change current adddon +extern void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue); // Guitar grip keys + #endif diff --git a/desmume/src/addons/guitarGrip.cpp b/desmume/src/addons/guitarGrip.cpp new file mode 100644 index 000000000..5d34f1d39 --- /dev/null +++ b/desmume/src/addons/guitarGrip.cpp @@ -0,0 +1,79 @@ +/* Copyright (C) 2006 yopyop + yopyop156@ifrance.com + yopyop156.ifrance.com + + Copyright (C) 2009 CrazyMax + Copyright (C) 2009 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "../addons.h" +#include + +static u8 guitarKeyStatus = 0; + +static BOOL guitarGrip_init(void) { return (TRUE); } +static void guitarGrip_reset(void) +{ + //INFO("GuitarGrip: Reset\n"); + guitarKeyStatus = 0; +} +static void guitarGrip_close(void) {} +static void guitarGrip_config(void) {} +static void guitarGrip_write08(u32 adr, u8 val) {} +static void guitarGrip_write16(u32 adr, u16 val) {} +static void guitarGrip_write32(u32 adr, u32 val) {} +static u8 guitarGrip_read08(u32 adr) +{ + //INFO("GuitarGrip: read 08 at 0x%08X\n", adr); + if (adr == 0x0A000000) return (~guitarKeyStatus); + return (0x0); +} +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 (0); +} +static u32 guitarGrip_read32(u32 adr) +{ + //INFO("GuitarGrip: read 32 at 0x%08X\n", adr); + return (0); +} +static void guitarGrip_info(char *info) { strcpy(info, "Guitar Grid for Guitar Hero games"); } + +void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue) +{ + guitarKeyStatus = 0 | (green << 6) | (red << 5) | (yellow << 4) | (blue << 3); +} + +ADDONINTERFACE addonGuitarGrip = { + "Guitar Grid", + guitarGrip_init, + guitarGrip_reset, + guitarGrip_close, + guitarGrip_config, + guitarGrip_write08, + guitarGrip_write16, + guitarGrip_write32, + guitarGrip_read08, + guitarGrip_read16, + guitarGrip_read32, + guitarGrip_info}; diff --git a/desmume/src/windows/DeSmuME_2005.vcproj b/desmume/src/windows/DeSmuME_2005.vcproj index 74596ca91..e8389501f 100644 --- a/desmume/src/windows/DeSmuME_2005.vcproj +++ b/desmume/src/windows/DeSmuME_2005.vcproj @@ -737,6 +737,10 @@ RelativePath="..\addons\gbagame.cpp" > + + diff --git a/desmume/src/windows/DeSmuME_2008.vcproj b/desmume/src/windows/DeSmuME_2008.vcproj index c8f41d454..4fcc91359 100644 --- a/desmume/src/windows/DeSmuME_2008.vcproj +++ b/desmume/src/windows/DeSmuME_2008.vcproj @@ -672,6 +672,10 @@ RelativePath="..\addons\gbagame.cpp" > + + diff --git a/desmume/src/windows/gbaslot_config.cpp b/desmume/src/windows/gbaslot_config.cpp index 863488e26..0638830d5 100644 --- a/desmume/src/windows/gbaslot_config.cpp +++ b/desmume/src/windows/gbaslot_config.cpp @@ -287,18 +287,33 @@ BOOL CALLBACK GbaSlotGBAgame(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) return FALSE; } +BOOL CALLBACK GbaSlotGuitarGrip(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + _OKbutton = TRUE; + return TRUE; + } + } + return FALSE; +} + u32 GBAslot_IDDs[NDS_ADDON_COUNT] = { IDD_GBASLOT_NONE, IDD_GBASLOT_CFLASH, IDD_GBASLOT_RUMBLEPAK, - IDD_GBASLOT_GBAGAME + IDD_GBASLOT_GBAGAME, + IDD_GBASLOT_GUITARGRIP }; DLGPROC GBAslot_Procs[NDS_ADDON_COUNT] = { GbaSlotNone, GbaSlotCFlash, GbaSlotRumblePak, - GbaSlotGBAgame + GbaSlotGBAgame, + GbaSlotGuitarGrip }; @@ -416,6 +431,8 @@ void GBAslotDialog(HWND hwnd) strcpy(GBAgameName, tmp_gbagame_filename); WritePrivateProfileString("GBAslot.GBAgame","filename",GBAgameName,IniName); break; + case NDS_ADDON_GUITARGRIP: + break; default: return; } diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index cd96bb7c5..b0a76014d 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1685,6 +1685,8 @@ int _main() } // TODO: check for file exist break; + case NDS_ADDON_GUITARGRIP: + break; default: addon_type = NDS_ADDON_NONE; break; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 7900b6090..4f67bc62c 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -297,13 +297,17 @@ #define IDC_EDIT07 1005 #define IDC_MROM 1005 #define IDC_ROTATE180 1005 +#define IDC_GGREEN 1005 #define IDC_EDIT12 1006 #define IDC_ROTATE270 1006 #define IDC_SPU_CACHE 1006 +#define IDC_GRED 1006 #define IDC_ARM7BIOSBROWSE 1007 #define IDC_EDIT06 1007 +#define IDC_GYELLOW 1007 #define IDC_EDIT09 1008 #define IDC_MEMVIEWBOX 1008 +#define IDC_GBLUE 1008 #define IDC_ADDRESS 1009 #define IDC_BIOSSWIS 1009 #define IDC_EDIT10 1009 @@ -644,6 +648,7 @@ #define IDD_IOREG_VIEW_DMA 10006 #define IDD_IOREG_VIEW_TIMERS 10007 #define IDD_IOREG_VIEW_IPC_ROM 10008 +#define IDD_GBASLOT_GUITARGRIP 10009 #define IDM_FILE_STOPAVI 40000 #define IDM_SCREENSEP_NONE 40000 #define IDM_FILE_STOPWAV 40001 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 9a28d2684b7e95b5516dfab8baecaf5f87b945a5..d5cad058cf20075d6dd4f99bd882ee254a298676 100644 GIT binary patch delta 405 zcmYjMJxc>o5S*9X<$MV-Cl*)8VUi*c2$B!;g^ETzj({kLK`bN&1PLkx(O%)eHX-14 zf)?VHf+U@VKR^px5mVav6Wlv3!ef?YW_D-a=Ue*bBYoirC*TAf#ZjL^p%m>KLZ7nH zKpoqtVGA~+PM3>eW7svsoSw_ss|60R(3c~p@>p2UM}`WDR_w6HcV7wGZ+ zUyjpJCfVR6@Cp4y+tjki`xit9 zazXW@Jz8dwV|pH0iVb8nG8W46Otgw3%SAS1P@vX(V7k9@kfiutKoJeP?Fo~*%R=G* zWl%!JTVnKoPLigLbF^`W7ETezA=frK+;x~apwY29OJBX95-amy#g8a(&C%#vHLvev T_)1TO7#d@OA%}V@{95}3j4WNb delta 48 zcmbPtNAuo!&4w1n7N!>F7M2#)Eo^LR(;ZfDa{u5*q6p^6WS