Skip to content

Commit 5b38f6a

Browse files
piepie62fincs
authored andcommitted
Fix possible unloaded font error
1 parent 9c333b8 commit 5b38f6a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

source/font.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ static C2D_Font C2Di_FontLoadFromArchive(u64 binary_lowpath)
115115
Handle romfs_handle;
116116
u64 romfs_size = 0;
117117
u32 romfs_bytes_read = 0;
118-
118+
119119
FS_Path savedatacheck_path = { PATH_BINARY, 16, (u8*)lowPath };
120120
u8 file_binary_lowpath[20] = {};
121121
FS_Path romfs_path = { PATH_BINARY, 20, file_binary_lowpath };
122-
122+
123123
if (R_FAILED(FSUSER_OpenFileDirectly(&romfs_handle, (FS_ArchiveID)0x2345678a, savedatacheck_path, romfs_path, FS_OPEN_READ, 0)))
124124
{
125125
free(font);
@@ -131,7 +131,7 @@ static C2D_Font C2Di_FontLoadFromArchive(u64 binary_lowpath)
131131
FSFILE_Close(romfs_handle);
132132
return NULL;
133133
}
134-
134+
135135
u8* romfs_data_buffer = malloc(romfs_size);
136136
if (!romfs_data_buffer)
137137
{
@@ -147,9 +147,9 @@ static C2D_Font C2Di_FontLoadFromArchive(u64 binary_lowpath)
147147
return NULL;
148148
}
149149
FSFILE_Close(romfs_handle);
150-
150+
151151
u8* compFontData = romfs_data_buffer + sizeMod;
152-
152+
153153
u32 fontSize = *(u32*)(compFontData) >> 8;
154154
font->cfnt = linearAlloc(fontSize);
155155
if (font->cfnt)
@@ -197,6 +197,7 @@ C2D_Font C2D_FontLoadSystem(CFG_Region region)
197197
break;
198198
return C2Di_FontLoadFromArchive(0x0004009b00014302);
199199
}
200+
fontEnsureMapped();
200201
return NULL;
201202
}
202203

0 commit comments

Comments
 (0)