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) {
|
||||
|
||||
std::vector<uint8_t> vector;
|
||||
|
||||
FILE *file = fopen(path, "rb");
|
||||
|
||||
if (file) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
long size = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
if (!file) return {};
|
||||
|
||||
vector.resize(size);
|
||||
fread(vector.data(), 1, size, file);
|
||||
fclose(file);
|
||||
} else {
|
||||
LOGD("Couldn't read %s file!", path);
|
||||
}
|
||||
auto size = std::filesystem::file_size(path);
|
||||
|
||||
std::vector<uint8_t> vector(size);
|
||||
|
||||
fread(vector.data(), 1, size, file);
|
||||
|
||||
fclose(file);
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
||||
static void companion(int fd) {
|
||||
|
||||
std::vector<uint8_t> dex, json;
|
||||
|
Loading…
Reference in New Issue
Block a user