src_x = graphic_info[i].src_x;
src_y = graphic_info[i].src_y;
+ if (program.headless)
+ continue;
+
if (src_x < 0 || src_y < 0 ||
src_x + width > src_bitmap_width ||
src_y + height > src_bitmap_height)
while (*str_ptr != ' ' && *str_ptr != '\t' && *str_ptr != '\0')
str_ptr++;
}
+
+ if (global.autoplay_mode == AUTOPLAY_MODE_TEST)
+ program.headless = TRUE;
}
else if (strPrefix(command, "convert "))
{
static void InitArtworkDone()
{
+ if (program.headless)
+ return;
+
InitGlobalAnimations();
}
#if defined(TARGET_SDL2)
static SDL_Texture *SDLCreateTextureFromSurface(SDL_Surface *surface)
{
+ if (program.headless)
+ return NULL;
+
SDL_Texture *texture = SDL_CreateTextureFromSurface(sdl_renderer, surface);
if (texture == NULL)
#endif
}
-void SDLInitVideoBuffer(boolean fullscreen)
+inline static void SDLInitVideoBuffer_VideoBuffer(boolean fullscreen)
{
+ if (program.headless)
+ return;
+
video.window_scaling_percent = setup.window_scaling_percent;
video.window_scaling_quality = setup.window_scaling_quality;
#else
SDL_WM_SetCaption(program.window_title, program.window_title);
#endif
+}
+inline static void SDLInitVideoBuffer_DrawBuffer()
+{
/* SDL cannot directly draw to the visible video framebuffer like X11,
but always uses a backbuffer, which is then blitted to the visible
video framebuffer with 'SDL_UpdateRect' (or replaced with the current
/* create additional (symbolic) buffer for double-buffering */
ReCreateBitmap(&window, video.width, video.height);
+
+ /* create dummy drawing buffer for headless mode, if needed */
+ if (program.headless)
+ ReCreateBitmap(&backbuffer, video.width, video.height);
+}
+
+void SDLInitVideoBuffer(boolean fullscreen)
+{
+ SDLInitVideoBuffer_VideoBuffer(fullscreen);
+ SDLInitVideoBuffer_DrawBuffer();
}
static boolean SDLCreateScreen(boolean fullscreen)
void SDLCreateBitmapContent(Bitmap *bitmap, int width, int height,
int depth)
{
+ if (program.headless)
+ return;
+
SDL_Surface *surface =
SDL_CreateRGBSurface(SURFACE_FLAGS, width, height, depth, 0,0,0, 0);
Bitmap *new_bitmap = CreateBitmapStruct();
SDL_Surface *sdl_image_tmp;
+ if (program.headless)
+ {
+ /* prevent sanity check warnings at later stage */
+ new_bitmap->width = new_bitmap->height = 1;
+
+ return new_bitmap;
+ }
+
print_timestamp_init("SDLLoadImage");
print_timestamp_time(getBaseNamePtr(filename));
void SDLOpenAudio(void)
{
+ if (program.headless)
+ return;
+
#if !defined(TARGET_SDL2)
if (!strEqual(setup.system.sdl_audiodriver, ARG_DEFAULT))
SDL_putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver));
program.log_filename[LOG_ERR_ID] = getLogFilename(LOG_ERR_BASENAME);
program.log_file[LOG_OUT_ID] = program.log_file_default[LOG_OUT_ID] = stdout;
program.log_file[LOG_ERR_ID] = program.log_file_default[LOG_ERR_ID] = stderr;
+
+ program.headless = FALSE;
}
void InitScoresInfo()
void InitVideoDisplay(void)
{
+ if (program.headless)
+ return;
+
SDLInitVideoDisplay();
#if defined(TARGET_SDL2)
SDLSetDisplaySize();
int dst_x_unclipped = dst_x;
int dst_y_unclipped = dst_y;
+ if (program.headless)
+ return;
+
if (src_bitmap == NULL || dst_bitmap == NULL)
return;