mirror of
https://github.com/mikage-emu/mikage-dev.git
synced 2025-01-09 06:50:59 +01:00
23 lines
448 B
C++
23 lines
448 B
C++
#include "firm.hpp"
|
|
|
|
namespace Loader {
|
|
|
|
bool IsFirm(std::istream& str) {
|
|
auto file_begin = str.tellg();
|
|
|
|
unsigned char magic[4];
|
|
str.read(reinterpret_cast<char*>(magic), sizeof(magic));
|
|
str.seekg(file_begin);
|
|
|
|
if (str.gcount() != sizeof(magic) ||
|
|
magic[0] != 'F' ||
|
|
magic[1] != 'I' ||
|
|
magic[2] != 'R' ||
|
|
magic[3] != 'M') {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace Loader
|