all repos — mgba @ ad38ae63ec3615da4a9e485affe38b7371bf47ea

mGBA Game Boy Advance Emulator

Properly support 16-bit color
Jeffrey Pfau jeffrey@endrift.com
Sun, 02 Feb 2014 02:47:50 -0800
commit

ad38ae63ec3615da4a9e485affe38b7371bf47ea

parent

02aec4fc6573661573912c501717cfce03aed24f

3 files changed, 19 insertions(+), 3 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -30,6 +30,13 @@ file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/posix/*.c)

source_group("POSIX-specific code" FILES ${OS_SRC}) endif() +if(BUILD_BBB OR BUILD_RASPI) + enable_language(ASM) + if(NOT BUILD_EGL) + add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5) + endif() +endif() + set(DEBUGGER_SRC "${CMAKE_SOURCE_DIR}/src/debugger/debugger.c;${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c") if(USE_CLI_DEBUGGER)
M src/platform/sdl/CMakeLists.txtsrc/platform/sdl/CMakeLists.txt

@@ -24,8 +24,6 @@ set(OPENGL_LIBRARY "-lEGL -lGLESv2 -lbcm_host")

set(OPENGL_INCLUDE_DIR "") add_definitions(-DBUILD_RASPI) elseif(BUILD_BBB OR BUILD_RASPI) - enable_language(ASM) - add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5) set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-main.c) else() set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-main.c)
M src/platform/sdl/gl-main.csrc/platform/sdl/gl-main.c

@@ -113,10 +113,21 @@ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

#else SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); #endif + +#ifndef COLOR_16_BIT SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); +#else + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); +#ifdef COLOR_5_6_5 + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); +#else + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); +#endif + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); +#endif + #if SDL_VERSION_ATLEAST(2, 0, 0) renderer->window = SDL_CreateWindow("GBAc", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, renderer->viewportWidth, renderer->viewportHeight, SDL_WINDOW_OPENGL); SDL_GL_CreateContext(renderer->window);