Removing utilities (that were just adding needless layers).

Progress on #294.
This commit is contained in:
Ben Vanik
2015-06-27 16:27:24 -07:00
parent 246c47f923
commit abf47b7973
17 changed files with 125 additions and 217 deletions

View File

@@ -17,29 +17,29 @@
namespace xe {
namespace vfs {
DiscImageDevice::DiscImageDevice(const std::string& path,
DiscImageDevice::DiscImageDevice(const std::string& mount_path,
const std::wstring& local_path)
: Device(path), local_path_(local_path), gdfx_(nullptr) {}
: Device(mount_path), local_path_(local_path), gdfx_(nullptr) {}
DiscImageDevice::~DiscImageDevice() { delete gdfx_; }
int DiscImageDevice::Init() {
bool DiscImageDevice::Initialize() {
mmap_ = MappedMemory::Open(local_path_, MappedMemory::Mode::kRead);
if (!mmap_) {
XELOGE("Disc image could not be mapped");
return 1;
return false;
}
gdfx_ = new GDFX(mmap_.get());
GDFX::Error error = gdfx_->Load();
if (error != GDFX::kSuccess) {
XELOGE("GDFX init failed: %d", error);
return 1;
return false;
}
// gdfx_->Dump();
return 0;
return true;
}
std::unique_ptr<Entry> DiscImageDevice::ResolvePath(const char* path) {

View File

@@ -23,10 +23,11 @@ class GDFX;
class DiscImageDevice : public Device {
public:
DiscImageDevice(const std::string& path, const std::wstring& local_path);
DiscImageDevice(const std::string& mount_path,
const std::wstring& local_path);
~DiscImageDevice() override;
int Init();
bool Initialize();
std::unique_ptr<Entry> ResolvePath(const char* path) override;

View File

@@ -17,9 +17,9 @@
namespace xe {
namespace vfs {
HostPathDevice::HostPathDevice(const std::string& path,
HostPathDevice::HostPathDevice(const std::string& mount_path,
const std::wstring& local_path, bool read_only)
: Device(path), local_path_(local_path), read_only_(read_only) {}
: Device(mount_path), local_path_(local_path), read_only_(read_only) {}
HostPathDevice::~HostPathDevice() {}

View File

@@ -19,7 +19,7 @@ namespace vfs {
class HostPathDevice : public Device {
public:
HostPathDevice(const std::string& path, const std::wstring& local_path,
HostPathDevice(const std::string& mount_path, const std::wstring& local_path,
bool read_only);
~HostPathDevice() override;

View File

@@ -18,29 +18,29 @@
namespace xe {
namespace vfs {
STFSContainerDevice::STFSContainerDevice(const std::string& path,
STFSContainerDevice::STFSContainerDevice(const std::string& mount_path,
const std::wstring& local_path)
: Device(path), local_path_(local_path), stfs_(nullptr) {}
: Device(mount_path), local_path_(local_path), stfs_(nullptr) {}
STFSContainerDevice::~STFSContainerDevice() { delete stfs_; }
int STFSContainerDevice::Init() {
bool STFSContainerDevice::Initialize() {
mmap_ = MappedMemory::Open(local_path_, MappedMemory::Mode::kRead);
if (!mmap_) {
XELOGE("STFS container could not be mapped");
return 1;
return false;
}
stfs_ = new STFS(mmap_.get());
STFS::Error error = stfs_->Load();
if (error != STFS::kSuccess) {
XELOGE("STFS init failed: %d", error);
return 1;
return false;
}
// stfs_->Dump();
return 0;
return true;
}
std::unique_ptr<Entry> STFSContainerDevice::ResolvePath(const char* path) {

View File

@@ -23,10 +23,11 @@ class STFS;
class STFSContainerDevice : public Device {
public:
STFSContainerDevice(const std::string& path, const std::wstring& local_path);
STFSContainerDevice(const std::string& mount_path,
const std::wstring& local_path);
~STFSContainerDevice() override;
int Init();
bool Initialize();
std::unique_ptr<Entry> ResolvePath(const char* path) override;