mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Add more verbose messages, should fix netplay hangup on Win32.
This commit is contained in:
parent
bbf4804d12
commit
7053006e77
4
gfx/gl.c
4
gfx/gl.c
@ -24,6 +24,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -474,8 +475,10 @@ static void* gl_init(video_info_t *video, const input_driver_t **input, void **i
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const SDL_VideoInfo *video_info = SDL_GetVideoInfo();
|
const SDL_VideoInfo *video_info = SDL_GetVideoInfo();
|
||||||
|
assert(video_info);
|
||||||
unsigned full_x = video_info->current_w;
|
unsigned full_x = video_info->current_w;
|
||||||
unsigned full_y = video_info->current_h;
|
unsigned full_y = video_info->current_h;
|
||||||
|
SSNES_LOG("Detecting desktop resolution %ux%u.\n", full_x, full_y);
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video->vsync ? 1 : 0);
|
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video->vsync ? 1 : 0);
|
||||||
@ -510,6 +513,7 @@ static void* gl_init(video_info_t *video, const input_driver_t **input, void **i
|
|||||||
gl->win_width = video->width;
|
gl->win_width = video->width;
|
||||||
gl->win_height = video->height;
|
gl->win_height = video->height;
|
||||||
}
|
}
|
||||||
|
SSNES_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
|
||||||
|
|
||||||
gl->vsync = video->vsync;
|
gl->vsync = video->vsync;
|
||||||
gl->keep_aspect = video->force_aspect;
|
gl->keep_aspect = video->force_aspect;
|
||||||
|
26
netplay.c
26
netplay.c
@ -408,25 +408,33 @@ static bool send_chunk(netplay_t *handle)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_RETRIES 16
|
#define MAX_RETRIES 64
|
||||||
|
#define RETRY_MS 500
|
||||||
|
|
||||||
static int poll_input(netplay_t *handle, bool block)
|
static int poll_input(netplay_t *handle, bool block)
|
||||||
{
|
{
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(handle->udp_fd, &fds);
|
FD_SET(handle->udp_fd, &fds);
|
||||||
|
FD_SET(handle->fd, &fds);
|
||||||
|
int max_fd = (handle->fd > handle->udp_fd ? handle->fd : handle->udp_fd) + 1;
|
||||||
|
|
||||||
struct timeval tv = {
|
struct timeval tv = {
|
||||||
.tv_sec = 0,
|
.tv_sec = 0,
|
||||||
.tv_usec = block ? 500000 : 0
|
.tv_usec = block ? (RETRY_MS * 1000) : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (select(handle->udp_fd + 1, &fds, NULL, NULL, &tv) < 0)
|
if (select(max_fd, &fds, NULL, NULL, &tv) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
// Somewhat hacky, but we aren't using the TCP connection for anything useful atm.
|
||||||
|
// Will probably add some proper messaging system here later.
|
||||||
|
if (FD_ISSET(handle->fd, &fds))
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (FD_ISSET(handle->udp_fd, &fds))
|
if (FD_ISSET(handle->udp_fd, &fds))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -434,10 +442,18 @@ static int poll_input(netplay_t *handle, bool block)
|
|||||||
{
|
{
|
||||||
SSNES_WARN("Netplay connection hung up. Will continue without netplay.\n");
|
SSNES_WARN("Netplay connection hung up. Will continue without netplay.\n");
|
||||||
handle->has_connection = false;
|
handle->has_connection = false;
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (i++ < MAX_RETRIES && block);
|
if (block)
|
||||||
|
SSNES_LOG("Network lag of %d ms, resending packet... Attempt %d of %d ...\n", RETRY_MS, i, MAX_RETRIES);
|
||||||
|
|
||||||
|
// Seems to be necessary on Win32.
|
||||||
|
FD_ZERO(&fds);
|
||||||
|
FD_SET(handle->udp_fd, &fds);
|
||||||
|
FD_SET(handle->fd, &fds);
|
||||||
|
|
||||||
|
} while ((i++ < MAX_RETRIES) && block);
|
||||||
|
|
||||||
if (block)
|
if (block)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user