-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some values are encoded in a non-readable way #59
Comments
JSON encodes binary data as Base64. |
I tried to convert that to byte array which gives |
Binary data of some commands are not parsed / modeled. They are still retained and outputted as-is, which reflects the data stored in replays. In such cases the parser needs to be updated to interpret the data, or you have to do your own research what the data means. In most such cases I lacked the information how to interpret the data and was "lazy" to figure it out myself. |
Any other cmds have values that still encoded as base64 string in json ? |
Yes, there are some, there are also some that partly interpret the data, and outputs the rest, uninterpreted part as Base64. |
cmds like what exactly ? |
Actually, looking at the code, I don't see anything else besides the "Use Cheat" command. |
I think I finally got it working, this code is in C#, no experience in Go, so hopefully you can port it and tell me if it's working on your side: if (cmdType == "Cheat")
{
cheatByteArray_new = Convert.FromBase64String(item.XPathSelectElement("Data").Value); // convert encoded Base64 string to byte array
string[] excludeThose = new string[] { "16,0,0,0" , "0,0,4,0", "0,0,8,0", "8,0,0,0" }; //don't know how, but ignoring those seems to have the correct values.
byte[] result = new byte[4];
for (int i = 0; i < 4; i++)
{
result[i] = (byte)(cheatByteArray_new[i] ^ cheatByteArray_old[i]); //xoring the items in the 2 byte arrays
}
data = string.Join(",", result);
if (!excludeThose.Contains(data))
cheatByteArray_old = cheatByteArray_new;
switch (data) //The initial values of every cheat code, can be different if the order of issuing them changed.
{
case "16,0,0,0": more = ": show me the money " + data; break;
case "1,0,0,0": more = ": black sheep wall " + data; break;
case "2,0,0,0": more = ": operation cwal " + data; break;
case "4,0,0,0": more = ": power overwhelming " + data; break;
case "0,1,0,0": more = ": staying alive " + data; break;
case "128,0,0,0": more = ": there is no cow level " + data; break;
case "64,0,0,0": more = ": game over man " + data; break;
case "0,0,4,0": more = ": whats mine is mine " + data; break;
case "0,8,0,0": more = ": the gathering " + data; break;
case "0,0,8,0": more = ": breathe deep " + data; break;
case "8,0,0,0": more = ": something for nothing " + data; break;
case "0,16,0,0": more = ": medieval man " + data; break;
case "0,32,0,0": more = ": modify the phase variance " + data; break;
case "0,64,0,0": more = ": war aint what it used to be " + data; break;
case "0,0,2,0": more = ": food for thought " + data; break;
case "0,0,0,32": more = ": noglues " + data; break;
case "0,2,0,0": more = ": ophelia " + data; break;
case "0,0,16,0": more = ": zoom zoom " + data; break;
default: more = ": ??? unknown " + data; break;
}
} |
So it seems there are 4 bytes of data, and each bit of those corresponds to a specific cheat code (there may be unsued bits). |
Would like to know the cheat type, so how Data is encoded here ?
The text was updated successfully, but these errors were encountered: