Author Topic: Demul  (Read 24154 times)

davhuit

  • Full Member
  • ***
  • Posts: 173
Re: Demul
« Reply #7 on: May 03, 2014, 10:41:27 AM »
Okay, let's just forget the last version script, so (because it don't work with the old versions, like the v057 one, even when I modify it).

Okay for the keypress but I still need a "lite" version of the script that do not crash with the 057 version. I tried deleting some lines in the script you posted earlier but it output some errors on some lines so I probably removed some lines I shouldn't.

So to summary, to start, just a autoit script that will able me to load the v057 version of the emulator on Mgalaxy, compatible with that command in the xml, if possible (I suppose it's the fullscreen thing of the script that make the emulator crash/freeze) :

Code: [Select]
<Cmd id="0" name="Demul (AutoIt)" value="-run=dc -image=&quot;%path\%file%ext&quot;" />
I managed to do some autoit scripts myself (for the splash screen thing for example), but for this, it's too much complicated for my level :/

(Then, I'll try to see myself how I can handle the loading of the iso, but it should probably work natively witht the xml command, as the other emulators ? I even tried to use some others scripts as an exemple, like the pcsx2 one but it didn't work).

Thanks a lot, again, it's really kind to help me!
« Last Edit: May 03, 2014, 10:46:16 AM by davhuit »

Aeliss

  • Hero Member
  • *****
  • Posts: 900
Re: Demul
« Reply #6 on: May 03, 2014, 10:04:39 AM »
The last script work with the last version so with mGalaxy_Script.exe, if you want to use it in the command line it s the previous version you can find on my last post.

Try with the new offical script + sending alt+enter (3 exemples here)
Code: [Select]
Send("!{Enter}") ;
Send("{AltDown}{Enter}")
Send("{AltDown}{Enter}{AltUp}")

but I think it will be better after

Code: [Select]
WinWaitActive ( "gpu" )
this part wait for game load before cotinu.

« Last Edit: May 03, 2014, 10:08:07 AM by Aeliss »

davhuit

  • Full Member
  • ***
  • Posts: 173
Re: Demul
« Reply #5 on: May 03, 2014, 08:29:01 AM »
The emulator load with this script, but then it seems to crash/freeze without loading the game.

Do you have a lite version of that script? Just the part to load the emulator?

Or maybe it's because we don't have the same command-line in the xml? (I didn't updated my mGalaxy so I'm still at the 5.0 version).

My command-line is this one :

Code: [Select]
<Cmd id="0" name="Demul (AutoIt)" value="-run=dc -image=&quot;%path\%file%ext&quot;" />
Or maybe I need to remove the command line, as it seems the parameters are already in the script?

By the way, about the fullscreen mode, why don't just "ask" the autoit script to input "ALT+ENTER", as it force the emulator into fullscreen?

Anyway, thanks for your help :)

I have a doubt about the script. Do I have to use it the old way (compile it then put the exe link in "mGalaxy_runaway", or do I need to compile it, name it "mGalaxy_Script.exe" then put it in the same directory as the emulator and check the "Use script if available" box ? (though I tried both possibilites and it crash for both).

Can't mGalaxy handle itself the iso loading with the command in the xml? (like the others emulators and the 0.58 version?)

Then, just have the script to send the "ALT+ENTER" combo ? (with something like this : http://www.autoitscript.com/forum/topic/127187-combination-send-key/ ?).

The fullscreen is working fine here, it's just it's loaded in windowed mode by default.

By the way, I am wondering why this script (http://www.mgalaxy.com/forum/index.php?topic=453.0) don't work with the old versions? What did they change exactly? I assume even if they changed something about the iso loading, the emulator should, at least, load with this script?
« Last Edit: May 03, 2014, 09:15:11 AM by davhuit »

Aeliss

  • Hero Member
  • *****
  • Posts: 900
Re: Demul
« Reply #4 on: May 03, 2014, 04:40:06 AM »
Try in adding this

Code: (autoit) [Select]
;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

This script can use 2 fullscreen mode because of flickering try the 2 value for $fullscreenmode.
And I m using this code for 0.57 only.

davhuit

  • Full Member
  • ***
  • Posts: 173
Re: Demul
« Reply #3 on: May 02, 2014, 06:11:22 PM »
I might have precised it but it seemed logic as my command-line as the "dc" value in it, I'm trying to make it to work for the dreamcast (atomiswave and naomi are already ok on my computer with the v58.2).

The emulator works pretty fine here for dreamcast, but only the 057 version (the 058 have some flickering yeah, and the framerate seems choppy). As I said upper, I managed to finish Shenmue with major glitches where NullDC have some problems with it (sound problems during some parts in the game, for example).

I also mainly use NullDC but I prefer to have both, depending of the game (and I was planning to replay Shenmue as a undub version has been released). I can run the emulator manually but I'm really curious why mGalaxy can't load the v057 of the emulator.

I will try your scripts tomorrow with the 057 version, hoping it'll work :)
« Last Edit: May 02, 2014, 06:20:37 PM by davhuit »

Aeliss

  • Hero Member
  • *****
  • Posts: 900
Re: Demul
« Reply #2 on: May 02, 2014, 03:53:13 PM »
Here you can find my last masochist tries > http://www.mgalaxy.com/forum/index.php?topic=361.msg1183#msg1183

This script correct fullscreen and background problem, you can remove the specail config part.
I think I still have my config file for this version, hard to configure fullscreen to avoid flickering effect. It s really a crappy emulator, still at beta step after so many years.

Shenmue is working on NullDC too, perhaps it need some manipulation or patch, but I have already see on their forum that this game is totally playable (with special saves if I remember).

Edit:
I have tried this code 5 mn ago, and it work (for naomi and mgalaxy 5.2, you need to make some change for DC)

Code: (autoit) [Select]
#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
;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
   



« Last Edit: May 02, 2014, 04:07:34 PM by Aeliss »

davhuit

  • Full Member
  • ***
  • Posts: 173
Demul
« Reply #1 on: May 02, 2014, 01:46:51 PM »
After a lot of tests, I found that the 058 and upper versions are laggy so I would like to downgrade back to the 057 version which work perfectly (I managed to go through Shenmue from start to finish without major lag or glitches) but the 057 version don't want to run with mGalaxy (I know NullDC works fine but some games, like Shenmue, works better with Demul so I added both emulators in mGalaxy).

Here's the 057 version : http://demul.emulation64.com/files/demul057.rar

First, the required command-line to run the emulator is that :

Demul.exe -run=dc image=directory\file.ext (for example, this command-line works fine in a .bat file : demul.exe -run=dc -image="D:\Isos_Emulation\DreamCast\Shenmue v1.001 (2000)(Sega)(PAL)(M4)(Disc 1 of 4)[!].gdi")

Whatever I try, demul seems to be loaded in background when loaded through mGalaxy (it don't appear on my screen, but is in th taskmanager). I suppose I might need an auto-it script but the actual one is only compatible with 058+ versions (at least, even if it don't load the iso file because of a command-line problem, it should at least open the emulator, right?).

Aeliss said here (http://www.mgalaxy.com/forum/index.php?topic=537.msg1842#msg1842) that another script were required for >5.0.8 versions but didn't find it anywhere.

Here's the actual command line in the xml file :

Code: [Select]
<Cmd id="0" name="Demul (AutoIt)" value="-run=dc -image=&quot;%path\%file%ext&quot;" />
(So the command line seems okay)

So all is missing would be an auto-it script ?

I know the old video plugins of this version don't allow to force fullscreen at startup, but that's not a big problem. I rather prefer that than playing games with lag, and I think it can probably be fixed (would just need to put an "ALT+ENTER" combo key in a auto-it script after the emulator startup).

I'm ready to buy a third supporter version if my problem is fixed ;) (and if it's someone else who fix my problem, I'm ready to buy and offer you a supporter version if you don't have one yet :D).

Thanks a lot in advance if someone can help me.
« Last Edit: May 02, 2014, 02:08:47 PM by davhuit »