implements getprefpath in null platform driver
This commit is contained in:
parent
dc9d0922af
commit
653b7dc139
|
@ -224,7 +224,7 @@ void Harness_DetectAndSetWorkingDirectory(char* argv0) {
|
||||||
if (access("DATA/GENERAL.TXT", F_OK) == 0) {
|
if (access("DATA/GENERAL.TXT", F_OK) == 0) {
|
||||||
// good, found
|
// good, found
|
||||||
} else {
|
} else {
|
||||||
gHarness_platform.GetPrefPath("dethrace", pref_path);
|
gHarness_platform.GetPrefPath(pref_path, "dethrace");
|
||||||
path = pref_path;
|
path = pref_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ static int Harness_Ini_Callback(void* user, const char* section, const char* nam
|
||||||
int Harness_ProcessIniFile(void) {
|
int Harness_ProcessIniFile(void) {
|
||||||
int i;
|
int i;
|
||||||
char path[1024];
|
char path[1024];
|
||||||
gHarness_platform.GetPrefPath("dethrace", path);
|
gHarness_platform.GetPrefPath(path, "dethrace");
|
||||||
|
|
||||||
strcat(path, "dethrace.ini");
|
strcat(path, "dethrace.ini");
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ typedef struct tHarness_platform {
|
||||||
void* (*GL_GetProcAddress)(const char* name);
|
void* (*GL_GetProcAddress)(const char* name);
|
||||||
void (*GetViewport)(int* x, int* y, float* width_multiplier, float* height_multiplier);
|
void (*GetViewport)(int* x, int* y, float* width_multiplier, float* height_multiplier);
|
||||||
|
|
||||||
void (*GetPrefPath)(char* app_name, char* path);
|
void (*GetPrefPath)(char* path, char* app_name);
|
||||||
|
|
||||||
} tHarness_platform;
|
} tHarness_platform;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "null.h"
|
#include "null.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static uint32_t null_time;
|
static uint32_t null_time;
|
||||||
|
|
||||||
|
@ -53,6 +54,10 @@ static uint32_t null_getticks(void) {
|
||||||
return null_time;
|
return null_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void null_get_pref_path(char* path, char* app_name) {
|
||||||
|
strcpy(path, ".");
|
||||||
|
}
|
||||||
|
|
||||||
void Null_Platform_Init(tHarness_platform* platform) {
|
void Null_Platform_Init(tHarness_platform* platform) {
|
||||||
null_time = 0;
|
null_time = 0;
|
||||||
platform->ProcessWindowMessages = null_get_and_handle_message;
|
platform->ProcessWindowMessages = null_get_and_handle_message;
|
||||||
|
@ -68,4 +73,5 @@ void Null_Platform_Init(tHarness_platform* platform) {
|
||||||
platform->ShowErrorMessage = null_show_error_message;
|
platform->ShowErrorMessage = null_show_error_message;
|
||||||
|
|
||||||
platform->Renderer_SetPalette = null_set_palette;
|
platform->Renderer_SetPalette = null_set_palette;
|
||||||
|
platform->GetPrefPath = null_get_pref_path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ static void SDL1_Harness_GetViewport(int* x, int* y, float* width_multipler, flo
|
||||||
*height_multiplier = viewport.scale_y;
|
*height_multiplier = viewport.scale_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SDL1_Harness_GetPrefPath(char* app_name, char* path) {
|
static void SDL1_Harness_GetPrefPath(char* path, char* app_name) {
|
||||||
// SDL_GetPrefPath not in SDL1. We could implement it if we really needed to.
|
// SDL_GetPrefPath not in SDL1. We could implement it if we really needed to.
|
||||||
// for now, just return the current path
|
// for now, just return the current path
|
||||||
strcpy(path, ".");
|
strcpy(path, ".");
|
||||||
|
|
|
@ -367,7 +367,7 @@ static void SDL2_Harness_GetViewport(int* x, int* y, float* width_multipler, flo
|
||||||
*height_multiplier = viewport.scale_y;
|
*height_multiplier = viewport.scale_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SDL2_Harness_GetPrefPath(char* app_name, char* path) {
|
static void SDL2_Harness_GetPrefPath(char* path, char* app_name) {
|
||||||
char* sdl_path = SDL2_GetPrefPath(NULL, app_name);
|
char* sdl_path = SDL2_GetPrefPath(NULL, app_name);
|
||||||
strcpy(path, sdl_path);
|
strcpy(path, sdl_path);
|
||||||
SDL2_free(sdl_path);
|
SDL2_free(sdl_path);
|
||||||
|
|
Loading…
Reference in New Issue