All: Remove unmaintained RasPi and Pandora code

This commit is contained in:
Vicki Pfau 2024-04-22 03:34:55 -07:00
parent 267167a236
commit d5e49a5981
9 changed files with 12 additions and 336 deletions

View File

@ -269,20 +269,6 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf")
endif()
if(BUILD_BBB OR BUILD_RASPI OR BUILD_PANDORA)
if(NOT BUILD_EGL)
add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5)
endif()
endif()
if(BUILD_RASPI)
set(BUILD_GL OFF CACHE BOOL "OpenGL not supported" FORCE)
endif()
if(BUILD_PANDORA)
add_definitions(-DBUILD_PANDORA)
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*")
enable_language(ASM)
endif()

View File

@ -80,37 +80,19 @@ set(SDLMAIN_LIBRARY "${SDLMAIN_LIBRARY}" PARENT_SCOPE)
set(MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/main.c)
if(BUILD_RASPI)
add_definitions(-DBUILD_RASPI)
list(APPEND PLATFORM_SRC ${PROJECT_SOURCE_DIR}/src/platform/opengl/gles2.c ${CMAKE_CURRENT_SOURCE_DIR}/gl-common.c ${CMAKE_CURRENT_SOURCE_DIR}/rpi-common.c)
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gles2-sdl.c)
set(OPENGLES2_LIBRARY "-lEGL -lGLESv2 -lbcm_host")
set(BUILD_GLES2 ON CACHE BOOL "Using OpenGL|ES 2" FORCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fgnu89-inline")
add_executable(${BINARY_NAME}-rpi ${PLATFORM_SRC} ${MAIN_SRC})
set_target_properties(${BINARY_NAME}-rpi PROPERTIES COMPILE_DEFINITIONS "${FEATURE_DEFINES};${FUNCTION_DEFINES}")
target_link_libraries(${BINARY_NAME}-rpi ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OPENGLES2_LIBRARY})
install(TARGETS ${BINARY_NAME}-rpi DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-rpi)
unset(OPENGLES2_INCLUDE_DIR CACHE) # Clear NOTFOUND
if(BUILD_GL)
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gl-sdl.c)
list(APPEND PLATFORM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gl-common.c)
endif()
if(BUILD_PANDORA)
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/pandora-sdl.c)
if(BUILD_GLES2)
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gles2-sdl.c)
list(APPEND PLATFORM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gl-common.c)
include_directories(${OPENGLES2_INCLUDE_DIR})
endif()
if(SDL_VERSION EQUAL "2")
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sw-sdl2.c)
else()
if(BUILD_GL)
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gl-sdl.c)
list(APPEND PLATFORM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gl-common.c)
endif()
if(BUILD_GLES2)
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gles2-sdl.c)
list(APPEND PLATFORM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gl-common.c)
include_directories(${OPENGLES2_INCLUDE_DIR})
endif()
if(SDL_VERSION EQUAL "2")
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sw-sdl2.c)
else()
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sw-sdl1.c)
endif()
list(APPEND MAIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sw-sdl1.c)
endif()
if(ENABLE_SCRIPTING)

View File

@ -6,9 +6,6 @@
#include "main.h"
#include "gl-common.h"
#ifdef BUILD_RASPI
#include "rpi-common.h"
#endif
#include <mgba/core/core.h>
@ -43,11 +40,7 @@ bool mSDLGLES2Init(struct mSDLRenderer* renderer) {
renderer->gl2.d.lockAspectRatio = renderer->lockAspectRatio;
renderer->gl2.d.lockIntegerScaling = renderer->lockIntegerScaling;
renderer->gl2.d.filter = renderer->filter;
#ifdef BUILD_RASPI
renderer->gl2.d.swap = mRPIGLCommonSwap;
#else
renderer->gl2.d.swap = mSDLGLCommonSwap;
#endif
renderer->gl2.d.init(&renderer->gl2.d, 0);
struct mRectangle dims = {
@ -66,13 +59,7 @@ void mSDLGLES2Deinit(struct mSDLRenderer* renderer) {
if (renderer->gl2.d.deinit) {
renderer->gl2.d.deinit(&renderer->gl2.d);
}
#ifdef BUILD_RASPI
eglMakeCurrent(renderer->eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(renderer->eglDisplay, renderer->eglSurface);
eglDestroyContext(renderer->eglDisplay, renderer->eglContext);
eglTerminate(renderer->eglDisplay);
bcm_host_deinit();
#elif SDL_VERSION_ATLEAST(2, 0, 0)
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_GL_DeleteContext(renderer->glCtx);
#endif
free(renderer->outputBuffer);

View File

@ -133,11 +133,7 @@ int main(int argc, char** argv) {
mSDLGLCreate(&renderer);
} else
#elif defined(BUILD_GLES2) || defined(USE_EPOXY)
#ifdef BUILD_RASPI
mRPIGLCommonInit(&renderer);
#else
if (mSDLGLCommonInit(&renderer))
#endif
{
mSDLGLES2Create(&renderer);
} else

View File

@ -18,17 +18,6 @@ CXX_GUARD_START
#include "platform/opengl/gl.h"
#endif
#ifdef BUILD_RASPI
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#include <SDL/SDL.h>
#include <EGL/egl.h>
#include <bcm_host.h>
#pragma GCC diagnostic pop
#endif
#if defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
#include "gl-common.h"
#include "platform/opengl/gles2.h"
@ -82,19 +71,6 @@ struct mSDLRenderer {
pixman_image_t* pix;
pixman_image_t* screenpix;
#endif
#ifdef BUILD_RASPI
EGLDisplay eglDisplay;
EGLSurface eglSurface;
EGLContext eglContext;
EGL_DISPMANX_WINDOW_T eglWindow;
#endif
#ifdef BUILD_PANDORA
int fb;
int odd;
void* base[2];
#endif
};
void mSDLSWCreate(struct mSDLRenderer* renderer);

View File

@ -1,129 +0,0 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "main.h"
#include "gba/supervisor/thread.h"
#include <linux/omapfb.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#ifndef FBIO_WAITFORVSYNC
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
#endif
static bool mSDLInit(struct SDLSoftwareRenderer* renderer);
static void mSDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer);
static void mSDLDeinit(struct SDLSoftwareRenderer* renderer);
void mSDLGLCreate(struct SDLSoftwareRenderer* renderer) {
renderer->init = mSDLInit;
renderer->deinit = mSDLDeinit;
renderer->runloop = mSDLRunloop;
}
void mSDLSWCreate(struct SDLSoftwareRenderer* renderer) {
renderer->init = mSDLInit;
renderer->deinit = mSDLDeinit;
renderer->runloop = mSDLRunloop;
}
bool mSDLInit(struct SDLSoftwareRenderer* renderer) {
SDL_SetVideoMode(800, 480, 16, SDL_FULLSCREEN);
renderer->odd = 0;
renderer->fb = open("/dev/fb1", O_RDWR);
if (renderer->fb < 0) {
return false;
}
struct omapfb_plane_info plane;
struct omapfb_mem_info mem;
if (ioctl(renderer->fb, OMAPFB_QUERY_PLANE, &plane) < 0) {
return false;
}
if (ioctl(renderer->fb, OMAPFB_QUERY_MEM, &mem) < 0) {
return false;
}
if (plane.enabled) {
plane.enabled = 0;
ioctl(renderer->fb, OMAPFB_SETUP_PLANE, &plane);
}
mem.size = GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4;
ioctl(renderer->fb, OMAPFB_SETUP_MEM, &mem);
plane.enabled = 1;
plane.pos_x = 40;
plane.pos_y = 0;
plane.out_width = 720;
plane.out_height = 480;
ioctl(renderer->fb, OMAPFB_SETUP_PLANE, &plane);
struct fb_var_screeninfo info;
ioctl(renderer->fb, FBIOGET_VSCREENINFO, &info);
info.xres = GBA_VIDEO_HORIZONTAL_PIXELS;
info.yres = GBA_VIDEO_VERTICAL_PIXELS;
info.xres_virtual = GBA_VIDEO_HORIZONTAL_PIXELS;
info.yres_virtual = GBA_VIDEO_VERTICAL_PIXELS * 2;
info.bits_per_pixel = 16;
ioctl(renderer->fb, FBIOPUT_VSCREENINFO, &info);
renderer->odd = 0;
renderer->base[0] = mmap(0, GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4, PROT_READ | PROT_WRITE, MAP_SHARED, renderer->fb, 0);
renderer->base[1] = (uint16_t*) renderer->base[0] + GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS;
renderer->d.outputBuffer = renderer->base[0];
renderer->d.outputBufferStride = GBA_VIDEO_HORIZONTAL_PIXELS;
return true;
}
void mSDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer) {
SDL_Event event;
while (context->state < THREAD_EXITING) {
while (SDL_PollEvent(&event)) {
mSDLHandleEventGBA(context, &renderer->player, &event);
}
if (mCoreSyncWaitFrameStart(&context->sync)) {
struct fb_var_screeninfo info;
ioctl(renderer->fb, FBIOGET_VSCREENINFO, &info);
info.yoffset = GBA_VIDEO_VERTICAL_PIXELS * renderer->odd;
ioctl(renderer->fb, FBIOPAN_DISPLAY, &info);
int arg = 0;
ioctl(renderer->fb, FBIO_WAITFORVSYNC, &arg);
renderer->odd = !renderer->odd;
renderer->d.outputBuffer = renderer->base[renderer->odd];
}
mCoreSyncWaitFrameEnd(&context->sync);
}
}
void mSDLDeinit(struct SDLSoftwareRenderer* renderer) {
munmap(renderer->base[0], GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4);
struct omapfb_plane_info plane;
struct omapfb_mem_info mem;
ioctl(renderer->fb, OMAPFB_QUERY_PLANE, &plane);
ioctl(renderer->fb, OMAPFB_QUERY_MEM, &mem);
mem.size = 0;
ioctl(renderer->fb, OMAPFB_SETUP_MEM, &mem);
plane.enabled = 0;
plane.pos_x = 0;
plane.pos_y = 0;
plane.out_width = 0;
plane.out_height = 0;
ioctl(renderer->fb, OMAPFB_SETUP_PLANE, &plane);
close(renderer->fb);
}

View File

@ -1,84 +0,0 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "main.h"
#include <mgba/core/version.h>
void mRPIGLCommonSwap(struct VideoBackend* context) {
struct mSDLRenderer* renderer = (struct mSDLRenderer*) context->user;
eglSwapBuffers(renderer->eglDisplay, renderer->eglSurface);
}
void mRPIGLCommonInit(struct mSDLRenderer* renderer) {
bcm_host_init();
renderer->eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
int major, minor;
if (EGL_FALSE == eglInitialize(renderer->eglDisplay, &major, &minor)) {
printf("Failed to initialize EGL");
return false;
}
if (EGL_FALSE == eglBindAPI(EGL_OPENGL_ES_API)) {
printf("Failed to get GLES API");
return false;
}
const EGLint requestConfig[] = {
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 5,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 1,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
EGLConfig config;
EGLint numConfigs;
if (EGL_FALSE == eglChooseConfig(renderer->eglDisplay, requestConfig, &config, 1, &numConfigs)) {
printf("Failed to choose EGL config\n");
return false;
}
const EGLint contextAttributes[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
int dispWidth = 240, dispHeight = 160, adjWidth;
renderer->eglContext = eglCreateContext(renderer->eglDisplay, config, EGL_NO_CONTEXT, contextAttributes);
graphics_get_display_size(0, &dispWidth, &dispHeight);
adjWidth = dispHeight / 2 * 3;
DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open(0);
DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0);
VC_RECT_T destRect = {
.x = (dispWidth - adjWidth) / 2,
.y = 0,
.width = adjWidth,
.height = dispHeight
};
VC_RECT_T srcRect = {
.x = 0,
.y = 0,
.width = 240 << 16,
.height = 160 << 16
};
DISPMANX_ELEMENT_HANDLE_T element = vc_dispmanx_element_add(update, display, 0, &destRect, 0, &srcRect, DISPMANX_PROTECTION_NONE, 0, 0, 0);
vc_dispmanx_update_submit_sync(update);
renderer->eglWindow.element = element;
renderer->eglWindow.width = dispWidth;
renderer->eglWindow.height = dispHeight;
renderer->eglSurface = eglCreateWindowSurface(renderer->eglDisplay, config, &renderer->eglWindow, 0);
if (EGL_FALSE == eglMakeCurrent(renderer->eglDisplay, renderer->eglSurface, renderer->eglSurface, renderer->eglContext)) {
return false;
}
}

View File

@ -1,20 +0,0 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef SDL_RPI_COMMON_H
#define SDL_RPI_COMMON_H
#include <mgba-util/common.h>
CXX_GUARD_START
#include "main.h"
void mRPIGLCommonSwap(struct VideoBackend* context);
void mRPIGLCommonInit(struct mSDLRenderer* renderer);
CXX_GUARD_END
#endif

View File

@ -143,18 +143,6 @@ void mSDLEventsLoadConfig(struct mSDLEvents* context, const struct Configuration
}
void mSDLInitBindingsGBA(struct mInputMap* inputMap) {
#ifdef BUILD_PANDORA
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_PAGEDOWN, GBA_KEY_A);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_END, GBA_KEY_B);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RSHIFT, GBA_KEY_L);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RCTRL, GBA_KEY_R);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LALT, GBA_KEY_START);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LCTRL, GBA_KEY_SELECT);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_UP, GBA_KEY_UP);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_DOWN, GBA_KEY_DOWN);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LEFT, GBA_KEY_LEFT);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RIGHT, GBA_KEY_RIGHT);
#else
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_x, GBA_KEY_A);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_z, GBA_KEY_B);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_a, GBA_KEY_L);
@ -165,7 +153,6 @@ void mSDLInitBindingsGBA(struct mInputMap* inputMap) {
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_DOWN, GBA_KEY_DOWN);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LEFT, GBA_KEY_LEFT);
mInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RIGHT, GBA_KEY_RIGHT);
#endif
#if SDL_VERSION_ATLEAST(2, 0, 0)
mInputBindKey(inputMap, SDL_BINDING_CONTROLLER, SDL_CONTROLLER_BUTTON_A, GBA_KEY_A);
@ -522,11 +509,6 @@ static void _mSDLHandleKeypress(struct mCoreThread* context, struct mSDLPlayer*
context->frameCallback = _pauseAfterFrame;
mCoreThreadUnpause(context);
return;
#ifdef BUILD_PANDORA
case SDLK_ESCAPE:
mCoreThreadEnd(context);
return;
#endif
default:
if ((event->keysym.mod & GUI_MOD) && (event->keysym.mod & GUI_MOD) == event->keysym.mod) {
switch (event->keysym.sym) {