Steam Emu //top\\ - Ali213
SaveManager::SaveManager(const std::string& gameName) : m_gameName(gameName) InitCRC32(); // Default path: local saves (no Steam userdata) m_saveDir = "./saves/" + gameName + "/"; fs::create_directories(m_saveDir);
std::vector<SaveSlot> SaveManager::ListSlots() std::vector<SaveSlot> slots; for (int id = 0; id <= 99; id++) // max 100 slots std::string metaPath = GetSlotPath(id, ".meta"); if (!fs::exists(metaPath)) continue; ali213 steam emu
bool SaveManager::SaveGame(int slotId, const uint8_t* data, size_t size) std::string mainPath = GetSlotPath(slotId); std::string metaPath = GetSlotPath(slotId, ".meta"); for (int id = 0
std::ifstream metaFile(metaPath); if (!metaFile) continue; SaveSlot slot; slot.id = id; metaFile >> slot.checksum >> slot.timestamp; size_t size; metaFile >> size; slot.isValid = VerifyIntegrity(id); slot.name = "AutoSlot_" + std::to_string(id); slot.filePath = GetSlotPath(id); // Format timestamp to readable std::time_t t = slot.timestamp; std::tm tm; localtime_s(&tm, &t); std::stringstream ss; ss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S"); slot.name = ss.str(); // Override name with datetime slots.push_back(slot); if (!fs::exists(metaPath)) continue
// Write metadata std::ofstream metaFile(metaPath); if (!metaFile) return false; metaFile << checksum << "\n" << timestamp << "\n" << size; metaFile.close();
crc32_initialized = true;