I'm not sure if I'm really clear about what I say, so I'm talking about this script for a "lite" version :
Code: Select all
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>
__myTaskHS(True)
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
HotKeySet("{ESC}", "Terminate")
$count = StringInStr($command, "-rom=", 0 , 1, 1)
local $file = StringTrimLeft( $command, $count + 4 )
local $fullscreenmode = 0 ; 0 = normal fullscreen 1 = special Fullscreen
; here you can use different configuration by game
local $option2 = "false"
local $option1 = IniRead("gpuDXv3.ini","main","transformZ", "")
;for naomi rom
if stringInStr($command,"naomi") then
$type = ' -run=naomi -rom="'
local $bios2 = 0
Local $bios1 = IniRead("demul.ini", "main", "naomiBios", "")
;Special config for house of dead 2
if $file = "hotd2" then
$bios2 = 17
$option2 = "true"
elseIf $file = "kurucham" then
$bios2 = 27
elseIf $file = "alpildx" then
$bios2 = 21
elseIf $file = "lupinsho" then
$bios2 = 21
elseIf $file = "takoron" then
$bios2 = 4
else
$bios2 = 10
Endif
If $bios1 <> $bios2 then Iniwrite("demul.ini", "main", "naomiBios", $bios2)
;for atomiswave rom
elseif stringInStr($command,"Atomiswave") then
$type = ' -run=atomiswave -rom="'
$fullscreenmode = 1
;for Dreamcast rom
elseif stringInStr($command,"DC") then
$type = ' -run=dc -image="'
$fullscreenmode = 1
;bug
Else
Exit 0
Endif
;Set differents options by game
If $option1 <> $option2 then
Iniwrite("gpuDXv3.ini","main","transformZ", $option2)
Endif
$PID = Run("demul.exe" & $type & $file & '"')
Local $hWnd = WinWaitActive ( "gpu" )
if $fullscreenmode = 1 then
Local $winX = 0
Local $winY = 0
Local $winWidth = @DesktopWidth
Local $winHeight = @DesktopHeight+20
WinSetStyle($hWnd,$WS_POPUP)
WinMove("gpu", "", $winX, $winY, $winWidth, $winHeight)
Send("!{F3}")
_MouseTrap(@DesktopWidth, @DesktopHeight, @DesktopWidth, @DesktopHeight)
__myTaskHS(True)
else
Send("!{ENTER}")
endif
ProcessWaitClose("demul.exe")
if $fullscreenmode = 1 then __myTaskHS(False)
Exit 0
;functions
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
if $fullscreenmode = 1 then __myTaskHS(False)
Exit 0
EndFunc
Func WinSetStyle($hWnd, $Style = -1, $ExStyle = 0)
Local Const $GWL_STYLE = -16
Local Const $GWL_EXSTYLE = -20
Local Const $SWP_NOMOVE = 0x2
Local Const $SWP_NOSIZE = 0x1
Local Const $SWP_SHOWWINDOW = 0x40
Local Const $SWP_NOZORDER = 0x4
Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER)
If $Style = -1 Then $Style = $WS_MINIMIZEBOX + $WS_CAPTION + $WS_POPUP + $WS_SYSMENU
DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $Style)
DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_EXSTYLE, "int", $ExStyle)
DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, _
"int", 0, "int", 0, "int", $iFlags)
EndFunc
Func __myTaskHS($f_hide = False)
Local $h_task = WinGetHandle("[CLASS:Shell_TrayWnd]")
If Not $h_task Then Return SetError(1, 0, 0)
Local $h_start = 0
Local $a_wlist = WinList("[CLASS:Button]")
If Not IsArray($a_wlist) Then Return SetError(2, 0, 0)
For $iwin = 1 To $a_wlist[0][0]
If _WinAPI_GetParent($a_wlist[$iwin][1]) = $h_task Then
$h_start = $a_wlist[$iwin][1]
ExitLoop
EndIf
Next
If Not $h_start Then Return SetError(3, 0, 0)
If $f_hide Then
_WinAPI_ShowWindow($h_start, @SW_HIDE)
_WinAPI_ShowWindow($h_task, @SW_HIDE)
Else
_WinAPI_ShowWindow($h_start, @SW_SHOW)
_WinAPI_ShowWindow($h_task, @SW_SHOW)
EndIf
EndFunc
This script manage to load the emulator withing mGalaxy so that's a great thing but it make the emulator crash/freeze on my pc for an unknow reason (rather than freezing, it seems it's loading the game but don't manage to run it).
What I would need is the same script but with all the optional lines removed (the ones about the fullscreen and such), so just to keep the lines which are required to load the emulator for the dc (I don't need atomiswave/naomi which already works fine with the last emulator version).
That's way, I should be able to run the emulator from mGalaxy without freeze/crash. Then, from that script, I'll see how to deal with the iso loading, if required, then with the "ALT+Screen" thing and it'll be ready