Converting logging to ASCII and other Windows fixes.
This commit is contained in:
@@ -83,3 +83,27 @@ size_t xe_file_read(xe_file_ref file, const size_t offset,
|
||||
|
||||
return fread(buffer, 1, buffer_size, handle);
|
||||
}
|
||||
|
||||
void xe_path_join(const xechar_t* left, const xechar_t* right,
|
||||
xechar_t* out_path, size_t out_path_size) {
|
||||
#if XE_WCHAR
|
||||
xesnprintf(out_path, out_path_size, XT("%ls%c%ls"),
|
||||
left, XE_PATH_SEPARATOR, right);
|
||||
#else
|
||||
xesnprintf(out_path, out_path_size, XT("%s%c%s"),
|
||||
left, XE_PATH_SEPARATOR, right);
|
||||
#endif // XE_WCHAR
|
||||
}
|
||||
|
||||
void xe_path_get_absolute(const xechar_t* path, xechar_t* out_abs_path,
|
||||
size_t abs_path_size) {
|
||||
#if XE_PLATFORM(WIN32)
|
||||
#if XE_WCHAR
|
||||
_wfullpath(out_abs_path, path, abs_path_size);
|
||||
#else
|
||||
_fullpath(out_abs_path, path, abs_path_size);
|
||||
#endif // XE_WCHAR
|
||||
#else
|
||||
realpath(path, out_abs_path);
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
@@ -33,5 +33,10 @@ size_t xe_file_get_length(xe_file_ref file);
|
||||
size_t xe_file_read(xe_file_ref file, const size_t offset,
|
||||
uint8_t *buffer, const size_t buffer_size);
|
||||
|
||||
void xe_path_join(const xechar_t* left, const xechar_t* right,
|
||||
xechar_t* out_path, size_t out_path_size);
|
||||
void xe_path_get_absolute(const xechar_t* path, xechar_t* out_abs_path,
|
||||
size_t abs_path_size);
|
||||
|
||||
|
||||
#endif // XENIA_CORE_FILE_H_
|
||||
|
||||
@@ -83,10 +83,12 @@ xe_mmap_ref xe_mmap_open(xe_pal_ref pal, const xe_file_mode mode,
|
||||
mmap->file_handle = file_handle;
|
||||
mmap->mmap_handle = handle;
|
||||
mmap->addr = address;
|
||||
if (!length) {
|
||||
if (length) {
|
||||
mmap->length = length;
|
||||
} else {
|
||||
size_t map_length = GetFileSize(file_handle, NULL);
|
||||
DWORD length_high;
|
||||
size_t map_length = GetFileSize(file_handle, &length_high);
|
||||
map_length |= ((uint64_t)length_high) << 32;
|
||||
mmap->length = map_length;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ int xe_thread_start(xe_thread_ref thread) {
|
||||
if (!thread_handle) {
|
||||
uint32_t last_error = GetLastError();
|
||||
// TODO(benvanik): translate?
|
||||
XELOGE(XT("CreateThread failed with %d"), last_error);
|
||||
XELOGE("CreateThread failed with %d", last_error);
|
||||
return last_error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user