@@ -309,12 +309,12 @@ static int lngLoadFont(const char *dir, const char *name)
309
309
{
310
310
char path [256 ];
311
311
312
- snprintf (path , sizeof (path ), "%s/font_ %s.ttf" , dir , name );
312
+ snprintf (path , sizeof (path ), "%sfont_ %s.ttf" , dir , name );
313
313
LOG ("LANG Custom TTF font path: %s\n" , path );
314
314
if (fntLoadDefault (path ) == 0 )
315
315
return 0 ;
316
316
317
- snprintf (path , sizeof (path ), "%s/font_ %s.otf" , dir , name );
317
+ snprintf (path , sizeof (path ), "%sfont_ %s.otf" , dir , name );
318
318
LOG ("LANG Custom OTF font path: %s\n" , path );
319
319
if (fntLoadDefault (path ) == 0 )
320
320
return 0 ;
@@ -326,7 +326,8 @@ static int lngLoadFont(const char *dir, const char *name)
326
326
327
327
static int lngLoadFromFile (char * path , char * name )
328
328
{
329
- int HddStartMode ;
329
+ char dir [128 ];
330
+
330
331
file_buffer_t * fileBuffer = openFileBuffer (path , O_RDONLY , 1 , 1024 );
331
332
if (fileBuffer ) {
332
333
// file exists, try to read it and load the custom lang
@@ -350,14 +351,11 @@ static int lngLoadFromFile(char *path, char *name)
350
351
strId ++ ;
351
352
}
352
353
353
- if (lngLoadFont (gBaseMCDir , name ) != 0 ) {
354
- if (lngLoadFont ("mass0:LNG" , name ) != 0 ) {
355
- if (configGetInt (configGetByType (CONFIG_OPL ), CONFIG_OPL_HDD_MODE , & HddStartMode ) && (HddStartMode == START_MODE_AUTO )) {
356
- hddLoadModules ();
357
- lngLoadFont ("pfs0:LNG" , name );
358
- }
359
- }
360
- }
354
+ int len = strlen (path ) - strlen (name ) - 9 ; //-4 for extension, -5 for prefix
355
+ strncpy (dir , path , len );
356
+ dir [len ] = '\0' ;
357
+
358
+ lngLoadFont (dir , name );
361
359
362
360
return 1 ;
363
361
}
@@ -374,7 +372,7 @@ static int lngReadEntry(int index, const char *path, const char *separator, cons
374
372
if (!FIO_S_ISDIR (mode )) {
375
373
if (strstr (name , ".lng" ) || strstr (name , ".LNG" )) {
376
374
377
- language_t * currLang = & languages [index ];
375
+ language_t * currLang = & languages [nLanguages + index ];
378
376
379
377
// filepath for this language file
380
378
int length = strlen (path ) + 1 + strlen (name ) + 1 ;
0 commit comments