diff --git a/desmume/src/NDSSystem.c b/desmume/src/NDSSystem.c index ed143451b..44d5dd3e8 100644 --- a/desmume/src/NDSSystem.c +++ b/desmume/src/NDSSystem.c @@ -19,9 +19,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "NDSSystem.h" #include -#include #include "ROMReader.h" @@ -45,6 +45,8 @@ int NDS_Init(void) { if (SPU_Init(SNDCORE_DUMMY, 735) != 0) return -1; + WIFI_Init(&wifiMac) ; + return 0; } @@ -423,6 +425,8 @@ void NDS_Reset(void) GPU_Reset(SubScreen.gpu, 1); SPU_Reset(); + NDS_CreateDummyFirmware() ; + execute = oldexecute; } @@ -515,6 +519,21 @@ int NDS_WriteBMP(const char *filename) return 1; } +/* creates an firmware flash image, which contains all needed info to initiate a wifi connection */ +int NDS_CreateDummyFirmware(void) +{ + memcpy(MMU.fw.data+0x36,FW_Mac,sizeof(FW_Mac)) ; + memcpy(MMU.fw.data+0x44,FW_WIFIInit,sizeof(FW_WIFIInit)) ; + MMU.fw.data[0x41] = 18 ; /* bits per RF value */ + MMU.fw.data[0x42] = 12 ; /* # of RF values to init */ + memcpy(MMU.fw.data+0x64,FW_BBInit,sizeof(FW_BBInit)) ; + memcpy(MMU.fw.data+0xCE,FW_RFInit,sizeof(FW_RFInit)) ; + memcpy(MMU.fw.data+0xF2,FW_RFChannel,sizeof(FW_RFChannel)) ; + memcpy(MMU.fw.data+0x146,FW_BBChannel,sizeof(FW_BBChannel)) ; + + memcpy(MMU.fw.data+0x03FA40,FW_WFCProfile,sizeof(FW_WFCProfile)) ; +} + int NDS_LoadFirmware(const char *filename) { int i; diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 40a60a9cf..4256f5ee5 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -128,6 +128,7 @@ void NDS_Reset(void); int NDS_WriteBMP(const char *filename); int NDS_LoadFirmware(const char *filename); +int NDS_CreateDummyFirmware(void); static INLINE void NDS_ARM9HBlankInt(void) {