Skip to content

Instantly share code, notes, and snippets.

@ducalex

ducalex/nes netplay.c Secret

Last active Mar 28, 2020
Embed
What would you like to do?
// This function is called on netplay events
static void netplay_callback(netplay_event_t event, void *arg)
{
if (event == NETPLAY_EVENT_PACKET_RECEIVED)
{
printf("Movement!\n");
memcpy(remoteJoystick, arg, sizeof *remoteJoystick);
}
netplay = (odroid_netplay_mode() != NETPLAY_MODE_NONE);
if (event == NETPLAY_EVENT_STATUS_CHANGED)
{
if (odroid_netplay_status() == NETPLAY_STATUS_CONNECTED)
{
if (odroid_netplay_mode() == NETPLAY_MODE_GUEST)
{
localJoystick = &joystick2;
remoteJoystick = &joystick1;
}
else
{
localJoystick = &joystick1;
remoteJoystick = &joystick2;
}
nes_reset(ZERO_RESET);
}
}
}
...
...
...
// This function is called every frame by the emulation loop
void osd_getinput(void)
{
...
...
...
odroid_input_gamepad_read(localJoystick);
if (netplay) {
odroid_netplay_send(localJoystick, sizeof *localJoystick);
}
...
...
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.