Incoming User Function Changes

brolly

Administrator
Developer
Edited my previous post, you didn't change the class name so that would never work like that.
 

reddye5

New member
RL Member
Hey Again,

I'm still getting an error on game launch from Hyperspin with the below MAME.ahk.

Here's the code again:
Code:
class SystemUserFunction extends UserFunction {

; Use this function to define any code you want to run in every module on start
StartUserFeatures() {
Global RLLog, romName, emupath, ListXMLInfo

RLLog.Info(A_ThisFunc . " - Starting")

ListMameTable := []
ListMameTable := ListXMLInfo%zz%(romName)
RotationAngle := ListMameTable[2]

If (romName == "punchout")
{
RLLog.Info("RotateFunctions - Override Punchout")
Run, %emupath%\maestro -p, %emupath%\, hide
RLLog.Info("RotateFunctions - Rotating Portrait")
}
Else If (RotationAngle != "0")
{
Run, %emupath%\maestro -p, %emupath%\, hide
RLLog.Info("RotateFunctions - Rotating Portrait")
} Else {
Run, %emupath%\maestro -l, %emupath%\, hide
RLLog.Info("RotateFunctions - Rotating Landscape")
}
RLLog.Info(A_ThisFunc . " - Ending")
}

; Use this function to define any code you may need to stop or clean up in every module on exit
StopUserFeatures() {
Global RLLog, emupath
RLLog.Info(A_ThisFunc . " - Starting")

Run, %emupath%\maestro -l, %emupath%\, hide
RLLog.Info("RotateFunctions - Rotating Landscape")
}
RLLog.Info(A_ThisFunc . " - Ending")
}

Here's the error:
MAME_ahk_error.png

Any idea why I might be getting this? Thanks
 
Last edited:

agent47

Super Moderator
Staff member
Supporter
RL Member
The line the error message mentions is outside of the StopUserFeatures function so it needs to be moved. This should work:

Code:
class SystemUserFunction extends UserFunction {

	; Use this function to define any code you want to run in every module on start
	StartUserFeatures() {
		Global RLLog, romName, emupath, ListXMLInfo

		RLLog.Info(A_ThisFunc . " - Starting")

		ListMameTable := []
		ListMameTable := ListXMLInfo%zz%(romName)
		RotationAngle := ListMameTable[2]

		If (romName == "punchout")
		{
			RLLog.Info("RotateFunctions - Override Punchout")
			Run, %emupath%\maestro -p, %emupath%\, hide
			RLLog.Info("RotateFunctions - Rotating Portrait")
		}
		Else If (RotationAngle != "0")
		{
			Run, %emupath%\maestro -p, %emupath%\, hide
			RLLog.Info("RotateFunctions - Rotating Portrait")
		} 
		Else {
			Run, %emupath%\maestro -l, %emupath%\, hide
			RLLog.Info("RotateFunctions - Rotating Landscape")
		}
		RLLog.Info(A_ThisFunc . " - Ending")
	}

	; Use this function to define any code you may need to stop or clean up in every module on exit
	StopUserFeatures() {
		Global RLLog, emupath
		RLLog.Info(A_ThisFunc . " - Starting")

		Run, %emupath%\maestro -l, %emupath%\, hide
		RLLog.Info("RotateFunctions - Rotating Landscape")
		RLLog.Info(A_ThisFunc . " - Ending")
	}
}
 

aorin1

Member
RL Member
I have some games that need alt+enter after launching to become full screen in PC Games, and some that will need a simple Space key to be launched, can someone tell me where to add these commands or paste the commands so I can try them here?
 

agent47

Super Moderator
Staff member
Supporter
RL Member
Create an ahk script located at RocketLauncher/Lib/User Functions/%SystemName%/%GameName%, paste the following in that file, and set Fullscreen to true on the Misc tab in the PCLauncher module for that game.

Code:
class GameUserFunction extends GameFunction {

	SetFullscreenPostLaunch(fs) {
		RLLog.Info(A_ThisFunc . " - Starting")
		;Sleep, 1000
		Send, !{Enter}
		RLLog.Info(A_ThisFunc . " - Ending")
	}
}

You may have to uncomment and play with the Sleep value if it isn't working for whatever reason to ensure it's not getting sent too early. To send a space instead replace !{Enter} with {Space}.
 

aorin1

Member
RL Member
I believe I put the ahk files in their correct paths, tried both games, one needs alt+enter, the other needs space to start, but none received the commands, I also increased the sleep value to make sure they weren`t sent too early, but it didn`t work, does it have something to do with the autohotkey version I have installed?

AHK version 1.1.21.02

The path I tried is \RocketLauncher\Lib\User Functions\PC Games\Game Folder\Game AHK file\

I also tried \RocketLauncher\Lib\User Functions\PC Games\Game AHK file\
 
Last edited:

brolly

Administrator
Developer
agent's solution should work, you'll need to check the log to make sure the function is being called.
Could also be that the game only reacts to real keyboard events in that case there's nothing it can be done as simulated keypresses won't work.
 

brolly

Administrator
Developer
Well, the function is being called:
21:44:13:506 | MD | INFO | +47 | GameUserFunction.SetFullscreenPostLaunch - Starting

You can try doing something like instead of the !{Enter}:
KeyUtils.Send("{Alt Down}{Enter}{Alt Up}")
 

aorin1

Member
RL Member
I tried with the new instructions but the game keeps Windowed no matter what, I'm removing it from the database, it will only accept true keyboard alt+enter to go full screen.

Thanks for checking again!
 

aorin1

Member
RL Member
I've managed to make Myst V - End of Ages boot without any further intervention, since it dumbly asks which language every time you start the game.
The simple command "Send {space}" did the trick.
Sonic Before the Sequel and Sonic After the Sequel only need alt+enter to become full screen but it won't accept the commands I tried earlier, I'll probably stick to a simple Xpadder profile and assign a button in the gamepad to do that for me.
Now, Assassin's Creed - Revelations need space in order to enter the game, and when I close the game, that uplay launcher is still there waiting for me to close it, an alt+F4 should do the trick, but it didn't accept the simple "Send {space}" command to only start the game so I stopped there.

Can someone help me figuring that out? Some games will only accept the physical keyboard, yet somehow I don't believe that it cannot be sorted out.
 

agent47

Super Moderator
Staff member
Supporter
RL Member
Some games will only accept the physical keyboard, yet somehow I don't believe that it cannot be sorted out.

Well, believe it. If it only accepts physical keyboard inputs then you obviously can't use simulated ones via AHK. I don't own AC: Revelations (on PC) so I can't verify if it's one of those games or not.

Regarding the UPlay launcher, are you referring to the game launcher or the UPlay client?
 

aorin1

Member
RL Member
It launches this Uplay screen when I open any AC Revelations exe from the game's install folder:
https://ibb.co/mGWgM7

It works with Enter and needs to be closed after I exit the game, from all my AC collection in the frontend, this is the only version I couldn't get to launch directly without any third party launcher.
 

aorin1

Member
RL Member
Hey guys, mainly Agent, thanks again for the help, I was having a hard time believing these commands weren't working.
It was nothing less than administrative privilege to the Autohotkey.exe, since it's installed in C:\program files, it needed this permission in order to make the commands work, now all games that has a launcher and needs input to start are working automatically.
I went ahead and made 3 scripts that will launch each of the Shadow Warrior (1998 game) and expansions with auto cursor move and click, there's no other way (via command line or anything) this game will launch, no parameters, no keys, only clicks.
 
Top