diff --git a/src/idz/decoder/saveProfile.ts b/src/idz/decoder/saveProfile.ts index 0d29d7d..72d2190 100644 --- a/src/idz/decoder/saveProfile.ts +++ b/src/idz/decoder/saveProfile.ts @@ -61,6 +61,7 @@ export function saveProfile(buf: Buffer): SaveProfileRequest { cup: buf.readUInt8(0x0110), gauges: buf.readUInt16LE(0x0114), music: buf.readUInt16LE(0x0140), + lastMileageReward: buf.readUInt32LE(0x013c), }, settings: { music: buf.readUInt16LE(0x045a), diff --git a/src/idz/encoder/loadProfile2.ts b/src/idz/encoder/loadProfile2.ts index 7c2a935..5698acc 100644 --- a/src/idz/encoder/loadProfile2.ts +++ b/src/idz/encoder/loadProfile2.ts @@ -57,6 +57,7 @@ export function loadProfile2(res: LoadProfileResponse2) { buf.writeUInt16LE(0x0065, 0x0000); buf.writeUInt8(res.unlocks.cup, 0x00b4); buf.writeUInt16LE(res.unlocks.gauges, 0x00b8); + buf.writeUInt32LE(res.unlocks.lastMileageReward, 0x01e8); buf.writeUInt16LE(res.unlocks.music, 0x01ec); mission(res.missions.team).copy(buf, 0x038a); buf.writeUInt16LE(0xffff, 0x0388); // [1] diff --git a/src/idz/handler/createProfile.ts b/src/idz/handler/createProfile.ts index 4368b0e..e130330 100644 --- a/src/idz/handler/createProfile.ts +++ b/src/idz/handler/createProfile.ts @@ -30,7 +30,12 @@ export async function createProfile( const missions: MissionState = { team: [], solo: [] }; const settings: Settings = { music: 0, pack: 13640, paperCup: 0, gauges: 5 }; const story: Story = { x: 0, y: 0, rows: [] }; - const unlocks: Unlocks = { cup: 0, gauges: 0, music: 0 }; + const unlocks: Unlocks = { + cup: 0, + gauges: 1 << 5, + music: 0, + lastMileageReward: 0, + }; await Promise.all([ w.profile().save(profile.id, profile), diff --git a/src/idz/model/unlocks.ts b/src/idz/model/unlocks.ts index 7ee2f50..3e0282b 100644 --- a/src/idz/model/unlocks.ts +++ b/src/idz/model/unlocks.ts @@ -2,4 +2,12 @@ export interface Unlocks { cup: number; gauges: number; music: number; + + // Doesn't really fit anywhere but let's put it here for now. This field is + // an odd one, still not entirely sure what its purpose and semantics are, + // but if we don't save it then the unlock notification for the music track + // THE TOP (unlocked at 300km mileage) pops up at the start of every credit + // even if its music unlock bit is set and round-tripped. + + lastMileageReward: number; }