Hello,
This afternoon, I will reply to the request to push Roomba to be Gamepad compatible, I'll update this post, and hope you'll enjoy the feedback !
1st step : the request itself : WTF ? Roomba not compatible ? It should be !
It's just a keybind and user need to clic on it ?
it's only A KEYBIND maybe he need to move with its controller and press the action button on it ? no ?
Let's try.
2nd step : Damn,
ZOS keybind are at left. I had created something which hide Roomba's keybind if there is already something. ok,
working as intended
And at right there is ZOS stuff too. Hopefuly , I already write something to put it in the middle ! (or almost, very easy to do).
lines #774, #820 ..
KEYBIND_STRIP_ALIGN_LEFT -> KEYBIND_STRIP_ALIGN_CENTER .. hmm what the code behind ? Let's do a
/zgoo while being at bank and keybind_strip displayed !
Ahhhhhhh..
/zgoo don't work while in gamepad menus ?... WTF is this Zgoo dev .. wait.. it's me now.
I neeed that KEYBIND_STRIP while being in menu !!!
okay.. let's see zgoo now...
1, 2, 3rd file, found id. slash_command ..
SetGameCameraUIMode() ? try it. testing .. seems that ! commenting.. It don't works. ok SetGameCameraUIMode is not the guilty.. adding a comment to the 1st line of my function linked to my handler :
Lua Code:
SLASH_COMMANDS["/zgoo"] = Zgoo.CommandHandler
function Zgoo.CommandHandler(text)
d("zgoo called")
...
Nothing. that slash command isn't available while being in menu in gamepad mode ?!
Let's try it differently, take pChat addon and add a d() to check if everything is broken as intended.
Lua Code:
function pChat.showAutoMsg()
d("showing")
LMM:ToggleCategory(MENU_CATEGORY_PCHAT)
end
-- Register Slash commands
SLASH_COMMANDS["/msg"] = pChat.showAutoMsg
reload, displaying the C panel, or no, already did it, let's try the L panel.
that works. ? testing back the C panel ?
that works... hmmmm.. ok. that was only
the zgoo mouse broken ? my tests were not so correctly done. (hey I should have edited this ! but didn't do.).
So, what's a /zgoo mouse ? Oh wait. it's the push on my associated keybind Alt+F12 which call a zgoo mouse.
Code:
<Action name="ZGOO_MOUSE">
<Down>Zgoo.CommandHandler("mouse")</Down>
</Action>
Maybe the Alt+f12 ? let's try the
F4 key. don't work. problem. It should output me
d("zgoo called") at least. I must have done an error.
Oh yes, I know a good test !
My addon SuperStar is linked to the key
à. tsting it while not being in menus, pressing the key. it works. my addon is displayed.
Displaying the C panel..... presing
"à" , DON'T WORK.
Okay, I understood
-> Bindings are disabled while in Gamepad menus. Let's test with F10/F11/F112 (my language switchers). confirmed !
So now.. what's a menu ? a scene ? .. hmmm.. a gamepad scene .. need to guess which part of the UI disabled my bindings in menus.. wait zos,
seriously.
Because when I'm on the C panel, the L binding is enabled, but not my F4 one... There should have something.
Let's see esoui\ingame\globals\bindings.xml
Code:
<Layer name="GamepadUIMode" allowFallthrough="false">
<Category>
<Action name="GAMEPAD_UI_EXIT" hideAction="true" rebindable="false">
<Down>MAIN_MENU_GAMEPAD:AttemptShowBaseScene()</Down>
</Action>
<AllowAction name="START_CHAT_ENTER"/>
looks very promising.
let's do it.
Elder Scrolls Online\liveeu\AddOns\DevTools\Bindings.xml
Code:
<Layer name="GamepadUIMode" allowFallthrough="false">
<Category>
<AllowAction name="ZGOO_MOUSE"/>
</Category>
</Layer>
ReloadUI > C > F4 . Working !
-> Back to Roomba
F. my life, there is no center keybind anywhere in gamepad. let's revert to keyboard and find on quickly. ok it was centerButtons
#685
Lua Code:
if IsInGamepadPreferredMode() then
defaults.RoombaPosition = KEYBIND_STRIP_ALIGN_CENTER
else
defaults.RoombaPosition = KEYBIND_STRIP_ALIGN_LEFT
end
#775
Lua Code:
if Roomba.opts.RoombaPosition == KEYBIND_STRIP_ALIGN_LEFT then
Roomba.keyBindCheck = "leftButtons"
elseif Roomba.opts.RoombaPosition == KEYBIND_STRIP_ALIGN_RIGHT then
Roomba.keyBindCheck = "rightButtons"
elseif Roomba.opts.RoombaPosition == KEYBIND_STRIP_ALIGN_CENTER then
Roomba.keyBindCheck = "centerButtons"
end
#825
Lua Code:
setFunc = function(choice)
if choice == Roomba.lang.RoombaPositionChoice[KEYBIND_STRIP_ALIGN_LEFT] then
Roomba.opts.RoombaPosition = KEYBIND_STRIP_ALIGN_LEFT
Roomba.keyBindCheck = "leftButtons"
elseif choice == Roomba.lang.RoombaPositionChoice[KEYBIND_STRIP_ALIGN_RIGHT] then
Roomba.opts.RoombaPosition = KEYBIND_STRIP_ALIGN_RIGHT
Roomba.keyBindCheck = "rightButtons"
elseif choice == Roomba.lang.RoombaPositionChoice[KEYBIND_STRIP_ALIGN_CENTER] then
Roomba.opts.RoombaPosition = KEYBIND_STRIP_ALIGN_CENTER
Roomba.keyBindCheck = "centerButtons"
elseif IsInGamepadPreferredMode() then
-- When user click on LAM reinit button
Roomba.opts.RoombaPosition = defaults.RoombaPosition
Roomba.keyBindCheck = "centerButtons"
else
-- When user click on LAM reinit button
Roomba.opts.RoombaPosition = defaults.RoombaPosition
Roomba.keyBindCheck = "leftButtons"
end
reload. and try to align the keybind in center.
ooops. forget fr/en/de.lua and Roomba.lua#819
Lua Code:
Roomba.lang.RoombaPositionChoice[KEYBIND_STRIP_ALIGN_CENTER],
new reloadui. Ooops I push the German key switcher. Np keybind, and I'm aligned in center mode. let's see keybind_strip.
Roomba is here, and enabled. Why not displayed ? are the gamepad UI does not allow keybinds in the center ? First, checking my conditions !
Lua Code:
visible = function(descriptor) return Roomba.isBagDisplayed() end,
Lua Code:
local scene = SCENE_MANAGER:GetCurrentScene():GetName()
if scene == "guildBank" then
return true
else
return false
end
Lua Code:
d(SCENE_MANAGER:GetCurrentScene():GetName())
-> [17:42:42]
gamepad_guild_bank
Found you little one !
-> All scenes in gamepad mode must be checked !
Changing my scenes ... ok.. ahw, this is still badly coded.
Keybind is here !
Keybind Works !!
and .. UI is badly displayed
XML ..
relativeTo="ZO_SharedRightPanelBackground" oh yes. Oops. old reference ?
Hmmm.. which one should I use to do not rewrite My WHOLE UI ?
Let's look at
esoui\ingame\inventory\gamepad\guildbank_gamepad.xml ...
ZO_GuildBankTopLevel_Gamepad ? or
ZO_Gamepad_ParametricList_Screen ? 1st is interesting yes. but 2nd should be better.. oh.. it doesn't have any UI reference. toooo bad .. let's look at it.
Found in
esoui\common\gamepad\zo_gamepadparametricscrolllistscreen.xml .. inherits
ZO_AnchoredToQuadrant1Background .. nothing.. & nothing.. Oh, that's not very fair.
So let's use ZO_GuildBankTopLevel_Gamepad !
.. But how to do ?
hmmm .. breaking the parent at the addon loaded ?
Or having 2 XML definition and 2 Lua code ?
ZOS choose to do 2 XML and 2 Lua with Lua shared functions. they should have a reason. let's do like 'em !
So my toplevelcontrol will be replicated.. heyyy .. why not having a
$(UIMode) in our metafiles ?
should be a nice request. but.. it could break the code because switching to keyboard <-> gamepad is made without reloadui. that's definitively a False good idea.
so : XML :
Lua Code:
<GuiXml>
<Controls>
<!-- Keyboard UI -->
<TopLevelControl name="RoombaWindow" hidden="true" mouseEnabled="true">
<Dimensions x="565" />
<Anchor point="TOPLEFT" relativeTo="ZO_SharedRightPanelBackground" offsetY="90" />
<Anchor point="BOTTOMLEFT" relativeTo="ZO_SharedRightPanelBackground" offsetY="-20" />
<Controls>
<Texture name="$(parent)BG" textureFile="EsoUI/Art/Miscellaneous/listItem_backdrop.dds">
<AnchorFill />
<TextureCoords left="0" right="1" top="0" bottom=".8125" />
</Texture>
<Texture name="$(parent)Icon">
<Dimensions x="80" y="80" />
<Anchor point="BOTTOM" relativePoint="CENTER" offsetX="20" offsetY="-40" />
</Texture>
<Label name="$(parent)Description" inherits="ZO_TooltipIfTruncatedLabel" font="ZoFontGameMedium" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_SECOND_CONTRAST" horizontalAlignment="CENTER">
<Anchor point="TOPLEFT" relativeTo="$(parent)Icon" relativePoint="BOTTOM" offsetY="5" offsetX="-300"/>
<Dimensions x="600" y="40" />
</Label>
<Control name="$(parent)SpeedRow" inherits="ZO_StableTrainingRow_Keyboard" />
</Controls>
</TopLevelControl>
<!-- Gamepad UI -->
<TopLevelControl name="RoombaWindowGamepad" hidden="true" mouseEnabled="true">
<Dimensions x="565" />
<Anchor point="TOPLEFT" relativeTo="ZO_GuildBankTopLevel_Gamepad" offsetY="90" />
<Anchor point="BOTTOMLEFT" relativeTo="ZO_GuildBankTopLevel_Gamepad" offsetY="-20" />
<Controls>
<Texture name="$(parent)BG" textureFile="EsoUI/Art/Miscellaneous/listItem_backdrop.dds">
<AnchorFill />
<TextureCoords left="0" right="1" top="0" bottom=".8125" />
</Texture>
<Texture name="$(parent)Icon">
<Dimensions x="80" y="80" />
<Anchor point="BOTTOM" relativePoint="CENTER" offsetX="20" offsetY="-40" />
</Texture>
<Label name="$(parent)Description" inherits="ZO_TooltipIfTruncatedLabel" font="ZoFontGameMedium" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_SECOND_CONTRAST" horizontalAlignment="CENTER">
<Anchor point="TOPLEFT" relativeTo="$(parent)Icon" relativePoint="BOTTOM" offsetY="5" offsetX="-300"/>
<Dimensions x="600" y="40" />
</Label>
<Control name="$(parent)SpeedRow" inherits="ZO_StableTrainingRow_Keyboard" />
</Controls>
</TopLevelControl>
</Controls>
</GuiXml>
Changing all my
RoombaWindowDescription, RoombaWindowSpeedRow to
Roomba.UI:GetNamedChild("Description"), etc
Oh my god, so many bad code here..
and a
Lua Code:
if IsInGamepadPreferredMode() then
Roomba.UI = RoombaWindowGamepad
else
Roomba.UI = RoombaWindow
end
Let's see if it works better now.
Oh lua error .. ahw yes
Roomba.InitialiseFrame() at addon loaded and I didn't checked yet (I do it at EVENT_GUILD_BANK_ITEMS_READY).. so lets init both UIs.
Lua Code:
Roomba.InitialiseFrame(RoombaWindow)
Roomba.InitialiseFrame(RoombaWindowGamepad)
function Roomba.InitialiseFrame(object)
object:SetDrawLayer(DL_OVERLAY)
object:GetNamedChild("SpeedRow").value:SetText(" 0%")
ZO_StatusBar_SetGradientColor(object:GetNamedChild("SpeedRow").bar, ZO_XP_BAR_GRADIENT_COLORS)
ZO_StatusBar_SmoothTransition(object:GetNamedChild("SpeedRow").bar, 0, 20, FORCE_VALUE)
...
end
Finished !
-> 3h30 for 1 Keybind and a little UI.
Feel free to post any comments or leave some advices if you try a gamepad integration of your addon.