- fix string parsing for two consecutive newline chars

- fix missing string output under various conditions
- add "extra" field to version in title string (alpha/beta/rc/...)
- don't force reboot after working on a GBA game
- some updates to instruction file
- delete pnps file, which is not a part of the code
(I hope this is all that was changed. Tried to fix one final bug, didn't work, tried to revert everything that did not work.)
This commit is contained in:
msiewert76@gmail.com 2011-08-07 14:53:26 +00:00
parent 0be609e24c
commit 6155c6d59f
13 changed files with 60 additions and 29 deletions

View File

@ -37,14 +37,13 @@ Version 0.2.4 (4-10-2011)
- Program now makes use of lower screen for most messages, which allows longer, more detailled messages.
- Adds a Readme file/Manual to the program.
Version 0.3 (6-??-2011)
Version 0.3.0 RC1 (8-??-2011)
This is the first non-beta, feature complete release.
- Adds the ability to translate most parts of the user interface.
- Adds Slot 2 backup mode (you will need a Slot 2 flash card; anything that has a DLDI driver should be supported).
- Enables FTP restore mode for saves bigger than the memory buffer (usually 2 MB).
- Fixes FTP mode so that multiple transactions are possible without restarting.
- Various stability fixes.
- Many behind-the scenes improvements aimed to simplify further hacking.
- Instruction file is no longer beta.

View File

@ -28,3 +28,6 @@ A small library for parsing ini files. Mostly untouched.
- *.i
- ini.cpp
Debug target:
I have finally added a debug build target, which prints some additional information on the screen. You should never need it, but one never knows. Since my skills at writing makefiles su... erm... could be better, you will need to run a "make clean" before running "make debug". If you want to add additional debug output without having to worry about removing it on a new release, just add an "#ifdef DEBUG ... #endif" block around your debug code.

View File

@ -57,7 +57,7 @@ void displayInit()
void displayTitle()
{
displayMessageF(STR_TITLE_MSG, VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO);
displayMessageF(STR_TITLE_MSG, VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO, VERSION_EXTRA);
displayStateF(STR_STR, "Press (B) to continue");
while (!(keysCurrent() & KEY_B));
@ -349,7 +349,7 @@ char *ParseLine(char *start, const char *end, int &length)
while (start < end) {
if (*start == '\n') {
length = 1;
length = 0;
return start;
}

View File

@ -204,6 +204,12 @@ void gbaEepromRead8Bytes(u8 *out, u32 addr, bool short_addr = false)
buf[15] = addr;
buf[16] = 0;
}
for (int i = 0; i < 17; i++) {
if (buf[i])
buf[i] = 255;
else
buf[i] = 0;
}
static u32 eeprom = 0x09ffff00;
@ -491,7 +497,6 @@ bool gbaWriteSave(u32 dst, u8 *src, u32 len, u8 type)
// FIXME: currently, you can only write "all or nothing"
nbanks = 2;
for (int j = 0; j < nbanks; j++) {
displayStateF(STR_STR, "Switching Bank.");
*(u8*)0x0a005555 = 0xaa;
swiDelay(10);
*(u8*)0x0a002aaa = 0x55;

View File

@ -32,6 +32,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_MICRO 0
#define VERSION_EXTRA "rc1"
extern u8 *data;
extern u32 size_buf;

View File

@ -509,6 +509,7 @@ void hwBackupSlot2()
uint8 type = auxspi_save_type(slot_1_type);
// just select a filename, no extra work required!
displayMessageF(STR_HW_SELECT_FILE_OW);
char path[256];
char fname[256] = "";
fileSelect("/", path, fname, 0, true, false);
@ -568,7 +569,6 @@ void hwRestoreSlot2()
fileSelect("/", path, fname, 0, false, false);
char msg[256];
// This does not have to be translated.
// FIXME: make this more meaningful!
sprintf(msg, "%s/%s", path, fname);
FILE *file = fopen(msg, "rb");
@ -616,7 +616,9 @@ void hwRestoreSlot2()
}
// ------------------------------------------------------------
void hwLoginFTP(netbuf **buf)
static netbuf *buf = NULL;
void hwLoginFTP()
{
int j;
static int jmax = 10;
@ -629,7 +631,7 @@ void hwLoginFTP(netbuf **buf)
displayMessage2F(STR_HW_FTP_SEEK_FTP);
sprintf(txt, "%s:%i", ftp_ip, ftp_port);
j = 0;
while (!FtpConnect(txt, buf)) {
while (!FtpConnect(txt, &buf)) {
j++;
if (j >= jmax) {
displayWarning2F(STR_HW_FTP_ERR_FTP);
@ -639,7 +641,7 @@ void hwLoginFTP(netbuf **buf)
}
displayMessage2F(STR_HW_FTP_LOGIN);
j = 0;
while (!FtpLogin(ftp_user, ftp_pass, *buf)) {
while (!FtpLogin(ftp_user, ftp_pass, buf)) {
j++;
if (j >= jmax) {
displayWarning2F(STR_HW_FTP_ERR_LOGIN);
@ -652,7 +654,7 @@ void hwLoginFTP(netbuf **buf)
void hwBackupFTP(bool dlp)
{
netbuf *buf, *ndata;
netbuf *ndata;
// Dump save and write it to FTP server
// First: swap card
@ -669,7 +671,7 @@ void hwBackupFTP(bool dlp)
// Second: connect to FTP server
if (!ftp_active)
hwLoginFTP(&buf);
hwLoginFTP();
char fdir[256] = "";
char fname[256] ="";
@ -704,6 +706,7 @@ void hwBackupFTP(bool dlp)
sprintf(fname, "%.12s.%i.sav", nds.gameTitle, cnt);
}
}
displayMessage2F(STR_HW_WRITE_FILE, fname);
// Fourth: dump save
displayStateF(STR_EMPTY);
@ -720,19 +723,19 @@ void hwBackupFTP(bool dlp)
if (delta == 0) {
displayMessage2F(STR_HW_FTP_READ_ONLY);
} else {
displayMessage2F(STR_EMPTY);
displayMessage2F(STR_HW_WRITE_FILE, fname);
}
if (delta < length) {
displayStateF(STR_HW_FTP_SLOW);
} else {
displayStateF(STR_EMPTY);
displayMessage2F(STR_HW_WRITE_FILE, fname);
}
}
}
FtpCloseAccess(buf, ndata);
FtpQuit(buf);
//FtpQuit(buf);
Wifi_DisconnectAP();
//Wifi_DisconnectAP();
if (dlp) {
displayMessage2F(STR_HW_PLEASE_REBOOT);
@ -800,12 +803,12 @@ bool hwRestoreFTPPartial(u32 ofs, u32 size, u32 type, netbuf *ndata)
void hwRestoreFTP(bool dlp)
{
netbuf *buf, *ndata;
netbuf *ndata;
// Dump save and write it to FTP server
// First: connect to FTP server
if (ftp_active)
hwLoginFTP(&buf);
if (!ftp_active)
hwLoginFTP();
// Second: select a filename
char fdir[256] = "";
@ -838,9 +841,9 @@ void hwRestoreFTP(bool dlp)
hwRestoreFTPPartial(i << len_block, len_block, type, ndata);
}
FtpClose(ndata);
FtpQuit(buf);
//FtpQuit(buf);
Wifi_DisconnectAP();
//Wifi_DisconnectAP();
if (dlp) {
displayMessage2F(STR_HW_PLEASE_REBOOT);
@ -856,7 +859,7 @@ void hwBackupGBA(u8 type)
{
if ((type == 0) || (type > 5))
return;
if ((type == 1) || (type == 2)) {
// This is not to be translated, it will be removed at some point.
displayMessageF(STR_STR, "I can't read this save type\nyet. Please use Rudolphs tool\ninstead.");
@ -895,7 +898,7 @@ void hwBackupGBA(u8 type)
fclose(file);
displayStateF(STR_STR, "Done!");
while(1);
//while(1);
}
void hwRestoreGBA()
@ -931,8 +934,11 @@ void hwRestoreGBA()
displayMessage2F(STR_HW_WRITE_GAME);
gbaWriteSave(0, data, size, type);
displayStateF(STR_STR, "Done!");
/*
displayMessage2F(STR_HW_PLEASE_REBOOT);
while(1);
*/
}
void hwEraseGBA()
@ -940,8 +946,13 @@ void hwEraseGBA()
u8 type = gbaGetSaveType();
if ((type == 0) || (type > 5))
return;
displayMessage2F(STR_HW_WARN_DELETE);
while (!(keysCurrent() & (KEY_UP | KEY_R | KEY_Y))) {};
gbaFormatSave(type);
displayMessage2F(STR_HW_DID_DELETE);
while (1);
}
// -------------------------------------------------

View File

@ -57,6 +57,9 @@ using std::max;
char bootdir[256] = "/";
#define REBOOT_WIFI
// ============================================================================
void mode_dsi()
{
@ -197,18 +200,21 @@ void mode_gba()
if ((touchXY.py > 8*0) && (touchXY.py < 8*8)) {
displayPrintUpper();
hwBackupGBA(gbatype);
displayPrintLower();
}
// restore
if ((touchXY.py > 8*8) && (touchXY.py < 8*16)) {
displayPrintUpper();
hwRestoreGBA();
displayPrintLower();
}
// erase
if ((touchXY.py > 8*16) && (touchXY.py < 8*24)) {
displayPrintUpper();
hwEraseGBA();
displayPrintLower();
}
}
}
@ -228,12 +234,20 @@ void mode_wifi()
// backup
if ((touchXY.py > 8*0) && (touchXY.py < 8*8)) {
hwBackupFTP();
#ifdef REBOOT_WIFI
displayMessage2F(STR_HW_PLEASE_REBOOT);
while(1);
#endif
displayPrintLower();
}
// restore
if ((touchXY.py > 8*8) && (touchXY.py < 8*16)) {
hwRestoreFTP();
#ifdef REBOOT_WIFI
displayMessage2F(STR_HW_PLEASE_REBOOT);
while(1);
#endif
displayPrintLower();
}

View File

@ -62,7 +62,7 @@ bool stringsLoadFile(const char *fname)
ADD_STRING(STR_STR, "%s");
//
ADD_STRING(STR_MM_WIPE,"\n WIPES OUT ALL SAVE DATA\n ON YOUR GAME !");
ADD_STRING(STR_TITLE_MSG,"DS savegame manager\nVersion 0.3.0\nBy Pokedoc");
ADD_STRING(STR_TITLE_MSG,"DS savegame manager\nVersion %i.%i.%i%s\nBy Pokedoc");
ADD_STRING(STR_BOOT_NO_INI,"Unable to open ini file!\nPlease make sure that it is\n1. in this apps folder, or"
"\n2. in the root folder\nIf 1. does not work, use 2.");
ADD_STRING(STR_BOOT_MODE_UNSUPPORTED,"This mode is DISABLED.\nPlease restart the system.");
@ -113,7 +113,6 @@ bool stringsLoadFile(const char *fname)
remove("/tmpfile");
// Convert manual newline commands added as plaintext in the translation file.
// FIXME: this does not seem to work reliably yet (or maybe it is the print function).
for (int i = 0; i < STR_LAST; i++) {
char *ptr = message_strings[i];
while ((ptr = strchr(ptr, '\\')) != NULL) {

View File

@ -6,7 +6,7 @@
# The strings "0" and "1" should never be used; they are internal stuff for "empty" and "untranslated" strings.
# 2-5: These are boot-time messages.
2=DS savegame manager\nVersion %i.%i.%i\nVon Pokedoc
2=DS savegame manager\nVersion %i.%i.%i %s\nVon Pokedoc
# This is an error message appearing when the ini file can not be found.
3=Kann die ini-Datei nicht finden!\nBitte kopiere sie entweder\n1. in den selben Ordner wie die nds Datei, oder\n2. in das Hauptverzeichnis.\nWenn 1. nicht funktioniert, musst Du 2. verwenden
# Thsis is an error message called when the system tries to enter a mode that is not supported yet (e.g. DSi mode)

View File

@ -9,7 +9,7 @@
# 2-5: These are boot-time messages.
# You do not need to translate 2 and 3, they only appear *before* this file is read. Since the format is frozen, I leave these slots in.
#2=DS savegame manager\nVersion %i.%i.%i\nBy Pokedoc
#2=DS savegame manager\nVersion %i.%i.%i %s\nBy Pokedoc
# This is an error message appearing when the ini file can not be found.
#3=Unable to open ini file!\nPlease make sure that it is\n1. in this apps folder, or\n2. in the root folder\nIf 1. does not work, use 2.
# Thsis is an error message called when the system tries to enter a mode that is not supported yet (e.g. DSi mode)

Binary file not shown.

View File

@ -1 +1 @@
<Project name="Savegame Manager"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="arm9" path="arm9\"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="build" path="build\"><File path=".map"></File><File path="auxspi.d"></File><File path="auxspi.o"></File><File path="display.d"></File><File path="display.o"></File><File path="dsCard.d"></File><File path="dsCard.o"></File><File path="dsi.d"></File><File path="dsi.o"></File><File path="fileselect.d"></File><File path="fileselect.o"></File><File path="ftplib.d"></File><File path="ftplib.o"></File><File path="gba.d"></File><File path="gba.o"></File><File path="globals.d"></File><File path="globals.o"></File><File path="hardware.d"></File><File path="hardware.o"></File><File path="ini.d"></File><File path="ini.o"></File><File path="main.d"></File><File path="main.o"></File><File path="strings.d"></File><File path="strings.o"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="debug" path="debug\"></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="source" path="source\"><File path="auxspi.cpp"></File><File path="auxspi.h"></File><File path="auxspi_core.inc"></File><File path="display.cpp"></File><File path="display.h"></File><File path="dsCard.cpp"></File><File path="dsCard.h"></File><File path="dsi.cpp"></File><File path="dsi.h"></File><File path="fileselect.cpp"></File><File path="fileselect.h"></File><File path="ftplib.c"></File><File path="ftplib.h"></File><File path="gba.cpp"></File><File path="gba.h"></File><File path="globals.cpp"></File><File path="globals.h"></File><File path="hardware.cpp"></File><File path="hardware.h"></File><File path="headings.i"></File><File path="ini.cpp"></File><File path="ini.h"></File><File path="iniconfig.h"></File><File path="iniheadings.h"></File><File path="inikeys.h"></File><File path="inilist.h"></File><File path="keys.i"></File><File path="libini.h"></File><File path="list.i"></File><File path="main.cpp"></File><File path="strings.cpp"></File><File path="strings.h"></File><File path="types.i"></File></MagicFolder><File path="Makefile"></File><File path="Makefile.debug"></File><File path="savegame_manager-debug.elf"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="arm7" path="arm7\"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="build" path="build\"><File path=".map"></File><File path="arm7.d"></File><File path="arm7.o"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="debug" path="debug\"></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="source" path="source\"><File path="arm7.c"></File></MagicFolder><File path="Makefile"></File><File path="Makefile.debug"></File><File path="savegame_manager-debug.elf"></File></MagicFolder><File path="Makefile"></File></Project>
<Project name="Savegame Manager"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="arm9" path="arm9\"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="build" path="build\"><File path=".map"></File><File path="auxspi.d"></File><File path="auxspi.o"></File><File path="display.d"></File><File path="display.o"></File><File path="dsCard.d"></File><File path="dsCard.o"></File><File path="dsi.d"></File><File path="dsi.o"></File><File path="fileselect.d"></File><File path="fileselect.o"></File><File path="ftplib.d"></File><File path="ftplib.o"></File><File path="gba.d"></File><File path="gba.o"></File><File path="globals.d"></File><File path="globals.o"></File><File path="hardware.d"></File><File path="hardware.o"></File><File path="ini.d"></File><File path="ini.o"></File><File path="main.d"></File><File path="main.o"></File><File path="strings.d"></File><File path="strings.o"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="debug" path="debug\"></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="source" path="source\"><File path="auxspi.cpp"></File><File path="auxspi.h"></File><File path="auxspi_core.inc"></File><File path="display.cpp"></File><File path="display.h"></File><File path="dsCard.cpp"></File><File path="dsCard.h"></File><File path="dsi.cpp"></File><File path="dsi.h"></File><File path="fileselect.cpp"></File><File path="fileselect.h"></File><File path="ftplib.c"></File><File path="ftplib.h"></File><File path="gba.cpp"></File><File path="gba.h"></File><File path="globals.cpp"></File><File path="globals.h"></File><File path="hardware.cpp"></File><File path="hardware.h"></File><File path="headings.i"></File><File path="ini.cpp"></File><File path="ini.h"></File><File path="iniconfig.h"></File><File path="iniheadings.h"></File><File path="inikeys.h"></File><File path="inilist.h"></File><File path="keys.i"></File><File path="libini.h"></File><File path="list.i"></File><File path="main.cpp"></File><File path="strings.cpp"></File><File path="strings.h"></File><File path="types.i"></File></MagicFolder><File path="Makefile"></File><File path="Makefile.debug"></File><File path="savegame_manager.elf"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="arm7" path="arm7\"><MagicFolder excludeFolders="CVS;.svn" filter="*" name="build" path="build\"><File path=".map"></File><File path="arm7.d"></File><File path="arm7.o"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="debug" path="debug\"></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*" name="source" path="source\"><File path="arm7.c"></File></MagicFolder><File path="Makefile"></File><File path="Makefile.debug"></File><File path="savegame_manager.elf"></File></MagicFolder><File path="Makefile"></File></Project>

View File

@ -1 +0,0 @@
<pd><ViewState><e p="Savegame Manager\arm7" x="false"></e><e p="Savegame Manager\arm9" x="true"></e><e p="Savegame Manager" x="true"></e><e p="Savegame Manager\arm9\build" x="false"></e><e p="Savegame Manager\arm9\source" x="true"></e></ViewState></pd>