diff --git a/desmume/src/FIFO.cpp b/desmume/src/FIFO.cpp index ff781aec7..54cc61dd3 100644 --- a/desmume/src/FIFO.cpp +++ b/desmume/src/FIFO.cpp @@ -1,7 +1,7 @@ /* Copyright 2006 yopyop Copyright 2007 shash - Copyright 2007-2012 DeSmuME team + Copyright 2007-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,11 +18,14 @@ */ #include "FIFO.h" + #include + #include "armcpu.h" #include "debug.h" #include "mem.h" #include "MMU.h" +#include "registers.h" #include "NDSSystem.h" #include "gfx3d.h" diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 33935284f..435b11ef9 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -2,7 +2,7 @@ Copyright (C) 2006 yopyop Copyright (C) 2006-2007 Theo Berkau Copyright (C) 2007 shash - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,26 @@ along with the this software. If not, see . */ - -#include -#include -#include -#include -#include -#include "MMU.h" #include "GPU.h" + +#include +#include +#include +#include +#include + +#include "MMU.h" +#include "FIFO.h" #include "debug.h" #include "render3D.h" +#include "registers.h" #include "gfx3d.h" #include "debug.h" #include "GPU_osd.h" #include "NDSSystem.h" #include "readwrite.h" +#include "matrix.h" +#include "emufile.h" #ifdef FASTBUILD #undef FORCEINLINE @@ -2739,6 +2744,16 @@ template void GPU::modeRender(int layer) } } +u32 GPU::getHOFS(int bg) +{ + return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxHOFS,0) & 0x1FF; +} + +u32 GPU::getVOFS(int bg) +{ + return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxVOFS,0) & 0x1FF; +} + void gpu_SetRotateScreen(u16 angle) { gpu_angle = angle; diff --git a/desmume/src/GPU.h b/desmume/src/GPU.h index a00c22488..6171b1e68 100644 --- a/desmume/src/GPU.h +++ b/desmume/src/GPU.h @@ -2,7 +2,7 @@ Copyright (C) 2006 yopyop Copyright (C) 2006-2007 Theo Berkau Copyright (C) 2007 shash - Copyright (C) 2009-2012 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,13 +22,13 @@ #define GPU_H #include -#include "mem.h" -#include "common.h" -#include "registers.h" -#include "FIFO.h" -#include "MMU.h" #include +#include "types.h" + +class EMUFILE; +struct MMU_struct; + //#undef FORCEINLINE //#define FORCEINLINE @@ -783,8 +783,8 @@ struct GPU updateBLDALPHA(); } - u32 getHOFS(int bg) { return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxHOFS,0) & 0x1FF; } - u32 getVOFS(int bg) { return T1ReadWord(&dispx_st->dispx_BGxOFS[bg].BGxVOFS,0) & 0x1FF; } + u32 getHOFS(int bg); + u32 getVOFS(int bg); typedef u8 TBlendTable[32][32]; TBlendTable *blendTable; diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index 600a01f3f..10f836ceb 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,7 @@ */ #include "GPU_osd.h" +#include "driver.h" #include "GPU.h" #include "mem.h" #include //mem funcs diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index e6823fd77..31de14d4d 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -23,13 +23,16 @@ #include #include +#include "armcpu.h" #include "common.h" #include "debug.h" +#include "driver.h" #include "NDSSystem.h" #include "cp15.h" #include "wifi.h" #include "registers.h" #include "render3D.h" +#include "FIFO.h" #include "gfx3d.h" #include "rtc.h" #include "mc.h" @@ -41,6 +44,8 @@ #include "MMU_timing.h" #include "firmware.h" #include "encrypt.h" +#include "GPU.h" +#include "SPU.h" #ifdef DO_ASSERT_UNALIGNED #define ASSERT_UNALIGNED(x) assert(x) @@ -1259,6 +1264,29 @@ void MMU_GC_endTransfer(u32 PROCNUM) NDS_makeIrq(PROCNUM, IRQ_BIT_GC_TRANSFER_COMPLETE); } +void GC_Command::print() +{ + GCLOG("%02X%02X%02X%02X%02X%02X%02X%02X\n",bytes[0],bytes[1],bytes[2],bytes[3],bytes[4],bytes[5],bytes[6],bytes[7]); +} + +void GC_Command::toCryptoBuffer(u32 buf[2]) +{ + u8 temp[8] = { bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0] }; + buf[0] = T1ReadLong(temp,0); + buf[1] = T1ReadLong(temp,4); +} + +void GC_Command::fromCryptoBuffer(u32 buf[2]) +{ + bytes[7] = (buf[0]>>0)&0xFF; + bytes[6] = (buf[0]>>8)&0xFF; + bytes[5] = (buf[0]>>16)&0xFF; + bytes[4] = (buf[0]>>24)&0xFF; + bytes[3] = (buf[1]>>0)&0xFF; + bytes[2] = (buf[1]>>8)&0xFF; + bytes[1] = (buf[1]>>16)&0xFF; + bytes[0] = (buf[1]>>24)&0xFF; +} template void FASTCALL MMU_writeToGCControl(u32 val) @@ -2057,6 +2085,11 @@ u32 MMU_struct_new::read_dma(const int proc, const int size, const u32 _adr) return temp; } +bool MMU_struct_new::is_dma(const u32 adr) +{ + return adr >= _REG_DMA_CONTROL_MIN && adr <= _REG_DMA_CONTROL_MAX; +} + MMU_struct_new::MMU_struct_new() { for(int i=0;i<2;i++) @@ -2066,6 +2099,36 @@ MMU_struct_new::MMU_struct_new() } } +void DivController::savestate(EMUFILE* os) +{ + write8le(&mode,os); + write8le(&busy,os); + write8le(&div0,os); +} + +bool DivController::loadstate(EMUFILE* is, int version) +{ + int ret = 1; + ret &= read8le(&mode,is); + ret &= read8le(&busy,is); + ret &= read8le(&div0,is); + return ret==1; +} + +void SqrtController::savestate(EMUFILE* os) +{ + write8le(&mode,os); + write8le(&busy,os); +} + +bool SqrtController::loadstate(EMUFILE* is, int version) +{ + int ret=1; + ret &= read8le(&mode,is); + ret &= read8le(&busy,is); + return ret==1; +} + bool DmaController::loadstate(EMUFILE* f) { u32 version; diff --git a/desmume/src/MMU.h b/desmume/src/MMU.h index 5e07abaf4..2dda82f2b 100644 --- a/desmume/src/MMU.h +++ b/desmume/src/MMU.h @@ -20,14 +20,10 @@ #ifndef MMU_H #define MMU_H -#include "FIFO.h" -#include "mem.h" -#include "registers.h" -#include "mc.h" -#include "bits.h" -#include "readwrite.h" #include "debug.h" #include "firmware.h" +#include "mc.h" +#include "mem.h" #ifdef HAVE_LUA #include "lua-engine.h" @@ -41,8 +37,9 @@ #define ARMCPU_ARM9 0 #define ARMPROC (PROCNUM ? NDS_ARM7:NDS_ARM9) -typedef const u8 TWaitState; +class EMUFILE; +typedef const u8 TWaitState; enum EDMAMode { @@ -152,20 +149,8 @@ public: mode = val&3; //todo - do we clear the div0 flag here or is that strictly done by the divider unit? } - void savestate(EMUFILE* os) - { - write8le(&mode,os); - write8le(&busy,os); - write8le(&div0,os); - } - bool loadstate(EMUFILE* is, int version) - { - int ret = 1; - ret &= read8le(&mode,is); - ret &= read8le(&busy,is); - ret &= read8le(&div0,is); - return ret==1; - } + void savestate(EMUFILE* os); + bool loadstate(EMUFILE* is, int version); }; class SqrtController @@ -178,18 +163,8 @@ public: u8 mode, busy; u16 read16() { return mode|(busy<<15); } void write16(u16 val) { mode = val&1; } - void savestate(EMUFILE* os) - { - write8le(&mode,os); - write8le(&busy,os); - } - bool loadstate(EMUFILE* is, int version) - { - int ret=1; - ret &= read8le(&mode,is); - ret &= read8le(&busy,is); - return ret==1; - } + void savestate(EMUFILE* os); + bool loadstate(EMUFILE* is, int version); }; @@ -324,27 +299,10 @@ void MMU_GC_endTransfer(u32 PROCNUM); struct GC_Command { u8 bytes[8]; - void print() - { - GCLOG("%02X%02X%02X%02X%02X%02X%02X%02X\n",bytes[0],bytes[1],bytes[2],bytes[3],bytes[4],bytes[5],bytes[6],bytes[7]); - } - void toCryptoBuffer(u32 buf[2]) - { - u8 temp[8] = { bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0] }; - buf[0] = T1ReadLong(temp,0); - buf[1] = T1ReadLong(temp,4); - } - void fromCryptoBuffer(u32 buf[2]) - { - bytes[7] = (buf[0]>>0)&0xFF; - bytes[6] = (buf[0]>>8)&0xFF; - bytes[5] = (buf[0]>>16)&0xFF; - bytes[4] = (buf[0]>>24)&0xFF; - bytes[3] = (buf[1]>>0)&0xFF; - bytes[2] = (buf[1]>>8)&0xFF; - bytes[1] = (buf[1]>>16)&0xFF; - bytes[0] = (buf[1]>>24)&0xFF; - } + + void print(); + void toCryptoBuffer(u32 buf[2]); + void fromCryptoBuffer(u32 buf[2]); }; //should rather be known as GCBUS controller, or somesuch @@ -506,14 +464,15 @@ struct MMU_struct_new void write_dma(const int proc, const int size, const u32 adr, const u32 val); u32 read_dma(const int proc, const int size, const u32 adr); - bool is_dma(const u32 adr) { return adr >= _REG_DMA_CONTROL_MIN && adr <= _REG_DMA_CONTROL_MAX; } + bool is_dma(const u32 adr); }; extern MMU_struct MMU; extern MMU_struct_new MMU_new; -typedef struct { +struct armcpu_memory_iface +{ /** the 32 bit instruction prefetch */ u32 FASTCALL (*prefetch32)( void *data, u32 adr); @@ -535,7 +494,7 @@ typedef struct { void FASTCALL (*write32)( void *data, u32 adr, u32 val); void *data; -} armcpu_memory_iface; +}; void MMU_Init(void); diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 9fcb485ec..995d880f0 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -16,34 +16,44 @@ along with the this software. If not, see . */ +#include "NDSSystem.h" + #include #include #include #include #include +#include "utils/decrypt/decrypt.h" +#include "utils/decrypt/crc.h" +#include "utils/advanscene.h" +#include "utils/task.h" + #include "common.h" -#include "NDSSystem.h" +#include "armcpu.h" #include "render3D.h" #include "MMU.h" #include "ROMReader.h" #include "gfx3d.h" -#include "utils/decrypt/decrypt.h" -#include "utils/decrypt/crc.h" -#include "utils/advanscene.h" +#include "GPU.h" #include "cp15.h" #include "bios.h" #include "debug.h" #include "cheatSystem.h" #include "movie.h" #include "Disassembler.h" +#include "FIFO.h" #include "readwrite.h" +#include "registers.h" #include "debug.h" +#include "driver.h" #include "firmware.h" #include "version.h" #include "path.h" #include "slot1.h" #include "slot2.h" +#include "SPU.h" +#include "wifi.h" //int xxctr=0; //#define LOG_ARM9 @@ -100,6 +110,16 @@ void Desmume_InitOnce() #endif } +int NDS_GetCPUCoreCount() +{ + return getOnlineCores(); +} + +void NDS_SetupDefaultFirmware() +{ + NDS_FillDefaultFirmwareConfigData(&CommonSettings.fw_config); +} + void NDS_RunAdvansceneAutoImport() { if(CommonSettings.run_advanscene_import != "") @@ -545,6 +565,16 @@ u32 GameInfo::readROM(u32 pos) } } +bool GameInfo::isDSiEnhanced() +{ + return _isDSiEnhanced; +} + +bool GameInfo::isHomebrew() +{ + return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221)); +} + static int rom_init_path(const char *filename, const char *physicalName, const char *logicalFilename) { u32 type = ROM_NDS; @@ -2828,6 +2858,13 @@ void NDS_suspendProcessingInput(bool suspend) } } +void NDS_swapScreen() +{ + u16 tmp = MainScreen.offset; + MainScreen.offset = SubScreen.offset; + SubScreen.offset = tmp; +} + void emu_halt() { //printf("halting emu: ARM9 PC=%08X/%08X, ARM7 PC=%08X/%08X\n", NDS_ARM9.R[15], NDS_ARM9.instruct_adr, NDS_ARM7.R[15], NDS_ARM7.instruct_adr); diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index eea2f8dd2..14a478616 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -20,23 +20,13 @@ #define NDSSYSTEM_H #include -#include "armcpu.h" -#include "MMU.h" -#include "driver.h" -#include "GPU.h" -#include "SPU.h" -#include "mem.h" -#include "wifi.h" -#include "emufile.h" -#include "firmware.h" -#include "types.h" -#include "utils/task.h" - #include -#if defined(HOST_WINDOWS) && !defined(DESMUME_QT) -#include "pathsettings.h" -#endif +#include "types.h" + +class BaseDriver; +class CFIRMWARE; +class EMUFILE; template struct buttonstruct { @@ -81,7 +71,8 @@ extern BOOL click; #define NDS_FW_LANG_CHI 6 #define NDS_FW_LANG_RES 7 -extern CFIRMWARE *firmware; +extern BaseDriver *driver; +extern CFIRMWARE *firmware; #define DSGBA_LOADER_SIZE 512 enum @@ -363,8 +354,8 @@ struct GameInfo void closeROM(); u32 readROM(u32 pos); void populate(); - bool isDSiEnhanced() { return _isDSiEnhanced; }; - bool isHomebrew() { return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221)); } + bool isDSiEnhanced(); + bool isHomebrew(); bool hasRomBanner(); }; @@ -470,19 +461,15 @@ void NDS_debug_break(); void NDS_debug_continue(); void NDS_debug_step(); -void execHardware_doAllDma(EDMAMode modeNum); +int NDS_GetCPUCoreCount(); +void NDS_SetupDefaultFirmware(); + +//void execHardware_doAllDma(EDMAMode modeNum); template void NDS_exec(s32 nb = 560190<<1); extern int lagframecounter; -static INLINE void NDS_swapScreen(void) -{ - u16 tmp = MainScreen.offset; - MainScreen.offset = SubScreen.offset; - SubScreen.offset = tmp; -} - extern struct TCommonSettings { TCommonSettings() : GFX3D_HighResolutionInterpolateColor(true) @@ -507,7 +494,7 @@ extern struct TCommonSettings { , rigorous_timing(false) , advanced_timing(true) , micMode(InternalNoise) - , spuInterpolationMode(SPUInterpolation_Linear) + , spuInterpolationMode(1) , manualBackupType(0) , autodetectBackupMethod(0) , spu_captureMuted(false) @@ -522,7 +509,6 @@ extern struct TCommonSettings { strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM7BIOS, "biosnds7.bin"); strcpy(Firmware, "firmware.bin"); - NDS_FillDefaultFirmwareConfigData(&fw_config); /* WIFI mode: adhoc = 0, infrastructure = 1 */ wifi.mode = 1; @@ -542,7 +528,8 @@ extern struct TCommonSettings { use_jit = false; #endif - num_cores = getOnlineCores(); + num_cores = NDS_GetCPUCoreCount(); + NDS_SetupDefaultFirmware(); } bool GFX3D_HighResolutionInterpolateColor; bool GFX3D_EdgeMark; @@ -601,7 +588,7 @@ extern struct TCommonSettings { } micMode; - SPUInterpolationMode spuInterpolationMode; + int spuInterpolationMode; //this is a temporary hack until we straighten out the flushing logic and/or gxfifo //int gfx3d_flushMode; diff --git a/desmume/src/OGLRender.cpp b/desmume/src/OGLRender.cpp index b472e4c1d..7bac38c6a 100644 --- a/desmume/src/OGLRender.cpp +++ b/desmume/src/OGLRender.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ #include "OGLRender.h" +#include #include #include diff --git a/desmume/src/SPU.cpp b/desmume/src/SPU.cpp index 263bcadfd..6bee138f0 100644 --- a/desmume/src/SPU.cpp +++ b/desmume/src/SPU.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006 Theo Berkau - Copyright (C) 2008-2012 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team Ideas borrowed from Stephane Dallongeville's SCSP core @@ -32,6 +32,7 @@ #include #include "debug.h" +#include "driver.h" #include "MMU.h" #include "SPU.h" #include "mem.h" diff --git a/desmume/src/SPU.h b/desmume/src/SPU.h index 368e79734..4443b49e4 100644 --- a/desmume/src/SPU.h +++ b/desmume/src/SPU.h @@ -1,6 +1,6 @@ /* Copyright 2006 Theo Berkau - Copyright (C) 2006-2010 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +22,13 @@ #include #include #include +#include + #include "types.h" #include "matrix.h" -#include "emufile.h" #include "metaspu/metaspu.h" +class EMUFILE; #define SNDCORE_DEFAULT -1 #define SNDCORE_DUMMY 0 diff --git a/desmume/src/addons/slot1_none.cpp b/desmume/src/addons/slot1_none.cpp index 69cf8bcaf..d5da0ddc9 100644 --- a/desmume/src/addons/slot1_none.cpp +++ b/desmume/src/addons/slot1_none.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +16,6 @@ */ #include "../slot1.h" -#include "../registers.h" -#include "../MMU.h" -#include "../NDSSystem.h" class Slot1_None : public ISlot1Interface { diff --git a/desmume/src/addons/slot1_r4.cpp b/desmume/src/addons/slot1_r4.cpp index e63fd7f99..96c6cc078 100644 --- a/desmume/src/addons/slot1_r4.cpp +++ b/desmume/src/addons/slot1_r4.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,14 +15,13 @@ along with the this software. If not, see . */ +#include "slot1comp_protocol.h" + #include #include "../slot1.h" -#include "../registers.h" -#include "../MMU.h" #include "../NDSSystem.h" #include "../emufile.h" -#include "slot1comp_protocol.h" class Slot1_R4 : public ISlot1Interface, public ISlot1Comp_Protocol_Client { diff --git a/desmume/src/addons/slot1_retail_auto.cpp b/desmume/src/addons/slot1_retail_auto.cpp index b3ad5215f..cb07ab1ed 100644 --- a/desmume/src/addons/slot1_retail_auto.cpp +++ b/desmume/src/addons/slot1_retail_auto.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2105 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,6 @@ */ #include "../slot1.h" -#include "../registers.h" -#include "../MMU.h" #include "../NDSSystem.h" class Slot1_Retail_Auto : public ISlot1Interface diff --git a/desmume/src/addons/slot1_retail_mcrom.cpp b/desmume/src/addons/slot1_retail_mcrom.cpp index 98133fc8e..501f477ad 100644 --- a/desmume/src/addons/slot1_retail_mcrom.cpp +++ b/desmume/src/addons/slot1_retail_mcrom.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,14 +15,13 @@ along with the this software. If not, see . */ -#include "../slot1.h" -#include "../registers.h" -#include "../MMU.h" -#include "../NDSSystem.h" #include "slot1comp_mc.h" #include "slot1comp_rom.h" #include "slot1comp_protocol.h" +#include "../slot1.h" +#include "../NDSSystem.h" + //quick architecture overview: //MCROM receives GC bus commands from MMU.cpp //those are passed on to the protocol component for parsing diff --git a/desmume/src/addons/slot1_retail_mcrom_debug.cpp b/desmume/src/addons/slot1_retail_mcrom_debug.cpp index f556bff79..0d4f5a2fd 100644 --- a/desmume/src/addons/slot1_retail_mcrom_debug.cpp +++ b/desmume/src/addons/slot1_retail_mcrom_debug.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,16 +15,18 @@ along with the this software. If not, see . */ -#include "../slot1.h" -#include "../registers.h" -#include "../MMU.h" -#include "../NDSSystem.h" -#include "../utils/fsnitro.h" -#include "../path.h" #include "slot1comp_mc.h" #include "slot1comp_rom.h" #include "slot1comp_protocol.h" +#include +#include + +#include "../slot1.h" +#include "../path.h" +#include "../NDSSystem.h" +#include "../utils/fsnitro.h" + //quick architecture overview: //MCROM receives GC bus commands from MMU.cpp //those are passed on to the protocol component for parsing diff --git a/desmume/src/addons/slot1_retail_nand.cpp b/desmume/src/addons/slot1_retail_nand.cpp index 7c9d9426b..051a50bae 100644 --- a/desmume/src/addons/slot1_retail_nand.cpp +++ b/desmume/src/addons/slot1_retail_nand.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,13 +21,13 @@ // NTR-UORE-0 // - 128Mbit -#include "../slot1.h" -#include "../registers.h" -#include "../MMU.h" -#include "../NDSSystem.h" #include "slot1comp_rom.h" #include "slot1comp_protocol.h" +#include "../slot1.h" +#include "../NDSSystem.h" +#include "../emufile.h" + //quick architecture overview: //NAND receives GC bus commands from MMU.cpp //those are passed on to the protocol component for parsing diff --git a/desmume/src/addons/slot1comp_mc.cpp b/desmume/src/addons/slot1comp_mc.cpp index 18c390cdc..15fbd8401 100644 --- a/desmume/src/addons/slot1comp_mc.cpp +++ b/desmume/src/addons/slot1comp_mc.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,10 +18,10 @@ //this file contains the components used for emulating standard gamecard "MC" devices (eeprom, fram, flash) //this is largely done by accessing the BackupDevice resources in the core emulator -#include "types.h" -#include "../MMU.h" #include "slot1comp_mc.h" -#include "NDSSystem.h" + +#include "../MMU.h" +#include "../NDSSystem.h" Slot1Comp_MC g_Slot1Comp_MC; diff --git a/desmume/src/addons/slot1comp_mc.h b/desmume/src/addons/slot1comp_mc.h index 558c31b42..2c48a4b11 100644 --- a/desmume/src/addons/slot1comp_mc.h +++ b/desmume/src/addons/slot1comp_mc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,11 @@ //this file contains the components used for emulating standard gamecard "MC" devices (eeprom, fram, flash) +#ifndef _SLOT1COMP_MC_H +#define _SLOT1COMP_MC_H + +#include "../types.h" + class Slot1Comp_MC { public: @@ -25,4 +30,6 @@ public: void connect(); }; -extern Slot1Comp_MC g_Slot1Comp_MC; \ No newline at end of file +extern Slot1Comp_MC g_Slot1Comp_MC; + +#endif diff --git a/desmume/src/addons/slot1comp_protocol.cpp b/desmume/src/addons/slot1comp_protocol.cpp index 80dc67e35..def9f15f4 100644 --- a/desmume/src/addons/slot1comp_protocol.cpp +++ b/desmume/src/addons/slot1comp_protocol.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2013 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +16,12 @@ */ #include "slot1comp_protocol.h" -#include "MMU.h" -#include "armcpu.h" -#include "encrypt.h" + +#include + +#include "../armcpu.h" +#include "../encrypt.h" +#include "../emufile.h" #include "../utils/decrypt/decrypt.h" static _KEY1 key1((const u8*)arm7_key); diff --git a/desmume/src/addons/slot1comp_protocol.h b/desmume/src/addons/slot1comp_protocol.h index 5dff4834d..895485ee4 100644 --- a/desmume/src/addons/slot1comp_protocol.h +++ b/desmume/src/addons/slot1comp_protocol.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,10 @@ #ifndef _SLOT1COMP_PROTOCOL_H #define _SLOT1COMP_PROTOCOL_H -#include "MMU.h" +#include "../types.h" +#include "../MMU.h" + +class EMUFILE; enum eSlot1Operation { diff --git a/desmume/src/addons/slot1comp_rom.cpp b/desmume/src/addons/slot1comp_rom.cpp index 38ba93c74..e7139096b 100644 --- a/desmume/src/addons/slot1comp_rom.cpp +++ b/desmume/src/addons/slot1comp_rom.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,9 @@ */ #include "slot1comp_rom.h" -#include "MMU.h" -#include "NDSSystem.h" + +#include "../NDSSystem.h" +#include "../emufile.h" void Slot1Comp_Rom::start(eSlot1Operation operation, u32 addr) diff --git a/desmume/src/addons/slot1comp_rom.h b/desmume/src/addons/slot1comp_rom.h index ac40cc889..8643f6cc8 100644 --- a/desmume/src/addons/slot1comp_rom.h +++ b/desmume/src/addons/slot1comp_rom.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,8 +18,13 @@ //this file contains the components used for emulating standard gamecard ROMs //this is largely done by accessing the rom provided in the core emulator +#ifndef _SLOT1COMP_ROM_H +#define _SLOT1COMP_ROM_H + #include "slot1comp_protocol.h" -#include "emufile.h" +#include "../types.h" + +class EMUFILE; class Slot1Comp_Rom { @@ -37,3 +42,4 @@ private: eSlot1Operation operation; }; +#endif diff --git a/desmume/src/addons/slot2_auto.cpp b/desmume/src/addons/slot2_auto.cpp index 2054a8a7d..4d0fd6313 100644 --- a/desmume/src/addons/slot2_auto.cpp +++ b/desmume/src/addons/slot2_auto.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,10 +15,9 @@ along with the this software. If not, see . */ -#include "../slot2.h" -#include "../registers.h" -#include "../MMU.h" +#include +#include "../slot2.h" class Slot2_Auto : public ISlot2Interface { diff --git a/desmume/src/addons/slot2_expMemory.cpp b/desmume/src/addons/slot2_expMemory.cpp index 03008df18..77af20845 100644 --- a/desmume/src/addons/slot2_expMemory.cpp +++ b/desmume/src/addons/slot2_expMemory.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2009 CrazyMax - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,8 @@ */ #include "../slot2.h" +#include "../emufile.h" +#include "../mem.h" #if 0 #define EXPINFO(...) INFO(__VA_ARGS__) diff --git a/desmume/src/addons/slot2_gbagame.cpp b/desmume/src/addons/slot2_gbagame.cpp index 29f08704e..80fce6730 100644 --- a/desmume/src/addons/slot2_gbagame.cpp +++ b/desmume/src/addons/slot2_gbagame.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2009 CrazyMax - Copyright (C) 2009-2014 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,12 +16,13 @@ along with the this software. If not, see . */ +#include "../slot2.h" + #include -#include "../mem.h" -#include "../MMU.h" + +#include "../debug.h" #include "../NDSSystem.h" #include "../path.h" -#include "../slot2.h" #include "../emufile.h" #define EEPROM 0x52504545 diff --git a/desmume/src/addons/slot2_mpcf.cpp b/desmume/src/addons/slot2_mpcf.cpp index 6ff2370f3..b0bc6320a 100644 --- a/desmume/src/addons/slot2_mpcf.cpp +++ b/desmume/src/addons/slot2_mpcf.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006 Mic - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +22,12 @@ #include #include #include -#include "../types.h" + +#include "../slot2.h" #include "../debug.h" +#include "../emufile.h" #include "../path.h" #include "../utils/vfat.h" -#include "../slot2.h" // Set up addresses for GBAMP #define CF_REG_DATA 0x9000000 diff --git a/desmume/src/addons/slot2_paddle.cpp b/desmume/src/addons/slot2_paddle.cpp index 71558752a..40263efc5 100644 --- a/desmume/src/addons/slot2_paddle.cpp +++ b/desmume/src/addons/slot2_paddle.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,8 +38,9 @@ maybe legally configure the paddle differently, which could be rejected here; in */ #include -#include "../NDSSystem.h" + #include "../slot2.h" +#include "../NDSSystem.h" class Slot2_Paddle : public ISlot2Interface { diff --git a/desmume/src/addons/slot2_passme.cpp b/desmume/src/addons/slot2_passme.cpp index e6d58e826..58ba742d9 100644 --- a/desmume/src/addons/slot2_passme.cpp +++ b/desmume/src/addons/slot2_passme.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,8 @@ along with the this software. If not, see . */ -#include "../NDSSystem.h" -#include "../types.h" #include "../slot2.h" +#include "../NDSSystem.h" class Slot2_PassME : public ISlot2Interface { diff --git a/desmume/src/arm_instructions.cpp b/desmume/src/arm_instructions.cpp index 828ac8d0a..e788fcaef 100644 --- a/desmume/src/arm_instructions.cpp +++ b/desmume/src/arm_instructions.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ // of current ones) //#define UNTESTEDOPCODEDEBUG +#include "instructions.h" #include "cp15.h" #include "debug.h" #include "MMU.h" diff --git a/desmume/src/arm_jit.cpp b/desmume/src/arm_jit.cpp index b874849e0..0f369ad4b 100644 --- a/desmume/src/arm_jit.cpp +++ b/desmume/src/arm_jit.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2011 Loren Merritt - Copyright (C) 2012-2013 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ #define HAVE_STATIC_CODE_BUFFER #endif +#include "armcpu.h" #include "instructions.h" #include "instruction_attributes.h" #include "Disassembler.h" diff --git a/desmume/src/armcpu.cpp b/desmume/src/armcpu.cpp index 11f3d83a0..081902852 100644 --- a/desmume/src/armcpu.cpp +++ b/desmume/src/armcpu.cpp @@ -20,7 +20,9 @@ #include #include #include -#include "types.h" + +#include "armcpu.h" +#include "common.h" #include "instructions.h" #include "cp15.h" #include "bios.h" @@ -745,6 +747,33 @@ template u32 armcpu_exec<1,false>(); template u32 armcpu_exec<1,true>(); #endif +void setIF(int PROCNUM, u32 flag) +{ + //don't set generated bits!!! + assert(!(flag&0x00200000)); + + MMU.reg_IF_bits[PROCNUM] |= flag; + + NDS_Reschedule(); +} + +char* decodeIntruction(bool thumb_mode, u32 instr) +{ + char txt[20] = {0}; + u32 tmp = 0; + if (thumb_mode == true) + { + tmp = (instr >> 6); + strcpy(txt, intToBin((u16)tmp)+6); + } + else + { + tmp = ((instr >> 16) & 0x0FF0) | ((instr >> 4) & 0x0F); + strcpy(txt, intToBin((u32)tmp)+20); + } + return strdup(txt); +} + const armcpu_ctrl_iface arm_default_ctrl_iface = { stall_cpu, unstall_cpu, diff --git a/desmume/src/armcpu.h b/desmume/src/armcpu.h index c2c8241a7..f65f3bb3b 100644 --- a/desmume/src/armcpu.h +++ b/desmume/src/armcpu.h @@ -22,9 +22,6 @@ #include "types.h" #include "bits.h" #include "MMU.h" -#include "common.h" -#include "instructions.h" -#include "cp15.h" #define CODE(i) (((i)>>25)&0x7) #define OPCODE(i) (((i)>>21)&0xF) @@ -223,7 +220,8 @@ typedef union /** * The control interface to a CPU */ -typedef struct { +struct armcpu_ctrl_iface +{ /** stall the processor */ void (*stall)( void *instance); @@ -246,7 +244,7 @@ typedef struct { /** the private data passed to all interface functions */ void *data; -} armcpu_ctrl_iface; +}; typedef void* armcp_t; @@ -343,37 +341,12 @@ template u32 armcpu_exec(); template u32 armcpu_exec(); #endif -static INLINE void setIF(int PROCNUM, u32 flag) -{ - //don't set generated bits!!! - assert(!(flag&0x00200000)); - - MMU.reg_IF_bits[PROCNUM] |= flag; - - extern void NDS_Reschedule(); - NDS_Reschedule(); -} +void setIF(int PROCNUM, u32 flag); +char* decodeIntruction(bool thumb_mode, u32 instr); static INLINE void NDS_makeIrq(int PROCNUM, u32 num) { setIF(PROCNUM,1<> 6); - strcpy(txt, intToBin((u16)tmp)+6); - } - else - { - tmp = ((instr >> 16) & 0x0FF0) | ((instr >> 4) & 0x0F); - strcpy(txt, intToBin((u32)tmp)+20); - } - return strdup(txt); -} - #endif diff --git a/desmume/src/bios.cpp b/desmume/src/bios.cpp index 3f2f37bbd..070a376f4 100644 --- a/desmume/src/bios.cpp +++ b/desmume/src/bios.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,10 +20,12 @@ //it renders the use of bios files generally unnecessary. //it turns out that they're not too complex, although of course the timings will be all wrong here. +#include "armcpu.h" #include "cp15.h" #include #include "MMU.h" #include "debug.h" +#include "registers.h" #include "NDSSystem.h" #define cpu (&ARMPROC) diff --git a/desmume/src/bios.h b/desmume/src/bios.h index 078519d5c..813f614ad 100644 --- a/desmume/src/bios.h +++ b/desmume/src/bios.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2012 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ #ifndef BIOS_H #define BIOS_H -#include "armcpu.h" +#include "types.h" extern u32 (* ARM_swi_tab[2][32])(); extern const char* ARM_swi_names[2][32]; diff --git a/desmume/src/cheatSystem.cpp b/desmume/src/cheatSystem.cpp index f8503e1b3..7ad50a324 100644 --- a/desmume/src/cheatSystem.cpp +++ b/desmume/src/cheatSystem.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2012 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,11 @@ along with the this software. If not, see . */ -#include #include "cheatSystem.h" +#include "bits.h" + #include "NDSSystem.h" +#include "common.h" #include "mem.h" #include "MMU.h" #include "debug.h" diff --git a/desmume/src/cheatSystem.h b/desmume/src/cheatSystem.h index 671c4c9e3..6b3bbf333 100644 --- a/desmume/src/cheatSystem.h +++ b/desmume/src/cheatSystem.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2012 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,10 +15,12 @@ along with the this software. If not, see . */ +#include #include #include -#include "common.h" +#include #include +#include "types.h" #define CHEAT_VERSION_MAJOR 2 #define CHEAT_VERSION_MINOR 0 diff --git a/desmume/src/cli/main.cpp b/desmume/src/cli/main.cpp index 6c6c39d25..acd6f215a 100644 --- a/desmume/src/cli/main.cpp +++ b/desmume/src/cli/main.cpp @@ -44,21 +44,25 @@ #define CLI_UI #endif -#include "MMU.h" -#include "NDSSystem.h" -#include "debug.h" -#include "sndsdl.h" -#include "ctrlssdl.h" -#include "render3D.h" -#include "rasterize.h" -#include "saves.h" -#include "firmware.h" -#include "GPU_osd.h" -#include "desmume_config.h" -#include "commandline.h" -#include "slot2.h" -#include "utils/xstring.h" -#include "gdbstub.h" +#include "../NDSSystem.h" +#include "../driver.h" +#include "../GPU.h" +#include "../SPU.h" +#include "../sndsdl.h" +#include "../ctrlssdl.h" +#include "../render3D.h" +#include "../rasterize.h" +#include "../saves.h" +#include "../GPU_osd.h" +#include "../desmume_config.h" +#include "../commandline.h" +#include "../slot2.h" +#include "../utils/xstring.h" + +#ifdef GDB_STUB +#include "../armcpu.h" +#include "../gdbstub.h" +#endif volatile bool execute = false; @@ -589,7 +593,7 @@ int main(int argc, char ** argv) { g_thread_init( NULL); } - driver = new UnixDriver(); + driver = new BaseDriver(); #ifdef GDB_STUB /* diff --git a/desmume/src/cocoa/cocoa_cheat.h b/desmume/src/cocoa/cocoa_cheat.h index e410e57e2..3ca72c106 100644 --- a/desmume/src/cocoa/cocoa_cheat.h +++ b/desmume/src/cocoa/cocoa_cheat.h @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2014 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +17,12 @@ */ #import -#include "../cheatSystem.h" #undef BOOL +class CHEATS; +class CHEATS_LIST; +class CHEATSEARCH; + /******************************************************************************************** CocoaDSCheatItem - OBJECTIVE-C CLASS diff --git a/desmume/src/cocoa/cocoa_cheat.mm b/desmume/src/cocoa/cocoa_cheat.mm index 5c7d97db8..6fcf1b866 100644 --- a/desmume/src/cocoa/cocoa_cheat.mm +++ b/desmume/src/cocoa/cocoa_cheat.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012-2014 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ #import "cocoa_globals.h" #import "cocoa_util.h" +#include "../cheatSystem.h" #include "../MMU.h" @implementation CocoaDSCheatItem diff --git a/desmume/src/cocoa/cocoa_core.mm b/desmume/src/cocoa/cocoa_core.mm index 1cb4263cd..075fbaf2f 100644 --- a/desmume/src/cocoa/cocoa_core.mm +++ b/desmume/src/cocoa/cocoa_core.mm @@ -30,6 +30,7 @@ #include "../movie.h" #include "../NDSSystem.h" +#include "../armcpu.h" #include "../driver.h" #include "../gdbstub.h" #include "../slot1.h" diff --git a/desmume/src/cocoa/cocoa_firmware.mm b/desmume/src/cocoa/cocoa_firmware.mm index 6422f3393..f8664ed54 100644 --- a/desmume/src/cocoa/cocoa_firmware.mm +++ b/desmume/src/cocoa/cocoa_firmware.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ #import "cocoa_firmware.h" #include "../NDSSystem.h" +#include "../firmware.h" @implementation CocoaDSFirmware diff --git a/desmume/src/cocoa/cocoa_output.mm b/desmume/src/cocoa/cocoa_output.mm index 719b56079..ddffd3aff 100644 --- a/desmume/src/cocoa/cocoa_output.mm +++ b/desmume/src/cocoa/cocoa_output.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2014 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ #include "sndOSX.h" #include "../NDSSystem.h" +#include "../GPU.h" #include "../SPU.h" #include "../metaspu/metaspu.h" diff --git a/desmume/src/cocoa/cocoa_rom.mm b/desmume/src/cocoa/cocoa_rom.mm index 5dc93054f..ff40d74d4 100644 --- a/desmume/src/cocoa/cocoa_rom.mm +++ b/desmume/src/cocoa/cocoa_rom.mm @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #import "cocoa_util.h" #include "../NDSSystem.h" -#include "../MMU.h" +#include "../common.h" #include "../mc.h" #undef BOOL diff --git a/desmume/src/cocoa/mic_ext.cpp b/desmume/src/cocoa/mic_ext.cpp index c6a525b40..de1cf755a 100644 --- a/desmume/src/cocoa/mic_ext.cpp +++ b/desmume/src/cocoa/mic_ext.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2011 Roger Manuel - Copyright (C) 2012-2013 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,8 @@ #import "cocoa_globals.h" #include "mic_ext.h" -#include "readwrite.h" +#include "../emufile.h" +#include "../readwrite.h" RingBuffer micInputBuffer(MIC_MAX_BUFFER_SAMPLES * 2, sizeof(u8)); NullGenerator nullSampleGenerator; diff --git a/desmume/src/cocoa/openemu/NDSGameCore.mm b/desmume/src/cocoa/openemu/NDSGameCore.mm index 4ebfe08d7..7b218a0f4 100644 --- a/desmume/src/cocoa/openemu/NDSGameCore.mm +++ b/desmume/src/cocoa/openemu/NDSGameCore.mm @@ -27,6 +27,7 @@ #include #include "../../NDSSystem.h" +#include "../../GPU.h" #undef BOOL diff --git a/desmume/src/common.cpp b/desmume/src/common.cpp index 867a376a0..7b32f925a 100644 --- a/desmume/src/common.cpp +++ b/desmume/src/common.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2010 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,10 +17,11 @@ //TODO - move this into ndssystem where it belongs probably +#include "common.h" + #include #include #include -#include "common.h" #include #include diff --git a/desmume/src/common.h b/desmume/src/common.h index bd95dd1ff..d2213ba18 100644 --- a/desmume/src/common.h +++ b/desmume/src/common.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2010 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,31 +22,13 @@ #include #include -#include "types.h" #include +#include "types.h" #if defined(WIN32) - - #include - #include - #define CLASSNAME "DeSmuME" - - extern HINSTANCE hAppInst; - - extern bool romloaded; - - extern char IniName[MAX_PATH]; - extern void GetINIPath(); - extern void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file); - - bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename); - void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file); - #else // non Windows - -#define sscanf_s sscanf - + #define sscanf_s sscanf #endif template diff --git a/desmume/src/cp15.cpp b/desmume/src/cp15.cpp index fb130b60f..9de54466b 100644 --- a/desmume/src/cp15.cpp +++ b/desmume/src/cp15.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2013 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,9 +18,12 @@ #include +#include "armcpu.h" #include "cp15.h" #include "debug.h" #include "MMU.h" +#include "emufile.h" +#include "readwrite.h" armcp15_t cp15; @@ -292,7 +295,7 @@ BOOL armcp15_t::moveCP2ARM(u32 * R, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2) } return FALSE; case 9: - if((opcode1==0)) + if(opcode1==0) { switch(CRm) { diff --git a/desmume/src/cp15.h b/desmume/src/cp15.h index 488850ce3..0d479e67a 100644 --- a/desmume/src/cp15.h +++ b/desmume/src/cp15.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2013 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,8 +19,10 @@ #ifndef __CP15_H__ #define __CP15_H__ -#include "armcpu.h" -#include "emufile.h" +#include +#include "types.h" + +class EMUFILE; #define CP15_ACCESS_WRITE 0 #define CP15_ACCESS_READ 2 diff --git a/desmume/src/debug.h b/desmume/src/debug.h index b5080300b..7134cc7ba 100644 --- a/desmume/src/debug.h +++ b/desmume/src/debug.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 Guillaume Duhamel - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,9 @@ #include "types.h" #include "mem.h" -#include "emufile.h" + +struct armcpu_t; +class EMUFILE; struct DebugStatistics { @@ -168,7 +170,6 @@ private: }; extern DebugNotify DEBUG_Notify; -struct armcpu_t; //information about a debug event will be stuffed into here by the generator struct TDebugEventData diff --git a/desmume/src/driver.cpp b/desmume/src/driver.cpp index 93f9e29d2..558067c5d 100644 --- a/desmume/src/driver.cpp +++ b/desmume/src/driver.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2010 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,8 +15,9 @@ along with the this software. If not, see . */ -#include "types.h" #include "driver.h" + +#include "debug.h" #include "rasterize.h" #include "gfx3d.h" #include "texcache.h" @@ -44,3 +45,8 @@ BaseDriver::~BaseDriver() { } +void BaseDriver::USR_InfoMessage(const char *message) +{ + LOG("%s\n", message); +} + diff --git a/desmume/src/driver.h b/desmume/src/driver.h index 79816bd2c..6f4a46618 100644 --- a/desmume/src/driver.h +++ b/desmume/src/driver.h @@ -18,13 +18,8 @@ #ifndef _DRIVER_H_ #define _DRIVER_H_ -#include "types.h" -#include "debug.h" #include - -#ifdef EXPERIMENTAL_WIFI_COMM -#include -#endif +#include "types.h" class VIEW3D_Driver { @@ -40,28 +35,11 @@ public: BaseDriver(); ~BaseDriver(); -#ifdef EXPERIMENTAL_WIFI_COMM - virtual bool WIFI_SocketsAvailable() { return true; } - virtual bool WIFI_PCapAvailable() { return false; } - - virtual void WIFI_GetUniqueMAC(u8* mac) {} - - virtual bool WIFI_WFCWarning() { return false; } - - virtual int PCAP_findalldevs(pcap_if_t** alldevs, char* errbuf) { return -1; } - virtual void PCAP_freealldevs(pcap_if_t* alldevs) {} - virtual pcap_t* PCAP_open(const char* source, int snaplen, int flags, int readtimeout, char* errbuf) { return NULL; } - virtual void PCAP_close(pcap_t* dev) {} - virtual int PCAP_setnonblock(pcap_t* dev, int nonblock, char* errbuf) { return -1; } - virtual int PCAP_sendpacket(pcap_t* dev, const u_char* data, int len) { return -1; } - virtual int PCAP_dispatch(pcap_t* dev, int num, pcap_handler callback, u_char* userdata) { return -1; } -#endif - virtual void AVI_SoundUpdate(void* soundData, int soundLen) {} virtual bool AVI_IsRecording() { return FALSE; } virtual bool WAV_IsRecording() { return FALSE; } - virtual void USR_InfoMessage(const char *message) { LOG("%s\n", message); } + virtual void USR_InfoMessage(const char *message); virtual void USR_RefreshScreen() {} virtual void USR_SetDisplayPostpone(int milliseconds, bool drawNextFrame) {} // -1 == indefinitely, 0 == don't pospone, 500 == don't draw for 0.5 seconds @@ -93,38 +71,5 @@ public: void VIEW3D_Shutdown(); void VIEW3D_Init(); }; -extern BaseDriver* driver; - -#ifndef HOST_WINDOWS -class UnixDriver : public BaseDriver -{ -#ifdef EXPERIMENTAL_WIFI_COMM - virtual bool WIFI_SocketsAvailable() { return true; } - virtual bool WIFI_PCapAvailable() { return true; } - virtual bool WIFI_WFCWarning() { return false; } - - virtual int PCAP_findalldevs(pcap_if_t** alldevs, char* errbuf) { - return pcap_findalldevs(alldevs, errbuf); } - - virtual void PCAP_freealldevs(pcap_if_t* alldevs) { - pcap_freealldevs(alldevs); } - - virtual pcap_t* PCAP_open(const char* source, int snaplen, int flags, int readtimeout, char* errbuf) { - return pcap_open_live(source, snaplen, flags, readtimeout, errbuf); } - - virtual void PCAP_close(pcap_t* dev) { - pcap_close(dev); } - - virtual int PCAP_setnonblock(pcap_t* dev, int nonblock, char* errbuf) { - return pcap_setnonblock(dev, nonblock, errbuf); } - - virtual int PCAP_sendpacket(pcap_t* dev, const u_char* data, int len) { - return pcap_sendpacket(dev, data, len); } - - virtual int PCAP_dispatch(pcap_t* dev, int num, pcap_handler callback, u_char* userdata) { - return pcap_dispatch(dev, num, callback, userdata); } -#endif -}; -#endif #endif //_DRIVER_H_ diff --git a/desmume/src/encrypt.cpp b/desmume/src/encrypt.cpp index ca43b2f1b..9355c2592 100644 --- a/desmume/src/encrypt.cpp +++ b/desmume/src/encrypt.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,10 @@ along with the this software. If not, see . */ +#include "encrypt.h" #include "armcpu.h" #include "MMU.h" -#include "encrypt.h" +#include "registers.h" //TODO - a lot of redundant code (maybe?) with utils/decrypt.cpp //we should try unifying all that. diff --git a/desmume/src/filter/videofilter.h b/desmume/src/filter/videofilter.h index 8f383e3b6..bbd1c516f 100644 --- a/desmume/src/filter/videofilter.h +++ b/desmume/src/filter/videofilter.h @@ -1,6 +1,6 @@ /* Copyright (C) 2011-2012 Roger Manuel - Copyright (C) 2013-2014 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,13 +22,14 @@ #include #include #include + #include "types.h" #include "filter.h" #include "../utils/task.h" #ifdef HOST_WINDOWS typedef unsigned __int32 uint32_t; - #include + #define WIN32_LEAN_AND_MEAN #include typedef CRITICAL_SECTION ThreadLock; typedef HANDLE ThreadCond; diff --git a/desmume/src/firmware.cpp b/desmume/src/firmware.cpp index 3493ddfba..711a840c3 100644 --- a/desmume/src/firmware.cpp +++ b/desmume/src/firmware.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2011 DeSmuME Team + Copyright (C) 2009-2015 DeSmuME Team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,10 +16,12 @@ */ #include "firmware.h" + #include "NDSSystem.h" #include "MMU.h" #include "path.h" #include "encrypt.h" +#include "wifi.h" #define DFC_ID_CODE "DeSmuME Firmware User Settings" #define DFC_ID_SIZE sizeof(DFC_ID_CODE) @@ -811,7 +813,7 @@ static void fill_user_data_area( struct NDS_fw_config_data *user_settings,u8 *da } // creates an firmware flash image, which contains all needed info to initiate a wifi connection -int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings) +int NDS_CreateDummyFirmware(NDS_fw_config_data *user_settings) { //Create the firmware header @@ -895,18 +897,18 @@ int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings) (*(u16*)(MMU.fw.data + 0x2A)) = calc_CRC16(0, (MMU.fw.data + 0x2C), 0x138); if (&CommonSettings.fw_config != user_settings) - memcpy(&CommonSettings.fw_config, user_settings, sizeof(struct NDS_fw_config_data)); + memcpy(&CommonSettings.fw_config, user_settings, sizeof(NDS_fw_config_data)); return TRUE ; } -void NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config) { +void NDS_FillDefaultFirmwareConfigData(NDS_fw_config_data *fw_config) { const char *default_nickname = "DeSmuME"; const char *default_message = "DeSmuME makes you happy!"; int i; int str_length; - memset( fw_config, 0, sizeof( struct NDS_fw_config_data)); + memset( fw_config, 0, sizeof(NDS_fw_config_data)); fw_config->ds_type = NDS_CONSOLE_TYPE_FAT; fw_config->fav_colour = 7; diff --git a/desmume/src/firmware.h b/desmume/src/firmware.h index 1673d2b7f..407a78691 100644 --- a/desmume/src/firmware.h +++ b/desmume/src/firmware.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME Team + Copyright (C) 2009-2015 DeSmuME Team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,9 @@ #ifndef _FIRMWARE_H_ #define _FIRMWARE_H_ -#include "common.h" + +#include +#include "types.h" #define NDS_FW_SIZE_V1 (256 * 1024) /* size of fw memory on nds v1 */ #define NDS_FW_SIZE_V2 (512 * 1024) /* size of fw memory on nds v2 */ @@ -28,6 +30,8 @@ //extension of the firmware user settings file #define FW_CONFIG_FILE_EXT "dfc" +struct NDS_fw_config_data; + class CFIRMWARE { private: @@ -86,8 +90,8 @@ public: }; int copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data); -int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings); -void NDS_FillDefaultFirmwareConfigData( struct NDS_fw_config_data *fw_config); +int NDS_CreateDummyFirmware(NDS_fw_config_data *user_settings); +void NDS_FillDefaultFirmwareConfigData(NDS_fw_config_data *fw_config); void NDS_PatchFirmwareMAC(); struct fw_memory_chip diff --git a/desmume/src/gdbstub.h b/desmume/src/gdbstub.h index a71347bbf..968e579a9 100644 --- a/desmume/src/gdbstub.h +++ b/desmume/src/gdbstub.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 Ben Jaques - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,8 @@ #include "types.h" typedef void *gdbstub_handle_t; -extern const armcpu_memory_iface gdb_memory_iface; +struct armcpu_t; +struct armcpu_memory_iface; /* * The function interface diff --git a/desmume/src/gdbstub/gdbstub.cpp b/desmume/src/gdbstub/gdbstub.cpp index 89c70d94f..cb9287142 100644 --- a/desmume/src/gdbstub/gdbstub.cpp +++ b/desmume/src/gdbstub/gdbstub.cpp @@ -22,34 +22,18 @@ THE SOFTWARE. */ +#include "gdbstub_internal.h" + #include -//#include #include #include - #include -#include "types.h" -#include "NDSSystem.h" - -#ifdef WIN32 -#include -#else -#include -#include -#include -#include -#include -#endif - -#include "armcpu.h" - -#define uint32_t u32 -#define uint16_t u16 -#define uint8_t u8 - -#include "gdbstub.h" -#include "gdbstub_internal.h" +#include "../gdbstub.h" +#include "../types.h" +#include "../NDSSystem.h" +#include "../armcpu.h" +#include "../MMU.h" #ifdef __GNUC__ #define UNUSED_PARM( parm) parm __attribute__((unused)) @@ -638,7 +622,7 @@ processPacket_gdb( SOCKET_TYPE sock, const uint8_t *packet, if ( *rx_ptr++ == ',') { if ( hexToInt( &rx_ptr, &length)) { //DEBUG_LOG("mem read from %08x (%d)\n", addr, length); - if ( !mem2hex( &stub->direct_memio, addr, out_ptr, length)) { + if ( !mem2hex( stub->direct_memio, addr, out_ptr, length)) { strcpy ( (char *)out_ptr, "E03"); send_size = 3; } @@ -674,7 +658,7 @@ processPacket_gdb( SOCKET_TYPE sock, const uint8_t *packet, for ( i = 0; i < length; i++) { rx_ptr = hex2mem( rx_ptr, &write_byte, 1); - stub->direct_memio.write8( stub->direct_memio.data, + stub->direct_memio->write8( stub->direct_memio->data, addr++, write_byte); } @@ -1397,7 +1381,21 @@ gdb_write32( void *data, uint32_t adr, uint32_t val) { STOP_AWATCHPOINT); } +// GDB memory interface for the ARM CPUs +static const armcpu_memory_iface gdb_memory_iface = { + gdb_prefetch32, + gdb_prefetch16, + gdb_read8, + gdb_read16, + gdb_read32, + + gdb_write8, + gdb_write16, + gdb_write32, + + NULL +}; @@ -1453,20 +1451,19 @@ createStub_gdb( uint16_t port, return stub; } - stub = (gdb_stub_state*)malloc( sizeof (struct gdb_stub_state)); - if ( stub == NULL) { - return stub; - } - + stub = new gdb_stub_state; stub->arm_cpu_object = theCPU; stub->active = 0; /* keep the memory interfaces */ stub->cpu_memio = theCPU->GetBaseMemoryInterface(); - stub->direct_memio = *direct_memio; - stub->gdb_memio = gdb_memory_iface; - stub->gdb_memio.data = stub; + stub->direct_memio = new armcpu_memory_iface; + *(stub->direct_memio) = *direct_memio; + + stub->gdb_memio = new armcpu_memory_iface; + *(stub->gdb_memio) = gdb_memory_iface; + stub->gdb_memio->data = stub; stub->cpu_ctrl = theCPU->GetControlInterface(); @@ -1570,14 +1567,14 @@ createStub_gdb( uint16_t port, if ( stub->thread == NULL) { LOG_ERROR("Failed to create listener thread\n"); - free( stub); + delete stub; } else { DEBUG_LOG("Created GDB stub on port %d\n", port); } } else { - free( stub); + delete stub; } return stub; @@ -1601,7 +1598,9 @@ destroyStub_gdb( gdbstub_handle_t instance) { theCPU->ResetMemoryInterfaceToBase(); DEBUG_LOG("Destroyed GDB stub on port %d\n", stub->port_num); - free( stub); + delete stub->direct_memio; + delete stub->gdb_memio; + delete stub; } void @@ -1611,26 +1610,10 @@ activateStub_gdb( gdbstub_handle_t instance) { struct gdb_stub_state *stub = (struct gdb_stub_state *)instance; armcpu_t *theCPU = (armcpu_t *)stub->arm_cpu_object; - theCPU->SetCurrentMemoryInterface(&stub->gdb_memio); + theCPU->SetCurrentMemoryInterface(stub->gdb_memio); /* stall the cpu */ stub->cpu_ctrl->stall( stub->cpu_ctrl->data); stub->active = 1; } - -// GDB memory interface for the ARM CPUs -const armcpu_memory_iface gdb_memory_iface = { - gdb_prefetch32, - gdb_prefetch16, - - gdb_read8, - gdb_read16, - gdb_read32, - - gdb_write8, - gdb_write16, - gdb_write32, - - NULL -}; diff --git a/desmume/src/gdbstub/gdbstub_internal.h b/desmume/src/gdbstub/gdbstub_internal.h index 8d273037f..4714cce9f 100644 --- a/desmume/src/gdbstub/gdbstub_internal.h +++ b/desmume/src/gdbstub/gdbstub_internal.h @@ -26,9 +26,23 @@ #define _GDBSTUB_INTERNAL_H_ 1 #ifdef WIN32 -#define SOCKET_TYPE SOCKET + typedef __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + + #include + #define SOCKET_TYPE SOCKET #else -#define SOCKET_TYPE int + #include + #include + #include + #include + #include + #include + #define SOCKET_TYPE int #endif @@ -42,6 +56,8 @@ enum stop_type { STOP_AWATCHPOINT }; +struct armcpu_ctrl_iface; +struct armcpu_memory_iface; /** * The structure describing a breakpoint. @@ -99,10 +115,10 @@ struct gdb_stub_state { armcpu_memory_iface *cpu_memio; /** the direct interface to the memory system */ - armcpu_memory_iface direct_memio; + armcpu_memory_iface *direct_memio; /** GDB stub's memory interface passed to the CPU */ - armcpu_memory_iface gdb_memio; + armcpu_memory_iface *gdb_memio; /** the list of active instruction breakpoints */ struct breakpoint_gdb *instr_breakpoints; diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 4b5d8af1f..092b2cd7f 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,13 +28,18 @@ //if they do, then we need to copy them out in doFlush!!! //--------------- -#include +#include "gfx3d.h" + #include #include #include +#include +#include + #include "armcpu.h" #include "debug.h" -#include "gfx3d.h" +#include "driver.h" +#include "emufile.h" #include "matrix.h" #include "bits.h" #include "MMU.h" @@ -46,7 +51,6 @@ #include "readwrite.h" #include "FIFO.h" #include "movie.h" //only for currframecounter which really ought to be moved into the core emu.... -#include //#define _SHOW_VTX_COUNTERS // show polygon/vertex counters on screen #ifdef _SHOW_VTX_COUNTERS @@ -459,6 +463,44 @@ static void makeTables() { } } +#define OSWRITE(x) os->fwrite((char*)&(x),sizeof((x))); +#define OSREAD(x) is->fread((char*)&(x),sizeof((x))); + +void POLY::save(EMUFILE* os) +{ + OSWRITE(type); + OSWRITE(vertIndexes[0]); OSWRITE(vertIndexes[1]); OSWRITE(vertIndexes[2]); OSWRITE(vertIndexes[3]); + OSWRITE(polyAttr); OSWRITE(texParam); OSWRITE(texPalette); + OSWRITE(viewport); + OSWRITE(miny); + OSWRITE(maxy); +} + +void POLY::load(EMUFILE* is) +{ + OSREAD(type); + OSREAD(vertIndexes[0]); OSREAD(vertIndexes[1]); OSREAD(vertIndexes[2]); OSREAD(vertIndexes[3]); + OSREAD(polyAttr); OSREAD(texParam); OSREAD(texPalette); + OSREAD(viewport); + OSREAD(miny); + OSREAD(maxy); +} + +void VERT::save(EMUFILE* os) +{ + OSWRITE(x); OSWRITE(y); OSWRITE(z); OSWRITE(w); + OSWRITE(u); OSWRITE(v); + OSWRITE(color[0]); OSWRITE(color[1]); OSWRITE(color[2]); + OSWRITE(fcolor[0]); OSWRITE(fcolor[1]); OSWRITE(fcolor[2]); +} +void VERT::load(EMUFILE* is) +{ + OSREAD(x); OSREAD(y); OSREAD(z); OSREAD(w); + OSREAD(u); OSREAD(v); + OSREAD(color[0]); OSREAD(color[1]); OSREAD(color[2]); + OSREAD(fcolor[0]); OSREAD(fcolor[1]); OSREAD(fcolor[2]); +} + void gfx3d_init() { gxf_hardware.reset(); diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index 0a768e87d..523caa7d9 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2008-2012 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,9 +22,10 @@ #include #include #include -#include "types.h" -#include "emufile.h" +#include "types.h" + +class EMUFILE; // Pixel dimensions of the NDS 3D framebuffer #define GFX3D_FRAMEBUFFER_WIDTH 256 @@ -232,9 +233,6 @@ enum void gfx3d_init(); void gfx3d_reset(); -#define OSWRITE(x) os->fwrite((char*)&(x),sizeof((x))); -#define OSREAD(x) is->fread((char*)&(x),sizeof((x))); - typedef struct { u8 enableLightFlags; @@ -496,26 +494,9 @@ struct POLY { return false; } - - void save(EMUFILE* os) - { - OSWRITE(type); - OSWRITE(vertIndexes[0]); OSWRITE(vertIndexes[1]); OSWRITE(vertIndexes[2]); OSWRITE(vertIndexes[3]); - OSWRITE(polyAttr); OSWRITE(texParam); OSWRITE(texPalette); - OSWRITE(viewport); - OSWRITE(miny); - OSWRITE(maxy); - } - - void load(EMUFILE* is) - { - OSREAD(type); - OSREAD(vertIndexes[0]); OSREAD(vertIndexes[1]); OSREAD(vertIndexes[2]); OSREAD(vertIndexes[3]); - OSREAD(polyAttr); OSREAD(texParam); OSREAD(texPalette); - OSREAD(viewport); - OSREAD(miny); - OSREAD(maxy); - } + + void save(EMUFILE* os); + void load(EMUFILE* is); }; #define POLYLIST_SIZE 100000 @@ -582,20 +563,8 @@ struct VERT { fcolor[1] = color[1]; fcolor[2] = color[2]; } - void save(EMUFILE* os) - { - OSWRITE(x); OSWRITE(y); OSWRITE(z); OSWRITE(w); - OSWRITE(u); OSWRITE(v); - OSWRITE(color[0]); OSWRITE(color[1]); OSWRITE(color[2]); - OSWRITE(fcolor[0]); OSWRITE(fcolor[1]); OSWRITE(fcolor[2]); - } - void load(EMUFILE* is) - { - OSREAD(x); OSREAD(y); OSREAD(z); OSREAD(w); - OSREAD(u); OSREAD(v); - OSREAD(color[0]); OSREAD(color[1]); OSREAD(color[2]); - OSREAD(fcolor[0]); OSREAD(fcolor[1]); OSREAD(fcolor[2]); - } + void save(EMUFILE* os); + void load(EMUFILE* is); }; #define VERTLIST_SIZE 400000 diff --git a/desmume/src/gtk/dTool.h b/desmume/src/gtk/dTool.h index 82685b3f7..e0a6cd5f8 100644 --- a/desmume/src/gtk/dTool.h +++ b/desmume/src/gtk/dTool.h @@ -1,9 +1,6 @@ #ifndef __DTOOL_H__ #define __DTOOL_H__ -#include "../types.h" -#include "../registers.h" - typedef void (*dTool_openFn)(int id); typedef void (*dTool_updateFn)(); typedef void (*dTool_closeFn)(); diff --git a/desmume/src/gtk/dToolsList.cpp b/desmume/src/gtk/dToolsList.cpp index 1b7e24d16..503da5b43 100644 --- a/desmume/src/gtk/dToolsList.cpp +++ b/desmume/src/gtk/dToolsList.cpp @@ -1,6 +1,7 @@ /* dToolsList.cpp * * Copyright (C) 2006 Thoduv + * Copyright (C) 2006-2015 DeSmuME Team * * This file is part of DeSmuME * @@ -20,6 +21,7 @@ */ #include "dTool.h" +#include "../types.h" #include "tools/ioregsView.h" dTool_t *dTools_list[] = diff --git a/desmume/src/gtk/desmume.cpp b/desmume/src/gtk/desmume.cpp index 45102facd..0197da6be 100644 --- a/desmume/src/gtk/desmume.cpp +++ b/desmume/src/gtk/desmume.cpp @@ -19,13 +19,13 @@ * Boston, MA 02111-1307, USA. */ -#include "types.h" -#include "NDSSystem.h" -#include "SPU.h" -#include "sndsdl.h" -#include "ctrlssdl.h" + #include "desmume.h" -#include "movie.h" + +#include "../NDSSystem.h" +#include "../SPU.h" +#include "../sndsdl.h" +#include "../movie.h" volatile bool execute = false; BOOL click = FALSE; diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 73723844b..58b809240 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -34,8 +34,10 @@ #include "types.h" #include "firmware.h" -#include "armcpu.h" #include "NDSSystem.h" +#include "driver.h" +#include "GPU.h" +#include "SPU.h" #include "sndsdl.h" #include "ctrlssdl.h" #include "MMU.h" @@ -63,6 +65,7 @@ #include "filter/videofilter.h" #ifdef GDB_STUB +#include "armcpu.h" #include "gdbstub.h" #endif @@ -2336,7 +2339,7 @@ static inline void _updateDTools() /////////////////////////////// MAIN EMULATOR LOOP /////////////////////////////// -class GtkDriver : public UnixDriver +class GtkDriver : public BaseDriver { public: virtual void EMU_DebugIdleUpdate() diff --git a/desmume/src/gtk/tools/ioregsView.cpp b/desmume/src/gtk/tools/ioregsView.cpp index 83c3fad78..c338470c4 100644 --- a/desmume/src/gtk/tools/ioregsView.cpp +++ b/desmume/src/gtk/tools/ioregsView.cpp @@ -1,7 +1,7 @@ /* ioregsView.cpp - this file is part of DeSmuME * * Copyright (C) 2006 Thoduv - * Copyright (C) 2006,2007 DeSmuME Team + * Copyright (C) 2006-2015 DeSmuME Team * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,8 @@ #include #include "../dTool.h" -#include "../MMU.h" +#include "../../MMU.h" +#include "../../registers.h" #undef GPOINTER_TO_INT #define GPOINTER_TO_INT(p) ((gint) (glong) (p)) diff --git a/desmume/src/instructions.h b/desmume/src/instructions.h index 243ed8554..3a4dc750a 100644 --- a/desmume/src/instructions.h +++ b/desmume/src/instructions.h @@ -1,5 +1,5 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2012 DeSmuME team + Copyright (C) 2012-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ #ifndef _INSTRUCIONS_H_ #define _INSTRUCIONS_H_ +#include "types.h" + typedef u32 (FASTCALL* OpFunc)(const u32 i); extern const OpFunc arm_instructions_set[2][4096]; extern const char* arm_instruction_names[4096]; diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp index 22f81d0a1..4a7ee655b 100644 --- a/desmume/src/lua-engine.cpp +++ b/desmume/src/lua-engine.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2012 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,31 +15,44 @@ along with the this software. If not, see . */ -#include "types.h" #include "lua-engine.h" -#include "movie.h" + +#if defined(WIN32) + #include + #include + + typedef HMENU PlatformMenu; // hMenu + #define MAX_MENU_COUNT (IDC_LUAMENU_RESERVE_END - IDC_LUAMENU_RESERVE_START + 1) + + #include "windows/main.h" + #include "windows/video.h" + #include "windows/resource.h" +#else + // TODO: define appropriate types for menu + typedef void* PlatformMenu; + #define MAX_MENU_COUNT 0 + + #include +#endif + #include #include #include #include #include + +#include "armcpu.h" +#include "movie.h" #include "zlib.h" +#include "driver.h" #include "NDSSystem.h" #include "movie.h" +#include "MMU.h" +#include "GPU.h" #include "GPU_osd.h" +#include "SPU.h" #include "saves.h" #include "emufile.h" -#if defined(WIN32) -#include -#include "main.h" -#include "video.h" -#include "resource.h" -#endif -#ifdef WIN32 -#include -#else -#include -#endif using namespace std; @@ -3523,7 +3536,7 @@ static PlatformMenu AddSubMenu(PlatformMenu topMenu, PlatformMenu menu, const ch } // add new submenu - UINT subMenuId; + PlatformMenuItem subMenuId; if (!SearchFreeMenuItem(topMenu, subMenuId)) { return NULL; @@ -3567,7 +3580,7 @@ bool AddMenuEntries(PlatformMenu topMenu, PlatformMenu menu) lua_rawgeti(L, -1, index); if (lua_isnil(L, -1)) { - UINT menuItem; + PlatformMenuItem menuItem; if (!SearchFreeMenuItem(topMenu, menuItem)) { luaL_error(L, "too many menu items"); @@ -3597,7 +3610,7 @@ bool AddMenuEntries(PlatformMenu topMenu, PlatformMenu menu) lua_rawgeti(L, -1, 2); if (lua_isfunction(L, -1)) { - UINT menuItem; + PlatformMenuItem menuItem; if (!SearchFreeMenuItem(topMenu, menuItem)) { luaL_error(L, "too many menu items"); diff --git a/desmume/src/lua-engine.h b/desmume/src/lua-engine.h index ba70aac3b..cae475ea5 100644 --- a/desmume/src/lua-engine.h +++ b/desmume/src/lua-engine.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2010 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,12 +20,6 @@ #include "types.h" -#if defined(WIN32) -#include -#include -#include "resource.h" -#endif - void OpenLuaContext(int uid, void(*print)(int uid, const char* str) = 0, void(*onstart)(int uid) = 0, void(*onstop)(int uid, bool statusOK) = 0); void RunLuaScriptFile(int uid, const char* filename); void StopLuaScript(int uid); @@ -110,16 +104,7 @@ private: void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData); void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData); -#if defined(WIN32) -typedef HMENU PlatformMenu; // hMenu -typedef UINT PlatformMenuItem; // menuId -#define MAX_MENU_COUNT (IDC_LUAMENU_RESERVE_END - IDC_LUAMENU_RESERVE_START + 1) -#else -// TODO: define appropriate types for menu -typedef void* PlatformMenu; -typedef u32 PlatformMenuItem; -#define MAX_MENU_COUNT 0 -#endif +typedef size_t PlatformMenuItem; void CallRegisteredLuaMenuHandlers(PlatformMenuItem menuItem); void StopAllLuaScripts(); diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index c0664186e..41865ae26 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 thoduv Copyright (C) 2006-2007 Theo Berkau - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,13 +17,16 @@ along with the this software. If not, see . */ +#include "mc.h" + #include #include -#include "types.h" +#include "common.h" +#include "armcpu.h" #include "debug.h" -#include "mc.h" #include "movie.h" +#include "MMU.h" #include "readwrite.h" #include "NDSSystem.h" #include "path.h" @@ -526,6 +529,16 @@ void BackupDevice::writeLong(u32 val) fpMC->write32le(val); } +void BackupDevice::seek(u32 pos) +{ + fpMC->fseek(pos, SEEK_SET); +} + +void BackupDevice::flushBackup() +{ + fpMC->fflush(); +} + bool BackupDevice::saveBuffer(u8 *data, u32 size, bool _rewind, bool _truncate) { if (_rewind) diff --git a/desmume/src/mc.h b/desmume/src/mc.h index 136cb9b61..e569c55e1 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -1,7 +1,7 @@ /* Copyright (C) 2006 thoduv Copyright (C) 2006 Theo Berkau - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,10 +23,8 @@ #include #include #include + #include "types.h" -#include "emufile.h" -#include "common.h" -#include "utils/tinyxml/tinyxml.h" #define MAX_SAVE_TYPES 13 #define MC_TYPE_AUTODETECT 0x0 @@ -50,6 +48,9 @@ #define MC_SIZE_256MBITS 0x2000000 #define MC_SIZE_512MBITS 0x4000000 +class EMUFILE; +class EMUFILE_FILE; + //This "backup device" represents a typical retail NDS save memory accessible via AUXSPI. //It is managed as a core emulator service for historical reasons which are bad, //and possible infrastructural simplification reasons which are good. @@ -84,9 +85,9 @@ public: void writeWord(u16 val); void writeLong(u32 val); - void seek(u32 pos) { fpMC->fseek(pos, SEEK_SET); } + void seek(u32 pos); - void flushBackup() { fpMC->fflush(); } + void flushBackup(); u8 searchFileSaveType(u32 size); diff --git a/desmume/src/metaspu/SndOut.cpp b/desmume/src/metaspu/SndOut.cpp index 1377ba515..fd920b5cc 100644 --- a/desmume/src/metaspu/SndOut.cpp +++ b/desmume/src/metaspu/SndOut.cpp @@ -16,9 +16,10 @@ */ //#include "Global.h" -#include "types.h" #include "SndOut.h" + #include +#include //---------------- int SndOutLatencyMS = 160; diff --git a/desmume/src/metaspu/SndOut.h b/desmume/src/metaspu/SndOut.h index d897be199..ab83abb94 100644 --- a/desmume/src/metaspu/SndOut.h +++ b/desmume/src/metaspu/SndOut.h @@ -19,6 +19,8 @@ #include +#include "types.h" + struct StereoOut16; struct StereoOut32; struct StereoOutFloat; diff --git a/desmume/src/metaspu/Timestretcher.cpp b/desmume/src/metaspu/Timestretcher.cpp index 967c31d0e..b1b854db4 100644 --- a/desmume/src/metaspu/Timestretcher.cpp +++ b/desmume/src/metaspu/Timestretcher.cpp @@ -17,6 +17,7 @@ //#include "Global.h" #include +#include #include "types.h" #include "SndOut.h" //#include "SoundTouch/WavFile.h" diff --git a/desmume/src/metaspu/metaspu.cpp b/desmume/src/metaspu/metaspu.cpp index cc1182cc5..c12887991 100644 --- a/desmume/src/metaspu/metaspu.cpp +++ b/desmume/src/metaspu/metaspu.cpp @@ -1,4 +1,4 @@ -/* Copyright 2009 DeSmuME team +/* Copyright 2009-2015 DeSmuME team This file is part of DeSmuME @@ -17,8 +17,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "types.h" #include "metaspu.h" + #include #include #include diff --git a/desmume/src/metaspu/metaspu.h b/desmume/src/metaspu/metaspu.h index 7a878d548..005e64eb7 100644 --- a/desmume/src/metaspu/metaspu.h +++ b/desmume/src/metaspu/metaspu.h @@ -1,4 +1,4 @@ -/* Copyright 2009-2010 DeSmuME team +/* Copyright 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,8 @@ #include +#include "types.h" + template< typename T > static FORCEINLINE void Clampify( T& src, T min, T max ) { diff --git a/desmume/src/mic.h b/desmume/src/mic.h index c71774096..56eaf6240 100644 --- a/desmume/src/mic.h +++ b/desmume/src/mic.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2011 DeSmuME Team + Copyright (C) 2009-2015 DeSmuME Team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,10 +18,10 @@ #ifndef MIC_H #define MIC_H -#include -#include "emufile.h" #include "types.h" +class EMUFILE; + #ifdef WIN32 static char MicSampleName[256]; bool LoadSample(const char *name); diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index 6cd0d38c1..cea765be0 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -1,5 +1,5 @@ /* - Copyright 2008-2014 DeSmuME team + Copyright 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,18 +16,23 @@ */ #define WIN32_LEAN_AND_MEAN +#include "movie.h" + #include #include #include #include + #include "utils/guid.h" #include "utils/xstring.h" #include "utils/datetime.h" #include "utils/ConvertUTF.h" -#include "movie.h" + +#include "MMU.h" #include "NDSSystem.h" #include "readwrite.h" #include "debug.h" +#include "driver.h" #include "rtc.h" #include "common.h" #include "mic.h" diff --git a/desmume/src/movie.h b/desmume/src/movie.h index 777a6e096..1b0053750 100644 --- a/desmume/src/movie.h +++ b/desmume/src/movie.h @@ -1,5 +1,5 @@ /* - Copyright 2008-2014 DeSmuME team + Copyright 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,13 +23,13 @@ #include #include #include -#include "emufile.h" #include "utils/datetime.h" #include "utils/guid.h" #include "utils/md5.h" struct UserInput; +class EMUFILE; typedef struct { diff --git a/desmume/src/path.h b/desmume/src/path.h index e18724812..1c35f8fc9 100644 --- a/desmume/src/path.h +++ b/desmume/src/path.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,35 +16,33 @@ */ #include - -#ifdef HOST_WINDOWS -#define mkdir _mkdir -#endif +#include "types.h" #if defined(HOST_WINDOWS) -#include -#include -#include -#include "common.h" -#ifndef DESMUME_QT -#include "winutil.h" -#include "resource.h" -#endif + #define WIN32_LEAN_AND_MEAN + #include + #include + #define mkdir _mkdir + + #ifndef DESMUME_QT + #include "windows/winutil.h" + #include "windows/resource.h" + #endif #elif !defined(DESMUME_COCOA) -#include + #include #endif /* HOST_WINDOWS */ #include "time.h" #include "utils/xstring.h" #ifdef HOST_WINDOWS -#define FILE_EXT_DELIMITER_CHAR '.' -#define DIRECTORY_DELIMITER_CHAR '\\' -#define ALL_DIRECTORY_DELIMITER_STRING "/\\" + #define FILE_EXT_DELIMITER_CHAR '.' + #define DIRECTORY_DELIMITER_CHAR '\\' + #define ALL_DIRECTORY_DELIMITER_STRING "/\\" #else -#define FILE_EXT_DELIMITER_CHAR '.' -#define DIRECTORY_DELIMITER_CHAR '/' -#define ALL_DIRECTORY_DELIMITER_STRING "/" + #define FILE_EXT_DELIMITER_CHAR '.' + #define DIRECTORY_DELIMITER_CHAR '/' + #define ALL_DIRECTORY_DELIMITER_STRING "/" #endif #ifdef HOST_WINDOWS diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index f51049ab6..5f2a8223b 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,6 +43,7 @@ #include "render3D.h" #include "gfx3d.h" #include "texcache.h" +#include "MMU.h" #include "NDSSystem.h" #include "utils/task.h" diff --git a/desmume/src/readwrite.cpp b/desmume/src/readwrite.cpp index 7d3b9b106..24b9b0ad9 100644 --- a/desmume/src/readwrite.cpp +++ b/desmume/src/readwrite.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2009 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ */ #include "readwrite.h" -#include "types.h" +#include "emufile.h" //well. just for the sake of consistency int write8le(u8 b, EMUFILE*os) diff --git a/desmume/src/readwrite.h b/desmume/src/readwrite.h index 8c945c949..b64cd680d 100644 --- a/desmume/src/readwrite.h +++ b/desmume/src/readwrite.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,12 +18,14 @@ #ifndef _READWRITE_H_ #define _READWRITE_H_ -#include "types.h" -#include "emufile.h" #include #include #include +#include "types.h" + +class EMUFILE; + //well. just for the sake of consistency int write8le(u8 b, EMUFILE *fp); inline int write8le(u8* b, EMUFILE *fp) { return write8le(*b,fp); } diff --git a/desmume/src/render3D.cpp b/desmume/src/render3D.cpp index 6d068b502..de89a716b 100644 --- a/desmume/src/render3D.cpp +++ b/desmume/src/render3D.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006-2007 shash - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,9 @@ */ #include "render3D.h" + +#include + #include "gfx3d.h" #include "MMU.h" #include "texcache.h" diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index d1bd4c898..351a91693 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -2,7 +2,7 @@ Copyright (C) 2006 Normmatt Copyright (C) 2006 Theo Berkau Copyright (C) 2007 Pascal Giard - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,11 +28,18 @@ #include #include #include + +#include "common.h" +#include "armcpu.h" +#include "registers.h" +#include "FIFO.h" +#include "driver.h" #include "saves.h" #include "MMU.h" #include "NDSSystem.h" #include "render3D.h" #include "cp15.h" +#include "GPU.h" #include "GPU_osd.h" #include "version.h" @@ -43,6 +50,8 @@ #include "MMU_timing.h" #include "slot1.h" #include "slot2.h" +#include "SPU.h" +#include "wifi.h" #include "path.h" diff --git a/desmume/src/slot1.h b/desmume/src/slot1.h index 04266570e..3b2066699 100644 --- a/desmume/src/slot1.h +++ b/desmume/src/slot1.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,9 +19,8 @@ #define __SLOT1_H__ #include -#include "common.h" + #include "types.h" -#include "debug.h" #include "MMU.h" class EMUFILE; diff --git a/desmume/src/slot2.cpp b/desmume/src/slot2.cpp index 058b5a071..140c35213 100644 --- a/desmume/src/slot2.cpp +++ b/desmume/src/slot2.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,11 @@ along with the this software. If not, see . */ #include "slot2.h" + #include "types.h" #include "mem.h" #include "MMU.h" +#include "registers.h" #include "NDSSystem.h" //this is the currently-configured cflash mode diff --git a/desmume/src/slot2.h b/desmume/src/slot2.h index 2908bca9b..eef4d3f78 100644 --- a/desmume/src/slot2.h +++ b/desmume/src/slot2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,12 +18,14 @@ #ifndef __SLOT2_H__ #define __SLOT2_H__ -#include "common.h" +#include + #include "types.h" -#include "debug.h" #define GBA_SRAM_FILE_EXT "sav" +class EMUFILE; + class Slot2Info { public: diff --git a/desmume/src/texcache.cpp b/desmume/src/texcache.cpp index fdb577743..15e20c2f0 100644 --- a/desmume/src/texcache.cpp +++ b/desmume/src/texcache.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash - Copyright (C) 2008-2011 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include "common.h" #include "debug.h" #include "gfx3d.h" +#include "MMU.h" #include "NDSSystem.h" using std::min; diff --git a/desmume/src/texcache.h b/desmume/src/texcache.h index f9d82a036..ab1e524ac 100644 --- a/desmume/src/texcache.h +++ b/desmume/src/texcache.h @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006-2007 shash - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,9 +20,10 @@ #ifndef _TEXCACHE_H_ #define _TEXCACHE_H_ -#include "common.h" #include +#include "types.h" + enum TexCache_TexFormat { TexFormat_None, //used when nothing yet is cached diff --git a/desmume/src/thumb_instructions.cpp b/desmume/src/thumb_instructions.cpp index f24027649..d697bb53c 100644 --- a/desmume/src/thumb_instructions.cpp +++ b/desmume/src/thumb_instructions.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2008 shash - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,12 +17,16 @@ along with the this software. If not, see . */ +#include "armcpu.h" +#include "instructions.h" + +#include + #include "bios.h" #include "debug.h" #include "MMU.h" #include "NDSSystem.h" #include "MMU_timing.h" -#include #define cpu (&ARMPROC) #define TEMPLATE template diff --git a/desmume/src/types.h b/desmume/src/types.h index c715ee9d1..84e13cba8 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -1,6 +1,6 @@ /* Copyright (C) 2005 Guillaume Duhamel - Copyright (C) 2008-2012 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,15 +85,20 @@ #define WINAPI #endif -#ifdef __GNUC__ -#include -#ifndef PATH_MAX -#define MAX_PATH 1024 -#else -#define MAX_PATH PATH_MAX +#if !defined(MAX_PATH) + #if defined(HOST_WINDOWS) + #define MAX_PATH 260 + #elif defined(__GNUC__) + #include + #if !defined(PATH_MAX) + #define MAX_PATH 1024 + #else + #define MAX_PATH PATH_MAX + #endif + #else + #define MAX_PATH 1024 + #endif #endif -#endif - //------------alignment macros------------- //dont apply these to types without further testing. it only works portably here on declarations of variables diff --git a/desmume/src/utils/advanscene.cpp b/desmume/src/utils/advanscene.cpp index c6bfae662..8d8f37005 100644 --- a/desmume/src/utils/advanscene.cpp +++ b/desmume/src/utils/advanscene.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,9 @@ #include "tinyxml/tinyxml.h" #include "advanscene.h" -#include "mc.h" +#include "../common.h" +#include "../mc.h" +#include "../emufile.h" ADVANsCEne advsc; diff --git a/desmume/src/utils/advanscene.h b/desmume/src/utils/advanscene.h index 47347fd24..9333d7eff 100644 --- a/desmume/src/utils/advanscene.h +++ b/desmume/src/utils/advanscene.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,9 @@ */ #include -#include "types.h" -#include "emufile.h" +#include "../types.h" + +class EMUFILE; class ADVANsCEne { diff --git a/desmume/src/utils/decrypt/crc.h b/desmume/src/utils/decrypt/crc.h index e7ca5779e..2af2fe6e9 100644 --- a/desmume/src/utils/decrypt/crc.h +++ b/desmume/src/utils/decrypt/crc.h @@ -30,6 +30,7 @@ #define __CRC_H //#include "little.h" // FixCrc is not yet big endian compatible +#include /* * Data diff --git a/desmume/src/utils/decrypt/decrypt.cpp b/desmume/src/utils/decrypt/decrypt.cpp index 28a6c2573..d8280efad 100644 --- a/desmume/src/utils/decrypt/decrypt.cpp +++ b/desmume/src/utils/decrypt/decrypt.cpp @@ -21,14 +21,13 @@ * Boston, MA 02111-1307, USA. */ -#include +#include "decrypt.h" + #include #include -#include "../../types.h" #include "crc.h" #include "header.h" -#include "decrypt.h" //encr_data const unsigned char arm7_key[] = diff --git a/desmume/src/utils/decrypt/decrypt.h b/desmume/src/utils/decrypt/decrypt.h index 58242b445..169108480 100644 --- a/desmume/src/utils/decrypt/decrypt.h +++ b/desmume/src/utils/decrypt/decrypt.h @@ -21,6 +21,8 @@ #ifndef _DECRYPT_H_ #define _DECRYPT_H_ +#include "../../types.h" + extern const unsigned char arm7_key[]; //decrypts the secure area of a rom (or does nothing if it is already decrypted) diff --git a/desmume/src/utils/emufat.cpp b/desmume/src/utils/emufat.cpp index cd3d7741d..1a6c5575a 100644 --- a/desmume/src/utils/emufat.cpp +++ b/desmume/src/utils/emufat.cpp @@ -1,5 +1,5 @@ /* - Copyright 2009-2010 DeSmuME team + Copyright 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include #include #include +#include "../emufile.h" #define LE16(x) (x) diff --git a/desmume/src/utils/emufat.h b/desmume/src/utils/emufat.h index 536d25015..6b60461eb 100644 --- a/desmume/src/utils/emufat.h +++ b/desmume/src/utils/emufat.h @@ -1,5 +1,5 @@ /* - Copyright 2009-2010 DeSmuME team + Copyright 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,9 +32,10 @@ #define EMUFAT_H #include "emufat_types.h" -#include "emufile.h" #include +class EMUFILE; + #define BOOTCODE_SIZE 448 #define BOOTCODE_FAT32_SIZE 420 diff --git a/desmume/src/utils/vfat.cpp b/desmume/src/utils/vfat.cpp index c648d1a56..e05b81758 100644 --- a/desmume/src/utils/vfat.cpp +++ b/desmume/src/utils/vfat.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2006 yopyop Copyright (C) 2006 Mic - Copyright (C) 2010-2011 DeSmuME team + Copyright (C) 2010-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include "../types.h" #include "../debug.h" +#include "../emufile.h" #include "../fs.h" #include "emufat.h" diff --git a/desmume/src/wifi.cpp b/desmume/src/wifi.cpp index ed84b319c..299cebc01 100644 --- a/desmume/src/wifi.cpp +++ b/desmume/src/wifi.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Tim Seidel - Copyright (C) 2008-2012 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,23 +16,17 @@ along with the this software. If not, see . */ -#include -#include "wifi.h" -#include "armcpu.h" -#include "NDSSystem.h" -#include "debug.h" -#include "bits.h" - +#include "types.h" #ifdef HOST_WINDOWS - #include + #include #include #define socket_t SOCKET #define sockaddr_t SOCKADDR #include "windriver.h" #define PCAP_DEVICE_NAME description #else - #include + #include #include #include #include @@ -43,6 +37,16 @@ #define PCAP_DEVICE_NAME name #endif +#include "wifi.h" + +#include + +#include "armcpu.h" +#include "NDSSystem.h" +#include "debug.h" +#include "bits.h" +#include "registers.h" + #ifndef INVALID_SOCKET #define INVALID_SOCKET (socket_t)-1 #endif @@ -67,6 +71,9 @@ pcap_t *wifi_bridge = NULL; #define PCAP_OPENFLAG_PROMISCUOUS 1 #endif +static WifiHandler _defaultHandler; +WifiHandler *CurrentWifiHandler = &_defaultHandler; + wifimac_t wifiMac; SoftAP_t SoftAP; int wifi_lastmode; @@ -1773,7 +1780,7 @@ bool Adhoc_Init() BOOL opt_true = TRUE; int res; - if (!driver->WIFI_SocketsAvailable()) + if (!CurrentWifiHandler->WIFI_SocketsAvailable()) { WIFI_LOG(1, "Ad-hoc: failed to initialize sockets.\n"); wifi_socket = INVALID_SOCKET; @@ -1835,7 +1842,7 @@ void Adhoc_DeInit() void Adhoc_Reset() { - driver->WIFI_GetUniqueMAC(FW_Mac); + CurrentWifiHandler->WIFI_GetUniqueMAC(FW_Mac); NDS_PatchFirmwareMAC(); printf("WIFI: ADHOC: MAC = %02X:%02X:%02X:%02X:%02X:%02X\n", @@ -2060,7 +2067,7 @@ static pcap_if_t * WIFI_index_device(pcap_if_t *alldevs, int index) bool SoftAP_Init() { - if (!driver->WIFI_PCapAvailable()) + if (!CurrentWifiHandler->WIFI_PCapAvailable()) { WIFI_LOG(1, "SoftAP: PCap library not available on your system.\n"); wifi_bridge = NULL; @@ -2071,7 +2078,7 @@ bool SoftAP_Init() pcap_if_t *alldevs; int ret = 0; - ret = driver->PCAP_findalldevs(&alldevs, errbuf); + ret = CurrentWifiHandler->PCAP_findalldevs(&alldevs, errbuf); if (ret == -1 || alldevs == NULL) { WIFI_LOG(1, "SoftAP: PCap: failed to find any network adapter: %s\n", errbuf); @@ -2079,20 +2086,20 @@ bool SoftAP_Init() } pcap_if_t* dev = WIFI_index_device(alldevs,CommonSettings.wifi.infraBridgeAdapter); - wifi_bridge = driver->PCAP_open(dev->name, PACKET_SIZE, PCAP_OPENFLAG_PROMISCUOUS, 1, errbuf); + wifi_bridge = CurrentWifiHandler->PCAP_open(dev->name, PACKET_SIZE, PCAP_OPENFLAG_PROMISCUOUS, 1, errbuf); if(wifi_bridge == NULL) { WIFI_LOG(1, "SoftAP: PCap: failed to open %s: %s\n", dev->PCAP_DEVICE_NAME, errbuf); return false; } - driver->PCAP_freealldevs(alldevs); + CurrentWifiHandler->PCAP_freealldevs(alldevs); // Set non-blocking mode - if (driver->PCAP_setnonblock(wifi_bridge, 1, errbuf) == -1) + if (CurrentWifiHandler->PCAP_setnonblock(wifi_bridge, 1, errbuf) == -1) { WIFI_LOG(1, "SoftAP: PCap: failed to set non-blocking mode: %s\n", errbuf); - driver->PCAP_close(wifi_bridge); wifi_bridge = NULL; + CurrentWifiHandler->PCAP_close(wifi_bridge); wifi_bridge = NULL; return false; } @@ -2104,7 +2111,7 @@ bool SoftAP_Init() void SoftAP_DeInit() { if(wifi_bridge != NULL) - driver->PCAP_close(wifi_bridge); + CurrentWifiHandler->PCAP_close(wifi_bridge); } void SoftAP_Reset() @@ -2289,7 +2296,7 @@ void SoftAP_SendPacket(u8 *packet, u32 len) memcpy(&epacket[14], &packet[32], epacketLen - 14); if(wifi_bridge != NULL) - driver->PCAP_sendpacket(wifi_bridge, epacket, epacketLen); + CurrentWifiHandler->PCAP_sendpacket(wifi_bridge, epacket, epacketLen); } else { @@ -2374,7 +2381,7 @@ void SoftAP_msTrigger() // Can now receive 64 packets per millisecond. Completely arbitrary limit. Todo: tweak if needed. // But due to using non-blocking mode, this shouldn't be as slow as it used to be. if (wifi_bridge != NULL) - driver->PCAP_dispatch(wifi_bridge, 64, SoftAP_RXHandler, NULL); + CurrentWifiHandler->PCAP_dispatch(wifi_bridge, 64, SoftAP_RXHandler, NULL); } #endif diff --git a/desmume/src/wifi.h b/desmume/src/wifi.h index d246d12f7..0edc82599 100644 --- a/desmume/src/wifi.h +++ b/desmume/src/wifi.h @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Tim Seidel - Copyright (C) 2008-2011 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,17 +20,19 @@ #define WIFI_H #include +#include #include "types.h" -#include - #ifdef EXPERIMENTAL_WIFI_COMM + #ifdef HOST_WINDOWS + #define WIN32_LEAN_AND_MEAN + #endif -#define HAVE_REMOTE -#define WPCAP -#define PACKET_SIZE 65535 -#define _INC_STDIO - + #include + #define HAVE_REMOTE + #define WPCAP + #define PACKET_SIZE 65535 + #define _INC_STDIO #endif @@ -619,6 +621,57 @@ typedef struct _FW_WFCProfile } FW_WFCProfile; +class WifiHandler +{ +public: +#ifdef EXPERIMENTAL_WIFI_COMM + virtual bool WIFI_SocketsAvailable() { return true; } + virtual bool WIFI_PCapAvailable() { return false; } + virtual void WIFI_GetUniqueMAC(u8* mac) {} + virtual bool WIFI_WFCWarning() { return false; } + + virtual int PCAP_findalldevs(pcap_if_t** alldevs, char* errbuf) { return -1; } + virtual void PCAP_freealldevs(pcap_if_t* alldevs) {} + virtual pcap_t* PCAP_open(const char* source, int snaplen, int flags, int readtimeout, char* errbuf) { return NULL; } + virtual void PCAP_close(pcap_t* dev) {} + virtual int PCAP_setnonblock(pcap_t* dev, int nonblock, char* errbuf) { return -1; } + virtual int PCAP_sendpacket(pcap_t* dev, const u_char* data, int len) { return -1; } + virtual int PCAP_dispatch(pcap_t* dev, int num, pcap_handler callback, u_char* userdata) { return -1; } +#endif +}; + +#ifndef HOST_WINDOWS +class UnixWifiHandler : public WifiHandler +{ +#ifdef EXPERIMENTAL_WIFI_COMM + virtual bool WIFI_SocketsAvailable() { return true; } + virtual bool WIFI_PCapAvailable() { return true; } + virtual bool WIFI_WFCWarning() { return false; } + + virtual int PCAP_findalldevs(pcap_if_t** alldevs, char* errbuf) { + return pcap_findalldevs(alldevs, errbuf); } + + virtual void PCAP_freealldevs(pcap_if_t* alldevs) { + pcap_freealldevs(alldevs); } + + virtual pcap_t* PCAP_open(const char* source, int snaplen, int flags, int readtimeout, char* errbuf) { + return pcap_open_live(source, snaplen, flags, readtimeout, errbuf); } + + virtual void PCAP_close(pcap_t* dev) { + pcap_close(dev); } + + virtual int PCAP_setnonblock(pcap_t* dev, int nonblock, char* errbuf) { + return pcap_setnonblock(dev, nonblock, errbuf); } + + virtual int PCAP_sendpacket(pcap_t* dev, const u_char* data, int len) { + return pcap_sendpacket(dev, data, len); } + + virtual int PCAP_dispatch(pcap_t* dev, int num, pcap_handler callback, u_char* userdata) { + return pcap_dispatch(dev, num, callback, userdata); } +#endif +}; +#endif + /* wifi data to be stored in firmware, when no firmware image was loaded */ extern u8 FW_Mac[6]; extern const u8 FW_WIFIInit[32]; @@ -629,5 +682,6 @@ extern const u8 FW_BBChannel[14]; extern FW_WFCProfile FW_WFCProfile1; extern FW_WFCProfile FW_WFCProfile2; extern FW_WFCProfile FW_WFCProfile3; +extern WifiHandler *CurrentWifiHandler; #endif diff --git a/desmume/src/windows/AboutBox.cpp b/desmume/src/windows/AboutBox.cpp index 700c7a075..2287ba631 100644 --- a/desmume/src/windows/AboutBox.cpp +++ b/desmume/src/windows/AboutBox.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2008 shash - Copyright (C) 2008-2013 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,11 +16,10 @@ along with the this software. If not, see . */ - -#include "../common.h" -#include "version.h" - #include "AboutBox.h" + +#include "../version.h" + #include "resource.h" #define ABOUT_TIMER_ID 110222 diff --git a/desmume/src/windows/AboutBox.h b/desmume/src/windows/AboutBox.h index 65dffc866..3657d577d 100644 --- a/desmume/src/windows/AboutBox.h +++ b/desmume/src/windows/AboutBox.h @@ -1,6 +1,6 @@ /* Copyright (C) 2008 shash - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,8 @@ #ifndef ABOUTBOX_H #define ABOUTBOX_H +#include + extern BOOL CALLBACK AboutBox_Proc(HWND dialog,UINT komunikat,WPARAM wparam,LPARAM lparam); - #endif \ No newline at end of file diff --git a/desmume/src/windows/CWindow.cpp b/desmume/src/windows/CWindow.cpp index 55b40dfc7..0d33ef65d 100644 --- a/desmume/src/windows/CWindow.cpp +++ b/desmume/src/windows/CWindow.cpp @@ -17,13 +17,15 @@ */ #include "CWindow.h" + +#include +#include + +#include "../debug.h" + +#include "resource.h" #include "main.h" #include "IORegView.h" -#include "debug.h" -#include "resource.h" -#include - -#include //----------------------------------------------------------------------------- // The Toolkit - Helpers diff --git a/desmume/src/windows/CWindow.h b/desmume/src/windows/CWindow.h index 0135670e8..7a304c110 100644 --- a/desmume/src/windows/CWindow.h +++ b/desmume/src/windows/CWindow.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2010 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ #ifndef CWINDOW_H #define CWINDOW_H -#include "../common.h" +#include #include #include @@ -27,6 +27,8 @@ #include #include +#include "../types.h" + using namespace std; extern CRITICAL_SECTION win_execute_sync; diff --git a/desmume/src/windows/FEX_Interface.cpp b/desmume/src/windows/FEX_Interface.cpp index 16af640e7..ea618d405 100644 --- a/desmume/src/windows/FEX_Interface.cpp +++ b/desmume/src/windows/FEX_Interface.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,9 +18,9 @@ //TODO - consider making this use UTF-8 everywhere instead of wstrings. sort of cleaner. but im tired of it now. it works presently. #include "FEX_Interface.h" - #include "File_Extractor/fex/fex.h" +#include #include #include #include diff --git a/desmume/src/windows/FEX_Interface.h b/desmume/src/windows/FEX_Interface.h index f03c215fa..4e0a3df91 100644 --- a/desmume/src/windows/FEX_Interface.h +++ b/desmume/src/windows/FEX_Interface.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #ifndef _FEX_DEC_HEADER #define _FEX_DEC_HEADER -#include "NDSSystem.h" +#include "../types.h" // File_Extractor interface // NOTE: if you want to add support for opening files within archives to some part of DeSmuME, diff --git a/desmume/src/windows/FirmConfig.cpp b/desmume/src/windows/FirmConfig.cpp index 1c0377977..8c00794dc 100644 --- a/desmume/src/windows/FirmConfig.cpp +++ b/desmume/src/windows/FirmConfig.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Normmatt - Copyright (C) 2007-2009 DeSmuME team + Copyright (C) 2007-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,22 +16,19 @@ along with the this software. If not, see . */ -#include -#include -#include "../common.h" -#include -#include -#include - -#include "CWindow.h" - -#include "resource.h" #include "FirmConfig.h" -#include "../debug.h" +#include +#include +#include + #include "../NDSSystem.h" #include "../firmware.h" +#include "resource.h" +#include "CWindow.h" +#include "winutil.h" + static char nickname_buffer[11]; static char message_buffer[27]; diff --git a/desmume/src/windows/IORegView.cpp b/desmume/src/windows/IORegView.cpp index 26a4ec531..22feecdeb 100644 --- a/desmume/src/windows/IORegView.cpp +++ b/desmume/src/windows/IORegView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2009 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,14 +16,18 @@ along with the this software. If not, see . */ -#include "CWindow.h" #include "IORegView.h" + #include -#include "debug.h" -#include "resource.h" + +#include "../debug.h" #include "../MMU.h" +#include "../registers.h" #include "../armcpu.h" +#include "resource.h" +#include "main.h" + //this message is only supported in vista so folks sdk might not have it. //therefore we shall declare it here #ifndef RB_SETBANDWIDTH diff --git a/desmume/src/windows/IORegView.h b/desmume/src/windows/IORegView.h index 02edaab68..8f28d69ac 100644 --- a/desmume/src/windows/IORegView.h +++ b/desmume/src/windows/IORegView.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2009 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ #ifndef IO_REG_H #define IO_REG_H -#include "../common.h" +#include #include "CWindow.h" LRESULT CALLBACK IORegView_Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/OpenArchive.cpp b/desmume/src/windows/OpenArchive.cpp index 1619bb089..b81865f02 100644 --- a/desmume/src/windows/OpenArchive.cpp +++ b/desmume/src/windows/OpenArchive.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,8 @@ along with the this software. If not, see . */ -#include "common.h" -#include "main.h" -#include "driver.h" +#include "OpenArchive.h" + #include #include #include @@ -26,11 +25,11 @@ #include #include #include -#include "FEX_Interface.h" -//#include "G_main.h" -//#include "G_dsound.h" + +#include "../driver.h" + #include "resource.h" -#include "OpenArchive.h" +#include "main.h" static char Str_Tmp[1024]; diff --git a/desmume/src/windows/aviout.cpp b/desmume/src/windows/aviout.cpp index 463ffb08c..a3cb251ea 100644 --- a/desmume/src/windows/aviout.cpp +++ b/desmume/src/windows/aviout.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2009 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,20 +15,21 @@ along with the this software. If not, see . */ -#include "main.h" -#include "types.h" -#include "windriver.h" -#include "console.h" -#include "gfx3d.h" #include "aviout.h" + +#include +#include +#include +#include + +#include "../debug.h" +#include "../console.h" +#include "../gfx3d.h" #include "../GPU_osd.h" #include "../SPU.h" -#include -#include -#include - -#include "debug.h" +#include "windriver.h" +#include "main.h" static void EMU_PrintError(const char* msg) { LOG(msg); diff --git a/desmume/src/windows/aviout.h b/desmume/src/windows/aviout.h index 69f6cd718..b34f43b4f 100644 --- a/desmume/src/windows/aviout.h +++ b/desmume/src/windows/aviout.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ #ifndef _AVIOUT_H_ #define _AVIOUT_H_ +#include "../types.h" + bool DRV_AviBegin(const char* fname); void DRV_AviEnd(); void DRV_AviSoundUpdate(void* soundData, int soundLen); diff --git a/desmume/src/windows/cheatsWin.cpp b/desmume/src/windows/cheatsWin.cpp index cc8c143ac..40a9dd424 100644 --- a/desmume/src/windows/cheatsWin.cpp +++ b/desmume/src/windows/cheatsWin.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,15 +16,20 @@ */ #include "cheatsWin.h" + #include + +#include "../common.h" #include "../cheatSystem.h" -#include "resource.h" #include "../debug.h" #include "../utils/xstring.h" #include "../path.h" #include "../NDSSystem.h" #include "../version.h" +#include "resource.h" +#include "main.h" + extern u8 CheatsR4Type = 0; static const char *HEX_Valid = "Oo0123456789ABCDEFabcdef"; diff --git a/desmume/src/windows/cheatsWin.h b/desmume/src/windows/cheatsWin.h index b63ef7cad..2902cc2a9 100644 --- a/desmume/src/windows/cheatsWin.h +++ b/desmume/src/windows/cheatsWin.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2011 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,10 +15,16 @@ along with the this software. If not, see . */ -#include "../common.h" +#ifndef _CHEATSWIN_H_ +#define _CHEATSWIN_H_ + +#include +#include "../types.h" extern void CheatsListDialog(HWND hwnd); extern void CheatsSearchDialog(HWND hwnd); extern void CheatsSearchReset(); extern void CheatAddVerify(HWND dialog,char* addre, char* valu,u8 size); extern void CheatsAddDialog(HWND parentHwnd, u32 address, u32 value, u8 size, const char* description=0); + +#endif diff --git a/desmume/src/windows/colorctrl.cpp b/desmume/src/windows/colorctrl.cpp index 6d52245fd..05ee7bb20 100644 --- a/desmume/src/windows/colorctrl.cpp +++ b/desmume/src/windows/colorctrl.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Acid Burn - Copyright (C) 2008-2010 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +16,8 @@ along with the this software. If not, see . */ -#include "../common.h" -#include #include "colorctrl.h" +#include static char szClassName[] = "DeSmuME_ColorCtrl"; diff --git a/desmume/src/windows/colorctrl.h b/desmume/src/windows/colorctrl.h index 5a7a9e9b8..e946ce3a0 100644 --- a/desmume/src/windows/colorctrl.h +++ b/desmume/src/windows/colorctrl.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 Acid Burn + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +19,8 @@ #ifndef COLORCTRL_H #define COLORCTRL_H +#include + typedef struct { HWND hWnd; diff --git a/desmume/src/windows/console.cpp b/desmume/src/windows/console.cpp index 62b33ee20..bad4c2928 100644 --- a/desmume/src/windows/console.cpp +++ b/desmume/src/windows/console.cpp @@ -1,5 +1,5 @@ /* - Copyright 2008-2013 DeSmuME team + Copyright 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,12 +15,14 @@ along with the this software. If not, see . */ -#include "../common.h" #include #include #include + #include "../version.h" + #include "main.h" +#include "winutil.h" ///////////////////////////////////////////////////////////////// Console #define BUFFER_SIZE 100 diff --git a/desmume/src/windows/disView.cpp b/desmume/src/windows/disView.cpp index c310b7f08..32b51d9cb 100644 --- a/desmume/src/windows/disView.cpp +++ b/desmume/src/windows/disView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,15 +16,18 @@ along with the this software. If not, see . */ +#include "disView.h" + #include +#include #include #include + #include "../MMU.h" #include "../Disassembler.h" #include "../NDSSystem.h" #include "../armcpu.h" -#include "disView.h" -#include + #include "resource.h" #include "main.h" diff --git a/desmume/src/windows/disView.h b/desmume/src/windows/disView.h index f7bd708d3..a248c50ce 100644 --- a/desmume/src/windows/disView.h +++ b/desmume/src/windows/disView.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2009 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ #ifndef DISVIEW_H #define DISVIEW_H -#include "../common.h" +#include extern BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK ViewDisasm_ARM7BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/fsnitroView.cpp b/desmume/src/windows/fsnitroView.cpp index adf06b929..959139818 100644 --- a/desmume/src/windows/fsnitroView.cpp +++ b/desmume/src/windows/fsnitroView.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,15 +15,18 @@ along with the this software. If not, see . */ -#include "resource.h" -#include "../common.h" -#include #include "fsnitroView.h" -#include "CWindow.h" -#include "../MMU.h" -#include "../NDSSystem.h" +#include + #include "../path.h" +#include "../common.h" +#include "../NDSSystem.h" +#include "../MMU.h" #include "../utils/fsnitro.h" + +#include "resource.h" +#include "CWindow.h" +#include "main.h" #include "memView.h" //not available on old SDK versions diff --git a/desmume/src/windows/fsnitroView.h b/desmume/src/windows/fsnitroView.h index 8a0f043eb..287e176ab 100644 --- a/desmume/src/windows/fsnitroView.h +++ b/desmume/src/windows/fsnitroView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 DeSmuME team + Copyright (C) 2013-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,8 @@ #ifndef _FSNITROVIEW_H_ #define _FSNITROVIEW_H_ -#include "../types.h" + +#include extern BOOL CALLBACK ViewFSNitroProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/gbaslot_config.cpp b/desmume/src/windows/gbaslot_config.cpp index 8f83c4144..2a40f980d 100644 --- a/desmume/src/windows/gbaslot_config.cpp +++ b/desmume/src/windows/gbaslot_config.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2011 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,14 +16,18 @@ */ #include "gbaslot_config.h" + #include -#include "resource.h" -#include "main.h" -#include "debug.h" +#include + +#include "../debug.h" #include "../slot2.h" #include "../NDSSystem.h" + +#include "resource.h" #include "inputdx.h" -#include +#include "main.h" +#include "winutil.h" WNDCLASSEX wc; HWND wndConfig = NULL; diff --git a/desmume/src/windows/gbaslot_config.h b/desmume/src/windows/gbaslot_config.h index 22a5129e8..0753cfa23 100644 --- a/desmume/src/windows/gbaslot_config.h +++ b/desmume/src/windows/gbaslot_config.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,8 +17,9 @@ #ifndef __GBASLOT_CONFIG_H_ #define __GBASLOT_CONFIG_H_ -#include "../common.h" + #include +#include extern std::string win32_CFlash_cfgDirectory, win32_CFlash_cfgFileName; extern UINT win32_CFlash_cfgMode; diff --git a/desmume/src/windows/ginfo.cpp b/desmume/src/windows/ginfo.cpp index d7ac04e6a..75f2add68 100644 --- a/desmume/src/windows/ginfo.cpp +++ b/desmume/src/windows/ginfo.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2010 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,15 +16,18 @@ along with the this software. If not, see . */ -#include "resource.h" -#include "common.h" +#include "ginfo.h" + +#include +#include + +#include "../common.h" #include "../MMU.h" #include "../NDSSystem.h" + +#include "resource.h" #include "FirmConfig.h" -#include -#include -#include -#include "ginfo.h" +#include "main.h" ////////////////////////////////////////////////////////////////////////////// diff --git a/desmume/src/windows/ginfo.h b/desmume/src/windows/ginfo.h index 39778daaa..e8d2c452b 100644 --- a/desmume/src/windows/ginfo.h +++ b/desmume/src/windows/ginfo.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ #ifndef GINFO_H #define GINFO_H +#include + BOOL GInfo_Init(); void GInfo_DeInit(); diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index fec21208e..b4ed85959 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -3,7 +3,7 @@ licensed under the terms supplied at the end of this file (for the terms are very long!) Differences from that baseline version are: - Copyright (C) 2009-2013 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,27 @@ */ #include "hotkey.h" -#include "main.h" -#include "CheatsWin.h" -#include "NDSSystem.h" -#include "saves.h" -#include "inputdx.h" -#include "render3d.h" -#include "throttle.h" + +#include "../NDSSystem.h" +#include "../saves.h" +#include "../render3D.h" +#include "../arm_jit.h" #include "../mic.h" #include "../movie.h" +#include "../SPU.h" +#include "../GPU.h" +#include "../GPU_osd.h" +#include "../path.h" + +#include "main.h" +#include "CheatsWin.h" +#include "inputdx.h" +#include "throttle.h" #include "ramwatch.h" //In order to call UpdateRamWatch (for loadstate functions) #include "ram_search.h" //In order to call UpdateRamSearch (for loadstate functions) #include "replay.h" #include "aviout.h" -#include "spu.h" -#include "../GPU.h" #include "pathsettings.h" -#include "GPU_osd.h" -#include "path.h" #include "video.h" #include "winutil.h" #include "windriver.h" diff --git a/desmume/src/windows/hotkey.h b/desmume/src/windows/hotkey.h index e99005bab..e41f6753b 100644 --- a/desmume/src/windows/hotkey.h +++ b/desmume/src/windows/hotkey.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2008-2012 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ #ifndef HOTKEY_H_INCLUDED #define HOTKEY_H_INCLUDED -#include #include #include #include diff --git a/desmume/src/windows/importSave.cpp b/desmume/src/windows/importSave.cpp index adafc9e22..a4b5f9c62 100644 --- a/desmume/src/windows/importSave.cpp +++ b/desmume/src/windows/importSave.cpp @@ -1,29 +1,30 @@ /* -Copyright 2006 Theo Berkau -Copyright (C) 2006-2013 DeSmuME team + Copyright 2006 Theo Berkau + Copyright (C) 2006-2015 DeSmuME team -This file 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. + This file 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. -This file 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. + This file 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 the this software. If not, see . + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ +#include "importSave.h" + #include "../types.h" -#include "../common.h" #include "../path.h" #include "../MMU.h" #include "../NDSSystem.h" +#include "../utils/advanscene.h" + #include "resource.h" -#include "importSave.h" -#include "utils/advanscene.h" char ImportSavFName[MAX_PATH] = {0}; u32 fileSaveSize = 0; diff --git a/desmume/src/windows/importSave.h b/desmume/src/windows/importSave.h index ece7ad457..c9fb40c2b 100644 --- a/desmume/src/windows/importSave.h +++ b/desmume/src/windows/importSave.h @@ -1,24 +1,26 @@ /* -Copyright 2006 Theo Berkau -Copyright (C) 2006-2012 DeSmuME team + Copyright 2006 Theo Berkau + Copyright (C) 2006-2015 DeSmuME team -This file 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. + This file 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. -This file 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. + This file 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 the this software. If not, see . + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #ifndef _IMPORT_SAVE_H_ #define _IMPORT_SAVE_H_ +#include + extern bool importSave(HWND hwnd, HINSTANCE hAppInst); #endif \ No newline at end of file diff --git a/desmume/src/windows/inputdx.cpp b/desmume/src/windows/inputdx.cpp index 1a9404e37..5ff2824d3 100644 --- a/desmume/src/windows/inputdx.cpp +++ b/desmume/src/windows/inputdx.cpp @@ -3,7 +3,7 @@ licensed under the terms supplied at the end of this file (for the terms are very long!) Differences from that baseline version are: - Copyright (C) 2009-2010 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,17 +21,15 @@ //TODO - rumble is broken. hopefully nobody will notice +#include "inputdx.h" + #ifdef __MINGW32__ #define _WIN32_IE 0x0501 #define _WIN32_WINNT 0x0501 #endif -#define STRICT -#include -#include #include #include - #include #if (((defined(_MSC_VER) && _MSC_VER >= 1300)) || defined(__MINGW32__)) @@ -43,19 +41,16 @@ #include #endif -#include "inputdx.h" -#include "hotkey.h" - -#include "main.h" -#include "resource.h" -#include "common.h" -#include "../slot2.h" -#include "../NDSSystem.h" - -#define DIRECTINPUT_VERSION 0x0800 -#include "../common.h" #include "../types.h" -#include "directx/dinput.h" +#include "../common.h" +#include "../NDSSystem.h" +#include "../slot2.h" +#include "../debug.h" + +#include "resource.h" +#include "hotkey.h" +#include "main.h" +#include "winutil.h" // Gamepad Dialog Strings // Support Unicode display @@ -2625,8 +2620,6 @@ void S9xWinScanJoypads () ////#endif //} -#include "directx/xinput.h" - void input_feedback(bool enable) { diff --git a/desmume/src/windows/inputdx.h b/desmume/src/windows/inputdx.h index de9effc3a..468444e7a 100644 --- a/desmume/src/windows/inputdx.h +++ b/desmume/src/windows/inputdx.h @@ -23,9 +23,10 @@ #ifndef INPUTDX_INCLUDED #define INPUTDX_INCLUDED -#include +#include #define DIRECTINPUT_VERSION 0x0800 #include "directx/dinput.h" +#include "directx/xinput.h" typedef struct { diff --git a/desmume/src/windows/lightView.cpp b/desmume/src/windows/lightView.cpp index 2d070b793..fb006d669 100644 --- a/desmume/src/windows/lightView.cpp +++ b/desmume/src/windows/lightView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Acid Burn - Copyright (C) 2008-2011 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,11 +17,14 @@ */ #include "lightView.h" -#include "commctrl.h" + +#include + +#include "../debug.h" +#include "../gfx3d.h" + #include "colorctrl.h" -#include "gfx3d.h" #include "resource.h" -#include "debug.h" #include "main.h" // Convert B5G5R5 color format into R8G8B8 color format diff --git a/desmume/src/windows/lightView.h b/desmume/src/windows/lightView.h index bbdb4916d..68d37e28c 100644 --- a/desmume/src/windows/lightView.h +++ b/desmume/src/windows/lightView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #ifndef LIGHTVIEW_H #define LIGHTVIEW_H -#include "../common.h" +#include extern BOOL CALLBACK ViewLightsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/luaconsole.cpp b/desmume/src/windows/luaconsole.cpp index 07eaa5bb8..ab878bb29 100644 --- a/desmume/src/windows/luaconsole.cpp +++ b/desmume/src/windows/luaconsole.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2098-2010 DeSmuME team + Copyright (C) 2098-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +15,6 @@ along with the this software. If not, see . */ -#include "resource.h" #include #include #include @@ -23,14 +22,15 @@ #include #include -#include "OpenArchive.h" +#include "../driver.h" +#include "../lua-engine.h" #ifdef WIN32 -#include "common.h" +#include +#include "resource.h" #include "main.h" -#include "driver.h" +#include "OpenArchive.h" #endif -#include "..\lua-engine.h" #define MAX_RECENT_SCRIPTS 15 char Recent_Scripts[MAX_RECENT_SCRIPTS][1024] = {0}; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index ec8038654..33fb73f71 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -19,6 +19,7 @@ // icon gradient: #f6f6fb to #8080c0 // RGB(246, 246, 251) to RGB(128, 128, 192) +#include "main.h" #include "windriver.h" #include @@ -42,17 +43,21 @@ #include "../MMU.h" #include "../armcpu.h" #include "../NDSSystem.h" +#include "../driver.h" #include "../debug.h" #include "../saves.h" #include "../slot1.h" #include "../slot2.h" +#include "../GPU.h" #include "../GPU_osd.h" +#include "../SPU.h" #include "../OGLRender.h" #include "../OGLRender_3_2.h" #include "../rasterize.h" #include "../gfx3d.h" #include "../render3D.h" #include "../gdbstub.h" +#include "../wifi.h" #include "../cheatSystem.h" #include "../mic.h" #include "../movie.h" @@ -63,7 +68,6 @@ //other random stuff #include "recentroms.h" -#include "main.h" #include "resource.h" #include "CWindow.h" #include "gthread.h" @@ -2639,11 +2643,7 @@ static void ExitRunLoop() emu_halt(); } -//----------------------------------------------------------------------------- -// Platform driver for Win32 -//----------------------------------------------------------------------------- - -class WinDriver : public BaseDriver +class WinWifiHandler : public WifiHandler { #ifdef EXPERIMENTAL_WIFI_COMM virtual bool WIFI_SocketsAvailable() { return bSocketsAvailable; } @@ -2680,55 +2680,69 @@ class WinDriver : public BaseDriver virtual bool WIFI_WFCWarning() { - return MessageBox(NULL, "You are trying to connect to the Nintendo WFC servers.\n" - "\n" - "Please don't do this." - "\n" - "DeSmuME is not perfect yet, and connecting to WFC will cause unexpected problems\n" - "for Nintendo, and for DeSmuME, which neither of us want.\n" - "\n" - "And you don't want that either, right?\n" - "\n" - "You may get your IP blocked and then you won't even be able to use your real DS.\n" - "You may cause DeSmuME to get blocked, which would be a shame since we wouldn't even\n" - "be able to work on it any more.\n" - "\n" - "By the time you read this, it may have already happened due to irresponsible individuals\n" - "ignoring this message.\n" - "\n" - "So please don't do it.\n" - "\n" - "We aren't going to try to stop you, since someone will just make a hacked build and you\n" - "won't get a chance to read this. So please, stop yourself.\n" - "\n" - "Do you still want to connect?", - "DeSmuME - WFC warning", - MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING - ) == IDYES; + return MessageBox(NULL, "You are trying to connect to the Nintendo WFC servers.\n" + "\n" + "Please don't do this." + "\n" + "DeSmuME is not perfect yet, and connecting to WFC will cause unexpected problems\n" + "for Nintendo, and for DeSmuME, which neither of us want.\n" + "\n" + "And you don't want that either, right?\n" + "\n" + "You may get your IP blocked and then you won't even be able to use your real DS.\n" + "You may cause DeSmuME to get blocked, which would be a shame since we wouldn't even\n" + "be able to work on it any more.\n" + "\n" + "By the time you read this, it may have already happened due to irresponsible individuals\n" + "ignoring this message.\n" + "\n" + "So please don't do it.\n" + "\n" + "We aren't going to try to stop you, since someone will just make a hacked build and you\n" + "won't get a chance to read this. So please, stop yourself.\n" + "\n" + "Do you still want to connect?", + "DeSmuME - WFC warning", + MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING + ) == IDYES; } virtual int PCAP_findalldevs(pcap_if_t** alldevs, char* errbuf) { - return _pcap_findalldevs(alldevs, errbuf); } + return _pcap_findalldevs(alldevs, errbuf); + } virtual void PCAP_freealldevs(pcap_if_t* alldevs) { - _pcap_freealldevs(alldevs); } + _pcap_freealldevs(alldevs); + } virtual pcap_t* PCAP_open(const char* source, int snaplen, int flags, int readtimeout, char* errbuf) { - return _pcap_open_live(source, snaplen, flags, readtimeout, errbuf); } + return _pcap_open_live(source, snaplen, flags, readtimeout, errbuf); + } virtual void PCAP_close(pcap_t* dev) { - _pcap_close(dev); } + _pcap_close(dev); + } virtual int PCAP_setnonblock(pcap_t* dev, int nonblock, char* errbuf) { - return _pcap_setnonblock(dev, nonblock, errbuf); } + return _pcap_setnonblock(dev, nonblock, errbuf); + } virtual int PCAP_sendpacket(pcap_t* dev, const u_char* data, int len) { - return _pcap_sendpacket(dev, data, len); } + return _pcap_sendpacket(dev, data, len); + } virtual int PCAP_dispatch(pcap_t* dev, int num, pcap_handler callback, u_char* userdata) { - return _pcap_dispatch(dev, num, callback, userdata); } + return _pcap_dispatch(dev, num, callback, userdata); + } #endif +}; +//----------------------------------------------------------------------------- +// Platform driver for Win32 +//----------------------------------------------------------------------------- + +class WinDriver : public BaseDriver +{ virtual bool AVI_IsRecording() { return ::AVI_IsRecording(); @@ -2909,6 +2923,7 @@ int _main() #endif driver = new WinDriver(); + CurrentWifiHandler = new WinWifiHandler(); InitializeCriticalSection(&win_execute_sync); InitializeCriticalSection(&win_backbuffer_sync); @@ -6756,7 +6771,7 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM if (bWinPCapAvailable) { - if(driver->PCAP_findalldevs(&alldevs, errbuf) == -1) + if(CurrentWifiHandler->PCAP_findalldevs(&alldevs, errbuf) == -1) { // TODO: fail more gracefully! EndDialog(hDlg, TRUE); diff --git a/desmume/src/windows/main.h b/desmume/src/windows/main.h index 4224389ba..833798511 100644 --- a/desmume/src/windows/main.h +++ b/desmume/src/windows/main.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 Theo Berkau - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,13 +19,18 @@ #ifndef _MAIN_H_ #define _MAIN_H_ +#define WIN32_LEAN_AND_MEAN +#include +#include "../types.h" #include "CWindow.h" + extern WINCLASS *MainWindow; extern HINSTANCE hAppInst; extern HMENU mainMenu; //Holds handle to the main DeSmuME menu extern CToolBar* MainWindowToolbar; extern volatile bool execute, paused; +extern bool romloaded; bool NDS_Pause(bool showMsg = true); void NDS_UnPause(bool showMsg = true); void LoadSaveStateInfo(); diff --git a/desmume/src/windows/mapView.cpp b/desmume/src/windows/mapView.cpp index 831f80b34..b51b2ece0 100644 --- a/desmume/src/windows/mapView.cpp +++ b/desmume/src/windows/mapView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,12 +17,15 @@ */ #include "mapView.h" -#include "resource.h" #include + +#include "../GPU.h" #include "../MMU.h" #include "../NDSSystem.h" -#include "debug.h" +#include "../debug.h" + +#include "resource.h" #include "main.h" #include "windriver.h" diff --git a/desmume/src/windows/mapView.h b/desmume/src/windows/mapView.h index 26d3ca66e..6a6a51668 100644 --- a/desmume/src/windows/mapView.h +++ b/desmume/src/windows/mapView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #ifndef MAPVIEW_H #define MAPVIEW_H -#include "../common.h" +#include extern BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/matrixView.cpp b/desmume/src/windows/matrixView.cpp index 5cfe2aa41..303a02543 100644 --- a/desmume/src/windows/matrixView.cpp +++ b/desmume/src/windows/matrixView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2007 Acid Burn - Copyright (C) 2007-2011 DeSmuME team + Copyright (C) 2007-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,11 +17,14 @@ */ #include "matrixView.h" + #include -#include "debug.h" + +#include "../debug.h" +#include "../gfx3d.h" + #include "resource.h" #include "main.h" -#include "gfx3d.h" typedef struct { diff --git a/desmume/src/windows/matrixView.h b/desmume/src/windows/matrixView.h index eb03c2469..5992e4754 100644 --- a/desmume/src/windows/matrixView.h +++ b/desmume/src/windows/matrixView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ #ifndef MATRIXVIEW_H #define MATRIXVIEW_H -#include "../common.h" +#include extern BOOL CALLBACK ViewMatricesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/memView.cpp b/desmume/src/windows/memView.cpp index f32e1ff7e..c9b870def 100644 --- a/desmume/src/windows/memView.cpp +++ b/desmume/src/windows/memView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,17 +16,19 @@ along with the this software. If not, see . */ -#include "CWindow.h" -#include "../MMU.h" -#include "../NDSSystem.h" -#include "debug.h" -#include "resource.h" -#include "common.h" +#include "memView.h" + #include -#include #include #include -#include "memView.h" + +#include "../common.h" +#include "../NDSSystem.h" +#include "../emufile.h" +#include "../MMU.h" +#include "../debug.h" + +#include "resource.h" #include "winutil.h" using namespace std; diff --git a/desmume/src/windows/memView.h b/desmume/src/windows/memView.h index 99e5fc3a4..301bd2bf0 100644 --- a/desmume/src/windows/memView.h +++ b/desmume/src/windows/memView.h @@ -1,27 +1,28 @@ -/* Copyright (C) 2006 yopyop - yopyop156@ifrance.com - yopyop156.ifrance.com +/* + Copyright (C) 2006 yopyop + Copyright (C) 2008-2015 DeSmuME team - This file is part of DeSmuME + This file 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 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. + This file 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. - 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 + You should have received a copy of the GNU General Public License + along with the this software. If not, see . */ #ifndef MEM_VIEW_H #define MEM_VIEW_H +#include +#include "CWindow.h" +#include "../types.h" + enum MemRegionType { MEMVIEW_ARM9 = 0, MEMVIEW_ARM7, diff --git a/desmume/src/windows/mic.cpp b/desmume/src/windows/mic.cpp index a7e3c84a4..c50f3d550 100644 --- a/desmume/src/windows/mic.cpp +++ b/desmume/src/windows/mic.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,15 +24,20 @@ documented on GBATek. */ -#include "NDSSystem.h" -#include "../types.h" -#include "../debug.h" #include "../mic.h" -#include "../movie.h" -#include "readwrite.h" + +#include +#include #include #include +#include "../types.h" +#include "../NDSSystem.h" +#include "../emufile.h" +#include "../debug.h" +#include "../movie.h" +#include "../readwrite.h" + int MicDisplay; int SampleLoaded=0; diff --git a/desmume/src/windows/oamView.cpp b/desmume/src/windows/oamView.cpp index 7661e9006..f63edcf9d 100644 --- a/desmume/src/windows/oamView.cpp +++ b/desmume/src/windows/oamView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2012 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,14 +17,17 @@ */ #include "oamView.h" + #include -#include "main.h" -#include "debug.h" -#include "resource.h" + +#include "../debug.h" #include "../MMU.h" #include "../GPU.h" #include "../NDSSystem.h" + +#include "resource.h" #include "windriver.h" +#include "main.h" typedef struct { diff --git a/desmume/src/windows/oamView.h b/desmume/src/windows/oamView.h index bdc91e977..13973552f 100644 --- a/desmume/src/windows/oamView.h +++ b/desmume/src/windows/oamView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #ifndef OAMVIEW_H #define OAMVIEW_H -#include "../common.h" +#include extern LRESULT CALLBACK ViewOAMBoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/palView.cpp b/desmume/src/windows/palView.cpp index 0cf52e440..b484f97fd 100644 --- a/desmume/src/windows/palView.cpp +++ b/desmume/src/windows/palView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2013 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,13 +17,17 @@ */ #include "palView.h" + #include -#include "main.h" -#include "debug.h" -#include "resource.h" + +#include "../types.h" +#include "../debug.h" #include "../MMU.h" #include "../gfx3d.h" +#include "resource.h" +#include "main.h" + typedef struct { u32 autoup_secs; diff --git a/desmume/src/windows/palView.h b/desmume/src/windows/palView.h index 48d18828d..a87687653 100644 --- a/desmume/src/windows/palView.h +++ b/desmume/src/windows/palView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,8 +18,7 @@ #ifndef PALVIEW_H #define PALVIEW_H -#include "../common.h" -#include +#include extern BOOL CALLBACK ViewPalProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/pathsettings.h b/desmume/src/windows/pathsettings.h index 6b8c8edcc..818064e40 100644 --- a/desmume/src/windows/pathsettings.h +++ b/desmume/src/windows/pathsettings.h @@ -1,6 +1,6 @@ /* Copyright (C) 2009 Hicoder - Copyright (C) 2009 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,8 @@ #ifndef _PATHSETTINGS_H_ #define _PATHSETTINGS_H_ +#include + void WritePathSettings(); void ReadPathSettings(); diff --git a/desmume/src/windows/ram_search.cpp b/desmume/src/windows/ram_search.cpp index d9f682bdc..80f37541d 100644 --- a/desmume/src/windows/ram_search.cpp +++ b/desmume/src/windows/ram_search.cpp @@ -2,7 +2,7 @@ //Authors: Nitsuja, Upthorn, adelikat /* - Modifications Copyright (C) 2009-2011 DeSmuME team + Modifications Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,20 +47,22 @@ // during these sporadic "setup" steps to achieve an all-around faster per-update speed. // (You can test this case by performing the search: Modulo 2 Is Specific Address 0) -#include "resource.h" - -#include "common.h" -#include "main.h" -#include "NDSSystem.h" +#include "ram_search.h" #include "ramwatch.h" -#include "ram_search.h" #include #include -#include "ramwatch.h" -#include "cheatsWin.h" #include #include + +#include "../common.h" +#include "../NDSSystem.h" +#include "../MMU.h" + +#include "resource.h" +#include "main.h" +#include "cheatsWin.h" + #ifdef _WIN32 #include "BaseTsd.h" typedef INT_PTR intptr_t; diff --git a/desmume/src/windows/ram_search.h b/desmume/src/windows/ram_search.h index 50b7d1861..bdb106e56 100644 --- a/desmume/src/windows/ram_search.h +++ b/desmume/src/windows/ram_search.h @@ -2,7 +2,7 @@ //Authors: Nitsuja, Upthorn, adelikat /* - Modifications Copyright (C) 2009-2011 DeSmuME team + Modifications Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #ifndef RAM_SEARCH_H #define RAM_SEARCH_H +#include //64k in Ram_68k[], 8k in Ram_Z80[] //#define _68K_RAM_SIZE 64*1024 diff --git a/desmume/src/windows/ramwatch.cpp b/desmume/src/windows/ramwatch.cpp index 827b1bd46..427fa35c8 100644 --- a/desmume/src/windows/ramwatch.cpp +++ b/desmume/src/windows/ramwatch.cpp @@ -2,7 +2,7 @@ //Authors: adelikat, Upthorn, Nitsuja /* - Modifications Copyright (C) 2009-2010 DeSmuME team + Modifications Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,18 +18,22 @@ along with the this software. If not, see . */ -#include "main.h" -#include "resource.h" -#include "common.h" -#include "NDSSystem.h" #include "ramwatch.h" #include "ram_search.h" -#include "cheatsWin.h" + #include #include #include #include -#include "path.h" + +#include "../common.h" +#include "../NDSSystem.h" +#include "../path.h" +#include "../MMU.h" + +#include "resource.h" +#include "main.h" +#include "cheatsWin.h" HWND RamWatchHWnd = NULL; diff --git a/desmume/src/windows/recentroms.cpp b/desmume/src/windows/recentroms.cpp index ba059ffa3..a90968b8a 100644 --- a/desmume/src/windows/recentroms.cpp +++ b/desmume/src/windows/recentroms.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,17 +15,17 @@ along with the this software. If not, see . */ +#include "recentroms.h" #include #include +#include + +#include "../common.h" -#include "recentroms.h" -#include "common.h" #include "resource.h" -#include "main.h" #include "winutil.h" -#include std::vector RecentRoms; //The list of recent ROM filenames HMENU recentromsmenu; //Handle to the recent ROMs submenu diff --git a/desmume/src/windows/recentroms.h b/desmume/src/windows/recentroms.h index 3bb8bd164..6a91f004d 100644 --- a/desmume/src/windows/recentroms.h +++ b/desmume/src/windows/recentroms.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2009 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ #include #include +#include #include "main.h" diff --git a/desmume/src/windows/replay.cpp b/desmume/src/windows/replay.cpp index d107faf9a..aca507e40 100644 --- a/desmume/src/windows/replay.cpp +++ b/desmume/src/windows/replay.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2010 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,21 +15,22 @@ along with the this software. If not, see . */ -#include "types.h" -#include +#include "replay.h" + #include #include #include #include #include -#include "resource.h" -#include "replay.h" -#include "common.h" -#include "main.h" -#include "movie.h" -#include "rtc.h" + +#include "../types.h" +#include "../movie.h" #include "utils/xstring.h" +#include "resource.h" +#include "main.h" +#include "rtc.h" + bool replayreadonly=1; //adelikat: TODO: put this in one of the header files diff --git a/desmume/src/windows/replay.h b/desmume/src/windows/replay.h index d721b31b5..63466b876 100644 --- a/desmume/src/windows/replay.h +++ b/desmume/src/windows/replay.h @@ -1,2 +1,24 @@ +/* + Copyright (C) 2008-2015 DeSmuME team + + This file 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. + + This file 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 the this software. If not, see . +*/ + +#ifndef _WIN_REPLAY_H_ +#define _WIN_REPLAY_H_ + void Replay_LoadMovie(); void MovieRecordTo(); + +#endif diff --git a/desmume/src/windows/slot1_config.cpp b/desmume/src/windows/slot1_config.cpp index 0cdb4f2e7..cd87ed32e 100644 --- a/desmume/src/windows/slot1_config.cpp +++ b/desmume/src/windows/slot1_config.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2011-2013 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,16 +16,19 @@ */ #include "slot1_config.h" + #include #include #include -#include "resource.h" -#include "main.h" -#include "debug.h" + #include "../slot1.h" +#include "../debug.h" #include "../NDSSystem.h" #include "../path.h" +#include "resource.h" +#include "main.h" + HWND wndConfigSlot1 = NULL; NDS_SLOT1_TYPE temp_type_slot1 = NDS_SLOT1_NONE; NDS_SLOT1_TYPE last_type_slot1 = NDS_SLOT1_NONE; diff --git a/desmume/src/windows/slot1_config.h b/desmume/src/windows/slot1_config.h index b9d341ae3..65b124367 100644 --- a/desmume/src/windows/slot1_config.h +++ b/desmume/src/windows/slot1_config.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2011 DeSmuME team + Copyright (C) 2011-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,8 +17,8 @@ #ifndef __SLOT1_CONFIG_H_ #define __SLOT1_CONFIG_H_ -#include "../common.h" -#include + +#include extern void slot1Dialog(HWND hwnd); diff --git a/desmume/src/windows/snddx.cpp b/desmume/src/windows/snddx.cpp index 09d2a20df..2e6fcae43 100755 --- a/desmume/src/windows/snddx.cpp +++ b/desmume/src/windows/snddx.cpp @@ -1,6 +1,6 @@ /* snddx.cpp Copyright (C) 2005-2007 Theo Berkau - Copyright (C) 2006-2010 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +16,12 @@ along with the this software. If not, see . */ -#include +#include "snddx.h" + #include +#include #include "directx/dsound.h" + #ifdef __MINGW32__ // I have to do this because for some reason because the dxerr8.h header is fubared const char* __stdcall DXGetErrorString8A(HRESULT hr); @@ -28,8 +31,8 @@ const char* __stdcall DXGetErrorDescription8A(HRESULT hr); #else #include "directx/dxerr8.h" #endif -#include "SPU.h" -#include "snddx.h" + +#include "../SPU.h" #include "CWindow.h" #include "windriver.h" diff --git a/desmume/src/windows/snddx.h b/desmume/src/windows/snddx.h index d4aed193a..898f6f653 100755 --- a/desmume/src/windows/snddx.h +++ b/desmume/src/windows/snddx.h @@ -1,5 +1,6 @@ /* Copyright (C) 2006 Theo Berkau + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +18,10 @@ #ifndef SNDDX_H #define SNDDX_H + +#include "../SPU.h" #define SNDCORE_DIRECTX 2 extern SoundInterface_struct SNDDIRECTX; + #endif diff --git a/desmume/src/windows/sndxa2.cpp b/desmume/src/windows/sndxa2.cpp index 8365f2d49..4f3cbd63d 100644 --- a/desmume/src/windows/sndxa2.cpp +++ b/desmume/src/windows/sndxa2.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2013 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,11 +15,11 @@ along with the this software. If not, see . */ -#include +#include "sndxa2.h" #include "directx/XAudio2.h" #include -#include "types.h" -#include "sndxa2.h" + +#include "../types.h" #include "windriver.h" int SNDXA2Init(int buffersize); diff --git a/desmume/src/windows/sndxa2.h b/desmume/src/windows/sndxa2.h index a526792a1..6adbfa076 100644 --- a/desmume/src/windows/sndxa2.h +++ b/desmume/src/windows/sndxa2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2010 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,8 +17,10 @@ #ifndef SNDXA2_H #define SNDXA2_H -#include "SPU.h" + +#include "../SPU.h" #define SNDCORE_XAUDIO2 3 extern SoundInterface_struct SNDXAUDIO2; + #endif diff --git a/desmume/src/windows/soundView.cpp b/desmume/src/windows/soundView.cpp index 3155f9fad..7e4da6539 100644 --- a/desmume/src/windows/soundView.cpp +++ b/desmume/src/windows/soundView.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2010 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,21 +15,24 @@ along with the this software. If not, see . */ - -#include "../SPU.h" -#include "../debug.h" -#include "../common.h" -#include "../matrix.h" -#include "resource.h" -#include "NDSSystem.h" -#include -#include -#include -#include #include "soundView.h" -#include "winutil.h" #include +#include +#include +#include +#include + +#include "../common.h" +#include "../NDSSystem.h" +#include "../debug.h" +#include "../matrix.h" +#include "../MMU.h" +#include "../SPU.h" + +#include "resource.h" +#include "winutil.h" +#include "main.h" using namespace std; diff --git a/desmume/src/windows/soundView.h b/desmume/src/windows/soundView.h index c7dfcedab..e1b41bb13 100644 --- a/desmume/src/windows/soundView.h +++ b/desmume/src/windows/soundView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2010 DeSmuME team + Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ #ifndef SOUND_VIEW_H #define SOUND_VIEW_H +#include + BOOL SoundView_Init(); void SoundView_DeInit(); diff --git a/desmume/src/windows/throttle.cpp b/desmume/src/windows/throttle.cpp index 262c1b894..8b2943160 100644 --- a/desmume/src/windows/throttle.cpp +++ b/desmume/src/windows/throttle.cpp @@ -3,7 +3,7 @@ //(the code might look quite different by now, though...) /* - Many Modifications Copyright (C) 2009-2010 DeSmuME team + Many Modifications Copyright (C) 2009-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,12 +19,16 @@ along with the this software. If not, see . */ -#include "../common.h" +#include "throttle.h" + +#include + #include "../types.h" #include "../debug.h" #include "../console.h" -#include "throttle.h" -#include "GPU_osd.h" +#include "../GPU_osd.h" + +#include "winutil.h" int FastForward=0; static u64 tmethod,tfreq,afsfreq; diff --git a/desmume/src/windows/tileView.cpp b/desmume/src/windows/tileView.cpp index 31bbe151e..b1c72b0de 100644 --- a/desmume/src/windows/tileView.cpp +++ b/desmume/src/windows/tileView.cpp @@ -1,6 +1,6 @@ /* Copyright (C) 2006 yopyop - Copyright (C) 2006-2011 DeSmuME team + Copyright (C) 2006-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,12 +17,14 @@ */ #include "tileView.h" + +#include "../MMU.h" +#include "../GPU.h" + #include "commctrl.h" #include "resource.h" #include "debug.h" #include "main.h" -#include "../MMU.h" -#include "../gpu.h" class tileview_struct { diff --git a/desmume/src/windows/tileView.h b/desmume/src/windows/tileView.h index dfb3e2e48..998d25217 100644 --- a/desmume/src/windows/tileView.h +++ b/desmume/src/windows/tileView.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,8 +18,7 @@ #ifndef TILEVIEW_H #define TILEVIEW_H -#include "../common.h" -#include +#include extern LRESULT CALLBACK TileViewBoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK MiniTileViewBoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/desmume/src/windows/winutil.h b/desmume/src/windows/winutil.h index 381a5619c..44d0961e9 100644 --- a/desmume/src/windows/winutil.h +++ b/desmume/src/windows/winutil.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2008-2010 DeSmuME team + Copyright (C) 2008-2015 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,6 @@ #include #include - #include extern char IniName[MAX_PATH]; @@ -35,6 +34,10 @@ HMENU GetSubMenuByIdOfFirstChild(HMENU menu, UINT child); HMENU GetSubMenuById(HMENU menu, UINT id); //untested int GetSubMenuIndexByHMENU(HMENU menu, HMENU sub); +void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file); +bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename); +void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file); + //returns the specified resource string ID as a std::wstring std::wstring STRW(UINT id);