cabarius / ToyBox

Toy Box is a cute and playful mod with 500+ cheats, tweaks and quality of life improvements for Pathfinder: WoTR. It was created in the spirit of Bag of Tricks & Cheat Menu but with a little different focus . It of a powerful and convenient way to edit the party composition, stats, search and add Feats, Features, Items, etc. to party members.
MIT License
167 stars 106 forks source link

Instead of being checkboxes they're black squares with no indication of state #499

Closed lyssieth closed 1 year ago

lyssieth commented 3 years ago

Describe the bug Wherever there are toggles (I'm assuming they're meant to be checkboxes), there are just black lines which don't indicate their checked/unchecked state. (see screenshot)

To Reproduce

  1. Run the game
  2. Open Toy Box's settings
  3. Scroll to any checkbox

Expected behavior Checkboxes or toggle buttons with a clear indication of state

Save Files Save files aren't necessary, this is visible on the main menu as well.

Screenshots image

Settings.xml Completely unchanged, file has not even been generated yet

Version Info:

Additional Notes: Unity Mod Manager was installed using 'Assembly' mode as that's recommended for Linux gaming.

Sizurka commented 3 years ago

Looks like there's some problem rendering the Unicode "✔" and "✖" under wine. My quick hack to get it usable is just to patch the .dll:

#!/usr/bin/python3

with open('ToyBox.dll', 'rb+') as f:
    c = f.read()
    c = c.replace("<color=green><b>✔</b></color>".encode('utf-16-le'),
                  "<color=green><b>+</b></color>".encode('utf-16-le'))
    f.seek(0)
    f.truncate(0)
    f.write(c)

I am not familiar enough with the internals of Unity modding to really advise about how to properly fix it, though.

lyssieth commented 3 years ago

If that's the case, I think installing a font which provides emojis should work? I'll do some testing first.

lyssieth commented 3 years ago

Okay, installing an emoji font didn't work.

However, here's my script for anyone that wants it:

#!/usr/bin/env python

with open('ToyBox.dll', 'rb+') as f:
    c = f.read()
    c = c.replace("<color=green><b>✔</b></color>".encode('utf-16-le'),
                  "<color=green><b>X</b></color>".encode('utf-16-le'))
    c = c.replace("<color=#B8B8B8FF>✖</color>".encode('utf-16-le'),
                  "<color=#B8B8B8FF>-</color>".encode('utf-16-le'))
    f.seek(0)
    f.truncate(0)
    f.write(c)
dark0dave commented 2 years ago

@lyssieth

I fixed your script and the bug is gone:

#!/usr/bin/env python

with open('ToyBox.dll', 'rb+') as f:
    c = f.read()
    c = c.replace("✔".encode('utf-16-le'),
                  "+".encode('utf-16-le'))
    c = c.replace("✖".encode('utf-16-le'),
                  "-".encode('utf-16-le'))
    f.seek(0)
    f.truncate(0)
    f.write(c)

This is caused by ✔ showing up in about 4 places in the source code.

https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/GUIHelper.cs#L7 https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BControls.cs#L68 https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BElements.cs#7 https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BToggles.cs#14

One of them is not in the format of

<color=green><b>✔</b></color>

See https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BControls.cs#L68

                    if (GL.Button("✔".green(), GUI.skin.box, AutoWidth())
condekind commented 2 years ago

@lyssieth

I fixed your script and the bug is gone:

#!/usr/bin/env python

with open('ToyBox.dll', 'rb+') as f:
    c = f.read()
    c = c.replace("✔".encode('utf-16-le'),
                  "+".encode('utf-16-le'))
    c = c.replace("✖".encode('utf-16-le'),
                  "-".encode('utf-16-le'))
    f.seek(0)
    f.truncate(0)
    f.write(c)

This is caused by heavy_check_mark showing up in about 4 places in the source code.

https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/GUIHelper.cs#L7 https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BControls.cs#L68 https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BElements.cs#7 https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BToggles.cs#14

One of them is not in the format of

<color=green><b>✔</b></color>

See https://github.com/cabarius/ToyBox/blob/master/ModKit/UI/UI%2BControls.cs#L68

                    if (GL.Button("✔".green(), GUI.skin.box, AutoWidth())

That did it, my thanks to all of you!

ThyWoof commented 2 years ago

@cabarius , I fixed this on ModKit solasta code base

dark0dave commented 2 years ago

I would propably remove all fancy characters, I know it won't look as good but it will be more portable:

 public static string FormatOn = "▼".color(RGBA.white).Bold() + " {0}";
 public static string FormatOff = "▶".color(RGBA.lime).Bold() + " {0}";
 public static string FormatNone = " ▪".color(RGBA.white) + "   {0}";

with simplier ascii ones like V > . and so on, just a thought. And I totally understand if this is does not work, we are an odd usecase (I am using proton (wine)).

BaconCatBug commented 2 years ago

After failing to get the patch scripts working, I have found out that the font "Unifont" will display the characters. https://unifoundry.com/pub/unifont/unifont-13.0.06/font-builds/unifont-13.0.06.ttf

ThyWoof commented 2 years ago

Any instructions on how to install this font? Where does Linux users should drop it?

BaconCatBug commented 2 years ago

For me at least if you open the font, whatever font viewer your distro uses should give you the option to install the font (I use Linux Mint so it has a font viewer installed by default). If you're using Wine, you should use Winetricks to install it.

image

xADDBx commented 1 year ago

This issue will be closed because it is older than a year. The here mentioned Bug/Feature might already be fixed or implemented. If the bug still persists/the Feature is still requested, please reopen the issue or create a new one.