Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lyssieth opened this issue Oct 21, 2021 · 11 comments
Closed
Labels
bug Something isn't working

Comments

@lyssieth
Copy link

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:

  • ToyBox Version: 1.4.4
  • OS: Linux (5.14.12-zen, Arch)
  • Version 1.1.0-beta

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

@lyssieth lyssieth added the bug Something isn't working label Oct 21, 2021
@Sizurka
Copy link

Sizurka commented Oct 21, 2021

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
Copy link
Author

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

@lyssieth
Copy link
Author

lyssieth commented Oct 22, 2021

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
Copy link
Contributor

dark0dave commented Jan 2, 2022

@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
Copy link

@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
Copy link
Collaborator

ThyWoof commented Jan 31, 2022

@cabarius , I fixed this on ModKit solasta code base

@dark0dave
Copy link
Contributor

dark0dave commented Feb 2, 2022

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
Copy link

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
Copy link
Collaborator

ThyWoof commented Mar 14, 2022

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

@BaconCatBug
Copy link

BaconCatBug commented Mar 14, 2022

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
Copy link
Collaborator

xADDBx commented Apr 21, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants