Wiring up xex loading via the new virtual filesystem.
File resolution is hacked, but works well enough for testing.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#define XE_OPTION_LOG_SDB 1
|
||||
#define XE_OPTION_LOG_GPU 1
|
||||
#define XE_OPTION_LOG_KERNEL 1
|
||||
#define XE_OPTION_LOG_FS 1
|
||||
|
||||
|
||||
// TODO(benvanik): make this a runtime option
|
||||
|
||||
@@ -23,13 +23,17 @@ namespace fs {
|
||||
|
||||
class Device {
|
||||
public:
|
||||
Device(xe_pal_ref pal);
|
||||
Device(xe_pal_ref pal, const char* path);
|
||||
virtual ~Device();
|
||||
|
||||
xe_pal_ref pal();
|
||||
const char* path();
|
||||
|
||||
virtual Entry* ResolvePath(const char* path) = 0;
|
||||
|
||||
protected:
|
||||
xe_pal_ref pal_;
|
||||
xe_pal_ref pal_;
|
||||
char* path_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -45,12 +45,29 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class MemoryMapping {
|
||||
public:
|
||||
MemoryMapping(uint8_t* address, size_t length);
|
||||
virtual ~MemoryMapping();
|
||||
|
||||
uint8_t* address();
|
||||
size_t length();
|
||||
|
||||
private:
|
||||
uint8_t* address_;
|
||||
size_t length_;
|
||||
};
|
||||
|
||||
|
||||
class FileEntry : public Entry {
|
||||
public:
|
||||
FileEntry(Device* device, const char* path);
|
||||
virtual ~FileEntry();
|
||||
|
||||
//virtual void Query();
|
||||
//virtual void Query() = 0;
|
||||
|
||||
virtual MemoryMapping* CreateMemoryMapping(
|
||||
xe_file_mode file_mode, const size_t offset, const size_t length) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -59,7 +76,7 @@ public:
|
||||
DirectoryEntry(Device* device, const char* path);
|
||||
virtual ~DirectoryEntry();
|
||||
|
||||
//virtual void Query();
|
||||
//virtual void Query() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
|
||||
@@ -40,7 +42,9 @@ public:
|
||||
Entry* ResolvePath(const char* path);
|
||||
|
||||
private:
|
||||
xe_pal_ref pal_;
|
||||
xe_pal_ref pal_;
|
||||
std::vector<Device*> devices_;
|
||||
std::tr1::unordered_map<std::string, std::string> symlinks_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -54,10 +54,11 @@ public:
|
||||
shared_ptr<ExportResolver> export_resolver();
|
||||
shared_ptr<fs::FileSystem> filesystem();
|
||||
|
||||
int LaunchModule(const xechar_t* path);
|
||||
int LaunchXexFile(const xechar_t* path);
|
||||
int LaunchDiscImage(const xechar_t* path);
|
||||
|
||||
private:
|
||||
xechar_t command_line_[2048];
|
||||
xechar_t command_line_[XE_MAX_PATH];
|
||||
|
||||
xe_pal_ref pal_;
|
||||
xe_memory_ref memory_;
|
||||
|
||||
@@ -34,6 +34,7 @@ typedef uint32_t X_STATUS;
|
||||
#define X_STATUS_ACCESS_VIOLATION ((uint32_t)0xC0000005L)
|
||||
#define X_STATUS_INVALID_HANDLE ((uint32_t)0xC0000008L)
|
||||
#define X_STATUS_INVALID_PARAMETER ((uint32_t)0xC000000DL)
|
||||
#define X_STATUS_NO_SUCH_FILE ((uint32_t)0xC000000FL)
|
||||
#define X_STATUS_NO_MEMORY ((uint32_t)0xC0000017L)
|
||||
#define X_STATUS_ALREADY_COMMITTED ((uint32_t)0xC0000021L)
|
||||
#define X_STATUS_ACCESS_DENIED ((uint32_t)0xC0000022L)
|
||||
|
||||
@@ -74,6 +74,11 @@ void xe_log_line(const xechar_t* file_path, const uint32_t line_number,
|
||||
#else
|
||||
#define XELOGKERNEL(fmt, ...) XE_EMPTY_MACRO
|
||||
#endif
|
||||
#if XE_OPTION(LOG_FS)
|
||||
#define XELOGFS(fmt, ...) XELOGCORE('F', fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define XELOGFS(fmt, ...) XE_EMPTY_MACRO
|
||||
#endif
|
||||
|
||||
|
||||
#endif // XENIA_LOGGING_H_
|
||||
|
||||
@@ -31,7 +31,7 @@ int strncpy_s(char* dest, size_t destLength, const char* source, size_t count);
|
||||
#define xestrdupa _strdup
|
||||
#define xestrtoullw _wcstoui64
|
||||
#define xestrtoulla _strtoui64
|
||||
#endif
|
||||
#endif // !WIN32
|
||||
|
||||
#define xestrlenw wcslen
|
||||
#define xestrcmpw wcscmp
|
||||
@@ -40,6 +40,7 @@ int strncpy_s(char* dest, size_t destLength, const char* source, size_t count);
|
||||
#define xestrchrw wcschr
|
||||
#define xestrrchrw wcsrchr
|
||||
#define xestrstrw wcsstr
|
||||
#define xestrcasestrw ??
|
||||
#define xestrcpyw(dest, destLength, source) (wcscpy_s(dest, destLength, source) == 0)
|
||||
#define xestrncpyw(dest, destLength, source, count) (wcsncpy_s(dest, destLength, source, count) == 0)
|
||||
#define xestrcatw(dest, destLength, source) (wcscat_s(dest, destLength, source) == 0)
|
||||
@@ -53,6 +54,7 @@ int strncpy_s(char* dest, size_t destLength, const char* source, size_t count);
|
||||
#define xestrchra strchr
|
||||
#define xestrrchra strrchr
|
||||
#define xestrstra strstr
|
||||
#define xestrcasestra strcasestr
|
||||
#define xestrcpya(dest, destLength, source) (strcpy_s(dest, destLength, source) == 0)
|
||||
#define xestrncpya(dest, destLength, source, count) (strncpy_s(dest, destLength, source, count) == 0)
|
||||
#define xestrcata(dest, destLength, source) (strcat_s(dest, destLength, source) == 0)
|
||||
@@ -72,6 +74,7 @@ typedef wchar_t xechar_t;
|
||||
#define xestrchr xestrchrw
|
||||
#define xestrrchr xestrrchrw
|
||||
#define xestrstr xestrstrw
|
||||
#define xestrcasestr xestrcasestrw
|
||||
#define xestrtoull xestrtoullw
|
||||
#define xestrcpy xestrcpyw
|
||||
#define xestrncpy xestrncpyw
|
||||
@@ -94,6 +97,7 @@ typedef char xechar_t;
|
||||
#define xestrchr xestrchra
|
||||
#define xestrrchr xestrrchra
|
||||
#define xestrstr xestrstra
|
||||
#define xestrcasestr xestrcasestra
|
||||
#define xestrtoull xestrtoulla
|
||||
#define xestrcpy xestrcpya
|
||||
#define xestrncpy xestrncpya
|
||||
@@ -109,8 +113,10 @@ typedef char xechar_t;
|
||||
|
||||
#if XE_LIKE(WIN32)
|
||||
#define XE_PATH_SEPARATOR ((xechar_t)'\\')
|
||||
#define XE_MAX_PATH _MAX_PATH
|
||||
#else
|
||||
#define XE_PATH_SEPARATOR ((xechar_t)'/')
|
||||
#define XE_MAX_PATH PATH_MAX
|
||||
#endif // WIN32
|
||||
|
||||
#endif // XENIA_STRING_H_
|
||||
|
||||
Reference in New Issue
Block a user