Merge branch 'master' (early part) into medusa

This commit is contained in:
Vicki Pfau 2019-06-28 17:38:17 -07:00
commit 03c894b1df
24 changed files with 153 additions and 119 deletions

View File

@ -41,6 +41,7 @@ Emulation fixes:
- GB Video: Fix more window edge cases (fixes mgba.io/i/1346)
- GB Timer: Fix timing adjustments when writing to TAC (fixes mgba.io/i/1340)
- GBA Memory: Fix writing to OBJ memory in modes 3 and 5
- GBA: Fix RTC on non-standard sized ROMs (fixes mgba.io/i/1400)
Other fixes:
- Qt: More app metadata fixes
- Qt: Fix load recent from archive (fixes mgba.io/i/1325)

View File

@ -18,49 +18,68 @@ if(NOT MSVC)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146")
endif()
set(USE_DEBUGGERS ON CACHE BOOL "Whether or not to enable the debugging infrastructure")
if (NOT WIN32)
set(USE_EDITLINE ON CACHE BOOL "Whether or not to enable the CLI-mode debugger")
if(NOT DEFINED LIBMGBA_ONLY)
get_directory_property(LIBMGBA_ONLY EXCLUDE_FROM_ALL)
endif()
set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")
set(USE_ZLIB ON CACHE BOOL "Whether or not to enable zlib support")
set(USE_MINIZIP ON CACHE BOOL "Whether or not to enable external minizip support")
set(USE_PNG ON CACHE BOOL "Whether or not to enable PNG support")
set(USE_LIBZIP ON CACHE BOOL "Whether or not to enable LIBZIP support")
set(USE_MAGICK ON CACHE BOOL "Whether or not to enable ImageMagick support")
set(USE_SQLITE3 ON CACHE BOOL "Whether or not to enable SQLite3 support")
set(USE_ELF ON CACHE BOOL "Whether or not to enable ELF support")
set(M_CORE_GBA ON CACHE BOOL "Build Game Boy Advance core")
set(M_CORE_GB ON CACHE BOOL "Build Game Boy core")
set(M_CORE_DS ON CACHE BOOL "Build DS core")
set(USE_LZMA ON CACHE BOOL "Whether or not to enable 7-Zip support")
set(USE_DISCORD_RPC ON CACHE BOOL "Whether or not to enable Discord RPC support")
set(ENABLE_SCRIPTING ON CACHE BOOL "Whether or not to enable scripting support")
set(BUILD_QT ON CACHE BOOL "Build Qt frontend")
set(BUILD_SDL ON CACHE BOOL "Build SDL frontend")
set(BUILD_LIBRETRO OFF CACHE BOOL "Build libretro core")
if(APPLE)
set(BUILD_OPENEMU OFF CACHE BOOL "Build OpenEmu core")
endif()
set(BUILD_PERF OFF CACHE BOOL "Build performance profiling tool")
set(BUILD_TEST OFF CACHE BOOL "Build testing harness")
set(BUILD_SUITE OFF CACHE BOOL "Build test suite")
set(BUILD_EXAMPLE OFF CACHE BOOL "Build example frontends")
set(BUILD_PYTHON OFF CACHE BOOL "Build Python bindings")
set(BUILD_STATIC OFF CACHE BOOL "Build a static library")
set(BUILD_SHARED ON CACHE BOOL "Build a shared library")
set(SKIP_LIBRARY OFF CACHE BOOL "Skip building the library (useful for only building libretro or OpenEmu cores)")
set(BUILD_GL ON CACHE BOOL "Build with OpenGL")
set(BUILD_GLES2 OFF CACHE BOOL "Build with OpenGL|ES 2")
set(BUILD_GLES3 OFF CACHE BOOL "Build with OpenGL|ES 3")
set(USE_EPOXY ON CACHE STRING "Build with libepoxy")
set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies")
set(DISTBUILD OFF CACHE BOOL "Build distribution packages")
if(WIN32)
set(WIN32_UNIX_PATHS OFF CACHE BOOL "Use Unix-like paths")
mark_as_advanced(WIN32_UNIX_PATHS)
if(NOT LIBMGBA_ONLY)
set(USE_DEBUGGERS ON CACHE BOOL "Whether or not to enable the debugging infrastructure")
if (NOT WIN32)
set(USE_EDITLINE ON CACHE BOOL "Whether or not to enable the CLI-mode debugger")
endif()
set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger")
set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support")
set(USE_ZLIB ON CACHE BOOL "Whether or not to enable zlib support")
set(USE_MINIZIP ON CACHE BOOL "Whether or not to enable external minizip support")
set(USE_PNG ON CACHE BOOL "Whether or not to enable PNG support")
set(USE_LIBZIP ON CACHE BOOL "Whether or not to enable LIBZIP support")
set(USE_MAGICK ON CACHE BOOL "Whether or not to enable ImageMagick support")
set(USE_SQLITE3 ON CACHE BOOL "Whether or not to enable SQLite3 support")
set(USE_ELF ON CACHE BOOL "Whether or not to enable ELF support")
set(M_CORE_GBA ON CACHE BOOL "Build Game Boy Advance core")
set(M_CORE_GB ON CACHE BOOL "Build Game Boy core")
set(M_CORE_DS ON CACHE BOOL "Build DS core")
set(USE_LZMA ON CACHE BOOL "Whether or not to enable 7-Zip support")
set(USE_DISCORD_RPC ON CACHE BOOL "Whether or not to enable Discord RPC support")
set(ENABLE_SCRIPTING ON CACHE BOOL "Whether or not to enable scripting support")
set(BUILD_QT ON CACHE BOOL "Build Qt frontend")
set(BUILD_SDL ON CACHE BOOL "Build SDL frontend")
set(BUILD_LIBRETRO OFF CACHE BOOL "Build libretro core")
if(APPLE)
set(BUILD_OPENEMU OFF CACHE BOOL "Build OpenEmu core")
endif()
set(BUILD_PERF OFF CACHE BOOL "Build performance profiling tool")
set(BUILD_TEST OFF CACHE BOOL "Build testing harness")
set(BUILD_SUITE OFF CACHE BOOL "Build test suite")
set(BUILD_EXAMPLE OFF CACHE BOOL "Build example frontends")
set(BUILD_PYTHON OFF CACHE BOOL "Build Python bindings")
set(BUILD_STATIC OFF CACHE BOOL "Build a static library")
set(BUILD_SHARED ON CACHE BOOL "Build a shared library")
set(SKIP_LIBRARY OFF CACHE BOOL "Skip building the library (useful for only building libretro or OpenEmu cores)")
set(BUILD_GL ON CACHE BOOL "Build with OpenGL")
set(BUILD_GLES2 OFF CACHE BOOL "Build with OpenGL|ES 2")
set(BUILD_GLES3 OFF CACHE BOOL "Build with OpenGL|ES 3")
set(USE_EPOXY ON CACHE STRING "Build with libepoxy")
set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies")
set(DISTBUILD OFF CACHE BOOL "Build distribution packages")
if(WIN32)
set(WIN32_UNIX_PATHS OFF CACHE BOOL "Use Unix-like paths")
mark_as_advanced(WIN32_UNIX_PATHS)
endif()
else()
set(DISABLE_FRONTENDS ON)
set(DISABLE_DEPS ON)
set(BUILD_STATIC ON)
set(BUILD_SHARED OFF)
if(NOT DEFINED M_CORE_GBA)
set(M_CORE_GBA ON)
endif()
if(NOT DEFINED M_CORE_GB)
set(M_CORE_GB ON)
endif()
endif()
file(GLOB ARM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/*.c)
file(GLOB ARM_TEST_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/arm/test/*.c)
file(GLOB LR35902_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/lr35902/*.c)
@ -95,7 +114,7 @@ source_group("GBA extra" FILES ${GBA_CHEATS_SRC} ${GBA_RR_SRC})
source_group("GB board" FILES ${GB_SRC} ${GB_SIO_SRC})
source_group("DS board" FILES ${DS_SRC})
source_group("Utilities" FILES ${UTIL_SRC})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/include)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type (e.g. Release, RelWithDebInfo, or Debug)" FORCE)
@ -346,7 +365,9 @@ endif()
check_include_files("xlocale.h" HAVE_XLOCALE)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
check_function_exists(snprintf_l HAVE_SNPRINTF_L)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(ANDROID AND ANDROID_NDK_MAJOR GREATER 13)
set(HAVE_STRTOF_L ON)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# The strtof_l on Linux not actually exposed nor actually strtof_l
set(HAVE_STRTOF_L OFF)
else()
@ -465,9 +486,17 @@ if(BUILD_GLES3)
set(BUILD_GLES3 OFF CACHE BOOL "OpenGL|ES 3 not found" FORCE)
endif()
endif()
if(DISABLE_DEPS)
set(USE_GDB_STUB OFF)
set(USE_DISCORD_RPC OFF)
set(USE_SQLITE3 OFF)
set(USE_PNG OFF)
set(USE_ZLIB OFF)
endif()
set(WANT_ZLIB ${USE_ZLIB})
set(WANT_PNG ${USE_PNG})
set(WANT_LIBZIP ${USE_LIBZIP})
set(WANT_SQLITE3 ${USE_SQLITE3})
set(USE_CMOCKA ${BUILD_SUITE})
@ -502,10 +531,6 @@ file(GLOB DEBUGGER_TEST_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/test/*.c)
set(FEATURE_SRC)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
if(DISABLE_DEPS)
set(USE_GDB_STUB OFF)
endif()
if(USE_EDITLINE)
list(APPEND FEATURES EDITLINE)
list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger/cli-debugger.c)
@ -597,11 +622,8 @@ endif()
if(WANT_ZLIB AND NOT USE_ZLIB)
set(SKIP_INSTALL_ALL ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib zlib)
set_property(TARGET zlibstatic PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/zlib;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib)
set_property(TARGET zlib PROPERTY EXCLUDE_FROM_ALL ON)
set_property(TARGET example PROPERTY EXCLUDE_FROM_ALL ON)
set_property(TARGET minigzip PROPERTY EXCLUDE_FROM_ALL ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib zlib EXCLUDE_FROM_ALL)
set_target_properties(zlibstatic PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/zlib;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib" POSITION_INDEPENDENT_CODE ON)
set(ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
set(ZLIB_LIBRARY zlibstatic)
@ -633,8 +655,8 @@ if(WANT_PNG AND USE_ZLIB AND NOT USE_PNG)
if (SWITCH)
set(PNG_ARM_NEON "off" CACHE STRING "" FORCE)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng libpng)
set_property(TARGET png_static PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/libpng;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng;${ZLIB_INCLUDE_DIRS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng libpng EXCLUDE_FROM_ALL)
set_target_properties(png_static PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/libpng;${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng;${ZLIB_INCLUDE_DIRS}" POSITION_INDEPENDENT_CODE ON)
set(PNG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/libpng ${CMAKE_CURRENT_BINARY_DIR}/libpng)
list(APPEND DEPENDENCY_LIB png_static)
set(USE_PNG ON)
@ -749,7 +771,7 @@ if(USE_ELF)
endif()
if (USE_DISCORD_RPC)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/discord-rpc discord-rpc)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/discord-rpc discord-rpc EXCLUDE_FROM_ALL)
list(APPEND FEATURES DISCORD_RPC)
include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/src/third-party/discord-rpc/include)
endif()
@ -898,6 +920,7 @@ if(NOT SKIP_LIBRARY)
add_library(${BINARY_NAME} SHARED ${SRC} ${VFS_SRC})
if(BUILD_STATIC)
add_library(${BINARY_NAME}-static STATIC ${SRC})
target_include_directories(${BINARY_NAME}-static BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include)
set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}" COMPILE_OPTIONS "${FEATURE_FLAGS}")
install(TARGETS ${BINARY_NAME}-static DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
add_dependencies(${BINARY_NAME}-static version-info)
@ -906,8 +929,9 @@ if(NOT SKIP_LIBRARY)
add_library(${BINARY_NAME} STATIC ${SRC})
endif()
add_dependencies(${BINARY_NAME} version-info)
target_include_directories(${BINARY_NAME} BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include)
set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}" COMPILE_OPTIONS "${FEATURE_FLAGS}")
add_dependencies(${BINARY_NAME} version-info)
target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB})
install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
@ -959,7 +983,8 @@ endif()
if(BUILD_LIBRETRO)
file(GLOB RETRO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/libretro/*.c)
add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC})
set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2")
add_dependencies(${BINARY_NAME} version-info)
set_target_properties(${BINARY_NAME}_libretro PROPERTIES PREFIX "" COMPILE_DEFINITIONS "__LIBRETRO__;COLOR_16_BIT;COLOR_5_6_5;DISABLE_THREADING;${OS_DEFINES};${FUNCTION_DEFINES};MINIMAL_CORE=2")
target_link_libraries(${BINARY_NAME}_libretro ${OS_LIB})
if(MSVC)
install(TARGETS ${BINARY_NAME}_libretro RUNTIME DESTINATION ${LIBRETRO_LIBDIR} COMPONENT ${BINARY_NAME}_libretro)
@ -1048,8 +1073,11 @@ if(BUILD_EXAMPLE)
endif()
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_BINARY_DIR}/flags.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT lib${BINARY_NAME})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/mgba)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mgba-util DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT ${BINARY_NAME}-dev FILES_MATCHING PATTERN "*.h")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/mgba/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT ${BINARY_NAME}-dev)
if(WIN32)
set(BIN_DIR ".\\")
@ -1195,6 +1223,7 @@ if(BUILD_SHARED)
elseif(BUILD_STATIC)
cpack_add_component(lib${BINARY_NAME} GROUP dev)
endif()
cpack_add_component(${BINARY_NAME}-dev GROUP dev)
if(3DS)
cpack_add_component(${BINARY_NAME}-3ds GROUP base)
@ -1270,7 +1299,7 @@ else()
set(SUMMARY_ZIP OFF)
endif()
if(NOT QUIET)
if(NOT QUIET AND NOT LIBMGBA_ONLY)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Platforms:")
message(STATUS " Game Boy Advance: ${M_CORE_GBA}")

View File

@ -13,6 +13,11 @@ CXX_GUARD_START
#include <mgba/core/interface.h>
#include <mgba/core/timing.h>
enum {
GBA_VIDEO_HORIZONTAL_PIXELS = 240,
GBA_VIDEO_VERTICAL_PIXELS = 160,
};
enum GBASIOMode {
SIO_NORMAL_8 = 0,
SIO_NORMAL_32 = 1,

View File

@ -11,6 +11,7 @@
CXX_GUARD_START
#include <mgba/core/core.h>
#include <mgba/gba/interface.h>
#include <mgba/internal/gba/io.h>
#include <mgba/internal/gba/video.h>
@ -179,7 +180,7 @@ struct GBAVideoSoftwareRenderer {
struct ScanlineCache {
uint16_t io[REG_SOUND1CNT_LO];
int32_t scale[2][2];
} cache[VIDEO_VERTICAL_PIXELS];
} cache[GBA_VIDEO_VERTICAL_PIXELS];
int nextY;
int start;

View File

@ -16,13 +16,11 @@ CXX_GUARD_START
mLOG_DECLARE_CATEGORY(GBA_VIDEO);
enum {
VIDEO_HORIZONTAL_PIXELS = 240,
VIDEO_HBLANK_PIXELS = 68,
VIDEO_HDRAW_LENGTH = 1006,
VIDEO_HBLANK_LENGTH = 226,
VIDEO_HORIZONTAL_LENGTH = 1232,
VIDEO_VERTICAL_PIXELS = 160,
VIDEO_VBLANK_PIXELS = 68,
VIDEO_VERTICAL_TOTAL_PIXELS = 228,

View File

@ -6,7 +6,7 @@
#include "ffmpeg-encoder.h"
#include <mgba/core/core.h>
#include <mgba/internal/gba/video.h>
#include <mgba/gba/interface.h>
#include <libavcodec/version.h>
#include <libavcodec/avcodec.h>
@ -52,9 +52,9 @@ void FFmpegEncoderInit(struct FFmpegEncoder* encoder) {
FFmpegEncoderSetAudio(encoder, "flac", 0);
FFmpegEncoderSetVideo(encoder, "png", 0);
FFmpegEncoderSetContainer(encoder, "matroska");
FFmpegEncoderSetDimensions(encoder, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
encoder->iwidth = VIDEO_HORIZONTAL_PIXELS;
encoder->iheight = VIDEO_VERTICAL_PIXELS;
FFmpegEncoderSetDimensions(encoder, GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
encoder->iwidth = GBA_VIDEO_HORIZONTAL_PIXELS;
encoder->iheight = GBA_VIDEO_VERTICAL_PIXELS;
encoder->frameCycles = VIDEO_TOTAL_LENGTH;
encoder->cycles = GBA_ARM7TDMI_FREQUENCY;
encoder->resampleContext = 0;
@ -181,8 +181,8 @@ bool FFmpegEncoderSetContainer(struct FFmpegEncoder* encoder, const char* contai
}
void FFmpegEncoderSetDimensions(struct FFmpegEncoder* encoder, int width, int height) {
encoder->width = width > 0 ? width : VIDEO_HORIZONTAL_PIXELS;
encoder->height = height > 0 ? height : VIDEO_VERTICAL_PIXELS;
encoder->width = width > 0 ? width : GBA_VIDEO_HORIZONTAL_PIXELS;
encoder->height = height > 0 ? height : GBA_VIDEO_VERTICAL_PIXELS;
}
bool FFmpegEncoderVerifyContainer(struct FFmpegEncoder* encoder) {

View File

@ -6,7 +6,7 @@
#include "imagemagick-gif-encoder.h"
#include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/video.h>
#include <mgba/gba/interface.h>
#include <mgba-util/string.h>
static void _magickPostVideoFrame(struct mAVStream*, const color_t* pixels, size_t stride);
@ -25,8 +25,8 @@ void ImageMagickGIFEncoderInit(struct ImageMagickGIFEncoder* encoder) {
encoder->frameskip = 2;
encoder->delayMs = -1;
encoder->iwidth = VIDEO_HORIZONTAL_PIXELS;
encoder->iheight = VIDEO_VERTICAL_PIXELS;
encoder->iwidth = GBA_VIDEO_HORIZONTAL_PIXELS;
encoder->iheight = GBA_VIDEO_VERTICAL_PIXELS;
encoder->numerator = VIDEO_TOTAL_LENGTH;
encoder->denominator = GBA_ARM7TDMI_FREQUENCY;
}

View File

@ -262,8 +262,8 @@ static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* con
static void _GBACoreDesiredVideoDimensions(struct mCore* core, unsigned* width, unsigned* height) {
UNUSED(core);
*width = VIDEO_HORIZONTAL_PIXELS;
*height = VIDEO_VERTICAL_PIXELS;
*width = GBA_VIDEO_HORIZONTAL_PIXELS;
*height = GBA_VIDEO_VERTICAL_PIXELS;
}
static void _GBACoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t stride) {
@ -319,7 +319,7 @@ static void _GBACoreSetAVStream(struct mCore* core, struct mAVStream* stream) {
struct GBA* gba = core->board;
gba->stream = stream;
if (stream && stream->videoDimensionsChanged) {
stream->videoDimensionsChanged(stream, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
stream->videoDimensionsChanged(stream, GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
}
if (stream && stream->videoFrameRateChanged) {
stream->videoFrameRateChanged(stream, core->frameCycles(core), core->frequency(core));

View File

@ -182,7 +182,7 @@ void _dmaEvent(struct mTiming* timing, void* context, uint32_t cyclesLate) {
dma->nextCount = 0;
bool noRepeat = !GBADMARegisterIsRepeat(dma->reg);
noRepeat |= GBADMARegisterGetTiming(dma->reg) == GBA_DMA_TIMING_NOW;
noRepeat |= memory->activeDMA == 3 && GBADMARegisterGetTiming(dma->reg) == GBA_DMA_TIMING_CUSTOM && gba->video.vcount == VIDEO_VERTICAL_PIXELS + 1;
noRepeat |= memory->activeDMA == 3 && GBADMARegisterGetTiming(dma->reg) == GBA_DMA_TIMING_CUSTOM && gba->video.vcount == GBA_VIDEO_VERTICAL_PIXELS + 1;
if (noRepeat) {
dma->reg = GBADMARegisterClearEnable(dma->reg);

View File

@ -165,7 +165,7 @@ static bool _parsePacket(struct mVideoLogger* logger, const struct mVideoLoggerD
}
break;
case DIRTY_SCANLINE:
if (item->address < VIDEO_VERTICAL_PIXELS) {
if (item->address < GBA_VIDEO_VERTICAL_PIXELS) {
proxyRenderer->backend->drawScanline(proxyRenderer->backend, item->address);
}
break;

View File

@ -405,8 +405,6 @@ bool GBALoadROM(struct GBA* gba, struct VFile* vf) {
gba->memory.romMask = toPow2(gba->memory.romSize) - 1;
gba->memory.mirroring = false;
gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize);
GBAHardwareInit(&gba->memory.hw, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]);
GBAVFameDetect(&gba->memory.vfame, gba->memory.rom, gba->memory.romSize);
if (popcount32(gba->memory.romSize) != 1) {
// This ROM is either a bad dump or homebrew. Emulate flash cart behavior.
#ifndef FIXED_ROM_BUFFER
@ -421,6 +419,8 @@ bool GBALoadROM(struct GBA* gba, struct VFile* vf) {
if (gba->cpu && gba->memory.activeRegion >= REGION_CART0) {
gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]);
}
GBAHardwareInit(&gba->memory.hw, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]);
GBAVFameDetect(&gba->memory.vfame, gba->memory.rom, gba->memory.romSize);
// TODO: error check
return true;
}

View File

@ -93,7 +93,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode3(struct GBAVideoSoftwareRenderer
int outX;
for (outX = renderer->start; outX < renderer->end; ++outX) {
BACKGROUND_BITMAP_ITERATE(renderer->masterEnd, VIDEO_VERTICAL_PIXELS);
BACKGROUND_BITMAP_ITERATE(renderer->masterEnd, GBA_VIDEO_VERTICAL_PIXELS);
if (!mosaicWait) {
LOAD_16(color, ((localX >> 8) + (localY >> 8) * renderer->masterEnd) << 1, renderer->d.vramBG[0]);
@ -131,7 +131,7 @@ void GBAVideoSoftwareRendererDrawBackgroundMode4(struct GBAVideoSoftwareRenderer
int outX;
for (outX = renderer->start; outX < renderer->end; ++outX) {
BACKGROUND_BITMAP_ITERATE(renderer->masterEnd, VIDEO_VERTICAL_PIXELS);
BACKGROUND_BITMAP_ITERATE(renderer->masterEnd, GBA_VIDEO_VERTICAL_PIXELS);
if (!mosaicWait) {
color = ((uint8_t*)renderer->d.vramBG[0])[offset + (localX >> 8) + (localY >> 8) * renderer->masterEnd];

View File

@ -64,8 +64,8 @@ void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer) {
renderer->tileStride = 0x20;
renderer->bitmapStride = 0;
renderer->combinedObjSort = false;
renderer->masterEnd = VIDEO_HORIZONTAL_PIXELS;
renderer->masterHeight = VIDEO_VERTICAL_PIXELS;
renderer->masterEnd = GBA_VIDEO_HORIZONTAL_PIXELS;
renderer->masterHeight = GBA_VIDEO_VERTICAL_PIXELS;
renderer->masterScanlines = VIDEO_VERTICAL_TOTAL_PIXELS;
renderer->temporaryBuffer = 0;
@ -555,7 +555,7 @@ static void _cleanOAM(struct GBAVideoSoftwareRenderer* renderer) {
static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* renderer, int y) {
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
if (y == VIDEO_VERTICAL_PIXELS - 1) {
if (y == GBA_VIDEO_VERTICAL_PIXELS - 1) {
softwareRenderer->nextY = 0;
} else {
softwareRenderer->nextY = y + 1;

View File

@ -166,7 +166,7 @@ void _startHdraw(struct mTiming* timing, void* context, uint32_t cyclesLate) {
case 0:
GBAFrameStarted(video->p);
break;
case VIDEO_VERTICAL_PIXELS:
case GBA_VIDEO_VERTICAL_PIXELS:
video->p->memory.io[REG_DISPSTAT >> 1] = GBARegisterDISPSTATFillInVblank(dispstat);
if (video->frameskipCounter <= 0) {
video->renderer->finishFrame(video->renderer);
@ -198,14 +198,14 @@ void _startHblank(struct mTiming* timing, void* context, uint32_t cyclesLate) {
// Begin Hblank
dispstat = GBARegisterDISPSTATFillInHblank(dispstat);
if (video->vcount < VIDEO_VERTICAL_PIXELS && video->frameskipCounter <= 0) {
if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS && video->frameskipCounter <= 0) {
video->renderer->drawScanline(video->renderer, video->vcount);
}
if (video->vcount < VIDEO_VERTICAL_PIXELS) {
if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) {
GBADMARunHblank(video->p, -cyclesLate);
}
if (video->vcount >= 2 && video->vcount < VIDEO_VERTICAL_PIXELS + 2) {
if (video->vcount >= 2 && video->vcount < GBA_VIDEO_VERTICAL_PIXELS + 2) {
GBADMARunDisplayStart(video->p, -cyclesLate);
}
if (GBARegisterDISPSTATIsHblankIRQ(dispstat)) {

View File

@ -8,9 +8,9 @@
#include <mgba/core/core.h>
#include <mgba/core/serialize.h>
#ifdef M_CORE_GBA
#include <mgba/gba/interface.h>
#include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/input.h>
#include <mgba/internal/gba/video.h>
#endif
#ifdef M_CORE_GB
#include <mgba/internal/gb/gb.h>
@ -550,9 +550,9 @@ static void _drawFrame(struct mGUIRunner* runner, bool faded) {
UNUSED(runner);
C3D_Tex* tex = &outputTexture;
GSPGPU_FlushDataCache(outputBuffer, 256 * VIDEO_VERTICAL_PIXELS * 2);
GSPGPU_FlushDataCache(outputBuffer, 256 * GBA_VIDEO_VERTICAL_PIXELS * 2);
C3D_SyncDisplayTransfer(
(u32*) outputBuffer, GX_BUFFER_DIM(256, VIDEO_VERTICAL_PIXELS),
(u32*) outputBuffer, GX_BUFFER_DIM(256, GBA_VIDEO_VERTICAL_PIXELS),
tex->data, GX_BUFFER_DIM(256, 256),
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) |
GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB565) |

View File

@ -34,7 +34,7 @@ void free(void*);
#include <limits.h>
#include "flags.h"
#include <mgba/flags.h>
#include <mgba/core/blip_buf.h>
#include <mgba/core/cache-set.h>

View File

@ -18,7 +18,7 @@ cppflags.extend(["-I" + incdir, "-I" + srcdir, "-I" + bindir])
ffi.set_source("mgba._pylib", """
#define static
#define inline
#include "flags.h"
#include <mgba/flags.h>
#define OPAQUE_THREADING
#include <mgba/core/blip_buf.h>
#include <mgba/core/cache-set.h>

View File

@ -1,4 +1,4 @@
#include "flags.h"
#include <mgba/flags.h>
struct VFile;

View File

@ -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 "flags.h"
#include <mgba/flags.h>
#define CREATE_SHIM(PLAT, NAME, RETURN) \
RETURN _py ## PLAT ## SIOPythonDriver ## NAME (void* driver); \

View File

@ -217,7 +217,6 @@ if(USE_SQLITE3)
endif()
if(USE_DISCORD_RPC)
message(STATUS What)
list(APPEND QT_LIBRARIES discord-rpc)
list(APPEND SOURCE_FILES DiscordCoordinator.cpp)
endif()

View File

@ -9,7 +9,7 @@
#include <QDebug>
#include <mgba/internal/gba/video.h>
#include <mgba/gba/interface.h>
using namespace QGBA;
@ -39,9 +39,9 @@ void MessagePainter::resize(const QSize& size, bool lockAspectRatio, qreal scale
}
}
m_world.reset();
m_world.scale(qreal(drawW) / VIDEO_HORIZONTAL_PIXELS, qreal(drawH) / VIDEO_VERTICAL_PIXELS);
m_world.scale(qreal(drawW) / GBA_VIDEO_HORIZONTAL_PIXELS, qreal(drawH) / GBA_VIDEO_VERTICAL_PIXELS);
m_scaleFactor = scaleFactor;
m_local = QPoint(1, VIDEO_VERTICAL_PIXELS - m_messageFont.pixelSize() - 1);
m_local = QPoint(1, GBA_VIDEO_VERTICAL_PIXELS - m_messageFont.pixelSize() - 1);
m_local = m_world.map(m_local);
m_local += QPoint((w - drawW) / 2, (h - drawH) / 2);
m_pixmapBuffer = QPixmap(drawW * m_scaleFactor,

View File

@ -66,6 +66,7 @@
#include <mgba/internal/gb/video.h>
#endif
#ifdef M_CORE_GBA
#include <mgba/gba/interface.h>
#include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/input.h>
#include <mgba/internal/gba/video.h>
@ -153,7 +154,7 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi
});
#endif
#if defined(M_CORE_GBA)
resizeFrame(QSize(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i));
resizeFrame(QSize(GBA_VIDEO_HORIZONTAL_PIXELS * i, GBA_VIDEO_VERTICAL_PIXELS * i));
#elif defined(M_CORE_GB)
resizeFrame(QSize(GB_VIDEO_HORIZONTAL_PIXELS * i, GB_VIDEO_VERTICAL_PIXELS * i));
#endif
@ -594,7 +595,7 @@ void Window::resizeEvent(QResizeEvent* event) {
}
int factor = 0;
QSize size(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
QSize size(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
if (m_controller) {
size = m_controller->screenDimensions();
}
@ -639,8 +640,8 @@ void Window::closeEvent(QCloseEvent* event) {
m_config->setQtOption("windowPos", pos());
if (m_savedScale > 0) {
m_config->setOption("height", VIDEO_VERTICAL_PIXELS * m_savedScale);
m_config->setOption("width", VIDEO_HORIZONTAL_PIXELS * m_savedScale);
m_config->setOption("height", GBA_VIDEO_VERTICAL_PIXELS * m_savedScale);
m_config->setOption("width", GBA_VIDEO_HORIZONTAL_PIXELS * m_savedScale);
}
saveConfig();
m_display.reset();
@ -861,7 +862,7 @@ void Window::gameStopped() {
#ifdef M_CORE_GB
m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS);
#elif defined(M_CORE_GBA)
m_display->setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
m_display->setMinimumSize(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
#endif
}
@ -966,7 +967,7 @@ void Window::reloadDisplayDriver() {
#ifdef M_CORE_GB
m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS);
#elif defined(M_CORE_GBA)
m_display->setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
m_display->setMinimumSize(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
#endif
}
}
@ -1471,7 +1472,7 @@ void Window::setupMenu(QMenuBar* menubar) {
}
connect(setSize, &QAction::triggered, [this, i, setSize]() {
showNormal();
QSize size(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);
QSize size(GBA_VIDEO_HORIZONTAL_PIXELS, GBA_VIDEO_VERTICAL_PIXELS);
if (m_controller) {
size = m_controller->screenDimensions();
}

View File

@ -12,7 +12,7 @@
#include "Window.h"
#include <mgba/core/version.h>
#include <mgba/internal/gba/video.h>
#include <mgba/gba/interface.h>
#include <QLibraryInfo>
#include <QTranslator>
@ -94,7 +94,7 @@ int main(int argc, char* argv[]) {
freeArguments(&args);
if (graphicsOpts.multiplier) {
w->resizeFrame(QSize(VIDEO_HORIZONTAL_PIXELS * graphicsOpts.multiplier, VIDEO_VERTICAL_PIXELS * graphicsOpts.multiplier));
w->resizeFrame(QSize(GBA_VIDEO_HORIZONTAL_PIXELS * graphicsOpts.multiplier, GBA_VIDEO_VERTICAL_PIXELS * graphicsOpts.multiplier));
}
if (graphicsOpts.fullscreen) {
w->enterFullScreen();

View File

@ -55,7 +55,7 @@ bool mSDLInit(struct SDLSoftwareRenderer* renderer) {
ioctl(renderer->fb, OMAPFB_SETUP_PLANE, &plane);
}
mem.size = VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4;
mem.size = GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4;
ioctl(renderer->fb, OMAPFB_SETUP_MEM, &mem);
plane.enabled = 1;
@ -67,19 +67,19 @@ bool mSDLInit(struct SDLSoftwareRenderer* renderer) {
struct fb_var_screeninfo info;
ioctl(renderer->fb, FBIOGET_VSCREENINFO, &info);
info.xres = VIDEO_HORIZONTAL_PIXELS;
info.yres = VIDEO_VERTICAL_PIXELS;
info.xres_virtual = VIDEO_HORIZONTAL_PIXELS;
info.yres_virtual = VIDEO_VERTICAL_PIXELS * 2;
info.xres = GBA_VIDEO_HORIZONTAL_PIXELS;
info.yres = GBA_VIDEO_VERTICAL_PIXELS;
info.xres_virtual = GBA_VIDEO_HORIZONTAL_PIXELS;
info.yres_virtual = GBA_VIDEO_VERTICAL_PIXELS * 2;
info.bits_per_pixel = 16;
ioctl(renderer->fb, FBIOPUT_VSCREENINFO, &info);
renderer->odd = 0;
renderer->base[0] = mmap(0, VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4, PROT_READ | PROT_WRITE, MAP_SHARED, renderer->fb, 0);
renderer->base[1] = (uint16_t*) renderer->base[0] + VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS;
renderer->base[0] = mmap(0, GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4, PROT_READ | PROT_WRITE, MAP_SHARED, renderer->fb, 0);
renderer->base[1] = (uint16_t*) renderer->base[0] + GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS;
renderer->d.outputBuffer = renderer->base[0];
renderer->d.outputBufferStride = VIDEO_HORIZONTAL_PIXELS;
renderer->d.outputBufferStride = GBA_VIDEO_HORIZONTAL_PIXELS;
return true;
}
@ -94,7 +94,7 @@ void mSDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer
if (mCoreSyncWaitFrameStart(&context->sync)) {
struct fb_var_screeninfo info;
ioctl(renderer->fb, FBIOGET_VSCREENINFO, &info);
info.yoffset = VIDEO_VERTICAL_PIXELS * renderer->odd;
info.yoffset = GBA_VIDEO_VERTICAL_PIXELS * renderer->odd;
ioctl(renderer->fb, FBIOPAN_DISPLAY, &info);
int arg = 0;
@ -108,7 +108,7 @@ void mSDLRunloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer
}
void mSDLDeinit(struct SDLSoftwareRenderer* renderer) {
munmap(renderer->base[0], VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4);
munmap(renderer->base[0], GBA_VIDEO_HORIZONTAL_PIXELS * GBA_VIDEO_VERTICAL_PIXELS * 4);
struct omapfb_plane_info plane;
struct omapfb_mem_info mem;