mirror of
https://github.com/wiiu-env/RPXLoadingModule.git
synced 2024-11-22 09:59:17 +01:00
Make sure the iconCache is aligned properly
This commit is contained in:
parent
5e53161cb1
commit
c6a700bf51
@ -42,7 +42,7 @@ DECL_FUNCTION(int, RPX_FSOpenFile, FSClient *client, FSCmdBlock *block, char *pa
|
|||||||
if (StringTools::EndsWith(path, iconTex)) {
|
if (StringTools::EndsWith(path, iconTex)) {
|
||||||
if (gReplacementInfo.rpxReplacementInfo.isRPXReplaced) {
|
if (gReplacementInfo.rpxReplacementInfo.isRPXReplaced) {
|
||||||
if (StringTools::EndsWith(path, iconTex)) {
|
if (StringTools::EndsWith(path, iconTex)) {
|
||||||
auto *reader = new FileReader(reinterpret_cast<uint8_t *>(gReplacementInfo.rpxReplacementInfo.iconCache), sizeof(gReplacementInfo.rpxReplacementInfo.iconCache));
|
auto *reader = new FileReader(reinterpret_cast<uint8_t *>(gReplacementInfo.rpxReplacementInfo.iconCache), ICON_SIZE);
|
||||||
*handle = (uint32_t) reader;
|
*handle = (uint32_t) reader;
|
||||||
return FS_STATUS_OK;
|
return FS_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ bool RL_LoadFromSDOnNextLaunch(const char *bundle_path) {
|
|||||||
}
|
}
|
||||||
if (reader) {
|
if (reader) {
|
||||||
uint32_t alreadyRead = 0;
|
uint32_t alreadyRead = 0;
|
||||||
uint32_t toRead = sizeof(gReplacementInfo.rpxReplacementInfo.iconCache);
|
uint32_t toRead = ICON_SIZE;
|
||||||
do {
|
do {
|
||||||
int read = reader->read(reinterpret_cast<uint8_t *>(&gReplacementInfo.rpxReplacementInfo.iconCache[alreadyRead]), toRead);
|
int read = reader->read(reinterpret_cast<uint8_t *>(&gReplacementInfo.rpxReplacementInfo.iconCache[alreadyRead]), toRead);
|
||||||
if (read <= 0) {
|
if (read <= 0) {
|
||||||
@ -152,7 +152,7 @@ bool RL_LoadFromSDOnNextLaunch(const char *bundle_path) {
|
|||||||
}
|
}
|
||||||
alreadyRead += read;
|
alreadyRead += read;
|
||||||
toRead -= read;
|
toRead -= read;
|
||||||
} while (alreadyRead < sizeof(gReplacementInfo.rpxReplacementInfo.iconCache));
|
} while (alreadyRead < ICON_SIZE);
|
||||||
delete reader;
|
delete reader;
|
||||||
} else {
|
} else {
|
||||||
memset(gReplacementInfo.rpxReplacementInfo.iconCache, 0, sizeof(gReplacementInfo.rpxReplacementInfo.iconCache));
|
memset(gReplacementInfo.rpxReplacementInfo.iconCache, 0, sizeof(gReplacementInfo.rpxReplacementInfo.iconCache));
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
|
#include "utils/utils.h"
|
||||||
#include <coreinit/filesystem.h>
|
#include <coreinit/filesystem.h>
|
||||||
#include <coreinit/mutex.h>
|
#include <coreinit/mutex.h>
|
||||||
#include <wums.h>
|
#include <wums.h>
|
||||||
|
#include <wut.h>
|
||||||
|
|
||||||
typedef struct MetaInformation_t {
|
typedef struct WUT_PACKED MetaInformation_t {
|
||||||
char shortname[64];
|
char shortname[64];
|
||||||
char longname[64];
|
char longname[64];
|
||||||
char author[64];
|
char author[64];
|
||||||
} MetaInformation;
|
} MetaInformation;
|
||||||
|
WUT_CHECK_SIZE(MetaInformation_t, 0xC0);
|
||||||
|
|
||||||
typedef struct BundleMountInformation_t {
|
typedef struct BundleMountInformation_t {
|
||||||
bool isMounted;
|
bool isMounted;
|
||||||
@ -14,12 +17,18 @@ typedef struct BundleMountInformation_t {
|
|||||||
char mountedPath[255];
|
char mountedPath[255];
|
||||||
} BundleMountInformation;
|
} BundleMountInformation;
|
||||||
|
|
||||||
typedef struct RPXReplacementInfo_t {
|
#define ICON_SIZE 65580
|
||||||
|
|
||||||
|
typedef struct WUT_PACKED RPXReplacementInfo_t {
|
||||||
bool willRPXBeReplaced;
|
bool willRPXBeReplaced;
|
||||||
bool isRPXReplaced;
|
bool isRPXReplaced;
|
||||||
MetaInformation metaInformation;
|
MetaInformation metaInformation;
|
||||||
char iconCache[65580];
|
WUT_UNKNOWN_BYTES(0x3E);
|
||||||
|
char iconCache[ROUNDUP(ICON_SIZE, 0x040)];
|
||||||
} RPXReplacementInfo;
|
} RPXReplacementInfo;
|
||||||
|
// make sure the iconCache is aligned to 0x40
|
||||||
|
WUT_CHECK_OFFSET(RPXReplacementInfo, 0x100, iconCache);
|
||||||
|
|
||||||
|
|
||||||
typedef enum ContentRedirect_Mode {
|
typedef enum ContentRedirect_Mode {
|
||||||
CONTENTREDIRECT_NONE,
|
CONTENTREDIRECT_NONE,
|
||||||
|
Loading…
Reference in New Issue
Block a user