docs, name changes
This commit is contained in:
parent
1115e5c259
commit
ca7698ad1f
2 changed files with 14 additions and 7 deletions
|
|
@ -451,6 +451,8 @@ const HK_STATISTICS = {
|
||||||
killsBindingSeal: ["Path of Pain", "White Palace: main secret area"],
|
killsBindingSeal: ["Path of Pain", "White Palace: main secret area"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------- Functions ----------------- //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks Hollow Knight game completion by analyzing the save file
|
* Checks Hollow Knight game completion by analyzing the save file
|
||||||
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
|
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
/*
|
/*
|
||||||
Parts of the code thanks to bloodorca https://github.com/bloodorca/hollow (base64.js, functions.js) with slight modifications.
|
Parts of the code thanks to bloodorca https://github.com/bloodorca/hollow (base64.js, functions.js) with slight modifications.
|
||||||
The steps used there for decryption were taken from KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager
|
The steps used there for decryption were taken from KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager
|
||||||
|
Without these two people the existence of this tool wouldn't be possible :)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// ---------------- Constants ----------------- //
|
||||||
|
|
||||||
const CSHARP_HEADER = [0, 1, 0, 0, 0, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 0]; // 22 bytes
|
const CSHARP_HEADER = [0, 1, 0, 0, 0, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 6, 1, 0, 0, 0]; // 22 bytes
|
||||||
|
|
||||||
const BASE64_ARRAY = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").map(c => c.charCodeAt(0));
|
const BASE64_ARRAY = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").map(c => c.charCodeAt(0));
|
||||||
|
|
@ -11,8 +14,12 @@ const BASE64_DECODE_TABLE = new Map(BASE64_ARRAY.map((ord, i) => [ord, i]));
|
||||||
const AES_KEY = new TextEncoder().encode('UKu52ePUBwetZ9wNX88o54dnfKRu0T1l'); // encodes a string to Uint8Array (prepare for AES JS)
|
const AES_KEY = new TextEncoder().encode('UKu52ePUBwetZ9wNX88o54dnfKRu0T1l'); // encodes a string to Uint8Array (prepare for AES JS)
|
||||||
const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a new AES stream cipher object using the encoded key
|
const ECB_STREAM_CIPHER = new aesjs.ModeOfOperation.ecb(AES_KEY); // create a new AES stream cipher object using the encoded key
|
||||||
|
|
||||||
|
// ---------------- Variables ----------------- //
|
||||||
|
|
||||||
let bench = { begin: 0, end: 0 };
|
let bench = { begin: 0, end: 0 };
|
||||||
|
|
||||||
|
// ---------------- Functions ----------------- //
|
||||||
|
|
||||||
// main input tag file function
|
// main input tag file function
|
||||||
function LoadSaveFile(input) {
|
function LoadSaveFile(input) {
|
||||||
// start benchmark
|
// start benchmark
|
||||||
|
|
@ -48,8 +55,8 @@ function ProcessFileObject() {
|
||||||
// The slice() method copies up to, but not including, the byte indicated by the end parameter.
|
// The slice() method copies up to, but not including, the byte indicated by the end parameter.
|
||||||
inputArrayBuffer.slice();
|
inputArrayBuffer.slice();
|
||||||
|
|
||||||
// remove C# header (ArrayBuffer)
|
// remove C# header and LengthPrefixedString header (ArrayBuffer)
|
||||||
inputArrayBuffer = RemoveCSharpHeader(inputArrayBuffer);
|
inputArrayBuffer = RemoveHeaders(inputArrayBuffer);
|
||||||
|
|
||||||
// base64 Decoding (ArrayBuffer)
|
// base64 Decoding (ArrayBuffer)
|
||||||
inputArrayBuffer = Base64Decode(inputArrayBuffer);
|
inputArrayBuffer = Base64Decode(inputArrayBuffer);
|
||||||
|
|
@ -80,9 +87,9 @@ function ProcessFileObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// removes C# header, LengthPrefixedString header and byte 11 at the end of the Uint8 Array Buffer
|
// removes C# header, LengthPrefixedString header and byte 11 at the end of the Uint8 Array Buffer
|
||||||
function RemoveCSharpHeader(buffer) {
|
function RemoveHeaders(buffer, csHeader = CSHARP_HEADER) {
|
||||||
// Remove the fixed C# header and byte 11 at the end.
|
// Remove the fixed C# header and byte 11 at the end.
|
||||||
buffer = buffer.subarray(CSHARP_HEADER.length, buffer.length - 1);
|
buffer = buffer.subarray(csHeader.length, buffer.length - 1);
|
||||||
|
|
||||||
// Remove LengthPrefixedString header
|
// Remove LengthPrefixedString header
|
||||||
let lengthCount = 0;
|
let lengthCount = 0;
|
||||||
|
|
@ -93,9 +100,7 @@ function RemoveCSharpHeader(buffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let fixedArrayBuffer = buffer.subarray(lengthCount);
|
return buffer.subarray(lengthCount);
|
||||||
|
|
||||||
return fixedArrayBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thanks to KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager and bloodorca https://github.com/bloodorca/hollow (base64.js)
|
// Thanks to KayDeeTee https://github.com/KayDeeTee/Hollow-Knight-SaveManager and bloodorca https://github.com/bloodorca/hollow (base64.js)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue