/** * @file pfile.h * * Interface of the save game encoding functionality. */ #pragma once #include "DiabloUI/diabloui.h" #include "player.h" namespace devilution { #define MAX_CHARACTERS 99 extern bool gbValidSaveFile; /** * @brief Comparsion result of pfile_compare_hero_demo */ enum class HeroCompareResult { ReferenceNotFound, Same, Difference, }; std::optional OpenSaveArchive(uint32_t saveNum); std::optional OpenStashArchive(); const char *pfile_get_password(); std::unique_ptr ReadArchive(MpqArchive &archive, const char *pszName, size_t *pdwLen = nullptr); void pfile_write_hero(bool writeGameData = false); /** * @brief Save a reference game-state (save game) for the demo recording * @param demo that is recorded */ void pfile_write_hero_demo(int demo); /** * @brief Compares the actual game-state (savegame) with a reference game-state (save game from demo recording) * @param demo for the comparsion * @return The comparsion result. */ HeroCompareResult pfile_compare_hero_demo(int demo); void sfile_write_stash(); bool pfile_ui_set_hero_infos(bool (*uiAddHeroInfo)(_uiheroinfo *)); void pfile_ui_set_class_stats(unsigned int playerClass, _uidefaultstats *classStats); uint32_t pfile_ui_get_first_unused_save_num(); bool pfile_ui_save_create(_uiheroinfo *heroinfo); bool pfile_delete_save(_uiheroinfo *heroInfo); void pfile_read_player_from_save(uint32_t saveNum, Player &player); void pfile_save_level(); void pfile_convert_levels(); void pfile_remove_temp_files(); std::unique_ptr pfile_read(const char *pszName, size_t *pdwLen); void pfile_update(bool forceSave); } // namespace devilution