Jump to content

[WIP] [1.12.x] HUDReplacer - (v1.2.11-beta)


UltraJohn

Recommended Posts

Look at the spam I get in the log lol

[LOG 16:05:51.462] Load(Texture): Naztheme/Editor/EditorButtons_Load#256x256
[WRN 16:05:51.466] Texture load error in '/home/ivyroot/Utility/KSP/GameData/Naztheme/Editor/EditorButtons_Load#256x256.png': HTTP/1.1 404 Not Found

There's like 200 of them... Apparently it considers that the file is EditorButtons_Load ... Wait what they use HTTP/1.1 to load images?????

That's the stock image loader btw, not HUDReplacer.

Link to comment
Share on other sites

  On 4/28/2023 at 2:10 PM, Nazalassa said:

Look at the spam I get in the log lol

[LOG 16:05:51.462] Load(Texture): Naztheme/Editor/EditorButtons_Load#256x256
[WRN 16:05:51.466] Texture load error in '/home/ivyroot/Utility/KSP/GameData/Naztheme/Editor/EditorButtons_Load#256x256.png': HTTP/1.1 404 Not Found

There's like 200 of them... Apparently it considers that the file is EditorButtons_Load ... Wait what they use HTTP/1.1 to load images?????

That's the stock image loader btw, not HUDReplacer.

Expand  

Yeah I noticed those as well a while back. Kinda funky lol

Link to comment
Share on other sites

I'm changing the loading screen background (the thing in the bottom-right)

  Reveal hidden contents

If you want to know what all the UiElement_xx are:

03: Funds display bg
04: Funds display tape bg
05: green Funds icon
06: red Funds icon
10: science display bg
11: science display
12: science display icon
13: some kind of background
14: reputation display bg
17: reputation tape
20: VAB/SPH vessel price display (I accidentally deleted it but I could get it back)
24: Funds/rep/science show/hide in flight (appbar)

Also I added another swap file of 4 GiB so KSP doesn't crash with Firefox and Gimp open (which it did a lot before, it was quite annoying).

Edited by Nazalassa
Forgot to add image
Link to comment
Share on other sites

[Major update]  Naztheme 0.3a is out! About halfway done with the flight UI (what's left in the flight UI: some stuff tied to maneuvers, some stuff tied the the "staging quadrant" (not significant), the altimeter).

Some screenshots:

  Reveal hidden contents
Link to comment
Share on other sites

  On 5/4/2023 at 3:12 PM, UltraJohn said:

If that works I'm gonna be impressed.

Expand  

So you are (lol)

oR522iO.png

The name of the font used for like everything but ToolBarController's window is  NotoSans-Regular SDF Atlas#2048x2048.

 

OK, so now I have to restart the game...

 

--

OK, so now I need to change all of that to Unifont.

Edited by Nazalassa
Removed outdated Github link
Link to comment
Share on other sites

  • 3 weeks later...

Hello! I have an issue where HUDReplacer doesn't always replace the textures of mods.

In this image, both [x] Science! and ResearchBodies are themed which is what I'd like to always happen (DOE/Unity default theme isn't themed yet).
Screenshot-5500.png

However in this screenshot, [x] Science! and ResearchBodies aren't themed (while Trajectories is always themed).
Screenshot-5573.png

This seems to be fixed by installing the dev version & pressing Q to refresh the theme but that isn't optimal (Q and E are the roll controls and I need them for muh planes).
KSP.log (only for the not-themed mods)
My theme        

Just realized that HUDReplacer is All Rights Reserved so the link's been removed

My Theme:

  Reveal hidden contents

 

Edited by zapsnh
Link to comment
Share on other sites

  On 5/20/2023 at 3:23 AM, zapsnh said:

Hello! I have an issue where HUDReplacer doesn't always replace the textures of mods.

In this image, both [x] Science! and ResearchBodies are themed which is what I'd like to always happen (DOE/Unity default theme isn't themed yet).
Screenshot-5500.png

However in this screenshot, [x] Science! and ResearchBodies aren't themed (while Trajectories is always themed).
Screenshot-5573.png

This seems to be fixed by installing the dev version & pressing Q to refresh the theme but that isn't optimal (Q and E are the roll controls and I need them for muh planes).
KSP.log (only for the not-themed mods)
My theme

Mod list:

  Reveal hidden contents

 

Expand  

My guess is that the textures are loaded dynamically, i.e they are loaded after the scene change (from whatever to flight), but HUDReplacer only replaces textures during scene changes (and by pressing 'q' in the dev version). I observed the issue twice while working on Naztheme, and it was always with DLC pop-ups (KAL editor, "mission dialog"), so maybe that's an issue with mods and DLCs? @UltraJohn said they'll try to fix it.

btw, great theme! Is that the "obsidianUI" theme I've heard of?

Link to comment
Share on other sites

  On 5/20/2023 at 8:24 AM, Nazalassa said:

... how long did it take? I've worked for a month and a half on Naztheme (with breaks ofc) and from what I see yours is a bit more complete.

Expand  

I started around mid-April (~1 month). I based most of my textures of yours (thx!) and the default example theme. Doing a theme like my theme seems a bit easier due to it not being centered around pixel-perfect textures and being able to use icons from the game instead of creating new ones.

Link to comment
Share on other sites

  On 5/20/2023 at 8:32 AM, zapsnh said:

Doing a theme like my theme seems a bit easier due to it not being centered around pixel-perfect textures and being able to use icons from the game instead of creating new ones.

Expand  

Maybe I'll make another, flatter, not-pixel-precise theme after I'll have "finished" Naztheme. Maybe.

I found an old thread about retheme-ing (??) KSP, which has screenshots from which we (mostly you :))  can draw inspiration; I'll put it here:

  Reveal hidden contents

I have to go, UI elements are waiting :D

Link to comment
Share on other sites

Another (very minor) issue. I've managed to change the how cursor looks but it only does it for the left & right click icons and not the main one.

Not really a Unity dev so take this with a kilogram of salt:

  Reveal hidden contents


The texture files are:
basicNeutral.png (32x32) Normal  <<<< doesn't work
basicElectricLime.png (32x32) Left click
basicDisabled.png (32x32) Right click
and the hotspot (i.e. where the cursor points) is around (6, 0)
p.s. i found the textures through painstakingly skimming through the log file seeing if there was a texture that kinda matched the cursors' icon (electriclime is a good name lol)

(no pics since screenshots don't capture cursors and I'm too lazy to use my phone)

Link to comment
Share on other sites

  On 5/20/2023 at 10:34 AM, zapsnh said:

Another (very minor) issue. I've managed to change the how cursor looks but it only does it for the left & right click icons and not the main one.

Not really a Unity dev so take this with a kilogram of salt:

  Reveal hidden contents


The texture files are:
basicNeutral.png (32x32) Normal  <<<< doesn't work
basicElectricLime.png (32x32) Left click
basicDisabled.png (32x32) Right click
and the hotspot (i.e. where the cursor points) is around (6, 0)
p.s. i found the textures through painstakingly skimming through the log file seeing if there was a texture that kinda matched the cursors' icon (electriclime is a good name lol)

(no pics since screenshots don't capture cursors and I'm too lazy to use my phone)

Expand  

Trying right now (I may have to disable cursorDeleter)

--

Nah, doesn't work, it does not replace WAIT I HAVE AN IDEA

Link to comment
Share on other sites

So in fact the pressed images do work when priority is set to 65535, but not 8. I'm trying with 4294967295 (uint32 limit)

Also I am browsing the source of mods that do stuff during startup (currently with ModuleManager) to try to find how to make stuff run at startup.

Still doesn't work, trying priority 2147483648 (signed int32 limit)

Link to comment
Share on other sites

  On 5/20/2023 at 11:01 AM, Nazalassa said:

So in fact the pressed images do work when priority is set to 65535, but not 8. I'm trying with 4294967295 (uint32 limit)

Expand  

Wait, my theme has them set to 2 (it's in the theme now) and they're (pressed images) working. Might have something to do with KSP Community fixes though.

Edited by zapsnh
nvm works without KSPCF
Link to comment
Share on other sites

Found something! MM uses

[KSPAddon(KSPAddon.Startup.Instantly, true)]

which isn't present in HUDReplacer source.

The function to call on startup is either Awake  or  Start . (have a look at https://github.com/sarbian/ModuleManager/blob/master/ModuleManager/ModuleManager.cs)

@UltraJohn I made a pull request: https://github.com/UltraJohn/HUDReplacer/pull/3

 

Also maybe try adding

[KSPAddon(KSPAddon.Startup.EveryScene, false)]

so that it works in every scene? Dunno.

 

(https://www.kerbalspaceprogram.com/ksp/api/class_k_s_p_addon.html)

Maybe the normal cursor isn't  basicNeutral#32x32  after all..?.

Edited by Nazalassa
Link to comment
Share on other sites

  On 5/20/2023 at 11:11 AM, Nazalassa said:

Found something! MM uses

[KSPAddon(KSPAddon.Startup.Instantly, true)]

which isn't present in HUDReplacer source.

The function to call on startup is either Awake  or  Start . (have a look at https://github.com/sarbian/ModuleManager/blob/master/ModuleManager/ModuleManager.cs)

 

Also maybe try adding

[KSPAddon(KSPAddon.Startup.EveryScene, false)]

so that it works in every scene? Dunno.

 

(https://www.kerbalspaceprogram.com/ksp/api/class_k_s_p_addon.html)

Maybe the normal cursor isn't  basicNeutral#32x32  after all..?.

Expand  

I still think that basicNeutral is getting cached in RAM when it loads (therefore making HUDReplacer unable to change it) since if you make textures for basicElectricLime.png && basicDisabled.png and you click while loading, they don't appear. (and if you don't, they do appear)

(reminder that i'm not a unity or a microsoft java (C#) dev)

Edited by zapsnh
Link to comment
Share on other sites

  On 5/20/2023 at 11:38 AM, zapsnh said:

I still think that basicNeutral is getting cached in RAM when it loads (therefore making HUDReplacer unable to change it) since if you make textures for basicElectricLime.png && basicDisabled.png and you click while loading, they don't appear. (and if you don't, they do appear)

(reminder that i'm not a unity or a microsoft java (C#) dev)

Expand  

So that explains why it didn't work first time, cuz I clicked (so that's not priority's fault)

Link to comment
Share on other sites

Welcome @zapsnh ! I can see you guys have been hard at work making some awesome UI mods :)

There's a lot of comments to skim through so bear with me if I forget to reply to some of it.

  On 5/20/2023 at 3:23 AM, zapsnh said:

I have an issue where HUDReplacer doesn't always replace the textures of mods.

Expand  

This is indeed mostly due to what @Nazalassasaid, that the textures are loaded on demand when you open the menus ingame, and thus not existing when the scene change is happening. HUDReplacer works by iterating through all the textures in the scene that are loaded in after scene switch and swapping them if a match is found. As you've noticed, using the Q function of the dev build works, but is very suboptimal as it induces a hefty lag spike, due to the compute time it takes to go through all textures. Therefore it's not feasible to use this feature for regular gameplay and a better way needs to be found. That's the part I'm working on, but is quite tricky. If anyone knows of a good implementation, do let me know!

Also, keep in mind that I didn't inherently make any adjustments to support textures from mods, but I'll gladly expand on this to make it work as well as I can. Though some things may be out of my hand and might require those mods to have alternative textures bundled with the mods themselves.

 

  On 5/20/2023 at 10:34 AM, zapsnh said:

Another (very minor) issue. I've managed to change the how cursor looks but it only does it for the left & right click icons and not the main one.

Expand  

I did notice this back when I first made this mod. I haven't really looked into why, but my guess is that the mouse cursor is not stored as a game object, and thus does not contain a reference to a Texture2D object. The solution would be to add a special case for the mouse in code, which I will look into.

 

  On 5/20/2023 at 11:01 AM, Nazalassa said:

So in fact the pressed images do work when priority is set to 65535, but not 8. I'm trying with 4294967295 (uint32 limit)

 

Expand  

Priority should have no effect on it working or not. What it does is let HUDReplacer know that if there are multiple configs with the same texture names, it will pick the ones from the config with the highest number.

 

  On 5/20/2023 at 11:11 AM, Nazalassa said:

Also maybe try adding

[KSPAddon(KSPAddon.Startup.EveryScene, false)]

so that it works in every scene? Dunno.

Expand  

I don't think this will make the cursor load. If it doesn't exist as a Texture2D, then none of the scene types will have an effect.

Edited by UltraJohn
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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