2012-04-03 17:19:18 +00:00
|
|
|
/* SSNES - A frontend for libretro.
|
2012-01-08 00:08:18 +00:00
|
|
|
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
2011-02-13 15:40:24 +00:00
|
|
|
*
|
|
|
|
* SSNES is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with SSNES.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __SSNES_NETPLAY_H
|
|
|
|
#define __SSNES_NETPLAY_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2012-04-05 09:47:43 +00:00
|
|
|
#include <stddef.h>
|
2011-12-24 12:46:12 +00:00
|
|
|
#include "boolean.h"
|
2012-04-05 09:47:43 +00:00
|
|
|
#include "libretro.h"
|
2011-02-13 15:40:24 +00:00
|
|
|
|
|
|
|
void input_poll_net(void);
|
2012-04-05 09:47:43 +00:00
|
|
|
int16_t input_state_net(unsigned port, unsigned device, unsigned index, unsigned id);
|
2012-04-07 09:55:37 +00:00
|
|
|
void video_frame_net(const void *data, unsigned width, unsigned height, size_t pitch);
|
2012-04-05 09:47:43 +00:00
|
|
|
void audio_sample_net(int16_t left, int16_t right);
|
2012-04-07 09:55:37 +00:00
|
|
|
size_t audio_sample_batch_net(const int16_t *data, size_t frames);
|
2011-02-13 15:40:24 +00:00
|
|
|
|
2012-04-05 09:47:43 +00:00
|
|
|
int16_t input_state_spectate(unsigned port, unsigned device, unsigned index, unsigned id);
|
|
|
|
int16_t input_state_spectate_client(unsigned port, unsigned device, unsigned index, unsigned id);
|
2012-01-11 18:22:18 +00:00
|
|
|
|
2011-02-13 15:40:24 +00:00
|
|
|
typedef struct netplay netplay_t;
|
|
|
|
|
2012-04-05 09:47:43 +00:00
|
|
|
struct retro_callbacks
|
2011-02-13 15:40:24 +00:00
|
|
|
{
|
2012-04-05 09:47:43 +00:00
|
|
|
retro_video_refresh_t frame_cb;
|
|
|
|
retro_audio_sample_t sample_cb;
|
|
|
|
retro_audio_sample_batch_t sample_batch_cb;
|
|
|
|
retro_input_state_t state_cb;
|
2011-02-13 15:40:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Creates a new netplay handle. A NULL host means we're hosting (player 1). :)
|
2012-01-21 13:00:11 +00:00
|
|
|
netplay_t *netplay_new(const char *server,
|
|
|
|
uint16_t port, unsigned frames,
|
2012-04-05 09:47:43 +00:00
|
|
|
const struct retro_callbacks *cb, bool spectate,
|
2012-01-21 17:12:42 +00:00
|
|
|
const char *nick);
|
2011-02-13 15:40:24 +00:00
|
|
|
void netplay_free(netplay_t *handle);
|
|
|
|
|
2012-01-21 13:00:11 +00:00
|
|
|
// On regular netplay, flip who controls player 1 and 2.
|
|
|
|
void netplay_flip_players(netplay_t *handle);
|
|
|
|
|
2011-02-14 15:10:53 +00:00
|
|
|
// Call this before running snes_run()
|
|
|
|
void netplay_pre_frame(netplay_t *handle);
|
|
|
|
// Call this after running snes_run()
|
|
|
|
void netplay_post_frame(netplay_t *handle);
|
|
|
|
|
2011-02-13 15:40:24 +00:00
|
|
|
#endif
|