32 getenv(
"DTTR_ISO_CACHE_ROOT")
37 getenv(
"DTTR_ISO_GAME_ROOT")
62 const size_t parent_len = strlen(parent);
63 const bool needs_separator = parent_len > 0
66 const int written = snprintf(
71 needs_separator ?
"\\" :
""
73 if (written <= 0 || (
size_t)written >=
sizeof(pattern)) {
77 WIN32_FIND_DATAA
data;
78 HANDLE find = FindFirstFileA(pattern, &
data);
79 if (find == INVALID_HANDLE_VALUE) {
89 }
while (FindNextFileA(find, &
data));
99 if (!path || !path[0] || !out_path || out_path_size == 0) {
103 const char *rest =
NULL;
111 bool wrote_segment =
false;
114 const char *segment = rest;
122 if (!
find_case_match(resolved, segment, segment_len, match,
sizeof(match))) {
132 wrote_segment =
true;
149 for (
const char *p = path; *p;) {
151 if (segment_len ==
sizeof(
"data") - 1
156 if (segment_len ==
sizeof(
"pcdogs.pkg") - 1
173 sds path = sdsnew(
source.game_root);
189 if (!
source.is_iso || !path || !path[0] || !out_path || out_path_size == 0) {
193 const char *relative = path;
213 sds requested = sdsnew(base_path ? *base_path :
NULL);
219 char resolved[MAX_PATH];
220 const char *out_path =
NULL;
226 char cached[MAX_PATH];
235 sds out = sdsnew(out_path);
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void * data
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
#define DTTR_ISO_MAX_PATH
bool DTTR_ISO_CachePathForFile(const char *cache_root, const char *iso_relative_path, char *out_path, size_t out_path_size)
bool DTTR_Path_AsciiIeqN(const char *lhs, const char *rhs, size_t n)
sds DTTR_Path_NativeRoot(const char *path, const char **rest)
bool DTTR_Path_IsSeparator(char ch)
const char * DTTR_Path_SkipSeparators(const char *path)
bool DTTR_Path_IsRelativeSegment(const char *segment, size_t segment_len)
bool DTTR_Path_CopyString(char *out, size_t out_size, const char *value)
bool DTTR_Path_CopySds(char *out, size_t out_size, sds value)
bool DTTR_Path_ExactExists(const char *path)
#define DTTR_PATH_NATIVE_SEPARATOR
bool DTTR_Path_IsAnyAbsolute(const char *path)
bool DTTR_Path_AppendSegment(sds *path, const char *segment, char separator)
size_t DTTR_Path_SegmentLen(const char *path)
bool DTTR_Path_IsSafeRelative(const char *path)
#define DTTR_PCDOGS_D_AUDIO_OPEN_STREAM_PKG_BASE_PATH_COUNT
DTTR_PCDOGS_API const struct DTTR_PCDOGS_D_Audio_OpenStream_PKGBasePath_type *const DTTR_PCDOGS_D_Audio_OpenStream_PKGBasePath
sds dttr_game_data_resolve_media_path(const char *relative)
bool dttr_game_data_resolve_read_path(const char *path, char *out_path, size_t out_path_size)
void dttr_game_data_cleanup()
static bool append_game_path(const char *relative, char *out, size_t out_size)
bool dttr_game_data_resolve_existing_read_path(const char *path, char *out_path, size_t out_path_size)
static game_data_source source
static bool find_case_match(const char *parent, const char *segment, size_t segment_len, char *out_name, size_t out_name_size)
const char * dttr_game_data_find_data_segment(const char *path)
void dttr_game_data_init()
static bool name_matches_segment(const char *name, const char *segment, size_t segment_len)
char game_root[DTTR_ISO_MAX_PATH]
char cache_root[DTTR_ISO_MAX_PATH]