Jump to content
Download Section Back Up, Navigate the Right Hand Menu to find files, ignore the 0s

question for .ahk (module)_ experts


craiganderson

Recommended Posts

hello,

im working on a module. my first attempt at loading multiple disks.

basically the emulator has 4 "slots" for disks.

some games have two disks

i need to load them both. (into drive 1 and drive 2 separately)..which i know how to do individually.....but

some games only have one disk so the module needs to be able to do the following

check to see if game has 1,2,3,4 disks?

if one disk only....thats easy...load it

if has multiple disks ...load them into the right drive (disk 1 in drive 1 etc)

any modules you can recommend i look at to see how to do this?

if anything comes to mind

thanks

craig

Link to comment
Share on other sites

i think i figured it out

this module (WIP) does the following

if rom contains "(Disk" in its name, it will trim off the last 9 characters (i.e trims off (Disk 1) or (Disk 2) etc

and then loads the trimmed rom name PLUS (Disk 1) into drive 1

the trimmed rom name PLUS (Disk 2) into drive 2

all the way up to drive 4

the emulator doesnt care if the disk doesnt exist (i.e. game is 2 disks not 4)

cool thing is .... you can start with any number disk from hyperspin (i.e. click on disk 2 or 4 or 1 etc) as your starting point...but it puts the correct one into the correct drive

just fyi

so far so good

works pretty good so far

let me know if you see a problem with this that perhaps i am not seeing

thanks

MEmu = EmuZ-2500
MEmuV =  Updated on Website: 10/11/2004
MURL = http://www.zophar.net/sharpmzx/emuz-2500.html
MAuthor = craiganderson
MVersion = 1.0
MCRC = 
iCRC =
MID = 
MSystem = "Sharp MZ-2500""
;----------------------------------------------------------------------------
; FullScreen: Set fullscreen mode in HyperLaunch HQ "Edit Global Module Settings".
;
; RemoveMenuBar: Enable/Disable Removal of Menu Bar in HyperLaunch HQ "Edit Global Module Settings".
;
; HideMouseCursor: Enable/Disable Hiding of Mouse Cursor in HyperLaunch HQ "Edit Global Module Settings".
;
; Module currently ONLY loads disk images (.d88 is the one tested). 
;
; Does not currently load games that need multiple disks.
;
; BIOS: IPL.ROM and KANJI.ROM are required. Other ROM images are optionally loaded if they exist. See readme.txt file for details.
;----------------------------------------------------------------------------
StartModule()
FadeInStart()

settingsFile := modulePath . "\" . moduleName . ".ini"
Fullscreen := IniReadCheck(settingsFile, "settings", "Fullscreen","true",,1)
RemoveMenuBar := IniReadCheck(settingsFile, "settings", "RemoveMenuBar","true",,1)
HideMouseCursor := IniReadCheck(settingsFile, "settings", "HideMouseCursor","true",,1)

7z(romPath, romName, romExtension, 7zExtractPath)

Run(executable, emuPath)

WinWait("ahk_class CWINDOW")
WinWaitActive("ahk_class CWINDOW")

; loading games with multiple disks
If romName contains (Disk
{
StringTrimRight, trimmedromName, romName, 9


Sleep,250
WinMenuSelectItem, ahk_class CWINDOW, , FDD1, Insert
Sleep, 1000
	Loop 	{
		ControlGetText, edit1Text, Edit1, Open ahk_class #32770
		If ( edit1Text = romPath . "\" . trimmedromName . " (Disk 1)" . romExtension )
			Break
		Sleep, 150
		ControlSetText, Edit1, %romPath%\%trimmedromName% (Disk 1)%romExtension%, Open ahk_class #32770
		}
Sleep,450
ControlSend, Button1, {Enter}, Open ahk_class #32770



Sleep,250
WinMenuSelectItem, ahk_class CWINDOW, , FDD2, Insert
Sleep, 1200
	Loop 	{
		ControlGetText, edit1Text, Edit1, Open ahk_class #32770
		If ( edit1Text = romPath . "\" . trimmedromName . " (Disk 2)" . romExtension )
			Break
		Sleep, 150
		ControlSetText, Edit1, %romPath%\%trimmedromName% (Disk 2)%romExtension%, Open ahk_class #32770
		}
Sleep, 450
ControlSend, Button1, {Enter}, Open ahk_class #32770



Sleep, 250
WinMenuSelectItem, ahk_class CWINDOW, , FDD3, Insert
Sleep, 1200
	Loop 	{
		ControlGetText, edit1Text, Edit1, Open ahk_class #32770
		If ( edit1Text = romPath . "\" . trimmedromName . " (Disk 3)" . romExtension )
			Break
		Sleep, 150
		ControlSetText, Edit1, %romPath%\%trimmedromName% (Disk 3)%romExtension%, Open ahk_class #32770
		}
Sleep, 450
ControlSend, Button1, {Enter}, Open ahk_class #32770



Sleep, 250
WinMenuSelectItem, ahk_class CWINDOW, , FDD4, Insert
Sleep, 1200
	Loop 	{
		ControlGetText, edit1Text, Edit1, Open ahk_class #32770
		If ( edit1Text = romPath . "\" . trimmedromName . " (Disk 4)" . romExtension )
			Break
		Sleep, 150
		ControlSetText, Edit1, %romPath%\%trimmedromName% (Disk 4)%romExtension%, Open ahk_class #32770
		}
Sleep, 450
ControlSend, Button1, {Enter}, Open ahk_class #32770
}

ELSE
{
Sleep,250
WinMenuSelectItem, ahk_class CWINDOW, , FDD1, Insert
	Loop 	{
		ControlGetText, edit1Text, Edit1, Open ahk_class #32770
		If ( edit1Text = romPath . "\" . romName . romExtension )
			Break
		Sleep, 150
		ControlSetText, Edit1, %romPath%\%romName%%romExtension%, Open ahk_class #32770
		}
	Sleep, 450
	ControlSend, Button1, {Enter}, Open ahk_class #32770
}


;*******************FULLSCREEN*******************************
If Fullscreen = true
{
Sleep, 555
WinMenuSelectItem, ahk_class CWINDOW, , Screen, Fullscreen
}


;*******************RemoveMenuBar***************************
If RemoveMenuBar = true
{
Sleep, 555
DllCall("SetMenu", uint, WinActive( "A" ), uint, 0) ; Removes the MenuBar (thank you djvj)
}


;*******************HideMouseCursor***************************
If HideMouseCursor = true
{
Sleep, 555
SystemCursor(OnOff=0) 
}



FadeInExit()
Process("WaitClose", executable)
7zCleanUp()
FadeOutExit()
ExitModule()

CloseProcess:

FadeOutStart()
IfWinExist, EmuZ-2500
	WinKill 
Return

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...