A new version.
This one work with name "iso name CDX.cue" and "iso name (Disk X).cue"
the Cd changement is invisible on my RetroCube, the display is slower than the manipulation, just some strange noise.
3 Problems left.
1 - Need to use other key than F1 because this one is used by emulator
2 - this version work only for french, need to chnage "ouvrir" by "open" this is not because of emulator but system language on windows
3 - Need to had a temporisation somewhere, you can have resize problem, sometime it's mGalaxy that have bad size after the return to front end ^^.
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>
Opt("WinTitleMatchMode", 1)
;Parsing
Local $count = StringInStr($CmdLineRaw, ".exe", 0 , 1, 1)
local $app = StringLeft ( $CmdLineRaw, $count + 4 )
local $command = StringTrimLeft( $CmdLineRaw, $count + 4 )
if not $command then exit 0
;Special parsing
$count = StringInStr($command, '"', 0 , 1, 1)
local $filename = StringTrimLeft( $command, $count )
$filename = StringTrimright( $filename, 1 )
;local $ext = StringTrimLeft($filename, StringInStr($filename, ".", 1, -1) - 1)
;local $file = StringLeft($filename, StringInStr($filename, ".", 1, -1) - 1 )
;$file = StringTrimLeft($file, StringInStr($file, "\", 1, -1) )
local $autchange = 1
local $oldCD = 1
;check if there is CD number
local $maxCD = 1
local $curCD = 1
local $type = 0
;look for CDX
local $aArray = StringRegExp ( $filename, "CD(\d)\.cue" , 1 )
if (UBound($aArray) > 0) then
$type = 1
else
;look for (Disk X)
$aArray = StringRegExp ( $filename, "\(Disk (\d)\)\.cue" , 1 )
if (UBound($aArray) > 0) then $type = 2
Endif
if (UBound($aArray) > 0) then
;ok there is the tag
;active the function
HotKeySet("{F1}", "CDchange")
;set current CD number
$curCD = $aArray[0]
;look for max cd Number
for $i = 2 to 10
If (($type = 1) AND FileExists(StringReplace($filename,'CD' & $curCD,'CD' & $i))) OR (($type = 2) AND FileExists(StringReplace($filename,'Disk ' & $curCD,'Disk ' & $i))) Then
$maxCD = $maxCD + 1
Else
ExitLoop
Endif
next
Else
;only 1 CD
endif
local $PID = Run ( '"' & $app & '" ' & $command )
ProcessWaitClose($PID)
Exit 0
;***********************************************************************************
;Functions
Func CDchange()
if ($maxCD = 1) then Return
if $autchange = 0 then return
$autchange = 0
$oldCD = $curCD
$curCD = $curCD + 1
if ($curCD > $maxCD) then $curCD = 1
;set new filename
if $type = 1 then $filename = StringReplace($filename,'CD' & $oldCD,'CD' & $curCD )
if $type = 2 then $filename = StringReplace($filename,'Disk ' & $oldCD,'Disk ' & $curCD)
;load the newCD
Send("!{ENTER}")
WinWaitActive ( "pSX" , "", 5 )
Send("!{f}")
Send("{ENTER}")
;Need to change here
WinwaitActive("Ouvrir","",5)
send($filename & ' ', 1)
send("{enter}")
WinwaitActive("pSX")
Send("!{ENTER}")
$autchange = 1
EndFunc