Fixing end_of_file and allocation_size, some wildcard stuff, etc.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/fs/devices/disc_image_file.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -30,7 +31,7 @@ DiscImageEntry::DiscImageEntry(Device* device, const char* path,
|
||||
: Entry(device, path),
|
||||
mmap_(mmap),
|
||||
gdfx_entry_(gdfx_entry),
|
||||
it_(gdfx_entry->children.end()) {}
|
||||
it_(gdfx_entry->children.begin()) {}
|
||||
|
||||
DiscImageEntry::~DiscImageEntry() {}
|
||||
|
||||
@@ -40,8 +41,8 @@ X_STATUS DiscImageEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
|
||||
out_info->last_access_time = 0;
|
||||
out_info->last_write_time = 0;
|
||||
out_info->change_time = 0;
|
||||
out_info->allocation_size = 2048;
|
||||
out_info->file_length = gdfx_entry_->size;
|
||||
out_info->allocation_size = xe::round_up(gdfx_entry_->size, 2048);
|
||||
out_info->end_of_file = gdfx_entry_->size;
|
||||
out_info->attributes = gdfx_entry_->attributes;
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -71,13 +72,13 @@ X_STATUS DiscImageEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
|
||||
|
||||
entry = gdfx_entry_->GetChild(find_engine_, it_);
|
||||
if (!entry) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
auto entry_name = entry->name;
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name.size() > end) {
|
||||
return X_STATUS_NO_MORE_FILES;
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ X_STATUS DiscImageEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info,
|
||||
out_info->last_write_time = 0;
|
||||
out_info->change_time = 0;
|
||||
out_info->end_of_file = entry->size;
|
||||
out_info->allocation_size = 2048;
|
||||
out_info->allocation_size = xe::round_up(entry->size, 2048);
|
||||
out_info->attributes = entry->attributes;
|
||||
out_info->file_name_length = static_cast<uint32_t>(entry->name.size());
|
||||
memcpy(out_info->file_name, entry->name.c_str(), entry->name.size());
|
||||
|
||||
@@ -48,7 +48,7 @@ X_STATUS DiscImageFile::ReadSync(void* buffer, size_t buffer_length,
|
||||
}
|
||||
size_t real_offset = gdfx_entry->offset + byte_offset;
|
||||
size_t real_length = std::min(buffer_length, gdfx_entry->size - byte_offset);
|
||||
memcpy(buffer, entry_->mmap()->data() + real_offset, real_length);
|
||||
std::memcpy(buffer, entry_->mmap()->data() + real_offset, real_length);
|
||||
*out_bytes_read = real_length;
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "xenia/kernel/fs/devices/host_path_entry.h"
|
||||
|
||||
#include "xenia/base/mapped_memory.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/kernel/fs/devices/host_path_file.h"
|
||||
|
||||
@@ -48,13 +49,14 @@ X_STATUS HostPathEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info) {
|
||||
return X_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
uint64_t file_size = ((uint64_t)data.nFileSizeHigh << 32) | data.nFileSizeLow;
|
||||
|
||||
out_info->creation_time = COMBINE_TIME(data.ftCreationTime);
|
||||
out_info->last_access_time = COMBINE_TIME(data.ftLastAccessTime);
|
||||
out_info->last_write_time = COMBINE_TIME(data.ftLastWriteTime);
|
||||
out_info->change_time = COMBINE_TIME(data.ftLastWriteTime);
|
||||
out_info->allocation_size = 4096;
|
||||
out_info->file_length =
|
||||
((uint64_t)data.nFileSizeHigh << 32) | data.nFileSizeLow;
|
||||
out_info->allocation_size = xe::round_up(file_size, 4096);
|
||||
out_info->end_of_file = file_size;
|
||||
out_info->attributes = (X_FILE_ATTRIBUTES)data.dwFileAttributes;
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -90,7 +92,7 @@ X_STATUS HostPathEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, s
|
||||
if (FindNextFile(handle, &ffd) == FALSE) {
|
||||
FindClose(handle);
|
||||
find_file_ = INVALID_HANDLE_VALUE;
|
||||
return X_STATUS_NO_MORE_FILES;
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,15 +104,16 @@ X_STATUS HostPathEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_info, s
|
||||
return X_STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
uint64_t file_size = ((uint64_t)ffd.nFileSizeHigh << 32) | ffd.nFileSizeLow;
|
||||
|
||||
out_info->next_entry_offset = 0;
|
||||
out_info->file_index = 0xCDCDCDCD;
|
||||
out_info->creation_time = COMBINE_TIME(ffd.ftCreationTime);
|
||||
out_info->last_access_time = COMBINE_TIME(ffd.ftLastAccessTime);
|
||||
out_info->last_write_time = COMBINE_TIME(ffd.ftLastWriteTime);
|
||||
out_info->change_time = COMBINE_TIME(ffd.ftLastWriteTime);
|
||||
out_info->end_of_file =
|
||||
((uint64_t)ffd.nFileSizeHigh << 32) | ffd.nFileSizeLow;
|
||||
out_info->allocation_size = 4096;
|
||||
out_info->end_of_file = file_size;
|
||||
out_info->allocation_size = xe::round_up(file_size, 4096);
|
||||
out_info->attributes = (X_FILE_ATTRIBUTES)ffd.dwFileAttributes;
|
||||
|
||||
out_info->file_name_length = (uint32_t)entry_name_length;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "xenia/kernel/fs/devices/stfs_container_entry.h"
|
||||
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/kernel/fs/devices/stfs_container_file.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -21,7 +22,7 @@ STFSContainerEntry::STFSContainerEntry(Device* device, const char* path,
|
||||
: Entry(device, path),
|
||||
mmap_(mmap),
|
||||
stfs_entry_(stfs_entry),
|
||||
it_(stfs_entry_->children.end()) {}
|
||||
it_(stfs_entry_->children.begin()) {}
|
||||
|
||||
STFSContainerEntry::~STFSContainerEntry() = default;
|
||||
|
||||
@@ -31,8 +32,8 @@ X_STATUS STFSContainerEntry::QueryInfo(X_FILE_NETWORK_OPEN_INFORMATION* out_info
|
||||
out_info->last_access_time = stfs_entry_->access_timestamp;
|
||||
out_info->last_write_time = stfs_entry_->update_timestamp;
|
||||
out_info->change_time = stfs_entry_->update_timestamp;
|
||||
out_info->allocation_size = 4096;
|
||||
out_info->file_length = stfs_entry_->size;
|
||||
out_info->allocation_size = xe::round_up(stfs_entry_->size, 4096);
|
||||
out_info->end_of_file = stfs_entry_->size;
|
||||
out_info->attributes = stfs_entry_->attributes;
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -64,13 +65,13 @@ X_STATUS STFSContainerEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_in
|
||||
|
||||
entry = stfs_entry_->GetChild(find_engine_, it_);
|
||||
if (!entry) {
|
||||
return X_STATUS_UNSUCCESSFUL;
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
auto entry_name = entry->name;
|
||||
if (((uint8_t*)&out_info->file_name[0]) + entry_name.size() > end) {
|
||||
return X_STATUS_NO_MORE_FILES;
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ X_STATUS STFSContainerEntry::QueryDirectory(X_FILE_DIRECTORY_INFORMATION* out_in
|
||||
out_info->last_write_time = entry->update_timestamp;
|
||||
out_info->change_time = entry->update_timestamp;
|
||||
out_info->end_of_file = entry->size;
|
||||
out_info->allocation_size = 4096;
|
||||
out_info->allocation_size = xe::round_up(entry->size, 4096);
|
||||
out_info->attributes = entry->attributes;
|
||||
out_info->file_name_length = static_cast<uint32_t>(entry->name.size());
|
||||
memcpy(out_info->file_name, entry->name.c_str(), entry->name.size());
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace xe {
|
||||
namespace kernel {
|
||||
class KernelState;
|
||||
class XFile;
|
||||
class X_FILE_NETWORK_OPEN_INFORMATION;
|
||||
struct X_FILE_NETWORK_OPEN_INFORMATION;
|
||||
class X_FILE_DIRECTORY_INFORMATION;
|
||||
class X_FILE_FS_ATTRIBUTE_INFORMATION;
|
||||
class X_FILE_FS_SIZE_INFORMATION;
|
||||
|
||||
Reference in New Issue
Block a user