mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
Make SDL fullscreen optional
This commit is contained in:
@@ -59,6 +59,7 @@ static struct option long_options[] = {
|
||||
{"save", required_argument, NULL, 'q'},
|
||||
{"keydir", required_argument, NULL, 'r'},
|
||||
{"remote", no_argument, NULL, 's'},
|
||||
{"fullscreen", no_argument, NULL, 't'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
@@ -184,6 +185,8 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) {
|
||||
case 's':
|
||||
config->stream.streamingRemotely = 1;
|
||||
break;
|
||||
case 't':
|
||||
config->fullscreen = true;
|
||||
case 1:
|
||||
if (config->action == NULL)
|
||||
config->action = value;
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef struct _CONFIGURATION {
|
||||
char key_dir[4096];
|
||||
bool sops;
|
||||
bool localaudio;
|
||||
bool fullscreen;
|
||||
struct input_config inputs[MAX_INPUTS];
|
||||
int inputsCount;
|
||||
} CONFIGURATION, *PCONFIGURATION;
|
||||
|
||||
13
src/main.c
13
src/main.c
@@ -21,6 +21,7 @@
|
||||
#include "client.h"
|
||||
#include "connection.h"
|
||||
#include "audio.h"
|
||||
#include "video.h"
|
||||
#include "discover.h"
|
||||
#include "config.h"
|
||||
#include "platform.h"
|
||||
@@ -89,7 +90,11 @@ static void stream(PSERVER_DATA server, PCONFIGURATION config, enum platform sys
|
||||
context = sdl_window;
|
||||
#endif
|
||||
|
||||
LiStartConnection(server->address, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), context, 0, server->serverMajorVersion);
|
||||
int drFlags = 0;
|
||||
if (config->fullscreen)
|
||||
drFlags |= DISPLAY_FULLSCREEN;
|
||||
|
||||
LiStartConnection(server->address, &config->stream, &connection_callbacks, platform_get_video(system), platform_get_audio(system), context, drFlags, server->serverMajorVersion);
|
||||
|
||||
if (IS_EMBEDDED(system)) {
|
||||
evdev_start();
|
||||
@@ -131,6 +136,10 @@ static void help() {
|
||||
printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n");
|
||||
printf("\t-localaudio\t\tPlay audio locally\n");
|
||||
printf("\t-keydir <directory>\tLoad encryption keys from directory\n");
|
||||
#ifdef HAVE_SDL
|
||||
printf("\n Video options (SDL Only)\n\n");
|
||||
printf("\t-fullscreen\t\tMake window fullscreen\n");
|
||||
#endif
|
||||
#ifdef HAVE_EMBEDDED
|
||||
printf("\n I/O options\n\n");
|
||||
printf("\t-mapping <file>\t\tUse <file> as gamepad mapping configuration file (use before -input)\n");
|
||||
@@ -224,7 +233,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
#ifdef HAVE_SDL
|
||||
else if (system == SDL)
|
||||
sdl_init(config.stream.width, config.stream.height);
|
||||
sdl_init(config.stream.width, config.stream.height, config.fullscreen);
|
||||
#endif
|
||||
|
||||
stream(&server, &config, system);
|
||||
|
||||
@@ -24,19 +24,18 @@
|
||||
|
||||
#include "limelight-common/Limelight.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
static bool done;
|
||||
static int fullscreen_flags = SDL_WINDOW_FULLSCREEN;
|
||||
static int fullscreen_flags;
|
||||
|
||||
SDL_Window *sdl_window;
|
||||
|
||||
void sdl_init(int width, int height) {
|
||||
void sdl_init(int width, int height, bool fullscreen) {
|
||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) {
|
||||
fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fullscreen_flags = fullscreen?SDL_WINDOW_FULLSCREEN:0;
|
||||
sdlinput_init();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define SDL_NOTHING 0
|
||||
#define SDL_QUIT_APPLICATION 1
|
||||
#define SDL_MOUSE_GRAB 2
|
||||
@@ -29,7 +31,7 @@
|
||||
|
||||
SDL_Window *sdl_window;
|
||||
|
||||
void sdl_init(int width, int height);
|
||||
void sdl_init(int width, int height, bool fullscreen);
|
||||
void sdl_loop();
|
||||
|
||||
#endif /* HAVE_SDL */
|
||||
|
||||
20
src/video.h
Normal file
20
src/video.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* This file is part of Moonlight Embedded.
|
||||
*
|
||||
* Copyright (C) 2015 Iwan Timmer
|
||||
*
|
||||
* Moonlight 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 Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Moonlight 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 Moonlight; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define DISPLAY_FULLSCREEN 1
|
||||
@@ -17,6 +17,7 @@
|
||||
* along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../video.h"
|
||||
#include "ffmpeg.h"
|
||||
|
||||
#include "limelight-common/Limelight.h"
|
||||
@@ -32,6 +33,8 @@ static SDL_Texture *bmp = NULL;
|
||||
static int screen_width, screen_height;
|
||||
static char* ffmpeg_buffer;
|
||||
|
||||
static bool fullscreen;
|
||||
|
||||
static void sdl_setup(int width, int height, int redrawRate, void* context, int drFlags) {
|
||||
int avc_flags = FAST_BILINEAR_FILTERING;
|
||||
if (ffmpeg_init(width, height, 2, avc_flags) < 0) {
|
||||
@@ -45,6 +48,7 @@ static void sdl_setup(int width, int height, int redrawRate, void* context, int
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fullscreen = drFlags & DISPLAY_FULLSCREEN == DISPLAY_FULLSCREEN);
|
||||
screen_width = width;
|
||||
screen_height = height;
|
||||
}
|
||||
@@ -55,7 +59,7 @@ static void sdl_cleanup() {
|
||||
|
||||
static int sdl_submit_decode_unit(PDECODE_UNIT decodeUnit) {
|
||||
if (window == NULL) {
|
||||
window = SDL_CreateWindow("Moonlight", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen_width, screen_height, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
|
||||
window = SDL_CreateWindow("Moonlight", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen_width, screen_height, SDL_WINDOW_OPENGL | (fullscreen?SDL_WINDOW_FULLSCREEN:0));
|
||||
if(!window) {
|
||||
fprintf(stderr, "SDL: could not create window - exiting\n");
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user