GBA: Separate out subcomponents to enable easier exclusion
jump to
@@ -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_RR_SRC ${CMAKE_SOURCE_DIR}/src/gba/rr/*.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 GUI_SRC ${CMAKE_SOURCE_DIR}/src/util/gui/*.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) source_group("ARM core" FILES ${ARM_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}) include_directories(${CMAKE_SOURCE_DIR}/src/arm) include_directories(${CMAKE_SOURCE_DIR}/src)@@ -415,7 +416,7 @@ set(CORE_SRC
${ARM_SRC} ${GBA_SRC} ${GBA_CHEATS_SRC} - ${GBA_SV_SRC} + ${GBA_CTX_SRC} ${DEBUGGER_SRC} ${RENDERER_SRC} ${UTIL_SRC}@@ -427,6 +428,7 @@ if(NOT MINIMAL_CORE)
set(SRC ${CORE_SRC} ${GBA_RR_SRC} + ${GBA_SV_SRC} ${SIO_SRC} ${FEATURE_SRC}) else()
@@ -8,7 +8,7 @@
#include "gba/bios.h" #include "gba/cheats.h" #include "gba/io.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" #include "gba/supervisor/thread.h" #include "gba/serialize.h" #include "gba/sio.h"@@ -863,6 +863,12 @@ } else {
GBAPatch16(gba->cpu, address, opcode, 0); } } + +#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) { GBASetBreakpoint((struct GBA*) debugger->cpu->master, &debugger->d, address, mode, opcode);
@@ -5,7 +5,7 @@ * 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 "io.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" #include "gba/serialize.h" #include "gba/sio.h" #include "gba/video.h"
@@ -8,7 +8,7 @@ #define RR_MGM_H
#include "util/common.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" struct GBA; struct VDir;
@@ -5,7 +5,7 @@ * 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 "util/common.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" struct GBAVBMContext { struct GBARRContext d;
@@ -7,7 +7,7 @@ #include "serialize.h"
#include "gba/audio.h" #include "gba/io.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" #include "gba/supervisor/thread.h" #include "gba/video.h"
@@ -3,9 +3,9 @@ *
* 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 "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/vfs.h"
@@ -8,7 +8,7 @@ #define CONTEXT_H
#include "util/common.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "gba/input.h" struct GBAContext {
@@ -3,7 +3,7 @@ *
* 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 "thread.h" +#include "sync.h" static void _changeVideoSync(struct GBASync* sync, bool frameOn) { // Make sure the video thread can process events while the GBA thread is paused
@@ -9,7 +9,7 @@ #include "arm.h"
#include "gba/gba.h" #include "gba/cheats.h" #include "gba/serialize.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "gba/rr/mgm.h" #include "gba/rr/vbm.h"@@ -751,10 +751,6 @@ #elif _WIN32
struct GBAThread* GBAThreadGetContext(void) { InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); return TlsGetValue(_contextKey); -} -#else -struct GBAThread* GBAThreadGetContext(void) { - return 0; } #endif
@@ -10,8 +10,8 @@ #include "util/common.h"
#include "gba/gba.h" #include "gba/input.h" -#include "gba/supervisor/overrides.h" -#include "gba/supervisor/sync.h" +#include "gba/context/overrides.h" +#include "gba/context/sync.h" #include "util/threading.h"
@@ -5,11 +5,11 @@ * 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 "video.h" +#include "gba/context/sync.h" #include "gba/gba.h" #include "gba/io.h" +#include "gba/rr/rr.h" #include "gba/serialize.h" -#include "gba/supervisor/rr.h" -#include "gba/supervisor/sync.h" #include "util/memory.h"
@@ -5,7 +5,7 @@ * 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 "gba/renderers/video-software.h" -#include "gba/supervisor/context.h" +#include "gba/context/context.h" #include "gba/video.h" #include "util/gui.h" #include "util/gui/file-select.h"@@ -121,6 +121,12 @@ }
if (!GBAContextStart(&context)) { 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()) { hidScanInput(); int activeKeys = hidKeysHeld() & 0x3FF;@@ -130,6 +136,10 @@ }
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); 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(); _drawStart(); sf2d_draw_texture_scale(tex, 40, 296, 1, -1);
@@ -8,7 +8,7 @@ #define COMMAND_LINE_H
#include "util/common.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" enum DebuggerType { DEBUGGER_NONE = 0,
@@ -9,7 +9,7 @@ #include "util/common.h"
#include "gba/renderers/video-software.h" #include "gba/serialize.h" -#include "gba/supervisor/context.h" +#include "gba/context/context.h" #include "util/circle-buffer.h" #include "util/vfs.h"
@@ -8,7 +8,7 @@
#include "gba/gba.h" #include "gba/input.h" #include "gba/audio.h" -#include "gba/supervisor/context.h" +#include "gba/context/context.h" #include "gba/renderers/video-software.h" #include "util/circle-buffer.h"
@@ -12,7 +12,7 @@ #include <QDir>
#include <QMenu> extern "C" { -#include "gba/supervisor/overrides.h" +#include "gba/context/overrides.h" #include "platform/commandline.h" }
@@ -14,7 +14,7 @@
#include <functional> extern "C" { -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "util/configuration.h" #include "platform/commandline.h" }
@@ -18,11 +18,11 @@ #include <ctime>
extern "C" { #include "gba/audio.h" +#include "gba/context/config.h" #include "gba/gba.h" #include "gba/serialize.h" #include "gba/sharkport.h" #include "gba/renderers/video-software.h" -#include "gba/supervisor/config.h" #include "util/vfs.h" }
@@ -11,7 +11,7 @@
#include "ui_OverrideView.h" extern "C" { -#include "gba/supervisor/overrides.h" +#include "gba/context/overrides.h" } struct GBAThread;
@@ -14,7 +14,7 @@ #include "debugger/gdb-stub.h"
#endif #include "gba/gba.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "gba/supervisor/thread.h" #include "gba/video.h" #include "platform/commandline.h"
@@ -7,7 +7,7 @@ #include "sdl-events.h"
#include "debugger/debugger.h" #include "gba/io.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" #include "gba/serialize.h" #include "gba/video.h" #include "gba/renderers/video-software.h"
@@ -3,8 +3,8 @@ *
* 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 "gba/supervisor/config.h" -#include "gba/supervisor/context.h" +#include "gba/context/config.h" +#include "gba/context/context.h" #include "gba/gba.h" #include "gba/renderers/video-software.h" #include "gba/serialize.h"
@@ -4,7 +4,7 @@ * 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 "gba/supervisor/thread.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "gba/gba.h" #include "gba/renderers/video-software.h" #include "gba/serialize.h"
@@ -13,7 +13,7 @@
#include "util/common.h" #include "gba/renderers/video-software.h" -#include "gba/supervisor/context.h" +#include "gba/context/context.h" #include "util/gui.h" #include "util/gui/file-select.h" #include "util/gui/font.h"