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: AHK for Resolution in Mala  (Read 4872 times)

0 Members and 1 Guest are viewing this topic.

EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
AHK for Resolution in Mala
« on: February 07, 2014, 08:39:43 am »
Hi,

I've setup several emulators (Electrem, ZXSpin, WinApe and WinUae) with auto hot key scripts that controls the key-to-joystick mapping, exiting and so on.

However, on exiting some of them (Electrem and WinApe certainly) the Mala layout adjusts. I can reset it through an option in Mala but the "Start" picture is then shunted from the middle to the bottom right for later games.

I've seen some stuff from BadMouth - http://forum.arcadecontrols.com/index.php?topic=121465.0 - to reset the resolution within autohotkey but it doesn't seem to work in this instance. Has anyone else had trouble with the resolutions of Mala and some emulators when running (and later exiting) AutoHotKey through Mala's pre/post commands?

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 07:23:49 am
  • ...
Re: AHK for Resolution in Mala
« Reply #1 on: February 07, 2014, 02:38:27 pm »
I've never tried it as part of the post command.

I incorporate it into the same script that launched the game.
When ESC is pressed, the script kills the game exe and switches the resolution.
That might be making it fast enough that the resolution is switched before Mala regains focus and is redrawn.

Also see my post in that thread about using the winclose command instead.
I learned about it after most of my posts about using process, close.
Sometimes my current advice is different from my old advice.  :lol

Post your script and I'll see if there's any reason it wouldn't be working.

EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
Re: AHK for Resolution in Mala
« Reply #2 on: February 10, 2014, 06:02:10 am »
I will do BadMouth, thanks.

My pre/post command comment was misleading - I start the AHK script in the PRE command. The POST command simply does a taskill of it. In the case of Electrem I have a different AHK script for each game - as the keys generally differ slighly for each game on the Acorn Electron. I determine which script to run with HK_%rom% in the pre-command.

Anyway, I'll post the script and more details. It might be that I run a BAT file rather than the emulator which determines/runs/stops the AHK script for each game - that might match more what you do in your example

EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
Re: AHK for Resolution in Mala
« Reply #3 on: February 10, 2014, 06:25:51 am »
This is my AHK script for one game (Croaker) which I compile to .exe

PRE = cmd /c start /MIN "" c:\ArcadeCabinet\Utilities\AutoHotKey\HK_%rom%.exe
POST= taskkill /IM HK_%rom%.exe

The HK_croaker.ahk (compiled to HK_croaker.exe) is as follows. I haven't included the RES addition here as I couldn't get it working for me. If you can see how to make the changes for it to work in this script BadMouth then great :-)

;Electrem to Mame Keys
SendMode Input

#IfWinActive ahk_class SDL_app ;ElectrEm from AHK Windows Spy
{
   up::a
   down::z
   left::n
   right::m      
   1::space           ;Start Game
   6::t            ;Music On/Off
   x::send DG {enter}      ;For Highscore Entry
   Escape::WinClose, ElectrEm    ;Exit Electrem
}
return

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 07:23:49 am
  • ...
Re: AHK for Resolution in Mala
« Reply #4 on: February 11, 2014, 06:39:48 pm »
The post command might be killing the script before it has a chance to reset the resolution.
If you're starting the script when launching the game (and exiting the script when you press ESC), then you don't need IFWinActive.

Try this:

Code: [Select]
up::a
down::z
left::n
right::m     
1::space           ;Start Game
6::t            ;Music On/Off
x::send DG {enter}      ;For Highscore Entry

Escape::WinClose, ElectrEm    ;Exit Electrem

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 )
}

and leave the POST line empty.

EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
Re: AHK for Resolution in Mala
« Reply #5 on: February 12, 2014, 04:31:32 am »
Thanks Badmouth, I will try it later.

Does the ExitAPP in AHK remove the need for my POST taskkill then? It's certainly neater if it does :-)

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 07:23:49 am
  • ...
Re: AHK for Resolution in Mala
« Reply #6 on: February 12, 2014, 09:02:34 am »
Thanks Badmouth, I will try it later.

Does the ExitAPP in AHK remove the need for my POST taskkill then? It's certainly neater if it does :-)

Yup, makes the script exit.

I haven't tested this script, but it's similar to what I'm using for a few other things.

EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
Re: AHK for Resolution in Mala
« Reply #7 on: February 13, 2014, 03:32:58 pm »
Hi

Unfortunately the script didn't work. The keys aren't working - i.e. "1" doesn't do "Space" (see enclosed script). However, if I press "space" it also doesn't work - implying that is mapped (to return/nothing so it "sort of" is working.

On exit, the AHK is still running so the ExitAPP doesn't seem to have worked either.

script and a screenshot of the non-adjustment of resolution enclosed - any more ideas :-) I think the IF might be needed - vague recollections thats how I got the keys working at least before.


EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
Re: AHK for Resolution in Mala
« Reply #8 on: February 16, 2014, 06:59:05 am »
Removing AHK from pre/post completely and the graphics shift in Mala still occurs.

SO, I could use AHK in some way to shift it back by changing the resolution (I know not how though)

OR, I need to find why the graphics shift happens from "Electrem" (and others). Mala is 1280x800 so perhaps that is why - Electrem is 4:3 I believe. My main arcade cabinet PC is also 4:3 (1600x1200) so I'll try it on there also

EssexMame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 472
  • Last login:May 20, 2025, 09:13:39 am
  • Mame Weekender
Re: AHK for Resolution in Mala
« Reply #9 on: February 17, 2014, 11:07:22 am »
I don't think this is AHK at all but the emulator/full screen resolution settings as described for Stella here:
http://forum.arcadecontrols.com/index.php?topic=88602.0

Now, AHK may be able to help that with these resolution tweaks (but not so far). I don't think Electrem has the same options to "get around" the problems as Stella but I'll have a play. I could hopefully exit it with Closemul.exe and help Electrem here. Alas, no Electrem source code and no ini file to speak of either so it might be a problem. The "GUI --> Game Start/Quit --> Reorder layout after game exit" does help, EXCEPT for the shift of the START button image. Is it possible to not have a "START" image perhaps? It doesn't really add much..

I'm Mala version 1.7.4.5 (beta) - I'm on beta to get around other issues fixed from 1.7.4 - I forget what.