fgenesis / liblvpa Goto Github PK
View Code? Open in Web Editor NEWLost Vikings Project Archive - a container file format & library optimized for games. (C++)
License: GNU General Public License v2.0
Lost Vikings Project Archive - a container file format & library optimized for games. (C++)
License: GNU General Public License v2.0
I'm trying to build the bindings with Visual Studio 2015 using these flags:
-DTTVFS_INCLUDE_DIRS="D:\source\ttvfs\ttvfs" -DTTVFS_SRC_DIR="D:\source\ttvfs\ttvfs" -DLVPA_ENABLE_LZHAM=ON -DLVPA_BUILD_TTVFS_BINDINGS=ON
I get a bunch of CMake policy errors (see below) when using these flags, and the binding project can't compile. Am not too familiar with cmake, so not sure how to fix this.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSBase.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSDebug.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSDir.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSDirInternal.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSDirView.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSFile.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSFileFuncs.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSLoader.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSRoot.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSSystemPaths.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:22 (add_executable):
Syntax error in cmake code when parsing string
D:\source\ttvfs\ttvfs/VFSTools.cpp
Invalid escape sequence \s
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
@fgenesis
`bool LVPAFile::_CryptBlock(uint8 *buf, LVPAFileHeader &hdr, bool writeMode)
{
if (!(hdr.flags & (LVPAFLAG_ENCRYPTED | LVPAFLAG_SCRAMBLED)))
return true; //Not encrypted, not scrambled, nothing to do, everythings fine
uint8 mem[LVPAHash_Size];
LVPACipher ciph;
if (hdr.flags & LVPAFLAG_SCRAMBLED) {
if (hdr.filename.empty()) {
DEBUG(logerror("File is scrmabled, but given filename is empty, can't decrypt"));
return false;
}
_CalcSaltedFilenameHash(&mem[0], hdr.filename.c_str());
if (writeMode)
memcpy(&hdr.hash[0], &mem[0], LVPAHash_Size);
else if (memcmp(&mem[0], hdr.hash, LVPAHash_Size)) {
DEBUG(logerror("_CryptBlock: wrong filename"));
return false;
}
//LVPAHash::Calc(&mem[0], (uint8*)hdr.filename.c_str(), hdr.filename.length()); //This doesn't include the terminating '\0'
LVPAHash::Calc(&mem[0], (uint8*)hdr.hash, LVPAHash_Size);
if (hdr.flags & LVPAFLAG_ENCRYPTED) {
LVPAHash sha(&mem[0]);
if (_masterKey.size())
sha.Update(&_masterKey[0], _masterKey.size());
sha.Update(&mem[0], LVPAHash_Size);
sha.Finalize();
}
ciph.Init(&mem[0], LVPAHash_Size);
}
else if (hdr.flags & LVPAFLAG_ENCRYPTED) {
if (_masterKey.size())
ciph.Init(&_masterKey[0], _masterKey.size());
else {
DEBUG(logerror("_CryptBlock: encrypted, not scrambled, and no master key!"));
}
}
if (!hdr.cipherWarmup) {
uint32 r = _mtrand->RandInt(128) + 30;
hdr.cipherWarmup = uint16(r * sizeof(uint32)); //For spped, we always use full uint32 blocks
}
ciph.WarmUp(hdr.cipherWarmup);
ciph.Apply(buf, hdr.packedSize); //We use packedSize here because the file is encrypted after the compression
//CRC will get checked elsewhere
return true;
}`
I've kind of run into a wall while digging around in your code. I understand what this function does for the most part. However, in trying to create a separate decrypt function I ran into trouble trying to figure what exactly is going on when the call to LVPAHash::Calc() function is made. You create a hash of the filename and then compare that to the hash of the file that's to be decrypted (this part makes sense to me), but then you do something with that filename again in the Calc() function. What does this do? Also, the result from this is used in the next block of code dealing with the master key. What is mem[0] being used for here?
Any info you have would be appreciated!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.