- add game database (only crc & savetype yet);

winport:
- add convert ADVANsCEne database (http://www.advanscene.com/offline/datas/ADVANsCEne_RToolDS.zip) to DeSmuME internal database;
This commit is contained in:
mtabachenko 2011-08-29 12:01:42 +00:00
parent d849bf11db
commit 1ba3dabe0d
16 changed files with 6163 additions and 10 deletions

View File

@ -78,6 +78,12 @@ libdesmume_a_SOURCES = \
utils/libfat/mem_allocate.h \
utils/libfat/partition.cpp \
utils/libfat/partition.h \
utils/tinyxml/tinystr.cpp \
utils/tinyxml/tinystr.h \
utils/tinyxml/tinyxml.cpp \
utils/tinyxml/tinyxml.h \
utils/tinyxml/tinyxmlerror.cpp \
utils/tinyxml/tinyxmlparser.cpp \
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/slot1_retail_nand.cpp \
cheatSystem.cpp cheatSystem.h \

View File

@ -67,6 +67,7 @@ static u8 countLid = 0;
GameInfo gameInfo;
NDSSystem nds;
CFIRMWARE *firmware = NULL;
ADVANsCEne advsc;
using std::min;
using std::max;
@ -563,10 +564,37 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename)
gameInfo.populate();
gameInfo.crc = crc32(0,(u8*)gameInfo.romdata,gameInfo.romsize);
INFO("\nROM crc: %08X\n", gameInfo.crc);
INFO("\nROM game code: %c%c%c%c\n", gameInfo.header.gameCode[0], gameInfo.header.gameCode[1], gameInfo.header.gameCode[2], gameInfo.header.gameCode[3]);
INFO("ROM crc: %08X\n", gameInfo.crc);
INFO("ROM serial: %s\n", gameInfo.ROMserial);
INFO("ROM internal name: %s\n\n", gameInfo.ROMname);
INFO("ROM game code: %c%c%c%c\n\n", gameInfo.header.gameCode[0], gameInfo.header.gameCode[1], gameInfo.header.gameCode[2], gameInfo.header.gameCode[3]);
INFO("ROM internal name: %s\n", gameInfo.ROMname);
memset(buf, 0, MAX_PATH);
strcpy(buf, path.pathToModule);
strcat(buf, "desmume.ddb"); // DeSmuME database :)
advsc.setDatabase(buf);
buf[0] = gameInfo.header.gameCode[0];
buf[1] = gameInfo.header.gameCode[1];
buf[2] = gameInfo.header.gameCode[2];
buf[3] = gameInfo.header.gameCode[3];
buf[4] = 0;
if (advsc.check(buf))
{
u8 sv = advsc.getSaveType();
printf("ADVANsCEne database:\n");
printf("\t* ROM save type: ");
if (sv == 0xFF)
printf("Unknown");
else
if (sv == 0xFE)
printf("None");
else
{
printf("%s", save_names[sv]);
}
printf("\n\t* ROM crc: %08X\n", advsc.getCRC32());
}
printf("\n");
//for homebrew, try auto-patching DLDI. should be benign if there is no DLDI or if it fails
if(gameInfo.isHomebrew)
@ -575,17 +603,12 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename)
NDS_Reset();
memset(buf, 0, MAX_PATH);
path.getpathnoext(path.BATTERY, buf);
strcat(buf, ".dsv"); // DeSmuME memory card :)
MMU_new.backupDevice.load_rom(buf);
memset(buf, 0, MAX_PATH);
path.getpathnoext(path.CHEATS, buf);
strcat(buf, ".dct"); // DeSmuME cheat :)
cheats->init(buf);
@ -1751,7 +1774,7 @@ FORCEINLINE void arm9log()
INFO("Disassembler is stopped\n");
}*/
#else
printf("%05d:%03d %12lld 9:%08X %08X %-30s R00:%08X R01:%08X R02:%08X R03:%08X R04:%08X R05:%08X R06:%08X R07:%08X R08:%08X R09:%08X R10:%08X R11:%08X R12:%08X R13:%08X R14:%08X R15:%08X\n",
printf("%05d:%03d %12lld 9:%08X %08X %-30s\nR00:%08X R01:%08X R02:%08X R03:%08X R04:%08X R05:%08X R06:%08X R07:%08X R08:%08X R09:%08X R10:%08X R11:%08X R12:%08X R13:%08X R14:%08X R15:%08X\n",
currFrameCounter, nds.VCount, nds_timer,
NDS_ARM9.instruct_adr,NDS_ARM9.instruction, dasmbuf,
NDS_ARM9.R[0], NDS_ARM9.R[1], NDS_ARM9.R[2], NDS_ARM9.R[3], NDS_ARM9.R[4], NDS_ARM9.R[5], NDS_ARM9.R[6], NDS_ARM9.R[7],
@ -1818,7 +1841,7 @@ static /*donotinline*/ std::pair<s32,s32> armInnerLoop(
const u64 nds_timer_base, const s32 s32next, s32 arm9, s32 arm7)
{
s32 timer = minarmtime<doarm9,doarm7>(arm9,arm7);
while(timer < s32next && !sequencer.reschedule)
while(timer < s32next && !sequencer.reschedule && execute)
{
if(doarm9 && (!doarm7 || arm9 <= timer))
{

View File

@ -604,5 +604,7 @@ void ClearAutoHold(void);
bool ValidateSlot2Access(u32 procnum, u32 demandSRAMSpeed, u32 demand1stROMSpeed, u32 demand2ndROMSpeed, int clockbits);
extern ADVANsCEne advsc;
#endif

View File

@ -27,6 +27,7 @@
#include "movie.h"
#include "readwrite.h"
#include "NDSSystem.h"
#include "utils/tinyxml/tinyxml.h"
//temporary hack until we have better error reporting facilities
#ifdef _WINDOWS
@ -1009,6 +1010,15 @@ void BackupDevice::loadfile()
addr_size = info.addr_size;
//none of the other fields are used right now
u32 ss = info.size * 8 / 1024;
if (ss >= 1024)
{
ss /= 1024;
printf("Backup size: %i Mbit\n", ss);
}
else
printf("Backup size: %i Kbit\n", ss);
delete inf;
}
}
@ -1213,4 +1223,186 @@ void BackupDevice::forceManualBackupType()
{
addr_size = addr_size_for_old_save_size(save_types[CommonSettings.manualBackupType][1]);
state = RUNNING;
}
// ============================================= ADVANsCEne
u8 ADVANsCEne::check(const char *serial, u32 crc)
{
FILE *fp = fopen(database_path, "rb");
if (fp)
{
char buf[64];
memset(buf, 0, sizeof(buf));
if (fread(buf, 1, strlen(_ADVANsCEne_BASE_ID), fp) == strlen(_ADVANsCEne_BASE_ID))
{
//printf("ID: %s\n", buf);
if (strcmp(buf, _ADVANsCEne_BASE_ID) == 0)
{
if (fread(&versionBase[0], 1, 2, fp) == 2)
{
//printf("Version base: %i.%i\n", versionBase[0], versionBase[1]);
if (fread(&version[0], 1, 4, fp) == 4)
{
//printf("Version: %c%c%c%c\n", version[3], version[2], version[1], version[0]);
if (fread(&createTime, 1, sizeof(time_t), fp) == sizeof(time_t))
{
memset(buf, 0,sizeof(buf));
// serial(8) + crc32(4) + save_type(1) = 13 + reserved(8) = 21
while (true)
{
if (fread(buf, 1, 21, fp) != 21) break;
if (memcmp(&buf[4], serial, 4) == 0)
{
memcpy(&crc32, &buf[8], 4);
//printf("%s founded: crc32=%04X, save type %02X\n", serial, crc32, buf[12]);
saveType = buf[12];
fclose(fp);
return true;
}
}
}
}
}
}
}
fclose(fp);
}
return false;
}
bool ADVANsCEne::getXMLConfig(const char *in_filaname)
{
TiXmlDocument *xml = NULL;
TiXmlElement *el = NULL;
TiXmlElement *el_configuration = NULL;
TiXmlElement *el_newDat = NULL;
xml = new TiXmlDocument();
if (!xml) return false;
if (!xml->LoadFile(in_filaname)) return false;
el = xml->FirstChildElement("dat");
if (!el) return false;
el_configuration = el->FirstChildElement("configuration");
if (!el_configuration) return false;
el = el_configuration->FirstChildElement("datName"); if (el) { datName = el->GetText(); }
el = el_configuration->FirstChildElement("datVersion"); if (el) { datVersion = el->GetText(); }
el_newDat = el_configuration->FirstChildElement("newDat");
if (!el_newDat) return false;
el = el_newDat->FirstChildElement("datVersionURL"); if (el) { urlVersion = el->GetText(); }
el = el_newDat->FirstChildElement("datURL"); if (el) { urlDat = el->GetText(); }
delete xml;
return true;
}
u32 ADVANsCEne::convertDB(const char *in_filaname)
{
char *saveTypeNames[] = { "Eeprom - 4 kbit", // EEPROM 4kbit
"Eeprom - 64 kbit", // EEPROM 64kbit
"Eeprom - 512 kbit", // EEPROM 512kbit
"Fram - 256 kbit", // FRAM 256kbit !
"Flash - 2 mbit", // FLASH 2Mbit
"Flash - 4 mbit", // FLASH 4Mbit
"Flash - 8 mbit", // FLASH 8Mbit
"Flash - 16 mbit", // FLASH 16Mbit !
"Flash - 32 mbit", // FLASH 32Mbit !
"Flash - 64 mbit", // FLASH 64Mbit
"Flash - 128 mbit", // FLASH 128Mbit !
"Flash - 256 mbit", // FLASH 256Mbit !
"Flash - 512 mbit" // FLASH 512Mbit !
};
TiXmlDocument *xml = NULL;
TiXmlElement *el = NULL;
TiXmlElement *el_serial = NULL;
TiXmlElement *el_games = NULL;
TiXmlElement *el_crc32 = NULL;
TiXmlElement *el_saveType = NULL;
FILE *fp;
u32 crc32 = 0;
u32 reserved = 0;
if (getXMLConfig(in_filaname))
{
if (!datName) return 0;
if (strcmp(datName, _ADVANsCEne_BASE_NAME) != 0) return 0;
}
fp = fopen(database_path, "wb");
if (!fp) return 0;
// Header
fwrite(_ADVANsCEne_BASE_ID, 1, strlen(_ADVANsCEne_BASE_ID), fp);
fputc(_ADVANsCEne_BASE_VERSION_MAJOR, fp);
fputc(_ADVANsCEne_BASE_VERSION_MINOR, fp);
if (datVersion)
fwrite(datVersion, 1, strlen(datVersion), fp);
else
fputc(0, fp);
time_t __time = time(NULL);
fwrite(&__time, 1, sizeof(time_t), fp);
xml = new TiXmlDocument();
if (!xml) { fclose(fp); return 0; }
if (!xml->LoadFile(in_filaname)) { fclose(fp); return 0; }
el = xml->FirstChildElement("dat");
if (!el) { fclose(fp); return 0; }
el_games = el->FirstChildElement("games");
if (!el_games) { fclose(fp); return 0; }
el = el_games->FirstChildElement("game");
if (!el) { fclose(fp); return 0; }
u32 count = 0;
while (el)
{
el_serial = el->FirstChildElement("serial");
if (fwrite(el_serial->GetText(), 1, 8, fp) != 8)
{
fclose(fp); return 0;
}
// CRC32
el_crc32 = el->FirstChildElement("files");
sscanf_s(el_crc32->FirstChildElement("romCRC")->GetText(), "%x", &crc32);
if (fwrite(&crc32, 1, sizeof(u32), fp) != sizeof(u32))
{
fclose(fp); return 0;
}
// Save type
el_saveType = el->FirstChildElement("saveType");
if (el_saveType)
{
const char *tmp = el_saveType->GetText();
if (tmp)
{
if (strcmp(tmp, "None") == 0)
fputc(0xFE, fp);
else
{
bool bUnknown = true;
for (u8 i = 0; i < MAX_SAVE_TYPES; i++)
{
if (strcmp(saveTypeNames[i], "") == 0) continue;
if (strcasecmp(tmp, saveTypeNames[i]) == 0)
{
fputc(i, fp);
bUnknown = false;
break;
}
}
if (bUnknown)
fputc(0xFF, fp); // Unknown
}
}
else
fputc(0xFF, fp); // Unknown
}
fwrite(&reserved, 1, sizeof(u32), fp);
fwrite(&reserved, 1, sizeof(u32), fp);
count++;
el = el->NextSiblingElement("game");
}
printf("ADVANsCEne converter: %i found\n", count);
delete xml;
fclose(fp);
return count;
}

View File

@ -28,6 +28,7 @@
#include "types.h"
#include "emufile.h"
#include "common.h"
#include "utils/tinyxml/tinyxml.h"
#define MAX_SAVE_TYPES 13
#define MC_TYPE_AUTODETECT 0x0
@ -51,6 +52,43 @@
#define MC_SIZE_256MBITS 0x2000000
#define MC_SIZE_512MBITS 0x4000000
// ============================================= ADVANsCEne
#define _ADVANsCEne_BASE_ID "DeSmuME database (ADVANsCEne)\0x1A"
#define _ADVANsCEne_BASE_VERSION_MAJOR 1
#define _ADVANsCEne_BASE_VERSION_MINOR 0
#define _ADVANsCEne_BASE_NAME "ADVANsCEne Nintendo DS Collection"
struct ADVANsCEne
{
private:
char database_path[MAX_PATH]; // DeSmuME save types
u8 versionBase[2];
char version[4];
time_t createTime;
u8 saveType;
u32 crc32;
// XML
const char *datName;
const char *datVersion;
const char *urlVersion;
const char *urlDat;
bool getXMLConfig(const char *in_filaname);
public:
ADVANsCEne() : saveType(0xFF),
crc32(0)
{
memset(database_path, 0, sizeof(database_path));
memset(versionBase, 0, sizeof(versionBase));
memset(version, 0, sizeof(version));
}
void setDatabase(const char *path) { strcpy(database_path, path); }
u32 convertDB(const char *in_filaname);
u8 check(const char *serial, u32 crc = 0);
u32 getSaveType() { return saveType; }
u32 getCRC32() { return crc32; }
};
struct memory_chip_t
{
u8 com; //persistent command actually handled

View File

@ -0,0 +1,111 @@
/*
www.sourceforge.net/projects/tinyxml
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#ifndef TIXML_USE_STL
#include "tinystr.h"
// Error value for find primitive
const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
// Null rep.
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
void TiXmlString::reserve (size_type cap)
{
if (cap > capacity())
{
TiXmlString tmp;
tmp.init(length(), cap);
memcpy(tmp.start(), data(), length());
swap(tmp);
}
}
TiXmlString& TiXmlString::assign(const char* str, size_type len)
{
size_type cap = capacity();
if (len > cap || cap > 3*(len + 8))
{
TiXmlString tmp;
tmp.init(len);
memcpy(tmp.start(), str, len);
swap(tmp);
}
else
{
memmove(start(), str, len);
set_size(len);
}
return *this;
}
TiXmlString& TiXmlString::append(const char* str, size_type len)
{
size_type newsize = length() + len;
if (newsize > capacity())
{
reserve (newsize + capacity());
}
memmove(finish(), str, len);
set_size(newsize);
return *this;
}
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
{
TiXmlString tmp;
tmp.reserve(a.length() + b.length());
tmp += a;
tmp += b;
return tmp;
}
TiXmlString operator + (const TiXmlString & a, const char* b)
{
TiXmlString tmp;
TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
tmp.reserve(a.length() + b_len);
tmp += a;
tmp.append(b, b_len);
return tmp;
}
TiXmlString operator + (const char* a, const TiXmlString & b)
{
TiXmlString tmp;
TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
tmp.reserve(a_len + b.length());
tmp.append(a, a_len);
tmp += b;
return tmp;
}
#endif // TIXML_USE_STL

View File

@ -0,0 +1,305 @@
/*
www.sourceforge.net/projects/tinyxml
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#ifndef TIXML_USE_STL
#ifndef TIXML_STRING_INCLUDED
#define TIXML_STRING_INCLUDED
#include <assert.h>
#include <string.h>
/* The support for explicit isn't that universal, and it isn't really
required - it is used to check that the TiXmlString class isn't incorrectly
used. Be nice to old compilers and macro it here:
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
// Microsoft visual studio, version 6 and higher.
#define TIXML_EXPLICIT explicit
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
// GCC version 3 and higher.s
#define TIXML_EXPLICIT explicit
#else
#define TIXML_EXPLICIT
#endif
/*
TiXmlString is an emulation of a subset of the std::string template.
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
Only the member functions relevant to the TinyXML project have been implemented.
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
a string and there's no more room, we allocate a buffer twice as big as we need.
*/
class TiXmlString
{
public :
// The size type used
typedef size_t size_type;
// Error value for find primitive
static const size_type npos; // = -1;
// TiXmlString empty constructor
TiXmlString () : rep_(&nullrep_)
{
}
// TiXmlString copy constructor
TiXmlString ( const TiXmlString & copy) : rep_(0)
{
init(copy.length());
memcpy(start(), copy.data(), length());
}
// TiXmlString constructor, based on a string
TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
{
init( static_cast<size_type>( strlen(copy) ));
memcpy(start(), copy, length());
}
// TiXmlString constructor, based on a string
TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
{
init(len);
memcpy(start(), str, len);
}
// TiXmlString destructor
~TiXmlString ()
{
quit();
}
TiXmlString& operator = (const char * copy)
{
return assign( copy, (size_type)strlen(copy));
}
TiXmlString& operator = (const TiXmlString & copy)
{
return assign(copy.start(), copy.length());
}
// += operator. Maps to append
TiXmlString& operator += (const char * suffix)
{
return append(suffix, static_cast<size_type>( strlen(suffix) ));
}
// += operator. Maps to append
TiXmlString& operator += (char single)
{
return append(&single, 1);
}
// += operator. Maps to append
TiXmlString& operator += (const TiXmlString & suffix)
{
return append(suffix.data(), suffix.length());
}
// Convert a TiXmlString into a null-terminated char *
const char * c_str () const { return rep_->str; }
// Convert a TiXmlString into a char * (need not be null terminated).
const char * data () const { return rep_->str; }
// Return the length of a TiXmlString
size_type length () const { return rep_->size; }
// Alias for length()
size_type size () const { return rep_->size; }
// Checks if a TiXmlString is empty
bool empty () const { return rep_->size == 0; }
// Return capacity of string
size_type capacity () const { return rep_->capacity; }
// single char extraction
const char& at (size_type index) const
{
assert( index < length() );
return rep_->str[ index ];
}
// [] operator
char& operator [] (size_type index) const
{
assert( index < length() );
return rep_->str[ index ];
}
// find a char in a string. Return TiXmlString::npos if not found
size_type find (char lookup) const
{
return find(lookup, 0);
}
// find a char in a string from an offset. Return TiXmlString::npos if not found
size_type find (char tofind, size_type offset) const
{
if (offset >= length()) return npos;
for (const char* p = c_str() + offset; *p != '\0'; ++p)
{
if (*p == tofind) return static_cast< size_type >( p - c_str() );
}
return npos;
}
void clear ()
{
//Lee:
//The original was just too strange, though correct:
// TiXmlString().swap(*this);
//Instead use the quit & re-init:
quit();
init(0,0);
}
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
function DOES NOT clear the content of the TiXmlString if any exists.
*/
void reserve (size_type cap);
TiXmlString& assign (const char* str, size_type len);
TiXmlString& append (const char* str, size_type len);
void swap (TiXmlString& other)
{
Rep* r = rep_;
rep_ = other.rep_;
other.rep_ = r;
}
private:
void init(size_type sz) { init(sz, sz); }
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
char* start() const { return rep_->str; }
char* finish() const { return rep_->str + rep_->size; }
struct Rep
{
size_type size, capacity;
char str[1];
};
void init(size_type sz, size_type cap)
{
if (cap)
{
// Lee: the original form:
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
// doesn't work in some cases of new being overloaded. Switching
// to the normal allocation, although use an 'int' for systems
// that are overly picky about structure alignment.
const size_type bytesNeeded = sizeof(Rep) + cap;
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
rep_->str[ rep_->size = sz ] = '\0';
rep_->capacity = cap;
}
else
{
rep_ = &nullrep_;
}
}
void quit()
{
if (rep_ != &nullrep_)
{
// The rep_ is really an array of ints. (see the allocator, above).
// Cast it back before delete, so the compiler won't incorrectly call destructors.
delete [] ( reinterpret_cast<int*>( rep_ ) );
}
}
Rep * rep_;
static Rep nullrep_;
} ;
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
{
return ( a.length() == b.length() ) // optimization on some platforms
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
}
inline bool operator < (const TiXmlString & a, const TiXmlString & b)
{
return strcmp(a.c_str(), b.c_str()) < 0;
}
inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
TiXmlString operator + (const TiXmlString & a, const char* b);
TiXmlString operator + (const char* a, const TiXmlString & b);
/*
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
Only the operators that we need for TinyXML have been developped.
*/
class TiXmlOutStream : public TiXmlString
{
public :
// TiXmlOutStream << operator.
TiXmlOutStream & operator << (const TiXmlString & in)
{
*this += in;
return *this;
}
// TiXmlOutStream << operator.
TiXmlOutStream & operator << (const char * in)
{
*this += in;
return *this;
}
} ;
#endif // TIXML_STRING_INCLUDED
#endif // TIXML_USE_STL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "tinyxml.h"
// The goal of the seperate error file is to make the first
// step towards localization. tinyxml (currently) only supports
// english error messages, but the could now be translated.
//
// It also cleans up the code a bit.
//
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
{
"No error",
"Error",
"Failed to open file",
"Error parsing Element.",
"Failed to read Element name",
"Error reading Element value.",
"Error reading Attributes.",
"Error: empty tag.",
"Error reading end tag.",
"Error parsing Unknown.",
"Error parsing Comment.",
"Error parsing Declaration.",
"Error document empty.",
"Error null (0) or unexpected EOF found in input stream.",
"Error parsing CDATA.",
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
};

File diff suppressed because it is too large Load Diff

View File

@ -1647,6 +1647,34 @@
>
</File>
</Filter>
<Filter
Name="tinyxml"
>
<File
RelativePath="..\utils\tinyxml\tinystr.cpp"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinystr.h"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxml.cpp"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxml.h"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxmlerror.cpp"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxmlparser.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="addons"

View File

@ -1249,6 +1249,34 @@
>
</File>
</Filter>
<Filter
Name="tinyxml"
>
<File
RelativePath="..\utils\tinyxml\tinystr.cpp"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinystr.h"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxml.cpp"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxml.h"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxmlerror.cpp"
>
</File>
<File
RelativePath="..\utils\tinyxml\tinyxmlparser.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="metaspu"

View File

@ -5010,6 +5010,44 @@ DOKEYDOWN:
NDS_UnPause();
return 0;
}
case IDM_FILE_IMPORT_DB:
{
OPENFILENAME ofn;
NDS_Pause();
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "ADVANsCEne database (XML)\0*.xml;\0";
ofn.nFilterIndex = 1;
ofn.lpstrFile = ImportSavName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "xml";
ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
char buffer[MAX_PATH];
ZeroMemory(buffer, sizeof(buffer));
strcpy(buffer, path.pathToModule);
ofn.lpstrInitialDir = buffer;
strcat(buffer, "desmume.ddb");
advsc.setDatabase(buffer);
if(!GetOpenFileName(&ofn))
{
NDS_UnPause();
return 0;
}
u32 count = advsc.convertDB(ImportSavName);
if (count > 0)
{
sprintf(buffer, "ADVANsCEne database was successfully imported\n(%i records)", count);
MessageBox(hwnd,buffer,"DeSmuME",MB_OK|MB_ICONINFORMATION);
}
else
MessageBox(hwnd,"ADVANsCEne database was not successfully imported","DeSmuME",MB_OK|MB_ICONERROR);
NDS_UnPause();
return 0;
}
case IDM_CONFIG:

View File

@ -883,6 +883,7 @@
#define ID_FILTRI_HQ4X 40092
#define ID_40093 40093
#define IDM_SLOT1 40097
#define IDM_FILE_IMPORT_DB 40103
#define IDC_LABEL_UP 50000
#define IDC_LABEL_RIGHT 50001
#define IDC_LABEL_LEFT 50002

Binary file not shown.