Skip to content

Commit 8a6a413

Browse files
authored
Update headerapi.md
1 parent ebc1f3d commit 8a6a413

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

headerapi.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ title: Header API
1212
* `api` - A global (and pre-defined) instance of `HeaderAPI`.
1313
* `fileBuffer` - decrypted save data used by the UI - stored as a `Uint8Array`.
1414
* `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+
1529

1630
## Formats
1731
* `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

Comments
 (0)