Merge remote-tracking branch 'upstream/0.6'

This commit is contained in:
Sérgio Benjamim 2017-07-12 21:57:30 -03:00
commit 4304cc9560
15 changed files with 1378 additions and 1147 deletions

259
CHANGES
View File

@ -1,184 +1,187 @@
0.6.0: (Future) 0.6.0: (Future)
Features: Features:
- GBA: Support printing debug strings from inside a game - Library view
- GBA: Better cheat type autodetection
- GB: Tile viewer
- Sprite viewer - Sprite viewer
- Debugging console - Debugging console
- Improved memory viewer - Improved memory viewer
- GB: LR35902/GB-Z80 disassembler - Memory search
- Configuration of gamepad hats
- Qt: Spanish translation (by Kevin López)
- Add option for whether rewinding restores save games
- Qt: German translation (by Lothar Serra Mari)
- Savestates now contain any RTC override data
- Command line ability to override configuration values - Command line ability to override configuration values
- Add option to allow preloading the entire ROM before running - Add option to allow preloading the entire ROM before running
- GB: Video/audio channel enabling/disabling - Add option for whether rewinding restores save games
- Savestates now contain any RTC override data
- Add option to lock video to integer scaling - Add option to lock video to integer scaling
- Video log recording for testing and bug reporting - LR35902: Watchpoints
- Library view - LR35902/GB-Z80 disassembler
- Debugger: Segment/bank support - GB: Tile viewer
- GB: Video/audio channel enabling/disabling
- GB: Symbol table support - GB: Symbol table support
- GB MBC: Add MBC1 multicart support - GB MBC: Add MBC1 multicart support
- GBA: Support printing debug strings from inside a game
- GBA: Better cheat type autodetection
- Implement keypad interrupts - Implement keypad interrupts
- LR35902: Watchpoints - Configuration of gamepad hats
- Memory search - Video log recording for testing and bug reporting
- Debugger: Segment/bank support
- Debugger: Execution tracing - Debugger: Execution tracing
- Partial Python scripting support
- Qt: German translation (by Lothar Serra Mari)
- Qt: Spanish translation (by Kevin López)
- Qt: Italian translation (by theheroGAC) - Qt: Italian translation (by theheroGAC)
Bugfixes: Bugfixes:
- LR35902: Fix core never exiting with certain event patterns
- GB Timer: Improve DIV reset behavior
- GBA Memory: Improve initial skipped BIOS state
- GBA BIOS: Implement BitUnPack
- ARM7: Fix MLA/*MULL/*MLAL timing - ARM7: Fix MLA/*MULL/*MLAL timing
- GBA: Fix multiboot ROM loading
- Libretro: Fix saving in GB games (fixes mgba.io/i/486)
- LR35902: Fix pc overflowing current region off-by-one
- GB MBC: Fix ROM bank overflows getting set to bank 0
- Qt: Fix timing issues on high refresh rate monitors
- GBA Savedata: Fix savedata unmasking (fixes mgba.io/i/441)
- Util: Fix overflow when loading invalid UPS patches
- Tools: Fix recurring multiple times over the same library
- GBA I/O: Handle audio registers specially when deserializing
- Util: Fix highest-fd socket not being returned by SocketAccept
- Qt: Fix linking after some windows have been closed
- GBA Video: Fix wrong palette on 256-color sprites in OBJWIN
- Windows: Fix VDir.rewind
- SDL: Fix game crash check
- SDL: Fix race condition with audio thread when starting
- GB: Fix flickering when screen is strobed quickly
- FFmpeg: Fix overflow and general issues with audio encoding
- Qt: Fix crash when changing audio settings after a game is closed
- GBA BIOS: Fix ArcTan sign in HLE BIOS
- GBA BIOS: Fix ArcTan2 sign in HLE BIOS (fixes mgba.io/i/689)
- GBA Video: Don't update background scanline params in mode 0 (fixes mgba.io/i/377)
- Qt: Ensure CLI backend is attached when submitting commands (fixes mgba.io/i/662)
- Core: Fix crash with rewind if savestates shrink - Core: Fix crash with rewind if savestates shrink
- Test: Fix crash when loading invalid file
- GBA Hardware: Fix crash if a savestate lies about game hardware
- Test: Fix crash when fuzzing fails to load a file
- GBA: Fix multiboot loading resulting in too small WRAM
- Test: Don't rely on core for frames elapsed
- Test: Fix crash when loading invalid file
- GBA Hardware: Fix crash if a savestate lies about game hardware
- Test: Fix crash when fuzzing fails to load a file
- Qt: Disable "New multiplayer window" when MAX_GBAS is reached (fixes mgba.io/i/107)
- LR35902: Fix decoding LD r, $imm and 0-valued immediates (fixes mgba.io/i/735)
- GB: Fix STAT blocking
- GB MBC: Fix swapping carts not detect new MBC
- GB Timer: Fix DIV batching if TAC changes
- GB Video: Reset renderer when loading state
- GBA BIOS: Fix INT_MIN/-1 crash
- GBA Savedata: Update and fix Sharkport importing (fixes mgba.io/i/658)
- OpenGL: Fix some shaders causing offset graphics
- Qt: Fix game unpausing after frame advancing and refocusing
- GB Timer: Fix sub-M-cycle DIV reset timing and edge triggering
- Core: Fix interrupting a thread while on the thread (fixes mgba.io/i/692) - Core: Fix interrupting a thread while on the thread (fixes mgba.io/i/692)
- Core: Fix directory sets crashing on close if base isn't properly detached - Core: Fix directory sets crashing on close if base isn't properly detached
- Qt: Fix window icon being stretched - FFmpeg: Fix overflow and general issues with audio encoding
- Qt: Fix data directory path - GB: Fix flickering when screen is strobed quickly
- GB: Fix STAT blocking
- GB MBC: Fix ROM bank overflows getting set to bank 0
- GB MBC: Fix swapping carts not detect new MBC
- GB Timer: Improve DIV reset behavior
- GB Timer: Fix DIV batching if TAC changes
- GB Video: Reset renderer when loading state
- GBA: Fix multiboot ROM loading
- GBA: Fix multiboot loading resulting in too small WRAM
- GBA BIOS: Implement BitUnPack
- GBA BIOS: Fix ArcTan sign in HLE BIOS
- GBA BIOS: Fix ArcTan2 sign in HLE BIOS (fixes mgba.io/i/689)
- GBA BIOS: Fix INT_MIN/-1 crash
- GBA Hardware: Fix crash if a savestate lies about game hardware
- GBA I/O: Handle audio registers specially when deserializing
- GBA Memory: Improve initial skipped BIOS state
- GBA Savedata: Fix savedata unmasking (fixes mgba.io/i/441)
- GBA Savedata: Update and fix Sharkport importing (fixes mgba.io/i/658)
- GBA Video: Fix wrong palette on 256-color sprites in OBJWIN
- GBA Video: Don't update background scanline params in mode 0 (fixes mgba.io/i/377)
- Libretro: Fix saving in GB games (fixes mgba.io/i/486)
- LR35902: Fix core never exiting with certain event patterns
- LR35902: Fix pc overflowing current region off-by-one
- LR35902: Fix decoding LD r, $imm and 0-valued immediates (fixes mgba.io/i/735)
- OpenGL: Fix some shaders causing offset graphics
- GB Timer: Fix sub-M-cycle DIV reset timing and edge triggering
- Qt: Fix timing issues on high refresh rate monitors
- Qt: Fix linking after some windows have been closed
- Qt: Fix crash when changing audio settings after a game is closed
- Qt: Ensure CLI backend is attached when submitting commands (fixes mgba.io/i/662)
- Qt: Disable "New multiplayer window" when MAX_GBAS is reached (fixes mgba.io/i/107)
- Qt: Fix game unpausing after frame advancing and refocusing
- SDL: Fix game crash check
- SDL: Fix race condition with audio thread when starting
- SDL: Fix showing version number
- Test: Fix crash when loading invalid file
- Test: Fix crash when fuzzing fails to load a file
- Test: Don't rely on core for frames elapsed
- Test: Fix crash when loading invalid file
- Test: Fix crash when fuzzing fails to load a file
- Tools: Fix recurring multiple times over the same library
- Util: Fix overflow when loading invalid UPS patches
- Util: Fix highest-fd socket not being returned by SocketAccept
- Windows: Fix VDir.rewind
Misc: Misc:
- SDL: Remove scancode key input - All: Add C++ header guards
- GBA Video: Clean up unused timers - All: Move time.h include to common.h
- Test: Add a basic test suite
- GBA Video: Allow multiple handles into the same tile cache
- VFS: Call msync when syncing mapped data
- GBA Video, GB Video: Colors are now fully scaled
- VFS: Allow truncating memory chunk VFiles
- Debugger: Modularize CLI debugger
- Core: Clean up some thread state checks
- Debugger: Make building with debugging aspects optional
- GBA Memory: Support for Mo Jie Qi Bing by Vast Fame (taizou)
- GBA Memory: Support reading/writing POSTFLG
- Util: Add size counting to Table
- Qt: Move last directory setting from qt.ini to config.ini
- 3DS, PSP2, Wii: Last directory loaded is saved - 3DS, PSP2, Wii: Last directory loaded is saved
- CMake: Add ability to just print version string
- Core: New, faster event timing subsystem
- Core: Clean up some thread state checks
- Core: Add generic checksum function
- Core: Cores can now have multiple sets of callbacks
- Core: Restore sleep callback
- Core: Move rewind diffing to its own thread
- Core: Ability to enumerate and modify video and audio channels
- Core: List memory segments in the core
- Core: Move savestate creation time to extdata
- Core: Config values can now be hexadecimal
- Core: Improved threading interrupted detection
- Debugger: Modularize CLI debugger
- Debugger: Make building with debugging aspects optional
- Debugger: Add functions for read- or write-only watchpoints
- Debugger: Make attaching a backend idempotent
- Debugger: Add mDebuggerRunFrame convenience function
- Feature: Move game database from flatfile to SQLite3
- Feature: Support ImageMagick 7
- Feature: Make -l option explicit
- FFmpeg: Return false if a file fails to open
- FFmpeg: Force MP4 files to YUV420P
- GB: Trust ROM header for number of SRAM banks (fixes mgba.io/i/726)
- GB: Reset with initial state of DIV register
- GB MBC: New MBC7 implementation
- GB Audio: Simplify envelope code - GB Audio: Simplify envelope code
- GB Audio: Improve initial envelope samples - GB Audio: Improve initial envelope samples
- Debugger: Add functions for read- or write-only watchpoints - GB Audio: Start implementing "zombie" audio (fixes mgba.io/i/389)
- GB Video: Improved video timings
- GBA: Ignore invalid opcodes used by the Wii U VC emulator
- GBA, GB: ROM is now unloaded if a patch is applied
- GBA DMA: Refactor DMA out of memory.c - GBA DMA: Refactor DMA out of memory.c
- GBA DMA: Move DMAs to using absolute timing - GBA DMA: Move DMAs to using absolute timing
- All: Add C++ header guards
- GBA I/O: Clear JOYSTAT RECV flag when reading JOY_RECV registers - GBA I/O: Clear JOYSTAT RECV flag when reading JOY_RECV registers
- GBA I/O: Set JOYSTAT TRANS flag when writing JOY_TRANS registers - GBA I/O: Set JOYSTAT TRANS flag when writing JOY_TRANS registers
- GBA Memory: Support for Mo Jie Qi Bing by Vast Fame (taizou)
- GBA Memory: Support reading/writing POSTFLG
- GBA Memory: Remove unused prefetch cruft
- GBA Timer: Improve accuracy of timers
- GBA Video: Clean up unused timers
- GBA Video: Allow multiple handles into the same tile cache
- GBA Video, GB Video: Colors are now fully scaled
- GBA Video: Optimize when BLD* registers are written frequently
- OpenGL: Add xBR-lv2 shader
- Qt: Move last directory setting from qt.ini to config.ini
- Qt: Improved HiDPI support - Qt: Improved HiDPI support
- Qt: Expose configuration directory - Qt: Expose configuration directory
- Feature: Move game database from flatfile to SQLite3
- GB Audio: Start implementing "zombie" audio (fixes mgba.io/i/389)
- VFS: Fix some minor VFile issues with FILEs
- Core: Add generic checksum function
- Feature: Support ImageMagick 7
- All: Move time.h include to common.h
- CMake: Add ability to just print version string
- Qt: Merge "Save" and "OK" buttons in shader options - Qt: Merge "Save" and "OK" buttons in shader options
- SDL: Automatically map controllers when plugged in
- Qt: Automatically load controller profile when plugged in - Qt: Automatically load controller profile when plugged in
- OpenGL: Add xBR-lv2 shader
- GBA, GB: ROM is now unloaded if a patch is applied
- Util: Add 8-bit PNG write support
- Qt: Rename "Resample video" option to "Bilinear filtering" - Qt: Rename "Resample video" option to "Bilinear filtering"
- GBA Video: Optimize when BLD* registers are written frequently
- Core: Cores can now have multiple sets of callbacks
- GBA: Ignore invalid opcodes used by the Wii U VC emulator
- Qt: Remove audio thread - Qt: Remove audio thread
- Qt: Remove audio buffer sizing in AudioProcessorQt - Qt: Remove audio buffer sizing in AudioProcessorQt
- Qt: Re-enable QtMultimedia on Windows - Qt: Re-enable QtMultimedia on Windows
- FFmpeg: Return false if a file fails to open
- FFmpeg: Force MP4 files to YUV420P
- Qt: Make "Mute" able to be bound to a key - Qt: Make "Mute" able to be bound to a key
- Core: Restore sleep callback
- Qt: Add .gb/.gbc files to the extension list in Info.plist - Qt: Add .gb/.gbc files to the extension list in Info.plist
- Feature: Make -l option explicit - Qt: Relax hard dependency on OpenGL
- Core: Ability to enumerate and modify video and audio channels - Qt: Better highlight active key in control binding
- Debugger: Make attaching a backend idempotent - SDL: Remove scancode key input
- SDL: Automatically map controllers when plugged in
- Test: Add a basic test suite
- Util: Add size counting to Table
- Util: Add 8-bit PNG write support
- Util: Tune patch-fast extent sizes
- VFS: Call msync when syncing mapped data
- VFS: Allow truncating memory chunk VFiles
- VFS: Fix some minor VFile issues with FILEs
- VFS: Optimize expanding in-memory files - VFS: Optimize expanding in-memory files
- VFS: Add VFileFIFO for operating on circle buffers - VFS: Add VFileFIFO for operating on circle buffers
- Core: Move rewind diffing to its own thread Changes from beta 1:
- Util: Tune patch-fast extent sizes
- Qt: Relax hard dependency on OpenGL
- GB Video: Improved video timings
- Core: List memory segments in the core
- Core: Move savestate creation time to extdata
- Debugger: Add mDebuggerRunFrame convenience function
- GBA Memory: Remove unused prefetch cruft
- GB: Trust ROM header for number of SRAM banks (fixes mgba.io/i/726)
- Core: Config values can now be hexadecimal
- GB: Reset with initial state of DIV register
- GB MBC: New MBC7 implementation
- Qt: Better highlight active key in control binding
- Core: Improved threading interrupted detection
- GBA Timer: Improve accuracy of timers
0.6 beta 2: (Future)
Features: Features:
- Qt: Italian translation (by theheroGAC) - Qt: Italian translation (by theheroGAC)
- Qt: Updated German translation - Qt: Updated German translation
Bugfixes: Bugfixes:
- Core: Fix rewinding getting out of sync (fixes mgba.io/i/791)
- GB Audio: Fix incorrect channel 4 iteration
- GB Audio: Fix zombie mode bit masking
- GB Serialize: Fix timer serialization
- GB Video: Fix LYC regression
- GBA SIO: Improve SIO Normal dummy driver (fixes mgba.io/i/520)
- GBA Timer: Fix count-up timing overflowing timer 3
- PSP2: Use custom localtime_r since newlib version is broken (fixes mgba.io/i/560)
- Qt: Fix memory search close button (fixes mgba.io/i/769) - Qt: Fix memory search close button (fixes mgba.io/i/769)
- Qt: Fix window icon being stretched - Qt: Fix window icon being stretched
- Qt: Fix initial window size (fixes mgba.io/i/766) - Qt: Fix initial window size (fixes mgba.io/i/766)
- Qt: Fix data directory path - Qt: Fix data directory path
- Qt: Fix controls not saving on non-SDL builds - Qt: Fix controls not saving on non-SDL builds
- GB Video: Fix LYC regression
- Qt: Fix translation initialization (fixes mgba.io/i/776) - Qt: Fix translation initialization (fixes mgba.io/i/776)
- PSP2: Use custom localtime_r since newlib version is broken (fixes mgba.io/i/560)
- GBA SIO: Improve SIO Normal dummy driver (fixes mgba.io/i/520)
- Qt: Fix patch loading while a game is running - Qt: Fix patch loading while a game is running
- Qt: Fix shader selector on Ubuntu (fixes mgba.io/i/767) - Qt: Fix shader selector on Ubuntu (fixes mgba.io/i/767)
- GB Serialize: Fix timer serialization - Qt: Fix GL-less build
- GB Audio: Fix incorrect channel 4 iteration - Qt: Fix Software renderer not handling alpha bits properly
- GB Audio: Fix zombie mode bit masking
- GBA Timer: Fix count-up timing overflowing timer 3
Misc: Misc:
- Qt: Add language selector
- GBA Timer: Improve accuracy of timers
- Qt: Minor test fixes
- PSP2: Update toolchain to use vita.cmake
- Qt: Move shader settings into main settings window
- GB Serialize: Add MBC state serialization - GB Serialize: Add MBC state serialization
- Qt: Dismiss game crashing/failing dialogs when a new game loads
- GBA Memory: Call crash callbacks regardless of if hard crash is enabled - GBA Memory: Call crash callbacks regardless of if hard crash is enabled
- GBA Timer: Improve accuracy of timers
- PSP2: Update toolchain to use vita.cmake
- Qt: Add language selector
- Qt: Minor text fixes
- Qt: Move shader settings into main settings window
- Qt: Dismiss game crashing/failing dialogs when a new game loads
- Qt: Properly ship Qt translations
- SDL: Remove writing back obtained samples (fixes mgba.io/i/768) - SDL: Remove writing back obtained samples (fixes mgba.io/i/768)
0.6 beta 1: (2017-06-29) 0.6 beta 1: (2017-06-29)

View File

@ -718,7 +718,7 @@ if(NOT SKIP_LIBRARY)
target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB}) target_link_libraries(${BINARY_NAME} ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB})
install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME}) install(TARGETS ${BINARY_NAME} LIBRARY DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME} NAMELINK_SKIP ARCHIVE DESTINATION ${LIBDIR} RUNTIME DESTINATION ${LIBDIR} COMPONENT lib${BINARY_NAME})
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE AND NOT HAIKU)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/mgba-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})
@ -846,7 +846,7 @@ if(BUILD_EXAMPLE)
endif() endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_BINARY_DIR}/flags.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/flags.h.in ${CMAKE_CURRENT_BINARY_DIR}/flags.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/flags.h DESTINATION include/mgba COMPONENT lib${BINARY_NAME}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/flags.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mgba COMPONENT lib${BINARY_NAME})
# Packaging # Packaging
set(CPACK_PACKAGE_VERSION ${VERSION_STRING}) set(CPACK_PACKAGE_VERSION ${VERSION_STRING})

View File

@ -31,6 +31,7 @@ struct mCoreRewindContext {
Thread thread; Thread thread;
Condition cond; Condition cond;
Mutex mutex; Mutex mutex;
bool ready;
#endif #endif
}; };

View File

@ -30,6 +30,7 @@ void mCoreRewindContextInit(struct mCoreRewindContext* context, size_t entries,
context->stateFlags = SAVESTATE_SAVEDATA; context->stateFlags = SAVESTATE_SAVEDATA;
#ifndef DISABLE_THREADING #ifndef DISABLE_THREADING
context->onThread = onThread; context->onThread = onThread;
context->ready = false;
if (onThread) { if (onThread) {
MutexInit(&context->mutex); MutexInit(&context->mutex);
ConditionInit(&context->cond); ConditionInit(&context->cond);
@ -73,6 +74,7 @@ void mCoreRewindAppend(struct mCoreRewindContext* context, struct mCore* core) {
context->currentState = nextState; context->currentState = nextState;
#ifndef DISABLE_THREADING #ifndef DISABLE_THREADING
if (context->onThread) { if (context->onThread) {
context->ready = true;
ConditionWake(&context->cond); ConditionWake(&context->cond);
MutexUnlock(&context->mutex); MutexUnlock(&context->mutex);
return; return;
@ -121,6 +123,12 @@ bool mCoreRewindRestore(struct mCoreRewindContext* context, struct mCore* core)
} }
--context->size; --context->size;
mCoreLoadStateNamed(core, context->previousState, context->stateFlags);
if (context->current == 0) {
context->current = mCoreRewindPatchesSize(&context->patchMemory);
}
--context->current;
struct PatchFast* patch = mCoreRewindPatchesGetPointer(&context->patchMemory, context->current); struct PatchFast* patch = mCoreRewindPatchesGetPointer(&context->patchMemory, context->current);
size_t size2 = context->previousState->size(context->previousState); size_t size2 = context->previousState->size(context->previousState);
size_t size = context->currentState->size(context->currentState); size_t size = context->currentState->size(context->currentState);
@ -129,18 +137,12 @@ bool mCoreRewindRestore(struct mCoreRewindContext* context, struct mCore* core)
} }
void* current = context->currentState->map(context->currentState, size, MAP_READ); void* current = context->currentState->map(context->currentState, size, MAP_READ);
void* previous = context->previousState->map(context->previousState, size, MAP_WRITE); void* previous = context->previousState->map(context->previousState, size, MAP_WRITE);
patch->d.applyPatch(&patch->d, current, size, previous, size); patch->d.applyPatch(&patch->d, previous, size, current, size);
context->currentState->unmap(context->currentState, current, size); context->currentState->unmap(context->currentState, current, size);
context->previousState->unmap(context->previousState, previous, size); context->previousState->unmap(context->previousState, previous, size);
mCoreLoadStateNamed(core, context->previousState, context->stateFlags);
struct VFile* nextState = context->previousState; struct VFile* nextState = context->previousState;
context->previousState = context->currentState; context->previousState = context->currentState;
context->currentState = nextState; context->currentState = nextState;
if (context->current == 0) {
context->current = mCoreRewindPatchesSize(&context->patchMemory);
}
--context->current;
#ifndef DISABLE_THREADING #ifndef DISABLE_THREADING
if (context->onThread) { if (context->onThread) {
MutexUnlock(&context->mutex); MutexUnlock(&context->mutex);
@ -154,13 +156,14 @@ THREAD_ENTRY _rewindThread(void* context) {
struct mCoreRewindContext* rewindContext = context; struct mCoreRewindContext* rewindContext = context;
ThreadSetName("Rewind Diff Thread"); ThreadSetName("Rewind Diff Thread");
MutexLock(&rewindContext->mutex); MutexLock(&rewindContext->mutex);
struct VFile* state = rewindContext->currentState;
while (rewindContext->onThread) { while (rewindContext->onThread) {
if (rewindContext->currentState != state) { while (!rewindContext->ready && rewindContext->onThread) {
_rewindDiff(rewindContext); ConditionWait(&rewindContext->cond, &rewindContext->mutex);
state = rewindContext->currentState;
} }
ConditionWait(&rewindContext->cond, &rewindContext->mutex); if (rewindContext->ready) {
_rewindDiff(rewindContext);
}
rewindContext->ready = false;
} }
MutexUnlock(&rewindContext->mutex); MutexUnlock(&rewindContext->mutex);
return 0; return 0;

View File

@ -212,7 +212,9 @@ if(NOT DEFINED DATADIR)
set(DATADIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) set(DATADIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME})
endif() endif()
endif() endif()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt) if(BUILD_GL OR BUILD_GLES2)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/res/shaders DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
endif()
install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt) install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
if(NOT WIN32 AND NOT APPLE) if(NOT WIN32 AND NOT APPLE)
list(APPEND QT_DEFINES DATADIR="${CMAKE_INSTALL_PREFIX}/${DATADIR}") list(APPEND QT_DEFINES DATADIR="${CMAKE_INSTALL_PREFIX}/${DATADIR}")
@ -228,8 +230,20 @@ if(Qt5LinguistTools_FOUND)
else() else()
qt5_add_translation(TRANSLATION_FILES ${TS_FILES}) qt5_add_translation(TRANSLATION_FILES ${TS_FILES})
endif() endif()
set(QT_QM_FILES)
if(QT_STATIC)
get_target_property(QT_CORE_LOCATION Qt5::Core LOCATION)
get_filename_component(QT_CORE_LOCATION ${QT_CORE_LOCATION} DIRECTORY)
get_filename_component(QT_QM_LOCATION "${QT_CORE_LOCATION}/../translations" ABSOLUTE)
foreach(TS ${TS_FILES})
get_filename_component(TS ${TS} NAME)
string(REGEX REPLACE "${BINARY_NAME}-(.*).ts$" "qtbase_\\1.qm" QT_QM "${TS}")
list(APPEND QT_QM_FILES "${QT_QM_LOCATION}/${QT_QM}")
endforeach()
list(APPEND TRANSLATION_FILES ${QT_QM_FILES})
endif()
add_custom_command(OUTPUT ${TRANSLATION_QRC} add_custom_command(OUTPUT ${TRANSLATION_QRC}
COMMAND ${CMAKE_COMMAND} -DTRANSLATION_QRC:FILEPATH="${TRANSLATION_QRC}" -DQM_BASE="${CMAKE_CURRENT_BINARY_DIR}" -P "${CMAKE_CURRENT_SOURCE_DIR}/ts.cmake" COMMAND ${CMAKE_COMMAND} -DTRANSLATION_QRC:FILEPATH="${TRANSLATION_QRC}" -DQM_BASE="${CMAKE_CURRENT_BINARY_DIR}" "-DTRANSLATION_FILES='${TRANSLATION_FILES}'" -P "${CMAKE_CURRENT_SOURCE_DIR}/ts.cmake"
DEPENDS ${TRANSLATION_FILES}) DEPENDS ${TRANSLATION_FILES})
qt5_add_resources(TRANSLATION_RESOURCES ${TRANSLATION_QRC}) qt5_add_resources(TRANSLATION_RESOURCES ${TRANSLATION_QRC})
list(APPEND RESOURCES ${TRANSLATION_RESOURCES}) list(APPEND RESOURCES ${TRANSLATION_RESOURCES})
@ -248,7 +262,7 @@ target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
install(TARGETS ${BINARY_NAME}-qt install(TARGETS ${BINARY_NAME}-qt
RUNTIME DESTINATION bin COMPONENT ${BINARY_NAME}-qt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-qt
BUNDLE DESTINATION Applications COMPONENT ${BINARY_NAME}-qt) BUNDLE DESTINATION Applications COMPONENT ${BINARY_NAME}-qt)
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
find_program(DESKTOP_FILE_INSTALL desktop-file-install) find_program(DESKTOP_FILE_INSTALL desktop-file-install)
@ -263,7 +277,6 @@ if(APPLE OR WIN32)
set_target_properties(${BINARY_NAME}-qt PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) set_target_properties(${BINARY_NAME}-qt PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
endif() endif()
if(APPLE) if(APPLE)
message(STATUS ${CMAKE_SYSTEM_NAME})
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
get_target_property(QTCOCOA Qt5::QCocoaIntegrationPlugin LOCATION) get_target_property(QTCOCOA Qt5::QCocoaIntegrationPlugin LOCATION)
get_target_property(COREAUDIO Qt5::CoreAudioPlugin LOCATION) get_target_property(COREAUDIO Qt5::CoreAudioPlugin LOCATION)

View File

@ -50,7 +50,8 @@ void DisplayQt::framePosted(const uint32_t* buffer) {
m_backing = QImage(reinterpret_cast<const uchar*>(buffer), m_width, m_height, QImage::Format_RGB555); m_backing = QImage(reinterpret_cast<const uchar*>(buffer), m_width, m_height, QImage::Format_RGB555);
#endif #endif
#else #else
m_backing = QImage(reinterpret_cast<const uchar*>(buffer), m_width, m_height, QImage::Format_RGB32); m_backing = QImage(reinterpret_cast<const uchar*>(buffer), m_width, m_height, QImage::Format_ARGB32);
m_backing = m_backing.convertToFormat(QImage::Format_RGB32);
#endif #endif
} }

View File

@ -169,7 +169,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
m_ui.languages->setItemData(0, QLocale("en")); m_ui.languages->setItemData(0, QLocale("en"));
QDir ts(":/translations/"); QDir ts(":/translations/");
for (auto name : ts.entryList()) { for (auto name : ts.entryList()) {
if (!name.endsWith(".qm")) { if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
continue; continue;
} }
QLocale locale(name.remove(QString("%0-").arg(binaryName)).remove(".qm")); QLocale locale(name.remove(QString("%0-").arg(binaryName)).remove(".qm"));
@ -187,17 +187,21 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
} }
SettingsView::~SettingsView() { SettingsView::~SettingsView() {
#if defined(BUILD_GL) || defined(BUILD_GLES)
if (m_shader) { if (m_shader) {
m_ui.stackedWidget->removeWidget(m_shader); m_ui.stackedWidget->removeWidget(m_shader);
m_shader->setParent(nullptr); m_shader->setParent(nullptr);
} }
#endif
} }
void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) { void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
#if defined(BUILD_GL) || defined(BUILD_GLES)
m_shader = shaderSelector; m_shader = shaderSelector;
m_ui.stackedWidget->addWidget(m_shader); m_ui.stackedWidget->addWidget(m_shader);
m_ui.tabs->addItem(tr("Shaders")); m_ui.tabs->addItem(tr("Shaders"));
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved); connect(m_ui.buttonBox, &QDialogButtonBox::accepted, m_shader, &ShaderSelector::saved);
#endif
} }
void SettingsView::selectBios(QLineEdit* bios) { void SettingsView::selectBios(QLineEdit* bios) {

View File

@ -21,6 +21,8 @@
#include <mgba-util/vfs.h> #include <mgba-util/vfs.h>
#include "platform/video-backend.h" #include "platform/video-backend.h"
#if defined(BUILD_GL) || defined(BUILD_GLES)
#if !defined(_WIN32) || defined(USE_EPOXY) #if !defined(_WIN32) || defined(USE_EPOXY)
#include "platform/opengl/gles2.h" #include "platform/opengl/gles2.h"
#endif #endif
@ -280,3 +282,5 @@ void ShaderSelector::buttonPressed(QAbstractButton* button) {
break; break;
} }
} }
#endif

View File

@ -6,6 +6,8 @@
#ifndef QGBA_SHADER_SELECTOR_H #ifndef QGBA_SHADER_SELECTOR_H
#define QGBA_SHADER_SELECTOR_H #define QGBA_SHADER_SELECTOR_H
#if defined(BUILD_GL) || defined(BUILD_GLES)
#include <QDialog> #include <QDialog>
#include "ui_ShaderSelector.h" #include "ui_ShaderSelector.h"
@ -56,3 +58,5 @@ private:
} }
#endif #endif
#endif

View File

@ -78,7 +78,9 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
updateTitle(); updateTitle();
m_display = Display::create(this); m_display = Display::create(this);
#if defined(BUILD_GL) || defined(BUILD_GLES)
m_shaderView = new ShaderSelector(m_display, m_config); m_shaderView = new ShaderSelector(m_display, m_config);
#endif
m_logo.setDevicePixelRatio(m_screenWidget->devicePixelRatio()); m_logo.setDevicePixelRatio(m_screenWidget->devicePixelRatio());
m_logo = m_logo; // Free memory left over in old pixmap m_logo = m_logo; // Free memory left over in old pixmap
@ -274,6 +276,7 @@ void Window::loadConfig() {
enterFullScreen(); enterFullScreen();
} }
#if defined(BUILD_GL) || defined(BUILD_GLES)
if (opts->shader) { if (opts->shader) {
struct VDir* shader = VDirOpen(opts->shader); struct VDir* shader = VDirOpen(opts->shader);
if (shader) { if (shader) {
@ -282,6 +285,7 @@ void Window::loadConfig() {
shader->close(shader); shader->close(shader);
} }
} }
#endif
m_mruFiles = m_config->getMRU(); m_mruFiles = m_config->getMRU();
updateMRU(); updateMRU();
@ -459,9 +463,11 @@ void Window::exportSharkport() {
void Window::openSettingsWindow() { void Window::openSettingsWindow() {
SettingsView* settingsWindow = new SettingsView(m_config, &m_inputController, m_shortcutController); SettingsView* settingsWindow = new SettingsView(m_config, &m_inputController, m_shortcutController);
#if defined(BUILD_GL) || defined(BUILD_GLES)
if (m_display->supportsShaders()) { if (m_display->supportsShaders()) {
settingsWindow->setShaderSelector(m_shaderView); settingsWindow->setShaderSelector(m_shaderView);
} }
#endif
connect(settingsWindow, &SettingsView::biosLoaded, m_controller, &GameController::loadBIOS); connect(settingsWindow, &SettingsView::biosLoaded, m_controller, &GameController::loadBIOS);
connect(settingsWindow, &SettingsView::audioDriverChanged, m_controller, &GameController::reloadAudioDriver); connect(settingsWindow, &SettingsView::audioDriverChanged, m_controller, &GameController::reloadAudioDriver);
connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::mustRestart); connect(settingsWindow, &SettingsView::displayDriverChanged, this, &Window::mustRestart);

View File

@ -30,7 +30,7 @@ Q_IMPORT_PLUGIN(QWindowsAudioPlugin);
using namespace QGBA; using namespace QGBA;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
#ifdef BUILD_SDL #if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetMainReady(); SDL_SetMainReady();
#endif #endif
@ -58,6 +58,12 @@ int main(int argc, char* argv[]) {
qtTranslator.load(locale, "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath)); qtTranslator.load(locale, "qt", "_", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
application.installTranslator(&qtTranslator); application.installTranslator(&qtTranslator);
#ifdef QT_STATIC
QTranslator qtStaticTranslator;
qtStaticTranslator.load(locale, "qtbase", "_", ":/translations/");
application.installTranslator(&qtStaticTranslator);
#endif
QTranslator langTranslator; QTranslator langTranslator;
langTranslator.load(locale, binaryName, "-", ":/translations/"); langTranslator.load(locale, binaryName, "-", ":/translations/");
application.installTranslator(&langTranslator); application.installTranslator(&langTranslator);

View File

@ -1,7 +1,6 @@
file(GLOB TRANSLATION_FILES "${QM_BASE}/*.qm")
file(WRITE ${TRANSLATION_QRC} "<RCC>\n\t<qresource prefix=\"/translations/\">\n") file(WRITE ${TRANSLATION_QRC} "<RCC>\n\t<qresource prefix=\"/translations/\">\n")
foreach(TS ${TRANSLATION_FILES}) foreach(TS ${TRANSLATION_FILES})
get_filename_component(TS_BASE "${TS}" NAME) get_filename_component(TS_BASE "${TS}" NAME)
file(APPEND ${TRANSLATION_QRC} "\t\t<file>${TS_BASE}</file>\n") file(APPEND ${TRANSLATION_QRC} "\t\t<file alias=\"${TS_BASE}\">${TS}</file>\n")
endforeach() endforeach()
file(APPEND ${TRANSLATION_QRC} "\t</qresource>\n</RCC>") file(APPEND ${TRANSLATION_QRC} "\t</qresource>\n</RCC>")

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,7 @@ add_executable(${BINARY_NAME}-sdl WIN32 ${PLATFORM_SRC} ${MAIN_SRC})
set_target_properties(${BINARY_NAME}-sdl PROPERTIES COMPILE_DEFINITIONS "${FEATURE_DEFINES};${FUNCTION_DEFINES}") set_target_properties(${BINARY_NAME}-sdl PROPERTIES COMPILE_DEFINITIONS "${FEATURE_DEFINES};${FUNCTION_DEFINES}")
target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY}) target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME}) set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})
install(TARGETS ${BINARY_NAME}-sdl DESTINATION bin COMPONENT ${BINARY_NAME}-sdl) install(TARGETS ${BINARY_NAME}-sdl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-sdl)
if(UNIX) if(UNIX)
install(FILES ${CMAKE_SOURCE_DIR}/doc/mgba.6 DESTINATION ${MANDIR}/man6 COMPONENT ${BINARY_NAME}-sdl) install(FILES ${CMAKE_SOURCE_DIR}/doc/mgba.6 DESTINATION ${MANDIR}/man6 COMPONENT ${BINARY_NAME}-sdl)
endif() endif()

View File

@ -56,7 +56,7 @@ int main(int argc, char** argv) {
initParserForGraphics(&subparser, &graphicsOpts); initParserForGraphics(&subparser, &graphicsOpts);
bool parsed = parseArguments(&args, argc, argv, &subparser); bool parsed = parseArguments(&args, argc, argv, &subparser);
if (!args.fname) { if (!args.fname && !args.showVersion) {
parsed = false; parsed = false;
} }
if (!parsed || args.showHelp) { if (!parsed || args.showHelp) {