allow all MAP files to be read from DDL archive

This commit is contained in:
Ondřej Novák 2025-06-14 14:10:02 +02:00
parent 96eaeb4851
commit 73a4187f79
18 changed files with 185 additions and 165 deletions

View file

@ -3,6 +3,7 @@
#include "globals.h"
#include "lang.h"
#include <libs/strlite.h>
#include <libs/memman.h>
static char *lang_folder = NULL;
@ -47,3 +48,19 @@ const char *lang_replace_path_if_exists(const char *file) {
if (check_file_exists(path)) return path;
return NULL;
}
char *lang_load_string(const char *filename) {
if (lang_folder == NULL) return NULL;
const char *path = build_pathname(2, lang_folder, filename);
FILE *f = fopen(path, "r");
if (f == NULL) return NULL;
fseek(f, 0, SEEK_END);
long sz = ftell(f);
char *trg = getmem(sz+1);
fseek(f, 0, SEEK_SET);
fread(trg, 1 , sz, f);
fclose(f);
trg[sz] = 0;
return trg;
}