Fix Unicode support (thanks @Stary2001)
This commit is contained in:
2
Makefile
2
Makefile
@@ -50,7 +50,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
|||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
LIBS := -lcitro3d -lctru -lm -lz
|
LIBS := -lcitro3d -lctrud -lm -lz
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
|||||||
@@ -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)
|
u32 zip_file_to_buf(char *file_name, u16 *zip_path, char **buf)
|
||||||
{
|
{
|
||||||
fflush(stdout);
|
|
||||||
ssize_t len = strulen(zip_path, 0x106);
|
ssize_t len = strulen(zip_path, 0x106);
|
||||||
|
|
||||||
u8 *path = calloc(sizeof(u8), len * 4);
|
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;
|
if (zip_handle == NULL) return 0;
|
||||||
u32 file_size = 0;
|
u32 file_size = 0;
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ void parse_smdh(theme *entry, u16 *path)
|
|||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
printf("Failed on path: ");
|
// printf("Failed on path: ");
|
||||||
printu(path);
|
// printu(path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void printu(u16 *input)
|
|||||||
ssize_t in_len = strulen(input, 0x106);
|
ssize_t in_len = strulen(input, 0x106);
|
||||||
ssize_t buf_len = in_len + 1; // Plus 1 for proper null termination
|
ssize_t buf_len = in_len + 1; // Plus 1 for proper null termination
|
||||||
wchar_t *buf = calloc(buf_len, sizeof(wchar_t));
|
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);
|
printf("%ls\n", buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user