Daytona USA Progress

Online games, how to get online, and anything involving Dreamcast online can be discussed here.

Moderator: pcwzrd13

Yuviapp
Fancy Pants Admin
Posts: 2
Joined: Sat Sep 09, 2023 12:28 pm
Contact:

Re: Daytona USA Progress

Post by Yuviapp »

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.

Image
Image

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;
        }
User avatar
Xiden
Developer
Posts: 2225
Joined: Thu Jun 23, 2016 12:24 am
Dreamcast Games you play Online: All the DC games!!

Re: Daytona USA Progress

Post by Xiden »

Yuviapp wrote:
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.

Image
Image

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;
        }
Do you have discord?
Yuviapp
Fancy Pants Admin
Posts: 2
Joined: Sat Sep 09, 2023 12:28 pm
Contact:

Re: Daytona USA Progress

Post by Yuviapp »

Xiden wrote:
Yuviapp wrote:
ioncannon wrote:
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.

Image
Image

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;
        }
Do you have discord?
I do yah, Please reach out to me on discord @yuvi, or twitter @yuviapp

Thanks :D
Sennar83
rebel
Posts: 19
Joined: Tue Aug 04, 2020 9:41 am
Dreamcast Games you play Online: all games online

Re: Daytona USA Progress

Post by Sennar83 »

Is It possible tò play Daytona online using flycast?
User avatar
redjeff76
Anarki
Posts: 86
Joined: Wed Jul 26, 2023 10:10 pm

Re: Daytona USA Progress

Post by redjeff76 »

nope, at this time no emulators
User avatar
Holsten
fragger
Posts: 258
Joined: Tue Feb 09, 2021 3:41 am

Re: Daytona USA Progress

Post by Holsten »

Even on real hardware it barely works at the moment.
Holsten knallt am dollsten.
User avatar
redjeff76
Anarki
Posts: 86
Joined: Wed Jul 26, 2023 10:10 pm

Re: Daytona USA Progress

Post by redjeff76 »

I really have very little trouble with Daytona USA. As long as there are people to race online. After every race, every person in your group MUST log back out to the Server window that says "DreamPipe_Daytona" and then go back into the race's. If every racer doesn't do this Daytona will crash after each race. Also no player can use emulators to play Daytona. If each racer follows these rules I have played for hours with multiple people online before. Back out of each race to this window (to back out you push start after a race <exit team/race>, then push start and <exit to the entrance>. THEN push "B" to back up to the server list that shows the picture I posted below:
Attachments
20230918_005623.jpg
User avatar
Holsten
fragger
Posts: 258
Joined: Tue Feb 09, 2021 3:41 am

Re: Daytona USA Progress

Post by Holsten »

lucky for you then. I can barely play with anyone (not that i want to). I also feel kind of bad for some of my friends who really want to play but it never works for them.
Holsten knallt am dollsten.
User avatar
Xiden
Developer
Posts: 2225
Joined: Thu Jun 23, 2016 12:24 am
Dreamcast Games you play Online: All the DC games!!

Re: Daytona USA Progress

Post by Xiden »

Holsten wrote:lucky for you then. I can barely play with anyone (not that i want to). I also feel kind of bad for some of my friends who really want to play but it never works for them.

Everyone needs to be on dreampi 1.8 and dmz or port forwarding. If its not working then someone likely just isnt setup correctly. Make sure you can all see each other yellow or blue orb in the lobby. If you see a red orb or no orb their ping is likely too high to connect.
User avatar
Holsten
fragger
Posts: 258
Joined: Tue Feb 09, 2021 3:41 am

Re: Daytona USA Progress

Post by Holsten »

i know we tried many times and many things
Holsten knallt am dollsten.
Post Reply