UltraJohn Posted March 29, 2023 Share Posted March 29, 2023 (edited) HUDReplacer HUDReplacer is a framework that allows you to replace the HUD/UI textures at runtime, without the hassle of modifying any stock files or assets. The mod is currently a Work in Progress, so bugs may occur. It does not come with any custom textures out of the box, though an example config can be found on the github page for those who want to create their own. This is intended as a dependency and a tool for modders to more easily create and share texture packs. Example images: Requirements: Module Manager HarmonyKSP Download: or Texture packs: Send me a PM or leave a comment if you want your own texture pack featured above! Edited January 4 by UltraJohn Quote Link to comment Share on other sites More sharing options...
Poodmund Posted March 30, 2023 Share Posted March 30, 2023 8 hours ago, UltraJohn said: HUDReplacer (GitHub) Is the repository private? Getting a 404 error. Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted March 30, 2023 Author Share Posted March 30, 2023 2 hours ago, Poodmund said: Is the repository private? Getting a 404 error. My bad, I forgot to set it to public. Fixed now! Quote Link to comment Share on other sites More sharing options...
Codapop Posted March 31, 2023 Share Posted March 31, 2023 This looks great! Really looking forward to seeing if anyone can come up with a good config! Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 2, 2023 Share Posted April 2, 2023 You should include the example textures in the zips (currently they are only in the source code) No, wait, you actually have to download the entire source code to get them. Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 2, 2023 Author Share Posted April 2, 2023 31 minutes ago, Nazalassa said: You should include the example textures in the zips (currently they are only in the source code) No, wait, you actually have to download the entire source code to get them. Good point, thanks for the feedback. Added a separate download for the example texture pack mod! Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 3, 2023 Share Posted April 3, 2023 I've messed around quite a bit with HUDReplacer, and I think I already have a bug report... I think I've found a pretty nasty issue, when HUDReplacer fetches the files from a config (filePath = GameData/ExampleMod/PluginData/ for example), it follows the path from the current directory, and not the KSP directory! (the current directory is the directory (or folder) from where the game was launched, not necessary the KSP directory.) For example, I have a shortcut on my desktop to launch KSP, so the directory from which KSP is launched is /home/whateverMyUserNameIs/ , so when HUDReplacer searches the directory GameData/ExampleMod/PluginData/, it actually looks at /home/whateverMyUserNameIs/GameData/ExampleMod/PluginData/ (which does not exist, as KSP isn't installed in /home/whateverMyUserNameIs/ ), and not at /home/whateverMyUserNameIs/Utility/KSP/GameData/ExampleMod/PluginData/ which is where it actually is. I learned all that from KSP.log where it said something like this: error, can't find directory /home/whateverMyUserNameIs/GameData/ExampleMod/PluginData/ . So, in order to load the images, I had to specify the following path: Utility/KSP/GameData/ExampleMod/PluginData/ ( /home/whateverMyUserNameIs/Utility/KSP/GameData/ExampleMod/PluginData/ also works). However, that makes texture packs (etc.) not portable, as different installs of KSP can be in different folders, and the current directory is not always the KSP directory, which is (at least in my opinion) a big issue. --] POSSIBLE PATCH [-- After browsing HUDReplacer's source code, I think I found the culprit: in HUDReplacer.cs , line 113: Directory.GetFiles(filePath, "*.png"); This function seems to looks for a directory that is either an absolute directory (path starts with C:\ or / for example), or a sub-directory of the "current directory". So, to fix that issue, the simplest idea would be perhaps to replace filepath by something like KSP_directory + filePath , and that would ensure that the mod loads correctly paths like GameData/ExampleMod/PluginData . By looking at the source of Navball Texture Changer (file NavBallTextures.cs , line 88) (https://github.com/linuxgurugamer/NavBallTextureChanger/blob/master/Source/NavBallTexture.cs) I found that they used this: KSPUtil.ApplicationRootPath + "GameData/NavBallTextureChanger/PluginData/" So it appears that what we're searching is KSPUtil.ApplicationRootPath ! I don't know if you need to add something like using KSPUtils , but I found it in the KSP API (https://www.kerbalspaceprogram.com/ksp/api/class_k_s_p_util.html#a60726f2d6045af932ffa222c8473424e). So I guess you don't need to... So, in a nutshell: a possible patch would be to replace Directory.GetFiles(filePath, "*.png"); by Directory.GetFiles(KSPUtil.ApplicationRootPath + filePath, "*.png"); . Ah, one last thing: you should maybe update the readme to indicate that, in the developer version, pressing 'e' dumps all images loaded to the log and, most importantly, pressing 'q' refreshes the loaded images. (key-binds found in HUDReplacer.cs) Nice mod btw. I can't wait to play KSP 95 Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 3, 2023 Author Share Posted April 3, 2023 45 minutes ago, Nazalassa said: I've messed around quite a bit with HUDReplacer, and I think I already have a bug report... Nice mod btw. I can't wait to play KSP 95 Thank you for the feedback. I've added the proposed change and it should work now. If not, let me know. Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 3, 2023 Share Posted April 3, 2023 (edited) The fix works perfectly :) I'm trying to get as much names as possible, and I propose that, for clarity, HUDReplacer prints a thick line ( [][][][][][][][][] ) to the log before spitting all the names when "d" is pressed, because else it's hard to make the difference between the outputs of two consecutive presses of "d" (if nothing's logged between them). Understand: it will improve readability if someone presses "d" a lot of times in a row. I have made a pull request: https://github.com/UltraJohn/HUDReplacer/pull/1 Oh, btw, here's what I have been doing all the afternoon: I'm planning to make the, um, let's call it "theme", once I'll have done all the space center and VAB/SPH buttons. Edited April 3, 2023 by Nazalassa Fix works, yey Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 3, 2023 Author Share Posted April 3, 2023 15 minutes ago, Nazalassa said: I have made a pull request: https://github.com/UltraJohn/HUDReplacer/pull/1 Approved and updated. 16 minutes ago, Nazalassa said: Oh, btw, here's what I have been doing all the afternoon: That's looking really awesome! I immediately got hit by some nostalgia! Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 3, 2023 Share Posted April 3, 2023 32 minutes ago, UltraJohn said: Approved and updated. That's looking really awesome! I immediately got hit by some nostalgia! Thanks :) I think I'll make it a new theme for KSP (I have plenty of time to kill this week) I just loaded all scenes and dumped the list of names of textures, then copied those that didn't start by Squad/ or something (those that aren't in GameData) to a new file, then sorted the file. Now I know all the names that are present in the scenes I loaded (settings, astronaut complex, VAB, etc.) so that if I find the name of one texture I can deduce the name of other textures. (for the same thing. sorry if what I say is all but understandable) Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 3, 2023 Author Share Posted April 3, 2023 3 minutes ago, Nazalassa said: Thanks I think I'll make it a new theme for KSP (I have plenty of time to kill this week) I just loaded all scenes and dumped the list of names of textures, then copied those that didn't start by Squad/ or something (those that aren't in GameData) to a new file, then sorted the file. Now I know all the names that are present in the scenes I loaded (settings, astronaut complex, VAB, etc.) so that if I find the name of one texture I can deduce the name of other textures. (for the same thing. sorry if what I say is all but understandable) Besides also using D to get the mouseover textures, you can use a 3rd party tool to get a list of all the internal texture names for easy referencing. I suspect you already know how to do this It'll make it easy to know which textures exist at different sizes (they will have the same internal name in sharedassets but the width/height varies). Can't wait to see your progress! Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 3, 2023 Share Posted April 3, 2023 I'll do all that before anything else: NOTES ======= Astronaut Complex -> Top bar: mainBorder_top#6x33 -> Crewmember bg: vsd_widget_crew_bg#30x54 -> Accept crewmember: vsd_widget_crew_button_v#22x54 (tick) vsd_widget_crew_button_v_over#22x54 (tick) vsd_widget_crew_button_v_down#22x54 (tick) -> Remove crewmember: vsd_widget_crew_button_x#22x54 (cross) vsd_widget_crew_button_x_over#22x54 (cross) vsd_widget_crew_button_x_down#22x54 (cross) -> Slider: vsd_slider_fill#29x11 vsd_slider_bg#29x11 -> Level: lvl0#85x17 lvl1#85x17 lvl2#85x17 lvl3#85x17 lvl4#85x17 lvl5#85x17 -> Suit switcher: kerbal_switch_suit#32x32 -> Tabs: tab_std_normal#44x24 -> scrollbarVknow#16x182 scrollbarHknow#182x16 VAB: Blue_Btn_Normal#40x18 Blue_Btn_Over#40x18 Blue_Btn_Active#40x18 Blue_Btn_Inactive#40x18 gen_btn_right_normal#22x32 gen_btn_right_over#22x32 gen_btn_right_active#22x32 gen_btn_right_inactive#22x32 gen_btn_left_normal#22x32 gen_btn_left_over#22x32 gen_btn_left_active#22x32 gen_btn_left_inactive#22x32 pin_toggle_on#32x32 pin_toggle_off#32x32 numeric_toggle_on#32x32 numeric_toggle_off#32x32 Flow_Enabled#18x18 Flow_Disabled#18x18 EditorButtons_New EditorButtons_Load EditorButtons_save EditorButtons_Launch EditorButtons_Symmetry_stateMap#384x256 EditorButtons_MirrorSymmetry_stateMap#128x256 EditorButtons_Symmetry_norm#128x128 EditorButtons_Symmetry_hover#128x128 EditorButtons_Symmetry_act#128x128 EditorButtons_Symmetry_disabled#128x128 app_divider_pulldown_header_xxx#30x17 Do you know the name of the texture for the grey bar on top of the screen? I couldn't find it. Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 3, 2023 Author Share Posted April 3, 2023 11 minutes ago, Nazalassa said: Do you know the name of the texture for the grey bar on top of the screen? I couldn't find it. Check the example mod files. Should be some of these: KSCTopBar 1 KSCTopBar 3 KSCTopBar KSCTopBarNew Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 5, 2023 Share Posted April 5, 2023 (edited) On 4/3/2023 at 7:02 PM, UltraJohn said: Check the example mod files. Should be some of these: KSCTopBar 1 KSCTopBar 3 KSCTopBar KSCTopBarNew That's for the KSC. But for the VAB/tracking station/etc. ? I can't find them. Also is there a way to save a texture from the game into a png (or whatever) file? Edited April 5, 2023 by Nazalassa Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 5, 2023 Author Share Posted April 5, 2023 44 minutes ago, Nazalassa said: That's for the KSC. But for the VAB/tracking station/etc. ? I can't find them. Also is there a way to save a texture from the game into a png (or whatever) file? I've sent you a PM. Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 5, 2023 Share Posted April 5, 2023 Turns out you can change any internal image in the game, which apparently include fonts (???), the Navball (???), building (and planet) textures (???), "wernerVonKerman_head" (???), and... I never had so much fun :D Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 5, 2023 Share Posted April 5, 2023 If anyone wants to try it... Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 5, 2023 Author Share Posted April 5, 2023 1 hour ago, Nazalassa said: If anyone wants to try it... Nice! Have you tested this on 1.7.x since you tagged it as a compatible version? I'm wondering if I should tag mine as that as well if it's confirmed to work on earlier versions. Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 6, 2023 Share Posted April 6, 2023 12 hours ago, UltraJohn said: Have you tested this on 1.7.x since you tagged it as a compatible version? I'm wondering if I should tag mine as that as well if it's confirmed to work on earlier versions. I did it yesterday, didn't work but turns out I had an incompatible version of MM installed. I'm retrying rn Nah, it doesn't, here's an error in KSP.log: [LOG 08:27:27.864] Load(Assembly): HUDReplacer-dev/HUDReplacer [LOG 08:27:27.864] AssemblyLoader: Loading assembly at /home/ivyroot/Backups/KSP_linux/GameData/HUDReplacer-dev/HUDReplacer.dll [LOG 08:27:27.867] AssemblyLoader: Loading assemblies [ERR 08:27:27.909] ADDON BINDER: Cannot resolve assembly: UnityEngine.CoreModule, Culture=neutral, PublicKeyToken=null [ERR 08:27:27.909] ADDON BINDER: Cannot resolve assembly: UnityEngine.CoreModule, Culture=neutral, PublicKeyToken=null [ERR 08:27:27.911] AssemblyLoader: Exception loading 'HUDReplacer': System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 at AssemblyLoader.LoadAssemblies () [0x00000] in <filename unknown>:0 Additional information about this exception: System.IO.FileNotFoundException: Could not load file or assembly 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. File name: 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' System.TypeLoadException: Could not load type 'HUDReplacer.HUDReplacer' from assembly 'HUDReplacer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type 'HUDReplacer.HUDReplacer' from assembly 'HUDReplacer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. System.TypeLoadException: Could not load type '<>c' from assembly 'HUDReplacer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. So I guess that's our culprit: UnityEngine.CoreModule Does the mod work without it? (like removing the "using UnityEngine.CoreModule") Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 6, 2023 Share Posted April 6, 2023 18 minutes ago, Nazalassa said: Does the mod work without it? (like removing the "using UnityEngine.CoreModule") I mean removing the "using UnityEngine.CoreModule"s from the source code and recompiling Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 6, 2023 Author Share Posted April 6, 2023 5 hours ago, Nazalassa said: I mean removing the "using UnityEngine.CoreModule"s from the source code and recompiling Nah you can't remove the core module. I guess it's incompatible with 1.7.x then. I was only targeting 1.12.x to begin with, so any version earlier would be a bonus. You can try newer versions if you want and let me know how it goes. Quote Link to comment Share on other sites More sharing options...
Nazalassa Posted April 7, 2023 Share Posted April 7, 2023 I think HUDReplacer requires MM right? As the configs use MM syntax (:NEEDS[HUDReplacer]) Quote Link to comment Share on other sites More sharing options...
UltraJohn Posted April 7, 2023 Author Share Posted April 7, 2023 3 hours ago, Nazalassa said: I think HUDReplacer requires MM right? As the configs use MM syntax (:NEEDS[HUDReplacer]) Technically the framework won't require it, as it doesnt come with any config by default. Only the texture packs that people download needs to add the :NEEDS[HUDReplacer] to their config if you want to make sure that it only loads if the framework is installed. You could in theory remove the NEEDS part from the config and it would still work without MM I think. So, there's two options here. 1. I add MM as a dependency for the framework and therefore texture packs won't need to specify they need it as well. 2. I let texture packs have the dependency included instead. I think going with option 1 makes more sense, so I will update my post with the required dependency. Quote Link to comment Share on other sites More sharing options...
tajwo Posted April 8, 2023 Share Posted April 8, 2023 This mod is very nice Haha, very funny.... the name of the texture is logoFullRed_alt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.