XMountUtilityDrive code tries reading/writing from \Device\Harddisk0\Cache0 / Cache1 / Partition0, NullDevice handling \Device\Harddisk0 will make that code think that the reads/writes were successful, so the utility-drive mount can proceed without failing.
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
/**
|
|
******************************************************************************
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
******************************************************************************
|
|
* Copyright 2021 Ben Vanik. All rights reserved. *
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
******************************************************************************
|
|
*/
|
|
|
|
#include "xenia/vfs/devices/null_file.h"
|
|
|
|
#include "xenia/vfs/devices/null_entry.h"
|
|
|
|
namespace xe {
|
|
namespace vfs {
|
|
|
|
NullFile::NullFile(uint32_t file_access, NullEntry* entry)
|
|
: File(file_access, entry) {}
|
|
|
|
NullFile::~NullFile() = default;
|
|
|
|
void NullFile::Destroy() { delete this; }
|
|
|
|
X_STATUS NullFile::ReadSync(void* buffer, size_t buffer_length,
|
|
size_t byte_offset, size_t* out_bytes_read) {
|
|
if (!(file_access_ & FileAccess::kFileReadData)) {
|
|
return X_STATUS_ACCESS_DENIED;
|
|
}
|
|
|
|
return X_STATUS_SUCCESS;
|
|
}
|
|
|
|
X_STATUS NullFile::WriteSync(const void* buffer, size_t buffer_length,
|
|
size_t byte_offset, size_t* out_bytes_written) {
|
|
if (!(file_access_ &
|
|
(FileAccess::kFileWriteData | FileAccess::kFileAppendData))) {
|
|
return X_STATUS_ACCESS_DENIED;
|
|
}
|
|
|
|
return X_STATUS_SUCCESS;
|
|
}
|
|
|
|
X_STATUS NullFile::SetLength(size_t length) {
|
|
if (!(file_access_ & FileAccess::kFileWriteData)) {
|
|
return X_STATUS_ACCESS_DENIED;
|
|
}
|
|
|
|
return X_STATUS_SUCCESS;
|
|
}
|
|
|
|
} // namespace vfs
|
|
} // namespace xe
|