int WriteCheats() { int a = 0; FILE *fp; fp = fopen("mc0:/cheat.bin", "r"); if (fp < 0) { printf("Could not open cheat.txt"); scr_printf("Could not open mc0:/cheat.bin"); return 0; fclose(fp); } if (fp > 0) { a = BinRead("mc0:/cheat.bin"); if ( a < 0 ) { scr_printf(" Did not successfully write cheats!\n"); } scr_printf("\n Cheats activated\n"); } fclose(fp); return 0; }
bool TTFCache::LoadCache(std::filesystem::path cachepath) { std::ifstream in(cachepath.string(), std::ios::binary); if (!in.is_open()) return false; mCharBuffer.clear(); int size; BinRead(in, size); while (!in.eof() && size > 0) { size_t chsize; int id; BinRead(in, id); BinRead(in, chsize); std::vector<uint8_t> buf(chsize); in.read((char*)buf.data(), chsize); mCharBuffer[id] = std::move(buf); size--; } return true; }