mirror of
https://github.com/chiteroman/PlayIntegrityFix.git
synced 2025-01-18 19:12:38 +02:00
Refine readFile logic
This commit is contained in:
parent
372be7e799
commit
c4959bf520
@ -267,27 +267,21 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<uint8_t> readFile(const char *path) {
|
static std::vector<uint8_t> readFile(const char *path) {
|
||||||
|
|
||||||
std::vector<uint8_t> vector;
|
|
||||||
|
|
||||||
FILE *file = fopen(path, "rb");
|
FILE *file = fopen(path, "rb");
|
||||||
|
|
||||||
if (file) {
|
if (!file) return {};
|
||||||
fseek(file, 0, SEEK_END);
|
|
||||||
long size = ftell(file);
|
|
||||||
fseek(file, 0, SEEK_SET);
|
|
||||||
|
|
||||||
vector.resize(size);
|
auto size = std::filesystem::file_size(path);
|
||||||
fread(vector.data(), 1, size, file);
|
|
||||||
fclose(file);
|
std::vector<uint8_t> vector(size);
|
||||||
} else {
|
|
||||||
LOGD("Couldn't read %s file!", path);
|
fread(vector.data(), 1, size, file);
|
||||||
}
|
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void companion(int fd) {
|
static void companion(int fd) {
|
||||||
|
|
||||||
std::vector<uint8_t> dex, json;
|
std::vector<uint8_t> dex, json;
|
||||||
|
Loading…
Reference in New Issue
Block a user