The NEW Build Your Own Arcade Controls
Main => Software Forum => Topic started by: danpomeroy on November 19, 2007, 05:44:23 pm
-
I can shell out to MAME but when I add the rom name it won't load. With no rom name, mame loads but says there are no roms even though there is. Any Ideas?
VB2005
-
Its a working directory problem. Before shelling out, use CHDRIVE and CHDIR to the directory where mame is located. That way, MAME can find the MAME.INI file (if it exists) and the ROMS folder.
ChDrive ("e:")
ChDir ("\emulators\mame")
Shell ("mame.exe pacman")
-
This is VB 2005 though. So you really want to use the System.Diagnostics.Process namespace.
Private Sub LaunchGame(ByVal GameName As String)
Dim myProcess As Process = New Process
AddHandler myProcess.Exited, AddressOf MameExited
myProcess.StartInfo.WorkingDirectory = "E:\Emulators\Mame"
myProcess.StartInfo.FileName = "E:\Emulators\Mame\Mame.exe"
myProcess.StartInfo.Arguments = GameName
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.EnableRaisingEvents = True
myProcess.Start()
End Sub
Private Sub MameExited(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show("Mame exited!")
End Sub
-
What is the advantage?
-
What is the advantage?
No great advantage, but Process is a handy namespace to get used to working with. It can tell you when a process has exited and hide the Command Line window for example. It gives you more control over the legacy Shell() method from VB6. It's really just the standard way to launch a process using VB.NET, but you get the same result in the end I guess ;)