|
|
|
@ -12,7 +12,6 @@ typedef char sbyte; |
|
|
|
|
|
|
|
|
|
class SHNFile{ |
|
|
|
|
SHNFile(const SHNFile&)=delete; |
|
|
|
|
SHNFile(const SHNFile&&)=delete; |
|
|
|
|
std::vector<std::byte>ReadBytes(std::ifstream&file); |
|
|
|
|
std::vector<std::byte>ReadBytes(std::ifstream&file,int bytes); |
|
|
|
|
void WriteBytes(std::ofstream&file,char*data,int length); |
|
|
|
@ -99,8 +98,11 @@ public: |
|
|
|
|
void Write(int row,int col,uint32_t val); |
|
|
|
|
void Write(int row,int col,float val); |
|
|
|
|
void Write(int row,int col,std::string val); |
|
|
|
|
const SHNFile::Data Get(int row,int col)const; |
|
|
|
|
//const SHNFile::Data Get(int row,int col)const;
|
|
|
|
|
template<typename T> |
|
|
|
|
const T Get(int row,int col)const; |
|
|
|
|
SHNFile(); |
|
|
|
|
SHNFile(SHNFile&&)noexcept; |
|
|
|
|
~SHNFile(); |
|
|
|
|
}; |
|
|
|
|
#ifdef OLC_PGEX_SHNFile |
|
|
|
@ -523,8 +525,9 @@ void SHNFile::Save(){ |
|
|
|
|
WriteBytes(encryptedFile,data,readAmt-0x24); |
|
|
|
|
std::cout<<"File "<<filename<<" Saved!"<<std::endl; |
|
|
|
|
} |
|
|
|
|
const SHNFile::Data SHNFile::Get(int row,int col)const{ |
|
|
|
|
return contents[row][col];
|
|
|
|
|
template<typename T> |
|
|
|
|
const T SHNFile::Get(int row,int col)const{ |
|
|
|
|
return *(std::static_pointer_cast<T>(contents[row][col].data)); |
|
|
|
|
}; |
|
|
|
|
void SHNFile::Write(int row,int col,std::byte val){ |
|
|
|
|
contents[row][col].Set<std::byte>(val); |
|
|
|
@ -556,6 +559,13 @@ SHNFile::SHNFile(){ |
|
|
|
|
SHNFile::~SHNFile(){ |
|
|
|
|
Cleanup(); |
|
|
|
|
} |
|
|
|
|
SHNFile::SHNFile(SHNFile&&temp)noexcept{ |
|
|
|
|
temp.cryptHeader=cryptHeader; |
|
|
|
|
temp.data=data; |
|
|
|
|
temp.rawData=rawData; |
|
|
|
|
|
|
|
|
|
cryptHeader=data=rawData=nullptr; |
|
|
|
|
} |
|
|
|
|
void SHNFile::Cleanup(){ |
|
|
|
|
if(cryptHeader!=nullptr){ |
|
|
|
|
delete[] cryptHeader; |
|
|
|
|