Jump to content
LaunchBox Community Forums

Recommended Posts

PauseMenu

View File

Hi,

I started working on Pause Menus for some different emulators (RetroArch, Dolphin, Demul, PCSX2 and KAT5200). I'm going to post the RetroArch one here. If people like it or are interested, I'll start posting my other ones as well. Please read the, Read Me.txt, file for info on how to set it up.

The Dolphin Pause Menu has now been released in v1.03

Thanks

Special thanks to @jayjay for creating the config and contributing to making the script easier to setup.

@jayjay is currently working on support for changing fonts and the ability to change button colors.


 

Edited by bbweiners
  • Like 3
Link to comment
Share on other sites

Thats cool @bbweiners. I only briefly looked at your script, much cleaner than my usual jumbled up mess.

AHK usually leaves tray icons behind maybe you could use #NoTrayIcons or look for a script called notrayorphans that you can run on exit.

How about looking into gdip or something similar, I only briefly looked at gdip, but im sure its capable of taking a screenshot and saving them. How about  taking a screenshot when the menu is activated and displaying it in your pause menu. Then with the screenshots expand on the saves, like backing up saves and deleting them.

I was working on something similar but life gets in the way. But I like what you've done so far. Thanks.

Link to comment
Share on other sites

Thanks for the kind words @jayjay

I'm pretty sure the only reason my script is pretty clean is since it's the first time I've really done anything like this. So, it has to be simple so I can understand it, haha.

I never would have even thought of the #NoTrayIcons. That's a simple thing to incorporate and a good idea.

I'm definitely going to look into the gdip suggestion. That's a great idea.

Feel free to change or add anything you want. My hope was for this to be something that people would be interested in enough to want to contribute whatever they see fit. Any poor scripting on my part getting cleaned up, adding features, artwork, etc...

Link to comment
Share on other sites

Hope you dont mind me giving you some suggestions. Im not trying to hijack your work by any means. Your more than welcome to tell me to F off. But I thought I would give you some food for thought as I like what your doing.

 

If u havent already, download scite4autohotkey. Its a cool environment for ahk development.

 

I was told by the smart guys over at the ahk forums that when creating multiple gui's, create them within the auto execute section of your script. The auto execute section of a script is the code that runs when your script is launched so as a rough example something like the following:

#SingleInstance Force

Gui, 1: Font, s40, Zrnic Rg
Gui, 1: Add, Button, gCancel x248 y638 w200 h50, Cancel
Gui, 1: Show

Gui, 2: Font, s40, Zrnic Rg
Gui, 2: Add, Button, gSave x248 y638 w200 h50, Save

Gui, 3: Font, s40, Zrnic Rg
Gui, 3: Add, Button, gLoad x248 y638 w200 h50, Load

Return ;end of auto execute section

Joy1::
Gui, 2: Show
return

Joy2::
Gui, 2: Close
return

Joy3::
Gui, 3: Show
return

This way everything is loaded and ready to go on start up. 

 

A couple of suggestions on how to make it easy to use for others.

 

In your script you use this:

Gui, Add, Picture, AltSubmit, C:\Launchbox\PauseMenu\PauseMenuButtons.png

If you use %A_ScriptDir% at the beginning of a path, it will start the path from wherever the script is located. So if you change the above to:

Gui, Add, Picture, AltSubmit, %A_ScriptDir%\PauseMenuButtons.png

It will give the same result but now you can move your PauseMenu folder to any directory you want.

 

Will your script work without autohotkey installed?

If not how about trying this:

Add this to your launchbox retroarch emulator ahk tab

Path = %A_ScriptDir%

AHKpath := StrReplace(Path, "Metadata\Temp", "AutoHotkey\AutoHotkey.exe")

PauseMenuPath := StrReplace(Path, "Metadata\Temp", "PauseMenu\PauseMenuButtonsRetroArch.ahk")

Run %AHKpath% %PauseMenuPath%

To see what this script is doing test it with this one:

Path = %A_ScriptDir%
msgbox %Path%

AHKpath := StrReplace(Path, "Metadata\Temp", "AutoHotkey\AutoHotkey.exe")
msgbox %AHKpath%

PauseMenuPath := StrReplace(Path, "Metadata\Temp", "PauseMenu\PauseMenuButtonsRetroArch.ahk")
msgbox %PauseMenuPath%

Run %AHKpath% %PauseMenuPath%

Copy this script to your retroarch ahk tab in launchbox.

You will have to test it properly. But should work.

Using this above will also mean you can run your PauseMenu without having to have launchbox installed at C:/ 

Using these 2 methods above should essentially mean you can extract your pause menu straight to a Launchbox directory that is stored anywhere on a computer and have it work.

 

When I start your menu the background is to large for my screen.

If you change this:

Gui,Show,w1920 h1080 y0 x0

to this

Gui,Show,w%A_ScreenWidth% h%A_ScreenHeight% y0 x0

and maybe also change your gui, add, picture

Gui, Add, Picture, w%A_ScreenWidth% h%A_ScreenHeight%

It should resize the background to the size of whatever screen it is on.

 

Hows your Maths? Using %A_ScreenWidth% and %A_ScreenHeight% it is possible for you to work out where the buttons x and y coordinates should be on any screen. I struggle with it so good luck lol.

 

Anyway... food for thought? or overwhelming or just bllx. lol. If any questions just ask. 

 

 

Link to comment
Share on other sites

@jayjay, that's a lot of great info. Thanks for sharing. Would you be interested in working on this with me? Clearly you know a heck of a lot more than I do.  I really wanted a pause menu in Launchbox, so I just decided why not give it a shot. I was hoping that there would be enough interest that someone or multiple someones would want to join in. I view myself as someone to get the ball rolling. So don't F off. Do whatever the opposite of that is, haha.

Link to comment
Share on other sites

I dont mind helping out when I can but my time is very limited, im not sure how much use I can be... I would also suggest as you do this, choose a different emulator than retroarch to progress on. Retroarch's menu is just to good for others to use and test this and maybe join in.

 

Also if anyone uses xpadder or joytokey etc, this potentially is going to clash with it. Im not sure how you could get around this.

 

Anyway test this:

FileSelectFile, file, 2, %A_ScriptDir%, Select a media file:
if Errorlevel
   ExitApp

Gui Wmp: +LastFound
Gui Wmp: Add, ActiveX, w250 h250 vWmp, WMPLayer.OCX
Wmp.Url := file
Gui Wmp: Show, w600 h500 x50 y50, Wmp in GUI
return

Choose a video file. There are other settings, like repeat, remove play, volume buttons etc

The challenge with this is being able to match the game being played with the video file within LB directory. But maybe something to look at in the future.

Link to comment
Share on other sites

 

Iv added some stuff to your script.

The only bit Iv modified on your script is this:

GUI, Add, Button, gCancel x100 y100 w100 h100, Cancel
Gui, Add, Button, gSave x+100 y100 w100 h100, Save
GUI, Add, Button, gLoad x+100 y100 w100 h100, Load
GUI, Add, Button, gPower x+100 y100 w100 h100, Power

Notice the x+100. This means x coordinate + 100 from the previous button. So if you first button is at x130, your next button will be plus 100, so x 230 and so on.

 

Have a look at the config.ahk I made. Try it out. Basically the idea is to be able to move and resize the buttons easily and modify the script to include the new coordinates etc. So others who have a different size screen can use the config.ahk to place the buttons in the correct locations. Once the buttons are in the correct location, if they would be kind enough to post to you the info that is inside the Display.txt file, you could soon have the correct coordinates for different size screens.

 

I will try to explain better when I have more time but give it a go. Any questions ask.

Link to comment
Share on other sites

Just a quick warning. If you make any changes to your pause menu script, dont use the config.ahk on the newly changed script without backing it up. 

 

The config.ahk makes changes to lines 27,28,29,30,31, (i think its those lines if im remebering corectly) on the pause menu script so if you move your gui's about or add any code above those lines, or even modify those lines, the config.ahk will mess the pause menu script up. 

 

Its simple to update the config.ahk to reflect changes in the pause menu script. When im near my pc i'll post up how... if you havent worked it out already.

Link to comment
Share on other sites

Have you tested the config with your new script? its doesn't work for me now lol. Sorry I was supposed to get back to you about updating the config to reflect changes in the pause menu. Also because I haven't added a Gui Exit command, the config runs in the background on exit and can only exit through task manager as you added #notrayicons lol, sorry mate my fault, i should of got back to you sooner. I'll get back to you shortly, just got back from work and need shower and food. wont be long.  

Link to comment
Share on other sites

Yeah. Have you moved the buttons about using the config? Do you have scite4autohotkey installed? If yeah can you tell me which line number...

GUI, Add, Button, gCancel x248 y638 w200 h50, Cancel

That is at?

Edited by jayjay
Link to comment
Share on other sites

Iv added notes but I'll try to explain the best I can...

PauseMenuScriptArr := []

This is to initialise an array. An array is ummm... imagine it as a stack of information. So for our purpose we stack 1 line of text from your pause menu script at a time. Line 1 is stacked at position 1, line 2 is stacked at position 2 and so on.

 

Loop, Parse, PauseMenuScript, `r,`n
{
	PauseMenuScriptArr.Insert(A_LoopField)
}

This here is the stacking in action.

Loop, , pause menu script.ahk, by each line of text

Insert each line of text (A_LoopField) into PauseMenuScriptArray.

 

ChangeFontSize = Gui, Font, s%FontSze%, Zrnic Rg 
	PauseMenuScriptArr.Insert(29, ChangeFontSize) 
	PauseMenuScriptArr.Remove(30) 
	
	CancelButton = GUI, Add, Button, gCancel x%ButtonXCoordinate% y%ButtonYCoordinate% w%ButtonWidth% h%ButtonHeight%, Cancel 
	PauseMenuScriptArr.Insert(30, CancelButton) 
	PauseMenuScriptArr.Remove(31) 
	
	SaveButton = Gui, Add, Button, gSave x+%ButtonSpacing% y%ButtonYCoordinate% w%ButtonWidth% h%ButtonHeight%, Save 
	PauseMenuScriptArr.Insert(31, SaveButton) 
	PauseMenuScriptArr.Remove(32) 
	
	LoadButton = GUI, Add, Button, gLoad x+%ButtonSpacing% y%ButtonYCoordinate% w%ButtonWidth% h%ButtonHeight%, Load 
	PauseMenuScriptArr.Insert(32, LoadButton) 
	PauseMenuScriptArr.Remove(33) 
	
	PowerButton = GUI, Add, Button, gPower x+%ButtonSpacing% y%ButtonYCoordinate% w%ButtonWidth% h%ButtonHeight%, Power 
	PauseMenuScriptArr.Insert(33, PowerButton) 
	PauseMenuScriptArr.Remove(34) 

These here are what you should focus on. This above modifies these lines:

Gui, Font, s10, Zrnic Rg
GUI, Add, Button, gCancel x200 y200 w200 h50, Cancel
Gui, Add, Button, gSave x+10 y200 w200 h50, Save
GUI, Add, Button, gLoad x+10 y200 w200 h50, Load
GUI, Add, Button, gPower x+10 y200 w200 h50, Power

Whatever line these commands are on in your script, you need to change the config to match. 

 

As example...

ChangeFontSize = Gui, Font, s%FontSze%, Zrnic Rg 

All this is saying is "ChangeFontSize" is a variable and this variable equals this text... Gui, Font, s(user in-puted new size), Zrnic Rg

 

PauseMenuScriptArr.Insert(29, ChangeFontSize)

This is saying... Pause menu script Array, Insert at position 29, the variable "ChangeFontSize". This is what you would have to change.

If in your pause menu script you move this line of text:

Gui, Font, s10, Zrnic Rg

to line 50, you would have to change the 29 in the command above to 50.

 

And because of how this works, adding this command to the stack

ChangeFontSize = Gui, Font, s%FontSze%, Zrnic Rg 

doesnt replace position 29, it inserts it at 29 and pushes everything within the stack up by 1.

 

So we have to remove 30 with this

PauseMenuScriptArr.Remove(30)

 

Im struggling to explain to be honest. I'll try something simpler.

In your script, If you move this:

GUI, Add, Button, gCancel x200 y200 w200 h50, Cancel

to line 70.

 

In the config script, change this:

PauseMenuScriptArr.Insert(30, CancelButton) 
PauseMenuScriptArr.Remove(31)

to this

PauseMenuScriptArr.Insert(70, CancelButton) 
PauseMenuScriptArr.Remove(71)

 

In your script, If you move this:

GUI, Add, Button, gSave x200 y200 w200 h50, Save

to line 102.

 

In the config script, change this:

PauseMenuScriptArr.Insert(31, SaveButton) 
PauseMenuScriptArr.Remove(32)

to this

PauseMenuScriptArr.Insert(102, CancelButton) 
PauseMenuScriptArr.Remove(103)

 

If your struggling to understand my shite explanation your more than welcome to not use my script. I wont be offended or you can ask me to update my script before you release again, im not far away. There are prob better ways to do this. I was using this method as apparently its a good way to keep variables and stored info etc to a minimum for better performance etc. 

Link to comment
Share on other sites

Yeah mate thats pretty much it. If only if i had thought of explaining it with 

8 minutes ago, bbweiners said:

If the button info in my script change where they're located according to the line they're on, they have to match those same values in your script.

I might of saved myself some time lol. 

 

If your still good with using my script what do you think of a theme editor. Im not sure how long it will take and whats even possible. But do you think its worth the time? 

  • Like 1
Link to comment
Share on other sites

Haha, well, your explanation actually explained what was going on to help understand the solution. I just jumped right to the solution with blissful ignorance as to why it worked.

A theme editor sounds awesome. I'd have to imagine after basic functionality, stability and ease of setup, which seem to be  currently provided, a theme editor would probably be what people would want the most. Well, that and the ability to use the PauseMenu on other emulators, which I'm currently working on.

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...