Skip to content

Instantly share code, notes, and snippets.

@LordNed
Created October 23, 2018 03:54
Show Gist options
  • Save LordNed/bf15b5b40f0154c89b58027547f1de9a to your computer and use it in GitHub Desktop.
Save LordNed/bf15b5b40f0154c89b58027547f1de9a to your computer and use it in GitHub Desktop.
This is a super quick exploration into the Just Cause 3 "Task" save file. This is the state of things discovered on your map (such as Settlements, Wingsuit Challenges, etc.).
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tasks
{
class Program
{
// 48 byte header
class Header
{
public uint UnknownA; // 4
public uint ZeroA;
public uint OneA;
public uint ZeroB;
public uint ZeroC;
public uint UnknownB; // 24
public uint OneB;
public uint ZeroD;
public uint ZeroE;
public uint UnknownC;
public uint DynamicFileSize; // Doesn't include 48 byte header
public uint Padding;
}
class HeaderTwo
{
public uint UnknownA;
public uint UnknownB;
public uint UnknownC;
public uint UnknownD;
public uint UnknownE;
public uint UnknownF; // 24
public uint UnknownG;
public uint UnknownH;
public uint EntryCount; // 36
public uint Padding;
}
class ScoreEntry
{
public uint Type;
public uint Type2;
public ulong Score;
public ulong Score2;
}
static void Main(string[] args)
{
using (var fileStream = new BinaryReader(File.Open(@"C:\Users\Matt\Documents\Square Enix\Just Cause 3\Saves\76561197990416387\tasks", FileMode.Open, FileAccess.Read)))
{
Header header = new Header();
header.UnknownA = fileStream.ReadUInt32();
header.ZeroA = fileStream.ReadUInt32();
header.OneA = fileStream.ReadUInt32();
header.ZeroB = fileStream.ReadUInt32();
header.ZeroC = fileStream.ReadUInt32();
header.UnknownB = fileStream.ReadUInt32();
header.OneB = fileStream.ReadUInt32();
header.ZeroD = fileStream.ReadUInt32();
header.ZeroE = fileStream.ReadUInt32();
header.UnknownC = fileStream.ReadUInt32();
header.DynamicFileSize = fileStream.ReadUInt32();
header.Padding = fileStream.ReadUInt32();
HeaderTwo header2 = new HeaderTwo();
header2.UnknownA = fileStream.ReadUInt32();
header2.UnknownB = fileStream.ReadUInt32();
header2.UnknownC = fileStream.ReadUInt32();
header2.UnknownD = fileStream.ReadUInt32();
header2.UnknownE = fileStream.ReadUInt32();
header2.UnknownF = fileStream.ReadUInt32();
header2.UnknownG = fileStream.ReadUInt32();
header2.UnknownH = fileStream.ReadUInt32();
header2.EntryCount = fileStream.ReadUInt32();
header2.Padding = fileStream.ReadUInt32();
Console.WriteLine($"Size: {header.DynamicFileSize + 48}, Task Count: {header2.EntryCount}");
List<ScoreEntry> tasks = new List<ScoreEntry>();
for(int i = 0; i < header2.EntryCount; i++)
{
ScoreEntry entry = new ScoreEntry();
entry.Type = fileStream.ReadUInt32();
entry.Type2 = fileStream.ReadUInt32();
entry.Score = fileStream.ReadUInt64();
entry.Score2 = fileStream.ReadUInt64();
long bytesLeft = (header.DynamicFileSize + 48) - fileStream.BaseStream.Position;
Console.WriteLine($"[{i}] Type: {entry.Type} Type2: {entry.Type2} Score: {entry.Score} Score2: {entry.Score2} TypeMatch: {entry.Type == entry.Type2} ScoreMatch: {entry.Score == entry.Score2} bytesLeft: {bytesLeft}");
tasks.Add(entry);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment