You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: headerapi.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,20 @@ title: Header API
12
12
*`api` - A global (and pre-defined) instance of `HeaderAPI`.
13
13
*`fileBuffer` - decrypted save data used by the UI - stored as a `Uint8Array`.
14
14
*`playerOffsets` - a global array containing the start pos' of each player block (`[0x5390, 0x5418, 0x54A0]`).
15
+
*`encoder.encode()` - a global alias for `Text.Encode(str)`.
16
+
*`decoder.decode()` - a global alias for `Text.Decode(str)`.
17
+
*`async isDecrypted(fileBuffer)` - Checks if a `head.yw`/`head.ywd` is decrypted - returns true if decrypted, if encrypted or heavily corrupted returns false.
18
+
*`async fullDecrypt()` - Decrypts a `head.yw` from `fileBuffer` (mutates it) (`head.yw` -> `head.ywd`). This also works on Yo-kai Watch 1 save files - although unintentional.
19
+
*`async fullEncrypt()` - Encrypts a `head.ywd` from `fileBuffer` (mutates it) (`head.ywd` -> `head.yw`). This also works on Yo-kai Watch 1 save files - although unintentional.
20
+
*`readUInt32(offset)` - Takes an offset of type `Number` and returns a `Number` corresponding that point in `fileBuffer` read as a uint32 (unsigned 32-bit integer).
21
+
*`readUInt16(offset)` - Takes an offset of type `Number` and returns a `Number` corresponding that point in `fileBuffer` read as a uint16 (unsigned 16-bit integer).
22
+
*`writeUInt32(offset, value)` - Takes an offset of type `Number` and a value, it writes that value as a `uint32` (unsigned 32-bit integer) and the offset in `fileBuffer`.
23
+
*`writeUInt16(offset, value)` - Takes an offset of type `Number` and a value, it writes that value as a `uint16` (unsigned 16-bit integer) and the offset in `fileBuffer`.
24
+
*`async download()` - Downloads `fileBuffer` as `head.ywd`.
25
+
*`async downloadEncrypted()` - Encrypts `fileBuffer`, downloads it as a `head.yw` and then decrypts it using `fullDecrypt` and `fullEncrypt` respectively.
26
+
*`formatPlayTime(seconds)` - Takes seconds in the form of `Number` and returns a string in format `HH:MM:SS` (seconds, minutes and hours are 0 padded when needed to look good).
27
+
*`getUTF8ByteLength(str)` - Returns the amount of bytes a string takes up. Note: DESPITE THE NAME STATING UTF8 IT USES CP932 WHEN `utf8 == false`!
28
+
15
29
16
30
## Formats
17
31
*`playerIndex` - A number from 0-2 where 0 is the 1st save file/player, 1 is the 2nd and 2 is the 3rd.
0 commit comments