From 05446c52035ab45dc6908414788a8838206ddcf0 Mon Sep 17 00:00:00 2001 From: dborth Date: Sat, 4 Oct 2008 02:37:54 +0000 Subject: [PATCH] DVD fixed! --- source/ngc/menu.cpp | 20 ++++++++++++-------- source/ngc/smbop.cpp | 12 ++++++++++-- source/ngc/smbop.h | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 8708e3f..d1ae36b 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -695,14 +695,18 @@ MainMenu (int selectedMenu) } } - /*** Remove any still held buttons ***/ - #ifdef HW_RVL - while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) ) - VIDEO_WaitVSync(); - #else - while( PAD_ButtonsHeld(0) ) - VIDEO_WaitVSync(); - #endif + // Wait for buttons to be released + int count = 0; // how long we've been waiting for the user to release the button + while(count < 50 && ( + PAD_ButtonsHeld(0) + #ifdef HW_RVL + || WPAD_ButtonsHeld(0) + #endif + )) + { + VIDEO_WaitVSync(); + count++; + } StartAudio(); mftb(&end); diff --git a/source/ngc/smbop.cpp b/source/ngc/smbop.cpp index bcde360..88457e9 100644 --- a/source/ngc/smbop.cpp +++ b/source/ngc/smbop.cpp @@ -234,8 +234,15 @@ LoadSMBFile (char * rom, int length) /**************************************************************************** * Write savebuffer to SMB file ****************************************************************************/ +// no buffer specified, use savebuffer int SaveBufferToSMB (char *filepath, int datasize, bool silent) +{ + return SaveBufferFromSMB(savebuffer, filepath, datasize, silent); +} + +int +SaveBufferToSMB (char * sbuffer, char *filepath, int datasize, bool silent) { if(!ConnectShare (NOTSILENT)) return 0; @@ -255,10 +262,10 @@ SaveBufferToSMB (char *filepath, int datasize, bool silent) { if (dsize > 1024) wrote = - SMB_WriteFile ((char *) savebuffer + boffset, 1024, boffset, smbfile); + SMB_WriteFile ((char *) sbuffer + boffset, 1024, boffset, smbfile); else wrote = - SMB_WriteFile ((char *) savebuffer + boffset, dsize, boffset, smbfile); + SMB_WriteFile ((char *) sbuffer + boffset, dsize, boffset, smbfile); boffset += wrote; dsize -= wrote; @@ -271,6 +278,7 @@ SaveBufferToSMB (char *filepath, int datasize, bool silent) sprintf(msg, "Couldn't save SMB: %s", SMBPath(filepath)); WaitPrompt (msg); } + return boffset; } diff --git a/source/ngc/smbop.h b/source/ngc/smbop.h index 0cebe4d..c4dd586 100644 --- a/source/ngc/smbop.h +++ b/source/ngc/smbop.h @@ -21,5 +21,5 @@ int LoadSMBFile (char * fbuffer, int length); int LoadBufferFromSMB (char *filepath, bool silent); int LoadBufferFromSMB (char * sbuffer, char *filepath, int length, bool silent); int SaveBufferToSMB (char *filepath, int datasize, bool silent); - +int SaveBufferToSMB (char * sbuffer, char *filepath, int datasize, bool silent); #endif