Skip to content

Commit

Permalink
Merge branch 'feature/input-revamp' into medusa
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Oct 5, 2017
2 parents bfb8e02 + 079ceea commit d1e96a0
Show file tree
Hide file tree
Showing 653 changed files with 27,278 additions and 2,077 deletions.
63 changes: 59 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,72 @@ Misc:
0.7.0: (Future)
Features:
- ELF support
- Game Boy Camera support
- Qt: Set default Game Boy colors
- Game Boy Printer support
- Super Game Boy support
- Customizable autofire speed
- Ability to set default Game Boy model
- Map viewer
Bugfixes:
- GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749)
- Python: Fix importing .gb or .gba before .core
- GBA: Reset active region as needed when loading a ROM
- Qt: Fix command line debugger closing second game
- GB Serialize: Fix audio state loading
- GB Video: Fix dot clock timing being slightly wrong
- Qt: Fix GL display when loading a game from CLI (fixes mgba.io/i/843)
- ARM: Fix MSR when T bit is set
- GB Serialize: Fix game title check
- GB: Revamp IRQ handling based on new information
Misc:
- GBA Timer: Use global cycles for timers
- GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
- All: Make FIXED_ROM_BUFFER an option instead of 3DS-only
- Qt: Don't rebuild library view if style hasn't changed
- Qt: Redo GameController into multiple classes
- Test: Restructure test suite into multiple executables
- Python: Integrate tests from cinema test suite
- Util: Don't build crc32 if the function already exists

0.6.1: (2017-10-01)
Bugfixes:
- GB, GBA: Fix crashes when attempting to identify null VFiles
- GB, GBA: Fix sync to video with frameskip
- GB, GBA Savedata: Fix savestate-related save overwriting (fixes mgba.io/i/834)
- GB Audio: Fix NRx2 writes while active (fixes mgba.io/i/866)
- GB Core: Fix palette loading when loading a foreign config
- GB MBC: Pocket Cam memory should be accessible without enabling
- GB MBC: Fix SRAM sizes 4 and 5
- GB MBC: Fix RTC initialization (fixes mgba.io/i/825)
- GB MBC: Fix RTC loading when file size is off
- GB Memory: Initialize peripheral pointers
- GB Memory: Prevent accessing empty SRAM (fixes mgba.io/i/831)
- GB Memory: Fix HDMA count starting in mode 0 (fixes mgba.io/i/855)
- GB Memory: Actually load latch time from savestate
- GB Serialize: Fix deserializing video STAT
- GB Video: Fix 16-bit screenshots (fixes mgba.io/i/826)
- GB Video: Fix potential hang when ending mode 0
- GB Video: Fix read mode when enabling LCD
- GBA: Reset active region as needed when loading a ROM
- GBA: Fix keypad IRQs not firing when extra buttons are pressed
- GBA BIOS: Use core's VRAM variable instead of renderer's
- GBA Cheats: Fix PARv3 multiline blocks (fixes mgba.io/i/889)
- GBA I/O: Fix reading from a few invalid I/O registers (fixes mgba.io/i/876)
- GBA Savedata: Fix 512 byte EEPROM saving as 8kB (fixes mgba.io/i/877)
- GBA Savedata: Fix size of SRAM saves (fixes mgba.io/i/883)
- GBA Video: Fix broken sprite blending hack (fixes mgba.io/i/532)
- Python: Fix importing .gb or .gba before .core
- Qt: Fix command line debugger closing second game
- Qt: Fix LOG argument order
- Qt: Fix timezone issues with time overrides
- Qt: Fix sprite export pausing game indefinitely (fixes mgba.io/i/841)
- SDL: Fix potential race condition when pressing keys (fixes mgba.io/i/872)
Misc:
- CMake: Fix CPack dependencies for libpng 1.6
- GBA: Detect hardware for Pokémon FireRed ROM hacks
- GBA Cheats: Improve detection of raw cheats
- Qt: Don't rebuild library view if style hasn't changed
- Qt: Allow overrides to be saved before a game is loaded
- Qt: Hide mouse immediately when loading
- SDL: Fix 2.0.5 build on macOS under some circumstances
- VFS: Make VFile.truncate work growing files on PSV (fixes mgba.io/i/885)

0.6.0: (2017-07-16)
Features:
Expand Down
42 changes: 30 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ file(GLOB GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/gui/*.c ${CMAKE_CURRENT_S
file(GLOB GBA_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/renderers/*.c)
file(GLOB GBA_SIO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/sio/lockstep.c)
file(GLOB GBA_EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gba/extra/*.c)
file(GLOB GB_SIO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/sio/lockstep.c)
file(GLOB GB_SIO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/sio/*.c)
file(GLOB GB_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/renderers/*.c)
file(GLOB GB_EXTRA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/gb/extra/*.c)
file(GLOB DS_RENDERER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/ds/renderers/*.c ${CMAKE_CURRENT_SOURCE_DIR}/src/ds/gx/*.c)
Expand Down Expand Up @@ -129,6 +129,7 @@ function(find_feature FEATURE_NAME FEATURE_REQUIRES)
set(${UREQUIRE}_CFLAGS_OTHER ${${REQUIRE}_CFLAGS_OTHER} PARENT_SCOPE)
set(${UREQUIRE}_FOUND ${${REQUIRE}_FOUND} PARENT_SCOPE)
set(${UREQUIRE}_INCLUDE_DIRS ${${REQUIRE}_INCLUDE_DIRS} PARENT_SCOPE)
set(${UREQUIRE}_VERSION_STRING ${${REQUIRE}_VERSION_STRING} PARENT_SCOPE)
if (APPLE)
set(IS_FRAMEWORK OFF)
set(LIBS)
Expand Down Expand Up @@ -518,6 +519,14 @@ if(USE_ZLIB)
include_directories(AFTER ${ZLIB_INCLUDE_DIRS})
list(APPEND DEPENDENCY_LIB ${ZLIB_LIBRARIES})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},zlib1g")
set(HAVE_CRC32 ON)
else()
# zlib pulls in crc32
check_function_exists(crc32 HAVE_CRC32)
endif()

if(HAVE_CRC32)
list(APPEND FUNCTION_DEFINES HAVE_CRC32)
endif()

if(WANT_PNG AND USE_ZLIB AND NOT USE_PNG)
Expand All @@ -536,7 +545,15 @@ if(USE_PNG)
list(APPEND FEATURES PNG)
include_directories(AFTER ${PNG_INCLUDE_DIRS})
list(APPEND DEPENDENCY_LIB ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libpng12-0")
if(PNG_VERSION_STRING)
string(REGEX MATCH "^[0-9]+\\.[0-9]+" PNG_VERSION_PARTIAL ${PNG_VERSION_STRING})
if(${PNG_VERSION_PARTIAL} STREQUAL "1.6")
set(PNG_DEB_VERSION "16-16")
else()
set(PNG_DEB_VERSION "12-0")
endif()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libpng${PNG_DEB_VERSION}")
endif()
endif()

if(WANT_SQLITE3 AND NOT USE_SQLITE3)
Expand Down Expand Up @@ -625,10 +642,6 @@ endif()
if(USE_ELF)
list(APPEND FEATURES ELF)
include_directories(AFTER ${LIBELF_INCLUDE_DIRS})
find_file(ELF_REPL_H elf_repl.h PATHS ${LIBELF_INCLUDE_DIRS} NO_CMAKE_FIND_ROOT_PATH)
if (ELF_REPL_H)
add_definitions(-DUSE_ELF_REPL)
endif()
list(APPEND DEPENDENCY_LIB ${LIBELF_LIBRARIES})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libelfg0")
endif()
Expand All @@ -637,8 +650,7 @@ if(ENABLE_SCRIPTING)
list(APPEND ENABLES SCRIPTING)

if(BUILD_PYTHON)
find_program(PYTHON python)
include(FindPythonLibs)
find_package(PythonLibs ${USE_PYTHON_VERSION})
list(APPEND DEPENDENCY_LIB ${PYTHON_LIBRARIES})
include_directories(AFTER ${PYTHON_INCLUDE_DIRS})
list(APPEND ENABLES PYTHON)
Expand Down Expand Up @@ -892,10 +904,16 @@ if(BUILD_SUITE)
include_directories(AFTER ${CMOCKA_INCLUDE_DIRS})
link_directories(${CMOCKA_LIBRARY_DIRS})

add_executable(${BINARY_NAME}-suite ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/test/suite-main.c ${TEST_SRC})
target_link_libraries(${BINARY_NAME}-suite ${BINARY_NAME} ${PLATFORM_LIBRARY} cmocka)
set_target_properties(${BINARY_NAME}-suite PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
add_test(${BINARY_NAME}-suite ${BINARY_NAME}-suite)
foreach(TEST IN LISTS TEST_SRC)
string(REPLACE "${CMAKE_SOURCE_DIR}/src/" "" TEST_NAME "${TEST}")
string(REPLACE "/" "-" TEST_NAME "${TEST_NAME}")
string(REPLACE "-test" "" TEST_NAME "${TEST_NAME}")
string(REPLACE ".c" "" TEST_NAME "${TEST_NAME}")
add_executable(test-${TEST_NAME} ${TEST})
target_link_libraries(test-${TEST_NAME} ${BINARY_NAME} ${PLATFORM_LIBRARY} cmocka)
set_target_properties(test-${TEST_NAME} PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
add_test(${TEST_NAME} test-${TEST_NAME})
endforeach()
endif()

if(BUILD_EXAMPLE)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Features
- Save type detection, even for flash memory size[<sup>[3]</sup>](#flashdetect).
- Support for cartridges with motion sensors and rumble (only usable with game controllers)[<sup>[2]</sup>](#dscaveat).
- Real-time clock support, even without configuration.
- Game Boy Camera and Game Boy Printer support.
- A built-in GBA BIOS implementation, and ability to load external BIOS files. DS currently requires BIOS and firmware dumps[<sup>[2]</sup>](#dscaveat).
- Turbo/fast-forward support by holding Tab.
- Rewind by holding Backquote.
Expand Down Expand Up @@ -46,7 +47,6 @@ Features
- A comprehensive debug suite.
- e-Reader support.
- Wireless adapter support.
- Game Boy Printer support.
- OpenGL renderer.
- HLE support for DS BIOS and DS ARM7 processor.
- Synthesizing a customizable DS firmware to avoid needing a dump.
Expand Down
4 changes: 1 addition & 3 deletions include/mgba-util/arm-algo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
#define ARM_ALGO_H

#ifdef __arm__
void _to16Bit(uint16_t* dest, uint32_t* src, size_t words);

#if defined(__ARM_NEON)
void _neon2x(void* dest, void* src, int width, int height);
void _neon4x(void* dest, void* src, int width, int height);
#endif
#endif

#endif
#endif
7 changes: 6 additions & 1 deletion include/mgba-util/crc32.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ CXX_GUARD_START

struct VFile;

#ifndef HAVE_CRC32
uint32_t crc32(uint32_t crc, const void* buf, size_t size);
#else
#include <zlib.h>
#endif

uint32_t doCrc32(const void* buf, size_t size);
uint32_t updateCrc32(uint32_t crc, const void* buf, size_t size);
uint32_t fileCrc32(struct VFile* file, size_t endOffset);

CXX_GUARD_END
Expand Down
6 changes: 0 additions & 6 deletions include/mgba-util/elf-read.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ CXX_GUARD_START

#include <libelf.h>

#if USE_ELF_REPL
#include <elf_repl.h>
#else
#include <elf.h>
#endif

#include <mgba-util/vector.h>

struct ELF;
Expand Down
2 changes: 2 additions & 0 deletions include/mgba-util/png-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ enum {

png_structp PNGWriteOpen(struct VFile* source);
png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height);
png_infop PNGWriteHeaderA(png_structp png, unsigned width, unsigned height);
png_infop PNGWriteHeader8(png_structp png, unsigned width, unsigned height);
bool PNGWritePalette(png_structp png, png_infop info, const uint32_t* palette, unsigned entries);
bool PNGWritePixels(png_structp png, unsigned width, unsigned height, unsigned stride, const void* pixels);
bool PNGWritePixelsA(png_structp png, unsigned width, unsigned height, unsigned stride, const void* pixels);
bool PNGWritePixels8(png_structp png, unsigned width, unsigned height, unsigned stride, const void* pixels);
bool PNGWriteCustomChunk(png_structp png, const char* name, size_t size, void* data);
void PNGWriteClose(png_structp png, png_infop info);
Expand Down
35 changes: 35 additions & 0 deletions include/mgba/core/cache-set.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2013-2017 Jeffrey Pfau
*
* 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/. */
#ifndef M_CACHE_SET_H
#define M_CACHE_SET_H

#include <mgba-util/common.h>

CXX_GUARD_START

#include <mgba/core/map-cache.h>
#include <mgba/core/tile-cache.h>
#include <mgba-util/vector.h>

DECLARE_VECTOR(mMapCacheSet, struct mMapCache);
DECLARE_VECTOR(mTileCacheSet, struct mTileCache);

struct mCacheSet {
struct mMapCacheSet maps;
struct mTileCacheSet tiles;
};

void mCacheSetInit(struct mCacheSet*, size_t nMaps, size_t nTiles);
void mCacheSetDeinit(struct mCacheSet*);

void mCacheSetAssignVRAM(struct mCacheSet*, void* vram);

void mCacheSetWriteVRAM(struct mCacheSet*, uint32_t address);
void mCacheSetWritePalette(struct mCacheSet*, uint32_t entry, color_t color);

CXX_GUARD_END

#endif
49 changes: 49 additions & 0 deletions include/mgba/core/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,50 @@ typedef uint32_t color_t;
#define M_RGB8_TO_BGR5(X) ((((X) & 0xF8) >> 3) | (((X) & 0xF800) >> 6) | (((X) & 0xF80000) >> 9))
#define M_RGB8_TO_RGB5(X) ((((X) & 0xF8) << 7) | (((X) & 0xF800) >> 6) | (((X) & 0xF80000) >> 19))

#ifndef PYCPARSE
static inline color_t mColorFrom555(uint16_t value) {
#ifdef COLOR_16_BIT
#ifdef COLOR_5_6_5
color_t color = 0;
color |= (value & 0x001F) << 11;
color |= (value & 0x03E0) << 1;
color |= (value & 0x7C00) >> 10;
#else
color_t color = value;
#endif
#else
color_t color = M_RGB5_TO_BGR8(value);
color |= (color >> 5) & 0x070707;
#endif
return color;
}
#endif

struct blip_t;

enum mColorFormat {
mCOLOR_XBGR8 = 0x00001,
mCOLOR_XRGB8 = 0x00002,
mCOLOR_BGRX8 = 0x00004,
mCOLOR_RGBX8 = 0x00008,
mCOLOR_ABGR8 = 0x00010,
mCOLOR_ARGB8 = 0x00020,
mCOLOR_BGRA8 = 0x00040,
mCOLOR_RGBA8 = 0x00080,
mCOLOR_RGB5 = 0x00100,
mCOLOR_BGR5 = 0x00200,
mCOLOR_RGB565 = 0x00400,
mCOLOR_BGR565 = 0x00800,
mCOLOR_ARGB5 = 0x01000,
mCOLOR_ABGR5 = 0x02000,
mCOLOR_RGBA5 = 0x04000,
mCOLOR_BGRA5 = 0x08000,
mCOLOR_RGB8 = 0x10000,
mCOLOR_BGR8 = 0x20000,

mCOLOR_ANY = -1
};

struct mCoreCallbacks {
void* context;
void (*videoFrameStarted)(void* context);
Expand All @@ -62,6 +104,7 @@ struct mKeyCallback {
enum mPeripheral {
mPERIPH_ROTATION = 1,
mPERIPH_RUMBLE,
mPERIPH_IMAGE_SOURCE,
mPERIPH_CUSTOM = 0x1000
};

Expand All @@ -83,6 +126,12 @@ struct mRTCSource {
bool (*deserialize)(struct mRTCSource*, const struct mStateExtdataItem*);
};

struct mImageSource {
void (*startRequestImage)(struct mImageSource*, unsigned w, unsigned h, int colorFormats);
void (*stopRequestImage)(struct mImageSource*);
void (*requestImage)(struct mImageSource*, const void** buffer, size_t* stride, enum mColorFormat* colorFormat);
};

enum mRTCGenericType {
RTC_NO_OVERRIDE,
RTC_FIXED,
Expand Down
Loading

0 comments on commit d1e96a0

Please sign in to comment.