Question Problem With Opening Binary File into List Box

SteveMack

Member
Joined
Aug 17, 2022
Messages
12
Programming Experience
10+
Hi,
I am stuck on this, I haven't really dealt with file reading.
I'm trying to read a file like this opened in note pad:
MGVS 0 S Bodo FNKW richmond_night FCRD NCS22 v1 Ò7NÅÐ h €Ò N Z Œ( ÿ –D 4C ÿ D < ¨I SLRD Ô TNRD ¯ S Bodo 4_kh_gearwrench.cup.car – TNRD ¯ Pace Car ÿÿÿÿ TNRD ¯ Chase Elliott 12-22#9^Elliott.cup.car ú TNRD ¯ Kyle Busch 18_KB_Myms.cup.car ú TNRD ¯ Aric Almirola 12-22#10^Almirola.cup.car
ú TNRD ¯ Martin Truex, Jr. 19_mtj_basspro.cup.car ú TNRD ¯ Cole Custer 41_Custer_PAG.cup.car ) ú ! TNRD ¯ Tyler Reddick 8_tr_chevrolet.cup.car ú " TNRD ¯ Kyle Larson 5_kl_hendrickcars.cup.car ú # TNRD ¯ Joey Logano 22VerizonFrontline.car ú $ TNRD ¯ Brad Keselowski 6_bk_fastenal.cup.car ú %
TNRD ¯ Aj Allmendinger 16_A_Allmendinger.cup.car ú &
TNRD ¯ Ross Chastain 1_rc_trackhouse.cup.car ú ' TNRD ¯ Austin Dillon 3basspro2022.cup.car ú (
TNRD ¯ Ryan Blaney 12_rb_menards.cup.car ú ) TNRD ¯ Erik Jones 43_ej_focusfactor.cup.car + ú * TNRD ¯ Alex Bowman 48_ab_ally.cup.car 0 ú + TNRD ¯ Chris Buescher 17_cb_fastenal.cup.car ú , TNRD ¯ Daniel Suarez 99_ds_tootsies.cup.car c ú - TNRD ¯ Ricky Stenhouse, Jr. 47_rs_sweetleaf.cup.car / ú . TNRD ¯ Harrison Burton 21_hb_motorcraft.cup.car ú / TNRD ¯ Ty Dillon 42_td_pettygms.cup.car * ú 0 TNRD ¯ Corey LaJoie 7_cl_spire.cup.car ú 1 TNRD ¯ Austin Cindric 2_ac_menards.cup.car ú 2 TNRD ¯ Cody Ware 51_cw_nurtecd.cup.car 3 ú 3 TNRD ¯ Noah Gragson 62_ng_beard.cup.car > ú 4 TNRD ¯ Denny Hamlin DH11_22FDX.cup.car
ú 5 SER €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ÿÿÿÿ SER í|A °
b²A ° n²A °¬²A °…²A °û©²A °
E¶²A °
ײA °çû²A °

Ä ³A °-³A °
X9³A °—n³A °
°r³A °åгA °¶ó³A °Ý$´A ° °r´A °\´A °
×µA °C‹¶A ° ·A °1·A °lç·A °ºA °®GÁA €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿí|A (
€¿ÿÿÿÿ SER €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ÿÿÿÿ SER í|A
b²A n²A ¬²A …²A û©²A
E¶²A
ײA çû²A

Ä ³A -³A
X9³A —n³A
°r³A åгA ¶ó³A Ý$´A °r´A \´A
×µA C‹¶A ·A 1·A lç·A ºA ®GÁA €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿí|A (
€¿ÿÿÿÿ SER €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿÿÿÿÿ €¿ÿÿÿÿ SER í|A °
b²A ° n²A °¬²A °…²A °û©²A °
E¶²A °
ײA °çû²A °

Ä ³A °-³A °
X9³A °—n³A °
°r³A °åгA °¶ó³A °Ý$´A ° °r´A °\´A °
×µA °C‹¶A ° ·A °1·A °lç·A °ºA °®GÁA €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿí|A (
€¿ÿÿÿÿ SER €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿÿÿÿÿ €¿ÿÿÿÿ SER í|A
b²A n²A ¬²A …²A û©²A
E¶²A
ײA çû²A

Ä ³A -³A
X9³A —n³A
°r³A åгA ¶ó³A Ý$´A °r´A \´A
×µA C‹¶A ·A 1·A lç·A ºA ®GÁA €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿ €¿ ÿí|A (
€¿ÿÿÿÿ BTPL BTPL ORPL Ά p(æ ˆD BTPL
I have tried just about everything I can for days now and the code below pretty much
does the same thing as anything else I tried, it's either a horizontal line or a vertical line
in the list box:
It's just a line of text like: TUdWUwAAAAAwAAAAW
Longer with some numbers mixed in, I wasn't able to copy from the list box.

C#:
 if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {

                string filename = openFileDialog1.FileName;
                string resultStr = string.Empty;
                FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
                BinaryReader br = new BinaryReader(fs);
                br.BaseStream.Position = 0;
                listBox1.BeginUpdate();
                listBox1.Items.Clear();
                Byte[] bytes = br.ReadBytes(Convert.ToInt32(fs.Length));
                resultStr = Convert.ToBase64String(bytes);
                listBox1.Items.Add(resultStr);
                listBox1.EndUpdate();
                br.Close();
                fs.Close();

I want to read the file and be able to move lines in the list box up and down
and also randomize the list and save the file again.
Main thing right now is just reading the file into the box.

Thanks for any help.
Steve
 
It seems like you're just throwing stuff at the wall and hoping something sticks. How about you think through the logic first and then write code to implement that logic? I have no idea why you think converting the data to a base-64 string would be useful. If you want to read the file as text then just read it as text. If it's a binary file though, I'm not sure why you'd want to do that but if that's what you want to do, do that. You can just call File.ReadAllLines to get a string array containing all the lines from a file. I would think, though, that you'd want to understand the format of the file and then read it in a manner that is appropriate for that format.
 
It seems like you're just throwing stuff at the wall and hoping something sticks. How about you think through the logic first and then write code to implement that logic? I have no idea why you think converting the data to a base-64 string would be useful. If you want to read the file as text then just read it as text. If it's a binary file though, I'm not sure why you'd want to do that but if that's what you want to do, do that. You can just call File.ReadAllLines to get a string array containing all the lines from a file. I would think, though, that you'd want to understand the format of the file and then read it in a manner that is appropriate for that format.
Hi,
I want to read that file as a list in a list box so the names can
be moved up or down or randomized, it's actually a roster.
If done right it will read like:

1-bob smith(9)
2-jim johnson(21)
3-fred brown(5)
4-billy ray(2)

That's the list that file makes, I wasn't throwing things at the wall,
I was reading from all kinds of sites on how to read a binary file.
I'm not finding anything that is really telling me how to go about it.
Believe me when I tell you that I have been trying hard to get this to work.
I will keep trying.

Thanks
Steve
 
how to read a binary file

It doesn't make sense. All files are binary files, even text files. And all different file types are differently formatted. A PNG is binary laid out like X, a ZIP is binary laid out like Y, a MP3 is binary laid out like Z. You can't just write one thing that "reads binary files" and then it'll be able to handle (play) your MP3 or handle (render) your PNG or handle (add files to) your ZIP

Files have a structure, usually, unless they're deliberately random bytes. When you read them you have to follow that structure. When you write them you have to follow that structure. If you don't then other programs that read that file and expect that structure won't be able to read it.

Even a simple text file containing "hello world" with a new line between the words is a stream of binary 0s and 1s, and the binary looks different depending on whether its ASCII or Unicode so before you've even got into interpreting the content, you have decisions to make about how many binary bits to read and convert into a byte, to convert into a char, to pick out a newline, to render text on the screen as one line under another

"How to read a binary file" in google will probably get you as far as File.ReadAllBytes - that gets you the raw bytes of the file in memory as an array, but you still can't do anything with it until you start interpreting it. It looks like your file has some kind of headered fields in - I see strings like TNRD MGVS FNKW FCRD repeat with data following them. It makes me think of an ID3V2 MP3 tag but those characters don't denote ID3V2 frames. You have to know more about the app that built the file, you can't just "read it as a string, into a listbox, and move the words about". That's like trying to apply a gaussian blur to a JPEG by opening it in microsoft word and moving some characters around; it 100% doesn't work like that
 
It looks like our OP is hacking a game file. Or is modding the politically correct term for creating a cheat, nowadays?
 
If done right it will read like:

1-bob smith(9)
2-jim johnson(21)
3-fred brown(5)
4-billy ray(2)

That's the list that file makes
Correction: that's the list that some application creates when it reads that file based on the appropriate format. If you're going to read the file to get the data correctly then you have to understand that format. As suggested, all files are binary in that all files contain bytes that represent data. You have to understand that representation in order to interpret those bytes correctly. There's no one way to read a binary file because the same bytes may mean different things in different files. You are throwing things at the wall because, unless you know where exactly the data is in that file that corresponds to the text you want to display in that list, you don't know how to read the file. Can you explain exactly where in that file the leading numbers are, which appear to be rankings? Can you explain exactly where the names are? Can you explain exactly where the numbers in the parentheses are? Unless you can answer those questions, we can't help you because if you don't know what you're reading then you can't know how to read it.
 
Correction: that's the list that some application creates when it reads that file based on the appropriate format. If you're going to read the file to get the data correctly then you have to understand that format. As suggested, all files are binary in that all files contain bytes that represent data. You have to understand that representation in order to interpret those bytes correctly. There's no one way to read a binary file because the same bytes may mean different things in different files. You are throwing things at the wall because, unless you know where exactly the data is in that file that corresponds to the text you want to display in that list, you don't know how to read the file. Can you explain exactly where in that file the leading numbers are, which appear to be rankings? Can you explain exactly where the names are? Can you explain exactly where the numbers in the parentheses are? Unless you can answer those questions, we can't help you because if you don't know what you're reading then you can't know how to read it.
The file is a racing sim roster. It's a race qualifying order. The first number is the line up 123456 and so on, the name is the driver's name, the number in the parentheses is the car number. Somebody made an app to move and randomize the qualifying order to mimic the qualifying or actually update to today's qualifying. Somebody did find away to get at least the names numbers and line up out of that file, there is other file names in the file they end in .car The app that opens that file has an issue when there are more than 42 cars in the list, the app will crash, I was trying to make an app that would work without crashing. This is not a hack or anything like that. Just a fix for a crashing app.
Thanks
Steve
 
Last edited:
Knowing what those values represent is not enough. You have to know where they appear in the file and also what is between them, at least in terms of numbers of bytes. You pretty much have to understand how a binary file was written in order to understand how to read it. If you want to read a value from bytes somewhere in the file then you have to know what the byte offset is or else how to read the preceding data to get to that offset, then you have to know how to interpret the bytes that represent that data. It's not easy to reverse engineer a file format but that is basically what you have to do. As we have already pointed out, there's no one way to read a binary file. You have to understand the binary format and then read the individual values from the file contents based on that.

Here's an example I wrote about 15 years ago that demonstrates writing and reading a very simple binary format:
C#:
using System;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            const string filePath = @"C:\BinaryTest.bin";

            using (BinaryWriter writer = new BinaryWriter(File.Open(filePath, FileMode.Create)))
            {
                // Write a 32-bit integer.
                writer.Write((byte)DataType.Int32);
                writer.Write(12345);
                // Write a double-preceision floating-point value.
                writer.Write((byte)DataType.Double);
                writer.Write(222.333);
                // Write a string.
                writer.Write((byte)DataType.String);
                writer.Write("Hello World");
                // Write a 32-bit integer.
                writer.Write((byte)DataType.Int32);
                writer.Write(98765);
            }

            DataType type;

            using (BinaryReader reader = new BinaryReader(File.OpenRead(filePath)))
            {
                // Keep reading while there is data available.
                while (reader.PeekChar() != -1)
                {
                    // Read the data type of the following value.
                    type = (DataType)reader.ReadByte();

                    Console.Write("{0}: ", type);

                    // Read the next value based on its data type.
                    switch (type)
                    {
                        case DataType.Byte:
                            Console.WriteLine(reader.ReadByte().ToString());
                            break;
                        case DataType.Int16:
                            Console.WriteLine(reader.ReadInt16().ToString());
                            break;
                        case DataType.Int32:
                            Console.WriteLine(reader.ReadInt32().ToString());
                            break;
                        case DataType.Int64:
                            Console.WriteLine(reader.ReadInt64().ToString());
                            break;
                        case DataType.Single:
                            Console.WriteLine(reader.ReadSingle().ToString());
                            break;
                        case DataType.Double:
                            Console.WriteLine(reader.ReadDouble().ToString());
                            break;
                        case DataType.Decimal:
                            Console.WriteLine(reader.ReadDecimal().ToString());
                            break;
                        case DataType.String:
                            Console.WriteLine(reader.ReadString());
                            break;
                        case DataType.Char:
                            Console.WriteLine(reader.ReadChar().ToString());
                            break;
                        case DataType.Boolean:
                            Console.WriteLine(reader.ReadBoolean().ToString());
                            break;
                        default:
                            break;
                    }
                }
            }

            Console.ReadLine();
        }
    }

    public enum DataType : byte
    {
        Byte,
        Int16,
        Int32,
        Int64,
        Single,
        Double,
        Decimal,
        String,
        Char,
        Boolean
    }
}
If you had no prior knowledge of that code and I gave you a file that was written by it, could you read it? Of course not, because it would just be random bytes to your eye. You would need to understand how it was written in order to understand how to read it. The same goes for you here. If you don't understand the format of the file you're reading, you can't read it.
 
Time to start reverse engineering the file them. Generate two, with slightly different data e.g. one with John at the top of the leaderboard and one with Jane. Use e.g. HexCmp to compare the differences - maybe you'll find it's really simple, or maybe there will be checksums and calculated values dotted around the file to protect it from edit attempts/check the data is sane.. Then do a third, and fourth etc. Add more people to the leaderboard etc etc

Maybe you'll find that it's e,g. just 128 irrelevant bytes, then up to 4096 bytes for leaderboard and theyre always in order of "name, 128 bytes, position 2 bytes, end of record larker, 4 bytes", then a count of the entries, 4 bytes, then remainder irrelevant bytes. Rewriting it is an exercise of copying some bytes you don't care about (the first 128, the trailing bytes from position 4224 onwards) and constructing others you do care about (the leaderboard)

At that point you will then have created a program that makes a meaningful interpretation of the file contents. If your new file doesn't work, you missed something; go over the diffs again
 
Knowing what those values represent is not enough. You have to know where they appear in the file and also what is between them, at least in terms of numbers of bytes. You pretty much have to understand how a binary file was written in order to understand how to read it. If you want to read a value from bytes somewhere in the file then you have to know what the byte offset is or else how to read the preceding data to get to that offset, then you have to know how to interpret the bytes that represent that data. It's not easy to reverse engineer a file format but that is basically what you have to do. As we have already pointed out, there's no one way to read a binary file. You have to understand the binary format and then read the individual values from the file contents based on that.

Here's an example I wrote about 15 years ago that demonstrates writing and reading a very simple binary format:
C#:
using System;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            const string filePath = @"C:\BinaryTest.bin";

            using (BinaryWriter writer = new BinaryWriter(File.Open(filePath, FileMode.Create)))
            {
                // Write a 32-bit integer.
                writer.Write((byte)DataType.Int32);
                writer.Write(12345);
                // Write a double-preceision floating-point value.
                writer.Write((byte)DataType.Double);
                writer.Write(222.333);
                // Write a string.
                writer.Write((byte)DataType.String);
                writer.Write("Hello World");
                // Write a 32-bit integer.
                writer.Write((byte)DataType.Int32);
                writer.Write(98765);
            }

            DataType type;

            using (BinaryReader reader = new BinaryReader(File.OpenRead(filePath)))
            {
                // Keep reading while there is data available.
                while (reader.PeekChar() != -1)
                {
                    // Read the data type of the following value.
                    type = (DataType)reader.ReadByte();

                    Console.Write("{0}: ", type);

                    // Read the next value based on its data type.
                    switch (type)
                    {
                        case DataType.Byte:
                            Console.WriteLine(reader.ReadByte().ToString());
                            break;
                        case DataType.Int16:
                            Console.WriteLine(reader.ReadInt16().ToString());
                            break;
                        case DataType.Int32:
                            Console.WriteLine(reader.ReadInt32().ToString());
                            break;
                        case DataType.Int64:
                            Console.WriteLine(reader.ReadInt64().ToString());
                            break;
                        case DataType.Single:
                            Console.WriteLine(reader.ReadSingle().ToString());
                            break;
                        case DataType.Double:
                            Console.WriteLine(reader.ReadDouble().ToString());
                            break;
                        case DataType.Decimal:
                            Console.WriteLine(reader.ReadDecimal().ToString());
                            break;
                        case DataType.String:
                            Console.WriteLine(reader.ReadString());
                            break;
                        case DataType.Char:
                            Console.WriteLine(reader.ReadChar().ToString());
                            break;
                        case DataType.Boolean:
                            Console.WriteLine(reader.ReadBoolean().ToString());
                            break;
                        default:
                            break;
                    }
                }
            }

            Console.ReadLine();
        }
    }

    public enum DataType : byte
    {
        Byte,
        Int16,
        Int32,
        Int64,
        Single,
        Double,
        Decimal,
        String,
        Char,
        Boolean
    }
}
If you had no prior knowledge of that code and I gave you a file that was written by it, could you read it? Of course not, because it would just be random bytes to your eye. You would need to understand how it was written in order to understand how to read it. The same goes for you here. If you don't understand the format of the file you're reading, you can't read it.
Ok, I am reading all I can and trying to figure out something, I did get some code similar to what you have, I try not to be a quitter, things like this bug me a lot so I'll keep trying.
 
Time to start reverse engineering the file them. Generate two, with slightly different data e.g. one with John at the top of the leaderboard and one with Jane. Use e.g. HexCmp to compare the differences - maybe you'll find it's really simple, or maybe there will be checksums and calculated values dotted around the file to protect it from edit attempts/check the data is sane.. Then do a third, and fourth etc. Add more people to the leaderboard etc etc

Maybe you'll find that it's e,g. just 128 irrelevant bytes, then up to 4096 bytes for leaderboard and theyre always in order of "name, 128 bytes, position 2 bytes, end of record larker, 4 bytes", then a count of the entries, 4 bytes, then remainder irrelevant bytes. Rewriting it is an exercise of copying some bytes you don't care about (the first 128, the trailing bytes from position 4224 onwards) and constructing others you do care about (the leaderboard)

At that point you will then have created a program that makes a meaningful interpretation of the file contents. If your new file doesn't work, you missed something; go over the diffs again
I got hexcmp and I will be working on it.

Thanks
Steve
 
Time to start reverse engineering the file them. Generate two, with slightly different data e.g. one with John at the top of the leaderboard and one with Jane. Use e.g. HexCmp to compare the differences - maybe you'll find it's really simple, or maybe there will be checksums and calculated values dotted around the file to protect it from edit attempts/check the data is sane.. Then do a third, and fourth etc. Add more people to the leaderboard etc etc

Maybe you'll find that it's e,g. just 128 irrelevant bytes, then up to 4096 bytes for leaderboard and theyre always in order of "name, 128 bytes, position 2 bytes, end of record larker, 4 bytes", then a count of the entries, 4 bytes, then remainder irrelevant bytes. Rewriting it is an exercise of copying some bytes you don't care about (the first 128, the trailing bytes from position 4224 onwards) and constructing others you do care about (the leaderboard)

At that point you will then have created a program that makes a meaningful interpretation of the file contents. If your new file doesn't work, you missed something; go over the diffs again
Ok, I do see that the file doesn't change until after the last .car , I moved one driver down and noticed the small change, I then reversed the order and noticed the big change. So thanks for letting me know about the compare tool, only had the vs binary editor before, no comparing with that, also comparing didn't even come to mind. I am going do some learning now.

Thanks
Steve
 
You might additionally find Beyond Compare from Scooter Software to be useful; it's one of the most amazing bits of software I have and is well worth the licensing fee. As a developer I use it every day to merge code changes, scan whole directory trewes for file differences, and it has all sorts of natty things like being able to pixel compare images etc.

In hex mode HexCmp is a fairly basic hex comparator, whereas BeyComp will try a lot better to cope with files of different length. For example here are two MP3 that are nearly identical, except the one on the right has had one entire frame removed (the diagonal lines), and its copyright and original bits set in the headers of every frame (the 1064 vs 116C):

1660843514569.png


A dumb hex compare where it just looks at "is the byte at position 1 in file A identical to byte 1 of file B", "is byte 2 of each file the same", "is byte 3..." would struggle with this; the missing frame means that from address 0x2DA onwards the two files would be different on most bytes, but BeyComp is smart enough to catch a difference and then start inserting blank space, trying to line the files up again (which it manages to do)

HexCmp just does a straight byte compare so declares the files as "mostly different" after 0x2DA:
1660844814344.png


HexCamp can manually align the two files relative to each other but I don't know about any automatic options. If you were looking to throw money at a tool, I'd say pay more for BeyComp
 
Back
Top Bottom