[GSOC] Add SDL2 library + additional SDL libraries #92

Open
Ghost wants to merge 8 commits from (deleted):sdl2-kolibri into main
3 changed files with 58 additions and 3 deletions
Showing only changes of commit 6fc6f9cc87 - Show all commits

View File

@ -44,7 +44,7 @@ loadso_OBJS = src/loadso/dummy/SDL_sysloadso.o
power_OBJS = src/power/SDL_power.o
filesystem_OBJS = src/filesystem/dummy/SDL_sysfilesystem.o
filesystem_OBJS = src/filesystem/kolibri/SDL_sysfilesystem.o
locale_OBJS = src/locale/SDL_locale.o src/locale/dummy/SDL_syslocale.o

View File

@ -116,7 +116,7 @@
/* Enable the dummy video driver (src/video/dummy/\*.c) */
#define SDL_VIDEO_DRIVER_DUMMY 1
/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
#define SDL_FILESYSTEM_DUMMY 1
/* Enable the Kolibri filesystem driver (src/filesystem/kolibri/\*.c) */
#define SDL_FILESYSTEM_KOLIBRI 1
#endif /* SDL_config_minimal_h_ */

View File

@ -0,0 +1,55 @@
#include "../../SDL_internal.h"
#ifdef SDL_FILESYSTEM_KOLIBRI
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */
#include <sys/ksys.h>
#include "SDL_error.h"
#include "SDL_filesystem.h"
char *SDL_GetBasePath(void)
{
char *retval = NULL;
size_t len;
char cwd[FILENAME_MAX];
_ksys_getcwd(cwd, sizeof(cwd));
len = SDL_strlen(cwd) + 2;
retval = (char *)SDL_malloc(len);
SDL_snprintf(retval, len, "%s/", cwd);
return retval;
}
char *SDL_GetPrefPath(const char *org, const char *app)
{
char *retval = NULL;
size_t len;
char *base = SDL_GetBasePath();
if (!app) {
SDL_InvalidParamError("app");
return NULL;
}
if (!org) {
org = "";
}
len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4;
retval = (char *)SDL_malloc(len);
if (*org) {
SDL_snprintf(retval, len, "%s%s/%s/", base, org, app);
} else {
SDL_snprintf(retval, len, "%s%s/", base, app);
}
free(base);
_ksys_mkdir(retval);
return retval;
}
#endif /* SDL_FILESYSTEM_KOLIBRI */