Compare commits

...

163 Commits

Author SHA1 Message Date
Rosalie Wanders bfbbbdda7b 3rdParty: update mupen64plus-input-gcn 2023-05-06 00:03:19 +02:00
Rosalie Wanders 67a885b43b 3rdParty: update mupen64plus-input-gcn 2023-05-05 23:26:50 +02:00
Rosalie Wanders a49fe03fc2 3rdParty: update mupen64plus-input-gcn 2023-05-05 22:21:29 +02:00
Rosalie Wanders a7b07dc0f9 ci: install libusb 2023-05-05 22:02:50 +02:00
Rosalie Wanders f9a767f8ae 3rdParty: remove mupen64plus-input-gca and add mupen64plus-input-gcn 2023-05-05 21:57:47 +02:00
Rosalie Wanders 42a4786a25 cmake: remove NO_RUST option 2023-05-05 21:57:29 +02:00
Rosalie Wanders b166eac200 Package: update InGame.png 2023-05-04 23:29:12 +02:00
Rosalie Wanders c06316f4aa Package: update RomBrowser.png 2023-05-04 23:27:22 +02:00
Rosalie Wanders 09d96d9e4d README: improve Support section 2023-05-04 23:18:23 +02:00
Rosalie Wanders 66703970b6 Package: v0.4.0 2023-05-04 22:49:45 +02:00
Rosalie Wanders 0d3314a39b 3rdParty: update mupen64plus-input-gca 2023-05-04 22:41:22 +02:00
Rosalie Wanders 748492cc68 Data: add more custom cheats from Gent 2023-05-04 22:25:00 +02:00
Rosalie Wanders e18ad31c53 RMG: set default QSurfaceFormat with vsync disabled in main.cpp 2023-05-04 22:24:32 +02:00
Rosalie Wanders 0dd297f0f8 3rdParty: update angrylion-rdp-plus 2023-04-24 16:42:52 +02:00
Rosalie Wanders 0da4becd46 3rdParty: update parallel-rsp 2023-04-24 16:40:35 +02:00
Rosalie Wanders d284911d4a Installer: don't skip Run when silent 2023-04-16 00:12:11 +02:00
Rosalie Wanders e772eb3906 RMG: don't install desktop icon on update on windows 2023-04-16 00:11:48 +02:00
Rosalie Wanders 577ee4c3e0 3rdParty: update GLideN64 2023-04-15 16:00:58 +02:00
Rosalie Wanders c534df8303 RMG: disable floating on toolbar 2023-04-13 17:47:47 +02:00
Rosalie Wanders a36c8f7de8 3rdParty: update SDL_GameControllerDB 2023-04-07 22:42:11 +02:00
Rosalie Wanders dfb5f1b687 Package: update InputSettings.png 2023-04-07 21:58:29 +02:00
Rosalie Wanders d8eea015fd RMG: allow the toolbar to be moved 2023-04-07 20:54:20 +02:00
Rosalie Wanders f17b7eb2c9 RMG-Core: add GUI_ToolbarArea setting 2023-04-07 20:52:06 +02:00
Rosalie Wanders 33146626a9 Package: v0.3.9 2023-04-06 14:34:29 +02:00
Rosalie Wanders 78e12f774d RMG: add "Edit Game Input Settings" to the context menu of the ROM browser 2023-04-06 14:11:58 +02:00
Rosalie Wanders 689d8debb1 RMG-Input: implement PluginConfig2() and PluginConfig2HasRomConfig() 2023-04-06 14:11:20 +02:00
Rosalie Wanders 8be1ed8af5 RMG-Core: introduce CorePluginsHasROMConfig() and CorePluginsOpenROMConfig() 2023-04-06 14:09:34 +02:00
Rosalie Wanders 0fabdb3f3a RMG-Input: account for versions which didn't have the sensitivity setting in main.cpp 2023-04-06 08:56:49 +02:00
Rosalie Wanders 7a64e7e479 RMG: show progress status in the loading screen of the ROM browser 2023-04-06 01:20:48 +02:00
Rosalie Wanders 8c1589d7cd RMG-Core: correct error message in read_7zip_file 2023-04-06 00:37:31 +02:00
Rosalie Wanders 5a74b137f2 RMG: implement 7-Zip support 2023-04-06 00:28:31 +02:00
Rosalie Wanders 52ba182610 RMG-Core: implement 7-Zip support 2023-04-06 00:28:31 +02:00
Rosalie Wanders b07eb79609 3rdParty: add 7-Zip 2023-04-06 00:28:31 +02:00
Rosalie Wanders 4e3915f527 RMG: only show 'Don't check for updates again' checkbox when needed 2023-04-05 16:22:27 +02:00
Rosalie Wanders 9f620f276d RMG-Input: account for versions which didn't have the sensitivity setting 2023-04-05 16:18:56 +02:00
JaxonWasTaken e3787b5ccf RMG-Input: implement "Analog Stick Sensitivity" 2023-03-31 19:47:31 +02:00
Rosalie Wanders 3d81a052c6 cmake: add NO_RUST option 2023-03-25 20:34:37 +01:00
Rosalie Wanders 6353be1599 RMG: expose CoreOverlay_SaveFileNameFormat setting 2023-03-12 21:47:20 +01:00
Rosalie Wanders bc6ee4877b RMG-Core: use {Core,CoreOverlay}_SaveFileNameFormat settings 2023-03-12 21:47:20 +01:00
Rosalie Wanders 6b38cc3740 RMG-Core: introduce {Core,CoreOverlay}_SaveFileNameFormat settings 2023-03-12 21:47:20 +01:00
Rosalie Wanders 9285fb9fdf 3rdParty: update mupen64plus-core 2023-03-12 21:47:19 +01:00
Rosalie Wanders f5c609413a Package: update archlinux PKGBUILD 2023-03-04 23:33:08 +01:00
RetraCarteR a304f11b1d RMG: introduce more columns (#119) 2023-03-04 23:10:01 +01:00
Rosalie Wanders e10ac1086f RMG: show window after opening ROM 2023-02-25 14:45:28 +01:00
Rosalie Wanders 4533ed61ac 3rdParty: update GLideN64 2023-02-25 14:44:15 +01:00
Rosalie Wanders 235e41653d Package: v0.3.8 2023-02-24 22:51:20 +01:00
Rosalie Wanders 433479b1c3 RMG: add date and time to OSD when selecting a save state slot 2023-02-24 22:47:29 +01:00
Rosalie Wanders 2b4736f224 RMG: add actions in MainWindow::Init() when showUI is false 2023-02-24 22:30:01 +01:00
Rosalie Wanders 41f1dcf9d2 RMG: use RomBrowser_ColumnVisibility 2023-02-24 22:19:41 +01:00
Rosalie Wanders 45b97cf39b RMG-Core: rename RomBrowser_Columns to RomBrowser_ColumnVisibility 2023-02-24 22:19:27 +01:00
Rosalie Wanders 95b1225219 3rdParty: update GLideN64 2023-02-24 22:08:43 +01:00
Rosalie Wanders 70f6c40b26 RMG: use Keybinding_ViewLog setting 2023-02-24 21:48:28 +01:00
Rosalie Wanders 43bc54fca9 RMG-Core: add Keybinding_ViewLog setting 2023-02-24 21:48:12 +01:00
Rosalie Wanders a5ec31ffef RMG: hook up state callback 2023-02-24 21:37:24 +01:00
Rosalie Wanders 81cbf82ddc RMG-Core: implement state callback 2023-02-24 21:36:54 +01:00
Rosalie Wanders 6cea506c6f RMG: implement -d/--debug-messages commandline option 2023-02-24 21:14:48 +01:00
Rosalie Wanders d7d49f261d RMG-Core: introduce CoreSetPrintDebugCallback() 2023-02-24 21:14:27 +01:00
Rosalie Wanders 4692a5c0b7 RMG-Core: use string() for std::filesystem::path in CoreGetSaveStatePath() 2023-02-24 20:04:43 +01:00
Rosalie Wanders d32ea32f1e Package: slight corrections to appdata 2023-02-24 19:57:27 +01:00
Rosalie Wanders f5f053cc4e RMG: add date and time to save state slot items in "Current Save State" 2023-02-24 19:54:24 +01:00
Rosalie Wanders bb3c6dc9fc RMG-Core: introduce CoreGetSaveStatePath() 2023-02-24 19:52:13 +01:00
RetraCarteR 496d4de1de RMG: slightly refactor RomBrowserWidget.cpp (#113) 2023-02-24 18:50:18 +01:00
Rosalie Wanders 71f8437ecb RMG: fix crash in RomBrowserWidget::on_RomBrowserThread_Finished() 2023-02-24 18:40:54 +01:00
Rosalie Wanders e7767105d6 RMG: simplify sanitizing filename in RomBrowserWidget 2023-02-24 00:46:07 +01:00
RetraCarteR 9cfda8514e RMG: implement toggling visibility for columns (#111) 2023-02-24 00:13:51 +01:00
Rosalie Wanders e0c6700a4d RMG: add info about LLE plugins to settings dialog 2023-02-23 22:10:57 +01:00
Rosalie Wanders 12bf158398 RMG: slightly refactor MainWindow.{cpp,hpp} 2023-02-23 21:38:21 +01:00
Rosalie Wanders ea01c86821 RMG: check for updates once an hour and add 'Check For Updates' to View 2023-02-23 15:45:32 +01:00
Rosalie Wanders 96459432a6 RMG-Core: add GUI_LastUpdateCheck setting 2023-02-23 15:36:15 +01:00
Rosalie Wanders 089194c663 Package: add version to AppImage filename 2023-02-23 14:54:28 +01:00
Rosalie Wanders 7a70227535 RMG: handle SIGINT and SIGTERM 2023-02-23 14:42:59 +01:00
Rosalie Wanders 7adfb3123b RMG: use new settings hotkeys 2023-02-23 14:31:19 +01:00
Rosalie Wanders 1d28075601 RMG-Input: add more settings hotkeys 2023-02-23 14:30:43 +01:00
Rosalie Wanders af7aa688bb RMG: implement -n/--nogui commandline option 2023-02-23 14:08:24 +01:00
Rosalie Wanders beb524f523 RMG: keep trying to set video size until it succeeds 2023-02-23 13:57:21 +01:00
Rosalie 18c9c151a8 RMG: hide AppImage commandline options 2023-02-23 09:07:00 +01:00
Rosalie Wanders 83820baf79 Package: v0.3.7 2023-02-19 22:42:49 +01:00
Rosalie Wanders abf50350e7 RMG: account for full path in plugin settings 2023-02-19 22:40:17 +01:00
Rosalie Wanders 6588d0d17a RMG: account for invalid GUI_IconTheme setting value 2023-02-19 22:35:31 +01:00
Rosalie Wanders 648736df48 Package: correct PKGBUILD 2023-02-19 19:22:29 +01:00
Rosalie Wanders 6278a443df ci: add appstream to ubuntu packages 2023-02-19 19:21:45 +01:00
Rosalie Wanders 615295f1f9 Package: v0.3.6 2023-02-19 13:20:57 +01:00
Rosalie Wanders 593135d02b gitignore: add AppImage things 2023-02-19 12:57:42 +01:00
Rosalie Wanders 78ea41a2ca RMG: always go back to ROM Browser when the plugins aren't ready 2023-02-19 12:56:54 +01:00
Rosalie Wanders 105600878e cmake: only allow AppImage updater on linux 2023-02-19 12:33:19 +01:00
Rosalie Wanders 415202e15f RMG: set original file permissions to updated AppImage 2023-02-19 12:28:36 +01:00
Rosalie Wanders 618a6f6c9f Package: change ArchLinux PKGBUILD to use the latest version 2023-02-19 01:01:24 +01:00
Rosalie Wanders af70f35bf2 README: add Download section 2023-02-19 01:01:24 +01:00
Rosalie Wanders 43bb0a3a1c ci: add -DUPDATER=ON -DAPPIMAGE_UPDATER=ON to AppImage build 2023-02-19 01:01:24 +01:00
Rosalie Wanders 8d9f83b1cc RMG: implement AppImage updater 2023-02-19 01:01:24 +01:00
Rosalie Wanders 7d713afbdd cmake: add APPIMAGE_UPDATER option 2023-02-19 01:01:24 +01:00
Rosalie Wanders 5044ef8ab1 Package: specify OUTPUT in AppImage Create.sh 2023-02-19 01:01:24 +01:00
Rosalie 5b4fe5667a ci: use ubuntu 20.04 LTS and add qt6 backport PPA 2023-02-19 01:01:24 +01:00
Rosalie Wanders a4d3efa087 RMG-Core: use filenames instead of absolute paths for plugins 2023-02-19 01:01:24 +01:00
Rosalie Wanders 9cb8adce55 Package: add AppImage files 2023-02-19 01:01:24 +01:00
Rosalie Wanders c061981de0 ci: build AppImage 2023-02-19 01:01:24 +01:00
Rosalie Wanders b2f76fc436 RMG: allow overriding RMG-Core paths using commandline 2023-02-19 01:01:22 +01:00
Rosalie Wanders dc58fbe900 RMG-Core: add CoreSet*PathOverride functions 2023-02-18 00:46:22 +01:00
Rosalie Wanders 0e80142da1 Package: remove empty description tag from appdata.xml 2023-02-18 00:35:30 +01:00
Rosalie Wanders ee77bc7c9b RMG: use the additional SpeedFactor settings 2023-02-17 22:03:25 +01:00
Rosalie Wanders b978248c03 RMG-Core: add more SpeedFactor settings 2023-02-17 22:02:50 +01:00
Rosalie Wanders 85d2b5be5a RMG: skip non-fatal mupen64plus errors 2023-02-17 21:48:11 +01:00
Rosalie Wanders cee35297d6 cmake: fix default for FORCE_XCB option 2023-02-17 21:38:10 +01:00
Rosalie Wanders edde08849f cmake: add FORCE_XCB option 2023-02-17 21:21:24 +01:00
RetraCarteR f649053e00 Add Ability to Move and Re-order Columns in "Game List" Mode (#105) 2023-02-17 10:45:14 +01:00
Rosalie Wanders 6c6b4bcd3a RMG: add Speed Factor hotkeys to {add,remove}FullscreenActions() 2023-02-16 19:37:40 +01:00
Rosalie Wanders 1fef816572 RMG: move changing speed factor to it's own function & add OSD message 2023-02-14 23:00:55 +01:00
Rosalie Wanders a6203cf6e9 RMG: add speed factor keybindings 2023-02-14 22:53:17 +01:00
Rosalie Wanders 200bb0f6e3 RMG-Core: add speed factor keybinding settings 2023-02-14 22:53:17 +01:00
Rosalie Wanders 1dd2fca3db RMG: add "Speed Factor" to System menubar 2023-02-14 22:37:20 +01:00
Rosalie Wanders 5444f3b807 RMG-Core: introduce SpeedFactor functions 2023-02-14 22:36:15 +01:00
Rosalie Wanders 897d81a188 RMG: add support for stylesheets & GUI_IconTheme setting 2023-02-14 21:12:34 +01:00
Rosalie Wanders eae18c446a RMG-Core: add GUI_IconTheme setting 2023-02-14 21:11:56 +01:00
Rosalie Wanders fb7402e394 Package: v0.3.5 2023-02-14 14:29:33 +01:00
Rosalie Wanders 63dc9cbe7c 3rdParty: update mupen64plus-video-parallel 2023-02-14 14:09:07 +01:00
Rosalie Wanders ac63f4809f RMG-Input: fix for loop in MainDialog::accept() 2023-02-14 13:44:55 +01:00
Rosalie Wanders 0bdf3ada25 RMG-Input: correct old profile detection 2023-02-14 13:30:08 +01:00
Rosalie Wanders aa684b903b 3rdParty: update GLideN64 2023-02-14 12:30:04 +01:00
Rosalie Wanders db0ae36702 3rdParty: update mupen64plus-video-parallel 2023-02-13 20:08:00 +01:00
Rosalie Wanders 3d5e812c6f 3rdParty: update mupen64plus-video-parallel 2023-02-13 19:51:51 +01:00
Rosalie Wanders 07f6810835 3rdParty: update mupen64plus-video-parallel 2023-02-13 19:39:02 +01:00
Rosalie Wanders b3e2a43cf8 RMG: use different signature of CoreGetRomType() 2023-02-12 22:35:06 +01:00
Rosalie Wanders 96f4abbc07 RMG-Core: change signature of CoreGetRomType() 2023-02-12 22:34:48 +01:00
Rosalie Wanders d96746c933 RMG: refactor EmulationThread & move license header in RomSearcherThread 2023-02-12 22:24:34 +01:00
Rosalie Wanders 4391ebd94a RMG-Input: fix RevertSettings not deleting profile sections in some cases 2023-02-12 21:54:20 +01:00
Rosalie Wanders 081029e3d1 RMG-Input: fix reset button not working 2023-02-12 21:48:14 +01:00
Rosalie Wanders 541724b63c Package: v0.3.4 2023-02-11 19:48:49 +01:00
Rosalie Wanders 304afbb50d RMG-Input: add Input_FilterEventsFor{Buttons,Axis} settings 2023-02-11 19:47:12 +01:00
Rosalie Wanders 1ba88f48bb RMG-Core: add Input_FilterEventsFor{Buttons,Axis} settings 2023-02-11 19:46:00 +01:00
Rosalie Wanders 8f8c9c35f1 3rdParty: update GLideN64 2023-02-11 15:28:54 +01:00
Rosalie Wanders 1c07d032ef RMG-Input: account for added profiles in RevertSettings() 2023-02-11 15:18:44 +01:00
Rosalie Wanders c500a17b1a RMG-Input: implement reverting settings & improve saving 2023-02-11 14:33:30 +01:00
Rosalie Wanders 6d0347b48a RMG-Core: introduce CoreSettingsRevertSection() 2023-02-11 14:32:43 +01:00
Rosalie Wanders 83af0ff4af RMG-Input: improve per game profile handling 2023-02-11 13:41:26 +01:00
Rosalie Wanders 32c13eee1d RMG-Core: add Input_UseGameProfile setting 2023-02-11 13:40:50 +01:00
Rosalie Wanders 42597a76f0 RMG-Input: handle automatic input device in CheckInputDeviceSettings() 2023-02-11 13:09:32 +01:00
Rosalie Wanders 7c59a520aa RMG: improve updater script for windows 2023-02-10 21:23:25 +01:00
Rosalie Wanders 3c124d8519 RMG-Input: change size policy for top UI elements 2023-02-10 15:01:31 +01:00
Rosalie Wanders 76282a11da RMG-Input: use const wherever possible in main.cpp 2023-02-10 14:35:51 +01:00
Rosalie Wanders 5249bf6a56 RMG-Input: fix button mapping when having multiple mappings in get_axis_state() 2023-02-10 14:23:32 +01:00
Rosalie Wanders 12e0dac777 RMG-Input: store & use initial size in MappingButton 2023-02-10 13:45:31 +01:00
Rosalie Wanders b4e3bede3b Package: v0.3.3 2023-02-09 22:04:00 +01:00
Rosalie Wanders 679731f004 Screenshots: update InputSettings.png 2023-02-09 22:04:00 +01:00
Rosalie Wanders 3bbd29916b RMG-Input: implement creation of profiles 2023-02-09 21:55:45 +01:00
Rosalie Wanders 6516330289 RMG-Input: slight UI changes 2023-02-09 21:53:47 +01:00
Rosalie Wanders 0628ea920b RMG-Input: introduce 'Automatic' input device 2023-02-09 21:53:47 +01:00
Rosalie Wanders 40a4133565 RMG-Core: add Input_{Profiles,UseProfile} setting 2023-02-09 21:53:47 +01:00
Rosalie Wanders b4425fe1be 3rdParty: update mupen64plus-rsp-parallel 2023-02-09 19:24:24 +01:00
Rosalie Wanders 809cbcbc21 3rdParty: update mupen64plus-core 2023-02-09 19:24:04 +01:00
Rosalie Wanders 2ae2b994a8 Package: update Cheats screenshot aswell 2023-02-07 00:44:00 +01:00
Rosalie Wanders 8ce36cdc03 Package: update screenshots 2023-02-06 22:32:30 +01:00
Rosalie Wanders 3707a86c79 Package: v0.3.2 2023-02-06 22:23:53 +01:00
Rosalie Wanders eea3ec7f95 RMG-Input: load SDL_GameControllerDB 2023-02-06 16:01:15 +01:00
Rosalie Wanders 4a2c6761fc cmake: install SDL_GameControllerDB 2023-02-06 16:01:15 +01:00
Rosalie Wanders 7a4e179f4c 3rdParty: add SDL_GameControllerDB 2023-02-06 16:01:15 +01:00
Rosalie Wanders 11eaadb739 RMG: use RomBrowser_SortAfterSearch setting 2023-02-05 20:29:40 +01:00
Rosalie Wanders 41b77b54ea RMG-Core: add RomBrowser_SortAfterSearch setting 2023-02-05 20:29:11 +01:00
Rosalie Wanders 22689bd9ee 3rdParty: update mupen64plus-core 2023-02-05 20:02:39 +01:00
Rosalie Wanders 831535c86f RMG-Core: remove Input_InvertAxis setting 2023-02-05 20:02:25 +01:00
Rosalie Wanders ce43955784 RMG-Input: remove 'Invert Axis Mapped To LRZ' 2023-02-05 20:02:25 +01:00
Rosalie Wanders e85f4f4309 RMG-Input: filter SDL events based on joystick type 2023-02-05 20:02:25 +01:00
Rosalie Wanders 00b3f33530 RMG-Core: use extracted_file.filename() in CoreOpenRom() 2023-02-04 23:18:47 +01:00
Rosalie Wanders 1b0116a0cb RMG-Core: don't use OSAL_FILES_DIR_SEPERATOR_STR in CoreOpenRom() 2023-02-04 23:14:45 +01:00
86 changed files with 4547 additions and 739 deletions
+20 -6
View File
@@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
Linux:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
@@ -14,20 +14,33 @@ jobs:
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 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
sudo apt-get -y install cmake ninja-build libusb-1.0-0-dev 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
@@ -53,6 +66,7 @@ jobs:
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-qt6
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-libusb
mingw-w64-x86_64-hidapi
mingw-w64-x86_64-speexdsp
mingw-w64-x86_64-libsamplerate
+4 -1
View File
@@ -9,4 +9,7 @@ Package/ArchLinux/rmg/
Package/ArchLinux/src/
Package/ArchLinux/*.pkg.*
# Clangd compile_commands.json
compile_commands.json
compile_commands.json
# AppImage
squashfs-root
*.AppImage
+23 -2
View File
@@ -6,8 +6,10 @@ 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(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})
project(RMG)
@@ -34,11 +36,26 @@ if (NOT PORTABLE_INSTALL AND (WIN32 OR MSYS))
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}")
@@ -59,6 +76,7 @@ else()
endif()
add_subdirectory(Source/3rdParty)
add_subdirectory(Source/3rdParty/7-Zip)
add_subdirectory(Source/RMG-Core)
add_subdirectory(Source/RMG)
@@ -88,6 +106,9 @@ install(FILES ${MUPEN64PLUSCORE_LIB}
install(FILES ${MUPEN64PLUSCORE_INI} Data/font.ttf
DESTINATION ${DATA_INSTALL_PATH}
)
install(FILES ${SDL_GAMECONTROLLERDB}
DESTINATION ${DATA_INSTALL_PATH}
)
file(GLOB GENERATED_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Generated/*.cht)
file(GLOB CUSTOM_CHEAT_FILES ${CMAKE_SOURCE_DIR}/Data/Cheats/Custom/*.cht)
install(FILES ${GENERATED_CHEAT_FILES} ${CUSTOM_CHEAT_FILES}
@@ -105,7 +126,7 @@ install(FILES ${MUPEN64PLUS_PLUGIN_RSP_PARALLEL}
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_RAPHNET}
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
)
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_GCA}
install(FILES ${MUPEN64PLUS_PLUGIN_INPUT_GCN}
DESTINATION ${PLUGIN_INSTALL_PATH}/Input
)
install(FILES ${MUPEN64PLUS_PLUGIN_GFX_ANGRYLION}
@@ -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
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
cur_dir="$(readlink -f "$(dirname "$0")")"
exec "$cur_dir/usr/bin/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" \
"$@"
+39
View File
@@ -0,0 +1,39 @@
#!/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"
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"
+13 -23
View File
@@ -1,46 +1,36 @@
# Maintainer: Rosalie Wanders <rosalie@mailbox.org>
_pkgname=rmg
pkgname=${_pkgname}-git
pkgver=git
pkgname=rmg
pkgver=0.3.9
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" "qt6-base" "qt6-svg" "xdg-user-dirs")
makedepends=("git" "pkg-config" "nasm" "cmake" "cargo" "ninja")
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()
{
mkdir -p "$srcdir/${_pkgname}/build"
mkdir -p "$srcdir/$pkgname/build"
}
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 "Ninja" \
-DNO_RUST="ON" \
-G "Ninja"
cmake --build "$srcdir/${_pkgname}/build"
cmake --build "$srcdir/$pkgname/build"
}
package()
{
cmake --install "$srcdir/${_pkgname}/build" --prefix="$pkgdir/usr"
cmake --install "$srcdir/$pkgname/build" --prefix="$pkgdir/usr"
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 KiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 57 KiB

+137 -6
View File
@@ -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,28 +12,158 @@
<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>Cheats</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>Settings</caption>
<caption>04 - Settings</caption>
<image type="source">https://github.com/Rosalie241/RMG/raw/master/Package/Screenshots/Settings.png</image>
</screenshot>
<screenshot type="default">
<caption>Input Settings</caption>
<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.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>
+14 -1
View File
@@ -4,9 +4,22 @@ Rosalie's Mupen GUI is a free and open-source mupen64plus GUI written in C++.
It offers a simple-to-use user interface.
## Download
#### Windows
You can download Rosalie's Mupen GUI on ![Github Releases](https://github.com/Rosalie241/RMG/releases)
#### 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
Join the [Rosalie's Mupen GUI Discord Server](https://discord.gg/k9GuyJ2PpF) for support
You can ask for help or report issues on
* [Github](https://github.com/Rosalie241/RMG/issues/new)
* [Discord](https://discord.gg/k9GuyJ2PpF)
## License
+40
View File
@@ -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}/lzma2201.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})
+2
View File
@@ -0,0 +1,2 @@
# 7-Zip SDK v22.01
Downloaded from https://www.7-zip.org/sdk.html
Binary file not shown.
+52 -40
View File
@@ -5,22 +5,12 @@ include(ExternalProject)
set(THIRDPARTY_DIR ${CMAKE_BINARY_DIR}/Source/3rdParty)
find_program(RUST_CARGO cargo)
if(${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()
set(BUILD_INPUT_GCA ON)
endif()
set(M64P_CORE_DIR ${THIRDPARTY_DIR}/mupen64plus-core)
if(WIN32)
set(SO_EXT "dll")
set(GCA_LIB "mupen64plus_input_gca.${SO_EXT}")
set(CORE_FILE "mupen64plus.dll")
else(WIN32)
set(SO_EXT "so")
set(GCA_LIB "libmupen64plus_input_gca.${SO_EXT}")
set(CORE_FILE "libmupen64plus.so")
endif(WIN32)
@@ -36,38 +26,41 @@ else(USE_CCACHE)
endif(USE_CCACHE)
if(NOT NO_GIT_CLONE)
set(MUPEN64PLUSCORE_URL "https://github.com/Rosalie241/mupen64plus-core")
set(MUPEN64PLUSCORE_TAG "fc8edd980a844d11fde64c719591090d09185264")
set(MUPEN64PLUSCORE_URL "https://github.com/mupen64plus/mupen64plus-core")
set(MUPEN64PLUSCORE_TAG "d4f3e12db0609158c7b4e0beef2bb950aad0ccb9")
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_INPUT_GCN_URL "https://github.com/Rosalie241/mupen64plus-input-gcn")
set(MUPEN64PLUS_INPUT_GCN_TAG "e220115fa8ad223be783c822a251d7e0f873ed4c")
set(MUPEN64PLUS_GFX_ANGRYLION_URL "https://github.com/Rosalie241/angrylion-rdp-plus")
set(MUPEN64PLUS_GFX_ANGRYLION_TAG "158e74d4ec1c818289cd19c3a05e498c3ceff758")
set(MUPEN64PLUS_GFX_ANGRYLION_TAG "670abbc972bd430fa77291b0967dd73128314317")
set(MUPEN64PLUS_GFX_GLIDEN64_URL "https://github.com/gonetz/GLideN64")
set(MUPEN64PLUS_GFX_GLIDEN64_TAG "263a7bd2ca81759ece98209bd282a6c1173a129f")
set(MUPEN64PLUS_GFX_GLIDEN64_TAG "0fee30d010d1feda7d343654871b3dfd05ccab70")
set(MUPEN64PLUS_GFX_PARALLEL_URL "https://github.com/Rosalie241/parallel-rdp-standalone")
set(MUPEN64PLUS_GFX_PARALLEL_TAG "48abaa5e082add7848e6f98648111c69c4a71632")
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 "b7e5701da82fc97beeede64d3818ef0f4d015aba")
endif(NOT NO_GIT_CLONE)
ExternalProject_Add(mupen64plus-core
@@ -158,23 +151,20 @@ ExternalProject_Add(mupen64plus-input-raphnetraw
DEPENDS mupen64plus-core
)
if (BUILD_INPUT_GCA)
ExternalProject_Add(mupen64plus-input-gca
SOURCE_DIR mupen64plus-input-gca/
ExternalProject_Add(mupen64plus-input-gcn
SOURCE_DIR mupen64plus-input-gcn
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
GIT_REPOSITORY ${MUPEN64PLUS_INPUT_GCN_URL}
GIT_TAG ${MUPEN64PLUS_INPUT_GCN_TAG}
GIT_REPOSITORY ${MUPEN64PLUS_INPUT_GCA_URL}
GIT_TAG ${MUPEN64PLUS_INPUT_GCA_TAG}
INSTALL_COMMAND ""
BUILD_COMMAND cargo build --release --features "m64p_compat"
BUILD_IN_SOURCE True
BUILD_IN_SOURCE True
CMAKE_ARGS ${CMAKE_CONFIGURE_ARGS}
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-input-gca/target/release/${GCA_LIB}
DEPENDS mupen64plus-core
)
endif(BUILD_INPUT_GCA)
BUILD_BYPRODUCTS ${THIRDPARTY_DIR}/mupen64plus-input-gcn/mupen64plus-input-gcn.${SO_EXT}
DEPENDS mupen64plus-core
)
set(GLIDEN64_DIR "${THIRDPARTY_DIR}/mupen64plus-video-GLideN64")
set(GLIDEN64_BUILD_DIR "${GLIDEN64_DIR}/projects/cmake")
@@ -286,6 +276,27 @@ ExternalProject_Add(imgui
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)
@@ -302,10 +313,8 @@ set(MUPEN64PLUS_PLUGIN_RSP_PARALLEL ${BUILD_BYPRODUCTS} PARENT_SCOPE)
ExternalProject_Get_property(mupen64plus-input-raphnetraw BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_INPUT_RAPHNET ${BUILD_BYPRODUCTS} PARENT_SCOPE)
if (BUILD_INPUT_GCA)
ExternalProject_Get_property(mupen64plus-input-gca BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_INPUT_GCA ${BUILD_BYPRODUCTS} PARENT_SCOPE)
endif(BUILD_INPUT_GCA)
ExternalProject_Get_property(mupen64plus-input-gcn BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_INPUT_GCN ${BUILD_BYPRODUCTS} PARENT_SCOPE)
ExternalProject_Get_property(mupen64plus-video-angrylion-plus BUILD_BYPRODUCTS)
set(MUPEN64PLUS_PLUGIN_GFX_ANGRYLION ${BUILD_BYPRODUCTS} PARENT_SCOPE)
@@ -324,3 +333,6 @@ 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)
+1 -1
View File
@@ -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
+2
View File
@@ -24,6 +24,7 @@ set(RMG_CORE_SOURCES
ConvertStringEncoding.cpp
Settings/Settings.cpp
SpeedLimiter.cpp
SpeedFactor.cpp
RomSettings.cpp
Directories.cpp
MediaLoader.cpp
@@ -79,6 +80,7 @@ endif(WIN32)
target_link_libraries(RMG-Core
${MINIZIP_LIBRARIES}
7Zip
)
if (DISCORD_RPC)
+26 -2
View File
@@ -36,11 +36,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_05"
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheWindows_06"
#else // Linux
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheLinux_05"
#define CACHE_FILE_MAGIC "RMGCoreHeaderAndSettingsCacheLinux_06"
#endif // _WIN32
#define CACHE_FILE_ITEMS_MAX 10000
@@ -103,6 +105,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;
@@ -131,6 +135,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));
@@ -144,7 +150,13 @@ void CoreReadRomHeaderAndSettingsCache(void)
// 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
@@ -169,6 +181,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;
@@ -200,12 +214,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));
@@ -220,6 +238,12 @@ bool CoreSaveRomHeaderAndSettingsCache(void)
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
+23 -2
View File
@@ -11,12 +11,16 @@
#include "Core.hpp"
#include "ConvertStringEncoding.hpp"
#include <iostream>
//
// Local Variables
//
static bool l_SetupCallbacks = false;
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;
//
// Internal Functions
@@ -42,21 +46,38 @@ void CoreDebugCallback(void* context, int level, const char* message)
messageString = CoreConvertStringEncoding(message, CoreStringEncoding::Shift_JIS);
}
if (l_PrintCallbacks)
{
std::cout << contextString << messageString << std::endl;
}
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, 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;
}
+21 -1
View File
@@ -32,6 +32,26 @@ enum class CoreDebugMessageType
Verbose = 5
};
bool CoreSetupCallbacks(std::function<void(enum CoreDebugMessageType, std::string, 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);
#endif // CORE_CALLBACK_HPP
+1
View File
@@ -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"
+52 -6
View File
@@ -18,6 +18,14 @@
#include <iostream>
#include <filesystem>
//
// Local Variables
//
static std::filesystem::path l_CorePathOverride;
static std::filesystem::path l_PluginPathOverride;
static std::filesystem::path l_SharedDataPathOverride;
//
// Local Functions
//
@@ -123,8 +131,15 @@ std::filesystem::path CoreGetCoreDirectory(void)
#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 +150,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;
}
@@ -233,8 +255,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 +282,20 @@ std::filesystem::path CoreGetScreenshotDirectory(void)
{
return CoreSettingsGetStringValue(SettingsID::Core_ScreenshotPath);
}
#ifndef PORTABLE_INSTALL
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
+9
View File
@@ -73,4 +73,13 @@ std::filesystem::path CoreGetSaveStateDirectory(void);
// screenshots should be located
std::filesystem::path CoreGetScreenshotDirectory(void);
// 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
+13 -2
View File
@@ -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,17 @@ bool CoreStartEmulation(std::filesystem::path n64rom, std::filesystem::path n64d
return false;
}
if (!CoreGetRomType(type))
{
CoreClearCheats();
CoreDetachPlugins();
CoreApplyPluginSettings();
CoreCloseRom();
return false;
}
// set disk file in media loader when ROM is a cartridge
if (CoreGetRomType() == CoreRomType::Cartridge)
if (type == CoreRomType::Cartridge)
{
CoreMediaLoaderSetDiskFile(n64ddrom);
}
+144 -42
View File
@@ -18,6 +18,7 @@
#include "m64p/PluginApi.hpp"
#include "osal/osal_dynlib.hpp"
#include "osal/osal_files.hpp"
#include "m64p/PluginApi.cpp"
#include "m64p/Api.hpp"
@@ -131,6 +132,54 @@ std::string get_plugin_context_name(CorePluginType type)
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;
@@ -142,15 +191,14 @@ 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());
@@ -237,6 +285,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
//
@@ -252,6 +372,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))
{
@@ -272,7 +393,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);
}
}
@@ -335,52 +456,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)
+8
View File
@@ -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);
+189 -11
View File
@@ -16,6 +16,16 @@
#include "Cheats.hpp"
#include "osal/osal_files.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>
@@ -140,7 +150,7 @@ static bool read_zip_file(std::filesystem::path file, std::filesystem::path* ext
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)
{
@@ -293,6 +303,155 @@ static bool read_zip_file(std::filesystem::path file, std::filesystem::path* ext
return false;
}
static bool read_7zip_file(std::filesystem::path file, std::filesystem::path* extractedFileName, bool* isDisk, char** buf, int* size)
{
std::string error;
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;
@@ -362,7 +521,6 @@ static bool write_file(std::filesystem::path file, char* buf, int size)
// write buffer to file
fileStream.write(buf, size);
fileStream.close();
return true;
}
@@ -395,24 +553,33 @@ bool CoreOpenRom(std::filesystem::path file)
file_extension = file.has_extension() ? file.extension().string() : "";
file_extension = to_lower_str(file_extension);
if (file_extension == ".zip")
if (file_extension == ".zip" ||
file_extension == ".7z")
{
std::filesystem::path extracted_file;
bool is_disk = false;
if (!read_zip_file(file, &extracted_file, &is_disk, &buf, &buf_size))
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 += OSAL_FILES_DIR_SEPERATOR_STR;
disk_file += "extracted_disks";
disk_file += OSAL_FILES_DIR_SEPERATOR_STR;
disk_file += extracted_file;
disk_file += "/extracted_disks/";
disk_file += extracted_file.filename();
// attempt to create extraction directory
try
@@ -503,9 +670,20 @@ bool CoreHasRomOpen(void)
return l_HasRomOpen;
}
CoreRomType CoreGetRomType(void)
bool CoreGetRomType(CoreRomType& type)
{
return l_HasDisk ? CoreRomType::Disk : CoreRomType::Cartridge;
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 CoreCloseRom(void)
+2 -2
View File
@@ -24,8 +24,8 @@ bool CoreOpenRom(std::filesystem::path file);
// returns whether core has a ROM opened
bool CoreHasRomOpen(void);
// returns the opened ROM's type
CoreRomType CoreGetRomType(void);
// attempts to retrieve the ROM type
bool CoreGetRomType(CoreRomType& type);
// closes ROM
bool CoreCloseRom(void);
+94 -1
View File
@@ -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;
}
+2
View File
@@ -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
+109
View File
@@ -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;
+4
View File
@@ -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);
+122 -13
View File
@@ -122,6 +122,7 @@ static std::vector<std::string> l_keyList;
#define SETTING_SECTION_GB SETTING_SECTION_CORE " Gameboy"
#define SETTING_SECTION_M64P "Core"
#define SETTING_SECTION_AUDIO SETTING_SECTION_GUI " - Audio Plugin"
#define SETTING_SECTION_INPUT SETTING_SECTION_GUI " - Input Plugin"
// retrieves l_Setting from settingId
static l_Setting get_setting(SettingsID settingId)
@@ -182,15 +183,24 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::GUI_Toolbar:
setting = {SETTING_SECTION_GUI, "Toolbar", true};
break;
case SettingsID::GUI_ToolbarArea:
setting = {SETTING_SECTION_GUI, "ToolbarArea", 0};
break;
case SettingsID::GUI_StatusBar:
setting = {SETTING_SECTION_GUI, "StatusBar", true};
break;
case SettingsID::GUI_Theme:
setting = {SETTING_SECTION_GUI, "Theme", "Native"};
break;
case SettingsID::GUI_IconTheme:
setting = {SETTING_SECTION_GUI, "IconTheme", "Automatic"};
break;
case SettingsID::GUI_CheckForUpdates:
setting = {SETTING_SECTION_GUI, "CheckForUpdates", true};
break;
case SettingsID::GUI_LastUpdateCheck:
setting = {SETTING_SECTION_GUI, "LastUpdateCheck", ""};
break;
case SettingsID::GUI_DiscordRpc:
setting = {SETTING_SECTION_GUI, "DiscordRpc", true};
break;
@@ -201,36 +211,36 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::Core_GFX_Plugin:
setting = {SETTING_SECTION_CORE, "GFX_Plugin",
#ifdef _WIN32
CoreGetPluginDirectory().string() + "\\GFX\\mupen64plus-video-GLideN64.dll",
"mupen64plus-video-GLideN64.dll",
#else
CoreGetPluginDirectory().string() + "/GFX/mupen64plus-video-GLideN64.so",
"mupen64plus-video-GLideN64.so",
#endif // _WIN32
};
break;
case SettingsID::Core_AUDIO_Plugin:
setting = {SETTING_SECTION_CORE, "AUDIO_Plugin",
#ifdef _WIN32
CoreGetPluginDirectory().string() + "\\Audio\\RMG-Audio.dll",
"RMG-Audio.dll",
#else
CoreGetPluginDirectory().string() + "/Audio/RMG-Audio.so",
"RMG-Audio.so",
#endif // _WIN32
};
break;
case SettingsID::Core_INPUT_Plugin:
setting = {SETTING_SECTION_CORE, "INPUT_Plugin",
#ifdef _WIN32
CoreGetPluginDirectory().string() + "\\Input\\RMG-Input.dll",
"RMG-Input.dll",
#else
CoreGetPluginDirectory().string() + "/Input/RMG-Input.so",
"RMG-Input.so",
#endif // _WIN32
};
break;
case SettingsID::Core_RSP_Plugin:
setting = {SETTING_SECTION_CORE, "RSP_Plugin",
#ifdef _WIN32
CoreGetPluginDirectory().string() + "\\RSP\\mupen64plus-rsp-hle.dll",
"mupen64plus-rsp-hle.dll",
#else
CoreGetPluginDirectory().string() + "/RSP/mupen64plus-rsp-hle.so",
"mupen64plus-rsp-hle.so",
#endif // _WIN32
};
break;
@@ -270,6 +280,9 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::Core_SiDmaDuration:
setting = {SETTING_SECTION_M64P, "SiDmaDuration", -1};
break;
case SettingsID::Core_SaveFileNameFormat:
setting = {SETTING_SECTION_M64P, "SaveFilenameFormat", 1};
break;
case SettingsID::CoreOverlay_RandomizeInterrupt:
setting = {SETTING_SECTION_OVERLAY, "RandomizeInterrupt", true};
@@ -292,6 +305,9 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::CoreOverlay_SiDmaDuration:
setting = {SETTING_SECTION_OVERLAY, "SiDmaDuration", -1};
break;
case SettingsID::CoreOverLay_SaveFileNameFormat:
setting = {SETTING_SECTION_OVERLAY, "SaveFilenameFormat", 1};
break;
case SettingsID::Core_ScreenshotPath:
setting = {SETTING_SECTION_M64P, "ScreenshotPath", CoreGetDefaultScreenshotDirectory(), "", true};
@@ -416,6 +432,42 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::KeyBinding_LimitFPS:
setting = {SETTING_SECTION_KEYBIND, "LimitFPS", "F4"};
break;
case SettingsID::KeyBinding_SpeedFactor25:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor25", "Alt+0"};
break;
case SettingsID::KeyBinding_SpeedFactor50:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor50", "Alt+1"};
break;
case SettingsID::KeyBinding_SpeedFactor75:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor75", "Alt+2"};
break;
case SettingsID::KeyBinding_SpeedFactor100:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor100", "Alt+3"};
break;
case SettingsID::KeyBinding_SpeedFactor125:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor125", "Alt+4"};
break;
case SettingsID::KeyBinding_SpeedFactor150:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor150", "Alt+5"};
break;
case SettingsID::KeyBinding_SpeedFactor175:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor175", "Alt+6"};
break;
case SettingsID::KeyBinding_SpeedFactor200:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor200", "Alt+7"};
break;
case SettingsID::KeyBinding_SpeedFactor225:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor225", "Alt+8"};
break;
case SettingsID::KeyBinding_SpeedFactor250:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor250", "Alt+9"};
break;
case SettingsID::KeyBinding_SpeedFactor275:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor275", "Alt+["};
break;
case SettingsID::KeyBinding_SpeedFactor300:
setting = {SETTING_SECTION_KEYBIND, "SpeedFactor300", "Alt+]"};
break;
case SettingsID::KeyBinding_SaveState:
setting = {SETTING_SECTION_KEYBIND, "SaveState", "F5"};
break;
@@ -467,6 +519,21 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::KeyBinding_Fullscreen:
setting = {SETTING_SECTION_KEYBIND, "Fullscreen", "Alt+Return"};
break;
case SettingsID::Keybinding_ViewLog:
setting = {SETTING_SECTION_KEYBIND, "ViewLog", "Ctrl+L"};
break;
case SettingsID::KeyBinding_GraphicsSettings:
setting = {SETTING_SECTION_KEYBIND, "GraphicsSettings", "Ctrl+G"};
break;
case SettingsID::KeyBinding_AudioSettings:
setting = {SETTING_SECTION_KEYBIND, "AudioSettings", "Ctrl+A"};
break;
case SettingsID::KeyBinding_RspSettings:
setting = {SETTING_SECTION_KEYBIND, "RspSettings", "Ctrl+R"};
break;
case SettingsID::KeyBinding_InputSettings:
setting = {SETTING_SECTION_KEYBIND, "InputSettings", "Ctrl+I"};
break;
case SettingsID::KeyBinding_Settings:
setting = {SETTING_SECTION_KEYBIND, "Settings", "Ctrl+T"};
break;
@@ -486,11 +553,17 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::RomBrowser_MaxItems:
setting = {SETTING_SECTION_ROMBROWSER, "MaxItems", 250};
break;
case SettingsID::RomBrowser_Columns:
setting = {SETTING_SECTION_ROMBROWSER, "Columns", std::vector<int>({0, 1, 2})};
case SettingsID::RomBrowser_ColumnVisibility:
setting = {SETTING_SECTION_ROMBROWSER, "ColumnVisibility", std::vector<int>({1, 1, 1, 0, 0, 0, 0, 0, 0})};
break;
case SettingsID::RomBrowser_ColumnOrder:
setting = {SETTING_SECTION_ROMBROWSER, "ColumnOrder", std::vector<int>({0, 1, 2, 3, 4, 5, 6, 7, 8})};
break;
case SettingsID::RomBrowser_ColumnSizes:
setting = {SETTING_SECTION_ROMBROWSER, "ColumnSizes", std::vector<int>({-1, -1, -1})};
setting = {SETTING_SECTION_ROMBROWSER, "ColumnSizes", std::vector<int>({-1, -1, -1, -1, -1, -1, -1, -1, -1})};
break;
case SettingsID::RomBrowser_SortAfterSearch:
setting = {SETTING_SECTION_ROMBROWSER, "SortAfterSearch", true};
break;
case SettingsID::RomBrowser_ViewMode:
setting = {SETTING_SECTION_ROMBROWSER, "ViewMode", 0};
@@ -543,6 +616,15 @@ static l_Setting get_setting(SettingsID settingId)
setting = {SETTING_SECTION_AUDIO, "Synchronize", false};
break;
case SettingsID::Input_Profiles:
setting = {SETTING_SECTION_INPUT, "Profiles", ""};
break;
case SettingsID::Input_UseProfile:
setting = {"", "UseProfile"};
break;
case SettingsID::Input_UseGameProfile:
setting = {"", "UseGameProfile"};
break;
case SettingsID::Input_PluggedIn:
setting = {"", "PluggedIn"};
break;
@@ -558,6 +640,9 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::Input_Deadzone:
setting = {"", "Deadzone"};
break;
case SettingsID::Input_Sensitivity:
setting = {"", "Sensitivity"};
break;
case SettingsID::Input_Pak:
setting = {"", "Pak"};
break;
@@ -570,8 +655,11 @@ static l_Setting get_setting(SettingsID settingId)
case SettingsID::Input_RemoveDuplicateMappings:
setting = {"", "RemoveDuplicateMappings"};
break;
case SettingsID::Input_InvertAxis:
setting = {"", "InvertAxis"};
case SettingsID::Input_FilterEventsForButtons:
setting = {"", "FilterEventsForButtons"};
break;
case SettingsID::Input_FilterEventsForAxis:
setting = {"", "FilterEventsForAxis"};
break;
case SettingsID::Input_A_InputType:
setting = {"", "A_InputType"};
@@ -1220,6 +1308,27 @@ bool CoreSettingsSectionExists(std::string section)
return config_section_exists(section);
}
bool CoreSettingsRevertSection(std::string section)
{
std::string error;
m64p_error ret;
if (!m64p::Config.IsHooked())
{
return false;
}
ret = m64p::Config.RevertChanges(section.c_str());
if (ret != M64ERR_SUCCESS)
{
error = "CoreSettingsRevertSection m64p::Config.RevertChanges() Failed: ";
error = m64p::Core.ErrorMessage(ret);
CoreSetError(error);
}
return ret == M64ERR_SUCCESS;
}
bool CoreSettingsDeleteSection(std::string section)
{
std::string error;
+3
View File
@@ -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);
+32 -3
View File
@@ -20,12 +20,15 @@ enum class SettingsID
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,
@@ -62,6 +65,7 @@ enum class SettingsID
Core_CountPerOp,
Core_CountPerOpDenomPot,
Core_SiDmaDuration,
Core_SaveFileNameFormat,
// (mupen64plus) Overlay Core Settings
CoreOverlay_RandomizeInterrupt,
@@ -71,6 +75,7 @@ enum class SettingsID
CoreOverlay_CountPerOp,
CoreOverlay_CountPerOpDenomPot,
CoreOverlay_SiDmaDuration,
CoreOverLay_SaveFileNameFormat,
// (mupen64plus) Core Directory Settings
Core_ScreenshotPath,
@@ -108,6 +113,18 @@ enum class SettingsID
KeyBinding_Resume,
KeyBinding_Screenshot,
KeyBinding_LimitFPS,
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,
@@ -125,6 +142,11 @@ enum class SettingsID
KeyBinding_SaveStateSlot8,
KeyBinding_SaveStateSlot9,
KeyBinding_Fullscreen,
Keybinding_ViewLog,
KeyBinding_GraphicsSettings,
KeyBinding_AudioSettings,
KeyBinding_RspSettings,
KeyBinding_InputSettings,
KeyBinding_Settings,
// RomBrowser Settings
@@ -133,8 +155,10 @@ enum class SettingsID
RomBrowser_Maximized,
RomBrowser_Recursive,
RomBrowser_MaxItems,
RomBrowser_Columns,
RomBrowser_ColumnVisibility,
RomBrowser_ColumnOrder,
RomBrowser_ColumnSizes,
RomBrowser_SortAfterSearch,
RomBrowser_ViewMode,
RomBrowser_ListViewSortSection,
RomBrowser_ListViewSortOrder,
@@ -157,16 +181,21 @@ enum class SettingsID
Audio_Synchronize,
// 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,
+63
View File
@@ -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;
}
+19
View File
@@ -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
+4
View File
@@ -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;
+2
View File
@@ -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:
+23
View File
@@ -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
+107 -27
View File
@@ -18,7 +18,7 @@
using namespace UserInterface;
MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread) : QDialog(parent)
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,19 @@ 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);
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 +98,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 +221,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 +241,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 +371,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();
}
+10 -4
View File
@@ -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;
};
}
@@ -24,7 +24,8 @@ OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings) :
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())
{
@@ -84,7 +85,8 @@ void OptionsDialog::on_buttonBox_clicked(QAbstractButton *button)
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->settings.FilterEventsForButtons = this->filterEventsForButtonsCheckBox->isChecked();
this->settings.FilterEventsForAxis = this->filterEventsForAxisCheckBox->isChecked();
}
this->accept();
@@ -24,7 +24,8 @@ struct OptionsDialogSettings
// UI settings
bool RemoveDuplicateMappings = false;
bool InvertAxis = false;
bool FilterEventsForButtons = true;
bool FilterEventsForAxis = true;
};
namespace UserInterface
@@ -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>
@@ -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
@@ -153,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();
File diff suppressed because it is too large Load Diff
@@ -34,14 +34,20 @@ class ControllerWidget : public QWidget, Ui::ControllerWidget
Q_OBJECT
private:
bool initialized = false;
QString settingsSection;
QString gameSection;
OptionsDialogSettings optionsDialogSettings;
QList<QString> inputDeviceNameList;
MappingButton* currentButton = nullptr;
bool addMappingToButton = false;
QList<QString> profiles;
QList<QString> removedProfiles;
QList<QString> addedProfiles;
struct buttonWidgetMapping
{
enum N64ControllerButton button;
@@ -68,7 +74,9 @@ private:
QList<buttonSettingMapping> buttonSettingMappings;
QList<MappingButton*> setupButtonWidgets;
void initializeButtons();
void initializeMappingButtons();
void initializeProfileButtons();
void initializeMiscButtons();
bool isCurrentDeviceKeyboard();
bool isCurrentDeviceNotFound();
@@ -80,7 +88,23 @@ private:
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;
public:
ControllerWidget(QWidget* parent, EventFilter* eventFilter);
@@ -96,25 +120,38 @@ 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_resetButton_clicked();
@@ -130,9 +167,13 @@ public slots:
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);
};
}
}
@@ -23,20 +23,45 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox_5">
<widget class="QGroupBox" name="profileGroupBox">
<property name="title">
<string>Profile</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QComboBox" name="profileComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addProfileButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeProfileButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove</string>
</property>
@@ -46,7 +71,20 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="inputDeviceGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -60,7 +98,7 @@
<item>
<widget class="QComboBox" name="inputDeviceComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -73,7 +111,7 @@
<item>
<widget class="QPushButton" name="inputDeviceRefreshButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -86,6 +124,19 @@
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="deadZoneGroupBox">
<property name="title">
@@ -95,7 +146,7 @@
<item>
<widget class="QSlider" name="deadZoneSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -109,21 +160,17 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="controllerPluggedCheckBox">
<property name="text">
<string>Controller is plugged in</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -157,7 +204,7 @@
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="dpadGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -368,7 +415,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="analogStickGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -554,6 +601,43 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="analogStickSensitivityGroupBox">
<property name="title">
<string>Analog Stick Sensitivity: 100%</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QSlider" name="analogStickSensitivitySlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>25</number>
</property>
<property name="maximum">
<number>175</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>15</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
@@ -828,7 +912,7 @@
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<widget class="QGroupBox" name="cButtonsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -1033,7 +1117,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<widget class="QGroupBox" name="buttonsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -14,8 +14,10 @@ using namespace UserInterface::Widget;
MappingButton::MappingButton(QWidget* parent) : QPushButton(parent)
{
this->countDownTimer = new QTimer(this);
this->countDownTimer = new QTimer(this);
connect(this->countDownTimer, &QTimer::timeout, this, &MappingButton::on_countDownTimer_triggered);
this->initialSize = this->size();
}
MappingButton::~MappingButton()
@@ -223,7 +225,7 @@ void MappingButton::reloadText()
}
}
QString elidedText = fontMetrics.elidedText(text, Qt::ElideRight, this->width());
QString elidedText = fontMetrics.elidedText(text, Qt::ElideRight, this->initialSize.width());
// needed for spacing
if (elidedText.isEmpty())
@@ -36,6 +36,7 @@ struct MappingButtonInputDataType
class MappingButton : public QPushButton
{
private:
QSize initialSize;
QTimer* countDownTimer = nullptr;
ControllerWidget* controllerWidget = nullptr;
int currentCountDownNum = 0;
+1 -1
View File
@@ -83,7 +83,7 @@ void InputDevice::OpenDevice(std::string name, int num)
// wait until SDLThread is done first
while (this->sdlThread->GetCurrentAction() != SDLThreadAction::None)
{
QThread::msleep(50);
QThread::msleep(5);
}
this->foundDevicesWithNameMatch.clear();
+7
View File
@@ -31,6 +31,13 @@ enum class N64ControllerButton
Invalid
};
enum class InputDeviceType
{
None = -3,
Automatic = -2,
Keyboard = -1
};
enum class InputType
{
Keyboard = -1,
+236 -72
View File
@@ -21,7 +21,7 @@
#include <QApplication>
#include <SDL.h>
#include <iostream>
#include <algorithm>
#include <chrono>
//
@@ -49,16 +49,18 @@
struct InputMapping
{
std::vector<int> Type;
std::vector<int> Data;
std::vector<int> ExtraData;
int Count = 0;
std::vector<std::string> Name;
std::vector<int> Type;
std::vector<int> Data;
std::vector<int> ExtraData;
int Count = 0;
};
struct InputProfile
{
bool PluggedIn = false;
int DeadzoneValue = 0;
int SensitivityValue = 100;
N64ControllerPak ControllerPak = N64ControllerPak::None;
@@ -121,15 +123,22 @@ static bool l_KeyboardState[SDL_NUM_SCANCODES];
//
static void load_inputmapping_settings(InputMapping* mapping, std::string section,
SettingsID inputTypeSettingsId, SettingsID dataSettingsId, SettingsID extraDataSettingsId)
SettingsID inputNameSettingsId, SettingsID inputTypeSettingsId,
SettingsID dataSettingsId, SettingsID extraDataSettingsId)
{
mapping->Name = CoreSettingsGetStringListValue(inputNameSettingsId, section);
mapping->Type = CoreSettingsGetIntListValue(inputTypeSettingsId, section);
mapping->Data = CoreSettingsGetIntListValue(dataSettingsId, section);
mapping->ExtraData = CoreSettingsGetIntListValue(extraDataSettingsId, section);
mapping->Count = std::min(mapping->Type.size(), std::min(mapping->Data.size(), mapping->ExtraData.size()));
if (mapping->Count == 0)
{ // try to load old profile type
// check if mapping is old profile type,
// it should be true when the minimum of the lengths
// of all int lists is 0, and the name isn't empty or whitespace
if (mapping->Count == 0 &&
!mapping->Name.empty() && !mapping->Name.at(0).empty() &&
mapping->Name.at(0).find_first_not_of(' ') != std::string::npos)
{
mapping->Type.push_back(CoreSettingsGetIntValue(inputTypeSettingsId, section));
mapping->Data.push_back(CoreSettingsGetIntValue(dataSettingsId, section));
mapping->ExtraData.push_back(CoreSettingsGetIntValue(extraDataSettingsId, section));
@@ -142,26 +151,60 @@ static void load_settings(void)
std::string gameId;
CoreRomSettings romSettings;
std::string userProfileSectionBase = "Rosalie's Mupen GUI - Input Plugin User Profile";
std::vector<std::string> userProfiles;
std::vector<std::string>::iterator userProfilesIter;
// try to retrieve current ROM settings
if (CoreGetCurrentRomSettings(romSettings))
{
gameId = romSettings.MD5;
}
// retrieve all user profiles
userProfiles = CoreSettingsGetStringListValue(SettingsID::Input_Profiles);
for (int i = 0; i < NUM_CONTROLLERS; i++)
{
InputProfile* profile = &l_InputProfiles[i];
std::string section = "Rosalie's Mupen GUI - Input Plugin Profile " + std::to_string(i);
std::string section = "Rosalie's Mupen GUI - Input Plugin Profile " + std::to_string(i);
std::string gameSection = section + " Game " + gameId;
std::string userProfileSection;
std::string userProfileName;
// when a user profile has been specified,
// ensure it exists in the profile list and
// in the settings, if it does,
// use that user profile
userProfileName = CoreSettingsGetStringValue(SettingsID::Input_UseProfile, section);
if (!userProfileName.empty())
{
userProfilesIter = std::find(userProfiles.begin(), userProfiles.end(), userProfileName);
if (userProfilesIter != userProfiles.end())
{
userProfileSection = userProfileSectionBase;
userProfileSection += " \"" + userProfileName + "\"";
if (CoreSettingsSectionExists(userProfileSection))
{
section = userProfileSection;
}
}
}
// if game ID was retrieved,
// check if game section exists, if it does
// use that section instead of the main section
// check if game section exists,
// if it does, check if the 'UseGameProfile' key exists,
// if it doesn't then use the profile, else
// check if the value is true
if (!gameId.empty())
{
if (CoreSettingsSectionExists(gameSection))
{
section = gameSection;
if (!CoreSettingsKeyExists(gameSection, "UseGameProfile") ||
CoreSettingsGetBoolValue(SettingsID::Input_UseGameProfile, gameSection))
{
section = gameSection;
}
}
}
@@ -181,25 +224,35 @@ static void load_settings(void)
profile->GameboyRom = CoreSettingsGetStringValue(SettingsID::Input_GameboyRom, section);
profile->GameboySave = CoreSettingsGetStringValue(SettingsID::Input_GameboySave, section);
// keep compatibility with profiles before version v0.3.9
if (CoreSettingsKeyExists(section, "Sensitivity"))
{
profile->SensitivityValue = CoreSettingsGetIntValue(SettingsID::Input_Sensitivity, section);
}
else
{
profile->SensitivityValue = 100;
}
// load inputmapping settings
load_inputmapping_settings(&profile->Button_A, section, SettingsID::Input_A_InputType, SettingsID::Input_A_Data, SettingsID::Input_A_ExtraData);
load_inputmapping_settings(&profile->Button_B, section, SettingsID::Input_B_InputType, SettingsID::Input_B_Data, SettingsID::Input_B_ExtraData);
load_inputmapping_settings(&profile->Button_Start, section, SettingsID::Input_Start_InputType, SettingsID::Input_Start_Data, SettingsID::Input_Start_ExtraData);
load_inputmapping_settings(&profile->Button_DpadUp, section, SettingsID::Input_DpadUp_InputType, SettingsID::Input_DpadUp_Data, SettingsID::Input_DpadUp_ExtraData);
load_inputmapping_settings(&profile->Button_DpadDown, section, SettingsID::Input_DpadDown_InputType, SettingsID::Input_DpadDown_Data, SettingsID::Input_DpadDown_ExtraData);
load_inputmapping_settings(&profile->Button_DpadLeft, section, SettingsID::Input_DpadLeft_InputType, SettingsID::Input_DpadLeft_Data, SettingsID::Input_DpadLeft_ExtraData);
load_inputmapping_settings(&profile->Button_DpadRight, section, SettingsID::Input_DpadRight_InputType, SettingsID::Input_DpadRight_Data, SettingsID::Input_DpadRight_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonUp, section, SettingsID::Input_CButtonUp_InputType, SettingsID::Input_CButtonUp_Data, SettingsID::Input_CButtonUp_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonDown, section, SettingsID::Input_CButtonDown_InputType, SettingsID::Input_CButtonDown_Data, SettingsID::Input_CButtonDown_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonLeft, section, SettingsID::Input_CButtonLeft_InputType, SettingsID::Input_CButtonLeft_Data, SettingsID::Input_CButtonLeft_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonRight, section, SettingsID::Input_CButtonRight_InputType, SettingsID::Input_CButtonRight_Data, SettingsID::Input_CButtonRight_ExtraData);
load_inputmapping_settings(&profile->Button_LeftTrigger, section, SettingsID::Input_LeftTrigger_InputType, SettingsID::Input_LeftTrigger_Data, SettingsID::Input_LeftTrigger_ExtraData);
load_inputmapping_settings(&profile->Button_RightTrigger, section, SettingsID::Input_RightTrigger_InputType, SettingsID::Input_RightTrigger_Data, SettingsID::Input_RightTrigger_ExtraData);
load_inputmapping_settings(&profile->Button_ZTrigger, section, SettingsID::Input_ZTrigger_InputType, SettingsID::Input_ZTrigger_Data, SettingsID::Input_ZTrigger_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Up, section, SettingsID::Input_AnalogStickUp_InputType, SettingsID::Input_AnalogStickUp_Data, SettingsID::Input_AnalogStickUp_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Down, section, SettingsID::Input_AnalogStickDown_InputType, SettingsID::Input_AnalogStickDown_Data, SettingsID::Input_AnalogStickDown_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Left, section, SettingsID::Input_AnalogStickLeft_InputType, SettingsID::Input_AnalogStickLeft_Data, SettingsID::Input_AnalogStickLeft_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Right, section, SettingsID::Input_AnalogStickRight_InputType, SettingsID::Input_AnalogStickRight_Data, SettingsID::Input_AnalogStickRight_ExtraData);
load_inputmapping_settings(&profile->Button_A, section, SettingsID::Input_A_Name, SettingsID::Input_A_InputType, SettingsID::Input_A_Data, SettingsID::Input_A_ExtraData);
load_inputmapping_settings(&profile->Button_B, section, SettingsID::Input_B_Name, SettingsID::Input_B_InputType, SettingsID::Input_B_Data, SettingsID::Input_B_ExtraData);
load_inputmapping_settings(&profile->Button_Start, section, SettingsID::Input_Start_Name, SettingsID::Input_Start_InputType, SettingsID::Input_Start_Data, SettingsID::Input_Start_ExtraData);
load_inputmapping_settings(&profile->Button_DpadUp, section, SettingsID::Input_DpadUp_Name, SettingsID::Input_DpadUp_InputType, SettingsID::Input_DpadUp_Data, SettingsID::Input_DpadUp_ExtraData);
load_inputmapping_settings(&profile->Button_DpadDown, section, SettingsID::Input_DpadDown_Name, SettingsID::Input_DpadDown_InputType, SettingsID::Input_DpadDown_Data, SettingsID::Input_DpadDown_ExtraData);
load_inputmapping_settings(&profile->Button_DpadLeft, section, SettingsID::Input_DpadLeft_Name, SettingsID::Input_DpadLeft_InputType, SettingsID::Input_DpadLeft_Data, SettingsID::Input_DpadLeft_ExtraData);
load_inputmapping_settings(&profile->Button_DpadRight, section, SettingsID::Input_DpadRight_Name, SettingsID::Input_DpadRight_InputType, SettingsID::Input_DpadRight_Data, SettingsID::Input_DpadRight_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonUp, section, SettingsID::Input_CButtonUp_Name, SettingsID::Input_CButtonUp_InputType, SettingsID::Input_CButtonUp_Data, SettingsID::Input_CButtonUp_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonDown, section, SettingsID::Input_CButtonDown_Name, SettingsID::Input_CButtonDown_InputType, SettingsID::Input_CButtonDown_Data, SettingsID::Input_CButtonDown_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonLeft, section, SettingsID::Input_CButtonLeft_Name, SettingsID::Input_CButtonLeft_InputType, SettingsID::Input_CButtonLeft_Data, SettingsID::Input_CButtonLeft_ExtraData);
load_inputmapping_settings(&profile->Button_CButtonRight, section, SettingsID::Input_CButtonRight_Name, SettingsID::Input_CButtonRight_InputType, SettingsID::Input_CButtonRight_Data, SettingsID::Input_CButtonRight_ExtraData);
load_inputmapping_settings(&profile->Button_LeftTrigger, section, SettingsID::Input_LeftTrigger_Name, SettingsID::Input_LeftTrigger_InputType, SettingsID::Input_LeftTrigger_Data, SettingsID::Input_LeftTrigger_ExtraData);
load_inputmapping_settings(&profile->Button_RightTrigger, section, SettingsID::Input_RightTrigger_Name, SettingsID::Input_RightTrigger_InputType, SettingsID::Input_RightTrigger_Data, SettingsID::Input_RightTrigger_ExtraData);
load_inputmapping_settings(&profile->Button_ZTrigger, section, SettingsID::Input_ZTrigger_Name, SettingsID::Input_ZTrigger_InputType, SettingsID::Input_ZTrigger_Data, SettingsID::Input_ZTrigger_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Up, section, SettingsID::Input_AnalogStickUp_Name, SettingsID::Input_AnalogStickUp_InputType, SettingsID::Input_AnalogStickUp_Data, SettingsID::Input_AnalogStickUp_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Down, section, SettingsID::Input_AnalogStickDown_Name, SettingsID::Input_AnalogStickDown_InputType, SettingsID::Input_AnalogStickDown_Data, SettingsID::Input_AnalogStickDown_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Left, section, SettingsID::Input_AnalogStickLeft_Name, SettingsID::Input_AnalogStickLeft_InputType, SettingsID::Input_AnalogStickLeft_Data, SettingsID::Input_AnalogStickLeft_ExtraData);
load_inputmapping_settings(&profile->AnalogStick_Right, section, SettingsID::Input_AnalogStickRight_Name, SettingsID::Input_AnalogStickRight_InputType, SettingsID::Input_AnalogStickRight_Data, SettingsID::Input_AnalogStickRight_ExtraData);
}
}
@@ -269,15 +322,90 @@ static void apply_gameboy_settings(void)
CoreSettingsSave();
}
static void setup_device_automatic(int num, InputProfile* profile)
{
static int previousSdlDeviceNum = -1;
// reset variable when needed
if (num == 0)
{
previousSdlDeviceNum = -1;
}
bool foundSdlDevice = false;
SDL_GameController* sdlGameController = nullptr;
SDL_Joystick* sdlJoystick = nullptr;
std::string sdlDeviceName;
for (int i = (previousSdlDeviceNum + 1); i < SDL_NumJoysticks(); i++)
{
if (SDL_IsGameController(i))
{
sdlGameController = SDL_GameControllerOpen(i);
if (sdlGameController != nullptr)
{
sdlDeviceName = SDL_GameControllerName(sdlGameController);
SDL_GameControllerClose(sdlGameController);
profile->DeviceNum = i;
profile->DeviceName = sdlDeviceName;
previousSdlDeviceNum = i;
foundSdlDevice = true;
break;
}
}
else
{
sdlJoystick = SDL_JoystickOpen(i);
if (sdlJoystick != nullptr)
{
sdlDeviceName = SDL_JoystickName(sdlJoystick);
SDL_JoystickClose(sdlJoystick);
profile->DeviceNum = i;
profile->DeviceName = sdlDeviceName;
previousSdlDeviceNum = i;
foundSdlDevice = true;
break;
}
}
}
if (!foundSdlDevice)
{ // fallback to keyboard
if (num == 0)
{
profile->DeviceNum = (int)InputDeviceType::Keyboard;
}
else
{
profile->PluggedIn = false;
// only override present in core
// when we have the control info
if (l_HasControlInfo)
{
l_ControlInfo.Controls[num].Present = 0;
}
}
}
}
static void open_controllers(void)
{
// force re-fresh joystick list
SDL_JoystickUpdate();
for (int i = 0; i < NUM_CONTROLLERS; i++)
{
InputProfile* profile = &l_InputProfiles[i];
profile->InputDevice.CloseDevice();
if (profile->DeviceNum != -1)
if (profile->DeviceNum == (int)InputDeviceType::Automatic)
{
setup_device_automatic(i, profile);
}
if (profile->DeviceNum != (int)InputDeviceType::Keyboard)
{
profile->InputDevice.OpenDevice(profile->DeviceName, profile->DeviceNum);
}
@@ -289,12 +417,12 @@ static void close_controllers(void)
for (int i = 0; i < NUM_CONTROLLERS; i++)
{
InputProfile* profile = &l_InputProfiles[i];
profile->InputDevice.CloseDevice();
}
}
static int get_button_state(InputProfile* profile, InputMapping* inputMapping)
static int get_button_state(InputProfile* profile, const InputMapping* inputMapping)
{
int state = 0;
@@ -336,9 +464,10 @@ static int get_button_state(InputProfile* profile, InputMapping* inputMapping)
}
// returns axis input scaled to the range [-1, 1]
static double get_axis_state(InputProfile* profile, InputMapping* inputMapping, int direction, double value)
static double get_axis_state(InputProfile* profile, const InputMapping* inputMapping, const int direction, const double value, bool& useButtonMapping)
{
int state = 0;
double axis_state = value;
bool button_state = false;
for (int i = 0; i < inputMapping->Count; i++)
{
@@ -349,8 +478,7 @@ static double get_axis_state(InputProfile* profile, InputMapping* inputMapping,
{
case InputType::GamepadButton:
{
int buttonState = SDL_GameControllerGetButton(profile->InputDevice.GetGameControllerHandle(), (SDL_GameControllerButton)data);
state |= buttonState;
button_state |= SDL_GameControllerGetButton(profile->InputDevice.GetGameControllerHandle(), (SDL_GameControllerButton)data);;
} break;
case InputType::GamepadAxis:
{
@@ -359,13 +487,12 @@ static double get_axis_state(InputProfile* profile, InputMapping* inputMapping,
{
axis_value = (axis_value / SDL_AXIS_PEAK);
axis_value = abs(axis_value) * direction;
return axis_value;
axis_state = axis_value;
}
} break;
case InputType::JoystickButton:
{
int buttonState = SDL_JoystickGetButton(profile->InputDevice.GetJoystickHandle(), data);
state |= buttonState;
button_state |= SDL_JoystickGetButton(profile->InputDevice.GetJoystickHandle(), data);;
} break;
case InputType::JoystickAxis:
{
@@ -374,22 +501,37 @@ static double get_axis_state(InputProfile* profile, InputMapping* inputMapping,
{
axis_value = (axis_value / SDL_AXIS_PEAK);
axis_value = abs(axis_value) * direction;
return axis_value;
axis_state = axis_value;
}
} break;
case InputType::Keyboard:
{
state |= l_KeyboardState[data];
button_state |= l_KeyboardState[data];
} break;
default:
break;
}
}
}
return state ? direction : value;
// when a button has been mapped
// to an axis, we should prioritize
// the button when it's been pressed
if (button_state)
{
useButtonMapping = true;
return direction;
}
else if (!useButtonMapping)
{
return axis_state;
}
else
{
return value;
}
}
static double simulate_deadzone(double n64InputAxis, double maxAxis, int deadzone, double axisRange)
static double simulate_deadzone(const double n64InputAxis, const double maxAxis, const int deadzone, const double axisRange)
{
double axisAbsolute = std::abs(n64InputAxis);
@@ -406,16 +548,17 @@ static double simulate_deadzone(double n64InputAxis, double maxAxis, int deadzon
return axisAbsolute;
}
// Credit: MerryMage
static void simulate_octagon(double inputX, double inputY, double deadzoneFactor, int& outputX, int& outputY)
// Credit: MerryMage & fzurita
static void simulate_octagon(const double inputX, const double inputY, const double deadzoneFactor, const double sensitivityFactor, int& outputX, int& outputY)
{
double maxAxis = N64_AXIS_PEAK;
double maxDiagonal = MAX_DIAGONAL_VALUE;
int deadzone = static_cast<int>(deadzoneFactor * N64_AXIS_PEAK);
double axisRange = maxAxis - deadzone;
// don't increase emulated range at higher than 100% sensitivity
const double maxAxis = N64_AXIS_PEAK * std::min(sensitivityFactor, 1.0);
const double maxDiagonal = MAX_DIAGONAL_VALUE * std::min(sensitivityFactor, 1.0);
const int deadzone = (int)(deadzoneFactor * N64_AXIS_PEAK * sensitivityFactor);
const double axisRange = maxAxis - deadzone;
// scale to [-maxAxis, maxAxis]
double ax = inputX * maxAxis;
double ay = inputY * maxAxis;
double ax = std::min(inputX * sensitivityFactor, 1.0) * maxAxis;
double ay = std::min(inputY * sensitivityFactor, 1.0) * maxAxis;
// check whether (ax, ay) is within the circle of radius MAX_AXIS
double len = std::sqrt(ax*ax + ay*ay);
@@ -436,18 +579,18 @@ static void simulate_octagon(double inputX, double inputY, double deadzoneFactor
// bound diagonals to an octagonal range [-69, 69]
if (ax != 0.0 && ay != 0.0)
{
double slope = ay / ax;
double edgex = copysign(maxAxis / (std::abs(slope) + (maxAxis - maxDiagonal) / maxDiagonal), ax);
double edgey = copysign(std::min(std::abs(edgex * slope), maxAxis / (1.0 / std::abs(slope) + (maxAxis - maxDiagonal) / maxDiagonal)), ay);
const double slope = ay / ax;
double edgex = std::copysign(maxAxis / (std::abs(slope) + (maxAxis - maxDiagonal) / maxDiagonal), ax);
const double edgey = std::copysign(std::min(std::abs(edgex * slope), maxAxis / (1.0 / std::abs(slope) + (maxAxis - maxDiagonal) / maxDiagonal)), ay);
edgex = edgey / slope;
double scale = std::sqrt(edgex*edgex + edgey*edgey) / maxAxis;
const double scale = std::sqrt(edgex*edgex + edgey*edgey) / maxAxis;
ax *= scale;
ay *= scale;
}
outputX = static_cast<int>(ax);
outputY = static_cast<int>(ay);
outputX = (int)ax;
outputY = (int)ay;
}
static unsigned char data_crc(unsigned char *data, int length)
@@ -476,18 +619,26 @@ static unsigned char data_crc(unsigned char *data, int length)
void sdl_init()
{
for (int subsystem : {SDL_INIT_GAMECONTROLLER, SDL_INIT_VIDEO, SDL_INIT_HAPTIC})
std::filesystem::path gameControllerDbPath;
for (const int subsystem : {SDL_INIT_GAMECONTROLLER, SDL_INIT_VIDEO, SDL_INIT_HAPTIC})
{
if (!SDL_WasInit(subsystem))
{
SDL_InitSubSystem(subsystem);
}
}
gameControllerDbPath = CoreGetSharedDataDirectory();
gameControllerDbPath += "/gamecontrollerdb.txt";
// load mappings from file
SDL_GameControllerAddMappingsFromFile(gameControllerDbPath.string().c_str());
}
void sdl_quit()
{
for (int subsystem : {SDL_INIT_GAMECONTROLLER, SDL_INIT_HAPTIC})
for (const int subsystem : {SDL_INIT_GAMECONTROLLER, SDL_INIT_HAPTIC})
{
if (SDL_WasInit(subsystem))
{
@@ -580,7 +731,7 @@ EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *pluginType, int *plugi
// Custom Plugin Functions
//
EXPORT m64p_error CALL PluginConfig()
EXPORT m64p_error CALL PluginConfig2(int romConfig)
{
if (l_SDLThread == nullptr)
{
@@ -592,11 +743,17 @@ EXPORT m64p_error CALL PluginConfig()
l_SDLThread->SetAction(SDLThreadAction::SDLPumpEvents);
UserInterface::MainDialog dialog(nullptr, l_SDLThread);
UserInterface::MainDialog dialog(nullptr, l_SDLThread, romConfig);
dialog.exec();
l_SDLThread->SetAction(SDLThreadAction::None);
// wait until it's done pumping events
while (l_SDLThread->GetCurrentAction() == SDLThreadAction::SDLPumpEvents)
{
QThread::msleep(5);
}
// reload settings
load_settings();
@@ -612,6 +769,11 @@ EXPORT m64p_error CALL PluginConfig()
return M64ERR_SUCCESS;
}
EXPORT int CALL PluginConfig2HasRomConfig(void)
{
return 1;
}
//
// Input Plugin Functions
//
@@ -686,13 +848,13 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
// check if device has been disconnected,
// if it has, try to open it again,
// only do this every 2 seconds to prevent lag
const auto currentTime = std::chrono::high_resolution_clock::now();
const auto currentTime = std::chrono::high_resolution_clock::now();
const int secondsPassed = std::chrono::duration_cast<std::chrono::seconds>(currentTime - profile->LastDeviceCheckTime).count();
if (secondsPassed >= 2)
{
profile->LastDeviceCheckTime = currentTime;
if (profile->DeviceNum != -1)
if (profile->DeviceNum != (int)InputDeviceType::Keyboard)
{
if (profile->InputDevice.IsOpeningDevice())
{
@@ -702,7 +864,6 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
if (!profile->InputDevice.HasOpenDevice() || !profile->InputDevice.IsAttached())
{
profile->InputDevice.OpenDevice(profile->DeviceName, profile->DeviceNum);
return;
}
}
}
@@ -723,16 +884,18 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
Keys->Z_TRIG = get_button_state(profile, &profile->Button_ZTrigger);
double inputX = 0, inputY = 0;
inputY = get_axis_state(profile, &profile->AnalogStick_Up, 1, inputY);
inputY = get_axis_state(profile, &profile->AnalogStick_Down, -1, inputY);
inputX = get_axis_state(profile, &profile->AnalogStick_Left, -1, inputX);
inputX = get_axis_state(profile, &profile->AnalogStick_Right, 1, inputX);
bool useButtonMapping = false;
inputY = get_axis_state(profile, &profile->AnalogStick_Up, 1, inputY, useButtonMapping);
inputY = get_axis_state(profile, &profile->AnalogStick_Down, -1, inputY, useButtonMapping);
inputX = get_axis_state(profile, &profile->AnalogStick_Left, -1, inputX, useButtonMapping);
inputX = get_axis_state(profile, &profile->AnalogStick_Right, 1, inputX, useButtonMapping);
int octagonX = 0, octagonY = 0;
simulate_octagon(
inputX, // inputX
inputY, // inputY
profile->DeadzoneValue / 100.0, // deadzoneFactor
profile->SensitivityValue / 100.0, // sensitivityFactor
octagonX, // outputX
octagonY // outputY
);
@@ -748,7 +911,7 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo)
l_KeyboardState[i] = 0;
}
l_ControlInfo = ControlInfo;
l_ControlInfo = ControlInfo;
l_HasControlInfo = true;
// load settings
@@ -772,6 +935,7 @@ EXPORT int CALL RomOpen(void)
EXPORT void CALL RomClosed(void)
{
l_HasControlInfo = false;
close_controllers();
}
+8
View File
@@ -16,10 +16,18 @@ if (UPDATER)
add_definitions(-DUPDATER)
endif(UPDATER)
if (APPIMAGE_UPDATER)
add_definitions(-DAPPIMAGE_UPDATER)
endif(APPIMAGE_UPDATER)
if (DISCORD_RPC)
add_definitions(-DDISCORD_RPC)
endif(DISCORD_RPC)
if (FORCE_XCB)
add_definitions(-DFORCE_XCB)
endif(FORCE_XCB)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
+22 -1
View File
@@ -36,11 +36,12 @@ bool CoreCallbacks::Init(void)
{
// needed for Qt
qRegisterMetaType<CoreDebugMessageType>("CoreDebugMessageType");
qRegisterMetaType<CoreDebugMessageType>("CoreStateCallbackType");
this->LoadSettings();
l_CoreCallbacks = this;
return CoreSetupCallbacks(this->coreDebugCallback);
return CoreSetupCallbacks(this->coreDebugCallback, this->coreStateCallback);
}
void CoreCallbacks::Stop(void)
@@ -66,5 +67,25 @@ void CoreCallbacks::coreDebugCallback(CoreDebugMessageType type, std::string con
return;
}
// skip non-fatal interpreter errors
if (type == CoreDebugMessageType::Error)
{
if (message == "DIV_S by 0" ||
message == "DIV_D by 0")
{
return;
}
}
emit l_CoreCallbacks->OnCoreDebugCallback(type, QString::fromStdString(context), QString::fromStdString(message));
}
void CoreCallbacks::coreStateCallback(CoreStateCallbackType type, int value)
{
if (l_CoreCallbacks == nullptr)
{
return;
}
emit l_CoreCallbacks->OnCoreStateCallback(type, value);
}
+2
View File
@@ -31,9 +31,11 @@ public:
private:
static void coreDebugCallback(CoreDebugMessageType type, std::string context, std::string message);
static void coreStateCallback(CoreStateCallbackType type, int value);
signals:
void OnCoreDebugCallback(CoreDebugMessageType type, QString context, QString message);
void OnCoreStateCallback(CoreStateCallbackType type, int value);
};
#endif // RMG_CALLBACKS_HPP
+5 -8
View File
@@ -22,25 +22,22 @@ EmulationThread::~EmulationThread(void)
void EmulationThread::SetRomFile(QString file)
{
this->rom_File = file;
this->rom = file;
}
void EmulationThread::SetDiskFile(QString file)
{
this->disk_File = file;
this->disk = file;
}
void EmulationThread::run(void)
{
emit this->on_Emulation_Started();
bool ret;
ret = CoreStartEmulation(this->rom_File.toStdU32String(), this->disk_File.toStdU32String());
bool ret = CoreStartEmulation(this->rom.toStdU32String(), this->disk.toStdU32String());
if (!ret)
{
this->error_Message = QString::fromStdString(CoreGetError());
this->errorMessage = QString::fromStdString(CoreGetError());
}
emit this->on_Emulation_Finished(ret);
@@ -48,5 +45,5 @@ void EmulationThread::run(void)
QString EmulationThread::GetLastError(void)
{
return this->error_Message;
return this->errorMessage;
}
+3 -3
View File
@@ -32,9 +32,9 @@ class EmulationThread : public QThread
QString GetLastError(void);
private:
QString rom_File;
QString disk_File;
QString error_Message;
QString rom;
QString disk;
QString errorMessage;
signals:
void on_Emulation_Started(void);
+14 -14
View File
@@ -70,6 +70,7 @@ void RomSearcherThread::searchDirectory(QString directory)
filter << "*.NDD";
filter << "*.D64";
filter << "*.ZIP";
filter << "*.7Z";
QDirIterator::IteratorFlag flag = this->recursive ?
QDirIterator::Subdirectories :
@@ -82,9 +83,16 @@ void RomSearcherThread::searchDirectory(QString directory)
bool ret;
int count = 0;
QList<QString> roms;
while (romDirIt.hasNext())
{
QString file = romDirIt.next();
roms.push_back(romDirIt.next());
}
int romAmount = std::min(this->maxItems, (int)roms.size());
for (int i = 0; i < romAmount; i++)
{
QString file = roms.at(i);
QElapsedTimer timer;
timer.start();
@@ -95,14 +103,11 @@ void RomSearcherThread::searchDirectory(QString directory)
}
else
{ // no cache entry
// open rom, retrieve rom settings & header
// open rom, retrieve rom settings, header & type
ret = CoreOpenRom(file.toStdU32String()) &&
CoreGetCurrentRomSettings(settings) &&
CoreGetCurrentRomHeader(header);
if (ret)
{
type = CoreGetRomType();
}
CoreGetCurrentRomHeader(header) &&
CoreGetRomType(type);
// always close the ROM,
// even when retrieving rom info failed
ret = CoreCloseRom() && ret;
@@ -111,15 +116,10 @@ void RomSearcherThread::searchDirectory(QString directory)
CoreAddCachedRomHeaderAndSettings(file.toStdU32String(), type, header, settings);
}
}
if (ret)
{
if (count++ >= this->maxItems)
{
break;
}
emit this->RomFound(file, type, header, settings);
emit this->RomFound(file, type, header, settings, (i + 1), romAmount);
}
if (this->stop)
+3 -4
View File
@@ -1,6 +1,3 @@
#ifndef ROMSEARCHERTHREAD_HPP
#define ROMSEARCHERTHREAD_HPP
/*
* Rosalie's Mupen GUI - https://github.com/Rosalie241/RMG
* Copyright (C) 2020 Rosalie Wanders <rosalie@mailbox.org>
@@ -10,6 +7,8 @@
* 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 ROMSEARCHERTHREAD_HPP
#define ROMSEARCHERTHREAD_HPP
#include <QString>
#include <QThread>
@@ -41,7 +40,7 @@ class RomSearcherThread : public QThread
void searchDirectory(QString);
signals:
void RomFound(QString file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings);
void RomFound(QString file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings, int index, int count);
void Finished(bool canceled);
};
} // namespace Thread
@@ -18,6 +18,7 @@
#include <QNetworkReply>
#include <QTemporaryDir>
#include <QFile>
#include <QProcess>
using namespace UserInterface::Dialog;
@@ -79,6 +80,9 @@ void DownloadUpdateDialog::on_reply_finished(void)
return;
}
QString filePath;
#ifndef APPIMAGE_UPDATER
QTemporaryDir temporaryDir;
temporaryDir.setAutoRemove(false);
if (!temporaryDir.isValid())
@@ -90,12 +94,52 @@ void DownloadUpdateDialog::on_reply_finished(void)
}
this->temporaryDirectory = temporaryDir.path();
filePath = temporaryDir.filePath(this->filename);
#else
const char* appImageEnv = std::getenv("APPIMAGE");
if (appImageEnv == nullptr ||
!QFile(appImageEnv).exists())
{
this->showErrorMessage("APPIMAGE variable is empty or invalid!", "");
this->reply->deleteLater();
this->reject();
return;
}
filePath = appImageEnv;
filePath += ".update";
#endif // APPIMAGE_UPDATER
QFile file(filePath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
this->showErrorMessage("QFile::open() Failed!", "");
this->reply->deleteLater();
this->reject();
return;
}
QFile file(temporaryDir.filePath(this->filename));
file.open(QIODevice::WriteOnly);
file.write(this->reply->readAll());
#ifdef APPIMAGE_UPDATER
file.setPermissions(QFile(appImageEnv).permissions());
#endif // APPIMAGE_UPDATER
file.close();
#ifdef APPIMAGE_UPDATER
int ret = std::rename(filePath.toStdString().c_str(), appImageEnv);
if (ret != 0)
{
this->showErrorMessage("std::rename() Failed!", QString(strerror(errno)));
this->reply->deleteLater();
this->reject();
return;
}
QProcess process;
process.setProgram(appImageEnv);
process.startDetached();
#endif // APPIMAGE_UPDATER
this->reply->deleteLater();
this->accept();
}
@@ -39,23 +39,45 @@ void InstallUpdateDialog::install(void)
QString appPath = QCoreApplication::applicationDirPath();
QString appPid = QString::number(QCoreApplication::applicationPid());
QString logPath = appPath + "/Cache/updater.log";
// convert paths to use the right path seperator
this->temporaryDirectory = QDir::toNativeSeparators(this->temporaryDirectory);
fullFilePath = QDir::toNativeSeparators(fullFilePath);
appPath = QDir::toNativeSeparators(appPath);
logPath = QDir::toNativeSeparators(logPath);
// remove log file when it exists
QFile qLogFile(logPath);
if (qLogFile.exists())
{
qLogFile.remove();
}
QString outputToLogLine = " >> \"" + logPath + "\" 2>&1";
#ifdef _WIN32
if (this->filename.endsWith(".exe"))
{
this->label->setText("Executing " + this->filename + "...");
QStringList scriptLines =
QStringList scriptLines =
{
"@echo off",
"taskkill /F /PID:" + appPid,
"\"" + fullFilePath + "\" /CLOSEAPPLICATIONS /SILENT /DIR=\"" + appPath + "\"",
"(",
" echo == Attemping to kill PID " + appPid + outputToLogLine,
" taskkill /F /PID:" + appPid + outputToLogLine,
" echo == Attemping to start \'" + fullFilePath + "\'" + outputToLogLine,
" \"" + fullFilePath + "\" /CLOSEAPPLICATIONS /NOCANCEL /MERGETASKS=\"!desktopicon\" /SILENT /DIR=\"" + appPath + "\"" + outputToLogLine,
")",
"IF NOT ERRORLEVEL 0 (",
" start \"\" cmd /c \"echo Rosalie's Mupen GUI failed to update, check the updater.log file in the Cache directory for more information && pause\"",
")",
// remove temporary directory at last
"rmdir /S /Q \"" + this->temporaryDirectory + "\"",
};
this->writeAndRunScript(scriptLines);
this->accept();
return;
}
#endif // _WIN32
this->label->setText("Extracting " + this->filename + "...");
this->progressBar->setValue(50);
@@ -77,47 +99,40 @@ void InstallUpdateDialog::install(void)
this->showErrorMessage("CoreUnzip() Failed!", QString::fromStdString(CoreGetError()));
this->reject();
return;
}
}
this->label->setText("Executing update script...");
this->progressBar->setValue(100);
#ifdef _WIN32
extractDirectory = QDir::toNativeSeparators(extractDirectory);
QStringList scriptLines =
{
"@echo off",
"del /F /Q \"" + fullFilePath + "\"",
"taskkill /F /PID:" + appPid,
"xcopy /S /Y /I \"" + extractDirectory + "\\*\" \"" + appPath + "/\"",
"start \"\" \"" + appPath + "\\RMG.exe\"",
"rmdir /S /Q \"" + this->temporaryDirectory + "\"",
"(",
" echo == Attempting to remove \'" + fullFilePath + "\'" + outputToLogLine,
" del /F /Q \"" + fullFilePath + "\"" + outputToLogLine,
" echo == Attemping to kill PID " + appPid + outputToLogLine,
" taskkill /F /PID:" + appPid + outputToLogLine,
" echo == Attemping to copy \'" + extractDirectory + "\' to \'" + appPath + "\'" + outputToLogLine,
" xcopy /S /Y /I \"" + extractDirectory + "\\*\" \"" + appPath + "\"" + outputToLogLine,
" echo == Attemping to start \'" + appPath + "\\RMG.exe\'" + outputToLogLine,
" start \"\" \"" + appPath + "\\RMG.exe\"" + outputToLogLine,
")",
"IF NOT ERRORLEVEL 0 (",
" start \"\" cmd /c \"echo Rosalie's Mupen GUI failed to update, check the updater.log file in the Cache directory for more information && pause\"",
")",
// remove temporary directory at last
"rmdir /S /Q \"" + this->temporaryDirectory + "\"",
};
this->writeAndRunScript(scriptLines);
#else // Linux
QStringList scriptLines =
{
"#!/usr/bin/env bash",
"set -e",
"rm -rf \"" + fullFilePath + "\"",
"kill -1 " + appPid,
"cp -R \"" + extractDirectory + "/\"* \"" + appPath + "/\"",
"chmod +x \"" + appPath + "/RMG\"",
"\"" + appPath + "/RMG\"&",
"rm -rf \"" + this->temporaryDirectory + "\"" ,
};
this->writeAndRunScript(scriptLines);
#endif // _WIN32
}
void InstallUpdateDialog::writeAndRunScript(QStringList stringList)
{
QString scriptPath;
scriptPath = this->temporaryDirectory;
#ifdef _WIN32
scriptPath += "/update.bat";
#else
scriptPath += "/update.sh";
#endif // _WIN32
QFile scriptFile(scriptPath);
if (!scriptFile.open(QIODevice::WriteOnly | QIODevice::Text))
@@ -30,7 +30,8 @@ RomInfoDialog::RomInfoDialog(QString file, CoreRomHeader romHeader, CoreRomSetti
this->locationLineEdit->setCursorPosition(0);
this->crc1LineEdit->setText(QString::number(romHeader.CRC1, 16).toUpper());
this->crc2LineEdit->setText(QString::number(romHeader.CRC2, 16).toUpper());
this->countryCodeLineEdit->setText(QString((char)romHeader.CountryCode));
this->gameIDLineEdit->setText(QString::fromStdString(romHeader.GameID));
this->gameRegionLineEdit->setText(QString::fromStdString(romHeader.Region));
}
RomInfoDialog::~RomInfoDialog(void)
@@ -199,12 +199,36 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Country Code</string>
<string>Game I.D.</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="countryCodeLineEdit">
<widget class="QLineEdit" name="gameIDLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Game Region</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="gameRegionLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -214,6 +214,7 @@ void SettingsDialog::loadCoreSettings(void)
bool disableExtraMem = false;
int counterFactor = 0;
int cpuEmulator = 0;
int saveFilenameFormat = 0;
int siDmaDuration = -1;
bool randomizeInterrupt = true;
bool debugger = false;
@@ -222,12 +223,14 @@ void SettingsDialog::loadCoreSettings(void)
disableExtraMem = CoreSettingsGetBoolValue(SettingsID::CoreOverlay_DisableExtraMem);
counterFactor = CoreSettingsGetIntValue(SettingsID::CoreOverlay_CountPerOp);
cpuEmulator = CoreSettingsGetIntValue(SettingsID::CoreOverlay_CPU_Emulator);
saveFilenameFormat = CoreSettingsGetIntValue(SettingsID::CoreOverLay_SaveFileNameFormat);
siDmaDuration = CoreSettingsGetIntValue(SettingsID::CoreOverlay_SiDmaDuration);
randomizeInterrupt = CoreSettingsGetBoolValue(SettingsID::CoreOverlay_RandomizeInterrupt);
debugger = CoreSettingsGetBoolValue(SettingsID::CoreOverlay_EnableDebugger);
overrideGameSettings = CoreSettingsGetBoolValue(SettingsID::Core_OverrideGameSpecificSettings);
this->coreCpuEmulatorComboBox->setCurrentIndex(cpuEmulator);
this->coreSaveFilenameFormatComboBox->setCurrentIndex(saveFilenameFormat);
this->coreRandomizeTimingCheckBox->setChecked(randomizeInterrupt);
//this->coreDebuggerCheckBox->setChecked(debugger);
@@ -385,6 +388,7 @@ void SettingsDialog::loadInterfaceEmulationSettings(void)
void SettingsDialog::loadInterfaceRomBrowserSettings(void)
{
this->searchSubDirectoriesCheckbox->setChecked(CoreSettingsGetBoolValue(SettingsID::RomBrowser_Recursive));
this->sortRomBrowserResultsCheckBox->setChecked(CoreSettingsGetBoolValue(SettingsID::RomBrowser_SortAfterSearch));
this->romSearchLimitSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::RomBrowser_MaxItems));
}
@@ -405,7 +409,24 @@ void SettingsDialog::loadInterfaceOSDSettings(void)
void SettingsDialog::loadInterfaceMiscSettings(void)
{
// find stylesheets and add them to the UI
QString directory;
directory = QString::fromStdString(CoreGetSharedDataDirectory().string());
directory += "/Styles/";
QStringList filter;
filter << "*.qss";
QDirIterator stylesDirectoryIter(directory, filter, QDir::Files, QDirIterator::NoIteratorFlags);
while (stylesDirectoryIter.hasNext())
{
QFileInfo fileInfo(stylesDirectoryIter.next());
this->themeComboBox->addItem(fileInfo.fileName());
}
// select currently chosen theme in UI
this->themeComboBox->setCurrentText(QString::fromStdString(CoreSettingsGetStringValue(SettingsID::GUI_Theme)));
this->iconThemeComboBox->setCurrentText(QString::fromStdString(CoreSettingsGetStringValue(SettingsID::GUI_IconTheme)));
#ifdef UPDATER
this->checkForUpdatesCheckBox->setChecked(CoreSettingsGetBoolValue(SettingsID::GUI_CheckForUpdates));
#endif // UPDATER
@@ -419,6 +440,7 @@ void SettingsDialog::loadDefaultCoreSettings(void)
bool disableExtraMem = false;
int counterFactor = 0;
int cpuEmulator = 0;
int saveFilenameFormat = 0;
int siDmaDuration = -1;
bool randomizeInterrupt = true;
bool debugger = false;
@@ -428,11 +450,13 @@ void SettingsDialog::loadDefaultCoreSettings(void)
counterFactor = CoreSettingsGetDefaultIntValue(SettingsID::CoreOverlay_CountPerOp);
cpuEmulator = CoreSettingsGetDefaultIntValue(SettingsID::CoreOverlay_CPU_Emulator);
siDmaDuration = CoreSettingsGetDefaultIntValue(SettingsID::CoreOverlay_SiDmaDuration);
saveFilenameFormat = CoreSettingsGetDefaultIntValue(SettingsID::CoreOverLay_SaveFileNameFormat);
randomizeInterrupt = CoreSettingsGetDefaultBoolValue(SettingsID::CoreOverlay_RandomizeInterrupt);
debugger = CoreSettingsGetDefaultBoolValue(SettingsID::CoreOverlay_EnableDebugger);
overrideGameSettings = CoreSettingsGetDefaultBoolValue(SettingsID::Core_OverrideGameSpecificSettings);
this->coreCpuEmulatorComboBox->setCurrentIndex(cpuEmulator);
this->coreSaveFilenameFormatComboBox->setCurrentIndex(saveFilenameFormat);
this->coreRandomizeTimingCheckBox->setChecked(randomizeInterrupt);
//this->coreDebuggerCheckBox->setChecked(debugger);
@@ -527,6 +551,7 @@ void SettingsDialog::loadDefaultInterfaceEmulationSettings(void)
void SettingsDialog::loadDefaultInterfaceRomBrowserSettings(void)
{
this->searchSubDirectoriesCheckbox->setChecked(CoreSettingsGetDefaultBoolValue(SettingsID::RomBrowser_Recursive));
this->sortRomBrowserResultsCheckBox->setChecked(CoreSettingsGetDefaultBoolValue(SettingsID::RomBrowser_SortAfterSearch));
this->romSearchLimitSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::RomBrowser_MaxItems));
}
@@ -548,6 +573,7 @@ void SettingsDialog::loadDefaultInterfaceOSDSettings(void)
void SettingsDialog::loadDefaultInterfaceMiscSettings(void)
{
this->themeComboBox->setCurrentText(QString::fromStdString(CoreSettingsGetDefaultStringValue(SettingsID::GUI_Theme)));
this->iconThemeComboBox->setCurrentText(QString::fromStdString(CoreSettingsGetDefaultStringValue(SettingsID::GUI_IconTheme)));
#ifdef UPDATER
this->checkForUpdatesCheckBox->setChecked(CoreSettingsGetDefaultBoolValue(SettingsID::GUI_CheckForUpdates));
#endif // UPDATER
@@ -583,12 +609,14 @@ void SettingsDialog::saveCoreSettings(void)
bool disableExtraMem = (this->coreMemorySizeComboBox->currentIndex() == 0);
int counterFactor = this->coreCounterFactorComboBox->currentIndex() + 1;
int cpuEmulator = this->coreCpuEmulatorComboBox->currentIndex();
int saveFilenameFormat = this->coreSaveFilenameFormatComboBox->currentIndex();
int siDmaDuration = this->coreSiDmaDurationSpinBox->value();
bool randomizeInterrupt = this->coreRandomizeTimingCheckBox->isChecked();
//bool debugger = this->coreDebuggerCheckBox->isChecked();
bool overrideGameSettings = this->coreOverrideGameSettingsGroup->isChecked();
CoreSettingsSetValue(SettingsID::CoreOverlay_CPU_Emulator, cpuEmulator);
CoreSettingsSetValue(SettingsID::CoreOverLay_SaveFileNameFormat, saveFilenameFormat);
CoreSettingsSetValue(SettingsID::CoreOverlay_RandomizeInterrupt, randomizeInterrupt);
//CoreSettingsSetValue(SettingsID::CoreOverlay_EnableDebugger, debugger);
CoreSettingsSetValue(SettingsID::Core_OverrideGameSpecificSettings, overrideGameSettings);
@@ -730,6 +758,7 @@ void SettingsDialog::saveInterfaceEmulationSettings(void)
void SettingsDialog::saveInterfaceRomBrowserSettings(void)
{
CoreSettingsSetValue(SettingsID::RomBrowser_Recursive, this->searchSubDirectoriesCheckbox->isChecked());
CoreSettingsSetValue(SettingsID::RomBrowser_SortAfterSearch, this->sortRomBrowserResultsCheckBox->isChecked());
CoreSettingsSetValue(SettingsID::RomBrowser_MaxItems, this->romSearchLimitSpinBox->value());
}
@@ -751,6 +780,7 @@ void SettingsDialog::saveInterfaceOSDSettings(void)
void SettingsDialog::saveInterfaceMiscSettings(void)
{
CoreSettingsSetValue(SettingsID::GUI_Theme, this->themeComboBox->currentText().toStdString());
CoreSettingsSetValue(SettingsID::GUI_IconTheme, this->iconThemeComboBox->currentText().toStdString());
#ifdef UPDATER
CoreSettingsSetValue(SettingsID::GUI_CheckForUpdates, this->checkForUpdatesCheckBox->isChecked());
#endif // UPDATER
@@ -789,6 +819,22 @@ void SettingsDialog::commonHotkeySettings(SettingsDialogAction action)
{ this->gsButtonKeyButton, SettingsID::KeyBinding_GSButton },
};
std::vector<keybinding> keybindings_SpeedFactor =
{
{ this->speedFactor25KeyButton, SettingsID::KeyBinding_SpeedFactor25 },
{ this->speedFactor50KeyButton, SettingsID::KeyBinding_SpeedFactor50 },
{ this->speedFactor75KeyButton, SettingsID::KeyBinding_SpeedFactor75 },
{ this->speedFactor100KeyButton, SettingsID::KeyBinding_SpeedFactor100 },
{ this->speedFactor125KeyButton, SettingsID::KeyBinding_SpeedFactor125 },
{ this->speedFactor150KeyButton, SettingsID::KeyBinding_SpeedFactor150 },
{ this->speedFactor175KeyButton, SettingsID::KeyBinding_SpeedFactor175 },
{ this->speedFactor200KeyButton, SettingsID::KeyBinding_SpeedFactor200 },
{ this->speedFactor225KeyButton, SettingsID::KeyBinding_SpeedFactor225 },
{ this->speedFactor250KeyButton, SettingsID::KeyBinding_SpeedFactor250 },
{ this->speedFactor275KeyButton, SettingsID::KeyBinding_SpeedFactor275 },
{ this->speedFactor300KeyButton, SettingsID::KeyBinding_SpeedFactor300 },
};
std::vector<keybinding> keybindings_CurrentSaveState =
{
{ this->saveState0KeyButton, SettingsID::KeyBinding_SaveStateSlot0 },
@@ -805,12 +851,17 @@ void SettingsDialog::commonHotkeySettings(SettingsDialogAction action)
std::vector<keybinding> keybindings_Settings =
{
{ this->graphicsSettingsKeyButton, SettingsID::KeyBinding_GraphicsSettings },
{ this->audioSettingsKeyButton, SettingsID::KeyBinding_AudioSettings },
{ this->rspSettingsKeyButton, SettingsID::KeyBinding_RspSettings },
{ this->inputSettingsKeyButton, SettingsID::KeyBinding_InputSettings },
{ this->settingsKeyButton, SettingsID::KeyBinding_Settings },
};
std::vector<keybinding> keybindings_View =
{
{ this->fullscreenKeyButton, SettingsID::KeyBinding_Fullscreen },
{ this->logKeyButton, SettingsID::Keybinding_ViewLog },
{ this->refreshRomListKeyButton, SettingsID::KeyBinding_RefreshROMList }
};
@@ -825,12 +876,15 @@ void SettingsDialog::commonHotkeySettings(SettingsDialogAction action)
keybindings.insert(keybindings.end(), keybindings_System.begin(), keybindings_System.end());
break;
case 1:
keybindings.insert(keybindings.end(), keybindings_CurrentSaveState.begin(), keybindings_CurrentSaveState.end());
keybindings.insert(keybindings.end(), keybindings_SpeedFactor.begin(), keybindings_SpeedFactor.end());
break;
case 2:
keybindings.insert(keybindings.end(), keybindings_Settings.begin(), keybindings_Settings.end());
keybindings.insert(keybindings.end(), keybindings_CurrentSaveState.begin(), keybindings_CurrentSaveState.end());
break;
case 3:
keybindings.insert(keybindings.end(), keybindings_Settings.begin(), keybindings_Settings.end());
break;
case 4:
keybindings.insert(keybindings.end(), keybindings_View.begin(), keybindings_View.end());
break;
}
@@ -838,6 +892,7 @@ void SettingsDialog::commonHotkeySettings(SettingsDialogAction action)
else
{
keybindings.insert(keybindings.end(), keybindings_System.begin(), keybindings_System.end());
keybindings.insert(keybindings.end(), keybindings_SpeedFactor.begin(), keybindings_SpeedFactor.end());
keybindings.insert(keybindings.end(), keybindings_CurrentSaveState.begin(), keybindings_CurrentSaveState.end());
keybindings.insert(keybindings.end(), keybindings_Settings.begin(), keybindings_Settings.end());
keybindings.insert(keybindings.end(), keybindings_View.begin(), keybindings_View.end());
@@ -888,7 +943,7 @@ void SettingsDialog::commonPluginSettings(SettingsDialogAction action)
bool pluginFound[] = {false, false, false, false};
QComboBox *comboBox;
std::string pluginFileName;
QString pluginFileName;
int index = 0;
// clear combobox items
@@ -903,12 +958,15 @@ void SettingsDialog::commonPluginSettings(SettingsDialogAction action)
comboBox = comboBoxArray[index];
pluginFileName = action == SettingsDialogAction::LoadSettings ?
CoreSettingsGetStringValue(settingsIdArray[index]) :
CoreSettingsGetDefaultStringValue(settingsIdArray[index]);
QString::fromStdString(CoreSettingsGetStringValue(settingsIdArray[index])) :
QString::fromStdString(CoreSettingsGetDefaultStringValue(settingsIdArray[index]));
// account for full path (<v0.3.5 we used the full path)
pluginFileName = QFileInfo(pluginFileName).fileName();
comboBox->addItem(QString::fromStdString(p.Name), QString::fromStdString(p.File));
if (pluginFileName == p.File)
if (pluginFileName == QString::fromStdString(p.File))
{
comboBox->setCurrentText(QString::fromStdString(p.Name));
pluginFound[index] = true;
@@ -931,7 +989,7 @@ void SettingsDialog::setIconsForEmulationInfoText(void)
QLabel* labels[] = {
this->infoIconLabel_0, this->infoIconLabel_1, this->infoIconLabel_2,
this->infoIconLabel_3, this->infoIconLabel_4, this->infoIconLabel_5,
this->infoIconLabel_7
this->infoIconLabel_7, this->infoIconLabel_6, this->infoIconLabel_8
};
QIcon infoIcon = QIcon::fromTheme("information-line");
@@ -1145,7 +1203,12 @@ void SettingsDialog::on_KeybindButton_KeybindingChanged(KeybindButton* button)
this->startComboKeyButton,
this->shutdownKeyButton,
this->exitKeyButton,
this->graphicsSettingsKeyButton,
this->audioSettingsKeyButton,
this->rspSettingsKeyButton,
this->inputSettingsKeyButton,
this->settingsKeyButton,
this->logKeyButton,
this->refreshRomListKeyButton,
};
@@ -1157,6 +1220,18 @@ void SettingsDialog::on_KeybindButton_KeybindingChanged(KeybindButton* button)
this->pauseKeyButton,
this->generateBitmapKeyButton,
this->limitFPSKeyButton,
this->speedFactor25KeyButton,
this->speedFactor50KeyButton,
this->speedFactor75KeyButton,
this->speedFactor100KeyButton,
this->speedFactor125KeyButton,
this->speedFactor150KeyButton,
this->speedFactor175KeyButton,
this->speedFactor200KeyButton,
this->speedFactor225KeyButton,
this->speedFactor250KeyButton,
this->speedFactor275KeyButton,
this->speedFactor300KeyButton,
this->saveStateKeyButton,
this->saveAsKeyButton,
this->loadStateKeyButton,
@@ -1174,7 +1249,12 @@ void SettingsDialog::on_KeybindButton_KeybindingChanged(KeybindButton* button)
this->saveState8KeyButton,
this->saveState9KeyButton,
this->exitKeyButton,
this->graphicsSettingsKeyButton,
this->audioSettingsKeyButton,
this->rspSettingsKeyButton,
this->inputSettingsKeyButton,
this->settingsKeyButton,
this->logKeyButton,
this->fullscreenKeyButton,
};
@@ -184,6 +184,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="sortRomBrowserResultsCheckBox">
<property name="text">
<string>Sort Results After Search</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@@ -400,7 +407,7 @@
<attribute name="title">
<string>Miscellaneous</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
@@ -431,6 +438,36 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>Icon Theme</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="iconThemeComboBox">
<item>
<property name="text">
<string>Automatic</string>
</property>
</item>
<item>
<property name="text">
<string>White</string>
</property>
</item>
<item>
<property name="text">
<string>Black</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkForUpdatesCheckBox">
<property name="text">
@@ -824,6 +861,242 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="speedFactorTab">
<attribute name="title">
<string>Speed Factor</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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="KeybindButton" 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>
</layout>
</widget>
<widget class="QWidget" name="currentSaveStateTab">
<attribute name="title">
<string>Current Save State</string>
@@ -1028,7 +1301,79 @@
<attribute name="title">
<string>Settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_37">
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_92">
<item>
<widget class="QLabel" name="label_85">
<property name="text">
<string>Graphics</string>
</property>
</widget>
</item>
<item>
<widget class="KeybindButton" name="graphicsSettingsKeyButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_93">
<item>
<widget class="QLabel" name="label_87">
<property name="text">
<string>Audio</string>
</property>
</widget>
</item>
<item>
<widget class="KeybindButton" name="audioSettingsKeyButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_94">
<item>
<widget class="QLabel" name="label_89">
<property name="text">
<string>RSP</string>
</property>
</widget>
</item>
<item>
<widget class="KeybindButton" name="rspSettingsKeyButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_117">
<item>
<widget class="QLabel" name="label_90">
<property name="text">
<string>Input</string>
</property>
</widget>
</item>
<item>
<widget class="KeybindButton" name="inputSettingsKeyButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_87">
<item>
@@ -1085,6 +1430,24 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_118">
<item>
<widget class="QLabel" name="label_114">
<property name="text">
<string>Log</string>
</property>
</widget>
</item>
<item>
<widget class="KeybindButton" name="logKeyButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_73">
<item>
@@ -1137,7 +1500,7 @@
<attribute name="title">
<string>Core</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_19">
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_43">
<item>
@@ -1168,6 +1531,31 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_46">
<item>
<widget class="QLabel" name="label_25">
<property name="text">
<string>Save Filename Format</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="coreSaveFilenameFormatComboBox">
<item>
<property name="text">
<string>Internal ROM Name</string>
</property>
</item>
<item>
<property name="text">
<string>Automatic</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="coreOverrideGameSettingsGroup">
<property name="enabled">
@@ -1685,7 +2073,7 @@
<attribute name="title">
<string>Plugins</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_24">
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="QGroupBox" name="groupBox_19">
<property name="enabled">
@@ -1817,6 +2205,51 @@
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="emulationInfoLayout_6">
<item>
<widget class="QLabel" name="infoIconLabel_8">
<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_68">
<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>Make sure to use a LLE RSP plugin (i.e paraLLEl RSP) when using a LLE Video plugin (i.e paraLLEl)</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
@@ -1869,7 +2302,7 @@
<attribute name="title">
<string>Plugins</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_25">
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QGroupBox" name="groupBox_25">
<property name="title">
@@ -1968,6 +2401,51 @@
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="emulationInfoLayout_4">
<item>
<widget class="QLabel" name="infoIconLabel_6">
<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_64">
<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>Make sure to use a LLE RSP plugin (i.e paraLLEl RSP) when using a LLE Video plugin (i.e paraLLEl)</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="emulationInfoLayout_1">
<item>
@@ -23,7 +23,7 @@
using namespace UserInterface::Dialog;
UpdateDialog::UpdateDialog(QWidget *parent, QJsonObject jsonObject) : QDialog(parent)
UpdateDialog::UpdateDialog(QWidget *parent, QJsonObject jsonObject, bool forced) : QDialog(parent)
{
this->setupUi(this);
@@ -35,6 +35,10 @@ UpdateDialog::UpdateDialog(QWidget *parent, QJsonObject jsonObject) : QDialog(pa
// change ok button text to 'Update'
QPushButton* button = this->buttonBox->button(QDialogButtonBox::Ok);
button->setText("Update");
// don't show the 'Don't check for updates again' checkbox,
// when the user requested we check for updates
this->disableUpdateCheckCheckBox->setHidden(forced);
}
UpdateDialog::~UpdateDialog(void)
@@ -36,7 +36,7 @@ class UpdateDialog : public QDialog, private Ui::UpdateDialog
#endif // _WIN32
public:
UpdateDialog(QWidget *parent, QJsonObject jsonObject);
UpdateDialog(QWidget *parent, QJsonObject jsonObject, bool forced);
~UpdateDialog(void);
QString GetFileName(void);
File diff suppressed because it is too large Load Diff
+64 -44
View File
@@ -47,19 +47,19 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
MainWindow(void);
~MainWindow(void);
bool Init(QApplication*);
void OpenROM(QString, QString, bool, bool);
bool Init(QApplication* app, bool showUI);
void OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation);
private:
Thread::EmulationThread *emulationThread;
Thread::EmulationThread *emulationThread = nullptr;
CoreCallbacks* coreCallBacks;
CoreCallbacks* coreCallBacks = nullptr;
QStackedWidget *ui_Widgets;
Widget::OGLWidget *ui_Widget_OpenGL;
Widget::RomBrowserWidget *ui_Widget_RomBrowser;
EventFilter *ui_EventFilter;
QLabel *ui_StatusBar_Label;
QStackedWidget *ui_Widgets = nullptr;
Widget::OGLWidget *ui_Widget_OpenGL = nullptr;
Widget::RomBrowserWidget *ui_Widget_RomBrowser = nullptr;
EventFilter *ui_EventFilter = nullptr;
QLabel *ui_StatusBar_Label = nullptr;
QByteArray ui_Geometry;
bool ui_Geometry_Maximized = false;
@@ -73,16 +73,26 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
bool ui_QuitAfterEmulation = false;
bool ui_RefreshRomListAfterEmulation = false;
bool ui_ShowUI = false;
bool ui_ShowMenubar = false;
bool ui_ShowToolbar = false;
bool ui_ShowStatusbar = false;
bool ui_ManuallyPaused = true;
QList<QAction*> ui_Actions;
bool ui_AddedActions = false;
QList<QAction*> ui_SlotActions;
bool ui_SilentUpdateCheck = false;
int ui_TimerId = 0;
int ui_TimerTimeout = 0;
int ui_FullscreenTimerId = 0;
int ui_GamesharkButtonTimerId = 0;
int ui_UpdateSaveStateSlotTimerId = 0;
QString ui_WindowTitle;
@@ -91,43 +101,49 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void closeEvent(QCloseEvent *) Q_DECL_OVERRIDE;
void initializeUI();
void configureUI(QApplication*);
void configureTheme(QApplication*);
void showErrorMessage(QString, QString);
void updateUI(bool, bool);
void configureUI(QApplication* app, bool showUI);
void configureTheme(QApplication* app);
void showErrorMessage(QString text, QString details = "");
void updateUI(bool inEmulation, bool isPaused);
void storeGeometry(void);
void loadGeometry(void);
void initializeEmulationThread(void);
void connectEmulationThreadSignals(void);
void launchEmulationThread(QString, QString);
void launchEmulationThread(QString);
void launchEmulationThread(QString cartRom, QString diskRom = "");
QString getSaveStateSlotDateTimeText(QAction* action);
QString getSaveStateSlotText(QAction* action, int slot);
int getToolbarSettingAreaFromArea(Qt::ToolBarArea area);
Qt::ToolBarArea getToolbarAreaFromSettingArea(int value);
void configureActions(void);
void connectActionSignals(void);
void updateActions(bool, bool);
void updateActions(bool inEmulation, bool isPaused);
void updateSaveStateSlotActions(bool inEmulation, bool isPaused);
void addFullscreenActions(void);
void removeFullscreenActions(void);
void addActions(void);
void removeActions(void);
#ifdef UPDATER
void checkForUpdates(void);
void checkForUpdates(bool silent, bool force);
#endif // UPDATER
protected:
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
private slots:
void on_EventFilter_KeyPressed(QKeyEvent *);
void on_EventFilter_KeyReleased(QKeyEvent *);
void on_EventFilter_KeyPressed(QKeyEvent *event);
void on_EventFilter_KeyReleased(QKeyEvent *event);
void on_QGuiApplication_applicationStateChanged(Qt::ApplicationState);
void on_QGuiApplication_applicationStateChanged(Qt::ApplicationState state);
#ifdef UPDATER
void on_networkAccessManager_Finished(QNetworkReply *);
void on_networkAccessManager_Finished(QNetworkReply *reply);
#endif // UPDATER
void on_Action_System_OpenRom(void);
@@ -138,11 +154,12 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void on_Action_System_Pause(void);
void on_Action_System_Screenshot(void);
void on_Action_System_LimitFPS(void);
void on_Action_System_SpeedFactor(int factor);
void on_Action_System_SaveState(void);
void on_Action_System_SaveAs(void);
void on_Action_System_LoadState(void);
void on_Action_System_Load(void);
void on_Action_System_CurrentSaveState(int);
void on_Action_System_CurrentSaveState(int slot);
void on_Action_System_Cheats(void);
void on_Action_System_GSButton(void);
void on_Action_System_Exit(void);
@@ -153,11 +170,11 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void on_Action_Settings_Input(void);
void on_Action_Settings_Settings(void);
void on_Action_View_Toolbar(bool);
void on_Action_View_StatusBar(bool);
void on_Action_View_GameList(bool);
void on_Action_View_GameGrid(bool);
void on_Action_View_UniformSize(bool);
void on_Action_View_Toolbar(bool checked);
void on_Action_View_StatusBar(bool checked);
void on_Action_View_GameList(bool checked);
void on_Action_View_GameGrid(bool checked);
void on_Action_View_UniformSize(bool checked);
void on_Action_View_Fullscreen(void);
void on_Action_View_RefreshRoms(void);
void on_Action_View_ClearRomCache(void);
@@ -165,27 +182,30 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
void on_Action_Help_Github(void);
void on_Action_Help_About(void);
void on_Action_Help_Update(void);
void on_Emulation_Started(void);
void on_Emulation_Finished(bool);
void on_Emulation_Finished(bool ret);
void on_RomBrowser_PlayGame(QString);
void on_RomBrowser_PlayGameWith(CoreRomType, QString);
void on_RomBrowser_PlayGame(QString file);
void on_RomBrowser_PlayGameWith(CoreRomType type, QString file);
void on_RomBrowser_ChangeRomDirectory(void);
void on_RomBrowser_RomInformation(QString);
void on_RomBrowser_EditGameSettings(QString);
void on_RomBrowser_Cheats(QString);
void on_RomBrowser_RomInformation(QString file);
void on_RomBrowser_EditGameSettings(QString file);
void on_RomBrowser_EditGameInputSettings(QString file);
void on_RomBrowser_Cheats(QString file);
public slots:
void on_VidExt_Init(void);
void on_VidExt_SetupOGL(QSurfaceFormat, QThread *);
void on_VidExt_SetWindowedMode(int, int, int, int);
void on_VidExt_SetFullscreenMode(int, int, int, int);
void on_VidExt_ResizeWindow(int, int);
void on_VidExt_ToggleFS(bool);
void on_VidExt_SetupOGL(QSurfaceFormat format, QThread *thread);
void on_VidExt_SetWindowedMode(int width, int height, int bps, int flags);
void on_VidExt_SetFullscreenMode(int width, int height, int bps, int flags);
void on_VidExt_ResizeWindow(int width, int height);
void on_VidExt_ToggleFS(bool fullscreen);
void on_Core_DebugCallback(CoreDebugMessageType, QString, QString);
void on_Core_DebugCallback(CoreDebugMessageType type, QString context, QString message);
void on_Core_StateCallback(CoreStateCallbackType type, int value);
};
} // namespace UserInterface
+103 -1
View File
@@ -63,6 +63,30 @@
<addaction name="actionSlot_8"/>
<addaction name="actionSlot_9"/>
</widget>
<widget class="QMenu" name="menuSpeedFactor">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Speed Factor</string>
</property>
<property name="icon">
<iconset theme="speed-line">
<normaloff>.</normaloff>.</iconset>
</property>
<addaction name="actionSpeed25"/>
<addaction name="actionSpeed50"/>
<addaction name="actionSpeed75"/>
<addaction name="actionSpeed100"/>
<addaction name="actionSpeed125"/>
<addaction name="actionSpeed150"/>
<addaction name="actionSpeed175"/>
<addaction name="actionSpeed200"/>
<addaction name="actionSpeed225"/>
<addaction name="actionSpeed250"/>
<addaction name="actionSpeed275"/>
<addaction name="actionSpeed300"/>
</widget>
<addaction name="action_System_StartRom"/>
<addaction name="action_System_OpenCombo"/>
<addaction name="separator"/>
@@ -73,6 +97,7 @@
<addaction name="action_System_Screenshot"/>
<addaction name="separator"/>
<addaction name="action_System_LimitFPS"/>
<addaction name="menuSpeedFactor"/>
<addaction name="separator"/>
<addaction name="action_System_SaveState"/>
<addaction name="action_System_SaveAs"/>
@@ -122,6 +147,8 @@
</property>
<addaction name="action_Help_Github"/>
<addaction name="separator"/>
<addaction name="action_Help_Update"/>
<addaction name="separator"/>
<addaction name="action_Help_About"/>
</widget>
<addaction name="menuSystem"/>
@@ -135,11 +162,14 @@
<string>toolBar</string>
</property>
<property name="movable">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@@ -532,6 +562,78 @@
<string>Uniform Size (Grid View)</string>
</property>
</action>
<action name="actionSpeed25">
<property name="checkable">
<bool>false</bool>
</property>
<property name="text">
<string>25%</string>
</property>
</action>
<action name="actionSpeed50">
<property name="text">
<string>50%</string>
</property>
</action>
<action name="actionSpeed100">
<property name="text">
<string>100%</string>
</property>
</action>
<action name="actionSpeed125">
<property name="text">
<string>125%</string>
</property>
</action>
<action name="actionSpeed150">
<property name="text">
<string>150%</string>
</property>
</action>
<action name="actionSpeed200">
<property name="text">
<string>200%</string>
</property>
</action>
<action name="actionSpeed75">
<property name="text">
<string>75%</string>
</property>
</action>
<action name="actionSpeed175">
<property name="text">
<string>175%</string>
</property>
</action>
<action name="actionSpeed225">
<property name="text">
<string>225%</string>
</property>
</action>
<action name="actionSpeed250">
<property name="text">
<string>250%</string>
</property>
</action>
<action name="actionSpeed275">
<property name="text">
<string>275%</string>
</property>
</action>
<action name="actionSpeed300">
<property name="text">
<string>300%</string>
</property>
</action>
<action name="action_Help_Update">
<property name="icon">
<iconset theme="download-line">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Check For Updates</string>
</property>
</action>
</widget>
<resources>
<include location="UIResources.qrc"/>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 19h18v2H3v-2zm10-5.828L19.071 7.1l1.414 1.414L12 17 3.515 8.515 4.929 7.1 11 13.17V2h2v11.172z"/></svg>

After

Width:  |  Height:  |  Size: 235 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 19h18v2H3v-2zm10-5.828L19.071 7.1l1.414 1.414L12 17 3.515 8.515 4.929 7.1 11 13.17V2h2v11.172z" fill="#ffffff"/></svg>

After

Width:  |  Height:  |  Size: 250 B

+2
View File
@@ -11,6 +11,7 @@
<file alias="icons/black/svg/delete-back-line.svg">Resource/icons/black/svg/delete-back-line.svg</file>
<file alias="icons/black/svg/delete-bin-line.svg">Resource/icons/black/svg/delete-bin-line.svg</file>
<file alias="icons/black/svg/door-open-line.svg">Resource/icons/black/svg/door-open-line.svg</file>
<file alias="icons/black/svg/download-line.svg">Resource/icons/black/svg/download-line.svg</file>
<file alias="icons/black/svg/file-line.svg">Resource/icons/black/svg/file-line.svg</file>
<file alias="icons/black/svg/file-list-line.svg">Resource/icons/black/svg/file-list-line.svg</file>
<file alias="icons/black/svg/folder-open-line.svg">Resource/icons/black/svg/folder-open-line.svg</file>
@@ -40,6 +41,7 @@
<file alias="icons/white/svg/delete-back-line.svg">Resource/icons/white/svg/delete-back-line.svg</file>
<file alias="icons/white/svg/delete-bin-line.svg">Resource/icons/white/svg/delete-bin-line.svg</file>
<file alias="icons/white/svg/door-open-line.svg">Resource/icons/white/svg/door-open-line.svg</file>
<file alias="icons/white/svg/download-line.svg">Resource/icons/white/svg/download-line.svg</file>
<file alias="icons/white/svg/file-line.svg">Resource/icons/white/svg/file-line.svg</file>
<file alias="icons/white/svg/file-list-line.svg">Resource/icons/white/svg/file-list-line.svg</file>
<file alias="icons/white/svg/folder-open-line.svg">Resource/icons/white/svg/folder-open-line.svg</file>
@@ -65,9 +65,11 @@ void OGLWidget::resizeEvent(QResizeEvent *event)
void OGLWidget::timerEvent(QTimerEvent *event)
{
CoreSetVideoSize(this->width, this->height);
// remove current timer
this->killTimer(this->timerId);
this->timerId = 0;
// only remove current timer
// when setting the video size succeeds
if (CoreSetVideoSize(this->width, this->height))
{
this->killTimer(this->timerId);
this->timerId = 0;
}
}
@@ -11,6 +11,7 @@
#include <QLabel>
#include <QHBoxLayout>
#include <QTimerEvent>
using namespace UserInterface::Widget;
@@ -36,6 +37,12 @@ void RomBrowserLoadingWidget::SetWidgetIndex(int index)
this->widgetIndex = index;
}
void RomBrowserLoadingWidget::SetCurrentRomIndex(int index, int count)
{
this->romIndex = index;
this->romCount = count;
}
void RomBrowserLoadingWidget::on_RomBrowserWidget_currentChanged(int index)
{
// start timer when it isnt running
@@ -45,6 +52,12 @@ void RomBrowserLoadingWidget::on_RomBrowserWidget_currentChanged(int index)
{
if (this->loadingLabelTimerId == -1)
{
this->dotCount = 0;
this->romIndex = 0;
this->romCount = 0;
this->elapsedTimeSinceLoading.start();
// reset loading text
this->updateLoadingText();
this->loadingLabelTimerId = this->startTimer(1000);
}
}
@@ -52,20 +65,52 @@ void RomBrowserLoadingWidget::on_RomBrowserWidget_currentChanged(int index)
{
if (this->loadingLabelTimerId != -1)
{
this->elapsedTimeSinceLoading.invalidate();
this->killTimer(this->loadingLabelTimerId);
this->loadingLabelTimerId = -1;
}
}
}
void RomBrowserLoadingWidget::timerEvent(QTimerEvent *event)
void RomBrowserLoadingWidget::updateLoadingText()
{
if (this->loadingLabel->text().size() >= 10)
QString loadingText = "Loading";
if (this->elapsedTimeSinceLoading.isValid() &&
this->elapsedTimeSinceLoading.elapsed() >= 5000)
{
this->loadingLabel->setText("Loading");
QString romCountString = QString::number(this->romCount);
loadingText += " [";
loadingText += QString::number(this->romIndex).rightJustified(romCountString.size(), '0', false);
loadingText += "/";
loadingText += romCountString;
loadingText += "]";
}
if (dotCount <= 3)
{
for (int i = 0; i < dotCount; i++)
{
loadingText += ".";
}
dotCount++;
}
else
{
this->loadingLabel->setText(this->loadingLabel->text() + ".");
dotCount = 1;
}
this->loadingLabel->setText(loadingText);
}
void RomBrowserLoadingWidget::timerEvent(QTimerEvent *event)
{
if (event->timerId() != this->loadingLabelTimerId)
{
return;
}
this->updateLoadingText();
}
@@ -12,6 +12,7 @@
#include <QWidget>
#include <QLabel>
#include <QElapsedTimer>
namespace UserInterface
{
@@ -26,6 +27,8 @@ public:
void SetWidgetIndex(int index);
void SetCurrentRomIndex(int index, int count);
public slots:
void on_RomBrowserWidget_currentChanged(int index);
@@ -33,6 +36,13 @@ private:
QLabel* loadingLabel;
int loadingLabelTimerId = -1;
int widgetIndex = -1;
int romIndex = 0;
int romCount = 0;
int dotCount = 0;
QElapsedTimer elapsedTimeSinceLoading;
void updateLoadingText();
protected:
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
@@ -89,28 +89,47 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->listViewWidget->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel);
this->listViewWidget->verticalHeader()->hide();
this->listViewWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
this->listViewWidget->horizontalHeader()->setSectionsMovable(true);
this->listViewWidget->horizontalHeader()->setFirstSectionMovable(true);
this->listViewWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
this->listViewWidget->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
this->listViewWidget->horizontalHeader()->setStretchLastSection(true);
this->listViewWidget->horizontalHeader()->setSortIndicatorShown(false);
this->listViewWidget->horizontalHeader()->setHighlightSections(false);
this->listViewWidget->horizontalHeader()->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
this->addWidget(this->listViewWidget);
connect(this->listViewWidget, &QTableView::doubleClicked, this, &RomBrowserWidget::on_DoubleClicked);
connect(this->listViewWidget, &QTableView::customContextMenuRequested, this, &RomBrowserListViewWidget::customContextMenuRequested);
connect(this->listViewWidget->horizontalHeader(), &QHeaderView::sortIndicatorChanged, this, &RomBrowserWidget::on_listViewWidget_sortIndicatorChanged);
connect(this->listViewWidget->horizontalHeader(), &QHeaderView::sectionResized, this, &RomBrowserWidget::on_listViewWidget_sectionResized);
connect(this->listViewWidget->horizontalHeader(), &QHeaderView::sectionMoved, this, &RomBrowserWidget::on_listViewWidget_sectionMoved);
connect(this->listViewWidget->horizontalHeader(), &QHeaderView::customContextMenuRequested, this, &RomBrowserWidget::on_listViewWidget_headerContextMenuRequested);
connect(this->listViewWidget, &Widget::RomBrowserListViewWidget::ZoomIn, this, &RomBrowserWidget::on_ZoomIn);
connect(this->listViewWidget, &Widget::RomBrowserListViewWidget::ZoomOut, this, &RomBrowserWidget::on_ZoomOut);
// TODO
// set up list view's columns
QStringList labels;
labels << "Name";
labels << "Internal Name";
labels << "MD5";
labels << "Format";
labels << "File Name";
labels << "File Ext.";
labels << "File Size";
labels << "I.D.";
labels << "Region";
this->listViewModel->setColumnCount(labels.size());
this->listViewModel->setHorizontalHeaderLabels(labels);
// set full names of list view's columns
this->columnNames << labels.at(0);
this->columnNames << labels.at(1);
this->columnNames << labels.at(2);
this->columnNames << "Game Format";
this->columnNames << labels.at(4);
this->columnNames << "File Extension";
this->columnNames << labels.at(6);
this->columnNames << "Game I.D.";
this->columnNames << "Game Region";
// configure grid view widget
this->gridViewWidget = new Widget::RomBrowserGridViewWidget(this);
this->gridViewModel = new QStandardItemModel(this);
@@ -126,14 +145,12 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->gridViewWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
this->gridViewWidget->verticalScrollBar()->setSingleStep(15);
this->gridViewWidget->setWordWrap(true);
this->gridViewWidget->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
this->gridViewWidget->setFrameStyle(QFrame::NoFrame);
int iconWidth = CoreSettingsGetIntValue(SettingsID::RomBrowser_GridViewIconWidth);
int iconHeight = CoreSettingsGetIntValue(SettingsID::RomBrowser_GridViewIconHeight);
this->gridViewWidget->setIconSize(QSize(iconWidth, iconHeight));
this->addWidget(this->gridViewWidget);
connect(this->gridViewWidget, &QListView::doubleClicked, this, &RomBrowserWidget::on_DoubleClicked);
connect(this->gridViewWidget, &QListView::customContextMenuRequested, this, &RomBrowserListViewWidget::customContextMenuRequested);
connect(this->gridViewWidget, &QListView::iconSizeChanged, this, &RomBrowserWidget::on_gridViewWidget_iconSizeChanged);
connect(this->gridViewWidget, &Widget::RomBrowserGridViewWidget::ZoomIn, this, &RomBrowserWidget::on_ZoomIn);
connect(this->gridViewWidget, &Widget::RomBrowserGridViewWidget::ZoomOut, this, &RomBrowserWidget::on_ZoomOut);
@@ -142,7 +159,8 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
connect(this, &QStackedWidget::customContextMenuRequested, this, &RomBrowserWidget::customContextMenuRequested);
// configure context menu actions
// define context menu and its contents
this->contextMenu = new QMenu(this);
this->action_PlayGame = new QAction(this);
this->action_PlayGameWith = new QAction(this);
this->action_RefreshRomList = new QAction(this);
@@ -150,9 +168,17 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->action_ChangeRomDirectory = new QAction(this);
this->action_RomInformation = new QAction(this);
this->action_EditGameSettings = new QAction(this);
this->action_EditGameInputSettings = new QAction(this);
this->action_EditCheats = new QAction(this);
this->action_ResetColumnSizes = new QAction(this);
this->action_SetCoverImage = new QAction(this);
this->action_RemoveCoverImage = new QAction(this);
// define columns menu and its contents
this->menu_Columns = new QMenu(this);
this->action_ColumnsMenuEntry = new QAction(this);
// configure context menu contents
this->action_PlayGame->setText("Play Game");
this->action_PlayGameWith->setText("Play Game with Disk");
this->action_RefreshRomList->setText("Refresh ROM List");
@@ -160,7 +186,10 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->action_ChangeRomDirectory->setText("Change ROM Directory...");
this->action_RomInformation->setText("ROM Information");
this->action_EditGameSettings->setText("Edit Game Settings");
this->action_EditGameInputSettings->setText("Edit Game Input Settings");
this->action_EditCheats->setText("Edit Cheats");
this->action_ResetColumnSizes->setText("Reset Column Sizes");
this->menu_Columns->menuAction()->setText("Show/Hide Columns");
this->action_SetCoverImage->setText("Set Cover Image...");
this->action_RemoveCoverImage->setText("Remove Cover Image");
connect(this->action_PlayGame, &QAction::triggered, this, &RomBrowserWidget::on_Action_PlayGame);
@@ -170,12 +199,13 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
connect(this->action_ChangeRomDirectory, &QAction::triggered, this, &RomBrowserWidget::on_Action_ChangeRomDirectory);
connect(this->action_RomInformation, &QAction::triggered, this, &RomBrowserWidget::on_Action_RomInformation);
connect(this->action_EditGameSettings, &QAction::triggered, this, &RomBrowserWidget::on_Action_EditGameSettings);
connect(this->action_EditGameInputSettings, &QAction::triggered, this, &RomBrowserWidget::on_Action_EditGameInputSettings);
connect(this->action_EditCheats, &QAction::triggered, this, &RomBrowserWidget::on_Action_EditCheats);
connect(this->action_ResetColumnSizes, &QAction::triggered, this, &RomBrowserWidget::on_Action_ResetColumnSizes);
connect(this->action_SetCoverImage, &QAction::triggered, this, &RomBrowserWidget::on_Action_SetCoverImage);
connect(this->action_RemoveCoverImage, &QAction::triggered, this, &RomBrowserWidget::on_Action_RemoveCoverImage);
// configure context menu
this->contextMenu = new QMenu(this);
this->contextMenu->addAction(this->action_PlayGame);
this->contextMenu->addAction(this->action_PlayGameWith);
this->contextMenu->addSeparator();
@@ -187,8 +217,11 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
this->contextMenu->addAction(this->action_RomInformation);
this->contextMenu->addSeparator();
this->contextMenu->addAction(this->action_EditGameSettings);
this->contextMenu->addAction(this->action_EditGameInputSettings);
this->contextMenu->addAction(this->action_EditCheats);
this->contextMenu->addSeparator();
this->contextMenu->addAction(this->action_ResetColumnSizes);
this->contextMenu->addMenu(this->menu_Columns);
this->contextMenu->addAction(this->action_SetCoverImage);
this->contextMenu->addAction(this->action_RemoveCoverImage);
@@ -216,6 +249,7 @@ void RomBrowserWidget::RefreshRomList(void)
this->coversDirectory = QString::fromStdString(CoreGetUserDataDirectory().string());
this->coversDirectory += "/Covers";
this->sortRomResults = CoreSettingsGetBoolValue(SettingsID::RomBrowser_SortAfterSearch);
this->listViewSortSection = CoreSettingsGetIntValue(SettingsID::RomBrowser_ListViewSortSection);
this->listViewSortOrder = CoreSettingsGetIntValue(SettingsID::RomBrowser_ListViewSortOrder);
@@ -381,14 +415,8 @@ QIcon RomBrowserWidget::getCurrentCover(QString file, CoreRomHeader header, Core
{
// fixup file name
QString fixedName = name;
for (const char c : ":<>\"/\\|?*")
for (const QChar c : QString(":<>\"/\\|?*"))
{
// skip empty characters
if (c == '\0')
{
continue;
}
fixedName.replace(c, "_");
}
@@ -461,7 +489,10 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
this->action_PlayGameWith->setEnabled(hasSelection);
this->action_RomInformation->setEnabled(hasSelection);
this->action_EditGameSettings->setEnabled(hasSelection);
this->action_EditGameInputSettings->setEnabled(hasSelection && CorePluginsHasROMConfig(CorePluginType::Input));
this->action_EditCheats->setEnabled(hasSelection);
this->action_ResetColumnSizes->setVisible(view == this->listViewWidget);
this->menu_Columns->menuAction()->setVisible(view == this->listViewWidget);
this->action_SetCoverImage->setEnabled(hasSelection);
this->action_SetCoverImage->setVisible(view == this->gridViewWidget);
this->action_RemoveCoverImage->setEnabled(hasSelection && !data.coverFile.isEmpty());
@@ -476,6 +507,11 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
this->action_PlayGameWith->setText("Play Game with Disk");
}
if (view == this->listViewWidget)
{ // list view
this->generateColumnsMenu();
}
if (view == this->gridViewWidget)
{ // grid view
if (data.coverFile.isEmpty())
@@ -491,6 +527,24 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
this->contextMenu->popup(this->mapToGlobal(position));
}
void RomBrowserWidget::generateColumnsMenu(void)
{
this->menu_Columns->clear();
for (int i = 0; i < this->listViewModel->columnCount(); i++)
{
int column = this->listViewWidget->horizontalHeader()->logicalIndex(i);
this->action_ColumnsMenuEntry = menu_Columns->addAction(this->columnNames.at(column));
this->action_ColumnsMenuEntry->setCheckable(true);
this->action_ColumnsMenuEntry->setChecked(!this->listViewWidget->horizontalHeader()->isSectionHidden(column));
connect(this->action_ColumnsMenuEntry, &QAction::toggled, [this, column](bool checked)
{
this->listViewWidget->horizontalHeader()->setSectionHidden(column, !checked);
});
}
}
void RomBrowserWidget::on_listViewWidget_sortIndicatorChanged(int logicalIndex, Qt::SortOrder sortOrder)
{
CoreSettingsSetValue(SettingsID::RomBrowser_ListViewSortSection, logicalIndex);
@@ -501,16 +555,60 @@ void RomBrowserWidget::on_listViewWidget_sectionResized(int logicalIndex, int ol
{
std::vector<int> columnSizes = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnSizes);
if (columnSizes.size() <= logicalIndex)
if (!this->listViewWidget->horizontalHeader()->stretchLastSection())
{
columnSizes.push_back(newWidth);
columnSizes.at(logicalIndex) = newWidth;
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnSizes, columnSizes);
}
else
{
columnSizes.at(logicalIndex) = newWidth;
std::vector<int> columnVisibility = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnVisibility);
if (newWidth == 0)
{
columnVisibility.at(logicalIndex) = 0;
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnVisibility, columnVisibility);
}
else
{
columnVisibility.at(logicalIndex) = 1;
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnVisibility, columnVisibility);
int lastVisibleColumn = -1;
for (int i = 0; i < this->listViewModel->columnCount(); i++)
{
int column = this->listViewWidget->horizontalHeader()->logicalIndex(i);
if (!this->listViewWidget->horizontalHeader()->isSectionHidden(column))
{
lastVisibleColumn = column;
}
}
if (logicalIndex != lastVisibleColumn)
{
columnSizes.at(logicalIndex) = newWidth;
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnSizes, columnSizes);
}
}
}
}
void RomBrowserWidget::on_listViewWidget_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex)
{
std::vector<int> columnOrder = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnOrder);
for (int i = 0; i < columnOrder.size(); i++)
{
columnOrder.at(i) = this->listViewWidget->horizontalHeader()->visualIndex(i);
}
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnSizes, columnSizes);
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnOrder, columnOrder);
}
void RomBrowserWidget::on_listViewWidget_headerContextMenuRequested(QPoint position)
{
this->generateColumnsMenu();
this->menu_Columns->popup(this->mapToGlobal(position));
}
void RomBrowserWidget::on_gridViewWidget_iconSizeChanged(const QSize& size)
@@ -541,9 +639,12 @@ void RomBrowserWidget::on_ZoomOut(void)
view->setIconSize(view->iconSize() - QSize(10, 10));
}
void RomBrowserWidget::on_RomBrowserThread_RomFound(QString file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings)
void RomBrowserWidget::on_RomBrowserThread_RomFound(QString file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings, int index, int count)
{
QString name;
QString gameFormat;
float fileSize;
QString fileSizeString;
QString coverFile;
QIcon coverIcon;
QVariant itemData;
@@ -560,6 +661,24 @@ void RomBrowserWidget::on_RomBrowserThread_RomFound(QString file, CoreRomType ty
name = QFileInfo(file).fileName();
}
// generate game format to use in UI
if (type == CoreRomType::Disk)
{
gameFormat = "Disk";
}
else
{
gameFormat = "Cartridge";
}
// generate file size to use in UI
fileSize = QFileInfo(file).size()/1048576.0;
fileSizeString = (QString::number(fileSize, 'f', 2)).append(" MB");
if (fileSizeString.size() == 7)
{
fileSizeString = fileSizeString.prepend(" ");
}
// retrieve cover image
coverIcon = this->getCurrentCover(file, header, settings, coverFile);
modelData.coverFile = coverFile;
@@ -583,6 +702,36 @@ void RomBrowserWidget::on_RomBrowserThread_RomFound(QString file, CoreRomType ty
listViewItem3->setText(QString::fromStdString(settings.MD5));
listViewItem3->setData(itemData);
listViewRow.append(listViewItem3);
// game format
QStandardItem* listViewItem4 = new QStandardItem();
listViewItem4->setText(gameFormat);
listViewItem4->setData(itemData);
listViewRow.append(listViewItem4);
// file name
QStandardItem* listViewItem5 = new QStandardItem();
listViewItem5->setText(QFileInfo(file).completeBaseName());
listViewItem5->setData(itemData);
listViewRow.append(listViewItem5);
// file extension
QStandardItem* listViewItem6 = new QStandardItem();
listViewItem6->setText(((QFileInfo(file).suffix()).prepend(".")).toUpper());
listViewItem6->setData(itemData);
listViewRow.append(listViewItem6);
// file size
QStandardItem* listViewItem7 = new QStandardItem();
listViewItem7->setText(fileSizeString);
listViewItem7->setData(itemData);
listViewRow.append(listViewItem7);
// game i.d.
QStandardItem* listViewItem8 = new QStandardItem();
listViewItem8->setText(QString::fromStdString(header.GameID));
listViewItem8->setData(itemData);
listViewRow.append(listViewItem8);
// region
QStandardItem* listViewItem9 = new QStandardItem();
listViewItem9->setText(QString::fromStdString(header.Region));
listViewItem9->setData(itemData);
listViewRow.append(listViewItem9);
this->listViewModel->appendRow(listViewRow);
QStandardItem* gridViewItem = new QStandardItem();
@@ -590,34 +739,94 @@ void RomBrowserWidget::on_RomBrowserThread_RomFound(QString file, CoreRomType ty
gridViewItem->setText(name);
gridViewItem->setData(itemData);
this->gridViewModel->appendRow(gridViewItem);
// update loading widget
this->loadingWidget->SetCurrentRomIndex(index, count);
}
void RomBrowserWidget::on_RomBrowserThread_Finished(bool canceled)
{
// sort data
this->listViewModel->sort(this->listViewSortSection, (Qt::SortOrder)this->listViewSortOrder);
this->gridViewModel->sort(0, Qt::SortOrder::AscendingOrder);
// resize list view's columns
std::vector<int> columnSizes = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnSizes);
if (columnSizes.size() != this->listViewModel->columnCount() ||
columnSizes.at(0) == -1)
if (this->sortRomResults)
{
// reset column sizes setting
columnSizes.clear();
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnSizes, columnSizes);
this->listViewWidget->resizeColumnsToContents();
this->listViewModel->sort(this->listViewSortSection, (Qt::SortOrder)this->listViewSortOrder);
this->gridViewModel->sort(0, Qt::SortOrder::AscendingOrder);
}
else
// retrieve column settings
std::vector<int> columnSizes = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnSizes);
std::vector<int> columnOrder = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnOrder);
std::vector<int> columnVisibility = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnVisibility);
// temporarily disable stretching last column in list view
this->listViewWidget->horizontalHeader()->setStretchLastSection(false);
// reset column sizes setting in config file if number of values is incorrect
if (!columnSizes.empty() &&
columnSizes.size() != this->listViewModel->columnCount())
{
// use settings' width
for (int i = 0; i < (columnSizes.size() - 1); i++)
columnSizes.clear();
columnSizes.resize(this->listViewModel->columnCount(), -1);
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnSizes, columnSizes);
}
// update list view's column sizes
for (int i = 0; i < columnSizes.size(); i++)
{
// set column widths to values specified in config file (or resize to content if not already specified)
if (columnSizes.at(i) == -1)
{
this->listViewWidget->resizeColumnToContents(i);
}
else
{
this->listViewWidget->setColumnWidth(i, columnSizes.at(i));
}
}
// enable stretching last column in list view
this->listViewWidget->horizontalHeader()->setStretchLastSection(true);
// reset column order setting in config file if number of values is incorrect
if (!columnOrder.empty() &&
columnOrder.size() != this->listViewModel->columnCount())
{
columnOrder.clear();
for (int i = 0; i < this->listViewModel->columnCount(); i++)
{
columnOrder.push_back(i);
}
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnOrder, columnOrder);
}
// update list view's column order
for (int i = 0; i < columnOrder.size(); i++)
{
this->listViewWidget->horizontalHeader()->moveSection(this->listViewWidget->horizontalHeader()->visualIndex(i), columnOrder.at(i));
}
// reset column visibility setting in config file if number of values is incorrect
if (!columnVisibility.empty() &&
columnVisibility.size() != this->listViewModel->columnCount())
{
columnVisibility.clear();
columnVisibility.resize(this->listViewModel->columnCount(), 0);
for (int i = 0; i < 3; i++)
{
columnVisibility.at(i) = 1;
}
CoreSettingsSetValue(SettingsID::RomBrowser_ColumnVisibility, columnVisibility);
}
// update list view's column visibilities
for (int i = 0; i < columnVisibility.size(); i++)
{
if (columnVisibility.at(i) == 0)
{
this->listViewWidget->horizontalHeader()->setSectionHidden(i, true);
}
}
if (!canceled)
{
if (this->listViewModel->rowCount() == 0)
@@ -688,11 +897,38 @@ void RomBrowserWidget::on_Action_EditGameSettings(void)
emit this->EditGameSettings(this->getCurrentRom());
}
void RomBrowserWidget::on_Action_EditGameInputSettings(void)
{
emit this->EditGameInputSettings(this->getCurrentRom());
}
void RomBrowserWidget::on_Action_EditCheats(void)
{
emit this->Cheats(this->getCurrentRom());
}
void RomBrowserWidget::on_Action_ResetColumnSizes(void)
{
std::vector<int> columnVisibility = CoreSettingsGetIntListValue(SettingsID::RomBrowser_ColumnVisibility);
this->listViewWidget->horizontalHeader()->setStretchLastSection(false);
for (int i = 0; i < this->listViewModel->columnCount(); i++)
{
this->listViewWidget->horizontalHeader()->setSectionHidden(i, false);
}
this->listViewWidget->resizeColumnsToContents();
this->listViewWidget->horizontalHeader()->setStretchLastSection(true);
for (int i = 0; i < columnVisibility.size(); i++)
{
if (columnVisibility.at(i) == 0)
{
this->listViewWidget->horizontalHeader()->setSectionHidden(i, true);
}
}
}
void RomBrowserWidget::on_Action_SetCoverImage(void)
{
QString sourceFile;
@@ -67,9 +67,13 @@ class RomBrowserWidget : public QStackedWidget
QElapsedTimer romSearcherTimer;
Thread::RomSearcherThread* romSearcherThread = nullptr;
bool sortRomResults = false;
int listViewSortSection = 0;
int listViewSortOrder = 0;
QStringList columnNames;
QMenu* contextMenu;
QAction* action_PlayGame;
QAction* action_PlayGameWith;
@@ -78,10 +82,15 @@ class RomBrowserWidget : public QStackedWidget
QAction* action_ChangeRomDirectory;
QAction* action_RomInformation;
QAction* action_EditGameSettings;
QAction* action_EditGameInputSettings;
QAction* action_EditCheats;
QAction* action_ResetColumnSizes;
QAction* action_SetCoverImage;
QAction* action_RemoveCoverImage;
QMenu* menu_Columns;
QAction* action_ColumnsMenuEntry;
QString coversDirectory;
QStandardItemModel* getCurrentModel(void);
@@ -97,17 +106,20 @@ class RomBrowserWidget : public QStackedWidget
private slots:
void on_DoubleClicked(const QModelIndex& index);
void customContextMenuRequested(QPoint point);
void customContextMenuRequested(QPoint position);
void generateColumnsMenu(void);
void on_listViewWidget_sortIndicatorChanged(int logicalIndex, Qt::SortOrder sortOrder);
void on_listViewWidget_sectionResized(int logicalIndex, int oldWidth, int newWidth);
void on_listViewWidget_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);
void on_listViewWidget_headerContextMenuRequested(QPoint position);
void on_gridViewWidget_iconSizeChanged(const QSize& size);
void on_ZoomIn(void);
void on_ZoomOut(void);
void on_RomBrowserThread_RomFound(QString file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings);
void on_RomBrowserThread_RomFound(QString file, CoreRomType type, CoreRomHeader header, CoreRomSettings settings, int index, int count);
void on_RomBrowserThread_Finished(bool canceled);
void on_Action_PlayGame(void);
@@ -117,7 +129,9 @@ class RomBrowserWidget : public QStackedWidget
void on_Action_ChangeRomDirectory(void);
void on_Action_RomInformation(void);
void on_Action_EditGameSettings(void);
void on_Action_EditGameInputSettings(void);
void on_Action_EditCheats(void);
void on_Action_ResetColumnSizes(void);
void on_Action_SetCoverImage(void);
void on_Action_RemoveCoverImage(void);
@@ -125,6 +139,7 @@ class RomBrowserWidget : public QStackedWidget
void PlayGame(QString);
void PlayGameWith(CoreRomType, QString);
void EditGameSettings(QString);
void EditGameInputSettings(QString);
void Cheats(QString);
void ChangeRomDirectory(void);
void RomInformation(QString);
+77 -6
View File
@@ -16,6 +16,11 @@
#include <RMG-Core/Core.hpp>
#include <iostream>
#include <cstdlib>
#ifndef _WIN32
#include <signal.h>
#endif
//
// Local Functions
@@ -65,6 +70,11 @@ void message_handler(QtMsgType type, const QMessageLogContext &context, const QS
std::cerr << typeString << localMsg.constData() << std::endl;
}
void signal_handler(int sig)
{
QGuiApplication::quit();
}
//
// Exported Functions
//
@@ -74,6 +84,25 @@ int main(int argc, char **argv)
// install message handler
qInstallMessageHandler(message_handler);
#ifndef _WIN32
// install signal handler
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
#endif
#ifdef FORCE_XCB
setenv("QT_QPA_PLATFORM", "xcb", 1);
#endif // FORCE_XCB
#ifndef _WIN32
// ensure the default OpenGL format
// doesn't have vsync enabled by default,
// only needed for linux (for now)
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
format.setSwapInterval(0);
QSurfaceFormat::setDefaultFormat(format);
#endif
QApplication app(argc, argv);
UserInterface::MainWindow window;
@@ -91,29 +120,71 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.addVersionOption();
// custom options
#ifndef PORTABLE_INSTALL
QCommandLineOption corePathOption("core-path", "Changes the path where the core library is stored", "path");
QCommandLineOption pluginPathOption("plugin-path", "Changes the path where the plugins are stored", "path");
QCommandLineOption sharedDataPathOption("shared-data-path", "Changes the path where the shared data is stored", "path");
corePathOption.setFlags(QCommandLineOption::HiddenFromHelp);
pluginPathOption.setFlags(QCommandLineOption::HiddenFromHelp);
sharedDataPathOption.setFlags(QCommandLineOption::HiddenFromHelp);
#endif // PORTABLE_INSTALL
QCommandLineOption debugMessagesOption({"d", "debug-messages"}, "Prints debug callback messages to stdout");
QCommandLineOption fullscreenOption({"f", "fullscreen"}, "Launches ROM in fullscreen mode");
QCommandLineOption quitAfterEmulation({"q", "quit-after-emulation"}, "Quits RMG when emulation has finished");
QCommandLineOption noGuiOption({"n", "nogui"}, "Hides GUI elements (menubar, toolbar, statusbar)");
QCommandLineOption quitAfterEmulationOption({"q", "quit-after-emulation"}, "Quits RMG when emulation has finished");
QCommandLineOption diskOption("disk", "64DD Disk to open ROM in combination with", "64DD Disk");
#ifndef PORTABLE_INSTALL
parser.addOption(corePathOption);
parser.addOption(pluginPathOption);
parser.addOption(sharedDataPathOption);
#endif // PORTABLE_INSTALL
parser.addOption(debugMessagesOption);
parser.addOption(fullscreenOption);
parser.addOption(quitAfterEmulation);
parser.addOption(noGuiOption);
parser.addOption(quitAfterEmulationOption);
parser.addOption(diskOption);
parser.addPositionalArgument("ROM", "ROM to open");
// parse arguments
parser.process(app);
#ifndef PORTABLE_INSTALL
// set path overrides before initializing
QString corePathOveride = parser.value(corePathOption);
QString pluginPathOverride = parser.value(pluginPathOption);
QString sharedDataPathOverride = parser.value(sharedDataPathOption);
if (!corePathOveride.isEmpty())
{
CoreSetCorePathOverride(corePathOveride.toStdString());
}
if (!pluginPathOverride.isEmpty())
{
CoreSetPluginPathOverride(pluginPathOverride.toStdString());
}
if (!sharedDataPathOverride.isEmpty())
{
CoreSetSharedDataPathOverride(sharedDataPathOverride.toStdString());
}
#endif // PORTABLE_INSTALL
// print debug callbacks to stdout if needed
CoreSetPrintDebugCallback(parser.isSet(debugMessagesOption));
// initialize window
if (!window.Init(&app))
if (!window.Init(&app, !parser.isSet(noGuiOption)))
{
return 1;
}
window.show();
QStringList args = parser.positionalArguments();
if (!args.empty())
{
window.OpenROM(args.at(0), parser.value(diskOption), parser.isSet(fullscreenOption), parser.isSet(quitAfterEmulation));
window.OpenROM(args.at(0), parser.value(diskOption), parser.isSet(fullscreenOption), parser.isSet(quitAfterEmulationOption));
}
// show window
window.show();
return app.exec();
}
}