[demo] Update demo build to newest engine. Block off world map navigation beyond Camp II for demo build. Fix bug with file trimming ignoring escape backslash characters in hash causing invalid file hashes. Disable admin mode for demo release build. Release Build 11555.

demo
sigonasr2 3 months ago
parent 6788e3c523
commit bbe5ccab10
  1. 2
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 33
      Adventures in Lestoria/SaveFile.cpp
  3. 2
      Adventures in Lestoria/Version.h
  4. 109
      Adventures in Lestoria/assets/Campaigns/World_Map.tmx
  5. BIN
      x64/Release/Adventures in Lestoria.exe

@ -90,7 +90,7 @@ INCLUDE_FOREDROP_DATA
INCLUDE_MONSTER_DATA INCLUDE_MONSTER_DATA
INCLUDE_PACK_KEY INCLUDE_PACK_KEY
bool ADMIN_MODE = true; //Enables the Unlock All button and admin console. bool ADMIN_MODE = false; //Enables the Unlock All button and admin console.
bool _DEBUG_MAP_LOAD_INFO = false; bool _DEBUG_MAP_LOAD_INFO = false;
//360x240 //360x240
vi2d WINDOW_SIZE={24*15,24*10}; vi2d WINDOW_SIZE={24*15,24*10};

@ -210,10 +210,27 @@ const void SaveFile::SaveGame(){
bool fileNoHashWrittenSuccessfully{false}; bool fileNoHashWrittenSuccessfully{false};
bool fileHashWrittenSuccessfully{false}; bool fileHashWrittenSuccessfully{false};
while(!fileNoHashWrittenSuccessfully||!fileHashWrittenSuccessfully){ while(!fileNoHashWrittenSuccessfully||!fileHashWrittenSuccessfully){
fileNoHashWrittenSuccessfully=false;
fileHashWrittenSuccessfully=false;
saveFile["Hash"].SetString(""); saveFile["Hash"].SetString("");
fileNoHashWrittenSuccessfully=utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp"); fileNoHashWrittenSuccessfully=utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp");
auto trim = [](std::string& s)
{
s.erase(0, s.find_first_not_of(" \\\t\n\r\f\v"));
s.erase(s.find_last_not_of(" \\\t\n\r\f\v") + 1);
for(int marker=0;marker<s.length();marker++){
char&c{s[marker]};
if(c=='\\'){
s.erase(marker,1U);
marker--;
}
}
};
std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp"); std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp");
trim(fileHash); //It's possible the expected file hash has a space at the end/beginning that gets stripped out. We want to trim and match that string.
saveFile["Hash"].SetString(fileHash); saveFile["Hash"].SetString(fileHash);
fileHashWrittenSuccessfully=utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); //Once the hash has been computed and added, save the file a second time. fileHashWrittenSuccessfully=utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); //Once the hash has been computed and added, save the file a second time.
@ -344,6 +361,7 @@ void SaveFile::LoadFile(){
while(!fileNoHashWrittenSuccessfully||!fileHashWrittenSuccessfully){ while(!fileNoHashWrittenSuccessfully||!fileHashWrittenSuccessfully){
fileNoHashWrittenSuccessfully=false; fileNoHashWrittenSuccessfully=false;
fileHashWrittenSuccessfully=false; fileHashWrittenSuccessfully=false;
loadFile["Hash"].SetString(""); loadFile["Hash"].SetString("");
fileNoHashWrittenSuccessfully=utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp"); fileNoHashWrittenSuccessfully=utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp");
@ -351,15 +369,22 @@ void SaveFile::LoadFile(){
{ {
s.erase(0, s.find_first_not_of(" \t\n\r\f\v")); s.erase(0, s.find_first_not_of(" \t\n\r\f\v"));
s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1); s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1);
for(int marker=0;marker<s.length();marker++){
char&c{s[marker]};
if(c=='\\'){
s.erase(marker,1U);
marker--;
}
}
}; };
std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp"); std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp");
trim(fileHash); //It's possible the expected file hash has a space at the end/beginning that gets stripped out. We want to trim and match that string. trim(fileHash); //It's possible the expected file hash has a space at the end/beginning that gets stripped out. We want to trim and match that string.
if(!ADMIN_MODE&&expectedFileHash!=fileHash){ if(!ADMIN_MODE&&expectedFileHash!=fileHash){
LOG(std::format("WARNING! Filehash for file {} was not identified as proper! Will not load this file!","save_file_path"_S+std::format("save.{:04}",saveFileID))); LOG(std::format("WARNING! Filehash for file {} was not identified as proper! Will not load this file!","save_file_path"_S+std::format("save.{:04}",saveFileID)));
return; return;
} }
loadFile["Hash"].SetString(expectedFileHash); //Now write the hash back into the file since we tampered with it. loadFile["Hash"].SetString(expectedFileHash); //Now write the hash back into the file since we tampered with it.
fileHashWrittenSuccessfully=utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); fileHashWrittenSuccessfully=utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID));

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 5 #define VERSION_PATCH 5
#define VERSION_BUILD 11546 #define VERSION_BUILD 11555
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -602,8 +602,6 @@
</object> </object>
<object id="8" name="Camp I" type="StagePlate" x="416" y="416" width="20" height="24"> <object id="8" name="Camp I" type="StagePlate" x="416" y="416" width="20" height="24">
<properties> <properties>
<property name="Connection 1 - North" type="object" value="33"/>
<property name="Connection 2 - East" type="object" value="37"/>
<property name="Map" propertytype="Level" value="HUB"/> <property name="Map" propertytype="Level" value="HUB"/>
<property name="Type" propertytype="StageType" value="HUB"/> <property name="Type" propertytype="StageType" value="HUB"/>
<property name="Unlock Condition" propertytype="Level" value="STORY_1_1"/> <property name="Unlock Condition" propertytype="Level" value="STORY_1_1"/>
@ -686,113 +684,6 @@
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_B1"/> <property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_B1"/>
</properties> </properties>
</object> </object>
<object id="20" name="Stage II-I" type="StagePlate" x="201" y="233" width="42" height="14">
<properties>
<property name="Connection 1 - North" type="object" value="21"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_1"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="STORY_2_1"/>
</properties>
</object>
<object id="21" name="Stage II-II" type="StagePlate" x="217" y="205" width="42" height="14">
<properties>
<property name="Connection 1 - North" type="object" value="22"/>
<property name="Connection 4 - West" type="object" value="22"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_2"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_1"/>
</properties>
</object>
<object id="22" name="Stage II-III" type="StagePlate" x="149" y="181" width="42" height="14">
<properties>
<property name="Connection 1 - North" type="object" value="23"/>
<property name="Connection 4 - West" type="object" value="23"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_3"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_2"/>
</properties>
</object>
<object id="23" name="Stage II-IV" type="StagePlate" x="121" y="137" width="42" height="14">
<properties>
<property name="Connection 1 - North" type="object" value="24"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_4"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_3"/>
</properties>
</object>
<object id="24" name="Stage II-V" type="StagePlate" x="125" y="89" width="42" height="14">
<properties>
<property name="Connection 1 - North" type="object" value="31"/>
<property name="Connection 2 - East" type="object" value="25"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_5"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_4"/>
</properties>
</object>
<object id="25" name="Stage II-VI" type="StagePlate" x="169" y="117" width="42" height="14">
<properties>
<property name="Connection 1 - North" type="object" value="26"/>
<property name="Connection 2 - East" type="object" value="26"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_6"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_5"/>
</properties>
</object>
<object id="26" name="Stage II-VII" type="StagePlate" x="185" y="93" width="42" height="14">
<properties>
<property name="Connection 2 - East" type="object" value="27"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_7"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_6"/>
</properties>
</object>
<object id="27" name="Stage II-VIII" type="StagePlate" x="245" y="89" width="42" height="14">
<properties>
<property name="Connection 3 - South" type="object" value="28"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_8"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_7"/>
</properties>
</object>
<object id="28" name="Boss II" type="StagePlate" x="237" y="137" width="30" height="22">
<properties>
<property name="Connection 4 - West" type="object" value="32"/>
<property name="Map" propertytype="Level" value="BOSS_2"/>
<property name="Type" propertytype="StageType" value="BOSS"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_8"/>
</properties>
</object>
<object id="29" name="Story II-I" type="StagePlate" x="273" y="249" width="18" height="22">
<properties>
<property name="Connection 1 - North" type="object" value="20"/>
<property name="Connection 4 - West" type="object" value="20"/>
<property name="Map" propertytype="Level" value="STORY_2_1"/>
<property name="Type" propertytype="StageType" value="STORY"/>
<property name="Unlock Condition" propertytype="Level" value="STORY_1_3"/>
</properties>
</object>
<object id="30" name="Boss B-II" type="StagePlate" x="289" y="49" width="30" height="22">
<properties>
<property name="Map" propertytype="Level" value="BOSS_2_B"/>
<property name="Type" propertytype="StageType" value="BOSS"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_B1"/>
</properties>
</object>
<object id="31" name="Stage B-II" type="StagePlate" x="193" y="65" width="42" height="14">
<properties>
<property name="Connection 2 - East" type="object" value="30"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_2_B1"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_2_5"/>
</properties>
</object>
<object id="32" name="Story II-II" type="StagePlate" x="229" y="105" width="18" height="22">
<properties>
<property name="Map" propertytype="Level" value="STORY_2_1"/>
<property name="Type" propertytype="StageType" value="STORY"/>
<property name="Unlock Condition" propertytype="Level" value="BOSS_2"/>
</properties>
</object>
<object id="33" name="Camp II" type="StagePlate" x="308" y="248" width="20" height="24"> <object id="33" name="Camp II" type="StagePlate" x="308" y="248" width="20" height="24">
<properties> <properties>
<property name="Connection 3 - South" type="object" value="8"/> <property name="Connection 3 - South" type="object" value="8"/>

Loading…
Cancel
Save