diff --git a/Dockerfile b/Dockerfile index 06f3c9f..370c6d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM wiiuenv/devkitppc:20210101 +COPY --from=wiiuenv/librpxloader:20210116 /artifacts $DEVKITPRO COPY --from=wiiuenv/libfunctionpatcher:20210109 /artifacts $DEVKITPRO COPY --from=wiiuenv/wiiumodulesystem:20210101 /artifacts $DEVKITPRO COPY --from=wiiuenv/libromfs_wiiu:20210109133626639534 /artifacts $DEVKITPRO diff --git a/src/RPXLoading.cpp b/src/RPXLoading.cpp index f3a9394..24c1d76 100644 --- a/src/RPXLoading.cpp +++ b/src/RPXLoading.cpp @@ -14,6 +14,7 @@ #include "utils/StringTools.h" #include "utils/ini.h" #include +#include char gIconCache[65580] __attribute__((section(".data"))); @@ -194,8 +195,8 @@ bool RL_LoadFromSDOnNextLaunch(const char *bundle_path) { return true; } -int32_t RL_MountBundle(const char *name, const char *path, RomfsSource source) { - return romfsMount(name, path, source); +int32_t RL_MountBundle(const char *name, const char *path, BundleSource source) { + return romfsMount(name, path, (RomfsSource) source); } int32_t RL_UnmountBundle(const char *name) { @@ -236,7 +237,7 @@ int32_t RL_FileClose(uint32_t handle) { return 0; } -int32_t RL_FileExists(const char *name) { +bool RL_FileExists(const char *name) { std::string checkgz = std::string(name) + ".gz"; return CheckFile(name) || CheckFile(checkgz.c_str()); } diff --git a/src/utils/FileReader.cpp b/src/utils/FileReader.cpp index cd88b0d..22d265c 100644 --- a/src/utils/FileReader.cpp +++ b/src/utils/FileReader.cpp @@ -1,9 +1,8 @@ #include "FileReader.h" #include "logger.h" -#include -#include +#include -int FileReader::read(uint8_t *buffer, int size) { +int FileReader::read(uint8_t *buffer, uint32_t size) { if (isReadFromBuffer) { if (input_buffer == nullptr) { return -1; diff --git a/src/utils/FileReader.h b/src/utils/FileReader.h index 7242113..3989d42 100644 --- a/src/utils/FileReader.h +++ b/src/utils/FileReader.h @@ -14,7 +14,7 @@ public: virtual ~FileReader(); - virtual int read(uint8_t *buffer, int size) ; + virtual int read(uint8_t *buffer, uint32_t size) ; private: bool isReadFromBuffer = false; diff --git a/src/utils/FileReaderCompressed.cpp b/src/utils/FileReaderCompressed.cpp index a28febd..4316e03 100644 --- a/src/utils/FileReaderCompressed.cpp +++ b/src/utils/FileReaderCompressed.cpp @@ -1,6 +1,6 @@ #include "FileReaderCompressed.h" -int FileReaderCompressed::read(uint8_t *buffer, int size) { +int FileReaderCompressed::read(uint8_t *buffer, uint32_t size) { int startValue = this->strm.total_out; uint32_t newSize = 0; int ret = 0; @@ -10,10 +10,11 @@ int FileReaderCompressed::read(uint8_t *buffer, int size) { nextOut = size; } if (this->strm.avail_in == 0) { - this->strm.avail_in = FileReader::read(this->zlib_in_buf, BUFFER_SIZE); - if (this->strm.avail_in == 0 || this->strm.avail_in == -1) { + int read_res = FileReader::read(this->zlib_in_buf, BUFFER_SIZE); + if (read_res <= 0) { break; } + this->strm.avail_in = read_res; this->strm.next_in = this->zlib_in_buf; } /* run inflate() on input until output buffer not full */ @@ -34,12 +35,15 @@ int FileReaderCompressed::read(uint8_t *buffer, int size) { switch (ret) { case Z_NEED_DICT: DEBUG_FUNCTION_LINE("Z_NEED_DICT"); - ret = Z_DATA_ERROR; /* and fall through */ + ret = Z_DATA_ERROR; + [[fallthrough]]; /* and fall through */ case Z_DATA_ERROR: case Z_MEM_ERROR: DEBUG_FUNCTION_LINE("Z_MEM_ERROR or Z_DATA_ERROR"); (void) inflateEnd(&this->strm); return ret; + default: + break; } newSize = this->strm.total_out - startValue; diff --git a/src/utils/FileReaderCompressed.h b/src/utils/FileReaderCompressed.h index 8c8470a..63b4e35 100644 --- a/src/utils/FileReaderCompressed.h +++ b/src/utils/FileReaderCompressed.h @@ -10,14 +10,13 @@ class FileReaderCompressed : public FileReader { public: FileReaderCompressed(uint8_t *buffer, uint32_t size); - explicit FileReaderCompressed(std::string &file); ~FileReaderCompressed() override{ DEBUG_FUNCTION_LINE(""); } - int read(uint8_t *buffer, int size) override; + int read(uint8_t *buffer, uint32_t size) override; private: bool initDone = false;