Homebrew [Release] Homebrew Launcher with grid layout

bunny365

Well-Known Member
Member
Joined
Aug 26, 2013
Messages
241
Trophies
0
XP
217
Country
United States
Yup. I'm seeing the problem with the time too. Also, the custom font is way too big on the top screen, specifically on the title.
"3ds_homemenu_extdatat"
"blargSnes -- SNES emulat"
"Mednafen/Beetle PCE FA"
I also really think the font SHOULD be Ubuntu. Ubuntu Condensed for the title, Ubuntu for the Author, and Ubuntu Light for the description. Then use Ubuntu for the title bar (with the folder name / "Homebrew Launcher Help" / "Settings" / "Select folder" / "Folders help") and Ubuntu Light for everything else.
 
  • Like
Reactions: fmkid

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Interestingly I'm now seeing the missing folders issue in Citra, but not on my real 3DS. I'll explore the issue in Citra and upload a fix when I have time. Hopefully fixing it in Citra will also get it working on the real devices that are having this problem. I didn't think to check if the clock issue was preset. I'll check when I get home.

Re. the font, I know the layout and sizes aren't ideal. I'm still working on it. Thanks for the feedback.

I tried to get accented characters working this morning by just adding the characters (e.g. é) to the font but it didn't work. I'll need to look into this by logging the ASCII codes the string contains to work out why it's still not being matched to the character in the font.
 

bunny365

Well-Known Member
Member
Joined
Aug 26, 2013
Messages
241
Trophies
0
XP
217
Country
United States
I tried to get accented characters working this morning by just adding the characters (e.g. é) to the font but it didn't work. I'll need to look into this by logging the ASCII codes the string contains to work out why it's still not being matched to the character in the font.
I think the é being a ? in the HB Launcher is because of character encoding and all that since I have noticed on Homebrew (at least with GameYob) that é is %82 (ASCII+IBM/OEM) instead of %E9 (ASCII+ANSI).
é isn't actually an ASCII character, you know.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Ok so the font engine goes through each character of the string to be drawn on the string and converts it to an ascii value, simply by casting it to an int:

Code:
char c = text[i];
int asciiID = c;

The characters are all in an array of structs which include the ASCII ID. The ASCII ID of é in this 'table' of characters is 130, consistent with http://www.asciitable.com. I think, therefore, that the problem is that casting the char to an int is not resulting in the ASCII ID I am expecting when the character is accented. So I'll make the text drawing routine log the ASCII values as they are passed so I can work out what exactly is being passed to it and then amend the font conversion so that the values will match.

The clock issue does happen in Citra also, so I'll be able to work on that too and hopefully fix it.
 

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
Ok so the font engine goes through each character of the string to be drawn on the string and converts it to an ascii value, simply by casting it to an int:

Code:
char c = text[i];
int asciiID = c;

The characters are all in an array of structs which include the ASCII ID. The ASCII ID of é in this 'table' of characters is 130, consistent with http://www.asciitable.com. I think, therefore, that the problem is that casting the char to an int is not resulting in the ASCII ID I am expecting when the character is accented. So I'll make the text drawing routine log the ASCII values as they are passed so I can work out what exactly is being passed to it and then amend the font conversion so that the values will match.

The clock issue does happen in Citra also, so I'll be able to work on that too and hopefully fix it.
I think that casting the char does result into the correct int.
However, i think it might be possible that you're using an utf-8 font which only has 128 characters.
If you share the font code, i could probably help you with that.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
I think that casting the char does result into the correct int.
However, i think it might be possible that you're using an utf-8 font which only has 128 characters.
If you share the font code, i could probably help you with that.
Thanks. I'm using Roboto which AFAIK contains a full character set, but I'll look into it. The character codes are generated in the PHP script which converts the font. The TTF is loaded, and then a string of characters is iterated through. Each character is converted to its ascii code using ord() function, which is the inverse operation of chr() (or indeed of casting the char to an int), so I'm not sure exactly what's going on.

WRT the clock issue, I think I've sorted it but want to test first. Is there any way of changing the time in Citra? It defaults to midnight every time you run it so I can't test any other times at all.

Edit - never mind about setting the time in Citra. I just made the status bar drawing code think it was 13 hours ahead of midnight by adding 13 to the number of hours. That way I can test PM times. I think it's working now.
 
Last edited by mashers,

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
I was mistaken, i meant that you might be using an 7 bit encoded font, utf-8 is 8 bit encoded,
Could you tell me which integer your method of converting a char to integer gives for "é"?
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
I was mistaken, i meant that you might be using an 7 bit encoded font, utf-8 is 8 bit encoded,
Could you tell me which integer your method of converting a char to integer gives for "é"?
Not really sure I understand the encoding stuff WRT fonts, but here's the code which generates the string of characters which are used to build the font:

PHP:
$text = "";
       
        for ($i=32; $i<127; $i++) {
            $text .= chr($i);
        }

        for ($i=128; $i<176; $i++) {
            $text .= chr($i);
        }

        for ($i=224; $i<255; $i++) {
            $text .= chr($i);
        }

This is then split into an array:

$chars = str_split($text);

(would probably be more efficient to just put the ascii values into the array, but hey)

The $chars array is then iterated through as follows:

PHP:
foreach ($chars as $char) {
    //Snip - draw the character to PNG canvas using imagettftext()

    //Convert the character to its ascii id
   $asciiID = ord($char);

    //Add a struct to the struct array in the .c file
    $mainfilecontent .= "    {" . "$asciiID, $xpos, 0, $charimagewidth, $adjustedimageheight" . "}";

    //Snip - moving drawing coordinates ready for the next char in the loop
}


Does that help?

--------------------- MERGED ---------------------------

I've just attached an update to the first post. In Citra at least this has resolved the issue with > 3 folders showing up and the clock formatting not working properly. Please could anybody who had these issues on a real device let me know if it's now sorted for you? Thanks.
 

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
Not really sure I understand the encoding stuff WRT fonts, but here's the code which generates the string of characters which are used to build the font:

PHP:
$text = "";
      
        for ($i=32; $i<127; $i++) {
            $text .= chr($i);
        }

        for ($i=128; $i<176; $i++) {
            $text .= chr($i);
        }

        for ($i=224; $i<255; $i++) {
            $text .= chr($i);
        }

This is then split into an array:

$chars = str_split($text);

(would probably be more efficient to just put the ascii values into the array, but hey)

The $chars array is then iterated through as follows:

PHP:
foreach ($chars as $char) {
    //Snip - draw the character to PNG canvas using imagettftext()

    //Convert the character to its ascii id
   $asciiID = ord($char);

    //Add a struct to the struct array in the .c file
    $mainfilecontent .= "    {" . "$asciiID, $xpos, 0, $charimagewidth, $adjustedimageheight" . "}";

    //Snip - moving drawing coordinates ready for the next char in the loop
}


Does that help?

--------------------- MERGED ---------------------------

I've just attached an update to the first post. In Citra at least this has resolved the issue with > 3 folders showing up and the clock formatting not working properly. Please could anybody who had these issues on a real device let me know if it's now sorted for you? Thanks.
ord() isn't the appropriate function for this since it gives the value 195 for "é"
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: Here's the full vid