Jump to content
LaunchBox Community Forums

Does anyone use the Yuzu feature to select a user profile on game launch?


drw4013

Recommended Posts

When I start a Yuzu game with Launchbox, it does bring up the user profile selection window, but the controller is stuck selecting the game menu behind the user profile window (see blue selection bar in screenshot). If I use a mouse to select a user profile, the game starts correctly.

Is there any way to fix this  focus issue so I can select a profile with the controller?

image.thumb.png.337b282336fe12bdbf3c0278325fff3d.png

Edited by drw4013
Link to comment
Share on other sites

the controller wouldn't control anything on that window. as far as I know yuzu would translate your controller to work WITHIN the game, not prior or at boot. same goes for LB/BB. the mappings done in the frontend do not translate into meaning you can use the controller to interact with other programs.

what is the point of this? I'm not sure what the benefit is to have multiple users selectable?

assuming you can navigate that Profile Selection window with a keyboard you could use a remapper to interact with it via controller. something like virtualcontroller, GlovePIE, antimicro, etc. if you have a go to remapper you could do it easily with that. for ex make up/down on d-pad navigate up down so up/down keyboard keys and use one of the face buttons as enter. if that sounds too much.....

 

then you could use an AHK script to move the mouse into position, click on the desired user, move the mouse into position, click on the OK button. it could go into the running script tab and would run for all yuzu games. note that those X, Y values I used are completely random numbers to just show syntax sort of example. you would need to figure out the actual coordinates using WinSpy. if you don't have that, I put that in the spoiler tag below. Run that and make sure to use the relative coordinates. So you want the "Mouse Position > Window" values . Hover the mouse over the spot you want to move to and take note of what the X Y coordinates are and put those in this script below, replacing the bogus values I used

WinActivate, Profile Selector 		;to make sure Profile Selector window is in focus
CoordMode, Mouse, Relative    		;makes mousemove commands releative to the top left corner of active window
MouseMove(54, 102)   				;moves to user profile
Send {LButton}              		;clicks mouse left button
MouseMove(169, 512)					;moves to OK button
Send {LButton}                      ;clicks mouse left button


WinSpy script here:

Spoiler


;
; Window Spy
;

#NoEnv
#NoTrayIcon
#SingleInstance Ignore
SetWorkingDir, %A_ScriptDir%
SetBatchLines, -1
CoordMode, Pixel, Screen

txtNotFrozen := "(Hold Ctrl or Shift to suspend updates)"
txtFrozen := "(Updates suspended)"
txtMouseCtrl := "Control Under Mouse Position"
txtFocusCtrl := "Focused Control"

Gui, New, hwndhGui AlwaysOnTop Resize MinSize
Gui, Add, Text,, Window Title, Class and Process:
Gui, Add, Checkbox, yp xp+200 w120 Right vCtrl_FollowMouse, Follow Mouse
Gui, Add, Edit, xm w320 r4 ReadOnly -Wrap vCtrl_Title
Gui, Add, Text,, Mouse Position:
Gui, Add, Edit, w320 r4 ReadOnly vCtrl_MousePos
Gui, Add, Text, w320 vCtrl_CtrlLabel, % txtFocusCtrl ":"
Gui, Add, Edit, w320 r4 ReadOnly vCtrl_Ctrl
Gui, Add, Text,, Active Window Position:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_Pos
Gui, Add, Text,, Status Bar Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_SBText
Gui, Add, Checkbox, vCtrl_IsSlow, Slow TitleMatchMode
Gui, Add, Text,, Visible Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_VisText
Gui, Add, Text,, All Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_AllText
Gui, Add, Text, w320 r1 vCtrl_Freeze, % txtNotFrozen
Gui, Show, NoActivate, Window Spy
GetClientSize(hGui, temp)
horzMargin := temp*96//A_ScreenDPI - 320
SetTimer, Update, 250
return

GuiSize:
Gui %hGui%:Default
if !horzMargin
	return
SetTimer, Update, % A_EventInfo=1 ? "Off" : "On" ; Suspend on minimize
ctrlW := A_GuiWidth - horzMargin
list = Title,MousePos,Ctrl,Pos,SBText,VisText,AllText,Freeze
Loop, Parse, list, `,
	GuiControl, Move, Ctrl_%A_LoopField%, w%ctrlW%
return

Update:
Gui %hGui%:Default
GuiControlGet, Ctrl_FollowMouse
CoordMode, Mouse, Screen
MouseGetPos, msX, msY, msWin, msCtrl
actWin := WinExist("A")
if Ctrl_FollowMouse
{
	curWin := msWin
	curCtrl := msCtrl
	WinExist("ahk_id " curWin)
}
else
{
	curWin := actWin
	ControlGetFocus, curCtrl
}
WinGetTitle, t1
WinGetClass, t2
if (curWin = hGui || t2 = "MultitaskingViewFrame") ; Our Gui || Alt-tab
{
	UpdateText("Ctrl_Freeze", txtFrozen)
	return
}
UpdateText("Ctrl_Freeze", txtNotFrozen)
WinGet, t3, ProcessName
WinGet, t4, PID
UpdateText("Ctrl_Title", t1 "`nahk_class " t2 "`nahk_exe " t3 "`nahk_pid " t4)
CoordMode, Mouse, Relative
MouseGetPos, mrX, mrY
CoordMode, Mouse, Client
MouseGetPos, mcX, mcY
PixelGetColor, mClr, %msX%, %msY%, RGB
mClr := SubStr(mClr, 3)
UpdateText("Ctrl_MousePos", "Screen:`t" msX ", " msY " (less often used)`nWindow:`t" mrX ", " mrY " (default)`nClient:`t" mcX ", " mcY " (recommended)"
	. "`nColor:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")")
UpdateText("Ctrl_CtrlLabel", (Ctrl_FollowMouse ? txtMouseCtrl : txtFocusCtrl) ":")
if (curCtrl)
{
	ControlGetText, ctrlTxt, %curCtrl%
	cText := "ClassNN:`t" curCtrl "`nText:`t" textMangle(ctrlTxt)
    ControlGetPos cX, cY, cW, cH, %curCtrl%
    cText .= "`n`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
    WinToClient(curWin, cX, cY)
	ControlGet, curCtrlHwnd, Hwnd,, % curCtrl
    GetClientSize(curCtrlHwnd, cW, cH)
    cText .= "`nClient:`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
}
else
	cText := ""
UpdateText("Ctrl_Ctrl", cText)
WinGetPos, wX, wY, wW, wH
GetClientSize(curWin, wcW, wcH)
UpdateText("Ctrl_Pos", "`tx: " wX "`ty: " wY "`tw: " wW "`th: " wH "`nClient:`tx: 0`ty: 0`tw: " wcW "`th: " wcH)
sbTxt := ""
Loop
{
	StatusBarGetText, ovi, %A_Index%
	if ovi =
		break
	sbTxt .= "(" A_Index "):`t" textMangle(ovi) "`n"
}
StringTrimRight, sbTxt, sbTxt, 1
UpdateText("Ctrl_SBText", sbTxt)
GuiControlGet, bSlow,, Ctrl_IsSlow
if bSlow
{
	DetectHiddenText, Off
	WinGetText, ovVisText
	DetectHiddenText, On
	WinGetText, ovAllText
}
else
{
	ovVisText := WinGetTextFast(false)
	ovAllText := WinGetTextFast(true)
}
UpdateText("Ctrl_VisText", ovVisText)
UpdateText("Ctrl_AllText", ovAllText)
return

GuiClose:
ExitApp

WinGetTextFast(detect_hidden)
{
	; WinGetText ALWAYS uses the "Slow" mode - TitleMatchMode only affects the
	; WinText/ExcludeText parameters.  In "Fast" mode, GetWindowText() is used
	; to retrieve the text of each control.
	WinGet controls, ControlListHwnd
	static WINDOW_TEXT_SIZE := 32767 ; Defined in AutoHotkey source.
	VarSetCapacity(buf, WINDOW_TEXT_SIZE * (A_IsUnicode ? 2 : 1))
	text := ""
	Loop Parse, controls, `n
	{
		if !detect_hidden && !DllCall("IsWindowVisible", "ptr", A_LoopField)
			continue
		if !DllCall("GetWindowText", "ptr", A_LoopField, "str", buf, "int", WINDOW_TEXT_SIZE)
			continue
		text .= buf "`r`n"
	}
	return text
}

UpdateText(ControlID, NewText)
{
	; Unlike using a pure GuiControl, this function causes the text of the
	; controls to be updated only when the text has changed, preventing periodic
	; flickering (especially on older systems).
	static OldText := {}
	global hGui
	if (OldText[ControlID] != NewText)
	{
		GuiControl, %hGui%:, % ControlID, % NewText
		OldText[ControlID] := NewText
	}
}

GetClientSize(hWnd, ByRef w := "", ByRef h := "")
{
	VarSetCapacity(rect, 16)
	DllCall("GetClientRect", "ptr", hWnd, "ptr", &rect)
	w := NumGet(rect, 8, "int")
	h := NumGet(rect, 12, "int")
}

WinToClient(hWnd, ByRef x, ByRef y)
{
    WinGetPos wX, wY,,, ahk_id %hWnd%
    x += wX, y += wY
    VarSetCapacity(pt, 8), NumPut(y, NumPut(x, pt, "int"), "int")
    if !DllCall("ScreenToClient", "ptr", hWnd, "ptr", &pt)
        return false
    x := NumGet(pt, 0, "int"), y := NumGet(pt, 4, "int")
    return true
}

textMangle(x)
{
	if pos := InStr(x, "`n")
		x := SubStr(x, 1, pos-1), elli := true
	if StrLen(x) > 40
	{
		StringLeft, x, x, 40
		elli := true
	}
	if elli
		x .= " (...)"
	return x
}

~*Ctrl::
~*Shift::
SetTimer, Update, Off
UpdateText("Ctrl_Freeze", txtFrozen)
return

~*Ctrl up::
~*Shift up::
SetTimer, Update, On
return


 

Link to comment
Share on other sites

16 hours ago, skizzosjt said:

the controller wouldn't control anything on that window. as far as I know yuzu would translate your controller to work WITHIN the game, not prior or at boot. same goes for LB/BB. the mappings done in the frontend do not translate into meaning you can use the controller to interact with other programs.

...but the controller works with the Yuzu games list window right behind this window just fine? It allows scrolling and selection.  It just isn't focused on the profile window...

16 hours ago, skizzosjt said:

what is the point of this? I'm not sure what the benefit is to have multiple users selectable?

It would mirror how the Switch console works where you select a game, then choose a profile.  It allows for multiple users saves for games that only have a single profile save, like Breath of the Wild, etc.

Link to comment
Share on other sites

8 minutes ago, drw4013 said:

...but the controller works with the Yuzu games list window right behind this window just fine? It allows scrolling and selection.  It just isn't focused on the profile window...

then you would need to just make the profile selector window in focus with WinActivate. or actually, first and foremost, prove to yourself you can even navigate on the profile selector window with a controller. I'm surprised you can move up/down in the game selection list with a controller. normally the emulator is assumed to be launched with mouse and/or keyboard, not controllers. this is a PC after all. either way...... just click into the profile selector window with the mouse and then try navigating and selecting with the controller. if that works it would prove you need to make sure the window is in focus. if it doesn't work, you're back to following my previous post for advice

here is one scenario. if you prove you can navigate the profile selector window with controller but WinActivate isn't helping to make it all automated then you would need to emulate exactly what you did to get the controller to work there....which involves a mouse click. So you would still need to use the mousemove and LButton in order to use the controller.

 

 

I just finally did some googling on it and found this. there might be a bug/quirk with using a controller to do this anyway? looks like this bug is still open, so it might be a problem even if you do select it with a controller.

https://github.com/yuzu-emu/yuzu/issues/8535

Link to comment
Share on other sites

32 minutes ago, drw4013 said:

It would mirror how the Switch console works where you select a game, then choose a profile.  It allows for multiple users saves for games that only have a single profile save, like Breath of the Wild, etc.

ahh good feature then! I wasn't sure if it was something emulation specific or was native.

Link to comment
Share on other sites

  • 7 months later...

My issue is exactly like drw4013 is describing. In big box only I select desired game and select "play" in the top left corner. Yuzu launches just fine and the window to select profile pops up but the controller is focused on the game selection window instead of the window to select the profile, this requires me to have to select the profile window with the mouse. In Launch box it's self I do not have this issue, it works as you would expect with all windows popping up in correct focus and I am able to select and start the desired game with selecting  the correct profile all with just the controller. One work around I have found is to select "Open Yuzu" instead of "Play" in BB. This launches Yuzu fine and I am able to scroll to the desired game with the controller then I have to select and launch the game again,  the profile window pops up in focus and I am able to select the desired profile with the controller. All without having to use the keyboard. Really kind of annoying since LB does not have this problem. I am assuming that drw4013 is trying to have a console like experience like I am where I can select and start everything with just a controller with no keyboard inputs needed. I hope someone smarter than me knows of a fix. 

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...