#NoTrayIcon
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=beta
#AutoIt3Wrapper_icon=Logo.ico
#AutoIt3Wrapper_outfile=WiiFlow Installer v1.0.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=WiiFlow Installer
#AutoIt3Wrapper_Res_Description=WiiFlow Installer
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_ProductVersion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2009 - © 2012 Spayrosam (Samir.L)
#AutoIt3Wrapper_Res_Field=CompanyName|Spayrosam
#AutoIt3Wrapper_Res_Field=ProductName|WiiFlow Installer
#AutoIt3Wrapper_Res_Field=ProductVersion|1.0.0.0
#AutoIt3Wrapper_Res_Field=WiiFlow Installer|1.0.0.0
#AutoIt3Wrapper_Run_AU3Check=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Crypt.au3>
#include <Timers.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBoxEx.au3>
GUICreate("WiiFlow MOD Installer", 800, 80, -1, -1)
$DBTN = GUICtrlCreateButton("Download", 20, 5, 120, 25)
GUICtrlCreateLabel("Language : ", 160, 5, 80, 20, $SS_CENTERIMAGE)
GUICtrlSetFont(-1, 10)
$HomebrewTypeBootDOLLanguage = GUICtrlCreateCombo("", 230, 5, 65, 20, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData($HomebrewTypeBootDOLLanguage, "EN|FR|DE|ES|IT|NL|PT|RU|JA|KO|ZHCN|ZHTW", "EN")
GUICtrlCreateLabel("Transfered : ", 320, 5, 80, 20, $SS_CENTERIMAGE)
$HomebrewListViewTransferedUnformated = GUICtrlCreateLabel("0", 20, 40, 200, 20, $SS_CENTERIMAGE)
GUICtrlSetState(-1, $GUI_HIDE)
$HomebrewListViewTransfered = GUICtrlCreateLabel("00.00 B", 400, 5, 200, 20, $SS_CENTERIMAGE)
GUICtrlSetFont(-1, 12, 600)
GUICtrlSetColor(-1, 0x000FFF)
$State = GUICtrlCreateLabel("State", 20, 50, 740, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $DBTN
GUICtrlSetState($DBTN, $GUI_DISABLE)
GUICtrlSetData($HomebrewListViewTransfered, "00.00 B")
_CurrentUSBWiiflowURL(@ScriptDir, $State, 0)
GUICtrlSetState($DBTN, $GUI_ENABLE)
EndSwitch
WEnd
Func _CurrentUSBWiiflowURL($SaveCurrentUSBWiiflow, $CurrentUSBWiiflowState, $CurrentUSBWiiflow_ListN = -1)
$startGeneratetime = _Timer_Init()
Local $CurrentUSBWiiflowSize = 0, $ReturnCurrentUSBWiiflowURL = ""
FileDelete(@TempDir & "\USBWiiflowupdate.xml")
Local $hDownload = InetGet("http://code.google.com/p/open-wiiflow-mod/downloads/list", @TempDir & "\USBWiiflowupdate.xml", 1, 1) ;Download Header
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$GetCurrentUSBWiiflowURL = FileRead(@TempDir & "\USBWiiflowupdate.xml")
FileClose($GetCurrentUSBWiiflowURL)
FileDelete(@TempDir & "\USBWiiflowupdate.xml") ;Clean
$StringCurrentUSBWiiflowVersion = _splitInfo($GetCurrentUSBWiiflowURL, 'open\-wiiflow\-mod\.googlecode\.com\/files\/Wiiflow\_Mod([^*]*?)\.zip', 1)
$UpdateUSBWiiflowURL = "http://open-wiiflow-mod.googlecode.com/files/Wiiflow_Mod" & $StringCurrentUSBWiiflowVersion & ".zip"
FileDelete(@TempDir & "\SHA1ChecksumURL")
Local $hDownload = InetGet("http://code.google.com/p/open-wiiflow-mod/downloads/detail?name=" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1"), @TempDir & "\SHA1ChecksumURL", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$GetSHA1ChecksumURL = FileRead(@TempDir & "\SHA1ChecksumURL")
FileClose($GetSHA1ChecksumURL)
FileDelete(@TempDir & "\SHA1ChecksumURL") ;Clean
$StringSHA1ChecksumURL = _splitInfo($GetSHA1ChecksumURL, "SHA1 Checksum\: ([^*]*?)What\'s this\?", 1)
$StringSHA1Checksum = _splitInfo($StringSHA1ChecksumURL, "\> ([^*]*?) \<", 1)
$UpdateUSBWiiflowRelease = StringRegExpReplace($StringCurrentUSBWiiflowVersion, "_|svn", "")
;==============Pugins
Global $GCWiiFlowPlugInsUpdate[6][3]
FileDelete(@TempDir & "\USBWiiflowupdatePlugins.xml")
Local $hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/", @TempDir & "\USBWiiflowupdatePlugins.xml", 1, 1) ;Download Header
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
$GetCurrentUSBWiiflowPlugIns = FileRead(@TempDir & "\USBWiiflowupdatePlugins.xml")
FileClose($GetCurrentUSBWiiflowPlugIns)
FileDelete(@TempDir & "\USBWiiflowupdatePlugins.xml") ;Clean
$fceugxCurrentWiiflow = _splitInfo($GetCurrentUSBWiiflowPlugIns, 'fceugx([^*]*?)\"\>fceugx', 1)
$fceugxCurrentWiiflowURL = "http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/fceugx" & $fceugxCurrentWiiflow
$GCWiiFlowPlugInsUpdate[0][0] = $fceugxCurrentWiiflowURL
$GCWiiFlowPlugInsUpdate[0][1] = "fceugx" & $fceugxCurrentWiiflow
$genplusgxCurrentWiiflow = _splitInfo($GetCurrentUSBWiiflowPlugIns, 'genplusgx([^*]*?)\"\>genplusgx', 1)
$genplusgxCurrentWiiflowURL = "http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/genplusgx" & $genplusgxCurrentWiiflow
$GCWiiFlowPlugInsUpdate[1][0] = $genplusgxCurrentWiiflowURL
$GCWiiFlowPlugInsUpdate[1][1] = "genplusgx" & $genplusgxCurrentWiiflow
$scummvmCurrentWiiflow = _splitInfo($GetCurrentUSBWiiflowPlugIns, 'scummvm([^*]*?)\"\>scummvm', 1)
$scummvmCurrentWiiflowURL = "http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/scummvm" & $scummvmCurrentWiiflow
$GCWiiFlowPlugInsUpdate[2][0] = $scummvmCurrentWiiflowURL
$GCWiiFlowPlugInsUpdate[2][1] = "scummvm" & $scummvmCurrentWiiflow
$snes9xgxCurrentWiiflow = _splitInfo($GetCurrentUSBWiiflowPlugIns, 'snes9xgx([^*]*?)\"\>snes9xgx', 1)
$snes9xgxCurrentWiiflowURL = "http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/snes9xgx" & $snes9xgxCurrentWiiflow
$GCWiiFlowPlugInsUpdate[3][0] = $snes9xgxCurrentWiiflowURL
$GCWiiFlowPlugInsUpdate[3][1] = "snes9xgx" & $snes9xgxCurrentWiiflow
$vbagxCurrentWiiflow = _splitInfo($GetCurrentUSBWiiflowPlugIns, 'vbagx([^*]*?)\"\>vbagx', 1)
$vbagxCurrentWiiflowURL = "http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/vbagx" & $vbagxCurrentWiiflow
$GCWiiFlowPlugInsUpdate[4][0] = $vbagxCurrentWiiflowURL
$GCWiiFlowPlugInsUpdate[4][1] = "vbagx" & $vbagxCurrentWiiflow
$wii64CurrentWiiflow = _splitInfo($GetCurrentUSBWiiflowPlugIns, 'wii64([^*]*?)\"\>wii64', 1)
$wii64CurrentWiiflowURL = "http://open-wiiflow-mod.googlecode.com/svn/branches/Plugins/Binaries/wii64" & $wii64CurrentWiiflow
$GCWiiFlowPlugInsUpdate[5][0] = $wii64CurrentWiiflowURL
$GCWiiFlowPlugInsUpdate[5][1] = "wii64" & $wii64CurrentWiiflow
;===========End
ConsoleWrite(@LF & _
"- Release : " & $UpdateUSBWiiflowRelease & @LF & _
"- URL : " & $UpdateUSBWiiflowURL & @LF & _
"- USBWiiflow SHA1 Checksum : " & $StringSHA1Checksum & @LF)
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\Languages")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\boxcovers")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\covers")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\trailers")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\fanart")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\help")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\settings")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\themes")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\vbagx\roms")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\snes9xgx\roms")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\wii64\roms")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\fceugx\roms")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\genplus\roms")
DirCreate($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\scummvm\roms")
DirCreate($SaveCurrentUSBWiiflow & "\wad")
$SplitCurrentUSBWiiflow = StringSplit("arab.ini|brazilian.ini|chinese_s.ini|chinese_t.ini|danish.ini|dutch.ini|english.ini|finnish.ini|" & _
"french.ini|gallego.ini|german.ini|hungarian.ini|italian.ini|japanese.ini|norwegian.ini|" & _
"polish.ini|portuguese.ini|russian.ini|spanish.ini|swedish.ini|tagalog.ini|turkish.ini", "|")
For $ilWiiflow = 1 To $SplitCurrentUSBWiiflow[0]
Local $hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/Languages/" & $SplitCurrentUSBWiiflow[$ilWiiflow], 3)
Local $hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/Languages/" & $SplitCurrentUSBWiiflow[$ilWiiflow], _
$SaveCurrentUSBWiiflow & "\Wiiflow\Languages\" & $SplitCurrentUSBWiiflow[$ilWiiflow], 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " " & $SplitCurrentUSBWiiflow[$ilWiiflow] & " | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\Languages\" & $SplitCurrentUSBWiiflow[$ilWiiflow])
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\Languages\" & $SplitCurrentUSBWiiflow[$ilWiiflow]))
Next
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/fanart/GAMEID.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/fanart/GAMEID.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\fanart\GAMEID.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (fanart : GAMEID.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\fanart\GAMEID.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\fanart\GAMEID.ini")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/help/english.txt")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/help/english.txt", _
$SaveCurrentUSBWiiflow & "\Wiiflow\help\english.txt", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (help : english.txt) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\help\english.txt"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\help\english.txt")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig1.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig1.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig1.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (settings : gameconfig1.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig1.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig1.ini")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig2.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/settings/gameconfig2.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig2.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (settings : gameconfig2.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig2.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\gameconfig2.ini")
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/themes/default.ini")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/trunk/wii/wiiflow/themes/default.ini", _
$SaveCurrentUSBWiiflow & "\Wiiflow\themes\default.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (themes : default.ini) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\themes\default.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\themes\default.ini")
$SplitTitleCurrentUSBWiiflow = StringSplit("EN|FR|DE|ES|IT|NL|PT|RU|JA|KO|ZHCN|ZHTW", "|")
For $iTWiiflow = 1 To $SplitTitleCurrentUSBWiiflow[0]
$hDownloadSize = InetGetSize("http://www.gametdb.com/titles.txt?LANG=" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow])
$hDownload = InetGet("http://www.gametdb.com/titles.txt?LANG=" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow], _
$SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini", 1, 1)
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " " & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini"))
$CurrentUSBWiiflowSize += FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini")
If $SplitTitleCurrentUSBWiiflow[$iTWiiflow] = GUICtrlRead($HomebrewTypeBootDOLLanguage) Then _
FileCopy($SaveCurrentUSBWiiflow & "\Wiiflow\settings\" & $SplitTitleCurrentUSBWiiflow[$iTWiiflow] & "custom_titles.ini", $SaveCurrentUSBWiiflow & "\Wiiflow\settings\custom_titles.ini", 9)
Next
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Boot.dol | " & $UpdateUSBWiiflowURL)
$DownloadCurrentUSBWiiflowSize = InetGetSize($UpdateUSBWiiflowURL)
$DownloadCurrentUSBWiiflow = InetGet($UpdateUSBWiiflowURL, $SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1"), 1, 1)
$CurrentUSBWiiflowSize += $DownloadCurrentUSBWiiflowSize
Do
$aInfo = InetGetInfo($DownloadCurrentUSBWiiflow)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $DownloadCurrentUSBWiiflowSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
Sleep(250)
Until $aInfo[2]
InetClose($DownloadCurrentUSBWiiflow)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1")))
GUICtrlSetData($CurrentUSBWiiflowState, "Successfully Downloaded | SHA1 Checksum: " & $StringSHA1Checksum)
Local $sReadSHA1 = $SaveCurrentUSBWiiflow & "\" & StringRegExpReplace($UpdateUSBWiiflowURL, "^.*/(.*)$", "$1")
If StringStripWS($sReadSHA1, 8) <> "" And FileExists($sReadSHA1) Then
Local $bHash = _Crypt_HashFile($sReadSHA1, $CALG_SHA1)
ConsoleWrite("- Found USBWiiflow SHA1 Checksum: " & $bHash & @CRLF & "- Inter USBWiiflow SHA1 Checksum: 0x" & $StringSHA1Checksum)
If $bHash = "0x" & $StringSHA1Checksum Then
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Successfully Downloaded and verified | SHA1 Checksum: " & $StringSHA1Checksum & " | " & _
StringFormat("%.2f", Round(_Timer_Diff($startGeneratetime) / 1000, 2)) & " Seconds"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
Else
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " already exists but it failed SHA1 verification. | SHA1 Checksum: " & $StringSHA1Checksum
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
EndIf
Else
$ReturnCurrentUSBWiiflowURL = "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Failed ! | SHA1 Checksum: " & $StringSHA1Checksum
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
EndIf
;==============> download Plugins
For $iDowPlugin = 0 To 5
$hDownloadSize = InetGetSize($GCWiiFlowPlugInsUpdate[$iDowPlugin][0])
$hDownload = InetGet($GCWiiFlowPlugInsUpdate[$iDowPlugin][0], $SaveCurrentUSBWiiflow & "\Wiiflow\plugins\" & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1], 1, 1)
$CurrentUSBWiiflowSize += $hDownloadSize
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins (" & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & ") | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\" & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1]))
If StringInStr($GCWiiFlowPlugInsUpdate[$iDowPlugin][1], "fceugx") <> 0 Then
$CurrentPluginFile = FileOpen($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\fceugx.ini", 2)
FileWrite($CurrentPluginFile, '[PLUGIN]' & @CRLF & _
'magic=46434555' & @CRLF & _
'coverColor=ff0000' & @CRLF & _
'coverFolder=fceugx' & @CRLF & _
'fileTypes=.nes|.fds|.nsf|.unf|.nez|.unif|.zip|.7z' & @CRLF & _
'romDir=Wiiflow\plugins\fceugx/roms' & @CRLF & _
'dolFile=' & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & @CRLF & _
'bannerSound=nes.ogg' & @CRLF & _
'displayname=FCEUltraGX' & @CRLF & _
'ReturnLoader=yes')
FileClose($CurrentPluginFile)
ElseIf StringInStr($GCWiiFlowPlugInsUpdate[$iDowPlugin][1], "genplusgx") <> 0 Then
$CurrentPluginFile = FileOpen($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\genplus-gx.ini", 2)
FileWrite($CurrentPluginFile, '[PLUGIN]' & @CRLF & _
'magic=53454741' & @CRLF & _
'coverColor=000000' & @CRLF & _
'coverFolder=genplusgx' & @CRLF & _
'fileTypes=.gen|.md|.zip' & @CRLF & _
'romDir=Wiiflow\plugins\genplus/roms' & @CRLF & _
'dolFile=' & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & @CRLF & _
'bannerSound=sega.ogg' & @CRLF & _
'displayname=GenPlusGX' & @CRLF & _
'ReturnLoader=yes')
FileClose($CurrentPluginFile)
ElseIf StringInStr($GCWiiFlowPlugInsUpdate[$iDowPlugin][1], "scummvm") <> 0 Then
$CurrentPluginFile = FileOpen($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\scummvm_plugin.ini", 2)
FileWrite($CurrentPluginFile, '[PLUGIN]' & @CRLF & _
'magic=5343564D' & @CRLF & _
'coverColor=fcff00' & @CRLF & _
'coverFolder=scummvm' & @CRLF & _
'fileTypes=' & @CRLF & _
'romDir=scummvm.ini' & @CRLF & _
'dolFile=' & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & @CRLF & _
'bannerSound=' & @CRLF & _
'displayname=ScummVM' & @CRLF & _
'ReturnLoader=yes')
FileClose($CurrentPluginFile)
ElseIf StringInStr($GCWiiFlowPlugInsUpdate[$iDowPlugin][1], "snes9x") <> 0 Then
$CurrentPluginFile = FileOpen($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\snes9x-gx.ini", 2)
FileWrite($CurrentPluginFile, '[PLUGIN]' & @CRLF & _
'magic=534e4553' & @CRLF & _
'coverColor=01a300' & @CRLF & _
'coverFolder=snes9xgx' & @CRLF & _
'fileTypes=.smc|.fig|.sfc|.swc|.zip|.7z' & @CRLF & _
'romDir=Wiiflow\plugins\snes9xgx/roms' & @CRLF & _
'dolFile=' & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & @CRLF & _
'bannerSound=snes.ogg' & @CRLF & _
'displayname=SNES9xGX' & @CRLF & _
'ReturnLoader=yes')
FileClose($CurrentPluginFile)
ElseIf StringInStr($GCWiiFlowPlugInsUpdate[$iDowPlugin][1], "vbagx") <> 0 Then
$CurrentPluginFile = FileOpen($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\vbagx.ini", 2)
FileWrite($CurrentPluginFile, '[PLUGIN]' & @CRLF & _
'magic=56424158' & @CRLF & _
'coverColor=fcff00' & @CRLF & _
'coverFolder=vbagx' & @CRLF & _
'fileTypes=.agb|.gba|.bin|.elf|.mb|.dmg|.gb|.gbc|.cgb|.sgb|.zip|.7z' & @CRLF & _
'romDir=Wiiflow\plugins\vbagx/roms' & @CRLF & _
'dolFile=' & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & @CRLF & _
'bannerSound=gba.ogg' & @CRLF & _
'displayname=VbaGX' & @CRLF & _
'ReturnLoader=yes')
FileClose($CurrentPluginFile)
ElseIf StringInStr($GCWiiFlowPlugInsUpdate[$iDowPlugin][1], "wii64") <> 0 Then
$CurrentPluginFile = FileOpen($SaveCurrentUSBWiiflow & "\Wiiflow\plugins\wii64.ini", 2)
FileWrite($CurrentPluginFile, '[PLUGIN]' & @CRLF & _
'magic=57493634' & @CRLF & _
'coverColor=ffffff' & @CRLF & _
'coverFolder=wii64' & @CRLF & _
'fileTypes=.n64|.v64|.z64|.zip' & @CRLF & _
'romDir=Wiiflow\plugins\wii64/roms' & @CRLF & _
'dolFile=' & $GCWiiFlowPlugInsUpdate[$iDowPlugin][1] & @CRLF & _
'bannerSound=n64.ogg' & @CRLF & _
'displayname=Wii64' & @CRLF & _
'ReturnLoader=yes')
FileClose($CurrentPluginFile)
EndIf
Next
$hDownloadSize = InetGetSize("http://open-wiiflow-mod.googlecode.com/svn/branches/WiiFLowLoader/WiiFlowLoaderChannel - WIIH.wad")
$hDownload = InetGet("http://open-wiiflow-mod.googlecode.com/svn/branches/WiiFLowLoader/WiiFlowLoaderChannel - WIIH.wad", $SaveCurrentUSBWiiflow & "\wad\WiiFlowLoaderChannel - WIIH.wad", 1, 1)
$CurrentUSBWiiflowSize += $hDownloadSize
Do
$aInfo = InetGetInfo($hDownload)
$iPercent = StringFormat("%.2f", Round($aInfo[0] / $hDownloadSize * 100, 2))
GUICtrlSetData($CurrentUSBWiiflowState, "Download : Wiiflow Mod " & $UpdateUSBWiiflowRelease & " Plugins (WiiFlowLoaderChannel - WIIH.wad) | Size: " & _FormatFileSize($aInfo[1]) & " | Downloaded: " & _
_FormatFileSize($aInfo[0]) & " / " & _FormatFileSize($aInfo[1]) & " | Percent: " & $iPercent & "% ")
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransfered, _FormatFileSize(GUICtrlRead($HomebrewListViewTransferedUnformated) + $aInfo[0]))
Sleep(250)
Until $aInfo[2]
InetClose($hDownload)
If $CurrentUSBWiiflow_ListN > -1 Then GUICtrlSetData($HomebrewListViewTransferedUnformated, GUICtrlRead($HomebrewListViewTransferedUnformated) + FileGetSize($SaveCurrentUSBWiiflow & "\wad\WiiFlowLoaderChannel - WIIH.wad"))
;<============== download Plugins
$ReturnCurrentUSBWiiflowURL = "Wiiflow Mod " & $UpdateUSBWiiflowRelease & " (Mega Pack) Successfully Downloaded and verified | " & _
StringFormat("%.2f", Round(_Timer_Diff($startGeneratetime) / 1000, 2)) & " Seconds"
GUICtrlSetData($CurrentUSBWiiflowState, $ReturnCurrentUSBWiiflowURL)
Return $ReturnCurrentUSBWiiflowURL
EndFunc ;==>_CurrentUSBWiiflowURL
Func _splitInfo($Mainstring, $Childstring, $ReturnT = 0)
$Arraystring = StringRegExp($Mainstring, $Childstring, 3)
If IsArray($Arraystring) Then
If $ReturnT = 0 Then
Return $Arraystring
Else
Return StringRegExpReplace($Arraystring[0], ' ', '')
EndIf
Else
Return ""
EndIf
EndFunc ;==>_splitInfo
Func _FormatFileSize($sFunc_Size = 0)
Local $sFS = ""
If $sFunc_Size < 1000 Then
$sFS = $sFunc_Size & " B"
ElseIf $sFunc_Size > 1000000000 Then
$sFS = StringFormat("%.2f", Round($sFunc_Size / 1000000000, 2)) & " Gb"
ElseIf $sFunc_Size > 1000000 Then
$sFS = StringFormat("%.2f", Round($sFunc_Size / 1000000, 2)) & " Mb"
ElseIf $sFunc_Size > 1000 Then
$sFS = StringFormat("%.2f", Round($sFunc_Size / 1000, 2)) & " Kb"
EndIf
Return $sFS
EndFunc ;==>_FormatFileSize