Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

Okay, so I have followed in NoLogic's footsteps and have downloaded AutoIt. I have tried to create a script to run Dreamcast

games straight from the hard drive. Let me explain what I'm trying to do:

1.) In Gameex, I'm setting the filter to .exe to run the autoit script with the name of the iso

2.) Each Dreamcast iso will have it's own autoit script.

3.) I'm trying to load NullDC from a specific path

4.) I'm trying to send the keys ALT F to open the menu, Press ENTER, Type in the name of the game.cdi, press ALT O to open it.

5.) Close the executable after it's done being used.

If NoLogic or HeadKaze could take a look at my script and tell me what i did wrong, that would be greatly appreciated.

Here it is:

Run ( "nullDC_100b1.exe" [, "C:\Program Files\gameex\Kenbox Arcade\Dreamcast\New Folder])

WinWaitActive ("NullDC v1.0.0 beta 1")

Send("{!}{F}")

Send("{ENTER}")

Send("Jet Grind Radio.cdi")

Send("{!}{O}")

Posted

Okay there is some work to be done here.

When you see an AutoIt command that has [...] what ever is between the brackets is optional...and the brackets are not suppose to be there.

Also one script per disc image is a lot of work thats not needed.

Any ways give me a second to look things over and we'll see what we end up with. :)

Posted

Okay set the filter to *.cdi

Command Line to: loader.exe "[ROMPATH]\[ROMFILE]"

; AutoIt Options
Opt("WinTitleMatchMode", 4)
Opt("MouseCoordMode", 0)

; Check For Valid Commandline
If NOT $CmdLine[0] = 1 Then Exit

; Launch Emulator
Run ( @ScriptDir & '\nullDC_100b1.exe' , '' , @SW_HIDE )

; Load Game
WinWaitActive ( "classname=ndc_main_window" )
ControlSend ( "classname=ndc_main_window" , "" , "" , "{ALTDOWN}fn{ALTUP}" )

; Open Dialog
WinWaitActive ( "classname=#32770" )
ControlSetText ( "classname=#32770" , "" , 1148 , $CmdLine[1] )
ControlClick ( "classname=#32770" , "" , 1 )

; Display Emu
WinSetState ( "classname=ndc_main_window", "", @SW_SHOW )
WinActivate ( "classname=ndc_main_window" )

; Move Mouse to Lower Right Corner
MouseMove ( @DesktopWidth , @DesktopHeight , 1 )

Posted

I'm such a noob. :P

I don't understand half the stuff you did. Is there a manual or a book somewhere where I could teach myself AutoIt?

I'm gonna try out the new code. Thanks.

Posted

Actually the help file is a blessing in AutoIts case...very very informative with lots of sample code that I steal from often. :)

Generally you want to stay as far away from "Send" keys as possible...if some thing steals focus your screwed. :(

Any ways look over the code...read up on it...and then improve upon it. :)

Posted

Try the below code

; Open Dialog
WinWaitActive ( "Open" )
ControlSetText ( "Open" , "" , 1148 , $CmdLine[1] )
ControlClick ( "Open" , "" , 1 )

Posted

Damit....I did it again.

I update every thing above...problem was I used the wrong command line var...some thing I've goofed on before. :(

I used "$CmdLine[0]" which is the count of how many commands are being sent to the executable...."$CmdLine[1]" is the first command...and "$CmdLine[2]" would be second...so on and so forth.

Posted
Try the below code

; Open Dialog
WinWaitActive ( "Open" )
ControlSetText ( "Open" , "" , 1148 , $CmdLine[0] )
ControlClick ( "Open" , "" , 1 )

Okay, here's what I've found. Not quite sure how to fix it, but I think I know where the problem is.

Everything works fine up until you get to ;load game. The load window when opened instead of showing up in front of the nulldc main screen, it pops up behind it. The active window is not the load game window.

With the new code you just gave me, the Open Dialog now types the number 1 into the open file box instead of the name of the game.

I believe that because the window is not the active window, it then decides in about 15 seconds or so to shut down the emulator and loader.

There are a couple questions I have about the script:

1.) the classname=ndc_main_window is that the main screen to nulldc or the open file box?

2.) In Open Dialog, you write ControlSetText... 1148 , $CmdLine[0]? What does that final portion of code mean?

3.) In Display Emu the WinSetState is set to @SW_SHOW? What is that?

4.) How does {ALTDOWN}fn{ALTUP} activate the ALT F menu? or what does it do?

I know, I'm taking up rather large amounts of your time NoLogic. But I am interested in learning. Thank you for everything you have done so far.

Btw, I found your reference to AUTOIT on the NullDC forum at 1upemulation.

Posted

Okay if you go to your AutoIt Programs folder with in the Start Menu you'll see a shortcut called "AutoIt Window Info" this little app will grab you all the info you typically need to know about a given window.

1.) "ndc_main_window" is the class name for the main window form...as rather than the command console.

There are different options for how you would like to identify a given window...I choose a way thats more universal...so should nullDC become multilingual it won't effect the script if its on a English system or a turkish system. :)

2.) this gain is much like the prior...its the actual ID given for the control as its spawned...don't matter what lang the system is...it'll always react correctly to that control.

3.) thats to redisplay the window...its suppose to be launched hidden...so that all you acutally see is the menu dialog as it opens...that is till the open file dialog opens...as I didn't try and hid it...basically its a hold over from my original script. I was trying to keep things as clean as possible...thats why I wrote the script the way I did...other wise I could have written it like this and put in some testing to see if the file is cdi gdi or what ever and then behave accordingly.

4.) holds down the ALT key then press f for File then n for Normal then releases the ALT key...its the best way to handle accelerator shortcuts in and on menu's.

Hehe read the above post where I describe a screw up on my end. ;)

Btw, I found your reference to AUTOIT on the NullDC forum at 1upemulation.

Hehe cool good to see some of my spam leading others into uncharted waters. :)

Posted

Your advice was extremely helpful. Now I understand the things you did. I now have a loader.exe that will work.

I had to get rid of the ControlClick to press the open button and I put in a ControlSend with the enter key. I don't know why

you're ControlClick didn't work because I think it should have. But the ControlSend works.

Would it be alright to post the nulldcloader here on gameex?

Posted
Sure why not?

So, the loader works outside of gameex. But when i run it through gameex, the game loads (I see the Dreamcast logo), but gameex crashes. The game minimizes and it must be shut off by right clicking close (it won't restore). This is my bug report:

11:27:20.2 4/12/2007: Running: cmd.exe /c C: loader.exe "C:\Program Files\gameex\Kenbox Arcade\Dreamcast\New Folder\Soul Calibur.cdi"

11:27:24.8 4/12/2007: 21 Consecutive Exceptions Occured: Exiting

11:27:24.8 4/12/2007: First Exception:

11:27:24.8 4/12/2007: Error in the application.

11:27:24.9 4/12/2007: at Microsoft.DirectX.DirectDraw.Device.SetCooperativeLevel(IntPtr windowHandle, CooperativeLevelFlags flags)

11:27:24.9 4/12/2007: at Microsoft.DirectX.DirectDraw.Device.SetCooperativeLevel(Control parent, CooperativeLevelFlags flags)

11:27:24.9 4/12/2007: at GameEx.GameEx.mainform.InitDirectDraw(Boolean FullScreenWindowed, Boolean nodispose, Boolean reinit, Boolean DontLoadSurfaces, Boolean SetSizingX, Int32 RefreshRate)

11:27:24.9 4/12/2007: at GameEx.GameEx.mainform.ReInitDDraw(Boolean NoDispose, Boolean DontLoadSurfaces, Boolean SetSizingX)

11:27:24.9 4/12/2007: at GameEx.GameEx.mainform.LaunchEmu(Boolean LaunchedFromAttract)

11:27:24.9 4/12/2007: at GameEx.GameEx.mainform.processgamemenu()

11:27:24.9 4/12/2007: at GameEx.GameEx.mainform.DisplayFrame()

11:27:24.9 4/12/2007: Last Exception:

11:27:24.9 4/12/2007: Object reference not set to an instance of an object.

11:27:24.9 4/12/2007: at Microsoft.DirectX.DirectDraw.Surface.get_SurfaceDescription()

11:27:24.9 4/12/2007: at GameEx.GameEx.mainform.DisplayFrame()

Posted

Well GameEx monitor's the process that it spawns...it doesn't monitor process that are started from the parent.

So as is the script out side of GameEx launch's nullDC, manipulates nullDC into loading a game...then exits, leaving nullDC all by its self.

So as we know from prior history as soon as the process ends that was spawned from GameEx its self, it reasserts its self...this is where the problem lays.

So to solve this we need to keep the load active...as long as nullDC is.

Thus we add the following code:

; Wait for Emu to Exit
ProcessWaitClose ( "nullDC_100b1.exe" )

; Close loader
Exit

; EOF

Posted

It's working!

There's one last thing The mouse cursor is in the middle of the screen. I tried changing desktopwidth and height to 1024 by 768 which is greater than the 800 by 600 nulldc runs at to see if it would disappear. No effect.

I'm gonna check the help files to see if I can find something.

This is cool. I really beginning to understand the code.

Posted

hmm this should have done it

; Move Mouse to Lower Right Corner
MouseMove ( @DesktopWidth , @DesktopHeight , 1 )

Keep in mind "@DesktopWidth" wasn't some thing you where to change...that actually a AutoIt macro that grabs the width of the desktop...same for the height one...since the mousemove command works from the upper left corner which equals 0,0 so putting:

MouseMove ( 0 , 0 , 1 )

Would move the mouse to the upper left corner of any desktop and:

MouseMove ( @DesktopWidth , @DesktopHeight , 1 )

should put it in the lower right corner and:

MouseMove ( @DesktopWidth / 2 , @DesktopHeight / 2 , 1 )

should put it in the middle of any screen as we are dividing the height and width of the desktop...no matter what it is.

MouseMove ( 10 , 20 , 1 )

Would move the mouse cursor 10 pixels to the right of upper left and 20 pixels down from upper left

MouseMove ( @DesktopWidth - 10 , @DesktopHeight - 20 , 1 )

Would place the cursor 10 pixels to the left of lower right and 20 pixels above lower right.

Heh well its good your starting to gain a grasp of it. :)

Posted

Doh! I did it again....blah

Opt("MouseCoordMode", 0)

should have been

Opt("MouseCoordMode", 1)

As 0 sets the mouse cursor to be moved based on the active window...rather than the whole of the desktop.

Hehe my f!up

Posted
Doh! I did it again....blah

should have been

Opt("MouseCoordMode", 1)

As 0 sets the mouse cursor to be moved based on the active window...rather than the whole of the desktop.

Hehe my f!up

Never mind. My bad. Refer to below message.

Posted
Tried changing it to 1 and then 2 because what happens now is that nulldc minimizes. It still loads the game but something about changing it to 1 or 2 messes it up.

I wonder if show desktop or don't show desktop would have an effect.

Never mind. My bad. Nulldc has to be set to full screen in the options menu for the loader to work.

Give me a few more minutes to change it back to 1 on the Opt MouseCoord.

Posted
Never mind. My bad. Nulldc has to be set to full screen in the options menu for the loader to work.

Give me a few more minutes to change it back to 1 on the Opt MouseCoord.

The mousecoord setting to 1 or 2 has no effect on the mouse cursor.

Posted
So its still in the middle of the screen? :(

It's still in the middle. Do you think that NullDC in fullscreen mode opens up into another window? I gonna try an activewindow info search.

UPDATE: Checked. It's the same window ndc_main_window

UPDATE 2: Checking for spyware or viruses. Maybe something has control of my mouse? Haven't scanned in a while.

Guest
This topic is now closed to further replies.
×
×
  • Create New...