ioncannon wrote:mstar wrote:Hey @ioncannon - hows the reversing coming along?
Not much further as trying to figure out the flow of the program w.o a debugger is frustrating. But you just made me think of something.... instead of trying to fix Flycast, why not patch Daytona to use a "free" port that Flycast understands? Will give it a try and see if I can debug in that case.
In the mean time I was actually reverse engineering the Onsen games. I got the whole protocol figured out (including the encryption and checksum), and got far enough into the login process that it connects into a "game" server. However a lot of the data is unknown and it never actually leaves the loading screen.Code: Select all
If type & 0x1F != 0, encrypt it. Packet looks like:
[headerSize (always 0xC)][type][payloadSize][ip][crc32][data]
In the data it usually has a header like this but the counts can be used in other ways:
[opcode][responseCode][count1][count2][maxCount]
My parse code:Code: Select all
Hey sir,
I wanted to follow up on this, as I also just recently started looking at One dice games to see if we can get them back online.
This was brought to my attention by PCWizard and wanted to follow up to see if you were still working on this, as I didn't want to step on you're shoes. If not maybe we could team up to complete it :D
private int ParsePacket(byte[] data, int offset, int maxLength, out byte outType, out byte[] outPayload)
{
outType = 0;
outPayload = null;
int bytesRemaining = maxLength - offset;
// Is there a header?
if (bytesRemaining < 0xC)
return 0;
// Get details
byte type = data[offset + 1];
ushort payloadSize = (ushort)((data[offset + 3] << 8) | data[offset + 2]);
// Is the full packet here?
if (bytesRemaining < payloadSize)
return 0;
// The rest of the packet
uint ipAddr = BitConverter.ToUInt32(data, offset + 4);
uint checksum = BitConverter.ToUInt32(data, offset + 8);
byte[] payload = new byte[payloadSize];
Array.Copy(data, offset + 0xc, payload, 0, payloadSize);
// Check CRC32
uint crc32 = Utils.CalcCRC32(payload);
if (crc32 != checksum)
return 0;
// Decrypt if needed
if ((type & 0x20) != 0)
server.GetBlowfish().Decrypt(payload);
// Done!
outType = type;
outPayload = payload;
return payloadSize + 0xc;
}