Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Mala layout gets messed up after exiting a game via AHK keys  (Read 3884 times)

0 Members and 1 Guest are viewing this topic.

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • Last login:April 06, 2017, 01:33:35 pm
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
I'm using an AHK script to launch a PC Game (Big Buck Hunter) on my cabinet.

After playing the game I can exit out two ways; by pressing ESC or by presing my combo two buttons AHK keys (2 + 4) at the same time. Both work to exit, but the latter somehow sets up Mala to not look right upon return.

If I press ESC, everything jumps back to the Mala frontend screen and menu like it's supposed to. Looks fine, works fine. 

If I press 2 + 4, it goes back to Mala but the Mala screen and menu layout is somewhat jumbled up - the background is pushed into and past the lower right hand corner while the game screenshot and one other graphic overlay remain where they are suppose to be. It's like there wasn't a proper switch of resolutions back to my desktop resolution for Mala to get reset on the layout correctly. The menu system still works, but it doesn't look pretty.

Why is this happening with the two button exit only and more importantly, how can if fix it?? Thanks in advance for any help.

See below for my AHK code:


#SingleInstance force
SetWorkingDir, C:\Arcade\PC Arcade Ports\Big Buck Hunter\BBH2
Run, C:\Arcade\PC Arcade Ports\Big Buck Hunter\BBH2\BBH2.exe

WinWait, BBHSC
WinWaitClose, BBHSC
exitAPP

LCtrl::~LButton
LAlt::~RButton
c::~ESC

a::~LButton
s::~RButton
]::~ESC

~2 & ~4::
Process, Close, BBH2.exe
ExitAPP
return
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:June 24, 2025, 10:49:58 am
  • ...
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #1 on: July 15, 2012, 10:31:09 pm »
There is an option in Mala to re-order the layout, but not sure if that would help in this situation.

Autohotkey cures all though.  ;D
Copied from one of my scripts, but originally swiped from here:
http://www.autohotkey.com/community/viewtopic.php?f=2&t=8355&start=30
Just change the resolution settings to match your desktop.



#SingleInstance force
SetWorkingDir, C:\Arcade\PC Arcade Ports\Big Buck Hunter\BBH2
Run, C:\Arcade\PC Arcade Ports\Big Buck Hunter\BBH2\BBH2.exe

WinWait, BBHSC
WinWaitClose, BBHSC
exitAPP

LCtrl::~LButton
LAlt::~RButton
c::~ESC

a::~LButton
s::~RButton
]::~ESC

~2 & ~4::
Process, Close, BBH2.exe

cD = 32   ; bits (quality) - you can change to suit your requirments
sW = 1920 ; pixels - you can change to suit your requirments
sH = 1080  ; pixels - you can change to suit your requirments
rR = 60   ; Hz (frequency) - you can change to suit your requirments

ChangeDisplaySettings( cD, sW, sH, rR )


ExitAPP

Return

ChangeDisplaySettings( cD, sW, sH, rR ) {
  VarSetCapacity(dM,156,0), NumPut(156,dM,36)
  DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
  NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
  Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
}

« Last Edit: July 15, 2012, 10:39:18 pm by BadMouth »

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • Last login:April 06, 2017, 01:33:35 pm
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #2 on: July 15, 2012, 11:14:21 pm »
Sweet. I like it. Thanks badmouth! !   :applaud:

Another quick fix was just to map the whole two button exit to the ESCAPE key instead of the close process command:

~2 & ~4:: Send input {ESC}
ExitAPP
return
« Last Edit: July 16, 2012, 06:29:03 pm by Wade007 »
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

juggle50

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 323
  • Last login:July 18, 2024, 07:25:48 am
  • Your either on the bus or off the bus
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #3 on: October 12, 2013, 04:55:20 pm »
Hey guys,

I want to use the method badmouth describes below to change resolutions back to desktop settings so mala doesn't get all disordered when I close a process with autohotkey.  However, I'm using arcade VGA and a multisync arcade monitor and I'm not sure what my true desktop resolution is and don't trust the windows display settings say.  Is there a program that will tell me exactly what my desktop resolution is?  Sorry if this is a dumb question.

empardopo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 526
  • Last login:June 22, 2025, 10:00:52 am
    • My personal forum
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #4 on: October 12, 2013, 05:37:47 pm »
I think the problem is to kill the process.
Take a look to my program AllInOneFYC.
Greetings.

Enviado desde mi GT-N7100 usando Tapatalk 2

juggle50

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 323
  • Last login:July 18, 2024, 07:25:48 am
  • Your either on the bus or off the bus
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #5 on: October 12, 2013, 11:03:25 pm »
Yeah, the allinonefyc looks pretty handy. Does the close process function on your program reset the resolution?  I can close process with autohotkey but the problem is that mala looks very odd when I close process out of mame.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:June 24, 2025, 10:49:58 am
  • ...
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #6 on: October 13, 2013, 07:00:59 pm »
Hey guys,

I want to use the method badmouth describes below to change resolutions back to desktop settings so mala doesn't get all disordered when I close a process with autohotkey.  However, I'm using arcade VGA and a multisync arcade monitor and I'm not sure what my true desktop resolution is and don't trust the windows display settings say.  Is there a program that will tell me exactly what my desktop resolution is?  Sorry if this is a dumb question.

Sorry, don't know much about arcade VGA.

You might try using the winclose command instead of process, close.
Instead of the exe name, it requires whatever is in the title bar.

WinClose, BBHSC

It's gentler than process close and might not screw up the resolution.
I'm not sure, I haven't tested it, but it's worth a shot.

empardopo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 526
  • Last login:June 22, 2025, 10:00:52 am
    • My personal forum
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #7 on: October 14, 2013, 03:25:32 am »
Yeah, the allinonefyc looks pretty handy. Does the close process function on your program reset the resolution?  I can close process with autohotkey but the problem is that mala looks very odd when I close process out of mame.
No.

What key closes your program? If, for example, ESC is the key that closes the program you can use the keyrempas section of AllInOneFYC.
In the section, WindowsResolution you can define a key or button to change the windows resolution.
You can see the AllInOneFYCs instructions in this thread.

Greetings!



juggle50

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 323
  • Last login:July 18, 2024, 07:25:48 am
  • Your either on the bus or off the bus
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #8 on: October 16, 2013, 07:39:17 pm »
Badmouth, as usual you are the ahk master.  Winclose worked like a charm, no mala disorder after closing the game.  Thanks again for getting me out of yet another jam.

Empardopo, thank you for your help too.  Your program looks great!  If I didn't already have an ahk script running, I would have totally used your program.  I'll give it a shot if I get into a jam in the future.  Might not be a bad idea to add a "winclose" feature to compliment the process close cabability.  That seemed to make a world of difference to the mala front end.

Cheers fellas!

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:June 24, 2025, 10:49:58 am
  • ...
Re: Mala layout gets messed up after exiting a game via AHK keys
« Reply #9 on: October 16, 2013, 09:37:35 pm »
Badmouth, as usual you are the ahk master. 

Nitz is the AHK master.  I'm just around more.  :lol