all repos — mgba @ a094024ad51cc8328fc16b6a72a78bd589a71f80

mGBA Game Boy Advance Emulator

Add missing files
Jeffrey Pfau jeffrey@endrift.com
Sat, 20 Apr 2013 18:08:52 -0700
commit

a094024ad51cc8328fc16b6a72a78bd589a71f80

parent

67d25794e1a8b04269742b0d46da927eef30f008

3 files changed, 61 insertions(+), 1 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -3,10 +3,12 @@ project(GBAc)

set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra") file(GLOB ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c) file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c) +file(GLOB RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/*.c) file(GLOB DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/*.c) file(GLOB THIRD_PARTY ${CMAKE_SOURCE_DIR}/third-party/linenoise/linenoise.c) include_directories(${CMAKE_SOURCE_DIR}/src/arm) include_directories(${CMAKE_SOURCE_DIR}/src/gba) include_directories(${CMAKE_SOURCE_DIR}/src/debugger) include_directories(${CMAKE_SOURCE_DIR}/third-party/linenoise) -add_executable(gbac ${ARM_SRC} ${GBA_SRC} ${DEBUGGER_SRC} ${THIRD_PARTY} ${CMAKE_SOURCE_DIR}/src/main.c) +add_executable(gbac ${ARM_SRC} ${GBA_SRC} ${DEBUGGER_SRC} ${RENDERER_SRC} ${THIRD_PARTY} ${CMAKE_SOURCE_DIR}/src/main.c) +target_link_libraries(gbac m pthread)
A src/gba/renderers/video-software.c

@@ -0,0 +1,38 @@

+#include "video-software.h" + +#include "gba.h" + +static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer); +static void GBAVideoSoftwareRendererDeinit(struct GBAVideoRenderer* renderer); +static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value); +static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* renderer, int y); +static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* renderer); + +void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer) { + renderer->d.init = GBAVideoSoftwareRendererInit; + renderer->d.deinit = GBAVideoSoftwareRendererDeinit; + renderer->d.writeVideoRegister = GBAVideoSoftwareRendererWriteVideoRegister; + renderer->d.drawScanline = GBAVideoSoftwareRendererDrawScanline; + renderer->d.finishFrame = GBAVideoSoftwareRendererFinishFrame; +} + +static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer) { + struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; +} + +static void GBAVideoSoftwareRendererDeinit(struct GBAVideoRenderer* renderer) { + struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; +} + +static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) { + struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; + return value; +} + +static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* renderer, int y) { + struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; +} + +static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* renderer) { + struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; +}
A src/gba/renderers/video-software.h

@@ -0,0 +1,20 @@

+#ifndef VIDEO_SOFTWARE_H +#define VIDEO_SOFTWARE_H + +#include "gba-video.h" + +#include <pthread.h> + +struct GBAVideoSoftwareRenderer { + struct GBAVideoRenderer d; + + uint16_t* outputBuffer; + unsigned outputBufferStride; + + pthread_mutex_t mutex; + pthread_cond_t cond; +}; + +void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer); + +#endif