Update remaining platform backends

This commit is contained in:
Clownacy 2020-10-11 21:28:04 +01:00
parent f9993b264c
commit b5292f0ce7
4 changed files with 18 additions and 11 deletions

View file

@ -188,9 +188,10 @@ void Backend_PostWindowCreation(void)
glfwSetWindowSizeCallback(window, WindowSizeCallback);
}
bool Backend_GetBasePath(std::string *string_buffer)
bool Backend_GetPaths(std::string *module_path, std::string *data_path)
{
(void)string_buffer;
(void)module_path;
(void)data_path;
// GLFW3 doesn't seem to have a mechanism for this
return false;

View file

@ -22,9 +22,10 @@ void Backend_PostWindowCreation(void)
}
bool Backend_GetBasePath(std::string *string_buffer)
bool Backend_GetPaths(std::string *module_path, std::string *data_path)
{
(void)string_buffer;
(void)module_path;
(void)data_path;
return false;
}

View file

@ -89,14 +89,15 @@ void Backend_PostWindowCreation(void)
}
bool Backend_GetBasePath(std::string *string_buffer)
bool Backend_GetPaths(std::string *module_path, std::string *data_path)
{
#ifdef _WIN32
// SDL_GetBasePath returns a UTF-8 string, but Windows' fopen uses (extended?) ASCII.
// This is apparently a problem for accented characters, as they will make fopen fail.
// So, instead, we rely on argv[0], as that will put the accented characters in a
// format Windows will understand.
(void)string_buffer;
(void)module_path;
(void)data_path;
return false;
#else
@ -107,9 +108,11 @@ bool Backend_GetBasePath(std::string *string_buffer)
// Trim the trailing '/'
size_t base_path_length = strlen(base_path);
base_path[base_path_length - 1] = '\0';
*string_buffer = base_path;
*module_path = base_path;
SDL_free(base_path);
*data_path = *module_path + "/data";
return true;
#endif
}

View file

@ -59,15 +59,17 @@ void Backend_PostWindowCreation(void)
}
bool Backend_GetBasePath(std::string *string_buffer)
bool Backend_GetPaths(std::string *module_path, std::string *data_path)
{
*string_buffer = WHBGetSdCardMountPath();
*module_path = WHBGetSdCardMountPath();
#ifdef JAPANESE
*string_buffer += "/CSE2-portable-jp";
*module_path += "/CSE2-portable-jp";
#else
*string_buffer += "/CSE2-portable-en";
*module_path += "/CSE2-portable-en";
#endif
*data_path = *module_path + "/data";
return true;
}