mirror of
https://github.com/suloku/gcmm.git
synced 2026-04-24 23:08:10 -05:00
Disabled Backup All mode and moved it to Backup Mode (press R or 2).
Similarly, now all savegames in MCBACKUP directory can be restored at one by pressing R or 2 in Restore Mode.
This commit is contained in:
parent
4952ad60a3
commit
4c660737eb
Binary file not shown.
|
|
@ -35,7 +35,8 @@ FT_Face face;
|
|||
FT_GlyphSlot slot;
|
||||
FT_UInt glyph_index;
|
||||
extern card_stat CardStatus;
|
||||
extern int cancel;
|
||||
extern int cancel;
|
||||
extern int doall;
|
||||
extern int mode;
|
||||
extern s32 MEM_CARD;
|
||||
extern u16 bannerdata[CARD_BANNER_W*CARD_BANNER_H] ATTRIBUTE_ALIGN (32);
|
||||
|
|
@ -418,8 +419,8 @@ int SelectMode ()
|
|||
VIDEO_WaitVSync ();
|
||||
}
|
||||
return 900;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HW_RVL
|
||||
if (WPAD_ButtonsHeld (0) & WPAD_BUTTON_A)
|
||||
{
|
||||
|
|
@ -486,14 +487,14 @@ int SelectMode ()
|
|||
}
|
||||
return 800;
|
||||
}
|
||||
|
||||
|
||||
if (WPAD_ButtonsHeld (0) & WPAD_BUTTON_2){//Format card mode
|
||||
while ((WPAD_ButtonsDown (0) & WPAD_BUTTON_B) || (WPAD_ButtonsDown (0) & WPAD_BUTTON_2))
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
}
|
||||
return 900;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (power)
|
||||
{
|
||||
|
|
@ -698,20 +699,20 @@ void showCardInfo(int sel){
|
|||
//START card image info START
|
||||
//put block 1 in cardheader
|
||||
SDLoadCardImageHeader((char*)filelist[sel]);
|
||||
|
||||
|
||||
//get the true serial
|
||||
u64 serial1[4];
|
||||
for (i=0;i<4;i++){
|
||||
memcpy(&serial1[i], (u8*)&cardheader+(8*i), sizeof(u64));
|
||||
}
|
||||
u64 serialA = serial1[0]^serial1[1]^serial1[2]^serial1[3];
|
||||
|
||||
|
||||
//get the flash ID
|
||||
getserial(imageserial);
|
||||
|
||||
|
||||
sprintf(txt, "Card image flash ID");
|
||||
DrawText(x, y, txt);
|
||||
y += 20;
|
||||
y += 20;
|
||||
|
||||
sprintf(txt, "%02X", imageserial[0]);
|
||||
for (i=1; i<11; i++){
|
||||
|
|
@ -720,7 +721,7 @@ void showCardInfo(int sel){
|
|||
}
|
||||
DrawText(x,y,txt);
|
||||
y+=20;
|
||||
|
||||
|
||||
sprintf(txt, "Serial N.: %016llX", serialA);
|
||||
DrawText(x,y,txt);
|
||||
y+=20;
|
||||
|
|
@ -734,10 +735,10 @@ void showCardInfo(int sel){
|
|||
|
||||
//In this call we mount the card, so we can later read the SRAM unscrambled flash ID
|
||||
u64 cardserialno = Card_SerialNo(MEM_CARD);
|
||||
|
||||
|
||||
sramex = __SYS_LockSramEx();
|
||||
__SYS_UnlockSramEx(0);
|
||||
|
||||
|
||||
if (!MEM_CARD)
|
||||
{
|
||||
sprintf(txt, "Slot A card flash ID:");
|
||||
|
|
@ -755,11 +756,11 @@ void showCardInfo(int sel){
|
|||
}
|
||||
DrawText(x,y,txt);
|
||||
y+=20;
|
||||
|
||||
|
||||
sprintf(txt, "Serial N.: %016llX", cardserialno);
|
||||
DrawText(x,y,txt);
|
||||
y+=20;
|
||||
|
||||
|
||||
sprintf(txt, "Size: %d blocks", (memsize*16)-5);
|
||||
DrawText(x,y,txt);
|
||||
//END real card info END
|
||||
|
|
@ -795,11 +796,11 @@ void showSaveInfo(int sel)
|
|||
// struct gci now contains header info
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Draw nice gradient background for banner and icon
|
||||
DrawBox (410, 163, 410+160, 163+39, getcolour (255,255,255));
|
||||
DrawBoxFilledGradient(412, 164, (410+159), (164+37), BLUECOL, PURPLECOL);
|
||||
|
||||
|
||||
//Show icon and banner
|
||||
if ((gci.banner_fmt&CARD_BANNER_MASK) == CARD_BANNER_RGB) {
|
||||
bannerloadRGB(bannerdata);
|
||||
|
|
@ -818,7 +819,7 @@ void showSaveInfo(int sel)
|
|||
else if ((gci.icon_fmt&CARD_ICON_MASK)== 2) {
|
||||
iconloadRGB(icondataRGB[0]);
|
||||
}
|
||||
|
||||
|
||||
/*** Display relevant info for this save ***/
|
||||
sprintf(txt, "#%d %s/%s", sel, gamecode, company);
|
||||
DrawText(x, y, txt);
|
||||
|
|
@ -829,7 +830,7 @@ void showSaveInfo(int sel)
|
|||
|
||||
char comment1[26];
|
||||
char comment2[6];
|
||||
|
||||
|
||||
//We go ahead and print the full 32byte comment lines - could go offscreen
|
||||
//but we like to live dangerously
|
||||
for (j = 0; j < 32; j++) {
|
||||
|
|
@ -840,7 +841,7 @@ void showSaveInfo(int sel)
|
|||
DrawText(x, y, comment1);
|
||||
y += 20;
|
||||
memset(comment1, 0, sizeof(comment1));
|
||||
|
||||
|
||||
for (j = 32; j < 64; j++) {
|
||||
if ((char)CommentBuffer[j] == 0 || (char)CommentBuffer[j] == 10) {break;}
|
||||
comment2[j-32] = (char)CommentBuffer[j];
|
||||
|
|
@ -856,7 +857,7 @@ void showSaveInfo(int sel)
|
|||
/*
|
||||
//Raw time display
|
||||
sprintf(txt, "D: %08X", t);
|
||||
DrawText(x, y, txt);
|
||||
DrawText(x, y, txt);
|
||||
y += 20;
|
||||
*/
|
||||
|
||||
|
|
@ -887,7 +888,7 @@ void showSaveInfo(int sel)
|
|||
year = I;
|
||||
month = J;
|
||||
day = K;
|
||||
|
||||
|
||||
sec = t % 60;
|
||||
t /= 60;
|
||||
min = t % 60;
|
||||
|
|
@ -959,7 +960,7 @@ static void ShowFiles (int offset, int selection, int upordown, int saveinfo) {
|
|||
DrawLineFast (35, 330, (j * 20) + (ypos - 14) + w, 0xff, 0xff, 0xff);
|
||||
}
|
||||
setfontcolour (28, 28, 28);
|
||||
DrawText (35, (j * 20) + ypos, text);
|
||||
DrawText (35, (j * 20) + ypos, text);
|
||||
setfontcolour (0xff, 0xff, 0xff);
|
||||
}
|
||||
else{
|
||||
|
|
@ -1054,8 +1055,8 @@ static void ShowFiles (int offset, int selection, int upordown, int saveinfo) {
|
|||
}
|
||||
}
|
||||
*/
|
||||
#ifdef DEBUG_VALUES
|
||||
static u8 CalculateFrameRate()
|
||||
#ifdef DEBUG_VALUES
|
||||
static u8 CalculateFrameRate()
|
||||
{
|
||||
static u8 frameCount = 0;
|
||||
static u32 lastTime;
|
||||
|
|
@ -1074,13 +1075,13 @@ static u8 CalculateFrameRate()
|
|||
int getdurationmilisecs(u16 icon_speed, int index)
|
||||
{
|
||||
int speed = ((icon_speed >> (2*index))&CARD_SPEED_MASK)*4;
|
||||
|
||||
|
||||
if(vmode_60hz){
|
||||
return 1000/(60/speed);
|
||||
}else{
|
||||
return 1000/(50/speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ShowSelector
|
||||
|
|
@ -1112,40 +1113,40 @@ int ShowSelector (int saveinfo)
|
|||
u8 fps = 0;
|
||||
char test[1024];
|
||||
#endif
|
||||
|
||||
|
||||
while (quit == 0)
|
||||
{
|
||||
|
||||
currtime = ticks_to_millisecs(gettime());
|
||||
#ifdef DEBUG_VALUES
|
||||
#ifdef DEBUG_VALUES
|
||||
fps = CalculateFrameRate();
|
||||
#endif
|
||||
if (redraw)
|
||||
{
|
||||
//clear buffers
|
||||
memset((u8*)bannerdata, 0, CARD_BANNER_W*CARD_BANNER_H);
|
||||
memset((u8*)bannerdata, 0, CARD_BANNER_W*CARD_BANNER_H*2);
|
||||
memset((u8*)bannerdataCI, 0, CARD_BANNER_W*CARD_BANNER_H);
|
||||
memset((u8*)icondata, 0, 8*1024);
|
||||
memset((u8*)icondataRGB, 0, 8*2048);
|
||||
memset((u8*)icondataRGB, 0, 8*1024*2);
|
||||
memset((u8*)tlut, 0, 9*512);
|
||||
memset((u8*)tlutbanner, 0, 512);
|
||||
|
||||
|
||||
ShowFiles (offset, selection, upordown, saveinfo);
|
||||
|
||||
|
||||
//reinit variables
|
||||
redraw = 0;
|
||||
reverse = 0;
|
||||
currframe = 1;
|
||||
lasttime = ticks_to_millisecs(gettime());
|
||||
|
||||
|
||||
}
|
||||
#ifdef DEBUG_VALUES
|
||||
#ifdef DEBUG_VALUES
|
||||
sprintf (test, "FPS%d numicons%d CF%d LF%d FT%d animtype%d speed%d", fps, numicons, currframe, lastframe, frametable[currframe], CHECK_BIT(gci.banner_fmt,2), ((gci.icon_speed >> (2*currframe))&CARD_SPEED_MASK)*4 );
|
||||
ShowAction(test);
|
||||
#endif
|
||||
|
||||
|
||||
if (numicons > 1){
|
||||
|
||||
|
||||
if((currtime - lasttime) >= getdurationmilisecs(gci.icon_speed, currframe) ){
|
||||
//If there's a real icon show it, if not just wait until next icon frame
|
||||
if (frametable[currframe]){
|
||||
|
|
@ -1161,7 +1162,7 @@ int ShowSelector (int saveinfo)
|
|||
}
|
||||
ShowScreen();
|
||||
}
|
||||
|
||||
|
||||
//Each bit pair in gci.icon_speed states for an icon's speed.
|
||||
//Blank bit pairs can be used to delay the animation
|
||||
//Check animation type (ping pong style if true)
|
||||
|
|
@ -1182,12 +1183,12 @@ int ShowSelector (int saveinfo)
|
|||
currframe = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lasttime = currtime;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
p = PAD_ButtonsDown (0);
|
||||
#ifdef HW_RVL
|
||||
wp = WPAD_ButtonsDown (0);
|
||||
|
|
@ -1201,7 +1202,18 @@ int ShowSelector (int saveinfo)
|
|||
offsetchanged = true;
|
||||
cancel = 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((p & PAD_TRIGGER_R)
|
||||
#ifdef HW_RVL
|
||||
| (wp & WPAD_BUTTON_1)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
doall = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HW_RVL
|
||||
if (power)
|
||||
{
|
||||
|
|
@ -1261,7 +1273,7 @@ int ShowSelector (int saveinfo)
|
|||
offset = 0;
|
||||
}
|
||||
redraw = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return selection;
|
||||
|
|
|
|||
BIN
source/gcbk.bmp
BIN
source/gcbk.bmp
Binary file not shown.
|
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 844 KiB |
176
source/main.c
176
source/main.c
|
|
@ -36,7 +36,9 @@
|
|||
|
||||
#define PSOSDLOADID 0x7c6000a6
|
||||
int mode;
|
||||
int cancel;
|
||||
int cancel;
|
||||
int doall;
|
||||
|
||||
/*** 2D Video Globals ***/
|
||||
GXRModeObj *vmode; /*** Graphics Mode Object ***/
|
||||
u32 *xfb[2] = { NULL, NULL }; /*** Framebuffers ***/
|
||||
|
|
@ -74,7 +76,7 @@ static int initFAT(int device)
|
|||
if (!__io_usbstorage.isInserted())
|
||||
{
|
||||
ShowAction ("No USB device inserted either!");
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
return 0;
|
||||
}
|
||||
else if (!fatMountSimple ("fat", &__io_usbstorage)){
|
||||
|
|
@ -116,7 +118,7 @@ static int initFAT(int device)
|
|||
ShowAction("Error Mounting USB fat!");
|
||||
sleep(1);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!device){
|
||||
|
|
@ -124,7 +126,7 @@ static int initFAT(int device)
|
|||
if (!__io_gcsda.isInserted())
|
||||
{
|
||||
ShowAction ("No SD Gecko inserted! Insert it in slot A please");
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
return 0;
|
||||
}
|
||||
if (!fatMountSimple ("fat", &__io_gcsda))
|
||||
|
|
@ -139,7 +141,7 @@ static int initFAT(int device)
|
|||
if (!__io_gcsdb.isInserted())
|
||||
{
|
||||
ShowAction ("No SD Gecko inserted! Insert it in slot B please");
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
return 0;
|
||||
}
|
||||
if (!fatMountSimple ("fat", &__io_gcsdb))
|
||||
|
|
@ -290,11 +292,19 @@ void SD_BackupMode ()
|
|||
{
|
||||
int memitems;
|
||||
int selected = 0;
|
||||
int bytestodo;
|
||||
int bytestodo;
|
||||
char buffer[256], text[64];
|
||||
|
||||
clearRightPane();
|
||||
DrawText(380,130,"B a c k u p M o d e");
|
||||
writeStatusBar("Pick a file using UP or DOWN ", "Press A to backup to SD Card ") ;
|
||||
writeStatusBar("Pick a file using UP or DOWN ", "Press A to backup to SD Card ") ;
|
||||
setfontsize (14);
|
||||
#ifdef HW_RVL
|
||||
DrawText(40, 60, "Press R/1 to backup ALL savegames");
|
||||
#else
|
||||
DrawText(40, 60, "Press R to backup ALL savegames");
|
||||
#endif
|
||||
|
||||
/*** Get the directory listing from the memory card ***/
|
||||
memitems = CardGetDirectory (MEM_CARD);
|
||||
|
||||
|
|
@ -309,6 +319,47 @@ void SD_BackupMode ()
|
|||
if (cancel)
|
||||
{
|
||||
WaitPrompt ("Backup action cancelled!");
|
||||
}
|
||||
else if(doall)
|
||||
{
|
||||
doall = WaitPromptChoice("Are you sure you want to backup all files?", "No", "Yes");
|
||||
if (doall)
|
||||
{
|
||||
//Backup All files
|
||||
for ( selected = 0; selected < memitems; selected++ ) {
|
||||
/*** Backup files ***/
|
||||
sprintf(buffer, "[%d/%d] Reading from MC slot %s", selected+1, memitems, (MEM_CARD) ? "B" : "A");
|
||||
ShowAction(buffer);
|
||||
bytestodo = CardReadFile(MEM_CARD, selected);
|
||||
if (bytestodo)
|
||||
{
|
||||
sprintf(buffer, "[%d/%d] Saving to SD card", selected+1, memitems);
|
||||
ShowAction(buffer);
|
||||
if (!SDSaveMCImage())
|
||||
{
|
||||
strncpy(text, (char*)filelist[selected], 32);
|
||||
text[32]='\0';
|
||||
sprintf(buffer, "Error during backup (%s). Continue?", text);
|
||||
doall = WaitPromptChoice(buffer, "Yes", "No");
|
||||
if (doall)
|
||||
{
|
||||
WaitPrompt ("Backup action cancelled due to error!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Error reading MC file");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WaitPrompt("Full card backup done!");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -320,22 +371,24 @@ void SD_BackupMode ()
|
|||
ShowAction ("Saving to SD CARD");
|
||||
if (SDSaveMCImage())
|
||||
{
|
||||
WaitPrompt ("Backup complete");
|
||||
WaitPrompt ("Backup complete");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Backup failed");
|
||||
WaitPrompt ("Backup failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Error reading MC file");
|
||||
WaitPrompt ("Error reading MC file");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -349,7 +402,7 @@ void SD_BackupModeAllFiles ()
|
|||
int memitems;
|
||||
int selected = 0;
|
||||
int bytestodo;
|
||||
|
||||
|
||||
char buffer[128];
|
||||
|
||||
clearRightPane();
|
||||
|
|
@ -382,7 +435,7 @@ void SD_BackupModeAllFiles ()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WaitPrompt("Full card backup done!");
|
||||
}
|
||||
}
|
||||
|
|
@ -397,25 +450,72 @@ void SD_BackupModeAllFiles ()
|
|||
void SD_RestoreMode ()
|
||||
{
|
||||
int files;
|
||||
int selected;
|
||||
int selected;
|
||||
char buffer[256], text[64];
|
||||
|
||||
clearRightPane();
|
||||
DrawText(380,130,"R e s t o r e M o d e");
|
||||
writeStatusBar("Pick a file using UP or DOWN", "Press A to restore to Memory Card ") ;
|
||||
writeStatusBar("Pick a file using UP or DOWN", "Press A to restore to Memory Card ") ;
|
||||
setfontsize (14);
|
||||
#ifdef HW_RVL
|
||||
DrawText(40, 60, "Press R/1 to restore ALL savegames");
|
||||
#else
|
||||
DrawText(40, 60, "Press R to restore ALL savegames");
|
||||
#endif
|
||||
|
||||
|
||||
files = SDGetFileList (1);
|
||||
if (!files)
|
||||
{
|
||||
WaitPrompt ("No saved games in SD Card to restore !");
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
{
|
||||
selected = ShowSelector (1);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
WaitPrompt ("Restore action cancelled !");
|
||||
}
|
||||
WaitPrompt ("Restore action cancelled !");
|
||||
return;
|
||||
}
|
||||
else if (doall)
|
||||
{
|
||||
doall = WaitPromptChoice("Are you sure you want to restore -ALL- files?", "Yes", "No");
|
||||
if (!doall)
|
||||
{
|
||||
//Restore All files
|
||||
for ( selected = 0; selected < files; selected++ ) {
|
||||
/*** Restore files ***/
|
||||
sprintf(buffer, "[%d/%d] Reading from SD card", selected+1, files);
|
||||
ShowAction(buffer);
|
||||
if (SDLoadMCImage ((char*)filelist[selected]))
|
||||
{
|
||||
sprintf(buffer, "[%d/%d] Saving to MC slot %s", selected+1, files, (MEM_CARD) ? "B" : "A");
|
||||
ShowAction(buffer);
|
||||
if (!CardWriteFile (MEM_CARD))
|
||||
{
|
||||
strncpy(text, (char*)filelist[selected], 32);
|
||||
text[32]='\0';
|
||||
sprintf(buffer, "Error during restore (%s). Continue?", text);
|
||||
doall = WaitPromptChoice(buffer, "Yes", "No");
|
||||
if (doall)
|
||||
{
|
||||
WaitPrompt ("Restore action cancelled due to error!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Error reading image");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WaitPrompt("Full card restore done!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowAction ("Reading from SD Card");
|
||||
|
|
@ -424,21 +524,24 @@ void SD_RestoreMode ()
|
|||
ShowAction ("Updating Memory Card");
|
||||
if (CardWriteFile (MEM_CARD))
|
||||
{
|
||||
WaitPrompt ("Restore Complete");
|
||||
WaitPrompt ("Restore Complete");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Error during restore");
|
||||
WaitPrompt ("Error during restore");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WaitPrompt ("Error reading image");
|
||||
WaitPrompt ("Error reading image");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -459,7 +562,7 @@ void SD_RawBackupMode ()
|
|||
sprintf(msg, "Backup complete! Wrote %d bytes to SD",writen);
|
||||
WaitPrompt(msg);
|
||||
}else{
|
||||
|
||||
|
||||
WaitPrompt("Backup failed!");
|
||||
}
|
||||
|
||||
|
|
@ -482,7 +585,7 @@ void SD_RawRestoreMode ()
|
|||
DrawText(380,130,"R A W R e s t o r e");
|
||||
DrawText(450,150,"M o d e");
|
||||
writeStatusBar("Pick a file using UP or DOWN", "Press A to restore to Memory Card ");
|
||||
|
||||
|
||||
files = SDGetFileList (0);
|
||||
if (!files)
|
||||
{
|
||||
|
|
@ -550,10 +653,11 @@ int main ()
|
|||
ClearScreen();
|
||||
setfontsize (FONT_SIZE);
|
||||
freecardbuf();
|
||||
cancel = 0;/******a global value to track action aborted by user pressing button B********/
|
||||
cancel = 0;/******a global value to track action aborted by user pressing button B********/
|
||||
doall = 0;
|
||||
mode = SelectMode ();
|
||||
#ifdef HW_RVL
|
||||
if ((mode != 500 ) && (mode != 100)){
|
||||
#ifdef HW_RVL
|
||||
if ((mode != 500 ) && (mode != 100) && (mode != 600)){
|
||||
if (WaitPromptChoice ("Please select a memory card slot", "Slot B", "Slot A") == 1)
|
||||
{
|
||||
MEM_CARD = CARD_SLOTA;
|
||||
|
|
@ -595,8 +699,10 @@ int main ()
|
|||
#endif
|
||||
break; //PSO_Reload
|
||||
case 600 : //User wants to backup full card
|
||||
/*
|
||||
if (have_sd) SD_BackupModeAllFiles();
|
||||
else WaitPrompt("Reboot aplication with an SD card");
|
||||
else WaitPrompt("Reboot aplication with an SD card");
|
||||
*/
|
||||
break;
|
||||
case 700 : //Raw backup mode
|
||||
if (have_sd)
|
||||
|
|
@ -611,31 +717,31 @@ int main ()
|
|||
case 800 : //Raw restore mode
|
||||
//These two lines are a work around for the second call of CARD_Probe to detect a newly inserted memory card
|
||||
CARD_Probe(MEM_CARD);
|
||||
VIDEO_WaitVSync ();
|
||||
VIDEO_WaitVSync ();
|
||||
if (CARD_Probe(MEM_CARD) > 0)
|
||||
{
|
||||
if (have_sd) SD_RawRestoreMode();
|
||||
else WaitPrompt("Reboot aplication with an SD card");
|
||||
|
||||
|
||||
}else if (MEM_CARD)
|
||||
{
|
||||
WaitPrompt("Please insert a memory card in slot B");
|
||||
}else
|
||||
{
|
||||
WaitPrompt("Please insert a memory card in slot A");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 900 : //Format card mode
|
||||
//These two lines are a work around for the second call of CARD_Probe to detect a newly inserted memory card
|
||||
CARD_Probe(MEM_CARD);
|
||||
VIDEO_WaitVSync ();
|
||||
VIDEO_WaitVSync ();
|
||||
if (CARD_Probe(MEM_CARD) > 0)
|
||||
{
|
||||
DrawText(70, 230, "F o r m a t C a r d");
|
||||
DrawText(150, 250, "M o d e");
|
||||
clearRightPane();
|
||||
MC_FormatMode(MEM_CARD);
|
||||
|
||||
|
||||
}else if (MEM_CARD)
|
||||
{
|
||||
WaitPrompt("Please insert a memory card in slot B");
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ int SDSaveMCImage ()
|
|||
mkdir(filename, S_IREAD | S_IWRITE);
|
||||
|
||||
sprintf (filename, "fat:/%s/%s-%s-%s_%02d.gci", MCSAVES, company, gamecode, tfile, filenumber);
|
||||
|
||||
|
||||
//Lets try if there's already a savegame (if it exists its name is legal, so theoretically the illegal name check will pass
|
||||
//Illegal savegame should report as nonexisting...
|
||||
//We will number the files
|
||||
|
|
@ -125,7 +125,7 @@ int SDSaveMCImage ()
|
|||
//SDCARD_CloseFile (handle);
|
||||
fwrite (FileBuffer , 1 , bytesToWrite , handle );
|
||||
fclose (handle);
|
||||
|
||||
|
||||
// check if file actually wrote correctly
|
||||
handle = fopen ( filename , "rb" );
|
||||
if (handle <= 0)
|
||||
|
|
@ -142,15 +142,15 @@ int SDSaveMCImage ()
|
|||
// ... this will end in an endless loop if the file to write is 0 bytes but that's very unlikely
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//Try 10 times if needed, then give up. Better to avoid endless looping
|
||||
if (retries > 9)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ int SDLoadMCImageHeader(char *sdfilename)
|
|||
}
|
||||
|
||||
ExtractGCIHeader();
|
||||
#ifdef STATUSOGC
|
||||
#ifdef STATUSOGC
|
||||
GCIMakeHeader();
|
||||
#else
|
||||
//Let's get the full header as is, instead of populating it...
|
||||
|
|
@ -417,22 +417,22 @@ int SDLoadMCImageHeader(char *sdfilename)
|
|||
//this stores if the frame has a real icon or not
|
||||
//no need to clear all values since we will only use the ones until last frame
|
||||
frametable[i] = 0;
|
||||
|
||||
|
||||
//Animation speed is mandatory to be set even for a single icon
|
||||
//When a speed is 0 there are no more icons
|
||||
//Some games may have bits set after the "blank icon" both in
|
||||
//speed (Baten Kaitos) and format (Wario Ware Inc.) bytes, which are just garbage
|
||||
if (!(check_speed&CARD_ICON_MASK)){
|
||||
break;
|
||||
break;
|
||||
}else
|
||||
{//We've got a frame
|
||||
lastframe=i;
|
||||
|
||||
|
||||
if (check_fmt & CARD_ICON_MASK){
|
||||
//count the number of real icons
|
||||
numicons++;
|
||||
frametable[i]=1; //There's a real icon
|
||||
|
||||
|
||||
//CI with shared palette
|
||||
if ((check_fmt&CARD_ICON_MASK) == 1) {
|
||||
fread(icondata[i], 1, 1024, handle);
|
||||
|
|
@ -451,7 +451,7 @@ int SDLoadMCImageHeader(char *sdfilename)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
check_fmt = check_fmt >> 2;
|
||||
check_speed = check_speed >> 2;
|
||||
}
|
||||
|
|
@ -521,7 +521,7 @@ int SDLoadCardImageHeader(char *sdfilename)
|
|||
|
||||
/*** Close the file ***/
|
||||
fclose (handle);
|
||||
|
||||
|
||||
return bytesToRead;
|
||||
}
|
||||
|
||||
|
|
@ -608,7 +608,7 @@ int SDGetFileList(int mode)
|
|||
dirtype = ((isdir_sd(namefile) == 1) ? DIRENT_T_DIR : DIRENT_T_FILE);
|
||||
|
||||
filecount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
source/wiibk.bmp
BIN
source/wiibk.bmp
Binary file not shown.
|
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 844 KiB |
Loading…
Reference in New Issue
Block a user