Answer the question
In order to leave comments, you need to log in
How to read and edit HEX value?
There is a file (game save) and there is a known location (offset) of the value I need.
And it seems like there is a code for reading and writing the value:
short skill = 0;
using (BinaryReader br = new BinaryReader(File.OpenRead("Player.chr")))
{
br.BaseStream.Position = 0x6F0;
label1.Text = br.ReadInt32().ToString();
}
using (BinaryWriter bw = new BinaryWriter(File.OpenWrite("Player.chr")))
{
bw.Seek(0x6F0, SeekOrigin.Begin);
bw.Write(skill + 10); // добавим 10 очков умений
}
Answer the question
In order to leave comments, you need to log in
The shift
when reading
is
indicated in your code by - Here you can also write in decimal
system
br.BaseStream.Position = 0x6F0;
using (var file = File.Open("Player.chr", FileMode.Open, FileAccess.ReadWrite))
{
int skillPoints;
using (var br = new BinaryReader(file))
{
br.BaseStream.Position = 4863; //0x12FF
skillPoints = br.ReadInt32();
}
using (var bw = new BinaryWriter(file))
{
bw.BaseStream.Position = 4863; //0x12FF
bw.Write(skillPoints + 10);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question