Loader:DemulWine
Jump to navigation
Jump to search
Demul Loader
About
This script loads roms passed from the commandline in Demul. The demul emulator does not currently (v0.5.6) have commanline options for game loading. The autohotkey script somewhat provides this functionality.
For this script to function it requires an ini be present in the emulator directory, this emulator can be built using the script by passing the build option.
An example bash script is included, this provides the full generic commandline.
Installation
- Save the AHK script
- Setup the AHK script
- Change Configuration Options a required, refer script comments
Usage
To build the required ini file:
- <path to script> build
To launch a title:
- <path to script> launch rom_name
Autohotkey Script
; Demul Launcher ; Launch Demul with romname param ; ::Written by sairuk ; ; Configuration options ; executable := "demul.exe" ;Executable to use emupath := "C:\emulators\demul\" ;Location of the demul executable inifile := "demul_launcher.ini" ;INI file for launcher ; fullscreen := "0" ;Push the emulator into fullscreen fsmode := "AE" ;Fullscreen mode, AE:ALT+ENTER or F8:F8 key ; ; File Menu Position ; filemenu_x := "15" filemenu_y := "30" ; ;================== Start Script =================== ; ; BuildSystemList(system) ; ; Read through control and write files ; ; BuildSystemList(system, emupath, inifile){ Sleep, 200 ControlGet, List, List, , SysListView321, Select ROM If Errorlevel MsgBox, ERROR, Couldn't read list Loop, Parse, List, `n { RowNumber := A_Index Loop, Parse, A_LoopField, %A_Tab% { if ( A_Index = 1 ) { RomName = %A_LoopField% } DownCount := RowNumber - 1 } IniWrite, %DownCount%, %emupath%%inifile%, %RomName%, Down_Count IniWrite, %system%, %emupath%%inifile%, %RomName%, System } Send, {ESCAPE} } ; ; Click on the File Menu (no shortcut keys are available) ; clickFileMenu(x,y,num,period) { Click %x%,%y% ; Click File menu Sleep, %period% Send, {DOWN %num%}{ENTER} } ; ; ; chkSystem(system, emupath, inifile) { ;==================== Available ==================== ; ; Naomi if (system = "Naomi") { down_keys := "2" } ; ; Atomiswave Else if (system = "Atomiswave") { down_keys := "3" } ; ;xxxxxxxxxxxxxxxxxx Not Available xxxxxxxxxxxxxxxxxx ; ; Hikaru ;Else if (system = "Hikari") { ; down_keys := "4" ;} ; ; Model 3 ;Else if (system = "Model 3") { ; down_keys := "5" ;} ; ; Saturn ;Else if (system = "Saturn") { ; down_keys := "6" ;} Else { MsgBox, Could not find romname, you ini may be out of date ExitApp } ;=================================================== if ( down_keys > 0 ) { return down_keys } } ; ; ; buildMe(system, emupath, inifile,filemenu_x,filemenu_y,down_keys) { down_keys := chkSystem(system, emupath, inifile) clickFileMenu(filemenu_x,filemenu_y,down_keys,500) BuildSystemList(system, emupath, inifile) } ; ; Check for params ; if 0 < 1 { MsgBox This script requires a mode be passed to it, options build/launch. ExitApp } mode = %1% ; Need to check for valid mode If ( mode = "launch" ) { romname = %2% } Else if ( mode = "build" ) { ; Nothing } Else { MsgBox, ERROR: No ROMNAME specified in launch mode, exiting ExitApp } ; ; Check for the inifile ; if ( mode = "launch" ) { ifNotExist, %emupath%%inifile% { MsgBox, Could not find %emupath%%inifile%, Run this script with the build option. ExitApp } Else { ; ; Read Ini settings for current rom ; IniRead, num_down, %emupath%%inifile%, %romname%, Down_Count, 0 IniRead, system, %emupath%%inifile%, %romname%, System, Atomiswave } } ; ; Start the emulator ; if (mode = "build") { MsgBox, The emulator will close when finished, press OK to continue } Run, "%emupath%%executable%", Hide UseErrorLevel WinActivate %executable% Sleep, 1000 if (mode = "launch") { down_keys := chkSystem(system, emupath, inifile) clickFileMenu(filemenu_x,filemenu_y,down_keys,500) } If (mode = "build") { ;==================== Available ==================== ; system := "Naomi" buildMe(system, emupath, inifile,filemenu_x,filemenu_y,down_keys) system := "Atomiswave" buildMe(system, emupath, inifile,filemenu_x,filemenu_y,down_keys) ; ;xxxxxxxxxxxxxxxxxx Not Available xxxxxxxxxxxxxxxxxx ; ;system := "Hikaru" ;buildMe(system, emupath, inifile,filemenu_x,filemenu_y,down_keys) ;system := "Model 3" ;buildMe(system, emupath, inifile,filemenu_x,filemenu_y,down_keys) ;system := "Saturn" ;buildMe(system, emupath, inifile,filemenu_x,filemenu_y,down_keys) } ; ; Select Rom ; Send, {DOWN 3} ; Move into the list Send, {DOWN %num_down%} ; Send down keystroke to select rom Send, {ENTER} ; ; Sleep, 9000 ; Sleep for 9 seconds before going into fullscreen ; ; Fullscreen ; If ( fullscreen = "1" ) { if ( fsmode = "AE" ) { Send, {ALTDOWN}{ENTER}{ALTUP} } Else { Send, {F8} ; Go full Screen } } ; ; Exit App ; If (mode = "Build") { Send, {ALTDOWN}{F4}{ALTUP} } Process, WaitClose, %executable%
Bash Script
#!/bin/sh wine "C:\\Program Files\\AutoHotkey\\AutoHotkey.exe" "C:\\emulators\\demul\\demul_launcher.ahk" $@