mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-23 03:39:16 +01:00
Merge branch 'fix/sharedcontent' into fix/enhanced
add sharedcontent installation fix to main fixes branch
This commit is contained in:
commit
92a412ffd5
@ -329,6 +329,7 @@ bool Wad::InstallContents(const char *installpath)
|
|||||||
else if(result < 0) // failure
|
else if(result < 0) // failure
|
||||||
return false;
|
return false;
|
||||||
// else it does not exist...install it
|
// else it does not exist...install it
|
||||||
|
snprintf(filepath, sizeof(filepath), "%s/shared1/%08x.app", installpath, (unsigned int)content_map_size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// private content
|
// private content
|
||||||
@ -419,6 +420,16 @@ bool Wad::InstallContents(const char *installpath)
|
|||||||
ShowError(tr("File read/write error."));
|
ShowError(tr("File read/write error."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(content->type == 0x8001) {
|
||||||
|
// shared content installed ok. It's time to update content.map
|
||||||
|
int result = UpdateContentMap(installpath, content, filepath);
|
||||||
|
if(result == 1) // exists already, skip file
|
||||||
|
continue;
|
||||||
|
|
||||||
|
else if(result < 0) // failure
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -448,6 +459,16 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi
|
|||||||
return 1; // content exists already
|
return 1; // content exists already
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Content does not exists
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Wad::UpdateContentMap(const char *installpath, tmd_content *content, char *filepath)
|
||||||
|
{
|
||||||
|
int result = CheckContentMap(installpath,content,filepath);
|
||||||
|
if ( result != 0 )
|
||||||
|
return result; // content already exists or error
|
||||||
|
|
||||||
// Content does not exists, append it.
|
// Content does not exists, append it.
|
||||||
u32 next_entry = content_map_size;
|
u32 next_entry = content_map_size;
|
||||||
u8 *tmp = (u8 *) realloc(content_map, (next_entry + 1) * sizeof(map_entry_t));
|
u8 *tmp = (u8 *) realloc(content_map, (next_entry + 1) * sizeof(map_entry_t));
|
||||||
@ -461,7 +482,7 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi
|
|||||||
content_map = tmp;
|
content_map = tmp;
|
||||||
content_map_size++;
|
content_map_size++;
|
||||||
|
|
||||||
map = (map_entry_t *) content_map;
|
map_entry_t *map = (map_entry_t *) content_map;
|
||||||
char name[9];
|
char name[9];
|
||||||
sprintf(name, "%08x", (unsigned int)next_entry);
|
sprintf(name, "%08x", (unsigned int)next_entry);
|
||||||
memcpy(map[next_entry].name, name, 8);
|
memcpy(map[next_entry].name, name, 8);
|
||||||
@ -472,8 +493,6 @@ int Wad::CheckContentMap(const char *installpath, tmd_content *content, char *fi
|
|||||||
if(!WriteFile(filepath, content_map, content_map_size * sizeof(map_entry_t)))
|
if(!WriteFile(filepath, content_map, content_map_size * sizeof(map_entry_t)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
snprintf(filepath, 1024, "%s/shared1/%08x.app", installpath, (unsigned int)next_entry);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool InstallContents(const char *installpath);
|
bool InstallContents(const char *installpath);
|
||||||
int CheckContentMap(const char *installpath, tmd_content *content, char *filepath);
|
int CheckContentMap(const char *installpath, tmd_content *content, char *filepath);
|
||||||
|
int UpdateContentMap(const char *installpath, tmd_content *content, char *filepath);
|
||||||
bool WriteFile(const char *filepath, u8 *buffer, u32 len);
|
bool WriteFile(const char *filepath, u8 *buffer, u32 len);
|
||||||
bool SetTitleUID(const char *intallpath, const u64 &tid);
|
bool SetTitleUID(const char *intallpath, const u64 &tid);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user