slot1:
- add support retail cartridge with NAND flash (Made in Ore/WariWare D.I.Y.); winport: - add choose Slot 1 device (Menu: Emulation->Slot 1); - fix change type of R4 cheats base; - fix printlog function;
This commit is contained in:
parent
13ae3664ab
commit
8d51fdfbbe
|
@ -79,7 +79,7 @@ libdesmume_a_SOURCES = \
|
|||
utils/libfat/partition.cpp \
|
||||
utils/libfat/partition.h \
|
||||
addons.cpp addons.h \
|
||||
addons/slot2_mpcf.cpp addons/slot2_paddle.cpp addons/slot2_gbagame.cpp addons/slot2_none.cpp addons/slot2_rumblepak.cpp addons/slot2_guitarGrip.cpp addons/slot2_expMemory.cpp addons/slot2_piano.cpp addons/slot1_none.cpp addons/slot1_r4.cpp addons/slot1_retail.cpp \
|
||||
addons/slot2_mpcf.cpp addons/slot2_paddle.cpp addons/slot2_gbagame.cpp addons/slot2_none.cpp addons/slot2_rumblepak.cpp addons/slot2_guitarGrip.cpp addons/slot2_expMemory.cpp addons/slot2_piano.cpp addons/slot1_none.cpp addons/slot1_r4.cpp addons/slot1_retail.cpp addons/slot1_retail_nand.cpp \
|
||||
cheatSystem.cpp cheatSystem.h \
|
||||
texcache.cpp texcache.h rasterize.cpp rasterize.h \
|
||||
metaspu/metaspu.cpp metaspu/metaspu.h \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2010 DeSmuME team
|
||||
/* Copyright (C) 2009-2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -70,10 +70,10 @@ void addonsReset()
|
|||
|
||||
BOOL addonsChangePak(NDS_ADDON_TYPE type)
|
||||
{
|
||||
printf("addonsChangePak\n");
|
||||
if (type > NDS_ADDON_COUNT) return FALSE;
|
||||
addon.close();
|
||||
addon = addonList[type];
|
||||
addon_type = type;
|
||||
printf("Slot 2: %s\n", addon.name);
|
||||
return addon.init();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2010 DeSmuME team
|
||||
/* Copyright (C) 2009-2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010 DeSmuME team
|
||||
/* Copyright (C) 2010-2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -48,7 +48,7 @@ static u32 slot1_read32(u8 PROCNUM, u32 adr)
|
|||
|
||||
|
||||
SLOT1INTERFACE slot1None = {
|
||||
"Slot1None",
|
||||
"None",
|
||||
slot1_init,
|
||||
slot1_reset,
|
||||
slot1_close,
|
||||
|
|
|
@ -223,7 +223,7 @@ static u32 read32(u8 PROCNUM, u32 adr)
|
|||
}
|
||||
|
||||
SLOT1INTERFACE slot1R4 = {
|
||||
"Slot1R4",
|
||||
"R4",
|
||||
init,
|
||||
reset,
|
||||
close,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010 DeSmuME team
|
||||
/* Copyright (C) 2010-2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -154,7 +154,7 @@ static u32 read32(u8 PROCNUM, u32 adr)
|
|||
|
||||
|
||||
SLOT1INTERFACE slot1Retail = {
|
||||
"Slot1Retail",
|
||||
"Retail",
|
||||
init,
|
||||
reset,
|
||||
close,
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
/* Copyright (C) 2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../slot1.h"
|
||||
#include "../registers.h"
|
||||
#include "../MMU.h"
|
||||
#include "../NDSSystem.h"
|
||||
|
||||
static void info(char *info) { strcpy(info, "Slot1 Retail NAND card emulation"); }
|
||||
static void config(void) {}
|
||||
|
||||
static BOOL init() { return (TRUE); }
|
||||
|
||||
static void reset() {}
|
||||
|
||||
static void close() {}
|
||||
|
||||
|
||||
static void write08(u8 PROCNUM, u32 adr, u8 val) {}
|
||||
static void write16(u8 PROCNUM, u32 adr, u16 val) {}
|
||||
|
||||
static void write32_GCROMCTRL(u8 PROCNUM, u32 val)
|
||||
{
|
||||
nds_dscard& card = MMU.dscard[PROCNUM];
|
||||
|
||||
switch(card.command[0])
|
||||
{
|
||||
case 0x00: //Data read
|
||||
case 0xB7:
|
||||
card.address = (card.command[1] << 24) | (card.command[2] << 16) | (card.command[3] << 8) | card.command[4];
|
||||
card.transfer_count = 0x80;
|
||||
break;
|
||||
|
||||
case 0xB8: // Chip ID
|
||||
card.address = 0;
|
||||
card.transfer_count = 1;
|
||||
break;
|
||||
|
||||
// Nand Init
|
||||
case 0x94:
|
||||
card.address = 0;
|
||||
card.transfer_count = 0x80;
|
||||
break;
|
||||
|
||||
// Nand Error?
|
||||
case 0xD6:
|
||||
card.address = 0;
|
||||
card.transfer_count = 1;
|
||||
break;
|
||||
|
||||
// Nand Write? ---- PROGRAM for INTERNAL DATA MOVE/RANDOM DATA INPUT
|
||||
//case 0x8B:
|
||||
case 0x85:
|
||||
card.address = 0;
|
||||
card.transfer_count = 0x80;
|
||||
break;
|
||||
|
||||
default:
|
||||
card.address = 0;
|
||||
card.transfer_count = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void write32(u8 PROCNUM, u32 adr, u32 val)
|
||||
{
|
||||
switch(adr)
|
||||
{
|
||||
case REG_GCROMCTRL:
|
||||
write32_GCROMCTRL(PROCNUM, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 read08(u8 PROCNUM, u32 adr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
static u16 read16(u8 PROCNUM, u32 adr)
|
||||
{
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
static u32 read32_GCDATAIN(u8 PROCNUM)
|
||||
{
|
||||
nds_dscard& card = MMU.dscard[PROCNUM];
|
||||
|
||||
switch(card.command[0])
|
||||
{
|
||||
//Get ROM chip ID
|
||||
case 0x90:
|
||||
case 0xB8:
|
||||
{
|
||||
// Note: the BIOS stores the chip ID in main memory
|
||||
// Most games continuously compare the chip ID with
|
||||
// the value in memory, probably to know if the card
|
||||
// was removed.
|
||||
// As DeSmuME boots directly from the game, the chip
|
||||
// ID in main mem is zero and this value needs to be
|
||||
// zero too.
|
||||
|
||||
//staff of kings verifies this (it also uses the arm7 IRQ 20)
|
||||
if(nds.cardEjected) //TODO - handle this with ejected card slot1 device (and verify using this case)
|
||||
return 0xFFFFFFFF;
|
||||
else return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// Data read
|
||||
case 0x00:
|
||||
case 0xB7:
|
||||
{
|
||||
// Make sure any reads below 0x8000 redirect to 0x8000+(adr&0x1FF) as on real cart
|
||||
if((card.command[0] == 0xB7) && (card.address < 0x8000))
|
||||
{
|
||||
//TODO - refactor this to include the PROCNUM, for debugging purposes if nothing else
|
||||
//(can refactor gbaslot also)
|
||||
|
||||
//INFO("Read below 0x8000 (0x%04X) from: ARM%s %08X\n",
|
||||
// card.address, (PROCNUM ? "7":"9"), (PROCNUM ? NDS_ARM7:NDS_ARM9).instruct_adr);
|
||||
|
||||
card.address = (0x8000 + (card.address&0x1FF));
|
||||
}
|
||||
|
||||
//it seems that etrian odyssey 3 doesnt work unless we mask this to cart size.
|
||||
//but, a thought: does the internal rom address counter register wrap around? we may be making a mistake by keeping the extra precision
|
||||
//but there is no test case yet
|
||||
u32 address = card.address & (gameInfo.mask);
|
||||
|
||||
//as a sanity measure for funny-sized roms (homebrew and perhaps truncated retail roms)
|
||||
//we need to protect ourselves by returning 0xFF for things still out of range
|
||||
if(address >= gameInfo.romsize)
|
||||
{
|
||||
DEBUG_Notify.ReadBeyondEndOfCart(address,gameInfo.romsize);
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
return T1ReadLong(MMU.CART_ROM, address);
|
||||
}
|
||||
break;
|
||||
|
||||
// Nand Init?
|
||||
case 0x94:
|
||||
return 0; //Unsure what to return here so return 0 for now
|
||||
|
||||
// Nand Status?
|
||||
case 0xD6:
|
||||
//0x80 == busy
|
||||
// Made in Ore/WariWare D.I.Y. need set value to 0x80
|
||||
return 0x80; //0x20 == ready
|
||||
|
||||
default:
|
||||
return 0;
|
||||
} //switch(card.command[0])
|
||||
} //read32_GCDATAIN
|
||||
|
||||
static u32 read32(u8 PROCNUM, u32 adr)
|
||||
{
|
||||
switch(adr)
|
||||
{
|
||||
case REG_GCDATAIN:
|
||||
return read32_GCDATAIN(PROCNUM);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SLOT1INTERFACE slot1Retail_NAND = {
|
||||
"Retail with NAND Flash",
|
||||
init,
|
||||
reset,
|
||||
close,
|
||||
config,
|
||||
write08,
|
||||
write16,
|
||||
write32,
|
||||
read08,
|
||||
read16,
|
||||
read32,
|
||||
info
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -241,5 +241,7 @@ void CommandLine::process_addonCommands()
|
|||
slot1Change(NDS_SLOT1_RETAIL);
|
||||
else if(slot1 == "r4")
|
||||
slot1Change(NDS_SLOT1_R4);
|
||||
else if(slot1 == "retailNAND")
|
||||
slot1Change(NDS_SLOT1_RETAIL_NAND);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
extern SLOT1INTERFACE slot1None;
|
||||
extern SLOT1INTERFACE slot1Retail;
|
||||
extern SLOT1INTERFACE slot1R4;
|
||||
extern SLOT1INTERFACE slot1Retail_NAND;
|
||||
|
||||
static EMUFILE* fatImage = NULL;
|
||||
static std::string fatDir;
|
||||
|
@ -35,7 +36,8 @@ static std::string fatDir;
|
|||
SLOT1INTERFACE slot1List[NDS_SLOT1_COUNT] = {
|
||||
slot1None,
|
||||
slot1Retail,
|
||||
slot1R4
|
||||
slot1R4,
|
||||
slot1Retail_NAND
|
||||
};
|
||||
|
||||
SLOT1INTERFACE slot1_device = slot1Retail; //default for frontends that dont even configure this
|
||||
|
@ -45,8 +47,11 @@ static void scanDir()
|
|||
{
|
||||
if(fatDir == "") return;
|
||||
|
||||
delete fatImage;
|
||||
fatImage = NULL;
|
||||
if (fatImage)
|
||||
{
|
||||
delete fatImage;
|
||||
fatImage = NULL;
|
||||
}
|
||||
|
||||
VFAT vfat;
|
||||
if(vfat.build(fatDir.c_str(),16))
|
||||
|
@ -57,7 +62,8 @@ static void scanDir()
|
|||
|
||||
BOOL slot1Init()
|
||||
{
|
||||
scanDir();
|
||||
if (slot1_device_type == NDS_SLOT1_R4)
|
||||
scanDir();
|
||||
return slot1_device.init();
|
||||
}
|
||||
|
||||
|
@ -66,8 +72,11 @@ void slot1Close()
|
|||
slot1_device.close();
|
||||
|
||||
//be careful to do this second, maybe the device will write something more
|
||||
delete fatImage;
|
||||
fatImage = NULL;
|
||||
if (fatImage)
|
||||
{
|
||||
delete fatImage;
|
||||
fatImage = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void slot1Reset()
|
||||
|
@ -77,19 +86,27 @@ void slot1Reset()
|
|||
|
||||
BOOL slot1Change(NDS_SLOT1_TYPE changeToType)
|
||||
{
|
||||
printf("slot1Change to: %d\n", changeToType);
|
||||
if (changeToType > NDS_SLOT1_COUNT || changeToType < 0) return FALSE;
|
||||
slot1_device.close();
|
||||
slot1_device_type = changeToType;
|
||||
slot1_device = slot1List[slot1_device_type];
|
||||
if (changeToType == NDS_SLOT1_R4)
|
||||
scanDir();
|
||||
printf("Slot 1: %s\n", slot1_device.name);
|
||||
return slot1_device.init();
|
||||
}
|
||||
|
||||
void slot1SetFatDir(const std::string& dir)
|
||||
{
|
||||
//printf("FAT path %s\n", dir.c_str());
|
||||
fatDir = dir;
|
||||
}
|
||||
|
||||
std::string slot1GetFatDir()
|
||||
{
|
||||
return fatDir;
|
||||
}
|
||||
|
||||
EMUFILE* slot1GetFatImage()
|
||||
{
|
||||
return fatImage;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010 DeSmuME team
|
||||
/* Copyright (C) 2010-2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -58,21 +58,24 @@ struct SLOT1INTERFACE
|
|||
void (*info)(char *info);
|
||||
};
|
||||
|
||||
extern SLOT1INTERFACE slot1_device; // current slot1 device
|
||||
|
||||
enum NDS_SLOT1_TYPE
|
||||
{
|
||||
NDS_SLOT1_NONE,
|
||||
NDS_SLOT1_RETAIL,
|
||||
NDS_SLOT1_R4,
|
||||
NDS_SLOT1_RETAIL_NAND, // used in Made in Ore/WarioWare D.I.Y.
|
||||
NDS_SLOT1_COUNT // use for counter addons - MUST TO BE LAST!!!
|
||||
};
|
||||
|
||||
extern SLOT1INTERFACE slot1_device; // current slot1 device
|
||||
extern SLOT1INTERFACE slot1List[NDS_SLOT1_COUNT];
|
||||
extern u8 slot1_device_type;
|
||||
|
||||
BOOL slot1Init();
|
||||
void slot1Close();
|
||||
void slot1Reset();
|
||||
BOOL slot1Change(NDS_SLOT1_TYPE type); // change current adddon
|
||||
void slot1SetFatDir(const std::string& dir);
|
||||
std::string slot1GetFatDir();
|
||||
EMUFILE* slot1GetFatImage();
|
||||
|
||||
#endif //__ADDONS_H__
|
||||
#endif //__SLOT1_H__
|
||||
|
|
|
@ -869,6 +869,14 @@
|
|||
RelativePath=".\resources.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\slot1_config.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\slot1_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\snddx.cpp"
|
||||
>
|
||||
|
@ -1655,6 +1663,10 @@
|
|||
RelativePath="..\addons\slot1_retail.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\addons\slot1_retail_nand.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\addons\slot2_expMemory.cpp"
|
||||
>
|
||||
|
|
|
@ -922,22 +922,6 @@
|
|||
RelativePath="..\slot1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\softrender.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\softrender_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\softrender_desmumefont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\softrender_v3sysfont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\SPU.cpp"
|
||||
>
|
||||
|
@ -1005,6 +989,10 @@
|
|||
RelativePath="..\addons\slot1_retail.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\addons\slot1_retail_nand.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\addons\slot2_expMemory.cpp"
|
||||
>
|
||||
|
@ -1554,6 +1542,14 @@
|
|||
RelativePath=".\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\slot1_config.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\slot1_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\snddx.cpp"
|
||||
>
|
||||
|
|
|
@ -432,6 +432,7 @@
|
|||
<ClCompile Include="..\addons\slot1_none.cpp" />
|
||||
<ClCompile Include="..\addons\slot1_r4.cpp" />
|
||||
<ClCompile Include="..\addons\slot1_retail.cpp" />
|
||||
<ClCompile Include="..\addons\slot1_retail_nand.cpp" />
|
||||
<ClCompile Include="..\addons\slot2_mpcf.cpp" />
|
||||
<ClCompile Include="..\addons\slot2_paddle.cpp" />
|
||||
<ClCompile Include="..\aggdraw.cpp" />
|
||||
|
@ -542,6 +543,7 @@
|
|||
<ClCompile Include="recentroms.cpp" />
|
||||
<ClCompile Include="replay.cpp" />
|
||||
<ClCompile Include="snddx.cpp" />
|
||||
<ClCompile Include="slot1_config.cpp" />
|
||||
<ClCompile Include="throttle.cpp" />
|
||||
<ClCompile Include="winutil.cpp" />
|
||||
<ClCompile Include="filter\2xsai.cpp" />
|
||||
|
@ -680,6 +682,7 @@
|
|||
<ClInclude Include="replay.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="snddx.h" />
|
||||
<ClInclude Include="slot1_config.h" />
|
||||
<ClInclude Include="throttle.h" />
|
||||
<ClInclude Include="winpcap.h" />
|
||||
<ClInclude Include="winutil.h" />
|
||||
|
|
|
@ -315,6 +315,9 @@
|
|||
<ClCompile Include="snddx.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="slot1_config.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="throttle.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
|
@ -393,6 +396,9 @@
|
|||
<ClCompile Include="..\addons\slot1_retail.cpp">
|
||||
<Filter>Core\addons</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\addons\slot1_retail_nand.cpp">
|
||||
<Filter>Core\addons</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\utils\datetime.cpp">
|
||||
<Filter>Core\utils</Filter>
|
||||
</ClCompile>
|
||||
|
@ -719,6 +725,9 @@
|
|||
<ClInclude Include="snddx.h">
|
||||
<Filter>Windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="slot1_config.h">
|
||||
<Filter>Windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="throttle.h">
|
||||
<Filter>Windows</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -106,14 +106,5 @@ void CloseConsole() {
|
|||
|
||||
void printlog(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[512];
|
||||
DWORD tmp;
|
||||
|
||||
memset(msg,0,512);
|
||||
|
||||
va_start(list,fmt);
|
||||
_vsnprintf(msg,511,fmt,list);
|
||||
va_end(list);
|
||||
WriteConsole(hConsole,msg, (DWORD)strlen(msg), &tmp, 0);
|
||||
printf(fmt);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../NDSSystem.h"
|
||||
#include "../debug.h"
|
||||
#include "../saves.h"
|
||||
#include "../slot1.h"
|
||||
#include "../addons.h"
|
||||
#include "../GPU_osd.h"
|
||||
#include "../OGLRender.h"
|
||||
|
@ -91,6 +92,7 @@ along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "mapview.h"
|
||||
#include "matrixview.h"
|
||||
#include "lightview.h"
|
||||
#include "slot1_config.h"
|
||||
#include "gbaslot_config.h"
|
||||
#include "cheatsWin.h"
|
||||
#include "memView.h"
|
||||
|
@ -2562,12 +2564,6 @@ int _main()
|
|||
|
||||
CommonSettings.cheatsDisable = GetPrivateProfileBool("General", "cheatsDisable", false, IniName);
|
||||
|
||||
addon_type = (NDS_ADDON_TYPE)GetPrivateProfileInt("GBAslot", "type", NDS_ADDON_NONE, IniName);
|
||||
win32_CFlash_cfgMode = GetPrivateProfileInt("GBAslot.CFlash", "fileMode", 2, IniName);
|
||||
win32_CFlash_cfgDirectory = GetPrivateProfileStdString("GBAslot.CFlash", "path", "");
|
||||
win32_CFlash_cfgFileName = GetPrivateProfileStdString("GBAslot.CFlash", "filename", "");
|
||||
GetPrivateProfileString("GBAslot.GBAgame", "filename", "", GBAgameName, MAX_PATH, IniName);
|
||||
|
||||
WIN_InstallCFlash();
|
||||
|
||||
ColorCtrl_Register();
|
||||
|
@ -2747,8 +2743,30 @@ int _main()
|
|||
ViewMatrices = new TOOLSCLASS(hAppInst, IDD_MATRIX_VIEWER, (DLGPROC) ViewMatricesProc);
|
||||
ViewLights = new TOOLSCLASS(hAppInst, IDD_LIGHT_VIEWER, (DLGPROC) ViewLightsProc);
|
||||
|
||||
// Slot 1 / Slot 2 (GBA slot)
|
||||
slot1_device_type = (NDS_SLOT1_TYPE)GetPrivateProfileInt("Slot1", "type", NDS_SLOT1_RETAIL, IniName);
|
||||
cmdline.slot1_fat_dir = GetPrivateProfileStdString("Slot1", "fat_path", "");
|
||||
|
||||
addon_type = (NDS_ADDON_TYPE)GetPrivateProfileInt("GBAslot", "type", NDS_ADDON_NONE, IniName);
|
||||
win32_CFlash_cfgMode = GetPrivateProfileInt("GBAslot.CFlash", "fileMode", 2, IniName);
|
||||
win32_CFlash_cfgDirectory = GetPrivateProfileStdString("GBAslot.CFlash", "path", "");
|
||||
win32_CFlash_cfgFileName = GetPrivateProfileStdString("GBAslot.CFlash", "filename", "");
|
||||
GetPrivateProfileString("GBAslot.GBAgame", "filename", "", GBAgameName, MAX_PATH, IniName);
|
||||
|
||||
cmdline.process_addonCommands();
|
||||
|
||||
switch (slot1_device_type)
|
||||
{
|
||||
case NDS_SLOT1_NONE:
|
||||
case NDS_SLOT1_RETAIL:
|
||||
case NDS_SLOT1_R4:
|
||||
case NDS_SLOT1_RETAIL_NAND:
|
||||
break;
|
||||
default:
|
||||
slot1_device_type = NDS_SLOT1_RETAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
if(cmdline.is_cflash_configured)
|
||||
{
|
||||
addon_type = NDS_ADDON_CFLASH;
|
||||
|
@ -2793,6 +2811,8 @@ int _main()
|
|||
addon_type = NDS_ADDON_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
slot1Change((NDS_SLOT1_TYPE)slot1_device_type);
|
||||
addonsChangePak(addon_type);
|
||||
|
||||
CommonSettings.wifi.mode = GetPrivateProfileInt("Wifi", "Mode", 0, IniName);
|
||||
|
@ -5078,6 +5098,10 @@ DOKEYDOWN:
|
|||
TogglePause();
|
||||
return 0;
|
||||
|
||||
case IDM_SLOT1:
|
||||
slot1Dialog(hwnd);
|
||||
return 0;
|
||||
|
||||
case IDM_GBASLOT:
|
||||
GBAslotDialog(hwnd);
|
||||
return 0;
|
||||
|
|
|
@ -109,6 +109,7 @@ void WritePathSettings()
|
|||
WritePrivateProfileString(SECTION, SCREENSHOTKEY, path.pathToScreenshots, IniName);
|
||||
WritePrivateProfileString(SECTION, AVIKEY, path.pathToAviFiles, IniName);
|
||||
WritePrivateProfileString(SECTION, CHEATKEY, path.pathToCheats, IniName);
|
||||
WritePrivateProfileInt(SECTION, R4FORMATKEY, path.r4Format, IniName);
|
||||
WritePrivateProfileString(SECTION, SOUNDKEY, path.pathToSounds, IniName);
|
||||
WritePrivateProfileString(SECTION, FIRMWAREKEY, path.pathToFirmware, IniName);
|
||||
WritePrivateProfileString(SECTION, LUAKEY, path.pathToLua, IniName);
|
||||
|
@ -141,6 +142,7 @@ BOOL PathSettings_OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam)
|
|||
CheckDlgButton(hDlg, IDC_USELASTVISIT, (path.savelastromvisit) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hDlg, IDC_ASSOCIATE, (associate) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckRadioButton(hDlg, IDC_PNG, IDC_BMP, (int)path.imageformat());
|
||||
CheckRadioButton(hDlg, IDC_R4TYPE1, IDC_R4TYPE2, (int)path.r4Format);
|
||||
|
||||
// IDC_FORMATEDIT setup
|
||||
SetDlgItemText(hDlg, IDC_FORMATEDIT, path.screenshotFormat);
|
||||
|
@ -258,6 +260,15 @@ void PathSettings_OnCommand(HWND hDlg, int id, HWND hwndCtl, UINT codeNotify)
|
|||
SetDlgItemText(hDlg, IDC_CHEATPATHEDIT, path.pathToCheats);
|
||||
}
|
||||
break;
|
||||
case IDC_R4TYPE1:
|
||||
CheckRadioButton(hDlg, IDC_R4TYPE1, IDC_R4TYPE2, IDC_R4TYPE1);
|
||||
path.r4Format = path.R4_CHEAT_DAT;
|
||||
break;
|
||||
case IDC_R4TYPE2:
|
||||
CheckRadioButton(hDlg, IDC_R4TYPE1, IDC_R4TYPE2, IDC_R4TYPE2);
|
||||
path.r4Format = path.R4_USRCHEAT_DAT;
|
||||
break;
|
||||
|
||||
case IDC_BROWSELUA:
|
||||
{
|
||||
if(BrowseForPath(path.pathToLua))
|
||||
|
|
|
@ -802,6 +802,8 @@
|
|||
#define IDD_CHEAT_ADD_XX_CODE 10005
|
||||
#define IDD_GBASLOT_GUITARGRIP 10009
|
||||
#define IDD_GBASLOT_PIANO 10010
|
||||
#define IDD_SLOT1_NONE 10011
|
||||
#define IDD_SLOT1_R4 10012
|
||||
#define IDM_FILE_STOPAVI 40000
|
||||
#define IDM_SCREENSEP_NONE 40000
|
||||
#define IDM_FILE_STOPWAV 40001
|
||||
|
@ -876,6 +878,7 @@
|
|||
#define ID_MAGNIFICATIONFILTER_HQ4X40091 40091
|
||||
#define ID_FILTRI_HQ4X 40092
|
||||
#define ID_40093 40093
|
||||
#define IDM_SLOT1 40097
|
||||
#define IDC_LABEL_UP 50000
|
||||
#define IDC_LABEL_RIGHT 50001
|
||||
#define IDC_LABEL_LEFT 50002
|
||||
|
@ -976,8 +979,8 @@
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 125
|
||||
#define _APS_NEXT_COMMAND_VALUE 40094
|
||||
#define _APS_NEXT_CONTROL_VALUE 1050
|
||||
#define _APS_NEXT_COMMAND_VALUE 40102
|
||||
#define _APS_NEXT_CONTROL_VALUE 1052
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,231 @@
|
|||
/* Copyright (C) 2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "slot1_config.h"
|
||||
#include <windowsx.h>
|
||||
#include "resource.h"
|
||||
#include "main.h"
|
||||
#include "debug.h"
|
||||
#include "../slot1.h"
|
||||
#include "../NDSSystem.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
HWND wndConfigSlot1 = NULL;
|
||||
u8 temp_type_slot1 = 0;
|
||||
u8 last_type_slot1 = 0;
|
||||
char tmp_fat_path[MAX_PATH] = {0};
|
||||
HWND OKbutton_slot1 = NULL;
|
||||
bool _OKbutton_slot1 = false;
|
||||
bool needReset_slot1 = true;
|
||||
|
||||
|
||||
INT_PTR CALLBACK Slot1None(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
_OKbutton_slot1 = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK Slot1R4(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_fat_path);
|
||||
_OKbutton_slot1 = (tmp_fat_path!="");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_BROWSE:
|
||||
{
|
||||
BROWSEINFO bp={0};
|
||||
|
||||
bp.hwndOwner=dialog;
|
||||
bp.pidlRoot=NULL;
|
||||
bp.pszDisplayName=NULL;
|
||||
bp.lpszTitle="Select directory for FAT image building";
|
||||
bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_USENEWUI;
|
||||
bp.lpfn=NULL;
|
||||
|
||||
LPITEMIDLIST tmp = SHBrowseForFolder((LPBROWSEINFO)&bp);
|
||||
if (tmp!=NULL)
|
||||
{
|
||||
memset(tmp_fat_path, 0, sizeof(tmp_fat_path));
|
||||
SHGetPathFromIDList(tmp, tmp_fat_path);
|
||||
if (tmp_fat_path[strlen(tmp_fat_path)-1] != '\\')
|
||||
tmp_fat_path[strlen(tmp_fat_path)] = '\\';
|
||||
SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_fat_path);
|
||||
}
|
||||
if (strlen(tmp_fat_path))
|
||||
EnableWindow(OKbutton_slot1, TRUE);
|
||||
else
|
||||
EnableWindow(OKbutton_slot1, FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 Slot1_IDDs[NDS_SLOT1_COUNT] = {
|
||||
IDD_SLOT1_NONE,
|
||||
IDD_SLOT1_NONE,
|
||||
IDD_SLOT1_R4,
|
||||
IDD_SLOT1_NONE
|
||||
};
|
||||
|
||||
DLGPROC Slot1_Procs[NDS_SLOT1_COUNT] = {
|
||||
Slot1None,
|
||||
Slot1None,
|
||||
Slot1R4,
|
||||
Slot1None
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
BOOL CALLBACK Slot1Box_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
OKbutton_slot1 = GetDlgItem(dialog, IDOK);
|
||||
for(int i = 0; i < NDS_SLOT1_COUNT; i++)
|
||||
ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), slot1List[i].name);
|
||||
ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type_slot1);
|
||||
u8 tmp_info[512];
|
||||
slot1List[temp_type_slot1].info((char *)tmp_info);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
|
||||
|
||||
_OKbutton_slot1 = false;
|
||||
wndConfigSlot1=CreateDialogW(hAppInst, MAKEINTRESOURCEW(Slot1_IDDs[temp_type_slot1]),
|
||||
dialog, (DLGPROC)Slot1_Procs[temp_type_slot1]);
|
||||
if ( (temp_type_slot1 == 0) || (_OKbutton_slot1) )
|
||||
EnableWindow(OKbutton_slot1, TRUE);
|
||||
else
|
||||
EnableWindow(OKbutton_slot1, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDOK:
|
||||
{
|
||||
int Msg = IDYES;
|
||||
if (romloaded && (needReset_slot1 || (temp_type_slot1!=slot1_device_type)) )
|
||||
{
|
||||
Msg = MessageBox(dialog,
|
||||
"After change slot1 device game will reset!\nAre you sure to continue?", "DeSmuME",
|
||||
MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
|
||||
}
|
||||
if (Msg == IDYES)
|
||||
{
|
||||
if (wndConfigSlot1) DestroyWindow(wndConfigSlot1);
|
||||
EndDialog(dialog, TRUE);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCANCEL:
|
||||
if (wndConfigSlot1) DestroyWindow(wndConfigSlot1);
|
||||
EndDialog(dialog, FALSE);
|
||||
return TRUE;
|
||||
|
||||
case IDC_ADDONS_LIST:
|
||||
if (HIWORD(wparam) == CBN_SELENDOK)
|
||||
{
|
||||
temp_type_slot1 = ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST));
|
||||
if (temp_type_slot1 != last_type_slot1)
|
||||
{
|
||||
if (wndConfigSlot1) DestroyWindow(wndConfigSlot1);
|
||||
_OKbutton_slot1 = false;
|
||||
wndConfigSlot1=CreateDialogW(hAppInst,
|
||||
MAKEINTRESOURCEW(Slot1_IDDs[temp_type_slot1]), dialog,
|
||||
(DLGPROC)Slot1_Procs[temp_type_slot1]);
|
||||
if ( (temp_type_slot1 == 0) || (_OKbutton_slot1) )
|
||||
EnableWindow(OKbutton_slot1, TRUE);
|
||||
else
|
||||
EnableWindow(OKbutton_slot1, FALSE);
|
||||
u8 tmp_info[512];
|
||||
slot1List[temp_type_slot1].info((char *)tmp_info);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
|
||||
last_type_slot1 = temp_type_slot1;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void slot1Dialog(HWND hwnd)
|
||||
{
|
||||
strcpy(tmp_fat_path, slot1GetFatDir().c_str());
|
||||
temp_type_slot1 = slot1_device_type;
|
||||
last_type_slot1 = temp_type_slot1;
|
||||
_OKbutton_slot1 = false;
|
||||
needReset_slot1 = true;
|
||||
u32 res=DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_GBASLOT), hwnd, (DLGPROC)Slot1Box_Proc);
|
||||
if (res)
|
||||
{
|
||||
switch (temp_type_slot1)
|
||||
{
|
||||
case NDS_SLOT1_NONE:
|
||||
if (temp_type_slot1 != slot1_device_type)
|
||||
needReset_slot1 = true;
|
||||
else
|
||||
needReset_slot1 = false;
|
||||
break;
|
||||
case NDS_SLOT1_RETAIL:
|
||||
break;
|
||||
case NDS_SLOT1_R4:
|
||||
if (strlen(tmp_fat_path))
|
||||
{
|
||||
slot1SetFatDir(tmp_fat_path);
|
||||
WritePrivateProfileString("Slot1","FAT_path",tmp_fat_path,IniName);
|
||||
}
|
||||
break;
|
||||
case NDS_SLOT1_RETAIL_NAND:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
WritePrivateProfileInt("Slot1","type",temp_type_slot1,IniName);
|
||||
|
||||
slot1Change((NDS_SLOT1_TYPE)temp_type_slot1);
|
||||
if (romloaded && needReset_slot1)
|
||||
NDS_Reset();
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright (C) 2011 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __SLOT1_CONFIG_H_
|
||||
#define __SLOT1_CONFIG_H_
|
||||
#include "../common.h"
|
||||
#include <string>
|
||||
|
||||
extern void slot1Dialog(HWND hwnd);
|
||||
|
||||
#endif
|
|
@ -1024,6 +1024,10 @@
|
|||
RelativePath="..\addons\slot1_retail.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\addons\slot1_retail_nand.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\addons\slot2_mpcf.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue