all repos — mgba @ 88212fc2deb72b3ab85313852b0b091edc88403b

mGBA Game Boy Advance Emulator

src/platform/sdl/main.h (view raw)

  1/* Copyright (c) 2013-2015 Jeffrey Pfau
  2 *
  3 * This Source Code Form is subject to the terms of the Mozilla Public
  4 * License, v. 2.0. If a copy of the MPL was not distributed with this
  5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6#ifndef SDL_MAIN_H
  7#define SDL_MAIN_H
  8
  9#include <mgba-util/common.h>
 10
 11CXX_GUARD_START
 12
 13#include "sdl-audio.h"
 14#include "sdl-events.h"
 15
 16#ifdef BUILD_GL
 17#include "gl-common.h"
 18#include "platform/opengl/gl.h"
 19#endif
 20
 21#ifdef BUILD_RASPI
 22#pragma GCC diagnostic push
 23#pragma GCC diagnostic ignored "-Wunused-function"
 24#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 25#include <SDL/SDL.h>
 26#include <EGL/egl.h>
 27
 28#include <bcm_host.h>
 29#pragma GCC diagnostic pop
 30#endif
 31
 32#if defined(BUILD_GLES2) || defined(USE_EPOXY)
 33#include "gl-common.h"
 34#include "platform/opengl/gles2.h"
 35#endif
 36
 37#ifdef USE_PIXMAN
 38#include <pixman.h>
 39#endif
 40
 41struct mCore;
 42struct mSDLRenderer {
 43	struct mCore* core;
 44	color_t* outputBuffer;
 45
 46	struct mSDLAudio audio;
 47	struct mSDLEvents events;
 48	struct mSDLPlayer player;
 49
 50	bool (*init)(struct mSDLRenderer* renderer);
 51	void (*runloop)(struct mSDLRenderer* renderer, void* user);
 52	void (*deinit)(struct mSDLRenderer* renderer);
 53
 54#if SDL_VERSION_ATLEAST(2, 0, 0)
 55	SDL_Window* window;
 56	SDL_Texture* sdlTex;
 57	SDL_Renderer* sdlRenderer;
 58	SDL_GLContext* glCtx;
 59#endif
 60
 61	unsigned width;
 62	unsigned height;
 63	int viewportWidth;
 64	int viewportHeight;
 65	int ratio;
 66
 67	bool lockAspectRatio;
 68	bool lockIntegerScaling;
 69	bool interframeBlending;
 70	bool filter;
 71
 72#ifdef BUILD_GL
 73	struct mGLContext gl;
 74#endif
 75#if defined(BUILD_GLES2) || defined(USE_EPOXY)
 76	struct mGLES2Context gl2;
 77#endif
 78
 79#ifdef USE_PIXMAN
 80	pixman_image_t* pix;
 81	pixman_image_t* screenpix;
 82#endif
 83
 84#ifdef BUILD_RASPI
 85	EGLDisplay eglDisplay;
 86	EGLSurface eglSurface;
 87	EGLContext eglContext;
 88	EGL_DISPMANX_WINDOW_T eglWindow;
 89#endif
 90
 91#ifdef BUILD_PANDORA
 92	int fb;
 93	int odd;
 94	void* base[2];
 95#endif
 96};
 97
 98void mSDLSWCreate(struct mSDLRenderer* renderer);
 99
100#ifdef BUILD_GL
101void mSDLGLCreate(struct mSDLRenderer* renderer);
102#endif
103
104#if defined(BUILD_GLES2) || defined(USE_EPOXY)
105void mSDLGLES2Create(struct mSDLRenderer* renderer);
106#endif
107
108CXX_GUARD_END
109
110#endif