Merge branch 'master' (early part) into medusa

This commit is contained in:
Vicki Pfau 2022-05-29 22:17:38 -07:00
commit ab4da41933
117 changed files with 25227 additions and 7016 deletions

View File

@ -7,7 +7,7 @@ configuration:
cache:
- C:\Tools\vcpkg
install:
- git -C C:\Tools\vcpkg clean -dfq docs ports scripts toolsrc versions
- git -C C:\Tools\vcpkg clean -dfq docs ports scripts toolsrc triplets versions
- git -C C:\Tools\vcpkg pull --force --quiet
- C:\Tools\vcpkg\bootstrap-vcpkg
- vcpkg --triplet x64-windows --recurse install ffmpeg libepoxy libpng libzip sdl2 sqlite3

37
CHANGES
View File

@ -49,35 +49,54 @@ Features:
- Support for 64 kiB SRAM saves used in some bootlegs
- Discord Rich Presence now supports time elapsed
- Additional scaling shaders
- Support for GameShark Advance SP (.gsv) save file importing
Emulation fixes:
- ARM7: Fix unsigned multiply timing
- GB Memory: Add cursory cartridge open bus emulation (fixes mgba.io/i/2032)
- GB Video: Draw SGB border pieces that overlap GB graphics (fixes mgba.io/i/1339)
- GBA: Improve timing when not booting from BIOS
- GBA BIOS: Work around IRQ handling hiccup in Mario & Luigi (fixes mgba.io/i/1059)
- GBA I/O: Redo internal key input, enabling edge-based key IRQs
- GBA I/O: Disable open bus behavior on invalid register 06A
- GBA Memory: Fix misaligned 32-bit I/O loads (fixes mgba.io/i/2307)
Other fixes:
- Core: Don't attempt to restore rewind diffs past start of rewind
- FFmpeg: Fix crash when encoding audio with some containers
Misc:
- Core: Suspend runloop when a core crashes
- GB Video: Add default SGB border
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)
- Qt: Rearrange menus some
- Qt: Clean up cheats dialog
- Qt: Only set default controller bindings if loading fails (fixes mgba.io/i/799)
- Qt: Save converter now supports importing GameShark Advance saves
- Qt: Save positions of multiplayer windows (closes mgba.io/i/2128)
- Windows: Attach to console if present
0.9.3: (2021-12-17)
Emulation fixes:
- GB I/O: Fix incrementing SGB controller when P14 is low (fixes mgba.io/i/2202)
- GB Memory: Add cursory cartridge open bus emulation (fixes mgba.io/i/2032)
- GB Video: Render SGB border when unmasking with ATTR/PAL_SET (fixes mgba.io/i/2261)
- GBA: Improve timing when not booting from BIOS
- GBA I/O: Redo internal key input, enabling edge-based key IRQs
- GBA Memory: Fix misaligned 32-bit I/O loads (fixes mgba.io/i/2307)
- GBA SIO: Fix SI value for unattached MULTI mode
- GBA Video: Fix backdrop color if DISPCNT is first set to 0 (fixes mgba.io/i/2260)
- GBA Video: Don't iterate affine backgrounds when disabled
- GBA Video: Delay enabling backgrounds in bitmap modes (fixes mgba.io/i/1668)
Other fixes:
- ARM Decoder: Fix decoding of lsl r0 (fixes mgba.io/i/2349)
- Core: Don't attempt to restore rewind diffs past start of rewind
- FFmpeg: Don't attempt to use YUV 4:2:0 for lossless videos (fixes mgba.io/i/2084)
- GB Video: Fix memory leak when reseting SGB games
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
- GBA: Fix maximum tile ID in caching for 256-color modes
- GBA Video: Fix cache updating with proxy and GL renderers
- Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281)
- mGUI: Fix crash if autosave file can't be opened (fixes mgba.io/i/2268)
- Qt: Remove potentially deadlocking optimization
- Qt: Fix corrupted savestate and fatal error text
- Qt: Fix sprite compositing when sprite tiles go out of bounds (fixes mgba.io/i/2348)
Misc:
- Core: Suspend runloop when a core crashes
- GBA I/O: Update KEYINPUT in internal I/O memory (fixes mgba.io/i/2235)
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)
- Qt: Rearrange menus some
- Qt: Clean up cheats dialog
- Qt: Only set default controller bindings if loading fails (fixes mgba.io/i/799)
- SDL: Use SDL_JoystickRumble where available
- Wii: Add adjustable gyroscope settings (closes mgba.io/i/2245)
0.9.2: (2021-07-10)

View File

@ -324,6 +324,8 @@ find_function(setlocale)
find_function(snprintf_l)
find_function(uselocale)
find_function(popcount32)
find_function(futimens)
find_function(futimes)
@ -372,7 +374,7 @@ if(USE_PTHREADS)
endif()
endif()
if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE)
if(HAVE_NEWLOCALE AND HAVE_FREELOCALE OR APPLE)
list(APPEND FUNCTION_DEFINES HAVE_LOCALE)
if (HAVE_SNPRINTF_L)
list(APPEND FUNCTION_DEFINES HAVE_SNPRINTF_L)
@ -958,6 +960,7 @@ endif()
if(BUILD_UPDATER)
add_executable(updater-stub WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater-main.c)
target_link_libraries(updater-stub ${OS_LIB} ${PLATFORM_LIBRARY} ${BINARY_NAME})
set_target_properties(updater-stub PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FUNCTION_DEFINES}")
if(MSVC)
set_target_properties(updater-stub PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup)
else()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,4 @@
[testinfo]
skip=10
frames=14
input=0:0001,2:0003,7:0000,8:0001,12:0003,13:0001

BIN
cinema/gba/irq/keyirq/test.gba Executable file

Binary file not shown.

View File

@ -48,6 +48,17 @@ enum GUIKeyboardStatus {
GUI_KEYBOARD_CANCEL,
};
enum GUIKeyFunction {
GUI_KEYFUNC_INPUT_DATA = 0,
GUI_KEYFUNC_CHANGE_KB,
GUI_KEYFUNC_SHIFT_KB,
GUI_KEYFUNC_BACKSPACE,
GUI_KEYFUNC_ENTER,
GUI_KEYFUNC_CANCEL,
GUI_KEYFUNC_LEFT,
GUI_KEYFUNC_RIGHT,
};
enum {
BATTERY_EMPTY = 0,
BATTERY_LOW = 25,
@ -72,6 +83,21 @@ struct GUIKeyboardParams {
bool multiline;
};
struct GUIKey {
const char* name;
const void* data;
int width;
enum GUIKeyFunction function;
};
struct GUIKeyboard {
struct {
int offset;
struct GUIKey* keys;
} rows[5];
int width;
};
struct GUIParams {
unsigned width;
unsigned height;

View File

@ -84,6 +84,19 @@ enum GUIIcon {
GUI_ICON_9SLICE_CAP_SWW,
GUI_ICON_9SLICE_CAP_SSE,
GUI_ICON_9SLICE_CAP_SEE,
GUI_ICON_9SLICE_FILL_ONLY_NW,
GUI_ICON_9SLICE_FILL_ONLY_N,
GUI_ICON_9SLICE_FILL_ONLY_NE,
GUI_ICON_9SLICE_FILL_ONLY_W,
GUI_ICON_9SLICE_FILL_ONLY_C,
GUI_ICON_9SLICE_FILL_ONLY_E,
GUI_ICON_9SLICE_FILL_ONLY_SW,
GUI_ICON_9SLICE_FILL_ONLY_S,
GUI_ICON_9SLICE_FILL_ONLY_SE,
GUI_ICON_BACKSPACE,
GUI_ICON_KBD_SHIFT,
GUI_ICON_CAPSLOCK,
GUI_ICON_TEXT_CURSOR,
GUI_ICON_MAX,
};
@ -109,11 +122,13 @@ enum GUI9SliceStyle {
GUI_9SLICE_FILLED,
GUI_9SLICE_EMPTY,
GUI_9SLICE_EMPTY_CAPPED,
GUI_9SLICE_FILL_ONLY,
};
unsigned GUIFontHeight(const struct GUIFont*);
unsigned GUIFontGlyphWidth(const struct GUIFont*, uint32_t glyph);
unsigned GUIFontSpanWidth(const struct GUIFont*, const char* text);
unsigned GUIFontSpanCountWidth(const struct GUIFont*, const char* text, size_t len);
void GUIFontIconMetrics(const struct GUIFont*, enum GUIIcon icon, unsigned* w, unsigned* h);
ATTRIBUTE_FORMAT(printf, 6, 7)

View File

@ -10,6 +10,7 @@
CXX_GUARD_START
#include <mgba-util/gui.h>
#include <mgba-util/vector.h>
#define GUI_V_V (struct GUIVariant) { .type = GUI_VARIANT_VOID }
@ -60,6 +61,7 @@ struct GUIMenuItem {
const struct GUIVariant* stateMappings;
unsigned nStates;
struct GUIMenu* submenu;
bool readonly;
};
DECLARE_VECTOR(GUIMenuItemList, struct GUIMenuItem);
@ -73,10 +75,29 @@ struct GUIMenu {
struct GUIBackground* background;
};
struct GUIMenuSavedState {
struct GUIMenu* menu;
size_t start;
};
DECLARE_VECTOR(GUIMenuSavedList, struct GUIMenuSavedState);
struct GUIMenuState {
size_t start;
int cursorOverItem;
enum GUICursorState cursor;
unsigned cx, cy;
struct GUIMenuSavedList stack;
struct GUIMenuItem* resultItem;
};
enum GUIMenuExitReason {
GUI_MENU_CONTINUE = 0,
GUI_MENU_EXIT_ACCEPT,
GUI_MENU_EXIT_BACK,
GUI_MENU_EXIT_CANCEL,
GUI_MENU_ENTER,
};
enum GUIMessageBoxButtons {
@ -85,7 +106,11 @@ enum GUIMessageBoxButtons {
};
struct GUIParams;
void GUIMenuStateInit(struct GUIMenuState*);
void GUIMenuStateDeinit(struct GUIMenuState*);
enum GUIMenuExitReason GUIShowMenu(struct GUIParams* params, struct GUIMenu* menu, struct GUIMenuItem** item);
enum GUIMenuExitReason GUIMenuRun(struct GUIParams* params, struct GUIMenu* menu, struct GUIMenuState* state);
ATTRIBUTE_FORMAT(printf, 4, 5)
enum GUIMenuExitReason GUIShowMessageBox(struct GUIParams* params, int buttons, int frames, const char* format, ...);

View File

@ -10,11 +10,13 @@
CXX_GUARD_START
#ifndef HAVE_POPCOUNT32
static inline uint32_t popcount32(unsigned bits) {
bits = bits - ((bits >> 1) & 0x55555555);
bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
return (((bits + (bits >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
}
#endif
static inline unsigned clz32(uint32_t bits) {
#if defined(__GNUC__) || __clang__

View File

@ -94,6 +94,8 @@ static inline int ThreadSetName(const char* name) {
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), name);
return 0;
#elif defined(__NetBSD__)
return pthread_setname_np(pthread_self(), "%s", (void *) name);
#elif defined(HAVE_PTHREAD_SETNAME_NP)
return pthread_setname_np(pthread_self(), name);
#else

View File

@ -78,6 +78,7 @@ bool mCoreConfigIsPortable(void);
#endif
const char* mCoreConfigGetValue(const struct mCoreConfig*, const char* key);
bool mCoreConfigGetBoolValue(const struct mCoreConfig*, const char* key, bool* value);
bool mCoreConfigGetIntValue(const struct mCoreConfig*, const char* key, int* value);
bool mCoreConfigGetUIntValue(const struct mCoreConfig*, const char* key, unsigned* value);
bool mCoreConfigGetFloatValue(const struct mCoreConfig*, const char* key, float* value);

View File

@ -196,6 +196,7 @@ struct mAVStream {
struct mKeyCallback {
uint16_t (*readKeys)(struct mKeyCallback*);
bool requireOpposingDirections;
};
enum mPeripheral {

View File

@ -31,6 +31,8 @@ DECL_BIT(mMapCacheEntryFlags, HMirror, 5);
DECL_BIT(mMapCacheEntryFlags, VMirror, 6);
DECL_BITS(mMapCacheEntryFlags, Mirror, 5, 2);
#define mMapCacheTileCount(C) (1 << mMapCacheSystemInfoGetTilesWide((C)->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh((C)->sysConfig))
struct mMapCacheEntry {
uint32_t vramVersion;
uint16_t tileId;

View File

@ -17,6 +17,7 @@ enum mStateExtdataTag {
EXTDATA_CHEATS = 3,
EXTDATA_RTC = 4,
EXTDATA_META_TIME = 0x101,
EXTDATA_META_CREATOR = 0x102,
EXTDATA_MAX
};

View File

@ -100,9 +100,9 @@ enum GBIORegisters {
GB_REG_OCPD = 0x6B,
GB_REG_OPRI = 0x6C,
GB_REG_SVBK = 0x70,
GB_REG_UNK72 = 0x72,
GB_REG_UNK73 = 0x73,
GB_REG_UNK74 = 0x74,
GB_REG_PSWX = 0x72,
GB_REG_PSWY = 0x73,
GB_REG_PSW = 0x74,
GB_REG_UNK75 = 0x75,
GB_REG_PCM12 = 0x76,
GB_REG_PCM34 = 0x77,

View File

@ -60,6 +60,7 @@ struct GBVideoSoftwareRenderer {
uint8_t sgbPacket[128];
uint8_t sgbCommandHeader;
bool sgbBorders;
uint32_t sgbBorderMask[18];
uint8_t lastHighlightAmount;
};

View File

@ -18,13 +18,6 @@ mLOG_DECLARE_CATEGORY(GBA_HW);
#define IS_GPIO_REGISTER(reg) ((reg) == GPIO_REG_DATA || (reg) == GPIO_REG_DIRECTION || (reg) == GPIO_REG_CONTROL)
struct GBARTCGenericSource {
struct mRTCSource d;
struct GBA* p;
enum mRTCGenericType override;
int64_t value;
};
enum GBAHardwareDevice {
HW_NO_OVERRIDE = 0x8000,
HW_NONE = 0,
@ -136,8 +129,6 @@ void GBAHardwareGPIOWrite(struct GBACartridgeHardware* gpio, uint32_t address, u
void GBAHardwareTiltWrite(struct GBACartridgeHardware* gpio, uint32_t address, uint8_t value);
uint8_t GBAHardwareTiltRead(struct GBACartridgeHardware* gpio, uint32_t address);
void GBARTCGenericSourceInit(struct GBARTCGenericSource* rtc, struct GBA* gba);
struct GBASerializedState;
void GBAHardwareSerialize(const struct GBACartridgeHardware* gpio, struct GBASerializedState* state);
void GBAHardwareDeserialize(struct GBACartridgeHardware* gpio, const struct GBASerializedState* state);

View File

@ -184,7 +184,11 @@ mLOG_DECLARE_CATEGORY(GBA_STATE);
* 0x002C4 - 0x002C7: Game Boy Player next event
* 0x002C8 - 0x002CB: Current DMA transfer word
* 0x002CC - 0x002CF: Last DMA transfer PC
* 0x002D0 - 0x002DF: Reserved (leave zero)
* 0x002D0 - 0x002DF: Matrix memory command buffer
* | 0x002D0 - 0x002D3: Command
* | 0x002D4 - 0x002D7: Physical address
* | 0x002D8 - 0x002DB: Virtual address
* | 0x002DC - 0x002DF: Size
* 0x002E0 - 0x002EF: Savedata state
* | 0x002E0 - 0x002E0: Savedata type
* | 0x002E1 - 0x002E1: Savedata command (see savedata.h)
@ -208,12 +212,16 @@ mLOG_DECLARE_CATEGORY(GBA_STATE);
* 0x00310 - 0x00317: Global cycle counter
* 0x00318 - 0x0031B: Last prefetched program counter
* 0x0031C - 0x0031F: Miscellaneous flags
* | bit 0: Is CPU halted?
* | bit 1: POSTFLG
* | bit 2: Is IRQ pending?
* | bit 0: Is CPU halted?
* | bit 1: POSTFLG
* | bit 2: Is IRQ pending?
* | bit 3: Is CPU blocked?
* | bits 4 - 14: Active key IRQ keys
* | bits 15 - 31: Reserved
* 0x00320 - 0x00323: Next IRQ event
* 0x00324 - 0x00327: Interruptable BIOS stall cycles
* 0x00328 - 0x003FF: Reserved (leave zero)
* 0x00328 - 0x00367: Matrix memory mapping table
* 0x00368 - 0x003FF: Reserved (leave zero)
* 0x00400 - 0x007FF: I/O memory
* 0x00800 - 0x00BFF: Palette
* 0x00C00 - 0x00FFF: OAM
@ -255,6 +263,7 @@ DECL_BIT(GBASerializedMiscFlags, Halted, 0);
DECL_BIT(GBASerializedMiscFlags, POSTFLG, 1);
DECL_BIT(GBASerializedMiscFlags, IrqPending, 2);
DECL_BIT(GBASerializedMiscFlags, Blocked, 3);
DECL_BITS(GBASerializedMiscFlags, KeyIRQKeys, 4, 11);
struct GBASerializedState {
uint32_t versionMagic;

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
/* Copyright (c) 2013-2021 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
@ -13,9 +13,15 @@ CXX_GUARD_START
struct GBA;
struct VFile;
int GBASavedataSharkPortPayloadSize(struct VFile* vf);
void* GBASavedataSharkPortGetPayload(struct VFile* vf, size_t* size, uint8_t* header, bool testChecksum);
bool GBASavedataImportSharkPort(struct GBA* gba, struct VFile* vf, bool testChecksum);
bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf);
int GBASavedataGSVPayloadSize(struct VFile* vf);
void* GBASavedataGSVGetPayload(struct VFile* vf, size_t* size, uint8_t* ident, bool testChecksum);
bool GBASavedataImportGSV(struct GBA* gba, struct VFile* vf, bool testChecksum);
CXX_GUARD_END
#endif

View File

@ -23,6 +23,8 @@ struct GBASIOPlayer {
int txPosition;
struct mTimingEvent event;
struct GBASIOPlayerKeyCallback callback;
bool oldOpposingDirections;
struct mKeyCallback* oldCallback;
};
void GBASIOPlayerInit(struct GBASIOPlayer* gbp);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 B

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,13 +1,13 @@
Akatsuki
Benedikt Feih
Brandon
Emily A. Bellows
gocha
Jaime J. Denizard
Jezzabel
Lucas Towers
MichaelK_
MichaelK__
Miras Absar
NimbusFox
Petru-Sebastian Toader
SquidHominid
Tyler Jenkins
William K. Leung
Zach

BIN
res/sgb-border.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

View File

@ -89,6 +89,20 @@ static bool _lookupCharValue(const struct mCoreConfig* config, const char* key,
return true;
}
static bool _lookupBoolValue(const struct mCoreConfig* config, const char* key, bool* out) {
const char* charValue = _lookupValue(config, key);
if (!charValue) {
return false;
}
char* end;
long value = strtol(charValue, &end, 10);
if (*end) {
return false;
}
*out = value;
return true;
}
static bool _lookupIntValue(const struct mCoreConfig* config, const char* key, int* out) {
const char* charValue = _lookupValue(config, key);
if (!charValue) {
@ -314,6 +328,10 @@ const char* mCoreConfigGetValue(const struct mCoreConfig* config, const char* ke
return _lookupValue(config, key);
}
bool mCoreConfigGetBoolValue(const struct mCoreConfig* config, const char* key, bool* value) {
return _lookupBoolValue(config, key, value);
}
bool mCoreConfigGetIntValue(const struct mCoreConfig* config, const char* key, int* value) {
return _lookupIntValue(config, key, value);
}
@ -396,40 +414,20 @@ void mCoreConfigMap(const struct mCoreConfig* config, struct mCoreOptions* opts)
}
_lookupUIntValue(config, "sampleRate", &opts->sampleRate);
int fakeBool;
if (_lookupIntValue(config, "useBios", &fakeBool)) {
opts->useBios = fakeBool;
}
if (_lookupIntValue(config, "audioSync", &fakeBool)) {
opts->audioSync = fakeBool;
}
if (_lookupIntValue(config, "videoSync", &fakeBool)) {
opts->videoSync = fakeBool;
}
if (_lookupIntValue(config, "lockAspectRatio", &fakeBool)) {
opts->lockAspectRatio = fakeBool;
}
if (_lookupIntValue(config, "lockIntegerScaling", &fakeBool)) {
opts->lockIntegerScaling = fakeBool;
}
if (_lookupIntValue(config, "interframeBlending", &fakeBool)) {
opts->interframeBlending = fakeBool;
}
if (_lookupIntValue(config, "resampleVideo", &fakeBool)) {
opts->resampleVideo = fakeBool;
}
if (_lookupIntValue(config, "suspendScreensaver", &fakeBool)) {
opts->suspendScreensaver = fakeBool;
}
if (_lookupIntValue(config, "mute", &fakeBool)) {
opts->mute = fakeBool;
}
if (_lookupIntValue(config, "skipBios", &fakeBool)) {
opts->skipBios = fakeBool;
}
if (_lookupIntValue(config, "rewindEnable", &fakeBool)) {
opts->rewindEnable = fakeBool;
}
_lookupBoolValue(config, "audioSync", &opts->audioSync);
_lookupBoolValue(config, "videoSync", &opts->videoSync);
_lookupBoolValue(config, "lockAspectRatio", &opts->lockAspectRatio);
_lookupBoolValue(config, "lockIntegerScaling", &opts->lockIntegerScaling);
_lookupBoolValue(config, "interframeBlending", &opts->interframeBlending);
_lookupBoolValue(config, "resampleVideo", &opts->resampleVideo);
_lookupBoolValue(config, "useBios", &opts->useBios);
_lookupBoolValue(config, "skipBios", &opts->skipBios);
_lookupBoolValue(config, "suspendScreensaver", &opts->suspendScreensaver);
_lookupBoolValue(config, "mute", &opts->mute);
_lookupBoolValue(config, "rewindEnable", &opts->rewindEnable);
_lookupIntValue(config, "fullscreen", &opts->fullscreen);
_lookupIntValue(config, "width", &opts->width);

View File

@ -123,4 +123,10 @@
#cmakedefine USE_ZLIB
#endif
// HAVE flags
#ifndef HAVE_POPCOUNT32
#cmakedefine HAVE_POPCOUNT32
#endif
#endif

View File

@ -32,7 +32,7 @@ static void _redoCacheSize(struct mMapCache* cache) {
return;
}
size_t tiles = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig));
size_t tiles = mMapCacheTileCount(cache);
cache->cache = anonymousMemoryMap(8 * 8 * sizeof(color_t) * tiles);
cache->status = anonymousMemoryMap(tiles * sizeof(*cache->status));
}
@ -54,12 +54,12 @@ void mMapCacheConfigureSystem(struct mMapCache* cache, mMapCacheSystemInfo confi
cache->sysConfig = config;
_redoCacheSize(cache);
size_t mapSize = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig));
size_t mapSize = mMapCacheTileCount(cache);
cache->mapSize = mapSize << mMapCacheSystemInfoGetMapAlign(cache->sysConfig);
}
void mMapCacheConfigureMap(struct mMapCache* cache, uint32_t mapStart) {
size_t tiles = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig));
size_t tiles = mMapCacheTileCount(cache);
memset(cache->status, 0, tiles * sizeof(*cache->status));
cache->mapStart = mapStart;
}

View File

@ -8,6 +8,7 @@
#include <mgba/core/core.h>
#include <mgba/core/cheats.h>
#include <mgba/core/interface.h>
#include <mgba/core/version.h>
#include <mgba-util/memory.h>
#include <mgba-util/vfs.h>
@ -385,6 +386,15 @@ bool mCoreSaveStateNamed(struct mCore* core, struct VFile* vf, int flags) {
};
mStateExtdataPut(&extdata, EXTDATA_META_TIME, &item);
}
char creator[256];
snprintf(creator, sizeof(creator), "%s %s", projectName, projectVersion);
struct mStateExtdataItem item = {
.size = strlen(creator) + 1,
.data = strdup(creator),
.clean = free
};
mStateExtdataPut(&extdata, EXTDATA_META_CREATOR, &item);
}
if (flags & SAVESTATE_SAVEDATA) {

View File

@ -744,7 +744,7 @@ static bool _doTrace(struct CLIDebugger* debugger) {
trace[sizeof(trace) - 1] = '\0';
size_t traceSize = sizeof(trace) - 2;
debugger->d.platform->trace(debugger->d.platform, trace, &traceSize);
if (traceSize + 1 <= sizeof(trace)) {
if (traceSize + 2 <= sizeof(trace)) {
trace[traceSize] = '\n';
trace[traceSize + 1] = '\0';
}

View File

@ -741,7 +741,7 @@ bool _ffmpegWriteAudioFrame(struct FFmpegEncoder* encoder, struct AVFrame* audio
#ifdef FFMPEG_USE_PACKET_UNREF
av_packet_move_ref(packet, tempPacket);
av_packet_free(&packet);
av_packet_free(&tempPacket);
#else
av_free_packet(packet);
av_freep(&packet);

View File

@ -11,6 +11,7 @@
#include <mgba-util/gui/menu.h>
enum mGUICheatAction {
CHEAT_BACK = 0,
CHEAT_ADD_LINE = 1,
CHEAT_RENAME,
CHEAT_DELETE,
@ -18,15 +19,37 @@ enum mGUICheatAction {
static const char* const offOn[] = { "Off", "On" };
static void _rebuildCheatView(struct GUIMenuItemList* items, const struct mCheatSet* set) {
GUIMenuItemListClear(items);
size_t i;
for (i = 0; i < StringListSize(&set->lines); ++i) {
*GUIMenuItemListAppend(items) = (struct GUIMenuItem) {
.title = *StringListGetConstPointer(&set->lines, i),
.readonly = true
};
}
*GUIMenuItemListAppend(items) = (struct GUIMenuItem) {
.title = "Back",
.data = GUI_V_U(CHEAT_BACK),
};
}
static void mGUIShowCheatSet(struct mGUIRunner* runner, struct mCheatDevice* device, struct mCheatSet* set) {
char cheatName[64];
snprintf(cheatName, sizeof(cheatName), "Edit cheat: %s", set->name);
struct GUIMenu menu = {
.title = cheatName,
.title = "Edit cheat",
.subtitle = set->name,
.index = 0,
.background = &runner->background.d
};
GUIMenuItemListInit(&menu.items, 0);
struct GUIMenu view = {
.title = "View cheat",
.subtitle = set->name,
.index = 0,
.background = &runner->background.d
};
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
.title = "Enable",
.state = set->enabled,
@ -37,6 +60,10 @@ static void mGUIShowCheatSet(struct mGUIRunner* runner, struct mCheatDevice* dev
.title = "Add line",
.data = GUI_V_U(CHEAT_ADD_LINE),
};
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
.title = "View lines",
.submenu = &view,
};
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
.title = "Rename",
.data = GUI_V_U(CHEAT_RENAME),
@ -50,6 +77,9 @@ static void mGUIShowCheatSet(struct mGUIRunner* runner, struct mCheatDevice* dev
.data = GUI_V_V,
};
GUIMenuItemListInit(&view.items, 0);
_rebuildCheatView(&view.items, set);
while (true) {
struct GUIKeyboardParams keyboard;
GUIKeyboardParamsInit(&keyboard);
@ -67,6 +97,7 @@ static void mGUIShowCheatSet(struct mGUIRunner* runner, struct mCheatDevice* dev
keyboard.maxLen = 12;
if (runner->params.getText(&keyboard) == GUI_KEYBOARD_DONE) {
mCheatAddLine(set, keyboard.result, 0);
_rebuildCheatView(&view.items, set);
}
break;
case CHEAT_RENAME:
@ -75,12 +106,16 @@ static void mGUIShowCheatSet(struct mGUIRunner* runner, struct mCheatDevice* dev
keyboard.maxLen = 50;
if (runner->params.getText(&keyboard) == GUI_KEYBOARD_DONE) {
mCheatSetRename(set, keyboard.result);
snprintf(cheatName, sizeof(cheatName), "Edit cheat: %s", set->name);
menu.subtitle = set->name;
view.subtitle = set->name;
}
break;
case CHEAT_DELETE:
mCheatRemoveSet(device, set);
break;
case CHEAT_BACK:
// Used by submenus to return to the top menu
break;
}
if (action == CHEAT_DELETE) {
@ -88,6 +123,7 @@ static void mGUIShowCheatSet(struct mGUIRunner* runner, struct mCheatDevice* dev
}
}
GUIMenuItemListDeinit(&menu.items);
GUIMenuItemListDeinit(&view.items);
}
void mGUIShowCheats(struct mGUIRunner* runner) {

View File

@ -186,10 +186,10 @@ static void _tryAutosave(struct mGUIRunner* runner) {
#ifdef DISABLE_THREADING
mCoreSaveState(runner->core, 0, SAVESTATE_SAVEDATA | SAVESTATE_RTC | SAVESTATE_METADATA);
#else
MutexLock(&runner->autosave.mutex);
if (!runner->autosave.buffer) {
runner->autosave.buffer = VFileMemChunk(NULL, 0);
}
MutexLock(&runner->autosave.mutex);
runner->autosave.core = runner->core;
mCoreSaveStateNamed(runner->core, runner->autosave.buffer, SAVESTATE_SAVEDATA | SAVESTATE_RTC | SAVESTATE_METADATA);
ConditionWake(&runner->autosave.cond);
@ -775,7 +775,13 @@ THREAD_ENTRY mGUIAutosaveThread(void* context) {
while (autosave->running) {
ConditionWait(&autosave->cond, &autosave->mutex);
if (autosave->running && autosave->core) {
if (!autosave->buffer) {
continue;
}
struct VFile* vf = mCoreGetState(autosave->core, 0, true);
if (!vf) {
continue;
}
void* mem = autosave->buffer->map(autosave->buffer, autosave->buffer->size(autosave->buffer), MAP_READ);
vf->write(vf, mem, autosave->buffer->size(autosave->buffer));
autosave->buffer->unmap(autosave->buffer, mem, autosave->buffer->size(autosave->buffer));

View File

@ -21,7 +21,7 @@ void mGUIRemapKeys(struct GUIParams* params, struct mInputMap* map, const struct
size_t i;
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
.title = "Game keys:",
.data = GUI_V_V,
.readonly = true,
};
for (i = 0; i < map->info->nKeys; ++i) {
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
@ -35,7 +35,7 @@ void mGUIRemapKeys(struct GUIParams* params, struct mInputMap* map, const struct
}
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
.title = "Interface keys:",
.data = GUI_V_V,
.readonly = true,
};
for (i = 0; i < params->keyMap.info->nKeys; ++i) {
if (!params->keyMap.info->keyId[i]) {

View File

@ -237,13 +237,10 @@ static void _GBCoreLoadConfig(struct mCore* core, const struct mCoreConfig* conf
mCoreConfigCopyValue(&core->config, config, "useCgbColors");
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
int fakeBool = 0;
mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool);
gb->allowOpposingDirections = fakeBool;
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gb->allowOpposingDirections);
if (mCoreConfigGetIntValue(config, "sgb.borders", &fakeBool)) {
gb->video.sgbBorders = fakeBool;
gb->video.renderer->enableSGBBorder(gb->video.renderer, fakeBool);
if (mCoreConfigGetBoolValue(config, "sgb.borders", &gb->video.sgbBorders)) {
gb->video.renderer->enableSGBBorder(gb->video.renderer, gb->video.sgbBorders);
}
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
@ -269,11 +266,8 @@ static void _GBCoreReloadConfigOption(struct mCore* core, const char* option, co
return;
}
int fakeBool;
if (strcmp("mute", option) == 0) {
if (mCoreConfigGetIntValue(config, "mute", &fakeBool)) {
core->opts.mute = fakeBool;
if (mCoreConfigGetBoolValue(config, "mute", &core->opts.mute)) {
if (core->opts.mute) {
gb->audio.masterVolume = 0;
} else {
@ -298,15 +292,12 @@ static void _GBCoreReloadConfigOption(struct mCore* core, const char* option, co
if (config != &core->config) {
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
}
if (mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool)) {
gb->allowOpposingDirections = fakeBool;
}
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gb->allowOpposingDirections);
return;
}
if (strcmp("sgb.borders", option) == 0) {
if (mCoreConfigGetIntValue(config, "sgb.borders", &fakeBool)) {
gb->video.sgbBorders = fakeBool;
gb->video.renderer->enableSGBBorder(gb->video.renderer, fakeBool);
if (mCoreConfigGetBoolValue(config, "sgb.borders", &gb->video.sgbBorders)) {
gb->video.renderer->enableSGBBorder(gb->video.renderer, gb->video.sgbBorders);
}
}

View File

@ -687,8 +687,8 @@ uint8_t GBIORead(struct GB* gb, unsigned address) {
case GB_REG_OCPS:
case GB_REG_OCPD:
case GB_REG_SVBK:
case GB_REG_UNK72:
case GB_REG_UNK73:
case GB_REG_PSWX:
case GB_REG_PSWY:
case GB_REG_UNK75:
// Handled transparently by the registers
if (gb->model < GB_MODEL_CGB) {

View File

@ -64,37 +64,58 @@ static void _regenerateSGBBorder(struct GBVideoSoftwareRenderer* renderer) {
}
int x, y;
for (y = 0; y < 224; ++y) {
int localY = y & 0x7;
if (!localY && y >= 40 && y < 184) {
renderer->sgbBorderMask[(y - 40) >> 3] = 0;
}
for (x = 0; x < 256; x += 8) {
if (x >= 48 && x < 208 && y >= 40 && y < 184) {
continue;
}
uint16_t mapData;
LOAD_16LE(mapData, (x >> 2) + (y & ~7) * 8, renderer->d.sgbMapRam);
if (UNLIKELY(SGBBgAttributesGetTile(mapData) >= 0x100)) {
continue;
}
int localY = y & 0x7;
if (SGBBgAttributesIsYFlip(mapData)) {
localY = 7 - localY;
if (x >= 48 && x < 208 && y >= 40 && y < 184) {
if (!localY) {
unsigned tileBase = SGBBgAttributesGetTile(mapData) * 8;
uint32_t bits = 0;
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 0];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 1];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 2];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 3];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 4];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 5];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 6];
bits |= ((uint32_t*) renderer->d.sgbCharRam)[tileBase + 7];
if (bits) {
renderer->sgbBorderMask[(y - 40) >> 3] |= 1 << ((x - 48) >> 3);
}
}
continue;
}
int yFlip = 0;
if (SGBBgAttributesIsYFlip(mapData)) {
yFlip = 7;
}
unsigned tileBase = (SGBBgAttributesGetTile(mapData) * 16 + (localY ^ yFlip)) * 2;
uint8_t tileData[4];
tileData[0] = renderer->d.sgbCharRam[(SGBBgAttributesGetTile(mapData) * 16 + localY) * 2 + 0x00];
tileData[1] = renderer->d.sgbCharRam[(SGBBgAttributesGetTile(mapData) * 16 + localY) * 2 + 0x01];
tileData[2] = renderer->d.sgbCharRam[(SGBBgAttributesGetTile(mapData) * 16 + localY) * 2 + 0x10];
tileData[3] = renderer->d.sgbCharRam[(SGBBgAttributesGetTile(mapData) * 16 + localY) * 2 + 0x11];
tileData[0] = renderer->d.sgbCharRam[tileBase + 0x00];
tileData[1] = renderer->d.sgbCharRam[tileBase + 0x01];
tileData[2] = renderer->d.sgbCharRam[tileBase + 0x10];
tileData[3] = renderer->d.sgbCharRam[tileBase + 0x11];
size_t base = y * renderer->outputBufferStride + x;
int paletteBase = SGBBgAttributesGetPalette(mapData) * 0x10;
int colorSelector;
int flip = 0;
int xFlip = 0;
if (SGBBgAttributesIsXFlip(mapData)) {
flip = 7;
xFlip = 7;
}
for (i = 7; i >= 0; --i) {
colorSelector = (tileData[0] >> i & 0x1) << 0 | (tileData[1] >> i & 0x1) << 1 | (tileData[2] >> i & 0x1) << 2 | (tileData[3] >> i & 0x1) << 3;
renderer->outputBuffer[(base + 7 - i) ^ flip] = renderer->palette[paletteBase | colorSelector];
renderer->outputBuffer[(base + 7 - i) ^ xFlip] = renderer->palette[paletteBase | colorSelector];
}
}
}
@ -233,6 +254,7 @@ static void GBVideoSoftwareRendererInit(struct GBVideoRenderer* renderer, enum G
}
memset(softwareRenderer->palette, 0, sizeof(softwareRenderer->palette));
memset(softwareRenderer->sgbBorderMask, 0, sizeof(softwareRenderer->sgbBorderMask));
softwareRenderer->lastHighlightAmount = 0;
}
@ -472,12 +494,14 @@ static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
color_t color = mColorFrom555(value);
if (softwareRenderer->model & GB_MODEL_SGB) {
if (index < 0x10 && index && !(index & 3)) {
if (index >= PAL_SGB_BORDER && !(index & 0xF)) {
color = softwareRenderer->palette[0];
} else if (index >= PAL_SGB_BORDER && !(index & 0xF)) {
color = softwareRenderer->palette[0];
} else if (index > PAL_HIGHLIGHT && index < PAL_HIGHLIGHT_OBJ && !(index & 3)) {
color = softwareRenderer->palette[PAL_HIGHLIGHT_BG];
} else if (!(softwareRenderer->model & GB_MODEL_CGB)) {
if (index < 0x10 && index && !(index & 3)) {
color = softwareRenderer->palette[0];
} else if (index > PAL_HIGHLIGHT && index < PAL_HIGHLIGHT_OBJ && !(index & 3)) {
color = softwareRenderer->palette[PAL_HIGHLIGHT_BG];
}
}
}
if (renderer->cache) {
@ -511,13 +535,15 @@ static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer
}
if (softwareRenderer->model & GB_MODEL_SGB && !index && GBRegisterLCDCIsEnable(softwareRenderer->lcdc)) {
renderer->writePalette(renderer, 0x04, value);
renderer->writePalette(renderer, 0x08, value);
renderer->writePalette(renderer, 0x0C, value);
renderer->writePalette(renderer, 0x40, value);
renderer->writePalette(renderer, 0x50, value);
renderer->writePalette(renderer, 0x60, value);
renderer->writePalette(renderer, 0x70, value);
if (!(softwareRenderer->model & GB_MODEL_CGB)) {
renderer->writePalette(renderer, 0x04, value);
renderer->writePalette(renderer, 0x08, value);
renderer->writePalette(renderer, 0x0C, value);
renderer->writePalette(renderer, 0x40, value);
renderer->writePalette(renderer, 0x50, value);
renderer->writePalette(renderer, 0x60, value);
renderer->writePalette(renderer, 0x70, value);
}
if (softwareRenderer->sgbBorders && !renderer->sgbRenderMode) {
_regenerateSGBBorder(softwareRenderer);
}
@ -663,6 +689,46 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
for (; x < endX; ++x) {
row[x] = softwareRenderer->palette[p | softwareRenderer->lookup[softwareRenderer->row[x] & OBJ_PRIO_MASK]];
}
if (softwareRenderer->sgbBorderMask[y >> 3]) {
uint32_t borderMask = softwareRenderer->sgbBorderMask[y >> 3];
int localY = y & 0x7;
for (x = startX; x < endX; x += 8) {
if (!(borderMask & (1 << (x >> 3)))) {
continue;
}
uint16_t mapData;
LOAD_16LE(mapData, (x >> 2) + 12 + (y & ~7) * 8 + 320, softwareRenderer->d.sgbMapRam);
if (UNLIKELY(SGBBgAttributesGetTile(mapData) >= 0x100)) {
continue;
}
int yFlip = 0;
if (SGBBgAttributesIsYFlip(mapData)) {
yFlip = 7;
}
unsigned tileBase = (SGBBgAttributesGetTile(mapData) * 16 + (localY ^ yFlip)) * 2;
uint8_t tileData[4];
tileData[0] = softwareRenderer->d.sgbCharRam[tileBase + 0x00];
tileData[1] = softwareRenderer->d.sgbCharRam[tileBase + 0x01];
tileData[2] = softwareRenderer->d.sgbCharRam[tileBase + 0x10];
tileData[3] = softwareRenderer->d.sgbCharRam[tileBase + 0x11];
int paletteBase = SGBBgAttributesGetPalette(mapData) * 0x10;
int colorSelector;
int flip = 0;
if (SGBBgAttributesIsXFlip(mapData)) {
flip = 7;
}
int i;
for (i = 7; i >= 0; --i) {
colorSelector = (tileData[0] >> i & 0x1) << 0 | (tileData[1] >> i & 0x1) << 1 | (tileData[2] >> i & 0x1) << 2 | (tileData[3] >> i & 0x1) << 3;
if (colorSelector) {
row[(x + 7 - i) ^ flip] = softwareRenderer->palette[paletteBase | colorSelector];
}
}
}
}
break;
case 1:
break;

View File

@ -61,11 +61,11 @@ void GBTimerReset(struct GBTimer* timer) {
timer->event.context = timer;
timer->event.name = "GB Timer";
timer->event.callback = _GBTimerUpdate;
timer->event.priority = 0x20;
timer->event.priority = 0x21;
timer->irq.context = timer;
timer->irq.name = "GB Timer IRQ";
timer->irq.callback = _GBTimerIRQ;
timer->event.priority = 0x21;
timer->irq.priority = 0x20;
timer->nextDiv = GB_DMG_DIV_PERIOD * 2;
timer->timaPeriod = 1024 >> 4;

View File

@ -40,6 +40,246 @@ static void _endMode2(struct mTiming* timing, void* context, uint32_t cyclesLate
static void _endMode3(struct mTiming* timing, void* context, uint32_t cyclesLate);
static void _updateFrameCount(struct mTiming* timing, void* context, uint32_t cyclesLate);
static const uint16_t _defaultBorderPalette[16] = {
0x0000,
0x7FDE,
0x7FFF,
0x739A,
0x2929,
0x24E7,
0x1CC6,
0x0400,
0x514A,
0x3907,
0x28C5,
};
static const uint8_t _defaultBorderTilemap[] = {
0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10,
0x12, 0x10, 0x14, 0x10, 0x16, 0x10, 0x17, 0x10, 0x17, 0x10, 0x17, 0x10, 0x17, 0x10, 0x17, 0x10,
0x17, 0x10, 0x17, 0x10, 0x17, 0x10, 0x17, 0x10, 0x17, 0x10, 0x16, 0x50, 0x14, 0x10, 0x12, 0x50,
0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10,
0x02, 0x10, 0x06, 0x10, 0x0A, 0x10, 0x0D, 0x10, 0x0E, 0x10, 0x0F, 0x10, 0x10, 0x10, 0x11, 0x10,
0x13, 0x10, 0x15, 0x10, 0x15, 0x10, 0x18, 0x10, 0x1B, 0x10, 0x1B, 0x10, 0x1B, 0x10, 0x1B, 0x10,
0x1B, 0x10, 0x1B, 0x10, 0x1B, 0x10, 0x1B, 0x10, 0x18, 0x50, 0x15, 0x10, 0x15, 0x10, 0x13, 0x10,
0x11, 0x10, 0x10, 0x50, 0x0F, 0x50, 0x0E, 0x50, 0x0D, 0x50, 0x0A, 0x50, 0x06, 0x50, 0x02, 0x50,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x04, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10,
0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10,
0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10,
0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x07, 0x10, 0x04, 0x50,
0x05, 0x10, 0x08, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10,
0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10,
0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10,
0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x0B, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0x00, 0x10, 0x00, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x05, 0x10, 0x09, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10,
0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10,
0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10,
0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x0C, 0x10, 0x05, 0x50,
0x04, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90,
0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x1F, 0x10, 0x23, 0x10, 0x23, 0x10,
0x23, 0x10, 0x23, 0x10, 0x23, 0x10, 0x23, 0x10, 0x34, 0x10, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90,
0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x07, 0x90, 0x04, 0xD0,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x19, 0x10, 0x1C, 0x10, 0x20, 0x10, 0x24, 0x10, 0x26, 0x10,
0x29, 0x10, 0x2B, 0x10, 0x2E, 0x10, 0x31, 0x10, 0x35, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x1A, 0x10, 0x1D, 0x10, 0x21, 0x10, 0x25, 0x10, 0x27, 0x10,
0x2A, 0x10, 0x2C, 0x10, 0x2F, 0x10, 0x32, 0x10, 0x1A, 0x50, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x19, 0x90, 0x1E, 0x10, 0x22, 0x10, 0x1C, 0x90, 0x28, 0x10,
0x1C, 0x90, 0x2D, 0x10, 0x30, 0x10, 0x33, 0x10, 0x19, 0xD0, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10, 0x03, 0x10,
};
static const uint8_t _defaultBorderChardata[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, 0xF0, 0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x03, 0xFC, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x01, 0xFF, 0x03, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x3F, 0x00, 0xF0, 0x00, 0x0F, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0x7F, 0x80, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x1F, 0x00, 0x7E, 0x80, 0x01, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFC, 0x03, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0x00, 0xF8, 0x07, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x07, 0xF8, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3F,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0xC0, 0x3F, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x07, 0xFF, 0x0F, 0xFF, 0x0F, 0xFF, 0x0F, 0xFE,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFE, 0x00,
0x0F, 0xFE, 0x0F, 0xFE, 0x0F, 0xFE, 0x0F, 0xFE, 0x0F, 0xFE, 0x0F, 0xFE, 0x0F, 0xFE, 0x0F, 0xFE,
0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00, 0xFE, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0x19, 0xFF, 0x19, 0xFF, 0x19, 0xFF, 0x19, 0xFF, 0x19, 0xFF, 0x19, 0xFF, 0x19,
0x00, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00, 0x19, 0x00,
0xFF, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x19, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x0F, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0x1F, 0xFF, 0x1F, 0xFF, 0x1F, 0xFC, 0x1F, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0x1C,
0xFF, 0x00, 0xFF, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0x1C, 0x00,
0xFF, 0x1C, 0xFF, 0x9C, 0xFF, 0x9C, 0xFF, 0x9C, 0xFF, 0x9C, 0xFF, 0x9C, 0xFF, 0x9C, 0xFF, 0x9C,
0x1C, 0x00, 0x9C, 0x00, 0x9C, 0x00, 0x9C, 0x00, 0x9C, 0x00, 0x9C, 0x00, 0x9C, 0x00, 0x9C, 0x00,
0xFF, 0x9C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x9C, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x0F, 0xFF, 0x0F, 0xFF, 0x0F,
0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00,
0xFF, 0x0E, 0xFF, 0x0E, 0xFF, 0x0E, 0xFF, 0x0F, 0xFF, 0x0F, 0xFF, 0x0F, 0xFF, 0x00, 0xFF, 0x00,
0x0E, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0x07, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0x07, 0xFF, 0x07, 0xFF, 0x07, 0xFF, 0xC7, 0xFF, 0xC7, 0xFF, 0xC7, 0xFF, 0x07, 0xFF, 0x07,
0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0xC7, 0x00, 0xC7, 0x00, 0xC7, 0x00, 0x07, 0x00, 0x07, 0x00,
0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x07, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03,
0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0x01, 0xFF, 0xF1, 0xFF, 0xF1, 0xFF, 0xF1,
0xFF, 0x00, 0xFF, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0xF1, 0x00, 0xF1, 0x00, 0xF1, 0x00,
0xFF, 0x03, 0xFF, 0x07, 0xFF, 0x03, 0xFF, 0xF1, 0xFF, 0xF1, 0xFF, 0xF1, 0xFF, 0x01, 0xFF, 0x01,
0x03, 0x00, 0x07, 0x00, 0x03, 0x00, 0xF1, 0x00, 0xF1, 0x00, 0xF1, 0x00, 0x01, 0x00, 0x01, 0x00,
0xFF, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0x01, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0,
0xFF, 0x00, 0xFF, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00,
0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0,
0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00,
0xFF, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xC0, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC,
0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xFC, 0x00,
0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
0xFC, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xE0, 0xFF,
0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0x7F, 0xF0, 0x7F, 0xF0, 0x7F, 0xF0, 0x7F, 0xF0, 0x7F, 0xF0, 0x7F,
0xFF, 0x00, 0xFF, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00,
};
void GBVideoInit(struct GBVideo* video) {
video->renderer = NULL;
video->vram = anonymousMemoryMap(GB_SIZE_VRAM);
@ -92,16 +332,25 @@ void GBVideoReset(struct GBVideo* video) {
} else {
video->renderer->sgbCharRam = anonymousMemoryMap(SGB_SIZE_CHAR_RAM);
}
memcpy(video->renderer->sgbCharRam, _defaultBorderChardata, sizeof(_defaultBorderChardata));
if (video->renderer->sgbMapRam) {
memset(video->renderer->sgbMapRam, 0, SGB_SIZE_MAP_RAM);
} else {
video->renderer->sgbMapRam = anonymousMemoryMap(SGB_SIZE_MAP_RAM);
}
memcpy(video->renderer->sgbMapRam, _defaultBorderTilemap, sizeof(_defaultBorderTilemap));
int i;
for (i = 0; i < 16; ++i) {
STORE_16LE(_defaultBorderPalette[i], 0x800 + i * 2, video->renderer->sgbMapRam);
}
if (video->renderer->sgbPalRam) {
memset(video->renderer->sgbPalRam, 0, SGB_SIZE_PAL_RAM);
} else {
video->renderer->sgbPalRam = anonymousMemoryMap(SGB_SIZE_PAL_RAM);
}
if (video->renderer->sgbAttributeFiles) {
memset(video->renderer->sgbAttributeFiles, 0, SGB_SIZE_ATF_RAM);
} else {

View File

@ -428,7 +428,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
switch (immediate) {
case 0xF0: // Used for internal stall counting
cpu->gprs[12] = gba->biosStall;
cpu->gprs[11] = gba->biosStall;
return;
case 0xFA:
GBAPrintFlush(gba);

View File

@ -296,9 +296,7 @@ static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* con
}
}
int fakeBool = 0;
mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool);
gba->allowOpposingDirections = fakeBool;
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gba->allowOpposingDirections);
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
mCoreConfigCopyValue(&core->config, config, "gba.bios");
@ -330,11 +328,8 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
return;
}
int fakeBool;
if (strcmp("mute", option) == 0) {
if (mCoreConfigGetIntValue(config, "mute", &fakeBool)) {
core->opts.mute = fakeBool;
if (mCoreConfigGetBoolValue(config, "mute", &core->opts.mute)) {
if (core->opts.mute) {
gba->audio.masterVolume = 0;
} else {
@ -359,9 +354,7 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
if (config != &core->config) {
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
}
if (mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool)) {
gba->allowOpposingDirections = fakeBool;
}
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gba->allowOpposingDirections);
return;
}
@ -371,7 +364,8 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
if (config != &core->config) {
mCoreConfigCopyValue(&core->config, config, "videoScale");
}
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
bool value;
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetBoolValue(&core->config, "hwaccelVideo", &value) && value) {
int scale;
mCoreConfigGetIntValue(config, "videoScale", &scale);
GBAVideoGLRendererSetScale(&gbacore->glRenderer, scale);
@ -385,7 +379,8 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
renderer = &gbacore->renderer.d;
}
#ifdef BUILD_GLES3
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
bool value;
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetBoolValue(&core->config, "hwaccelVideo", &value) && value) {
mCoreConfigGetIntValue(&core->config, "videoScale", &gbacore->glRenderer.scale);
renderer = &gbacore->glRenderer.d;
} else {
@ -567,7 +562,8 @@ static void _GBACoreChecksum(const struct mCore* core, void* data, enum mCoreChe
static void _GBACoreReset(struct mCore* core) {
struct GBACore* gbacore = (struct GBACore*) core;
struct GBA* gba = (struct GBA*) core->board;
int fakeBool;
bool value;
UNUSED(value);
if (gbacore->renderer.outputBuffer
#ifdef BUILD_GLES3
|| gbacore->glRenderer.outputTex != (unsigned) -1
@ -578,7 +574,7 @@ static void _GBACoreReset(struct mCore* core) {
renderer = &gbacore->renderer.d;
}
#ifdef BUILD_GLES3
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetBoolValue(&core->config, "hwaccelVideo", &value) && value) {
mCoreConfigGetIntValue(&core->config, "videoScale", &gbacore->glRenderer.scale);
renderer = &gbacore->glRenderer.d;
} else {
@ -586,7 +582,7 @@ static void _GBACoreReset(struct mCore* core) {
}
#endif
#ifndef DISABLE_THREADING
if (mCoreConfigGetIntValue(&core->config, "threadedVideo", &fakeBool) && fakeBool) {
if (mCoreConfigGetBoolValue(&core->config, "threadedVideo", &value) && value) {
if (!core->videoLogger) {
core->videoLogger = &gbacore->threadProxy.d;
}
@ -615,13 +611,9 @@ static void _GBACoreReset(struct mCore* core) {
#endif
bool forceGbp = false;
if (mCoreConfigGetIntValue(&core->config, "gba.forceGbp", &fakeBool)) {
forceGbp = fakeBool;
}
bool vbaBugCompat = true;
if (mCoreConfigGetIntValue(&core->config, "vbaBugCompat", &fakeBool)) {
vbaBugCompat = fakeBool;
}
mCoreConfigGetBoolValue(&core->config, "gba.forceGbp", &forceGbp);
mCoreConfigGetBoolValue(&core->config, "vbaBugCompat", &vbaBugCompat);
if (!forceGbp) {
gba->memory.hw.devices &= ~HW_GB_PLAYER_DETECTION;
}
@ -728,6 +720,7 @@ static void _GBACoreAddKeys(struct mCore* core, uint32_t keys) {
static void _GBACoreClearKeys(struct mCore* core, uint32_t keys) {
struct GBA* gba = core->board;
gba->keysActive &= ~keys;
GBATestKeypadIRQ(gba);
}
static void _GBACoreSetCursorLocation(struct mCore* core, int x, int y) {

View File

@ -8,6 +8,7 @@
#include <mgba/core/cache-set.h>
#include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/io.h>
#include <mgba/internal/gba/renderers/cache-set.h>
static void GBAVideoProxyRendererInit(struct GBAVideoRenderer* renderer);
static void GBAVideoProxyRendererReset(struct GBAVideoRenderer* renderer);
@ -285,6 +286,9 @@ uint16_t GBAVideoProxyRendererWriteVideoRegister(struct GBAVideoRenderer* render
if (address > REG_BLDY) {
return value;
}
if (renderer->cache) {
GBAVideoCacheWriteVideoRegister(renderer->cache, address, value);
}
mVideoLoggerRendererWriteVideoRegister(proxyRenderer->logger, address, value);
if (!proxyRenderer->logger->block) {

View File

@ -91,7 +91,7 @@ static void GBAInit(void* cpu, struct mCPUComponent* component) {
GBAHardwareInit(&gba->memory.hw, NULL);
gba->keysActive = 0;
gba->keysLast = 0;
gba->keysLast = 0x400;
gba->rotationSource = 0;
gba->luminanceSource = 0;
gba->rtcSource = 0;
@ -877,27 +877,26 @@ void GBAFrameEnded(struct GBA* gba) {
}
void GBATestKeypadIRQ(struct GBA* gba) {
if (gba->keysActive == gba->keysLast) {
return;
}
uint16_t keysLast = gba->keysLast;
uint16_t keysActive = gba->keysActive;
uint16_t keycnt = gba->memory.io[REG_KEYCNT >> 1];
if (!(keycnt & 0x4000)) {
return;
}
gba->keysLast = keysActive;
int isAnd = keycnt & 0x8000;
keycnt &= 0x3FF;
uint16_t keyInput = gba->keysActive & keycnt;
uint16_t lastInput = gba->keysLast & keycnt;
gba->keysLast = gba->keysActive;
if (keyInput == lastInput) {
return;
}
if (isAnd && keycnt == keyInput) {
if (isAnd && keycnt == (keysActive & keycnt)) {
if (keysLast == keysActive) {
return;
}
GBARaiseIRQ(gba, IRQ_KEYPAD, 0);
} else if (!isAnd && keyInput) {
} else if (!isAnd && (keysActive & keycnt)) {
GBARaiseIRQ(gba, IRQ_KEYPAD, 0);
} else {
gba->keysLast = 0x400;
}
}

View File

@ -9,16 +9,16 @@ const uint8_t hleBios[SIZE_BIOS] = {
0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0x4c, 0x01, 0x9f, 0x15,
0x10, 0xff, 0x2f, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x29, 0xe1,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03,
0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5,
0xd4, 0xc0, 0xa0, 0xe3, 0x0b, 0xb1, 0x9c, 0xe7, 0xd2, 0xcf, 0xa0, 0xe3,
0x0b, 0x00, 0x5c, 0xe1, 0x00, 0xc0, 0x4f, 0xe1, 0x00, 0x10, 0x2d, 0xe9,
0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3, 0x0c, 0xf0, 0x21, 0xe1,
0x00, 0x00, 0xf0, 0x0f, 0x04, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x5b, 0xe3,
0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9, 0x02, 0xc0, 0x5e, 0xe5,
0xd4, 0xb0, 0xa0, 0xe3, 0x0c, 0xc1, 0x9b, 0xe7, 0xd2, 0xbf, 0xa0, 0xe3,
0x0c, 0x00, 0x5b, 0xe1, 0x00, 0xb0, 0x4f, 0xe1, 0x00, 0x08, 0x2d, 0xe9,
0x80, 0xb0, 0x0b, 0xe2, 0x1f, 0xb0, 0x8b, 0xe3, 0x0b, 0xf0, 0x21, 0xe1,
0x00, 0x00, 0xf0, 0x0f, 0x04, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x5c, 0xe3,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
0x0f, 0xe0, 0xa0, 0xe1, 0x1b, 0xff, 0x2f, 0x11, 0x00, 0x00, 0xa0, 0xe1,
0x0f, 0xe0, 0xa0, 0x11, 0x1c, 0xff, 0x2f, 0x11, 0x00, 0x00, 0xa0, 0xe1,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x04, 0x40, 0xbd, 0xe8,
0x93, 0xf0, 0x29, 0xe3, 0x00, 0x10, 0xbd, 0xe8, 0x0c, 0xf0, 0x69, 0xe1,
0x93, 0xf0, 0x29, 0xe3, 0x00, 0x08, 0xbd, 0xe8, 0x0b, 0xf0, 0x69, 0xe1,
0x00, 0x58, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x04, 0x20, 0xa0, 0xe3, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
0xb0, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
@ -73,5 +73,5 @@ const uint8_t hleBios[SIZE_BIOS] = {
0x01, 0xa0, 0xa0, 0xe1, 0xfa, 0x07, 0xa0, 0xe8, 0xfa, 0x07, 0xa0, 0xe8,
0xfa, 0x07, 0xa0, 0xe8, 0xfa, 0x07, 0xa0, 0xe8, 0x00, 0x10, 0xa0, 0xe3,
0xf0, 0x07, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0xb0, 0x01, 0x00, 0x00,
0x04, 0xc0, 0x5c, 0xe2, 0xfd, 0xff, 0xff, 0x8a, 0x1e, 0xff, 0x2f, 0xe1
0x04, 0xb0, 0x5b, 0xe2, 0xfd, 0xff, 0xff, 0x8a, 0x1e, 0xff, 0x2f, 0xe1
};

View File

@ -31,36 +31,36 @@ swiBase:
cmp sp, #0
moveq sp, #0x04000000
subeq sp, #0x20
stmfd sp!, {r11-r12, lr}
ldrb r11, [lr, #-2]
mov r12, #swiTable
ldr r11, [r12, r11, lsl #2]
mov r12, #StallCall
cmp r12, r11
mrs r12, spsr
stmfd sp!, {r12}
and r12, #0x80
orr r12, #0x1F
msr cpsr_c, r12
swieq 0xF00000 @ Special mGBA-internal call to load the stall count into r12
stmfd sp!, {r11, r12, lr}
ldrb r12, [lr, #-2]
mov r11, #swiTable
ldr r12, [r11, r12, lsl #2]
mov r11, #StallCall
cmp r11, r12
mrs r11, spsr
stmfd sp!, {r11}
and r11, #0x80
orr r11, #0x1F
msr cpsr_c, r11
swieq 0xF00000 @ Special mGBA-internal call to load the stall count into r11
stmfd sp!, {r2, lr}
cmp r11, #0
cmp r12, #0
nop
nop
nop
nop
nop
nop
mov lr, pc
bxne r11
movne lr, pc
bxne r12
nop
nop
nop
ldmfd sp!, {r2, lr}
msr cpsr, #0x93
ldmfd sp!, {r12}
msr spsr, r12
ldmfd sp!, {r11-r12, lr}
ldmfd sp!, {r11}
msr spsr, r11
ldmfd sp!, {r11, r12, lr}
movs pc, lr
.word 0
.word 0xE3A02004
@ -310,6 +310,6 @@ ArcTan:
ArcTan2:
StallCall:
subs r12, #4
subs r11, #4
bhi StallCall
bx lr

View File

@ -547,6 +547,9 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) {
// Interrupts and misc
case REG_KEYCNT:
value &= 0xC3FF;
if (gba->keysLast < 0x400) {
gba->keysLast &= gba->memory.io[address >> 1] | ~value;
}
gba->memory.io[address >> 1] = value;
GBATestKeypadIRQ(gba);
return;
@ -743,11 +746,15 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
callbacks->keysRead(callbacks->context);
}
}
bool allowOpposingDirections = gba->allowOpposingDirections;
if (gba->keyCallback) {
gba->keysActive = gba->keyCallback->readKeys(gba->keyCallback);
if (!allowOpposingDirections) {
allowOpposingDirections = gba->keyCallback->requireOpposingDirections;
}
}
uint16_t input = gba->keysActive;
if (!gba->allowOpposingDirections) {
if (!allowOpposingDirections) {
unsigned rl = input & 0x030;
unsigned ud = input & 0x0C0;
input &= 0x30F;
@ -915,6 +922,7 @@ uint16_t GBAIORead(struct GBA* gba, uint32_t address) {
// Handled transparently by registers
break;
case 0x066:
case 0x06A:
case 0x06E:
case 0x076:
case 0x07A:

View File

@ -948,6 +948,9 @@ void GBAVideoGLRendererReset(struct GBAVideoRenderer* renderer) {
void GBAVideoGLRendererWriteVRAM(struct GBAVideoRenderer* renderer, uint32_t address) {
struct GBAVideoGLRenderer* glRenderer = (struct GBAVideoGLRenderer*) renderer;
if (renderer->cache) {
mCacheSetWriteVRAM(renderer->cache, address);
}
glRenderer->vramDirty |= 1 << (address >> 12);
}
@ -959,8 +962,9 @@ void GBAVideoGLRendererWriteOAM(struct GBAVideoRenderer* renderer, uint32_t oam)
void GBAVideoGLRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
struct GBAVideoGLRenderer* glRenderer = (struct GBAVideoGLRenderer*) renderer;
UNUSED(address);
UNUSED(value);
if (renderer->cache) {
mCacheSetWritePalette(renderer->cache, address >> 1, mColorFrom555(value));
}
glRenderer->paletteDirty = true;
int r = M_R5(value);
int g = M_G5(value) << 1;

View File

@ -68,6 +68,7 @@ void GBASerialize(struct GBA* gba, struct GBASerializedState* state) {
STORE_32(gba->irqEvent.when - mTimingCurrentTime(&gba->timing), 0, &state->nextIrq);
}
miscFlags = GBASerializedMiscFlagsSetBlocked(miscFlags, gba->cpuBlocked);
miscFlags = GBASerializedMiscFlagsSetKeyIRQKeys(miscFlags, gba->keysLast);
STORE_32(miscFlags, 0, &state->miscFlags);
STORE_32(gba->biosStall, 0, &state->biosStall);
@ -197,6 +198,7 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
mTimingSchedule(&gba->timing, &gba->irqEvent, when);
}
gba->cpuBlocked = GBASerializedMiscFlagsGetBlocked(miscFlags);
gba->keysLast = GBASerializedMiscFlagsGetKeyIRQKeys(miscFlags);
LOAD_32(gba->biosStall, 0, &state->biosStall);
GBAVideoDeserialize(&gba->video, state);

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
/* Copyright (c) 2013-2021 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
@ -10,119 +10,22 @@
#include <mgba-util/vfs.h>
static const char* const SHARKPORT_HEADER = "SharkPortSave";
static const char* const GSV_HEADER = "ADVSAVEG";
static const char* const GSV_FOOTER = "xV4\x12";
static const int GSV_IDENT_OFFSET = 0xC;
static const int GSV_PAYLOAD_OFFSET = 0x430;
bool GBASavedataImportSharkPort(struct GBA* gba, struct VFile* vf, bool testChecksum) {
union {
char c[0x1C];
int32_t i;
} buffer;
if (vf->read(vf, &buffer.i, 4) < 4) {
return false;
}
int32_t size;
LOAD_32(size, 0, &buffer.i);
if (size != (int32_t) strlen(SHARKPORT_HEADER)) {
return false;
}
if (vf->read(vf, buffer.c, size) < size) {
return false;
}
if (memcmp(SHARKPORT_HEADER, buffer.c, size) != 0) {
return false;
}
if (vf->read(vf, &buffer.i, 4) < 4) {
return false;
}
LOAD_32(size, 0, &buffer.i);
if (size != 0x000F0000) {
// What is this value?
return false;
}
// Skip first three fields
if (vf->read(vf, &buffer.i, 4) < 4) {
return false;
}
LOAD_32(size, 0, &buffer.i);
if (vf->seek(vf, size, SEEK_CUR) < 0) {
return false;
}
if (vf->read(vf, &buffer.i, 4) < 4) {
return false;
}
LOAD_32(size, 0, &buffer.i);
if (vf->seek(vf, size, SEEK_CUR) < 0) {
return false;
}
if (vf->read(vf, &buffer.i, 4) < 4) {
return false;
}
LOAD_32(size, 0, &buffer.i);
if (vf->seek(vf, size, SEEK_CUR) < 0) {
return false;
}
// Read payload
if (vf->read(vf, &buffer.i, 4) < 4) {
return false;
}
LOAD_32(size, 0, &buffer.i);
if (size < 0x1C || size > SIZE_CART_FLASH1M + 0x1C) {
return false;
}
char* payload = malloc(size);
if (vf->read(vf, payload, size) < size) {
goto cleanup;
}
struct GBACartridge* cart = (struct GBACartridge*) gba->memory.rom;
memcpy(buffer.c, &cart->title, 16);
buffer.c[0x10] = 0;
buffer.c[0x11] = 0;
buffer.c[0x12] = cart->checksum;
buffer.c[0x13] = cart->maker;
buffer.c[0x14] = 1;
buffer.c[0x15] = 0;
buffer.c[0x16] = 0;
buffer.c[0x17] = 0;
buffer.c[0x18] = 0;
buffer.c[0x19] = 0;
buffer.c[0x1A] = 0;
buffer.c[0x1B] = 0;
if (memcmp(buffer.c, payload, testChecksum ? 0x1C : 0xF) != 0) {
goto cleanup;
}
uint32_t checksum;
if (vf->read(vf, &buffer.i, 4) < 4) {
goto cleanup;
}
LOAD_32(checksum, 0, &buffer.i);
if (testChecksum) {
uint32_t calcChecksum = 0;
int i;
for (i = 0; i < size; ++i) {
calcChecksum += ((int32_t) payload[i]) << (calcChecksum % 24);
}
if (calcChecksum != checksum) {
goto cleanup;
}
}
uint32_t copySize = size - 0x1C;
static bool _importSavedata(struct GBA* gba, void* payload, size_t size) {
bool success = false;
switch (gba->memory.savedata.type) {
case SAVEDATA_FLASH512:
if (copySize > SIZE_CART_FLASH512) {
if (size > SIZE_CART_FLASH512) {
GBASavedataForceType(&gba->memory.savedata, SAVEDATA_FLASH1M);
}
// Fall through
default:
if (copySize > GBASavedataSize(&gba->memory.savedata)) {
copySize = GBASavedataSize(&gba->memory.savedata);
if (size > GBASavedataSize(&gba->memory.savedata)) {
size = GBASavedataSize(&gba->memory.savedata);
}
break;
case SAVEDATA_FORCE_NONE:
@ -130,28 +33,168 @@ bool GBASavedataImportSharkPort(struct GBA* gba, struct VFile* vf, bool testChec
goto cleanup;
}
if (gba->memory.savedata.type == SAVEDATA_EEPROM) {
if (size == SIZE_CART_EEPROM || size == SIZE_CART_EEPROM512) {
size_t i;
for (i = 0; i < copySize; i += 8) {
for (i = 0; i < size; i += 8) {
uint32_t lo, hi;
LOAD_32BE(lo, i + 0x1C, payload);
LOAD_32BE(hi, i + 0x20, payload);
LOAD_32BE(lo, i, payload);
LOAD_32BE(hi, i + 4, payload);
STORE_32LE(hi, i, gba->memory.savedata.data);
STORE_32LE(lo, i + 4, gba->memory.savedata.data);
}
} else {
memcpy(gba->memory.savedata.data, &payload[0x1C], copySize);
memcpy(gba->memory.savedata.data, payload, size);
}
if (gba->memory.savedata.vf) {
gba->memory.savedata.vf->sync(gba->memory.savedata.vf, gba->memory.savedata.data, size);
}
free(payload);
return true;
success = true;
cleanup:
free(payload);
return false;
return success;
}
int GBASavedataSharkPortPayloadSize(struct VFile* vf) {
union {
char c[0x1C];
int32_t i;
} buffer;
vf->seek(vf, 0, SEEK_SET);
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
int32_t size;
LOAD_32(size, 0, &buffer.i);
if (size != (int32_t) strlen(SHARKPORT_HEADER)) {
return 0;
}
if (vf->read(vf, buffer.c, size) < size) {
return 0;
}
if (memcmp(SHARKPORT_HEADER, buffer.c, size) != 0) {
return 0;
}
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
LOAD_32(size, 0, &buffer.i);
if (size != 0x000F0000) {
// What is this value?
return 0;
}
// Skip first three fields
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
LOAD_32(size, 0, &buffer.i);
if (vf->seek(vf, size, SEEK_CUR) < 0) {
return 0;
}
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
LOAD_32(size, 0, &buffer.i);
if (vf->seek(vf, size, SEEK_CUR) < 0) {
return 0;
}
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
LOAD_32(size, 0, &buffer.i);
if (vf->seek(vf, size, SEEK_CUR) < 0) {
return 0;
}
// Read payload
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
LOAD_32(size, 0, &buffer.i);
return size;
}
void* GBASavedataSharkPortGetPayload(struct VFile* vf, size_t* osize, uint8_t* oheader, bool testChecksum) {
int32_t size = GBASavedataSharkPortPayloadSize(vf);
if (size < 0x1C || size > SIZE_CART_FLASH1M + 0x1C) {
return NULL;
}
size -= 0x1C;
uint8_t header[0x1C];
int8_t* payload = malloc(size);
if (vf->read(vf, header, sizeof(header)) < (int) sizeof(header)) {
goto cleanup;
}
if (vf->read(vf, payload, size) < size) {
goto cleanup;
}
uint32_t buffer;
uint32_t checksum;
if (vf->read(vf, &buffer, 4) < 4) {
goto cleanup;
}
LOAD_32(checksum, 0, &buffer);
if (testChecksum) {
uint32_t calcChecksum = 0;
int i;
for (i = 0; i < (int) sizeof(header); ++i) {
calcChecksum += ((int32_t) header[i]) << (calcChecksum % 24);
}
for (i = 0; i < size; ++i) {
calcChecksum += ((int32_t) payload[i]) << (calcChecksum % 24);
}
if (calcChecksum != checksum) {
return NULL;
}
}
*osize = size;
if (oheader) {
memcpy(oheader, header, sizeof(header));
}
return payload;
cleanup:
free(payload);
return NULL;
}
bool GBASavedataImportSharkPort(struct GBA* gba, struct VFile* vf, bool testChecksum) {
uint8_t buffer[0x1C];
uint8_t header[0x1C];
size_t size;
void* payload = GBASavedataSharkPortGetPayload(vf, &size, header, testChecksum);
if (!payload) {
return false;
}
struct GBACartridge* cart = (struct GBACartridge*) gba->memory.rom;
memcpy(buffer, &cart->title, 16);
buffer[0x10] = 0;
buffer[0x11] = 0;
buffer[0x12] = cart->checksum;
buffer[0x13] = cart->maker;
buffer[0x14] = 1;
buffer[0x15] = 0;
buffer[0x16] = 0;
buffer[0x17] = 0;
buffer[0x18] = 0;
buffer[0x19] = 0;
buffer[0x1A] = 0;
buffer[0x1B] = 0;
if (memcmp(buffer, header, testChecksum ? 0x1C : 0xF) != 0) {
free(payload);
return false;
}
return _importSavedata(gba, payload, size);
}
bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
@ -233,7 +276,6 @@ bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
checksum += buffer.c[i] << (checksum % 24);
}
if (gba->memory.savedata.type == SAVEDATA_EEPROM) {
for (i = 0; i < size; ++i) {
char byte = gba->memory.savedata.data[i ^ 7];
@ -255,3 +297,93 @@ bool GBASavedataExportSharkPort(const struct GBA* gba, struct VFile* vf) {
return true;
}
int GBASavedataGSVPayloadSize(struct VFile* vf) {
union {
char c[8];
int32_t i;
} buffer;
vf->seek(vf, 0, SEEK_SET);
if (vf->read(vf, &buffer.c, 8) < 8) {
return 0;
}
if (memcmp(GSV_HEADER, buffer.c, 8) != 0) {
return 0;
}
// Skip the checksum
if (vf->read(vf, &buffer.i, 4) < 4) {
return 0;
}
struct {
char name[12];
int padding;
int type;
int unk[3];
char description[0x400];
char footer[4];
} header;
if (vf->read(vf, &header, sizeof(header)) < (ssize_t) sizeof(header)) {
return 0;
}
if (memcmp(GSV_FOOTER, header.footer, 4) != 0) {
return 0;
}
int type;
LOAD_32(type, 0, &header.type);
switch (type) {
case 2:
return SIZE_CART_SRAM;
case 3:
return SIZE_CART_EEPROM512;
case 4:
return SIZE_CART_EEPROM;
case 5:
return SIZE_CART_FLASH512;
case 6:
return SIZE_CART_FLASH1M; // Unconfirmed
default:
return vf->size(vf) - GSV_PAYLOAD_OFFSET;
}
}
void* GBASavedataGSVGetPayload(struct VFile* vf, size_t* osize, uint8_t* ident, bool testChecksum) {
int32_t size = GBASavedataGSVPayloadSize(vf);
if (!size || size > SIZE_CART_FLASH1M) {
return NULL;
}
vf->seek(vf, GSV_IDENT_OFFSET, SEEK_SET);
if (ident && vf->read(vf, ident, 12) != 12) {
return NULL;
}
vf->seek(vf, GSV_PAYLOAD_OFFSET, SEEK_SET);
int8_t* payload = malloc(size);
if (vf->read(vf, payload, size) != size) {
free(payload);
return NULL;
}
UNUSED(testChecksum); // The checksum format is currently unknown
*osize = size;
return payload;
}
bool GBASavedataImportGSV(struct GBA* gba, struct VFile* vf, bool testChecksum) {
size_t size;
uint8_t ident[12];
void* payload = GBASavedataGSVGetPayload(vf, &size, ident, testChecksum);
if (!payload) {
return false;
}
struct GBACartridge* cart = (struct GBACartridge*) gba->memory.rom;
if (memcmp(ident, cart->title, sizeof(ident)) != 0) {
free(payload);
return false;
}
return _importSavedata(gba, payload, size);
}

View File

@ -41,6 +41,7 @@ static const uint32_t _gbpTxData[] = {
void GBASIOPlayerInit(struct GBASIOPlayer* gbp) {
gbp->callback.d.readKeys = _gbpRead;
gbp->callback.d.requireOpposingDirections = true;
gbp->callback.p = gbp;
gbp->d.init = 0;
gbp->d.deinit = 0;
@ -72,10 +73,8 @@ void GBASIOPlayerUpdate(struct GBA* gba) {
if (GBASIOPlayerCheckScreen(&gba->video)) {
++gba->sio.gbp.inputsPosted;
gba->sio.gbp.inputsPosted %= 3;
gba->keyCallback = &gba->sio.gbp.callback.d;
} else {
// TODO: Save and restore
gba->keyCallback = 0;
gba->keyCallback = gba->sio.gbp.oldCallback;
}
gba->sio.gbp.txPosition = 0;
return;
@ -86,6 +85,7 @@ void GBASIOPlayerUpdate(struct GBA* gba) {
if (GBASIOPlayerCheckScreen(&gba->video)) {
gba->memory.hw.devices |= HW_GB_PLAYER;
gba->sio.gbp.inputsPosted = 0;
gba->sio.gbp.oldCallback = gba->keyCallback;
gba->keyCallback = &gba->sio.gbp.callback.d;
// TODO: Check if the SIO driver is actually used first
GBASIOSetDriver(&gba->sio, &gba->sio.gbp.d, SIO_NORMAL_32);

View File

@ -190,7 +190,7 @@ static void _cleanup(void) {
mcuHwcExit();
}
static void _map3DSKey(struct mInputMap* map, int ctrKey, enum GBAKey key) {
static void _map3DSKey(struct mInputMap* map, int ctrKey, int key) {
mInputBindKey(map, _3DS_INPUT, __builtin_ctz(ctrKey), key);
}

View File

@ -29,10 +29,19 @@
#include "libretro_core_options.h"
#define SAMPLES 1024
#define GB_SAMPLES 512
#define SAMPLE_RATE 32768
/* An alpha factor of 1/180 is *somewhat* equivalent
* to calculating the average for the last 180
* frames, or 3 seconds of runtime... */
#define SAMPLES_PER_FRAME_MOVING_AVG_ALPHA (1.0f / 180.0f)
#define RUMBLE_PWM 35
#define EVENT_RATE 60
#define VIDEO_WIDTH_MAX 256
#define VIDEO_HEIGHT_MAX 224
#define VIDEO_BUFF_SIZE (VIDEO_WIDTH_MAX * VIDEO_HEIGHT_MAX * sizeof(color_t))
static retro_environment_t environCallback;
static retro_video_refresh_t videoCallback;
static retro_audio_sample_batch_t audioCallback;
@ -60,6 +69,9 @@ static int32_t _readGyroZ(struct mRotationSource* source);
static struct mCore* core;
static color_t* outputBuffer = NULL;
static int16_t *audioSampleBuffer = NULL;
static size_t audioSampleBufferSize;
static float audioSamplesPerFrameAvg;
static void* data;
static size_t dataSize;
static void* savedata;
@ -92,6 +104,10 @@ static bool envVarsUpdated;
static int32_t tiltX = 0;
static int32_t tiltY = 0;
static int32_t gyroZ = 0;
static bool audioLowPassEnabled = false;
static int32_t audioLowPassRange = 0;
static int32_t audioLowPassLeftPrev = 0;
static int32_t audioLowPassRightPrev = 0;
static const int keymap[] = {
RETRO_DEVICE_ID_JOYPAD_A,
@ -106,6 +122,61 @@ static const int keymap[] = {
RETRO_DEVICE_ID_JOYPAD_L,
};
/* Audio post processing */
static void _audioLowPassFilter(int16_t* buffer, int count) {
int16_t* out = buffer;
/* Restore previous samples */
int32_t audioLowPassLeft = audioLowPassLeftPrev;
int32_t audioLowPassRight = audioLowPassRightPrev;
/* Single-pole low-pass filter (6 dB/octave) */
int32_t factorA = audioLowPassRange;
int32_t factorB = 0x10000 - factorA;
int samples;
for (samples = 0; samples < count; ++samples) {
/* Apply low-pass filter */
audioLowPassLeft = (audioLowPassLeft * factorA) + (out[0] * factorB);
audioLowPassRight = (audioLowPassRight * factorA) + (out[1] * factorB);
/* 16.16 fixed point */
audioLowPassLeft >>= 16;
audioLowPassRight >>= 16;
/* Update sound buffer */
out[0] = (int16_t) audioLowPassLeft;
out[1] = (int16_t) audioLowPassRight;
out += 2;
};
/* Save last samples for next frame */
audioLowPassLeftPrev = audioLowPassLeft;
audioLowPassRightPrev = audioLowPassRight;
}
static void _loadAudioLowPassFilterSettings(void) {
struct retro_variable var;
audioLowPassEnabled = false;
audioLowPassRange = (60 * 0x10000) / 100;
var.key = "mgba_audio_low_pass_filter";
var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0) {
audioLowPassEnabled = true;
}
}
var.key = "mgba_audio_low_pass_range";
var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
audioLowPassRange = (strtol(var.value, NULL, 10) * 0x10000) / 100;
}
}
static void _initSensors(void) {
if (sensorsInitDone) {
return;
@ -217,6 +288,12 @@ static void _reloadSettings(void) {
mCoreConfigSetDefaultIntValue(&core->config, "sgb.borders", strcmp(var.value, "ON") == 0);
}
var.key = "mgba_gb_colors_preset";
var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
mCoreConfigSetDefaultIntValue(&core->config, "gb.colors", strtol(var.value, NULL, 10));
}
_updateGbPal();
#endif
@ -238,6 +315,8 @@ static void _reloadSettings(void) {
opts.frameskip = strtol(var.value, NULL, 10);
}
_loadAudioLowPassFilterSettings();
var.key = "mgba_idle_optimization";
var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
@ -297,7 +376,8 @@ void retro_set_environment(retro_environment_t env) {
}
#endif
libretro_set_core_options(environCallback);
bool categoriesSupported;
libretro_set_core_options(environCallback, &categoriesSupported);
}
void retro_set_video_refresh(retro_video_refresh_t video) {
@ -350,7 +430,7 @@ void retro_get_system_av_info(struct retro_system_av_info* info) {
info->geometry.aspect_ratio = width / (double) height;
info->timing.fps = core->frequency(core) / (float) core->frameCycles(core);
info->timing.sample_rate = 32768;
info->timing.sample_rate = SAMPLE_RATE;
}
void retro_init(void) {
@ -436,6 +516,13 @@ void retro_init(void) {
void retro_deinit(void) {
free(outputBuffer);
if (audioSampleBuffer) {
free(audioSampleBuffer);
audioSampleBuffer = NULL;
}
audioSampleBufferSize = 0;
audioSamplesPerFrameAvg = 0.0f;
if (sensorStateCallback) {
sensorStateCallback(0, RETRO_SENSOR_ACCELEROMETER_DISABLE, EVENT_RATE);
sensorStateCallback(0, RETRO_SENSOR_GYROSCOPE_DISABLE, EVENT_RATE);
@ -449,6 +536,11 @@ void retro_deinit(void) {
luxSensorEnabled = false;
sensorsInitDone = false;
useBitmasks = false;
audioLowPassEnabled = false;
audioLowPassRange = 0;
audioLowPassLeftPrev = 0;
audioLowPassRightPrev = 0;
}
void retro_run(void) {
@ -472,6 +564,7 @@ void retro_run(void) {
core->reloadConfigOption(core, "allowOpposingDirections", NULL);
}
_loadAudioLowPassFilterSettings();
var.key = "mgba_frameskip";
var.value = 0;
if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
@ -749,17 +842,58 @@ bool retro_load_game(const struct retro_game_info* game) {
}
mCoreInitConfig(core, NULL);
core->init(core);
core->setAVStream(core, &stream);
size_t size = 256 * 224 * BYTES_PER_PIXEL;
outputBuffer = malloc(size);
memset(outputBuffer, 0xFF, size);
core->setVideoBuffer(core, outputBuffer, 256);
outputBuffer = malloc(VIDEO_BUFF_SIZE);
memset(outputBuffer, 0xFF, VIDEO_BUFF_SIZE);
core->setVideoBuffer(core, outputBuffer, VIDEO_WIDTH_MAX);
core->setAudioBufferSize(core, SAMPLES);
#ifdef M_CORE_GBA
/* GBA emulation produces a fairly regular number
* of audio samples per frame that is consistent
* with the set sample rate. We therefore consume
* audio samples in retro_run() to achieve the
* best possible frame pacing */
if (core->platform(core) == mPLATFORM_GBA) {
/* Set initial output audio buffer size
* to nominal number of samples per frame.
* Buffer will be resized as required in
* retro_run(). */
size_t audioSamplesPerFrame = (size_t)((float) SAMPLE_RATE * (float) core->frameCycles(core) /
(float)core->frequency(core));
audioSampleBufferSize = audioSamplesPerFrame * 2;
audioSampleBuffer = malloc(audioSampleBufferSize * sizeof(int16_t));
audioSamplesPerFrameAvg = (float) audioSamplesPerFrame;
/* Internal audio buffer size should be
* audioSamplesPerFrame, but number of samples
* actually generated varies slightly on a
* frame-by-frame basis. We therefore allow
* for some wriggle room by setting double
* what we need (accounting for the hard
* coded blip buffer limit of 0x4000). */
size_t internalAudioBufferSize = audioSamplesPerFrame * 2;
if (internalAudioBufferSize > 0x4000) {
internalAudioBufferSize = 0x4000;
}
core->setAudioBufferSize(core, internalAudioBufferSize);
} else
#endif
{
/* GB/GBC emulation does not produce a number
* of samples per frame that is consistent with
* the set sample rate, and so it is unclear how
* best to handle this. We therefore fallback to
* using the regular stream-set _postAudioBuffer()
* callback with a fixed buffer size, which seems
* (historically) to produce adequate results */
core->setAVStream(core, &stream);
audioSampleBufferSize = GB_SAMPLES * 2;
audioSampleBuffer = malloc(audioSampleBufferSize * sizeof(int16_t));
audioSamplesPerFrameAvg = GB_SAMPLES;
core->setAudioBufferSize(core, GB_SAMPLES);
}
blip_set_rates(core->getAudioChannel(core, 0), core->frequency(core), 32768);
blip_set_rates(core->getAudioChannel(core, 1), core->frequency(core), 32768);
blip_set_rates(core->getAudioChannel(core, 0), core->frequency(core), SAMPLE_RATE);
blip_set_rates(core->getAudioChannel(core, 1), core->frequency(core), SAMPLE_RATE);
core->setPeripheral(core, mPERIPH_RUMBLE, &rumble);
core->setPeripheral(core, mPERIPH_ROTATION, &rotation);
@ -976,12 +1110,13 @@ void* retro_get_memory_data(unsigned id) {
case GB_MBC3_RTC:
return &((uint8_t*) savedata)[((struct GB*) core->board)->sramSize];
default:
return NULL;
break;
}
#endif
default:
return NULL;
break;
}
break;
default:
break;
}
@ -1076,12 +1211,17 @@ void GBARetroLog(struct mLogger* logger, int category, enum mLogLevel level, con
logCallback(retroLevel, "%s: %s\n", mLogCategoryName(category), message);
}
/* Used only for GB/GBC content */
static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* right) {
UNUSED(stream);
int16_t samples[SAMPLES * 2];
blip_read_samples(left, samples, SAMPLES, true);
blip_read_samples(right, samples + 1, SAMPLES, true);
audioCallback(samples, SAMPLES);
int produced = blip_read_samples(left, audioSampleBuffer, GB_SAMPLES, true);
blip_read_samples(right, audioSampleBuffer + 1, GB_SAMPLES, true);
if (produced > 0) {
if (audioLowPassEnabled) {
_audioLowPassFilter(audioSampleBuffer, produced);
}
audioCallback(audioSampleBuffer, (size_t)produced);
}
}
static void _setRumble(struct mRumble* rumble, int enable) {

View File

@ -69,7 +69,7 @@ extern "C" {
# endif
# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__CELLOS_LV2__)
# if defined(__GNUC__) && __GNUC__ >= 4
# define RETRO_API RETRO_CALLCONV __attribute__((__visibility__("default")))
# else
# define RETRO_API RETRO_CALLCONV
@ -282,6 +282,7 @@ enum retro_language
RETRO_LANGUAGE_PERSIAN = 20,
RETRO_LANGUAGE_HEBREW = 21,
RETRO_LANGUAGE_ASTURIAN = 22,
RETRO_LANGUAGE_FINNISH = 23,
RETRO_LANGUAGE_LAST,
/* Ensure sizeof(enum) == sizeof(int) */
@ -712,6 +713,9 @@ enum retro_mod
* state of rumble motors in controllers.
* A strong and weak motor is supported, and they can be
* controlled indepedently.
* Should be called from either retro_init() or retro_load_game().
* Should not be called from retro_set_environment().
* Returns false if rumble functionality is unavailable.
*/
#define RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES 24
/* uint64_t * --
@ -1127,6 +1131,13 @@ enum retro_mod
* retro_core_option_definition structs to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
* This allows the core to additionally set option sublabel information
* and/or provide localisation support.
*
* If version is >= 2, core options may instead be set by passing
* a retro_core_options_v2 struct to RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
* or an array of retro_core_options_v2 structs to
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL. This allows the core
* to additionally set optional core option category information
* for frontends with core option category support.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS 53
@ -1168,7 +1179,7 @@ enum retro_mod
* default value is NULL, the first entry in the
* retro_core_option_definition::values array is treated as the default.
*
* The number of possible options should be very limited,
* The number of possible option values should be very limited,
* and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX.
* i.e. it should be feasible to cycle through options
* without a keyboard.
@ -1201,6 +1212,7 @@ enum retro_mod
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
* returns an API version of >= 1.
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
* This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS.
* This should be called the first time as early as
* possible (ideally in retro_set_environment).
* Afterwards it may be called again for the core to communicate
@ -1374,6 +1386,373 @@ enum retro_mod
* call will target the newly initialized driver.
*/
#define RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE 64
/* const struct retro_fastforwarding_override * --
* Used by a libretro core to override the current
* fastforwarding mode of the frontend.
* If NULL is passed to this function, the frontend
* will return true if fastforwarding override
* functionality is supported (no change in
* fastforwarding state will occur in this case).
*/
#define RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE 65
/* const struct retro_system_content_info_override * --
* Allows an implementation to override 'global' content
* info parameters reported by retro_get_system_info().
* Overrides also affect subsystem content info parameters
* set via RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO.
* This function must be called inside retro_set_environment().
* If callback returns false, content info overrides
* are unsupported by the frontend, and will be ignored.
* If callback returns true, extended game info may be
* retrieved by calling RETRO_ENVIRONMENT_GET_GAME_INFO_EXT
* in retro_load_game() or retro_load_game_special().
*
* 'data' points to an array of retro_system_content_info_override
* structs terminated by a { NULL, false, false } element.
* If 'data' is NULL, no changes will be made to the frontend;
* a core may therefore pass NULL in order to test whether
* the RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE and
* RETRO_ENVIRONMENT_GET_GAME_INFO_EXT callbacks are supported
* by the frontend.
*
* For struct member descriptions, see the definition of
* struct retro_system_content_info_override.
*
* Example:
*
* - struct retro_system_info:
* {
* "My Core", // library_name
* "v1.0", // library_version
* "m3u|md|cue|iso|chd|sms|gg|sg", // valid_extensions
* true, // need_fullpath
* false // block_extract
* }
*
* - Array of struct retro_system_content_info_override:
* {
* {
* "md|sms|gg", // extensions
* false, // need_fullpath
* true // persistent_data
* },
* {
* "sg", // extensions
* false, // need_fullpath
* false // persistent_data
* },
* { NULL, false, false }
* }
*
* Result:
* - Files of type m3u, cue, iso, chd will not be
* loaded by the frontend. Frontend will pass a
* valid path to the core, and core will handle
* loading internally
* - Files of type md, sms, gg will be loaded by
* the frontend. A valid memory buffer will be
* passed to the core. This memory buffer will
* remain valid until retro_deinit() returns
* - Files of type sg will be loaded by the frontend.
* A valid memory buffer will be passed to the core.
* This memory buffer will remain valid until
* retro_load_game() (or retro_load_game_special())
* returns
*
* NOTE: If an extension is listed multiple times in
* an array of retro_system_content_info_override
* structs, only the first instance will be registered
*/
#define RETRO_ENVIRONMENT_GET_GAME_INFO_EXT 66
/* const struct retro_game_info_ext ** --
* Allows an implementation to fetch extended game
* information, providing additional content path
* and memory buffer status details.
* This function may only be called inside
* retro_load_game() or retro_load_game_special().
* If callback returns false, extended game information
* is unsupported by the frontend. In this case, only
* regular retro_game_info will be available.
* RETRO_ENVIRONMENT_GET_GAME_INFO_EXT is guaranteed
* to return true if RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE
* returns true.
*
* 'data' points to an array of retro_game_info_ext structs.
*
* For struct member descriptions, see the definition of
* struct retro_game_info_ext.
*
* - If function is called inside retro_load_game(),
* the retro_game_info_ext array is guaranteed to
* have a size of 1 - i.e. the returned pointer may
* be used to access directly the members of the
* first retro_game_info_ext struct, for example:
*
* struct retro_game_info_ext *game_info_ext;
* if (environ_cb(RETRO_ENVIRONMENT_GET_GAME_INFO_EXT, &game_info_ext))
* printf("Content Directory: %s\n", game_info_ext->dir);
*
* - If the function is called inside retro_load_game_special(),
* the retro_game_info_ext array is guaranteed to have a
* size equal to the num_info argument passed to
* retro_load_game_special()
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 67
/* const struct retro_core_options_v2 * --
* Allows an implementation to signal the environment
* which variables it might want to check for later using
* GET_VARIABLE.
* This allows the frontend to present these variables to
* a user dynamically.
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
* returns an API version of >= 2.
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
* This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS.
* This should be called the first time as early as
* possible (ideally in retro_set_environment).
* Afterwards it may be called again for the core to communicate
* updated options to the frontend, but the number of core
* options must not change from the number in the initial call.
* If RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION returns an API
* version of >= 2, this callback is guaranteed to succeed
* (i.e. callback return value does not indicate success)
* If callback returns true, frontend has core option category
* support.
* If callback returns false, frontend does not have core option
* category support.
*
* 'data' points to a retro_core_options_v2 struct, containing
* of two pointers:
* - retro_core_options_v2::categories is an array of
* retro_core_option_v2_category structs terminated by a
* { NULL, NULL, NULL } element. If retro_core_options_v2::categories
* is NULL, all core options will have no category and will be shown
* at the top level of the frontend core option interface. If frontend
* does not have core option category support, categories array will
* be ignored.
* - retro_core_options_v2::definitions is an array of
* retro_core_option_v2_definition structs terminated by a
* { NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL }
* element.
*
* >> retro_core_option_v2_category notes:
*
* - retro_core_option_v2_category::key should contain string
* that uniquely identifies the core option category. Valid
* key characters are [a-z, A-Z, 0-9, _, -]
* Namespace collisions with other implementations' category
* keys are permitted.
* - retro_core_option_v2_category::desc should contain a human
* readable description of the category key.
* - retro_core_option_v2_category::info should contain any
* additional human readable information text that a typical
* user may need to understand the nature of the core option
* category.
*
* Example entry:
* {
* "advanced_settings",
* "Advanced",
* "Options affecting low-level emulation performance and accuracy."
* }
*
* >> retro_core_option_v2_definition notes:
*
* - retro_core_option_v2_definition::key should be namespaced to not
* collide with other implementations' keys. e.g. A core called
* 'foo' should use keys named as 'foo_option'. Valid key characters
* are [a-z, A-Z, 0-9, _, -].
* - retro_core_option_v2_definition::desc should contain a human readable
* description of the key. Will be used when the frontend does not
* have core option category support. Examples: "Aspect Ratio" or
* "Video > Aspect Ratio".
* - retro_core_option_v2_definition::desc_categorized should contain a
* human readable description of the key, which will be used when
* frontend has core option category support. Example: "Aspect Ratio",
* where associated retro_core_option_v2_category::desc is "Video".
* If empty or NULL, the string specified by
* retro_core_option_v2_definition::desc will be used instead.
* retro_core_option_v2_definition::desc_categorized will be ignored
* if retro_core_option_v2_definition::category_key is empty or NULL.
* - retro_core_option_v2_definition::info should contain any additional
* human readable information text that a typical user may need to
* understand the functionality of the option.
* - retro_core_option_v2_definition::info_categorized should contain
* any additional human readable information text that a typical user
* may need to understand the functionality of the option, and will be
* used when frontend has core option category support. This is provided
* to accommodate the case where info text references an option by
* name/desc, and the desc/desc_categorized text for that option differ.
* If empty or NULL, the string specified by
* retro_core_option_v2_definition::info will be used instead.
* retro_core_option_v2_definition::info_categorized will be ignored
* if retro_core_option_v2_definition::category_key is empty or NULL.
* - retro_core_option_v2_definition::category_key should contain a
* category identifier (e.g. "video" or "audio") that will be
* assigned to the core option if frontend has core option category
* support. A categorized option will be shown in a subsection/
* submenu of the frontend core option interface. If key is empty
* or NULL, or if key does not match one of the
* retro_core_option_v2_category::key values in the associated
* retro_core_option_v2_category array, option will have no category
* and will be shown at the top level of the frontend core option
* interface.
* - retro_core_option_v2_definition::values is an array of
* retro_core_option_value structs terminated by a { NULL, NULL }
* element.
* --> retro_core_option_v2_definition::values[index].value is an
* expected option value.
* --> retro_core_option_v2_definition::values[index].label is a
* human readable label used when displaying the value on screen.
* If NULL, the value itself is used.
* - retro_core_option_v2_definition::default_value is the default
* core option setting. It must match one of the expected option
* values in the retro_core_option_v2_definition::values array. If
* it does not, or the default value is NULL, the first entry in the
* retro_core_option_v2_definition::values array is treated as the
* default.
*
* The number of possible option values should be very limited,
* and must be less than RETRO_NUM_CORE_OPTION_VALUES_MAX.
* i.e. it should be feasible to cycle through options
* without a keyboard.
*
* Example entries:
*
* - Uncategorized:
*
* {
* "foo_option",
* "Speed hack coprocessor X",
* NULL,
* "Provides increased performance at the expense of reduced accuracy.",
* NULL,
* NULL,
* {
* { "false", NULL },
* { "true", NULL },
* { "unstable", "Turbo (Unstable)" },
* { NULL, NULL },
* },
* "false"
* }
*
* - Categorized:
*
* {
* "foo_option",
* "Advanced > Speed hack coprocessor X",
* "Speed hack coprocessor X",
* "Setting 'Advanced > Speed hack coprocessor X' to 'true' or 'Turbo' provides increased performance at the expense of reduced accuracy",
* "Setting 'Speed hack coprocessor X' to 'true' or 'Turbo' provides increased performance at the expense of reduced accuracy",
* "advanced_settings",
* {
* { "false", NULL },
* { "true", NULL },
* { "unstable", "Turbo (Unstable)" },
* { NULL, NULL },
* },
* "false"
* }
*
* Only strings are operated on. The possible values will
* generally be displayed and stored as-is by the frontend.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL 68
/* const struct retro_core_options_v2_intl * --
* Allows an implementation to signal the environment
* which variables it might want to check for later using
* GET_VARIABLE.
* This allows the frontend to present these variables to
* a user dynamically.
* This should only be called if RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
* returns an API version of >= 2.
* This should be called instead of RETRO_ENVIRONMENT_SET_VARIABLES.
* This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS.
* This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL.
* This should be called instead of RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2.
* This should be called the first time as early as
* possible (ideally in retro_set_environment).
* Afterwards it may be called again for the core to communicate
* updated options to the frontend, but the number of core
* options must not change from the number in the initial call.
* If RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION returns an API
* version of >= 2, this callback is guaranteed to succeed
* (i.e. callback return value does not indicate success)
* If callback returns true, frontend has core option category
* support.
* If callback returns false, frontend does not have core option
* category support.
*
* This is fundamentally the same as RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
* with the addition of localisation support. The description of the
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 callback should be consulted
* for further details.
*
* 'data' points to a retro_core_options_v2_intl struct.
*
* - retro_core_options_v2_intl::us is a pointer to a
* retro_core_options_v2 struct defining the US English
* core options implementation. It must point to a valid struct.
*
* - retro_core_options_v2_intl::local is a pointer to a
* retro_core_options_v2 struct defining core options for
* the current frontend language. It may be NULL (in which case
* retro_core_options_v2_intl::us is used by the frontend). Any items
* missing from this struct will be read from
* retro_core_options_v2_intl::us instead.
*
* NOTE: Default core option values are always taken from the
* retro_core_options_v2_intl::us struct. Any default values in
* the retro_core_options_v2_intl::local struct will be ignored.
*/
#define RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK 69
/* const struct retro_core_options_update_display_callback * --
* Allows a frontend to signal that a core must update
* the visibility of any dynamically hidden core options,
* and enables the frontend to detect visibility changes.
* Used by the frontend to update the menu display status
* of core options without requiring a call of retro_run().
* Must be called in retro_set_environment().
*/
#define RETRO_ENVIRONMENT_SET_VARIABLE 70
/* const struct retro_variable * --
* Allows an implementation to notify the frontend
* that a core option value has changed.
*
* retro_variable::key and retro_variable::value
* must match strings that have been set previously
* via one of the following:
*
* - RETRO_ENVIRONMENT_SET_VARIABLES
* - RETRO_ENVIRONMENT_SET_CORE_OPTIONS
* - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL
* - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2
* - RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL
*
* After changing a core option value via this
* callback, RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE
* will return true.
*
* If data is NULL, no changes will be registered
* and the callback will return true; an
* implementation may therefore pass NULL in order
* to test whether the callback is supported.
*/
#define RETRO_ENVIRONMENT_GET_THROTTLE_STATE (71 | RETRO_ENVIRONMENT_EXPERIMENTAL)
/* struct retro_throttle_state * --
* Allows an implementation to get details on the actual rate
* the frontend is attempting to call retro_run().
*/
/* VFS functionality */
/* File paths:
@ -2777,6 +3156,213 @@ struct retro_system_info
bool block_extract;
};
/* Defines overrides which modify frontend handling of
* specific content file types.
* An array of retro_system_content_info_override is
* passed to RETRO_ENVIRONMENT_SET_CONTENT_INFO_OVERRIDE
* NOTE: In the following descriptions, references to
* retro_load_game() may be replaced with
* retro_load_game_special() */
struct retro_system_content_info_override
{
/* A list of file extensions for which the override
* should apply, delimited by a 'pipe' character
* (e.g. "md|sms|gg")
* Permitted file extensions are limited to those
* included in retro_system_info::valid_extensions
* and/or retro_subsystem_rom_info::valid_extensions */
const char *extensions;
/* Overrides the need_fullpath value set in
* retro_system_info and/or retro_subsystem_rom_info.
* To reiterate:
*
* If need_fullpath is true and retro_load_game() is called:
* - retro_game_info::path is guaranteed to contain a valid
* path to an existent file
* - retro_game_info::data and retro_game_info::size are invalid
*
* If need_fullpath is false and retro_load_game() is called:
* - retro_game_info::path may be NULL
* - retro_game_info::data and retro_game_info::size are guaranteed
* to be valid
*
* In addition:
*
* If need_fullpath is true and retro_load_game() is called:
* - retro_game_info_ext::full_path is guaranteed to contain a valid
* path to an existent file
* - retro_game_info_ext::archive_path may be NULL
* - retro_game_info_ext::archive_file may be NULL
* - retro_game_info_ext::dir is guaranteed to contain a valid path
* to the directory in which the content file exists
* - retro_game_info_ext::name is guaranteed to contain the
* basename of the content file, without extension
* - retro_game_info_ext::ext is guaranteed to contain the
* extension of the content file in lower case format
* - retro_game_info_ext::data and retro_game_info_ext::size
* are invalid
*
* If need_fullpath is false and retro_load_game() is called:
* - If retro_game_info_ext::file_in_archive is false:
* - retro_game_info_ext::full_path is guaranteed to contain
* a valid path to an existent file
* - retro_game_info_ext::archive_path may be NULL
* - retro_game_info_ext::archive_file may be NULL
* - retro_game_info_ext::dir is guaranteed to contain a
* valid path to the directory in which the content file exists
* - retro_game_info_ext::name is guaranteed to contain the
* basename of the content file, without extension
* - retro_game_info_ext::ext is guaranteed to contain the
* extension of the content file in lower case format
* - If retro_game_info_ext::file_in_archive is true:
* - retro_game_info_ext::full_path may be NULL
* - retro_game_info_ext::archive_path is guaranteed to
* contain a valid path to an existent compressed file
* inside which the content file is located
* - retro_game_info_ext::archive_file is guaranteed to
* contain a valid path to an existent content file
* inside the compressed file referred to by
* retro_game_info_ext::archive_path
* e.g. for a compressed file '/path/to/foo.zip'
* containing 'bar.sfc'
* > retro_game_info_ext::archive_path will be '/path/to/foo.zip'
* > retro_game_info_ext::archive_file will be 'bar.sfc'
* - retro_game_info_ext::dir is guaranteed to contain a
* valid path to the directory in which the compressed file
* (containing the content file) exists
* - retro_game_info_ext::name is guaranteed to contain
* EITHER
* 1) the basename of the compressed file (containing
* the content file), without extension
* OR
* 2) the basename of the content file inside the
* compressed file, without extension
* In either case, a core should consider 'name' to
* be the canonical name/ID of the the content file
* - retro_game_info_ext::ext is guaranteed to contain the
* extension of the content file inside the compressed file,
* in lower case format
* - retro_game_info_ext::data and retro_game_info_ext::size are
* guaranteed to be valid */
bool need_fullpath;
/* If need_fullpath is false, specifies whether the content
* data buffer available in retro_load_game() is 'persistent'
*
* If persistent_data is false and retro_load_game() is called:
* - retro_game_info::data and retro_game_info::size
* are valid only until retro_load_game() returns
* - retro_game_info_ext::data and retro_game_info_ext::size
* are valid only until retro_load_game() returns
*
* If persistent_data is true and retro_load_game() is called:
* - retro_game_info::data and retro_game_info::size
* are valid until retro_deinit() returns
* - retro_game_info_ext::data and retro_game_info_ext::size
* are valid until retro_deinit() returns */
bool persistent_data;
};
/* Similar to retro_game_info, but provides extended
* information about the source content file and
* game memory buffer status.
* And array of retro_game_info_ext is returned by
* RETRO_ENVIRONMENT_GET_GAME_INFO_EXT
* NOTE: In the following descriptions, references to
* retro_load_game() may be replaced with
* retro_load_game_special() */
struct retro_game_info_ext
{
/* - If file_in_archive is false, contains a valid
* path to an existent content file (UTF-8 encoded)
* - If file_in_archive is true, may be NULL */
const char *full_path;
/* - If file_in_archive is false, may be NULL
* - If file_in_archive is true, contains a valid path
* to an existent compressed file inside which the
* content file is located (UTF-8 encoded) */
const char *archive_path;
/* - If file_in_archive is false, may be NULL
* - If file_in_archive is true, contain a valid path
* to an existent content file inside the compressed
* file referred to by archive_path (UTF-8 encoded)
* e.g. for a compressed file '/path/to/foo.zip'
* containing 'bar.sfc'
* > archive_path will be '/path/to/foo.zip'
* > archive_file will be 'bar.sfc' */
const char *archive_file;
/* - If file_in_archive is false, contains a valid path
* to the directory in which the content file exists
* (UTF-8 encoded)
* - If file_in_archive is true, contains a valid path
* to the directory in which the compressed file
* (containing the content file) exists (UTF-8 encoded) */
const char *dir;
/* Contains the canonical name/ID of the content file
* (UTF-8 encoded). Intended for use when identifying
* 'complementary' content named after the loaded file -
* i.e. companion data of a different format (a CD image
* required by a ROM), texture packs, internally handled
* save files, etc.
* - If file_in_archive is false, contains the basename
* of the content file, without extension
* - If file_in_archive is true, then string is
* implementation specific. A frontend may choose to
* set a name value of:
* EITHER
* 1) the basename of the compressed file (containing
* the content file), without extension
* OR
* 2) the basename of the content file inside the
* compressed file, without extension
* RetroArch sets the 'name' value according to (1).
* A frontend that supports routine loading of
* content from archives containing multiple unrelated
* content files may set the 'name' value according
* to (2). */
const char *name;
/* - If file_in_archive is false, contains the extension
* of the content file in lower case format
* - If file_in_archive is true, contains the extension
* of the content file inside the compressed file,
* in lower case format */
const char *ext;
/* String of implementation specific meta-data. */
const char *meta;
/* Memory buffer of loaded game content. Will be NULL:
* IF
* - retro_system_info::need_fullpath is true and
* retro_system_content_info_override::need_fullpath
* is unset
* OR
* - retro_system_content_info_override::need_fullpath
* is true */
const void *data;
/* Size of game content memory buffer, in bytes */
size_t size;
/* True if loaded content file is inside a compressed
* archive */
bool file_in_archive;
/* - If data is NULL, value is unset/ignored
* - If data is non-NULL:
* - If persistent_data is false, data and size are
* valid only until retro_load_game() returns
* - If persistent_data is true, data and size are
* are valid until retro_deinit() returns */
bool persistent_data;
};
struct retro_game_geometry
{
unsigned base_width; /* Nominal video width of game. */
@ -2888,6 +3474,143 @@ struct retro_core_options_intl
struct retro_core_option_definition *local;
};
struct retro_core_option_v2_category
{
/* Variable uniquely identifying the
* option category. Valid key characters
* are [a-z, A-Z, 0-9, _, -] */
const char *key;
/* Human-readable category description
* > Used as category menu label when
* frontend has core option category
* support */
const char *desc;
/* Human-readable category information
* > Used as category menu sublabel when
* frontend has core option category
* support
* > Optional (may be NULL or an empty
* string) */
const char *info;
};
struct retro_core_option_v2_definition
{
/* Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE.
* Valid key characters are [a-z, A-Z, 0-9, _, -] */
const char *key;
/* Human-readable core option description
* > Used as menu label when frontend does
* not have core option category support
* e.g. "Video > Aspect Ratio" */
const char *desc;
/* Human-readable core option description
* > Used as menu label when frontend has
* core option category support
* e.g. "Aspect Ratio", where associated
* retro_core_option_v2_category::desc
* is "Video"
* > If empty or NULL, the string specified by
* desc will be used as the menu label
* > Will be ignored (and may be set to NULL)
* if category_key is empty or NULL */
const char *desc_categorized;
/* Human-readable core option information
* > Used as menu sublabel */
const char *info;
/* Human-readable core option information
* > Used as menu sublabel when frontend
* has core option category support
* (e.g. may be required when info text
* references an option by name/desc,
* and the desc/desc_categorized text
* for that option differ)
* > If empty or NULL, the string specified by
* info will be used as the menu sublabel
* > Will be ignored (and may be set to NULL)
* if category_key is empty or NULL */
const char *info_categorized;
/* Variable specifying category (e.g. "video",
* "audio") that will be assigned to the option
* if frontend has core option category support.
* > Categorized options will be displayed in a
* subsection/submenu of the frontend core
* option interface
* > Specified string must match one of the
* retro_core_option_v2_category::key values
* in the associated retro_core_option_v2_category
* array; If no match is not found, specified
* string will be considered as NULL
* > If specified string is empty or NULL, option will
* have no category and will be shown at the top
* level of the frontend core option interface */
const char *category_key;
/* Array of retro_core_option_value structs, terminated by NULL */
struct retro_core_option_value values[RETRO_NUM_CORE_OPTION_VALUES_MAX];
/* Default core option value. Must match one of the values
* in the retro_core_option_value array, otherwise will be
* ignored */
const char *default_value;
};
struct retro_core_options_v2
{
/* Array of retro_core_option_v2_category structs,
* terminated by NULL
* > If NULL, all entries in definitions array
* will have no category and will be shown at
* the top level of the frontend core option
* interface
* > Will be ignored if frontend does not have
* core option category support */
struct retro_core_option_v2_category *categories;
/* Array of retro_core_option_v2_definition structs,
* terminated by NULL */
struct retro_core_option_v2_definition *definitions;
};
struct retro_core_options_v2_intl
{
/* Pointer to a retro_core_options_v2 struct
* > US English implementation
* > Must point to a valid struct */
struct retro_core_options_v2 *us;
/* Pointer to a retro_core_options_v2 struct
* - Implementation for current frontend language
* - May be NULL */
struct retro_core_options_v2 *local;
};
/* Used by the frontend to monitor changes in core option
* visibility. May be called each time any core option
* value is set via the frontend.
* - On each invocation, the core must update the visibility
* of any dynamically hidden options using the
* RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY environment
* callback.
* - On the first invocation, returns 'true' if the visibility
* of any core option has changed since the last call of
* retro_load_game() or retro_load_game_special().
* - On each subsequent invocation, returns 'true' if the
* visibility of any core option has changed since the last
* time the function was called. */
typedef bool (RETRO_CALLCONV *retro_core_options_update_display_callback_t)(void);
struct retro_core_options_update_display_callback
{
retro_core_options_update_display_callback_t callback;
};
struct retro_game_info
{
const char *path; /* Path to game, UTF-8 encoded.
@ -2934,6 +3657,84 @@ struct retro_framebuffer
Set by frontend in GET_CURRENT_SOFTWARE_FRAMEBUFFER. */
};
/* Used by a libretro core to override the current
* fastforwarding mode of the frontend */
struct retro_fastforwarding_override
{
/* Specifies the runtime speed multiplier that
* will be applied when 'fastforward' is true.
* For example, a value of 5.0 when running 60 FPS
* content will cap the fast-forward rate at 300 FPS.
* Note that the target multiplier may not be achieved
* if the host hardware has insufficient processing
* power.
* Setting a value of 0.0 (or greater than 0.0 but
* less than 1.0) will result in an uncapped
* fast-forward rate (limited only by hardware
* capacity).
* If the value is negative, it will be ignored
* (i.e. the frontend will use a runtime speed
* multiplier of its own choosing) */
float ratio;
/* If true, fastforwarding mode will be enabled.
* If false, fastforwarding mode will be disabled. */
bool fastforward;
/* If true, and if supported by the frontend, an
* on-screen notification will be displayed while
* 'fastforward' is true.
* If false, and if supported by the frontend, any
* on-screen fast-forward notifications will be
* suppressed */
bool notification;
/* If true, the core will have sole control over
* when fastforwarding mode is enabled/disabled;
* the frontend will not be able to change the
* state set by 'fastforward' until either
* 'inhibit_toggle' is set to false, or the core
* is unloaded */
bool inhibit_toggle;
};
/* During normal operation. Rate will be equal to the core's internal FPS. */
#define RETRO_THROTTLE_NONE 0
/* While paused or stepping single frames. Rate will be 0. */
#define RETRO_THROTTLE_FRAME_STEPPING 1
/* During fast forwarding.
* Rate will be 0 if not specifically limited to a maximum speed. */
#define RETRO_THROTTLE_FAST_FORWARD 2
/* During slow motion. Rate will be less than the core's internal FPS. */
#define RETRO_THROTTLE_SLOW_MOTION 3
/* While rewinding recorded save states. Rate can vary depending on the rewind
* speed or be 0 if the frontend is not aiming for a specific rate. */
#define RETRO_THROTTLE_REWINDING 4
/* While vsync is active in the video driver and the target refresh rate is
* lower than the core's internal FPS. Rate is the target refresh rate. */
#define RETRO_THROTTLE_VSYNC 5
/* When the frontend does not throttle in any way. Rate will be 0.
* An example could be if no vsync or audio output is active. */
#define RETRO_THROTTLE_UNBLOCKED 6
struct retro_throttle_state
{
/* The current throttling mode. Should be one of the values above. */
unsigned mode;
/* How many times per second the frontend aims to call retro_run.
* Depending on the mode, it can be 0 if there is no known fixed rate.
* This won't be accurate if the total processing time of the core and
* the frontend is longer than what is available for one frame. */
float rate;
};
/* Callbacks */
/* Environment callback. Gives implementations a way of performing

View File

@ -13,9 +13,10 @@
/*
********************************
* VERSION: 1.3
* VERSION: 2.0
********************************
*
* - 2.0: Add support for core options v2 interface
* - 1.3: Move translations to libretro_core_options_intl.h
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
@ -48,43 +49,43 @@ extern "C" {
* - Will be used as a fallback for any missing entries in
* frontend language definition */
struct retro_core_option_definition option_defs_us[] = {
struct retro_core_option_v2_category option_cats_us[] = {
{
"mgba_solar_sensor_level",
"Solar Sensor Level",
"Sets ambient sunlight intensity. Can be used by games that included a solar sensor in their cartridges, e.g: the Boktai series.",
{
{ "sensor", "Use device sensor if available" },
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL },
},
"0"
"system",
"System",
"Configure base hardware selection / BIOS parameters."
},
{
"mgba_allow_opposing_directions",
"Allow Opposing Directional Input",
"Enabling this will allow pressing / quickly alternating / holding both left and right (or up and down) directions at the same time. This may cause movement-based glitches.",
{
{ "no", "disabled" },
{ "yes", "enabled" },
{ NULL, NULL },
},
"no"
"video",
"Video",
"Configure DMG palette / SGB borders."
},
{
"audio",
"Audio",
"Configure audio filtering."
},
{
"input",
"Input & Auxiliary Devices",
"Configure controller / sensor input and controller rumble settings."
},
{
"performance",
"Performance",
"Configure idle loop removal / frameskipping parameters."
},
{ NULL, NULL, NULL },
};
struct retro_core_option_v2_definition option_defs_us[] = {
{
"mgba_gb_model",
"Game Boy Model (requires restart)",
"Game Boy Model (Restart)",
NULL,
"Runs loaded content with a specific Game Boy model. 'Autodetect' will select the most appropriate model for the current game.",
NULL,
"system",
{
{ "Autodetect", NULL },
{ "Game Boy", NULL },
@ -97,41 +98,180 @@ struct retro_core_option_definition option_defs_us[] = {
},
{
"mgba_use_bios",
"Use BIOS File if Found (requires restart)",
"Use BIOS File if Found (Restart)",
NULL,
"Use official BIOS/bootloader for emulated hardware, if present in RetroArch's system directory.",
NULL,
"system",
{
{ "ON", NULL },
{ "OFF", NULL },
{ "ON", "enabled" },
{ "OFF", "disabled" },
{ NULL, NULL },
},
"ON"
},
{
"mgba_skip_bios",
"Skip BIOS Intro (requires restart)",
"Skip BIOS Intro (Restart)",
NULL,
"When using an official BIOS/bootloader, skip the start-up logo animation. This setting is ignored when 'Use BIOS File if Found' is disabled.",
NULL,
"system",
{
{ "OFF", NULL },
{ "ON", NULL },
{ "OFF", "disabled" },
{ "ON", "enabled" },
{ NULL, NULL },
},
"OFF"
},
{
"mgba_sgb_borders",
"Use Super Game Boy Borders (requires restart)",
"Display Super Game Boy borders when running Super Game Boy enhanced games.",
"mgba_gb_colors",
"Default Game Boy Palette",
NULL,
"Selects which palette is used for Game Boy games that are not Game Boy Color or Super Game Boy compatible, or if the model is forced to Game Boy.",
NULL,
"video",
{
{ "ON", NULL },
{ "OFF", NULL },
/* This list is populated at runtime */
{ "Grayscale", NULL },
{ NULL, NULL },
},
"Grayscale"
},
{
"mgba_gb_colors_preset",
"Hardware Preset Game Boy Palettes (Restart)",
NULL,
"Use the palettes for Game Boy games that have presets on the Game Boy Color or Super Game Boy.",
NULL,
"video",
{
{ "0", "Default Game Boy preset" },
{ "1", "Game Boy Color presets only" },
{ "2", "Super Game Boy presets only" },
{ "3", "Any available presets" },
{ NULL, NULL },
},
"0"
},
{
"mgba_sgb_borders",
"Use Super Game Boy Borders (Restart)",
NULL,
"Display Super Game Boy borders when running Super Game Boy enhanced games.",
NULL,
"video",
{
{ "ON", "enabled" },
{ "OFF", "disabled" },
{ NULL, NULL },
},
"ON"
},
{
"mgba_audio_low_pass_filter",
"Audio Filter",
"Low Pass Filter",
"Enables a low pass audio filter to reduce the 'harshness' of generated audio.",
NULL,
"audio",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"mgba_audio_low_pass_range",
"Audio Filter Level",
"Filter Level",
"Specifies the cut-off frequency of the low pass audio filter. A higher value increases the perceived 'strength' of the filter, since a wider range of the high frequency spectrum is attenuated.",
NULL,
"audio",
{
{ "5", "5%" },
{ "10", "10%" },
{ "15", "15%" },
{ "20", "20%" },
{ "25", "25%" },
{ "30", "30%" },
{ "35", "35%" },
{ "40", "40%" },
{ "45", "45%" },
{ "50", "50%" },
{ "55", "55%" },
{ "60", "60%" },
{ "65", "65%" },
{ "70", "70%" },
{ "75", "75%" },
{ "80", "80%" },
{ "85", "85%" },
{ "90", "90%" },
{ "95", "95%" },
{ NULL, NULL },
},
"60"
},
{
"mgba_allow_opposing_directions",
"Allow Opposing Directional Input",
NULL,
"Enabling this will allow pressing / quickly alternating / holding both left and right (or up and down) directions at the same time. This may cause movement-based glitches.",
NULL,
"input",
{
{ "no", "disabled" },
{ "yes", "enabled" },
{ NULL, NULL },
},
"no"
},
{
"mgba_solar_sensor_level",
"Solar Sensor Level",
NULL,
"Sets ambient sunlight intensity. Can be used by games that included a solar sensor in their cartridges, e.g: the Boktai series.",
NULL,
"input",
{
{ "sensor", "Use device sensor if available" },
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL },
},
"0"
},
{
"mgba_force_gbp",
"Game Boy Player Rumble (Restart)",
NULL,
"Enabling this will allow compatible games with the Game Boy Player boot logo to make the controller rumble. Due to how Nintendo decided this feature should work, it may cause glitches such as flickering or lag in some of these games.",
NULL,
"input",
{
{ "OFF", "disabled" },
{ "ON", "enabled" },
{ NULL, NULL },
},
"OFF"
},
{
"mgba_idle_optimization",
"Idle Loop Removal",
NULL,
"Reduce system load by optimizing so-called 'idle-loops' - sections in the code where nothing happens, but the CPU runs at full speed (like a car revving in neutral). Improves performance, and should be enabled on low-end hardware.",
NULL,
"performance",
{
{ "Remove Known", NULL },
{ "Detect and Remove", NULL },
@ -143,7 +283,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"mgba_frameskip",
"Frameskip",
"Skip frames to improve performance at the expense of visual smoothness. Value set here is the number of frames omitted after a frame is rendered - i.e. '0' = 60fps, '1' = 30fps, '2' = 15fps, etc.",
NULL,
"Skip frames to improve performance at the expense of visual smoothness. The value set here is the number of frames omitted after a frame is rendered - i.e. '0' = 60fps, '1' = 30fps, '2' = 15fps, etc.",
NULL,
"performance",
{
{ "0", NULL },
{ "1", NULL },
@ -160,44 +303,12 @@ struct retro_core_option_definition option_defs_us[] = {
},
"0"
},
#if defined(COLOR_16_BIT) && defined(COLOR_5_6_5)
{
"mgba_color_correction",
"Color Correction",
"Adjusts output colors to match the display of real GBA/GBC hardware.",
{
{ "OFF", NULL },
{ "GBA", "Game Boy Advance" },
{ "GBC", "Game Boy Color" },
{ "Auto", NULL },
{ NULL, NULL },
},
"OFF"
},
#endif
{
"mgba_force_gbp",
"Enable Game Boy Player Rumble (requires restart)",
"Enabling this will allow compatible games with the Game Boy Player boot logo to make the controller rumble. Due to how Nintendo decided this feature should work, it may cause glitches such as flickering or lag in some of these games.",
{
{ "OFF", NULL },
{ "ON", NULL },
{ NULL, NULL },
},
"OFF"
},
{
"mgba_gb_colors",
"Set default Game Boy palette",
"Selects which palette is used for Game Boy games that are not Game Boy Color or Super Game Boy compatible, or if the model is forced to Game Boy.",
{
// This list is populated at runtime
{ "Grayscale", NULL },
{ NULL, NULL },
},
"Grayscale"
},
{ NULL, NULL, NULL, {{0}}, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL, {{0}}, NULL },
};
struct retro_core_options_v2 options_us = {
option_cats_us,
option_defs_us
};
/*
@ -207,26 +318,31 @@ struct retro_core_option_definition option_defs_us[] = {
*/
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
option_defs_us, /* RETRO_LANGUAGE_ENGLISH */
NULL, /* RETRO_LANGUAGE_JAPANESE */
NULL, /* RETRO_LANGUAGE_FRENCH */
NULL, /* RETRO_LANGUAGE_SPANISH */
NULL, /* RETRO_LANGUAGE_GERMAN */
option_defs_it, /* RETRO_LANGUAGE_ITALIAN */
NULL, /* RETRO_LANGUAGE_DUTCH */
NULL, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
NULL, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
NULL, /* RETRO_LANGUAGE_RUSSIAN */
NULL, /* RETRO_LANGUAGE_KOREAN */
NULL, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
NULL, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
NULL, /* RETRO_LANGUAGE_ESPERANTO */
NULL, /* RETRO_LANGUAGE_POLISH */
NULL, /* RETRO_LANGUAGE_VIETNAMESE */
NULL, /* RETRO_LANGUAGE_ARABIC */
NULL, /* RETRO_LANGUAGE_GREEK */
option_defs_tr, /* RETRO_LANGUAGE_TURKISH */
struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
&options_us, /* RETRO_LANGUAGE_ENGLISH */
&options_ja, /* RETRO_LANGUAGE_JAPANESE */
&options_fr, /* RETRO_LANGUAGE_FRENCH */
&options_es, /* RETRO_LANGUAGE_SPANISH */
&options_de, /* RETRO_LANGUAGE_GERMAN */
&options_it, /* RETRO_LANGUAGE_ITALIAN */
&options_nl, /* RETRO_LANGUAGE_DUTCH */
&options_pt_br, /* RETRO_LANGUAGE_PORTUGUESE_BRAZIL */
&options_pt_pt, /* RETRO_LANGUAGE_PORTUGUESE_PORTUGAL */
&options_ru, /* RETRO_LANGUAGE_RUSSIAN */
&options_ko, /* RETRO_LANGUAGE_KOREAN */
&options_cht, /* RETRO_LANGUAGE_CHINESE_TRADITIONAL */
&options_chs, /* RETRO_LANGUAGE_CHINESE_SIMPLIFIED */
&options_eo, /* RETRO_LANGUAGE_ESPERANTO */
&options_pl, /* RETRO_LANGUAGE_POLISH */
&options_vn, /* RETRO_LANGUAGE_VIETNAMESE */
&options_ar, /* RETRO_LANGUAGE_ARABIC */
&options_el, /* RETRO_LANGUAGE_GREEK */
&options_tr, /* RETRO_LANGUAGE_TURKISH */
&options_sv, /* RETRO_LANGUAGE_SLOVAK */
&options_fa, /* RETRO_LANGUAGE_PERSIAN */
&options_he, /* RETRO_LANGUAGE_HEBREW */
&options_ast, /* RETRO_LANGUAGE_ASTURIAN */
&options_fi, /* RETRO_LANGUAGE_FINNISH */
};
#endif
@ -244,39 +360,61 @@ struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
* be as painless as possible for core devs)
*/
static INLINE void libretro_set_core_options(retro_environment_t environ_cb)
static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
bool *categories_supported)
{
unsigned version = 0;
unsigned version = 0;
#ifndef HAVE_NO_LANGEXTRA
unsigned language = 0;
#endif
if (!environ_cb)
if (!environ_cb || !categories_supported)
return;
if (environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version) && (version >= 1))
*categories_supported = false;
if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
version = 0;
if (version >= 2)
{
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_options_intl core_options_intl;
unsigned language = 0;
struct retro_core_options_v2_intl core_options_intl;
core_options_intl.us = option_defs_us;
core_options_intl.us = &options_us;
core_options_intl.local = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
core_options_intl.local = option_defs_intl[language];
core_options_intl.local = options_intl[language];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_intl);
*categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
&core_options_intl);
#else
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, &option_defs_us);
*categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
&options_us);
#endif
}
else
{
size_t i;
size_t i, j;
size_t option_index = 0;
size_t num_options = 0;
struct retro_core_option_definition
*option_v1_defs_us = NULL;
#ifndef HAVE_NO_LANGEXTRA
size_t num_options_intl = 0;
struct retro_core_option_v2_definition
*option_defs_intl = NULL;
struct retro_core_option_definition
*option_v1_defs_intl = NULL;
struct retro_core_options_intl
core_options_v1_intl;
#endif
struct retro_variable *variables = NULL;
char **values_buf = NULL;
/* Determine number of options */
/* Determine total number of options */
while (true)
{
if (option_defs_us[num_options].key)
@ -285,86 +423,187 @@ static INLINE void libretro_set_core_options(retro_environment_t environ_cb)
break;
}
/* Allocate arrays */
variables = (struct retro_variable *)calloc(num_options + 1, sizeof(struct retro_variable));
values_buf = (char **)calloc(num_options, sizeof(char *));
if (!variables || !values_buf)
goto error;
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
if (version >= 1)
{
const char *key = option_defs_us[i].key;
const char *desc = option_defs_us[i].desc;
const char *default_value = option_defs_us[i].default_value;
struct retro_core_option_value *values = option_defs_us[i].values;
size_t buf_len = 3;
size_t default_index = 0;
/* Allocate US array */
option_v1_defs_us = (struct retro_core_option_definition *)
calloc(num_options + 1, sizeof(struct retro_core_option_definition));
values_buf[i] = NULL;
if (desc)
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
size_t num_values = 0;
struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
struct retro_core_option_value *option_values = option_def_us->values;
struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
/* Determine number of values */
option_v1_def_us->key = option_def_us->key;
option_v1_def_us->desc = option_def_us->desc;
option_v1_def_us->info = option_def_us->info;
option_v1_def_us->default_value = option_def_us->default_value;
/* Values must be copied individually... */
while (option_values->value)
{
option_v1_values->value = option_values->value;
option_v1_values->label = option_values->label;
option_values++;
option_v1_values++;
}
}
#ifndef HAVE_NO_LANGEXTRA
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
options_intl[language])
option_defs_intl = options_intl[language]->definitions;
if (option_defs_intl)
{
/* Determine number of intl options */
while (true)
{
if (values[num_values].value)
{
/* Check if this is the default value */
if (default_value)
if (strcmp(values[num_values].value, default_value) == 0)
default_index = num_values;
buf_len += strlen(values[num_values].value);
num_values++;
}
if (option_defs_intl[num_options_intl].key)
num_options_intl++;
else
break;
}
/* Build values string */
if (num_values > 0)
/* Allocate intl array */
option_v1_defs_intl = (struct retro_core_option_definition *)
calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
/* Copy parameters from option_defs_intl array */
for (i = 0; i < num_options_intl; i++)
{
size_t j;
struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
struct retro_core_option_value *option_values = option_def_intl->values;
struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
buf_len += num_values - 1;
buf_len += strlen(desc);
option_v1_def_intl->key = option_def_intl->key;
option_v1_def_intl->desc = option_def_intl->desc;
option_v1_def_intl->info = option_def_intl->info;
option_v1_def_intl->default_value = option_def_intl->default_value;
values_buf[i] = (char *)calloc(buf_len, sizeof(char));
if (!values_buf[i])
goto error;
strcpy(values_buf[i], desc);
strcat(values_buf[i], "; ");
/* Default value goes first */
strcat(values_buf[i], values[default_index].value);
/* Add remaining values */
for (j = 0; j < num_values; j++)
/* Values must be copied individually... */
while (option_values->value)
{
if (j != default_index)
{
strcat(values_buf[i], "|");
strcat(values_buf[i], values[j].value);
}
option_v1_values->value = option_values->value;
option_v1_values->label = option_values->label;
option_values++;
option_v1_values++;
}
}
}
variables[i].key = key;
variables[i].value = values_buf[i];
core_options_v1_intl.us = option_v1_defs_us;
core_options_v1_intl.local = option_v1_defs_intl;
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
#else
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
#endif
}
else
{
/* Allocate arrays */
variables = (struct retro_variable *)calloc(num_options + 1,
sizeof(struct retro_variable));
values_buf = (char **)calloc(num_options, sizeof(char *));
if (!variables || !values_buf)
goto error;
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
const char *key = option_defs_us[i].key;
const char *desc = option_defs_us[i].desc;
const char *default_value = option_defs_us[i].default_value;
struct retro_core_option_value *values = option_defs_us[i].values;
size_t buf_len = 3;
size_t default_index = 0;
values_buf[i] = NULL;
if (desc)
{
size_t num_values = 0;
/* Determine number of values */
while (true)
{
if (values[num_values].value)
{
/* Check if this is the default value */
if (default_value)
if (strcmp(values[num_values].value, default_value) == 0)
default_index = num_values;
buf_len += strlen(values[num_values].value);
num_values++;
}
else
break;
}
/* Build values string */
if (num_values > 0)
{
buf_len += num_values - 1;
buf_len += strlen(desc);
values_buf[i] = (char *)calloc(buf_len, sizeof(char));
if (!values_buf[i])
goto error;
strcpy(values_buf[i], desc);
strcat(values_buf[i], "; ");
/* Default value goes first */
strcat(values_buf[i], values[default_index].value);
/* Add remaining values */
for (j = 0; j < num_values; j++)
{
if (j != default_index)
{
strcat(values_buf[i], "|");
strcat(values_buf[i], values[j].value);
}
}
}
}
variables[option_index].key = key;
variables[option_index].value = values_buf[i];
option_index++;
}
/* Set variables */
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
}
/* Set variables */
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
error:
/* Clean up */
if (option_v1_defs_us)
{
free(option_v1_defs_us);
option_v1_defs_us = NULL;
}
#ifndef HAVE_NO_LANGEXTRA
if (option_v1_defs_intl)
{
free(option_v1_defs_intl);
option_v1_defs_intl = NULL;
}
#endif
if (values_buf)
{
for (i = 0; i < num_options; i++)

File diff suppressed because it is too large Load Diff

View File

@ -235,13 +235,15 @@ static void mGLES2ContextResized(struct VideoBackend* v, unsigned w, unsigned h)
context->shaders[n].dirty = true;
}
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, context->finalShader.tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, drawW, drawH, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindFramebuffer(GL_FRAMEBUFFER, context->finalShader.fbo);
glViewport((w - drawW) / 2, (h - drawH) / 2, drawW, drawH);
}
static void mGLES2ContextClear(struct VideoBackend* v) {
UNUSED(v);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
struct mGLES2Context* context = (struct mGLES2Context*) v;
glBindFramebuffer(GL_FRAMEBUFFER, context->finalShader.fbo);
glClearColor(0.f, 0.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
}
@ -277,7 +279,7 @@ void _drawShader(struct mGLES2Context* context, struct mGLES2Shader* shader) {
GLint oldTex;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTex);
glBindTexture(GL_TEXTURE_2D, shader->tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, drawW, drawH, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, drawW + padW * 2, drawH + padH * 2, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, oldTex);
}
shader->dirty = false;
@ -434,6 +436,22 @@ void mGLES2ContextCreate(struct mGLES2Context* context) {
context->nShaders = 0;
}
void mGLES2ContextUseFramebuffer(struct mGLES2Context* context) {
glGenFramebuffers(1, &context->finalShader.fbo);
glGenTextures(1, &context->finalShader.tex);
glBindTexture(GL_TEXTURE_2D, context->finalShader.tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindTexture(GL_TEXTURE_2D, 0);
glBindFramebuffer(GL_FRAMEBUFFER, context->finalShader.fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, context->finalShader.tex, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* fs, int width, int height, bool integerScaling, struct mGLES2Uniform* uniforms, size_t nUniforms) {
shader->width = width;
shader->height = height;

View File

@ -92,6 +92,7 @@ struct mGLES2Context {
};
void mGLES2ContextCreate(struct mGLES2Context*);
void mGLES2ContextUseFramebuffer(struct mGLES2Context*);
void mGLES2ShaderInit(struct mGLES2Shader*, const char* vs, const char* fs, int width, int height, bool integerScaling, struct mGLES2Uniform* uniforms, size_t nUniforms);
void mGLES2ShaderDeinit(struct mGLES2Shader*);

View File

@ -23,8 +23,15 @@ ApplicationUpdatePrompt::ApplicationUpdatePrompt(QWidget* parent)
ApplicationUpdater* updater = GBAApp::app()->updater();
ApplicationUpdater::UpdateInfo info = updater->updateInfo();
m_ui.text->setText(tr("An update to %1 is available.\nDo you want to download and install it now? You will need to restart the emulator when the download is complete.")
.arg(QLatin1String(projectName)));
QString updateText(tr("An update to %1 is available.\n").arg(QLatin1String(projectName)));
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
updateText += tr("\nDo you want to download and install it now? You will need to restart the emulator when the download is complete.");
m_okDownload = connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &ApplicationUpdatePrompt::startUpdate);
#else
updateText += tr("\nAuto-update is not available on this platform. If you wish to update you will need to do it manually.");
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &QWidget::close);
#endif
m_ui.text->setText(updateText);
m_ui.details->setText(tr("Current version: %1\nNew version: %2\nDownload size: %3")
.arg(QLatin1String(projectVersion))
.arg(info)
@ -34,7 +41,6 @@ ApplicationUpdatePrompt::ApplicationUpdatePrompt(QWidget* parent)
connect(updater, &AbstractUpdater::updateProgress, this, [this](float progress) {
m_ui.progressBar->setValue(progress * 100);
});
m_okDownload = connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &ApplicationUpdatePrompt::startUpdate);
connect(updater, &AbstractUpdater::updateDone, this, &ApplicationUpdatePrompt::promptRestart);
}

View File

@ -44,12 +44,10 @@ ApplicationUpdater::ApplicationUpdater(ConfigController* config, QObject* parent
config->setQtOption("lastUpdateCheck", m_lastCheck);
if (available && currentVersion() < updateInfo()) {
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
ApplicationUpdatePrompt* prompt = new ApplicationUpdatePrompt;
connect(prompt, &QDialog::accepted, GBAApp::app(), &GBAApp::restartForUpdate);
prompt->setAttribute(Qt::WA_DeleteOnClose);
prompt->show();
#endif
}
});

View File

@ -112,15 +112,19 @@ void AssetView::compositeTile(const void* tBuffer, void* buffer, size_t stride,
}
}
QImage AssetView::compositeMap(int map, mMapCacheEntry* mapStatus) {
QImage AssetView::compositeMap(int map, QVector<mMapCacheEntry>* mapStatus) {
mMapCache* mapCache = mMapCacheSetGetPointer(&m_cacheSet->maps, map);
int tilesW = 1 << mMapCacheSystemInfoGetTilesWide(mapCache->sysConfig);
int tilesH = 1 << mMapCacheSystemInfoGetTilesHigh(mapCache->sysConfig);
if (mapStatus->size() != tilesW * tilesH) {
mapStatus->resize(tilesW * tilesH);
mapStatus->fill({});
}
QImage rawMap = QImage(QSize(tilesW * 8, tilesH * 8), QImage::Format_ARGB32);
uchar* bgBits = rawMap.bits();
for (int j = 0; j < tilesH; ++j) {
for (int i = 0; i < tilesW; ++i) {
mMapCacheCleanTile(mapCache, mapStatus, i, j);
mMapCacheCleanTile(mapCache, mapStatus->data(), i, j);
}
for (int i = 0; i < 8; ++i) {
memcpy(static_cast<void*>(&bgBits[tilesW * 32 * (i + j * 8)]), mMapCacheGetRow(mapCache, i + j * 8), tilesW * 32);

View File

@ -54,7 +54,7 @@ protected:
};
static void compositeTile(const void* tile, void* image, size_t stride, size_t x, size_t y, int depth = 8);
QImage compositeMap(int map, mMapCacheEntry*);
QImage compositeMap(int map, QVector<mMapCacheEntry>*);
QImage compositeObj(const ObjInfo&);
bool lookupObj(int id, struct ObjInfo*);

View File

@ -540,9 +540,11 @@ void CoreController::overrideMute(bool override) {
if (m_mute) {
core->opts.mute = true;
} else {
int fakeBool = 0;
mCoreConfigGetIntValue(&core->config, "mute", &fakeBool);
core->opts.mute = fakeBool;
if (m_fastForward || m_fastForwardForced) {
core->opts.mute = m_fastForwardMute >= 0;
} else {
mCoreConfigGetBoolValue(&core->config, "mute", &core->opts.mute);
}
}
core->reloadConfigOption(core, NULL, NULL);
}
@ -838,6 +840,7 @@ void CoreController::importSharkport(const QString& path) {
}
Interrupter interrupter(this);
GBASavedataImportSharkPort(static_cast<GBA*>(m_threadContext.core->board), vf, false);
GBASavedataImportGSV(static_cast<GBA*>(m_threadContext.core->board), vf, false);
vf->close(vf);
#endif
}
@ -1090,9 +1093,7 @@ void CoreController::updateFastForward() {
if (!mCoreConfigGetIntValue(&m_threadContext.core->config, "volume", &m_threadContext.core->opts.volume)) {
m_threadContext.core->opts.volume = 0x100;
}
int fakeBool = 0;
mCoreConfigGetIntValue(&m_threadContext.core->config, "mute", &fakeBool);
m_threadContext.core->opts.mute = fakeBool;
mCoreConfigGetBoolValue(&m_threadContext.core->config, "mute", &m_threadContext.core->opts.mute);
m_threadContext.impl->sync.fpsTarget = m_fpsTarget;
setSync(true);
}

View File

@ -112,7 +112,7 @@ CoreController* CoreManager::loadGame(VFile* vf, const QString& path, const QStr
bytes = info.dir().canonicalPath().toUtf8();
mDirectorySetAttachBase(&core->dirs, VDirOpen(bytes.constData()));
if (!mCoreAutoloadSave(core)) {
LOG(QT, ERROR) << tr("Failed to open save file. Is the save directory writable?");
LOG(QT, ERROR) << tr("Failed to open save file; in-game saves cannot be updated. Please ensure the save directory is writable without additional privileges (e.g. UAC on Windows).");
}
mCoreAutoloadCheats(core);

View File

@ -11,6 +11,7 @@
#include <QMutexLocker>
#include <QOffscreenSurface>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QOpenGLPaintDevice>
#include <QResizeEvent>
#include <QScreen>
@ -128,7 +129,22 @@ bool DisplayGL::supportsFormat(const QSurfaceFormat& format) {
context.format().profile() == QSurfaceFormat::CompatibilityProfile ||
context.format().testOption(QSurfaceFormat::DeprecatedFunctions))) {
// Supports the old stuff
s_supports[format] = true;
QOffscreenSurface surface;
surface.create();
if (!context.makeCurrent(&surface)) {
s_supports[format] = false;
return false;
}
#ifdef Q_OS_WIN
QLatin1String renderer(reinterpret_cast<const char*>(context.functions()->glGetString(GL_RENDERER)));
if (renderer == "GDI Generic") {
// Windows' software OpenGL 1.1 implementation is not sufficient
s_supports[format] = false;
return false;
}
#endif
s_supports[format] = context.hasExtension("GL_EXT_blend_color"); // Core as of 1.2
context.doneCurrent();
} else if (!context.isOpenGLES() && format.version() >= qMakePair(2, 1) && foundVersion < qMakePair(3, 0) && foundVersion >= qMakePair(2, 1)) {
// Weird edge case we support if ARB_framebuffer_object is present
QOffscreenSurface surface;

View File

@ -245,7 +245,7 @@ void FrameView::updateTilesGBA(bool) {
m_queue.append({
{ LayerId::BACKGROUND, bg },
!m_disabled.contains({ LayerId::BACKGROUND, bg }),
QPixmap::fromImage(compositeMap(bg, m_mapStatus[bg])),
QPixmap::fromImage(compositeMap(bg, &m_mapStatus[bg])),
{}, offset, true, false
});
if (m_queue.back().image.hasAlpha()) {

View File

@ -108,7 +108,7 @@ private:
QSet<LayerId> m_disabled;
QPixmap m_composited;
QPixmap m_rendered;
mMapCacheEntry m_mapStatus[4][128 * 128] = {}; // TODO: Correct size
QVector<mMapCacheEntry> m_mapStatus[4];
ColorPicker m_backdropPicker;
QColor m_overrideBackdrop;

View File

@ -120,7 +120,7 @@ Window* GBAApp::newWindow() {
if (m_windows.count() >= MAX_GBAS) {
return nullptr;
}
Window* w = new Window(&m_manager, m_configController, m_multiplayer.attached());
Window* w = new Window(&m_manager, m_configController, m_windows.count());
connect(w, &Window::destroyed, [this, w]() {
m_windows.removeAll(w);
for (Window* w : m_windows) {

View File

@ -116,12 +116,18 @@ void MapView::selectMap(int map) {
return;
}
m_map = map;
m_mapStatus.fill({});
updateTiles(true);
}
void MapView::selectTile(int x, int y) {
CoreController::Interrupter interrupter(m_controller);
mMapCache* mapCache = mMapCacheSetGetPointer(&m_cacheSet->maps, m_map);
int tiles = mMapCacheTileCount(mapCache);
if (m_mapStatus.size() != tiles) {
m_mapStatus.resize(tiles);
m_mapStatus.fill({});
}
size_t tileCache = mTileCacheSetIndex(&m_cacheSet->tiles, mapCache->tileCache);
m_ui.tile->setBoundary(m_boundary, tileCache, tileCache);
uint32_t location = mMapCacheTileId(mapCache, x, y);
@ -221,7 +227,7 @@ void MapView::updateTilesGBA(bool) {
m_rawMap = QImage(QSize(width, height), QImage::Format_ARGB32);
uchar* bgBits = m_rawMap.bits();
for (int j = 0; j < height; ++j) {
mBitmapCacheCleanRow(bitmapCache, m_bitmapStatus, j);
mBitmapCacheCleanRow(bitmapCache, m_bitmapStatus.data(), j);
memcpy(static_cast<void*>(&bgBits[width * j * 4]), mBitmapCacheGetRow(bitmapCache, j), width * 4);
}
m_rawMap = m_rawMap.convertToFormat(QImage::Format_RGB32).rgbSwapped();
@ -239,7 +245,7 @@ void MapView::updateTilesGBA(bool) {
m_ui.bgInfo->setCustomProperty("priority", priority);
m_ui.bgInfo->setCustomProperty("offset", offset);
m_ui.bgInfo->setCustomProperty("transform", transform);
m_rawMap = compositeMap(m_map, m_mapStatus);
m_rawMap = compositeMap(m_map, &m_mapStatus);
}
}
QPixmap map = QPixmap::fromImage(m_rawMap.convertToFormat(QImage::Format_RGB32));

View File

@ -43,8 +43,8 @@ private:
Ui::MapView m_ui;
std::shared_ptr<CoreController> m_controller;
mMapCacheEntry m_mapStatus[128 * 128] = {}; // TODO: Correct size
mBitmapCacheEntry m_bitmapStatus[512 * 2] = {}; // TODO: Correct size
QVector<mMapCacheEntry> m_mapStatus;
QVector<mBitmapCacheEntry> m_bitmapStatus{512 * 2}; // TODO: Correct size
int m_map = 0;
QImage m_rawMap;
int m_boundary;

View File

@ -195,6 +195,10 @@ void ReportView::generateReport() {
addGLInfo(hwReport);
addReport(QString("Hardware info"), hwReport.join('\n'));
QStringList controlsReport;
addGamepadInfo(controlsReport);
addReport(QString("Controls"), controlsReport.join('\n'));
QList<QScreen*> screens = QGuiApplication::screens();
std::sort(screens.begin(), screens.end(), [](const QScreen* a, const QScreen* b) {
if (a->geometry().y() < b->geometry().y()) {
@ -288,6 +292,10 @@ void ReportView::generateReport() {
} else {
windowReport << QString("ROM open: No");
}
#ifdef BUILD_SDL
InputController* input = window->inputController();
windowReport << QString("Active gamepad: %1").arg(input->gamepad(SDL_BINDING_BUTTON));
#endif
windowReport << QString("Configuration: %1").arg(configs.indexOf(config) + 1);
addReport(QString("Window %1").arg(winId), windowReport.join('\n'));
}
@ -446,6 +454,26 @@ void ReportView::addGLInfo(QStringList& report) {
#endif
}
void ReportView::addGamepadInfo(QStringList& report) {
#ifdef BUILD_SDL
InputController* input = GBAApp::app()->windows()[0]->inputController();
QStringList gamepads = input->connectedGamepads(SDL_BINDING_BUTTON);
report << QString("Connected gamepads: %1").arg(gamepads.size());
int i = 0;
for (const auto& gamepad : gamepads) {
report << QString("Gamepad %1: %2").arg(i).arg(gamepad);
++i;
}
if (gamepads.size()) {
i = 0;
for (Window* window : GBAApp::app()->windows()) {
++i;
report << QString("Window %1 gamepad: %2").arg(i).arg(window->inputController()->gamepad(SDL_BINDING_BUTTON));
}
}
#endif
}
void ReportView::addROMInfo(QStringList& report, CoreController* controller) {
report << QString("Currently paused: %1").arg(yesNo[controller->isPaused()]);

View File

@ -41,6 +41,7 @@ protected:
private:
void addCpuInfo(QStringList&);
void addGLInfo(QStringList&);
void addGamepadInfo(QStringList&);
void addROMInfo(QStringList&, CoreController*);
void addScreenInfo(QStringList&, const QScreen*);

View File

@ -15,6 +15,7 @@
#ifdef M_CORE_GBA
#include <mgba/gba/core.h>
#include <mgba/internal/gba/serialize.h>
#include <mgba/internal/gba/sharkport.h>
#endif
#ifdef M_CORE_GB
#include <mgba/gb/core.h>
@ -34,8 +35,7 @@ SaveConverter::SaveConverter(std::shared_ptr<CoreController> controller, QWidget
connect(m_ui.inputFile, &QLineEdit::textEdited, this, &SaveConverter::refreshInputTypes);
connect(m_ui.inputBrowse, &QAbstractButton::clicked, this, [this]() {
// TODO: Add gameshark saves here too
QStringList formats{"*.sav", "*.sgm", "*.ss0", "*.ss1", "*.ss2", "*.ss3", "*.ss4", "*.ss5", "*.ss6", "*.ss7", "*.ss8", "*.ss9"};
QStringList formats{"*.gsv", "*.sav", "*.sgm", "*.sps", "*.ss0", "*.ss1", "*.ss2", "*.ss3", "*.ss4", "*.ss5", "*.ss6", "*.ss7", "*.ss8", "*.ss9", "*.xps"};
QString filter = tr("Save games and save states (%1)").arg(formats.join(QChar(' ')));
QString filename = GBAApp::app()->getOpenFileName(this, tr("Select save game or save state"), filter);
if (!filename.isEmpty()) {
@ -101,6 +101,7 @@ void SaveConverter::refreshInputTypes() {
detectFromSavestate(*vf);
detectFromSize(vf);
detectFromHeaders(vf);
for (const auto& save : m_validSaves) {
m_ui.inputType->addItem(save);
@ -166,7 +167,7 @@ void SaveConverter::detectFromSavestate(VFile* vf) {
}
QByteArray state = getState(vf, platform);
AnnotatedSave save{platform, std::make_shared<VFileDevice>(extSavedata)};
AnnotatedSave save{platform, std::make_shared<VFileDevice>(extSavedata), Endian::NONE, Container::SAVESTATE};
switch (platform) {
#ifdef M_CORE_GBA
case mPLATFORM_GBA:
@ -253,6 +254,58 @@ void SaveConverter::detectFromSize(std::shared_ptr<VFileDevice> vf) {
#endif
}
void SaveConverter::detectFromHeaders(std::shared_ptr<VFileDevice> vf) {
const QByteArray sharkport("\xd\0\0\0SharkPortSave", 0x11);
const QByteArray gsv("ADVSAVEG", 8);
QByteArray buffer;
vf->seek(0);
buffer = vf->read(sharkport.size());
if (buffer == sharkport) {
size_t size;
void* data = GBASavedataSharkPortGetPayload(*vf, &size, nullptr, false);
if (data) {
QByteArray bytes = QByteArray::fromRawData(static_cast<const char*>(data), size);
bytes.data(); // Trigger a deep copy before we delete the backing
if (size == SIZE_CART_FLASH1M) {
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH1M, std::make_shared<VFileDevice>(bytes), Endian::NONE, Container::SHARKPORT});
} else {
m_validSaves.append(AnnotatedSave{SAVEDATA_SRAM, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_SRAM)), Endian::NONE, Container::SHARKPORT});
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH512, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_FLASH512)), Endian::NONE, Container::SHARKPORT});
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_EEPROM)), Endian::BIG, Container::SHARKPORT});
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM512, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_EEPROM512)), Endian::BIG, Container::SHARKPORT});
}
free(data);
}
} else if (buffer.left(gsv.count()) == gsv) {
size_t size;
void* data = GBASavedataGSVGetPayload(*vf, &size, nullptr, false);
if (data) {
QByteArray bytes = QByteArray::fromRawData(static_cast<const char*>(data), size);
bytes.data(); // Trigger a deep copy before we delete the backing
switch (size) {
case SIZE_CART_FLASH1M:
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH1M, std::make_shared<VFileDevice>(bytes), Endian::NONE, Container::GSV});
break;
case SIZE_CART_FLASH512:
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH512, std::make_shared<VFileDevice>(bytes), Endian::NONE, Container::GSV});
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH1M, std::make_shared<VFileDevice>(bytes), Endian::NONE, Container::GSV});
break;
case SIZE_CART_SRAM:
m_validSaves.append(AnnotatedSave{SAVEDATA_SRAM, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_SRAM)), Endian::NONE, Container::GSV});
break;
case SIZE_CART_EEPROM:
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_EEPROM)), Endian::BIG, Container::GSV});
break;
case SIZE_CART_EEPROM512:
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM512, std::make_shared<VFileDevice>(bytes.left(SIZE_CART_EEPROM512)), Endian::BIG, Container::GSV});
break;
}
free(data);
}
}
}
mPlatform SaveConverter::getStatePlatform(VFile* vf) {
uint32_t magic;
void* state = nullptr;
@ -326,7 +379,7 @@ QByteArray SaveConverter::getExtdata(VFile* vf, mPlatform platform, mStateExtdat
}
SaveConverter::AnnotatedSave::AnnotatedSave()
: savestate(false)
: container(Container::NONE)
, platform(mPLATFORM_NONE)
, size(0)
, backing()
@ -334,8 +387,8 @@ SaveConverter::AnnotatedSave::AnnotatedSave()
{
}
SaveConverter::AnnotatedSave::AnnotatedSave(mPlatform platform, std::shared_ptr<VFileDevice> vf, Endian endianness)
: savestate(true)
SaveConverter::AnnotatedSave::AnnotatedSave(mPlatform platform, std::shared_ptr<VFileDevice> vf, Endian endianness, Container container)
: container(container)
, platform(platform)
, size(vf->size())
, backing(vf)
@ -344,8 +397,8 @@ SaveConverter::AnnotatedSave::AnnotatedSave(mPlatform platform, std::shared_ptr<
}
#ifdef M_CORE_GBA
SaveConverter::AnnotatedSave::AnnotatedSave(SavedataType type, std::shared_ptr<VFileDevice> vf, Endian endianness)
: savestate(false)
SaveConverter::AnnotatedSave::AnnotatedSave(SavedataType type, std::shared_ptr<VFileDevice> vf, Endian endianness, Container container)
: container(container)
, platform(mPLATFORM_GBA)
, size(vf->size())
, backing(vf)
@ -356,8 +409,8 @@ SaveConverter::AnnotatedSave::AnnotatedSave(SavedataType type, std::shared_ptr<V
#endif
#ifdef M_CORE_GB
SaveConverter::AnnotatedSave::AnnotatedSave(GBMemoryBankControllerType type, std::shared_ptr<VFileDevice> vf, Endian endianness)
: savestate(false)
SaveConverter::AnnotatedSave::AnnotatedSave(GBMemoryBankControllerType type, std::shared_ptr<VFileDevice> vf, Endian endianness, Container container)
: container(container)
, platform(mPLATFORM_GB)
, size(vf->size())
, backing(vf)
@ -468,14 +521,24 @@ SaveConverter::AnnotatedSave::operator QString() const {
if (!endianStr.isEmpty()) {
saveType = QCoreApplication::translate("SaveConverter", "%1 (%2)").arg(saveType).arg(endianStr);
}
if (savestate) {
switch (container) {
case Container::SAVESTATE:
format = QCoreApplication::translate("SaveConverter", "%1 save state with embedded %2 save game");
break;
case Container::SHARKPORT:
format = QCoreApplication::translate("SaveConverter", "%1 SharkPort %2 save game");
break;
case Container::GSV:
format = QCoreApplication::translate("SaveConverter", "%1 GameShark Advance SP %2 save game");
break;
case Container::NONE:
break;
}
return format.arg(nicePlatformFormat(platform)).arg(saveType);
}
bool SaveConverter::AnnotatedSave::operator==(const AnnotatedSave& other) const {
if (other.savestate != savestate || other.platform != platform || other.size != size || other.endianness != endianness) {
if (other.container != container || other.platform != platform || other.size != size || other.endianness != endianness) {
return false;
}
switch (platform) {
@ -503,13 +566,12 @@ QList<SaveConverter::AnnotatedSave> SaveConverter::AnnotatedSave::possibleConver
QList<AnnotatedSave> possible;
AnnotatedSave same = asRaw();
same.backing.reset();
same.savestate = false;
same.container = Container::NONE;
if (savestate) {
if (container != Container::NONE) {
possible.append(same);
}
AnnotatedSave endianSwapped = same;
switch (endianness) {
case Endian::LITTLE:
@ -583,6 +645,9 @@ QByteArray SaveConverter::AnnotatedSave::convertTo(const SaveConverter::Annotate
switch (gba.type) {
case SAVEDATA_EEPROM:
case SAVEDATA_EEPROM512:
if (endianness == target.endianness) {
break;
}
converted.resize(target.size);
buffer = backing->readAll();
for (int i = 0; i < size; i += 8) {

View File

@ -56,14 +56,20 @@ private:
GBMemoryBankControllerType type;
};
#endif
enum class Container {
NONE = 0,
SAVESTATE,
SHARKPORT,
GSV
};
struct AnnotatedSave {
AnnotatedSave();
AnnotatedSave(mPlatform, std::shared_ptr<VFileDevice>, Endian = Endian::NONE);
AnnotatedSave(mPlatform, std::shared_ptr<VFileDevice>, Endian = Endian::NONE, Container = Container::NONE);
#ifdef M_CORE_GBA
AnnotatedSave(SavedataType, std::shared_ptr<VFileDevice>, Endian = Endian::NONE);
AnnotatedSave(SavedataType, std::shared_ptr<VFileDevice>, Endian = Endian::NONE, Container = Container::NONE);
#endif
#ifdef M_CORE_GB
AnnotatedSave(GBMemoryBankControllerType, std::shared_ptr<VFileDevice>, Endian = Endian::NONE);
AnnotatedSave(GBMemoryBankControllerType, std::shared_ptr<VFileDevice>, Endian = Endian::NONE, Container = Container::NONE);
#endif
AnnotatedSave asRaw() const;
@ -73,7 +79,7 @@ private:
QList<AnnotatedSave> possibleConversions() const;
QByteArray convertTo(const AnnotatedSave&) const;
bool savestate;
Container container;
mPlatform platform;
ssize_t size;
std::shared_ptr<VFileDevice> backing;

View File

@ -112,6 +112,7 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi
, m_config(config)
, m_inputController(playerId, this)
, m_shortcutController(new ShortcutController(this))
, m_playerId(playerId)
{
setFocusPolicy(Qt::StrongFocus);
setAcceptDrops(true);
@ -250,6 +251,16 @@ void Window::resizeFrame(const QSize& size) {
}
}
void Window::updateMultiplayerStatus(bool canOpenAnother) {
m_multiWindow->setEnabled(canOpenAnother);
if (m_controller) {
MultiplayerController* multiplayer = m_controller->multiplayerController();
if (multiplayer) {
m_playerId = multiplayer->playerId(m_controller.get());
}
}
}
void Window::updateMultiplayerActive(bool active) {
m_multiActive = active;
updateMute();
@ -541,7 +552,7 @@ void Window::loadCamImage() {
}
void Window::importSharkport() {
QString filename = GBAApp::app()->getOpenFileName(this, tr("Select save"), tr("GameShark saves (*.sps *.xps)"));
QString filename = GBAApp::app()->getOpenFileName(this, tr("Select save"), tr("GameShark saves (*.gsv *.sps *.xps)"));
if (!filename.isEmpty()) {
m_controller->importSharkport(filename);
}
@ -695,7 +706,7 @@ void Window::showEvent(QShowEvent* event) {
}
m_wasOpened = true;
resizeFrame(m_screenWidget->sizeHint());
QVariant windowPos = m_config->getQtOption("windowPos");
QVariant windowPos = m_config->getQtOption("windowPos", m_playerId > 0 ? QString("player%0").arg(m_playerId) : QString());
bool maximized = m_config->getQtOption("maximized").toBool();
QRect geom = windowHandle()->screen()->availableGeometry();
if (!windowPos.isNull() && geom.contains(windowPos.toPoint())) {
@ -736,7 +747,7 @@ void Window::hideEvent(QHideEvent* event) {
void Window::closeEvent(QCloseEvent* event) {
emit shutdown();
m_config->setQtOption("windowPos", pos());
m_config->setQtOption("windowPos", pos(), m_playerId > 0 ? QString("player%0").arg(m_playerId) : QString());
m_config->setQtOption("maximized", isMaximized());
if (m_savedScale > 0) {
@ -1164,7 +1175,7 @@ void Window::updateTitle(float fps) {
MultiplayerController* multiplayer = m_controller->multiplayerController();
if (multiplayer && multiplayer->attached() > 1) {
title += tr(" - Player %1 of %2").arg(multiplayer->playerId(m_controller.get()) + 1).arg(multiplayer->attached());
title += tr(" - Player %1 of %2").arg(m_playerId + 1).arg(multiplayer->attached());
for (Action* action : m_nonMpActions) {
action->setEnabled(false);
}
@ -2064,7 +2075,7 @@ void Window::updateMute() {
QString multiplayerAudio = m_config->getQtOption("multiplayerAudio").toString();
if (multiplayerAudio == QLatin1String("p1")) {
MultiplayerController* multiplayer = m_controller->multiplayerController();
mute = multiplayer && multiplayer->attached() > 1 && multiplayer->playerId(m_controller.get());
mute = multiplayer && multiplayer->attached() > 1 && m_playerId;
} else if (multiplayerAudio == QLatin1String("active")) {
mute = !m_multiActive;
}

View File

@ -63,9 +63,11 @@ public:
void resizeFrame(const QSize& size);
void updateMultiplayerStatus(bool canOpenAnother) { m_multiWindow->setEnabled(canOpenAnother); }
void updateMultiplayerStatus(bool canOpenAnother);
void updateMultiplayerActive(bool active);
InputController* inputController() { return &m_inputController; }
signals:
void startDrawing();
void shutdown();
@ -228,6 +230,7 @@ private:
bool m_inactiveMute = false;
bool m_multiActive = true;
int m_playerId;
std::unique_ptr<OverrideView> m_overrideView;
std::unique_ptr<SensorView> m_sensorView;

View File

@ -41,6 +41,7 @@ Q_IMPORT_PLUGIN(AVFServicePlugin);
#ifdef Q_OS_WIN
#include <process.h>
#include <wincon.h>
#else
#include <unistd.h>
#endif
@ -48,6 +49,9 @@ Q_IMPORT_PLUGIN(AVFServicePlugin);
using namespace QGBA;
int main(int argc, char* argv[]) {
#ifdef Q_OS_WIN
AttachConsole(ATTACH_PARENT_PROCESS);
#endif
#ifdef BUILD_SDL
#if SDL_VERSION_ATLEAST(2, 0, 0) // CPP does not shortcut function lookup
SDL_SetMainReady();
@ -154,6 +158,7 @@ int wmain(int argc, wchar_t* argv[]) {
for (int i = 0; i < argc; ++i) {
argv8.push_back(utf16to8(reinterpret_cast<uint16_t*>(argv[i]), wcslen(argv[i]) * 2));
}
__argv = argv8.data();
int ret = main(argc, argv8.data());
for (char* ptr : argv8) {
free(ptr);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More