| 2536 | return (await fileIn.read(length * 2)).toString("utf8"); |
| 2537 | }; |
| 2538 | const readUTFStringFromBuffer = (buffer: Buffer, pos: number): [string, number] => { |
| 2539 | const length = buffer.readInt16LE(pos); |
| 2540 | pos += 2; |
| 2541 | // console.log('length is ' + length); |
| 2542 | // since utf8 is 2 bytes per char |
| 2543 | return [buffer.subarray(pos, pos + length * 2).toString("utf8"), pos + length * 2]; |
| 2544 | }; |
| 2545 | const matchPackNamesInsideSaveFile = /\0[^\0]+?\.pack/g; |
| 2546 | export const getPacksInSave = async (saveName: string): Promise<string[]> => { |
| 2547 | console.log("Getting packs from save: ", saveName); |