From 322e1575b77f43715607a73dabfcd831ac35f7a5 Mon Sep 17 00:00:00 2001 From: dborth Date: Thu, 3 Feb 2011 03:09:49 +0000 Subject: [PATCH] enable SMB on GameCube (thanks Extrems!) --- Makefile.gc | 2 +- source/filebrowser.cpp | 18 +++++++++--------- source/fileop.cpp | 2 -- source/menu.cpp | 14 -------------- source/networkop.cpp | 28 +++++++++++----------------- 5 files changed, 21 insertions(+), 43 deletions(-) diff --git a/Makefile.gc b/Makefile.gc index 23c20fd..d3a870b 100644 --- a/Makefile.gc +++ b/Makefile.gc @@ -39,7 +39,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lpng -lmxml -lfat -liso9660 -lz -logc -lfreetype +LIBS := -lpng -lmxml -ltinysmb -lbba -lfat -liso9660 -lz -logc -lfreetype #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/source/filebrowser.cpp b/source/filebrowser.cpp index 5338c19..15da614 100644 --- a/source/filebrowser.cpp +++ b/source/filebrowser.cpp @@ -579,15 +579,6 @@ int BrowserChangeFolder() browserList[i].isdir = 1; browserList[i].icon = ICON_USB; i++; - - AddBrowserEntry(); - sprintf(browserList[i].filename, "smb:/"); - sprintf(browserList[i].displayname, "Network Share"); - browserList[i].length = 0; - browserList[i].mtime = 0; - browserList[i].isdir = 1; - browserList[i].icon = ICON_SMB; - i++; #else AddBrowserEntry(); sprintf(browserList[i].filename, "carda:/"); @@ -607,6 +598,15 @@ int BrowserChangeFolder() browserList[i].icon = ICON_SD; i++; #endif + AddBrowserEntry(); + sprintf(browserList[i].filename, "smb:/"); + sprintf(browserList[i].displayname, "Network Share"); + browserList[i].length = 0; + browserList[i].mtime = 0; + browserList[i].isdir = 1; + browserList[i].icon = ICON_SMB; + i++; + AddBrowserEntry(); sprintf(browserList[i].filename, "dvd:/"); sprintf(browserList[i].displayname, "Data DVD"); diff --git a/source/fileop.cpp b/source/fileop.cpp index cd50bdd..47e1f77 100644 --- a/source/fileop.cpp +++ b/source/fileop.cpp @@ -413,11 +413,9 @@ bool ChangeInterface(int device, bool silent) case DEVICE_DVD: mounted = MountDVD(silent); break; -#ifdef HW_RVL case DEVICE_SMB: mounted = ConnectShare(silent); break; -#endif } return mounted; diff --git a/source/menu.cpp b/source/menu.cpp index 063caa1..9fa9227 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3227,11 +3227,7 @@ static int MenuSettings() w.Append(&titleTxt); w.Append(&savingBtn); w.Append(&menuBtn); - -#ifdef HW_RVL w.Append(&networkBtn); -#endif - w.Append(&backBtn); w.Append(&resetBtn); @@ -3403,14 +3399,6 @@ static int MenuSettingsFile() if(GCSettings.SaveMethod == DEVICE_DVD) GCSettings.SaveMethod++; - // disable SMB in GC mode (stalls out) - #ifdef HW_DOL - if(GCSettings.LoadMethod == DEVICE_SMB) - GCSettings.LoadMethod++; - if(GCSettings.SaveMethod == DEVICE_SMB) - GCSettings.SaveMethod++; - #endif - // don't allow SD Gecko on Wii #ifdef HW_RVL if(GCSettings.LoadMethod == DEVICE_SD_SLOTA) @@ -3663,7 +3651,6 @@ static int MenuSettingsMenu() static int MenuSettingsNetwork() { int menu = MENU_NONE; -#ifdef HW_RVL int ret; int i = 0; bool firstRun = true; @@ -3760,7 +3747,6 @@ static int MenuSettingsNetwork() mainWindow->Remove(&w); mainWindow->Remove(&titleTxt); CloseShare(); -#endif return menu; } diff --git a/source/networkop.cpp b/source/networkop.cpp index d3bf2aa..d0c0547 100644 --- a/source/networkop.cpp +++ b/source/networkop.cpp @@ -8,16 +8,6 @@ * Network and SMB support routines ****************************************************************************/ -#ifdef HW_DOL - -bool -ConnectShare (bool silent) -{ - return false; -} - -#else - #include #include #include @@ -40,6 +30,8 @@ static bool updateChecked = false; // true if checked for app update static char updateURL[128]; // URL of app update bool updateFound = false; // true if an app update was found +#ifdef HW_RVL + /**************************************************************************** * UpdateCheck * Checks for an update for the application @@ -270,11 +262,15 @@ void StopNetworkThread() networkthread = LWP_THREAD_NULL; } +#endif + bool InitializeNetwork(bool silent) { if(networkInit) { +#ifdef HW_RVL StopNetworkThread(); +#endif return true; } @@ -288,6 +284,8 @@ bool InitializeNetwork(bool silent) u64 start = gettime(); ShowAction("Initializing network..."); + +#ifdef HW_RVL StartNetworkThread(); while (!LWP_ThreadIsSuspended(networkthread)) @@ -297,6 +295,9 @@ bool InitializeNetwork(bool silent) if(diff_sec(start, gettime()) > 10) // wait for 10 seconds max for net init break; } +#else + networkInit = !(if_config(wiiIP, NULL, NULL, true) < 0); +#endif CancelAction(); @@ -323,11 +324,6 @@ void CloseShare() bool ConnectShare (bool silent) { - // Crashes or stalls system in GameCube mode - so disable - #ifndef HW_RVL - return false; - #endif - if(!InitializeNetwork(silent)) return false; @@ -377,5 +373,3 @@ ConnectShare (bool silent) return networkShareInit; } - -#endif