Compare commits
393 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d9e2ed2b9a | |||
| 81015e086c | |||
| a0e31029d1 | |||
| 53f87d0793 | |||
| 1e6c906300 | |||
| b76023209c | |||
| b4c7821630 | |||
| e86261e2dc | |||
| 7534c5bb3c | |||
| 7d5eec2d41 | |||
| 69b8461a87 | |||
| 32d2a12331 | |||
| ce8de27fb5 | |||
| 9c64d647ad | |||
| 726861dfaa | |||
| 51dea638c9 | |||
| 298a717225 | |||
| 27b2bc8387 | |||
| 6f6310c776 | |||
| e45fcdfb3e | |||
| ea02f68abe | |||
| 65d7d149f1 | |||
| c5f23f8b71 | |||
| ba327ce1c6 | |||
| 583687cfe1 | |||
| 19eda69468 | |||
| 4b3f979a74 | |||
| d171d62609 | |||
| 5ba195d32e | |||
| 950aa60fca | |||
| 3547e9bf53 | |||
| 5dbf6cfb2e | |||
| fb12f6432b | |||
| 5b61f811da | |||
| fe0fa0b527 | |||
| ba371f1349 | |||
| 38ec62c238 | |||
| 942c2ee1b0 | |||
| 2a7d8aa4d2 | |||
| b166eac200 | |||
| c06316f4aa | |||
| 09d96d9e4d | |||
| 66703970b6 | |||
| 0d3314a39b | |||
| 748492cc68 | |||
| e18ad31c53 | |||
| 0dd297f0f8 | |||
| 0da4becd46 | |||
| d284911d4a | |||
| e772eb3906 | |||
| 577ee4c3e0 | |||
| c534df8303 | |||
| a36c8f7de8 | |||
| dfb5f1b687 | |||
| d8eea015fd | |||
| f17b7eb2c9 | |||
| 33146626a9 | |||
| 78e12f774d | |||
| 689d8debb1 | |||
| 8be1ed8af5 | |||
| 0fabdb3f3a | |||
| 7a64e7e479 | |||
| 8c1589d7cd | |||
| 5a74b137f2 | |||
| 52ba182610 | |||
| b07eb79609 | |||
| 4e3915f527 | |||
| 9f620f276d | |||
| e3787b5ccf | |||
| 3d81a052c6 | |||
| 6353be1599 | |||
| bc6ee4877b | |||
| 6b38cc3740 | |||
| 9285fb9fdf | |||
| f5c609413a | |||
| a304f11b1d | |||
| e10ac1086f | |||
| 4533ed61ac | |||
| 235e41653d | |||
| 433479b1c3 | |||
| 2b4736f224 | |||
| 41f1dcf9d2 | |||
| 45b97cf39b | |||
| 95b1225219 | |||
| 70f6c40b26 | |||
| 43bc54fca9 | |||
| a5ec31ffef | |||
| 81cbf82ddc | |||
| 6cea506c6f | |||
| d7d49f261d | |||
| 4692a5c0b7 | |||
| d32ea32f1e | |||
| f5f053cc4e | |||
| bb3c6dc9fc | |||
| 496d4de1de | |||
| 71f8437ecb | |||
| e7767105d6 | |||
| 9cfda8514e | |||
| e0c6700a4d | |||
| 12bf158398 | |||
| ea01c86821 | |||
| 96459432a6 | |||
| 089194c663 | |||
| 7a70227535 | |||
| 7adfb3123b | |||
| 1d28075601 | |||
| af7aa688bb | |||
| beb524f523 | |||
| 18c9c151a8 | |||
| 83820baf79 | |||
| abf50350e7 | |||
| 6588d0d17a | |||
| 648736df48 | |||
| 6278a443df | |||
| 615295f1f9 | |||
| 593135d02b | |||
| 78ea41a2ca | |||
| 105600878e | |||
| 415202e15f | |||
| 618a6f6c9f | |||
| af70f35bf2 | |||
| 43bb0a3a1c | |||
| 8d9f83b1cc | |||
| 7d713afbdd | |||
| 5044ef8ab1 | |||
| 5b4fe5667a | |||
| a4d3efa087 | |||
| 9cb8adce55 | |||
| c061981de0 | |||
| b2f76fc436 | |||
| dc58fbe900 | |||
| 0e80142da1 | |||
| ee77bc7c9b | |||
| b978248c03 | |||
| 85d2b5be5a | |||
| cee35297d6 | |||
| edde08849f | |||
| f649053e00 | |||
| 6c6b4bcd3a | |||
| 1fef816572 | |||
| a6203cf6e9 | |||
| 200bb0f6e3 | |||
| 1dd2fca3db | |||
| 5444f3b807 | |||
| 897d81a188 | |||
| eae18c446a | |||
| fb7402e394 | |||
| 63dc9cbe7c | |||
| ac63f4809f | |||
| 0bdf3ada25 | |||
| aa684b903b | |||
| db0ae36702 | |||
| 3d5e812c6f | |||
| 07f6810835 | |||
| b3e2a43cf8 | |||
| 96f4abbc07 | |||
| d96746c933 | |||
| 4391ebd94a | |||
| 081029e3d1 | |||
| 541724b63c | |||
| 304afbb50d | |||
| 1ba88f48bb | |||
| 8f8c9c35f1 | |||
| 1c07d032ef | |||
| c500a17b1a | |||
| 6d0347b48a | |||
| 83af0ff4af | |||
| 32c13eee1d | |||
| 42597a76f0 | |||
| 7c59a520aa | |||
| 3c124d8519 | |||
| 76282a11da | |||
| 5249bf6a56 | |||
| 12e0dac777 | |||
| b4e3bede3b | |||
| 679731f004 | |||
| 3bbd29916b | |||
| 6516330289 | |||
| 0628ea920b | |||
| 40a4133565 | |||
| b4425fe1be | |||
| 809cbcbc21 | |||
| 2ae2b994a8 | |||
| 8ce36cdc03 | |||
| 3707a86c79 | |||
| eea3ec7f95 | |||
| 4a2c6761fc | |||
| 7a4e179f4c | |||
| 11eaadb739 | |||
| 41b77b54ea | |||
| 22689bd9ee | |||
| 831535c86f | |||
| ce43955784 | |||
| e85f4f4309 | |||
| 00b3f33530 | |||
| 1b0116a0cb | |||
| 486281427c | |||
| 8ccdc415bc | |||
| 008049265d | |||
| fef407b839 | |||
| 084570bc4b | |||
| 3d91e0c3e3 | |||
| b5a942b4fe | |||
| 5c5cc8453d | |||
| 30495795cd | |||
| 073cdd2815 | |||
| fe21c73f75 | |||
| a6cba2ce2a | |||
| 9afd971b43 | |||
| b0f9136fe8 | |||
| b513439565 | |||
| 42494e5019 | |||
| 8653234cb3 | |||
| 6a14761770 | |||
| 399a5c93b2 | |||
| be2db3c95a | |||
| 7f7ac4c5fb | |||
| 7ca98bb496 | |||
| e9cf27411b | |||
| d8f1a5a118 | |||
| 07ea2d8ec4 | |||
| 2c63963134 | |||
| c9d9e71631 | |||
| 69726baa48 | |||
| c02a44d020 | |||
| 1c0c3eb6aa | |||
| 7f9f30181e | |||
| 2bc788beea | |||
| 4a0d20c1a1 | |||
| 2ea9efd622 | |||
| 723f4ab16b | |||
| a242ae78eb | |||
| c037e1465f | |||
| 3e8578f2fd | |||
| 0050646ad7 | |||
| f2ef7e345f | |||
| 3c0698d14b | |||
| ec677c8d26 | |||
| f115c82512 | |||
| 9f4f8ab15b | |||
| 532d8bcaee | |||
| 2978b8443c | |||
| 3b1fbcd9d3 | |||
| de4d4c27c7 | |||
| 91bf6ad996 | |||
| 312885bec1 | |||
| 8641e1b3ba | |||
| ca203d96b0 | |||
| 6774c8731a | |||
| b603f3b75c | |||
| b546826b67 | |||
| a39263aeb5 | |||
| ecaa5b9dee | |||
| 7fcc468353 | |||
| 52952942e9 | |||
| 81dc449637 | |||
| ce25524ed9 | |||
| 30a3522def | |||
| f62de70aa5 | |||
| ec190adc51 | |||
| 7095824874 | |||
| b243f48fff | |||
| 3bc052e948 | |||
| 482e237d08 | |||
| 86f38ab024 | |||
| c837d736bb | |||
| ab94fd484f | |||
| 1508b11044 | |||
| b4e18d1b63 | |||
| f49272288d | |||
| f1dd82c65e | |||
| 7aa7eaffb9 | |||
| 6577fa9810 | |||
| 6aabc4eca8 | |||
| bf5b3d3c99 | |||
| 420eb39c16 | |||
| 6dd764c04c | |||
| 95d5141a2b | |||
| 51c6c3904d | |||
| 32a39afc75 | |||
| fd967cc2a3 | |||
| 8c0bb09667 | |||
| 8c753d6cfe | |||
| 276e681f29 | |||
| f23b17e1b8 | |||
| f1e10fa4b1 | |||
| be67cd03cb | |||
| d7dfe12fb4 | |||
| be437afd2f | |||
| f72688773a | |||
| fb328d8d92 | |||
| 36e6d2fcc7 | |||
| 7b3293341b | |||
| 0a7b72a51b | |||
| 6265973cc6 | |||
| f1edc47a80 | |||
| 8f60d5c80f | |||
| c42489fa81 | |||
| 66b60c988a | |||
| 5d20e98aba | |||
| 617ee3f96c | |||
| 083f7c2e4f | |||
| a8ea1795bf | |||
| 8a6cb4b5a8 | |||
| 53edf065a5 | |||
| bf65be483d | |||
| 1e90047368 | |||
| abd1160f87 | |||
| 55d7dd9d89 | |||
| b7eb1afb86 | |||
| 25ddb4a531 | |||
| 79f7c2224b | |||
| 8adda4fc7d | |||
| 5d23743133 | |||
| 2558e5d6a6 | |||
| 859b81b7e0 | |||
| 30369f58a9 | |||
| 30afc80a64 | |||
| 949eee8d08 | |||
| 1fae30bd33 | |||
| d8817bf0f3 | |||
| 5279b10b67 | |||
| 391f46be22 | |||
| 44809bf28f | |||
| 3cd113c46f | |||
| 3d195c6a4d | |||
| 423d30ac29 | |||
| b07b73e005 | |||
| 418d9c4684 | |||
| 1801a48eaa | |||
| 8e8fbcdd2e | |||
| d5834de5e7 | |||
| a52e3fe1e5 | |||
| eb261bc2bf | |||
| 7b5f735714 | |||
| 404c2c4f43 | |||
| 57f1a33e51 | |||
| fa277352b0 | |||
| f502984e05 | |||
| c205b5bfd3 | |||
| c6625e137d | |||
| 0ad7e1d715 | |||
| 1f8d5be9a7 | |||
| 21673affbb | |||
| a0a1255ef3 | |||
| 206a5ec7f6 | |||
| 8661273568 | |||
| 6aed340831 | |||
| f7bfb6aea1 | |||
| c5ae117cf8 | |||
| a1c9dc3f12 | |||
| 0f3e70706d | |||
| 722ca67b87 | |||
| 981897df8c | |||
| 3a066dfc03 | |||
| 870481e34e | |||
| 9f5f2334d7 | |||
| 330a66c81c | |||
| 92b4d4dc32 | |||
| 531fab51be | |||
| 3f027fad63 | |||
| 6eb46dd63c | |||
| 70830ae016 | |||
| 8a88a736ad | |||
| d580d2be9a | |||
| 0e3fc0e981 | |||
| 4907b2dd32 | |||
| 3ad2a5760e | |||
| e474a09642 | |||
| f5296c9f79 | |||
| f8e1ed3920 | |||
| 9aeca88946 | |||
| 3961c066be | |||
| 4aeb3da6eb | |||
| bf9e370ddd | |||
| 7c72fa98fd | |||
| 0824586db9 | |||
| 8a22c6d929 | |||
| 8f76619d7d | |||
| d94d9fc5d7 | |||
| 38312f8add | |||
| d52b1e1b5a | |||
| 06c9d9b826 | |||
| 20a669dbbb | |||
| 68c8c431a2 | |||
| d6b1fdfa7b | |||
| 6ac9208c7f | |||
| fdcfaf3fad | |||
| dd08dfafc8 | |||
| 22a019abb1 | |||
| e112ae75eb | |||
| 0de1073094 | |||
| 18a1a6afe6 |
@@ -4,27 +4,43 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: hendrikmuhs/ccache-action@v1.2.5
|
||||
with:
|
||||
key: Linux
|
||||
- name: Install Packages
|
||||
run: |
|
||||
sudo apt-get purge grub\* --yes --allow-remove-essential
|
||||
sudo add-apt-repository ppa:okirby/qt6-backports --yes
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get upgrade
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qtbase5-dev libqt5svg5-dev build-essential nasm git zip
|
||||
sudo apt-get -y install cmake ninja-build libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev build-essential nasm git zip appstream
|
||||
- name: Prepare Environment
|
||||
run: |
|
||||
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
|
||||
- name: Build RMG (Portable)
|
||||
run: ./Source/Script/Build.sh Release
|
||||
- name: Build RMG (AppImage)
|
||||
run: |
|
||||
mkdir Build Build/AppImage Bin/ -p
|
||||
export src_dir="$(pwd)"
|
||||
export build_dir="$(pwd)/build"
|
||||
export bin_dir="$(pwd)/Bin/AppImage"
|
||||
cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="Release" -DPORTABLE_INSTALL="OFF" -DUPDATER=ON -DAPPIMAGE_UPDATER=ON -DCMAKE_INSTALL_PREFIX="/usr" -G "Ninja"
|
||||
cmake --build "$build_dir"
|
||||
cmake --install "$build_dir" --prefix="$bin_dir/usr"
|
||||
shell: bash
|
||||
- name: Upload RMG (Portable)
|
||||
- name: Create AppImage
|
||||
run: |
|
||||
./Package/AppImage/Create.sh
|
||||
shell: bash
|
||||
- name: Upload RMG (AppImage)
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: RMG-Portable-Linux64-${{ env.GIT_REVISION }}
|
||||
path: Bin/Release/*
|
||||
path: Bin/*.AppImage
|
||||
|
||||
Windows:
|
||||
runs-on: windows-2019
|
||||
@@ -32,6 +48,9 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: hendrikmuhs/ccache-action@v1.2.5
|
||||
with:
|
||||
key: Windows
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
path-type: inherit
|
||||
@@ -39,20 +58,19 @@ jobs:
|
||||
install: >-
|
||||
make
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-ninja
|
||||
mingw-w64-x86_64-gcc
|
||||
mingw-w64-x86_64-hidapi
|
||||
mingw-w64-x86_64-freetype
|
||||
mingw-w64-x86_64-libpng
|
||||
mingw-w64-x86_64-SDL2
|
||||
mingw-w64-x86_64-jasper
|
||||
mingw-w64-x86_64-qt5
|
||||
mingw-w64-x86_64-qt6
|
||||
mingw-w64-x86_64-SDL2
|
||||
mingw-w64-x86_64-hidapi
|
||||
mingw-w64-x86_64-speexdsp
|
||||
mingw-w64-x86_64-libsamplerate
|
||||
mingw-w64-x86_64-python3-pip
|
||||
mingw-w64-x86_64-python3-pyopenssl
|
||||
mingw-w64-x86_64-nasm
|
||||
mingw-w64-x86_64-minizip
|
||||
git
|
||||
- name: Prepare Environment
|
||||
run: |
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
# CMake build directory
|
||||
Build/
|
||||
Bin/
|
||||
# VSCode Configuration
|
||||
.vscode/
|
||||
# Clangd cache
|
||||
.cache/
|
||||
.cache/
|
||||
# Archlinux Package
|
||||
Package/ArchLinux/pkg/
|
||||
Package/ArchLinux/rmg/
|
||||
Package/ArchLinux/src/
|
||||
Package/ArchLinux/*.pkg.*
|
||||
# Clangd compile_commands.json
|
||||
compile_commands.json
|
||||
# AppImage
|
||||
squashfs-root
|
||||
*.AppImage
|
||||
@@ -6,7 +6,12 @@ cmake_minimum_required(VERSION 3.15)
|
||||
option(PORTABLE_INSTALL "Portable Installation" ON)
|
||||
option(NO_GIT_CLONE "Disables git clone usage for 3rdParty dependencies" OFF)
|
||||
option(UPDATER "Enables updater" ${PORTABLE_INSTALL})
|
||||
option(APPIMAGE_UPDATER "Enables AppImage updater" OFF)
|
||||
option(DISCORD_RPC "Enables Discord Rich Presence" ON)
|
||||
option(VRU "Enables VRU support in RMG-Input" ON)
|
||||
option(USE_CCACHE "Enables usage of ccache when ccache has been found" ON)
|
||||
option(FORCE_XCB "Forces Qt to use the xcb platform on linux" ${LINUX})
|
||||
option(NO_RUST "Disables the building of rust subprojects" OFF)
|
||||
|
||||
project(RMG)
|
||||
|
||||
@@ -19,26 +24,54 @@ execute_process(
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if (USE_CCACHE)
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if (CCACHE_FOUND)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||
else(CCACHE_FOUND)
|
||||
set(USE_CCACHE OFF)
|
||||
endif(CCACHE_FOUND)
|
||||
endif(USE_CCACHE)
|
||||
|
||||
if (NOT PORTABLE_INSTALL AND (WIN32 OR MSYS))
|
||||
message(WARNING "Not-Portable build not supported on windows, re-enabling PORTABLE_INSTALL!")
|
||||
set(PORTABLE_INSTALL ON)
|
||||
endif()
|
||||
|
||||
if (NOT PORTABLE_INSTALL AND UPDATER)
|
||||
if (NOT PORTABLE_INSTALL AND UPDATER AND NOT APPIMAGE_UPDATER)
|
||||
message(WARNING "Not-Portable builds don't support the updater, disabling UPDATER")
|
||||
set(UPDATER OFF)
|
||||
endif()
|
||||
|
||||
if (APPIMAGE_UPDATER AND (WIN32 OR MSYS))
|
||||
message(WARNING "AppImage updater not supported on windows, disabling APPIMAGE_UPDATER!")
|
||||
set(APPIMAGE_UPDATER OFF)
|
||||
endif()
|
||||
|
||||
if (UPDATER AND NOT (WIN32 OR MSYS) AND NOT APPIMAGE_UPDATER)
|
||||
message(WARNING "Only AppImage updater is supported on linux, disabling UPDATER!")
|
||||
set(UPDATER OFF)
|
||||
endif()
|
||||
|
||||
if (FORCE_XCB AND (WIN32 OR MSYS))
|
||||
message(WARNING "XCB Qt platform not supported on windows, disabling FORCE_XCB!")
|
||||
set(FORCE_XCB OFF)
|
||||
endif()
|
||||
|
||||
if (PORTABLE_INSTALL)
|
||||
set(CMAKE_INSTALL_PREFIX "")
|
||||
set(INSTALL_PATH "Bin/${CMAKE_BUILD_TYPE}")
|
||||
set(RMG_INSTALL_PATH "${INSTALL_PATH}")
|
||||
set(SYSTEM_LIB_INSTALL_PATH "${INSTALL_PATH}")
|
||||
set(LIB_INSTALL_PATH "${INSTALL_PATH}")
|
||||
set(CORE_INSTALL_PATH "${INSTALL_PATH}/Core")
|
||||
set(PLUGIN_INSTALL_PATH "${INSTALL_PATH}/Plugin")
|
||||
set(DATA_INSTALL_PATH "${INSTALL_PATH}/Data")
|
||||
set(INSTALL_DESKTOP_FILE OFF)
|
||||
else()
|
||||
set(RMG_INSTALL_PATH "bin")
|
||||
set(SYSTEM_LIB_INSTALL_PATH "lib")
|
||||
set(LIB_INSTALL_PATH "lib/RMG")
|
||||
set(CORE_INSTALL_PATH "lib/RMG/Core")
|
||||
set(PLUGIN_INSTALL_PATH "lib/RMG/Plugin")
|
||||
set(DATA_INSTALL_PATH "share/RMG")
|
||||
@@ -49,11 +82,18 @@ else()
|
||||
endif()
|
||||
|
||||
add_subdirectory(Source/3rdParty)
|
||||
add_subdirectory(Source/3rdParty/7-Zip)
|
||||
if (VRU)
|
||||
add_subdirectory(Source/3rdParty/vosk-api)
|
||||
endif(VRU)
|
||||
|
||||
add_subdirectory(Source/RMG-Core)
|
||||
add_subdirectory(Source/RMG)
|
||||
add_subdirectory(Source/RMG-Audio)
|
||||
add_subdirectory(Source/RMG-Input)
|
||||
install(TARGETS RMG-Core
|
||||
DESTINATION ${SYSTEM_LIB_INSTALL_PATH}
|
||||
)
|
||||
install(TARGETS RMG
|
||||
DESTINATION ${RMG_INSTALL_PATH}
|
||||
)
|
||||
@@ -66,16 +106,27 @@ install(TARGETS RMG-Input
|
||||
|
||||
if (WIN32)
|
||||
add_subdirectory(Source/Installer)
|
||||
|
||||
|
||||
add_custom_target(bundle_dependencies
|
||||
COMMAND "${CMAKE_SOURCE_DIR}/Source/Script/BundleDependencies.sh" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}/RMG.exe" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}/" "/mingw64/bin"
|
||||
COMMAND bash "${CMAKE_SOURCE_DIR}/Source/Script/BundleDependencies.sh" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}/RMG.exe" "${CMAKE_SOURCE_DIR}/Bin/${CMAKE_BUILD_TYPE}" "/mingw64/bin"
|
||||
)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
install(FILES ${MUPEN64PLUSCORE_LIB}
|
||||
DESTINATION ${CORE_INSTALL_PATH}
|
||||
)
|
||||
install(FILES ${MUPEN64PLUSCORE_INI} Data/font.ttf Data/stylesheet.qss
|
||||
install(FILES ${MUPEN64PLUSCORE_INI} Data/font.ttf
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
if (VRU)
|
||||
install(FILES ${VOSK_API_LIBRARY}
|
||||
DESTINATION ${LIB_INSTALL_PATH}
|
||||
)
|
||||
install(FILES ${VOSK_API_MODEL}
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
endif(VRU)
|
||||
install(FILES ${SDL_GAMECONTROLLERDB}
|
||||
DESTINATION ${DATA_INSTALL_PATH}
|
||||
)
|
||||
file(GLOB GENERATED_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Generated/*.cht)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
[1FBAF161-2C1C54F1-C:41]
|
||||
Name=1080 Snowboarding (JU) (M2)
|
||||
|
||||
$Enable All Levels & Boarders
|
||||
80255089 00FF
|
||||
8025508B 0005
|
||||
81255096 FCFF
|
||||
80255098 0007
|
||||
|
||||
$Have All\Contest First Place Done
|
||||
80244098 0007
|
||||
|
||||
$Have All\Match Levels Completed
|
||||
8025508A 0005
|
||||
|
||||
$Have All\Trick Attacks Done
|
||||
81255096 FCFF
|
||||
|
||||
$Infinite Damage All Players & Levels
|
||||
803F4C3C 0024
|
||||
807F4C3C 0024
|
||||
|
||||
$Infinite Lives & Continues
|
||||
8026B1CB 0003
|
||||
|
||||
$Always First Place (Player 1)
|
||||
81267B88 2400
|
||||
Note=The game will still show you in 2nd when you are behind. But when you cross the finish line, you will win!
|
||||
|
||||
$Open Level Character Select
|
||||
Note=With these codes, you have to press the buttons listed below when you are viewing a certain boarders stats. Highlight Akari Hayami's stats, and then hold down the C-Left button and then press the A button to be the Crystal Boarder. Highlight Kensuke Kimachi's stats, and then hold down the C-Up button and then press the A button to be the Metal Boarder. Hightlight Rob Haywood's stats, and then hold down the C-Right button and then press the A button to be the Panda Boarder
|
||||
8125508A 00??
|
||||
01 Easy Level
|
||||
02 Easy & Normal Level
|
||||
03 Easy Normal & Hard Levels
|
||||
04 Easy Normal Hard Levels & Crystal Boarder
|
||||
05 Easy Normal Hard Levels & Crystal & Metal Boarders
|
||||
|
||||
$Play As
|
||||
800200E7 00??
|
||||
00 Dion Blaster
|
||||
01 Kensuke Kimachi
|
||||
02 Akari Hayami
|
||||
03 Ricky Winterborn
|
||||
04 Rob Haywood
|
||||
05 Silver Boarder
|
||||
06 Gold Boarder
|
||||
07 Panda Boarder
|
||||
|
||||
$Freeze Timer In\Match Race
|
||||
D1267B20 05E1
|
||||
81267B20 1000
|
||||
|
||||
$Freeze Timer In\Time Attack
|
||||
D12660CC 05E1
|
||||
812660CC 1000
|
||||
|
||||
$Freeze Timer In\Trick Attack
|
||||
D1266138 05E1
|
||||
81266138 1000
|
||||
|
||||
$Freeze Timer In\Contest
|
||||
D126628C 05E1
|
||||
8126628C 1000
|
||||
@@ -0,0 +1,55 @@
|
||||
[58FD3F25-D92EAA8D-C:50]
|
||||
Name=1080 Snowboarding (E) (M4)
|
||||
|
||||
$Enable All Levels & Boarders
|
||||
80250AB9 00FF
|
||||
80250ABB 0005
|
||||
81250AC6 FCFF
|
||||
80250AC8 0007
|
||||
|
||||
$Infinite Damage All Players and Levels
|
||||
803F4C00 0024
|
||||
807F4C00 0024
|
||||
|
||||
$Infinite Lives & Continues
|
||||
802648A4 0003
|
||||
|
||||
$Open Level Character Select
|
||||
Note=With these codes, you have to press the buttons listed below when you are viewing a certain boarders stats. Highlight Akari Hayami's stats, and then hold down the C-Left button and then press the A button to be the Crystal Boarder. Highlight Kensuke Kimachi's stats, and then hold down the C-Up button and then press the A button to be the Metal Boarder. Hightlight Rob Haywood's stats, and then hold down the C-Right button and then press the A button to be the Panda Boarder
|
||||
8125508A 00??
|
||||
01 Easy Level
|
||||
02 Easy & Normal Level
|
||||
03 Easy Normal & Hard Levels
|
||||
04 Easy Normal Hard Levels & Crystal Boarder
|
||||
05 Easy Normal Hard Levels & Crystal & Metal Boarders
|
||||
|
||||
$Play As
|
||||
8001A0E7 00??
|
||||
00 Dion Blaster
|
||||
01 Kensuke Kimachi
|
||||
02 Akari Hayami
|
||||
03 Ricky Winterborn
|
||||
04 Rob Haywood
|
||||
05 Silver Boarder
|
||||
06 Gold Boarder
|
||||
07 Panda Boarder
|
||||
|
||||
$Always First Place (Player 1)
|
||||
812679BC 2400
|
||||
Note=The game will still show you in 2nd when you are behind. But when you cross the finish line, you will win!
|
||||
|
||||
$Freeze Timer In\Match Race
|
||||
D1267954 05E1
|
||||
81267954 1000
|
||||
|
||||
$Freeze Timer In\Time Attack
|
||||
D1265D4C 05E1
|
||||
81265D4C 1000
|
||||
|
||||
$Freeze Timer In\Trick Attack
|
||||
D1265DB8 05E1
|
||||
81265DB8 1000
|
||||
|
||||
$Freeze Timer In\Contest
|
||||
D1265F48 05E1
|
||||
81265F48 1000
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cur_dir="$(readlink -f "$(dirname "$0")")"
|
||||
|
||||
exec "$cur_dir/usr/bin/RMG" \
|
||||
--lib-path="$cur_dir/usr/lib/RMG" \
|
||||
--core-path="$cur_dir/usr/lib/RMG/Core" \
|
||||
--plugin-path="$cur_dir/usr/lib/RMG/Plugin" \
|
||||
--shared-data-path="$cur_dir/usr/share/RMG" \
|
||||
"$@"
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
script_dir="$(dirname "$0")"
|
||||
toplvl_dir="$(realpath "$script_dir/../../")"
|
||||
bin_dir="$toplvl_dir/Bin/AppImage" # RMG should be installed here
|
||||
|
||||
export QMAKE="$(which qmake6)"
|
||||
export EXTRA_QT_PLUGINS="imageformats;iconengines;"
|
||||
export VERSION="$(git describe --tags --always)"
|
||||
export OUTPUT="$bin_dir/../RMG-Portable-Linux64-$VERSION.AppImage"
|
||||
export LD_LIBRARY_PATH="$toplvl_dir/build/Source/RMG-Core" # hack
|
||||
|
||||
if [ ! -f "$script_dir/linuxdeploy-x86_64.AppImage" ]
|
||||
then
|
||||
curl -L https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
|
||||
-o "$script_dir/linuxdeploy-x86_64.AppImage"
|
||||
chmod +x "$script_dir/linuxdeploy-x86_64.AppImage"
|
||||
fi
|
||||
|
||||
if [ ! -f "$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage" ]
|
||||
then
|
||||
curl -L https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
|
||||
-o "$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
chmod +x "$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
fi
|
||||
|
||||
"$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage" --appimage-extract
|
||||
"$script_dir/linuxdeploy-x86_64.AppImage" --appimage-extract
|
||||
|
||||
# delete appimages
|
||||
rm "$script_dir/linuxdeploy-x86_64.AppImage" \
|
||||
"$script_dir/linuxdeploy-plugin-qt-x86_64.AppImage"
|
||||
|
||||
"$(pwd)/squashfs-root/AppRun" \
|
||||
--plugin=qt \
|
||||
--appdir="$bin_dir" \
|
||||
--custom-apprun="$script_dir/AppRun" \
|
||||
--output=appimage \
|
||||
--desktop-file="$bin_dir/usr/share/applications/com.github.Rosalie241.RMG.desktop"
|
||||
@@ -1,51 +1,36 @@
|
||||
# Maintainer: Rosalie Wanders <rosalie@mailbox.org>
|
||||
_pkgname=rmg
|
||||
pkgname=${_pkgname}-git
|
||||
pkgver=git
|
||||
pkgname=rmg
|
||||
pkgver=0.4.3
|
||||
pkgrel=1
|
||||
pkgdesc="Rosalie's Mupen GUI"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/Rosalie241/${_pkgname}"
|
||||
license=('GPLv3')
|
||||
url="https://github.com/Rosalie241/$pkgname"
|
||||
license=('GPL3')
|
||||
|
||||
provides=("$_pkgname")
|
||||
conflicts=("$_pkgname")
|
||||
depends=("hidapi" "libsamplerate" "speexdsp" "minizip" "sdl2" "zlib" "freetype2" "qt6-base" "qt6-svg" "xdg-user-dirs")
|
||||
makedepends=("git" "nasm" "cmake" "ninja")
|
||||
|
||||
depends=("hidapi" "libsamplerate" "minizip" "sdl2" "zlib" "freetype2" "qt5-base" "qt5-svg")
|
||||
makedepends=("git" "pkg-config" "nasm" "cmake" "rustup")
|
||||
|
||||
source=("git+https://github.com/Rosalie241/${_pkgname}.git")
|
||||
source=("git+https://github.com/Rosalie241/$pkgname.git#tag=v$pkgver")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver()
|
||||
{
|
||||
cd "$_pkgname"
|
||||
|
||||
git describe --tags --always | sed -e 's|^v||;s|-|.|g'
|
||||
}
|
||||
|
||||
prepare()
|
||||
{
|
||||
cd "$srcdir/${_pkgname}"
|
||||
|
||||
mkdir -p build
|
||||
mkdir -p "$srcdir/$pkgname/build"
|
||||
}
|
||||
|
||||
build()
|
||||
{
|
||||
cd "$srcdir/${_pkgname}/build"
|
||||
|
||||
cmake -S "$srcdir/${_pkgname}" -B "$srcdir/${_pkgname}/build" \
|
||||
cmake -S "$srcdir/$pkgname" -B "$srcdir/$pkgname/build" \
|
||||
-DCMAKE_BUILD_TYPE="Release" \
|
||||
-DPORTABLE_INSTALL="OFF" \
|
||||
-DCMAKE_INSTALL_PREFIX="/usr" \
|
||||
-G "Unix Makefiles"
|
||||
make
|
||||
-DNO_RUST="ON" \
|
||||
-G "Ninja"
|
||||
|
||||
cmake --build "$srcdir/$pkgname/build"
|
||||
}
|
||||
|
||||
package()
|
||||
{
|
||||
cd "$srcdir/${_pkgname}/build"
|
||||
|
||||
make install DESTDIR="$pkgdir"
|
||||
cmake --install "$srcdir/$pkgname/build" --prefix="$pkgdir/usr"
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 276 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 57 KiB |
@@ -1,4 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<!-- Copyright 2022 Rosalie Wanders -->
|
||||
<component type="desktop">
|
||||
<!--Created with jdAppdataEdit 2.1-->
|
||||
<id>com.github.Rosalie241.RMG</id>
|
||||
@@ -11,20 +12,324 @@
|
||||
<description><p>Rosalie's Mupen GUI is an easy to use yet customizable mupen64plus front-end, allowing you to easily play N64 games.</p></description>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<caption>The Rom Browser</caption>
|
||||
<caption>01 - The Rom Browser</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/RomBrowser.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>During A Game</caption>
|
||||
<caption>02 - During A Game</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/InGame.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>Settings</caption>
|
||||
<caption>03 - Cheats</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/Cheats.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>04 - Settings</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/Settings.png</image>
|
||||
</screenshot>
|
||||
<screenshot type="default">
|
||||
<caption>05 - Input Settings</caption>
|
||||
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/InputSettings.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<description/>
|
||||
<releases>
|
||||
<release version="v0.4.3" date="2023-07-11" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix minor corruption issues when using GLideN64 in Wave Race 64 and Space Station Silicon Valley</li>
|
||||
<li>Fix some potential issues with out of bounds RDRAM reads (thank you loganmc10)</li>
|
||||
<li>Fix ROM browser not updating entries when they've changed in the ROM database</li>
|
||||
<li>Fix mupen64plus-rsp-hle not having a fallback configured (fixes Xeno Crisis not booting with mupen64plus-rsp-hle)</li>
|
||||
<li>Fix Xeno Crisis showing an error message</li>
|
||||
<li>Add Xeno Crisis to the ROM database</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.4.2" date="2023-07-07" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix window behavior issues when saving GLideN64 settings while in-game</li>
|
||||
<li>Add VRU support to RMG-Input</li>
|
||||
<li>Add controller hotkey support to RMG-Input</li>
|
||||
<li>Improve window title by using the ROM filename when the ROM isn't in the database</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.4.1" date="2023-06-19" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix debug callbacks not printing before GUI has been started</li>
|
||||
<li>Fix emulation error being incorrect in some cases</li>
|
||||
<li>Fix user cheat file location (new ones will be placed in the user config directory instead of the user data directory)</li>
|
||||
<li>Fix mupen64plus-input-gca crashing in v0.4.0 due to updating to a broken commit</li>
|
||||
<li>Fix Paper Mario crashing when using the hammer on a specific tree in-game by implementing RDRAM address range 0x0800000-0x03EFFFFF</li>
|
||||
<li>Improve accuracy of the pure and cached interpreter</li>
|
||||
<li>Add *.st* and *.pj* to the file filter when loading a save state from a file</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.4.0" date="2023-05-04" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix updater on windows always installing the desktop icon</li>
|
||||
<li>Fix updater on windows not re-launching RMG after installation</li>
|
||||
<li>Fix the speed limiter toggle and speed factor options not working on linux on some systems</li>
|
||||
<li>Fix the 1080 Snowboarding cheats (thank you Gent)</li>
|
||||
<li>Add support for moving the toolbar (changes to the docked position are persistent across application runs)</li>
|
||||
<li>Update GLideN64 and mupen64plus-input-gca</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.9" date="2023-04-06" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix "Don't check for updates again" checkbox appearing when requesting an update check through Help -> Check For Updates</li>
|
||||
<li>Add game format, file name, file extension, file size, game I.D. and game region columns to the list view of the ROM browser which can be toggled in the "Show/Hide Columns" menu of the context menu in the list view of the ROM browser (thank you RetraCarteR)</li>
|
||||
<li>Add "Reset Column Sizes" to context menu of the list view of the ROM browser (thank you RetraCarteR)</li>
|
||||
<li>Add "Analog Stick Sensitivity" setting to RMG-Input (thank you JaxonWasTaken)</li>
|
||||
<li>Add "Save Filename Format" setting to the Core tab of the settings dialog</li>
|
||||
<li>Add "Edit Game Input Settings" to the context menu of the ROM browser</li>
|
||||
<li>Add support for 7z files</li>
|
||||
<li>Add progress status to the loading screen in the ROM browser when loading takes more than 5 seconds</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.8" date="2023-02-24" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix RMG not having the correct video size in some cases (i.e on a WM where resizing is not allowed to be done by an application)</li>
|
||||
<li>Fix translations not working in GLideN64</li>
|
||||
<li>Add -n/--nogui commandline option</li>
|
||||
<li>Add -d/--debug-messages commandline option</li>
|
||||
<li>Add hotkeys for graphics, audio, RSP and input settings</li>
|
||||
<li>Add hotkey for viewing the log</li>
|
||||
<li>Add SIGINT and SIGTERM handling on linux</li>
|
||||
<li>Add "Check For Updates" to "View" in the toolbar</li>
|
||||
<li>Add information about LLE plugins in the settings dialog</li>
|
||||
<li>Add support for toggling visibility of columns in the ROM browser list view (thank you RetraCarteR)</li>
|
||||
<li>Add date and time to the save state slot items in "Current Save State" menu in the menubar</li>
|
||||
<li>Add date and time to the OSD when selecting a save state slot</li>
|
||||
<li>Add failure messages to the OSD when loading/saving a save state fails</li>
|
||||
<li>Improve updater behavior by checking for an update on startup with at least an hour in-between checks</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.7" date="2023-02-19" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix icons not showing up in some cases when migrating from a version before v0.3.6</li>
|
||||
<li>Fix plugin settings not being loaded properly in the settings dialog when migrating from a version before v0.3.6</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.6" date="2023-02-19" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix RMG not using xwayland when using wayland (wayland has lots of issues, can be disabled by building with the "-DFORCE_XCB=OFF" option)</li>
|
||||
<li>Fix some non-fatal mupen64plus errors showing a pop-up</li>
|
||||
<li>Fix window not returning to ROM browser when launching a game through the commandline and the plugins aren't ready</li>
|
||||
<li>Add support for Qt stylesheets (place them in the 'user data directory/Styles' directory with the '.qss' extension, they'll show up in "Themes")</li>
|
||||
<li>Add "Icon Theme" setting</li>
|
||||
<li>Add "Speed Factor" to System menu bar</li>
|
||||
<li>Add support for re-ordering columns in the list view of the ROM browser (thank you RetraCarteR)</li>
|
||||
<li>Add AppImage to github releases (this replaces the old portable linux builds on github releases)</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.5" date="2023-02-14" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix reset button not working properly in RMG-Input</li>
|
||||
<li>Fix profiles not being deleted properly when clicking on cancel/close in some cases in RMG-Input</li>
|
||||
<li>Fix paraLLEl not logging to the log window</li>
|
||||
<li>Fix paraLLEl's odd window behavior by not saving the window size when emulation ends</li>
|
||||
<li>Fix GLideN64 initializing a noise texture being slow</li>
|
||||
<li>Fix issue where an unbound mapping in RMG-Input would respond to an A controller button press in-game</li>
|
||||
<li>Fix issue where RMG-Input wouldn't save anything but the currently opened profile</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.4" date="2023-02-11" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix mapping button size increasing when reloading settings in RMG-Input</li>
|
||||
<li>Fix analog stick mapping in-game when having buttons and axis bound in RMG-Input</li>
|
||||
<li>Fix height mismatch of "Profile" and "Input Device" UI elements in RMG-Input</li>
|
||||
<li>Fix updater script not using the correct path seperators on Windows</li>
|
||||
<li>Fix GLideN64's per game settings being overwritten by the updater on windows (or not being updated on linux)</li>
|
||||
<li>Fix "Automatic" input device not opening controller device when clicking on 'Refresh' in RMG-Input</li>
|
||||
<li>Fix game specific profile having unexpected UI behavior in RMG-Input</li>
|
||||
<li>Fix cancel and close button not working correctly in RMG-Input</li>
|
||||
<li>Fix profile saving not working correctly when having the same profile selected for multiple players in RMG-Input</li>
|
||||
<li>Add "Filter Events Based On Joystick Type For Buttons" setting to RMG-Input</li>
|
||||
<li>Add "Filter Events Based On Joystick Type For Axis" setting to RMG-Input</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.3" date="2023-02-09" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Remove "Controller Is Plugged In" checkbox in RMG-Input</li>
|
||||
<li>Remove text from 'Remove' button in RMG-Input</li>
|
||||
<li>Add "None" input device to RMG-Input (replacing the "Controller Is Plugged In" checkbox)</li>
|
||||
<li>Add "Automatic" input device to RMG-Input</li>
|
||||
<li>Add support for creating profiles in RMG-Input</li>
|
||||
<li>Add icons to 'Remove', 'Refresh', 'Reset' and 'Options' buttons in RMG-Input</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.2" date="2023-02-06" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix ndd/d64 files in zip files not working when the disk file is inside a subdirectory inside the zip file</li>
|
||||
<li>Fix ndd/d64 files in zip files not working correctly on windows</li>
|
||||
<li>Fix controller image in RMG-Input sometimes being stuck when having a trigger bound to a button</li>
|
||||
<li>Fix trigger mapping in RMG-Input</li>
|
||||
<li>Remove "Invert Axis Mapped To LRZ" setting in RMG-Input</li>
|
||||
<li>Add "Sort Results After Search" ROM Browser setting</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.1" date="2023-02-04" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix taking a screenshot not working in some cases</li>
|
||||
<li>Fix some games being unable to save due to having an illegal character in the save filename</li>
|
||||
<li>Fix OSD tab crash in GLideN64</li>
|
||||
<li>Fix an issue where the graphics plugin would show the 64DD IPL as ROM name in the settings even after booting a cartridge</li>
|
||||
<li>Fix "Refresh ROM List" in Hotkeys tab in settings dialog not reverting back to defaults when clicking on 'restore defaults'</li>
|
||||
<li>Fix "Remove Duplicate Keybindings" in settings dialog not behaving correctly in some cases</li>
|
||||
<li>Fix fallback application icons not respecting system icon theme on linux</li>
|
||||
<li>Add support for ndd/d64 files in zip files</li>
|
||||
<li>Add support for using the basename of the ROM filename for covers</li>
|
||||
<li>Add support for binding multiple inputs in RMG-Input</li>
|
||||
<li>Improve behavior of window when launching RMG with a ROM using the commandline</li>
|
||||
<li>Improve behavior of error message when emulation fails</li>
|
||||
<li>Improve behavior of hotkey buttons in settings dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.3.0" date="2023-01-23" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix GLideN64 not being able to load texture packs from relative paths</li>
|
||||
<li>Fix "Save State Slot" keybindings not working in fullscreen</li>
|
||||
<li>Fix deadzone percentage being incorrect when set to 0% in RMG-Input</li>
|
||||
<li>Fix low deadzone value not working in RMG-Input (thank you porcino)</li>
|
||||
<li>Fix toolbar being hidden when ending emulation while in fullscreen</li>
|
||||
<li>Fix zip files with japanese characters in the file name not being able to be opened on windows</li>
|
||||
<li>Fix ROM Browser not returning to a maximized state when ending emulation</li>
|
||||
<li>Fix ROM Browser not opening maximized when closing RMG with it maximized</li>
|
||||
<li>Fix window not being able to be maximized during emulation when scaling is enabled</li>
|
||||
<li>Fix read-only ROM files not being able to be opened on linux</li>
|
||||
<li>Remove "Allow Manual Window Resizing" setting due to it being always enabled</li>
|
||||
<li>Remove Styles tab from settings dialog on windows</li>
|
||||
<li>Add "Play Game with Cartridge" to context menu when a 64DD disk is selected in the ROM Browser</li>
|
||||
<li>Add "Open ROM Directory" to context menu in the ROM Browser</li>
|
||||
<li>Add an On-Screen Display (see the OSD tab in the settings dialog for settings)</li>
|
||||
<li>Add Theme setting to settings dialog (see Interface -> Miscellaneous, this is a replacement for the previous Styles settings)</li>
|
||||
<li>Improve error message when opening a zip file fails</li>
|
||||
<li>Improve tab order and naming in settings dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.9" date="2023-01-03" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix wrong 64DD Disk extension being listed in empty ROM browser</li>
|
||||
<li>Fix memory corruption when having 64DD Disk files</li>
|
||||
<li>Fix possible crash when render window wasn't visible yet</li>
|
||||
<li>Fix RMG changing the current directory on non-portable installs</li>
|
||||
<li>Remove Qt warning messages (you can view them by setting RMG_SHOW_DEBUG_QT_MESSAGES to 1)</li>
|
||||
<li>Change "Choose ROM Directory" to "Change ROM Directory"</li>
|
||||
<li>Add -q/--quit-after-emulation commandline option</li>
|
||||
<li>Add 2 more icons to menubar menus/items</li>
|
||||
<li>Add "Current Save State" tab to Hotkeys tab in settings dialog (this allows you to use a hotkey to change save state slots)</li>
|
||||
<li>Improve behavior of Hotkeys tab in settings dialog</li>
|
||||
<li>Improve behavior of window when exiting RMG while in-game</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.8" date="2023-01-01" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix 'Uniform Size (Grid View)' not being disabled during emulation</li>
|
||||
<li>Fix toolbar not respecting the view setting</li>
|
||||
<li>Fix being stuck at the loading screen when having more ROMs than the ROM search limit</li>
|
||||
<li>Improve error message when opening a ROM fails</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.7" date="2022-12-29" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix core error not showing when the statusbar was hidden</li>
|
||||
<li>Fix .ndd/.64d not being in the empty ROM Browser widget</li>
|
||||
<li>Fix .jpg/.jpeg files not working on covers on Windows</li>
|
||||
<li>Fix updater script not copying subdirectories on Windows (for portable installs)</li>
|
||||
<li>Fix 64DD Disks which required the development IPL not working</li>
|
||||
<li>Fix 64DD Disks showing the wrong internal ROM name (this fix requires clearing the ROM cache)</li>
|
||||
<li>Fix cover filenames allowing invalid characters (they will now be replaced by _)</li>
|
||||
<li>Add more icons to View menu in the menu bar</li>
|
||||
<li>Add 'Uniform Size (Grid View)' to View menu in the menu bar</li>
|
||||
<li>Add smooth scrolling to List View and Grid View</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.6" date="2022-12-28" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix default save state/game directory being incorrect on first run (on non-portable installs)</li>
|
||||
<li>Fix angrylion-rdp-plus not loading settings correctly</li>
|
||||
<li>Fix cheat settings not moving over when renaming a cheat</li>
|
||||
<li>Remove fullscreen resolution combobox from GLideN64 because it did nothing</li>
|
||||
<li>Remove File menu from menu bar</li>
|
||||
<li>Implement disk support without requiring a cartridge</li>
|
||||
<li>Add toolbar</li>
|
||||
<li>Add View menu to menu bar</li>
|
||||
<li>Add Grid view to ROM browser</li>
|
||||
<li>Add icons to all menu bar items</li>
|
||||
<li>Add log dialog</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.5" date="2022-12-14" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix incorrect controller being selected in RMG-Input when having 2 controllers with the same name</li>
|
||||
<li>Fix some UI elements being enabled while the 'Controller Is Plugged In' checkbox is disabled in RMG-Input</li>
|
||||
<li>Fix extra padding being added when having a controller selected and opening RMG-Input</li>
|
||||
<li>Fix creating a new profile in GLideN64</li>
|
||||
<li>Add Z-Trigger visualization in RMG-Input</li>
|
||||
<li>Remove Debugger checkbox in the settings dialog because it did nothing</li>
|
||||
<li>Remove About buttons in the plugin tab of the settings dialog because it did nothing</li>
|
||||
<li>Implement close button on all dialogs</li>
|
||||
<li>Implement custom style support (for Windows only)</li>
|
||||
<li>Implement the ability to remove/reset the main profile in RMG-Input</li>
|
||||
<li>Rename Interface tab in settings dialog to User Interface</li>
|
||||
<li>Migrate to Qt6 (currently the flatpak will remain Qt5)</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.2.4" date="2022-12-08" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
|
||||
@@ -4,55 +4,66 @@ Rosalie's Mupen GUI is a free and open-source mupen64plus GUI written in C++.
|
||||
|
||||
It offers a simple-to-use user interface.
|
||||
|
||||
## System Requirements
|
||||
## Download
|
||||
|
||||
* Operating System
|
||||
* Windows Or Linux
|
||||
* CPU
|
||||
* Intel or AMD processor with SSE2 support
|
||||
* RAM
|
||||
* 512MB or more
|
||||
* Graphics card
|
||||
* OpenGL 3.3 capable
|
||||
#### Windows
|
||||
You can download Rosalie's Mupen GUI on 
|
||||
|
||||
#### Linux
|
||||
You can download Rosalie's Mupen GUI on
|
||||
* [Github Releases (AppImage)](https://github.com/Rosalie241/RMG/releases)
|
||||
* [Flathub (Flatpak)](https://flathub.org/apps/details/com.github.Rosalie241.RMG)
|
||||
* [Arch User Repository](https://aur.archlinux.org/packages/rmg)
|
||||
|
||||
## Support
|
||||
|
||||
You can ask for help or report issues on
|
||||
* [Github](https://github.com/Rosalie241/RMG/issues/new)
|
||||
* [Discord](https://discord.gg/k9GuyJ2PpF)
|
||||
|
||||
## License
|
||||
|
||||
Rosalie's Mupen GUI is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
||||
|
||||
## Showcase
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Building
|
||||
|
||||
#### Linux
|
||||
* Portable Debian/Ubuntu
|
||||
|
||||
```shell
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt5-default build-essential nasm git zip
|
||||
```bash
|
||||
sudo apt-get -y install cmake libhidapi-dev libsamplerate0-dev libspeex-dev libminizip-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev pkg-config zlib1g-dev binutils-dev libspeexdsp-dev qt6-base-dev libqt6svg6-dev build-essential nasm git zip ninja-build
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
* Portable Fedora
|
||||
```shell
|
||||
sudo dnf install hidapi-devel libsamplerate-devel minizip-compat-devel SDL2-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel zlib-ng-devel binutils-devel speexdsp-devel qt5-qtbase-devel qt5-qtsvg-devel gcc-c++ nasm git
|
||||
./Source/Script/Build.sh Release
|
||||
```bash
|
||||
sudo dnf install hidapi-devel libsamplerate-devel minizip-compat-devel SDL2-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel zlib-ng-devel binutils-devel speexdsp-devel qt6-qtbase-devel qt6-qtsvg-devel gcc-c++ nasm git ninja-build
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
When it's done building, executables can be found in `Bin/Release`
|
||||
|
||||
* Installation/Packaging
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE="Release" -DPORTABLE_INSTALL="OFF" -G "Unix Makefiles"
|
||||
make install
|
||||
```bash
|
||||
export src_dir="$(pwd)"
|
||||
export build_dir="$(pwd)/build"
|
||||
mkdir -p "$build_dir"
|
||||
cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="Release" -DPORTABLE_INSTALL="OFF" -DCMAKE_INSTALL_PREFIX="/usr" -G "Ninja"
|
||||
cmake --build "$build_dir"
|
||||
cmake --install "$build_dir" --prefix="/usr"
|
||||
```
|
||||
|
||||
#### Windows
|
||||
* Download & Install [MSYS2](https://www.msys2.org/)
|
||||
```
|
||||
sudo pacman -S git make mingw-w64-x86_64-cmake mingw-w64-x86_64-freetype mingw-w64-x86_64-gcc mingw-w64-x86_64-hidapi mingw-w64-x86_64-jasper mingw-w64-x86_64-libpng mingw-w64-x86_64-libsamplerate mingw-w64-x86_64-nasm mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-pyopenssl mingw-w64-x86_64-qt5 mingw-w64-x86_64-rust mingw-w64-x86_64-SDL2
|
||||
```bash
|
||||
pacman -S --needed make mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-hidapi mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-SDL2 mingw-w64-x86_64-qt6 mingw-w64-x86_64-SDL2 mingw-w64-x86_64-hidapi mingw-w64-x86_64-speexdsp mingw-w64-x86_64-libsamplerate mingw-w64-x86_64-nasm mingw-w64-x86_64-minizip git
|
||||
./Source/Script/Build.sh Release
|
||||
```
|
||||
|
||||
When it's done building, executables can be found in `Bin/Release`
|
||||
|
||||
## Support
|
||||
|
||||
Join the [Rosalie's Mupen GUI Discord Server](https://discord.gg/k9GuyJ2PpF) for support
|
||||
|
||||
## License
|
||||
|
||||
Rosalie's Mupen GUI is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# 7-Zip CMakeLists.txt
|
||||
#
|
||||
project(7Zip)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set(7ZIP_SOURCES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Bcj2.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Bra.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Bra86.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/BraIA64.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/CpuArch.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Delta.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Lzma2Dec.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/LzmaDec.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Ppmd7.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Ppmd7Dec.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zCrc.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zCrcOpt.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Sha256.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/Sha256Opt.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zAlloc.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zArcIn.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zBuf.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zBuf2.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zDec.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zFile.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/C/7zStream.c
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${7ZIP_SOURCES}
|
||||
COMMAND ${CMAKE_COMMAND} -E tar "xvz" "${CMAKE_CURRENT_SOURCE_DIR}/lzma2301.tar.gz"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_definitions(-D_7ZIP_PPMD_SUPPPORT -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE)
|
||||
|
||||
add_library(7Zip STATIC ${7ZIP_SOURCES})
|
||||
@@ -0,0 +1,2 @@
|
||||
# 7-Zip SDK v23.01
|
||||
Downloaded from https://www.7-zip.org/sdk.html
|
||||
@@ -6,7 +6,9 @@ include(ExternalProject)
|
||||
set(THIRDPARTY_DIR ${CMAKE_BINARY_DIR}/Source/3rdParty)
|
||||
|
||||
find_program(RUST_CARGO cargo)
|
||||
if(${RUST_CARGO} STREQUAL "RUST_CARGO-NOTFOUND")
|
||||
if(NO_RUST)
|
||||
set(BUILD_INPUT_GCA OFF)
|
||||
elseif(${RUST_CARGO} STREQUAL "RUST_CARGO-NOTFOUND")
|
||||
message(WARNING "mupen64plus-input-gca will not be built due to not having cargo installed")
|
||||
set(BUILD_INPUT_GCA OFF)
|
||||
else()
|
||||
@@ -24,36 +26,53 @@ else(WIN32)
|
||||
set(CORE_FILE "libmupen64plus.so")
|
||||
endif(WIN32)
|
||||
|
||||
set(BASE_CMAKE_CONFIGURE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
|
||||
if (USE_CCACHE)
|
||||
set(CMAKE_CONFIGURE_ARGS ${BASE_CMAKE_CONFIGURE_ARGS} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache)
|
||||
set(MAKE_CC_COMPILER "ccache ${CMAKE_C_COMPILER}")
|
||||
set(MAKE_CXX_COMPILER "ccache ${CMAKE_CXX_COMPILER}")
|
||||
else(USE_CCACHE)
|
||||
set(CMAKE_CONFIGURE_ARGS ${BASE_CMAKE_CONFIGURE_ARGS})
|
||||
set(MAKE_CC_COMPILER "${CMAKE_C_COMPILER}")
|
||||
set(MAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
|
||||
endif(USE_CCACHE)
|
||||
|
||||
if(NOT NO_GIT_CLONE)
|
||||
set(MUPEN64PLUSCORE_URL "https://github.com/mupen64plus/mupen64plus-core")
|
||||
set(MUPEN64PLUSCORE_TAG "ba9a52483052248b67c324e3fd0e073b807bbea4")
|
||||
|
||||
set(MUPEN64PLUSCORE_URL "https://github.com/Rosalie241/mupen64plus-core")
|
||||
set(MUPEN64PLUSCORE_TAG "bb6949ad2ab268024ee4049279abc2f3c7fbdbb4")
|
||||
|
||||
set(MUPEN64PLUS_RSP_CXD4_URL "https://github.com/mupen64plus/mupen64plus-rsp-cxd4")
|
||||
set(MUPEN64PLUS_RSP_CXD4_TAG "39f79201baa15890c4cbae92f2215a634cc3ee6d")
|
||||
|
||||
|
||||
set(MUPEN64PLUS_RSP_HLE_URL "https://github.com/mupen64plus/mupen64plus-rsp-hle")
|
||||
set(MUPEN64PLUS_RSP_HLE_TAG "88093cb43499eff53d343653cddcae2132af17ef")
|
||||
|
||||
|
||||
set(MUPEN64PLUS_RSP_PARALLEL_URL "https://github.com/Rosalie241/parallel-rsp")
|
||||
set(MUPEN64PLUS_RSP_PARALLEL_TAG "e67cee3131651c3e48343294d94fa68a6f8ec14c")
|
||||
|
||||
set(MUPEN64PLUS_RSP_PARALLEL_TAG "dbecbe3a120e428436c5972fa7b872cfc2c9db3e")
|
||||
|
||||
set(MUPEN64PLUS_INPUT_RAPHNET_URL "https://github.com/raphnet/mupen64plus-input-raphnetraw")
|
||||
set(MUPEN64PLUS_INPUT_RAPHNET_TAG "86112413e98a8648edb11d199673cc24d5799af8")
|
||||
|
||||
|
||||
set(MUPEN64PLUS_INPUT_GCA_URL "https://github.com/amatho/mupen64plus-input-gca")
|
||||
set(MUPEN64PLUS_INPUT_GCA_TAG "21639fb13dfa797a7c0949ffd9bbda9a3456fc69")
|
||||
|
||||
set(MUPEN64PLUS_GFX_ANGRYLION_URL "https://github.com/Rosalie241/angrylion-rdp-plus")
|
||||
set(MUPEN64PLUS_GFX_ANGRYLION_TAG "9d71074f6b71750e99ad06a713f28a9c32ad15cb")
|
||||
set(MUPEN64PLUS_GFX_ANGRYLION_TAG "670abbc972bd430fa77291b0967dd73128314317")
|
||||
|
||||
set(MUPEN64PLUS_GFX_GLIDEN64_URL "https://github.com/gonetz/GLideN64")
|
||||
set(MUPEN64PLUS_GFX_GLIDEN64_TAG "ff47414c2bd6e572872e9148b2f3e1dbc83e5fee")
|
||||
set(MUPEN64PLUS_GFX_GLIDEN64_URL "https://github.com/Rosalie241/GLideN64")
|
||||
set(MUPEN64PLUS_GFX_GLIDEN64_TAG "2f1b358028e700fcae2502a53f4f5e6822ce0367")
|
||||
|
||||
set(MUPEN64PLUS_GFX_PARALLEL_URL "https://github.com/Rosalie241/parallel-rdp-standalone")
|
||||
set(MUPEN64PLUS_GFX_PARALLEL_TAG "693f607728aca78d94ba5d45b0ce119b4ccbcd8c")
|
||||
set(MUPEN64PLUS_GFX_PARALLEL_TAG "2c2226517c4c8929e08ec944654867e26efe0cf5")
|
||||
|
||||
set(DISCORD_RPC_URL "https://github.com/discord/discord-rpc")
|
||||
set(DISCORD_RPC_TAG "963aa9f3e5ce81a4682c6ca3d136cddda614db33")
|
||||
|
||||
set(IMGUI_URL "https://github.com/ocornut/imgui")
|
||||
set(IMGUI_TAG "d7c8516a4b848c0291e3d75b627c0843f515f591")
|
||||
|
||||
set(SDL_GAMECONTROLLERDB_URL "https://github.com/gabomdq/SDL_GameControllerDB")
|
||||
set(SDL_GAMECONTROLLERDB_TAG "5e25aeccb84fb166451443c4cd9fff349e8b0360")
|
||||
endif(NOT NO_GIT_CLONE)
|
||||
|
||||
ExternalProject_Add(mupen64plus-core
|
||||
@@ -65,11 +84,11 @@ ExternalProject_Add(mupen64plus-core
|
||||
GIT_REPOSITORY ${MUPEN64PLUSCORE_URL}
|
||||
GIT_TAG ${MUPEN64PLUSCORE_TAG}
|
||||
|
||||
BUILD_COMMAND make all OSD=0 NEW_DYNAREC=1 TARGET=${CORE_FILE} DEBUG=$<CONFIG:Debug> KEYBINDINGS=0
|
||||
BUILD_COMMAND make all OSD=0 NEW_DYNAREC=1 KEYBINDINGS=0 ACCURATE_FPU=1 TARGET=${CORE_FILE} DEBUG=$<CONFIG:Debug> CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_IN_SOURCE False
|
||||
|
||||
BINARY_DIR ${M64P_CORE_DIR}/projects/unix
|
||||
|
||||
|
||||
BUILD_BYPRODUCTS ${M64P_CORE_DIR}/projects/unix/${CORE_FILE}
|
||||
)
|
||||
|
||||
@@ -84,11 +103,11 @@ ExternalProject_Add(mupen64plus-rsp-cxd4
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_RSP_CXD4_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_RSP_CXD4_TAG}
|
||||
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> POSTFIX=
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> POSTFIX= CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_IN_SOURCE False
|
||||
|
||||
BINARY_DIR ${THIRDPARTY_DIR}/mupen64plus-rsp-cxd4/projects/unix
|
||||
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-rsp-cxd4/projects/unix/mupen64plus-rsp-cxd4.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
)
|
||||
@@ -102,7 +121,7 @@ ExternalProject_Add(mupen64plus-rsp-hle
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_RSP_HLE_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_RSP_HLE_TAG}
|
||||
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug>
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_IN_SOURCE False
|
||||
|
||||
BINARY_DIR ${THIRDPARTY_DIR}/mupen64plus-rsp-hle/projects/unix
|
||||
@@ -120,7 +139,7 @@ ExternalProject_Add(mupen64plus-rsp-parallel
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
CMAKE_ARGS ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-rsp-parallel/mupen64plus-rsp-parallel.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
@@ -135,11 +154,11 @@ ExternalProject_Add(mupen64plus-input-raphnetraw
|
||||
GIT_REPOSITORY ${MUPEN64PLUS_INPUT_RAPHNET_URL}
|
||||
GIT_TAG ${MUPEN64PLUS_INPUT_RAPHNET_TAG}
|
||||
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug>
|
||||
BUILD_COMMAND make all APIDIR=${APIDIR} DEBUG=$<CONFIG:Debug> CC=${MAKE_CC_COMPILER} CXX=${MAKE_CXX_COMPILER}
|
||||
BUILD_IN_SOURCE False
|
||||
|
||||
BINARY_DIR ${THIRDPARTY_DIR}/mupen64plus-input-raphnetraw/projects/unix
|
||||
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-input-raphnetraw/projects/unix/mupen64plus-input-raphnetraw.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
)
|
||||
@@ -164,11 +183,12 @@ endif(BUILD_INPUT_GCA)
|
||||
|
||||
set(GLIDEN64_DIR "${THIRDPARTY_DIR}/mupen64plus-video-GLideN64")
|
||||
set(GLIDEN64_BUILD_DIR "${GLIDEN64_DIR}/projects/cmake")
|
||||
if (MSYS)
|
||||
set(GLIDEN64_CUSTOM_INI "${GLIDEN64_DIR}/ini/GLideN64.custom.ini")
|
||||
if (WIN32)
|
||||
set(GLIDEN64_LIB "${GLIDEN64_BUILD_DIR}/mupen64plus-video-GLideN64.${SO_EXT}")
|
||||
else()
|
||||
else(WIN32)
|
||||
set(GLIDEN64_LIB "${GLIDEN64_BUILD_DIR}/plugin/${CMAKE_BUILD_TYPE}/mupen64plus-video-GLideN64.${SO_EXT}")
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
set(GLIDENUI_TRANSLATIONS_LANGS "de;es;fr;it;ja;pl;pt_BR")
|
||||
foreach(LANG ${GLIDENUI_TRANSLATIONS_LANGS})
|
||||
@@ -184,7 +204,7 @@ ExternalProject_Add(mupen64plus-video-angrylion-plus
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DBUILD_MUPEN64PLUS=ON -DBUILD_PROJECT64=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
CMAKE_ARGS -DBUILD_MUPEN64PLUS=ON -DBUILD_PROJECT64=OFF -DUSE_QT5=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-video-angrylion-plus/mupen64plus-video-angrylion-plus.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
@@ -199,14 +219,12 @@ ExternalProject_Add(mupen64plus-video-GLideN64
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE False
|
||||
CMAKE_ARGS -DMUPENPLUSAPI=ON -DMUPENPLUSAPI_GLIDENUI=ON -DUSE_SYSTEM_LIBS=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
CMAKE_ARGS -DMUPENPLUSAPI=ON -DMUPENPLUSAPI_GLIDENUI=ON -DGLIDENUI_QT6=ON -DUSE_SYSTEM_LIBS=ON ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
SOURCE_SUBDIR ./src/
|
||||
BINARY_DIR ${GLIDEN64_BUILD_DIR}
|
||||
|
||||
BUILD_BYPRODUCTS ${GLIDEN64_LIB}
|
||||
BUILD_BYPRODUCTS ${GLIDEN64_DIR}/ini/GLideN64.custom.ini
|
||||
BUILD_BYPRODUCTS ${GLIDENUI_TRANSLATIONS}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mupen64plus-video-parallel
|
||||
@@ -218,7 +236,7 @@ ExternalProject_Add(mupen64plus-video-parallel
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
CMAKE_ARGS -DUSE_QT5=OFF ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-video-parallel/mupen64plus-video-parallel.${SO_EXT}
|
||||
DEPENDS mupen64plus-core
|
||||
@@ -234,12 +252,66 @@ if (DISCORD_RPC)
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_IN_SOURCE True
|
||||
CMAKE_ARGS -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
CMAKE_ARGS -DBUILD_EXAMPLES=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON ${CMAKE_CONFIGURE_ARGS}
|
||||
|
||||
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/discord-rpc/src/libdiscord-rpc.a
|
||||
)
|
||||
endif(DISCORD_RPC)
|
||||
|
||||
set(IMGUI_DIR ${THIRDPARTY_DIR}/imgui)
|
||||
set(IMGUI_BUILD_DIR ${IMGUI_DIR}/build)
|
||||
set(IMGUI_SOURCES_IN
|
||||
${IMGUI_DIR}/imgui_draw.cpp
|
||||
${IMGUI_DIR}/imgui_tables.cpp
|
||||
${IMGUI_DIR}/imgui_widgets.cpp
|
||||
${IMGUI_DIR}/imgui.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_opengl3.h
|
||||
${IMGUI_DIR}/backends/imgui_impl_opengl3_loader.h
|
||||
)
|
||||
set(IMGUI_SOURCES_OUT
|
||||
${IMGUI_BUILD_DIR}/imgui_draw.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_tables.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_widgets.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_impl_opengl3.cpp
|
||||
${IMGUI_BUILD_DIR}/imgui_impl_opengl3.h
|
||||
${IMGUI_BUILD_DIR}/imgui_impl_opengl3_loader.h
|
||||
)
|
||||
ExternalProject_Add(imgui
|
||||
SOURCE_DIR imgui
|
||||
|
||||
GIT_REPOSITORY ${IMGUI_URL}
|
||||
GIT_TAG ${IMGUI_TAG}
|
||||
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory ${IMGUI_BUILD_DIR}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E copy ${IMGUI_SOURCES_IN} ${IMGUI_BUILD_DIR}
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_BYPRODUCTS ${IMGUI_SOURCES_OUT}
|
||||
)
|
||||
|
||||
set(SDL_GAMECONTROLLERDB_DIR ${THIRDPARTY_DIR}/SDL_GameControllerDB)
|
||||
set(SDL_GAMECONTROLLERDB_BUILD_DIR ${SDL_GAMECONTROLLERDB_DIR}/build)
|
||||
set(SDL_GAMECONTROLLERDB_SOURCES_IN
|
||||
${SDL_GAMECONTROLLERDB_DIR}/gamecontrollerdb.txt
|
||||
)
|
||||
set(SDL_GAMECONTROLLERDB_SOURCES_OUT
|
||||
${SDL_GAMECONTROLLERDB_BUILD_DIR}/gamecontrollerdb.txt
|
||||
)
|
||||
ExternalProject_Add(SDL_GameControllerDB
|
||||
SOURCE_DIR SDL_GameControllerDB
|
||||
|
||||
GIT_REPOSITORY ${SDL_GAMECONTROLLERDB_URL}
|
||||
GIT_TAG ${SDL_GAMECONTROLLERDB_TAG}
|
||||
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory ${SDL_GAMECONTROLLERDB_BUILD_DIR}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E copy ${SDL_GAMECONTROLLERDB_SOURCES_IN} ${SDL_GAMECONTROLLERDB_SOURCES_OUT}
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
BUILD_BYPRODUCTS ${SDL_GAMECONTROLLERDB_SOURCES_OUT}
|
||||
)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-core BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUSCORE_LIB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
set(MUPEN64PLUSCORE_INI ${M64P_CORE_DIR}/data/mupen64plus.ini PARENT_SCOPE)
|
||||
@@ -265,12 +337,19 @@ ExternalProject_Get_property(mupen64plus-video-angrylion-plus BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_ANGRYLION ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-video-GLideN64 BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64 ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_GLIDEN64 ${BUILD_BYPRODUCTS} ${GLIDENUI_TRANSLATIONS} ${GLIDEN64_CUSTOM_INI} PARENT_SCOPE)
|
||||
|
||||
ExternalProject_Get_property(mupen64plus-video-parallel BUILD_BYPRODUCTS)
|
||||
set(MUPEN64PLUS_PLUGIN_GFX_PARALLEL ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
if (DISCORD_RPC)
|
||||
ExternalProject_Get_property(discord-rpc BUILD_BYPRODUCTS)
|
||||
set(DISCORD_RPC_LIB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
ExternalProject_Get_property(discord-rpc BUILD_BYPRODUCTS)
|
||||
set(DISCORD_RPC_LIB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
endif(DISCORD_RPC)
|
||||
|
||||
ExternalProject_Get_property(imgui BUILD_BYPRODUCTS)
|
||||
set(IMGUI_SOURCES ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
set(IMGUI_DIR ${THIRDPARTY_DIR}/imgui PARENT_SCOPE)
|
||||
|
||||
ExternalProject_Get_property(SDL_GameControllerDB BUILD_BYPRODUCTS)
|
||||
set(SDL_GAMECONTROLLERDB ${BUILD_BYPRODUCTS} PARENT_SCOPE)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# 7-Zip CMakeLists.txt
|
||||
#
|
||||
project(vosk-api)
|
||||
|
||||
set(VOSK_API_VERSION "0.3.45")
|
||||
|
||||
if (WIN32)
|
||||
set(VOSK_API_PLATFORM "win64")
|
||||
set(SO_EXT "dll")
|
||||
else(WIN32)
|
||||
set(SO_EXT "so")
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
|
||||
set(VOSK_API_PLATFORM "linux-aarch64")
|
||||
else()
|
||||
set(VOSK_API_PLATFORM "linux-x86_64")
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
set(VOSK_API_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vosk-${VOSK_API_PLATFORM}-${VOSK_API_VERSION}/libvosk.${SO_EXT}
|
||||
)
|
||||
|
||||
add_library(vosk-api IMPORTED SHARED ${VOSK_API_SOURCES})
|
||||
|
||||
set(VOSK_API_LIBRARY ${VOSK_API_SOURCES} PARENT_SCOPE)
|
||||
set(VOSK_API_MODEL "${CMAKE_CURRENT_SOURCE_DIR}/vosk-model-small-en-us-0.15.zip" PARENT_SCOPE)
|
||||
@@ -0,0 +1,4 @@
|
||||
# vosk-api
|
||||
Downloaded from https://github.com/alphacep/vosk-api/releases/tag/v0.3.45
|
||||
# vosk-model-small-en-us-0.15.zip
|
||||
Downloaded from https://alphacephei.com/vosk/models
|
||||
@@ -0,0 +1,361 @@
|
||||
// Copyright 2020-2021 Alpha Cephei Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/* This header contains the C API for Vosk speech recognition system */
|
||||
|
||||
#ifndef VOSK_API_H
|
||||
#define VOSK_API_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Model stores all the data required for recognition
|
||||
* it contains static data and can be shared across processing
|
||||
* threads. */
|
||||
typedef struct VoskModel VoskModel;
|
||||
|
||||
|
||||
/** Speaker model is the same as model but contains the data
|
||||
* for speaker identification. */
|
||||
typedef struct VoskSpkModel VoskSpkModel;
|
||||
|
||||
|
||||
/** Recognizer object is the main object which processes data.
|
||||
* Each recognizer usually runs in own thread and takes audio as input.
|
||||
* Once audio is processed recognizer returns JSON object as a string
|
||||
* which represent decoded information - words, confidences, times, n-best lists,
|
||||
* speaker information and so on */
|
||||
typedef struct VoskRecognizer VoskRecognizer;
|
||||
|
||||
|
||||
/**
|
||||
* Batch model object
|
||||
*/
|
||||
typedef struct VoskBatchModel VoskBatchModel;
|
||||
|
||||
/**
|
||||
* Batch recognizer object
|
||||
*/
|
||||
typedef struct VoskBatchRecognizer VoskBatchRecognizer;
|
||||
|
||||
|
||||
/** Loads model data from the file and returns the model object
|
||||
*
|
||||
* @param model_path: the path of the model on the filesystem
|
||||
* @returns model object or NULL if problem occured */
|
||||
VoskModel *vosk_model_new(const char *model_path);
|
||||
|
||||
|
||||
/** Releases the model memory
|
||||
*
|
||||
* The model object is reference-counted so if some recognizer
|
||||
* depends on this model, model might still stay alive. When
|
||||
* last recognizer is released, model will be released too. */
|
||||
void vosk_model_free(VoskModel *model);
|
||||
|
||||
|
||||
/** Check if a word can be recognized by the model
|
||||
* @param word: the word
|
||||
* @returns the word symbol if @param word exists inside the model
|
||||
* or -1 otherwise.
|
||||
* Reminding that word symbol 0 is for <epsilon> */
|
||||
int vosk_model_find_word(VoskModel *model, const char *word);
|
||||
|
||||
|
||||
/** Loads speaker model data from the file and returns the model object
|
||||
*
|
||||
* @param model_path: the path of the model on the filesystem
|
||||
* @returns model object or NULL if problem occured */
|
||||
VoskSpkModel *vosk_spk_model_new(const char *model_path);
|
||||
|
||||
|
||||
/** Releases the model memory
|
||||
*
|
||||
* The model object is reference-counted so if some recognizer
|
||||
* depends on this model, model might still stay alive. When
|
||||
* last recognizer is released, model will be released too. */
|
||||
void vosk_spk_model_free(VoskSpkModel *model);
|
||||
|
||||
/** Creates the recognizer object
|
||||
*
|
||||
* The recognizers process the speech and return text using shared model data
|
||||
* @param model VoskModel containing static data for recognizer. Model can be
|
||||
* shared across recognizers, even running in different threads.
|
||||
* @param sample_rate The sample rate of the audio you going to feed into the recognizer.
|
||||
* Make sure this rate matches the audio content, it is a common
|
||||
* issue causing accuracy problems.
|
||||
* @returns recognizer object or NULL if problem occured */
|
||||
VoskRecognizer *vosk_recognizer_new(VoskModel *model, float sample_rate);
|
||||
|
||||
|
||||
/** Creates the recognizer object with speaker recognition
|
||||
*
|
||||
* With the speaker recognition mode the recognizer not just recognize
|
||||
* text but also return speaker vectors one can use for speaker identification
|
||||
*
|
||||
* @param model VoskModel containing static data for recognizer. Model can be
|
||||
* shared across recognizers, even running in different threads.
|
||||
* @param sample_rate The sample rate of the audio you going to feed into the recognizer.
|
||||
* Make sure this rate matches the audio content, it is a common
|
||||
* issue causing accuracy problems.
|
||||
* @param spk_model speaker model for speaker identification
|
||||
* @returns recognizer object or NULL if problem occured */
|
||||
VoskRecognizer *vosk_recognizer_new_spk(VoskModel *model, float sample_rate, VoskSpkModel *spk_model);
|
||||
|
||||
|
||||
/** Creates the recognizer object with the phrase list
|
||||
*
|
||||
* Sometimes when you want to improve recognition accuracy and when you don't need
|
||||
* to recognize large vocabulary you can specify a list of phrases to recognize. This
|
||||
* will improve recognizer speed and accuracy but might return [unk] if user said
|
||||
* something different.
|
||||
*
|
||||
* Only recognizers with lookahead models support this type of quick configuration.
|
||||
* Precompiled HCLG graph models are not supported.
|
||||
*
|
||||
* @param model VoskModel containing static data for recognizer. Model can be
|
||||
* shared across recognizers, even running in different threads.
|
||||
* @param sample_rate The sample rate of the audio you going to feed into the recognizer.
|
||||
* Make sure this rate matches the audio content, it is a common
|
||||
* issue causing accuracy problems.
|
||||
* @param grammar The string with the list of phrases to recognize as JSON array of strings,
|
||||
* for example "["one two three four five", "[unk]"]".
|
||||
*
|
||||
* @returns recognizer object or NULL if problem occured */
|
||||
VoskRecognizer *vosk_recognizer_new_grm(VoskModel *model, float sample_rate, const char *grammar);
|
||||
|
||||
|
||||
/** Adds speaker model to already initialized recognizer
|
||||
*
|
||||
* Can add speaker recognition model to already created recognizer. Helps to initialize
|
||||
* speaker recognition for grammar-based recognizer.
|
||||
*
|
||||
* @param spk_model Speaker recognition model */
|
||||
void vosk_recognizer_set_spk_model(VoskRecognizer *recognizer, VoskSpkModel *spk_model);
|
||||
|
||||
|
||||
/** Reconfigures recognizer to use grammar
|
||||
*
|
||||
* @param recognizer Already running VoskRecognizer
|
||||
* @param grammar Set of phrases in JSON array of strings or "[]" to use default model graph.
|
||||
* See also vosk_recognizer_new_grm
|
||||
*/
|
||||
void vosk_recognizer_set_grm(VoskRecognizer *recognizer, char const *grammar);
|
||||
|
||||
|
||||
/** Configures recognizer to output n-best results
|
||||
*
|
||||
* <pre>
|
||||
* {
|
||||
* "alternatives": [
|
||||
* { "text": "one two three four five", "confidence": 0.97 },
|
||||
* { "text": "one two three for five", "confidence": 0.03 },
|
||||
* ]
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param max_alternatives - maximum alternatives to return from recognition results
|
||||
*/
|
||||
void vosk_recognizer_set_max_alternatives(VoskRecognizer *recognizer, int max_alternatives);
|
||||
|
||||
|
||||
/** Enables words with times in the output
|
||||
*
|
||||
* <pre>
|
||||
* "result" : [{
|
||||
* "conf" : 1.000000,
|
||||
* "end" : 1.110000,
|
||||
* "start" : 0.870000,
|
||||
* "word" : "what"
|
||||
* }, {
|
||||
* "conf" : 1.000000,
|
||||
* "end" : 1.530000,
|
||||
* "start" : 1.110000,
|
||||
* "word" : "zero"
|
||||
* }, {
|
||||
* "conf" : 1.000000,
|
||||
* "end" : 1.950000,
|
||||
* "start" : 1.530000,
|
||||
* "word" : "zero"
|
||||
* }, {
|
||||
* "conf" : 1.000000,
|
||||
* "end" : 2.340000,
|
||||
* "start" : 1.950000,
|
||||
* "word" : "zero"
|
||||
* }, {
|
||||
* "conf" : 1.000000,
|
||||
* "end" : 2.610000,
|
||||
* "start" : 2.340000,
|
||||
* "word" : "one"
|
||||
* }],
|
||||
* </pre>
|
||||
*
|
||||
* @param words - boolean value
|
||||
*/
|
||||
void vosk_recognizer_set_words(VoskRecognizer *recognizer, int words);
|
||||
|
||||
/** Like above return words and confidences in partial results
|
||||
*
|
||||
* @param partial_words - boolean value
|
||||
*/
|
||||
void vosk_recognizer_set_partial_words(VoskRecognizer *recognizer, int partial_words);
|
||||
|
||||
/** Set NLSML output
|
||||
* @param nlsml - boolean value
|
||||
*/
|
||||
void vosk_recognizer_set_nlsml(VoskRecognizer *recognizer, int nlsml);
|
||||
|
||||
|
||||
/** Accept voice data
|
||||
*
|
||||
* accept and process new chunk of voice data
|
||||
*
|
||||
* @param data - audio data in PCM 16-bit mono format
|
||||
* @param length - length of the audio data
|
||||
* @returns 1 if silence is occured and you can retrieve a new utterance with result method
|
||||
* 0 if decoding continues
|
||||
* -1 if exception occured */
|
||||
int vosk_recognizer_accept_waveform(VoskRecognizer *recognizer, const char *data, int length);
|
||||
|
||||
|
||||
/** Same as above but the version with the short data for language bindings where you have
|
||||
* audio as array of shorts */
|
||||
int vosk_recognizer_accept_waveform_s(VoskRecognizer *recognizer, const short *data, int length);
|
||||
|
||||
|
||||
/** Same as above but the version with the float data for language bindings where you have
|
||||
* audio as array of floats */
|
||||
int vosk_recognizer_accept_waveform_f(VoskRecognizer *recognizer, const float *data, int length);
|
||||
|
||||
|
||||
/** Returns speech recognition result
|
||||
*
|
||||
* @returns the result in JSON format which contains decoded line, decoded
|
||||
* words, times in seconds and confidences. You can parse this result
|
||||
* with any json parser
|
||||
*
|
||||
* <pre>
|
||||
* {
|
||||
* "text" : "what zero zero zero one"
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* If alternatives enabled it returns result with alternatives, see also vosk_recognizer_set_max_alternatives().
|
||||
*
|
||||
* If word times enabled returns word time, see also vosk_recognizer_set_word_times().
|
||||
*/
|
||||
const char *vosk_recognizer_result(VoskRecognizer *recognizer);
|
||||
|
||||
|
||||
/** Returns partial speech recognition
|
||||
*
|
||||
* @returns partial speech recognition text which is not yet finalized.
|
||||
* result may change as recognizer process more data.
|
||||
*
|
||||
* <pre>
|
||||
* {
|
||||
* "partial" : "cyril one eight zero"
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
const char *vosk_recognizer_partial_result(VoskRecognizer *recognizer);
|
||||
|
||||
|
||||
/** Returns speech recognition result. Same as result, but doesn't wait for silence
|
||||
* You usually call it in the end of the stream to get final bits of audio. It
|
||||
* flushes the feature pipeline, so all remaining audio chunks got processed.
|
||||
*
|
||||
* @returns speech result in JSON format.
|
||||
*/
|
||||
const char *vosk_recognizer_final_result(VoskRecognizer *recognizer);
|
||||
|
||||
|
||||
/** Resets the recognizer
|
||||
*
|
||||
* Resets current results so the recognition can continue from scratch */
|
||||
void vosk_recognizer_reset(VoskRecognizer *recognizer);
|
||||
|
||||
|
||||
/** Releases recognizer object
|
||||
*
|
||||
* Underlying model is also unreferenced and if needed released */
|
||||
void vosk_recognizer_free(VoskRecognizer *recognizer);
|
||||
|
||||
/** Set log level for Kaldi messages
|
||||
*
|
||||
* @param log_level the level
|
||||
* 0 - default value to print info and error messages but no debug
|
||||
* less than 0 - don't print info messages
|
||||
* greather than 0 - more verbose mode
|
||||
*/
|
||||
void vosk_set_log_level(int log_level);
|
||||
|
||||
/**
|
||||
* Init, automatically select a CUDA device and allow multithreading.
|
||||
* Must be called once from the main thread.
|
||||
* Has no effect if HAVE_CUDA flag is not set.
|
||||
*/
|
||||
void vosk_gpu_init();
|
||||
|
||||
/**
|
||||
* Init CUDA device in a multi-threaded environment.
|
||||
* Must be called for each thread.
|
||||
* Has no effect if HAVE_CUDA flag is not set.
|
||||
*/
|
||||
void vosk_gpu_thread_init();
|
||||
|
||||
/** Creates the batch recognizer object
|
||||
*
|
||||
* @returns model object or NULL if problem occured */
|
||||
VoskBatchModel *vosk_batch_model_new(const char *model_path);
|
||||
|
||||
/** Releases batch model object */
|
||||
void vosk_batch_model_free(VoskBatchModel *model);
|
||||
|
||||
/** Wait for the processing */
|
||||
void vosk_batch_model_wait(VoskBatchModel *model);
|
||||
|
||||
/** Creates batch recognizer object
|
||||
* @returns recognizer object or NULL if problem occured */
|
||||
VoskBatchRecognizer *vosk_batch_recognizer_new(VoskBatchModel *model, float sample_rate);
|
||||
|
||||
/** Releases batch recognizer object */
|
||||
void vosk_batch_recognizer_free(VoskBatchRecognizer *recognizer);
|
||||
|
||||
/** Accept batch voice data */
|
||||
void vosk_batch_recognizer_accept_waveform(VoskBatchRecognizer *recognizer, const char *data, int length);
|
||||
|
||||
/** Set NLSML output
|
||||
* @param nlsml - boolean value
|
||||
*/
|
||||
void vosk_batch_recognizer_set_nlsml(VoskBatchRecognizer *recognizer, int nlsml);
|
||||
|
||||
/** Closes the stream */
|
||||
void vosk_batch_recognizer_finish_stream(VoskBatchRecognizer *recognizer);
|
||||
|
||||
/** Return results */
|
||||
const char *vosk_batch_recognizer_front_result(VoskBatchRecognizer *recognizer);
|
||||
|
||||
/** Release and free first retrieved result */
|
||||
void vosk_batch_recognizer_pop(VoskBatchRecognizer *recognizer);
|
||||
|
||||
/** Get amount of pending chunks for more intelligent waiting */
|
||||
int vosk_batch_recognizer_get_pending_chunks(VoskBatchRecognizer *recognizer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VOSK_API_H */
|
||||
@@ -55,5 +55,5 @@ Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
find_package(Qt5 COMPONENTS Gui Widgets Core REQUIRED)
|
||||
find_package(Qt6 COMPONENTS Gui Widgets Core REQUIRED)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
@@ -36,7 +36,7 @@ target_link_libraries(RMG-Audio
|
||||
${SDL2_LIBRARIES}
|
||||
${SPEEX_LIBRARIES}
|
||||
${SAMPLERATE_LIBRARIES}
|
||||
Qt5::Gui Qt5::Widgets
|
||||
Qt6::Gui Qt6::Widgets
|
||||
)
|
||||
|
||||
target_include_directories(RMG-Audio PRIVATE
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
|
||||
using namespace UserInterface;
|
||||
|
||||
MainDialog::MainDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
|
||||
MainDialog::MainDialog(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
this->setupUi(this);
|
||||
this->setWindowIcon(QIcon(":Resource/RMG.png"));
|
||||
|
||||
this->setIconsForEmulationInfoText();
|
||||
|
||||
this->volumeSlider->setValue(CoreSettingsGetIntValue(SettingsID::Audio_Volume));
|
||||
this->muteCheckBox->setChecked(CoreSettingsGetBoolValue(SettingsID::Audio_Muted));
|
||||
|
||||
@@ -38,6 +40,21 @@ MainDialog::~MainDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void MainDialog::setIconsForEmulationInfoText(void)
|
||||
{
|
||||
QLabel* labels[] = {
|
||||
this->infoIconLabel_0
|
||||
};
|
||||
|
||||
QIcon infoIcon = QIcon::fromTheme("information-line");
|
||||
QPixmap infoIconPixmap = infoIcon.pixmap(16, 16);
|
||||
|
||||
for (QLabel* label : labels)
|
||||
{
|
||||
label->setPixmap(infoIconPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
void MainDialog::hideEmulationInfoText(void)
|
||||
{
|
||||
QHBoxLayout *layouts[] = {this->emulationInfoLayout};
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
~MainDialog(void);
|
||||
|
||||
private:
|
||||
void setIconsForEmulationInfoText(void);
|
||||
void hideEmulationInfoText(void);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="emulationInfoLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="infoIconLabel_0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -335,7 +335,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="UIResources.qrc">:/Resource/Info.ico</pixmap>
|
||||
<pixmap>:/Resource/Info.ico</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,6 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>Resource/RMG.png</file>
|
||||
<file>Resource/Info.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -4,7 +4,6 @@
|
||||
project(RMG-Core)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
@@ -24,6 +23,7 @@ set(RMG_CORE_SOURCES
|
||||
ConvertStringEncoding.cpp
|
||||
Settings/Settings.cpp
|
||||
SpeedLimiter.cpp
|
||||
SpeedFactor.cpp
|
||||
RomSettings.cpp
|
||||
Directories.cpp
|
||||
MediaLoader.cpp
|
||||
@@ -33,6 +33,7 @@ set(RMG_CORE_SOURCES
|
||||
SaveState.cpp
|
||||
Callback.cpp
|
||||
Plugins.cpp
|
||||
Version.cpp
|
||||
Cheats.cpp
|
||||
VidExt.cpp
|
||||
Video.cpp
|
||||
@@ -66,7 +67,7 @@ if (PORTABLE_INSTALL)
|
||||
add_definitions(-DPORTABLE_INSTALL)
|
||||
endif(PORTABLE_INSTALL)
|
||||
|
||||
add_library(RMG-Core STATIC ${RMG_CORE_SOURCES})
|
||||
add_library(RMG-Core SHARED ${RMG_CORE_SOURCES})
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(RMG-Core dl)
|
||||
@@ -78,6 +79,7 @@ endif(WIN32)
|
||||
|
||||
target_link_libraries(RMG-Core
|
||||
${MINIZIP_LIBRARIES}
|
||||
7Zip
|
||||
)
|
||||
|
||||
if (DISCORD_RPC)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
#include "CachedRomHeaderAndSettings.hpp"
|
||||
#include "Directories.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
#include "RomHeader.hpp"
|
||||
#include "Error.hpp"
|
||||
|
||||
#include "osal/osal_files.hpp"
|
||||
@@ -36,11 +38,13 @@
|
||||
#define ROMHEADER_NAME_LEN 256
|
||||
#define GOODNAME_LEN 256
|
||||
#define MD5_LEN 33
|
||||
#define GAMEID_LEN 5
|
||||
#define REGION_LEN 18
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheWindows_04"
|
||||
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheWindows_06"
|
||||
#else // Linux
|
||||
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheLinux_04"
|
||||
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheLinux_06"
|
||||
#endif // _WIN32
|
||||
#define CACHE_FILE_ITEMS_MAX 10000
|
||||
|
||||
@@ -53,6 +57,7 @@ struct l_CacheEntry
|
||||
std::filesystem::path fileName;
|
||||
osal_files_file_time fileTime;
|
||||
|
||||
CoreRomType type;
|
||||
CoreRomHeader header;
|
||||
CoreRomSettings settings;
|
||||
};
|
||||
@@ -102,6 +107,8 @@ void CoreReadRomHeaderAndSettingsCache(void)
|
||||
char magicBuf[sizeof(CACHE_FILE_MAGIC)];
|
||||
wchar_t fileNameBuf[MAX_FILENAME_LEN];
|
||||
char headerNameBuf[ROMHEADER_NAME_LEN];
|
||||
char gameIDBuf[GAMEID_LEN];
|
||||
char regionBuf[REGION_LEN];
|
||||
char goodNameBuf[GOODNAME_LEN];
|
||||
char md5Buf[MD5_LEN];
|
||||
uint32_t size;
|
||||
@@ -130,6 +137,8 @@ void CoreReadRomHeaderAndSettingsCache(void)
|
||||
size = 0;
|
||||
memset(fileNameBuf, 0, sizeof(fileNameBuf));
|
||||
memset(headerNameBuf, 0, sizeof(headerNameBuf));
|
||||
memset(gameIDBuf, 0, sizeof(gameIDBuf));
|
||||
memset(regionBuf, 0, sizeof(regionBuf));
|
||||
memset(goodNameBuf, 0, sizeof(goodNameBuf));
|
||||
memset(md5Buf, 0, sizeof(md5Buf));
|
||||
|
||||
@@ -138,10 +147,18 @@ void CoreReadRomHeaderAndSettingsCache(void)
|
||||
FREAD_STR(fileNameBuf, size);
|
||||
cacheEntry.fileName = std::filesystem::path(fileNameBuf);
|
||||
FREAD(cacheEntry.fileTime);
|
||||
// type
|
||||
FREAD(cacheEntry.type);
|
||||
// header
|
||||
FREAD(size);
|
||||
FREAD_STR(headerNameBuf, size);
|
||||
FREAD(size);
|
||||
FREAD_STR(gameIDBuf, size);
|
||||
FREAD(size);
|
||||
FREAD_STR(regionBuf, size);
|
||||
cacheEntry.header.Name = std::string(headerNameBuf);
|
||||
cacheEntry.header.GameID = std::string(gameIDBuf);
|
||||
cacheEntry.header.Region = std::string(regionBuf);
|
||||
FREAD(cacheEntry.header.CRC1);
|
||||
FREAD(cacheEntry.header.CRC2);
|
||||
// (partial) settings
|
||||
@@ -166,6 +183,8 @@ bool CoreSaveRomHeaderAndSettingsCache(void)
|
||||
std::ofstream outputStream;
|
||||
wchar_t fileNameBuf[MAX_FILENAME_LEN];
|
||||
char headerNameBuf[ROMHEADER_NAME_LEN];
|
||||
char gameIDBuf[GAMEID_LEN];
|
||||
char regionBuf[REGION_LEN];
|
||||
char goodNameBuf[GOODNAME_LEN];
|
||||
char md5Buf[MD5_LEN];
|
||||
uint32_t size;
|
||||
@@ -197,12 +216,16 @@ bool CoreSaveRomHeaderAndSettingsCache(void)
|
||||
size = 0;
|
||||
memset(fileNameBuf, 0, sizeof(fileNameBuf));
|
||||
memset(headerNameBuf, 0, sizeof(headerNameBuf));
|
||||
memset(gameIDBuf, 0, sizeof(gameIDBuf));
|
||||
memset(regionBuf, 0, sizeof(regionBuf));
|
||||
memset(goodNameBuf, 0, sizeof(goodNameBuf));
|
||||
memset(md5Buf, 0, sizeof(md5Buf));
|
||||
|
||||
// copy strings into buffers
|
||||
wcsncpy(fileNameBuf, cacheEntry.fileName.wstring().c_str(), MAX_FILENAME_LEN);
|
||||
strncpy(headerNameBuf, cacheEntry.header.Name.c_str(), sizeof(headerNameBuf));
|
||||
strncpy(gameIDBuf, cacheEntry.header.GameID.c_str(), sizeof(gameIDBuf));
|
||||
strncpy(regionBuf, cacheEntry.header.Region.c_str(), sizeof(regionBuf));
|
||||
strncpy(goodNameBuf, cacheEntry.settings.GoodName.c_str(), sizeof(goodNameBuf));
|
||||
strncpy(md5Buf, cacheEntry.settings.MD5.c_str(), sizeof(md5Buf));
|
||||
|
||||
@@ -211,10 +234,18 @@ bool CoreSaveRomHeaderAndSettingsCache(void)
|
||||
FWRITE(size);
|
||||
FWRITE_STR(fileNameBuf, size);
|
||||
FWRITE(cacheEntry.fileTime);
|
||||
// type
|
||||
FWRITE(cacheEntry.type);
|
||||
// header
|
||||
size = cacheEntry.header.Name.size();
|
||||
FWRITE(size);
|
||||
FWRITE_STR(headerNameBuf, size);
|
||||
size = cacheEntry.header.GameID.size();
|
||||
FWRITE(size);
|
||||
FWRITE_STR(gameIDBuf, size);
|
||||
size = cacheEntry.header.Region.size();
|
||||
FWRITE(size);
|
||||
FWRITE_STR(regionBuf, size);
|
||||
FWRITE(cacheEntry.header.CRC1);
|
||||
FWRITE(cacheEntry.header.CRC2);
|
||||
// (partial) settings
|
||||
@@ -237,7 +268,7 @@ bool CoreHasRomHeaderAndSettingsCached(std::filesystem::path file)
|
||||
return get_cache_entry_iter(file) != l_CacheEntries.end();
|
||||
}
|
||||
|
||||
bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader& header, CoreRomSettings& settings)
|
||||
bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType& type, CoreRomHeader& header, CoreRomSettings& settings)
|
||||
{
|
||||
auto iter = get_cache_entry_iter(file);
|
||||
if (iter == l_CacheEntries.end())
|
||||
@@ -245,12 +276,13 @@ bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader
|
||||
return false;
|
||||
}
|
||||
|
||||
type = (*iter).type;
|
||||
header = (*iter).header;
|
||||
settings = (*iter).settings;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader header, CoreRomSettings settings)
|
||||
bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings)
|
||||
{
|
||||
l_CacheEntry cacheEntry;
|
||||
|
||||
@@ -268,6 +300,7 @@ bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader
|
||||
|
||||
cacheEntry.fileName = file;
|
||||
cacheEntry.fileTime = osal_files_get_file_time(file);
|
||||
cacheEntry.type = type;
|
||||
cacheEntry.header = header;
|
||||
cacheEntry.settings = settings;
|
||||
|
||||
@@ -275,3 +308,57 @@ bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader
|
||||
l_CacheEntriesChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file)
|
||||
{
|
||||
l_CacheEntry cachedEntry;
|
||||
CoreRomType type;
|
||||
CoreRomHeader header;
|
||||
CoreRomSettings settings;
|
||||
|
||||
// try to find existing entry with same filename,
|
||||
// when not found, do nothing
|
||||
auto iter = get_cache_entry_iter(file, false);
|
||||
if (iter == l_CacheEntries.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
cachedEntry = (*iter);
|
||||
|
||||
// attempt to retrieve required information
|
||||
if (!CoreGetRomType(type) ||
|
||||
!CoreGetCurrentRomHeader(header) ||
|
||||
!CoreGetCurrentDefaultRomSettings(settings))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the cached entry needs to be updated,
|
||||
// if it does, then update the entry
|
||||
if (/* rom type */
|
||||
cachedEntry.type != type ||
|
||||
/* header */
|
||||
cachedEntry.header.Name != header.Name ||
|
||||
cachedEntry.header.Region != header.Region ||
|
||||
cachedEntry.header.CRC1 != header.CRC1 ||
|
||||
cachedEntry.header.CRC2 != header.CRC2 ||
|
||||
/* settings */
|
||||
cachedEntry.settings.MD5 != settings.MD5 ||
|
||||
cachedEntry.settings.GoodName != settings.GoodName)
|
||||
{
|
||||
(*iter).type = type;
|
||||
(*iter).header = header;
|
||||
(*iter).settings.MD5 = settings.MD5;
|
||||
(*iter).settings.GoodName = settings.GoodName;
|
||||
l_CacheEntriesChanged = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreClearRomHeaderAndSettingsCache(void)
|
||||
{
|
||||
l_CacheEntries.clear();
|
||||
l_CacheEntriesChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "Rom.hpp"
|
||||
#include "RomHeader.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
|
||||
@@ -30,10 +31,20 @@ bool CoreHasRomHeaderAndSettingsCached(std::filesystem::path file);
|
||||
|
||||
// returns whether retrieving the rom header & settings
|
||||
// for given filename succeeds
|
||||
bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader& header, CoreRomSettings& settings);
|
||||
bool CoreGetCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType& type, CoreRomHeader& header, CoreRomSettings& settings);
|
||||
|
||||
// returns whether adding cached rom header & settings
|
||||
// for given filename succeeds
|
||||
bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomHeader header, CoreRomSettings settings);
|
||||
bool CoreAddCachedRomHeaderAndSettings(std::filesystem::path file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings);
|
||||
|
||||
#ifdef CORE_INTERNAL
|
||||
// returns whether updating the cached rom header & settings
|
||||
// for given filename succeeds
|
||||
bool CoreUpdateCachedRomHeaderAndSettings(std::filesystem::path file);
|
||||
#endif // CORE_INTERNAL
|
||||
|
||||
// returns whether clearing rom header & settings cache
|
||||
// succeeds
|
||||
bool CoreClearRomHeaderAndSettingsCache(void);
|
||||
|
||||
#endif // CORE_CACHEDROMHEADERANDSETTINGS_HPP
|
||||
|
||||
@@ -11,12 +11,20 @@
|
||||
#include "Core.hpp"
|
||||
#include "ConvertStringEncoding.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//
|
||||
// Local Variables
|
||||
//
|
||||
|
||||
static bool l_SetupCallbacks = false;
|
||||
static std::function<void(enum CoreDebugMessageType, std::string)> l_DebugCallbackFunc;
|
||||
static std::function<void(enum CoreDebugMessageType, std::string, std::string)> l_DebugCallbackFunc;
|
||||
static std::function<void(enum CoreStateCallbackType, int)> l_StateCallbackFunc;
|
||||
static bool l_PrintCallbacks = false;
|
||||
|
||||
static bool l_SetupDebugMessageCallback = false;
|
||||
static std::function<void(void*, int, const char*)> l_DebugMessageCallbackFunc;
|
||||
static void* l_DebugMessageCallbackFuncContext;
|
||||
|
||||
//
|
||||
// Internal Functions
|
||||
@@ -24,13 +32,19 @@ static std::function<void(enum CoreDebugMessageType, std::string)> l_DebugCallba
|
||||
|
||||
void CoreDebugCallback(void* context, int level, const char* message)
|
||||
{
|
||||
std::string contextString((const char*)context);
|
||||
std::string messageString(message);
|
||||
|
||||
if (l_PrintCallbacks)
|
||||
{
|
||||
std::cout << contextString << messageString << std::endl;
|
||||
}
|
||||
|
||||
if (!l_SetupCallbacks)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string messageString(message);
|
||||
|
||||
// convert string encoding accordingly
|
||||
if (messageString.starts_with("IS64:"))
|
||||
{
|
||||
@@ -41,21 +55,50 @@ void CoreDebugCallback(void* context, int level, const char* message)
|
||||
messageString = CoreConvertStringEncoding(message, CoreStringEncoding::Shift_JIS);
|
||||
}
|
||||
|
||||
l_DebugCallbackFunc((CoreDebugMessageType)level, messageString);
|
||||
l_DebugCallbackFunc((CoreDebugMessageType)level, contextString, messageString);
|
||||
}
|
||||
|
||||
void CoreStateCallback(void* context, m64p_core_param param, int value)
|
||||
{
|
||||
// TODO
|
||||
if (!l_SetupCallbacks)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
l_StateCallbackFunc((CoreStateCallbackType)param, value);
|
||||
}
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
|
||||
bool CoreSetupCallbacks(std::function<void(enum CoreDebugMessageType, std::string)> debugCallbackFunc)
|
||||
bool CoreSetupCallbacks(std::function<void(enum CoreDebugMessageType, std::string, std::string)> debugCallbackFunc,
|
||||
std::function<void(enum CoreStateCallbackType, int)> stateCallbackFunc)
|
||||
{
|
||||
l_DebugCallbackFunc = debugCallbackFunc;
|
||||
l_StateCallbackFunc = stateCallbackFunc;
|
||||
l_SetupCallbacks = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CoreSetPrintDebugCallback(bool enabled)
|
||||
{
|
||||
l_PrintCallbacks = enabled;
|
||||
}
|
||||
|
||||
void CoreSetupDebugCallbackMessage(std::function<void(void*, int, const char*)> debugCallbackFunc, void* debugCallbackFuncContext)
|
||||
{
|
||||
l_DebugMessageCallbackFunc = debugCallbackFunc;
|
||||
l_DebugMessageCallbackFuncContext = debugCallbackFuncContext;
|
||||
l_SetupDebugMessageCallback = true;
|
||||
}
|
||||
|
||||
void CoreDebugCallbackMessage(CoreDebugMessageType type, std::string message)
|
||||
{
|
||||
if (!l_SetupDebugMessageCallback)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
l_DebugMessageCallbackFunc(l_DebugMessageCallbackFuncContext, (int)type, message.c_str());
|
||||
}
|
||||
|
||||
@@ -32,6 +32,34 @@ enum class CoreDebugMessageType
|
||||
Verbose = 5
|
||||
};
|
||||
|
||||
bool CoreSetupCallbacks(std::function<void(enum CoreDebugMessageType, std::string)> debugCallbackFunc);
|
||||
enum class CoreStateCallbackType
|
||||
{
|
||||
EmulationState = 1,
|
||||
VideoMode,
|
||||
SaveStateSlot,
|
||||
SpeedFactor,
|
||||
SpeedLimiter,
|
||||
VideoSize,
|
||||
AudioVolume,
|
||||
AudioMute,
|
||||
GamesharkInput,
|
||||
SaveStateLoaded,
|
||||
SaveStateSaved,
|
||||
};
|
||||
|
||||
// attempts to setup callbacks with the provided functions
|
||||
bool CoreSetupCallbacks(std::function<void(enum CoreDebugMessageType, std::string, std::string)> debugCallbackFunc,
|
||||
std::function<void(enum CoreStateCallbackType, int)> stateCallbackFunc);
|
||||
|
||||
// sets whether the debug callbacks will be printed to stdout
|
||||
void CoreSetPrintDebugCallback(bool enabled);
|
||||
|
||||
#ifdef CORE_PLUGIN
|
||||
// attempts to setup up the debug message debug callback
|
||||
void CoreSetupDebugCallbackMessage(std::function<void(void*, int, const char*)> debugCallbackFunc, void* debugCallbackFuncContext);
|
||||
|
||||
// sends a debug message to the debug callback (if it exists)
|
||||
void CoreDebugCallbackMessage(CoreDebugMessageType type, std::string message);
|
||||
#endif // CORE_PLUGIN
|
||||
|
||||
#endif // CORE_CALLBACK_HPP
|
||||
|
||||
@@ -118,9 +118,16 @@ static std::filesystem::path get_shared_cheat_file_path(CoreRomHeader romHeader,
|
||||
|
||||
static std::filesystem::path get_user_cheat_file_path(CoreRomHeader romHeader, CoreRomSettings romSettings)
|
||||
{
|
||||
std::filesystem::path oldCheatFilePath;
|
||||
std::filesystem::path cheatFilePath;
|
||||
|
||||
cheatFilePath = CoreGetUserDataDirectory();
|
||||
oldCheatFilePath = CoreGetUserDataDirectory();
|
||||
oldCheatFilePath += OSAL_FILES_DIR_SEPERATOR_STR;
|
||||
oldCheatFilePath += "Cheats-User";
|
||||
oldCheatFilePath += OSAL_FILES_DIR_SEPERATOR_STR;
|
||||
oldCheatFilePath += get_cheat_file_name(romHeader, romSettings);
|
||||
|
||||
cheatFilePath = CoreGetUserConfigDirectory();
|
||||
cheatFilePath += OSAL_FILES_DIR_SEPERATOR_STR;
|
||||
cheatFilePath += "Cheats-User";
|
||||
cheatFilePath += OSAL_FILES_DIR_SEPERATOR_STR;
|
||||
@@ -140,6 +147,12 @@ static std::filesystem::path get_user_cheat_file_path(CoreRomHeader romHeader, C
|
||||
// we'll fail later...
|
||||
}
|
||||
|
||||
// keep compatability with <v0.4.1
|
||||
if (std::filesystem::is_regular_file(oldCheatFilePath))
|
||||
{
|
||||
return oldCheatFilePath;
|
||||
}
|
||||
|
||||
return cheatFilePath;
|
||||
}
|
||||
|
||||
@@ -717,6 +730,7 @@ bool CoreUpdateCheat(CoreCheat oldCheat, CoreCheat newCheat)
|
||||
CoreRomHeader romHeader;
|
||||
CoreRomSettings romSettings;
|
||||
std::filesystem::path cheatFilePath;
|
||||
CoreCheatOption cheatOption;
|
||||
|
||||
if (!CoreGetCurrentRomHeader(romHeader) ||
|
||||
!CoreGetCurrentRomSettings(romSettings))
|
||||
@@ -726,6 +740,23 @@ bool CoreUpdateCheat(CoreCheat oldCheat, CoreCheat newCheat)
|
||||
|
||||
cheatFilePath = get_user_cheat_file_path(romHeader, romSettings);
|
||||
|
||||
// copy over cheat settings when name has changed
|
||||
if (oldCheat.Name != newCheat.Name)
|
||||
{
|
||||
CoreEnableCheat(newCheat, CoreIsCheatEnabled(oldCheat));
|
||||
|
||||
// only set option to new cheat when
|
||||
// retrieving from old one succeeds
|
||||
if (CoreGetCheatOption(oldCheat, cheatOption))
|
||||
{
|
||||
CoreSetCheatOption(newCheat, cheatOption);
|
||||
}
|
||||
|
||||
// reset old cheat settings
|
||||
CoreEnableCheat(oldCheat, false);
|
||||
CoreResetCheatOption(oldCheat);
|
||||
}
|
||||
|
||||
// try to find old cheat in user cheats,
|
||||
// when it isnt found, it's most likely a system cheat
|
||||
auto iter = find_user_cheat_using_name(oldCheat.Name);
|
||||
@@ -892,6 +923,29 @@ bool CoreGetCheatOption(CoreCheat cheat, CoreCheatOption& option)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CoreResetCheatOption(CoreCheat cheat)
|
||||
{
|
||||
CoreRomSettings romSettings;
|
||||
std::string settingSection;
|
||||
std::string settingKey;
|
||||
|
||||
if (!cheat.HasOptions)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CoreGetCurrentRomSettings(romSettings))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
settingSection = romSettings.MD5 + " Cheats";
|
||||
settingKey = "Cheat \"" + cheat.Name + "\" Option";
|
||||
|
||||
CoreSettingsSetValue(settingSection, settingKey, -1);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreApplyCheats(void)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
@@ -136,6 +136,9 @@ bool CoreSetCheatOption(CoreCheat cheat, CoreCheatOption option);
|
||||
// attempts to retrieve the currently's set cheat's option
|
||||
bool CoreGetCheatOption(CoreCheat cheat, CoreCheatOption& option);
|
||||
|
||||
// attempts to reset the cheat option
|
||||
bool CoreResetCheatOption(CoreCheat cheat);
|
||||
|
||||
// attempts to apply the enabled cheats to the currently opened ROM
|
||||
bool CoreApplyCheats(void);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define CORE_VERSION "${GIT_VERSION}"
|
||||
|
||||
#ifndef PORTABLE_INSTALL
|
||||
#define CORE_INSTAlL_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
||||
#define CORE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
||||
#endif // PORTABLE_INSTALL
|
||||
|
||||
#endif // CORE_CONFIG_HPP
|
||||
|
||||
@@ -17,29 +17,32 @@
|
||||
#include "m64p/api/version.h"
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
//
|
||||
// Local Variables
|
||||
//
|
||||
|
||||
static osal_dynlib_lib_handle l_CoreLibHandle;
|
||||
static char l_CoreContextString[20];
|
||||
|
||||
//
|
||||
// Local Functions
|
||||
//
|
||||
|
||||
std::string find_core_lib(void)
|
||||
std::filesystem::path find_core_lib(void)
|
||||
{
|
||||
for (const auto& entry : std::filesystem::recursive_directory_iterator(CoreGetCoreDirectory()))
|
||||
{
|
||||
std::string path = entry.path().string();
|
||||
if (path.ends_with(OSAL_DYNLIB_LIB_EXT_STR))
|
||||
std::filesystem::path path = entry.path();
|
||||
if (path.has_extension() &&
|
||||
path.extension() == OSAL_DYNLIB_LIB_EXT_STR)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return std::string();
|
||||
return std::filesystem::path();
|
||||
}
|
||||
|
||||
bool config_override_user_dirs(void)
|
||||
@@ -76,11 +79,14 @@ bool config_override_user_dirs(void)
|
||||
|
||||
bool CoreInit(void)
|
||||
{
|
||||
std::string error;
|
||||
std::string core_file;
|
||||
m64p_error m64p_ret;
|
||||
std::string error;
|
||||
std::filesystem::path core_file;
|
||||
m64p_error m64p_ret;
|
||||
bool ret = false;
|
||||
|
||||
// initialize context string
|
||||
std::strcpy(l_CoreContextString, "[CORE] ");
|
||||
|
||||
core_file = find_core_lib();
|
||||
if (core_file.empty())
|
||||
{
|
||||
@@ -89,7 +95,7 @@ bool CoreInit(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
l_CoreLibHandle = osal_dynlib_open(core_file.c_str());
|
||||
l_CoreLibHandle = osal_dynlib_open(core_file);
|
||||
if (l_CoreLibHandle == nullptr)
|
||||
{
|
||||
error = "osal_dynlib_open Failed: ";
|
||||
@@ -114,7 +120,7 @@ bool CoreInit(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
m64p_ret = m64p::Core.Startup(FRONTEND_API_VERSION, CoreGetUserConfigDirectory().string().c_str(), CoreGetSharedDataDirectory().string().c_str(), nullptr, CoreDebugCallback, nullptr, CoreStateCallback);
|
||||
m64p_ret = m64p::Core.Startup(FRONTEND_API_VERSION, CoreGetUserConfigDirectory().string().c_str(), CoreGetSharedDataDirectory().string().c_str(), (void*)l_CoreContextString, CoreDebugCallback, nullptr, CoreStateCallback);
|
||||
if (m64p_ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CoreInit M64P::Core.Startup() Failed: ";
|
||||
@@ -168,7 +174,7 @@ bool CoreInit(m64p_dynlib_handle handle)
|
||||
std::string error;
|
||||
bool ret = false;
|
||||
|
||||
ret = m64p::Core.Hook(handle);
|
||||
ret = m64p::Core.IsHooked() || m64p::Core.Hook(handle);
|
||||
if (!ret)
|
||||
{
|
||||
error = m64p::Core.GetLastError();
|
||||
@@ -176,7 +182,7 @@ bool CoreInit(m64p_dynlib_handle handle)
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = m64p::Config.Hook(handle);
|
||||
ret = m64p::Config.IsHooked() || m64p::Config.Hook(handle);
|
||||
if (!ret)
|
||||
{
|
||||
error = m64p::Config.GetLastError();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "CachedRomHeaderAndSettings.hpp"
|
||||
#include "Settings/Settings.hpp"
|
||||
#include "SpeedLimiter.hpp"
|
||||
#include "SpeedFactor.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
#include "Directories.hpp"
|
||||
#include "MediaLoader.hpp"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "RomHeader.hpp"
|
||||
#include "Callback.hpp"
|
||||
#include "Plugins.hpp"
|
||||
#include "Version.hpp"
|
||||
#include "Cheats.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "Unzip.hpp"
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "Directories.hpp"
|
||||
#include "Config.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "Core.hpp"
|
||||
#include "Config.hpp"
|
||||
#include "m64p/Api.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
@@ -18,6 +18,15 @@
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
//
|
||||
// Local Variables
|
||||
//
|
||||
|
||||
static std::filesystem::path l_LibraryPathOverride;
|
||||
static std::filesystem::path l_CorePathOverride;
|
||||
static std::filesystem::path l_PluginPathOverride;
|
||||
static std::filesystem::path l_SharedDataPathOverride;
|
||||
|
||||
//
|
||||
// Local Functions
|
||||
//
|
||||
@@ -117,14 +126,40 @@ bool CoreCreateDirectories(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::filesystem::path CoreGetLibraryDirectory(void)
|
||||
{
|
||||
std::filesystem::path directory;
|
||||
#ifdef PORTABLE_INSTALL
|
||||
directory = ".";
|
||||
#else // Not Portable
|
||||
if (!l_LibraryPathOverride.empty())
|
||||
{
|
||||
directory = l_LibraryPathOverride;
|
||||
}
|
||||
else
|
||||
{
|
||||
directory = CORE_INSTALL_PREFIX;
|
||||
directory += "/lib/RMG/";
|
||||
}
|
||||
#endif // PORTABLE_INSTALL
|
||||
return directory;
|
||||
}
|
||||
|
||||
std::filesystem::path CoreGetCoreDirectory(void)
|
||||
{
|
||||
std::filesystem::path directory;
|
||||
#ifdef PORTABLE_INSTALL
|
||||
directory = "Core";
|
||||
#else // Not Portable
|
||||
directory = CORE_INSTAlL_PREFIX;
|
||||
directory += "/lib/RMG/Core";
|
||||
if (!l_CorePathOverride.empty())
|
||||
{
|
||||
directory = l_CorePathOverride;
|
||||
}
|
||||
else
|
||||
{
|
||||
directory = CORE_INSTALL_PREFIX;
|
||||
directory += "/lib/RMG/Core";
|
||||
}
|
||||
#endif // PORTABLE_INSTALL
|
||||
return directory;
|
||||
}
|
||||
@@ -135,8 +170,15 @@ std::filesystem::path CoreGetPluginDirectory(void)
|
||||
#ifdef PORTABLE_INSTALL
|
||||
directory = "Plugin";
|
||||
#else // Not Portable
|
||||
directory = CORE_INSTAlL_PREFIX;
|
||||
directory += "/lib/RMG/Plugin";
|
||||
if (!l_PluginPathOverride.empty())
|
||||
{
|
||||
directory = l_PluginPathOverride;
|
||||
}
|
||||
else
|
||||
{
|
||||
directory = CORE_INSTALL_PREFIX;
|
||||
directory += "/lib/RMG/Plugin";
|
||||
}
|
||||
#endif // PORTABLE_INSTALL
|
||||
return directory;
|
||||
}
|
||||
@@ -180,7 +222,7 @@ std::filesystem::path CoreGetDefaultSaveDirectory(void)
|
||||
#ifdef PORTABLE_INSTALL
|
||||
directory = "Save/Game";
|
||||
#else // Not Portable
|
||||
directory = CoreGetUserDataDirectory();
|
||||
directory = CoreGetDefaultUserDataDirectory();
|
||||
directory += "/Save/Game";
|
||||
#endif // PORTABLE_INSTALL
|
||||
return directory;
|
||||
@@ -192,7 +234,7 @@ std::filesystem::path CoreGetDefaultSaveStateDirectory(void)
|
||||
#ifdef PORTABLE_INSTALL
|
||||
directory = "Save/State";
|
||||
#else // Not Portable
|
||||
directory = CoreGetUserDataDirectory();
|
||||
directory = CoreGetDefaultUserDataDirectory();
|
||||
directory += "/Save/State";
|
||||
#endif // PORTABLE_INSTALL
|
||||
return directory;
|
||||
@@ -233,8 +275,15 @@ std::filesystem::path CoreGetSharedDataDirectory(void)
|
||||
#ifdef PORTABLE_INSTALL
|
||||
directory = "Data";
|
||||
#else // Not Portable
|
||||
directory = CORE_INSTAlL_PREFIX;
|
||||
directory += "/share/RMG";
|
||||
if (!l_SharedDataPathOverride.empty())
|
||||
{
|
||||
directory = l_SharedDataPathOverride;
|
||||
}
|
||||
else
|
||||
{
|
||||
directory = CORE_INSTALL_PREFIX;
|
||||
directory += "/share/RMG";
|
||||
}
|
||||
#endif // PORTABLE_INSTALL
|
||||
return directory;
|
||||
}
|
||||
@@ -253,3 +302,25 @@ std::filesystem::path CoreGetScreenshotDirectory(void)
|
||||
{
|
||||
return CoreSettingsGetStringValue(SettingsID::Core_ScreenshotPath);
|
||||
}
|
||||
|
||||
#ifndef PORTABLE_INSTALL
|
||||
void CoreSetLibraryPathOverride(std::filesystem::path path)
|
||||
{
|
||||
l_LibraryPathOverride = path;
|
||||
}
|
||||
|
||||
void CoreSetCorePathOverride(std::filesystem::path path)
|
||||
{
|
||||
l_CorePathOverride = path;
|
||||
}
|
||||
|
||||
void CoreSetPluginPathOverride(std::filesystem::path path)
|
||||
{
|
||||
l_PluginPathOverride = path;
|
||||
}
|
||||
|
||||
void CoreSetSharedDataPathOverride(std::filesystem::path path)
|
||||
{
|
||||
l_SharedDataPathOverride = path;
|
||||
}
|
||||
#endif // PORTABLE_INSTALL
|
||||
|
||||
@@ -21,6 +21,10 @@ bool CoreCreateDirectories(void);
|
||||
// located
|
||||
std::filesystem::path CoreGetCoreDirectory(void);
|
||||
|
||||
// returns the library directory where
|
||||
// misc libraries should be located
|
||||
std::filesystem::path CoreGetLibraryDirectory(void);
|
||||
|
||||
// returns the plugin directory where
|
||||
// plugins should be located
|
||||
std::filesystem::path CoreGetPluginDirectory(void);
|
||||
@@ -73,4 +77,16 @@ std::filesystem::path CoreGetSaveStateDirectory(void);
|
||||
// screenshots should be located
|
||||
std::filesystem::path CoreGetScreenshotDirectory(void);
|
||||
|
||||
// changes the library path to the given path
|
||||
void CoreSetLibraryPathOverride(std::filesystem::path path);
|
||||
|
||||
// changes the core path to the given path
|
||||
void CoreSetCorePathOverride(std::filesystem::path path);
|
||||
|
||||
// changes the plugin path to the given path
|
||||
void CoreSetPluginPathOverride(std::filesystem::path path);
|
||||
|
||||
// changes the shared data path to the given path
|
||||
void CoreSetSharedDataPathOverride(std::filesystem::path path);
|
||||
|
||||
#endif // DIRECTORIES_HPP
|
||||
|
||||
@@ -54,6 +54,7 @@ static void apply_coresettings_overlay(void)
|
||||
CoreSettingsSetValue(SettingsID::Core_CountPerOp, CoreSettingsGetIntValue(SettingsID::CoreOverlay_CountPerOp));
|
||||
CoreSettingsSetValue(SettingsID::Core_CountPerOpDenomPot, CoreSettingsGetIntValue(SettingsID::CoreOverlay_CountPerOpDenomPot));
|
||||
CoreSettingsSetValue(SettingsID::Core_SiDmaDuration, CoreSettingsGetIntValue(SettingsID::CoreOverlay_SiDmaDuration));
|
||||
CoreSettingsSetValue(SettingsID::Core_SaveFileNameFormat, CoreSettingsGetIntValue(SettingsID::CoreOverLay_SaveFileNameFormat));
|
||||
}
|
||||
|
||||
static void apply_game_coresettings_overlay(void)
|
||||
@@ -90,7 +91,8 @@ static void apply_game_coresettings_overlay(void)
|
||||
bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64ddrom)
|
||||
{
|
||||
std::string error;
|
||||
m64p_error ret;
|
||||
m64p_error ret;
|
||||
CoreRomType type;
|
||||
|
||||
if (!CoreOpenRom(n64rom))
|
||||
{
|
||||
@@ -126,8 +128,20 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
|
||||
return false;
|
||||
}
|
||||
|
||||
// set disk file in media loader
|
||||
CoreMediaLoaderSetDiskFile(n64ddrom);
|
||||
if (!CoreGetRomType(type))
|
||||
{
|
||||
CoreClearCheats();
|
||||
CoreDetachPlugins();
|
||||
CoreApplyPluginSettings();
|
||||
CoreCloseRom();
|
||||
return false;
|
||||
}
|
||||
|
||||
// set disk file in media loader when ROM is a cartridge
|
||||
if (type == CoreRomType::Cartridge)
|
||||
{
|
||||
CoreMediaLoaderSetDiskFile(n64ddrom);
|
||||
}
|
||||
|
||||
// apply core settings overlay
|
||||
apply_coresettings_overlay();
|
||||
@@ -144,7 +158,6 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
|
||||
{
|
||||
error = "CoreStartEmulation m64p::Core.DoCommand(M64CMD_EXECUTE) Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
}
|
||||
|
||||
CoreClearCheats();
|
||||
@@ -154,10 +167,18 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
|
||||
// restore plugin settings
|
||||
CoreApplyPluginSettings();
|
||||
|
||||
// reset media loader state
|
||||
CoreResetMediaLoader();
|
||||
|
||||
#ifdef DISCORD_RPC
|
||||
CoreDiscordRpcUpdate(false);
|
||||
#endif // DISCORD_RPC
|
||||
|
||||
// we need to set the emulation error last,
|
||||
// to prevent the other functions from
|
||||
// overriding the emulation error
|
||||
CoreSetError(error);
|
||||
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
enum class CoreEmulationState
|
||||
{
|
||||
Stopped = 1,
|
||||
Running,
|
||||
Paused
|
||||
};
|
||||
|
||||
// starts emulation with given ROM
|
||||
bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64ddrom);
|
||||
|
||||
|
||||
@@ -139,7 +139,12 @@ bool CoreSetupMediaLoader(void)
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
void CoreMediaLoaderSetDiskFile(std::filesystem::path ddRom)
|
||||
void CoreResetMediaLoader(void)
|
||||
{
|
||||
l_DdDiskFile = ddRom;
|
||||
l_DdRomFile = "";
|
||||
}
|
||||
|
||||
void CoreMediaLoaderSetDiskFile(std::filesystem::path disk)
|
||||
{
|
||||
l_DdDiskFile = disk;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
// sets up the medialoader
|
||||
bool CoreSetupMediaLoader(void);
|
||||
|
||||
// resets media loader state
|
||||
void CoreResetMediaLoader(void);
|
||||
|
||||
// sets the media loader disk file
|
||||
void CoreMediaLoaderSetDiskFile(std::filesystem::path ddRom);
|
||||
void CoreMediaLoaderSetDiskFile(std::filesystem::path disk);
|
||||
|
||||
#endif // CORE_MEDIALOADER_HPP
|
||||
|
||||
@@ -7,20 +7,23 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#define CORE_INTERNAL
|
||||
#include "Plugins.hpp"
|
||||
#include "Callback.hpp"
|
||||
#include "Directories.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "Emulation.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
#include "Settings/Settings.hpp"
|
||||
|
||||
#include "m64p/PluginApi.hpp"
|
||||
#include "osal/osal_dynlib.hpp"
|
||||
#include "osal/osal_files.hpp"
|
||||
|
||||
#include "m64p/PluginApi.cpp"
|
||||
#include "m64p/PluginApi.hpp"
|
||||
#include "m64p/Api.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <cstring>
|
||||
|
||||
//
|
||||
// Local Variables
|
||||
@@ -28,6 +31,7 @@
|
||||
|
||||
static m64p::PluginApi l_Plugins[(int)CorePluginType::Input];
|
||||
static std::string l_PluginFiles[(int)CorePluginType::Input];
|
||||
static char l_PluginContext[(int)CorePluginType::Input][20];
|
||||
|
||||
//
|
||||
// Local Functions
|
||||
@@ -101,6 +105,80 @@ std::string get_plugin_type_name(CorePluginType type)
|
||||
return name + " Plugin";
|
||||
}
|
||||
|
||||
std::string get_plugin_context_name(CorePluginType type)
|
||||
{
|
||||
std::string name;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
name = "[UNKNOWN]";
|
||||
break;
|
||||
case CorePluginType::Rsp:
|
||||
name = "[RSP] ";
|
||||
break;
|
||||
case CorePluginType::Gfx:
|
||||
name = "[GFX] ";
|
||||
break;
|
||||
case CorePluginType::Audio:
|
||||
name = "[AUDIO] ";
|
||||
break;
|
||||
case CorePluginType::Input:
|
||||
name = "[INPUT] ";
|
||||
break;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string get_plugin_path(CorePluginType type, std::string settingsValue)
|
||||
{
|
||||
std::string pluginPath;
|
||||
std::string path;
|
||||
std::string typeName;
|
||||
|
||||
// return an empty string when the value is empty
|
||||
if (settingsValue.empty())
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
pluginPath = CoreGetPluginDirectory().string();
|
||||
|
||||
// if the full plugin path is in the settings value,
|
||||
// we know it's the old type
|
||||
if (settingsValue.find(pluginPath) != std::string::npos)
|
||||
{
|
||||
return settingsValue;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CorePluginType::Rsp:
|
||||
typeName = "RSP";
|
||||
break;
|
||||
case CorePluginType::Gfx:
|
||||
typeName = "GFX";
|
||||
break;
|
||||
case CorePluginType::Audio:
|
||||
typeName = "Audio";
|
||||
break;
|
||||
case CorePluginType::Input:
|
||||
typeName = "Input";
|
||||
break;
|
||||
default:
|
||||
return path;
|
||||
}
|
||||
|
||||
path = pluginPath;
|
||||
path += OSAL_FILES_DIR_SEPERATOR_STR;
|
||||
path += typeName;
|
||||
path += OSAL_FILES_DIR_SEPERATOR_STR;
|
||||
path += settingsValue;
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
bool apply_plugin_settings(std::string pluginSettings[4])
|
||||
{
|
||||
std::string error;
|
||||
@@ -112,14 +190,16 @@ bool apply_plugin_settings(std::string pluginSettings[4])
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
settingValue = pluginSettings[i];
|
||||
pluginType = (CorePluginType)(i + 1);
|
||||
settingValue = get_plugin_path(pluginType, pluginSettings[i]);
|
||||
if (settingValue.empty() ||
|
||||
!std::filesystem::is_regular_file(settingValue))
|
||||
{ // skip invalid setting value
|
||||
continue;
|
||||
}
|
||||
|
||||
pluginType = (CorePluginType)(i + 1);
|
||||
// copy context string to a c string using strcpy
|
||||
std::strcpy(l_PluginContext[(int)pluginType], get_plugin_context_name(pluginType).c_str());
|
||||
|
||||
if (settingValue != l_PluginFiles[i])
|
||||
{
|
||||
@@ -179,7 +259,7 @@ bool apply_plugin_settings(std::string pluginSettings[4])
|
||||
}
|
||||
|
||||
// attempt to start plugin
|
||||
ret = plugin->Startup(m64p::Core.GetHandle(), nullptr, nullptr);
|
||||
ret = plugin->Startup(m64p::Core.GetHandle(), (void*)l_PluginContext[(int)pluginType], CoreDebugCallback);
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "apply_plugin_settings (";
|
||||
@@ -204,6 +284,78 @@ bool apply_plugin_settings(std::string pluginSettings[4])
|
||||
return true;
|
||||
}
|
||||
|
||||
bool open_plugin_config(CorePluginType type, bool romConfig)
|
||||
{
|
||||
std::string error;
|
||||
m64p_error ret;
|
||||
bool resumeEmulation = false;
|
||||
m64p::PluginApi* plugin;
|
||||
std::string functionName;
|
||||
|
||||
if (!romConfig && !CorePluginsHasConfig(type))
|
||||
{
|
||||
error = "open_plugin_config Failed: ";
|
||||
error += get_plugin_type_name(type);
|
||||
error += " doesn't have the config or config2 function!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
else if (romConfig && !CorePluginsHasROMConfig(type))
|
||||
{
|
||||
error = "open_plugin_config Failed: ";
|
||||
error += get_plugin_type_name(type);
|
||||
error += " doesn't support ROM specific configuration!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// try to pause emulation,
|
||||
// when emulation is running
|
||||
// and try to resume afterwards
|
||||
if (CoreIsEmulationRunning())
|
||||
{
|
||||
// only resume emulation
|
||||
// after running the config function
|
||||
// when pausing succeeds
|
||||
resumeEmulation = CorePauseEmulation();
|
||||
}
|
||||
|
||||
plugin = get_plugin(type);
|
||||
|
||||
// check if the plugin has the Config2
|
||||
// or Config function, the Config2 function
|
||||
// has priority
|
||||
if (plugin->Config2 != nullptr)
|
||||
{
|
||||
ret = plugin->Config2(romConfig ? 1 : 0);
|
||||
functionName = "Config2";
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = plugin->Config();
|
||||
functionName = "Config";
|
||||
}
|
||||
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CorePluginsOpenConfig (";
|
||||
error += get_plugin_type_name(type);
|
||||
error += ")->";
|
||||
error += functionName;
|
||||
error += "() Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
}
|
||||
|
||||
// try to resume emulation when needed
|
||||
if (resumeEmulation)
|
||||
{
|
||||
CoreResumeEmulation();
|
||||
}
|
||||
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
@@ -219,6 +371,7 @@ std::vector<CorePlugin> CoreGetAllPlugins(void)
|
||||
for (const auto& entry : std::filesystem::recursive_directory_iterator(CoreGetPluginDirectory()))
|
||||
{
|
||||
std::string path = entry.path().string();
|
||||
std::string file = entry.path().filename().string();
|
||||
if (!entry.is_directory() &&
|
||||
path.ends_with(OSAL_DYNLIB_LIB_EXT_STR))
|
||||
{
|
||||
@@ -239,7 +392,7 @@ std::vector<CorePlugin> CoreGetAllPlugins(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
CorePlugin corePlugin = {path, plugin_name, plugin_type};
|
||||
CorePlugin corePlugin = {file, plugin_name, plugin_type};
|
||||
plugins.emplace_back(corePlugin);
|
||||
}
|
||||
}
|
||||
@@ -302,52 +455,33 @@ bool CoreArePluginsReady(void)
|
||||
|
||||
bool CorePluginsHasConfig(CorePluginType type)
|
||||
{
|
||||
return get_plugin(type)->Config != nullptr;
|
||||
m64p::PluginApi* plugin;
|
||||
|
||||
plugin = get_plugin(type);
|
||||
|
||||
return plugin->Config != nullptr ||
|
||||
plugin->Config2 != nullptr;
|
||||
}
|
||||
|
||||
bool CorePluginsOpenConfig(CorePluginType type)
|
||||
{
|
||||
std::string error;
|
||||
m64p_error ret;
|
||||
bool resumeEmulation = false;
|
||||
return open_plugin_config(type, false);
|
||||
}
|
||||
|
||||
if (!CorePluginsHasConfig(type))
|
||||
{
|
||||
error = "CorePluginsOpenConfig Failed: ";
|
||||
error += get_plugin_type_name(type);
|
||||
error += " doesn't have config function!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
bool CorePluginsHasROMConfig(CorePluginType type)
|
||||
{
|
||||
m64p::PluginApi* plugin;
|
||||
|
||||
// try to pause emulation,
|
||||
// when emulation is running
|
||||
// and try to resume afterwards
|
||||
if (CoreIsEmulationRunning())
|
||||
{
|
||||
// only resume emulation
|
||||
// after running the config function
|
||||
// when pausing succeeds
|
||||
resumeEmulation = CorePauseEmulation();
|
||||
}
|
||||
plugin = get_plugin(type);
|
||||
|
||||
ret = get_plugin(type)->Config();
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CorePluginsOpenConfig (";
|
||||
error += get_plugin_type_name(type);
|
||||
error += ")->Config() Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
}
|
||||
return plugin->Config2 != nullptr &&
|
||||
plugin->Config2HasRomConfig != nullptr &&
|
||||
plugin->Config2HasRomConfig() > 0;
|
||||
}
|
||||
|
||||
// try to resume emulation when needed
|
||||
if (resumeEmulation)
|
||||
{
|
||||
CoreResumeEmulation();
|
||||
}
|
||||
|
||||
return ret == M64ERR_SUCCESS;
|
||||
bool CorePluginsOpenROMConfig(CorePluginType type)
|
||||
{
|
||||
return open_plugin_config(type, true);
|
||||
}
|
||||
|
||||
bool CoreAttachPlugins(void)
|
||||
|
||||
@@ -52,6 +52,14 @@ bool CorePluginsHasConfig(CorePluginType type);
|
||||
// used plugin of given type
|
||||
bool CorePluginsOpenConfig(CorePluginType type);
|
||||
|
||||
// returns wether the currently used plugin
|
||||
// of the given type has a ROM config GUI
|
||||
bool CorePluginsHasROMConfig(CorePluginType type);
|
||||
|
||||
// opens the ROM config GUI for the currently
|
||||
// used plugin of given type
|
||||
bool CorePluginsOpenROMConfig(CorePluginType type);
|
||||
|
||||
// attaches all used plugins
|
||||
bool CoreAttachPlugins(void);
|
||||
|
||||
|
||||
@@ -7,16 +7,32 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#define CORE_INTERNAL
|
||||
#include "Rom.hpp"
|
||||
#include "Directories.hpp"
|
||||
#include "Error.hpp"
|
||||
#include "MediaLoader.hpp"
|
||||
#include "m64p/Api.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
#include "Cheats.hpp"
|
||||
#include "osal/osal_files.hpp"
|
||||
#include "CachedRomHeaderAndSettings.hpp"
|
||||
|
||||
// 7-Zip includes
|
||||
#include "../3rdParty/7-Zip/C/7zTypes.h"
|
||||
#include "../3rdParty/7-Zip/C/7z.h"
|
||||
#include "../3rdParty/7-Zip/C/7zAlloc.h"
|
||||
#include "../3rdParty/7-Zip/C/7zBuf.h"
|
||||
#include "../3rdParty/7-Zip/C/7zCrc.h"
|
||||
#include "../3rdParty/7-Zip/C/7zFile.h"
|
||||
#include "../3rdParty/7-Zip/C/7zVersion.h"
|
||||
|
||||
#include <string>
|
||||
#include <unzip.h>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
|
||||
//
|
||||
// Local Defines
|
||||
@@ -28,31 +44,137 @@
|
||||
// Local Variables
|
||||
//
|
||||
|
||||
static bool l_HasRomOpen = false;
|
||||
static bool l_HasRomOpen = false;
|
||||
static bool l_HasDisk = false;
|
||||
static bool l_HasExtractedDisk = false;
|
||||
static std::filesystem::path l_ExtractedDiskPath;
|
||||
static std::filesystem::path l_RomPath;
|
||||
|
||||
//
|
||||
// Local Functions
|
||||
//
|
||||
|
||||
static bool read_zip_file(std::filesystem::path file, char** buf, int* size)
|
||||
static std::string to_lower_str(std::string str)
|
||||
{
|
||||
std::string resultString = str;
|
||||
|
||||
std::transform(resultString.begin(), resultString.end(), resultString.begin(),
|
||||
[](unsigned char c)
|
||||
{
|
||||
return std::tolower(c);
|
||||
}
|
||||
);
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
static voidpf zlib_filefunc_open(voidpf opaque, const void* filename, int mode)
|
||||
{
|
||||
std::filesystem::path path = *(std::filesystem::path*)filename;
|
||||
|
||||
// we need a static filestream
|
||||
static std::ifstream fileStream;
|
||||
|
||||
// attempt to open file
|
||||
fileStream.open(path, std::ios::binary);
|
||||
if (!fileStream.is_open())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (voidpf)&fileStream;
|
||||
}
|
||||
|
||||
static uLong zlib_filefunc_read(voidpf opaque, voidpf stream, void* buf, uLong size)
|
||||
{
|
||||
std::ifstream* fileStream = (std::ifstream*)stream;
|
||||
fileStream->read((char*)buf, size);
|
||||
return fileStream->fail() ? 0 : size;
|
||||
}
|
||||
|
||||
static ZPOS64_T zlib_filefunc_tell(voidpf opaque, voidpf stream)
|
||||
{
|
||||
std::ifstream* fileStream = (std::ifstream*)stream;
|
||||
return fileStream->tellg();
|
||||
}
|
||||
|
||||
static long zlib_filefunc_seek(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
|
||||
{
|
||||
std::ifstream* fileStream = (std::ifstream*)stream;
|
||||
std::ios_base::seekdir seekOrigin;
|
||||
|
||||
switch (origin)
|
||||
{
|
||||
default:
|
||||
return 0;
|
||||
case ZLIB_FILEFUNC_SEEK_CUR:
|
||||
seekOrigin = std::ios::cur;
|
||||
break;
|
||||
case ZLIB_FILEFUNC_SEEK_END:
|
||||
seekOrigin = std::ios::end;
|
||||
break;
|
||||
case ZLIB_FILEFUNC_SEEK_SET:
|
||||
seekOrigin = std::ios::beg;
|
||||
break;
|
||||
}
|
||||
|
||||
fileStream->seekg(offset, seekOrigin);
|
||||
return fileStream->fail() ? -1 : 0;
|
||||
}
|
||||
|
||||
static int zlib_filefunc_close(voidpf opaque, voidpf stream)
|
||||
{
|
||||
std::ifstream* fileStream = (std::ifstream*)stream;
|
||||
fileStream->close();
|
||||
return fileStream->fail() ? -1 : 0;
|
||||
}
|
||||
|
||||
static int zlib_filefunc_testerror(voidpf opaque, voidpf stream)
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
static bool read_zip_file(std::filesystem::path file, std::filesystem::path* extractedFileName, bool* isDisk, char** buf, int* size)
|
||||
{
|
||||
std::string error;
|
||||
std::fstream fileStream;
|
||||
int fileStreamLen;
|
||||
char* fileStreamBuf;
|
||||
|
||||
unzFile zipFile;
|
||||
unz_global_info zipInfo;
|
||||
unzFile zipFile;
|
||||
unz_global_info64 zipInfo;
|
||||
|
||||
zipFile = unzOpen(file.string().c_str());
|
||||
zlib_filefunc64_def filefuncs;
|
||||
filefuncs.zopen64_file = zlib_filefunc_open;
|
||||
filefuncs.zread_file = zlib_filefunc_read;
|
||||
filefuncs.zwrite_file = nullptr;
|
||||
filefuncs.ztell64_file = zlib_filefunc_tell;
|
||||
filefuncs.zseek64_file = zlib_filefunc_seek;
|
||||
filefuncs.zclose_file = zlib_filefunc_close;
|
||||
filefuncs.zerror_file = zlib_filefunc_testerror;
|
||||
filefuncs.opaque = nullptr;
|
||||
|
||||
zipFile = unzOpen2_64((const void*)&file, &filefuncs);
|
||||
if (zipFile == nullptr)
|
||||
{
|
||||
error = "read_zip_file: unzOpen Failed!";
|
||||
if (errno == 0)
|
||||
{
|
||||
error = "read_zip_file: unzOpen Failed!";
|
||||
}
|
||||
else
|
||||
{
|
||||
error = "read_zip_file: unzOpen Failed: ";
|
||||
error += "failed to open file: ";
|
||||
error += strerror(errno);
|
||||
error += " (";
|
||||
error += std::to_string(errno);
|
||||
error += ")";
|
||||
}
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (unzGetGlobalInfo(zipFile, &zipInfo) != UNZ_OK)
|
||||
if (unzGetGlobalInfo64(zipFile, &zipInfo) != UNZ_OK)
|
||||
{
|
||||
error = "read_zip_file: unzGetGlobalInfo Failed!";
|
||||
CoreSetError(error);
|
||||
@@ -74,9 +196,13 @@ static bool read_zip_file(std::filesystem::path file, char** buf, int* size)
|
||||
// make sure file has supported file format,
|
||||
// if it does, read it in memory
|
||||
std::filesystem::path fileNamePath(fileName);
|
||||
if (fileNamePath.extension() == ".z64" ||
|
||||
fileNamePath.extension() == ".v64" ||
|
||||
fileNamePath.extension() == ".n64")
|
||||
std::string fileExtension = fileNamePath.has_extension() ? fileNamePath.extension().string() : "";
|
||||
fileExtension = to_lower_str(fileExtension);
|
||||
if (fileExtension == ".z64" ||
|
||||
fileExtension == ".v64" ||
|
||||
fileExtension == ".n64" ||
|
||||
fileExtension == ".ndd" ||
|
||||
fileExtension == ".d64")
|
||||
{
|
||||
char* buffer;
|
||||
char* outBuffer;
|
||||
@@ -148,8 +274,10 @@ static bool read_zip_file(std::filesystem::path file, char** buf, int* size)
|
||||
}
|
||||
} while (bytes_read > 0);
|
||||
|
||||
*size = total_bytes_read;
|
||||
*buf = outBuffer;
|
||||
*size = total_bytes_read;
|
||||
*buf = outBuffer;
|
||||
*extractedFileName = fileNamePath;
|
||||
*isDisk = (fileExtension == ".ndd" || fileExtension == ".d64");
|
||||
unzCloseCurrentFile(zipFile);
|
||||
unzClose(zipFile);
|
||||
free(buffer);
|
||||
@@ -178,19 +306,172 @@ static bool read_zip_file(std::filesystem::path file, char** buf, int* size)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool read_raw_file(std::filesystem::path file, char** buf, int* size)
|
||||
static bool read_7zip_file(std::filesystem::path file, std::filesystem::path* extractedFileName, bool* isDisk, char** buf, int* size)
|
||||
{
|
||||
std::string error;
|
||||
std::fstream fileStream;
|
||||
int fileStreamLen;
|
||||
char* fileStreamBuf;
|
||||
|
||||
const ISzAlloc alloc = { SzAlloc, SzFree };
|
||||
const size_t bufSize = ((size_t)1 << 18);
|
||||
|
||||
ISzAlloc allocImp;
|
||||
ISzAlloc allocTempImp;
|
||||
|
||||
CFileInStream archiveStream;
|
||||
CLookToRead2 lookStream;
|
||||
CSzArEx db;
|
||||
SRes res;
|
||||
|
||||
// initialize allocator
|
||||
allocImp = alloc;
|
||||
allocTempImp = alloc;
|
||||
|
||||
// try to open file
|
||||
#ifdef _WIN32
|
||||
WRes wres = InFile_OpenW(&archiveStream.file, file.wstring().c_str());
|
||||
#else
|
||||
WRes wres = InFile_Open(&archiveStream.file, file.string().c_str());
|
||||
#endif // _WIN32
|
||||
if (wres != 0)
|
||||
{
|
||||
error = "read_7zip_file Failed: InFile_Open Failed: ";
|
||||
error += std::to_string(wres);
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// create vtables for streams
|
||||
FileInStream_CreateVTable(&archiveStream);
|
||||
archiveStream.wres = 0;
|
||||
LookToRead2_CreateVTable(&lookStream, 0);
|
||||
lookStream.buf = nullptr;
|
||||
|
||||
// allocate memory look reader
|
||||
lookStream.buf = (Byte*)ISzAlloc_Alloc(&allocImp, bufSize);
|
||||
if (lookStream.buf == nullptr)
|
||||
{
|
||||
error = "read_7zip_file Failed: ISzAlloc_Alloc Failed!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize look reader
|
||||
lookStream.bufSize = bufSize;
|
||||
lookStream.realStream = &archiveStream.vt;
|
||||
LookToRead2_INIT(&lookStream);
|
||||
|
||||
// initialize CRC table
|
||||
CrcGenerateTable();
|
||||
|
||||
// initialize archive
|
||||
SzArEx_Init(&db);
|
||||
|
||||
// try to open file
|
||||
res = SzArEx_Open(&db, &lookStream.vt, &allocImp, &allocTempImp);
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
error = "read_7zip_file Failed: SzArEx_Open Failed: ";
|
||||
error += std::to_string(res);
|
||||
CoreSetError(error);
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
ISzAlloc_Free(&allocImp, lookStream.buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < db.NumFiles; i++)
|
||||
{
|
||||
size_t filename_size = 0;
|
||||
uint16_t fileName[PATH_MAX];
|
||||
|
||||
// skip directories
|
||||
if (SzArEx_IsDir(&db, i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip when filename size exceeds our buffer size
|
||||
filename_size = SzArEx_GetFileNameUtf16(&db, i, nullptr);
|
||||
if (filename_size > PATH_MAX)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SzArEx_GetFileNameUtf16(&db, i, fileName);
|
||||
|
||||
std::filesystem::path fileNamePath((char16_t*)fileName);
|
||||
std::string fileExtension = fileNamePath.has_extension() ? fileNamePath.extension().string() : "";
|
||||
fileExtension = to_lower_str(fileExtension);
|
||||
if (fileExtension == ".z64" ||
|
||||
fileExtension == ".v64" ||
|
||||
fileExtension == ".n64" ||
|
||||
fileExtension == ".ndd" ||
|
||||
fileExtension == ".d64")
|
||||
{
|
||||
uint32_t blockIndex = 0xFFFFFFFF;
|
||||
uint8_t* outBuffer = nullptr;
|
||||
size_t outBufferSize = 0;
|
||||
size_t offset = 0;
|
||||
size_t outSizeProcessed = 0;
|
||||
|
||||
res = SzArEx_Extract(&db, &lookStream.vt, i,
|
||||
&blockIndex, &outBuffer, &outBufferSize,
|
||||
&offset, &outSizeProcessed,
|
||||
&allocImp, &allocTempImp);
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
error = "read_7zip_file Failed: SzArEx_Extract Failed: ";
|
||||
error += std::to_string(res);
|
||||
CoreSetError(error);
|
||||
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
ISzAlloc_Free(&allocImp, lookStream.buf);
|
||||
File_Close(&archiveStream.file);
|
||||
ISzAlloc_Free(&allocImp, outBuffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
*size = outSizeProcessed;
|
||||
// we have to memcpy it into buf, otherwise
|
||||
// the free() in CoreOpenRom() crashes
|
||||
*buf = (char*)malloc(outSizeProcessed);
|
||||
memcpy(*buf, (outBuffer + offset), outSizeProcessed);
|
||||
*extractedFileName = fileNamePath;
|
||||
*isDisk = (fileExtension == ".ndd" || fileExtension == ".d64");
|
||||
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
ISzAlloc_Free(&allocImp, lookStream.buf);
|
||||
File_Close(&archiveStream.file);
|
||||
ISzAlloc_Free(&allocImp, outBuffer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup
|
||||
SzArEx_Free(&db, &allocImp);
|
||||
ISzAlloc_Free(&allocImp, lookStream.buf);
|
||||
File_Close(&archiveStream.file);
|
||||
|
||||
error = "read_7zip_file Failed: no valid ROMs found in 7zip!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool read_raw_file(std::filesystem::path file, char** buf, int* size)
|
||||
{
|
||||
std::string error;
|
||||
std::ifstream fileStream;
|
||||
int fileStreamLen;
|
||||
char* fileStreamBuf;
|
||||
|
||||
// attempt to open file
|
||||
fileStream.open(file);
|
||||
fileStream.open(file, std::ios::binary);
|
||||
if (!fileStream.is_open())
|
||||
{
|
||||
error = "read_raw_file Failed: ";
|
||||
error += "failed to open file!";
|
||||
error += "failed to open file: ";
|
||||
error += strerror(errno);
|
||||
error += " (";
|
||||
error += std::to_string(errno);
|
||||
error += ")";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
@@ -222,6 +503,31 @@ static bool read_raw_file(std::filesystem::path file, char** buf, int* size)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool write_file(std::filesystem::path file, char* buf, int size)
|
||||
{
|
||||
std::string error;
|
||||
std::ofstream fileStream;
|
||||
|
||||
// attempt to open file
|
||||
fileStream.open(file, std::ios::binary);
|
||||
if (!fileStream.is_open())
|
||||
{
|
||||
error = "write_file Failed: ";
|
||||
error += "failed to open file: ";
|
||||
error += strerror(errno);
|
||||
error += " (";
|
||||
error += std::to_string(errno);
|
||||
error += ")";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// write buffer to file
|
||||
fileStream.write(buf, size);
|
||||
fileStream.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
@@ -230,8 +536,9 @@ bool CoreOpenRom(std::filesystem::path file)
|
||||
{
|
||||
std::string error;
|
||||
m64p_error ret;
|
||||
char* buf;
|
||||
int buf_size;
|
||||
char* buf = nullptr;
|
||||
int buf_size = 0;
|
||||
std::string file_extension;
|
||||
|
||||
if (!m64p::Core.IsHooked())
|
||||
{
|
||||
@@ -246,12 +553,78 @@ bool CoreOpenRom(std::filesystem::path file)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.has_extension() && file.extension() == ".zip")
|
||||
file_extension = file.has_extension() ? file.extension().string() : "";
|
||||
file_extension = to_lower_str(file_extension);
|
||||
|
||||
if (file_extension == ".zip" ||
|
||||
file_extension == ".7z")
|
||||
{
|
||||
if (!read_zip_file(file, &buf, &buf_size))
|
||||
std::filesystem::path extracted_file;
|
||||
bool is_disk = false;
|
||||
|
||||
if (file_extension == ".zip")
|
||||
{
|
||||
return false;
|
||||
if (!read_zip_file(file, &extracted_file, &is_disk, &buf, &buf_size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!read_7zip_file(file, &extracted_file, &is_disk, &buf, &buf_size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_disk)
|
||||
{
|
||||
std::filesystem::path disk_file;
|
||||
disk_file = CoreGetUserCacheDirectory();
|
||||
disk_file += "/extracted_disks/";
|
||||
disk_file += extracted_file.filename();
|
||||
|
||||
// attempt to create extraction directory
|
||||
try
|
||||
{
|
||||
if (!std::filesystem::exists(disk_file.parent_path()))
|
||||
{
|
||||
if (!std::filesystem::create_directory(disk_file.parent_path()))
|
||||
{
|
||||
throw std::exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
error = "CoreOpenRom Failed: ";
|
||||
error += "Failed to create \"";
|
||||
error += disk_file.parent_path().string();
|
||||
error += "\"!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// attempt to write temporary file
|
||||
if (!write_file(disk_file, buf, buf_size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CoreMediaLoaderSetDiskFile(disk_file);
|
||||
|
||||
l_ExtractedDiskPath = disk_file;
|
||||
}
|
||||
|
||||
l_HasDisk = is_disk;
|
||||
l_HasExtractedDisk = is_disk;
|
||||
}
|
||||
else if (file_extension == ".d64" ||
|
||||
file_extension == ".ndd")
|
||||
{
|
||||
CoreMediaLoaderSetDiskFile(file);
|
||||
l_HasDisk = true;
|
||||
l_HasExtractedDisk = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -259,25 +632,41 @@ bool CoreOpenRom(std::filesystem::path file)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
l_HasDisk = false;
|
||||
l_HasExtractedDisk = false;
|
||||
}
|
||||
|
||||
if (l_HasDisk)
|
||||
{
|
||||
ret = m64p::Core.DoCommand(M64CMD_DISK_OPEN, 0, nullptr);
|
||||
error = "CoreOpenRom: m64p::Core.DoCommand(M64CMD_DISK_OPEN) Failed: ";
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = m64p::Core.DoCommand(M64CMD_ROM_OPEN, buf_size, buf);
|
||||
error = "CoreOpenRom: m64p::Core.DoCommand(M64CMD_ROM_OPEN) Failed: ";
|
||||
free(buf);
|
||||
}
|
||||
|
||||
ret = m64p::Core.DoCommand(M64CMD_ROM_OPEN, buf_size, buf);
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CoreOpenRom: m64p::Core.DoCommand(M64CMD_ROM_OPEN) Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
l_HasRomOpen = (ret == M64ERR_SUCCESS);
|
||||
|
||||
if (l_HasRomOpen)
|
||||
{
|
||||
// store ROM path
|
||||
l_RomPath = file;
|
||||
// store default ROM settings
|
||||
CoreStoreCurrentDefaultRomSettings();
|
||||
// apply rom settings overlay
|
||||
CoreApplyRomSettingsOverlay();
|
||||
// update cached rom header and settings entry
|
||||
CoreUpdateCachedRomHeaderAndSettings(file);
|
||||
}
|
||||
|
||||
return l_HasRomOpen;
|
||||
@@ -288,6 +677,38 @@ bool CoreHasRomOpen(void)
|
||||
return l_HasRomOpen;
|
||||
}
|
||||
|
||||
bool CoreGetRomType(CoreRomType& type)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
if (!l_HasRomOpen)
|
||||
{
|
||||
error = "CoreGetRomType Failed: ";
|
||||
error += "cannot retrieve ROM type when no ROM has been opened!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
type = l_HasDisk ? CoreRomType::Disk : CoreRomType::Cartridge;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreGetRomPath(std::filesystem::path& path)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
if (!l_HasRomOpen)
|
||||
{
|
||||
error = "CoreGetRomPath Failed: ";
|
||||
error += "cannot retrieve ROM path when no ROM has been opened!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
path = l_RomPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreCloseRom(void)
|
||||
{
|
||||
std::string error;
|
||||
@@ -311,10 +732,19 @@ bool CoreCloseRom(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = m64p::Core.DoCommand(M64CMD_ROM_CLOSE, 0, nullptr);
|
||||
if (l_HasDisk)
|
||||
{
|
||||
ret = m64p::Core.DoCommand(M64CMD_DISK_CLOSE, 0, nullptr);
|
||||
error = "CoreCloseRom: m64p::Core.DoCommand(M64CMD_DISK_CLOSE) Failed: ";
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = m64p::Core.DoCommand(M64CMD_ROM_CLOSE, 0, nullptr);
|
||||
error = "CoreCloseRom: m64p::Core.DoCommand(M64CMD_ROM_CLOSE) Failed: ";
|
||||
}
|
||||
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CoreCloseRom: m64p::Core.DoCommand(M64CMD_ROM_CLOSE) Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
@@ -323,6 +753,32 @@ bool CoreCloseRom(void)
|
||||
// clear default ROM settings
|
||||
CoreClearCurrentDefaultRomSettings();
|
||||
|
||||
// if removing the temporary extracted disk file
|
||||
// fails, then we shouldn't break the state of
|
||||
// whether we currently have an open ROM/disk,
|
||||
// so we can safely say the ROM/disk isn't open
|
||||
// anymore here
|
||||
l_HasRomOpen = false;
|
||||
|
||||
// attempt to clean temporary extracted disk file
|
||||
if (l_HasExtractedDisk)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!std::filesystem::remove(l_ExtractedDiskPath))
|
||||
{
|
||||
throw std::exception();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
error = "CoreCloseRom: Failed to remove \"";
|
||||
error += l_ExtractedDiskPath.string();
|
||||
error += "\"!";
|
||||
CoreSetError(error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,24 @@
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
enum class CoreRomType
|
||||
{
|
||||
Cartridge = 0,
|
||||
Disk = 1
|
||||
};
|
||||
|
||||
// opens the given file as ROM
|
||||
bool CoreOpenRom(std::filesystem::path file);
|
||||
|
||||
// returns whether core has a ROM opened
|
||||
bool CoreHasRomOpen(void);
|
||||
|
||||
// attempts to retrieve the ROM type
|
||||
bool CoreGetRomType(CoreRomType& type);
|
||||
|
||||
// attempts to retrieve ROM path
|
||||
bool CoreGetRomPath(std::filesystem::path& path);
|
||||
|
||||
// closes ROM
|
||||
bool CoreCloseRom(void);
|
||||
|
||||
|
||||
@@ -21,6 +21,97 @@
|
||||
#include "Error.hpp"
|
||||
#include "Rom.hpp"
|
||||
|
||||
//
|
||||
// Local Functions
|
||||
//
|
||||
|
||||
static std::string get_gameid_from_header(m64p_rom_header header)
|
||||
{
|
||||
std::string gameID;
|
||||
|
||||
if (header.Manufacturer_ID == 0)
|
||||
{
|
||||
return "????";
|
||||
}
|
||||
|
||||
gameID.push_back(char(ntohl(header.Manufacturer_ID)));
|
||||
gameID.push_back(char(header.Cartridge_ID % 256));
|
||||
gameID.push_back(char(header.Cartridge_ID / 256));
|
||||
gameID.push_back(char(header.Country_code));
|
||||
|
||||
return gameID;
|
||||
}
|
||||
|
||||
static std::string get_region_from_countrycode(char countryCode)
|
||||
{
|
||||
std::string region;
|
||||
|
||||
switch (countryCode)
|
||||
{
|
||||
case 'A':
|
||||
region = "Region-Free";
|
||||
break;
|
||||
case 'B':
|
||||
region = "Brazil";
|
||||
break;
|
||||
case 'C':
|
||||
region = "China";
|
||||
break;
|
||||
case 'D':
|
||||
region = "Germany";
|
||||
break;
|
||||
case 'E':
|
||||
region = "North America";
|
||||
break;
|
||||
case 'F':
|
||||
region = "France";
|
||||
break;
|
||||
case 'G':
|
||||
region = "Gateway 64 (NTSC)";
|
||||
break;
|
||||
case 'H':
|
||||
region = "Netherlands";
|
||||
break;
|
||||
case 'I':
|
||||
region = "Italy";
|
||||
break;
|
||||
case 'J':
|
||||
region = "Japan";
|
||||
break;
|
||||
case 'K':
|
||||
region = "Korea";
|
||||
break;
|
||||
case 'L':
|
||||
region = "Gateway 64 (PAL)";
|
||||
break;
|
||||
case 'N':
|
||||
region = "Canada";
|
||||
break;
|
||||
case 'P':
|
||||
case 'X':
|
||||
region = "Europe/Australia";
|
||||
break;
|
||||
case 'S':
|
||||
region = "Spain";
|
||||
break;
|
||||
case 'U':
|
||||
region = "Australia";
|
||||
break;
|
||||
case 'W':
|
||||
region = "Scandanavia";
|
||||
break;
|
||||
case 'Y':
|
||||
case 'Z':
|
||||
region = "Europe";
|
||||
break;
|
||||
default:
|
||||
region = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
@@ -49,6 +140,8 @@ bool CoreGetCurrentRomHeader(CoreRomHeader& header)
|
||||
header.CRC2 = ntohl(m64p_header.CRC2);
|
||||
header.CountryCode = m64p_header.Country_code;
|
||||
header.Name = CoreConvertStringEncoding((char*)m64p_header.Name, CoreStringEncoding::Shift_JIS);
|
||||
|
||||
header.GameID = get_gameid_from_header(m64p_header);
|
||||
header.Region = get_region_from_countrycode((char)header.CountryCode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ struct CoreRomHeader
|
||||
uint32_t CRC2;
|
||||
uint32_t CountryCode;
|
||||
std::string Name;
|
||||
std::string GameID;
|
||||
std::string Region;
|
||||
};
|
||||
|
||||
// retrieves the currently opened ROM header
|
||||
|
||||
@@ -8,10 +8,33 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "SaveState.hpp"
|
||||
#include "Directories.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
#include "RomHeader.hpp"
|
||||
#include "Error.hpp"
|
||||
|
||||
#include "Settings/Settings.hpp"
|
||||
#include "m64p/Api.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//
|
||||
// Local Functions
|
||||
//
|
||||
|
||||
// replaces all occurences of any chars in replace with c inside str
|
||||
static void str_replace_chars(std::string& str, const std::string replace, const char c)
|
||||
{
|
||||
for (int i = 0; i < str.size(); i++)
|
||||
{
|
||||
char str_char = str.at(i);
|
||||
if (replace.find(str_char) != std::string::npos)
|
||||
{
|
||||
str.at(i) = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
@@ -59,6 +82,92 @@ int CoreGetSaveStateSlot(void)
|
||||
return slot;
|
||||
}
|
||||
|
||||
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
|
||||
{
|
||||
// TODO: this should probably be an API function
|
||||
// in mupen64plus-core instead
|
||||
|
||||
std::filesystem::path saveStatePath;
|
||||
std::filesystem::path oldSaveStatePath;
|
||||
std::string saveStateFileName;
|
||||
std::filesystem::path saveStateExtension;
|
||||
CoreRomHeader romHeader;
|
||||
CoreRomSettings romSettings;
|
||||
|
||||
// attempt to retrieve the current
|
||||
// rom header and settings
|
||||
if (!CoreGetCurrentRomHeader(romHeader) ||
|
||||
!CoreGetCurrentRomSettings(romSettings))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// retrieve save state directory
|
||||
saveStatePath = CoreGetSaveStateDirectory();
|
||||
saveStatePath += "/";
|
||||
|
||||
// construct extension
|
||||
saveStateExtension = ".st";
|
||||
saveStateExtension += std::to_string(slot);
|
||||
|
||||
// construct old save state path
|
||||
oldSaveStatePath = saveStatePath;
|
||||
oldSaveStatePath += romSettings.GoodName;
|
||||
oldSaveStatePath += saveStateExtension;
|
||||
|
||||
// use old filename if it exists
|
||||
if (std::filesystem::is_regular_file(oldSaveStatePath))
|
||||
{
|
||||
path = oldSaveStatePath;
|
||||
return true;
|
||||
}
|
||||
|
||||
// else use new filename
|
||||
int format = CoreSettingsGetIntValue(SettingsID::Core_SaveFileNameFormat);
|
||||
if (format == 0)
|
||||
{
|
||||
saveStatePath += romHeader.Name;
|
||||
saveStatePath += saveStateExtension;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (romSettings.GoodName.find("(unknown rom)") == std::string::npos)
|
||||
{
|
||||
if (romSettings.GoodName.size() < 32)
|
||||
{
|
||||
saveStatePath += romSettings.GoodName;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveStatePath += romSettings.GoodName.substr(0, 32);
|
||||
}
|
||||
}
|
||||
else if (!romHeader.Name.empty())
|
||||
{
|
||||
saveStatePath += romHeader.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveStatePath += "unknown";
|
||||
}
|
||||
saveStatePath += "-";
|
||||
saveStatePath += romSettings.MD5.substr(0, 8);
|
||||
saveStatePath += saveStateExtension;
|
||||
}
|
||||
|
||||
// retrieve filename from path
|
||||
saveStateFileName = saveStatePath.filename().string();
|
||||
|
||||
// sanitize filename
|
||||
str_replace_chars(saveStateFileName, ":<>\"/\\|?*", '_');
|
||||
|
||||
// replace filename in path
|
||||
saveStatePath.replace_filename(saveStateFileName);
|
||||
|
||||
path = saveStatePath;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreSaveState(void)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
@@ -19,6 +19,10 @@ bool CoreSetSaveStateSlot(int slot);
|
||||
// returns -1 on error
|
||||
int CoreGetSaveStateSlot(void);
|
||||
|
||||
// retrieves the file path for
|
||||
// the save state in the given slot
|
||||
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path);
|
||||
|
||||
// saves state
|
||||
bool CoreSaveState(void);
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ bool CoreSettingsSetupDefaults(void);
|
||||
// returns whether a section exists
|
||||
bool CoreSettingsSectionExists(std::string section);
|
||||
|
||||
// reverts section to the one from the settings
|
||||
bool CoreSettingsRevertSection(std::string section);
|
||||
|
||||
// deletes given section
|
||||
bool CoreSettingsDeleteSection(std::string section);
|
||||
|
||||
@@ -43,6 +46,8 @@ bool CoreSettingsSetValue(SettingsID settingId, float value);
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::string value);
|
||||
// sets setting as int list value
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::vector<int> value);
|
||||
// sets setting as string list value
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::vector<std::string> value);
|
||||
|
||||
// sets setting in section as int value
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::string section, int value);
|
||||
@@ -54,6 +59,8 @@ bool CoreSettingsSetValue(SettingsID settingId, std::string section, float value
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::string value);
|
||||
// sets setting in section as int list value
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector<int> value);
|
||||
// sets setting as section as string list value
|
||||
bool CoreSettingsSetValue(SettingsID settingId, std::string section, std::vector<std::string> value);
|
||||
|
||||
#ifdef CORE_INTERNAL
|
||||
// sets key in section as int value
|
||||
@@ -66,6 +73,8 @@ bool CoreSettingsSetValue(std::string section, std::string key, float value);
|
||||
bool CoreSettingsSetValue(std::string section, std::string key, std::string value);
|
||||
// sets key in section as int list value
|
||||
bool CoreSettingsSetValue(std::string section, std::string key, std::vector<int> value);
|
||||
// sets key in section as string list value
|
||||
bool CoreSettingsSetValue(std::string section, std::string key, std::vector<std::string> value);
|
||||
#endif // CORE_INTERNAL
|
||||
|
||||
// retrieves default setting as int
|
||||
@@ -78,6 +87,8 @@ float CoreSettingsGetDefaultFloatValue(SettingsID settingId);
|
||||
std::string CoreSettingsGetDefaultStringValue(SettingsID settingId);
|
||||
// retrieves default setting as int list
|
||||
std::vector<int> CoreSettingsGetDefaultIntListValue(SettingsID settingId);
|
||||
// retrieves default setting as string list
|
||||
std::vector<std::string> CoreSettingsGetDefaultStringListValue(SettingsID settingId);
|
||||
|
||||
// retrieves setting as int
|
||||
int CoreSettingsGetIntValue(SettingsID settingId);
|
||||
@@ -89,6 +100,8 @@ float CoreSettingsGetFloatValue(SettingsID settingId);
|
||||
std::string CoreSettingsGetStringValue(SettingsID settingId);
|
||||
// retrieves setting as int list
|
||||
std::vector<int> CoreSettingsGetIntListValue(SettingsID settingId);
|
||||
// retrieves setting as string list
|
||||
std::vector<std::string> CoreSettingsGetStringListValue(SettingsID settingId);
|
||||
|
||||
// retrieves setting in section as int
|
||||
int CoreSettingsGetIntValue(SettingsID settingId, std::string section);
|
||||
@@ -100,6 +113,8 @@ float CoreSettingsGetFloatValue(SettingsID settingId, std::string section);
|
||||
std::string CoreSettingsGetStringValue(SettingsID settingId, std::string section);
|
||||
// retrieves setting in section as int list
|
||||
std::vector<int> CoreSettingsGetIntListValue(SettingsID settingId, std::string section);
|
||||
// retrieves setting in section as string list
|
||||
std::vector<std::string> CoreSettingsGetStringListValue(SettingsID settingId, std::string section);
|
||||
|
||||
#ifdef CORE_INTERNAL
|
||||
// retrieves key in section as int
|
||||
@@ -112,6 +127,8 @@ float CoreSettingsGetFloatValue(std::string section, std::string key, float defa
|
||||
std::string CoreSettingsGetStringValue(std::string section, std::string key);
|
||||
// retrieves key in section as int list
|
||||
std::vector<int> CoreSettingsGetIntListValue(std::string section, std::string key);
|
||||
// retrieves key in section as string list
|
||||
std::vector<std::string> CoreSettingsGetStringListValue(std::string section, std::string key);
|
||||
#endif // CORE_INTERNAL
|
||||
|
||||
#endif // CORE_SETTINGS_HPP
|
||||
|
||||
@@ -6,17 +6,29 @@ enum class SettingsID
|
||||
// GUI Settings
|
||||
GUI_SettingsDialogWidth = 0,
|
||||
GUI_SettingsDialogHeight,
|
||||
GUI_AllowManualResizing,
|
||||
GUI_HideCursorInEmulation,
|
||||
GUI_HideCursorInFullscreenEmulation,
|
||||
GUI_StatusbarMessageDuration,
|
||||
GUI_PauseEmulationOnFocusLoss,
|
||||
GUI_ResumeEmulationOnFocus,
|
||||
GUI_AutomaticFullscreen,
|
||||
GUI_ShowVerboseLogMessages,
|
||||
GUI_OnScreenDisplayEnabled,
|
||||
GUI_OnScreenDisplayLocation,
|
||||
GUI_OnScreenDisplayPaddingX,
|
||||
GUI_OnScreenDisplayPaddingY,
|
||||
GUI_OnScreenDisplayOpacity,
|
||||
GUI_OnScreenDisplayDuration,
|
||||
GUI_Toolbar,
|
||||
GUI_ToolbarArea,
|
||||
GUI_StatusBar,
|
||||
GUI_Theme,
|
||||
GUI_IconTheme,
|
||||
GUI_CheckForUpdates,
|
||||
GUI_LastUpdateCheck,
|
||||
GUI_DiscordRpc,
|
||||
GUI_Version,
|
||||
|
||||
|
||||
// Core Plugin Settings
|
||||
Core_GFX_Plugin,
|
||||
Core_AUDIO_Plugin,
|
||||
@@ -53,6 +65,7 @@ enum class SettingsID
|
||||
Core_CountPerOp,
|
||||
Core_CountPerOpDenomPot,
|
||||
Core_SiDmaDuration,
|
||||
Core_SaveFileNameFormat,
|
||||
|
||||
// (mupen64plus) Overlay Core Settings
|
||||
CoreOverlay_RandomizeInterrupt,
|
||||
@@ -62,6 +75,7 @@ enum class SettingsID
|
||||
CoreOverlay_CountPerOp,
|
||||
CoreOverlay_CountPerOpDenomPot,
|
||||
CoreOverlay_SiDmaDuration,
|
||||
CoreOverLay_SaveFileNameFormat,
|
||||
|
||||
// (mupen64plus) Core Directory Settings
|
||||
Core_ScreenshotPath,
|
||||
@@ -89,35 +103,69 @@ enum class SettingsID
|
||||
|
||||
// GUI KeyBindings
|
||||
KeyBinding_RemoveDuplicates,
|
||||
KeyBinding_OpenROM,
|
||||
KeyBinding_OpenCombo,
|
||||
KeyBinding_StartEmulation,
|
||||
KeyBinding_EndEmulation,
|
||||
KeyBinding_StartROM,
|
||||
KeyBinding_StartCombo,
|
||||
KeyBinding_Shutdown,
|
||||
KeyBinding_RefreshROMList,
|
||||
KeyBinding_Exit,
|
||||
KeyBinding_SoftReset,
|
||||
KeyBinding_HardReset,
|
||||
KeyBinding_Resume,
|
||||
KeyBinding_GenerateBitmap,
|
||||
KeyBinding_Screenshot,
|
||||
KeyBinding_LimitFPS,
|
||||
KeyBinding_SwapDisk,
|
||||
KeyBinding_SpeedFactor25,
|
||||
KeyBinding_SpeedFactor50,
|
||||
KeyBinding_SpeedFactor75,
|
||||
KeyBinding_SpeedFactor100,
|
||||
KeyBinding_SpeedFactor125,
|
||||
KeyBinding_SpeedFactor150,
|
||||
KeyBinding_SpeedFactor175,
|
||||
KeyBinding_SpeedFactor200,
|
||||
KeyBinding_SpeedFactor225,
|
||||
KeyBinding_SpeedFactor250,
|
||||
KeyBinding_SpeedFactor275,
|
||||
KeyBinding_SpeedFactor300,
|
||||
KeyBinding_SaveState,
|
||||
KeyBinding_SaveAs,
|
||||
KeyBinding_LoadState,
|
||||
KeyBinding_Load,
|
||||
KeyBinding_Cheats,
|
||||
KeyBinding_GSButton,
|
||||
KeyBinding_SaveStateSlot0,
|
||||
KeyBinding_SaveStateSlot1,
|
||||
KeyBinding_SaveStateSlot2,
|
||||
KeyBinding_SaveStateSlot3,
|
||||
KeyBinding_SaveStateSlot4,
|
||||
KeyBinding_SaveStateSlot5,
|
||||
KeyBinding_SaveStateSlot6,
|
||||
KeyBinding_SaveStateSlot7,
|
||||
KeyBinding_SaveStateSlot8,
|
||||
KeyBinding_SaveStateSlot9,
|
||||
KeyBinding_Fullscreen,
|
||||
Keybinding_ViewLog,
|
||||
KeyBinding_GraphicsSettings,
|
||||
KeyBinding_AudioSettings,
|
||||
KeyBinding_RspSettings,
|
||||
KeyBinding_InputSettings,
|
||||
KeyBinding_Settings,
|
||||
|
||||
// RomBrowser Settings
|
||||
RomBrowser_Directory,
|
||||
RomBrowser_Geometry,
|
||||
RomBrowser_Maximized,
|
||||
RomBrowser_Recursive,
|
||||
RomBrowser_MaxItems,
|
||||
RomBrowser_Columns,
|
||||
RomBrowser_ColumnVisibility,
|
||||
RomBrowser_ColumnOrder,
|
||||
RomBrowser_ColumnSizes,
|
||||
|
||||
RomBrowser_SortAfterSearch,
|
||||
RomBrowser_ViewMode,
|
||||
RomBrowser_ListViewSortSection,
|
||||
RomBrowser_ListViewSortOrder,
|
||||
RomBrowser_GridViewIconWidth,
|
||||
RomBrowser_GridViewIconHeight,
|
||||
RomBrowser_GridViewUniformItemSizes,
|
||||
|
||||
// Settings Settings
|
||||
Settings_HasForceUsedSetOnce,
|
||||
|
||||
@@ -132,17 +180,25 @@ enum class SettingsID
|
||||
Audio_Muted,
|
||||
Audio_Synchronize,
|
||||
|
||||
// HLE RSP Plugin Settings
|
||||
RSP_Fallback,
|
||||
|
||||
// Input Plugin Settings
|
||||
Input_Profiles,
|
||||
Input_UseProfile,
|
||||
Input_UseGameProfile,
|
||||
Input_PluggedIn,
|
||||
Input_DeviceType,
|
||||
Input_DeviceName,
|
||||
Input_DeviceNum,
|
||||
Input_Deadzone,
|
||||
Input_Sensitivity,
|
||||
Input_Pak,
|
||||
Input_GameboyRom,
|
||||
Input_GameboySave,
|
||||
Input_RemoveDuplicateMappings,
|
||||
Input_InvertAxis,
|
||||
Input_FilterEventsForButtons,
|
||||
Input_FilterEventsForAxis,
|
||||
Input_A_InputType,
|
||||
Input_A_Name,
|
||||
Input_A_Data,
|
||||
@@ -215,6 +271,138 @@ enum class SettingsID
|
||||
Input_AnalogStickRight_Name,
|
||||
Input_AnalogStickRight_Data,
|
||||
Input_AnalogStickRight_ExtraData,
|
||||
Input_Hotkey_Shutdown_InputType,
|
||||
Input_Hotkey_Shutdown_Name,
|
||||
Input_Hotkey_Shutdown_Data,
|
||||
Input_Hotkey_Shutdown_ExtraData,
|
||||
Input_Hotkey_Exit_InputType,
|
||||
Input_Hotkey_Exit_Name,
|
||||
Input_Hotkey_Exit_Data,
|
||||
Input_Hotkey_Exit_ExtraData,
|
||||
Input_Hotkey_SoftReset_InputType,
|
||||
Input_Hotkey_SoftReset_Name,
|
||||
Input_Hotkey_SoftReset_Data,
|
||||
Input_Hotkey_SoftReset_ExtraData,
|
||||
Input_Hotkey_HardReset_InputType,
|
||||
Input_Hotkey_HardReset_Name,
|
||||
Input_Hotkey_HardReset_Data,
|
||||
Input_Hotkey_HardReset_ExtraData,
|
||||
Input_Hotkey_Resume_InputType,
|
||||
Input_Hotkey_Resume_Name,
|
||||
Input_Hotkey_Resume_Data,
|
||||
Input_Hotkey_Resume_ExtraData,
|
||||
Input_Hotkey_Screenshot_InputType,
|
||||
Input_Hotkey_Screenshot_Name,
|
||||
Input_Hotkey_Screenshot_Data,
|
||||
Input_Hotkey_Screenshot_ExtraData,
|
||||
Input_Hotkey_LimitFPS_InputType,
|
||||
Input_Hotkey_LimitFPS_Name,
|
||||
Input_Hotkey_LimitFPS_Data,
|
||||
Input_Hotkey_LimitFPS_ExtraData,
|
||||
Input_Hotkey_SpeedFactor25_InputType,
|
||||
Input_Hotkey_SpeedFactor25_Name,
|
||||
Input_Hotkey_SpeedFactor25_Data,
|
||||
Input_Hotkey_SpeedFactor25_ExtraData,
|
||||
Input_Hotkey_SpeedFactor50_InputType,
|
||||
Input_Hotkey_SpeedFactor50_Name,
|
||||
Input_Hotkey_SpeedFactor50_Data,
|
||||
Input_Hotkey_SpeedFactor50_ExtraData,
|
||||
Input_Hotkey_SpeedFactor75_InputType,
|
||||
Input_Hotkey_SpeedFactor75_Name,
|
||||
Input_Hotkey_SpeedFactor75_Data,
|
||||
Input_Hotkey_SpeedFactor75_ExtraData,
|
||||
Input_Hotkey_SpeedFactor100_InputType,
|
||||
Input_Hotkey_SpeedFactor100_Name,
|
||||
Input_Hotkey_SpeedFactor100_Data,
|
||||
Input_Hotkey_SpeedFactor100_ExtraData,
|
||||
Input_Hotkey_SpeedFactor125_InputType,
|
||||
Input_Hotkey_SpeedFactor125_Name,
|
||||
Input_Hotkey_SpeedFactor125_Data,
|
||||
Input_Hotkey_SpeedFactor125_ExtraData,
|
||||
Input_Hotkey_SpeedFactor150_InputType,
|
||||
Input_Hotkey_SpeedFactor150_Name,
|
||||
Input_Hotkey_SpeedFactor150_Data,
|
||||
Input_Hotkey_SpeedFactor150_ExtraData,
|
||||
Input_Hotkey_SpeedFactor175_InputType,
|
||||
Input_Hotkey_SpeedFactor175_Name,
|
||||
Input_Hotkey_SpeedFactor175_Data,
|
||||
Input_Hotkey_SpeedFactor175_ExtraData,
|
||||
Input_Hotkey_SpeedFactor200_InputType,
|
||||
Input_Hotkey_SpeedFactor200_Name,
|
||||
Input_Hotkey_SpeedFactor200_Data,
|
||||
Input_Hotkey_SpeedFactor200_ExtraData,
|
||||
Input_Hotkey_SpeedFactor225_InputType,
|
||||
Input_Hotkey_SpeedFactor225_Name,
|
||||
Input_Hotkey_SpeedFactor225_Data,
|
||||
Input_Hotkey_SpeedFactor225_ExtraData,
|
||||
Input_Hotkey_SpeedFactor250_InputType,
|
||||
Input_Hotkey_SpeedFactor250_Name,
|
||||
Input_Hotkey_SpeedFactor250_Data,
|
||||
Input_Hotkey_SpeedFactor250_ExtraData,
|
||||
Input_Hotkey_SpeedFactor275_InputType,
|
||||
Input_Hotkey_SpeedFactor275_Name,
|
||||
Input_Hotkey_SpeedFactor275_Data,
|
||||
Input_Hotkey_SpeedFactor275_ExtraData,
|
||||
Input_Hotkey_SpeedFactor300_InputType,
|
||||
Input_Hotkey_SpeedFactor300_Name,
|
||||
Input_Hotkey_SpeedFactor300_Data,
|
||||
Input_Hotkey_SpeedFactor300_ExtraData,
|
||||
Input_Hotkey_SaveState_InputType,
|
||||
Input_Hotkey_SaveState_Name,
|
||||
Input_Hotkey_SaveState_Data,
|
||||
Input_Hotkey_SaveState_ExtraData,
|
||||
Input_Hotkey_LoadState_InputType,
|
||||
Input_Hotkey_LoadState_Name,
|
||||
Input_Hotkey_LoadState_Data,
|
||||
Input_Hotkey_LoadState_ExtraData,
|
||||
Input_Hotkey_GSButton_InputType,
|
||||
Input_Hotkey_GSButton_Name,
|
||||
Input_Hotkey_GSButton_Data,
|
||||
Input_Hotkey_GSButton_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot0_InputType,
|
||||
Input_Hotkey_SaveStateSlot0_Name,
|
||||
Input_Hotkey_SaveStateSlot0_Data,
|
||||
Input_Hotkey_SaveStateSlot0_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot1_InputType,
|
||||
Input_Hotkey_SaveStateSlot1_Name,
|
||||
Input_Hotkey_SaveStateSlot1_Data,
|
||||
Input_Hotkey_SaveStateSlot1_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot2_InputType,
|
||||
Input_Hotkey_SaveStateSlot2_Name,
|
||||
Input_Hotkey_SaveStateSlot2_Data,
|
||||
Input_Hotkey_SaveStateSlot2_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot3_InputType,
|
||||
Input_Hotkey_SaveStateSlot3_Name,
|
||||
Input_Hotkey_SaveStateSlot3_Data,
|
||||
Input_Hotkey_SaveStateSlot3_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot4_InputType,
|
||||
Input_Hotkey_SaveStateSlot4_Name,
|
||||
Input_Hotkey_SaveStateSlot4_Data,
|
||||
Input_Hotkey_SaveStateSlot4_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot5_InputType,
|
||||
Input_Hotkey_SaveStateSlot5_Name,
|
||||
Input_Hotkey_SaveStateSlot5_Data,
|
||||
Input_Hotkey_SaveStateSlot5_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot6_InputType,
|
||||
Input_Hotkey_SaveStateSlot6_Name,
|
||||
Input_Hotkey_SaveStateSlot6_Data,
|
||||
Input_Hotkey_SaveStateSlot6_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot7_InputType,
|
||||
Input_Hotkey_SaveStateSlot7_Name,
|
||||
Input_Hotkey_SaveStateSlot7_Data,
|
||||
Input_Hotkey_SaveStateSlot7_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot8_InputType,
|
||||
Input_Hotkey_SaveStateSlot8_Name,
|
||||
Input_Hotkey_SaveStateSlot8_Data,
|
||||
Input_Hotkey_SaveStateSlot8_ExtraData,
|
||||
Input_Hotkey_SaveStateSlot9_InputType,
|
||||
Input_Hotkey_SaveStateSlot9_Name,
|
||||
Input_Hotkey_SaveStateSlot9_Data,
|
||||
Input_Hotkey_SaveStateSlot9_ExtraData,
|
||||
Input_Hotkey_Fullscreen_InputType,
|
||||
Input_Hotkey_Fullscreen_Name,
|
||||
Input_Hotkey_Fullscreen_Data,
|
||||
Input_Hotkey_Fullscreen_ExtraData,
|
||||
|
||||
Invalid
|
||||
};
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "SpeedFactor.hpp"
|
||||
#include "Error.hpp"
|
||||
|
||||
#include "m64p/Api.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
|
||||
int CoreGetSpeedFactor(void)
|
||||
{
|
||||
std::string error;
|
||||
m64p_error ret;
|
||||
int value = 0;
|
||||
|
||||
if (!m64p::Core.IsHooked())
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
ret = m64p::Core.DoCommand(M64CMD_CORE_STATE_QUERY, M64CORE_SPEED_FACTOR, &value);
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CoreGetSpeedFactor: m64p::Core.DoCommand(M64CMD_CORE_STATE_QUERY) Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
bool CoreSetSpeedFactor(int factor)
|
||||
{
|
||||
std::string error;
|
||||
m64p_error ret;
|
||||
int value = factor;
|
||||
|
||||
if (!m64p::Core.IsHooked())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = m64p::Core.DoCommand(M64CMD_CORE_STATE_SET, M64CORE_SPEED_FACTOR, &value);
|
||||
if (ret != M64ERR_SUCCESS)
|
||||
{
|
||||
error = "CoreSetSpeedFactor: m64p::Core.DoCommand(M64CMD_CORE_STATE_SET) Failed: ";
|
||||
error += m64p::Core.ErrorMessage(ret);
|
||||
CoreSetError(error);
|
||||
}
|
||||
|
||||
return ret == M64ERR_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CORE_SPEEDFACTOR_HPP
|
||||
#define CORE_SPEEDFACTOR_HPP
|
||||
|
||||
// returns the current speed factor
|
||||
int CoreGetSpeedFactor(void);
|
||||
|
||||
// sets the speed factor
|
||||
bool CoreSetSpeedFactor(int factor);
|
||||
|
||||
#endif // CORE_SPEEDFACTOR_HPP
|
||||
@@ -7,10 +7,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
QTableView
|
||||
#include "Version.hpp"
|
||||
#include "Config.hpp"
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
//
|
||||
|
||||
std::string CoreGetVersion(void)
|
||||
{
|
||||
border: none;
|
||||
color: #0096d3;
|
||||
selection-color: #FFFFFF;
|
||||
selection-background-color: #0096d3;
|
||||
return std::string(CORE_VERSION);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CORE_VERSION_HPP
|
||||
#define CORE_VERSION_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
// returns the current RMG-Core version (as string)
|
||||
std::string CoreGetVersion(void);
|
||||
|
||||
#endif // CORE_VERSION_HPP
|
||||
@@ -28,6 +28,8 @@ bool PluginApi::Hook(m64p_dynlib_handle handle)
|
||||
HOOK_FUNC(handle, Plugin, Startup);
|
||||
HOOK_FUNC(handle, Plugin, Shutdown);
|
||||
HOOK_FUNC_OPT(handle, Plugin, Config);
|
||||
HOOK_FUNC_OPT(handle, Plugin, Config2);
|
||||
HOOK_FUNC_OPT(handle, Plugin, Config2HasRomConfig);
|
||||
HOOK_FUNC(handle, Plugin, GetVersion);
|
||||
|
||||
this->handle = handle;
|
||||
@@ -40,6 +42,8 @@ bool PluginApi::Unhook(void)
|
||||
UNHOOK_FUNC(Plugin, Startup);
|
||||
UNHOOK_FUNC(Plugin, Shutdown);
|
||||
UNHOOK_FUNC(Plugin, Config);
|
||||
UNHOOK_FUNC(Plugin, Config2);
|
||||
UNHOOK_FUNC(Plugin, Config2HasRomConfig);
|
||||
UNHOOK_FUNC(Plugin, GetVersion);
|
||||
|
||||
this->handle = nullptr;
|
||||
|
||||
@@ -34,6 +34,8 @@ class PluginApi
|
||||
ptr_PluginStartup Startup;
|
||||
ptr_PluginShutdown Shutdown;
|
||||
ptr_PluginConfig Config;
|
||||
ptr_PluginConfig2 Config2;
|
||||
ptr_PluginConfig2HasRomConfig Config2HasRomConfig;
|
||||
ptr_PluginGetVersion GetVersion;
|
||||
|
||||
private:
|
||||
|
||||
@@ -21,6 +21,29 @@ typedef m64p_error (*ptr_PluginConfig)(void);
|
||||
EXPORT m64p_error CALL PluginConfig(void);
|
||||
#endif
|
||||
|
||||
/* PluginConfig2(int romConfig)
|
||||
*
|
||||
* This optional function opens a configuration GUI for the plugin
|
||||
* https://github.com/mupen64plus/mupen64plus-core/pull/774
|
||||
*
|
||||
* romConfig argument determines if it should open the ROM specific config
|
||||
*/
|
||||
typedef m64p_error (*ptr_PluginConfig2)(int);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT m64p_error CALL PluginConfig2(int);
|
||||
#endif
|
||||
|
||||
/* PluginConfig2HasRomConfig(void)
|
||||
*
|
||||
* This optional function returns wether the plugin supports ROM specific config
|
||||
* using PluginConfig2
|
||||
*
|
||||
*/
|
||||
typedef int (*ptr_PluginConfig2HasRomConfig)(void);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT int CALL PluginConfig2HasRomConfig(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -168,7 +168,9 @@ typedef enum {
|
||||
M64CMD_NETPLAY_GET_VERSION,
|
||||
M64CMD_NETPLAY_CLOSE,
|
||||
M64CMD_PIF_OPEN,
|
||||
M64CMD_ROM_SET_SETTINGS
|
||||
M64CMD_ROM_SET_SETTINGS,
|
||||
M64CMD_DISK_OPEN,
|
||||
M64CMD_DISK_CLOSE
|
||||
} m64p_command;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define OSAL_DYNLIB_HPP
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@@ -25,11 +26,11 @@ typedef void* osal_dynlib_lib_sym;
|
||||
|
||||
// returns library handle for given filename,
|
||||
// return nullptr when invalid library
|
||||
osal_dynlib_lib_handle osal_dynlib_open(const char *);
|
||||
osal_dynlib_lib_handle osal_dynlib_open(std::filesystem::path path);
|
||||
|
||||
// retrieves symbol handle for given library
|
||||
// handle, returns nullptr when not found
|
||||
osal_dynlib_lib_sym osal_dynlib_sym(osal_dynlib_lib_handle, const char *);
|
||||
osal_dynlib_lib_sym osal_dynlib_sym(osal_dynlib_lib_handle, const char* symbol);
|
||||
|
||||
// closes library handle
|
||||
void osal_dynlib_close(osal_dynlib_lib_handle);
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
osal_dynlib_lib_handle osal_dynlib_open(const char* file)
|
||||
osal_dynlib_lib_handle osal_dynlib_open(std::filesystem::path path)
|
||||
{
|
||||
return dlopen(file, RTLD_LAZY);
|
||||
return dlopen(path.string().c_str(), RTLD_LAZY);
|
||||
}
|
||||
|
||||
osal_dynlib_lib_sym osal_dynlib_sym(osal_dynlib_lib_handle handle, const char *sym)
|
||||
osal_dynlib_lib_sym osal_dynlib_sym(osal_dynlib_lib_handle handle, const char* symbol)
|
||||
{
|
||||
return dlsym(handle, sym);
|
||||
return dlsym(handle, symbol);
|
||||
}
|
||||
|
||||
void osal_dynlib_close(osal_dynlib_lib_handle handle)
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
*/
|
||||
#include "osal_dynlib.hpp"
|
||||
|
||||
osal_dynlib_lib_handle osal_dynlib_open(const char* file)
|
||||
osal_dynlib_lib_handle osal_dynlib_open(std::filesystem::path path)
|
||||
{
|
||||
return LoadLibrary(file);
|
||||
return LoadLibraryW(path.wstring().c_str());
|
||||
}
|
||||
|
||||
osal_dynlib_lib_sym osal_dynlib_sym(osal_dynlib_lib_handle handle, const char *sym)
|
||||
osal_dynlib_lib_sym osal_dynlib_sym(osal_dynlib_lib_handle handle, const char* symbol)
|
||||
{
|
||||
return GetProcAddress(handle, sym);
|
||||
return GetProcAddress(handle, symbol);
|
||||
}
|
||||
|
||||
void osal_dynlib_close(osal_dynlib_lib_handle handle)
|
||||
|
||||
@@ -17,8 +17,9 @@ osal_files_file_time osal_files_get_file_time(std::filesystem::path file)
|
||||
BOOL ret;
|
||||
HANDLE file_handle;
|
||||
FILETIME file_time;
|
||||
ULARGE_INTEGER ularge_int;
|
||||
|
||||
file_handle = CreateFileA(file.string().c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
file_handle = CreateFileW(file.wstring().c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (file_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return -1;
|
||||
@@ -36,7 +37,8 @@ osal_files_file_time osal_files_get_file_time(std::filesystem::path file)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// this is probably incorrect but it doesn't matter
|
||||
// for our use-case
|
||||
return file_time.dwLowDateTime + file_time.dwHighDateTime;
|
||||
ularge_int.LowPart = file_time.dwLowDateTime;
|
||||
ularge_int.HighPart = file_time.dwHighDateTime;
|
||||
|
||||
return ularge_int.QuadPart;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ set(CMAKE_AUTOUIC ON)
|
||||
# disable lib prefix
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
|
||||
find_package(Qt5 COMPONENTS Gui Widgets Core Svg REQUIRED)
|
||||
find_package(Qt6 COMPONENTS Gui Widgets Core Svg REQUIRED)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
@@ -17,19 +17,33 @@ set(RMG_INPUT_SOURCES
|
||||
UserInterface/Widget/ControllerWidget.ui
|
||||
UserInterface/Widget/ControllerWidget.cpp
|
||||
UserInterface/Widget/ControllerImageWidget.cpp
|
||||
UserInterface/Widget/CustomButton.cpp
|
||||
UserInterface/Widget/HotkeyButton.cpp
|
||||
UserInterface/Widget/MappingButton.cpp
|
||||
UserInterface/Widget/AddMappingButton.cpp
|
||||
UserInterface/Widget/RemoveMappingButton.cpp
|
||||
UserInterface/EventFilter.cpp
|
||||
UserInterface/OptionsDialog.ui
|
||||
UserInterface/OptionsDialog.cpp
|
||||
UserInterface/HotkeysDialog.ui
|
||||
UserInterface/HotkeysDialog.cpp
|
||||
UserInterface/MainDialog.ui
|
||||
UserInterface/MainDialog.cpp
|
||||
UserInterface/UIResources.qrc
|
||||
Utilities/QtKeyToSdl2Key.cpp
|
||||
Utilities/InputDevice.cpp
|
||||
Thread/SDLThread.cpp
|
||||
Thread/HotkeysThread.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
if (VRU)
|
||||
list(APPEND RMG_INPUT_SOURCES
|
||||
VRU.cpp
|
||||
VRUwords.cpp
|
||||
)
|
||||
add_definitions(-DVRU)
|
||||
endif(VRU)
|
||||
|
||||
add_library(RMG-Input SHARED ${RMG_INPUT_SOURCES})
|
||||
|
||||
target_link_libraries(RMG-Input RMG-Core ${SDL2_LIBRARIES})
|
||||
@@ -41,4 +55,4 @@ target_include_directories(RMG-Input PRIVATE
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(RMG-Input Qt5::Gui Qt5::Widgets Qt5::Svg)
|
||||
target_link_libraries(RMG-Input Qt6::Gui Qt6::Widgets Qt6::Svg)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "HotkeysThread.hpp"
|
||||
|
||||
#include <RMG-Core/Core.hpp>
|
||||
|
||||
using namespace Thread;
|
||||
|
||||
HotkeysThread::HotkeysThread(std::function<void(int)> checkHotkeysFunc, QObject *parent) : QThread(parent)
|
||||
{
|
||||
this->checkHotkeysFunc = checkHotkeysFunc;
|
||||
}
|
||||
|
||||
HotkeysThread::~HotkeysThread()
|
||||
{
|
||||
if (this->isRunning())
|
||||
{
|
||||
this->StopLoop();
|
||||
}
|
||||
}
|
||||
|
||||
void HotkeysThread::SetState(HotkeysThreadState state)
|
||||
{
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
void HotkeysThread::StopLoop(void)
|
||||
{
|
||||
this->keepLoopRunning = false;
|
||||
while (this->isRunning())
|
||||
{
|
||||
// wait until we're not running anymore
|
||||
}
|
||||
}
|
||||
|
||||
void HotkeysThread::run(void)
|
||||
{
|
||||
while (this->keepLoopRunning)
|
||||
{
|
||||
// sleep for 300ms when no ROM is opened
|
||||
if (this->state == HotkeysThreadState::RomClosed)
|
||||
{
|
||||
QThread::msleep(300);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CoreIsEmulationPaused())
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
this->checkHotkeysFunc(i);
|
||||
}
|
||||
}
|
||||
|
||||
// sleep for 100ms
|
||||
QThread::msleep(100);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HOTKEYSTHREAD_HPP
|
||||
#define HOTKEYSTHREAD_HPP
|
||||
|
||||
#include <QThread>
|
||||
|
||||
enum class HotkeysThreadState
|
||||
{
|
||||
RomOpened,
|
||||
RomClosed,
|
||||
};
|
||||
|
||||
namespace Thread
|
||||
{
|
||||
class HotkeysThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HotkeysThread(std::function<void(int)> checkHotkeysFunc, QObject *parent);
|
||||
~HotkeysThread(void);
|
||||
|
||||
void run(void) override;
|
||||
|
||||
void SetState(HotkeysThreadState state);
|
||||
|
||||
void StopLoop(void);
|
||||
|
||||
private:
|
||||
bool keepLoopRunning = true;
|
||||
std::function<void(int)> checkHotkeysFunc;
|
||||
HotkeysThreadState state = HotkeysThreadState::RomClosed;
|
||||
|
||||
};
|
||||
} // namespace Thread
|
||||
|
||||
#endif // HOTKEYSTHREAD_HPP
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "HotkeysDialog.hpp"
|
||||
#include "common.hpp"
|
||||
|
||||
#include <RMG-Core/Core.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace UserInterface;
|
||||
|
||||
HotkeysDialog::HotkeysDialog(QWidget* parent, QList<HotkeySettingMapping> hotkeySettingMappings,
|
||||
bool isGameController, SDL_JoystickID joystickId,
|
||||
bool filterEvents, bool removeDuplicates) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
|
||||
{
|
||||
this->setupUi(this);
|
||||
|
||||
this->currentJoystickId = joystickId;
|
||||
this->isCurrentJoystickGameController = isGameController;
|
||||
this->filterEventsForButtons = filterEvents;
|
||||
this->removeDuplicates = removeDuplicates;
|
||||
|
||||
this->hotkeySettingMappings.append(
|
||||
{
|
||||
{ this->shutdownKeyButton, SettingsID::Input_Hotkey_Shutdown_InputType, SettingsID::Input_Hotkey_Shutdown_Name, SettingsID::Input_Hotkey_Shutdown_Data, SettingsID::Input_Hotkey_Shutdown_ExtraData },
|
||||
{ this->exitKeyButton, SettingsID::Input_Hotkey_Exit_InputType, SettingsID::Input_Hotkey_Exit_Name, SettingsID::Input_Hotkey_Exit_Data, SettingsID::Input_Hotkey_Exit_ExtraData },
|
||||
{ this->softResetKeyButton, SettingsID::Input_Hotkey_SoftReset_InputType, SettingsID::Input_Hotkey_SoftReset_Name, SettingsID::Input_Hotkey_SoftReset_Data, SettingsID::Input_Hotkey_SoftReset_ExtraData },
|
||||
{ this->hardResetKeyButton, SettingsID::Input_Hotkey_HardReset_InputType, SettingsID::Input_Hotkey_HardReset_Name, SettingsID::Input_Hotkey_HardReset_Data, SettingsID::Input_Hotkey_HardReset_ExtraData },
|
||||
{ this->pauseKeyButton, SettingsID::Input_Hotkey_Resume_InputType, SettingsID::Input_Hotkey_Resume_Name, SettingsID::Input_Hotkey_Resume_Data, SettingsID::Input_Hotkey_Resume_ExtraData },
|
||||
{ this->generateBitmapKeyButton, SettingsID::Input_Hotkey_Screenshot_InputType, SettingsID::Input_Hotkey_Screenshot_Name, SettingsID::Input_Hotkey_Screenshot_Data, SettingsID::Input_Hotkey_Screenshot_ExtraData },
|
||||
{ this->limitFPSKeyButton, SettingsID::Input_Hotkey_LimitFPS_InputType, SettingsID::Input_Hotkey_LimitFPS_Name, SettingsID::Input_Hotkey_LimitFPS_Data, SettingsID::Input_Hotkey_LimitFPS_ExtraData },
|
||||
{ this->speedFactor25KeyButton, SettingsID::Input_Hotkey_SpeedFactor25_InputType, SettingsID::Input_Hotkey_SpeedFactor25_Name, SettingsID::Input_Hotkey_SpeedFactor25_Data, SettingsID::Input_Hotkey_SpeedFactor25_ExtraData },
|
||||
{ this->speedFactor50KeyButton, SettingsID::Input_Hotkey_SpeedFactor50_InputType, SettingsID::Input_Hotkey_SpeedFactor50_Name, SettingsID::Input_Hotkey_SpeedFactor50_Data, SettingsID::Input_Hotkey_SpeedFactor50_ExtraData },
|
||||
{ this->speedFactor75KeyButton, SettingsID::Input_Hotkey_SpeedFactor75_InputType, SettingsID::Input_Hotkey_SpeedFactor75_Name, SettingsID::Input_Hotkey_SpeedFactor75_Data, SettingsID::Input_Hotkey_SpeedFactor75_ExtraData },
|
||||
{ this->speedFactor100KeyButton, SettingsID::Input_Hotkey_SpeedFactor100_InputType, SettingsID::Input_Hotkey_SpeedFactor100_Name, SettingsID::Input_Hotkey_SpeedFactor100_Data, SettingsID::Input_Hotkey_SpeedFactor100_ExtraData },
|
||||
{ this->speedFactor125KeyButton, SettingsID::Input_Hotkey_SpeedFactor125_InputType, SettingsID::Input_Hotkey_SpeedFactor125_Name, SettingsID::Input_Hotkey_SpeedFactor125_Data, SettingsID::Input_Hotkey_SpeedFactor125_ExtraData },
|
||||
{ this->speedFactor150KeyButton, SettingsID::Input_Hotkey_SpeedFactor150_InputType, SettingsID::Input_Hotkey_SpeedFactor150_Name, SettingsID::Input_Hotkey_SpeedFactor150_Data, SettingsID::Input_Hotkey_SpeedFactor150_ExtraData },
|
||||
{ this->speedFactor175KeyButton, SettingsID::Input_Hotkey_SpeedFactor175_InputType, SettingsID::Input_Hotkey_SpeedFactor175_Name, SettingsID::Input_Hotkey_SpeedFactor175_Data, SettingsID::Input_Hotkey_SpeedFactor175_ExtraData },
|
||||
{ this->speedFactor200KeyButton, SettingsID::Input_Hotkey_SpeedFactor200_InputType, SettingsID::Input_Hotkey_SpeedFactor200_Name, SettingsID::Input_Hotkey_SpeedFactor200_Data, SettingsID::Input_Hotkey_SpeedFactor200_ExtraData },
|
||||
{ this->speedFactor225KeyButton, SettingsID::Input_Hotkey_SpeedFactor225_InputType, SettingsID::Input_Hotkey_SpeedFactor225_Name, SettingsID::Input_Hotkey_SpeedFactor225_Data, SettingsID::Input_Hotkey_SpeedFactor225_ExtraData },
|
||||
{ this->speedFactor250KeyButton, SettingsID::Input_Hotkey_SpeedFactor250_InputType, SettingsID::Input_Hotkey_SpeedFactor250_Name, SettingsID::Input_Hotkey_SpeedFactor250_Data, SettingsID::Input_Hotkey_SpeedFactor250_ExtraData },
|
||||
{ this->speedFactor275KeyButton, SettingsID::Input_Hotkey_SpeedFactor275_InputType, SettingsID::Input_Hotkey_SpeedFactor275_Name, SettingsID::Input_Hotkey_SpeedFactor275_Data, SettingsID::Input_Hotkey_SpeedFactor275_ExtraData },
|
||||
{ this->speedFactor300KeyButton, SettingsID::Input_Hotkey_SpeedFactor300_InputType, SettingsID::Input_Hotkey_SpeedFactor300_Name, SettingsID::Input_Hotkey_SpeedFactor300_Data, SettingsID::Input_Hotkey_SpeedFactor300_ExtraData },
|
||||
{ this->saveStateKeyButton, SettingsID::Input_Hotkey_SaveState_InputType, SettingsID::Input_Hotkey_SaveState_Name, SettingsID::Input_Hotkey_SaveState_Data, SettingsID::Input_Hotkey_SaveState_ExtraData },
|
||||
{ this->loadStateKeyButton, SettingsID::Input_Hotkey_LoadState_InputType, SettingsID::Input_Hotkey_LoadState_Name, SettingsID::Input_Hotkey_LoadState_Data, SettingsID::Input_Hotkey_LoadState_ExtraData },
|
||||
{ this->gsButtonKeyButton, SettingsID::Input_Hotkey_GSButton_InputType, SettingsID::Input_Hotkey_GSButton_Name, SettingsID::Input_Hotkey_GSButton_Data, SettingsID::Input_Hotkey_GSButton_ExtraData },
|
||||
{ this->saveState0KeyButton, SettingsID::Input_Hotkey_SaveStateSlot0_InputType, SettingsID::Input_Hotkey_SaveStateSlot0_Name, SettingsID::Input_Hotkey_SaveStateSlot0_Data, SettingsID::Input_Hotkey_SaveStateSlot0_ExtraData },
|
||||
{ this->saveState1KeyButton, SettingsID::Input_Hotkey_SaveStateSlot1_InputType, SettingsID::Input_Hotkey_SaveStateSlot1_Name, SettingsID::Input_Hotkey_SaveStateSlot1_Data, SettingsID::Input_Hotkey_SaveStateSlot1_ExtraData },
|
||||
{ this->saveState2KeyButton, SettingsID::Input_Hotkey_SaveStateSlot2_InputType, SettingsID::Input_Hotkey_SaveStateSlot2_Name, SettingsID::Input_Hotkey_SaveStateSlot2_Data, SettingsID::Input_Hotkey_SaveStateSlot2_ExtraData },
|
||||
{ this->saveState3KeyButton, SettingsID::Input_Hotkey_SaveStateSlot3_InputType, SettingsID::Input_Hotkey_SaveStateSlot3_Name, SettingsID::Input_Hotkey_SaveStateSlot3_Data, SettingsID::Input_Hotkey_SaveStateSlot3_ExtraData },
|
||||
{ this->saveState4KeyButton, SettingsID::Input_Hotkey_SaveStateSlot4_InputType, SettingsID::Input_Hotkey_SaveStateSlot4_Name, SettingsID::Input_Hotkey_SaveStateSlot4_Data, SettingsID::Input_Hotkey_SaveStateSlot4_ExtraData },
|
||||
{ this->saveState5KeyButton, SettingsID::Input_Hotkey_SaveStateSlot5_InputType, SettingsID::Input_Hotkey_SaveStateSlot5_Name, SettingsID::Input_Hotkey_SaveStateSlot5_Data, SettingsID::Input_Hotkey_SaveStateSlot5_ExtraData },
|
||||
{ this->saveState6KeyButton, SettingsID::Input_Hotkey_SaveStateSlot6_InputType, SettingsID::Input_Hotkey_SaveStateSlot6_Name, SettingsID::Input_Hotkey_SaveStateSlot6_Data, SettingsID::Input_Hotkey_SaveStateSlot6_ExtraData },
|
||||
{ this->saveState7KeyButton, SettingsID::Input_Hotkey_SaveStateSlot7_InputType, SettingsID::Input_Hotkey_SaveStateSlot7_Name, SettingsID::Input_Hotkey_SaveStateSlot7_Data, SettingsID::Input_Hotkey_SaveStateSlot7_ExtraData },
|
||||
{ this->saveState8KeyButton, SettingsID::Input_Hotkey_SaveStateSlot8_InputType, SettingsID::Input_Hotkey_SaveStateSlot8_Name, SettingsID::Input_Hotkey_SaveStateSlot8_Data, SettingsID::Input_Hotkey_SaveStateSlot8_ExtraData },
|
||||
{ this->saveState9KeyButton, SettingsID::Input_Hotkey_SaveStateSlot9_InputType, SettingsID::Input_Hotkey_SaveStateSlot9_Name, SettingsID::Input_Hotkey_SaveStateSlot9_Data, SettingsID::Input_Hotkey_SaveStateSlot9_ExtraData },
|
||||
{ this->fullscreenKeyButton, SettingsID::Input_Hotkey_Fullscreen_InputType, SettingsID::Input_Hotkey_Fullscreen_Name, SettingsID::Input_Hotkey_Fullscreen_Data, SettingsID::Input_Hotkey_Fullscreen_ExtraData },
|
||||
});
|
||||
|
||||
// initialize buttons
|
||||
for (auto& mapping : this->hotkeySettingMappings)
|
||||
{
|
||||
mapping.button->Initialize(this);
|
||||
}
|
||||
|
||||
// initialize icons
|
||||
this->infoIconLabel->setPixmap(QIcon::fromTheme("information-line").pixmap(16, 16));
|
||||
this->infoIconLabel_2->setPixmap(QIcon::fromTheme("information-line").pixmap(16, 16));
|
||||
this->infoIconLabel_3->setPixmap(QIcon::fromTheme("information-line").pixmap(16, 16));
|
||||
this->infoIconLabel_4->setPixmap(QIcon::fromTheme("information-line").pixmap(16, 16));
|
||||
|
||||
// load settings from given mappings
|
||||
for (int i = 0; i < hotkeySettingMappings.size(); i++)
|
||||
{
|
||||
auto& buttonMapping = this->hotkeySettingMappings.at(i);
|
||||
auto& givenMapping = hotkeySettingMappings.at(i);
|
||||
|
||||
for (int y = 0; y < givenMapping.inputTypes.size(); y++)
|
||||
{
|
||||
buttonMapping.button->AddInputData(
|
||||
(InputType)givenMapping.inputTypes.at(y),
|
||||
givenMapping.inputData.at(y),
|
||||
givenMapping.extraInputData.at(y),
|
||||
QString::fromStdString(givenMapping.inputText.at(y))
|
||||
);
|
||||
}
|
||||
|
||||
buttonMapping.button->FinishState();
|
||||
}
|
||||
}
|
||||
|
||||
void HotkeysDialog::on_MainDialog_SdlEvent(SDL_Event* event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case SDL_CONTROLLERBUTTONDOWN:
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
{
|
||||
SDL_JoystickID joystickId = -1;
|
||||
InputType inputType = InputType::Invalid;
|
||||
int sdlButton = 0;
|
||||
QString sdlButtonName;
|
||||
|
||||
if (event->type == SDL_CONTROLLERBUTTONDOWN)
|
||||
{ // gamepad button
|
||||
if (!this->isCurrentJoystickGameController &&
|
||||
this->filterEventsForButtons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
joystickId = event->cbutton.which;
|
||||
inputType = InputType::GamepadButton;
|
||||
sdlButton = event->cbutton.button;
|
||||
sdlButtonName = SDL_GameControllerGetStringForButton((SDL_GameControllerButton)sdlButton);
|
||||
}
|
||||
else
|
||||
{ // joystick button
|
||||
if (this->isCurrentJoystickGameController &&
|
||||
this->filterEventsForButtons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
joystickId = event->jbutton.which;
|
||||
inputType = InputType::JoystickButton;
|
||||
sdlButton = event->jbutton.button;
|
||||
sdlButtonName = "button " + QString::number(sdlButton);
|
||||
}
|
||||
|
||||
// make sure we have the right joystick
|
||||
if (joystickId != this->currentJoystickId)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->currentHotkeyButton != nullptr)
|
||||
{
|
||||
this->currentHotkeyButton->AddInputData(
|
||||
inputType,
|
||||
sdlButton,
|
||||
0,
|
||||
sdlButtonName
|
||||
);
|
||||
}
|
||||
} break;
|
||||
|
||||
case SDL_CONTROLLERBUTTONUP:
|
||||
case SDL_JOYBUTTONUP:
|
||||
{
|
||||
SDL_JoystickID joystickId = -1;
|
||||
|
||||
if (event->type == SDL_CONTROLLERBUTTONUP)
|
||||
{ // gamepad button
|
||||
if (!this->isCurrentJoystickGameController &&
|
||||
this->filterEventsForButtons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
joystickId = event->cbutton.which;
|
||||
}
|
||||
else
|
||||
{ // joystick button
|
||||
if (this->isCurrentJoystickGameController &&
|
||||
this->filterEventsForButtons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
joystickId = event->jbutton.which;
|
||||
}
|
||||
|
||||
// make sure we have the right joystick
|
||||
if (joystickId != this->currentJoystickId)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->currentHotkeyButton != nullptr)
|
||||
{
|
||||
this->currentHotkeyButton->StopTimer();
|
||||
this->currentHotkeyButton->FinishState();
|
||||
this->currentHotkeyButton->clearFocus();
|
||||
this->currentHotkeyButton = nullptr;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void HotkeysDialog::on_HotkeyButton_Released(Widget::HotkeyButton* button)
|
||||
{
|
||||
if (this->currentHotkeyButton != nullptr)
|
||||
{
|
||||
this->currentHotkeyButton->StopTimer();
|
||||
this->currentHotkeyButton->RestoreState();
|
||||
}
|
||||
|
||||
this->currentHotkeyButton = button;
|
||||
|
||||
button->SaveState();
|
||||
button->StartTimer();
|
||||
}
|
||||
|
||||
void HotkeysDialog::on_HotkeyButton_TimerFinished(Widget::HotkeyButton* button)
|
||||
{
|
||||
if (this->currentHotkeyButton == button)
|
||||
{
|
||||
this->currentHotkeyButton = nullptr;
|
||||
}
|
||||
|
||||
button->RestoreState();
|
||||
button->clearFocus();
|
||||
}
|
||||
|
||||
void HotkeysDialog::on_HotkeyButton_StateFinished(Widget::HotkeyButton* button)
|
||||
{
|
||||
// do nothing when the user
|
||||
// doesn't want us to remove
|
||||
// duplicates
|
||||
if (!this->removeDuplicates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<int> inputType = button->GetInputType();
|
||||
std::vector<int> inputData = button->GetInputData();
|
||||
std::vector<int> extraInputData = button->GetExtraInputData();
|
||||
|
||||
for (auto& mapping : this->hotkeySettingMappings)
|
||||
{
|
||||
// skip ourselves
|
||||
if (mapping.button == button)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inputType == mapping.button->GetInputType() &&
|
||||
inputData == mapping.button->GetInputData() &&
|
||||
extraInputData == mapping.button->GetExtraInputData())
|
||||
{
|
||||
mapping.button->Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<HotkeySettingMapping> HotkeysDialog::GetSettingMappings()
|
||||
{
|
||||
QList<HotkeySettingMapping> mappings;
|
||||
|
||||
for (auto& mapping : this->hotkeySettingMappings)
|
||||
{
|
||||
mappings.append({
|
||||
mapping.button->GetInputType(),
|
||||
mapping.button->GetInputData(),
|
||||
mapping.button->GetExtraInputData(),
|
||||
mapping.button->GetInputText(),
|
||||
mapping.inputTypeSettingsId,
|
||||
mapping.nameSettingsId,
|
||||
mapping.dataSettingsId,
|
||||
mapping.extraDataSettingsId
|
||||
});
|
||||
}
|
||||
|
||||
return mappings;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HOTKEYSDIALOG_HPP
|
||||
#define HOTKEYSDIALOG_HPP
|
||||
|
||||
#include <QDialog>
|
||||
#include <string>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <RMG-Core/Core.hpp>
|
||||
|
||||
#include "ui_HotkeysDialog.h"
|
||||
|
||||
namespace UserInterface
|
||||
{
|
||||
|
||||
struct HotkeySettingMapping
|
||||
{
|
||||
std::vector<int> inputTypes;
|
||||
std::vector<int> inputData;
|
||||
std::vector<int> extraInputData;
|
||||
std::vector<std::string> inputText;
|
||||
SettingsID inputTypeSettingsId;
|
||||
SettingsID nameSettingsId;
|
||||
SettingsID dataSettingsId;
|
||||
SettingsID extraDataSettingsId;
|
||||
};
|
||||
|
||||
class HotkeysDialog : public QDialog, private Ui::HotkeysDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
SDL_JoystickID currentJoystickId = -1;
|
||||
bool isCurrentJoystickGameController = false;
|
||||
bool filterEventsForButtons = false;
|
||||
bool removeDuplicates = false;
|
||||
|
||||
struct hotkeySettingMapping
|
||||
{
|
||||
Widget::HotkeyButton* button;
|
||||
SettingsID inputTypeSettingsId;
|
||||
SettingsID nameSettingsId;
|
||||
SettingsID dataSettingsId;
|
||||
SettingsID extraDataSettingsId;
|
||||
};
|
||||
|
||||
QList<hotkeySettingMapping> hotkeySettingMappings;
|
||||
|
||||
Widget::HotkeyButton* currentHotkeyButton = nullptr;
|
||||
|
||||
public:
|
||||
HotkeysDialog(QWidget *parent, QList<HotkeySettingMapping> hotkeySettingMappings,
|
||||
bool isGameController, SDL_JoystickID joystickId,
|
||||
bool filterEvents, bool removeDuplicates);
|
||||
|
||||
QList<HotkeySettingMapping> GetSettingMappings();
|
||||
|
||||
public slots:
|
||||
void on_MainDialog_SdlEvent(SDL_Event* event);
|
||||
|
||||
void on_HotkeyButton_Released(Widget::HotkeyButton* button);
|
||||
void on_HotkeyButton_TimerFinished(Widget::HotkeyButton* button);
|
||||
void on_HotkeyButton_StateFinished(Widget::HotkeyButton* button);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // HOTKEYSDIALOG_HPP
|
||||
@@ -0,0 +1,920 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HotkeysDialog</class>
|
||||
<widget class="QDialog" name="HotkeysDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>377</width>
|
||||
<height>563</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Hotkeys</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="keybindingsMenuTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="systemMenuTab">
|
||||
<attribute name="title">
|
||||
<string>System</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_72">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_69">
|
||||
<property name="text">
|
||||
<string>Shutdown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="shutdownKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_75">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_72">
|
||||
<property name="text">
|
||||
<string>Soft Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="softResetKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_76">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_73">
|
||||
<property name="text">
|
||||
<string>Hard Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="hardResetKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_89">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_88">
|
||||
<property name="text">
|
||||
<string>Pause</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="pauseKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_77">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_74">
|
||||
<property name="text">
|
||||
<string>Capture Screenshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="generateBitmapKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_78">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_75">
|
||||
<property name="text">
|
||||
<string>Limit FPS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="limitFPSKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_80">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_77">
|
||||
<property name="text">
|
||||
<string>Save State</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveStateKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_82">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_79">
|
||||
<property name="text">
|
||||
<string>Load State</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="loadStateKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_85">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_82">
|
||||
<property name="text">
|
||||
<string>GS Button</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="gsButtonKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_74">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_71">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="exitKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="verticalLayout_0">
|
||||
<item>
|
||||
<widget class="QLabel" name="infoIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/newPrefix/Resource/Info.ico</pixmap>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_86">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>These hotkeys are only for controllers</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="speedFactorTab">
|
||||
<attribute name="title">
|
||||
<string>Speed Factor</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_105">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_102">
|
||||
<property name="text">
|
||||
<string>25%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor25KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_106">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_103">
|
||||
<property name="text">
|
||||
<string>50%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor50KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_107">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_104">
|
||||
<property name="text">
|
||||
<string>75%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor75KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_108">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_105">
|
||||
<property name="text">
|
||||
<string>100%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor100KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_109">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_106">
|
||||
<property name="text">
|
||||
<string>125%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor125KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_110">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_107">
|
||||
<property name="text">
|
||||
<string>150%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor150KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_111">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_108">
|
||||
<property name="text">
|
||||
<string>175%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor175KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_112">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_109">
|
||||
<property name="text">
|
||||
<string>200%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor200KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_113">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_110">
|
||||
<property name="text">
|
||||
<string>225%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor225KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_114">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_111">
|
||||
<property name="text">
|
||||
<string>250%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor250KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_115">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_112">
|
||||
<property name="text">
|
||||
<string>275%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor275KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_116">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_113">
|
||||
<property name="text">
|
||||
<string>300%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="speedFactor300KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="verticalLayout_1">
|
||||
<item>
|
||||
<widget class="QLabel" name="infoIconLabel_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/newPrefix/Resource/Info.ico</pixmap>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_87">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>These hotkeys are only for controllers</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="currentSaveStateTab">
|
||||
<attribute name="title">
|
||||
<string>Current Save State</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_95">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_92">
|
||||
<property name="text">
|
||||
<string>Slot 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState0KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_96">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_93">
|
||||
<property name="text">
|
||||
<string>Slot 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState1KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_97">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_94">
|
||||
<property name="text">
|
||||
<string>Slot 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState2KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_98">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_95">
|
||||
<property name="text">
|
||||
<string>Slot 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState3KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_99">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_96">
|
||||
<property name="text">
|
||||
<string>Slot 4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState4KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_100">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_97">
|
||||
<property name="text">
|
||||
<string>Slot 5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState5KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_101">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_98">
|
||||
<property name="text">
|
||||
<string>Slot 6</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState6KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_102">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_99">
|
||||
<property name="text">
|
||||
<string>Slot 7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState7KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_104">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_101">
|
||||
<property name="text">
|
||||
<string>Slot 8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState8KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_103">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_100">
|
||||
<property name="text">
|
||||
<string>Slot 9</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="saveState9KeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="infoIconLabel_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/newPrefix/Resource/Info.ico</pixmap>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_89">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>These hotkeys are only for controllers</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="viewMenuTab">
|
||||
<attribute name="title">
|
||||
<string>View</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_86">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_83">
|
||||
<property name="text">
|
||||
<string>Full Screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UserInterface::Widget::HotkeyButton" name="fullscreenKeyButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>419</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="infoIconLabel_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/newPrefix/Resource/Info.ico</pixmap>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_90">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>These hotkeys are only for controllers</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>UserInterface::Widget::HotkeyButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>UserInterface/Widget/HotkeyButton.hpp</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>HotkeysDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>HotkeysDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
using namespace UserInterface;
|
||||
|
||||
MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
|
||||
MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread, bool romConfig) : QDialog(parent)
|
||||
{
|
||||
this->setupUi(this);
|
||||
this->setWindowIcon(QIcon(":Resource/RMG.png"));
|
||||
@@ -41,7 +41,8 @@ MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread) : QDialog(
|
||||
for (int i = 0; i < this->tabWidget->count(); i++)
|
||||
{
|
||||
Widget::ControllerWidget* widget = new Widget::ControllerWidget(this, this->eventFilter);
|
||||
widget->SetSettingsSection("Rosalie's Mupen GUI - Input Plugin Profile " + QString::number(i));
|
||||
widget->SetOnlyLoadGameProfile(romConfig);
|
||||
widget->SetSettingsSection("Player " + QString::number(i + 1), "Rosalie's Mupen GUI - Input Plugin Profile " + QString::number(i));
|
||||
widget->LoadSettings();
|
||||
this->tabWidget->widget(i)->layout()->addWidget(widget);
|
||||
controllerWidgets.push_back(widget);
|
||||
@@ -49,12 +50,28 @@ MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread) : QDialog(
|
||||
&MainDialog::on_ControllerWidget_CurrentInputDeviceChanged);
|
||||
connect(widget, &Widget::ControllerWidget::RefreshInputDevicesButtonClicked, this,
|
||||
&MainDialog::on_ControllerWidget_RefreshInputDevicesButtonClicked);
|
||||
connect(widget, &Widget::ControllerWidget::UserProfileAdded, this,
|
||||
&MainDialog::on_ControllerWidget_UserProfileAdded);
|
||||
connect(widget, &Widget::ControllerWidget::UserProfileRemoved, this,
|
||||
&MainDialog::on_ControllerWidget_UserProfileRemoved);
|
||||
}
|
||||
|
||||
// always add keyboard device
|
||||
for (auto& controllerWidget : this->controllerWidgets)
|
||||
{
|
||||
controllerWidget->AddInputDevice("Keyboard", -1);
|
||||
#ifdef VRU
|
||||
// both games which support the VRU,
|
||||
// require the VRU to be in port #4,
|
||||
// so we only have to expose it there
|
||||
if (controllerWidget == this->controllerWidgets.last())
|
||||
{
|
||||
controllerWidget->AddInputDevice("Voice Recognition Unit", (int)InputDeviceType::EmulateVRU);
|
||||
}
|
||||
#endif // VRU
|
||||
controllerWidget->AddInputDevice("None", (int)InputDeviceType::None);
|
||||
controllerWidget->AddInputDevice("Automatic", (int)InputDeviceType::Automatic);
|
||||
controllerWidget->AddInputDevice("Keyboard", (int)InputDeviceType::Keyboard);
|
||||
controllerWidget->SetInitialized(true);
|
||||
}
|
||||
|
||||
// fill device list at least once
|
||||
@@ -90,30 +107,50 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
|
||||
{
|
||||
SDL_JoystickID joystickId;
|
||||
Widget::ControllerWidget* controllerWidget;
|
||||
controllerWidget = controllerWidgets.at(this->tabWidget->currentIndex());
|
||||
controllerWidget = this->controllerWidgets.at(this->tabWidget->currentIndex());
|
||||
|
||||
// we don't need to open a keyboard
|
||||
if (deviceNum == -1)
|
||||
if (deviceNum == (int)InputDeviceType::None ||
|
||||
deviceNum == (int)InputDeviceType::Keyboard)
|
||||
{
|
||||
currentDeviceName = "";
|
||||
currentDeviceNum = -1;
|
||||
controllerWidget->SetCurrentJoystickID(-1);
|
||||
this->currentDeviceName = "";
|
||||
this->currentDeviceNum = deviceNum;
|
||||
controllerWidget->SetCurrentJoystickID(this->currentDeviceNum);
|
||||
return;
|
||||
}
|
||||
|
||||
// handle automatic mode
|
||||
if (deviceNum == (int)InputDeviceType::Automatic)
|
||||
{
|
||||
int currentIndex = this->tabWidget->currentIndex();
|
||||
if (currentIndex < this->inputDeviceList.size())
|
||||
{ // use device when there's one
|
||||
deviceNum = this->inputDeviceList.at(currentIndex).deviceNum;
|
||||
}
|
||||
else
|
||||
{ // no device found, fallback to keyboard
|
||||
this->currentDeviceName = "";
|
||||
this->currentDeviceNum = (int)InputDeviceType::Keyboard;
|
||||
controllerWidget->SetCurrentJoystickID(this->currentDeviceNum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_IsGameController(deviceNum) == SDL_TRUE)
|
||||
{
|
||||
currentJoystick = nullptr;
|
||||
currentController = SDL_GameControllerOpen(deviceNum);
|
||||
this->currentJoystick = nullptr;
|
||||
this->currentController = SDL_GameControllerOpen(deviceNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentJoystick = SDL_JoystickOpen(deviceNum);
|
||||
currentController = nullptr;
|
||||
this->currentJoystick = SDL_JoystickOpen(deviceNum);
|
||||
this->currentController = nullptr;
|
||||
}
|
||||
currentDeviceNum = deviceNum;
|
||||
|
||||
this->currentDeviceNum = deviceNum;
|
||||
joystickId = SDL_JoystickGetDeviceInstanceID(deviceNum);
|
||||
controllerWidget->SetCurrentJoystickID(joystickId);
|
||||
controllerWidget->SetIsCurrentJoystickGameController(currentController != nullptr);
|
||||
}
|
||||
|
||||
void MainDialog::closeInputDevice()
|
||||
@@ -193,8 +230,9 @@ void MainDialog::on_ControllerWidget_CurrentInputDeviceChanged(ControllerWidget*
|
||||
this->closeInputDevice();
|
||||
|
||||
// only open device,
|
||||
// when it's not a keyboard
|
||||
if (deviceNum != -1)
|
||||
// when needed
|
||||
if (deviceNum != (int)InputDeviceType::None &&
|
||||
deviceNum != (int)InputDeviceType::Keyboard)
|
||||
{
|
||||
this->openInputDevice(deviceName, deviceNum);
|
||||
}
|
||||
@@ -212,21 +250,54 @@ void MainDialog::on_ControllerWidget_RefreshInputDevicesButtonClicked()
|
||||
this->sdlThread->SetAction(SDLThreadAction::GetInputDevices);
|
||||
}
|
||||
|
||||
void MainDialog::on_ControllerWidget_UserProfileAdded(QString name, QString section)
|
||||
{
|
||||
for (auto& controllerWidget : this->controllerWidgets)
|
||||
{
|
||||
controllerWidget->AddUserProfile(name, section);
|
||||
}
|
||||
}
|
||||
|
||||
void MainDialog::on_ControllerWidget_UserProfileRemoved(QString name, QString section)
|
||||
{
|
||||
for (auto& controllerWidget : this->controllerWidgets)
|
||||
{
|
||||
controllerWidget->RemoveUserProfile(name, section);
|
||||
}
|
||||
}
|
||||
|
||||
void MainDialog::on_tabWidget_currentChanged(int index)
|
||||
{
|
||||
QString deviceName;
|
||||
int deviceNum;
|
||||
int deviceNum;
|
||||
Widget::ControllerWidget* controllerWidget;
|
||||
|
||||
Widget::ControllerWidget* controllerWidget = controllerWidgets.at(index);
|
||||
// save previous tab's user profile
|
||||
if (previousTabWidgetIndex != -1 &&
|
||||
previousTabWidgetIndex != index)
|
||||
{
|
||||
controllerWidget = controllerWidgets.at(previousTabWidgetIndex);
|
||||
controllerWidget->SaveUserProfileSettings();
|
||||
}
|
||||
|
||||
// update previous index
|
||||
previousTabWidgetIndex = index;
|
||||
|
||||
// prepare switched tab
|
||||
controllerWidget = controllerWidgets.at(index);
|
||||
controllerWidget->ClearControllerImage();
|
||||
|
||||
this->closeInputDevice();
|
||||
|
||||
// re-load user profile settings
|
||||
controllerWidget->LoadUserProfileSettings();
|
||||
|
||||
// retrieve current input device
|
||||
controllerWidget->GetCurrentInputDevice(deviceName, deviceNum);
|
||||
|
||||
// only open device,
|
||||
// when it's not a keyboard
|
||||
if (deviceNum != -1)
|
||||
// only open device when needed
|
||||
if (deviceNum != (int)InputDeviceType::None &&
|
||||
deviceNum != (int)InputDeviceType::Keyboard)
|
||||
{
|
||||
this->openInputDevice(deviceName, deviceNum);
|
||||
}
|
||||
@@ -309,19 +380,37 @@ void MainDialog::on_EventFilter_KeyReleased(QKeyEvent *event)
|
||||
SDL_PeepEvents(&sdlEvent, 1, SDL_ADDEVENT, 0, 0);
|
||||
}
|
||||
|
||||
void MainDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||
void MainDialog::accept(void)
|
||||
{
|
||||
QPushButton *pushButton = (QPushButton *)button;
|
||||
QPushButton *okButton = this->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Widget::ControllerWidget* controllerWidget;
|
||||
int currentIndex = this->tabWidget->currentIndex();
|
||||
|
||||
if (pushButton == okButton)
|
||||
for (int i = 0; i < this->controllerWidgets.count(); i++)
|
||||
{
|
||||
for (auto& controllerWidget : this->controllerWidgets)
|
||||
if (i != currentIndex)
|
||||
{
|
||||
controllerWidget = this->controllerWidgets.at(i);
|
||||
controllerWidget->SaveSettings();
|
||||
}
|
||||
|
||||
CoreSettingsSave();
|
||||
}
|
||||
|
||||
// the widget which has focus should be saved last
|
||||
controllerWidget = this->controllerWidgets.at(currentIndex);
|
||||
controllerWidget->SaveSettings();
|
||||
|
||||
CoreSettingsSave();
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void MainDialog::reject(void)
|
||||
{
|
||||
for (auto& controllerWidget : this->controllerWidgets)
|
||||
{
|
||||
controllerWidget->RevertSettings();
|
||||
}
|
||||
|
||||
CoreSettingsSave();
|
||||
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
QString deviceName;
|
||||
int deviceNum;
|
||||
|
||||
bool operator== (inputDevice_t other)
|
||||
bool operator== (inputDevice_t other) const
|
||||
{
|
||||
return other.deviceNum == deviceNum &&
|
||||
other.deviceName == deviceName;
|
||||
@@ -43,11 +43,13 @@ private:
|
||||
bool updatingDeviceList = false;
|
||||
|
||||
QList<Widget::ControllerWidget*> controllerWidgets;
|
||||
SDL_Joystick* currentJoystick = nullptr;
|
||||
SDL_Joystick* currentJoystick = nullptr;
|
||||
SDL_GameController* currentController = nullptr;
|
||||
QString currentDeviceName;
|
||||
int currentDeviceNum = 0;
|
||||
|
||||
int previousTabWidgetIndex = 0;
|
||||
|
||||
EventFilter* eventFilter;
|
||||
|
||||
void addInputDevice(QString, int);
|
||||
@@ -57,7 +59,7 @@ private:
|
||||
void closeInputDevice();
|
||||
|
||||
public:
|
||||
MainDialog(QWidget *parent, Thread::SDLThread*);
|
||||
MainDialog(QWidget *parent, Thread::SDLThread*, bool);
|
||||
~MainDialog(void);
|
||||
|
||||
public slots:
|
||||
@@ -65,7 +67,10 @@ public slots:
|
||||
|
||||
void on_ControllerWidget_CurrentInputDeviceChanged(ControllerWidget*, QString, int);
|
||||
void on_ControllerWidget_RefreshInputDevicesButtonClicked();
|
||||
|
||||
|
||||
void on_ControllerWidget_UserProfileAdded(QString, QString);
|
||||
void on_ControllerWidget_UserProfileRemoved(QString, QString);
|
||||
|
||||
void on_tabWidget_currentChanged(int);
|
||||
|
||||
void on_SDLThread_DeviceFound(QString, int);
|
||||
@@ -75,7 +80,8 @@ private slots:
|
||||
void on_EventFilter_KeyPressed(QKeyEvent *);
|
||||
void on_EventFilter_KeyReleased(QKeyEvent *);
|
||||
|
||||
void on_buttonBox_clicked(QAbstractButton *);
|
||||
void accept(void) Q_DECL_OVERRIDE;
|
||||
void reject(void) Q_DECL_OVERRIDE;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,27 +18,41 @@ OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings) :
|
||||
{
|
||||
this->setupUi(this);
|
||||
|
||||
this->setIconsForEmulationInfoText();
|
||||
|
||||
this->controllerPakComboBox->setCurrentIndex(settings.ControllerPak);
|
||||
this->gameboyRomLineEdit->setText(QString::fromStdString(settings.GameboyRom));
|
||||
this->gameboySaveLineEdit->setText(QString::fromStdString(settings.GameboySave));
|
||||
this->removeDuplicateMappingsCheckbox->setChecked(settings.RemoveDuplicateMappings);
|
||||
this->invertAxisCheckBox->setChecked(settings.InvertAxis);
|
||||
this->filterEventsForButtonsCheckBox->setChecked(settings.FilterEventsForButtons);
|
||||
this->filterEventsForAxisCheckBox->setChecked(settings.FilterEventsForAxis);
|
||||
|
||||
if (!CoreIsEmulationRunning() && !CoreIsEmulationPaused())
|
||||
{
|
||||
this->hideEmulationInfoText();
|
||||
}
|
||||
}
|
||||
|
||||
bool OptionsDialog::HasSaved()
|
||||
{
|
||||
return this->hasSaved;
|
||||
}
|
||||
|
||||
OptionsDialogSettings OptionsDialog::GetSettings()
|
||||
{
|
||||
return this->settings;
|
||||
}
|
||||
|
||||
void OptionsDialog::setIconsForEmulationInfoText(void)
|
||||
{
|
||||
QLabel* labels[] = {
|
||||
this->infoIconLabel_0
|
||||
};
|
||||
|
||||
QIcon infoIcon = QIcon::fromTheme("information-line");
|
||||
QPixmap infoIconPixmap = infoIcon.pixmap(16, 16);
|
||||
|
||||
for (QLabel* label : labels)
|
||||
{
|
||||
label->setPixmap(infoIconPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::hideEmulationInfoText(void)
|
||||
{
|
||||
QHBoxLayout *layouts[] = {this->emulationInfoLayout_1};
|
||||
@@ -53,23 +67,16 @@ void OptionsDialog::hideEmulationInfoText(void)
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||
void OptionsDialog::accept()
|
||||
{
|
||||
this->settings.ControllerPak = this->controllerPakComboBox->currentIndex();
|
||||
this->settings.GameboyRom = this->gameboyRomLineEdit->text().toStdString();
|
||||
this->settings.GameboySave = this->gameboySaveLineEdit->text().toStdString();
|
||||
this->settings.RemoveDuplicateMappings = this->removeDuplicateMappingsCheckbox->isChecked();
|
||||
this->settings.FilterEventsForButtons = this->filterEventsForButtonsCheckBox->isChecked();
|
||||
this->settings.FilterEventsForAxis = this->filterEventsForAxisCheckBox->isChecked();
|
||||
|
||||
QPushButton *pushButton = (QPushButton *)button;
|
||||
QPushButton *okButton = this->buttonBox->button(QDialogButtonBox::Ok);
|
||||
|
||||
if (pushButton == okButton)
|
||||
{
|
||||
this->hasSaved = true;
|
||||
this->settings.ControllerPak = this->controllerPakComboBox->currentIndex();
|
||||
this->settings.GameboyRom = this->gameboyRomLineEdit->text().toStdString();
|
||||
this->settings.GameboySave = this->gameboySaveLineEdit->text().toStdString();
|
||||
this->settings.RemoveDuplicateMappings = this->removeDuplicateMappingsCheckbox->isChecked();
|
||||
this->settings.InvertAxis = this->invertAxisCheckBox->isChecked();
|
||||
}
|
||||
|
||||
this->accept();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void OptionsDialog::on_changeGameboyRomButton_clicked()
|
||||
|
||||
@@ -24,7 +24,8 @@ struct OptionsDialogSettings
|
||||
|
||||
// UI settings
|
||||
bool RemoveDuplicateMappings = false;
|
||||
bool InvertAxis = false;
|
||||
bool FilterEventsForButtons = true;
|
||||
bool FilterEventsForAxis = true;
|
||||
};
|
||||
|
||||
namespace UserInterface
|
||||
@@ -36,18 +37,17 @@ Q_OBJECT
|
||||
public:
|
||||
OptionsDialog(QWidget *parent, OptionsDialogSettings settings);
|
||||
|
||||
bool HasSaved();
|
||||
OptionsDialogSettings GetSettings();
|
||||
|
||||
protected:
|
||||
void accept() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
bool hasSaved = false;
|
||||
OptionsDialogSettings settings;
|
||||
|
||||
void setIconsForEmulationInfoText(void);
|
||||
void hideEmulationInfoText(void);
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_clicked(QAbstractButton *);
|
||||
|
||||
void on_changeGameboyRomButton_clicked();
|
||||
void on_changeGameboySaveButton_clicked();
|
||||
};
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="emulationInfoLayout_1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="infoIconLabel_0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -162,7 +162,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="UIResources.qrc">:/Resource/Info.ico</pixmap>
|
||||
<pixmap>:/Resource/Info.ico</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
@@ -203,9 +203,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="invertAxisCheckBox">
|
||||
<widget class="QCheckBox" name="filterEventsForButtonsCheckBox">
|
||||
<property name="text">
|
||||
<string>Invert Axes Mapped To LRZ</string>
|
||||
<string>Filter Events Based On Joystick Type For Buttons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="filterEventsForAxisCheckBox">
|
||||
<property name="text">
|
||||
<string>Filter Events Based On Joystick Type For Axis</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -241,5 +248,38 @@
|
||||
<resources>
|
||||
<include location="UIResources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>OptionsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>OptionsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"
|
||||
id="svg21"
|
||||
sodipodi:docname="Controller.svg"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -23,15 +23,17 @@
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.28240146"
|
||||
inkscape:cx="-426.69751"
|
||||
inkscape:cy="3454.3023"
|
||||
inkscape:zoom="0.070600365"
|
||||
inkscape:cx="6019.7989"
|
||||
inkscape:cy="1600.5583"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg21" />
|
||||
inkscape:current-layer="layer2"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<path
|
||||
id="Dark-Grey-Background"
|
||||
serif:id="Dark Grey Background"
|
||||
@@ -111,4 +113,39 @@
|
||||
style="fill:#ec3f21"
|
||||
id="circle18" />
|
||||
</g>
|
||||
</svg>
|
||||
<g
|
||||
id="layer2"
|
||||
inkscape:label="Z-Button"
|
||||
style="display:inline;opacity:1;stroke-width:1;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
transform="matrix(50.366966,0,0,50.366966,3240.0678,-579.56452)"><g
|
||||
id="layer2-0"
|
||||
inkscape:label="Z-Button"
|
||||
style="clip-rule:evenodd;display:inline;fill-rule:evenodd;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;paint-order:markers stroke fill"><rect
|
||||
style="clip-rule:evenodd;display:inline;opacity:1;fill:#5c5c5c;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.999999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;image-rendering:auto"
|
||||
id="rect1917-0-4"
|
||||
width="11.478539"
|
||||
height="16.72587"
|
||||
x="-32.517441"
|
||||
y="86.256668"
|
||||
ry="3.4675589"
|
||||
inkscape:label="btnZ-outline"
|
||||
class="theme-button"
|
||||
ojd-button="Z" /><rect
|
||||
style="display:inline;opacity:1;fill:#bcbdbf;fill-opacity:1;stroke:none;stroke-width:0.960842;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;image-rendering:auto"
|
||||
id="rect1917-8"
|
||||
width="10.956328"
|
||||
height="16.177647"
|
||||
x="-32.225891"
|
||||
y="86.523468"
|
||||
ry="3.3539019"
|
||||
inkscape:label="btnZ"
|
||||
class="theme-button"
|
||||
ojd-button="Z" /><g
|
||||
aria-label="Z"
|
||||
style="font-style:normal;font-weight:normal;font-size:5.73478px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;clip-rule:evenodd;display:inline;opacity:1;fill:#56575b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.751267;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
id="text1921-7"
|
||||
transform="matrix(1.3310888,0,0,1.3310888,-67.459296,-40.853038)"><path
|
||||
d="m 28.805176,99.685474 h 3.514231 v 0.652446 l -2.242948,2.71338 h 2.307352 v 0.81485 h -3.64304 v -0.65244 l 2.242948,-2.71338 h -2.178543 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#56575b;fill-opacity:1;stroke-width:0.751267;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
id="path2008-2"
|
||||
inkscape:connector-curvature="0" /></g></g></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
@@ -8,7 +8,7 @@
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"
|
||||
id="svg21"
|
||||
sodipodi:docname="Controller_NoAnalogStick.svg"
|
||||
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -23,15 +23,17 @@
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.14120073"
|
||||
inkscape:cx="2549.5619"
|
||||
inkscape:cy="3325.0536"
|
||||
inkscape:zoom="0.099843994"
|
||||
inkscape:cx="2829.4141"
|
||||
inkscape:cy="3475.4219"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1007"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg21" />
|
||||
inkscape:current-layer="svg21"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<path
|
||||
id="Dark-Grey-Background"
|
||||
serif:id="Dark Grey Background"
|
||||
@@ -101,4 +103,36 @@
|
||||
style="fill:#ec3f21"
|
||||
id="circle18" />
|
||||
</g>
|
||||
</svg>
|
||||
<g
|
||||
id="layer2"
|
||||
inkscape:label="Z-Button"
|
||||
style="display:inline;opacity:1;stroke-width:1;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
transform="matrix(50.366966,0,0,50.366966,3240.0678,-579.56452)"><rect
|
||||
style="clip-rule:evenodd;display:inline;opacity:1;fill:#5c5c5c;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.999999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;image-rendering:auto"
|
||||
id="rect1917-0"
|
||||
width="11.478539"
|
||||
height="16.72587"
|
||||
x="-32.517441"
|
||||
y="86.256668"
|
||||
ry="3.4675589"
|
||||
inkscape:label="btnZ-outline"
|
||||
class="theme-button"
|
||||
ojd-button="Z" /><rect
|
||||
style="display:inline;opacity:1;fill:#bcbdbf;fill-opacity:1;stroke:none;stroke-width:0.960842;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill;image-rendering:auto"
|
||||
id="rect1917"
|
||||
width="10.956328"
|
||||
height="16.177647"
|
||||
x="-32.225891"
|
||||
y="86.523468"
|
||||
ry="3.3539019"
|
||||
inkscape:label="btnZ"
|
||||
class="theme-button"
|
||||
ojd-button="Z" /><g
|
||||
aria-label="Z"
|
||||
style="font-style:normal;font-weight:normal;font-size:5.73478px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;clip-rule:evenodd;display:inline;opacity:1;fill:#56575b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.751267;stroke-linejoin:round;stroke-miterlimit:2;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
id="text1921"
|
||||
transform="matrix(1.3310888,0,0,1.3310888,-67.459296,-40.853038)"><path
|
||||
d="m 28.805176,99.685474 h 3.514231 v 0.652446 l -2.242948,2.71338 h 2.307352 v 0.81485 h -3.64304 v -0.65244 l 2.242948,-2.71338 h -2.178543 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#56575b;fill-opacity:1;stroke-width:0.751267;stroke-dasharray:none;paint-order:markers stroke fill"
|
||||
id="path2008"
|
||||
inkscape:connector-curvature="0" /></g></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="6939.9795"
|
||||
height="6772.564"
|
||||
viewBox="0 0 6939.9795 6772.564"
|
||||
version="1.1"
|
||||
xml:space="preserve"
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"
|
||||
id="svg21"
|
||||
sodipodi:docname="Controller_Pressed_ZTrigger.svg"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs25" /><sodipodi:namedview
|
||||
id="namedview23"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.099843994"
|
||||
inkscape:cx="2468.8516"
|
||||
inkscape:cy="3856.0156"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg21"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<g
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"
|
||||
id="g5916"
|
||||
transform="matrix(1.0882331,0,0,1.0882331,512.32815,1416.6572)"><circle
|
||||
style="opacity:0.62;fill:#ececec;fill-rule:evenodd;stroke-width:0.280377"
|
||||
id="path42"
|
||||
cx="1267.6501"
|
||||
cy="2546.3296"
|
||||
r="180.5985" /></g></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -15,7 +15,7 @@
|
||||
<file>Resource/Controller_Pressed_Start.svg</file>
|
||||
<file>Resource/Controller_Pressed_LeftTrigger.svg</file>
|
||||
<file>Resource/Controller_Pressed_RightTrigger.svg</file>
|
||||
<file>Resource/Controller_Pressed_ZTrigger.svg</file>
|
||||
<file>Resource/RMG.png</file>
|
||||
<file>Resource/Info.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "AddMappingButton.hpp"
|
||||
#include "ControllerWidget.hpp"
|
||||
#include "MappingButton.hpp"
|
||||
|
||||
using namespace UserInterface::Widget;
|
||||
|
||||
AddMappingButton::AddMappingButton(QWidget* parent) : QPushButton(parent)
|
||||
{
|
||||
}
|
||||
|
||||
AddMappingButton::~AddMappingButton()
|
||||
{
|
||||
}
|
||||
|
||||
void AddMappingButton::Initialize(ControllerWidget* widget, MappingButton* button)
|
||||
{
|
||||
this->controllerWidget = widget;
|
||||
this->mappingButton = button;
|
||||
|
||||
connect(this, &QPushButton::released, [=]
|
||||
{
|
||||
emit this->controllerWidget->on_AddMappingButton_Released(this->mappingButton);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ADDMAPPINGBUTTON_HPP
|
||||
#define ADDMAPPINGBUTTON_HPP
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
namespace UserInterface
|
||||
{
|
||||
namespace Widget
|
||||
{
|
||||
|
||||
// we can't include ControllerWidget.hpp
|
||||
// because that header includes this header,
|
||||
// so forward-declare it to prevent issues
|
||||
class ControllerWidget;
|
||||
class MappingButton;
|
||||
|
||||
class AddMappingButton : public QPushButton
|
||||
{
|
||||
private:
|
||||
ControllerWidget* controllerWidget = nullptr;
|
||||
MappingButton* mappingButton = nullptr;
|
||||
|
||||
public:
|
||||
AddMappingButton(QWidget* parent);
|
||||
~AddMappingButton();
|
||||
|
||||
void Initialize(ControllerWidget* widget, MappingButton* button);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ADDMAPPINGBUTTON_HPP
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "ControllerImageWidget.hpp"
|
||||
|
||||
#include <QSvgRenderer>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <QPainter>
|
||||
#include <QResizeEvent>
|
||||
|
||||
@@ -62,6 +62,15 @@ void ControllerImageWidget::SetDeadzone(int value)
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerImageWidget::SetSensitivity(int value)
|
||||
{
|
||||
if (this->sensitivityValue != value)
|
||||
{
|
||||
this->sensitivityValue = value;
|
||||
this->needImageUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerImageWidget::ClearControllerState()
|
||||
{
|
||||
// reset button state
|
||||
@@ -125,6 +134,7 @@ void ControllerImageWidget::paintEvent(QPaintEvent *event)
|
||||
{ N64ControllerButton::CButtonRight, ":Resource/Controller_Pressed_CButtonRight.svg" },
|
||||
{ N64ControllerButton::LeftTrigger, ":Resource/Controller_Pressed_LeftTrigger.svg" },
|
||||
{ N64ControllerButton::RightTrigger, ":Resource/Controller_Pressed_RightTrigger.svg" },
|
||||
{ N64ControllerButton::ZTrigger, ":Resource/Controller_Pressed_ZTrigger.svg" }
|
||||
};
|
||||
|
||||
static const QString baseImageUri = ":Resource/Controller_NoAnalogStick.svg";
|
||||
@@ -152,27 +162,35 @@ void ControllerImageWidget::paintEvent(QPaintEvent *event)
|
||||
renderer.setAspectRatioMode(Qt::AspectRatioMode::KeepAspectRatio);
|
||||
|
||||
QRectF rectF = renderer.viewBoxF();
|
||||
double offsetx = 0, offsety = 0;
|
||||
const int width = rectF.width();
|
||||
const int height = rectF.height();
|
||||
// we'll move the analog stick by a percentage
|
||||
// of the total width/height from the image
|
||||
const double maxOffsety = ((double)(height * 0.12265f) / 2);
|
||||
const double maxOffsetx = maxOffsety;
|
||||
const double dist = sqrt(pow(this->xAxisState, 2) + pow(this->yAxisState, 2));
|
||||
const double absoluteMaxOffset = ((double)(height * 0.12265f) / 2);
|
||||
// slope as in line gradient
|
||||
const double offsetSlope = absoluteMaxOffset / 100;
|
||||
// take sensitivity into account
|
||||
const double sensitivityFactor = this->sensitivityValue / 100.0;
|
||||
const double sensitivityAdjustedMaxOffset = absoluteMaxOffset * std::min(sensitivityFactor, 1.0);
|
||||
double offsetDeadzone = this->deadzoneValue * sensitivityFactor * offsetSlope;
|
||||
int offsetx = this->xAxisState * sensitivityFactor * offsetSlope;
|
||||
int offsety = this->yAxisState * sensitivityFactor * offsetSlope;
|
||||
const double offsetDist = sqrt(pow(offsetx, 2) + pow(offsety, 2));
|
||||
|
||||
// take deadzone into account
|
||||
if (dist > this->deadzoneValue)
|
||||
// deadzone grows with sensitivity such that the deadzone
|
||||
// is always a percentage of the real stick range
|
||||
if (offsetDist <= offsetDeadzone)
|
||||
{
|
||||
offsetx = (maxOffsetx / 100 * this->xAxisState);
|
||||
offsety = (maxOffsety / 100 * this->yAxisState);
|
||||
offsetx = 0;
|
||||
offsety = 0;
|
||||
}
|
||||
|
||||
// take circle range into account
|
||||
if (dist > 100)
|
||||
if (offsetDist > sensitivityAdjustedMaxOffset)
|
||||
{
|
||||
offsetx = (maxOffsetx / 100 * (this->xAxisState / dist * 100));
|
||||
offsety = (maxOffsety / 100 * (this->yAxisState / dist * 100));
|
||||
offsetx = (offsetx / offsetDist) * sensitivityAdjustedMaxOffset;
|
||||
offsety = (offsety / offsetDist) * sensitivityAdjustedMaxOffset;
|
||||
}
|
||||
|
||||
// adjust rect with offset
|
||||
|
||||
@@ -31,6 +31,8 @@ private:
|
||||
int yAxisState = 0;
|
||||
// deadzone value, 0-100
|
||||
int deadzoneValue = 0;
|
||||
// sensitivity value, 25-175
|
||||
int sensitivityValue = 100;
|
||||
|
||||
bool needImageUpdate = false;
|
||||
public:
|
||||
@@ -41,6 +43,7 @@ public:
|
||||
void SetXAxisState(int xAxis);
|
||||
void SetYAxisState(int yAxis);
|
||||
void SetDeadzone(int value);
|
||||
void SetSensitivity(int value);
|
||||
|
||||
void ClearControllerState();
|
||||
void UpdateImage();
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
#ifndef CONTROLLERWIDGET_H
|
||||
#define CONTROLLERWIDGET_H
|
||||
|
||||
#include "CustomButton.hpp"
|
||||
#include "MappingButton.hpp"
|
||||
#include "ControllerImageWidget.hpp"
|
||||
|
||||
#include "UserInterface/EventFilter.hpp"
|
||||
#include "UserInterface/OptionsDialog.hpp"
|
||||
#include "UserInterface/HotkeysDialog.hpp"
|
||||
|
||||
using namespace UserInterface::Widget;
|
||||
|
||||
@@ -34,28 +35,35 @@ class ControllerWidget : public QWidget, Ui::ControllerWidget
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
bool initialized = false;
|
||||
QString settingsSection;
|
||||
|
||||
QString gameSection;
|
||||
|
||||
OptionsDialogSettings optionsDialogSettings;
|
||||
|
||||
QList<QString> inputDeviceNameList;
|
||||
CustomButton* currentButton = nullptr;
|
||||
MappingButton* currentButton = nullptr;
|
||||
bool addMappingToButton = false;
|
||||
|
||||
QList<QString> profiles;
|
||||
QList<QString> removedProfiles;
|
||||
QList<QString> addedProfiles;
|
||||
|
||||
struct buttonWidgetMapping
|
||||
{
|
||||
enum N64ControllerButton button;
|
||||
CustomButton* buttonWidget;
|
||||
MappingButton* buttonWidget;
|
||||
};
|
||||
|
||||
struct axisWidgetMapping
|
||||
{
|
||||
enum InputAxisDirection direction;
|
||||
CustomButton* buttonWidget;
|
||||
MappingButton* buttonWidget;
|
||||
};
|
||||
|
||||
struct buttonSettingMapping
|
||||
{
|
||||
CustomButton* button;
|
||||
MappingButton* button;
|
||||
SettingsID inputTypeSettingsId;
|
||||
SettingsID nameSettingsId;
|
||||
SettingsID dataSettingsId;
|
||||
@@ -65,11 +73,12 @@ private:
|
||||
QList<buttonWidgetMapping> buttonWidgetMappings;
|
||||
QList<axisWidgetMapping> joystickWidgetMappings;
|
||||
QList<buttonSettingMapping> buttonSettingMappings;
|
||||
QList<CustomButton*> setupButtonWidgets;
|
||||
int currentSetupButtonWidgetIndex = 0;
|
||||
bool currentInSetup = false;
|
||||
QList<HotkeySettingMapping> hotkeySettingMappings;
|
||||
QList<MappingButton*> setupButtonWidgets;
|
||||
|
||||
void initializeButtons();
|
||||
void initializeMappingButtons();
|
||||
void initializeProfileButtons();
|
||||
void initializeMiscButtons();
|
||||
|
||||
bool isCurrentDeviceKeyboard();
|
||||
bool isCurrentDeviceNotFound();
|
||||
@@ -77,11 +86,29 @@ private:
|
||||
void disableAllChildren();
|
||||
void enableAllChildren();
|
||||
|
||||
void removeDuplicates(CustomButton* button);
|
||||
void removeDuplicates(MappingButton* button);
|
||||
|
||||
QString getCurrentSettingsSection();
|
||||
|
||||
SDL_JoystickID currentJoystickId = -1;
|
||||
QString getUserProfileSectionName(QString profile);
|
||||
|
||||
bool isSectionUserProfile(QString section);
|
||||
bool isSectionGameProfile(QString section);
|
||||
|
||||
void setPluggedIn(bool value);
|
||||
|
||||
bool hasAnyGameSettingChanged(void);
|
||||
|
||||
void showErrorMessage(QString text, QString details = "");
|
||||
|
||||
SDL_JoystickID currentJoystickId = -1;
|
||||
bool isCurrentJoystickGameController = false;
|
||||
|
||||
int previousProfileComboBoxIndex = -1;
|
||||
|
||||
bool onlyLoadGameProfile = false;
|
||||
|
||||
HotkeysDialog* currentHotkeysDialog = nullptr;
|
||||
|
||||
public:
|
||||
ControllerWidget(QWidget* parent, EventFilter* eventFilter);
|
||||
@@ -97,40 +124,61 @@ public:
|
||||
void GetCurrentInputDevice(QString& deviceName, int& deviceNum, bool ignoreDeviceNotFound = false);
|
||||
bool IsPluggedIn();
|
||||
|
||||
void SetSettingsSection(QString section);
|
||||
void SetOnlyLoadGameProfile(bool value);
|
||||
|
||||
void SetSettingsSection(QString profile, QString section);
|
||||
void SetInitialized(bool value);
|
||||
|
||||
void LoadSettings();
|
||||
void LoadSettings(QString section);
|
||||
void LoadSettings(QString section, bool loadUserProfile = false);
|
||||
void LoadUserProfileSettings();
|
||||
|
||||
void SaveDefaultSettings();
|
||||
void SaveSettings();
|
||||
void SaveUserProfileSettings();
|
||||
void SaveSettings(QString section);
|
||||
|
||||
void RevertSettings();
|
||||
|
||||
void SetCurrentJoystickID(SDL_JoystickID joystickId);
|
||||
void SetIsCurrentJoystickGameController(bool isGameController);
|
||||
|
||||
void AddUserProfile(QString name, QString section);
|
||||
void RemoveUserProfile(QString name, QString section);
|
||||
|
||||
private slots:
|
||||
void on_deadZoneSlider_valueChanged(int value);
|
||||
void on_analogStickSensitivitySlider_valueChanged(int value);
|
||||
|
||||
void on_profileComboBox_currentIndexChanged(int value);
|
||||
|
||||
void on_inputDeviceComboBox_currentIndexChanged(int value);
|
||||
void on_inputDeviceRefreshButton_clicked();
|
||||
|
||||
void on_controllerPluggedCheckBox_toggled(bool value);
|
||||
|
||||
void on_addProfileButton_clicked();
|
||||
void on_removeProfileButton_clicked();
|
||||
void on_setupButton_clicked();
|
||||
|
||||
void on_resetButton_clicked();
|
||||
void on_optionsButton_clicked();
|
||||
void on_hotkeysButton_clicked();
|
||||
|
||||
public slots:
|
||||
void on_CustomButton_released(CustomButton* button);
|
||||
void on_CustomButton_TimerFinished(CustomButton* button);
|
||||
void on_CustomButton_DataSet(CustomButton* button);
|
||||
void on_MappingButton_Released(MappingButton* button);
|
||||
void on_MappingButton_TimerFinished(MappingButton* button);
|
||||
void on_MappingButton_DataSet(MappingButton* button);
|
||||
|
||||
void on_AddMappingButton_Released(MappingButton* button);
|
||||
void on_RemoveMappingButton_Released(MappingButton* button);
|
||||
|
||||
void on_MainDialog_SdlEvent(SDL_Event* event);
|
||||
void on_MainDialog_SdlEventPollFinished();
|
||||
|
||||
signals:
|
||||
void CurrentInputDeviceChanged(ControllerWidget* widget, QString deviceName, int deviceNum);
|
||||
void RefreshInputDevicesButtonClicked();
|
||||
|
||||
void UserProfileAdded(QString name, QString section);
|
||||
void UserProfileRemoved(QString name, QString section);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "CustomButton.hpp"
|
||||
#include "ControllerWidget.hpp"
|
||||
|
||||
using namespace UserInterface::Widget;
|
||||
|
||||
CustomButton::CustomButton(QWidget* parent) : QPushButton(parent)
|
||||
{
|
||||
this->countDownTimer = new QTimer(this);
|
||||
connect(this->countDownTimer, &QTimer::timeout, this, &CustomButton::on_countDownTimer_triggered);
|
||||
}
|
||||
|
||||
CustomButton::~CustomButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CustomButton::Initialize(QWidget* widget)
|
||||
{
|
||||
this->controllerWidget = (ControllerWidget*)widget;
|
||||
|
||||
connect(this, &QPushButton::released,
|
||||
[=]
|
||||
{
|
||||
emit this->controllerWidget->on_CustomButton_released(this);
|
||||
});
|
||||
}
|
||||
|
||||
void CustomButton::Clear()
|
||||
{
|
||||
this->inputType = InputType::Invalid;
|
||||
this->inputData = 0;
|
||||
this->extraInputData = 0;
|
||||
this->savedInputData = 0;
|
||||
this->savedExtraInputData = 0;
|
||||
this->setText(" ");
|
||||
}
|
||||
|
||||
void CustomButton::StartTimer()
|
||||
{
|
||||
this->currentCountDownNum = 5;
|
||||
this->on_countDownTimer_triggered();
|
||||
this->countDownTimer->start(1000);
|
||||
}
|
||||
|
||||
void CustomButton::StopTimer()
|
||||
{
|
||||
this->countDownTimer->stop();
|
||||
}
|
||||
|
||||
void CustomButton::SetInputData(enum InputType type, int value, int extraValue, QString name)
|
||||
{
|
||||
this->inputType = type;
|
||||
this->inputData = value;
|
||||
this->extraInputData = extraValue;
|
||||
this->setText(name);
|
||||
this->StopTimer();
|
||||
emit this->controllerWidget->on_CustomButton_DataSet(this);
|
||||
}
|
||||
|
||||
enum InputType CustomButton::GetInputType()
|
||||
{
|
||||
return this->inputType;
|
||||
}
|
||||
|
||||
int CustomButton::GetInputData()
|
||||
{
|
||||
return this->inputData;
|
||||
}
|
||||
|
||||
int CustomButton::GetExtraInputData()
|
||||
{
|
||||
return this->extraInputData;
|
||||
}
|
||||
|
||||
void CustomButton::SaveState()
|
||||
{
|
||||
this->savedInputType = this->inputType;
|
||||
this->savedInputData = this->inputData;
|
||||
this->savedExtraInputData = this->extraInputData;
|
||||
this->savedText = this->text();
|
||||
}
|
||||
|
||||
void CustomButton::RestoreState()
|
||||
{
|
||||
this->inputType = this->savedInputType;
|
||||
this->inputData = this->savedInputData;
|
||||
this->extraInputData = this->savedExtraInputData;
|
||||
this->setText(this->savedText);
|
||||
}
|
||||
|
||||
void CustomButton::on_countDownTimer_triggered()
|
||||
{
|
||||
this->setText(QString::number(this->currentCountDownNum));
|
||||
|
||||
if (this->currentCountDownNum == 0)
|
||||
{
|
||||
this->setText("");
|
||||
this->currentCountDownNum = 5;
|
||||
this->countDownTimer->stop();
|
||||
emit this->controllerWidget->on_CustomButton_TimerFinished(this);
|
||||
}
|
||||
|
||||
this->currentCountDownNum--;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CUSTOMBUTTON_HPP
|
||||
#define CUSTOMBUTTON_HPP
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
namespace UserInterface
|
||||
{
|
||||
namespace Widget
|
||||
{
|
||||
|
||||
// we can't include ControllerWidget.hpp
|
||||
// because that header includes this header,
|
||||
// so forward-declare it to prevent issues
|
||||
class ControllerWidget;
|
||||
|
||||
class CustomButton : public QPushButton
|
||||
{
|
||||
private:
|
||||
QTimer* countDownTimer = nullptr;
|
||||
ControllerWidget* controllerWidget = nullptr;
|
||||
int currentCountDownNum = 0;
|
||||
enum InputType inputType = InputType::Invalid;
|
||||
int inputData = 0;
|
||||
int extraInputData = 0;
|
||||
|
||||
enum InputType savedInputType = InputType::Invalid;
|
||||
int savedInputData = 0;
|
||||
int savedExtraInputData = 0;
|
||||
QString savedText;
|
||||
public:
|
||||
CustomButton(QWidget* parent);
|
||||
~CustomButton();
|
||||
void Initialize(QWidget* widget);
|
||||
void Clear();
|
||||
|
||||
void StartTimer();
|
||||
void StopTimer();
|
||||
|
||||
|
||||
void SetInputData(enum InputType type, int value, int extraValue, QString name);
|
||||
enum InputType GetInputType();
|
||||
int GetInputData();
|
||||
int GetExtraInputData();
|
||||
|
||||
void SaveState();
|
||||
void RestoreState();
|
||||
|
||||
private slots:
|
||||
void on_countDownTimer_triggered();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // CUSTOMBUTTON_HPP
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "HotkeyButton.hpp"
|
||||
#include "UserInterface/HotkeysDialog.hpp"
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
using namespace UserInterface::Widget;
|
||||
|
||||
HotkeyButton::HotkeyButton(QWidget* parent) : QPushButton(parent)
|
||||
{
|
||||
this->countDownTimer = new QTimer(this);
|
||||
connect(this->countDownTimer, &QTimer::timeout, this, &HotkeyButton::on_countDownTimer_triggered);
|
||||
|
||||
this->initialSize = this->size();
|
||||
}
|
||||
|
||||
HotkeyButton::~HotkeyButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HotkeyButton::Initialize(HotkeysDialog* dialog)
|
||||
{
|
||||
this->hotkeysDialog = dialog;
|
||||
|
||||
connect(this, &QPushButton::released, [=]
|
||||
{
|
||||
emit this->hotkeysDialog->on_HotkeyButton_Released(this);
|
||||
});
|
||||
|
||||
this->setText(" ");
|
||||
}
|
||||
|
||||
void HotkeyButton::Clear()
|
||||
{
|
||||
this->inputData.clear();
|
||||
this->savedInputData.clear();
|
||||
this->setText("");
|
||||
}
|
||||
|
||||
void HotkeyButton::StartTimer()
|
||||
{
|
||||
// clear current state
|
||||
this->inputData.clear();
|
||||
|
||||
this->currentCountDownNum = 5;
|
||||
this->on_countDownTimer_triggered();
|
||||
this->countDownTimer->start(1000);
|
||||
}
|
||||
|
||||
void HotkeyButton::StopTimer()
|
||||
{
|
||||
this->countDownTimer->stop();
|
||||
}
|
||||
|
||||
void HotkeyButton::AddInputData(enum InputType type, int value, int extraValue, QString name)
|
||||
{
|
||||
// don't add stub
|
||||
if (name.simplified().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->HasInputData(type, value, extraValue))
|
||||
{
|
||||
this->inputData.push_back(
|
||||
{
|
||||
type,
|
||||
value,
|
||||
extraValue,
|
||||
name
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool HotkeyButton::HasInputData(enum InputType type, int value, int extraValue)
|
||||
{
|
||||
return this->getInputDataIter(type, value, extraValue) != this->inputData.end();
|
||||
}
|
||||
|
||||
std::vector<int> HotkeyButton::GetInputType()
|
||||
{
|
||||
std::vector<int> inputTypeList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
inputTypeList.push_back((int)data.Type);
|
||||
}
|
||||
|
||||
return inputTypeList;
|
||||
}
|
||||
|
||||
std::vector<int> HotkeyButton::GetInputData()
|
||||
{
|
||||
std::vector<int> inputDataList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
inputDataList.push_back(data.Data);
|
||||
}
|
||||
|
||||
return inputDataList;
|
||||
}
|
||||
|
||||
std::vector<int> HotkeyButton::GetExtraInputData()
|
||||
{
|
||||
std::vector<int> extraInputDataList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
extraInputDataList.push_back(data.ExtraData);
|
||||
}
|
||||
|
||||
return extraInputDataList;
|
||||
}
|
||||
|
||||
std::vector<std::string> HotkeyButton::GetInputText()
|
||||
{
|
||||
std::vector<std::string> inputTextList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
inputTextList.push_back(data.Text.toStdString());
|
||||
}
|
||||
|
||||
return inputTextList;
|
||||
}
|
||||
|
||||
void HotkeyButton::SaveState()
|
||||
{
|
||||
this->savedInputData = this->inputData;
|
||||
}
|
||||
|
||||
void HotkeyButton::RestoreState()
|
||||
{
|
||||
this->inputData = this->savedInputData;
|
||||
this->reloadText();
|
||||
}
|
||||
|
||||
void HotkeyButton::FinishState()
|
||||
{
|
||||
this->reloadText();
|
||||
emit this->hotkeysDialog->on_HotkeyButton_StateFinished(this);
|
||||
}
|
||||
|
||||
void HotkeyButton::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton)
|
||||
{
|
||||
this->Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QPushButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void HotkeyButton::on_countDownTimer_triggered()
|
||||
{
|
||||
this->setText(QString::number(this->currentCountDownNum));
|
||||
|
||||
if (this->currentCountDownNum == 0)
|
||||
{
|
||||
this->setText("");
|
||||
this->currentCountDownNum = 5;
|
||||
this->countDownTimer->stop();
|
||||
emit this->hotkeysDialog->on_HotkeyButton_TimerFinished(this);
|
||||
}
|
||||
|
||||
this->currentCountDownNum--;
|
||||
}
|
||||
|
||||
void HotkeyButton::reloadText()
|
||||
{
|
||||
QString text;
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
|
||||
int size = this->inputData.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
text += this->inputData.at(i).Text;
|
||||
|
||||
// only add comma when
|
||||
// not at the last item
|
||||
if (i < (size - 1))
|
||||
{
|
||||
text += "+";
|
||||
}
|
||||
}
|
||||
|
||||
QString elidedText = fontMetrics.elidedText(text, Qt::ElideRight, this->initialSize.width());
|
||||
|
||||
// needed for spacing
|
||||
if (elidedText.isEmpty())
|
||||
{
|
||||
elidedText = " ";
|
||||
}
|
||||
|
||||
this->setToolTip(text);
|
||||
this->setText(elidedText);
|
||||
}
|
||||
|
||||
std::vector<HotkeyButtonInputDataType>::iterator HotkeyButton::getInputDataIter(InputType type, int value, int extraValue)
|
||||
{
|
||||
auto predicate = [type, value, extraValue](const auto& entry)
|
||||
{
|
||||
return entry.Type == type &&
|
||||
(value == -1 || entry.Data == value) &&
|
||||
(extraValue == -1 || entry.ExtraData == extraValue);
|
||||
};
|
||||
|
||||
return std::find_if(this->inputData.begin(), this->inputData.end(), predicate);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HOTKEYBUTTON_HPP
|
||||
#define HOTKEYBUTTON_HPP
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
namespace UserInterface
|
||||
{
|
||||
|
||||
// we can't include HotkeysDialog.hpp
|
||||
// because that header includes this header,
|
||||
// so forward-declare it to prevent issues
|
||||
class HotkeysDialog;
|
||||
|
||||
namespace Widget
|
||||
{
|
||||
|
||||
struct HotkeyButtonInputDataType
|
||||
{
|
||||
InputType Type;
|
||||
int Data;
|
||||
int ExtraData;
|
||||
QString Text;
|
||||
};
|
||||
|
||||
class HotkeyButton : public QPushButton
|
||||
{
|
||||
private:
|
||||
QSize initialSize;
|
||||
QTimer* countDownTimer = nullptr;
|
||||
HotkeysDialog* hotkeysDialog = nullptr;
|
||||
int currentCountDownNum = 0;
|
||||
|
||||
std::vector<HotkeyButtonInputDataType> inputData;
|
||||
|
||||
std::vector<HotkeyButtonInputDataType> savedInputData;
|
||||
|
||||
void reloadText();
|
||||
|
||||
std::vector<HotkeyButtonInputDataType>::iterator getInputDataIter(InputType type, int value, int extraValue);
|
||||
|
||||
public:
|
||||
HotkeyButton(QWidget* parent);
|
||||
~HotkeyButton();
|
||||
|
||||
void Initialize(HotkeysDialog* dialog);
|
||||
void Clear();
|
||||
|
||||
void StartTimer();
|
||||
void StopTimer();
|
||||
|
||||
void AddInputData(InputType type, int value, int extraValue, QString name);
|
||||
|
||||
bool HasInputData(InputType type, int value = -1, int extraValue = -1);
|
||||
|
||||
std::vector<int> GetInputType();
|
||||
std::vector<int> GetInputData();
|
||||
std::vector<int> GetExtraInputData();
|
||||
std::vector<std::string> GetInputText();
|
||||
|
||||
void SaveState();
|
||||
void RestoreState();
|
||||
void FinishState();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private slots:
|
||||
void on_countDownTimer_triggered();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HOTKEYBUTTON_HPP
|
||||
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
|
||||
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "MappingButton.hpp"
|
||||
#include "ControllerWidget.hpp"
|
||||
|
||||
using namespace UserInterface::Widget;
|
||||
|
||||
MappingButton::MappingButton(QWidget* parent) : QPushButton(parent)
|
||||
{
|
||||
this->countDownTimer = new QTimer(this);
|
||||
connect(this->countDownTimer, &QTimer::timeout, this, &MappingButton::on_countDownTimer_triggered);
|
||||
|
||||
this->initialSize = this->size();
|
||||
}
|
||||
|
||||
MappingButton::~MappingButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MappingButton::Initialize(ControllerWidget* widget)
|
||||
{
|
||||
this->controllerWidget = widget;
|
||||
|
||||
connect(this, &QPushButton::released, [=]
|
||||
{
|
||||
emit this->controllerWidget->on_MappingButton_Released(this);
|
||||
});
|
||||
|
||||
this->setText(" ");
|
||||
}
|
||||
|
||||
void MappingButton::Clear()
|
||||
{
|
||||
this->inputData.clear();
|
||||
this->savedInputData.clear();
|
||||
this->setText(" ");
|
||||
}
|
||||
|
||||
void MappingButton::StartTimer()
|
||||
{
|
||||
this->currentCountDownNum = 5;
|
||||
this->on_countDownTimer_triggered();
|
||||
this->countDownTimer->start(1000);
|
||||
}
|
||||
|
||||
void MappingButton::StopTimer()
|
||||
{
|
||||
this->countDownTimer->stop();
|
||||
}
|
||||
|
||||
void MappingButton::SetInputData(enum InputType type, int value, int extraValue, QString name)
|
||||
{
|
||||
// don't add stub
|
||||
if (name.simplified().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->inputData.clear();
|
||||
this->inputData.push_back(
|
||||
{
|
||||
type,
|
||||
value,
|
||||
extraValue,
|
||||
name
|
||||
}
|
||||
);
|
||||
|
||||
this->reloadText();
|
||||
this->StopTimer();
|
||||
|
||||
emit this->controllerWidget->on_MappingButton_DataSet(this);
|
||||
}
|
||||
|
||||
void MappingButton::AddInputData(enum InputType type, int value, int extraValue, QString name)
|
||||
{
|
||||
// don't add stub
|
||||
if (name.simplified().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->HasInputData(type, value, extraValue))
|
||||
{
|
||||
this->inputData.push_back(
|
||||
{
|
||||
type,
|
||||
value,
|
||||
extraValue,
|
||||
name
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this->reloadText();
|
||||
this->StopTimer();
|
||||
|
||||
emit this->controllerWidget->on_MappingButton_DataSet(this);
|
||||
}
|
||||
|
||||
void MappingButton::RemoveLastInputData(void)
|
||||
{
|
||||
if (!this->inputData.empty())
|
||||
{
|
||||
this->inputData.pop_back();
|
||||
}
|
||||
|
||||
this->reloadText();
|
||||
}
|
||||
|
||||
void MappingButton::RemoveInputData(InputType type, int value, int extraValue)
|
||||
{
|
||||
auto iter = this->getInputDataIter(type, value, extraValue);
|
||||
if (iter == this->inputData.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->inputData.erase(iter);
|
||||
this->reloadText();
|
||||
}
|
||||
|
||||
bool MappingButton::HasInputData(enum InputType type, int value, int extraValue)
|
||||
{
|
||||
return this->getInputDataIter(type, value, extraValue) != this->inputData.end();
|
||||
}
|
||||
|
||||
std::vector<int> MappingButton::GetInputType()
|
||||
{
|
||||
std::vector<int> inputTypeList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
inputTypeList.push_back((int)data.Type);
|
||||
}
|
||||
|
||||
return inputTypeList;
|
||||
}
|
||||
|
||||
std::vector<int> MappingButton::GetInputData()
|
||||
{
|
||||
std::vector<int> inputDataList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
inputDataList.push_back(data.Data);
|
||||
}
|
||||
|
||||
return inputDataList;
|
||||
}
|
||||
|
||||
std::vector<int> MappingButton::GetExtraInputData()
|
||||
{
|
||||
std::vector<int> extraInputDataList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
extraInputDataList.push_back(data.ExtraData);
|
||||
}
|
||||
|
||||
return extraInputDataList;
|
||||
}
|
||||
|
||||
std::vector<std::string> MappingButton::GetInputText()
|
||||
{
|
||||
std::vector<std::string> inputTextList;
|
||||
|
||||
for (const auto& data : this->inputData)
|
||||
{
|
||||
inputTextList.push_back(data.Text.toStdString());
|
||||
}
|
||||
|
||||
return inputTextList;
|
||||
}
|
||||
|
||||
void MappingButton::SaveState()
|
||||
{
|
||||
this->savedInputData = this->inputData;
|
||||
}
|
||||
|
||||
void MappingButton::RestoreState()
|
||||
{
|
||||
this->inputData = this->savedInputData;
|
||||
this->reloadText();
|
||||
}
|
||||
|
||||
void MappingButton::on_countDownTimer_triggered()
|
||||
{
|
||||
this->setText(QString::number(this->currentCountDownNum));
|
||||
|
||||
if (this->currentCountDownNum == 0)
|
||||
{
|
||||
this->setText("");
|
||||
this->currentCountDownNum = 5;
|
||||
this->countDownTimer->stop();
|
||||
emit this->controllerWidget->on_MappingButton_TimerFinished(this);
|
||||
}
|
||||
|
||||
this->currentCountDownNum--;
|
||||
}
|
||||
|
||||
void MappingButton::reloadText()
|
||||
{
|
||||
QString text;
|
||||
QFontMetrics fontMetrics(this->font());
|
||||
|
||||
int size = this->inputData.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
text += this->inputData.at(i).Text;
|
||||
|
||||
// only add comma when
|
||||
// not at the last item
|
||||
if (i < (size - 1))
|
||||
{
|
||||
text += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
QString elidedText = fontMetrics.elidedText(text, Qt::ElideRight, this->initialSize.width());
|
||||
|
||||
// needed for spacing
|
||||
if (elidedText.isEmpty())
|
||||
{
|
||||
elidedText = " ";
|
||||
}
|
||||
|
||||
this->setToolTip(text);
|
||||
this->setText(elidedText);
|
||||
}
|
||||
|
||||
std::vector<MappingButtonInputDataType>::iterator MappingButton::getInputDataIter(InputType type, int value, int extraValue)
|
||||
{
|
||||
auto predicate = [type, value, extraValue](const auto& entry)
|
||||
{
|
||||
return entry.Type == type &&
|
||||
(value == -1 || entry.Data == value) &&
|
||||
(extraValue == -1 || entry.ExtraData == extraValue);
|
||||
};
|
||||
|
||||
return std::find_if(this->inputData.begin(), this->inputData.end(), predicate);
|
||||
}
|
||||