mirror of
https://github.com/wiiu-env/homebrew_launcher.git
synced 2025-02-17 13:06:20 +01:00
Adapt to new RPX loading
This commit is contained in:
parent
fe5604de4d
commit
764bfbcd3c
@ -23,7 +23,7 @@ int32_t HomebrewLoader::loadToMemory(const std::string & file) {
|
|||||||
HomebrewLoader * loader = new HomebrewLoader(file);
|
HomebrewLoader * loader = new HomebrewLoader(file);
|
||||||
int result = loader->loadToMemory();
|
int result = loader->loadToMemory();
|
||||||
delete loader;
|
delete loader;
|
||||||
return result;;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// You must free the result if result is non-NULL.
|
// You must free the result if result is non-NULL.
|
||||||
@ -73,6 +73,14 @@ char *str_replace(char *orig, char *rep, char *with) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct __attribute((packed)) {
|
||||||
|
uint32_t command;
|
||||||
|
uint32_t target;
|
||||||
|
uint32_t filesize;
|
||||||
|
uint32_t fileoffset;
|
||||||
|
char path[256];
|
||||||
|
}LOAD_REQUEST;
|
||||||
|
|
||||||
int HomebrewLoader::loadToMemory() {
|
int HomebrewLoader::loadToMemory() {
|
||||||
if(filepath.empty()) {
|
if(filepath.empty()) {
|
||||||
return INVALID_INPUT;
|
return INVALID_INPUT;
|
||||||
@ -81,7 +89,7 @@ int HomebrewLoader::loadToMemory() {
|
|||||||
log_printf("Loading file %s\n", filepath.c_str());
|
log_printf("Loading file %s\n", filepath.c_str());
|
||||||
|
|
||||||
char * repl = (char*)"fs:/vol/external01/";
|
char * repl = (char*)"fs:/vol/external01/";
|
||||||
char * with = (char*)"/vol/storage_iosu_homebrew/";
|
char * with = (char*)"";
|
||||||
char * input = (char*) filepath.c_str();
|
char * input = (char*) filepath.c_str();
|
||||||
|
|
||||||
char* extension = input + strlen(input) - 4;
|
char* extension = input + strlen(input) - 4;
|
||||||
@ -90,21 +98,25 @@ int HomebrewLoader::loadToMemory() {
|
|||||||
extension[2] == 'p' &&
|
extension[2] == 'p' &&
|
||||||
extension[3] == 'x') {
|
extension[3] == 'x') {
|
||||||
|
|
||||||
|
|
||||||
char rpxpath[280];
|
|
||||||
char * path = str_replace(input,repl, with);
|
char * path = str_replace(input,repl, with);
|
||||||
if(path != NULL) {
|
if(path != NULL) {
|
||||||
|
LOAD_REQUEST request;
|
||||||
|
memset(&request, 0, sizeof(request));
|
||||||
|
|
||||||
log_printf("Loading file %s\n", path);
|
log_printf("Loading file %s\n", path);
|
||||||
|
request.command = 0xFC; // IPC_CUSTOM_LOAD_CUSTOM_RPX;
|
||||||
strncpy(rpxpath, path, sizeof(rpxpath) - 1);
|
request.target = 0; // LOAD_FILE_TARGET_SD_CARD
|
||||||
rpxpath[sizeof(rpxpath) - 1] = '\0';
|
request.filesize = 0; // unknown
|
||||||
|
request.fileoffset = 0; //
|
||||||
|
|
||||||
|
strncpy(request.path, path, 255);
|
||||||
|
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
int mcpFd = IOS_Open("/dev/mcp", (IOSOpenMode)0);
|
int mcpFd = IOS_Open("/dev/mcp", (IOSOpenMode)0);
|
||||||
if(mcpFd >= 0) {
|
if(mcpFd >= 0) {
|
||||||
int out = 0;
|
int out = 0;
|
||||||
IOS_Ioctl(mcpFd, 100, (void*)rpxpath, strlen(rpxpath), &out, sizeof(out));
|
IOS_Ioctl(mcpFd, 100, &request, sizeof(request), &out, sizeof(out));
|
||||||
IOS_Close(mcpFd);
|
IOS_Close(mcpFd);
|
||||||
if(out == 2) {
|
if(out == 2) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user