From b137e459e0cb6d467721874c0aa8ffd7e7aef288 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 19 Oct 2019 23:37:31 -0700 Subject: [PATCH 01/30] Core: Fix uninitialized variable --- src/core/cheats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/cheats.c b/src/core/cheats.c index fa45db291..acd994393 100644 --- a/src/core/cheats.c +++ b/src/core/cheats.c @@ -334,7 +334,7 @@ bool mCheatParseEZFChtFile(struct mCheatDevice* device, struct VFile* vf) { char cheat[MAX_LINE_LENGTH]; char cheatName[MAX_LINE_LENGTH]; char miniline[32]; - size_t cheatNameLength; + size_t cheatNameLength = 0; struct mCheatSet* set = NULL; cheatName[MAX_LINE_LENGTH - 1] = '\0'; From d96b93037484085cd0804b3e2ec9264bdd5adf72 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 20 Oct 2019 00:09:12 -0700 Subject: [PATCH 02/30] Qt: Try GLES 3.0 if using GLES --- src/platform/qt/Display.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/qt/Display.cpp b/src/platform/qt/Display.cpp index 36b463545..3f916ec7b 100644 --- a/src/platform/qt/Display.cpp +++ b/src/platform/qt/Display.cpp @@ -26,7 +26,11 @@ Display* Display::create(QWidget* parent) { switch (s_driver) { #if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY) case Driver::OPENGL: - format.setVersion(3, 2); + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) { + format.setVersion(3, 0); + } else { + format.setVersion(3, 2); + } format.setProfile(QSurfaceFormat::CoreProfile); return new DisplayGL(format, parent); #endif From f0956ce249be1c553c5f8146d6224bf5e758f091 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 20 Oct 2019 14:46:52 -0700 Subject: [PATCH 03/30] CMake: Fix installation on disco/eoan --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2627c4ff2..8d3ccf8c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -618,7 +618,7 @@ if(USE_LIBZIP) if (LIBZIP_VERSION_MAJOR LESS 1) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip2") elseif(LIBZIP_VERSION_MAJOR EQUAL 1) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip4") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libzip4|libzip5") else() message(AUTHOR_WARNING Unknown version of libzip detected: ${libzip_VERSION}) endif() From 13893803c3f528327a7aa96056e7c51564c5f86c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 20 Oct 2019 14:43:45 -0700 Subject: [PATCH 04/30] CHANGES: Update for 0.8 beta 1 --- CHANGES | 83 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/CHANGES b/CHANGES index 430717069..0d2f74d3a 100644 --- a/CHANGES +++ b/CHANGES @@ -23,68 +23,71 @@ Features: - GB: Yanking gamepak now supported - Qt: Memory range dumping (closes mgba.io/i/1298) Emulation fixes: + - GB: Fix using boot ROM with MMM01 games + - GB Audio: Only reset channel 3 sample in DMG mode + - GB Audio: Sample inactive channels (fixes mgba.io/i/1455, mgba.io/i/1456) + - GB Audio: Fix channel 4 volume (fixes mgba.io/i/1529) + - GB I/O: Filter IE top bits properly (fixes mgba.io/i/1329) + - GB Memory: Better emulate 0xFEA0 region on DMG, MGB and AGB + - GB Video: Delay LYC STAT check (fixes mgba.io/i/1331) + - GB Video: Fix window being enabled mid-scanline (fixes mgba.io/i/1328) + - GB Video: Fix mode 0 window edge case (fixes mgba.io/i/1519) + - GB Video: Fix color scaling in AGB mode - GBA: All IRQs have 7 cycle delay (fixes mgba.io/i/539, mgba.io/i/1208) - GBA: Reset now reloads multiboot ROMs - GBA BIOS: Fix multiboot entry point (fixes Magic Floor) - - GB Video: Delay LYC STAT check (fixes mgba.io/i/1331) - - GB Video: Fix window being enabled mid-scanline (fixes mgba.io/i/1328) - - GB I/O: Filter IE top bits properly (fixes mgba.io/i/1329) - - GB Audio: Only reset channel 3 sample in DMG mode - - GB Audio: Sample inactive channels (fixes mgba.io/i/1455, mgba.io/i/1456) - - GB Memory: Better emulate 0xFEA0 region on DMG, MGB and AGB - - GB Video: Fix mode 0 window edge case (fixes mgba.io/i/1519) - - GB Audio: Fix channel 4 volume (fixes mgba.io/i/1529) - - GB Video: Fix color scaling in AGB mode - - GB: Fix using boot ROM with MMM01 games Other fixes: - - Qt: Fix some Qt display driver race conditions - Core: Improved lockstep driver reliability (Le Hoang Quyen) - - Qt: Fix menu bar staying hidden in full screen (fixes mgba.io/i/317) - - GB SIO: Fix lockstep failing games aren't reloaded - - Libretro: Fix crash changing allowing opposing directions (hhromic) - - GBA Cheats: Fix value incrementing in CB slide codes (fixes mgba.io/i/1501) - - Qt: Only show emulator restart warning once per settings saving - FFmpeg: Drain recording buffers - - Shaders: Fix gba-color shader resolution (fixes mgba.io/i/1435) - - Qt: Fix LibraryController initialization (fixes mgba.io/i/1324) - - Switch: Fix audio when video rate desyncs (fixes mgba.io/i/1532) - GB: Fix reading ROM immediately after unmapping BIOS + - GB SIO: Fix lockstep failing games aren't reloaded + - GBA Cheats: Fix value incrementing in CB slide codes (fixes mgba.io/i/1501) + - Libretro: Fix crash changing allowing opposing directions (hhromic) + - Qt: Fix some Qt display driver race conditions + - Qt: Fix menu bar staying hidden in full screen (fixes mgba.io/i/317) + - Qt: Only show emulator restart warning once per settings saving + - Qt: Fix LibraryController initialization (fixes mgba.io/i/1324) + - Shaders: Fix gba-color shader resolution (fixes mgba.io/i/1435) + - Switch: Fix audio when video rate desyncs (fixes mgba.io/i/1532) Misc: - - GBA Savedata: EEPROM performance fixes - - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash - - GB Memory: Support running from blocked memory - - Qt: Don't unload ROM immediately if it crashes - - Debugger: Add breakpoint and watchpoint listing - - LR35902: Support PC-relative opcode decoding - - Qt: Support switching webcams + - CMake: Don't use libzip on embedded platforms (fixes mgba.io/i/1527) - Core: Add keysRead callback - - Qt: Cap window size on start to monitor size - - GBA BIOS: Add timings for HLE BIOS math functions (fixes mgba.io/i/1396) + - Core: Create game-related paths if they don't exist (fixes mgba.io/i/1446) + - Core: Add more memory search ops (closes mgba.io/i/1510) - Debugger: Make tracing compatible with breakpoints/watchpoints - Debugger: Print breakpoint/watchpoint number when inserting - - Qt: Open a message box for Qt frontend errors + - Feature: Switch from ImageMagick to FFmpeg for GIF generation - FFmpeg: Support audio-only recording + - GB Memory: Support running from blocked memory + - GBA BIOS: Add timings for HLE BIOS math functions (fixes mgba.io/i/1396) + - GBA BIOS: Fix clobbered registers in CpuSet (fixes mgba.io/i/1531) + - GBA Savedata: EEPROM performance fixes + - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash + - Debugger: Add breakpoint and watchpoint listing + - LR35902: Support PC-relative opcode decoding + - mGUI: Remember name and position of last loaded game + - OpenGL: Only resize textures when needed + - Qt: Don't unload ROM immediately if it crashes + - Qt: Support switching webcams + - Qt: Cap window size on start to monitor size + - Qt: Open a message box for Qt frontend errors - Qt: Increase maximum magnifications and scaling - Qt: Add native FPS button to settings view - Qt: Improve sync code - - Switch: Dynamic display resizing - - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) - - mGUI: Remember name and position of last loaded game - - Core: Create game-related paths if they don't exist (fixes mgba.io/i/1446) - Qt: Add option to pause on minimizing window (closes mgba.io/i/1379) - - Switch: Support file associations - Qt: Scale pixel color values to full range (fixes mgba.io/i/1511) - - Qt, OpenGL: Disable integer scaling for dimensions that don't fit - - Feature: Switch from ImageMagick to FFmpeg for GIF generation - - OpenGL: Only resize textures when needed - - GBA BIOS: Fix clobbered registers in CpuSet (fixes mgba.io/i/1531) - Qt: Remove What's This icon from dialogs - - CMake: Don't use libzip on embedded platforms (fixes mgba.io/i/1527) - Qt: Printer quality of life improvements (fixes mgba.io/i/1540) - Qt: Add copy and QoL improvements to graphic views (closes mgba.io/i/1541) - Qt: Show list of all sprites in sprite view - Qt: Add option for disabling OSD messages - - Core: Add more memory search ops (closes mgba.io/i/1510) + - Qt, OpenGL: Disable integer scaling for dimensions that don't fit + - Switch: Dynamic display resizing + - Switch: Support file associations + - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) + +0.8 beta 1: (2019-10-20) +- Initial beta for 0.8 0.7.3: (2019-09-15) Emulation fixes: From 3241df238b4ac2f163c51c85951f93e4082b02dc Mon Sep 17 00:00:00 2001 From: Lothar Serra Mari Date: Mon, 21 Oct 2019 16:28:44 +0200 Subject: [PATCH 05/30] Win32: Fix x64 installation paths The current way to check if we are running a 64 bit version of Windows in order to detect the proper path ("Program Files" or "Program Files (x86)") doesn't work, thus even the 64 bit version is installed in the 32 bit Program Files folder. The check itself is not necessary, since Inno Setup is smart enough to check the platform it's running on and chooses the proper path and registry settings by itself. --- src/platform/windows/setup/setup.iss.in | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/platform/windows/setup/setup.iss.in b/src/platform/windows/setup/setup.iss.in index c3771eadb..111b5bc09 100644 --- a/src/platform/windows/setup/setup.iss.in +++ b/src/platform/windows/setup/setup.iss.in @@ -48,15 +48,11 @@ LicenseFile={#BinDir}\LICENSE.txt #define IsRelease = 'no' AppVerName={#AppName} {#VersionString} (Development build) #endif -#if '{#WinBits}' == '64' - ArchitecturesInstallIn64BitMode=x64 - ArchitecturesAllows=x64 -#endif OutputBaseFilename={#AppName}-setup-{#CleanVersionString}-win{#WinBits} UsePreviousLanguage=False DisableWelcomePage=False VersionInfoDescription={#AppName} is an open-source Game Boy Advance emulator -VersionInfoCopyright= 20132018 Jeffrey Pfau +VersionInfoCopyright= 20132019 Jeffrey Pfau VersionInfoProductName={#AppName} VersionInfoVersion={#AppVer} Compression=lzma2/ultra64 @@ -64,6 +60,8 @@ SolidCompression=True VersionInfoTextVersion={#AppVer} VersionInfoProductVersion={#AppVer} VersionInfoProductTextVersion={#AppVer} +ArchitecturesInstallIn64BitMode=x64 +ArchitecturesAllowed=x86 x64 [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" From 3d5ec91a2a5a96a4b393a34a92448fc698d9e526 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 23 Oct 2019 19:14:07 -0700 Subject: [PATCH 06/30] Vita: Fix analog controls (fixes #1554) --- CHANGES | 3 +++ src/platform/psp2/main.c | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 0d2f74d3a..a5de79b90 100644 --- a/CHANGES +++ b/CHANGES @@ -85,6 +85,9 @@ Misc: - Switch: Dynamic display resizing - Switch: Support file associations - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) +Changes from beta 1: +Other fixes: + - Vita: Fix analog controls (fixes mgba.io/i/1554) 0.8 beta 1: (2019-10-20) - Initial beta for 0.8 diff --git a/src/platform/psp2/main.c b/src/platform/psp2/main.c index 594d9942f..8451515ea 100644 --- a/src/platform/psp2/main.c +++ b/src/platform/psp2/main.c @@ -165,6 +165,7 @@ int main() { sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG_WIDE); + sceCtrlSetSamplingModeExt(SCE_CTRL_MODE_ANALOG_WIDE); sceSysmoduleLoadModule(SCE_SYSMODULE_PHOTO_EXPORT); sceSysmoduleLoadModule(SCE_SYSMODULE_APPUTIL); From 7ef0c5074c7064e0a3509d8d9ecd03061f1abf07 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 29 Oct 2019 19:32:52 -0700 Subject: [PATCH 07/30] 3DS: Fix screen darkening (fixes #1562) --- CHANGES | 1 + src/platform/3ds/main.c | 79 ++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/CHANGES b/CHANGES index a5de79b90..d0965c4fc 100644 --- a/CHANGES +++ b/CHANGES @@ -87,6 +87,7 @@ Misc: - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) Changes from beta 1: Other fixes: + - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554) 0.8 beta 1: (2019-10-20) diff --git a/src/platform/3ds/main.c b/src/platform/3ds/main.c index f5af6d50b..a89dfcc8b 100644 --- a/src/platform/3ds/main.c +++ b/src/platform/3ds/main.c @@ -417,6 +417,46 @@ static void _gameUnloaded(struct mGUIRunner* runner) { } } +static u32 _setupTex(int out, bool faded) { + ctrActivateTexture(&outputTexture[out]); + u32 color; + if (!faded) { + color = 0xFFFFFFFF; + switch (darkenMode) { + case DM_NATIVE: + case DM_MAX: + break; + case DM_MULT_SCALE_BIAS: + ctrTextureBias(0x070707); + // Fall through + case DM_MULT_SCALE: + color = 0xFF707070; + // Fall through + case DM_MULT: + ctrTextureMultiply(); + break; + } + } else { + color = 0xFF484848; + switch (darkenMode) { + case DM_NATIVE: + case DM_MAX: + break; + case DM_MULT_SCALE_BIAS: + ctrTextureBias(0x030303); + // Fall through + case DM_MULT_SCALE: + color = 0xFF303030; + // Fall through + case DM_MULT: + ctrTextureMultiply(); + break; + } + + } + return color; +} + static void _drawTex(struct mCore* core, bool faded, bool both) { unsigned screen_w, screen_h; switch (screenMode) { @@ -485,45 +525,10 @@ static void _drawTex(struct mCore* core, bool faded, bool both) { break; } - u32 color; - if (!faded) { - color = 0xFFFFFFFF; - switch (darkenMode) { - case DM_NATIVE: - case DM_MAX: - break; - case DM_MULT_SCALE_BIAS: - ctrTextureBias(0x070707); - // Fall through - case DM_MULT_SCALE: - color = 0xFF707070; - // Fall through - case DM_MULT: - ctrTextureMultiply(); - break; - } - } else { - color = 0xFF484848; - switch (darkenMode) { - case DM_NATIVE: - case DM_MAX: - break; - case DM_MULT_SCALE_BIAS: - ctrTextureBias(0x030303); - // Fall through - case DM_MULT_SCALE: - color = 0xFF303030; - // Fall through - case DM_MULT: - ctrTextureMultiply(); - break; - } - - } - ctrActivateTexture(&outputTexture[activeOutputTexture]); + uint32_t color = _setupTex(activeOutputTexture, faded); ctrAddRectEx(color, x, y, w, h, 0, 0, corew, coreh, 0); if (both) { - ctrActivateTexture(&outputTexture[activeOutputTexture ^ 1]); + color = _setupTex(activeOutputTexture ^ 1, faded); ctrAddRectEx(color & 0x7FFFFFFF, x, y, w, h, 0, 0, corew, coreh, 0); } ctrFlushBatch(); From f35136f8814b74518a3a0ba2d39f3b70876f3f3d Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 29 Oct 2019 20:13:58 -0700 Subject: [PATCH 08/30] GBA DMA: Fix case where DMAs could get misaligned (fixes #1092) --- CHANGES | 2 ++ src/gba/dma.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index d0965c4fc..2dab08aa4 100644 --- a/CHANGES +++ b/CHANGES @@ -86,6 +86,8 @@ Misc: - Switch: Support file associations - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) Changes from beta 1: +Emulation fixes: + - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554) diff --git a/src/gba/dma.c b/src/gba/dma.c index 765358da1..2c112716f 100644 --- a/src/gba/dma.c +++ b/src/gba/dma.c @@ -95,6 +95,8 @@ uint16_t GBADMAWriteCNT_HI(struct GBA* gba, int dma, uint16_t control) { if (currentDma->nextDest & (width - 1)) { mLOG(GBA_MEM, GAME_ERROR, "Misaligned DMA destination address: 0x%08X", currentDma->nextDest); } + currentDma->nextSource &= -width; + currentDma->nextDest &= -width; GBADMASchedule(gba, dma, currentDma); } @@ -242,8 +244,6 @@ void GBADMAService(struct GBA* gba, int number, struct GBADMA* info) { } else { cycles += memory->waitstatesNonseq16[sourceRegion] + memory->waitstatesNonseq16[destRegion]; } - source &= -width; - dest &= -width; } else { if (width == 4) { cycles += memory->waitstatesSeq32[sourceRegion] + memory->waitstatesSeq32[destRegion]; From 14bf90995069b3a97e3eb67610b032416d0eb6a4 Mon Sep 17 00:00:00 2001 From: EmpyreusX <36258024+EmpyreusX@users.noreply.github.com> Date: Thu, 31 Oct 2019 03:21:01 +0800 Subject: [PATCH 09/30] Updated Simplified Chinese translation (#1563) * Updated Simplified Chinese translation * Update mgba-zh_CN.ts --- src/platform/qt/ts/mgba-zh_CN.ts | 915 +++++++++++++++++-------------- 1 file changed, 500 insertions(+), 415 deletions(-) diff --git a/src/platform/qt/ts/mgba-zh_CN.ts b/src/platform/qt/ts/mgba-zh_CN.ts index 6840ea2b2..32cf34542 100644 --- a/src/platform/qt/ts/mgba-zh_CN.ts +++ b/src/platform/qt/ts/mgba-zh_CN.ts @@ -589,20 +589,26 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 贴图 - - Export - 导出 - - + × × - + Magnification 缩放率 + + + Export + 导出 + + + + Copy + 复制 + MemoryDump @@ -641,124 +647,149 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 MemorySearch - + Memory Search 内存查找 - + Address 地址 - + Current Value 当前值 - - + + Type 类型 - + Value - + Numeric 数字 - + Text 文本 - + Width 位宽 - - + + Guess - 猜测 + 估计 - + 1 Byte (8-bit) 1 字节 (8 位) - + 2 Bytes (16-bit) 2 字节 (16 位) - + 4 Bytes (32-bit) 4 字节 (32 位) - + Number type 数字进制 - + Decimal 十进制 - + Hexadecimal 十六进制 - + Compare 比较 - - Equal - 等于 + + Equal to value + 约等于下值 - - Greater - 大于 + + Greater than value + 大于下值 - - Less - 小于 + + Less than value + 小于下值 - - Delta - 相差 + + Unknown/changed + 未知/已更改 - - Search - 查找 + + Changed by value + 由下值更改 - + + Unchanged + 无更改 + + + + Increased + 增加 + + + + Decreased + 减少 + + + + Search ROM + 查找 ROM + + + + New Search + 新的查找 + + + Search Within 在结果中查找 - + Open in Memory Viewer 在内存查看器中打开 - + Refresh 刷新 @@ -854,143 +885,148 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 精灵图 - - - × - × + + Copy + 复制 - - Magnification - 缩放率 + + Position + 位置 - - Export - 导出 - - - - Attributes - 属性 - - - - Transform - 变换 - - - - Off - - - - - Palette - 调色板 - - - - - - + + + + 0 0 - + + , + , + + + + Dimensions + 维度 + + + + + 8 + 8 + + + + + × + × + + + + Tile + 瓷贴 + + + + Export + 导出 + + + + Attributes + 属性 + + + + Transform + 变换 + + + + Off + + + + + Palette + 调色板 + + + Double Size 双倍大小 - - - - + + + + Return, Ctrl+R 回车键、Ctrl+R - + Flipped 已翻转 - + H 水平 - + V 垂直 - + Mode 模式 - + Normal 普通 - + Mosaic 马赛克 - + Enabled 已启用 - + Priority 优先级 - - - Tile - 瓷贴 - Geometry 几何图像 - - Position - 位置 - - - - , - , - - - - Dimensions - 维度 - - - - - 8 - 8 - - - + Address 地址 - + 0x07000000 0x07000000 + + + Magnification + 缩放率 + OverrideView @@ -1145,36 +1181,51 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 + MBC6 + MBC6 + + + MBC7 MBC7 - + + MMM01 + MMM01 + + + Pocket Cam Pocket Cam - + TAMA5 TAMA5 - + + HuC-1 + HuC-1 + + + HuC-3 HuC-3 - + Background Colors 背景颜色 - + Sprite Colors 1 精灵图颜色 1 - + Sprite Colors 2 精灵图颜色 2 @@ -1300,15 +1351,25 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 Game Boy 打印机 - + Hurry up! Hurry up! - + Tear off Tear off + + + × + × + + + + Magnification + 缩放率 + QGBA::AssetTile @@ -1318,9 +1379,9 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 %0%1%2 - - - + + + 0x%0 (%1) 0x%0 (%1) @@ -3097,83 +3158,85 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 QGBA::MapView - + Priority 优先级 - - + + Map base 映射基 - - + + Tile base 瓷贴基 - + Size 大小 - - + + offset 偏移 - + Xform 变换 - + Map Addr. 映射地址 - + Mirror 镜像 - + None - + Both 两者 - + Horizontal 水平 - + Vertical 垂直 - + + + + N/A + + + + Export map 导出映射 - + Portable Network Graphics (*.png) 便携式网络图形 (*.png) - - - Failed to open output PNG file: %1 - 打开输出 PNG 文件失败: %1 - QGBA::MemoryModel @@ -3248,22 +3311,22 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 QGBA::MemorySearch - + (%0/%1×) (%0/%1×) - + (⅟%0×) (⅟%0×) - + (%0×) (%0×) - + %1 byte%2 %1 字节%2 @@ -3271,49 +3334,49 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 QGBA::ObjView - - + + 0x%0 0x%0 - + Off - + Normal 一般 - + Trans 变换 - + OBJWIN OBJWIN - + Invalid 无效 - - + + N/A - + Export sprite 导出精灵图 - + Portable Network Graphics (*.png) 便携式网络图形 (*.png) @@ -3361,12 +3424,12 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 QGBA::PrinterView - + Save Printout 保存输出 - + Portable Network Graphics (*.png) 便携式网络图形 (*.png) @@ -3513,12 +3576,14 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 QGBA::TileView - + + Export tiles 导出文件 - + + Portable Network Graphics (*.png) 便携式网络图形 (*.png) @@ -3611,7 +3676,7 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 Patches (*.ips *.ups *.bps) - 补丁文件 (*.ips *.ups *.bps) + 补丁 (*.ips *.ups *.bps) @@ -3640,12 +3705,12 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 视频日志文件 (*.mvl) - + Crash 崩溃 - + The game has crashed with the following error: %1 @@ -3654,107 +3719,107 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 %1 - + Couldn't Load 无法载入 - + Could not load game. Are you sure it's in the correct format? 无法载入游戏。请确认游戏格式是否无误。 - + Unimplemented BIOS call 未实现的 BIOS 调用 - + This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience. 该游戏使用了尚未实现的 BIOS 调用。请使用官方 BIOS 以获得最佳游戏体验。 - + Really make portable? 确定进行程序便携化? - + This will make the emulator load its configuration from the same directory as the executable. Do you want to continue? 进行此操作后,模拟器将从模拟器可执行文件所在目录内加载模拟器配置。您想继续吗? - + Restart needed 需要重新启动 - + Some changes will not take effect until the emulator is restarted. 更改将在模拟器下次启动时生效。 - + - Player %1 of %2 - 玩家 %1 共 %2 - + %1 - %2 %1 - %2 - + %1 - %2 - %3 %1 - %2 - %3 - + %1 - %2 (%3 fps) - %4 %1 - %2 (%3 fps) - %4 - + &File 文件(&F) - + Load &ROM... 载入 ROM(&R)... - + Load ROM in archive... 从压缩文件中载入 ROM... - + Add folder to library... 将文件夹添加到库中... - + Load alternate save... - 读取其他的存档... + 读取其他存档... - + Load temporary save... 读取临时存档... - + Load &patch... 载入补丁文件(&P)... - + Boot BIOS 引导 BIOS - + Replace ROM... 替换 ROM... @@ -3764,468 +3829,468 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 ROM 信息(&I)... - + Recent 最近打开 - + Make portable 程序便携化 - + &Load state 读取即时存档(&L) - + Load state file... 载入即时存档文件... - + &Save state 保存即时存档(&S) - + Save state file... 保存即时存档文件... - + Quick load 快速读档 - + Quick save 快速存档 - + Load recent 载入最近 - + Save recent 保存最近 - + Undo load state 撤消读档 - + Undo save state 撤消存档 - - + + State &%1 即时存档 1(&1) - + Load camera image... 读取相机图片... - + Import GameShark Save 导入 GameShark 存档 - + Export GameShark Save 导出 GameShark 存档 - + New multiplayer window 新建多人游戏窗口 - + About... 关于... - + E&xit 退出(&X) - + &Emulation 模拟(&E) - + &Reset - 复位(&R) + 重置(&R) - + Sh&utdown 关机(&U) - + Yank game pak 快速抽出游戏卡带 - + &Pause 暂停(&P) - + &Next frame 下一帧(&N) - + Fast forward (held) 快进 (长按) - + &Fast forward 快进(&F) - + Fast forward speed 快进速度 - + Unbounded 不限制 - + %0x %0x - + Rewind (held) - 回退 (长按) + 倒带 (长按) - + Re&wind - 回退(&W) + 倒带(&W) - + Step backwards - 后退 + 步退 - + Sync to &video 视频同步(&V) - + Sync to &audio 音频同步(&A) - + Solar sensor 光线传感器 - + Increase solar level 增加光线级别 - + Decrease solar level 降低光线级别 - + Brightest solar level 光线级别为最亮 - + Darkest solar level 光线级别为最暗 - + Brightness %1 亮度 %1 - + Game Boy Printer... Game Boy 打印机... - + BattleChip Gate... BattleChip Gate... - + Audio/&Video 音频/视频(&V) - + Frame size 帧率 - + %1× %1× - + Toggle fullscreen 切换全屏 - + Lock aspect ratio 锁定纵横比 - + Force integer scaling 强制整数缩放 - + Interframe blending 帧间混合 - + Bilinear filtering 双线性过滤 - + Frame&skip 跳帧(&S) - + Mute 静音 - + FPS target 目标 FPS - + Native (59.7275) 原生 (59.7275) - + Take &screenshot 截图(&S) - + Record A/V... 录制音频/视频... - + Record GIF... 录制 GIF... - + Video layers 视频图层 - + Audio channels 音频通道 - + Adjust layer placement... 调整图层布局... - + &Tools 工具(&T) - + View &logs... 查看日志(&L)... - + Game &overrides... 覆盖游戏(&O)... - + Game Pak sensors... 游戏卡带传感器... - + &Cheats... 作弊码(&C)... - + Settings... 设置... - + Open debugger console... 打开调试器控制台... - + Start &GDB server... 打开 GDB 服务器(&G)... - + View &palette... 查看调色板(&P)... - + View &sprites... 查看精灵图(&S)... - + View &tiles... 查看瓷贴(&T)... - + View &map... 查看映射(&M)... - - &Frame inspector - 框架检查(&F) + + &Frame inspector... + 框架检查(&F)... - + View memory... 查看内存... - + Search memory... 搜索内存... - + View &I/O registers... 查看 I/O 寄存器(&I)... - + Record debug video log... 记录调试视频日志... - + Stop debug video log 停止记录调试视频日志 - + Exit fullscreen 退出全屏 - + GameShark Button (held) GameShark 键 (长按) - + Autofire 连发 - + Autofire A 连发 A - + Autofire B 连发 B - + Autofire L 连发 L - + Autofire R 连发 R - + Autofire Start 连发 Start - + Autofire Select 连发 Select - + Autofire Up 连发 上 - + Autofire Right 连发 右 - + Autofire Down 连发 下 - + Autofire Left 连发 左 - + Clear 清除 @@ -4543,7 +4608,7 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 - + frames @@ -4615,12 +4680,12 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 List view - 列表查看 + 列表视图 Tree view - 树状查看 + 树状视图 @@ -4649,339 +4714,344 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 + Pause when minimized + 最小化时暂停 + + + Show FPS in title bar 在标题栏显示 FPS - Automatically save cheats - 自动保存作弊码 - - - - Automatically load cheats - 自动载入作弊码 - - - - Automatically save state - 自动存档 - - - - Automatically load state - 自动读档 - - - Enable Discord Rich Presence 启用 Enable Discord Rich Presence - - Pause when minimized - 最小化时暂停 + + Automatically save state + 自动存档 + + + + Automatically load state + 自动读档 + + + + Automatically save cheats + 自动保存作弊码 + + + + Automatically load cheats + 自动载入作弊码 + Show OSD messages + 显示 OSD 信息 + + + Fast forward speed: 快进速度: - - - + + + × × - - + + Unbounded 不限制 - + Fast forward (held) speed: 快进 (按住) 速度: - + Autofire interval: 连发间隔: - + Enable rewind - 启用回退 + 启用倒带 - + Rewind history: - 回退历史: + 倒带历史: - + Idle loops: 空循环: - + Run all 运行全部 - + Remove known 移除已知 - + Detect and remove 检测并移除 - + Preload entire ROM into memory 将整个 ROM 预加载到内存中 - + Savestate extra data: 即时存档额外数据: - - + + Screenshot 截图 - - + + Save data 保存数据 - - + + Cheat codes 作弊码 - + Load extra data: 载入额外数据: - + Video renderer: 视频渲染器: - + Software 软件 - + OpenGL OpenGL - + OpenGL enhancements OpenGL 增强 - + High-resolution scale: 高分辨率比例: - + (240×160) (240×160) - + XQ GBA audio (experimental) XQ GBA 音频 (实验) - + GB BIOS file: GB BIOS 文件: - - - - - - - - - + + + + + + + + + Browse 浏览 - + Use BIOS file if found 当可用时使用 BIOS 文件 - + Skip BIOS intro 跳过 BIOS 启动画面 - + GBA BIOS file: GBA BIOS 文件: - + GBC BIOS file: GBC BIOS 文件: - + SGB BIOS file: SGB BIOS 文件: - + Save games 游戏存档 - - - - - + + + + + Same directory as the ROM 保存在 ROM 所在目录 - + Save states 即时存档 - + Screenshots 截图 - + Patches 补丁 - + Cheats 作弊码 - + Log to file 记录日志到文件 - + Log to console 记录日志到控制台 - + Select Log File 选择日志文件 - + Game Boy model: Game Boy 模型: - - - + + + Autodetect 自动检测 - - - + + + Game Boy (DMG) Game Boy (DMG) - - - + + + Super Game Boy (SGB) Super Game Boy (SGB) - - - + + + Game Boy Color (CGB) Game Boy Color (CGB) - - - + + + Game Boy Advance (AGB) Game Boy Advance (AGB) - + Super Game Boy model: Super Game Boy 模型: - + Game Boy Color model: Game Boy Color 模型: - + Default BG colors: 默认背景颜色: - + Super Game Boy borders Super Game Boy 边框 - + Camera driver: 相机驱动: - + Default sprite colors 1: 默认精灵图颜色 1: - + Default sprite colors 2: 默认精灵图颜色 2: - + Use GBC colors in GB games 在 GB 游戏中使用 GBC 颜色 - + Camera: 相机: @@ -5055,34 +5125,49 @@ Game Boy Advance 是任天堂有限公司(Nintendo Co., Ltd.)的注册商标 瓷贴 - + + Export Selected + 导出所选 + + + + Export All + 导出全部 + + + 256 colors 256 色 - + × × - + Magnification 缩放率 - + Tiles per row 每行瓷贴 - + Fit to window 自适应窗口 - - Export - 导出 + + Copy Selected + 复制所选 + + + + Copy All + 复制全部 From 766311ba611da98717201eb6bc9d46d35c0e4c19 Mon Sep 17 00:00:00 2001 From: jsmolka Date: Thu, 31 Oct 2019 17:47:13 +0100 Subject: [PATCH 10/30] Fix German save state translation --- src/platform/qt/ts/mgba-de.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/qt/ts/mgba-de.ts b/src/platform/qt/ts/mgba-de.ts index af4c7d560..88c112707 100644 --- a/src/platform/qt/ts/mgba-de.ts +++ b/src/platform/qt/ts/mgba-de.ts @@ -3774,7 +3774,7 @@ Game Boy Advance ist ein eingetragenes Warenzeichen von Nintendo Co., Ltd. Load state file... - Ssavestate-Datei laden... + Savestate-Datei laden... From f336219a6145904f8f95f4cae748db41a598d979 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 1 Nov 2019 19:06:13 -0700 Subject: [PATCH 11/30] ARM: Fix STR writeback pipeline stage --- CHANGES | 1 + src/arm/isa-arm.c | 118 ++++++++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 56 deletions(-) diff --git a/CHANGES b/CHANGES index 2dab08aa4..c2f1ab05e 100644 --- a/CHANGES +++ b/CHANGES @@ -87,6 +87,7 @@ Misc: - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) Changes from beta 1: Emulation fixes: + - ARM: Fix STR writeback pipeline stage - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) diff --git a/src/arm/isa-arm.c b/src/arm/isa-arm.c index ae8d61820..3f99b8443 100644 --- a/src/arm/isa-arm.c +++ b/src/arm/isa-arm.c @@ -258,6 +258,11 @@ ATTRIBUTE_NOINLINE static void _neutralS(struct ARMCore* cpu, int32_t d) { currentCycles += ARMWritePC(cpu); \ } +#define ADDR_MODE_2_WRITEBACK_PRE_STORE(WB) +#define ADDR_MODE_2_WRITEBACK_POST_STORE(WB) WB +#define ADDR_MODE_2_WRITEBACK_PRE_LOAD(WB) WB +#define ADDR_MODE_2_WRITEBACK_POST_LOAD(WB) + #define ADDR_MODE_2_LSL (cpu->gprs[rm] << ADDR_MODE_2_I) #define ADDR_MODE_2_LSR (ADDR_MODE_2_I_TEST ? ((uint32_t) cpu->gprs[rm]) >> ADDR_MODE_2_I : 0) #define ADDR_MODE_2_ASR (ADDR_MODE_2_I_TEST ? ((int32_t) cpu->gprs[rm]) >> ADDR_MODE_2_I : ((int32_t) cpu->gprs[rm]) >> 31) @@ -363,7 +368,7 @@ ATTRIBUTE_NOINLINE static void _neutralS(struct ARMCore* cpu, int32_t d) { DEFINE_MULTIPLY_INSTRUCTION_2_EX_ARM(NAME, BODY, , WAIT) \ DEFINE_MULTIPLY_INSTRUCTION_2_EX_ARM(NAME ## S, BODY, S_BODY, WAIT) -#define DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, ADDRESS, WRITEBACK, BODY) \ +#define DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, ADDRESS, WRITEBACK, LS, BODY) \ DEFINE_INSTRUCTION_ARM(NAME, \ uint32_t address; \ int rn = (opcode >> 16) & 0xF; \ @@ -371,54 +376,55 @@ ATTRIBUTE_NOINLINE static void _neutralS(struct ARMCore* cpu, int32_t d) { int rm = opcode & 0xF; \ UNUSED(rm); \ address = ADDRESS; \ - WRITEBACK; \ - BODY;) + ADDR_MODE_2_WRITEBACK_PRE_ ## LS (WRITEBACK); \ + BODY; \ + ADDR_MODE_2_WRITEBACK_POST_ ## LS (WRITEBACK);) -#define DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME, SHIFTER, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, SHIFTER)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## U, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, SHIFTER)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## P, ADDR_MODE_2_INDEX(-, SHIFTER), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PW, ADDR_MODE_2_INDEX(-, SHIFTER), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PU, ADDR_MODE_2_INDEX(+, SHIFTER), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PUW, ADDR_MODE_2_INDEX(+, SHIFTER), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), BODY) +#define DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME, SHIFTER, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, SHIFTER)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## U, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, SHIFTER)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## P, ADDR_MODE_2_INDEX(-, SHIFTER), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PW, ADDR_MODE_2_INDEX(-, SHIFTER), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PU, ADDR_MODE_2_INDEX(+, SHIFTER), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PUW, ADDR_MODE_2_INDEX(+, SHIFTER), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), LS, BODY) -#define DEFINE_LOAD_STORE_INSTRUCTION_ARM(NAME, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _LSL_, ADDR_MODE_2_LSL, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _LSR_, ADDR_MODE_2_LSR, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _ASR_, ADDR_MODE_2_ASR, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _ROR_, ADDR_MODE_2_ROR, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## I, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IU, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IP, ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPW, ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPU, ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPUW, ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), BODY) \ +#define DEFINE_LOAD_STORE_INSTRUCTION_ARM(NAME, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _LSL_, ADDR_MODE_2_LSL, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _LSR_, ADDR_MODE_2_LSR, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _ASR_, ADDR_MODE_2_ASR, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_SHIFTER_ARM(NAME ## _ROR_, ADDR_MODE_2_ROR, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## I, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IU, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IP, ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPW, ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPU, ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPUW, ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE), ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_ADDRESS), LS, BODY) \ -#define DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(NAME, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(-, ADDR_MODE_3_RM)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## U, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(+, ADDR_MODE_3_RM)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## P, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_RM), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PW, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_RM), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PU, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_RM), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PUW, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_RM), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## I, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(-, ADDR_MODE_3_IMMEDIATE)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IU, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(+, ADDR_MODE_3_IMMEDIATE)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IP, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_IMMEDIATE), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPW, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_IMMEDIATE), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPU, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_IMMEDIATE), , BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPUW, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_IMMEDIATE), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), BODY) \ +#define DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(NAME, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(-, ADDR_MODE_3_RM)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## U, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(+, ADDR_MODE_3_RM)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## P, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_RM), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PW, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_RM), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PU, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_RM), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## PUW, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_RM), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## I, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(-, ADDR_MODE_3_IMMEDIATE)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IU, ADDR_MODE_3_RN, ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_INDEX(+, ADDR_MODE_3_IMMEDIATE)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IP, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_IMMEDIATE), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPW, ADDR_MODE_3_INDEX(-, ADDR_MODE_3_IMMEDIATE), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPU, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_IMMEDIATE), , LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IPUW, ADDR_MODE_3_INDEX(+, ADDR_MODE_3_IMMEDIATE), ADDR_MODE_3_WRITEBACK(ADDR_MODE_3_ADDRESS), LS, BODY) \ -#define DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME, SHIFTER, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, SHIFTER, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, ADDR_MODE_2_RM)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## U, SHIFTER, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, ADDR_MODE_2_RM)), BODY) \ +#define DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME, SHIFTER, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME, SHIFTER, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, ADDR_MODE_2_RM)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## U, SHIFTER, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, ADDR_MODE_2_RM)), LS, BODY) \ -#define DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(NAME, BODY) \ - DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _LSL_, ADDR_MODE_2_LSL, BODY) \ - DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _LSR_, ADDR_MODE_2_LSR, BODY) \ - DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _ASR_, ADDR_MODE_2_ASR, BODY) \ - DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _ROR_, ADDR_MODE_2_ROR, BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## I, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE)), BODY) \ - DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IU, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE)), BODY) \ +#define DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(NAME, LS, BODY) \ + DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _LSL_, ADDR_MODE_2_LSL, LS, BODY) \ + DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _LSR_, ADDR_MODE_2_LSR, LS, BODY) \ + DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _ASR_, ADDR_MODE_2_ASR, LS, BODY) \ + DEFINE_LOAD_STORE_T_INSTRUCTION_SHIFTER_ARM(NAME ## _ROR_, ADDR_MODE_2_ROR, LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## I, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(-, ADDR_MODE_2_IMMEDIATE)), LS, BODY) \ + DEFINE_LOAD_STORE_INSTRUCTION_EX_ARM(NAME ## IU, ADDR_MODE_2_RN, ADDR_MODE_2_WRITEBACK(ADDR_MODE_2_INDEX(+, ADDR_MODE_2_IMMEDIATE)), LS, BODY) \ #define ARM_MS_PRE \ enum PrivilegeMode privilegeMode = cpu->privilegeMode; \ @@ -551,16 +557,16 @@ DEFINE_MULTIPLY_INSTRUCTION_2_ARM(UMULL, // Begin load/store definitions -DEFINE_LOAD_STORE_INSTRUCTION_ARM(LDR, cpu->gprs[rd] = cpu->memory.load32(cpu, address, ¤tCycles); ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_INSTRUCTION_ARM(LDRB, cpu->gprs[rd] = cpu->memory.load8(cpu, address, ¤tCycles); ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(LDRH, cpu->gprs[rd] = cpu->memory.load16(cpu, address, ¤tCycles); ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(LDRSB, cpu->gprs[rd] = ARM_SXT_8(cpu->memory.load8(cpu, address, ¤tCycles)); ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(LDRSH, cpu->gprs[rd] = address & 1 ? ARM_SXT_8(cpu->memory.load16(cpu, address, ¤tCycles)) : ARM_SXT_16(cpu->memory.load16(cpu, address, ¤tCycles)); ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_INSTRUCTION_ARM(STR, cpu->memory.store32(cpu, address, cpu->gprs[rd], ¤tCycles); ARM_STORE_POST_BODY;) -DEFINE_LOAD_STORE_INSTRUCTION_ARM(STRB, cpu->memory.store8(cpu, address, cpu->gprs[rd], ¤tCycles); ARM_STORE_POST_BODY;) -DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(STRH, cpu->memory.store16(cpu, address, cpu->gprs[rd], ¤tCycles); ARM_STORE_POST_BODY;) +DEFINE_LOAD_STORE_INSTRUCTION_ARM(LDR, LOAD, cpu->gprs[rd] = cpu->memory.load32(cpu, address, ¤tCycles); ARM_LOAD_POST_BODY;) +DEFINE_LOAD_STORE_INSTRUCTION_ARM(LDRB, LOAD, cpu->gprs[rd] = cpu->memory.load8(cpu, address, ¤tCycles); ARM_LOAD_POST_BODY;) +DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(LDRH, LOAD, cpu->gprs[rd] = cpu->memory.load16(cpu, address, ¤tCycles); ARM_LOAD_POST_BODY;) +DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(LDRSB, LOAD, cpu->gprs[rd] = ARM_SXT_8(cpu->memory.load8(cpu, address, ¤tCycles)); ARM_LOAD_POST_BODY;) +DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(LDRSH, LOAD, cpu->gprs[rd] = address & 1 ? ARM_SXT_8(cpu->memory.load16(cpu, address, ¤tCycles)) : ARM_SXT_16(cpu->memory.load16(cpu, address, ¤tCycles)); ARM_LOAD_POST_BODY;) +DEFINE_LOAD_STORE_INSTRUCTION_ARM(STR, STORE, cpu->memory.store32(cpu, address, cpu->gprs[rd], ¤tCycles); ARM_STORE_POST_BODY;) +DEFINE_LOAD_STORE_INSTRUCTION_ARM(STRB, STORE, cpu->memory.store8(cpu, address, cpu->gprs[rd], ¤tCycles); ARM_STORE_POST_BODY;) +DEFINE_LOAD_STORE_MODE_3_INSTRUCTION_ARM(STRH, STORE, cpu->memory.store16(cpu, address, cpu->gprs[rd], ¤tCycles); ARM_STORE_POST_BODY;) -DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(LDRBT, +DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(LDRBT, LOAD, enum PrivilegeMode priv = cpu->privilegeMode; ARMSetPrivilegeMode(cpu, MODE_USER); int32_t r = cpu->memory.load8(cpu, address, ¤tCycles); @@ -568,7 +574,7 @@ DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(LDRBT, cpu->gprs[rd] = r; ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(LDRT, +DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(LDRT, LOAD, enum PrivilegeMode priv = cpu->privilegeMode; ARMSetPrivilegeMode(cpu, MODE_USER); int32_t r = cpu->memory.load32(cpu, address, ¤tCycles); @@ -576,7 +582,7 @@ DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(LDRT, cpu->gprs[rd] = r; ARM_LOAD_POST_BODY;) -DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(STRBT, +DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(STRBT, STORE, enum PrivilegeMode priv = cpu->privilegeMode; int32_t r = cpu->gprs[rd]; ARMSetPrivilegeMode(cpu, MODE_USER); @@ -584,7 +590,7 @@ DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(STRBT, ARMSetPrivilegeMode(cpu, priv); ARM_STORE_POST_BODY;) -DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(STRT, +DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(STRT, STORE, enum PrivilegeMode priv = cpu->privilegeMode; int32_t r = cpu->gprs[rd]; ARMSetPrivilegeMode(cpu, MODE_USER); From 89c49f15d0880596436a567f300693f01ab2c47f Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 1 Nov 2019 19:37:08 -0700 Subject: [PATCH 12/30] ARM: Partially fix LDM/STM writeback with empty register list --- CHANGES | 1 + src/arm/isa-arm.c | 2 +- src/arm/isa-thumb.c | 3 +++ src/gba/memory.c | 12 ++++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c2f1ab05e..4ccfef90d 100644 --- a/CHANGES +++ b/CHANGES @@ -88,6 +88,7 @@ Misc: Changes from beta 1: Emulation fixes: - ARM: Fix STR writeback pipeline stage + - ARM: Partially fix LDM/STM writeback with empty register list - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) diff --git a/src/arm/isa-arm.c b/src/arm/isa-arm.c index 3f99b8443..c88345f90 100644 --- a/src/arm/isa-arm.c +++ b/src/arm/isa-arm.c @@ -601,7 +601,7 @@ DEFINE_LOAD_STORE_T_INSTRUCTION_ARM(STRT, STORE, DEFINE_LOAD_STORE_MULTIPLE_INSTRUCTION_ARM(LDM, load, currentCycles += cpu->memory.activeNonseqCycles32 - cpu->memory.activeSeqCycles32; - if (rs & 0x8000) { + if ((rs & 0x8000) || !rs) { currentCycles += ARMWritePC(cpu); }) diff --git a/src/arm/isa-thumb.c b/src/arm/isa-thumb.c index ede7ba368..15f845a29 100644 --- a/src/arm/isa-thumb.c +++ b/src/arm/isa-thumb.c @@ -295,6 +295,9 @@ DEFINE_LOAD_STORE_MULTIPLE_THUMB(LDMIA, IA, , THUMB_LOAD_POST_BODY; + if (!rs) { + currentCycles += ThumbWritePC(cpu); + } if (!((1 << rn) & rs)) { cpu->gprs[rn] = address; }) diff --git a/src/gba/memory.c b/src/gba/memory.c index 7a4cf18c7..d70578830 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -1326,6 +1326,12 @@ void GBAPatch8(struct ARMCore* cpu, uint32_t address, int8_t value, int8_t* old) } #define LDM_LOOP(LDM) \ + if (UNLIKELY(!mask)) { \ + LDM; \ + cpu->gprs[ARM_PC] = value; \ + wait += 16; \ + address += 64; \ + } \ for (i = 0; i < 16; i += 4) { \ if (UNLIKELY(mask & (1 << i))) { \ LDM; \ @@ -1438,6 +1444,12 @@ uint32_t GBALoadMultiple(struct ARMCore* cpu, uint32_t address, int mask, enum L } #define STM_LOOP(STM) \ + if (UNLIKELY(!mask)) { \ + value = cpu->gprs[ARM_PC] + (cpu->executionMode == MODE_ARM ? WORD_SIZE_ARM : WORD_SIZE_THUMB); \ + STM; \ + wait += 16; \ + address += 64; \ + } \ for (i = 0; i < 16; i += 4) { \ if (UNLIKELY(mask & (1 << i))) { \ value = cpu->gprs[i]; \ From 4e03b15040737129648b532521b3547dfed7bba8 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 10 Nov 2019 20:42:36 -0800 Subject: [PATCH 13/30] GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes #1572) --- CHANGES | 1 + src/gba/renderers/gl.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 4ccfef90d..dc568189d 100644 --- a/CHANGES +++ b/CHANGES @@ -90,6 +90,7 @@ Emulation fixes: - ARM: Fix STR writeback pipeline stage - ARM: Partially fix LDM/STM writeback with empty register list - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) + - GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554) diff --git a/src/gba/renderers/gl.c b/src/gba/renderers/gl.c index 13a36a231..398f14a57 100644 --- a/src/gba/renderers/gl.c +++ b/src/gba/renderers/gl.c @@ -145,21 +145,21 @@ static const char* const _renderMode0 = " if (mosaic.y > 1) {\n" " coord.y -= coord.y % mosaic.y;\n" " }\n" - " coord += (ivec2(0x3FF, 0x3FF000) & offset[int(texCoord.y)]) >> ivec2(0, 12);\n" - " ivec2 wrap = ivec2(255, 511);\n" - " if (size == 3) {\n" - " coord.y += (coord.y & 256) << 1;\n" - " wrap.y = 1023;\n" - " } else if (size == 0) {\n" - " wrap.y = 255;\n" - " }\n" - " if (size != 2) {\n" - " coord.y &= ~256;\n" - " }\n" + " coord += (ivec2(0x1FF, 0x1FF000) & offset[int(texCoord.y)]) >> ivec2(0, 12);\n" + " ivec2 wrap = ivec2(255, 255);\n" + " int doty = 0;\n" " if ((size & 1) == 1) {\n" - " coord.y += coord.x & 256;\n" + " wrap.x = 511;\n" + " ++doty;\n" + " }\n" + " if ((size & 2) == 2) {\n" + " wrap.y = 511;\n" + " ++doty;\n" " }\n" " coord &= wrap;\n" + " wrap = coord & 256;\n" + " coord &= 255;\n" + " coord.y += wrap.x + wrap.y * doty;\n" " int mapAddress = screenBase + (coord.x >> 3) + (coord.y >> 3) * 32;\n" " vec4 map = texelFetch(vram, ivec2(mapAddress & 255, mapAddress >> 8), 0);\n" " int tileFlags = int(map.g * 15.9);\n" From 77ab0ef7703b9a8f0eaf9b43cbd6341bca12f773 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 11 Nov 2019 01:39:43 -0800 Subject: [PATCH 14/30] Qt: Fix fast forward mute being reset (fixes #1574) --- CHANGES | 1 + src/platform/qt/Window.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index dc568189d..fc2436f71 100644 --- a/CHANGES +++ b/CHANGES @@ -94,6 +94,7 @@ Emulation fixes: Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554) + - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) 0.8 beta 1: (2019-10-20) - Initial beta for 0.8 diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 122eea673..c60514940 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -1405,7 +1405,9 @@ void Window::setupMenu(QMenuBar* menubar) { ConfigOption* mute = m_config->addOption("mute"); mute->addBoolean(tr("Mute"), &m_actions, "av"); mute->connect([this](const QVariant& value) { - m_config->setOption("fastForwardMute", static_cast(value.toInt())); + if (value.toInt()) { + m_config->setOption("fastForwardMute", true); + } reloadConfig(); }, this); m_config->updateOption("mute"); From 6900d130ae1fc082ac98c53213a4d31b1f9928fb Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 11 Nov 2019 18:24:49 -0800 Subject: [PATCH 15/30] GBA Memory: Fix open bus from IWRAM (fixes #1575) --- CHANGES | 1 + src/gba/memory.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index fc2436f71..f60f6b8e9 100644 --- a/CHANGES +++ b/CHANGES @@ -91,6 +91,7 @@ Emulation fixes: - ARM: Partially fix LDM/STM writeback with empty register list - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) - GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572) + - GBA Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554) diff --git a/src/gba/memory.c b/src/gba/memory.c index d70578830..091bfa1e1 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -353,10 +353,10 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) { case REGION_WORKING_IRAM: \ /* This doesn't handle prefetch clobbering */ \ if (cpu->gprs[ARM_PC] & 2) { \ - value |= cpu->prefetch[0] << 16; \ - } else { \ value <<= 16; \ value |= cpu->prefetch[0]; \ + } else { \ + value |= cpu->prefetch[0] << 16; \ } \ break; \ default: \ From 5e37df6cf5b7f9744bdbb64c550cf13a98892b35 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 16 Nov 2019 12:16:16 -0800 Subject: [PATCH 16/30] Core: Fix unitialized memory issues with graphics caches --- CHANGES | 1 + src/core/bitmap-cache.c | 15 ++++++++++----- src/core/map-cache.c | 13 +++++++++---- src/core/tile-cache.c | 3 +++ src/gb/renderers/cache-set.c | 12 +++++++----- src/gba/renderers/cache-set.c | 13 +++++++++---- 6 files changed, 39 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index f60f6b8e9..a451feeaa 100644 --- a/CHANGES +++ b/CHANGES @@ -94,6 +94,7 @@ Emulation fixes: - GBA Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) + - Core: Fix uninitialized memory issues with graphics caches - Vita: Fix analog controls (fixes mgba.io/i/1554) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) diff --git a/src/core/bitmap-cache.c b/src/core/bitmap-cache.c index c86768e45..cdbc90a0e 100644 --- a/src/core/bitmap-cache.c +++ b/src/core/bitmap-cache.c @@ -11,6 +11,7 @@ void mBitmapCacheInit(struct mBitmapCache* cache) { // TODO: Reconfigurable cache for space savings cache->cache = NULL; cache->config = mBitmapCacheConfigurationFillShouldStore(0); + cache->sysConfig = 0; cache->status = NULL; cache->palette = NULL; cache->buffer = 0; @@ -18,14 +19,18 @@ void mBitmapCacheInit(struct mBitmapCache* cache) { static void _freeCache(struct mBitmapCache* cache) { size_t size = mBitmapCacheSystemInfoGetHeight(cache->sysConfig) * mBitmapCacheSystemInfoGetBuffers(cache->sysConfig); - mappedMemoryFree(cache->cache, mBitmapCacheSystemInfoGetWidth(cache->sysConfig) * size * sizeof(color_t)); - mappedMemoryFree(cache->status, size * sizeof(*cache->status)); + if (cache->cache) { + mappedMemoryFree(cache->cache, mBitmapCacheSystemInfoGetWidth(cache->sysConfig) * size * sizeof(color_t)); + cache->cache = NULL; + } + if (cache->status) { + mappedMemoryFree(cache->status, size * sizeof(*cache->status)); + cache->status = NULL; + } if (cache->palette) { free(cache->palette); + cache->palette = NULL; } - cache->cache = NULL; - cache->status = NULL; - cache->palette = NULL; } static void _redoCacheSize(struct mBitmapCache* cache) { diff --git a/src/core/map-cache.c b/src/core/map-cache.c index 495978672..470f72b89 100644 --- a/src/core/map-cache.c +++ b/src/core/map-cache.c @@ -11,15 +11,20 @@ void mMapCacheInit(struct mMapCache* cache) { // TODO: Reconfigurable cache for space savings cache->cache = NULL; cache->config = mMapCacheConfigurationFillShouldStore(0); + cache->sysConfig = 0; cache->status = NULL; } static void _freeCache(struct mMapCache* cache) { size_t tiles = (1 << mMapCacheSystemInfoGetTilesWide(cache->sysConfig)) * (1 << mMapCacheSystemInfoGetTilesHigh(cache->sysConfig)); - mappedMemoryFree(cache->cache, 8 * 8 * sizeof(color_t) * tiles); - mappedMemoryFree(cache->status, tiles * sizeof(*cache->status)); - cache->cache = NULL; - cache->status = NULL; + if (cache->cache) { + mappedMemoryFree(cache->cache, 8 * 8 * sizeof(color_t) * tiles); + cache->cache = NULL; + } + if (cache->status) { + mappedMemoryFree(cache->status, tiles * sizeof(*cache->status)); + cache->status = NULL; + } } static void _redoCacheSize(struct mMapCache* cache) { diff --git a/src/core/tile-cache.c b/src/core/tile-cache.c index d1e1b9e25..8272c52fa 100644 --- a/src/core/tile-cache.c +++ b/src/core/tile-cache.c @@ -51,6 +51,9 @@ static void _redoCacheSize(struct mTileCache* cache) { } void mTileCacheConfigure(struct mTileCache* cache, mTileCacheConfiguration config) { + if (cache->config == config) { + return; + } _freeCache(cache); cache->config = config; _redoCacheSize(cache); diff --git a/src/gb/renderers/cache-set.c b/src/gb/renderers/cache-set.c index 9703c09c1..5426e5ac1 100644 --- a/src/gb/renderers/cache-set.c +++ b/src/gb/renderers/cache-set.c @@ -12,11 +12,13 @@ void GBVideoCacheInit(struct mCacheSet* cache) { mCacheSetInit(cache, 2, 0, 1); - mTileCacheConfiguration config = 0; - config = mTileCacheSystemInfoSetPaletteBPP(config, 1); // 2^(2^1) = 4 entries - config = mTileCacheSystemInfoSetPaletteCount(config, 4); // 16 palettes - config = mTileCacheSystemInfoSetMaxTiles(config, 1024); - mTileCacheConfigureSystem(mTileCacheSetGetPointer(&cache->tiles, 0), config, 0, 0); + mTileCacheSystemInfo sysconfig = 0; + mTileCacheConfiguration config = mTileCacheConfigurationFillShouldStore(0); + sysconfig = mTileCacheSystemInfoSetPaletteBPP(sysconfig, 1); // 2^(2^1) = 4 entries + sysconfig = mTileCacheSystemInfoSetPaletteCount(sysconfig, 4); // 16 palettes + sysconfig = mTileCacheSystemInfoSetMaxTiles(sysconfig, 1024); + mTileCacheConfigureSystem(mTileCacheSetGetPointer(&cache->tiles, 0), sysconfig, 0, 0); + mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 0), config); mMapCacheSetGetPointer(&cache->maps, 0)->tileCache = mTileCacheSetGetPointer(&cache->tiles, 0); mMapCacheSetGetPointer(&cache->maps, 1)->tileCache = mTileCacheSetGetPointer(&cache->tiles, 0); diff --git a/src/gba/renderers/cache-set.c b/src/gba/renderers/cache-set.c index 71a4b8617..bc84deadd 100644 --- a/src/gba/renderers/cache-set.c +++ b/src/gba/renderers/cache-set.c @@ -17,20 +17,20 @@ void GBAVideoCacheInit(struct mCacheSet* cache) { sysconfig = mTileCacheSystemInfoSetPaletteBPP(sysconfig, 2); // 2^(2^2) = 16 entries sysconfig = mTileCacheSystemInfoSetPaletteCount(sysconfig, 4); // 16 palettes sysconfig = mTileCacheSystemInfoSetMaxTiles(sysconfig, 2048); - mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 0), config); mTileCacheConfigureSystem(mTileCacheSetGetPointer(&cache->tiles, 0), sysconfig, 0, 0); + mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 0), config); sysconfig = mTileCacheSystemInfoSetMaxTiles(sysconfig, 1024); - mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 2), config); mTileCacheConfigureSystem(mTileCacheSetGetPointer(&cache->tiles, 2), sysconfig, 0x10000, 0x100); + mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 2), config); sysconfig = mTileCacheSystemInfoSetPaletteBPP(sysconfig, 3); // 2^(2^3) = 256 entries sysconfig = mTileCacheSystemInfoSetPaletteCount(sysconfig, 0); // 1 palettes sysconfig = mTileCacheSystemInfoSetMaxTiles(sysconfig, 2048); - mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 1), config); mTileCacheConfigureSystem(mTileCacheSetGetPointer(&cache->tiles, 1), sysconfig, 0, 0); + mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 1), config); sysconfig = mTileCacheSystemInfoSetMaxTiles(sysconfig, 1024); - mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 3), config); mTileCacheConfigureSystem(mTileCacheSetGetPointer(&cache->tiles, 3), sysconfig, 0x10000, 0x100); + mTileCacheConfigure(mTileCacheSetGetPointer(&cache->tiles, 3), config); mBitmapCacheSystemInfo bitConfig; bitConfig = mBitmapCacheSystemInfoSetEntryBPP(0, 4); @@ -50,6 +50,11 @@ void GBAVideoCacheInit(struct mCacheSet* cache) { mBitmapCacheConfigureSystem(mBitmapCacheSetGetPointer(&cache->bitmaps, 1), bitConfig); mBitmapCacheSetGetPointer(&cache->bitmaps, 1)->bitsStart[0] = 0; mBitmapCacheSetGetPointer(&cache->bitmaps, 1)->bitsStart[1] = 0xA000; + + mMapCacheSetGetPointer(&cache->maps, 0)->context = NULL; + mMapCacheSetGetPointer(&cache->maps, 1)->context = NULL; + mMapCacheSetGetPointer(&cache->maps, 2)->context = NULL; + mMapCacheSetGetPointer(&cache->maps, 3)->context = NULL; } void GBAVideoCacheAssociate(struct mCacheSet* cache, struct GBAVideo* video) { From 2bacae3075d4191c26d0f66e40da7ae360923bf8 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 16 Nov 2019 12:16:47 -0800 Subject: [PATCH 17/30] GBA SIO: Fix unitialized memory issue --- src/gba/sio/lockstep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gba/sio/lockstep.c b/src/gba/sio/lockstep.c index 506854a7e..d4392f47e 100644 --- a/src/gba/sio/lockstep.c +++ b/src/gba/sio/lockstep.c @@ -47,6 +47,7 @@ bool GBASIOLockstepAttachNode(struct GBASIOLockstep* lockstep, struct GBASIOLock lockstep->players[lockstep->d.attached] = node; node->p = lockstep; node->id = lockstep->d.attached; + node->transferFinished = true; ++lockstep->d.attached; return true; } From a2b3129bc0748e7373443a61259c52231216b704 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 16 Nov 2019 12:17:13 -0800 Subject: [PATCH 18/30] Qt: Fix uninitialized memory issue --- src/platform/qt/CoreController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/qt/CoreController.h b/src/platform/qt/CoreController.h index 8f89c5858..fe4eb542d 100644 --- a/src/platform/qt/CoreController.h +++ b/src/platform/qt/CoreController.h @@ -230,7 +230,7 @@ private: bool m_autosave; bool m_autoload; - int m_autosaveCounter; + int m_autosaveCounter = 0; int m_fastForward = false; int m_fastForwardForced = false; From ffe99c08b745bdef74d9385a16c2159c6f5744e6 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Wed, 20 Nov 2019 07:30:14 -0700 Subject: [PATCH 19/30] Qt: Fix compiling with M_CORE_GB disabled GB specific code was added without guards, causing configurations with it disabled to fail compiling: cmake -B build -DM_CORE_GB:BOOL=OFF Resolves: #1578 Fixes: a44a8f668f6a5 ("GB: Add yanking") Fixes: fbe375fab992c ("Core: Add support for caching bitmapped modes") Fixes: 06657d9fde5a2 ("Qt: Add additional info to map view") Fixes: f15aacd0b6aaf ("Qt: Set default Game Boy colors") --- src/platform/qt/CoreController.cpp | 4 ++++ src/platform/qt/MapView.cpp | 6 +++++- src/platform/qt/OverrideView.cpp | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/platform/qt/CoreController.cpp b/src/platform/qt/CoreController.cpp index ed6020ff8..3f1886de5 100644 --- a/src/platform/qt/CoreController.cpp +++ b/src/platform/qt/CoreController.cpp @@ -632,12 +632,16 @@ void CoreController::yankPak() { Interrupter interrupter(this); switch (platform()) { +#ifdef M_CORE_GBA case PLATFORM_GBA: GBAYankROM(static_cast(m_threadContext.core->board)); break; +#endif +#ifdef M_CORE_GB case PLATFORM_GB: GBYankROM(static_cast(m_threadContext.core->board)); break; +#endif } } diff --git a/src/platform/qt/MapView.cpp b/src/platform/qt/MapView.cpp index f71baf0fe..46b6ab814 100644 --- a/src/platform/qt/MapView.cpp +++ b/src/platform/qt/MapView.cpp @@ -167,6 +167,7 @@ void MapView::updateTilesGBA(bool force) { int frame = 0; QString offset(tr("N/A")); QString transform(tr("N/A")); +#ifdef M_CORE_GBA if (m_controller->platform() == PLATFORM_GBA) { uint16_t* io = static_cast(m_controller->thread()->core->board)->memory.io; int mode = GBARegisterDISPCNTGetMode(io[REG_DISPCNT >> 1]); @@ -199,12 +200,15 @@ void MapView::updateTilesGBA(bool force) { } } +#endif +#ifdef M_CORE_GB if (m_controller->platform() == PLATFORM_GB) { uint8_t* io = static_cast(m_controller->thread()->core->board)->memory.io; int x = io[m_map == 0 ? 0x42 : 0x4A]; int y = io[m_map == 0 ? 0x43 : 0x4B]; offset = QString("%1, %2").arg(x).arg(y); } +#endif if (bitmap >= 0) { mBitmapCache* bitmapCache = mBitmapCacheSetGetPointer(&m_cacheSet->bitmaps, bitmap); int width = mBitmapCacheSystemInfoGetWidth(bitmapCache->sysConfig); @@ -266,4 +270,4 @@ void MapView::exportMap() { void MapView::copyMap() { CoreController::Interrupter interrupter(m_controller); GBAApp::app()->clipboard()->setImage(m_rawMap); -} \ No newline at end of file +} diff --git a/src/platform/qt/OverrideView.cpp b/src/platform/qt/OverrideView.cpp index f2957a5d2..f0d1fe772 100644 --- a/src/platform/qt/OverrideView.cpp +++ b/src/platform/qt/OverrideView.cpp @@ -69,6 +69,7 @@ OverrideView::OverrideView(ConfigController* config, QWidget* parent) m_ui.hwRumble->setEnabled(!enabled); }); +#ifdef M_CORE_GB m_colorPickers[0] = ColorPicker(m_ui.color0, QColor(0xF8, 0xF8, 0xF8)); m_colorPickers[1] = ColorPicker(m_ui.color1, QColor(0xA8, 0xA8, 0xA8)); m_colorPickers[2] = ColorPicker(m_ui.color2, QColor(0x50, 0x50, 0x50)); @@ -86,6 +87,7 @@ OverrideView::OverrideView(ConfigController* config, QWidget* parent) m_gbColors[colorId] = color.rgb() | 0xFF000000; }); } +#endif #ifndef M_CORE_GBA m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.tabGBA)); From d3ec40b392db348f3ab1273e90d68e32e7717a15 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 30 Nov 2019 11:37:36 -0800 Subject: [PATCH 20/30] GB Memory: Support manual SRAM editing (fixes #1580) --- CHANGES | 2 ++ src/gb/memory.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index a451feeaa..c709f3851 100644 --- a/CHANGES +++ b/CHANGES @@ -97,6 +97,8 @@ Other fixes: - Core: Fix uninitialized memory issues with graphics caches - Vita: Fix analog controls (fixes mgba.io/i/1554) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) +Misc: + - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) 0.8 beta 1: (2019-10-20) - Initial beta for 0.8 diff --git a/src/gb/memory.c b/src/gb/memory.c index e5817cefe..e60fbde18 100644 --- a/src/gb/memory.c +++ b/src/gb/memory.c @@ -649,7 +649,15 @@ void GBPatch8(struct LR35902Core* cpu, uint16_t address, int8_t value, int8_t* o break; case GB_REGION_EXTERNAL_RAM: case GB_REGION_EXTERNAL_RAM + 1: - mLOG(GB_MEM, STUB, "Unimplemented memory Patch8: 0x%08X", address); + if (memory->rtcAccess) { + memory->rtcRegs[memory->activeRtcReg] = value; + } else if (memory->sramAccess && memory->sram && memory->mbcType != GB_MBC2) { + // TODO: Remove sramAccess check? + memory->sramBank[address & (GB_SIZE_EXTERNAL_RAM - 1)] = value; + } else { + memory->mbcWrite(gb, address, value); + } + gb->sramDirty |= GB_SRAM_DIRT_NEW; return; case GB_REGION_WORKING_RAM_BANK0: case GB_REGION_WORKING_RAM_BANK0 + 2: From c300da9be6e85928dc6068aaadc3f9275e476418 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 2 Dec 2019 19:18:48 -0800 Subject: [PATCH 21/30] Qt: Incomplete non-GBA build fixes --- src/platform/qt/CheatsView.cpp | 1 - src/platform/qt/MultiplayerController.cpp | 4 ++++ src/platform/qt/MultiplayerController.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platform/qt/CheatsView.cpp b/src/platform/qt/CheatsView.cpp index 4a631c932..567400cdb 100644 --- a/src/platform/qt/CheatsView.cpp +++ b/src/platform/qt/CheatsView.cpp @@ -129,7 +129,6 @@ void CheatsView::addSet() { } void CheatsView::removeSet() { - GBACheatSet* set; QModelIndexList selection = m_ui.cheatList->selectionModel()->selectedIndexes(); if (selection.count() < 1) { return; diff --git a/src/platform/qt/MultiplayerController.cpp b/src/platform/qt/MultiplayerController.cpp index 8387d3f03..ca2f048d3 100644 --- a/src/platform/qt/MultiplayerController.cpp +++ b/src/platform/qt/MultiplayerController.cpp @@ -22,11 +22,13 @@ MultiplayerController::Player::Player(CoreController* coreController, GBSIOLocks { } +#ifdef M_CORE_GBA MultiplayerController::Player::Player(CoreController* coreController, GBASIOLockstepNode* node) : controller(coreController) , gbaNode(node) { } +#endif MultiplayerController::MultiplayerController() { mLockstepInit(&m_lockstep); @@ -71,10 +73,12 @@ MultiplayerController::MultiplayerController() { if (!id) { for (int i = 1; i < controller->m_players.count(); ++i) { Player* player = &controller->m_players[i]; +#ifdef M_CORE_GBA if (player->controller->platform() == PLATFORM_GBA && player->gbaNode->d.p->mode != controller->m_players[0].gbaNode->d.p->mode) { player->controller->setSync(true); continue; } +#endif player->controller->setSync(false); player->cyclesPosted += cycles; if (player->awake < 1) { diff --git a/src/platform/qt/MultiplayerController.h b/src/platform/qt/MultiplayerController.h index 4614c5c6f..03aad86d8 100644 --- a/src/platform/qt/MultiplayerController.h +++ b/src/platform/qt/MultiplayerController.h @@ -45,8 +45,12 @@ signals: private: struct Player { +#ifdef M_CORE_GB Player(CoreController* controller, GBSIOLockstepNode* node); +#endif +#ifdef M_CORE_GBA Player(CoreController* controller, GBASIOLockstepNode* node); +#endif CoreController* controller; GBSIOLockstepNode* gbNode = nullptr; From e51d3e105ffedc5c983165fc7ae24ebda8786148 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 5 Dec 2019 16:19:54 -0800 Subject: [PATCH 22/30] Qt: Fix scrollbar arrows in memory view (fixes #1558) --- CHANGES | 1 + src/platform/qt/MemoryModel.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGES b/CHANGES index c709f3851..52da99df1 100644 --- a/CHANGES +++ b/CHANGES @@ -97,6 +97,7 @@ Other fixes: - Core: Fix uninitialized memory issues with graphics caches - Vita: Fix analog controls (fixes mgba.io/i/1554) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) + - Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558) Misc: - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) diff --git a/src/platform/qt/MemoryModel.cpp b/src/platform/qt/MemoryModel.cpp index dfdc6c113..98d743067 100644 --- a/src/platform/qt/MemoryModel.cpp +++ b/src/platform/qt/MemoryModel.cpp @@ -88,6 +88,19 @@ MemoryModel::MemoryModel(QWidget* parent) update(); }); + connect(verticalScrollBar(), &QSlider::actionTriggered, [this](int action) { + if (action == QSlider::SliderSingleStepAdd) { + ++m_top; + } else if (action == QSlider::SliderSingleStepSub) { + --m_top; + } else { + return; + } + boundsCheck(); + verticalScrollBar()->setValue(m_top); + update(); + }); + setRegion(0, 0x10000000, tr("All")); } From ad84c8f3c47420e5f526932dc49f21a6824e4b30 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 13 Dec 2019 00:35:48 -0800 Subject: [PATCH 23/30] Travis: Fix macOS builds --- .travis-deps.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis-deps.sh b/.travis-deps.sh index cf70b5010..88cffd263 100755 --- a/.travis-deps.sh +++ b/.travis-deps.sh @@ -1,5 +1,4 @@ #!/bin/sh -set -e if [ $TRAVIS_OS_NAME = "osx" ]; then brew update brew install qt5 ffmpeg imagemagick sdl2 libedit libelf libpng libzip From b7bbe0a2078954b2f2e61e1813b789dc65356653 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 13 Dec 2019 00:57:14 -0800 Subject: [PATCH 24/30] Travis: Remove imagemagick dependency --- .travis-deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis-deps.sh b/.travis-deps.sh index 88cffd263..27f885203 100755 --- a/.travis-deps.sh +++ b/.travis-deps.sh @@ -1,7 +1,7 @@ #!/bin/sh if [ $TRAVIS_OS_NAME = "osx" ]; then brew update - brew install qt5 ffmpeg imagemagick sdl2 libedit libelf libpng libzip + brew install qt5 ffmpeg sdl2 libedit libelf libpng libzip else sudo apt-get update sudo apt-get -y install libseccomp2 From 2583c5cae8099c1f5babf8782cc5e0ba520a9740 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 14 Dec 2019 13:09:09 -0800 Subject: [PATCH 25/30] Qt: Fix several cases where shader selections don't get saved --- CHANGES | 1 + src/platform/qt/ShaderSelector.cpp | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 52da99df1..35613fca5 100644 --- a/CHANGES +++ b/CHANGES @@ -98,6 +98,7 @@ Other fixes: - Vita: Fix analog controls (fixes mgba.io/i/1554) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) - Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558) + - Qt: Fix several cases where shader selections don't get saved Misc: - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) diff --git a/src/platform/qt/ShaderSelector.cpp b/src/platform/qt/ShaderSelector.cpp index 759cf6c7e..cf7f999a0 100644 --- a/src/platform/qt/ShaderSelector.cpp +++ b/src/platform/qt/ShaderSelector.cpp @@ -33,6 +33,7 @@ ShaderSelector::ShaderSelector(Display* display, ConfigController* config, QWidg : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) , m_display(display) , m_config(config) + , m_shaderPath(config->getOption("shader")) { m_ui.setupUi(this); @@ -41,9 +42,6 @@ ShaderSelector::ShaderSelector(Display* display, ConfigController* config, QWidg connect(m_ui.load, &QAbstractButton::clicked, this, &ShaderSelector::selectShader); connect(m_ui.unload, &QAbstractButton::clicked, this, &ShaderSelector::clearShader); connect(m_ui.buttonBox, &QDialogButtonBox::clicked, this, &ShaderSelector::buttonPressed); - connect(this, &ShaderSelector::saved, [this]() { - m_config->setOption("shader", m_shaderPath); - }); } ShaderSelector::~ShaderSelector() { @@ -85,12 +83,14 @@ void ShaderSelector::loadShader(const QString& path) { m_display->setShaders(shader); shader->close(shader); m_shaderPath = path; + m_config->setOption("shader", m_shaderPath); } void ShaderSelector::clearShader() { m_display->clearShaders(); refreshShaders(); m_shaderPath = ""; + m_config->setOption("shader", m_shaderPath); } void ShaderSelector::refreshShaders() { @@ -119,10 +119,6 @@ void ShaderSelector::refreshShaders() { disconnect(this, &ShaderSelector::reset, 0, 0); disconnect(this, &ShaderSelector::resetToDefault, 0, 0); - connect(this, &ShaderSelector::saved, [this]() { - m_config->setOption("shader", m_shaderPath); - }); - #if !defined(_WIN32) || defined(USE_EPOXY) if (m_shaders->preprocessShader) { m_ui.passes->addTab(makePage(static_cast(m_shaders->preprocessShader), "default", 0), tr("Preprocessing")); From 0707cc2cc05e7dafc906822f32b01a9e7bcd335c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 14 Dec 2019 16:43:50 -0800 Subject: [PATCH 26/30] SDL: Use controller GUID instead of name --- src/platform/qt/GBAKeyEditor.cpp | 2 +- src/platform/qt/InputController.cpp | 6 ++++-- src/platform/qt/InputController.h | 2 +- src/platform/sdl/sdl-events.c | 33 ++++++++++++++++------------- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/platform/qt/GBAKeyEditor.cpp b/src/platform/qt/GBAKeyEditor.cpp index 03d0769e2..f1ef98d61 100644 --- a/src/platform/qt/GBAKeyEditor.cpp +++ b/src/platform/qt/GBAKeyEditor.cpp @@ -232,7 +232,7 @@ void GBAKeyEditor::save() { #ifdef BUILD_SDL if (m_profileSelect) { - m_controller->setPreferredGamepad(m_type, m_profileSelect->currentText()); + m_controller->setPreferredGamepad(m_type, m_profileSelect->currentIndex()); } #endif diff --git a/src/platform/qt/InputController.cpp b/src/platform/qt/InputController.cpp index 9935626bc..77ee07042 100644 --- a/src/platform/qt/InputController.cpp +++ b/src/platform/qt/InputController.cpp @@ -267,11 +267,13 @@ void InputController::setGamepad(uint32_t type, int index) { #endif } -void InputController::setPreferredGamepad(uint32_t type, const QString& device) { +void InputController::setPreferredGamepad(uint32_t type, int index) { if (!m_config) { return; } - mInputSetPreferredDevice(m_config->input(), "gba", type, m_playerId, device.toUtf8().constData()); + char name[34] = {0}; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_JoystickListGetPointer(&s_sdlEvents.joysticks, index)->joystick), name, sizeof(name)); + mInputSetPreferredDevice(m_config->input(), "gba", type, m_playerId, name); } mRumble* InputController::rumble() { diff --git a/src/platform/qt/InputController.h b/src/platform/qt/InputController.h index 6418343c1..5c2c8502e 100644 --- a/src/platform/qt/InputController.h +++ b/src/platform/qt/InputController.h @@ -83,7 +83,7 @@ public: QStringList connectedGamepads(uint32_t type) const; int gamepad(uint32_t type) const; void setGamepad(uint32_t type, int index); - void setPreferredGamepad(uint32_t type, const QString& device); + void setPreferredGamepad(uint32_t type, int index); void registerTiltAxisX(int axis); void registerTiltAxisY(int axis); diff --git a/src/platform/sdl/sdl-events.c b/src/platform/sdl/sdl-events.c index 93243a1db..d29bfb378 100644 --- a/src/platform/sdl/sdl-events.c +++ b/src/platform/sdl/sdl-events.c @@ -201,15 +201,15 @@ bool mSDLAttachPlayer(struct mSDLEvents* events, struct mSDLPlayer* player) { firstUnclaimed = i; } - const char* joystickName; #if SDL_VERSION_ATLEAST(2, 0, 0) - joystickName = SDL_JoystickName(SDL_JoystickListGetPointer(&events->joysticks, i)->joystick); + char joystickName[34] = {0}; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_JoystickListGetPointer(&events->joysticks, i)->joystick), joystickName, sizeof(joystickName)); #else - joystickName = SDL_JoystickName(SDL_JoystickIndex(SDL_JoystickListGetPointer(&events->joysticks, i)->joystick)); -#endif + const char* joystickName = SDL_JoystickName(SDL_JoystickIndex(SDL_JoystickListGetPointer(&events->joysticks, i)->joystick)); if (!joystickName) { continue; } +#endif if (events->preferredJoysticks[player->playerId] && strcmp(events->preferredJoysticks[player->playerId], joystickName) == 0) { index = i; break; @@ -256,13 +256,14 @@ void mSDLPlayerLoadConfig(struct mSDLPlayer* context, const struct Configuration if (context->joystick) { mInputMapLoad(context->bindings, SDL_BINDING_BUTTON, config); #if SDL_VERSION_ATLEAST(2, 0, 0) - const char* name = SDL_JoystickName(context->joystick->joystick); + char name[34] = {0}; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(context->joystick->joystick), name, sizeof(name)); #else const char* name = SDL_JoystickName(SDL_JoystickIndex(context->joystick->joystick)); -#endif if (!name) { return; } +#endif mInputProfileLoad(context->bindings, SDL_BINDING_BUTTON, config, name); const char* value; @@ -310,13 +311,14 @@ void mSDLPlayerLoadConfig(struct mSDLPlayer* context, const struct Configuration void mSDLPlayerSaveConfig(const struct mSDLPlayer* context, struct Configuration* config) { if (context->joystick) { #if SDL_VERSION_ATLEAST(2, 0, 0) - const char* name = SDL_JoystickName(context->joystick->joystick); + char name[34] = {0}; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(context->joystick->joystick), name, sizeof(name)); #else const char* name = SDL_JoystickName(SDL_JoystickIndex(context->joystick->joystick)); -#endif if (!name) { return; } +#endif char value[16]; snprintf(value, sizeof(value), "%i", context->rotation.axisX); mInputSetCustomValue(config, "gba", SDL_BINDING_BUTTON, "tiltAxisX", value, name); @@ -357,14 +359,15 @@ void mSDLUpdateJoysticks(struct mSDLEvents* events, const struct Configuration* joystick->haptic = SDL_HapticOpenFromJoystick(joystick->joystick); #endif - const char* joystickName; -#if SDL_VERSION_ATLEAST(2, 0, 0) - joystickName = SDL_JoystickName(joystick->joystick); -#else - joystickName = SDL_JoystickName(SDL_JoystickIndex(joystick->joystick)); -#endif size_t i; - if (joystickName) { +#if SDL_VERSION_ATLEAST(2, 0, 0) + char joystickName[34] = {0}; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick->joystick), joystickName, sizeof(joystickName)); +#else + const char* joystickName = SDL_JoystickName(SDL_JoystickIndex(joystick->joystick)); + if (joystickName) +#endif + { for (i = 0; (int) i < events->playersAttached; ++i) { if (events->players[i]->joystick) { continue; From f4c657c5378977cfe24372c4df0b53caddf0eeed Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 18 Dec 2019 18:19:56 -0800 Subject: [PATCH 27/30] CHANGES: Update --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 35613fca5..26685c872 100644 --- a/CHANGES +++ b/CHANGES @@ -101,6 +101,7 @@ Other fixes: - Qt: Fix several cases where shader selections don't get saved Misc: - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) + - SDL: Use controller GUID instead of name 0.8 beta 1: (2019-10-20) - Initial beta for 0.8 From 1002dfd0dbd86950145493c82ff1af7744e60c81 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 18 Dec 2019 18:21:01 -0800 Subject: [PATCH 28/30] Core: Return null for out of bounds cached tile VRAM querying --- CHANGES | 1 + src/core/tile-cache.c | 4 ++++ src/platform/qt/AssetView.cpp | 3 +++ 3 files changed, 8 insertions(+) diff --git a/CHANGES b/CHANGES index 26685c872..6dc5bcdce 100644 --- a/CHANGES +++ b/CHANGES @@ -95,6 +95,7 @@ Emulation fixes: Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Core: Fix uninitialized memory issues with graphics caches + - Core: Return null for out of bounds cached tile VRAM querying - Vita: Fix analog controls (fixes mgba.io/i/1554) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) - Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558) diff --git a/src/core/tile-cache.c b/src/core/tile-cache.c index 8272c52fa..89b4a52cb 100644 --- a/src/core/tile-cache.c +++ b/src/core/tile-cache.c @@ -281,5 +281,9 @@ const color_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId } const uint16_t* mTileCacheGetVRAM(struct mTileCache* cache, unsigned tileId) { + unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig); + if (tileId >= tiles) { + return NULL; + } return &cache->vram[tileId << (cache->bpp + 2)]; } diff --git a/src/platform/qt/AssetView.cpp b/src/platform/qt/AssetView.cpp index f77b779bb..20dbd1641 100644 --- a/src/platform/qt/AssetView.cpp +++ b/src/platform/qt/AssetView.cpp @@ -66,6 +66,9 @@ void AssetView::showEvent(QShowEvent*) { } void AssetView::compositeTile(const void* tBuffer, void* buffer, size_t stride, size_t x, size_t y, int depth) { + if (!tBuffer) { + return; + } const uint8_t* tile = static_cast(tBuffer); uint8_t* pixels = static_cast(buffer); size_t base = stride * y + x; From 2cb5a08f4f02468e351cab80a92f5803ec3356cf Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 18 Dec 2019 18:23:40 -0800 Subject: [PATCH 29/30] Qt: Fix division by zero error in invalid TilePainter state --- CHANGES | 1 + src/platform/qt/TilePainter.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 6dc5bcdce..09a028618 100644 --- a/CHANGES +++ b/CHANGES @@ -100,6 +100,7 @@ Other fixes: - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) - Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558) - Qt: Fix several cases where shader selections don't get saved + - Qt: Fix division by zero error in invalid TilePainter state Misc: - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) - SDL: Use controller GUID instead of name diff --git a/src/platform/qt/TilePainter.cpp b/src/platform/qt/TilePainter.cpp index b9417b827..127b31058 100644 --- a/src/platform/qt/TilePainter.cpp +++ b/src/platform/qt/TilePainter.cpp @@ -26,6 +26,9 @@ void TilePainter::paintEvent(QPaintEvent* event) { void TilePainter::resizeEvent(QResizeEvent* event) { int w = width() / m_size; + if (!w) { + w = 1; + } int calculatedHeight = (m_tileCount + w - 1) * m_size / w; calculatedHeight -= calculatedHeight % m_size; if (width() / m_size != m_backing.width() / m_size || m_backing.height() != calculatedHeight) { From 780b4521cf14abf3b76a47406b4de17ec3f0d9fb Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 20 Dec 2019 21:08:28 -0800 Subject: [PATCH 30/30] ARM: Fix stepping when events are pending --- CHANGES | 1 + src/arm/arm.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 09a028618..353c58498 100644 --- a/CHANGES +++ b/CHANGES @@ -89,6 +89,7 @@ Changes from beta 1: Emulation fixes: - ARM: Fix STR writeback pipeline stage - ARM: Partially fix LDM/STM writeback with empty register list + - ARM: Fix stepping when events are pending - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) - GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572) - GBA Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575) diff --git a/src/arm/arm.c b/src/arm/arm.c index bd8c3b565..747a1aac7 100644 --- a/src/arm/arm.c +++ b/src/arm/arm.c @@ -276,14 +276,14 @@ static inline void ThumbStep(struct ARMCore* cpu) { } void ARMRun(struct ARMCore* cpu) { + while (cpu->cycles >= cpu->nextEvent) { + cpu->irqh.processEvents(cpu); + } if (cpu->executionMode == MODE_THUMB) { ThumbStep(cpu); } else { ARMStep(cpu); } - if (cpu->cycles >= cpu->nextEvent) { - cpu->irqh.processEvents(cpu); - } } void ARMRunLoop(struct ARMCore* cpu) {