diff --git a/CMakeLists.txt b/CMakeLists.txt index b4492a321..002396451 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/gba/supervisor/config.c b/src/gba/context/config.c similarity index 100% rename from src/gba/supervisor/config.c rename to src/gba/context/config.c diff --git a/src/gba/supervisor/config.h b/src/gba/context/config.h similarity index 100% rename from src/gba/supervisor/config.h rename to src/gba/context/config.h diff --git a/src/gba/supervisor/context.c b/src/gba/context/context.c similarity index 98% rename from src/gba/supervisor/context.c rename to src/gba/context/context.c index 9351f643e..3ddd3c21f 100644 --- a/src/gba/supervisor/context.c +++ b/src/gba/context/context.c @@ -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" diff --git a/src/gba/supervisor/context.h b/src/gba/context/context.h similarity index 97% rename from src/gba/supervisor/context.h rename to src/gba/context/context.h index 867ce6cc6..6d597d9b3 100644 --- a/src/gba/supervisor/context.h +++ b/src/gba/context/context.h @@ -8,7 +8,7 @@ #include "util/common.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "gba/input.h" struct GBAContext { diff --git a/src/gba/supervisor/overrides.c b/src/gba/context/overrides.c similarity index 100% rename from src/gba/supervisor/overrides.c rename to src/gba/context/overrides.c diff --git a/src/gba/supervisor/overrides.h b/src/gba/context/overrides.h similarity index 100% rename from src/gba/supervisor/overrides.h rename to src/gba/context/overrides.h diff --git a/src/gba/supervisor/sync.c b/src/gba/context/sync.c similarity index 99% rename from src/gba/supervisor/sync.c rename to src/gba/context/sync.c index ddcdf2b9f..335ebda4d 100644 --- a/src/gba/supervisor/sync.c +++ b/src/gba/context/sync.c @@ -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 diff --git a/src/gba/supervisor/sync.h b/src/gba/context/sync.h similarity index 100% rename from src/gba/supervisor/sync.h rename to src/gba/context/sync.h diff --git a/src/gba/gba.c b/src/gba/gba.c index 4ef596a5e..e44d0f83d 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -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" @@ -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) { GBASetBreakpoint((struct GBA*) debugger->cpu->master, &debugger->d, address, mode, opcode); return true; diff --git a/src/gba/io.c b/src/gba/io.c index 304a6253a..db4ee0f95 100644 --- a/src/gba/io.c +++ b/src/gba/io.c @@ -5,7 +5,7 @@ * 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" diff --git a/src/gba/rr/mgm.h b/src/gba/rr/mgm.h index a0d0a860f..5870afb56 100644 --- a/src/gba/rr/mgm.h +++ b/src/gba/rr/mgm.h @@ -8,7 +8,7 @@ #include "util/common.h" -#include "gba/supervisor/rr.h" +#include "gba/rr/rr.h" struct GBA; struct VDir; diff --git a/src/gba/supervisor/rr.c b/src/gba/rr/rr.c similarity index 100% rename from src/gba/supervisor/rr.c rename to src/gba/rr/rr.c diff --git a/src/gba/supervisor/rr.h b/src/gba/rr/rr.h similarity index 100% rename from src/gba/supervisor/rr.h rename to src/gba/rr/rr.h diff --git a/src/gba/rr/vbm.h b/src/gba/rr/vbm.h index c9a503cf4..a314b9b0b 100644 --- a/src/gba/rr/vbm.h +++ b/src/gba/rr/vbm.h @@ -5,7 +5,7 @@ * 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; diff --git a/src/gba/serialize.c b/src/gba/serialize.c index a7321dd93..37d6cce36 100644 --- a/src/gba/serialize.c +++ b/src/gba/serialize.c @@ -7,7 +7,7 @@ #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" diff --git a/src/gba/supervisor/thread.c b/src/gba/supervisor/thread.c index 901694462..5f5e23776 100644 --- a/src/gba/supervisor/thread.c +++ b/src/gba/supervisor/thread.c @@ -9,7 +9,7 @@ #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" @@ -752,10 +752,6 @@ struct GBAThread* GBAThreadGetContext(void) { InitOnceExecuteOnce(&_contextOnce, _createTLS, NULL, 0); return TlsGetValue(_contextKey); } -#else -struct GBAThread* GBAThreadGetContext(void) { - return 0; -} #endif #ifdef USE_PNG diff --git a/src/gba/supervisor/thread.h b/src/gba/supervisor/thread.h index f9dab3248..c9b86bd5e 100644 --- a/src/gba/supervisor/thread.h +++ b/src/gba/supervisor/thread.h @@ -10,8 +10,8 @@ #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" diff --git a/src/gba/video.c b/src/gba/video.c index c70e47a38..05b3818d8 100644 --- a/src/gba/video.c +++ b/src/gba/video.c @@ -5,11 +5,11 @@ * 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" diff --git a/src/platform/3ds/main.c b/src/platform/3ds/main.c index 4f4a644da..dab83dcd7 100644 --- a/src/platform/3ds/main.c +++ b/src/platform/3ds/main.c @@ -5,7 +5,7 @@ * 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 @@ int main() { 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 @@ int main() { 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); diff --git a/src/platform/commandline.h b/src/platform/commandline.h index 203895088..bb1bfb874 100644 --- a/src/platform/commandline.h +++ b/src/platform/commandline.h @@ -8,7 +8,7 @@ #include "util/common.h" -#include "gba/supervisor/config.h" +#include "gba/context/config.h" enum DebuggerType { DEBUGGER_NONE = 0, diff --git a/src/platform/libretro/libretro.c b/src/platform/libretro/libretro.c index caf2c9f74..853126c2a 100644 --- a/src/platform/libretro/libretro.c +++ b/src/platform/libretro/libretro.c @@ -9,7 +9,7 @@ #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" diff --git a/src/platform/psp2/psp2-context.c b/src/platform/psp2/psp2-context.c index 7e7a1393a..4e9a328fc 100644 --- a/src/platform/psp2/psp2-context.c +++ b/src/platform/psp2/psp2-context.c @@ -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" diff --git a/src/platform/qt/ConfigController.cpp b/src/platform/qt/ConfigController.cpp index 4fd374c1b..6ab9d39d5 100644 --- a/src/platform/qt/ConfigController.cpp +++ b/src/platform/qt/ConfigController.cpp @@ -12,7 +12,7 @@ #include extern "C" { -#include "gba/supervisor/overrides.h" +#include "gba/context/overrides.h" #include "platform/commandline.h" } diff --git a/src/platform/qt/ConfigController.h b/src/platform/qt/ConfigController.h index 439c14653..f4723427d 100644 --- a/src/platform/qt/ConfigController.h +++ b/src/platform/qt/ConfigController.h @@ -14,7 +14,7 @@ #include extern "C" { -#include "gba/supervisor/config.h" +#include "gba/context/config.h" #include "util/configuration.h" #include "platform/commandline.h" } diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index b64d89193..8f3d6678c 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -18,11 +18,11 @@ 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" } diff --git a/src/platform/qt/OverrideView.h b/src/platform/qt/OverrideView.h index 3ed5d3e20..34ef503ed 100644 --- a/src/platform/qt/OverrideView.h +++ b/src/platform/qt/OverrideView.h @@ -11,7 +11,7 @@ #include "ui_OverrideView.h" extern "C" { -#include "gba/supervisor/overrides.h" +#include "gba/context/overrides.h" } struct GBAThread; diff --git a/src/platform/sdl/main.c b/src/platform/sdl/main.c index 292130f04..9ab62b6df 100644 --- a/src/platform/sdl/main.c +++ b/src/platform/sdl/main.c @@ -14,7 +14,7 @@ #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" diff --git a/src/platform/sdl/sdl-events.c b/src/platform/sdl/sdl-events.c index c63e5dc76..13b905d40 100644 --- a/src/platform/sdl/sdl-events.c +++ b/src/platform/sdl/sdl-events.c @@ -7,7 +7,7 @@ #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" diff --git a/src/platform/test/fuzz-main.c b/src/platform/test/fuzz-main.c index c7d6e91ad..1111c2945 100644 --- a/src/platform/test/fuzz-main.c +++ b/src/platform/test/fuzz-main.c @@ -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" diff --git a/src/platform/test/perf-main.c b/src/platform/test/perf-main.c index 942dd57d9..a7009c01a 100644 --- a/src/platform/test/perf-main.c +++ b/src/platform/test/perf-main.c @@ -4,7 +4,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/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" diff --git a/src/platform/wii/main.c b/src/platform/wii/main.c index 6e5c4062c..1b9bf9135 100644 --- a/src/platform/wii/main.c +++ b/src/platform/wii/main.c @@ -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"