| 30 | } |
| 31 | |
| 32 | static std::vector<uint16_t> readTutorialFile(fs::path filename) |
| 33 | { |
| 34 | std::ifstream file(filename, std::ios::in | std::ios::binary); |
| 35 | file.unsetf(std::ios::skipws); |
| 36 | if (!file) |
| 37 | { |
| 38 | throw; |
| 39 | } |
| 40 | |
| 41 | std::vector<uint16_t> tutorial; |
| 42 | auto start = std::istream_iterator<uint8_t>(file); |
| 43 | auto const end = std::istream_iterator<uint8_t>(); |
| 44 | |
| 45 | for (auto it = start; it != end; ++it) |
| 46 | { |
| 47 | auto const firstByte = *it; |
| 48 | ++it; |
| 49 | |
| 50 | // We expect an even number of bytes |
| 51 | if (it == end) |
| 52 | { |
| 53 | throw; |
| 54 | } |
| 55 | |
| 56 | auto const secondByte = *it; |
| 57 | tutorial.push_back(secondByte << 8 | firstByte); |
| 58 | } |
| 59 | |
| 60 | return tutorial; |
| 61 | } |
| 62 | |
| 63 | // 0x0043C590 |
| 64 | void start(int16_t tutorialNumber) |