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.chttps://github.com/Yabause/yabause/blob ... /netlink.h