RetroArch/netplay.h

71 lines
2.1 KiB
C
Raw Normal View History

2012-04-21 23:13:50 +02:00
/* RetroArch - A frontend for libretro.
2014-01-01 01:50:59 +01:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2015-01-07 17:46:50 +01:00
* Copyright (C) 2011-2015 - Daniel De Matteis
2011-02-13 16:40:24 +01:00
*
2012-04-21 23:13:50 +02:00
* RetroArch is free software: you can redistribute it and/or modify it under the terms
2011-02-13 16:40:24 +01:00
* 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.
*
2012-04-21 23:13:50 +02:00
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
2011-02-13 16:40:24 +01:00
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
2012-04-21 23:31:57 +02:00
* You should have received a copy of the GNU General Public License along with RetroArch.
2011-02-13 16:40:24 +01:00
* If not, see <http://www.gnu.org/licenses/>.
*/
2012-04-21 23:25:32 +02:00
#ifndef __RARCH_NETPLAY_H
#define __RARCH_NETPLAY_H
2011-02-13 16:40:24 +01:00
#include <stdint.h>
2012-04-05 11:47:43 +02:00
#include <stddef.h>
#include <boolean.h>
2012-04-05 11:47:43 +02:00
#include "libretro.h"
#include "retro.h"
2011-02-13 16:40:24 +01:00
void input_poll_net(void);
2014-09-07 05:47:18 +02:00
int16_t input_state_net(unsigned port, unsigned device,
2014-10-20 19:29:49 +02:00
unsigned idx, unsigned id);
2014-09-07 05:47:18 +02:00
void video_frame_net(const void *data, unsigned width,
unsigned height, size_t pitch);
2012-04-05 11:47:43 +02:00
void audio_sample_net(int16_t left, int16_t right);
2014-09-07 05:47:18 +02:00
2012-04-07 11:55:37 +02:00
size_t audio_sample_batch_net(const int16_t *data, size_t frames);
2011-02-13 16:40:24 +01:00
2014-09-07 05:47:18 +02:00
int16_t input_state_spectate(unsigned port, unsigned device,
2014-10-20 19:29:49 +02:00
unsigned idx, unsigned id);
2014-09-07 05:47:18 +02:00
int16_t input_state_spectate_client(unsigned port, unsigned device,
2014-10-20 19:29:49 +02:00
unsigned idx, unsigned id);
2012-01-11 19:22:18 +01:00
2011-02-13 16:40:24 +01:00
typedef struct netplay netplay_t;
bool network_init(void);
void network_deinit(void);
2012-06-01 15:20:53 +02:00
2014-09-07 05:47:18 +02:00
/* Creates a new netplay handle. A NULL host means we're
2014-12-05 13:48:54 +01:00
* hosting (user 1). :) */
2012-01-21 14:00:11 +01:00
netplay_t *netplay_new(const char *server,
uint16_t port, unsigned frames,
2012-04-05 11:47:43 +02:00
const struct retro_callbacks *cb, bool spectate,
2012-01-21 18:12:42 +01:00
const char *nick);
2014-09-07 05:47:18 +02:00
2011-02-13 16:40:24 +01:00
void netplay_free(netplay_t *handle);
2014-12-05 13:48:54 +01:00
/* On regular netplay, flip who controls user 1 and 2. */
void netplay_flip_users(netplay_t *handle);
2012-01-21 14:00:11 +01:00
2014-09-07 05:47:18 +02:00
/* Call this before running retro_run(). */
void netplay_pre_frame(netplay_t *handle);
2014-09-07 05:47:18 +02:00
/* Call this after running retro_run(). */
void netplay_post_frame(netplay_t *handle);
2011-02-13 16:40:24 +01:00
#endif