Network code

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: Network code

Postby Ian » Thu Feb 08, 2018 10:14 am

Spindizzi,
I had a look at lemans24. In nik's version it doesn't even send anything at all. Although the code thinks its transmitting then you get a network error straight away.

Anyway with ours I am pretty sure send_offset could be wrong. Currently we are just sending totally empty packets ie 0x000000000 since the memory is empty
If we dumped the entire memory we should be able to find where the actual send buffer is (assuming it's in the memory). The network data has a very particular pattern followed by 0xFF to terminate the packets.
Ian
 
Posts: 1536
Joined: Tue Feb 23, 2016 9:23 am

Re: Network code

Postby Bart » Thu Feb 08, 2018 11:19 am

Haven't dug into how you guys are emulating the network board but are you attempting a high level emulation or are you trying to emulate the network device? Presumably, a pointer is supplied to some device that DMAs the data out?
User avatar
Bart
Site Admin
 
Posts: 2201
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Network code

Postby Spindizzi » Thu Feb 08, 2018 1:13 pm

I'm pretty sure the offset is correct ;)
however, it misses something maybe in init, because I saw at least one time or two, some bytes at this point (00 00 00 ff) or (00 00 ff 00) can't remember exactly
lemans (and von2) start network negociation with
send offset = 0xf000
send size = 0x4
recv offset = 0xf010
recv size = 0x8
(notice : the addresses are the same for dirtdvls but not the size)
actually, master send 00 00 00 00, and slave receive that, but never understand what it is and can't change some byte to answer, it expects 00 00 ff 00 or 00 00 00 ff to give a good answer to the master, (I suppose). So Master and slave wait for packet for now

A thing I can't understand : apparently slave wants to send from 0xf010 and not from 0xf000 like master, that's fooling me because all others games have different address for recv and send (and master and slave have the same)

I use cheat engine to see the memory when running instance without debugger, very handy tool to inspect memory in real time

----

High level, I don't know! 68k cpu is implemented and runs it's own program (the netcode). All registers, memory are modified by 68k cpu or ppc cpu.
Absolutly don't know about direct memory access
I think Nik doesn't add a 68k cpu to the emulation but only changes values in memory himself as result of solicitation (assumption). In fact he has a better understanding of the process because he knows what to answer when events happen
Spindizzi
 
Posts: 122
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: Network code

Postby Bart » Thu Feb 08, 2018 1:17 pm

I think Nik was actually emulating the 68K.
User avatar
Bart
Site Admin
 
Posts: 2201
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Network code

Postby Ian » Thu Feb 08, 2018 2:10 pm

If Nik was emulating the 68k he obviously found a way to modify the 68k code to work multi threaded.
Spindizzi,
Yeah I see now :) It appears to be sending totally empty packets at boot. Since they start with 0xFF ? and then 3 more bytes of nothing

I'm pretty sure the offset is correct

Yes I think you are right. I did a brute force memory search to look for the first occurrence of 0xFF since from my limited poking it seems that marked the end of a packet. Starting from address 0 i got a first hit with the address ‭0xF000‬ which is right where we are sending. So it looks right.

A thing I can't understand : apparently slave wants to send from 0xf010 and not from 0xf000 like master

Maybe each client doesn't need to send the whole buffer? Just sends data from its slot.

it expects 00 00 ff 00 or 00 00 00 ff to give a good answer to the master, (I suppose).

With a send size of 4, I would expect it to send 00 00 00 FF.
FF always marks the packet end? Maybe try just returning that.
Ian
 
Posts: 1536
Joined: Tue Feb 23, 2016 9:23 am

Re: Network code

Postby Spindizzi » Fri Feb 09, 2018 2:30 am

The data packet we discuss actually, is the machine count process (with eventually a sync process) I call this frame type 1
As soon as all the machines have responded correctly, there is a reconfiguration of the recv-send address and recv-send size. This allows to receive-send the real datas packet game. I call this frame type 2
ie:
for frame type1 dirtdvls (2cabs)
send off=0xf000 send size=0x10 recv off=0xf010 recv size=0x18
for frame type2 dirtdvls (2cabs) and raw data before treatment (see code)
send off=0x0001 send size=0x801c recv off=0x000f recv size=0x001c

for frame type1 harley (2cabs)
send off=0x0080 send size=0x07 recv off=0x0090 recv size=0x0b
for frame type2 harley (2cabs) and raw data before treatment (see code)
send off=0x0001 send size=0x003a recv off=0x0009 recv size=0xff37

for frame type1 lemans (2cabs)
send off=0xf000 (M) send size=0x04 recv off=0xf010 recv size=0x08
send off=0xf010 (S)
for frame type2 lemans (2cabs)
unknown for now but certainly this
send off=0x0001 send size=0x8??? recv off=0xc00d recv size=0x????

Maybe each client doesn't need to send the whole buffer? Just sends data from its slot.

this is entirely possible, but this also means each game work differently...

I do not put my hand to the fire saying packet will be terminated by 0xff and we don't care, because all is based on packet/slot size
I think it's only predetermined data with only 2-3 bytes of real datas in the case of type1 frame
this is an example of type1 frame exchange between 2 cabs(scud, skichamp and some others) aka machine count frame exchange
the values of 0x90 and 0x68 are fixed
M : 90 00 00 68 00 00 00
S : 90 00 00 68 01 00 01
M : 90 00 09 68 00 00 00
S : 90 00 09 68 01 00 01
M : 90 00 ec 68 00 01 00
S : 90 00 ec 68 01 01 01

the 0xff for lemans would certainly acts as 0x90 and 0x68 for the other games
Spindizzi
 
Posts: 122
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: Network code

Postby Ian » Sat Feb 10, 2018 7:04 am

What is the master waiting for, to go further?
Ian
 
Posts: 1536
Joined: Tue Feb 23, 2016 9:23 am

Re: Network code

Postby Spindizzi » Sun Feb 11, 2018 2:52 am

Good question, if I knew that.... ;)
may be the same thing that it sends
Spindizzi
 
Posts: 122
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: Network code

Postby Ian » Sun Feb 11, 2018 7:38 am

How hard would it be to see trace the assembly to see what it expects?
I guess it will read those values out of common ram and do a comparison somewhere
Ian
 
Posts: 1536
Joined: Tue Feb 23, 2016 9:23 am

Re: Network code

Postby Ian » Sun Feb 25, 2018 1:00 pm

Finally got a chance to try Spindizzi's updated network code
And ..

https://i.imgur.com/21tEFF6.jpg

:) Might have to disable EmulateNet in the ini to setup the network part
But once it's setup seems to mostly work :)
Ian
 
Posts: 1536
Joined: Tue Feb 23, 2016 9:23 am

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 2 guests