mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Merge branch 'indev' into launcher_rework
This commit is contained in:
commit
b5d9977e5d
@ -82,6 +82,7 @@ void PrintM128i64(__m128i in);
|
||||
void AppendPrintf(char* pBuffer, size_t nBufSize, char const* pFormat, ...);
|
||||
string PrintPercentageEscape(const string& svInput);
|
||||
|
||||
string FormatBytes(size_t nBytes);
|
||||
string FormatV(const char* szFormat, va_list args);
|
||||
string Format(const char* szFormat, ...);
|
||||
|
||||
|
@ -39,28 +39,35 @@ def RecursiveComputeChecksum(directoryPath):
|
||||
#------------------------------------------------------------------------------
|
||||
# Save the checksums to a manifest file
|
||||
#------------------------------------------------------------------------------
|
||||
def CreateManifest(version, checksums, outManifestFile):
|
||||
def CreateManifest(version, depot, checksums, outManifestFile):
|
||||
manifest = {
|
||||
"version": version,
|
||||
"assets": checksums
|
||||
"depots": {
|
||||
depot: {
|
||||
"checksum": 0,
|
||||
"optional": False,
|
||||
"assets": checksums
|
||||
}
|
||||
}
|
||||
}
|
||||
with open(outManifestFile, "w") as jsonFile:
|
||||
json.dump(manifest, jsonFile, indent=4)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: bld_man.py <versionNum>")
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: bld_man.py <versionNum> <depotName>")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
version = int(sys.argv[1])
|
||||
depot = sys.argv[2]
|
||||
except ValueError:
|
||||
print("Version must be an integer")
|
||||
sys.exit(1)
|
||||
|
||||
workingDirectory = os.getcwd()
|
||||
outManifestFile = "patch_manifest.json"
|
||||
outManifestFile = "manifest_patch.json"
|
||||
|
||||
checksums = RecursiveComputeChecksum(workingDirectory)
|
||||
CreateManifest(version, checksums, outManifestFile)
|
||||
CreateManifest(version, depot, checksums, outManifestFile)
|
||||
|
@ -987,6 +987,18 @@ string PrintPercentageEscape(const string& svInput)
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For formatting a STL string to a prettified representation of input bytes.
|
||||
string FormatBytes(size_t nBytes)
|
||||
{
|
||||
char szBuf[128] = "";
|
||||
const char* szPrefix[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB" };
|
||||
const int iBase = 1024;
|
||||
size_t c = (std::min)((size_t)(log((double)nBytes) / log((double)iBase)), (size_t)sizeof(szPrefix) - 1);
|
||||
sprintf(szBuf, "%1.2lf %s", nBytes / pow((double)iBase, c), szPrefix[c]);
|
||||
return string(szBuf);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For formatting a STL string using C-style format specifiers (va_list version).
|
||||
string FormatV(const char* szFormat, va_list args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user