mirror of
https://github.com/NohamR/RMHook.git
synced 2026-05-26 12:56:24 +00:00
Add QML resource replacement support for specific files
Implements a mechanism to replace specific QML resource files at runtime by reading replacement files from a designated directory. Updates the resource registration hook to rebuild resource data tables when replacements are present, and adds utility functions and structures for managing replacement entries. Only selected files are eligible for replacement, and the README is updated with instructions for using this feature.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -19,6 +20,16 @@ struct ResourceRoot {
|
||||
int entriesAffected;
|
||||
};
|
||||
|
||||
// Replacement entry for storing new data to be appended
|
||||
struct ReplacementEntry {
|
||||
int node;
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
size_t copyToOffset;
|
||||
bool freeAfterwards;
|
||||
struct ReplacementEntry *next;
|
||||
};
|
||||
|
||||
#define TREE_ENTRY_SIZE 22
|
||||
#define DIRECTORY 0x02
|
||||
|
||||
@@ -35,8 +46,14 @@ void statArchive(struct ResourceRoot *root, int node);
|
||||
void processNode(struct ResourceRoot *root, int node, const char *rootName);
|
||||
void ReMarkableDumpResourceFile(struct ResourceRoot *root, int node, const char *rootName, const char *fileName, uint16_t flags);
|
||||
|
||||
// Replacement utilities
|
||||
void addReplacementEntry(struct ReplacementEntry *entry);
|
||||
struct ReplacementEntry *getReplacementEntries(void);
|
||||
void clearReplacementEntries(void);
|
||||
void replaceNode(struct ResourceRoot *root, int node, const char *fullPath, int treeOffset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ResourceUtils_h */
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user