Quantcast
Replace Texture Throughout UI - ESOUI
Thread Tools Display Modes
11/04/15, 06:56 PM   #1
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Replace Texture Throughout UI

I've had several requests to replace the Xbox One icons found in the gamepad UI with the Playstation icons and decided to take up the project. It's been awhile since I've done any coding, so figured I'd ask for a bit of assistance.
There are a few ways going about doing this. The first thing I thought about was using PreHook, but realized that it might cause issues if a player changes gamepad Templates (basically the controller setup/bindings). Then I thought about the idea of "reassigning" certain textures with a texture of my choice. To give a better explanation, I have written a simple idea below:

Lua Code:
  1. --Detects if the game is in Gamepad Mode and if it is then....
  2. if function: IsInGamepadPreferredMode() then
  3. --Replace this texture with....
  4.    if "/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds" then
  5. --This texture
  6.       "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds"
  7.    end
  8. end


Obviously, this is very rough draft and only what I can come up with while at work (this day won't end I swear). When I write all of the replacements, this will essentially replace any Xbox texture with the corresponding Playstation texture (i.e. A with Cross, X with Square, Y with Triangle, etc.). As you can see from the code above, all of these textures are already in the game, so it makes it much easier.

So what's the best way about doing this? I would think the second would be best, but not sure if it's possible to do it throughout the entire game (globally?), rather than having to replace every single texture in every window.

Last edited by Tierney11290 : 11/04/15 at 06:59 PM.
  Reply With Quote
11/04/15, 07:25 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
Found this: http://esodata.uesp.net/100012/src/c...tures.lua.html

Problem is by the time add-on gets a chance to replace these, the textures are already set all over the place. But I'd replace them anyway in case some code assigns textures later.

You'll probably need to find all controls using these textures and set them individually. I can try to make a list.

Then there are other subtle differences which I don't know whether they matter or not, for example in http://esodata.uesp.net/100012/src/i...kpick.lua.html the default vibration duration differs.
  Reply With Quote
11/04/15, 07:57 PM   #3
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Originally Posted by merlight View Post
Found this: http://esodata.uesp.net/100012/src/c...tures.lua.html

Problem is by the time add-on gets a chance to replace these, the textures are already set all over the place. But I'd replace them anyway in case some code assigns textures later.

You'll probably need to find all controls using these textures and set them individually. I can try to make a list.

Then there are other subtle differences which I don't know whether they matter or not, for example in http://esodata.uesp.net/100012/src/i...kpick.lua.html the default vibration duration differs.
Interesting find. I was looking around the source code quite a bit last night, but made little progress. Looks like that is what I am looking for. It does appear that the vibration is indeed different and something worth looking at, but I think check that out a bit later and update the addon at some point. Thanks for the info!
  Reply With Quote
11/04/15, 07:59 PM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
Here's a list of controls that I found using some "XB" textures (note that some are CT_TEXTURE, some are CT_LABEL with the texture embedded in "|tw:h:path|t" tags)
Warning: Spoiler
  Reply With Quote
11/04/15, 08:14 PM   #5
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 648
Originally Posted by Tierney11290 View Post
Lua Code:
  1. --Detects if the game is in Gamepad Mode and if it is then....
  2. if function: IsInGamepadPreferredMode() then
  3. --Replace this texture with....
  4.    if "/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds" then
  5. --This texture
  6.       "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds"
  7.    end
  8. end
Originally Posted by merlight View Post
Whaaat Is that some undocumented awesomeness?!
Edit: lol, I like that I'm stealing it:

Try this "undocumented awesomeness" :
Lua Code:
  1. RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds")
__________________
My Addons: JunkIt, FilterIt, WaypointIt, LootIt, TweakIt, ChatIt, SortIt
My Libs & Other Developer Stuff: Click4Info, LibNeed4Research, LibMsgWin, LibFilterIt, LibItemInfo
Other Files & Works In Progress can be found on my Dropbox: ESO Dropbox

Last edited by circonian : 11/04/15 at 08:32 PM.
  Reply With Quote
11/04/15, 08:14 PM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
You might also need to override GetGamepadIconPathForKeyCode, but again some code calls it before add-ons run.
  Reply With Quote
11/04/15, 08:17 PM   #7
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 679
Originally Posted by circonian View Post
I've never used this myself, but have you tried:
Lua Code:
  1. RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds")
Whaaat Is that some undocumented awesomeness?!

edit: no kidding, just tried that and it works, replaced the icon inside label, without reload just /script

Last edited by merlight : 11/04/15 at 08:21 PM.
  Reply With Quote
11/04/15, 08:38 PM   #8
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Originally Posted by merlight View Post
Whaaat Is that some undocumented awesomeness?!

edit: no kidding, just tried that and it works, replaced the icon inside label, without reload just /script
Wow, yeah. That seems to work great! I've used a /script in a previous addon, but it's been awhile so I'll have to remember how to implement it (no spoilers :P ) Thanks for all of the tips guys. That scorcery looks like it should work great.
  Reply With Quote
11/04/15, 09:43 PM   #9
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Scratch that, not set up how I thought it was. The addon I made actually used a function to pull up the gamepad and it initiated OnAddOnLoaded. Tried a few things to bring it up in-game, but no use.

Any tips on writing the RedirectTexture to the code to apply it in-game? I'll keep messing around with it and update if I find something. I'm sure it's something easy that I'm overlooking.
  Reply With Quote
11/04/15, 10:05 PM   #10
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Yep, spoke too soon. Got it figured out....so far. Thanks again for the help merlight and circonian!
  Reply With Quote
11/04/15, 10:27 PM   #11
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
So here's a weird issue.

Lua Code:
  1. RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds")

This works fine when put into the lua file. It even works when putting /script RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds") into the chat box in game.

However, putting this into the lua file:

Lua Code:
  1. RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_x.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_square.dds")

does NOT work. Putting /script RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_x.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_square.dds") into the chat box in game works perfectly fine, just like the first one does.

So what gives? Why does it work in the chat box in game, but not in the lua file coding? Kind of stumped on this one.
  Reply With Quote
11/05/15, 12:15 AM   #12
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 513
I have heard (not verified) that RedirectTexture works after the texture was loaded, only.
Maybe you have to add your code to the OnTextureLoaded event of the Texture-Controls containing the source texture.
__________________
@votan73 (EU - megaserver)
  Reply With Quote
11/05/15, 12:27 AM   #13
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Originally Posted by votan View Post
I have heard (not verified) that RedirectTexture works after the texture was loaded, only.
Maybe you have to add your code to the OnTextureLoaded event of the Texture-Controls containing the source texture.
That seems to make sense. I guess I'll mess around with it a bit. Thanks for the info.
  Reply With Quote
11/05/15, 01:01 AM   #14
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
After a bit of tweaking, I was able to get it to work! I think that this is probably the simplest way. Any suggestions for improvment??


Lua Code:
  1. local function Addon_Loaded(eventCode, addOnName)
  2.     if (addOnName == "PlaystationInterface") then
  3.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_a.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_x.dds")
  4.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_x.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_square.dds")
  5.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_y.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_triangle.dds")
  6.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_b.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_circle.dds")
  7.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_dpadup.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_dpadup.dds")
  8.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_dpadleft.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_dpadleft.dds")
  9.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_dpaddown.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_dpaddown.dds")
  10.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_dpadright.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_dpadright.dds")
  11.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_view.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_share.dds")-- ???
  12.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/rightarrow_down.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_options.dds")-- ???
  13.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_rb.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_r1.dds")
  14.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_lb.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_l1.dds")
  15.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_rt.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_r2.dds")
  16.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_lt.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_l2.dds")
  17.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_lsrs_press.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_lsrs_press.dds")
  18.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_rs.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_rs.dds")
  19.         RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_ls.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_rs.dds")
  20.     end
  21. end
  22.  
  23.  EVENT_MANAGER:RegisterForEvent("PlaystationInterface", EVENT_ADD_ON_LOADED, Addon_Loaded)
  Reply With Quote
11/05/15, 03:43 AM   #15
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,043
Is the last entry of the redirected texture a copy&paste error, or is the texture name of the ps4 for "ls" just missing?

RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_ls.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_rs.dds")
  Reply With Quote
11/05/15, 07:41 AM   #16
Jadel
Join Date: Nov 2015
Posts: 2
Brilliant, I was looking for this.

Thanks for putting i the effort.

Is it still ongoing or already useable?
  Reply With Quote
11/05/15, 12:50 PM   #17
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 648
I would do it on player activation to be safe:

Lua Code:
  1. local function OnPlayerActivated()
  2.     RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_b.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_circle.dds")
  3. end

It looks like you may have already found them, but this is the function that grabs the texture path for all of the gamepad textures. If you need to find a texture name you can use this & just pass it the appropriate keyCode. There is also a list of them in TextureIt, but I'm not sure if they've changed any of the textures. So if you have problems with one check that its still the correct texture with this.
Lua Code:
  1. local path, width, height = GetGamepadIconPathForKeyCode(keyCode)
__________________
My Addons: JunkIt, FilterIt, WaypointIt, LootIt, TweakIt, ChatIt, SortIt
My Libs & Other Developer Stuff: Click4Info, LibNeed4Research, LibMsgWin, LibFilterIt, LibItemInfo
Other Files & Works In Progress can be found on my Dropbox: ESO Dropbox
  Reply With Quote
11/05/15, 06:47 PM   #18
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Originally Posted by Baertram View Post
Is the last entry of the redirected texture a copy&paste error, or is the texture name of the ps4 for "ls" just missing?

RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_ls.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_rs.dds")
That's a copy paste error :P After working almost 14 hours yesterday and staying up until midnight, I was trying to rush it. Thanks for the catch though!

It's actually just short for left stick and right stick.
  Reply With Quote
11/05/15, 06:48 PM   #19
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Originally Posted by Jadel View Post
Brilliant, I was looking for this.

Thanks for putting i the effort.

Is it still ongoing or already useable?
Very minimally ready. I should have the addon out tomorrow night with very few features.
  Reply With Quote
11/05/15, 07:00 PM   #20
Tierney11290
 
Tierney11290's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 250
Originally Posted by circonian View Post
I would do it on player activation to be safe:

Lua Code:
  1. local function OnPlayerActivated()
  2.     RedirectTexture("/esoui/art/buttons/gamepad/xbox/nav_xbone_b.dds", "/esoui/art/buttons/gamepad/ps4/nav_ps4_circle.dds")
  3. end
Good call. I still haven't tested this by switching zones (OnPlayerActivated is ran upon log in and zone change correct?) and I know I've had issues with textures before when changing zones for some reason.

Originally Posted by circonian View Post
It looks like you may have already found them, but this is the function that grabs the texture path for all of the gamepad textures. If you need to find a texture name you can use this & just pass it the appropriate keyCode. There is also a list of them in TextureIt, but I'm not sure if they've changed any of the textures. So if you have problems with one check that its still the correct texture with this.
Lua Code:
  1. local path, width, height = GetGamepadIconPathForKeyCode(keyCode)
I did in fact pull it from TextureIt as well as a list that Wykkyd gave me awhile back. Didn't know there was a function to pull the path for the textures though! Seeing as that will probably be the most up to date, I'll use that.

I did notice that some textures were off with the list that Wykkyd provided me quite a few updates ago, but they still appeared correctly in game at the time. I assume that they are corrected now because I didn't see them in TextureIt.

Last edited by Tierney11290 : 11/05/15 at 07:03 PM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Replace Texture Throughout UI

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off