Fix Unicode support (thanks @Stary2001)

This commit is contained in:
2017-08-27 23:46:43 -04:00
parent aa411e7c7b
commit 129eef0f38
5 changed files with 7 additions and 8 deletions

View File

@@ -108,13 +108,12 @@ u64 file_to_buf(FS_Path path, FS_Archive archive, char** buf)
u32 zip_file_to_buf(char *file_name, u16 *zip_path, char **buf)
{
fflush(stdout);
ssize_t len = strulen(zip_path, 0x106);
u8 *path = calloc(sizeof(u8), len * 4);
utf16_to_utf8(path, zip_path, len);
utf16_to_utf8(path, zip_path, len * 4);
unzFile zip_handle = unzOpen(path); // Can unzOpen really handle utf8?
unzFile zip_handle = unzOpen((char*)path);
if (zip_handle == NULL) return 0;
u32 file_size = 0;

View File

@@ -46,7 +46,7 @@ int main(void)
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_A)
{
{
for (int i = 0; i < theme_count; i++)
{
printu(themes_list[i]->name);

View File

@@ -23,8 +23,8 @@ void parse_smdh(theme *entry, u16 *path)
if (!size)
{
printf("Failed on path: ");
printu(path);
// printf("Failed on path: ");
// printu(path);
return;
}

View File

@@ -26,7 +26,7 @@ void printu(u16 *input)
ssize_t in_len = strulen(input, 0x106);
ssize_t buf_len = in_len + 1; // Plus 1 for proper null termination
wchar_t *buf = calloc(buf_len, sizeof(wchar_t));
for (u16 i = 0; i < buf_len; i++) buf[i] = input[i];
utf16_to_utf32(buf, input, buf_len);
printf("%ls\n", buf);
free(buf);
}