diff --git a/SHNFileDecryptor/ItemInfo.shn b/SHNFileDecryptor/ItemInfo.shn new file mode 100644 index 0000000..149ab22 Binary files /dev/null and b/SHNFileDecryptor/ItemInfo.shn differ diff --git a/SHNFileDecryptor/SHNFileDecryptor.h b/SHNFileDecryptor/SHNFileDecryptor.h index af6a18d..3766113 100644 --- a/SHNFileDecryptor/SHNFileDecryptor.h +++ b/SHNFileDecryptor/SHNFileDecryptor.h @@ -5,6 +5,7 @@ #include #include #include +#include //typedef std::std::byte std::byte; typedef char sbyte; @@ -16,7 +17,7 @@ class SHNFile{ int ReadInt32(std::ifstream&file); void Encrypt(); void Decrypt(); - std::vectorReadBytes(int bytes); + std::vector&ReadBytes(int bytes); std::byte ReadByte(); void WriteByte(std::ofstream&f,std::byte b); void WriteSByte(std::ofstream&f,sbyte b); @@ -146,13 +147,13 @@ std::vector&SHNFile::ReadBytes(int bytes){ readArr.clear(); for(int i=0;i&b=ReadBytes(1); @@ -341,8 +342,6 @@ std::string SHNFile::Data::GetDisplayText(){ } } void SHNFile::Load(std::string file){ - cryptHeader.clear(); - data.clear(); header=recordCount=defaultRecordLength=columnCount=0; columns.clear(); contents.clear(); @@ -356,7 +355,6 @@ void SHNFile::Load(std::string file){ //Since we don't just read in the entire file raw, we have to do some additional work here as the header provides us with some basic info on how to decrypt this file. //The backup itself needs all the data from the original file, so we're appending it to rawData as we continue reading it. cryptHeader=ReadBytes(f,0x20); - std::copy(cryptHeader.begin(),cryptHeader.end(),std::back_inserter(rawData)); int readAmt=ReadInt32(f); rawData.push_back(std::byte(readAmt&0xFF)); rawData.push_back(std::byte((readAmt>>8)&0xFF)); @@ -537,5 +535,7 @@ void SHNFile::Write(int row,int col,float val){ void SHNFile::Write(int row,int col,std::string val){ contents[row][col].Set(val); } -SHNFile::SHNFile(){} +SHNFile::SHNFile(){ + readArr.reserve(64000); +} #endif \ No newline at end of file diff --git a/SHNFileDecryptor/SHNFileDecryptor.vcxproj b/SHNFileDecryptor/SHNFileDecryptor.vcxproj index fc9d546..739ce57 100644 --- a/SHNFileDecryptor/SHNFileDecryptor.vcxproj +++ b/SHNFileDecryptor/SHNFileDecryptor.vcxproj @@ -76,7 +76,7 @@ true WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 Console @@ -106,7 +106,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - stdcpp17 + stdcpp20 Console diff --git a/SHNFileDecryptor/SHNFile_example.cpp b/SHNFileDecryptor/SHNFile_example.cpp index 83cbb77..1fa2bf1 100644 --- a/SHNFileDecryptor/SHNFile_example.cpp +++ b/SHNFileDecryptor/SHNFile_example.cpp @@ -7,9 +7,5 @@ int main(){ SHNFile shn; - shn.Load("AbState.shn"); - SHNFile::Data dat=shn.Get(3,6); - std::cout<