Language patch | Fix boot lag | Fix axis input

This commit is contained in:
ptmaster
2024-12-21 06:03:22 +08:00
parent a6066d31cf
commit 32512d0dbc
14 changed files with 905 additions and 603 deletions
+18
View File
@@ -182,4 +182,22 @@ AreAllBytesZero (const u8 *array, const size_t offset, const size_t length) {
for (size_t i = 0; i < length; ++i)
if (array[offset + i] != 0x00) return false;
return true;
}
void
withFile (const char *fileName, std::function<void (u8 *)> callback) {
FILE *file = fopen (fileName, "rb");
if (file == nullptr) return;
fseek (file, 0, SEEK_END);
long size = ftell (file);
fseek (file, 0, SEEK_SET);
u8 *buffer = (u8 *)malloc(size);
fread (buffer, 1, size, file);
callback (buffer);
free (buffer);
fclose (file);
}