Official Sega Saturn NetLink Guide

General Dreamcast discussion applies here. Before posting here please check the other forums in the Dreamcast section to see if your topic would fit better in those categories.

Moderators: pcwzrd13, mazonemayu

Forum rules
Please check the other forums in the Dreamcast section before posting here to see if your topic would fit better in those categories. Example: A new game/homebrew release would go in the New Releases/Homebrew/Emulation section: http://dreamcast-talk.com/forum/viewforum.php?f=5 or if you're having an issue with getting your Dreamcast to work or a game to boot it would go in the Support section: http://dreamcast-talk.com/forum/viewforum.php?f=42
User avatar
-drez01-
Tank Jr.
Posts: 344

Re: SaturnPi

Post#21 » Mon Oct 17, 2016 6:24 pm

pcwzrd13 has a good point and nothing will be as good as an analogue telephone line in terms of latency for Netlink.

Compression is one factor of latency. Servers used by VoIP companies and VoIP devices themselves also contribute lag.

Though you can minimize the lag by bypassing the VoIP serves with a direct connection and turn off compression in the device, the adapters themselves still create latency and that is unavoidable.

Maybe your right. This is all speculation but perhaps the best way to do this without a phone line is if you could directly connect 2 pi's together online, or to a server wich sole purpose is to be the middleman in that configuration.

User avatar
Xiden
Developer
Posts: 2219

Re: SaturnPi

Post#22 » Fri Oct 21, 2016 5:11 pm

So the creators of Yabause Sega Saturn Emulator actually has emulated Netlink over LAN/Internet with their Saturn Emulator. Since he knows how Netlink works I'm wondering if he could provide software for Netlinks to connect to a central server...

They have a contact page, but doesn't appear to have a direct emails listed. I might post something on their message board.

More Info
https://yabause.org/2013/12/15/yabause- ... -10-years/

User avatar
Xiden
Developer
Posts: 2219

Re: SaturnPi

Post#23 » Fri Oct 21, 2016 5:15 pm

Actually looks like he has it available as open source. Unfortunately I only program in C#/VB.Net/Java, I'm certain he programs in C++ (Haven't examined the source code yet).

Found interesting reading on Netlink initialization

http://wiki.yabause.org/index.php5?title=Netlink

User avatar
itsthinkingstill
Vagabond
Posts: 787

Re: SaturnPi

Post#24 » Fri Oct 21, 2016 6:57 pm

This is a Amazing find!!!!! this actually wouldn't take too much work i think to transfer to dreampi. PC call up kazade and lets get this sucker working!

User avatar
itsthinkingstill
Vagabond
Posts: 787

Re: SaturnPi

Post#25 » Fri Oct 21, 2016 7:03 pm

As for contacting the team a good way to do it i guess would to comment in one of their newest topics on their website or maybe over at the sega xtreme forms as i think some of the members of the team are there

User avatar
itsthinkingstill
Vagabond
Posts: 787

Re: SaturnPi

Post#26 » Thu Nov 10, 2016 10:44 pm

Okay after some help over at sega xtreme i found the netlink emulation code from yabause

*/

#ifndef NETLINK_H
#define NETLINK_H

#include "sock.h"

#define NETLINK_BUFFER_SIZE 1024

enum NL_RESULTCODE
{
NL_RESULTCODE_OK=0,
NL_RESULTCODE_CONNECT,
NL_RESULTCODE_RING,
NL_RESULTCODE_NOCARRIER,
NL_RESULTCODE_ERROR,
NL_RESULTCODE_CONNECT1200,
NL_RESULTCODE_NODIALTONE,
NL_RESULTCODE_BUSY,
NL_RESULTCODE_NOANSWER,
};

enum NL_CONNECTSTATUS
{
NL_CONNECTSTATUS_IDLE,
NL_CONNECTSTATUS_WAIT,
NL_CONNECTSTATUS_CONNECT,
NL_CONNECTSTATUS_LOGIN1,
NL_CONNECTSTATUS_LOGIN2,
NL_CONNECTSTATUS_LOGIN3,
NL_CONNECTSTATUS_CONNECTED,
};

enum NL_MODEMSTATE
{
NL_MODEMSTATE_COMMAND,
NL_MODEMSTATE_DATA,
};

typedef struct
{
u8 RBR;
u8 THR;
u8 IER;
u8 DLL;
u8 DLM;
u8 IIR;
u8 FCR;
u8 LCR;
u8 MCR;
u8 LSR;
u8 MSR;
u8 SCR;
u8 SREG[256];
} netlinkregs_struct;

typedef struct {
volatile u8 inbuffer[NETLINK_BUFFER_SIZE];
volatile u8 outbuffer[NETLINK_BUFFER_SIZE];
volatile u32 inbufferstart, inbufferend, inbuffersize;
volatile int inbufferupdate;
volatile u32 outbufferstart, outbufferend, outbuffersize;
volatile int outbufferupdate;
netlinkregs_struct reg;
int isechoenab;
YabSock listensocket;
YabSock connectsocket;
YabSock clientsocket;
enum NL_CONNECTSTATUS connectstatus;
u32 cycles;
enum NL_MODEMSTATE modemstate;
char ipstring[16];
char portstring[6];
u32 connect_time, connect_timeout;
int internet_enable;
volatile u32 thb_write_time;
int escape_count;
} Netlink;

typedef struct
{
char ip[16];
int port;
YabSock sock;
} netlink_thread;

extern Netlink *NetlinkArea;

u8 FASTCALL NetlinkReadByte(SH2_struct *sh, u32 addr);
void FASTCALL NetlinkWriteByte(SH2_struct *sh, u32 addr, u8 val);
int NetlinkInit(const char *ip, const char *port);
void NetlinkDeInit(void);
void NetlinkExec(u32 timing);

#endif

The next one is very long so here is the links
https://github.com/Yabause/yabause/blob ... /netlink.c
https://github.com/Yabause/yabause/blob ... /netlink.h

User avatar
Xiden
Developer
Posts: 2219

Re: SaturnPi

Post#27 » Mon Nov 14, 2016 11:43 am

itsthinkingstill wrote:Okay after some help over at sega xtreme i found the netlink emulation code from yabause

*/

#ifndef NETLINK_H
#define NETLINK_H

#include "sock.h"

#define NETLINK_BUFFER_SIZE 1024

enum NL_RESULTCODE
{
NL_RESULTCODE_OK=0,
NL_RESULTCODE_CONNECT,
NL_RESULTCODE_RING,
NL_RESULTCODE_NOCARRIER,
NL_RESULTCODE_ERROR,
NL_RESULTCODE_CONNECT1200,
NL_RESULTCODE_NODIALTONE,
NL_RESULTCODE_BUSY,
NL_RESULTCODE_NOANSWER,
};

enum NL_CONNECTSTATUS
{
NL_CONNECTSTATUS_IDLE,
NL_CONNECTSTATUS_WAIT,
NL_CONNECTSTATUS_CONNECT,
NL_CONNECTSTATUS_LOGIN1,
NL_CONNECTSTATUS_LOGIN2,
NL_CONNECTSTATUS_LOGIN3,
NL_CONNECTSTATUS_CONNECTED,
};

enum NL_MODEMSTATE
{
NL_MODEMSTATE_COMMAND,
NL_MODEMSTATE_DATA,
};

typedef struct
{
u8 RBR;
u8 THR;
u8 IER;
u8 DLL;
u8 DLM;
u8 IIR;
u8 FCR;
u8 LCR;
u8 MCR;
u8 LSR;
u8 MSR;
u8 SCR;
u8 SREG[256];
} netlinkregs_struct;

typedef struct {
volatile u8 inbuffer[NETLINK_BUFFER_SIZE];
volatile u8 outbuffer[NETLINK_BUFFER_SIZE];
volatile u32 inbufferstart, inbufferend, inbuffersize;
volatile int inbufferupdate;
volatile u32 outbufferstart, outbufferend, outbuffersize;
volatile int outbufferupdate;
netlinkregs_struct reg;
int isechoenab;
YabSock listensocket;
YabSock connectsocket;
YabSock clientsocket;
enum NL_CONNECTSTATUS connectstatus;
u32 cycles;
enum NL_MODEMSTATE modemstate;
char ipstring[16];
char portstring[6];
u32 connect_time, connect_timeout;
int internet_enable;
volatile u32 thb_write_time;
int escape_count;
} Netlink;

typedef struct
{
char ip[16];
int port;
YabSock sock;
} netlink_thread;

extern Netlink *NetlinkArea;

u8 FASTCALL NetlinkReadByte(SH2_struct *sh, u32 addr);
void FASTCALL NetlinkWriteByte(SH2_struct *sh, u32 addr, u8 val);
int NetlinkInit(const char *ip, const char *port);
void NetlinkDeInit(void);
void NetlinkExec(u32 timing);

#endif

The next one is very long so here is the links
https://github.com/Yabause/yabause/blob ... /netlink.c
https://github.com/Yabause/yabause/blob ... /netlink.h


I think our best bet to implement this with a ras pi would be to get a hold of that yabuse group. I'm thinking they'd be willing to help get this running on raspi's. Seems like everything we'd need is there however Im not a C++/C Programmer :(

But this looks very promising :) Maybe Shu or Kazade can take a look at it eventually ;)

User avatar
itsthinkingstill
Vagabond
Posts: 787

Re: SaturnPi

Post#28 » Mon Nov 14, 2016 11:09 pm

from amon on sega xtreme "Best place to find them is in their irc channel on freenode #yabause
"

User avatar
SEGA RPG FAN
Developer
Posts: 601

Re: SaturnPi

Post#29 » Thu Feb 02, 2017 2:31 pm

Very interesting. Even if the netlink has been emulated in an emulator, you might have trouble getting it to work with real hardware. An emulator can change the way the virtual hardware works to solve some of the issues (not saying that's what they did, but it's a real possibility), you can't change the way a real saturn/netlink works.
PSO Dreamcast 100% Legit: Eda FOmarl, Automaton HUcast

User avatar
Xiden
Developer
Posts: 2219

Re: SaturnPi

Post#30 » Thu Feb 02, 2017 2:46 pm

Ultimately if we are able to emulate a Phone Line Simulator via software, we can get the Saturn Netlink to work with a pi. That's really what it comes down to I think.

  • Similar Topics
    Replies
    Views
    Last post

Return to “Lounge”

Who is online

Users browsing this forum: Majestic-12 [Bot]