GBA: Separate out subcomponents to enable easier exclusion

This commit is contained in:
Jeffrey Pfau 2015-08-28 23:45:24 -07:00
parent 97447ffa40
commit 99f7e5f035
32 changed files with 48 additions and 34 deletions

View File

@ -29,6 +29,7 @@ file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c)
file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c) file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c)
file(GLOB GBA_RR_SRC ${CMAKE_SOURCE_DIR}/src/gba/rr/*.c) file(GLOB GBA_RR_SRC ${CMAKE_SOURCE_DIR}/src/gba/rr/*.c)
file(GLOB GBA_SV_SRC ${CMAKE_SOURCE_DIR}/src/gba/supervisor/*.c) file(GLOB GBA_SV_SRC ${CMAKE_SOURCE_DIR}/src/gba/supervisor/*.c)
file(GLOB GBA_CTX_SRC ${CMAKE_SOURCE_DIR}/src/gba/context/*.c)
file(GLOB UTIL_SRC ${CMAKE_SOURCE_DIR}/src/util/*.[cSs]) file(GLOB UTIL_SRC ${CMAKE_SOURCE_DIR}/src/util/*.[cSs])
file(GLOB GUI_SRC ${CMAKE_SOURCE_DIR}/src/util/gui/*.c) file(GLOB GUI_SRC ${CMAKE_SOURCE_DIR}/src/util/gui/*.c)
file(GLOB RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/*.c) file(GLOB RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/*.c)
@ -38,7 +39,7 @@ list(APPEND UTIL_SRC ${CMAKE_SOURCE_DIR}/src/platform/commandline.c)
set(VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-mem.c) set(VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-mem.c)
source_group("ARM core" FILES ${ARM_SRC}) source_group("ARM core" FILES ${ARM_SRC})
source_group("GBA board" FILES ${GBA_SRC} ${RENDERER_SRC} ${SIO_SRC}) source_group("GBA board" FILES ${GBA_SRC} ${RENDERER_SRC} ${SIO_SRC})
source_group("GBA supervisor" FILES ${GBA_CHEATS_SRC} ${GBA_SV_SRC} ${GBA_RR_SRC}) source_group("GBA extra" FILES ${GBA_CHEATS_SRC} ${GBA_CTX_SRC} ${GBA_SV_SRC} ${GBA_RR_SRC})
source_group("Utilities" FILES ${UTIL_SRC}) source_group("Utilities" FILES ${UTIL_SRC})
include_directories(${CMAKE_SOURCE_DIR}/src/arm) include_directories(${CMAKE_SOURCE_DIR}/src/arm)
include_directories(${CMAKE_SOURCE_DIR}/src) include_directories(${CMAKE_SOURCE_DIR}/src)
@ -415,7 +416,7 @@ set(CORE_SRC
${ARM_SRC} ${ARM_SRC}
${GBA_SRC} ${GBA_SRC}
${GBA_CHEATS_SRC} ${GBA_CHEATS_SRC}
${GBA_SV_SRC} ${GBA_CTX_SRC}
${DEBUGGER_SRC} ${DEBUGGER_SRC}
${RENDERER_SRC} ${RENDERER_SRC}
${UTIL_SRC} ${UTIL_SRC}
@ -427,6 +428,7 @@ if(NOT MINIMAL_CORE)
set(SRC set(SRC
${CORE_SRC} ${CORE_SRC}
${GBA_RR_SRC} ${GBA_RR_SRC}
${GBA_SV_SRC}
${SIO_SRC} ${SIO_SRC}
${FEATURE_SRC}) ${FEATURE_SRC})
else() else()

View File

@ -3,9 +3,9 @@
* This Source Code Form is subject to the terms of the Mozilla Public * 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gba/supervisor/context.h" #include "gba/context/context.h"
#include "gba/supervisor/overrides.h" #include "gba/context/overrides.h"
#include "util/memory.h" #include "util/memory.h"
#include "util/vfs.h" #include "util/vfs.h"

View File

@ -8,7 +8,7 @@
#include "util/common.h" #include "util/common.h"
#include "gba/supervisor/config.h" #include "gba/context/config.h"
#include "gba/input.h" #include "gba/input.h"
struct GBAContext { struct GBAContext {

View File

@ -3,7 +3,7 @@
* This Source Code Form is subject to the terms of the Mozilla Public * 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "thread.h" #include "sync.h"
static void _changeVideoSync(struct GBASync* sync, bool frameOn) { static void _changeVideoSync(struct GBASync* sync, bool frameOn) {
// Make sure the video thread can process events while the GBA thread is paused // Make sure the video thread can process events while the GBA thread is paused

View File

@ -8,7 +8,7 @@
#include "gba/bios.h" #include "gba/bios.h"
#include "gba/cheats.h" #include "gba/cheats.h"
#include "gba/io.h" #include "gba/io.h"
#include "gba/supervisor/rr.h" #include "gba/rr/rr.h"
#include "gba/supervisor/thread.h" #include "gba/supervisor/thread.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/sio.h" #include "gba/sio.h"
@ -864,6 +864,12 @@ void GBAClearBreakpoint(struct GBA* gba, uint32_t address, enum ExecutionMode mo
} }
} }
#if (!defined(USE_PTHREADS) && !defined(_WIN32)) || defined(DISABLE_THREADING)
struct GBAThread* GBAThreadGetContext(void) {
return 0;
}
#endif
static bool _setSoftwareBreakpoint(struct ARMDebugger* debugger, uint32_t address, enum ExecutionMode mode, uint32_t* opcode) { static bool _setSoftwareBreakpoint(struct ARMDebugger* debugger, uint32_t address, enum ExecutionMode mode, uint32_t* opcode) {
GBASetBreakpoint((struct GBA*) debugger->cpu->master, &debugger->d, address, mode, opcode); GBASetBreakpoint((struct GBA*) debugger->cpu->master, &debugger->d, address, mode, opcode);
return true; return true;

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "io.h" #include "io.h"
#include "gba/supervisor/rr.h" #include "gba/rr/rr.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/sio.h" #include "gba/sio.h"
#include "gba/video.h" #include "gba/video.h"

View File

@ -8,7 +8,7 @@
#include "util/common.h" #include "util/common.h"
#include "gba/supervisor/rr.h" #include "gba/rr/rr.h"
struct GBA; struct GBA;
struct VDir; struct VDir;

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "util/common.h" #include "util/common.h"
#include "gba/supervisor/rr.h" #include "gba/rr/rr.h"
struct GBAVBMContext { struct GBAVBMContext {
struct GBARRContext d; struct GBARRContext d;

View File

@ -7,7 +7,7 @@
#include "gba/audio.h" #include "gba/audio.h"
#include "gba/io.h" #include "gba/io.h"
#include "gba/supervisor/rr.h" #include "gba/rr/rr.h"
#include "gba/supervisor/thread.h" #include "gba/supervisor/thread.h"
#include "gba/video.h" #include "gba/video.h"

View File

@ -9,7 +9,7 @@
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/cheats.h" #include "gba/cheats.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/supervisor/config.h" #include "gba/context/config.h"
#include "gba/rr/mgm.h" #include "gba/rr/mgm.h"
#include "gba/rr/vbm.h" #include "gba/rr/vbm.h"
@ -752,10 +752,6 @@ struct GBAThread* GBAThreadGetContext(void) {
InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0);
return TlsGetValue(_contextKey); return TlsGetValue(_contextKey);
} }
#else
struct GBAThread* GBAThreadGetContext(void) {
return 0;
}
#endif #endif
#ifdef USE_PNG #ifdef USE_PNG

View File

@ -10,8 +10,8 @@
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/input.h" #include "gba/input.h"
#include "gba/supervisor/overrides.h" #include "gba/context/overrides.h"
#include "gba/supervisor/sync.h" #include "gba/context/sync.h"
#include "util/threading.h" #include "util/threading.h"

View File

@ -5,11 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "video.h" #include "video.h"
#include "gba/context/sync.h"
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/io.h" #include "gba/io.h"
#include "gba/rr/rr.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/supervisor/rr.h"
#include "gba/supervisor/sync.h"
#include "util/memory.h" #include "util/memory.h"

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "gba/supervisor/context.h" #include "gba/context/context.h"
#include "gba/video.h" #include "gba/video.h"
#include "util/gui.h" #include "util/gui.h"
#include "util/gui/file-select.h" #include "util/gui/file-select.h"
@ -121,6 +121,12 @@ int main() {
if (!GBAContextStart(&context)) { if (!GBAContextStart(&context)) {
continue; continue;
} }
#if RESAMPLE_LIBRARY == RESAMPLE_BLIP_BUF
blip_set_rates(context.gba->audio.left, GBA_ARM7TDMI_FREQUENCY, 48000);
blip_set_rates(context.gba->audio.right, GBA_ARM7TDMI_FREQUENCY, 48000);
#endif
while (aptMainLoop()) { while (aptMainLoop()) {
hidScanInput(); hidScanInput();
int activeKeys = hidKeysHeld() & 0x3FF; int activeKeys = hidKeysHeld() & 0x3FF;
@ -130,6 +136,10 @@ int main() {
GBAContextFrame(&context, activeKeys); GBAContextFrame(&context, activeKeys);
GX_SetDisplayTransfer(0, renderer.outputBuffer, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS), tex->data, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS), 0x000002202); GX_SetDisplayTransfer(0, renderer.outputBuffer, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS), tex->data, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS), 0x000002202);
GSPGPU_FlushDataCache(0, tex->data, 256 * VIDEO_VERTICAL_PIXELS * 2); GSPGPU_FlushDataCache(0, tex->data, 256 * VIDEO_VERTICAL_PIXELS * 2);
#if RESAMPLE_LIBRARY == RESAMPLE_BLIP_BUF
blip_clear(context.gba->audio.left);
blip_clear(context.gba->audio.left);
#endif
gspWaitForPPF(); gspWaitForPPF();
_drawStart(); _drawStart();
sf2d_draw_texture_scale(tex, 40, 296, 1, -1); sf2d_draw_texture_scale(tex, 40, 296, 1, -1);

View File

@ -8,7 +8,7 @@
#include "util/common.h" #include "util/common.h"
#include "gba/supervisor/config.h" #include "gba/context/config.h"
enum DebuggerType { enum DebuggerType {
DEBUGGER_NONE = 0, DEBUGGER_NONE = 0,

View File

@ -9,7 +9,7 @@
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/supervisor/context.h" #include "gba/context/context.h"
#include "util/circle-buffer.h" #include "util/circle-buffer.h"
#include "util/vfs.h" #include "util/vfs.h"

View File

@ -8,7 +8,7 @@
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/input.h" #include "gba/input.h"
#include "gba/audio.h" #include "gba/audio.h"
#include "gba/supervisor/context.h" #include "gba/context/context.h"
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "util/circle-buffer.h" #include "util/circle-buffer.h"

View File

@ -12,7 +12,7 @@
#include <QMenu> #include <QMenu>
extern "C" { extern "C" {
#include "gba/supervisor/overrides.h" #include "gba/context/overrides.h"
#include "platform/commandline.h" #include "platform/commandline.h"
} }

View File

@ -14,7 +14,7 @@
#include <functional> #include <functional>
extern "C" { extern "C" {
#include "gba/supervisor/config.h" #include "gba/context/config.h"
#include "util/configuration.h" #include "util/configuration.h"
#include "platform/commandline.h" #include "platform/commandline.h"
} }

View File

@ -18,11 +18,11 @@
extern "C" { extern "C" {
#include "gba/audio.h" #include "gba/audio.h"
#include "gba/context/config.h"
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/sharkport.h" #include "gba/sharkport.h"
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "gba/supervisor/config.h"
#include "util/vfs.h" #include "util/vfs.h"
} }

View File

@ -11,7 +11,7 @@
#include "ui_OverrideView.h" #include "ui_OverrideView.h"
extern "C" { extern "C" {
#include "gba/supervisor/overrides.h" #include "gba/context/overrides.h"
} }
struct GBAThread; struct GBAThread;

View File

@ -14,7 +14,7 @@
#endif #endif
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/supervisor/config.h" #include "gba/context/config.h"
#include "gba/supervisor/thread.h" #include "gba/supervisor/thread.h"
#include "gba/video.h" #include "gba/video.h"
#include "platform/commandline.h" #include "platform/commandline.h"

View File

@ -7,7 +7,7 @@
#include "debugger/debugger.h" #include "debugger/debugger.h"
#include "gba/io.h" #include "gba/io.h"
#include "gba/supervisor/rr.h" #include "gba/rr/rr.h"
#include "gba/serialize.h" #include "gba/serialize.h"
#include "gba/video.h" #include "gba/video.h"
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"

View File

@ -3,8 +3,8 @@
* This Source Code Form is subject to the terms of the Mozilla Public * 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gba/supervisor/config.h" #include "gba/context/config.h"
#include "gba/supervisor/context.h" #include "gba/context/context.h"
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "gba/serialize.h" #include "gba/serialize.h"

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gba/supervisor/thread.h" #include "gba/supervisor/thread.h"
#include "gba/supervisor/config.h" #include "gba/context/config.h"
#include "gba/gba.h" #include "gba/gba.h"
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "gba/serialize.h" #include "gba/serialize.h"

View File

@ -13,7 +13,7 @@
#include "util/common.h" #include "util/common.h"
#include "gba/renderers/video-software.h" #include "gba/renderers/video-software.h"
#include "gba/supervisor/context.h" #include "gba/context/context.h"
#include "util/gui.h" #include "util/gui.h"
#include "util/gui/file-select.h" #include "util/gui/file-select.h"
#include "util/gui/font.h" #include "util/gui/font.h"