mirror of
https://github.com/esuo1198/TaikoArcadeLoader.git
synced 2026-09-29 10:18:13 +03:00
Language patch | Fix boot lag | Fix axis input
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user