Le 15/07/2015 08:57, Kevin Fishburne a écrit : > I've been working on an arcade cabinet over the last few weeks and it's > almost done. I started work tonight on the front end because existing > ones aren't suitable for a real-world cabinet. This is the first > open-source project I've released and you can find it here (we'll say > it's GPLv2 for now, maybe BSD later): > > http://eightvirtues.com/misc/MAMEMENU/ > > Here is the first of five parts (with a sixth to follow) showing my > progress building it: > > https://youtu.be/yiy8T7ihZOk > > It was a bit tricky because it uses SDL and OpenGL but must still work > with MAME which also uses those libraries. I grab the first/primary > joystick using: > > Public PadDevice As Process > PadDevice = Exec ["cat", "/dev/input/js0"] For Read As "Gamepad" > > which allows both MAME and the GAMBAS app to accept joystick commands > simultaneously (keyboard events are hoarded by MAME since SDL handles > them). These lines: > > Public MenuButton1 As Byte = 8 ' Buttons to be held > simultaneously to quit game and return to main menu. > Public MenuButton2 As Byte = 9 ' Buttons to be held > simultaneously to quit game and return to main menu. > > assign which gamepad buttons cause MAMEMENU to kill the MAME process and > return to MAMEMENU. When a gamepad button is pressed its number is > printed, so when running this on your system/gamepad use that as a > reference for changing those lines to use whatever two buttons you'd > like to terminate MAME when held simultaneously. I've included my > mame.ini file which you can modify to fit your needs, although the > screen options are tuned to work with MAMEMENU which is designed to run > full-screen on an arcade cabinet. > > MAMEMENU is in its infancy (just started on it tonight), so it's > functionally rough, but is pretty solid outside of a single issue. When > I kill the MAME process in GAMBAS it doesn't "shut down gracefully", and > the OS (Linux Mint 17.1 Cinnamon) thinks the resolution MAME was using > when killed is the resolution that should be used when MAMEMENU/GAMBAS > exits, despite me manually telling GAMBAS to use the initial desktop > resolution upon exiting. The solution I think is to shut down MAME > "gracefully", but I don't know how to do that. > > Is there a way to gracefully kill a process, such as by sending it a > command to exit instead of using Process.Kill? > > Also let me know if you need help getting it up and running. All the > needed files have been supplied but there's no documentation. Thanks! >
If your process has a top-level X11 window, even if it is not visible, you can close that window from any process. You need just the handle of that window. I added the Window.Handle property to gb.sdl2, it will be committed when Sourceforge servers come back. Meanwhile, you can use Desktop.FindWindow() in 'gb.desktop' to search for a window with a specific title and get its handle. Then you call the Desktop.Windows.FromHandle(id).Close() method to close it. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user