Amiga lha games/whd games

Feel free to talk about anything and everything in this board.
Post Reply
User avatar
SegaDoesWhatNintenDont
Jr. Member
Jr. Member
Posts: 26
Joined: Sun Jan 27, 2019 1:53 pm

Hello Amiga pros!
I'm trying to understand how to load rom archives with .lha extension. I have some to test. They came from a rasberrypi setup using amiberry.

Now I'm a little bit familiar with WinUAE and adf files and tried to read up on how to run lha games. I'm very confused now, and don't really know how to setup WinUAE, WinUAEloader, WHDrun or whatever.

Is there a simple way of setting up the software on a portable flash drive so it will recognize and launch my packed .lha files? Or do I need to partition a real physical drive somehow? Any help on this would be much appreciated.. :)
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

For WHD, I have already done a topic for that http://www.mgalaxy.com/forum/https://ww ... ic.php?t=6.
For HDF, its' a little bit more complicated, because it's a n harddrive image, so you need to load a complete system image and mount this file.
For LHA, its' just a compressed file, so unzip them to see what is the content, but I just think it's the same file, *.zip on windows and *.lha on amiga.

This topic is old, from my memory fs-uae can now launch whd archive, but I haven't tried this feature yet : https://fs-uae.net/whdload-support
Last edited by Aeliss on Tue Feb 05, 2019 3:25 pm, edited 1 time in total.
User avatar
SegaDoesWhatNintenDont
Jr. Member
Jr. Member
Posts: 26
Joined: Sun Jan 27, 2019 1:53 pm

Thank you for the tip, Aleliss. :)

I tried it and got FS-UAE working perfectly by using the launcher to load WHDs and get the config from the online database.

Now my problem is that I don't know the first thing about autoit or how to use scripts. I tried to understand but it seems to me all the instructions given on this forum are targeted towards people who actually know already how to do it but just need help with the right code..

What I would like to do is use FS UAE from within mGalaxy. I tried pointing the emulator to the FS-UAE-launcher.exe, but that doesn't seem to do the trick.

Can you explain to me - in a noob friendly way - where to go and what to edit in order to get FS-UAE-launcher.exe to run a specific .lha archive? ;)
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

WinUAELoader.exe works with fs-uae too ?

BTW if you are using fs-uae, have you a command line to launch game ? A command line with FS-UAE-launcher.exe ?

From my memory no, so if you wana use the "hard way". Some explanation about autoit
- you will find some script in F:\emulateur\mGalaxy\Data\Scripts
- You can edit them with notepad, but better to use the application with it.
- When you have instaled mGalaxy it have also installed autoit, so you don't need more.
- To make *.exe with the script > tools/ compile.

On my side I m using the exe file as executable, but my script have changed since the last one.
Here my last one

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
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

Local $patch = IniRead(@ScriptDir & "\Data.ini", "PATCH", $file, "")
Local $save = IniRead(@ScriptDir & "\Data.ini", "SAVE", $file, "")

;Add save if exist
if $save <> "" Then
   local $search2 = FileFindFirstFile(@scriptdir & '\SAVE\' & $file & '\' & $save & '\'  & '\*.*' )
   If $search2 <> -1 then
	  local $fileSave = FileFindNextFile($search2)
	  while $fileSave <> ''
		 FileCopy (@scriptdir & '\SAVE\' & $file & '\' & $save & '\' & $fileSave, $tmp & $file & '\' & $save & '\' & $fileSave, 1 )
		 $fileSave = FileFindNextFile($search2)
	  wend
   Endif
   FileClose($search2)
   $patch = 'NOWRITECACHE ' & $patch
Endif

FileWriteLine($file2, 'echo "";')
FileWriteLine($file2, 'echo "WHD loader";')
FileWriteLine($file2, 'echo "Running: ' & $file & '.Slave";')
FileWriteLine($file2, 'echo "Special command : ' & $patch & '";')
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 ' & $patch & ';')
FileClose($file2)

#CS
;for WinUAE
$app = @ScriptDir & '\..\WinUAE\WinUAE.exe'

;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 )
#Ce

;#cs
;For FS-UAE
$app = @ScriptDir & '\..\fs-uae\Windows\fs-uae\fs-uae.exe'
$config = @ScriptDir & '\WHD_loader\whd.fs-uae'

Runwait('"' & $app & '" ' & $config )
;#ce

;Sauvegarde
if $save <> "" Then
   local $search2 = FileFindFirstFile(@scriptdir & '\SAVE\' & $file & '\' & $save & '\'  & '\*.*' )
   If $search2 <> -1 then
	  local $fileSave = FileFindNextFile($search2)
	  while $fileSave <> ''
		 FileCopy ($tmp & $file & '\' & $save & '\' & $fileSave, @scriptdir & '\SAVE\' & $file & '\' & $save & '\' & $fileSave, 1 )
		 $fileSave = FileFindNextFile($search2)
	  wend
   Endif
   FileClose($search2)
Endif

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
And to use it

Code: Select all

  <System guid="Commodore Amiga-Zc3nHfED" type="Computer">
    <Name ss="75" em="Commodore_Amiga" tgdb="Amiga" gb="1|AMI">Commodore Amiga</Name>
    <UserName>Commodore Amiga WHD</UserName>
    <AppPath>F:\emulateur\Amiga\MyWHDLoader\WHDloader.exe</AppPath>
    <RomPath>F:\emulateur\Amiga\Jeux WHD</RomPath>
    <SnapPath>F:\emulateur\mGalaxy\snapsemul\AmigaWHD</SnapPath>
    <VidPath>
    </VidPath>
    <CoverPath>
    </CoverPath>
    <LogoPath>
    </LogoPath>
    <ArtPath>
    </ArtPath>
    <Emu selected="My loader">
      <Cmd hidden="false" name="FS-UAE" value="--fullscreen=1 --floppy-drive-0="%path\%file%ext"" extensions=".adf,.adz,.dms,.fdi,.gz,.hdf,.hdz,.ipf,.rdf,.rdz,.vhd,.zip" />
      <Cmd hidden="false" name="WinUAE" value="-config=mGalaxy.uae -0 "%path\%file%ext"" extensions=".adf,.adz,.dms,.fdi,.gz,.hdf,.hdz,.ipf,.rdf,.rdz,.vhd,.zip" />
      <Cmd hidden="true" name="RetroArch [puae_libretro.dll]" value="-f -L cores\puae_libretro.dll "%path\%file%ext"" extensions=".adf,.adz,.dms,.fdi,.gz,.hdf,.hdz,.ipf,.rdf,.rdz,.vhd,.zip" />
      <Cmd hidden="false" name="My loader" value=""%path\%file%ext"" extensions=".adf,.adz,.dms,.fdi,.gz,.hdf,.hdz,.ipf,.rdf,.rdz,.vhd,.zip" />
    </Emu>
    <Active>True</Active>
    <Script>True</Script>
    <Database>True</Database>
    <Screensaver>False</Screensaver>
    <Theme>
    </Theme>
    <Prelaunch enable="False">
      <Data app="" cmd="" state="0" />
    </Prelaunch>
  </System>
Last edited by Aeliss on Sun Feb 10, 2019 10:55 am, edited 1 time in total.
Post Reply