Easy way
Simply use the Winuaeloader > http://headsoft.com.au/index.php?category=winuaeloader
It works with command line so easy to include in mGalaxy. the command is
Code: Select all
WinUAELoader.exe -mode whdload -rom "RomName.zip"
Hard Way
This method is a little complicated but you can control all the system with it.
Unzip this archive in WinUAE directory > http://www.multiupload.nl/Z5OWMPBHG3
If you want to skip the waiting time, buy or find a license and put the WHDLoad.key file ine the WinUAE\WHD_loader\WHD\S directory
Check the configuration file WHDLoader.uae with your path
Code: Select all
filesystem2=rw,DH0:DH0:.\WHD_loader\WHD,0
uaehf0=dir,rw,DH0:DH0:.\WHD_loader\WHD,0
filesystem2=rw,DH1:DH1:F:\emulateur\Amiga\WinUAE\WHD_loader\tmp\,0
uaehf1=dir,rw,DH1:DH1:F:\emulateur\Amiga\WinUAE\WHD_loader\tmp\,0
The script, you can call it like you want but not mGalaxy_Script.au3, it s a loader not a script for mGalaxy.
Code: Select all
#include <array.au3>
#include <File.au3>
local $fichier = $CmdLineRaw
;clen name
$fichier= StringTrimRight( $fichier, 1 )
$fichier= StringTrimleft( $fichier, 1 )
local $tmp = @ScriptDir & '\WHD_loader\tmp\'
local $app = @ScriptDir & '\winuae.exe'
local $config = @ScriptDir & '\WHD_loader\WHDLoader.uae'
;delete previous archives
DirRemove(@scriptdir & "\WHD_loader\tmp\",1)
DirCreate(@scriptdir & "\WHD_loader\tmp\")
;unzip archive
_Zip_UnzipAll($fichier,$tmp)
;we get the name of the game
Local $search = FileFindFirstFile($tmp & '*.info')
If $search = -1 Then exit 0
Local $file = FileFindNextFile($search)
$file = StringTrimRight( $file, 5 )
FileClose($search)
;file modification
Local $file2 = FileOpen(@ScriptDir & '\WHD_loader\WHD\S\user-startup',2)
If $file2 = -1 Then exit 0
FileWriteLine($file2, 'echo "";')
FileWriteLine($file2, 'echo "WHD loader";')
FileWriteLine($file2, 'echo "Running: ' & $file & '.Slave";')
FileWriteLine($file2, 'echo "";')
FileWriteLine($file2, 'echo "Remember to use the quit key instead of closing WinUAE!";')
FileWriteLine($file2, 'echo "";')
FileWriteLine($file2, 'cd dh1:' & $file & ';')
FileWriteLine($file2, 'whdload ' & $file & '.Slave PRELOAD;')
FileClose($file2)
;configuration modification
local $aLines
_FileReadToArray($config, $aLines)
for $i = 0 To $aLines[0]
If StringInStr($aLines[$i], "filesystem2=rw,DH1") Then
_FileWriteToLine($config, $i ,"filesystem2=rw,DH1:DH1:" & $tmp & ",0", 1)
EndIf
If StringInStr($aLines[$i], "uaehf1=dir,rw,DH1:") Then
_FileWriteToLine($config, $i ,"uaehf1=dir,rw,DH1:DH1:" & $tmp & ",0", 1)
EndIf
Next
Runwait('"' & $app & '" -config="' & $config )
exit 0
;==========================================================================
;
; Function Name: _Zip_DllChk()
; Description: Internal error handler.
; Parameter(s): none.
; Requirement(s): none.
; Return Value(s): Failure - @extended = 1
; Author(s): smashley
;
;===============================================================================
Func _Zip_DllChk()
If Not FileExists(@SystemDir & "\zipfldr.dll") Then Return 2
If Not RegRead("HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}", "") Then Return 3
Return 0
EndFunc ;==>_Zip_DllChk
;===============================================================================
;
; Function Name: _Zip_UnzipAll()
; Description: Extract all files contained in a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hDestPath - Complete path to where the files will be extracted
; $flag = 1
; - 1 no progress box
; - 0 progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: The return values will be given once the extracting process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_UnzipAll($hZipFile, $hDestPath, $flag = 1)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(2, 0, 0) ;no zip file
If Not FileExists($hDestPath) Then DirCreate($hDestPath)
Local $aArray[1]
$oApp = ObjCreate("Shell.Application")
$oApp.Namespace($hDestPath).CopyHere($oApp.Namespace($hZipFile).Items)
For $item In $oApp.Namespace($hZipFile).Items
_ArrayAdd($aArray, $item)
Next
While 1
If $flag = 1 then _Hide()
If FileExists($hDestPath & "\" & $aArray[UBound($aArray) - 1]) Then
Return SetError(0, 0, 1)
ExitLoop
EndIf
Sleep(500)
WEnd
EndFunc ;==>_Zip_UnzipAll
;===============================================================================
;
; Function Name: _Hide()
; Description: Internal Function.
; Parameter(s): none
; Requirement(s): none.
; Return Value(s): none.
; Author(s): torels_
;
;===============================================================================
Func _Hide()
If ControlGetHandle("[CLASS:#32770]", "", "[CLASS:SysAnimate32; INSTANCE:1]") <> "" And WinGetState("[CLASS:#32770]") <> @SW_HIDE Then ;The Window Exists
$hWnd = WinGetHandle("[CLASS:#32770]")
WinSetState($hWnd, "", @SW_HIDE)
EndIf
EndFunc
;===============================================================================
;
; Function Name: _IsFullPath()
; Description: Internal Function.
; Parameter(s): $path - a zip path
; Requirement(s): none.
; Return Value(s): success - True.
; failure - False.
; Author(s): torels_
;
;===============================================================================
Func _IsFullPath($path)
if StringInStr($path,":\") then
Return True
Else
Return False
EndIf
Endfunc
Test.bat
Code: Select all
WHDloader.exe "F:\emulateur\Amiga\Jeux WHD\Ork_v1.1d_0219.zip"