- Do a massive cleanup of the #include and header structure.
- Remove a lot of unnecessary dependencies in the headers.
- Make headers responsible for including what they need for themselves. This makes the headers more independent of where they are in the #include order.
- Relocate some structs/classes to more logical locations.
- Clean up some platform-specific #ifdef stuff.
This commit is contained in:
rogerman 2015-01-10 02:04:18 +00:00
parent d5ab656090
commit 8fefb4fb7a
170 changed files with 1275 additions and 943 deletions

View File

@ -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 <string.h>
#include "armcpu.h"
#include "debug.h"
#include "mem.h"
#include "MMU.h"
#include "registers.h"
#include "NDSSystem.h"
#include "gfx3d.h"

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <iostream>
#include "MMU.h"
#include "GPU.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#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<bool MOSAIC> 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;

View File

@ -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 <stdio.h>
#include "mem.h"
#include "common.h"
#include "registers.h"
#include "FIFO.h"
#include "MMU.h"
#include <iosfwd>
#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;

View File

@ -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 <string.h> //mem funcs

View File

@ -23,13 +23,16 @@
#include <assert.h>
#include <sstream>
#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<int PROCNUM>
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;

View File

@ -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);

View File

@ -16,34 +16,44 @@
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "NDSSystem.h"
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <zlib.h>
#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);

View File

@ -20,23 +20,13 @@
#define NDSSYSTEM_H
#include <string.h>
#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 <string>
#if defined(HOST_WINDOWS) && !defined(DESMUME_QT)
#include "pathsettings.h"
#endif
#include "types.h"
class BaseDriver;
class CFIRMWARE;
class EMUFILE;
template<typename Type>
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<bool FORCE> 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;

View File

@ -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 <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -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 <vector>
#include "debug.h"
#include "driver.h"
#include "MMU.h"
#include "SPU.h"
#include "mem.h"

View File

@ -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 <iosfwd>
#include <string>
#include <assert.h>
#include <stdio.h>
#include "types.h"
#include "matrix.h"
#include "emufile.h"
#include "metaspu/metaspu.h"
class EMUFILE;
#define SNDCORE_DEFAULT -1
#define SNDCORE_DUMMY 0

View File

@ -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
{

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "slot1comp_protocol.h"
#include <time.h>
#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
{

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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 <stdio.h>
#include <string>
#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

View File

@ -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

View File

@ -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;

View File

@ -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;
extern Slot1Comp_MC g_Slot1Comp_MC;
#endif

View File

@ -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 <string.h>
#include "../armcpu.h"
#include "../encrypt.h"
#include "../emufile.h"
#include "../utils/decrypt/decrypt.h"
static _KEY1 key1((const u8*)arm7_key);

View File

@ -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
{

View File

@ -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)

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "../slot2.h"
#include "../registers.h"
#include "../MMU.h"
#include <stdio.h>
#include "../slot2.h"
class Slot2_Auto : public ISlot2Interface
{

View File

@ -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__)

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "../slot2.h"
#include <string.h>
#include "../mem.h"
#include "../MMU.h"
#include "../debug.h"
#include "../NDSSystem.h"
#include "../path.h"
#include "../slot2.h"
#include "../emufile.h"
#define EEPROM 0x52504545

View File

@ -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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#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

View File

@ -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 <string.h>
#include "../NDSSystem.h"
#include "../slot2.h"
#include "../NDSSystem.h"
class Slot2_Paddle : public ISlot2Interface
{

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "../NDSSystem.h"
#include "../types.h"
#include "../slot2.h"
#include "../NDSSystem.h"
class Slot2_PassME : public ISlot2Interface
{

View File

@ -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"

View File

@ -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"

View File

@ -20,7 +20,9 @@
#include <stdio.h>
#include <assert.h>
#include <algorithm>
#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,

View File

@ -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<int PROCNUM> u32 armcpu_exec();
template<int PROCNUM, bool jit> 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<<num);
}
static INLINE 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);
}
#endif

View File

@ -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 <math.h>
#include "MMU.h"
#include "debug.h"
#include "registers.h"
#include "NDSSystem.h"
#define cpu (&ARMPROC)

View File

@ -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];

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include "cheatSystem.h"
#include "bits.h"
#include "NDSSystem.h"
#include "common.h"
#include "mem.h"
#include "MMU.h"
#include "debug.h"

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include <string>
#include <vector>
#include "types.h"
#define CHEAT_VERSION_MAJOR 2
#define CHEAT_VERSION_MINOR 0

View File

@ -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
/*

View File

@ -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 <Cocoa/Cocoa.h>
#include "../cheatSystem.h"
#undef BOOL
class CHEATS;
class CHEATS_LIST;
class CHEATSEARCH;
/********************************************************************************************
CocoaDSCheatItem - OBJECTIVE-C CLASS

View File

@ -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

View File

@ -30,6 +30,7 @@
#include "../movie.h"
#include "../NDSSystem.h"
#include "../armcpu.h"
#include "../driver.h"
#include "../gdbstub.h"
#include "../slot1.h"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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;

View File

@ -27,6 +27,7 @@
#include <OpenGL/gl.h>
#include "../../NDSSystem.h"
#include "../../GPU.h"
#undef BOOL

View File

@ -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 <string.h>
#include <string>
#include <stdarg.h>
#include "common.h"
#include <zlib.h>
#include <stdlib.h>

View File

@ -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 <stdio.h>
#include <string.h>
#include "types.h"
#include <string>
#include "types.h"
#if defined(WIN32)
#include <winsock2.h>
#include <windows.h>
#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<typename T>

View File

@ -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 <stdlib.h>
#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)
{

View File

@ -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 <string.h>
#include "types.h"
class EMUFILE;
#define CP15_ACCESS_WRITE 0
#define CP15_ACCESS_READ 2

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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);
}

View File

@ -18,13 +18,8 @@
#ifndef _DRIVER_H_
#define _DRIVER_H_
#include "types.h"
#include "debug.h"
#include <stdio.h>
#ifdef EXPERIMENTAL_WIFI_COMM
#include <pcap.h>
#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_

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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.

View File

@ -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 <stdlib.h>
#include <string>
#include <vector>
#include "types.h"
#include "filter.h"
#include "../utils/task.h"
#ifdef HOST_WINDOWS
typedef unsigned __int32 uint32_t;
#include <winsock2.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef CRITICAL_SECTION ThreadLock;
typedef HANDLE ThreadCond;

View File

@ -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;

View File

@ -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 <string>
#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

View File

@ -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

View File

@ -22,34 +22,18 @@
THE SOFTWARE.
*/
#include "gdbstub_internal.h"
#include <errno.h>
//#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include "types.h"
#include "NDSSystem.h"
#ifdef WIN32
#include <winsock2.h>
#else
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#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
};

View File

@ -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 <winsock2.h>
#define SOCKET_TYPE SOCKET
#else
#define SOCKET_TYPE int
#include <stdint.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#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;

View File

@ -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 <algorithm>
#include "gfx3d.h"
#include <assert.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <queue>
#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 <queue>
//#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();

View File

@ -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 <iosfwd>
#include <ostream>
#include <istream>
#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

View File

@ -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)();

View File

@ -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[] =

View File

@ -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;

View File

@ -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()

View File

@ -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 <string.h>
#include "../dTool.h"
#include "../MMU.h"
#include "../../MMU.h"
#include "../../registers.h"
#undef GPOINTER_TO_INT
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))

View File

@ -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];

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "types.h"
#include "lua-engine.h"
#include "movie.h"
#if defined(WIN32)
#include <windows.h>
#include <direct.h>
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 <unistd.h>
#endif
#include <assert.h>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#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 <windows.h>
#include "main.h"
#include "video.h"
#include "resource.h"
#endif
#ifdef WIN32
#include <direct.h>
#else
#include <unistd.h>
#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");

View File

@ -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 <winsock2.h>
#include <windows.h>
#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();

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "mc.h"
#include <stdlib.h>
#include <string.h>
#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)

View File

@ -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 <stdio.h>
#include <vector>
#include <string>
#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);

View File

@ -16,9 +16,10 @@
*/
//#include "Global.h"
#include "types.h"
#include "SndOut.h"
#include <assert.h>
#include <stdio.h>
//----------------
int SndOutLatencyMS = 160;

View File

@ -19,6 +19,8 @@
#include <algorithm>
#include "types.h"
struct StereoOut16;
struct StereoOut32;
struct StereoOutFloat;

View File

@ -17,6 +17,7 @@
//#include "Global.h"
#include <math.h>
#include <stdio.h>
#include "types.h"
#include "SndOut.h"
//#include "SoundTouch/WavFile.h"

View File

@ -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 <queue>
#include <vector>
#include <assert.h>

View File

@ -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 <algorithm>
#include "types.h"
template< typename T >
static FORCEINLINE void Clampify( T& src, T min, T max )
{

View File

@ -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 <iostream>
#include "emufile.h"
#include "types.h"
class EMUFILE;
#ifdef WIN32
static char MicSampleName[256];
bool LoadSample(const char *name);

View File

@ -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 <assert.h>
#include <limits.h>
#include <ctype.h>
#include <time.h>
#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"

View File

@ -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 <string>
#include <stdlib.h>
#include <time.h>
#include "emufile.h"
#include "utils/datetime.h"
#include "utils/guid.h"
#include "utils/md5.h"
struct UserInput;
class EMUFILE;
typedef struct
{

View File

@ -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 <string>
#ifdef HOST_WINDOWS
#define mkdir _mkdir
#endif
#include "types.h"
#if defined(HOST_WINDOWS)
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#include "common.h"
#ifndef DESMUME_QT
#include "winutil.h"
#include "resource.h"
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <direct.h>
#define mkdir _mkdir
#ifndef DESMUME_QT
#include "windows/winutil.h"
#include "windows/resource.h"
#endif
#elif !defined(DESMUME_COCOA)
#include <glib.h>
#include <glib.h>
#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

View File

@ -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"

View File

@ -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)

View File

@ -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 <iostream>
#include <cstdio>
#include <vector>
#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); }

View File

@ -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 <string.h>
#include "gfx3d.h"
#include "MMU.h"
#include "texcache.h"

View File

@ -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 <sys/stat.h>
#include <time.h>
#include <fstream>
#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"

View File

@ -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 <string>
#include "common.h"
#include "types.h"
#include "debug.h"
#include "MMU.h"
class EMUFILE;

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -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 <string>
#include "types.h"
#include "debug.h"
#define GBA_SRAM_FILE_EXT "sav"
class EMUFILE;
class Slot2Info
{
public:

View File

@ -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;

View File

@ -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 <map>
#include "types.h"
enum TexCache_TexFormat
{
TexFormat_None, //used when nothing yet is cached

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "armcpu.h"
#include "instructions.h"
#include <assert.h>
#include "bios.h"
#include "debug.h"
#include "MMU.h"
#include "NDSSystem.h"
#include "MMU_timing.h"
#include <assert.h>
#define cpu (&ARMPROC)
#define TEMPLATE template<int PROCNUM>

View File

@ -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 <limits.h>
#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 <limits.h>
#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

View File

@ -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;

View File

@ -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 <string>
#include "types.h"
#include "emufile.h"
#include "../types.h"
class EMUFILE;
class ADVANsCEne
{

View File

@ -30,6 +30,7 @@
#define __CRC_H
//#include "little.h" // FixCrc is not yet big endian compatible
#include <stdio.h>
/*
* Data

View File

@ -21,14 +21,13 @@
* Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include "decrypt.h"
#include <stdlib.h>
#include <string.h>
#include "../../types.h"
#include "crc.h"
#include "header.h"
#include "decrypt.h"
//encr_data
const unsigned char arm7_key[] =

View File

@ -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)

View File

@ -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 <wchar.h>
#include <wctype.h>
#include <string.h>
#include "../emufile.h"
#define LE16(x) (x)

View File

@ -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 <stdio.h>
class EMUFILE;
#define BOOTCODE_SIZE 448
#define BOOTCODE_FAT32_SIZE 420

Some files were not shown because too many files have changed in this diff Show More