mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
feat(console): load console variables from WTF files
This commit is contained in:
parent
b2a7a3d4ca
commit
1219279a2d
5 changed files with 170 additions and 2 deletions
|
|
@ -4,6 +4,9 @@
|
|||
#include <storm/Memory.hpp>
|
||||
#include <storm/String.hpp>
|
||||
|
||||
static char s_basepath[STORM_MAX_PATH] = {0};
|
||||
static char s_datapath[STORM_MAX_PATH] = {0};
|
||||
|
||||
// TODO Proper implementation
|
||||
int32_t SFile::Close(SFile* file) {
|
||||
delete file->m_filename;
|
||||
|
|
@ -125,3 +128,42 @@ int32_t SFile::Unload(void* ptr) {
|
|||
SMemFree(ptr, __FILE__, __LINE__, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t SFile::SetBasePath(const char* path) {
|
||||
SStrCopy(s_basepath, path, STORM_MAX_PATH);
|
||||
|
||||
if (s_basepath != '\0') {
|
||||
auto len = SStrLen(s_basepath);
|
||||
if (s_basepath[len-1] != '\\') {
|
||||
SStrPack(s_basepath, "\\", STORM_MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
// SFileSetBasePath(path);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t SFile::SetDataPath(const char* path) {
|
||||
SStrCopy(s_datapath, path, STORM_MAX_PATH);
|
||||
|
||||
if (s_datapath != '\0') {
|
||||
auto len = SStrLen(s_datapath);
|
||||
if (s_basepath[len-1] != '\\') {
|
||||
SStrPack(s_datapath, "\\", STORM_MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t SFile::GetBasePath(char* buffer, size_t bufferchars) {
|
||||
SStrCopy(buffer, s_basepath, bufferchars);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t SFile::GetDataPath(char* buffer, size_t bufferchars) {
|
||||
SStrCopy(buffer, s_datapath, bufferchars);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ class SFile {
|
|||
static int32_t OpenEx(SArchive*, const char*, uint32_t, SFile**);
|
||||
static int32_t Read(SFile*, void*, size_t, size_t*, SOVERLAPPED*, TASYNCPARAMBLOCK*);
|
||||
static int32_t Unload(void*);
|
||||
static int32_t SetBasePath(const char* path);
|
||||
static int32_t SetDataPath(const char* path);
|
||||
static int32_t GetBasePath(char* path, size_t capacity);
|
||||
static int32_t GetDataPath(char* path, size_t capacity);
|
||||
|
||||
// Member variables
|
||||
const char* m_filename;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue