mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-07-31 03:08:40 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
941a8832bf | ||
|
|
8ae111add3 | ||
|
|
88672dc38f | ||
|
|
dccba86dde | ||
|
|
a7bced02da | ||
|
|
a654e2ac43 | ||
|
|
56b54e0e17 | ||
|
|
8ffd920700 | ||
|
|
b6f67a7a6e | ||
|
|
9308410e12 | ||
|
|
65882ae14d | ||
|
|
0f533ec16c | ||
|
|
0c708e8c1e | ||
|
|
2693544faa | ||
|
|
2e95e59f40 | ||
|
|
72bc826907 | ||
|
|
21440c31f4 | ||
|
|
3e225d78fa | ||
|
|
5464463ab0 | ||
|
|
9c9bae7443 | ||
|
|
9d69a0ad54 | ||
|
|
4b88256df2 | ||
|
|
bc7b0e53f0 | ||
|
|
3695862368 | ||
|
|
18ae23b99d | ||
|
|
bb60058fa0 | ||
|
|
1ad25605d1 | ||
|
|
9809265be4 | ||
|
|
63872e6b28 | ||
|
|
fb3a9eae9b | ||
|
|
f53c3050df | ||
|
|
67bd0dfcdb | ||
|
|
12196359f7 | ||
|
|
609165e412 | ||
|
|
41f14a8cf8 | ||
|
|
a8bdd3fbfc | ||
|
|
993ec82a9e | ||
|
|
c5a2844367 | ||
|
|
e5bb405b47 | ||
|
|
8c9a65d094 | ||
|
|
047b8593ac | ||
|
|
4fc4eb8a66 | ||
|
|
1f95a86f0a | ||
|
|
2b90451c4a | ||
|
|
77a6525556 | ||
|
|
5eacab387d | ||
|
|
ddaf57d5b0 | ||
|
|
1144c46109 | ||
|
|
850b839fc3 | ||
|
|
22037e75ba | ||
|
|
303ab163ab | ||
|
|
2833537167 | ||
|
|
1aa7b591b6 | ||
|
|
2f0463d936 | ||
|
|
82a1ec0c3a | ||
|
|
d65133451d | ||
|
|
36e81949e0 | ||
|
|
6b62945632 | ||
|
|
fa2f578900 | ||
|
|
e1c9987059 | ||
|
|
325e219bb1 | ||
|
|
be208df11b | ||
|
|
49df804d1b | ||
|
|
122fde79bd | ||
|
|
2099e68c41 | ||
|
|
52ccc609cd | ||
|
|
b402f6a404 | ||
|
|
3576a1824d | ||
|
|
c3afaae169 | ||
|
|
c5a9ce6b56 | ||
|
|
4f0d944bb9 | ||
|
|
5684bcb6f4 | ||
|
|
5087fcea88 | ||
|
|
28f984e87f | ||
|
|
e0233daeb0 | ||
|
|
49922ebe32 | ||
|
|
8fe0c3441c | ||
|
|
ba55caa404 | ||
|
|
e50e651078 | ||
|
|
39b4fd47c7 | ||
|
|
56b83e5cfa | ||
|
|
ed57355948 | ||
|
|
b4b2f3a0b6 | ||
|
|
1946882952 | ||
|
|
dbe4930c17 | ||
|
|
3b25fa3065 | ||
|
|
01849565aa | ||
|
|
e3ca5833d0 | ||
|
|
dfac1f034b | ||
|
|
a8d07df81d | ||
|
|
609cb44b01 | ||
|
|
feb4d605d0 | ||
|
|
276d887917 | ||
|
|
61aef9c96f | ||
|
|
b4005682f2 | ||
|
|
7d98461fc6 | ||
|
|
862d03b78e | ||
|
|
0ecf46240f | ||
|
|
a2755e212b | ||
|
|
2ec5559dd6 | ||
|
|
6f904759ee | ||
|
|
507fafd601 | ||
|
|
9c463f1338 | ||
|
|
8818cd0285 | ||
|
|
23b72d08d2 | ||
|
|
227049b6f2 | ||
|
|
97abd3e1f9 | ||
|
|
6f34b7ba99 | ||
|
|
c0d86c3852 | ||
|
|
bf743ff467 | ||
|
|
306f994464 | ||
|
|
f56676942b | ||
|
|
bfd0a05289 | ||
|
|
3999c08f00 | ||
|
|
febb8ec1a6 | ||
|
|
cdd38ef7aa | ||
|
|
54c620a5df | ||
|
|
089b7fa73e | ||
|
|
d9d0e84ca1 | ||
|
|
badede2e2d | ||
|
|
e2ae28741d | ||
|
|
ff34150b15 | ||
|
|
4a93ceac58 | ||
|
|
5a724bf49e | ||
|
|
c23bcf6322 | ||
|
|
c863149ad9 | ||
|
|
5fb6e22bed | ||
|
|
d634088282 | ||
|
|
c99a935831 | ||
|
|
165da677ed | ||
|
|
0bbde2ca52 | ||
|
|
3d13c5d13c | ||
|
|
9d978c67ec | ||
|
|
8766e1fa57 | ||
|
|
c0e4883987 | ||
|
|
57f2cd5f9e | ||
|
|
50d8d06a94 | ||
|
|
2e07328878 | ||
|
|
ad8294e521 | ||
|
|
14426a7b45 | ||
|
|
6697e76be1 | ||
|
|
73cd876f6d | ||
|
|
e626754000 | ||
|
|
1fedd31229 | ||
|
|
bfe1746ddb | ||
|
|
4800c32db4 | ||
|
|
140fc28b3e | ||
|
|
f9833bb8af | ||
|
|
4b6ddaf09e | ||
|
|
d427db4a15 | ||
|
|
deb39cc20f | ||
|
|
3a4c25e916 | ||
|
|
f416eb3d4f | ||
|
|
87cbb1f90c | ||
|
|
68f43121fb | ||
|
|
51ceab1f3c | ||
|
|
2257992a3f | ||
|
|
40ead584d7 | ||
|
|
6f2be7bd17 | ||
|
|
af9ca4cf7d | ||
|
|
ea98203ac5 | ||
|
|
e908bbfae6 | ||
|
|
fa00069068 | ||
|
|
efae58de52 | ||
|
|
39c7f703cb | ||
|
|
96220e509c | ||
|
|
4de495ad59 | ||
|
|
56a950a074 | ||
|
|
2b47254bdd | ||
|
|
da28e2cc37 | ||
|
|
3d64f4a548 | ||
|
|
abf03b0c79 | ||
|
|
8381742422 | ||
|
|
724bb09aec | ||
|
|
ad5de248b4 | ||
|
|
1a1fdf6a5a | ||
|
|
c469b17350 | ||
|
|
01842a3c6b | ||
|
|
4cd385dbff | ||
|
|
72787d103f | ||
|
|
59072272a9 | ||
|
|
ef76666e5a | ||
|
|
0a0994b19c | ||
|
|
ab68c570a9 | ||
|
|
dcdf3b39a3 | ||
|
|
476cb2db34 | ||
|
|
34a7e00413 | ||
|
|
413ba09ee0 | ||
|
|
33eefefffb | ||
|
|
b3c822e31b | ||
|
|
14a458a275 | ||
|
|
6c49f9cf52 | ||
|
|
803ea4dda5 | ||
|
|
c9b23e6e4e | ||
|
|
509c9318af | ||
|
|
46e1e3d904 | ||
|
|
7a045d837b | ||
|
|
574ea820f7 |
@@ -33,6 +33,7 @@ jobs:
|
||||
uses: ./.github/workflows/linux_build_flatpak.yml
|
||||
with:
|
||||
jobName: "Qt"
|
||||
artifactPrefixName: "PCSX2-linux-Qt-x64-flatpak"
|
||||
compiler: clang
|
||||
cmakeflags: ""
|
||||
publish: true
|
||||
|
||||
@@ -39,6 +39,10 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
@@ -59,6 +63,13 @@ jobs:
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
|
||||
@@ -39,6 +39,10 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_linux:
|
||||
@@ -60,7 +64,7 @@ jobs:
|
||||
run: |
|
||||
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --allow-downgrades libc6=2.35-0ubuntu3.5 libc6-dev=2.35-0ubuntu3.5 libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04
|
||||
sudo apt-get install -y --allow-downgrades 'libc6=2.35-0ubuntu*' 'libc6-dev=2.35-0ubuntu*' libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -72,6 +76,13 @@ jobs:
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
@@ -109,7 +120,7 @@ jobs:
|
||||
|
||||
- name: Build Dependencies
|
||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||
run: .github/workflows/scripts/linux/build-dependencies-qt.sh
|
||||
run: .github/workflows/scripts/linux/build-dependencies-qt.sh "$HOME/deps"
|
||||
|
||||
- name: Download patches
|
||||
run: |
|
||||
|
||||
@@ -21,6 +21,10 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_macos:
|
||||
@@ -47,6 +51,13 @@ jobs:
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Use Xcode 14.3.1
|
||||
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
|
||||
|
||||
|
||||
@@ -10,16 +10,19 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
# TODO - future work
|
||||
# workflow_dispatch:
|
||||
# inputs:
|
||||
# isStable:
|
||||
# description: 'Should it be a stable release?'
|
||||
# required: true
|
||||
# default: 'false'
|
||||
# versionTag:
|
||||
# description: 'The version to tag with'
|
||||
# required: true
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
is_prelease:
|
||||
description: 'Should be a pre-release?'
|
||||
required: true
|
||||
default: 'true'
|
||||
type: choice
|
||||
options:
|
||||
- 'true'
|
||||
- 'false'
|
||||
tag_value:
|
||||
description: 'Create a new release from latest master with the given tag, if this is left blank it will bump the patch version. You dont need to include the "v" prefix'
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -42,6 +45,8 @@ jobs:
|
||||
github_token: ${{ github.token }}
|
||||
tag_prefix: v
|
||||
default_bump: patch
|
||||
# if set, it will overwrite the bump settings
|
||||
custom_tag: ${{ github.event.inputs.tag_value == '' && null || github.event.inputs.tag_value }}
|
||||
|
||||
# TODO - we could do this and remove the node.js script, but auto-generated notes only work
|
||||
# with PRs -- not commits (determine how much we care).
|
||||
@@ -62,9 +67,18 @@ jobs:
|
||||
node index.js
|
||||
mv ./release-notes.md ${GITHUB_WORKSPACE}/release-notes.md
|
||||
|
||||
- name: Create a GitHub Release
|
||||
- name: Create a GitHub Release (Manual)
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.tag_version.outputs.new_tag
|
||||
if: steps.tag_version.outputs.new_tag && github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
body_path: ./release-notes.md
|
||||
draft: true
|
||||
prerelease: ${{ github.event_name != 'workflow_dispatch' || inputs.is_prelease == 'true' }}
|
||||
tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
||||
|
||||
- name: Create a GitHub Release (Push)
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.tag_version.outputs.new_tag && github.event_name != 'workflow_dispatch'
|
||||
with:
|
||||
body_path: ./release-notes.md
|
||||
draft: true
|
||||
@@ -86,6 +100,7 @@ jobs:
|
||||
cmakeflags: ""
|
||||
buildAppImage: true
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
build_linux_flatpak:
|
||||
@@ -102,6 +117,7 @@ jobs:
|
||||
branch: "stable"
|
||||
publish: false
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
# Windows
|
||||
@@ -118,6 +134,7 @@ jobs:
|
||||
buildSystem: cmake
|
||||
cmakeFlags: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
# MacOS
|
||||
@@ -131,6 +148,7 @@ jobs:
|
||||
jobName: "MacOS Build"
|
||||
artifactPrefixName: "PCSX2-macos-Qt"
|
||||
fetchTags: true
|
||||
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
|
||||
secrets: inherit
|
||||
|
||||
# Upload the Artifacts
|
||||
@@ -163,9 +181,6 @@ jobs:
|
||||
working-directory: ./ci-artifacts/
|
||||
run: for d in *windows*/; do 7z a "${d}asset.7z" ./$d/*; done
|
||||
|
||||
# Artifact Naming:
|
||||
# MacOS: PCSX2-<tag>-macOS-[additional hyphen seperated tags]
|
||||
# Windows|Linux: PCSX2-<tag>-<windows|linux>-<32bit|64bit>--[additional hyphen seperated tags]
|
||||
- name: Name and Upload the Release Assets
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
|
||||
set -e
|
||||
|
||||
INSTALLDIR="$HOME/deps"
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Syntax: $0 <output directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INSTALLDIR="$1"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.28.5
|
||||
SDL=SDL2-2.30.0
|
||||
QT=6.6.1
|
||||
LIBBACKTRACE=ad106d5fdd5d960bd33fae1c48a351af567fd075
|
||||
|
||||
@@ -12,7 +17,7 @@ mkdir -p deps-build
|
||||
cd deps-build
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
332cb37d0be20cb9541739c61f79bae5a477427d79ae85e352089afdaf6666e4 $SDL.tar.gz
|
||||
36e2e41557e0fa4a1519315c0f5958a87ccb27e25c51776beb6f1239526447b0 $SDL.tar.gz
|
||||
fd6f417fe9e3a071cf1424a5152d926a34c4a3c5070745470be6cf12a404ed79 $LIBBACKTRACE.zip
|
||||
450c5b4677b2fe40ed07954d7f0f40690068e80a94c9df86c2c905ccd59d02f7 qtbase-everywhere-src-$QT.tar.xz
|
||||
ac4ed08950072e375be662cfa64fdb447dd6e935cf29c56a4128d1500492188f qtimageformats-everywhere-src-$QT.tar.xz
|
||||
@@ -45,7 +50,7 @@ cd ..
|
||||
echo "Building libbacktrace..."
|
||||
unzip "$LIBBACKTRACE.zip"
|
||||
cd "libbacktrace-$LIBBACKTRACE"
|
||||
./configure --prefix="$HOME/deps"
|
||||
./configure --prefix="$INSTALLDIR"
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://libsdl.org/release/SDL2-2.28.5.tar.gz",
|
||||
"sha256": "332cb37d0be20cb9541739c61f79bae5a477427d79ae85e352089afdaf6666e4"
|
||||
"url": "https://libsdl.org/release/SDL2-2.30.0.tar.gz",
|
||||
"sha256": "36e2e41557e0fa4a1519315c0f5958a87ccb27e25c51776beb6f1239526447b0"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
|
||||
@@ -11,7 +11,7 @@ export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||
|
||||
INSTALLDIR="$1"
|
||||
NPROCS="$(getconf _NPROCESSORS_ONLN)"
|
||||
SDL=SDL2-2.28.5
|
||||
SDL=SDL2-2.30.0
|
||||
XZ=5.4.5
|
||||
ZSTD=1.5.5
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
@@ -29,7 +29,7 @@ export CFLAGS="-I$INSTALLDIR/include $CFLAGS"
|
||||
export CXXFLAGS="-I$INSTALLDIR/include $CXXFLAGS"
|
||||
|
||||
cat > SHASUMS <<EOF
|
||||
332cb37d0be20cb9541739c61f79bae5a477427d79ae85e352089afdaf6666e4 $SDL.tar.gz
|
||||
36e2e41557e0fa4a1519315c0f5958a87ccb27e25c51776beb6f1239526447b0 $SDL.tar.gz
|
||||
135c90b934aee8fbc0d467de87a05cb70d627da36abe518c357a873709e5b7d6 xz-$XZ.tar.gz
|
||||
9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 zstd-$ZSTD.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
@@ -62,24 +62,6 @@ shasum -a 256 --check SHASUMS
|
||||
echo "Installing SDL..."
|
||||
tar xf "$SDL.tar.gz"
|
||||
cd "$SDL"
|
||||
|
||||
# MFI causes multiple joystick connection events, I'm guessing because both the HIDAPI and MFI interfaces
|
||||
# race each other, and sometimes both end up getting through. So, just force MFI off.
|
||||
patch -u CMakeLists.txt <<EOF
|
||||
--- CMakeLists.txt 2023-08-03 01:33:11
|
||||
+++ CMakeLists.txt 2023-08-26 12:58:53
|
||||
@@ -2105,7 +2105,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreHaptics/CoreHaptics.h>
|
||||
int main() { return 0; }" HAVE_FRAMEWORK_COREHAPTICS)
|
||||
- if(HAVE_FRAMEWORK_GAMECONTROLLER AND HAVE_FRAMEWORK_COREHAPTICS)
|
||||
+ if(HAVE_FRAMEWORK_GAMECONTROLLER AND HAVE_FRAMEWORK_COREHAPTICS AND FALSE)
|
||||
# Only enable MFI if we also have CoreHaptics to ensure rumble works
|
||||
set(SDL_JOYSTICK_MFI 1)
|
||||
set(SDL_FRAMEWORK_GAMECONTROLLER 1)
|
||||
|
||||
EOF
|
||||
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_OSX_ARCHITECTURES="x86_64" -DSDL_X11=OFF -DBUILD_SHARED_LIBS=ON
|
||||
make -C build "-j$NPROCS"
|
||||
make -C build install
|
||||
|
||||
@@ -39,9 +39,9 @@ cd "%BUILDDIR%"
|
||||
|
||||
set QT=6.6.1
|
||||
set QTMINOR=6.6
|
||||
set SDL=SDL2-2.28.5
|
||||
set SDL=SDL2-2.30.0
|
||||
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" 97bd14ee0ec67494d2b93f1a4f7da2bf891103c57090d96fdcc2b019d885c76a || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" 80b0c02b6018630cd40639ac9fc8e5c1d8eec14d8fe3e6dfa76343e3ba8b78d9 || goto error
|
||||
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" 818f92518d1a89ee98ae818891a7d2f0e41aa45b933d55215da2df6d5459428e || goto error
|
||||
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 03f01042f86b4dbf7329a179f20835817c660a183178c11570cc0535b3c3ba58 || goto error
|
||||
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" d44d5ead8d4682f54c91687b5e32f2735f086419e3889e05609feae1a7f02da9 || goto error
|
||||
|
||||
@@ -40,6 +40,10 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
stableBuild:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_windows_qt:
|
||||
@@ -61,6 +65,13 @@ jobs:
|
||||
if: ${{ inputs.fetchTags }}
|
||||
run: git fetch --tags --no-recurse-submodules
|
||||
|
||||
- name: Add stable release identifier file
|
||||
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
||||
|
||||
- name: Prepare Artifact Metadata
|
||||
id: artifact-metadata
|
||||
shell: bash
|
||||
|
||||
+16
@@ -56,6 +56,9 @@ oprofile_data/
|
||||
/UpgradeLog*.htm
|
||||
/.vscode*
|
||||
|
||||
# Jetbrains Rider
|
||||
/.idea*
|
||||
|
||||
# KDevelop 4 Workspace Configuration Files
|
||||
*.kdev4
|
||||
/.kdev4*
|
||||
@@ -77,6 +80,7 @@ oprofile_data/
|
||||
/bin/gamesettings
|
||||
/bin/help
|
||||
/bin/inis
|
||||
/bin/inis/debuggersettings
|
||||
/bin/logs
|
||||
/bin/memcards
|
||||
/bin/plugins
|
||||
@@ -85,6 +89,18 @@ oprofile_data/
|
||||
/bin/textures
|
||||
/bin/translations
|
||||
/bin/inputprofiles
|
||||
/bin/videos
|
||||
/bin/portable.ini
|
||||
|
||||
# Manually added by user.
|
||||
/bin/resources/patches.zip
|
||||
|
||||
# Resources that are runtime downloaded.
|
||||
/bin/resources/fonts/NotoSansJP-Regular.ttf
|
||||
/bin/resources/fonts/NotoSansKR-Regular.ttf
|
||||
/bin/resources/fonts/NotoSansSC-Regular.ttf
|
||||
/bin/resources/fonts/NotoSansTC-Regular.ttf
|
||||
|
||||
/deps
|
||||
/ipch
|
||||
|
||||
|
||||
Vendored
+1
@@ -706,6 +706,7 @@
|
||||
#define ICON_FA_RANDOM "\xef\x81\xb4" // U+f074
|
||||
#define ICON_FA_RECEIPT "\xef\x95\x83" // U+f543
|
||||
#define ICON_FA_RECORD_VINYL "\xef\xa3\x99" // U+f8d9
|
||||
#define ICON_FA_RECORDING "\xef\xa3\x9a" // U+f8da
|
||||
#define ICON_FA_RECYCLE "\xef\x86\xb8" // U+f1b8
|
||||
#define ICON_FA_REDO "\xef\x80\x9e" // U+f01e
|
||||
#define ICON_FA_REDO_ALT "\xef\x8b\xb9" // U+f2f9
|
||||
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1. This license is copied below, and is also available
|
||||
with a FAQ at <http://scripts.sil.org/OFL>
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Vendored
+33619
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
RunWizard=0
|
||||
+971
-214
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -114,6 +114,10 @@
|
||||
03000000050b00000679000000000000,ASUS ROG Kunai 3,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
|
||||
03000000503200000110000000000000,Atari VCS Classic Controller,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,start:b3,platform:Windows,
|
||||
03000000503200000210000000000000,Atari VCS Modern Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a3,righty:a4,start:b9,x:b2,y:b3,platform:Windows,
|
||||
030000008a3500000102000000000000,Backbone One,a:b4,b:b5,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b10,leftstick:b17,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b18,righttrigger:b13,rightx:a3,righty:a4,start:b15,x:b7,y:b8,platform:Windows,
|
||||
030000008a3500000201000000000000,Backbone One,a:b4,b:b5,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b10,leftstick:b17,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b18,righttrigger:b13,rightx:a3,righty:a4,start:b15,x:b7,y:b8,platform:Windows,
|
||||
030000008a3500000302000000000000,Backbone One,a:b4,b:b5,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b10,leftstick:b17,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b18,righttrigger:b13,rightx:a3,righty:a4,start:b15,x:b7,y:b8,platform:Windows,
|
||||
030000008a3500000402000000000000,Backbone One,a:b4,b:b5,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b10,leftstick:b17,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b18,righttrigger:b13,rightx:a3,righty:a4,start:b15,x:b7,y:b8,platform:Windows,
|
||||
03000000e4150000103f000000000000,Batarang,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b11,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000d6200000e557000000000000,Batarang PlayStation Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,platform:Windows,
|
||||
@@ -314,6 +318,7 @@
|
||||
03000000242e00000b20000000000000,Hyperkin Admiral N64 Controller,+rightx:b11,+righty:b13,-rightx:b8,-righty:b12,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,platform:Windows,
|
||||
03000000242e0000ff0b000000000000,Hyperkin N64 Adapter,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b9,platform:Windows,
|
||||
03000000790000004e95000000000000,Hyperkin N64 Controller Adapter,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b7,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a5,righty:a2,start:b9,platform:Windows,
|
||||
03000000242e00006a48000000000000,Hyperkin RetroN Sq,a:b3,b:b7,back:b5,dpdown:+a4,dpleft:-a0,dpright:+a0,dpup:-a4,leftshoulder:b0,rightshoulder:b1,start:b4,x:b2,y:b6,platform:Windows,
|
||||
03000000242e00006a38000000000000,Hyperkin Trooper 2,a:b0,b:b1,back:b4,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b3,start:b5,platform:Windows,
|
||||
03000000d81d00000e00000000000000,iBuffalo AC02 Arcade Joystick,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b11,righttrigger:b3,rightx:a2,righty:a5,start:b8,x:b4,y:b5,platform:Windows,
|
||||
03000000d81d00000f00000000000000,iBuffalo BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
|
||||
@@ -352,7 +357,7 @@
|
||||
030000006d040000d2ca000000000000,Logitech Cordless Precision,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,platform:Windows,
|
||||
030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
030000006d0400001dc2000000000000,Logitech F310,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
030000006d0400001dc2000000000000,Logitech F310,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
030000006d04000018c2000000000000,Logitech F510,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
030000006d0400001ec2000000000000,Logitech F510,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
030000006d04000019c2000000000000,Logitech F710,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
@@ -461,7 +466,7 @@
|
||||
030000008916000000fd000000000000,Onza TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
030000006b14000001a1000000000000,Orange Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,platform:Windows,
|
||||
03000000362800000100000000000000,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,platform:Windows,
|
||||
03000000362800000100000000000000,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,platform:Windows,
|
||||
03000000120c0000f60e000000000000,P4 Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,platform:Windows,
|
||||
03000000790000002201000000000000,PC Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
|
||||
030000006f0e00008501000000000000,PDP Fightpad Pro GameCube Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows,
|
||||
@@ -612,6 +617,7 @@
|
||||
03000000050b00001a1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,platform:Windows,
|
||||
03000000050b00001c1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,platform:Windows,
|
||||
030000004f04000001d0000000000000,Rumble Force,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,platform:Windows,
|
||||
030000000d0f0000ad00000000000000,RX Gamepad,a:b0,b:b4,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b3,rightshoulder:b6,start:b9,x:b2,y:b1,platform:Windows,
|
||||
030000008916000000fe000000000000,Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000c6240000045d000000000000,Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows,
|
||||
@@ -678,6 +684,7 @@
|
||||
03000000457500002211000000000000,Szmy Power PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
030000004f0400000ab1000000000000,T16000M,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b10,x:b2,y:b3,platform:Windows,
|
||||
030000000d0f00007b00000000000000,TAC GEAR,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows,
|
||||
03000000e40a00000307000000000000,Taito Egret II Mini Control Panel,a:b4,b:b2,back:b6,guide:b9,leftx:a0,lefty:a1,rightshoulder:b0,righttrigger:b1,start:b7,x:b8,y:b3,platform:Windows,
|
||||
03000000e40a00000207000000000000,Taito Egret II Mini Controller,a:b4,b:b2,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b9,rightshoulder:b0,righttrigger:b1,start:b7,x:b8,y:b3,platform:Windows,
|
||||
03000000d814000001a0000000000000,TE Kitty,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,
|
||||
03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows,
|
||||
@@ -854,6 +861,11 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000050b00000679000000010000,ASUS ROG Kunai 3,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b23,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X,
|
||||
03000000503200000110000047010000,Atari VCS Classic Controller,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b3,start:b2,platform:Mac OS X,
|
||||
03000000503200000210000047010000,Atari VCS Modern Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,platform:Mac OS X,
|
||||
030000008a3500000102000000010000,Backbone One,a:b0,b:b1,back:b16,dpdown:b11,dpleft:b13,dpright:b12,dpup:b10,guide:b17,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3~,start:b15,x:b2,y:b3,platform:Mac OS X,
|
||||
030000008a3500000201000000010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,
|
||||
030000008a3500000202000000010000,Backbone One,a:b0,b:b1,back:b16,dpdown:b11,dpleft:b13,dpright:b12,dpup:b10,guide:b17,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3~,start:b15,x:b2,y:b3,platform:Mac OS X,
|
||||
030000008a3500000402000000010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,
|
||||
030000008a3500000302000000010000,Backbone One PlayStationÆ Edition,a:b0,b:b1,back:b16,dpdown:b11,dpleft:b13,dpright:b12,dpup:b10,guide:b17,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3~,start:b15,x:b2,y:b3,platform:Mac OS X,
|
||||
03000000c62400001a89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X,
|
||||
03000000c62400001b89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,
|
||||
03000000d62000002a79000000010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
@@ -1018,6 +1030,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,platform:Mac OS X,
|
||||
030000000d0f0000f600000000010000,Switch Hori Pad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
|
||||
03000000457500002211000000010000,SZMY Power PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
03000000e40a00000307000001000000,Taito Egret II Mini Control Panel,a:b4,b:b2,back:b6,guide:b9,leftx:a0,lefty:a1,rightshoulder:b0,righttrigger:b1,start:b7,x:b8,y:b3,platform:Mac OS X,
|
||||
03000000e40a00000207000001000000,Taito Egret II Mini Controller,a:b4,b:b2,back:b6,guide:b9,leftx:a0,lefty:a1,rightshoulder:b0,righttrigger:b1,start:b7,x:b8,y:b3,platform:Mac OS X,
|
||||
03000000790000001c18000003100000,TGZ Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,
|
||||
03000000591c00002400000021000000,THEC64 Joystick,a:b0,b:b1,back:b6,leftshoulder:b4,leftx:a0,lefty:a4,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Mac OS X,
|
||||
03000000591c00002600000021000000,THEGamepad,a:b2,b:b1,back:b6,dpdown:+a4,dpleft:-a0,dpright:+a0,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b0,platform:Mac OS X,
|
||||
@@ -1164,20 +1178,24 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
05000000503200000210000045010000,Atari Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
|
||||
05000000503200000210000046010000,Atari Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux,
|
||||
05000000503200000210000047010000,Atari VCS Modern Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:-a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,platform:Linux,
|
||||
030000008a3500000201000011010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
030000008a3500000202000011010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
030000008a3500000302000011010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
030000008a3500000402000011010000,Backbone One,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000c62400001b89000011010000,BDA MOGA XP5X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000c21100000791000011010000,Be1 GC101 Controller 1.03,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
|
||||
03000000c31100000791000011010000,Be1 GC101 Controller 1.03,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
030000005e0400008e02000003030000,Be1 GC101 Xbox 360,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
03000000bc2000004d50000011010000,BEITONG A1T2 BFM,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
05000000bc2000000055000001000000,BETOP AX1 BFM,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000bc2000004d50000011010000,Beitong A1T2 BFM,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
05000000bc2000000055000001000000,Betop AX1 BFM,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000bc2000006412000011010000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b30,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
|
||||
030000006b1400000209000011010000,Bigben,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000120c0000200e000011010000,Brook Mars PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000120c0000210e000011010000,Brook Mars PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000120c0000f70e000011010000,Brook Universal Fighting Board,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
|
||||
03000000af1e00002400000010010000,ClockworkPI DevTerm,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b9,x:b3,y:b0,platform:Linux,
|
||||
03000000af1e00002400000010010000,Clockwork Pi DevTerm,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b9,x:b3,y:b0,platform:Linux,
|
||||
030000000b0400003365000000010000,Competition Pro,a:b0,b:b1,back:b2,leftx:a0,lefty:a1,start:b3,platform:Linux,
|
||||
03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Linux,
|
||||
03000000a306000022f6000011010000,Cyborg V3 Rumble,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
|
||||
@@ -1261,6 +1279,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000242e00008816000001010000,Hyperkin X91,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
|
||||
03000000f00300008d03000011010000,HyperX Clutch,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000830500006020000010010000,iBuffalo Super Famicom Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,
|
||||
030000008f0e00001330000001010000,iCode Retro Adapter,b:b3,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b9,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b1,start:b7,x:b2,y:b0,platform:Linux,
|
||||
050000006964726f69643a636f6e0000,idroidcon Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000b50700001503000010010000,Impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux,
|
||||
03000000d80400008200000003000000,IMS PCU0,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b5,x:b3,y:b2,platform:Linux,
|
||||
@@ -1573,6 +1592,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000457500000401000011010000,SZMY Power DS4 Wired Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000457500002211000010010000,SZMY Power Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux,
|
||||
030000008f0e00001431000010010000,SZMY Power PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000e40a00000307000011010000,Taito Egret II Mini Control Panel,a:b4,b:b2,back:b6,guide:b9,leftx:a0,lefty:a1,rightshoulder:b0,righttrigger:b1,start:b7,x:b8,y:b3,platform:Linux,
|
||||
03000000e40a00000207000011010000,Taito Egret II Mini Controller,a:b4,b:b2,back:b6,guide:b9,leftx:a0,lefty:a1,rightshoulder:b0,righttrigger:b1,start:b7,x:b8,y:b3,platform:Linux,
|
||||
03000000ba2200000701000001010000,Technology Innovation PS2 Adapter,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a5,righty:a2,start:b9,x:b3,y:b2,platform:Linux,
|
||||
03000000790000001c18000011010000,TGZ Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000591c00002400000010010000,THEC64 Joystick,a:b0,b:b1,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Linux,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 95 KiB |
@@ -491,6 +491,10 @@ float4 sample_depth(float2 st, float2 pos)
|
||||
{
|
||||
t.a = t.a >= 128.0f ? 255.0f * TA.y : ((PS_AEM == 0) || any(bool3(t.rgb))) ? 255.0f * TA.x : 0.0f;
|
||||
}
|
||||
else if (PS_PAL_FMT != 0 && !PS_TALES_OF_ABYSS_HLE && !PS_URBAN_CHAOS_HLE)
|
||||
{
|
||||
t = trunc(sample_4p(uint4(t.aaaa))[0] * 255.0f + 0.05f);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
@@ -631,7 +635,7 @@ float4 sample_color(float2 st, float uv_w)
|
||||
}
|
||||
else if(PS_AEM_FMT == FMT_16)
|
||||
{
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : !PS_AEM || any(c[i].rgb) ? TA.x : 0;
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : !PS_AEM || any(int3(c[i].rgb * 255.0f) & 0xF8) ? TA.x : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,6 +746,25 @@ float4 ps_color(PS_INPUT input)
|
||||
float4 T = sample_color(st, input.t.w);
|
||||
#endif
|
||||
|
||||
if (PS_SHUFFLE && !PS_SHUFFLE_SAME && !PS_READ16_SRC)
|
||||
{
|
||||
uint4 denorm_c_before = uint4(T);
|
||||
if (PS_READ_BA)
|
||||
{
|
||||
T.r = float((denorm_c_before.b << 3) & 0xF8);
|
||||
T.g = float(((denorm_c_before.b >> 2) & 0x38) | ((denorm_c_before.a << 6) & 0xC0));
|
||||
T.b = float((denorm_c_before.a << 1) & 0xF8);
|
||||
T.a = float(denorm_c_before.a & 0x80);
|
||||
}
|
||||
else
|
||||
{
|
||||
T.r = float((denorm_c_before.r << 3) & 0xF8);
|
||||
T.g = float(((denorm_c_before.r >> 2) & 0x38) | ((denorm_c_before.g << 6) & 0xC0));
|
||||
T.b = float((denorm_c_before.g << 1) & 0xF8);
|
||||
T.a = float(denorm_c_before.g & 0x80);
|
||||
}
|
||||
}
|
||||
|
||||
float4 C = tfx(T, input.c);
|
||||
|
||||
atst(C);
|
||||
@@ -925,48 +948,6 @@ PS_OUTPUT ps_main(PS_INPUT input)
|
||||
discard;
|
||||
}
|
||||
|
||||
if (PS_SHUFFLE)
|
||||
{
|
||||
uint4 denorm_c = uint4(C);
|
||||
uint2 denorm_TA = uint2(float2(TA.xy) * 255.0f + 0.5f);
|
||||
|
||||
// Special case for 32bit input and 16bit output, shuffle used by The Godfather
|
||||
if (PS_SHUFFLE_SAME)
|
||||
{
|
||||
if (PS_READ_BA)
|
||||
C = (float4)(float((denorm_c.b & 0x7Fu) | (denorm_c.a & 0x80u)));
|
||||
else
|
||||
C.ga = C.rg;
|
||||
}
|
||||
// Copy of a 16bit source in to this target
|
||||
else if (PS_READ16_SRC)
|
||||
{
|
||||
C.rb = (float2)float((denorm_c.r >> 3) | (((denorm_c.g >> 3) & 0x7u) << 5));
|
||||
if (denorm_c.a & 0x80u)
|
||||
C.ga = (float2)float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.y & 0x80u));
|
||||
else
|
||||
C.ga = (float2)float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.x & 0x80u));
|
||||
}
|
||||
// Write RB part. Mask will take care of the correct destination
|
||||
else if (PS_READ_BA)
|
||||
{
|
||||
C.rb = C.bb;
|
||||
if (denorm_c.a & 0x80u)
|
||||
C.ga = (float2)(float((denorm_c.a & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = (float2)(float((denorm_c.a & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
}
|
||||
else
|
||||
{
|
||||
C.rb = C.rr;
|
||||
if (denorm_c.g & 0x80u)
|
||||
C.ga = (float2)(float((denorm_c.g & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
|
||||
else
|
||||
C.ga = (float2)(float((denorm_c.g & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
}
|
||||
}
|
||||
|
||||
// Must be done before alpha correction
|
||||
|
||||
// AA (Fixed one) will output a coverage of 1.0 as alpha
|
||||
@@ -1023,6 +1004,63 @@ PS_OUTPUT ps_main(PS_INPUT input)
|
||||
|
||||
ps_blend(C, alpha_blend, input.p.xy);
|
||||
|
||||
if (PS_SHUFFLE)
|
||||
{
|
||||
if (!PS_SHUFFLE_SAME && !PS_READ16_SRC)
|
||||
{
|
||||
uint4 denorm_c_after = uint4(C);
|
||||
if (PS_READ_BA)
|
||||
{
|
||||
C.b = float(((denorm_c_after.r >> 3) & 0x1F) | ((denorm_c_after.g << 2) & 0xE0));
|
||||
C.a = float(((denorm_c_after.g >> 6) & 0x3) | ((denorm_c_after.b >> 1) & 0x7C) | (denorm_c_after.a & 0x80));
|
||||
}
|
||||
else
|
||||
{
|
||||
C.r = float(((denorm_c_after.r >> 3) & 0x1F) | ((denorm_c_after.g << 2) & 0xE0));
|
||||
C.g = float(((denorm_c_after.g >> 6) & 0x3) | ((denorm_c_after.b >> 1) & 0x7C) | (denorm_c_after.a & 0x80));
|
||||
}
|
||||
}
|
||||
|
||||
uint4 denorm_c = uint4(C);
|
||||
uint2 denorm_TA = uint2(float2(TA.xy) * 255.0f + 0.5f);
|
||||
|
||||
// Special case for 32bit input and 16bit output, shuffle used by The Godfather
|
||||
if (PS_SHUFFLE_SAME)
|
||||
{
|
||||
if (PS_READ_BA)
|
||||
C = (float4)(float((denorm_c.b & 0x7Fu) | (denorm_c.a & 0x80u)));
|
||||
else
|
||||
C.ga = C.rg;
|
||||
}
|
||||
// Copy of a 16bit source in to this target
|
||||
else if (PS_READ16_SRC)
|
||||
{
|
||||
C.rb = (float2)float((denorm_c.r >> 3) | (((denorm_c.g >> 3) & 0x7u) << 5));
|
||||
if (denorm_c.a & 0x80u)
|
||||
C.ga = (float2)float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.y & 0x80u));
|
||||
else
|
||||
C.ga = (float2)float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.x & 0x80u));
|
||||
}
|
||||
// Write RB part. Mask will take care of the correct destination
|
||||
else if (PS_READ_BA)
|
||||
{
|
||||
C.rb = C.bb;
|
||||
if (denorm_c.a & 0x80u)
|
||||
C.ga = (float2)(float((denorm_c.a & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = (float2)(float((denorm_c.a & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
}
|
||||
else
|
||||
{
|
||||
C.rb = C.rr;
|
||||
if (denorm_c.g & 0x80u)
|
||||
C.ga = (float2)(float((denorm_c.g & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
|
||||
else
|
||||
C.ga = (float2)(float((denorm_c.g & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
}
|
||||
}
|
||||
|
||||
ps_dither(C.rgb, input.p.xy);
|
||||
|
||||
// Color clamp/wrap needs to be done after sw blending and dithering
|
||||
|
||||
@@ -440,15 +440,15 @@ vec4 sample_depth(vec2 st)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// warning t ranges from 0 to 255
|
||||
#if (PS_AEM_FMT == FMT_24)
|
||||
t.a = ( (PS_AEM == 0) || any(bvec3(t.rgb)) ) ? 255.0f * TA.x : 0.0f;
|
||||
#elif (PS_AEM_FMT == FMT_16)
|
||||
t.a = t.a >= 128.0f ? 255.0f * TA.y : ( (PS_AEM == 0) || any(bvec3(t.rgb)) ) ? 255.0f * TA.x : 0.0f;
|
||||
#elif PS_PAL_FMT != 0 && !PS_TALES_OF_ABYSS_HLE && !PS_URBAN_CHAOS_HLE
|
||||
t = trunc(sample_4p(uvec4(t.aaaa))[0] * 255.0f + 0.05f);
|
||||
#endif
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ vec4 sample_color(vec2 st)
|
||||
c[i].a = ( (PS_AEM == 0) || any(bvec3(c[i].rgb)) ) ? TA.x : 0.0f;
|
||||
//c[i].a = ( (PS_AEM == 0) || (sum > 0.0f) ) ? TA.x : 0.0f;
|
||||
#elif (PS_AEM_FMT == FMT_16)
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(bvec3(c[i].rgb)) ) ? TA.x : 0.0f;
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(bvec3(ivec3(c[i].rgb * 255.0f) & ivec3(0xF8))) ) ? TA.x : 0.0f;
|
||||
//c[i].a = c[i].a >= 0.5 ? TA.y : ( (PS_AEM == 0) || (sum > 0.0f) ) ? TA.x : 0.0f;
|
||||
#endif
|
||||
}
|
||||
@@ -687,6 +687,21 @@ vec4 ps_color()
|
||||
vec4 T = sample_color(st);
|
||||
#endif
|
||||
|
||||
#if PS_SHUFFLE && !PS_SHUFFLE_SAME && !PS_READ16_SRC
|
||||
uvec4 denorm_c_before = uvec4(T);
|
||||
#if PS_READ_BA
|
||||
T.r = float((denorm_c_before.b << 3) & 0xF8);
|
||||
T.g = float(((denorm_c_before.b >> 2) & 0x38) | ((denorm_c_before.a << 6) & 0xC0));
|
||||
T.b = float((denorm_c_before.a << 1) & 0xF8);
|
||||
T.a = float(denorm_c_before.a & 0x80);
|
||||
#else
|
||||
T.r = float((denorm_c_before.r << 3) & 0xF8);
|
||||
T.g = float(((denorm_c_before.r >> 2) & 0x38) | ((denorm_c_before.g << 6) & 0xC0));
|
||||
T.b = float((denorm_c_before.g << 1) & 0xF8);
|
||||
T.a = float(denorm_c_before.g & 0x80);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec4 C = tfx(T, PSin.c);
|
||||
|
||||
atst(C);
|
||||
@@ -937,7 +952,56 @@ void ps_main()
|
||||
|
||||
vec4 C = ps_color();
|
||||
|
||||
// Must be done before alpha correction
|
||||
|
||||
// AA (Fixed one) will output a coverage of 1.0 as alpha
|
||||
#if PS_FIXED_ONE_A
|
||||
C.a = 128.0f;
|
||||
#endif
|
||||
|
||||
#if SW_AD_TO_HW
|
||||
vec4 RT = trunc(fetch_rt() * 255.0f + 0.1f);
|
||||
vec4 alpha_blend = vec4(RT.a / 128.0f);
|
||||
#else
|
||||
vec4 alpha_blend = vec4(C.a / 128.0f);
|
||||
#endif
|
||||
|
||||
// Correct the ALPHA value based on the output format
|
||||
#if (PS_DST_FMT == FMT_16)
|
||||
float A_one = 128.0f; // alpha output will be 0x80
|
||||
C.a = (PS_FBA != 0) ? A_one : step(128.0f, C.a) * A_one;
|
||||
#elif (PS_DST_FMT == FMT_32) && (PS_FBA != 0)
|
||||
if(C.a < 128.0f) C.a += 128.0f;
|
||||
#endif
|
||||
|
||||
// Get first primitive that will write a failling alpha value
|
||||
#if PS_DATE == 1
|
||||
// DATM == 0
|
||||
// Pixel with alpha equal to 1 will failed (128-255)
|
||||
SV_Target0 = (C.a > 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
||||
return;
|
||||
#elif PS_DATE == 2
|
||||
// DATM == 1
|
||||
// Pixel with alpha equal to 0 will failed (0-127)
|
||||
SV_Target0 = (C.a < 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
||||
return;
|
||||
#endif
|
||||
|
||||
ps_blend(C, alpha_blend);
|
||||
|
||||
|
||||
#if PS_SHUFFLE
|
||||
#if !PS_SHUFFLE_SAME && !PS_READ16_SRC
|
||||
uvec4 denorm_c_after = uvec4(C);
|
||||
#if PS_READ_BA
|
||||
C.b = float(((denorm_c_after.r >> 3) & 0x1F) | ((denorm_c_after.g << 2) & 0xE0));
|
||||
C.a = float(((denorm_c_after.g >> 6) & 0x3) | ((denorm_c_after.b >> 1) & 0x7C) | (denorm_c_after.a & 0x80));
|
||||
#else
|
||||
C.r = float(((denorm_c_after.r >> 3) & 0x1F) | ((denorm_c_after.g << 2) & 0xE0));
|
||||
C.g = float(((denorm_c_after.g >> 6) & 0x3) | ((denorm_c_after.b >> 1) & 0x7C) | (denorm_c_after.a & 0x80));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uvec4 denorm_c = uvec4(C);
|
||||
uvec2 denorm_TA = uvec2(vec2(TA.xy) * 255.0f + 0.5f);
|
||||
|
||||
@@ -991,43 +1055,6 @@ void ps_main()
|
||||
#endif // PS_SHUFFLE_SAME
|
||||
#endif // PS_SHUFFLE
|
||||
|
||||
// Must be done before alpha correction
|
||||
|
||||
// AA (Fixed one) will output a coverage of 1.0 as alpha
|
||||
#if PS_FIXED_ONE_A
|
||||
C.a = 128.0f;
|
||||
#endif
|
||||
|
||||
#if SW_AD_TO_HW
|
||||
vec4 RT = trunc(fetch_rt() * 255.0f + 0.1f);
|
||||
vec4 alpha_blend = vec4(RT.a / 128.0f);
|
||||
#else
|
||||
vec4 alpha_blend = vec4(C.a / 128.0f);
|
||||
#endif
|
||||
|
||||
// Correct the ALPHA value based on the output format
|
||||
#if (PS_DST_FMT == FMT_16)
|
||||
float A_one = 128.0f; // alpha output will be 0x80
|
||||
C.a = (PS_FBA != 0) ? A_one : step(128.0f, C.a) * A_one;
|
||||
#elif (PS_DST_FMT == FMT_32) && (PS_FBA != 0)
|
||||
if(C.a < 128.0f) C.a += 128.0f;
|
||||
#endif
|
||||
|
||||
// Get first primitive that will write a failling alpha value
|
||||
#if PS_DATE == 1
|
||||
// DATM == 0
|
||||
// Pixel with alpha equal to 1 will failed (128-255)
|
||||
SV_Target0 = (C.a > 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
||||
return;
|
||||
#elif PS_DATE == 2
|
||||
// DATM == 1
|
||||
// Pixel with alpha equal to 0 will failed (0-127)
|
||||
SV_Target0 = (C.a < 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
||||
return;
|
||||
#endif
|
||||
|
||||
ps_blend(C, alpha_blend);
|
||||
|
||||
ps_dither(C.rgb);
|
||||
|
||||
// Color clamp/wrap needs to be done after sw blending and dithering
|
||||
|
||||
@@ -689,6 +689,10 @@ vec4 sample_depth(vec2 st, ivec2 pos)
|
||||
{
|
||||
t.a = t.a >= 128.0f ? 255.0f * TA.y : ((PS_AEM == 0) || any(bvec3(t.rgb))) ? 255.0f * TA.x : 0.0f;
|
||||
}
|
||||
#elif PS_PAL_FMT != 0 && !PS_TALES_OF_ABYSS_HLE && !PS_URBAN_CHAOS_HLE
|
||||
{
|
||||
t = trunc(sample_4p(uvec4(t.aaaa))[0] * 255.0f + 0.05f);
|
||||
}
|
||||
#endif
|
||||
|
||||
return t;
|
||||
@@ -817,7 +821,7 @@ vec4 sample_color(vec2 st)
|
||||
#if (PS_AEM_FMT == FMT_24)
|
||||
c[i].a = (PS_AEM == 0 || any(bvec3(c[i].rgb))) ? TA.x : 0.0f;
|
||||
#elif (PS_AEM_FMT == FMT_16)
|
||||
c[i].a = (c[i].a >= 0.5) ? TA.y : ((PS_AEM == 0 || any(bvec3(c[i].rgb))) ? TA.x : 0.0f);
|
||||
c[i].a = (c[i].a >= 0.5) ? TA.y : ((PS_AEM == 0 || any(bvec3(ivec3(c[i].rgb * 255.0f) & ivec3(0xF8)))) ? TA.x : 0.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -933,6 +937,21 @@ vec4 ps_color()
|
||||
vec4 T = sample_color(st);
|
||||
#endif
|
||||
|
||||
#if PS_SHUFFLE && !PS_SHUFFLE_SAME && !PS_READ16_SRC
|
||||
uvec4 denorm_c_before = uvec4(T);
|
||||
#if PS_READ_BA
|
||||
T.r = float((denorm_c_before.b << 3) & 0xF8);
|
||||
T.g = float(((denorm_c_before.b >> 2) & 0x38) | ((denorm_c_before.a << 6) & 0xC0));
|
||||
T.b = float((denorm_c_before.a << 1) & 0xF8);
|
||||
T.a = float(denorm_c_before.a & 0x80);
|
||||
#else
|
||||
T.r = float((denorm_c_before.r << 3) & 0xF8);
|
||||
T.g = float(((denorm_c_before.r >> 2) & 0x38) | ((denorm_c_before.g << 6) & 0xC0));
|
||||
T.b = float((denorm_c_before.g << 1) & 0xF8);
|
||||
T.a = float(denorm_c_before.g & 0x80);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec4 C = tfx(T, vsIn.c);
|
||||
|
||||
atst(C);
|
||||
@@ -1184,40 +1203,6 @@ void main()
|
||||
|
||||
vec4 C = ps_color();
|
||||
|
||||
#if PS_SHUFFLE
|
||||
uvec4 denorm_c = uvec4(C);
|
||||
uvec2 denorm_TA = uvec2(vec2(TA.xy) * 255.0f + 0.5f);
|
||||
|
||||
// Special case for 32bit input and 16bit output, shuffle used by The Godfather
|
||||
#if PS_SHUFFLE_SAME
|
||||
#if (PS_READ_BA)
|
||||
C = vec4(float((denorm_c.b & 0x7Fu) | (denorm_c.a & 0x80u)));
|
||||
#else
|
||||
C.ga = C.rg;
|
||||
#endif
|
||||
// Copy of a 16bit source in to this target
|
||||
#elif PS_READ16_SRC
|
||||
C.rb = vec2(float((denorm_c.r >> 3) | (((denorm_c.g >> 3) & 0x7u) << 5)));
|
||||
if ((denorm_c.a & 0x80u) != 0u)
|
||||
C.ga = vec2(float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = vec2(float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.x & 0x80u)));
|
||||
// Write RB part. Mask will take care of the correct destination
|
||||
#elif PS_READ_BA
|
||||
C.rb = C.bb;
|
||||
if ((denorm_c.a & 0x80u) != 0u)
|
||||
C.ga = vec2(float((denorm_c.a & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = vec2(float((denorm_c.a & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
#else
|
||||
C.rb = C.rr;
|
||||
if ((denorm_c.g & 0x80u) != 0u)
|
||||
C.ga = vec2(float((denorm_c.g & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = vec2(float((denorm_c.g & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
#endif // PS_SHUFFLE_SAME
|
||||
#endif // PS_SHUFFLE
|
||||
|
||||
// Must be done before alpha correction
|
||||
|
||||
// AA (Fixed one) will output a coverage of 1.0 as alpha
|
||||
@@ -1254,9 +1239,53 @@ void main()
|
||||
o_col0 = (C.a < 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
||||
|
||||
#else
|
||||
|
||||
ps_blend(C, alpha_blend);
|
||||
|
||||
#if PS_SHUFFLE
|
||||
#if !PS_SHUFFLE_SAME && !PS_READ16_SRC
|
||||
uvec4 denorm_c_after = uvec4(C);
|
||||
#if PS_READ_BA
|
||||
C.b = float(((denorm_c_after.r >> 3) & 0x1F) | ((denorm_c_after.g << 2) & 0xE0));
|
||||
C.a = float(((denorm_c_after.g >> 6) & 0x3) | ((denorm_c_after.b >> 1) & 0x7C) | (denorm_c_after.a & 0x80));
|
||||
#else
|
||||
C.r = float(((denorm_c_after.r >> 3) & 0x1F) | ((denorm_c_after.g << 2) & 0xE0));
|
||||
C.g = float(((denorm_c_after.g >> 6) & 0x3) | ((denorm_c_after.b >> 1) & 0x7C) | (denorm_c_after.a & 0x80));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uvec4 denorm_c = uvec4(C);
|
||||
uvec2 denorm_TA = uvec2(vec2(TA.xy) * 255.0f + 0.5f);
|
||||
|
||||
// Special case for 32bit input and 16bit output, shuffle used by The Godfather
|
||||
#if PS_SHUFFLE_SAME
|
||||
#if (PS_READ_BA)
|
||||
C = vec4(float((denorm_c.b & 0x7Fu) | (denorm_c.a & 0x80u)));
|
||||
#else
|
||||
C.ga = C.rg;
|
||||
#endif
|
||||
// Copy of a 16bit source in to this target
|
||||
#elif PS_READ16_SRC
|
||||
C.rb = vec2(float((denorm_c.r >> 3) | (((denorm_c.g >> 3) & 0x7u) << 5)));
|
||||
if ((denorm_c.a & 0x80u) != 0u)
|
||||
C.ga = vec2(float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = vec2(float((denorm_c.g >> 6) | ((denorm_c.b >> 3) << 2) | (denorm_TA.x & 0x80u)));
|
||||
// Write RB part. Mask will take care of the correct destination
|
||||
#elif PS_READ_BA
|
||||
C.rb = C.bb;
|
||||
if ((denorm_c.a & 0x80u) != 0u)
|
||||
C.ga = vec2(float((denorm_c.a & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = vec2(float((denorm_c.a & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
#else
|
||||
C.rb = C.rr;
|
||||
if ((denorm_c.g & 0x80u) != 0u)
|
||||
C.ga = vec2(float((denorm_c.g & 0x7Fu) | (denorm_TA.y & 0x80u)));
|
||||
else
|
||||
C.ga = vec2(float((denorm_c.g & 0x7Fu) | (denorm_TA.x & 0x80u)));
|
||||
#endif // PS_SHUFFLE_SAME
|
||||
#endif // PS_SHUFFLE
|
||||
|
||||
ps_dither(C.rgb);
|
||||
|
||||
// Color clamp/wrap needs to be done after sw blending and dithering
|
||||
|
||||
@@ -4,7 +4,6 @@ set(PCSX2_DEFS "")
|
||||
#-------------------------------------------------------------------------------
|
||||
# Misc option
|
||||
#-------------------------------------------------------------------------------
|
||||
option(DISABLE_BUILD_DATE "Disable including the binary compile date")
|
||||
option(ENABLE_TESTS "Enables building the unit tests" ON)
|
||||
option(LTO_PCSX2_CORE "Enable LTO/IPO/LTCG on the subset of pcsx2 that benefits most from it but not anything else")
|
||||
option(USE_VTUNE "Plug VTUNE to profile GS JIT.")
|
||||
@@ -231,11 +230,6 @@ endif()
|
||||
|
||||
set(PCSX2_WARNINGS ${DEFAULT_WARNINGS})
|
||||
|
||||
if(DISABLE_BUILD_DATE)
|
||||
message(STATUS "Disabling the inclusion of the binary compile date.")
|
||||
list(APPEND PCSX2_DEFS DISABLE_BUILD_DATE)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# MacOS-specific things
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
+66
-50
@@ -1,7 +1,12 @@
|
||||
function(detect_operating_system)
|
||||
message(STATUS "CMake Version: ${CMAKE_VERSION}")
|
||||
message(STATUS "CMake System Name: ${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
# LINUX wasn't added until CMake 3.25.
|
||||
if (CMAKE_VERSION VERSION_LESS 3.25.0 AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# Have to make it visible in this scope as well for below.
|
||||
set(LINUX TRUE PARENT_SCOPE)
|
||||
set(LINUX TRUE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@@ -39,84 +44,92 @@ function(detect_compiler)
|
||||
endfunction()
|
||||
|
||||
function(get_git_version_info)
|
||||
set(PCSX2_WC_TIME 0)
|
||||
set(PCSX2_GIT_REV "")
|
||||
set(PCSX2_GIT_TAG "")
|
||||
set(PCSX2_GIT_HASH "")
|
||||
if (GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD
|
||||
OUTPUT_VARIABLE PCSX2_WC_TIME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# Output: "YYYY-MM-DD HH:MM:SS +HHMM" (last part is time zone, offset from UTC)
|
||||
string(REGEX REPLACE "[%:\\-]" "" PCSX2_WC_TIME "${PCSX2_WC_TIME}")
|
||||
string(REGEX REPLACE "([0-9]+) ([0-9]+).*" "\\1\\2" PCSX2_WC_TIME "${PCSX2_WC_TIME}")
|
||||
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --tags
|
||||
OUTPUT_VARIABLE PCSX2_GIT_REV
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} tag --points-at HEAD
|
||||
OUTPUT_VARIABLE PCSX2_GIT_TAG
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} tag --points-at HEAD --sort=version:refname
|
||||
OUTPUT_VARIABLE PCSX2_GIT_TAG_LIST
|
||||
RESULT_VARIABLE TAG_RESULT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
|
||||
# CAUTION: There is a race here, this solves the problem of a commit being tagged multiple times (take the last tag)
|
||||
# however, if simultaneous builds are pushing tags to the same commit you might get inconsistent results (it's a race)
|
||||
#
|
||||
# The easy solution is, don't do that, but just something to be aware of.
|
||||
if(PCSX2_GIT_TAG_LIST AND TAG_RESULT EQUAL 0)
|
||||
string(REPLACE "\n" ";" PCSX2_GIT_TAG_LIST "${PCSX2_GIT_TAG_LIST}")
|
||||
if (PCSX2_GIT_TAG_LIST)
|
||||
list(GET PCSX2_GIT_TAG_LIST -1 PCSX2_GIT_TAG)
|
||||
message("Using tag: ${PCSX2_GIT_TAG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||
OUTPUT_VARIABLE PCSX2_GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} log -1 --format=%cd --date=local
|
||||
OUTPUT_VARIABLE PCSX2_GIT_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
endif()
|
||||
if ("${PCSX2_GIT_TAG}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" PCSX2_VERSION_LONG "${PCSX2_GIT_TAG}")
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" PCSX2_VERSION_SHORT "${PCSX2_GIT_TAG}")
|
||||
elseif(PCSX2_GIT_REV)
|
||||
set(PCSX2_VERSION_LONG "${PCSX2_GIT_REV}")
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-z][a-z0-9]+)?" PCSX2_VERSION_SHORT "${PCSX2_VERSION_LONG}")
|
||||
else()
|
||||
set(PCSX2_VERSION_LONG "Unknown (git unavailable)")
|
||||
set(PCSX2_VERSION_SHORT "Unknown")
|
||||
endif()
|
||||
if ("${PCSX2_WC_TIME}" STREQUAL "")
|
||||
set(PCSX2_WC_TIME 0)
|
||||
if (NOT PCSX2_GIT_REV)
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE PCSX2_GIT_REV
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET)
|
||||
if (NOT PCSX2_GIT_REV)
|
||||
set(PCSX2_GIT_REV "Unknown")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(PCSX2_WC_TIME "${PCSX2_WC_TIME}" PARENT_SCOPE)
|
||||
set(PCSX2_GIT_REV "${PCSX2_GIT_REV}" PARENT_SCOPE)
|
||||
set(PCSX2_GIT_TAG "${PCSX2_GIT_TAG}" PARENT_SCOPE)
|
||||
set(PCSX2_GIT_HASH "${PCSX2_GIT_HASH}" PARENT_SCOPE)
|
||||
set(PCSX2_VERSION_LONG "${PCSX2_VERSION_LONG}" PARENT_SCOPE)
|
||||
set(PCSX2_VERSION_SHORT "${PCSX2_VERSION_SHORT}" PARENT_SCOPE)
|
||||
set(PCSX2_GIT_DATE "${PCSX2_GIT_DATE}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(write_svnrev_h)
|
||||
if(PCSX2_GIT_TAG)
|
||||
if ("${PCSX2_GIT_TAG}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
|
||||
"#define SVN_REV ${PCSX2_WC_TIME}ll\n"
|
||||
"#define GIT_TAG \"${PCSX2_GIT_TAG}\"\n"
|
||||
"#define GIT_TAGGED_COMMIT 1\n"
|
||||
"#define GIT_TAG_HI ${CMAKE_MATCH_1}\n"
|
||||
"#define GIT_TAG_MID ${CMAKE_MATCH_2}\n"
|
||||
"#define GIT_TAG_LO ${CMAKE_MATCH_3}\n"
|
||||
"#define GIT_REV \"\"\n"
|
||||
"#define GIT_HASH \"${PCSX2_GIT_HASH}\"\n"
|
||||
)
|
||||
else()
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
|
||||
"#define SVN_REV ${PCSX2_WC_TIME}ll\n"
|
||||
"#define GIT_TAG \"${PCSX2_GIT_TAG}\"\n"
|
||||
"#define GIT_TAGGED_COMMIT 1\n"
|
||||
"#define GIT_REV \"\"\n"
|
||||
"#define GIT_HASH \"${PCSX2_GIT_HASH}\"\n"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
|
||||
"#define SVN_REV ${PCSX2_WC_TIME}ll\n"
|
||||
if ("${PCSX2_GIT_TAG}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
|
||||
"#define GIT_TAG \"${PCSX2_GIT_TAG}\"\n"
|
||||
"#define GIT_TAGGED_COMMIT 1\n"
|
||||
"#define GIT_TAG_HI ${CMAKE_MATCH_1}\n"
|
||||
"#define GIT_TAG_MID ${CMAKE_MATCH_2}\n"
|
||||
"#define GIT_TAG_LO ${CMAKE_MATCH_3}\n"
|
||||
"#define GIT_REV \"${PCSX2_GIT_TAG}\"\n"
|
||||
"#define GIT_HASH \"${PCSX2_GIT_HASH}\"\n"
|
||||
"#define GIT_DATE \"${PCSX2_GIT_DATE}\"\n"
|
||||
)
|
||||
elseif ("${PCSX2_GIT_REV}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
|
||||
"#define GIT_TAG \"${PCSX2_GIT_TAG}\"\n"
|
||||
"#define GIT_TAGGED_COMMIT 0\n"
|
||||
"#define GIT_TAG_HI ${CMAKE_MATCH_1}\n"
|
||||
"#define GIT_TAG_MID ${CMAKE_MATCH_2}\n"
|
||||
"#define GIT_TAG_LO ${CMAKE_MATCH_3}\n"
|
||||
"#define GIT_REV \"${PCSX2_GIT_REV}\"\n"
|
||||
"#define GIT_HASH \"${PCSX2_GIT_HASH}\"\n"
|
||||
"#define GIT_DATE \"${PCSX2_GIT_DATE}\"\n"
|
||||
)
|
||||
else()
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
|
||||
"#define GIT_TAG \"${PCSX2_GIT_TAG}\"\n"
|
||||
"#define GIT_TAGGED_COMMIT 0\n"
|
||||
"#define GIT_TAG_HI 0\n"
|
||||
"#define GIT_TAG_MID 0\n"
|
||||
"#define GIT_TAG_LO 0\n"
|
||||
"#define GIT_REV \"${PCSX2_GIT_REV}\"\n"
|
||||
"#define GIT_HASH \"${PCSX2_GIT_HASH}\"\n"
|
||||
"#define GIT_DATE \"${PCSX2_GIT_DATE}\"\n"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -200,6 +213,9 @@ function(fixup_file_properties target)
|
||||
if("${source}" MATCHES "\\.(inl|h)$")
|
||||
set_source_files_properties("${source}" PROPERTIES XCODE_EXPLICIT_FILE_TYPE sourcecode.cpp.h)
|
||||
endif()
|
||||
if("${source}" MATCHES "\\.(qm)$")
|
||||
set_source_files_properties("${source}" PROPERTIES XCODE_EXPLICIT_FILE_TYPE compiled)
|
||||
endif()
|
||||
# CMake makefile and ninja generators will attempt to share one PCH for both cpp and mm files
|
||||
# That's not actually OK
|
||||
if("${source}" MATCHES "\\.mm$")
|
||||
|
||||
@@ -90,7 +90,7 @@ endif(WIN32)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# Also need SDL2.
|
||||
find_package(SDL2 2.28.5 REQUIRED)
|
||||
find_package(SDL2 2.30.0 REQUIRED)
|
||||
|
||||
set(ACTUALLY_ENABLE_TESTS ${ENABLE_TESTS})
|
||||
if(ENABLE_TESTS)
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace CocoaTools
|
||||
std::optional<std::string> MoveToTrash(std::string_view file);
|
||||
/// Launch the given application once this one quits
|
||||
bool DelayedLaunch(std::string_view file);
|
||||
/// Open a Finder window to the given URL
|
||||
bool ShowInFinder(std::string_view file);
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
+15
-2
@@ -17,6 +17,11 @@
|
||||
|
||||
// MARK: - Metal Layers
|
||||
|
||||
static NSString*_Nonnull NSStringFromStringView(std::string_view sv)
|
||||
{
|
||||
return [[NSString alloc] initWithBytes:sv.data() length:sv.size() encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
bool CocoaTools::CreateMetalLayer(WindowInfo* wi)
|
||||
{
|
||||
if (![NSThread isMainThread])
|
||||
@@ -156,7 +161,7 @@ std::optional<std::string> CocoaTools::GetNonTranslocatedBundlePath()
|
||||
|
||||
std::optional<std::string> CocoaTools::MoveToTrash(std::string_view file)
|
||||
{
|
||||
NSURL* url = [NSURL fileURLWithPath:[[NSString alloc] initWithBytes:file.data() length:file.size() encoding:NSUTF8StringEncoding]];
|
||||
NSURL* url = [NSURL fileURLWithPath:NSStringFromStringView(file)];
|
||||
NSURL* new_url;
|
||||
if (![[NSFileManager defaultManager] trashItemAtURL:url resultingItemURL:&new_url error:nil])
|
||||
return std::nullopt;
|
||||
@@ -170,9 +175,17 @@ bool CocoaTools::DelayedLaunch(std::string_view file)
|
||||
[task setExecutableURL:[NSURL fileURLWithPath:@"/bin/sh"]];
|
||||
[task setEnvironment:@{
|
||||
@"WAITPID": [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
|
||||
@"LAUNCHAPP": [[NSString alloc] initWithBytes:file.data() length:file.size() encoding:NSUTF8StringEncoding],
|
||||
@"LAUNCHAPP": NSStringFromStringView(file),
|
||||
}];
|
||||
[task setArguments:@[@"-c", @"while /bin/ps -p $WAITPID > /dev/null; do /bin/sleep 0.1; done; exec /usr/bin/open \"$LAUNCHAPP\";"]];
|
||||
return [task launchAndReturnError:nil];
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Directory Services
|
||||
|
||||
bool CocoaTools::ShowInFinder(std::string_view file)
|
||||
{
|
||||
return [[NSWorkspace sharedWorkspace] selectFile:NSStringFromStringView(file)
|
||||
inFileViewerRootedAtPath:nil];
|
||||
}
|
||||
|
||||
+455
-470
@@ -1,524 +1,509 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "common/Threading.h"
|
||||
#include "common/TraceLog.h"
|
||||
#include "common/Console.h"
|
||||
#include "common/Assertions.h"
|
||||
#include "common/RedtapeWindows.h" // OutputDebugString
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/SmallString.h"
|
||||
#include "common/Timer.h"
|
||||
|
||||
using namespace Threading;
|
||||
#include "fmt/format.h"
|
||||
|
||||
// thread-local console indentation setting.
|
||||
static thread_local int conlog_Indent(0);
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// thread-local console color storage.
|
||||
static thread_local ConsoleColors conlog_Color(DefaultConsoleColor);
|
||||
|
||||
#ifdef __POSIX__
|
||||
#ifdef _WIN32
|
||||
#include "common/RedtapeWindows.h"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
|
||||
static FILE* stdout_fp = stdout;
|
||||
|
||||
static bool checkSupportsColor()
|
||||
{
|
||||
if (!isatty(fileno(stdout_fp)))
|
||||
return false;
|
||||
char* term = getenv("TERM");
|
||||
if (!term || (0 == strcmp(term, "dumb")))
|
||||
return false;
|
||||
return true; // Probably supports color
|
||||
}
|
||||
|
||||
static bool supports_color = checkSupportsColor();
|
||||
|
||||
void Console_SetStdout(FILE* fp)
|
||||
{
|
||||
stdout_fp = fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
// This function re-assigns the console log writer(s) to the specified target. It makes sure
|
||||
// to flush any contents from the buffered console log (which typically accumulates due to
|
||||
// log suspension during log file/window re-init operations) into the new log.
|
||||
//
|
||||
// Important! Only Assert and Null console loggers are allowed during C++ startup init (when
|
||||
// the program or DLL first loads). Other log targets rely on the static buffer and a
|
||||
// threaded mutex lock, which are only valid after C++ initialization has finished.
|
||||
void Console_SetActiveHandler(const IConsoleWriter& writer, FILE* flushfp)
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
// Dummy objects, need to get rid of them...
|
||||
ConsoleLogWriter<LOGLEVEL_INFO> Console;
|
||||
ConsoleLogWriter<LOGLEVEL_DEV> DevCon;
|
||||
|
||||
#ifdef _DEBUG
|
||||
ConsoleLogWriter<LOGLEVEL_DEBUG> DbgConWriter;
|
||||
#else
|
||||
NullLogWriter DbgConWriter;
|
||||
#endif
|
||||
|
||||
#define TIMESTAMP_FORMAT_STRING "[{:10.4f}] "
|
||||
#define TIMESTAMP_PRINTF_STRING "[%10.4f] "
|
||||
|
||||
namespace Log
|
||||
{
|
||||
pxAssertMsg(
|
||||
(writer.WriteRaw != NULL) && (writer.DoWriteLn != NULL) &&
|
||||
(writer.Newline != NULL) && (writer.SetTitle != NULL) &&
|
||||
(writer.DoSetColor != NULL),
|
||||
"Invalid IConsoleWriter object! All function pointer interfaces must be implemented.");
|
||||
static void WriteToConsole(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
static void WriteToDebug(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
static void WriteToFile(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
|
||||
Console = writer;
|
||||
DevConWriter = writer;
|
||||
static void UpdateMaxLevel();
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
DbgCon = writer;
|
||||
static void ExecuteCallbacks(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
|
||||
static Common::Timer::Value s_start_timestamp = Common::Timer::GetCurrentValue();
|
||||
|
||||
static LOGLEVEL s_max_level = LOGLEVEL_NONE;
|
||||
static LOGLEVEL s_console_level = LOGLEVEL_NONE;
|
||||
static LOGLEVEL s_debug_level = LOGLEVEL_NONE;
|
||||
static LOGLEVEL s_file_level = LOGLEVEL_NONE;
|
||||
static LOGLEVEL s_host_level = LOGLEVEL_NONE;
|
||||
static bool s_log_timestamps = true;
|
||||
|
||||
static FileSystem::ManagedCFilePtr s_file_handle;
|
||||
static std::string s_file_path;
|
||||
static std::mutex s_file_mutex;
|
||||
|
||||
static HostCallbackType s_host_callback;
|
||||
|
||||
#ifdef _WIN32
|
||||
static HANDLE s_hConsoleStdIn = NULL;
|
||||
static HANDLE s_hConsoleStdOut = NULL;
|
||||
static HANDLE s_hConsoleStdErr = NULL;
|
||||
#endif
|
||||
} // namespace Log
|
||||
|
||||
float Log::GetCurrentMessageTime()
|
||||
{
|
||||
return static_cast<float>(Common::Timer::ConvertValueToSeconds(Common::Timer::GetCurrentValue() - s_start_timestamp));
|
||||
}
|
||||
|
||||
__ri void Log::WriteToConsole(LOGLEVEL level, ConsoleColors color, std::string_view message)
|
||||
{
|
||||
static constexpr std::string_view s_ansi_color_codes[ConsoleColors_Count] = {
|
||||
"\033[0m"sv, // default
|
||||
"\033[30m\033[1m"sv, // black
|
||||
"\033[32m"sv, // green
|
||||
"\033[31m"sv, // red
|
||||
"\033[34m"sv, // blue
|
||||
"\033[35m"sv, // magenta
|
||||
"\033[35m"sv, // orange (FIXME)
|
||||
"\033[37m"sv, // gray
|
||||
"\033[36m"sv, // cyan
|
||||
"\033[33m"sv, // yellow
|
||||
"\033[37m"sv, // white
|
||||
"\033[30m\033[1m"sv, // strong black
|
||||
"\033[31m\033[1m"sv, // strong red
|
||||
"\033[32m\033[1m"sv, // strong green
|
||||
"\033[34m\033[1m"sv, // strong blue
|
||||
"\033[35m\033[1m"sv, // strong magenta
|
||||
"\033[35m\033[1m"sv, // strong orange (FIXME)
|
||||
"\033[37m\033[1m"sv, // strong gray
|
||||
"\033[36m\033[1m"sv, // strong cyan
|
||||
"\033[33m\033[1m"sv, // strong yellow
|
||||
"\033[37m\033[1m"sv, // strong white
|
||||
};
|
||||
|
||||
static constexpr size_t BUFFER_SIZE = 512;
|
||||
|
||||
SmallStackString<BUFFER_SIZE> buffer;
|
||||
buffer.reserve(32 + message.length());
|
||||
buffer.append(s_ansi_color_codes[color]);
|
||||
|
||||
if (s_log_timestamps)
|
||||
buffer.append_fmt(TIMESTAMP_FORMAT_STRING, Log::GetCurrentMessageTime());
|
||||
|
||||
buffer.append(message);
|
||||
buffer.append('\n');
|
||||
|
||||
#ifdef _WIN32
|
||||
const HANDLE hOutput = (level <= LOGLEVEL_WARNING) ? s_hConsoleStdErr : s_hConsoleStdOut;
|
||||
|
||||
// Convert to UTF-16 first so Unicode characters display correctly. NT is going to do it anyway...
|
||||
wchar_t wbuf[BUFFER_SIZE];
|
||||
wchar_t* wmessage_buf = wbuf;
|
||||
int wmessage_buflen = static_cast<int>(std::size(wbuf) - 1);
|
||||
if (buffer.length() >= std::size(wbuf))
|
||||
{
|
||||
wmessage_buflen = static_cast<int>(buffer.length());
|
||||
wmessage_buf = static_cast<wchar_t*>(std::malloc(static_cast<size_t>(wmessage_buflen) * sizeof(wchar_t)));
|
||||
if (!wmessage_buf)
|
||||
return;
|
||||
}
|
||||
|
||||
const int wmessage_size = MultiByteToWideChar(CP_UTF8, 0, buffer.data(), static_cast<int>(buffer.length()), wmessage_buf, wmessage_buflen);
|
||||
if (wmessage_size <= 0)
|
||||
goto cleanup;
|
||||
|
||||
DWORD chars_written;
|
||||
WriteConsoleW(hOutput, wmessage_buf, static_cast<DWORD>(wmessage_size), &chars_written, nullptr);
|
||||
|
||||
cleanup:
|
||||
if (wmessage_buf != wbuf)
|
||||
std::free(wmessage_buf);
|
||||
#else
|
||||
const int fd = (level <= LOGLEVEL_WARNING) ? STDERR_FILENO : STDOUT_FILENO;
|
||||
write(fd, buffer.data(), buffer.length());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Writes text to the Visual Studio Output window (Microsoft Windows only).
|
||||
// On all other platforms this pipes to Stdout instead.
|
||||
static void MSW_OutputDebugString(const char* text)
|
||||
bool Log::IsConsoleOutputEnabled()
|
||||
{
|
||||
return (s_console_level > LOGLEVEL_NONE);
|
||||
}
|
||||
|
||||
void Log::SetConsoleOutputLevel(LOGLEVEL level)
|
||||
{
|
||||
if (s_console_level == level)
|
||||
return;
|
||||
|
||||
const bool was_enabled = (s_console_level > LOGLEVEL_NONE);
|
||||
const bool now_enabled = (level > LOGLEVEL_NONE);
|
||||
s_console_level = level;
|
||||
UpdateMaxLevel();
|
||||
|
||||
if (was_enabled == now_enabled)
|
||||
return;
|
||||
|
||||
// Worst that happens here is we write to a bad handle..
|
||||
|
||||
#if defined(_WIN32)
|
||||
static constexpr auto enable_virtual_terminal_processing = [](HANDLE hConsole) {
|
||||
DWORD old_mode;
|
||||
if (!GetConsoleMode(hConsole, &old_mode))
|
||||
return;
|
||||
|
||||
// already enabled?
|
||||
if (old_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
|
||||
return;
|
||||
|
||||
SetConsoleMode(hConsole, old_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
};
|
||||
|
||||
// On windows, no console is allocated by default on a windows based application
|
||||
static bool console_was_allocated = false;
|
||||
static HANDLE old_stdin = NULL;
|
||||
static HANDLE old_stdout = NULL;
|
||||
static HANDLE old_stderr = NULL;
|
||||
|
||||
if (now_enabled)
|
||||
{
|
||||
old_stdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
old_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
old_stderr = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
if (!old_stdout)
|
||||
{
|
||||
// Attach to the parent console if we're running from a command window
|
||||
if (!AttachConsole(ATTACH_PARENT_PROCESS) && !AllocConsole())
|
||||
return;
|
||||
|
||||
s_hConsoleStdIn = GetStdHandle(STD_INPUT_HANDLE);
|
||||
s_hConsoleStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
s_hConsoleStdErr = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
enable_virtual_terminal_processing(s_hConsoleStdOut);
|
||||
enable_virtual_terminal_processing(s_hConsoleStdErr);
|
||||
|
||||
std::FILE* fp;
|
||||
freopen_s(&fp, "CONIN$", "r", stdin);
|
||||
freopen_s(&fp, "CONOUT$", "w", stdout);
|
||||
freopen_s(&fp, "CONOUT$", "w", stderr);
|
||||
|
||||
console_was_allocated = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_hConsoleStdIn = old_stdin;
|
||||
s_hConsoleStdOut = old_stdout;
|
||||
s_hConsoleStdErr = old_stderr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (console_was_allocated)
|
||||
{
|
||||
console_was_allocated = false;
|
||||
|
||||
std::FILE* fp;
|
||||
freopen_s(&fp, "NUL:", "w", stderr);
|
||||
freopen_s(&fp, "NUL:", "w", stdout);
|
||||
freopen_s(&fp, "NUL:", "w", stdin);
|
||||
|
||||
SetStdHandle(STD_ERROR_HANDLE, old_stderr);
|
||||
SetStdHandle(STD_OUTPUT_HANDLE, old_stdout);
|
||||
SetStdHandle(STD_INPUT_HANDLE, old_stdin);
|
||||
|
||||
s_hConsoleStdIn = NULL;
|
||||
s_hConsoleStdOut = NULL;
|
||||
s_hConsoleStdErr = NULL;
|
||||
|
||||
FreeConsole();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__ri void Log::WriteToDebug(LOGLEVEL level, ConsoleColors color, std::string_view message)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
static bool hasDebugger = IsDebuggerPresent();
|
||||
if (hasDebugger)
|
||||
OutputDebugStringA(text);
|
||||
static constexpr size_t BUFFER_SIZE = 512;
|
||||
|
||||
// Convert to UTF-16 first so Unicode characters display correctly. NT is going to do it anyway...
|
||||
wchar_t wbuf[BUFFER_SIZE];
|
||||
wchar_t* wmessage_buf = wbuf;
|
||||
int wmessage_buflen = static_cast<int>(std::size(wbuf) - 1);
|
||||
if (message.length() >= std::size(wbuf))
|
||||
{
|
||||
wmessage_buflen = static_cast<int>(message.length());
|
||||
wmessage_buf = static_cast<wchar_t*>(std::malloc((static_cast<size_t>(wmessage_buflen) + 2) * sizeof(wchar_t)));
|
||||
if (!wmessage_buf)
|
||||
return;
|
||||
}
|
||||
|
||||
int wmessage_size = 0;
|
||||
if (!message.empty()) [[likely]]
|
||||
{
|
||||
wmessage_size = MultiByteToWideChar(CP_UTF8, 0, message.data(), static_cast<int>(message.length()), wmessage_buf, wmessage_buflen);
|
||||
if (wmessage_size <= 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
wmessage_buf[wmessage_size++] = L'\n';
|
||||
wmessage_buf[wmessage_size++] = 0;
|
||||
OutputDebugStringW(wmessage_buf);
|
||||
|
||||
cleanup:
|
||||
if (wmessage_buf != wbuf)
|
||||
std::free(wmessage_buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Log::IsDebugOutputAvailable()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return IsDebuggerPresent();
|
||||
#else
|
||||
fputs(text, stdout_fp);
|
||||
fflush(stdout_fp);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleNull
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void ConsoleNull_SetTitle(const char* title) {}
|
||||
static void ConsoleNull_DoSetColor(ConsoleColors color) {}
|
||||
static void ConsoleNull_Newline() {}
|
||||
static void ConsoleNull_DoWrite(const char* fmt) {}
|
||||
static void ConsoleNull_DoWriteLn(const char* fmt) {}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Null =
|
||||
{
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_DoWriteLn,
|
||||
ConsoleNull_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_Newline,
|
||||
ConsoleNull_SetTitle,
|
||||
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Console_Stdout
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__POSIX__)
|
||||
static __fi const char* GetLinuxConsoleColor(ConsoleColors color)
|
||||
bool Log::IsDebugOutputEnabled()
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case Color_Black:
|
||||
case Color_StrongBlack:
|
||||
return "\033[30m\033[1m";
|
||||
|
||||
case Color_Red:
|
||||
return "\033[31m";
|
||||
case Color_StrongRed:
|
||||
return "\033[31m\033[1m";
|
||||
|
||||
case Color_Green:
|
||||
return "\033[32m";
|
||||
case Color_StrongGreen:
|
||||
return "\033[32m\033[1m";
|
||||
|
||||
case Color_Yellow:
|
||||
return "\033[33m";
|
||||
case Color_StrongYellow:
|
||||
return "\033[33m\033[1m";
|
||||
|
||||
case Color_Blue:
|
||||
return "\033[34m";
|
||||
case Color_StrongBlue:
|
||||
return "\033[34m\033[1m";
|
||||
|
||||
// No orange, so use magenta.
|
||||
case Color_Orange:
|
||||
case Color_Magenta:
|
||||
return "\033[35m";
|
||||
case Color_StrongOrange:
|
||||
case Color_StrongMagenta:
|
||||
return "\033[35m\033[1m";
|
||||
|
||||
case Color_Cyan:
|
||||
return "\033[36m";
|
||||
case Color_StrongCyan:
|
||||
return "\033[36m\033[1m";
|
||||
|
||||
// Use 'white' instead of grey.
|
||||
case Color_Gray:
|
||||
case Color_White:
|
||||
return "\033[37m";
|
||||
case Color_StrongGray:
|
||||
case Color_StrongWhite:
|
||||
return "\033[37m\033[1m";
|
||||
|
||||
// On some other value being passed, clear any formatting.
|
||||
case Color_Default:
|
||||
default:
|
||||
return "\033[0m";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// One possible default write action at startup and shutdown is to use the stdout.
|
||||
static void ConsoleStdout_DoWrite(const char* fmt)
|
||||
{
|
||||
MSW_OutputDebugString(fmt);
|
||||
return (s_console_level > LOGLEVEL_NONE);
|
||||
}
|
||||
|
||||
// Default write action at startup and shutdown is to use the stdout.
|
||||
static void ConsoleStdout_DoWriteLn(const char* fmt)
|
||||
void Log::SetDebugOutputLevel(LOGLEVEL level)
|
||||
{
|
||||
MSW_OutputDebugString(fmt);
|
||||
MSW_OutputDebugString("\n");
|
||||
s_debug_level = level;
|
||||
UpdateMaxLevel();
|
||||
}
|
||||
|
||||
static void ConsoleStdout_Newline()
|
||||
__ri void Log::WriteToFile(LOGLEVEL level, ConsoleColors color, std::string_view message)
|
||||
{
|
||||
MSW_OutputDebugString("\n");
|
||||
}
|
||||
|
||||
static void ConsoleStdout_DoSetColor(ConsoleColors color)
|
||||
{
|
||||
#if defined(__POSIX__)
|
||||
if (!supports_color)
|
||||
std::unique_lock lock(s_file_mutex);
|
||||
if (!s_file_handle) [[unlikely]]
|
||||
return;
|
||||
fprintf(stdout_fp, "\033[0m%s", GetLinuxConsoleColor(color));
|
||||
fflush(stdout_fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ConsoleStdout_SetTitle(const char* title)
|
||||
{
|
||||
#if defined(__POSIX__)
|
||||
if (supports_color)
|
||||
fputs("\033]0;", stdout_fp);
|
||||
fputs(title, stdout_fp);
|
||||
if (supports_color)
|
||||
fputs("\007", stdout_fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Stdout =
|
||||
if (!message.empty()) [[likely]]
|
||||
{
|
||||
ConsoleStdout_DoWrite, // Writes without newlines go to buffer to avoid error log spam.
|
||||
ConsoleStdout_DoWriteLn,
|
||||
ConsoleStdout_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite, // writes from re-piped stdout are ignored here, lest we create infinite loop hell >_<
|
||||
ConsoleStdout_Newline,
|
||||
ConsoleStdout_SetTitle,
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleAssert
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static void ConsoleAssert_DoWrite(const char* fmt)
|
||||
{
|
||||
pxFailRel("Console class has not been initialized");
|
||||
}
|
||||
|
||||
static void ConsoleAssert_DoWriteLn(const char* fmt)
|
||||
{
|
||||
pxFailRel("Console class has not been initialized");
|
||||
}
|
||||
|
||||
const IConsoleWriter ConsoleWriter_Assert =
|
||||
{
|
||||
ConsoleAssert_DoWrite,
|
||||
ConsoleAssert_DoWriteLn,
|
||||
ConsoleNull_DoSetColor,
|
||||
|
||||
ConsoleNull_DoWrite,
|
||||
ConsoleNull_Newline,
|
||||
ConsoleNull_SetTitle,
|
||||
|
||||
0, // instance-level indentation (should always be 0)
|
||||
};
|
||||
|
||||
// =====================================================================================================
|
||||
// IConsoleWriter (implementations)
|
||||
// =====================================================================================================
|
||||
// (all non-virtual members that do common work and then pass the result through DoWrite
|
||||
// or DoWriteLn)
|
||||
|
||||
// Parameters:
|
||||
// glob_indent - this parameter is used to specify a global indentation setting. It is used by
|
||||
// WriteLn function, but defaults to 0 for Warning and Error calls. Local indentation always
|
||||
// applies to all writes.
|
||||
std::string IConsoleWriter::_addIndentation(const std::string& src, int glob_indent = 0) const
|
||||
{
|
||||
const int indent = glob_indent + _imm_indentation;
|
||||
|
||||
std::string indentStr;
|
||||
for (int i = 0; i < indent; i++)
|
||||
indentStr += '\t';
|
||||
|
||||
std::string result;
|
||||
result.reserve(src.length() + 16 * indent);
|
||||
result.append(indentStr);
|
||||
result.append(src);
|
||||
|
||||
std::string::size_type pos = result.find('\n');
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
result.insert(pos + 1, indentStr);
|
||||
pos = result.find('\n', pos + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Sets the indentation to be applied to all WriteLn's. The indentation is added to the
|
||||
// primary write, and to any newlines specified within the write. Note that this applies
|
||||
// to calls to WriteLn *only* -- calls to Write bypass the indentation parser.
|
||||
const IConsoleWriter& IConsoleWriter::SetIndent(int tabcount) const
|
||||
{
|
||||
conlog_Indent += tabcount;
|
||||
pxAssert(conlog_Indent >= 0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IConsoleWriter IConsoleWriter::Indent(int tabcount) const
|
||||
{
|
||||
IConsoleWriter retval = *this;
|
||||
retval._imm_indentation = tabcount;
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Changes the active console color.
|
||||
// This color will be unset by calls to colored text methods
|
||||
// such as ErrorMsg and Notice.
|
||||
const IConsoleWriter& IConsoleWriter::SetColor(ConsoleColors color) const
|
||||
{
|
||||
// Ignore current color requests since, well, the current color is already set. ;)
|
||||
if (color == Color_Current)
|
||||
return *this;
|
||||
|
||||
pxAssertMsg((color > Color_Current) && (color < ConsoleColors_Count), "Invalid ConsoleColor specified.");
|
||||
|
||||
if (conlog_Color != color)
|
||||
DoSetColor(conlog_Color = color);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ConsoleColors IConsoleWriter::GetColor() const
|
||||
{
|
||||
return conlog_Color;
|
||||
}
|
||||
|
||||
// Restores the console color to default (usually black, or low-intensity white if the console uses a black background)
|
||||
const IConsoleWriter& IConsoleWriter::ClearColor() const
|
||||
{
|
||||
if (conlog_Color != DefaultConsoleColor)
|
||||
DoSetColor(conlog_Color = DefaultConsoleColor);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ASCII/UTF8 (char*)
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
bool IConsoleWriter::FormatV(const char* fmt, va_list args) const
|
||||
{
|
||||
// TODO: Make this less rubbish
|
||||
if ((_imm_indentation + conlog_Indent) > 0)
|
||||
{
|
||||
DoWriteLn(_addIndentation(StringUtil::StdStringFromFormatV(fmt, args), conlog_Indent).c_str());
|
||||
if (s_log_timestamps)
|
||||
{
|
||||
std::fprintf(s_file_handle.get(), TIMESTAMP_PRINTF_STRING "%.*s\n", GetCurrentMessageTime(),
|
||||
static_cast<int>(message.size()), message.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::fprintf(s_file_handle.get(), "%.*s\n", static_cast<int>(message.size()), message.data());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DoWriteLn(StringUtil::StdStringFromFormatV(fmt, args).c_str());
|
||||
if (s_log_timestamps)
|
||||
{
|
||||
std::fprintf(s_file_handle.get(), TIMESTAMP_PRINTF_STRING "\n", GetCurrentMessageTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::fputc('\n', s_file_handle.get());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
std::fflush(s_file_handle.get());
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(const char* fmt, ...) const
|
||||
bool Log::IsFileOutputEnabled()
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
return (s_file_level > LOGLEVEL_NONE);
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const char* fmt, ...) const
|
||||
bool Log::SetFileOutputLevel(LOGLEVEL level, std::string path)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(color);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
std::unique_lock lock(s_file_mutex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Error(const char* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongRed);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Warning(const char* fmt, ...) const
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
ConsoleColorScope cs(Color_StrongOrange);
|
||||
FormatV(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(ConsoleColors color, const std::string& str) const
|
||||
{
|
||||
ConsoleColorScope cs(color);
|
||||
return WriteLn(str);
|
||||
}
|
||||
|
||||
bool IConsoleWriter::WriteLn(const std::string& str) const
|
||||
{
|
||||
// TODO: Make this less rubbish
|
||||
if ((_imm_indentation + conlog_Indent) > 0)
|
||||
const bool was_enabled = (s_file_level > LOGLEVEL_NONE);
|
||||
const bool new_enabled = (level > LOGLEVEL_NONE && !path.empty());
|
||||
if (was_enabled != new_enabled || (new_enabled && path == s_file_path))
|
||||
{
|
||||
DoWriteLn(_addIndentation(str, conlog_Indent).c_str());
|
||||
if (new_enabled)
|
||||
{
|
||||
if (!s_file_handle || s_file_path != path)
|
||||
{
|
||||
s_file_handle.reset();
|
||||
s_file_handle = FileSystem::OpenManagedCFile(path.c_str(), "wb");
|
||||
if (s_file_handle)
|
||||
{
|
||||
s_file_path = std::move(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_file_path = {};
|
||||
|
||||
if (IsConsoleOutputEnabled())
|
||||
WriteToConsole(LOGLEVEL_ERROR, Color_StrongRed, TinyString::from_fmt("Failed to open log file '{}'", path));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s_file_handle.reset();
|
||||
s_file_path = {};
|
||||
}
|
||||
}
|
||||
|
||||
s_file_level = s_file_handle ? level : LOGLEVEL_NONE;
|
||||
return IsFileOutputEnabled();
|
||||
}
|
||||
|
||||
std::FILE* Log::GetFileLogHandle()
|
||||
{
|
||||
std::unique_lock lock(s_file_mutex);
|
||||
return s_file_handle.get();
|
||||
}
|
||||
|
||||
bool Log::IsHostOutputEnabled()
|
||||
{
|
||||
return (s_host_level > LOGLEVEL_NONE);
|
||||
}
|
||||
|
||||
void Log::SetHostOutputLevel(LOGLEVEL level, HostCallbackType callback)
|
||||
{
|
||||
s_host_callback = callback;
|
||||
s_host_level = callback ? level : LOGLEVEL_NONE;
|
||||
UpdateMaxLevel();
|
||||
}
|
||||
|
||||
bool Log::AreTimestampsEnabled()
|
||||
{
|
||||
return s_log_timestamps;
|
||||
}
|
||||
|
||||
void Log::SetTimestampsEnabled(bool enabled)
|
||||
{
|
||||
s_log_timestamps = enabled;
|
||||
}
|
||||
|
||||
LOGLEVEL Log::GetMaxLevel()
|
||||
{
|
||||
return s_max_level;
|
||||
}
|
||||
|
||||
__ri void Log::UpdateMaxLevel()
|
||||
{
|
||||
s_max_level = std::max(s_console_level, std::max(s_debug_level, std::max(s_file_level, s_host_level)));
|
||||
}
|
||||
|
||||
void Log::ExecuteCallbacks(LOGLEVEL level, ConsoleColors color, std::string_view message)
|
||||
{
|
||||
// TODO: Cache the message time.
|
||||
|
||||
// Split newlines into separate messages.
|
||||
std::string_view::size_type start_pos = 0;
|
||||
if (std::string_view::size_type end_pos = message.find('\n'); end_pos != std::string::npos) [[unlikely]]
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
std::string_view message_line;
|
||||
if (start_pos != end_pos)
|
||||
message_line = message.substr(start_pos, (end_pos == std::string_view::npos) ? end_pos : end_pos - start_pos);
|
||||
|
||||
ExecuteCallbacks(level, color, message_line);
|
||||
|
||||
if (end_pos == std::string_view::npos)
|
||||
return;
|
||||
|
||||
start_pos = end_pos + 1;
|
||||
end_pos = message.find('\n', start_pos);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pxAssert(level > LOGLEVEL_NONE);
|
||||
if (level <= s_console_level)
|
||||
WriteToConsole(level, color, message);
|
||||
|
||||
if (level <= s_debug_level)
|
||||
WriteToDebug(level, color, message);
|
||||
|
||||
if (level <= s_file_level)
|
||||
WriteToFile(level, color, message);
|
||||
|
||||
if (level <= s_host_level)
|
||||
{
|
||||
// double check in case of race here
|
||||
const HostCallbackType callback = s_host_callback;
|
||||
if (callback)
|
||||
s_host_callback(level, color, message);
|
||||
}
|
||||
}
|
||||
|
||||
void Log::Write(LOGLEVEL level, ConsoleColors color, std::string_view message)
|
||||
{
|
||||
if (level > s_max_level)
|
||||
return;
|
||||
|
||||
ExecuteCallbacks(level, color, message);
|
||||
}
|
||||
|
||||
void Log::Writef(LOGLEVEL level, ConsoleColors color, const char* format, ...)
|
||||
{
|
||||
std::va_list ap;
|
||||
va_start(ap, format);
|
||||
Writev(level, color, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void Log::Writev(LOGLEVEL level, ConsoleColors color, const char* format, va_list ap)
|
||||
{
|
||||
if (level > s_max_level)
|
||||
return;
|
||||
|
||||
std::va_list ap_copy;
|
||||
va_copy(ap_copy, ap);
|
||||
|
||||
#ifdef _WIN32
|
||||
const u32 required_size = static_cast<u32>(_vscprintf(format, ap_copy));
|
||||
#else
|
||||
const u32 required_size = std::vsnprintf(nullptr, 0, format, ap_copy);
|
||||
#endif
|
||||
va_end(ap_copy);
|
||||
|
||||
if (required_size < 512)
|
||||
{
|
||||
char buffer[512];
|
||||
const int len = std::vsnprintf(buffer, std::size(buffer), format, ap);
|
||||
if (len > 0)
|
||||
ExecuteCallbacks(level, color, std::string_view(buffer, static_cast<size_t>(len)));
|
||||
}
|
||||
else
|
||||
{
|
||||
DoWriteLn(str.c_str());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Error(const std::string& str) const
|
||||
{
|
||||
return WriteLn(Color_StrongRed, str);
|
||||
}
|
||||
|
||||
bool IConsoleWriter::Warning(const std::string& str) const
|
||||
{
|
||||
return WriteLn(Color_StrongOrange, str);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleColorScope / ConsoleIndentScope
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
ConsoleColorScope::ConsoleColorScope(ConsoleColors newcolor)
|
||||
{
|
||||
m_IsScoped = false;
|
||||
m_newcolor = newcolor;
|
||||
EnterScope();
|
||||
}
|
||||
|
||||
ConsoleColorScope::~ConsoleColorScope()
|
||||
{
|
||||
LeaveScope();
|
||||
}
|
||||
|
||||
void ConsoleColorScope::EnterScope()
|
||||
{
|
||||
if (!m_IsScoped)
|
||||
{
|
||||
m_old_color = Console.GetColor();
|
||||
Console.SetColor(m_newcolor);
|
||||
m_IsScoped = true;
|
||||
char* buffer = new char[required_size + 1];
|
||||
const int len = std::vsnprintf(buffer, required_size + 1, format, ap);
|
||||
if (len > 0)
|
||||
ExecuteCallbacks(level, color, std::string_view(buffer, static_cast<size_t>(len)));
|
||||
delete[] buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleColorScope::LeaveScope()
|
||||
void Log::WriteFmtArgs(LOGLEVEL level, ConsoleColors color, fmt::string_view fmt, fmt::format_args args)
|
||||
{
|
||||
m_IsScoped = m_IsScoped && (Console.SetColor(m_old_color), false);
|
||||
}
|
||||
if (level > s_max_level)
|
||||
return;
|
||||
|
||||
ConsoleIndentScope::ConsoleIndentScope(int tabs)
|
||||
{
|
||||
m_IsScoped = false;
|
||||
m_amount = tabs;
|
||||
EnterScope();
|
||||
}
|
||||
fmt::memory_buffer buffer;
|
||||
fmt::vformat_to(std::back_inserter(buffer), fmt, args);
|
||||
|
||||
ConsoleIndentScope::~ConsoleIndentScope()
|
||||
{
|
||||
LeaveScope();
|
||||
}
|
||||
|
||||
void ConsoleIndentScope::EnterScope()
|
||||
{
|
||||
m_IsScoped = m_IsScoped || (Console.SetIndent(m_amount), true);
|
||||
}
|
||||
|
||||
void ConsoleIndentScope::LeaveScope()
|
||||
{
|
||||
m_IsScoped = m_IsScoped && (Console.SetIndent(-m_amount), false);
|
||||
}
|
||||
|
||||
|
||||
ConsoleAttrScope::ConsoleAttrScope(ConsoleColors newcolor, int indent)
|
||||
{
|
||||
m_old_color = Console.GetColor();
|
||||
Console.SetIndent(m_tabsize = indent);
|
||||
Console.SetColor(newcolor);
|
||||
}
|
||||
|
||||
ConsoleAttrScope::~ConsoleAttrScope()
|
||||
{
|
||||
Console.SetColor(m_old_color);
|
||||
Console.SetIndent(-m_tabsize);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Default Writer for C++ init / startup:
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Currently all build types default to Stdout, which is very functional on Linux but not
|
||||
// always so useful on Windows (which itself lacks a proper stdout console without using
|
||||
// platform specific code). Under windows Stdout will attempt to write to the IDE Debug
|
||||
// console, if one is available (such as running pcsx2 via MSVC). If not available, then
|
||||
// the log message will pretty much be lost into the ether.
|
||||
//
|
||||
#define _DefaultWriter_ ConsoleWriter_Stdout
|
||||
|
||||
IConsoleWriter Console = _DefaultWriter_;
|
||||
IConsoleWriter DevConWriter = _DefaultWriter_;
|
||||
bool DevConWriterEnabled = false;
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
IConsoleWriter DbgConWriter = _DefaultWriter_;
|
||||
#endif
|
||||
|
||||
NullConsoleWriter NullCon = {};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleLogSource (implementations)
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
// Writes to the console using the specified color. This overrides the default color setting
|
||||
// for this log.
|
||||
bool ConsoleLogSource::WriteV(ConsoleColors color, const char* fmt, va_list list) const
|
||||
{
|
||||
ConsoleColorScope cs(color);
|
||||
Console.WriteLn(StringUtil::StdStringFromFormatV(fmt, list));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Writes to the console using the source's default color. Note that the source's default
|
||||
// color will always be used, thus ConsoleColorScope() will not be effectual unless the
|
||||
// console's default color is Color_Default.
|
||||
bool ConsoleLogSource::WriteV(const char* fmt, va_list list) const
|
||||
{
|
||||
WriteV(DefaultColor, fmt, list);
|
||||
return false;
|
||||
ExecuteCallbacks(level, color, std::string_view(buffer.data(), buffer.size()));
|
||||
}
|
||||
|
||||
+129
-171
@@ -1,16 +1,19 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Pcsx2Defs.h"
|
||||
|
||||
#include "fmt/core.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <string>
|
||||
|
||||
// TODO: This whole thing needs to get ripped out.
|
||||
|
||||
enum ConsoleColors
|
||||
{
|
||||
Color_Current = -1,
|
||||
|
||||
Color_Default = 0,
|
||||
|
||||
Color_Black,
|
||||
@@ -42,191 +45,146 @@ enum ConsoleColors
|
||||
ConsoleColors_Count
|
||||
};
|
||||
|
||||
static const ConsoleColors DefaultConsoleColor = Color_Default;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// IConsoleWriter -- For printing messages to the console.
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// General ConsoleWrite Threading Guideline:
|
||||
// PCSX2 is a threaded environment and multiple threads can write to the console asynchronously.
|
||||
// Individual calls to ConsoleWriter APIs will be written in atomic fashion, however "partial"
|
||||
// logs may end up interrupted by logs on other threads. This is usually not a problem for
|
||||
// WriteLn, but may be undesirable for typical uses of Write. In cases where you want to
|
||||
// print multi-line blocks of uninterrupted logs, compound the entire log into a single large
|
||||
// string and issue that to WriteLn.
|
||||
//
|
||||
struct IConsoleWriter
|
||||
enum LOGLEVEL
|
||||
{
|
||||
// A direct console write, without tabbing or newlines. Useful to devs who want to do quick
|
||||
// logging of various junk; but should *not* be used in production code due.
|
||||
void(* WriteRaw)(const char* fmt);
|
||||
LOGLEVEL_NONE, // Silences all log traffic
|
||||
LOGLEVEL_ERROR,
|
||||
LOGLEVEL_WARNING,
|
||||
LOGLEVEL_INFO,
|
||||
LOGLEVEL_DEV,
|
||||
LOGLEVEL_DEBUG,
|
||||
LOGLEVEL_TRACE,
|
||||
|
||||
// WriteLn implementation for internal use only. Bypasses tabbing, prefixing, and other
|
||||
// formatting.
|
||||
void(* DoWriteLn)(const char* fmt);
|
||||
|
||||
// SetColor implementation for internal use only.
|
||||
void(* DoSetColor)(ConsoleColors color);
|
||||
|
||||
// Special implementation of DoWrite that's pretty much for MSVC use only.
|
||||
// All implementations should map to DoWrite, except Stdio which should map to Null.
|
||||
// (This avoids circular/recursive stdio output)
|
||||
void(* DoWriteFromStdout)(const char* fmt);
|
||||
|
||||
void(* Newline)();
|
||||
void(* SetTitle)(const char* title);
|
||||
|
||||
// internal value for indentation of individual lines. Use the Indent() member to invoke.
|
||||
int _imm_indentation;
|
||||
|
||||
// For internal use only.
|
||||
std::string _addIndentation(const std::string& src, int glob_indent) const;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Public members; call these to print stuff to console!
|
||||
//
|
||||
// All functions always return false. Return value is provided only so that we can easily
|
||||
// disable logs at compile time using the "0&&action" macro trick.
|
||||
|
||||
ConsoleColors GetColor() const;
|
||||
const IConsoleWriter& SetColor(ConsoleColors color) const;
|
||||
const IConsoleWriter& ClearColor() const;
|
||||
const IConsoleWriter& SetIndent(int tabcount = 1) const;
|
||||
|
||||
IConsoleWriter Indent(int tabcount = 1) const;
|
||||
|
||||
bool FormatV(const char* fmt, va_list args) const;
|
||||
bool WriteLn(ConsoleColors color, const char* fmt, ...) const;
|
||||
bool WriteLn(const char* fmt, ...) const;
|
||||
bool Error(const char* fmt, ...) const;
|
||||
bool Warning(const char* fmt, ...) const;
|
||||
|
||||
bool WriteLn(ConsoleColors color, const std::string& str) const;
|
||||
bool WriteLn(const std::string& str) const;
|
||||
bool Error(const std::string& str) const;
|
||||
bool Warning(const std::string& str) const;
|
||||
LOGLEVEL_COUNT,
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// NullConsoleWriter
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Used by Release builds for Debug and Devel writes (DbgCon / DevCon). Inlines to NOPs. :)
|
||||
//
|
||||
struct NullConsoleWriter
|
||||
// TODO: Move this elsewhere, add channels.
|
||||
|
||||
namespace Log
|
||||
{
|
||||
void WriteRaw(const char* fmt) {}
|
||||
void DoWriteLn(const char* fmt) {}
|
||||
void DoSetColor(ConsoleColors color) {}
|
||||
void DoWriteFromStdout(const char* fmt) {}
|
||||
void Newline() {}
|
||||
void SetTitle(const char* title) {}
|
||||
// log message callback type
|
||||
using HostCallbackType = void (*)(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
|
||||
// returns the time in seconds since the start of the process
|
||||
float GetCurrentMessageTime();
|
||||
|
||||
ConsoleColors GetColor() const { return Color_Current; }
|
||||
const NullConsoleWriter& SetColor(ConsoleColors color) const { return *this; }
|
||||
const NullConsoleWriter& ClearColor() const { return *this; }
|
||||
const NullConsoleWriter& SetIndent(int tabcount = 1) const { return *this; }
|
||||
// adds a standard console output
|
||||
bool IsConsoleOutputEnabled();
|
||||
void SetConsoleOutputLevel(LOGLEVEL level);
|
||||
|
||||
NullConsoleWriter Indent(int tabcount = 1) const { return NullConsoleWriter(); }
|
||||
// adds a debug console output
|
||||
bool IsDebugOutputAvailable();
|
||||
bool IsDebugOutputEnabled();
|
||||
void SetDebugOutputLevel(LOGLEVEL level);
|
||||
|
||||
bool FormatV(const char* fmt, va_list args) const { return false; }
|
||||
bool WriteLn(ConsoleColors color, const char* fmt, ...) const { return false; }
|
||||
bool WriteLn(const char* fmt, ...) const { return false; }
|
||||
bool Error(const char* fmt, ...) const { return false; }
|
||||
bool Warning(const char* fmt, ...) const { return false; }
|
||||
// adds a file output
|
||||
bool IsFileOutputEnabled();
|
||||
bool SetFileOutputLevel(LOGLEVEL level, std::string path);
|
||||
|
||||
// returns the log file, this is really dangerous to use if it changes...
|
||||
std::FILE* GetFileLogHandle();
|
||||
|
||||
// adds host output
|
||||
bool IsHostOutputEnabled();
|
||||
void SetHostOutputLevel(LOGLEVEL level, HostCallbackType callback);
|
||||
|
||||
// sets logging timestamps
|
||||
bool AreTimestampsEnabled();
|
||||
void SetTimestampsEnabled(bool enabled);
|
||||
|
||||
// Returns the current global filtering level.
|
||||
LOGLEVEL GetMaxLevel();
|
||||
|
||||
// writes a message to the log
|
||||
void Write(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
void Writef(LOGLEVEL level, ConsoleColors color, const char* format, ...);
|
||||
void Writev(LOGLEVEL level, ConsoleColors color, const char* format, va_list ap);
|
||||
void WriteFmtArgs(LOGLEVEL level, ConsoleColors color, fmt::string_view fmt, fmt::format_args args);
|
||||
|
||||
template <typename... T>
|
||||
__fi static void Write(LOGLEVEL level, ConsoleColors color, fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
// Avoid arg packing if filtered.
|
||||
if (level <= GetMaxLevel())
|
||||
return WriteFmtArgs(level, color, fmt, fmt::make_format_args(args...));
|
||||
}
|
||||
} // namespace Log
|
||||
|
||||
// Adapter classes to handle old code.
|
||||
template <LOGLEVEL level>
|
||||
struct ConsoleLogWriter
|
||||
{
|
||||
__fi static void Error(std::string_view str) { Log::Write(level, Color_StrongRed, str); }
|
||||
__fi static void Warning(std::string_view str) { Log::Write(level, Color_StrongOrange, str); }
|
||||
__fi static void WriteLn(std::string_view str) { Log::Write(level, Color_Default, str); }
|
||||
__fi static void WriteLn(ConsoleColors color, std::string_view str) { Log::Write(level, color, str); }
|
||||
__fi static void WriteLn() { Log::Write(level, Color_Default, std::string_view()); }
|
||||
__fi static void FormatV(const char* format, va_list ap) { Log::Writev(level, Color_Default, format, ap); }
|
||||
__fi static void FormatV(ConsoleColors color, const char* format, va_list ap) { Log::Writev(level, color, format, ap); }
|
||||
|
||||
#define MAKE_PRINTF_CONSOLE_WRITER(color) \
|
||||
do \
|
||||
{ \
|
||||
std::va_list ap; \
|
||||
va_start(ap, format); \
|
||||
Log::Writev(level, color, format, ap); \
|
||||
va_end(ap); \
|
||||
} while (0)
|
||||
|
||||
// clang-format off
|
||||
__fi static void Error(const char* format, ...) { MAKE_PRINTF_CONSOLE_WRITER(Color_StrongRed); }
|
||||
__fi static void Warning(const char* format, ...) { MAKE_PRINTF_CONSOLE_WRITER(Color_StrongOrange); }
|
||||
__fi static void WriteLn(const char* format, ...) { MAKE_PRINTF_CONSOLE_WRITER(Color_Default); }
|
||||
__fi static void WriteLn(ConsoleColors color, const char* format, ...) { MAKE_PRINTF_CONSOLE_WRITER(color); }
|
||||
// clang-format on
|
||||
|
||||
#undef MAKE_PRINTF_CONSOLE_WRITER
|
||||
|
||||
#define MAKE_FMT_CONSOLE_WRITER(color) do \
|
||||
{ \
|
||||
if (level <= Log::GetMaxLevel()) \
|
||||
Log::WriteFmtArgs(level, color, fmt, fmt::make_format_args(args...)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
// clang-format off
|
||||
template<typename... T> __fi static void ErrorFmt(fmt::format_string<T...> fmt, T&&... args) { MAKE_FMT_CONSOLE_WRITER(Color_StrongRed); }
|
||||
template<typename... T> __fi static void WarningFmt(fmt::format_string<T...> fmt, T&&... args) { MAKE_FMT_CONSOLE_WRITER(Color_StrongOrange); }
|
||||
template<typename... T> __fi static void WriteLnFmt(fmt::format_string<T...> fmt, T&&... args) { MAKE_FMT_CONSOLE_WRITER(Color_Default); }
|
||||
template<typename... T> __fi static void WriteLnFmt(ConsoleColors color, fmt::format_string<T...> fmt, T&&... args) { MAKE_FMT_CONSOLE_WRITER(color); }
|
||||
// clang-format on
|
||||
|
||||
#undef MAKE_FMT_CONSOLE_WRITER
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleIndentScope
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Provides a scoped indentation of the IConsoleWriter interface for the current thread.
|
||||
// Any console writes performed from this scope will be indented by the specified number
|
||||
// of tab characters.
|
||||
//
|
||||
// Scoped Object Notes: Like most scoped objects, this is intended to be used as a stack
|
||||
// or temporary object only. Using it in a situation where the object's lifespan out-lives
|
||||
// a scope will almost certainly result in unintended /undefined side effects.
|
||||
//
|
||||
class ConsoleIndentScope
|
||||
struct NullLogWriter
|
||||
{
|
||||
DeclareNoncopyableObject(ConsoleIndentScope);
|
||||
// clang-format off
|
||||
__fi static bool Error(std::string_view str) { return false; }
|
||||
__fi static bool Warning(std::string_view str) { return false; }
|
||||
__fi static bool WriteLn(std::string_view str) { return false; }
|
||||
__fi static bool WriteLn(ConsoleColors color, std::string_view str) { return false; }
|
||||
__fi static bool WriteLn() { return false; }
|
||||
|
||||
protected:
|
||||
int m_amount;
|
||||
bool m_IsScoped;
|
||||
__fi static bool Error(const char* format, ...) { return false; }
|
||||
__fi static bool Warning(const char* format, ...) { return false; }
|
||||
__fi static bool WriteLn(const char* format, ...) { return false; }
|
||||
__fi static bool WriteLn(ConsoleColors color, const char* format, ...) { return false; }
|
||||
|
||||
public:
|
||||
// Constructor: The specified number of tabs will be appended to the current indentation
|
||||
// setting. The tabs will be unrolled when the object leaves scope or is destroyed.
|
||||
ConsoleIndentScope(int tabs = 1);
|
||||
virtual ~ConsoleIndentScope();
|
||||
void EnterScope();
|
||||
void LeaveScope();
|
||||
template<typename... T> __fi static bool ErrorFmt(fmt::format_string<T...> fmt, T&&... args) { return false; }
|
||||
template<typename... T> __fi static bool WarningFmt(fmt::format_string<T...> fmt, T&&... args) { return false; }
|
||||
template<typename... T> __fi static bool WriteLnFmt(fmt::format_string<T...> fmt, T&&... args) { return false; }
|
||||
template<typename... T> __fi static bool WriteLnFmt(ConsoleColors color, fmt::format_string<T...> fmt, T&&... args) { return false; }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleColorScope
|
||||
// --------------------------------------------------------------------------------------
|
||||
class ConsoleColorScope
|
||||
{
|
||||
DeclareNoncopyableObject(ConsoleColorScope);
|
||||
extern ConsoleLogWriter<LOGLEVEL_INFO> Console;
|
||||
extern ConsoleLogWriter<LOGLEVEL_DEV> DevCon;
|
||||
|
||||
protected:
|
||||
ConsoleColors m_newcolor;
|
||||
ConsoleColors m_old_color;
|
||||
bool m_IsScoped;
|
||||
|
||||
public:
|
||||
ConsoleColorScope(ConsoleColors newcolor);
|
||||
virtual ~ConsoleColorScope();
|
||||
void EnterScope();
|
||||
void LeaveScope();
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ConsoleAttrScope
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Applies both color and tab attributes in a single object constructor.
|
||||
//
|
||||
class ConsoleAttrScope
|
||||
{
|
||||
DeclareNoncopyableObject(ConsoleAttrScope);
|
||||
|
||||
protected:
|
||||
ConsoleColors m_old_color;
|
||||
int m_tabsize;
|
||||
|
||||
public:
|
||||
ConsoleAttrScope(ConsoleColors newcolor, int indent = 0);
|
||||
virtual ~ConsoleAttrScope();
|
||||
};
|
||||
|
||||
extern IConsoleWriter Console;
|
||||
|
||||
#if defined(__POSIX__)
|
||||
extern void Console_SetStdout(FILE* fp);
|
||||
#endif
|
||||
extern void Console_SetActiveHandler(const IConsoleWriter& writer, FILE* flushfp = NULL);
|
||||
|
||||
extern const IConsoleWriter ConsoleWriter_Null;
|
||||
extern const IConsoleWriter ConsoleWriter_Stdout;
|
||||
extern const IConsoleWriter ConsoleWriter_Assert;
|
||||
|
||||
extern NullConsoleWriter NullCon;
|
||||
|
||||
extern IConsoleWriter DevConWriter;
|
||||
extern bool DevConWriterEnabled;
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
#define DevCon DevConWriter
|
||||
#else
|
||||
#define DevCon DevConWriterEnabled&& DevConWriter
|
||||
#endif
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
extern IConsoleWriter DbgConWriter;
|
||||
#ifdef _DEBUG
|
||||
extern ConsoleLogWriter<LOGLEVEL_DEBUG> DbgConWriter;
|
||||
#define DbgCon DbgConWriter
|
||||
#else
|
||||
#define DbgCon 0 && NullCon
|
||||
extern NullLogWriter DbgConWriter;
|
||||
#define DbgCon 0 && DbgConWriter
|
||||
#endif
|
||||
|
||||
+93
-57
@@ -53,7 +53,7 @@ static std::time_t ConvertFileTimeToUnixTime(const FILETIME& ft)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool FileSystemCharacterIsSane(char c, bool strip_slashes)
|
||||
static inline bool FileSystemCharacterIsSane(char32_t c, bool strip_slashes)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// https://docs.microsoft.com/en-gb/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN#naming-conventions
|
||||
@@ -1076,19 +1076,19 @@ static u32 TranslateWin32Attributes(u32 Win32Attributes)
|
||||
}
|
||||
|
||||
static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path, const char* path, const char* pattern,
|
||||
u32 flags, FileSystem::FindResultsArray* results)
|
||||
u32 flags, FileSystem::FindResultsArray* results, std::vector<std::string>& visited)
|
||||
{
|
||||
std::string tempStr;
|
||||
std::string search_dir;
|
||||
if (path)
|
||||
{
|
||||
if (parent_path)
|
||||
tempStr = StringUtil::StdStringFromFormat("%s\\%s\\%s\\*", origin_path, parent_path, path);
|
||||
search_dir = fmt::format("{}\\{}\\{}\\*", origin_path, parent_path, path);
|
||||
else
|
||||
tempStr = StringUtil::StdStringFromFormat("%s\\%s\\*", origin_path, path);
|
||||
search_dir = fmt::format("{}\\{}\\*", origin_path, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempStr = StringUtil::StdStringFromFormat("%s\\*", origin_path);
|
||||
search_dir = fmt::format("{}\\*", origin_path);
|
||||
}
|
||||
|
||||
// holder for utf-8 conversion
|
||||
@@ -1096,7 +1096,7 @@ static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path,
|
||||
std::string utf8_filename;
|
||||
utf8_filename.reserve((sizeof(wfd.cFileName) / sizeof(wfd.cFileName[0])) * 2);
|
||||
|
||||
HANDLE hFind = FindFirstFileW(StringUtil::UTF8StringToWideString(tempStr).c_str(), &wfd);
|
||||
const HANDLE hFind = FindFirstFileW(StringUtil::UTF8StringToWideString(search_dir).c_str(), &wfd);
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return 0;
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path,
|
||||
bool hasWildCards = false;
|
||||
bool wildCardMatchAll = false;
|
||||
u32 nFiles = 0;
|
||||
if (std::strpbrk(pattern, "*?") != nullptr)
|
||||
if (std::strpbrk(pattern, "*?"))
|
||||
{
|
||||
hasWildCards = true;
|
||||
wildCardMatchAll = !(std::strcmp(pattern, "*"));
|
||||
@@ -1132,15 +1132,29 @@ static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path,
|
||||
{
|
||||
if (flags & FILESYSTEM_FIND_RECURSIVE)
|
||||
{
|
||||
// recurse into this directory
|
||||
if (parent_path != nullptr)
|
||||
{
|
||||
const std::string recurseDir = StringUtil::StdStringFromFormat("%s\\%s", parent_path, path);
|
||||
nFiles += RecursiveFindFiles(origin_path, recurseDir.c_str(), utf8_filename.c_str(), pattern, flags, results);
|
||||
}
|
||||
// check that we're not following an infinite symbolic link loop
|
||||
std::string real_recurse_dir;
|
||||
if (parent_path)
|
||||
real_recurse_dir = Path::RealPath(fmt::format("{}\\{}\\{}\\{}", origin_path, parent_path, path, utf8_filename));
|
||||
else if (path)
|
||||
real_recurse_dir = Path::RealPath(fmt::format("{}\\{}\\{}", origin_path, path, utf8_filename));
|
||||
else
|
||||
real_recurse_dir = Path::RealPath(fmt::format("{}\\{}", origin_path, utf8_filename));
|
||||
if (real_recurse_dir.empty() || std::find(visited.begin(), visited.end(), real_recurse_dir) == visited.end())
|
||||
{
|
||||
nFiles += RecursiveFindFiles(origin_path, path, utf8_filename.c_str(), pattern, flags, results);
|
||||
if (!real_recurse_dir.empty())
|
||||
visited.push_back(std::move(real_recurse_dir));
|
||||
|
||||
// recurse into this directory
|
||||
if (parent_path)
|
||||
{
|
||||
const std::string recurse_dir = fmt::format("{}\\{}", parent_path, path);
|
||||
nFiles += RecursiveFindFiles(origin_path, recurse_dir.c_str(), utf8_filename.c_str(), pattern, flags, results, visited);
|
||||
}
|
||||
else
|
||||
{
|
||||
nFiles += RecursiveFindFiles(origin_path, path, utf8_filename.c_str(), pattern, flags, results, visited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1171,23 +1185,21 @@ static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path,
|
||||
}
|
||||
|
||||
// add file to list
|
||||
// TODO string formatter, clean this mess..
|
||||
if (!(flags & FILESYSTEM_FIND_RELATIVE_PATHS))
|
||||
{
|
||||
if (parent_path != nullptr)
|
||||
outData.FileName =
|
||||
StringUtil::StdStringFromFormat("%s\\%s\\%s\\%s", origin_path, parent_path, path, utf8_filename.c_str());
|
||||
else if (path != nullptr)
|
||||
outData.FileName = StringUtil::StdStringFromFormat("%s\\%s\\%s", origin_path, path, utf8_filename.c_str());
|
||||
if (parent_path)
|
||||
outData.FileName = fmt::format("{}\\{}\\{}\\{}", origin_path, parent_path, path, utf8_filename);
|
||||
else if (path)
|
||||
outData.FileName = fmt::format("{}\\{}\\{}", origin_path, path, utf8_filename);
|
||||
else
|
||||
outData.FileName = StringUtil::StdStringFromFormat("%s\\%s", origin_path, utf8_filename.c_str());
|
||||
outData.FileName = fmt::format("{}\\{}", origin_path, utf8_filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parent_path != nullptr)
|
||||
outData.FileName = StringUtil::StdStringFromFormat("%s\\%s\\%s", parent_path, path, utf8_filename.c_str());
|
||||
else if (path != nullptr)
|
||||
outData.FileName = StringUtil::StdStringFromFormat("%s\\%s", path, utf8_filename.c_str());
|
||||
if (parent_path)
|
||||
outData.FileName = fmt::format("{}\\{}\\{}", parent_path, path, utf8_filename);
|
||||
else if (path)
|
||||
outData.FileName = fmt::format("{}\\{}", path, utf8_filename);
|
||||
else
|
||||
outData.FileName = utf8_filename;
|
||||
}
|
||||
@@ -1214,10 +1226,18 @@ bool FileSystem::FindFiles(const char* path, const char* pattern, u32 flags, Fin
|
||||
if (!(flags & FILESYSTEM_FIND_KEEP_ARRAY))
|
||||
results->clear();
|
||||
|
||||
// enter the recursive function
|
||||
return (RecursiveFindFiles(path, nullptr, nullptr, pattern, flags, results) > 0);
|
||||
}
|
||||
// add self if recursive, we don't want to visit it twice
|
||||
std::vector<std::string> visited;
|
||||
if (flags & FILESYSTEM_FIND_RECURSIVE)
|
||||
{
|
||||
std::string real_path = Path::RealPath(path);
|
||||
if (!real_path.empty())
|
||||
visited.push_back(std::move(real_path));
|
||||
}
|
||||
|
||||
// enter the recursive function
|
||||
return (RecursiveFindFiles(path, nullptr, nullptr, pattern, flags, results, visited) > 0);
|
||||
}
|
||||
|
||||
static void TranslateStat64(struct stat* st, const struct _stat64& st64)
|
||||
{
|
||||
@@ -1620,23 +1640,23 @@ bool FileSystem::SetPathCompression(const char* path, bool enable)
|
||||
static_assert(sizeof(off_t) == sizeof(s64));
|
||||
|
||||
static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, const char* Path, const char* Pattern,
|
||||
u32 Flags, FileSystem::FindResultsArray* pResults)
|
||||
u32 Flags, FileSystem::FindResultsArray* pResults, std::vector<std::string>& visited)
|
||||
{
|
||||
std::string tempStr;
|
||||
if (Path)
|
||||
{
|
||||
if (ParentPath)
|
||||
tempStr = StringUtil::StdStringFromFormat("%s/%s/%s", OriginPath, ParentPath, Path);
|
||||
tempStr = fmt::format("{}/{}/{}", OriginPath, ParentPath, Path);
|
||||
else
|
||||
tempStr = StringUtil::StdStringFromFormat("%s/%s", OriginPath, Path);
|
||||
tempStr = fmt::format("{}/{}", OriginPath, Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempStr = StringUtil::StdStringFromFormat("%s", OriginPath);
|
||||
tempStr = fmt::format("{}", OriginPath);
|
||||
}
|
||||
|
||||
DIR* pDir = opendir(tempStr.c_str());
|
||||
if (pDir == nullptr)
|
||||
if (!pDir)
|
||||
return 0;
|
||||
|
||||
// small speed optimization for '*' case
|
||||
@@ -1663,12 +1683,12 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||
}
|
||||
|
||||
std::string full_path;
|
||||
if (ParentPath != nullptr)
|
||||
full_path = StringUtil::StdStringFromFormat("%s/%s/%s/%s", OriginPath, ParentPath, Path, pDirEnt->d_name);
|
||||
else if (Path != nullptr)
|
||||
full_path = StringUtil::StdStringFromFormat("%s/%s/%s", OriginPath, Path, pDirEnt->d_name);
|
||||
if (ParentPath)
|
||||
full_path = fmt::format("{}/{}/{}/{}", OriginPath, ParentPath, Path, pDirEnt->d_name);
|
||||
else if (Path)
|
||||
full_path = fmt::format("{}/{}/{}", OriginPath, Path, pDirEnt->d_name);
|
||||
else
|
||||
full_path = StringUtil::StdStringFromFormat("%s/%s", OriginPath, pDirEnt->d_name);
|
||||
full_path = fmt::format("{}/{}", OriginPath, pDirEnt->d_name);
|
||||
|
||||
FILESYSTEM_FIND_DATA outData;
|
||||
outData.Attributes = 0;
|
||||
@@ -1681,15 +1701,23 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||
{
|
||||
if (Flags & FILESYSTEM_FIND_RECURSIVE)
|
||||
{
|
||||
// recurse into this directory
|
||||
if (ParentPath != nullptr)
|
||||
// check that we're not following an infinite symbolic link loop
|
||||
if (std::string real_recurse_dir = Path::RealPath(full_path);
|
||||
real_recurse_dir.empty() || std::find(visited.begin(), visited.end(), real_recurse_dir) == visited.end())
|
||||
{
|
||||
std::string recursiveDir = StringUtil::StdStringFromFormat("%s/%s", ParentPath, Path);
|
||||
nFiles += RecursiveFindFiles(OriginPath, recursiveDir.c_str(), pDirEnt->d_name, Pattern, Flags, pResults);
|
||||
}
|
||||
else
|
||||
{
|
||||
nFiles += RecursiveFindFiles(OriginPath, Path, pDirEnt->d_name, Pattern, Flags, pResults);
|
||||
if (!real_recurse_dir.empty())
|
||||
visited.push_back(std::move(real_recurse_dir));
|
||||
|
||||
// recurse into this directory
|
||||
if (ParentPath)
|
||||
{
|
||||
const std::string recursive_dir = fmt::format("{}/{}", ParentPath, Path);
|
||||
nFiles += RecursiveFindFiles(OriginPath, recursive_dir.c_str(), pDirEnt->d_name, Pattern, Flags, pResults, visited);
|
||||
}
|
||||
else
|
||||
{
|
||||
nFiles += RecursiveFindFiles(OriginPath, Path, pDirEnt->d_name, Pattern, Flags, pResults, visited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1721,17 +1749,16 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||
}
|
||||
|
||||
// add file to list
|
||||
// TODO string formatter, clean this mess..
|
||||
if (!(Flags & FILESYSTEM_FIND_RELATIVE_PATHS))
|
||||
{
|
||||
outData.FileName = std::move(full_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ParentPath != nullptr)
|
||||
outData.FileName = StringUtil::StdStringFromFormat("%s/%s/%s", ParentPath, Path, pDirEnt->d_name);
|
||||
else if (Path != nullptr)
|
||||
outData.FileName = StringUtil::StdStringFromFormat("%s/%s", Path, pDirEnt->d_name);
|
||||
if (ParentPath)
|
||||
outData.FileName = fmt::format("{}/{}/{}", ParentPath, Path, pDirEnt->d_name);
|
||||
else if (Path)
|
||||
outData.FileName = fmt::format("{}/{}", Path, pDirEnt->d_name);
|
||||
else
|
||||
outData.FileName = pDirEnt->d_name;
|
||||
}
|
||||
@@ -1744,18 +1771,27 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
|
||||
return nFiles;
|
||||
}
|
||||
|
||||
bool FileSystem::FindFiles(const char* Path, const char* Pattern, u32 Flags, FindResultsArray* pResults)
|
||||
bool FileSystem::FindFiles(const char* path, const char* pattern, u32 flags, FindResultsArray* results)
|
||||
{
|
||||
// has a path
|
||||
if (Path[0] == '\0')
|
||||
if (path[0] == '\0')
|
||||
return false;
|
||||
|
||||
// clear result array
|
||||
if (!(Flags & FILESYSTEM_FIND_KEEP_ARRAY))
|
||||
pResults->clear();
|
||||
if (!(flags & FILESYSTEM_FIND_KEEP_ARRAY))
|
||||
results->clear();
|
||||
|
||||
// add self if recursive, we don't want to visit it twice
|
||||
std::vector<std::string> visited;
|
||||
if (flags & FILESYSTEM_FIND_RECURSIVE)
|
||||
{
|
||||
std::string real_path = Path::RealPath(path);
|
||||
if (!real_path.empty())
|
||||
visited.push_back(std::move(real_path));
|
||||
}
|
||||
|
||||
// enter the recursive function
|
||||
return (RecursiveFindFiles(Path, nullptr, nullptr, Pattern, Flags, pResults) > 0);
|
||||
return (RecursiveFindFiles(path, nullptr, nullptr, pattern, flags, results, visited) > 0);
|
||||
}
|
||||
|
||||
bool FileSystem::StatFile(const char* path, struct stat* st)
|
||||
|
||||
@@ -55,6 +55,11 @@ using r128 = __m128i;
|
||||
return _mm_set_epi64x(0, val);
|
||||
}
|
||||
|
||||
[[maybe_unused]] __fi static r128 r128_from_u32_dup(u32 val)
|
||||
{
|
||||
return _mm_set1_epi32(val);
|
||||
}
|
||||
|
||||
[[maybe_unused]] __fi static r128 r128_from_u32x4(u32 lo0, u32 lo1, u32 hi0, u32 hi1)
|
||||
{
|
||||
return _mm_setr_epi32(lo0, lo1, hi0, hi1);
|
||||
@@ -150,6 +155,11 @@ using r128 = uint32x4_t;
|
||||
return vreinterpretq_u32_u64(vcombine_u64(vcreate_u64(val), vcreate_u64(0)));
|
||||
}
|
||||
|
||||
[[maybe_unused]] __fi static r128 r128_from_u32_dup(u32 val)
|
||||
{
|
||||
return vdupq_n_u32(val);
|
||||
}
|
||||
|
||||
[[maybe_unused]] __fi static r128 r128_from_u32x4(u32 lo0, u32 lo1, u32 hi0, u32 hi1)
|
||||
{
|
||||
const u32 values[4] = {lo0, lo1, hi0, hi1};
|
||||
|
||||
@@ -59,10 +59,7 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
inline color_rgba()
|
||||
{
|
||||
static_assert(sizeof(*this) == 4, "sizeof(*this) != 4");
|
||||
}
|
||||
inline color_rgba() = default;
|
||||
|
||||
inline color_rgba(int y)
|
||||
{
|
||||
@@ -190,6 +187,8 @@ public:
|
||||
static color_rgba comp_max(const color_rgba& a, const color_rgba& b) { return color_rgba(std::max(a[0], b[0]), std::max(a[1], b[1]), std::max(a[2], b[2]), std::max(a[3], b[3])); }
|
||||
};
|
||||
|
||||
static_assert(sizeof(color_rgba) == 4);
|
||||
|
||||
bool unpack_bc7(const void *pBlock, color_rgba *pPixels);
|
||||
|
||||
} // namespace bc7decomp
|
||||
|
||||
+10
-2
@@ -183,7 +183,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WriteV(const char* fmt, va_list list) const;
|
||||
bool WriteV(const char* fmt, va_list list) const
|
||||
{
|
||||
Console.FormatV(fmt, list);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WriteV(ConsoleColors color, const char* fmt, va_list list) const;
|
||||
bool WriteV(ConsoleColors color, const char* fmt, va_list list) const
|
||||
{
|
||||
Console.FormatV(color, fmt, list);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#include "common/Threading.h"
|
||||
#include "common/Assertions.h"
|
||||
#include "common/RedtapeWindows.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <mmsystem.h>
|
||||
#include <process.h>
|
||||
#include <timeapi.h>
|
||||
|
||||
+39
-45
@@ -18,12 +18,15 @@ IF EXIST "%ProgramFiles%\Git\bin\git.exe" SET "GITPATH=%ProgramFiles%\Git\bin"
|
||||
IF EXIST "%ProgramW6432%\Git\bin\git.exe" SET "GITPATH=%ProgramW6432%\Git\bin"
|
||||
IF DEFINED GITPATH SET "PATH=%PATH%;%GITPATH%"
|
||||
|
||||
FOR /F "tokens=1-2" %%i IN ('"git show -s --format=%%%ci HEAD 2> NUL"') do (
|
||||
set REV3=%%i%%j
|
||||
)
|
||||
|
||||
FOR /F %%i IN ('"git describe 2> NUL"') do (
|
||||
set GIT_REV=%%i
|
||||
git describe --tags > NUL 2>NUL
|
||||
if !ERRORLEVEL! EQU 0 (
|
||||
FOR /F %%i IN ('"git describe --tags 2> NUL"') do (
|
||||
set GIT_REV=%%i
|
||||
)
|
||||
) else (
|
||||
FOR /F %%i IN ('"git rev-parse --short HEAD 2> NUL"') do (
|
||||
set GIT_REV=%%i
|
||||
)
|
||||
)
|
||||
|
||||
FOR /F "tokens=* USEBACKQ" %%i IN (`git tag --points-at HEAD`) DO (
|
||||
@@ -34,11 +37,11 @@ FOR /F "tokens=* USEBACKQ" %%i IN (`git rev-parse HEAD`) DO (
|
||||
set GIT_HASH=%%i
|
||||
)
|
||||
|
||||
set REV2=%REV3: =%
|
||||
set REV1=%REV2:-=%
|
||||
set REV=%REV1::=%
|
||||
FOR /F "tokens=* USEBACKQ" %%i IN (`git log -1 "--format=%%cd" "--date=local"`) DO (
|
||||
set GIT_DATE=%%i
|
||||
)
|
||||
|
||||
SET SIGNATURELINE=// H[%GIT_HASH%] T[%GIT_TAG%]
|
||||
SET SIGNATURELINE=// R[%GIT_REV%] H[%GIT_HASH%] T[%GIT_TAG%]
|
||||
SET /P EXISTINGLINE=<"%CD%\svnrev.h"
|
||||
|
||||
IF "%EXISTINGLINE%"=="%SIGNATURELINE%" (
|
||||
@@ -48,45 +51,36 @@ IF "%EXISTINGLINE%"=="%SIGNATURELINE%" (
|
||||
ECHO Updating "%CD%\svnrev.h"...
|
||||
echo %SIGNATURELINE%> "%CD%\svnrev.h"
|
||||
|
||||
git show -s > NUL 2>&1
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
echo Automatic version detection unavailable.
|
||||
echo If you want to have the version string print correctly,
|
||||
echo make sure your Git.exe is in the default installation directory,
|
||||
echo or in your PATH.
|
||||
echo You can safely ignore this message - a dummy string will be printed.
|
||||
echo #define GIT_HASH "%GIT_HASH%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG "%GIT_TAG%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_DATE "%GIT_DATE%" >> "%CD%\svnrev.h"
|
||||
|
||||
echo #define SVN_REV_UNKNOWN >> "%CD%\svnrev.h"
|
||||
echo #define SVN_REV 0ll >> "%CD%\svnrev.h"
|
||||
echo #define GIT_REV "" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_HASH "" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG "" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAGGED_COMMIT 0 >> "%CD%\svnrev.h"
|
||||
echo %GIT_TAG%|FINDSTR /R "^v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$" > NUL
|
||||
if !ERRORLEVEL! EQU 0 (
|
||||
echo #define GIT_REV "%GIT_TAG%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAGGED_COMMIT 1 >> "%CD%\svnrev.h"
|
||||
FOR /F "tokens=1,2,3 delims=v." %%a in ("%GIT_TAG%") DO (
|
||||
echo #define GIT_TAG_HI %%a >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_MID %%b >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_LO %%c >> "%CD%\svnrev.h"
|
||||
)
|
||||
) else (
|
||||
:: Support New Tagged Release Model
|
||||
if [%GIT_TAG%] NEQ [] (
|
||||
echo Detected that the current commit is tagged, using that!
|
||||
echo #define SVN_REV %REV%ll >> "%CD%\svnrev.h"
|
||||
echo #define GIT_REV "" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_HASH "%GIT_HASH%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG "%GIT_TAG%" >> "%CD%\svnrev.h"
|
||||
|
||||
echo %GIT_TAG%|FINDSTR /R "^v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$" > NUL
|
||||
if !ERRORLEVEL! EQU 0 (
|
||||
FOR /F "tokens=1,2,3 delims=v." %%a in ("%GIT_TAG%") DO (
|
||||
echo #define GIT_TAG_HI %%a >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_MID %%b >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_LO %%c >> "%CD%\svnrev.h"
|
||||
)
|
||||
:: Local branches
|
||||
echo #define GIT_REV "%GIT_REV%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAGGED_COMMIT 0 >> "%CD%\svnrev.h"
|
||||
echo %GIT_REV%|FINDSTR /R "^v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]-*" > NUL
|
||||
if !ERRORLEVEL! EQU 0 (
|
||||
FOR /F "tokens=1,2,3 delims=v." %%a in ("%GIT_REV%") DO (
|
||||
echo #define GIT_TAG_HI %%a >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_MID %%b >> "%CD%\svnrev.h"
|
||||
FOR /F "tokens=1 delims=-" %%d in ("%%c%") DO (
|
||||
echo #define GIT_TAG_LO %%d >> "%CD%\svnrev.h"
|
||||
)
|
||||
)
|
||||
|
||||
echo #define GIT_TAGGED_COMMIT 1 >> "%CD%\svnrev.h"
|
||||
) else (
|
||||
echo #define SVN_REV %REV%ll >> "%CD%\svnrev.h"
|
||||
echo #define GIT_REV "%GIT_REV%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_HASH "%GIT_HASH%" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG "" >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAGGED_COMMIT 0 >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_HI 0 >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_MID 0 >> "%CD%\svnrev.h"
|
||||
echo #define GIT_TAG_LO 0 >> "%CD%\svnrev.h"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
pull_request_title: "translations: Syncing Crowdin translations"
|
||||
commit_message: "[ci skip]"
|
||||
pull_request_title: 'translations: Syncing Crowdin translations'
|
||||
commit_message: '[ci skip]'
|
||||
files:
|
||||
- source: pcsx2-qt/Translations/pcsx2-qt_en.ts
|
||||
translation: '/pcsx2-qt/Translations/pcsx2-qt_%locale%.ts'
|
||||
translation: /pcsx2-qt/Translations/pcsx2-qt_%locale%.ts
|
||||
|
||||
+11
-5
@@ -33,9 +33,9 @@
|
||||
#include "pcsx2/GameList.h"
|
||||
#include "pcsx2/Host.h"
|
||||
#include "pcsx2/INISettingsInterface.h"
|
||||
#include "pcsx2/ImGui/FullscreenUI.h"
|
||||
#include "pcsx2/ImGui/ImGuiManager.h"
|
||||
#include "pcsx2/Input/InputManager.h"
|
||||
#include "pcsx2/LogSink.h"
|
||||
#include "pcsx2/MTGS.h"
|
||||
#include "pcsx2/SIO/Pad/Pad.h"
|
||||
#include "pcsx2/PerformanceMetrics.h"
|
||||
@@ -95,6 +95,8 @@ bool GSRunner::InitializeConfig()
|
||||
if (!VMManager::PerformEarlyHardwareChecks(&error))
|
||||
return false;
|
||||
|
||||
ImGuiManager::SetFontPathAndRange(Path::Combine(EmuFolders::Resources, "fonts" FS_OSPATH_SEPARATOR_STR "Roboto-Regular.ttf"), {});
|
||||
|
||||
// don't provide an ini path, or bother loading. we'll store everything in memory.
|
||||
MemorySettingsInterface& si = s_settings_interface;
|
||||
Host::Internal::SetBaseSettingsLayer(&si);
|
||||
@@ -390,6 +392,11 @@ void Host::OnCoverDownloaderOpenRequested()
|
||||
// noop
|
||||
}
|
||||
|
||||
void Host::OnCreateMemoryCardOpenRequested()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
std::optional<u32> InputManager::ConvertHostKeyboardStringToCode(const std::string_view& str)
|
||||
{
|
||||
return std::nullopt;
|
||||
@@ -440,7 +447,7 @@ void GSRunner::InitializeConsole()
|
||||
const char* var = std::getenv("PCSX2_NOCONSOLE");
|
||||
s_no_console = (var && StringUtil::FromChars<bool>(var).value_or(false));
|
||||
if (!s_no_console)
|
||||
LogSink::InitializeEarlyConsole();
|
||||
Log::SetConsoleOutputLevel(LOGLEVEL_DEBUG);
|
||||
}
|
||||
|
||||
bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& params)
|
||||
@@ -566,7 +573,7 @@ bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& pa
|
||||
{
|
||||
// disable timestamps, since we want to be able to diff the logs
|
||||
Console.WriteLn("Logging to %s...", logfile);
|
||||
LogSink::SetFileLogPath(logfile);
|
||||
VMManager::Internal::SetFileLogPath(logfile);
|
||||
s_settings_interface.SetBoolValue("Logging", "EnableFileLogging", true);
|
||||
s_settings_interface.SetBoolValue("Logging", "EnableTimestamps", false);
|
||||
}
|
||||
@@ -696,12 +703,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
VMManager::Internal::CPUThreadShutdown();
|
||||
GSRunner::DestroyPlatformWindow();
|
||||
LogSink::CloseFileLog();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void Host::VSyncOnCPUThread()
|
||||
void Host::PumpMessagesOnCPUThread()
|
||||
{
|
||||
// update GS thread copy of frame number
|
||||
MTGS::RunOnGSThread([frame_number = GSDumpReplayer::GetFrameNumber()]() { s_dump_frame_number = frame_number; });
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "pcsx2/SysForwardDefs.h"
|
||||
#include "pcsx2/SupportURLs.h"
|
||||
|
||||
#include "AboutDialog.h"
|
||||
#include "QtHost.h"
|
||||
#include "QtUtils.h"
|
||||
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/Path.h"
|
||||
#include "common/SmallString.h"
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QDialogButtonBox>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtWidgets/QTextBrowser>
|
||||
|
||||
static QString GetDocFileUrl(std::string_view name)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Windows uses the docs directory in bin.
|
||||
const std::string path = Path::Combine(EmuFolders::AppRoot,
|
||||
TinyString::from_fmt("docs" FS_OSPATH_SEPARATOR_STR "{}", name));
|
||||
#else
|
||||
// Linux/Mac has this in the Resources directory.
|
||||
const std::string path = Path::Combine(EmuFolders::Resources,
|
||||
TinyString::from_fmt("docs" FS_OSPATH_SEPARATOR_STR "{}", name));
|
||||
#endif
|
||||
return QUrl::fromLocalFile(QString::fromStdString(path)).toString();
|
||||
}
|
||||
|
||||
AboutDialog::AboutDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
@@ -21,9 +45,8 @@ AboutDialog::AboutDialog(QWidget* parent)
|
||||
m_ui.scmversion->setText(QtHost::GetAppNameAndVersion());
|
||||
|
||||
m_ui.links->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
m_ui.links->setOpenExternalLinks(true);
|
||||
m_ui.links->setText(QStringLiteral(
|
||||
R"(<a href="%1">%2</a> | <a href="%3">%4</a> | <a href="%5">%6</a> | <a href="%7">%8</a>)")
|
||||
R"(<a href="%1">%2</a> | <a href="%3">%4</a> | <a href="%5">%6</a> | <a href="%7">%8</a> | <a href="%9">%10</a>)")
|
||||
.arg(getWebsiteUrl())
|
||||
.arg(tr("Website"))
|
||||
.arg(getSupportForumsUrl())
|
||||
@@ -31,8 +54,11 @@ AboutDialog::AboutDialog(QWidget* parent)
|
||||
.arg(getGitHubRepositoryUrl())
|
||||
.arg(tr("GitHub Repository"))
|
||||
.arg(getLicenseUrl())
|
||||
.arg(tr("License")));
|
||||
.arg(tr("License"))
|
||||
.arg(getThirdPartyLicensesUrl())
|
||||
.arg(tr("Third-Party Licenses")));
|
||||
|
||||
connect(m_ui.links, &QLabel::linkActivated, this, &AboutDialog::linksLinkActivated);
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::close);
|
||||
}
|
||||
|
||||
@@ -55,10 +81,60 @@ QString AboutDialog::getGitHubRepositoryUrl()
|
||||
|
||||
QString AboutDialog::getLicenseUrl()
|
||||
{
|
||||
return QString::fromUtf8(PCSX2_LICENSE_URL);
|
||||
return GetDocFileUrl("GPL.html");
|
||||
}
|
||||
|
||||
QString AboutDialog::getThirdPartyLicensesUrl()
|
||||
{
|
||||
return GetDocFileUrl("ThirdPartyLicenses.html");
|
||||
}
|
||||
|
||||
QString AboutDialog::getDiscordServerUrl()
|
||||
{
|
||||
return QString::fromUtf8(PCSX2_DISCORD_URL);
|
||||
}
|
||||
|
||||
void AboutDialog::linksLinkActivated(const QString& link)
|
||||
{
|
||||
const QUrl url(link);
|
||||
if (!url.isValid())
|
||||
return;
|
||||
|
||||
if (!url.isLocalFile())
|
||||
{
|
||||
QDesktopServices::openUrl(url);
|
||||
return;
|
||||
}
|
||||
|
||||
showHTMLDialog(this, tr("View Document"), url.toLocalFile());
|
||||
}
|
||||
|
||||
void AboutDialog::showHTMLDialog(QWidget* parent, const QString& title, const QString& path)
|
||||
{
|
||||
QDialog dialog(parent);
|
||||
dialog.setMinimumSize(700, 400);
|
||||
dialog.setWindowTitle(title);
|
||||
dialog.setWindowIcon(QtHost::GetAppIcon());
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(&dialog);
|
||||
|
||||
QTextBrowser* tb = new QTextBrowser(&dialog);
|
||||
tb->setAcceptRichText(true);
|
||||
tb->setReadOnly(true);
|
||||
tb->setOpenExternalLinks(true);
|
||||
|
||||
QFile file(path);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
if (const QByteArray data = file.readAll(); !data.isEmpty())
|
||||
tb->setText(QString::fromUtf8(data));
|
||||
else
|
||||
tb->setText(tr("File not found: %1").arg(path));
|
||||
|
||||
layout->addWidget(tb, 1);
|
||||
|
||||
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, &dialog);
|
||||
connect(bb->button(QDialogButtonBox::Close), &QPushButton::clicked, &dialog, &QDialog::done);
|
||||
layout->addWidget(bb, 0);
|
||||
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
@@ -18,8 +18,14 @@ public:
|
||||
static QString getSupportForumsUrl();
|
||||
static QString getGitHubRepositoryUrl();
|
||||
static QString getLicenseUrl();
|
||||
static QString getThirdPartyLicensesUrl();
|
||||
static QString getDiscordServerUrl();
|
||||
|
||||
static void showHTMLDialog(QWidget* parent, const QString& title, const QString& url);
|
||||
|
||||
private Q_SLOTS:
|
||||
void linksLinkActivated(const QString& link);
|
||||
|
||||
private:
|
||||
Ui::AboutDialog m_ui;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "AutoUpdaterDialog.h"
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "QtUtils.h"
|
||||
|
||||
#include "pcsx2/Host.h"
|
||||
#include "pcsx2/SysForwardDefs.h"
|
||||
#include "svnrev.h"
|
||||
|
||||
#include "updater/UpdaterExtractor.h"
|
||||
@@ -16,8 +15,10 @@
|
||||
#include "common/Assertions.h"
|
||||
#include "common/CocoaTools.h"
|
||||
#include "common/Console.h"
|
||||
#include "common/Error.h"
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/HTTPDownloader.h"
|
||||
#include "common/Path.h"
|
||||
#include "common/StringUtil.h"
|
||||
|
||||
#include "cpuinfo.h"
|
||||
@@ -38,12 +39,17 @@
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QProgressDialog>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "common/RedtapeWindows.h"
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
// Interval at which HTTP requests are polled.
|
||||
static constexpr u32 HTTP_POLL_INTERVAL = 10;
|
||||
|
||||
// Logic to detect whether we can use the auto updater.
|
||||
// We use tagged commit, because this gets set on nightly builds.
|
||||
#if (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && defined(GIT_TAG_LO)
|
||||
#if (defined(_WIN32) || defined(__linux__) || defined(__APPLE__)) && GIT_TAGGED_COMMIT
|
||||
|
||||
#define AUTO_UPDATER_SUPPORTED 1
|
||||
|
||||
@@ -73,8 +79,13 @@ static constexpr u32 HTTP_POLL_INTERVAL = 10;
|
||||
// Available release channels.
|
||||
static const char* UPDATE_TAGS[] = {"stable", "nightly"};
|
||||
|
||||
// Bit annoying, because PCSX2_isReleaseVersion is a bool, but whatever.
|
||||
#define THIS_RELEASE_TAG (PCSX2_isReleaseVersion ? "stable" : "nightly")
|
||||
// TODO: Make manual releases create this file, and make it contain `#define DEFAULT_UPDATER_CHANNEL "stable"`.
|
||||
#if __has_include("DefaultUpdaterChannel.h")
|
||||
#include "DefaultUpdaterChannel.h"
|
||||
#endif
|
||||
#ifndef DEFAULT_UPDATER_CHANNEL
|
||||
#define DEFAULT_UPDATER_CHANNEL "nightly"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -129,7 +140,7 @@ QStringList AutoUpdaterDialog::getTagList()
|
||||
std::string AutoUpdaterDialog::getDefaultTag()
|
||||
{
|
||||
#ifdef AUTO_UPDATER_SUPPORTED
|
||||
return THIS_RELEASE_TAG;
|
||||
return DEFAULT_UPDATER_CHANNEL;
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
@@ -142,15 +153,13 @@ QString AutoUpdaterDialog::getCurrentVersion()
|
||||
|
||||
QString AutoUpdaterDialog::getCurrentVersionDate()
|
||||
{
|
||||
// 20220403235450ll
|
||||
const QDateTime current_build_date(QDateTime::fromString(QStringLiteral("%1").arg(SVN_REV), "yyyyMMddhhmmss"));
|
||||
return current_build_date.toString();
|
||||
return QStringLiteral(GIT_DATE);
|
||||
}
|
||||
|
||||
QString AutoUpdaterDialog::getCurrentUpdateTag() const
|
||||
{
|
||||
#ifdef AUTO_UPDATER_SUPPORTED
|
||||
return QString::fromStdString(Host::GetBaseStringSettingValue("AutoUpdater", "UpdateTag", THIS_RELEASE_TAG));
|
||||
return QString::fromStdString(Host::GetBaseStringSettingValue("AutoUpdater", "UpdateTag", DEFAULT_UPDATER_CHANNEL));
|
||||
#else
|
||||
return QString();
|
||||
#endif
|
||||
@@ -566,70 +575,74 @@ void AutoUpdaterDialog::remindMeLaterClicked()
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
bool AutoUpdaterDialog::doesUpdaterNeedElevation(const std::string& application_dir) const
|
||||
{
|
||||
// Try to create a dummy text file in the PCSX2 updater directory. If it fails, we probably won't have write permission.
|
||||
const std::string dummy_path = Path::Combine(application_dir, "update.txt");
|
||||
auto fp = FileSystem::OpenManagedCFile(dummy_path.c_str(), "wb");
|
||||
if (!fp)
|
||||
return true;
|
||||
|
||||
fp.reset();
|
||||
FileSystem::DeleteFilePath(dummy_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& data, QProgressDialog&)
|
||||
{
|
||||
const QString update_directory = QCoreApplication::applicationDirPath();
|
||||
const QString update_zip_path = QStringLiteral("%1" FS_OSPATH_SEPARATOR_STR "%2").arg(update_directory).arg(UPDATER_ARCHIVE_NAME);
|
||||
const QString updater_path = QStringLiteral("%1" FS_OSPATH_SEPARATOR_STR "%2").arg(update_directory).arg(UPDATER_EXECUTABLE);
|
||||
const std::string& application_dir = EmuFolders::AppRoot;
|
||||
const std::string update_zip_path = Path::Combine(EmuFolders::DataRoot, UPDATER_ARCHIVE_NAME);
|
||||
const std::string updater_path = Path::Combine(EmuFolders::DataRoot, UPDATER_EXECUTABLE);
|
||||
|
||||
Q_ASSERT(!update_zip_path.isEmpty() && !updater_path.isEmpty() && !update_directory.isEmpty());
|
||||
if ((QFile::exists(update_zip_path) && !QFile::remove(update_zip_path)) ||
|
||||
(QFile::exists(updater_path) && !QFile::remove(updater_path)))
|
||||
if ((FileSystem::FileExists(update_zip_path.c_str()) && !FileSystem::DeleteFilePath(update_zip_path.c_str())))
|
||||
{
|
||||
reportError("Removing existing update zip/updater failed");
|
||||
reportError("Removing existing update zip failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!FileSystem::WriteBinaryFile(update_zip_path.c_str(), data.data(), data.size()))
|
||||
{
|
||||
QFile update_zip_file(update_zip_path);
|
||||
if (!update_zip_file.open(QIODevice::WriteOnly) ||
|
||||
update_zip_file.write(reinterpret_cast<const char*>(data.data()), static_cast<qint64>(data.size())) != static_cast<qint64>(data.size()))
|
||||
{
|
||||
reportError("Writing update zip to '%s' failed", update_zip_path.toUtf8().constData());
|
||||
return false;
|
||||
}
|
||||
update_zip_file.close();
|
||||
reportError("Writing update zip to '%s' failed", update_zip_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string updater_extract_error;
|
||||
if (!ExtractUpdater(update_zip_path.toUtf8().constData(), updater_path.toUtf8().constData(), &updater_extract_error))
|
||||
if (!ExtractUpdater(update_zip_path.c_str(), updater_path.c_str(), &updater_extract_error))
|
||||
{
|
||||
reportError("Extracting updater failed: %s", updater_extract_error.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!doUpdate(update_zip_path, updater_path, update_directory))
|
||||
{
|
||||
reportError("Launching updater failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return doUpdate(application_dir, update_zip_path, updater_path);
|
||||
}
|
||||
|
||||
bool AutoUpdaterDialog::doUpdate(const QString& zip_path, const QString& updater_path, const QString& destination_path)
|
||||
bool AutoUpdaterDialog::doUpdate(const std::string& application_dir, const std::string& zip_path, const std::string& updater_path)
|
||||
{
|
||||
const QString program_path = QCoreApplication::applicationFilePath();
|
||||
if (program_path.isEmpty())
|
||||
const std::string program_path = QDir::toNativeSeparators(QCoreApplication::applicationFilePath()).toStdString();
|
||||
if (program_path.empty())
|
||||
{
|
||||
reportError("Failed to get current application path");
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList arguments;
|
||||
arguments << QString::number(QCoreApplication::applicationPid());
|
||||
arguments << destination_path;
|
||||
arguments << zip_path;
|
||||
arguments << program_path;
|
||||
const std::wstring wupdater_path = StringUtil::UTF8StringToWideString(updater_path);
|
||||
const std::wstring wapplication_dir = StringUtil::UTF8StringToWideString(application_dir);
|
||||
const std::wstring arguments = StringUtil::UTF8StringToWideString(fmt::format("{} \"{}\" \"{}\" \"{}\"",
|
||||
QCoreApplication::applicationPid(), application_dir, zip_path, program_path));
|
||||
|
||||
// this will leak, but not sure how else to handle it...
|
||||
QProcess* updater_process = new QProcess();
|
||||
updater_process->setProgram(updater_path);
|
||||
updater_process->setArguments(arguments);
|
||||
updater_process->start(QIODevice::NotOpen);
|
||||
if (!updater_process->waitForStarted())
|
||||
const bool needs_elevation = doesUpdaterNeedElevation(application_dir);
|
||||
|
||||
SHELLEXECUTEINFOW sei = {};
|
||||
sei.cbSize = sizeof(sei);
|
||||
sei.lpVerb = needs_elevation ? L"runas" : nullptr; // needed to trigger elevation
|
||||
sei.lpFile = wupdater_path.c_str();
|
||||
sei.lpParameters = arguments.c_str();
|
||||
sei.lpDirectory = wapplication_dir.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
if (!ShellExecuteExW(&sei))
|
||||
{
|
||||
reportError("Failed to start updater");
|
||||
reportError("Failed to start %s: %s", needs_elevation ? "elevated updater" : "updater",
|
||||
Error::CreateWin32(GetLastError()).GetDescription().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -638,7 +651,19 @@ bool AutoUpdaterDialog::doUpdate(const QString& zip_path, const QString& updater
|
||||
|
||||
void AutoUpdaterDialog::cleanupAfterUpdate()
|
||||
{
|
||||
// Nothing to do on Windows for now, the updater stub cleans everything up.
|
||||
// If we weren't portable, then updater executable gets left in the application directory.
|
||||
if (EmuFolders::AppRoot == EmuFolders::DataRoot)
|
||||
return;
|
||||
|
||||
const std::string updater_path = Path::Combine(EmuFolders::DataRoot, UPDATER_EXECUTABLE);
|
||||
if (!FileSystem::FileExists(updater_path.c_str()))
|
||||
return;
|
||||
|
||||
if (!FileSystem::DeleteFilePath(updater_path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(nullptr, tr("Updater Error"), tr("Failed to remove updater exe after update."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
@@ -60,7 +60,8 @@ private:
|
||||
|
||||
bool processUpdate(const std::vector<u8>& data, QProgressDialog& progress);
|
||||
#if defined(_WIN32)
|
||||
bool doUpdate(const QString& zip_path, const QString& updater_path, const QString& destination_path);
|
||||
bool doesUpdaterNeedElevation(const std::string& application_dir) const;
|
||||
bool doUpdate(const std::string& application_dir, const std::string& zip_path, const std::string& updater_path);
|
||||
#endif
|
||||
|
||||
Ui::AutoUpdaterDialog m_ui;
|
||||
|
||||
@@ -21,6 +21,8 @@ target_sources(pcsx2-qt PRIVATE
|
||||
DisplayWidget.cpp
|
||||
DisplayWidget.h
|
||||
EarlyHardwareCheck.cpp
|
||||
LogWindow.cpp
|
||||
LogWindow.h
|
||||
MainWindow.cpp
|
||||
MainWindow.h
|
||||
MainWindow.ui
|
||||
@@ -73,6 +75,7 @@ target_sources(pcsx2-qt PRIVATE
|
||||
Settings/ControllerGlobalSettingsWidget.ui
|
||||
Settings/ControllerMacroEditWidget.ui
|
||||
Settings/ControllerMacroWidget.ui
|
||||
Settings/ControllerMappingSettingsDialog.ui
|
||||
Settings/ControllerMouseSettingsDialog.ui
|
||||
Settings/ControllerSettingsWindow.cpp
|
||||
Settings/ControllerSettingsWindow.h
|
||||
@@ -147,6 +150,8 @@ target_sources(pcsx2-qt PRIVATE
|
||||
Debugger/CpuWidget.cpp
|
||||
Debugger/CpuWidget.h
|
||||
Debugger/CpuWidget.ui
|
||||
Debugger/DebuggerSettingsManager.cpp
|
||||
Debugger/DebuggerSettingsManager.h
|
||||
Debugger/DebuggerWindow.cpp
|
||||
Debugger/DebuggerWindow.h
|
||||
Debugger/DebuggerWindow.ui
|
||||
@@ -245,4 +250,5 @@ if(WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
fixup_file_properties(pcsx2-qt)
|
||||
setup_main_executable(pcsx2-qt)
|
||||
|
||||
+104
-144
@@ -8,6 +8,7 @@
|
||||
#include "Models/BreakpointModel.h"
|
||||
#include "Models/ThreadModel.h"
|
||||
#include "Models/SavedAddressesModel.h"
|
||||
#include "Debugger/DebuggerSettingsManager.h"
|
||||
|
||||
#include "DebugTools/DebugInterface.h"
|
||||
#include "DebugTools/Breakpoints.h"
|
||||
@@ -45,6 +46,15 @@ CpuWidget::CpuWidget(QWidget* parent, DebugInterface& cpu)
|
||||
m_ui.setupUi(this);
|
||||
|
||||
connect(g_emu_thread, &EmuThread::onVMPaused, this, &CpuWidget::onVMPaused);
|
||||
connect(g_emu_thread, &EmuThread::onGameChanged, [this](const QString& title) {
|
||||
if (title.isEmpty())
|
||||
return;
|
||||
// Don't overwrite users BPs/Saved Addresses unless they have a clean state.
|
||||
if (m_bpModel.rowCount() == 0)
|
||||
DebuggerSettingsManager::loadGameSettings(&m_bpModel);
|
||||
if (m_savedAddressesModel.rowCount() == 0)
|
||||
DebuggerSettingsManager::loadGameSettings(&m_savedAddressesModel);
|
||||
});
|
||||
|
||||
connect(m_ui.registerWidget, &RegisterWidget::gotoInDisasm, m_ui.disassemblyWidget, &DisassemblyWidget::gotoAddress);
|
||||
connect(m_ui.memoryviewWidget, &MemoryViewWidget::gotoInDisasm, m_ui.disassemblyWidget, &DisassemblyWidget::gotoAddress);
|
||||
@@ -143,9 +153,12 @@ CpuWidget::CpuWidget(QWidget* parent, DebugInterface& cpu)
|
||||
m_ui.savedAddressesList->horizontalHeader()->setSectionResizeMode(i++, mode);
|
||||
}
|
||||
QTableView* savedAddressesTableView = m_ui.savedAddressesList;
|
||||
connect(m_ui.savedAddressesList->model(), &QAbstractItemModel::dataChanged, [savedAddressesTableView](const QModelIndex& topLeft) {
|
||||
connect(m_ui.savedAddressesList->model(), &QAbstractItemModel::dataChanged, [savedAddressesTableView](const QModelIndex& topLeft) {
|
||||
savedAddressesTableView->resizeColumnToContents(topLeft.column());
|
||||
});
|
||||
|
||||
DebuggerSettingsManager::loadGameSettings(&m_bpModel);
|
||||
DebuggerSettingsManager::loadGameSettings(&m_savedAddressesModel);
|
||||
}
|
||||
|
||||
CpuWidget::~CpuWidget() = default;
|
||||
@@ -301,46 +314,63 @@ void CpuWidget::onBPListDoubleClicked(const QModelIndex& index)
|
||||
|
||||
void CpuWidget::onBPListContextMenu(QPoint pos)
|
||||
{
|
||||
if (!m_cpu.isAlive())
|
||||
return;
|
||||
|
||||
QMenu* contextMenu = new QMenu(tr("Breakpoint List Context Menu"), m_ui.breakpointList);
|
||||
|
||||
QAction* newAction = new QAction(tr("New"), m_ui.breakpointList);
|
||||
connect(newAction, &QAction::triggered, this, &CpuWidget::contextBPListNew);
|
||||
contextMenu->addAction(newAction);
|
||||
|
||||
const QItemSelectionModel* selModel = m_ui.breakpointList->selectionModel();
|
||||
|
||||
if (selModel->hasSelection())
|
||||
if (m_cpu.isAlive())
|
||||
{
|
||||
QAction* editAction = new QAction(tr("Edit"), m_ui.breakpointList);
|
||||
connect(editAction, &QAction::triggered, this, &CpuWidget::contextBPListEdit);
|
||||
contextMenu->addAction(editAction);
|
||||
|
||||
if (selModel->selectedIndexes().count() == 1)
|
||||
QAction* newAction = new QAction(tr("New"), m_ui.breakpointList);
|
||||
connect(newAction, &QAction::triggered, this, &CpuWidget::contextBPListNew);
|
||||
contextMenu->addAction(newAction);
|
||||
|
||||
const QItemSelectionModel* selModel = m_ui.breakpointList->selectionModel();
|
||||
|
||||
if (selModel->hasSelection())
|
||||
{
|
||||
QAction* copyAction = new QAction(tr("Copy"), m_ui.breakpointList);
|
||||
connect(copyAction, &QAction::triggered, this, &CpuWidget::contextBPListCopy);
|
||||
contextMenu->addAction(copyAction);
|
||||
}
|
||||
QAction* editAction = new QAction(tr("Edit"), m_ui.breakpointList);
|
||||
connect(editAction, &QAction::triggered, this, &CpuWidget::contextBPListEdit);
|
||||
contextMenu->addAction(editAction);
|
||||
|
||||
QAction* deleteAction = new QAction(tr("Delete"), m_ui.breakpointList);
|
||||
connect(deleteAction, &QAction::triggered, this, &CpuWidget::contextBPListDelete);
|
||||
contextMenu->addAction(deleteAction);
|
||||
if (selModel->selectedIndexes().count() == 1)
|
||||
{
|
||||
QAction* copyAction = new QAction(tr("Copy"), m_ui.breakpointList);
|
||||
connect(copyAction, &QAction::triggered, this, &CpuWidget::contextBPListCopy);
|
||||
contextMenu->addAction(copyAction);
|
||||
}
|
||||
|
||||
QAction* deleteAction = new QAction(tr("Delete"), m_ui.breakpointList);
|
||||
connect(deleteAction, &QAction::triggered, this, &CpuWidget::contextBPListDelete);
|
||||
contextMenu->addAction(deleteAction);
|
||||
}
|
||||
}
|
||||
|
||||
contextMenu->addSeparator();
|
||||
QAction* actionExport = new QAction(tr("Copy all as CSV"), m_ui.breakpointList);
|
||||
connect(actionExport, &QAction::triggered, [this]() {
|
||||
// It's important to use the Export Role here to allow pasting to be translation agnostic
|
||||
QGuiApplication::clipboard()->setText(QtUtils::AbstractItemModelToCSV(m_ui.breakpointList->model(), BreakpointModel::ExportRole, true));
|
||||
});
|
||||
contextMenu->addAction(actionExport);
|
||||
if (m_bpModel.rowCount() > 0)
|
||||
{
|
||||
QAction* actionExport = new QAction(tr("Copy all as CSV"), m_ui.breakpointList);
|
||||
connect(actionExport, &QAction::triggered, [this]() {
|
||||
// It's important to use the Export Role here to allow pasting to be translation agnostic
|
||||
QGuiApplication::clipboard()->setText(QtUtils::AbstractItemModelToCSV(m_ui.breakpointList->model(), BreakpointModel::ExportRole, true));
|
||||
});
|
||||
contextMenu->addAction(actionExport);
|
||||
}
|
||||
|
||||
QAction* actionImport = new QAction(tr("Paste from CSV"), m_ui.breakpointList);
|
||||
connect(actionImport, &QAction::triggered, this, &CpuWidget::contextBPListPasteCSV);
|
||||
contextMenu->addAction(actionImport);
|
||||
if (m_cpu.isAlive())
|
||||
{
|
||||
QAction* actionImport = new QAction(tr("Paste from CSV"), m_ui.breakpointList);
|
||||
connect(actionImport, &QAction::triggered, this, &CpuWidget::contextBPListPasteCSV);
|
||||
contextMenu->addAction(actionImport);
|
||||
|
||||
QAction* actionLoad = new QAction(tr("Load from Settings"), m_ui.breakpointList);
|
||||
connect(actionLoad, &QAction::triggered, [this]() {
|
||||
m_bpModel.clear();
|
||||
DebuggerSettingsManager::loadGameSettings(&m_bpModel);
|
||||
});
|
||||
contextMenu->addAction(actionLoad);
|
||||
|
||||
QAction* actionSave = new QAction(tr("Save to Settings"), m_ui.breakpointList);
|
||||
connect(actionSave, &QAction::triggered, this, &CpuWidget::saveBreakpointsToDebuggerSettings);
|
||||
contextMenu->addAction(actionSave);
|
||||
}
|
||||
|
||||
contextMenu->popup(m_ui.breakpointList->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
@@ -407,7 +437,7 @@ void CpuWidget::contextBPListPasteCSV()
|
||||
// In order to handle text with commas in them we must wrap values in quotes to mark
|
||||
// where a value starts and end so that text commas aren't identified as delimiters.
|
||||
// So matches each quote pair, parse it out, and removes the quotes to get the value.
|
||||
QRegularExpression eachQuotePair(R"("([^"]|\\.)*")");
|
||||
QRegularExpression eachQuotePair(R"("([^"]|\\.)*")");
|
||||
QRegularExpressionMatchIterator it = eachQuotePair.globalMatch(line);
|
||||
while (it.hasNext())
|
||||
{
|
||||
@@ -415,98 +445,7 @@ void CpuWidget::contextBPListPasteCSV()
|
||||
QString matchedValue = match.captured(0);
|
||||
fields << matchedValue.mid(1, matchedValue.length() - 2);
|
||||
}
|
||||
|
||||
if (fields.size() != BreakpointModel::BreakpointColumns::COLUMN_COUNT)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Invalid number of columns, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
const int type = fields[BreakpointModel::BreakpointColumns::TYPE].toUInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse type '%s', skipping", fields[BreakpointModel::BreakpointColumns::TYPE].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
// This is how we differentiate between breakpoints and memchecks
|
||||
if (type == MEMCHECK_INVALID)
|
||||
{
|
||||
BreakPoint bp;
|
||||
|
||||
// Address
|
||||
bp.addr = fields[BreakpointModel::BreakpointColumns::OFFSET].toUInt(&ok, 16);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse address '%s', skipping", fields[BreakpointModel::BreakpointColumns::OFFSET].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Condition
|
||||
if (!fields[BreakpointModel::BreakpointColumns::CONDITION].isEmpty())
|
||||
{
|
||||
PostfixExpression expr;
|
||||
bp.hasCond = true;
|
||||
bp.cond.debug = &m_cpu;
|
||||
|
||||
if (!m_cpu.initExpression(fields[BreakpointModel::BreakpointColumns::CONDITION].toUtf8().constData(), expr))
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse cond '%s', skipping", fields[BreakpointModel::BreakpointColumns::CONDITION].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
bp.cond.expression = expr;
|
||||
strncpy(&bp.cond.expressionString[0], fields[BreakpointModel::BreakpointColumns::CONDITION].toUtf8().constData(), sizeof(bp.cond.expressionString));
|
||||
}
|
||||
|
||||
// Enabled
|
||||
bp.enabled = fields[BreakpointModel::BreakpointColumns::ENABLED].toUInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse enable flag '%s', skipping", fields[BreakpointModel::BreakpointColumns::ENABLED].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
m_bpModel.insertBreakpointRows(0, 1, {bp});
|
||||
}
|
||||
else
|
||||
{
|
||||
MemCheck mc;
|
||||
// Mode
|
||||
if (type >= MEMCHECK_INVALID)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse cond type '%s', skipping", fields [BreakpointModel::BreakpointColumns::TYPE].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
mc.cond = static_cast<MemCheckCondition>(type);
|
||||
|
||||
// Address
|
||||
mc.start = fields[BreakpointModel::BreakpointColumns::OFFSET].toUInt(&ok, 16);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse address '%s', skipping", fields[BreakpointModel::BreakpointColumns::OFFSET].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Size
|
||||
mc.end = fields[BreakpointModel::BreakpointColumns::SIZE_LABEL].toUInt(&ok) + mc.start;
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse length '%s', skipping", fields[BreakpointModel::BreakpointColumns::SIZE_LABEL].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Result
|
||||
const int result = fields [BreakpointModel::BreakpointColumns::ENABLED].toUInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse result flag '%s', skipping", fields [BreakpointModel::BreakpointColumns::ENABLED].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
mc.result = static_cast<MemCheckResult>(result);
|
||||
|
||||
m_bpModel.insertBreakpointRows(0, 1, {mc});
|
||||
}
|
||||
m_bpModel.loadBreakpointFromFieldList(fields);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,7 +500,19 @@ void CpuWidget::onSavedAddressesListContextMenu(QPoint pos)
|
||||
connect(actionImportCSV, &QAction::triggered, this, &CpuWidget::contextSavedAddressesListPasteCSV);
|
||||
contextMenu->addAction(actionImportCSV);
|
||||
|
||||
contextMenu->popup(m_ui.savedAddressesList->viewport()->mapToGlobal(pos));
|
||||
if (m_cpu.isAlive())
|
||||
{
|
||||
QAction* actionLoad = new QAction(tr("Load from Settings"), m_ui.savedAddressesList);
|
||||
connect(actionLoad, &QAction::triggered, [this]() {
|
||||
m_savedAddressesModel.clear();
|
||||
DebuggerSettingsManager::loadGameSettings(&m_savedAddressesModel);
|
||||
});
|
||||
contextMenu->addAction(actionLoad);
|
||||
|
||||
QAction* actionSave = new QAction(tr("Save to Settings"), m_ui.savedAddressesList);
|
||||
connect(actionSave, &QAction::triggered, this, &CpuWidget::saveSavedAddressesToDebuggerSettings);
|
||||
contextMenu->addAction(actionSave);
|
||||
}
|
||||
|
||||
if (isIndexValid)
|
||||
{
|
||||
@@ -571,6 +522,8 @@ void CpuWidget::onSavedAddressesListContextMenu(QPoint pos)
|
||||
});
|
||||
contextMenu->addAction(deleteAction);
|
||||
}
|
||||
|
||||
contextMenu->popup(m_ui.savedAddressesList->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void CpuWidget::contextSavedAddressesListPasteCSV()
|
||||
@@ -594,24 +547,7 @@ void CpuWidget::contextSavedAddressesListPasteCSV()
|
||||
fields << matchedValue.mid(1, matchedValue.length() - 2);
|
||||
}
|
||||
|
||||
if (fields.size() != SavedAddressesModel::HeaderColumns::COLUMN_COUNT)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Invalid number of columns, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
const u32 address = fields[SavedAddressesModel::HeaderColumns::ADDRESS].toUInt(&ok, 16);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger CSV Import: Failed to parse address '%s', skipping", fields[SavedAddressesModel::HeaderColumns::ADDRESS].toUtf8().constData());
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString label = fields[SavedAddressesModel::HeaderColumns::LABEL];
|
||||
const QString description = fields[SavedAddressesModel::HeaderColumns::DESCRIPTION];
|
||||
const SavedAddressesModel::SavedAddress importedAddress = {address, label, description};
|
||||
m_savedAddressesModel.addRow(importedAddress);
|
||||
m_savedAddressesModel.loadSavedAddressFromFieldList(fields);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,6 +592,17 @@ void CpuWidget::contextRemoveSearchResult()
|
||||
delete rowToRemove;
|
||||
}
|
||||
|
||||
void CpuWidget::contextCopySearchResultAddress()
|
||||
{
|
||||
if (!m_ui.listSearchResults->selectionModel()->hasSelection())
|
||||
return;
|
||||
|
||||
const u32 selectedResultIndex = m_ui.listSearchResults->row(m_ui.listSearchResults->selectedItems().first());
|
||||
const u32 rowAddress = m_ui.listSearchResults->item(selectedResultIndex)->data(Qt::UserRole).toUInt();
|
||||
const QString addressString = FilledQStringFromValue(rowAddress, 16);
|
||||
QApplication::clipboard()->setText(addressString);
|
||||
}
|
||||
|
||||
void CpuWidget::updateFunctionList(bool whenEmpty)
|
||||
{
|
||||
if (!m_cpu.isAlive())
|
||||
@@ -958,6 +905,10 @@ void CpuWidget::onListSearchResultsContextMenu(QPoint pos)
|
||||
|
||||
if (selModel->hasSelection())
|
||||
{
|
||||
QAction* copyAddressAction = new QAction(tr("Copy Address"), m_ui.listSearchResults);
|
||||
connect(copyAddressAction, &QAction::triggered, this, &CpuWidget::contextCopySearchResultAddress);
|
||||
contextMenu->addAction(copyAddressAction);
|
||||
|
||||
QAction* goToDisassemblyAction = new QAction(tr("Go to in Disassembly"), m_ui.listSearchResults);
|
||||
connect(goToDisassemblyAction, &QAction::triggered, this, &CpuWidget::contextSearchResultGoToDisassembly);
|
||||
contextMenu->addAction(goToDisassemblyAction);
|
||||
@@ -1392,3 +1343,12 @@ void CpuWidget::loadSearchResults()
|
||||
}
|
||||
}
|
||||
|
||||
void CpuWidget::saveBreakpointsToDebuggerSettings()
|
||||
{
|
||||
DebuggerSettingsManager::saveGameSettings(&m_bpModel);
|
||||
}
|
||||
|
||||
void CpuWidget::saveSavedAddressesToDebuggerSettings()
|
||||
{
|
||||
DebuggerSettingsManager::saveGameSettings(&m_savedAddressesModel);
|
||||
}
|
||||
|
||||
@@ -116,8 +116,12 @@ public slots:
|
||||
void loadSearchResults();
|
||||
void contextSearchResultGoToDisassembly();
|
||||
void contextRemoveSearchResult();
|
||||
void contextCopySearchResultAddress();
|
||||
void onListSearchResultsContextMenu(QPoint pos);
|
||||
|
||||
void saveBreakpointsToDebuggerSettings();
|
||||
void saveSavedAddressesToDebuggerSettings();
|
||||
|
||||
private:
|
||||
std::vector<QTableWidget*> m_registerTableViews;
|
||||
std::vector<u32> m_searchResults;
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "DebuggerSettingsManager.h"
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <QtCore/QFile>
|
||||
|
||||
#include "common/Console.h"
|
||||
#include "fmt/core.h"
|
||||
#include "VMManager.h"
|
||||
#include "Models/BreakpointModel.h"
|
||||
|
||||
std::mutex DebuggerSettingsManager::writeLock;
|
||||
const QString DebuggerSettingsManager::settingsFileVersion = "0.00";
|
||||
|
||||
QJsonObject DebuggerSettingsManager::loadGameSettingsJSON() {
|
||||
std::string path = VMManager::GetDebuggerSettingsFilePathForCurrentGame();
|
||||
QFile file(QString::fromStdString(path));
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
Console.WriteLnFmt("Debugger Settings Manager: No Debugger Settings file found for game at: '{}'", path);
|
||||
return QJsonObject();
|
||||
}
|
||||
QByteArray fileContent = file.readAll();
|
||||
file.close();
|
||||
|
||||
const QJsonDocument jsonDoc(QJsonDocument::fromJson(fileContent));
|
||||
if (jsonDoc.isNull() || !jsonDoc.isObject())
|
||||
{
|
||||
Console.WriteLnFmt("Debugger Settings Manager: Failed to load contents of settings file for file at: '{}'", path);
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
return jsonDoc.object();
|
||||
}
|
||||
|
||||
void DebuggerSettingsManager::writeJSONToPath(std::string path, QJsonDocument jsonDocument)
|
||||
{
|
||||
QFile file(QString::fromStdString(path));
|
||||
if (!file.open(QIODevice::WriteOnly))
|
||||
{
|
||||
Console.WriteLnFmt("Debugger Settings Manager: Failed to write Debugger Settings file to path: '{}'", path);
|
||||
return;
|
||||
}
|
||||
file.write(jsonDocument.toJson(QJsonDocument::Indented));
|
||||
file.close();
|
||||
}
|
||||
|
||||
void DebuggerSettingsManager::loadGameSettings(BreakpointModel* bpModel)
|
||||
{
|
||||
const std::string path = VMManager::GetDebuggerSettingsFilePathForCurrentGame();
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
const QJsonValue breakpointsValue = loadGameSettingsJSON().value("Breakpoints");
|
||||
const QString valueToLoad = breakpointsValue.toString();
|
||||
if (breakpointsValue.isUndefined() || !breakpointsValue.isArray())
|
||||
{
|
||||
Console.WriteLnFmt("Debugger Settings Manager: Failed to read Breakpoints array from settings file: '{}'", path);
|
||||
return;
|
||||
}
|
||||
|
||||
const QJsonArray breakpointsArray = breakpointsValue.toArray();
|
||||
for (u32 row = 0; row < breakpointsArray.size(); row++)
|
||||
{
|
||||
const QJsonValue rowValue = breakpointsArray.at(row);
|
||||
if (rowValue.isUndefined() || !rowValue.isObject())
|
||||
{
|
||||
Console.WriteLn("Debugger Settings Manager: Failed to load invalid Breakpoint object.");
|
||||
continue;
|
||||
}
|
||||
const QJsonObject rowObject = rowValue.toObject();
|
||||
|
||||
QStringList fields;
|
||||
u32 col = 0;
|
||||
for (auto iter = rowObject.begin(); iter != rowObject.end(); iter++, col++)
|
||||
{
|
||||
QString headerColKey = bpModel->headerData(col, Qt::Horizontal, Qt::UserRole).toString();
|
||||
fields << rowObject.value(headerColKey).toString();
|
||||
}
|
||||
bpModel->loadBreakpointFromFieldList(fields);
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerSettingsManager::loadGameSettings(SavedAddressesModel* savedAddressesModel)
|
||||
{
|
||||
const std::string path = VMManager::GetDebuggerSettingsFilePathForCurrentGame();
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
const QJsonValue savedAddressesValue = loadGameSettingsJSON().value("SavedAddresses");
|
||||
QString valueToLoad = savedAddressesValue.toString();
|
||||
if (savedAddressesValue.isUndefined() || !savedAddressesValue.isArray())
|
||||
{
|
||||
Console.WriteLnFmt("Debugger Settings Manager: Failed to read Saved Addresses array from settings file: '{}'", path);
|
||||
return;
|
||||
}
|
||||
|
||||
const QJsonArray breakpointsArray = savedAddressesValue.toArray();
|
||||
|
||||
for (u32 row = 0; row < breakpointsArray.size(); row++)
|
||||
{
|
||||
const QJsonValue rowValue = breakpointsArray.at(row);
|
||||
if (rowValue.isUndefined() || !rowValue.isObject())
|
||||
{
|
||||
Console.WriteLn("Debugger Settings Manager: Failed to load invalid Breakpoint object.");
|
||||
continue;
|
||||
}
|
||||
const QJsonObject rowObject = rowValue.toObject();
|
||||
QStringList fields;
|
||||
u32 col = 0;
|
||||
for (auto iter = rowObject.begin(); iter != rowObject.end(); iter++, col++)
|
||||
{
|
||||
QString headerColKey = savedAddressesModel->headerData(col, Qt::Horizontal, Qt::UserRole).toString();
|
||||
fields << rowObject.value(headerColKey).toString();
|
||||
}
|
||||
savedAddressesModel->loadSavedAddressFromFieldList(fields);
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerSettingsManager::saveGameSettings(BreakpointModel* bpModel)
|
||||
{
|
||||
saveGameSettings(bpModel, "Breakpoints", BreakpointModel::ExportRole);
|
||||
}
|
||||
|
||||
void DebuggerSettingsManager::saveGameSettings(SavedAddressesModel* savedAddressesModel)
|
||||
{
|
||||
saveGameSettings(savedAddressesModel, "SavedAddresses", Qt::DisplayRole);
|
||||
}
|
||||
|
||||
void DebuggerSettingsManager::saveGameSettings(QAbstractTableModel* abstractTableModel, QString settingsKey, u32 role)
|
||||
{
|
||||
const std::string path = VMManager::GetDebuggerSettingsFilePathForCurrentGame();
|
||||
if (path.empty())
|
||||
return;
|
||||
|
||||
const std::lock_guard<std::mutex> lock(writeLock);
|
||||
QJsonObject loadedSettings = loadGameSettingsJSON();
|
||||
QJsonArray rowsArray;
|
||||
QStringList keys;
|
||||
for (int col = 0; col < abstractTableModel->columnCount(); ++col)
|
||||
{
|
||||
keys << abstractTableModel->headerData(col, Qt::Horizontal, Qt::UserRole).toString();
|
||||
}
|
||||
|
||||
for (int row = 0; row < abstractTableModel->rowCount(); row++)
|
||||
{
|
||||
QJsonObject rowObject;
|
||||
for (int col = 0; col < abstractTableModel->columnCount(); col++)
|
||||
{
|
||||
const QModelIndex index = abstractTableModel->index(row, col);
|
||||
const QString data = abstractTableModel->data(index, role).toString();
|
||||
rowObject.insert(keys[col], QJsonValue::fromVariant(data));
|
||||
}
|
||||
rowsArray.append(rowObject);
|
||||
}
|
||||
loadedSettings.insert(settingsKey, rowsArray);
|
||||
loadedSettings.insert("Version", settingsFileVersion);
|
||||
QJsonDocument doc(loadedSettings);
|
||||
writeJSONToPath(path, doc);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
#include <QtWidgets/QDialog>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "Models/BreakpointModel.h"
|
||||
#include "Models/SavedAddressesModel.h"
|
||||
|
||||
class DebuggerSettingsManager final
|
||||
{
|
||||
public:
|
||||
DebuggerSettingsManager(QWidget* parent = nullptr);
|
||||
~DebuggerSettingsManager();
|
||||
|
||||
static void loadGameSettings(BreakpointModel* bpModel);
|
||||
static void loadGameSettings(SavedAddressesModel* savedAddressesModel);
|
||||
static void saveGameSettings(BreakpointModel* bpModel);
|
||||
static void saveGameSettings(SavedAddressesModel* savedAddressesModel);
|
||||
static void saveGameSettings(QAbstractTableModel* abstractTableModel, QString settingsKey, u32 role);
|
||||
|
||||
private:
|
||||
static std::mutex writeLock;
|
||||
static void writeJSONToPath(std::string path, QJsonDocument jsonDocument);
|
||||
static QJsonObject loadGameSettingsJSON();
|
||||
const static QString settingsFileVersion;
|
||||
};
|
||||
@@ -95,6 +95,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOnTop">
|
||||
<property name="icon">
|
||||
<iconset theme="pin-filled"/>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
||||
@@ -277,9 +277,11 @@ bool MemoryViewTable::KeyPress(int key, QChar keychar)
|
||||
|
||||
if (keyCharIsText)
|
||||
{
|
||||
InsertIntoSelectedHexView(((u8)QString(QChar(key)).toInt(&pressHandled, 16)));
|
||||
// Check if key pressed is hex before insertion (QString conversion fails otherwise)
|
||||
const u8 keyPressed = (u8)QString(QChar(key)).toInt(&pressHandled, 16);
|
||||
if (pressHandled)
|
||||
{
|
||||
InsertIntoSelectedHexView(keyPressed);
|
||||
// Increment to the next nibble or byte
|
||||
if ((selectedNibbleHI = !selectedNibbleHI))
|
||||
UpdateSelectedAddress(selectedAddress + 1);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "DebugTools/DebugInterface.h"
|
||||
#include "DebugTools/Breakpoints.h"
|
||||
#include "DebugTools/DisassemblyManager.h"
|
||||
#include "common/Console.h"
|
||||
|
||||
#include "QtHost.h"
|
||||
#include "QtUtils.h"
|
||||
@@ -226,6 +227,28 @@ QVariant BreakpointModel::headerData(int section, Qt::Orientation orientation, i
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
if (role == Qt::UserRole && orientation == Qt::Horizontal)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case BreakpointColumns::TYPE:
|
||||
return "TYPE";
|
||||
case BreakpointColumns::OFFSET:
|
||||
return "OFFSET";
|
||||
case BreakpointColumns::SIZE_LABEL:
|
||||
return "SIZE / LABEL";
|
||||
case BreakpointColumns::OPCODE:
|
||||
return "INSTRUCTION";
|
||||
case BreakpointColumns::CONDITION:
|
||||
return "CONDITION";
|
||||
case BreakpointColumns::HITS:
|
||||
return "HITS";
|
||||
case BreakpointColumns::ENABLED:
|
||||
return "X";
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -402,3 +425,106 @@ void BreakpointModel::refreshData()
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void BreakpointModel::loadBreakpointFromFieldList(QStringList fields)
|
||||
{
|
||||
bool ok;
|
||||
if (fields.size() != BreakpointModel::BreakpointColumns::COLUMN_COUNT)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Invalid number of columns, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
const int type = fields[BreakpointModel::BreakpointColumns::TYPE].toUInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse type '%s', skipping", fields[BreakpointModel::BreakpointColumns::TYPE].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
// This is how we differentiate between breakpoints and memchecks
|
||||
if (type == MEMCHECK_INVALID)
|
||||
{
|
||||
BreakPoint bp;
|
||||
|
||||
// Address
|
||||
bp.addr = fields[BreakpointModel::BreakpointColumns::OFFSET].toUInt(&ok, 16);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse address '%s', skipping", fields[BreakpointModel::BreakpointColumns::OFFSET].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
// Condition
|
||||
if (!fields[BreakpointModel::BreakpointColumns::CONDITION].isEmpty())
|
||||
{
|
||||
PostfixExpression expr;
|
||||
bp.hasCond = true;
|
||||
bp.cond.debug = &m_cpu;
|
||||
|
||||
if (!m_cpu.initExpression(fields[BreakpointModel::BreakpointColumns::CONDITION].toUtf8().constData(), expr))
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse cond '%s', skipping", fields[BreakpointModel::BreakpointColumns::CONDITION].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
bp.cond.expression = expr;
|
||||
strncpy(&bp.cond.expressionString[0], fields[BreakpointModel::BreakpointColumns::CONDITION].toUtf8().constData(), sizeof(bp.cond.expressionString));
|
||||
}
|
||||
|
||||
// Enabled
|
||||
bp.enabled = fields[BreakpointModel::BreakpointColumns::ENABLED].toUInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse enable flag '%s', skipping", fields[BreakpointModel::BreakpointColumns::ENABLED].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
insertBreakpointRows(0, 1, {bp});
|
||||
}
|
||||
else
|
||||
{
|
||||
MemCheck mc;
|
||||
// Mode
|
||||
if (type >= MEMCHECK_INVALID)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse cond type '%s', skipping", fields[BreakpointModel::BreakpointColumns::TYPE].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
mc.cond = static_cast<MemCheckCondition>(type);
|
||||
|
||||
// Address
|
||||
QString test = fields[BreakpointModel::BreakpointColumns::OFFSET];
|
||||
mc.start = fields[BreakpointModel::BreakpointColumns::OFFSET].toUInt(&ok, 16);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse address '%s', skipping", fields[BreakpointModel::BreakpointColumns::OFFSET].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
// Size
|
||||
mc.end = fields[BreakpointModel::BreakpointColumns::SIZE_LABEL].toUInt(&ok) + mc.start;
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse length '%s', skipping", fields[BreakpointModel::BreakpointColumns::SIZE_LABEL].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
// Result
|
||||
const int result = fields[BreakpointModel::BreakpointColumns::ENABLED].toUInt(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Breakpoint Model: Failed to parse result flag '%s', skipping", fields[BreakpointModel::BreakpointColumns::ENABLED].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
mc.result = static_cast<MemCheckResult>(result);
|
||||
|
||||
insertBreakpointRows(0, 1, {mc});
|
||||
}
|
||||
}
|
||||
|
||||
void BreakpointModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
m_breakpoints.clear();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -55,10 +55,12 @@ public:
|
||||
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
|
||||
bool removeRows(int row, int count, const QModelIndex& index = QModelIndex()) override;
|
||||
bool insertBreakpointRows(int row, int count, std::vector<BreakpointMemcheck> breakpoints, const QModelIndex& index = QModelIndex());
|
||||
void loadBreakpointFromFieldList(QStringList breakpointFields);
|
||||
|
||||
BreakpointMemcheck at(int row) const { return m_breakpoints.at(row); };
|
||||
|
||||
void refreshData();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
DebugInterface& m_cpu;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "SavedAddressesModel.h"
|
||||
|
||||
#include "common/Console.h"
|
||||
|
||||
SavedAddressesModel::SavedAddressesModel(DebugInterface& cpu, QObject* parent)
|
||||
: QAbstractTableModel(parent)
|
||||
, m_cpu(cpu)
|
||||
@@ -96,20 +98,38 @@ bool SavedAddressesModel::setData(const QModelIndex& index, const QVariant& valu
|
||||
|
||||
QVariant SavedAddressesModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if ((role != Qt::DisplayRole && role != Qt::EditRole) || orientation != Qt::Horizontal)
|
||||
if (orientation != Qt::Horizontal)
|
||||
return QVariant();
|
||||
|
||||
switch (section)
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
case SavedAddressesModel::ADDRESS:
|
||||
return tr("MEMORY ADDRESS");
|
||||
case SavedAddressesModel::LABEL:
|
||||
return tr("LABEL");
|
||||
case SavedAddressesModel::DESCRIPTION:
|
||||
return tr("DESCRIPTION");
|
||||
default:
|
||||
return QVariant();
|
||||
switch (section)
|
||||
{
|
||||
case SavedAddressesModel::ADDRESS:
|
||||
return tr("MEMORY ADDRESS");
|
||||
case SavedAddressesModel::LABEL:
|
||||
return tr("LABEL");
|
||||
case SavedAddressesModel::DESCRIPTION:
|
||||
return tr("DESCRIPTION");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
if (role == Qt::UserRole)
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case SavedAddressesModel::ADDRESS:
|
||||
return "MEMORY ADDRESS";
|
||||
case SavedAddressesModel::LABEL:
|
||||
return "LABEL";
|
||||
case SavedAddressesModel::DESCRIPTION:
|
||||
return "DESCRIPTION";
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags SavedAddressesModel::flags(const QModelIndex& index) const
|
||||
@@ -119,7 +139,7 @@ Qt::ItemFlags SavedAddressesModel::flags(const QModelIndex& index) const
|
||||
|
||||
void SavedAddressesModel::addRow()
|
||||
{
|
||||
const SavedAddress defaultNewAddress = {NULL, "Name", "Description"};
|
||||
const SavedAddress defaultNewAddress = {0, "Name", "Description"};
|
||||
addRow(defaultNewAddress);
|
||||
}
|
||||
|
||||
@@ -133,7 +153,7 @@ void SavedAddressesModel::addRow(SavedAddress addresstoSave)
|
||||
|
||||
bool SavedAddressesModel::removeRows(int row, int count, const QModelIndex& parent)
|
||||
{
|
||||
if (row + count > m_savedAddresses.size() || row < 0 || count < 1)
|
||||
if (row < 0 || count < 1 || static_cast<size_t>(row + count) > m_savedAddresses.size())
|
||||
return false;
|
||||
beginRemoveRows(parent, row, row + count - 1);
|
||||
m_savedAddresses.erase(m_savedAddresses.begin() + row, m_savedAddresses.begin() + row + count);
|
||||
@@ -150,3 +170,32 @@ int SavedAddressesModel::columnCount(const QModelIndex&) const
|
||||
{
|
||||
return HeaderColumns::COLUMN_COUNT;
|
||||
}
|
||||
|
||||
void SavedAddressesModel::loadSavedAddressFromFieldList(QStringList fields)
|
||||
{
|
||||
if (fields.size() != SavedAddressesModel::HeaderColumns::COLUMN_COUNT)
|
||||
{
|
||||
Console.WriteLn("Debugger Saved Addresses Model: Invalid number of columns, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
const u32 address = fields[SavedAddressesModel::HeaderColumns::ADDRESS].toUInt(&ok, 16);
|
||||
if (!ok)
|
||||
{
|
||||
Console.WriteLn("Debugger Saved Addresses Model: Failed to parse address '%s', skipping", fields[SavedAddressesModel::HeaderColumns::ADDRESS].toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
|
||||
const QString label = fields[SavedAddressesModel::HeaderColumns::LABEL];
|
||||
const QString description = fields[SavedAddressesModel::HeaderColumns::DESCRIPTION];
|
||||
const SavedAddressesModel::SavedAddress importedAddress = {address, label, description};
|
||||
addRow(importedAddress);
|
||||
}
|
||||
|
||||
void SavedAddressesModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
m_savedAddresses.clear();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
QString description;
|
||||
};
|
||||
|
||||
enum HeaderColumns : int
|
||||
enum HeaderColumns: int
|
||||
{
|
||||
ADDRESS = 0,
|
||||
LABEL,
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
void addRow(SavedAddress addresstoSave);
|
||||
bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
bool setData(const QModelIndex& index, const QVariant& value, int role) override;
|
||||
void loadSavedAddressFromFieldList(QStringList fields);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
DebugInterface& m_cpu;
|
||||
|
||||
@@ -202,6 +202,19 @@ void RegisterWidget::wheelEvent(QWheelEvent* event)
|
||||
this->repaint();
|
||||
}
|
||||
|
||||
void RegisterWidget::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if (!m_cpu->isAlive())
|
||||
return;
|
||||
if (m_selectedRow > m_rowEnd) // Unsigned underflow; selectedRow will be > m_rowEnd (technically negative)
|
||||
return;
|
||||
const int categoryIndex = ui.registerTabs->currentIndex();
|
||||
if (m_cpu->getRegisterSize(categoryIndex) == 128)
|
||||
contextChangeSegment();
|
||||
else
|
||||
contextChangeValue();
|
||||
}
|
||||
|
||||
void RegisterWidget::customMenuRequested(QPoint pos)
|
||||
{
|
||||
if (!m_cpu->isAlive())
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
void wheelEvent(QWheelEvent* event);
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "QtHost.h"
|
||||
#include "QtUtils.h"
|
||||
|
||||
#include "pcsx2/ImGui/FullscreenUI.h"
|
||||
#include "pcsx2/ImGui/ImGuiManager.h"
|
||||
|
||||
#include "common/Assertions.h"
|
||||
@@ -323,8 +324,9 @@ bool DisplayWidget::event(QEvent* event)
|
||||
// don't toggle fullscreen when we're bound.. that wouldn't end well.
|
||||
if (event->type() == QEvent::MouseButtonDblClick &&
|
||||
static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton &&
|
||||
QtHost::IsVMValid() && !QtHost::IsVMPaused() &&
|
||||
!InputManager::HasAnyBindingsForKey(InputManager::MakePointerButtonKey(0, 0)) &&
|
||||
QtHost::IsVMValid() && !FullscreenUI::HasActiveWindow() &&
|
||||
((!QtHost::IsVMPaused() && !InputManager::HasAnyBindingsForKey(InputManager::MakePointerButtonKey(0, 0))) ||
|
||||
(QtHost::IsVMPaused() && !ImGuiManager::WantsMouseInput())) &&
|
||||
Host::GetBoolSettingValue("UI", "DoubleClickTogglesFullscreen", true))
|
||||
{
|
||||
g_emu_thread->toggleFullscreen();
|
||||
|
||||
@@ -29,6 +29,7 @@ static const char* SUPPORTED_FORMATS_STRING = QT_TRANSLATE_NOOP(GameListWidget,
|
||||
".mdf (Media Descriptor File)\n"
|
||||
".chd (Compressed Hunks of Data)\n"
|
||||
".cso (Compressed ISO)\n"
|
||||
".zso (Compressed ISO)\n"
|
||||
".gz (Gzip Compressed ISO)");
|
||||
|
||||
static constexpr float MIN_SCALE = 0.1f;
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "LogWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QtHost.h"
|
||||
#include "SettingWidgetBinder.h"
|
||||
|
||||
#include <QtCore/QLatin1StringView>
|
||||
#include <QtCore/QUtf8StringView>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
#include <QtWidgets/QScrollBar>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
// Need a lock so the other threads don't try to write to a deleting window.
|
||||
LogWindow* g_log_window;
|
||||
static std::mutex s_log_mutex;
|
||||
|
||||
static LOGLEVEL GetWindowLogLevel()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
return LOGLEVEL_DEBUG;
|
||||
#else
|
||||
return (IsDevBuild || Host::GetBaseBoolSettingValue("Logging", "EnableVerbose", false)) ? LOGLEVEL_DEV : LOGLEVEL_INFO;
|
||||
#endif
|
||||
}
|
||||
|
||||
LogWindow::LogWindow(bool attach_to_main)
|
||||
: QMainWindow()
|
||||
, m_attached_to_main_window(attach_to_main)
|
||||
{
|
||||
restoreSize();
|
||||
createUi();
|
||||
|
||||
Log::SetHostOutputLevel(GetWindowLogLevel(), &LogWindow::logCallback);
|
||||
}
|
||||
|
||||
LogWindow::~LogWindow()
|
||||
{
|
||||
Log::SetHostOutputLevel(LOGLEVEL_NONE, nullptr);
|
||||
}
|
||||
|
||||
void LogWindow::updateSettings()
|
||||
{
|
||||
std::unique_lock lock(s_log_mutex);
|
||||
|
||||
const bool new_enabled = Host::GetBaseBoolSettingValue("Logging", "EnableLogWindow", false) && !QtHost::InNoGUIMode();
|
||||
const bool attach_to_main = Host::GetBaseBoolSettingValue("Logging", "AttachLogWindowToMainWindow", true);
|
||||
const bool curr_enabled = Log::IsHostOutputEnabled();
|
||||
|
||||
if (new_enabled == curr_enabled)
|
||||
{
|
||||
if (g_log_window && g_log_window->m_attached_to_main_window != attach_to_main)
|
||||
{
|
||||
g_log_window->m_attached_to_main_window = attach_to_main;
|
||||
if (attach_to_main)
|
||||
g_log_window->reattachToMainWindow();
|
||||
}
|
||||
|
||||
// Update level.
|
||||
if (new_enabled)
|
||||
Log::SetHostOutputLevel(GetWindowLogLevel(), &LogWindow::logCallback);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (new_enabled)
|
||||
{
|
||||
g_log_window = new LogWindow(attach_to_main);
|
||||
if (attach_to_main && g_main_window && g_main_window->isVisible())
|
||||
g_log_window->reattachToMainWindow();
|
||||
|
||||
g_log_window->show();
|
||||
}
|
||||
else if (g_log_window)
|
||||
{
|
||||
g_log_window->m_destroying = true;
|
||||
g_log_window->close();
|
||||
g_log_window->deleteLater();
|
||||
g_log_window = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void LogWindow::destroy()
|
||||
{
|
||||
std::unique_lock lock(s_log_mutex);
|
||||
if (!g_log_window)
|
||||
return;
|
||||
|
||||
g_log_window->m_destroying = true;
|
||||
g_log_window->close();
|
||||
g_log_window->deleteLater();
|
||||
g_log_window = nullptr;
|
||||
}
|
||||
|
||||
void LogWindow::reattachToMainWindow()
|
||||
{
|
||||
// Skip when maximized.
|
||||
if (g_main_window->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen))
|
||||
return;
|
||||
|
||||
resize(width(), g_main_window->height());
|
||||
|
||||
const QPoint new_pos = g_main_window->pos() + QPoint(g_main_window->width() + 10, 0);
|
||||
if (pos() != new_pos)
|
||||
move(new_pos);
|
||||
}
|
||||
|
||||
void LogWindow::updateWindowTitle()
|
||||
{
|
||||
QString title;
|
||||
|
||||
const QString& serial = QtHost::GetCurrentGameSerial();
|
||||
|
||||
if (QtHost::IsVMValid() && !serial.isEmpty())
|
||||
{
|
||||
const QFileInfo fi(QtHost::GetCurrentGamePath());
|
||||
title = tr("Log Window - %1 [%2]").arg(serial).arg(fi.fileName());
|
||||
}
|
||||
else
|
||||
{
|
||||
title = tr("Log Window");
|
||||
}
|
||||
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
void LogWindow::createUi()
|
||||
{
|
||||
setWindowIcon(QtHost::GetAppIcon());
|
||||
updateWindowTitle();
|
||||
|
||||
QAction* action;
|
||||
|
||||
QMenuBar* menu = new QMenuBar(this);
|
||||
setMenuBar(menu);
|
||||
|
||||
QMenu* log_menu = menu->addMenu("&Log");
|
||||
action = log_menu->addAction(tr("&Clear"));
|
||||
connect(action, &QAction::triggered, this, &LogWindow::onClearTriggered);
|
||||
action = log_menu->addAction(tr("&Save..."));
|
||||
connect(action, &QAction::triggered, this, &LogWindow::onSaveTriggered);
|
||||
|
||||
log_menu->addSeparator();
|
||||
|
||||
action = log_menu->addAction(tr("Cl&ose"));
|
||||
connect(action, &QAction::triggered, this, &LogWindow::close);
|
||||
|
||||
QMenu* settings_menu = menu->addMenu(tr("&Settings"));
|
||||
|
||||
#if 0
|
||||
// TODO: These are duplicated with the main window...
|
||||
action = settings_menu->addAction(tr("Log To &System Console"));
|
||||
action->setCheckable(true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, action, "Logging", "EnableSystemConsole", false);
|
||||
|
||||
action = settings_menu->addAction(tr("Log To &Debug Console"));
|
||||
action->setCheckable(true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, action, "Logging", "EnableDebugConsole", false);
|
||||
|
||||
action = settings_menu->addAction(tr("Log To &File"));
|
||||
action->setCheckable(true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, action, "Logging", "EnableFileLogging", false);
|
||||
|
||||
settings_menu->addSeparator();
|
||||
#endif
|
||||
|
||||
action = settings_menu->addAction(tr("Attach To &Main Window"));
|
||||
action->setCheckable(true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, action, "Logging", "AttachLogWindowToMainWindow", true);
|
||||
|
||||
action = settings_menu->addAction(tr("Show &Timestamps"));
|
||||
action->setCheckable(true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, action, "Logging", "EnableTimestamps", true);
|
||||
|
||||
settings_menu->addSeparator();
|
||||
|
||||
// TODO: Log Level
|
||||
|
||||
m_text = new QPlainTextEdit(this);
|
||||
m_text->setReadOnly(true);
|
||||
m_text->setUndoRedoEnabled(false);
|
||||
m_text->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
|
||||
m_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
m_text->setWordWrapMode(QTextOption::WrapAnywhere);
|
||||
|
||||
#if defined(_WIN32)
|
||||
QFont font("Consolas");
|
||||
font.setPointSize(10);
|
||||
#elif defined(__APPLE__)
|
||||
QFont font("Monaco");
|
||||
font.setPointSize(11);
|
||||
#else
|
||||
QFont font("Monospace");
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
#endif
|
||||
m_text->setFont(font);
|
||||
|
||||
setCentralWidget(m_text);
|
||||
}
|
||||
|
||||
void LogWindow::onClearTriggered()
|
||||
{
|
||||
m_text->clear();
|
||||
}
|
||||
|
||||
void LogWindow::onSaveTriggered()
|
||||
{
|
||||
const QString path = QFileDialog::getSaveFileName(this, tr("Select Log File"), QString(), tr("Log Files (*.txt)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
QFile file(path);
|
||||
if (!file.open(QFile::WriteOnly | QFile::Text))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to open file for writing."));
|
||||
return;
|
||||
}
|
||||
|
||||
file.write(m_text->toPlainText().toUtf8());
|
||||
file.close();
|
||||
|
||||
appendMessage(LOGLEVEL_INFO, Color_Default, tr("Log was written to %1.\n").arg(path));
|
||||
}
|
||||
|
||||
void LogWindow::logCallback(LOGLEVEL level, ConsoleColors color, std::string_view message)
|
||||
{
|
||||
std::unique_lock lock(s_log_mutex);
|
||||
if (!g_log_window)
|
||||
return;
|
||||
|
||||
// I don't like the memory allocations here either...
|
||||
QString qmessage;
|
||||
qmessage.reserve(message.length() + 1);
|
||||
qmessage.append(QUtf8StringView(message.data(), message.length()));
|
||||
qmessage.append(QChar('\n'));
|
||||
|
||||
if (g_emu_thread->isOnUIThread())
|
||||
{
|
||||
g_log_window->appendMessage(static_cast<u32>(level), static_cast<u32>(color), qmessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMetaObject::invokeMethod(g_log_window, "appendMessage", Qt::QueuedConnection,
|
||||
Q_ARG(quint32, static_cast<u32>(level)), Q_ARG(quint32, static_cast<u32>(color)),
|
||||
Q_ARG(const QString&, qmessage));
|
||||
}
|
||||
}
|
||||
|
||||
void LogWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
Log::SetHostOutputLevel(LOGLEVEL_NONE, nullptr);
|
||||
|
||||
// Save size when actually closing, disable ourselves if the user closed us.
|
||||
if (m_destroying)
|
||||
{
|
||||
saveSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
Host::SetBaseBoolSettingValue("Logging", "EnableLogWindow", false);
|
||||
Host::CommitBaseSettingChanges();
|
||||
}
|
||||
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void LogWindow::appendMessage(quint32 level, quint32 color, const QString& message)
|
||||
{
|
||||
QTextCursor temp_cursor = m_text->textCursor();
|
||||
QScrollBar* scrollbar = m_text->verticalScrollBar();
|
||||
const bool cursor_at_end = temp_cursor.atEnd();
|
||||
const bool scroll_at_end = scrollbar->sliderPosition() == scrollbar->maximum();
|
||||
|
||||
temp_cursor.movePosition(QTextCursor::End);
|
||||
|
||||
{
|
||||
static constexpr const QColor qcolors[2][ConsoleColors_Count] = {
|
||||
// Light theme
|
||||
{
|
||||
QColor(0, 0, 0), // Color_Default
|
||||
QColor(0, 0, 0), // Color_Black
|
||||
QColor(128, 0, 0), // Color_Red
|
||||
QColor(0, 128, 0), // Color_Green
|
||||
QColor(0, 0, 128), // Color_Blue
|
||||
QColor(160, 0, 160), // Color_Magenta
|
||||
QColor(160, 120, 0), // Color_Orange
|
||||
QColor(108, 108, 108), // Color_Gray
|
||||
|
||||
QColor(128, 180, 180), // Color_Cyan
|
||||
QColor(180, 180, 128), // Color_Yellow
|
||||
QColor(160, 160, 160), // Color_White
|
||||
|
||||
QColor(0, 0, 0), // Color_StrongBlack
|
||||
QColor(128, 0, 0), // Color_StrongRed
|
||||
QColor(0, 128, 0), // Color_StrongGreen
|
||||
QColor(0, 0, 128), // Color_StrongBlue
|
||||
QColor(160, 0, 160), // Color_StrongMagenta
|
||||
QColor(160, 120, 0), // Color_StrongOrange
|
||||
QColor(108, 108, 108), // Color_StrongGray
|
||||
|
||||
QColor(128, 180, 180), // Color_StrongCyan
|
||||
QColor(180, 180, 128), // Color_StrongYellow
|
||||
QColor(160, 160, 160), // Color_StrongWhite
|
||||
},
|
||||
// Dark theme
|
||||
{
|
||||
QColor(208, 208, 208), // Color_Default
|
||||
QColor(255, 255, 255), // Color_Black
|
||||
QColor(180, 0, 0), // Color_Red
|
||||
QColor(0, 160, 0), // Color_Green
|
||||
QColor(32, 32, 204), // Color_Blue
|
||||
QColor(160, 0, 160), // Color_Magenta
|
||||
QColor(160, 120, 0), // Color_Orange
|
||||
QColor(128, 128, 128), // Color_Gray
|
||||
QColor(128, 180, 180), // Color_Cyan
|
||||
QColor(180, 180, 128), // Color_Yellow
|
||||
QColor(160, 160, 160), // Color_White
|
||||
QColor(255, 255, 255), // Color_StrongBlack
|
||||
QColor(180, 0, 0), // Color_StrongRed
|
||||
QColor(0, 160, 0), // Color_StrongGreen
|
||||
QColor(32, 32, 204), // Color_StrongBlue
|
||||
QColor(160, 0, 160), // Color_StrongMagenta
|
||||
QColor(160, 120, 0), // Color_StrongOrange
|
||||
QColor(128, 128, 128), // Color_StrongGray
|
||||
QColor(128, 180, 180), // Color_StrongCyan
|
||||
QColor(180, 180, 128), // Color_StrongYellow
|
||||
QColor(160, 160, 160), // Color_StrongWhite
|
||||
},
|
||||
};
|
||||
|
||||
static constexpr const QColor timestamp_color = QColor(0xcc, 0xcc, 0xcc);
|
||||
|
||||
QTextCharFormat format = temp_cursor.charFormat();
|
||||
|
||||
if (Log::AreTimestampsEnabled())
|
||||
{
|
||||
const float message_time = Log::GetCurrentMessageTime();
|
||||
const QString qtimestamp = QStringLiteral("[%1] ").arg(message_time, 10, 'f', 4);
|
||||
format.setForeground(QBrush(timestamp_color));
|
||||
temp_cursor.setCharFormat(format);
|
||||
temp_cursor.insertText(qtimestamp);
|
||||
}
|
||||
|
||||
const bool dark = static_cast<u32>(QtHost::IsDarkApplicationTheme());
|
||||
|
||||
// message has \n already
|
||||
format.setForeground(QBrush(qcolors[static_cast<u32>(dark)][color]));
|
||||
temp_cursor.setCharFormat(format);
|
||||
temp_cursor.insertText(message);
|
||||
}
|
||||
|
||||
if (cursor_at_end)
|
||||
{
|
||||
if (scroll_at_end)
|
||||
{
|
||||
m_text->setTextCursor(temp_cursor);
|
||||
scrollbar->setSliderPosition(scrollbar->maximum());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can't let changing the cursor affect the scroll bar...
|
||||
const int pos = scrollbar->sliderPosition();
|
||||
m_text->setTextCursor(temp_cursor);
|
||||
scrollbar->setSliderPosition(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogWindow::saveSize()
|
||||
{
|
||||
const int current_width = Host::GetBaseIntSettingValue("UI", "LogWindowWidth", DEFAULT_WIDTH);
|
||||
const int current_height = Host::GetBaseIntSettingValue("UI", "LogWindowHeight", DEFAULT_HEIGHT);
|
||||
const QSize wsize = size();
|
||||
|
||||
bool changed = false;
|
||||
if (current_width != wsize.width())
|
||||
{
|
||||
Host::SetBaseIntSettingValue("UI", "LogWindowWidth", wsize.width());
|
||||
changed = true;
|
||||
}
|
||||
if (current_height != wsize.height())
|
||||
{
|
||||
Host::SetBaseIntSettingValue("UI", "LogWindowHeight", wsize.height());
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
Host::CommitBaseSettingChanges();
|
||||
}
|
||||
|
||||
void LogWindow::restoreSize()
|
||||
{
|
||||
const int width = Host::GetBaseIntSettingValue("UI", "LogWindowWidth", DEFAULT_WIDTH);
|
||||
const int height = Host::GetBaseIntSettingValue("UI", "LogWindowHeight", DEFAULT_HEIGHT);
|
||||
resize(width, height);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/Console.h"
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtWidgets/QPlainTextEdit>
|
||||
|
||||
class LogWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LogWindow(bool attach_to_main);
|
||||
~LogWindow();
|
||||
|
||||
static void updateSettings();
|
||||
static void destroy();
|
||||
|
||||
__fi bool isAttachedToMainWindow() const { return m_attached_to_main_window; }
|
||||
void reattachToMainWindow();
|
||||
|
||||
void updateWindowTitle();
|
||||
|
||||
private:
|
||||
void createUi();
|
||||
|
||||
static void logCallback(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onClearTriggered();
|
||||
void onSaveTriggered();
|
||||
void appendMessage(quint32 level, quint32 color, const QString& message);
|
||||
|
||||
private:
|
||||
static constexpr int DEFAULT_WIDTH = 750;
|
||||
static constexpr int DEFAULT_HEIGHT = 400;
|
||||
|
||||
void saveSize();
|
||||
void restoreSize();
|
||||
|
||||
QPlainTextEdit* m_text;
|
||||
QMenu* m_level_menu;
|
||||
|
||||
bool m_attached_to_main_window = true;
|
||||
bool m_destroying = false;
|
||||
};
|
||||
|
||||
extern LogWindow* g_log_window;
|
||||
+146
-44
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "AboutDialog.h"
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "DisplayWidget.h"
|
||||
#include "GameList/GameListRefreshThread.h"
|
||||
#include "GameList/GameListWidget.h"
|
||||
#include "LogWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QtHost.h"
|
||||
#include "QtUtils.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include "Settings/ControllerSettingsWindow.h"
|
||||
#include "Settings/GameListSettingsWidget.h"
|
||||
#include "Settings/InterfaceSettingsWidget.h"
|
||||
#include "Settings/MemoryCardCreateDialog.h"
|
||||
#include "Tools/InputRecording/InputRecordingViewer.h"
|
||||
#include "Tools/InputRecording/NewInputRecordingDlg.h"
|
||||
#include "svnrev.h"
|
||||
@@ -27,7 +29,6 @@
|
||||
#include "pcsx2/GSDumpReplayer.h"
|
||||
#include "pcsx2/GameList.h"
|
||||
#include "pcsx2/Host.h"
|
||||
#include "pcsx2/LogSink.h"
|
||||
#include "pcsx2/MTGS.h"
|
||||
#include "pcsx2/PerformanceMetrics.h"
|
||||
#include "pcsx2/Recording/InputRecording.h"
|
||||
@@ -91,6 +92,12 @@ static bool s_use_central_widget = false;
|
||||
// UI thread VM validity.
|
||||
static bool s_vm_valid = false;
|
||||
static bool s_vm_paused = false;
|
||||
static QString s_current_title;
|
||||
static QString s_current_elf_override;
|
||||
static QString s_current_disc_path;
|
||||
static QString s_current_disc_serial;
|
||||
static quint32 s_current_disc_crc;
|
||||
static quint32 s_current_running_crc;
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
@@ -172,11 +179,8 @@ QWidget* MainWindow::getContentParent()
|
||||
|
||||
void MainWindow::setupAdditionalUi()
|
||||
{
|
||||
const bool show_advanced_settings = QtHost::ShouldShowAdvancedSettings();
|
||||
|
||||
makeIconsMasks(menuBar());
|
||||
|
||||
m_ui.menuDebug->menuAction()->setVisible(show_advanced_settings);
|
||||
updateAdvancedSettingsVisibility();
|
||||
|
||||
const bool toolbar_visible = Host::GetBaseBoolSettingValue("UI", "ShowToolbar", false);
|
||||
m_ui.actionViewToolbar->setChecked(toolbar_visible);
|
||||
@@ -250,7 +254,7 @@ void MainWindow::setupAdditionalUi()
|
||||
#ifdef ENABLE_RAINTEGRATION
|
||||
if (Achievements::IsUsingRAIntegration())
|
||||
{
|
||||
QMenu* raMenu = new QMenu(QStringLiteral("RAIntegration"), m_ui.menu_Tools);
|
||||
QMenu* raMenu = new QMenu(QStringLiteral("RAIntegration"), m_ui.menuTools);
|
||||
connect(raMenu, &QMenu::aboutToShow, this, [this, raMenu]() {
|
||||
raMenu->clear();
|
||||
|
||||
@@ -274,7 +278,7 @@ void MainWindow::setupAdditionalUi()
|
||||
[id = id]() { Host::RunOnCPUThread([id]() { Achievements::RAIntegration::ActivateMenuItem(id); }, false); });
|
||||
}
|
||||
});
|
||||
m_ui.menu_Tools->insertMenu(m_ui.menuInput_Recording->menuAction(), raMenu);
|
||||
m_ui.menuTools->insertMenu(m_ui.menuInputRecording->menuAction(), raMenu);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -361,6 +365,18 @@ void MainWindow::connectSignals()
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionViewStatusBarVerbose, "UI", "VerboseStatusBar", false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableSystemConsole, "Logging", "EnableSystemConsole", false);
|
||||
|
||||
if (Log::IsDebugOutputAvailable())
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableDebugConsole, "Logging", "EnableDebugConsole", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui.menuTools->removeAction(m_ui.actionEnableDebugConsole);
|
||||
m_ui.actionEnableDebugConsole->deleteLater();
|
||||
m_ui.actionEnableDebugConsole = nullptr;
|
||||
}
|
||||
|
||||
#ifndef PCSX2_DEVBUILD
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableVerboseLogging, "Logging", "EnableVerbose", false);
|
||||
#else
|
||||
@@ -370,6 +386,7 @@ void MainWindow::connectSignals()
|
||||
#endif
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableEEConsoleLogging, "Logging", "EnableEEConsole", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableIOPConsoleLogging, "Logging", "EnableIOPConsole", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableLogWindow, "Logging", "EnableLogWindow", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableFileLogging, "Logging", "EnableFileLogging", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableLogTimestamps, "Logging", "EnableTimestamps", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableCDVDVerboseReads, "EmuCore", "CdvdVerboseReads", false);
|
||||
@@ -423,6 +440,7 @@ void MainWindow::connectVMThreadSignals(EmuThread* thread)
|
||||
connect(thread, &EmuThread::onAchievementsLoginSucceeded, this, &MainWindow::onAchievementsLoginSucceeded);
|
||||
connect(thread, &EmuThread::onAchievementsHardcoreModeChanged, this, &MainWindow::onAchievementsHardcoreModeChanged);
|
||||
connect(thread, &EmuThread::onCoverDownloaderOpenRequested, this, &MainWindow::onToolsCoverDownloaderTriggered);
|
||||
connect(thread, &EmuThread::onCreateMemoryCardOpenRequested, this, &MainWindow::onCreateMemoryCardOpenRequested);
|
||||
|
||||
connect(m_ui.actionReset, &QAction::triggered, this, &MainWindow::requestReset);
|
||||
connect(m_ui.actionPause, &QAction::toggled, thread, &EmuThread::setVMPaused);
|
||||
@@ -503,6 +521,11 @@ void MainWindow::recreate()
|
||||
new_main_window->show();
|
||||
deleteLater();
|
||||
|
||||
// Recreate log window as well. Then make sure we're still on top.
|
||||
LogWindow::updateSettings();
|
||||
new_main_window->raise();
|
||||
new_main_window->activateWindow();
|
||||
|
||||
// Reload the sources we just closed.
|
||||
g_emu_thread->reloadInputSources();
|
||||
|
||||
@@ -574,6 +597,8 @@ void MainWindow::destroySubWindows()
|
||||
}
|
||||
|
||||
SettingsWindow::closeGamePropertiesDialogs();
|
||||
|
||||
LogWindow::destroy();
|
||||
}
|
||||
|
||||
void MainWindow::onScreenshotActionTriggered()
|
||||
@@ -591,13 +616,13 @@ void MainWindow::onBlockDumpActionToggled(bool checked)
|
||||
if (!checked)
|
||||
return;
|
||||
|
||||
std::string old_directory(Host::GetBaseStringSettingValue("EmuCore", "BlockDumpSaveDirectory", ""));
|
||||
std::string old_directory = Host::GetBaseStringSettingValue("EmuCore", "BlockDumpSaveDirectory", "");
|
||||
if (old_directory.empty())
|
||||
old_directory = FileSystem::GetWorkingDirectory();
|
||||
|
||||
// prompt for a location to save
|
||||
const QString new_dir(
|
||||
QFileDialog::getExistingDirectory(this, tr("Select location to save block dump:"), QString::fromStdString(old_directory)));
|
||||
const QString new_dir(QDir::toNativeSeparators(
|
||||
QFileDialog::getExistingDirectory(this, tr("Select location to save block dump:"), QString::fromStdString(old_directory))));
|
||||
if (new_dir.isEmpty())
|
||||
{
|
||||
// disable it again
|
||||
@@ -647,13 +672,25 @@ void MainWindow::onShowAdvancedSettingsToggled(bool checked)
|
||||
Host::SetBaseBoolSettingValue("UI", "ShowAdvancedSettings", checked);
|
||||
Host::CommitBaseSettingChanges();
|
||||
|
||||
m_ui.menuDebug->menuAction()->setVisible(checked);
|
||||
updateAdvancedSettingsVisibility();
|
||||
|
||||
// just recreate the entire settings window, it's easier.
|
||||
if (m_settings_window)
|
||||
recreateSettings();
|
||||
}
|
||||
|
||||
void MainWindow::updateAdvancedSettingsVisibility()
|
||||
{
|
||||
const bool enabled = QtHost::ShouldShowAdvancedSettings();
|
||||
|
||||
m_ui.menuDebug->menuAction()->setVisible(enabled);
|
||||
|
||||
m_ui.actionEnableSystemConsole->setVisible(enabled);
|
||||
if (m_ui.actionEnableDebugConsole)
|
||||
m_ui.actionEnableDebugConsole->setVisible(enabled);
|
||||
m_ui.actionEnableVerboseLogging->setVisible(enabled);
|
||||
}
|
||||
|
||||
void MainWindow::onToolsVideoCaptureToggled(bool checked)
|
||||
{
|
||||
if (!s_vm_valid)
|
||||
@@ -899,9 +936,9 @@ void MainWindow::updateWindowTitle()
|
||||
{
|
||||
QString suffix(QtHost::GetAppConfigSuffix());
|
||||
QString main_title(QtHost::GetAppNameAndVersion() + suffix);
|
||||
QString display_title(m_current_title + suffix);
|
||||
QString display_title(s_current_title + suffix);
|
||||
|
||||
if (!s_vm_valid || m_current_title.isEmpty())
|
||||
if (!s_vm_valid || s_current_title.isEmpty())
|
||||
display_title = main_title;
|
||||
else if (isRenderingToMain())
|
||||
main_title = display_title;
|
||||
@@ -915,6 +952,9 @@ void MainWindow::updateWindowTitle()
|
||||
if (container->windowTitle() != display_title)
|
||||
container->setWindowTitle(display_title);
|
||||
}
|
||||
|
||||
if (g_log_window)
|
||||
g_log_window->updateWindowTitle();
|
||||
}
|
||||
|
||||
void MainWindow::updateWindowState(bool force_visible)
|
||||
@@ -1006,10 +1046,10 @@ bool MainWindow::shouldAbortForMemcardBusy(const VMLock& lock)
|
||||
{
|
||||
if (MemcardBusy::IsBusy() && !GSDumpReplayer::IsReplayingDump())
|
||||
{
|
||||
const QMessageBox::StandardButton res = QMessageBox::question(
|
||||
const QMessageBox::StandardButton res = QMessageBox::critical(
|
||||
lock.getDialogParent(),
|
||||
tr("WARNING: Memory Card Busy"),
|
||||
tr("WARNING: Your memory card is still writing data. Shutting down now will IRREVERSIBLY DESTROY YOUR MEMORY CARD. It is strongly recommended to resume your game and let it finish writing to your memory card.\n\nDo you wish to shutdown anyways and IRREVERSIBLY DESTROY YOUR MEMORY CARD?"));
|
||||
tr("WARNING: Your memory card is still writing data. Shutting down now <b>WILL IRREVERSIBLY DESTROY YOUR MEMORY CARD.</b> It is strongly recommended to resume your game and let it finish writing to your memory card.<br><br>Do you wish to shutdown anyways and <b>IRREVERSIBLY DESTROY YOUR MEMORY CARD?</b>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
|
||||
if (res != QMessageBox::Yes)
|
||||
{
|
||||
@@ -1109,7 +1149,7 @@ bool MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, b
|
||||
return true;
|
||||
|
||||
// If we don't have a crc, we can't save state.
|
||||
allow_save_to_state &= (m_current_disc_crc != 0);
|
||||
allow_save_to_state &= (s_current_disc_crc != 0);
|
||||
bool save_state = allow_save_to_state && default_save_to_state;
|
||||
VMLock lock(pauseAndLockVM());
|
||||
|
||||
@@ -1187,6 +1227,8 @@ void MainWindow::checkForSettingChanges()
|
||||
updateDisplayWidgetCursor();
|
||||
|
||||
updateWindowState();
|
||||
|
||||
LogWindow::updateSettings();
|
||||
}
|
||||
|
||||
std::optional<WindowInfo> MainWindow::getWindowInfo()
|
||||
@@ -1276,11 +1318,10 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
|
||||
});
|
||||
}
|
||||
|
||||
//: Refers to the directory where a game is contained.
|
||||
action = menu.addAction(tr("Open Containing Directory..."));
|
||||
action = menu.addAction(QtUtils::GetShowInFileExplorerMessage());
|
||||
connect(action, &QAction::triggered, [this, entry]() {
|
||||
const QFileInfo fi(QString::fromStdString(entry->path));
|
||||
QtUtils::OpenURL(this, QUrl::fromLocalFile(fi.absolutePath()));
|
||||
QtUtils::ShowInFileExplorer(this, fi);
|
||||
});
|
||||
|
||||
action = menu.addAction(tr("Set Cover Image..."));
|
||||
@@ -1408,13 +1449,13 @@ void MainWindow::onChangeDiscMenuAboutToHide()
|
||||
void MainWindow::onLoadStateMenuAboutToShow()
|
||||
{
|
||||
m_ui.menuLoadState->clear();
|
||||
populateLoadStateMenu(m_ui.menuLoadState, m_current_disc_path, m_current_disc_serial, m_current_disc_crc);
|
||||
populateLoadStateMenu(m_ui.menuLoadState, s_current_disc_path, s_current_disc_serial, s_current_disc_crc);
|
||||
}
|
||||
|
||||
void MainWindow::onSaveStateMenuAboutToShow()
|
||||
{
|
||||
m_ui.menuSaveState->clear();
|
||||
populateSaveStateMenu(m_ui.menuSaveState, m_current_disc_serial, m_current_disc_crc);
|
||||
populateSaveStateMenu(m_ui.menuSaveState, s_current_disc_serial, s_current_disc_crc);
|
||||
}
|
||||
|
||||
void MainWindow::onStartFullscreenUITriggered()
|
||||
@@ -1476,36 +1517,36 @@ void MainWindow::onViewGamePropertiesActionTriggered()
|
||||
return;
|
||||
|
||||
// prefer to use a game list entry, if we have one, that way the summary is populated
|
||||
if (!m_current_disc_path.isEmpty() || !m_current_elf_override.isEmpty())
|
||||
if (!s_current_disc_path.isEmpty() || !s_current_elf_override.isEmpty())
|
||||
{
|
||||
auto lock = GameList::GetLock();
|
||||
const QString& path = (m_current_elf_override.isEmpty() ? m_current_disc_path : m_current_elf_override);
|
||||
const QString& path = (s_current_elf_override.isEmpty() ? s_current_disc_path : s_current_elf_override);
|
||||
const GameList::Entry* entry = GameList::GetEntryForPath(path.toUtf8().constData());
|
||||
if (entry)
|
||||
{
|
||||
SettingsWindow::openGamePropertiesDialog(
|
||||
entry, entry->title, m_current_elf_override.isEmpty() ? entry->serial : std::string(), entry->crc);
|
||||
entry, entry->title, s_current_elf_override.isEmpty() ? entry->serial : std::string(), entry->crc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// open properties for the current running file (isn't in the game list)
|
||||
if (m_current_disc_crc == 0)
|
||||
if (s_current_disc_crc == 0)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Game Properties"), tr("Game properties is unavailable for the current game."));
|
||||
return;
|
||||
}
|
||||
|
||||
// can't use serial for ELFs, because they might have a disc set
|
||||
if (m_current_elf_override.isEmpty())
|
||||
if (s_current_elf_override.isEmpty())
|
||||
{
|
||||
SettingsWindow::openGamePropertiesDialog(
|
||||
nullptr, m_current_title.toStdString(), m_current_disc_serial.toStdString(), m_current_disc_crc);
|
||||
nullptr, s_current_title.toStdString(), s_current_disc_serial.toStdString(), s_current_disc_crc);
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsWindow::openGamePropertiesDialog(
|
||||
nullptr, m_current_title.toStdString(), std::string(), m_current_disc_crc);
|
||||
nullptr, s_current_title.toStdString(), std::string(), s_current_disc_crc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1600,17 +1641,17 @@ void MainWindow::onToolsCoverDownloaderTriggered()
|
||||
{
|
||||
// This can be invoked via big picture, so exit fullscreen.
|
||||
VMLock lock(pauseAndLockVM());
|
||||
CoverDownloadDialog dlg(this);
|
||||
CoverDownloadDialog dlg(lock.getDialogParent());
|
||||
connect(&dlg, &CoverDownloadDialog::coverRefreshRequested, m_game_list_widget, &GameListWidget::refreshGridCovers);
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void MainWindow::onToolsEditCheatsPatchesTriggered(bool cheats)
|
||||
{
|
||||
if (m_current_disc_serial.isEmpty() || m_current_running_crc == 0)
|
||||
if (s_current_disc_serial.isEmpty() || s_current_running_crc == 0)
|
||||
return;
|
||||
|
||||
const std::string path = Patch::GetPnachFilename(m_current_disc_serial.toStdString(), m_current_running_crc, cheats);
|
||||
const std::string path = Patch::GetPnachFilename(s_current_disc_serial.toStdString(), s_current_running_crc, cheats);
|
||||
if (!FileSystem::FileExists(path.c_str()))
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Confirm File Creation"),
|
||||
@@ -1631,6 +1672,14 @@ void MainWindow::onToolsEditCheatsPatchesTriggered(bool cheats)
|
||||
QtUtils::OpenURL(this, QUrl::fromLocalFile(QString::fromStdString(path)));
|
||||
}
|
||||
|
||||
void MainWindow::onCreateMemoryCardOpenRequested()
|
||||
{
|
||||
// This can be invoked via big picture, so exit fullscreen.
|
||||
VMLock lock(pauseAndLockVM());
|
||||
MemoryCardCreateDialog dlg(lock.getDialogParent());
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void MainWindow::updateTheme()
|
||||
{
|
||||
QtHost::UpdateApplicationTheme();
|
||||
@@ -1644,7 +1693,10 @@ void MainWindow::reloadThemeSpecificImages()
|
||||
|
||||
void MainWindow::updateLanguage()
|
||||
{
|
||||
QtHost::InstallTranslator();
|
||||
// Remove the settings window, so it doesn't mess with any popups that happen (e.g. font download).
|
||||
destroySubWindows();
|
||||
|
||||
QtHost::InstallTranslator(this);
|
||||
recreate();
|
||||
}
|
||||
|
||||
@@ -1874,12 +1926,12 @@ void MainWindow::onVMStopped()
|
||||
void MainWindow::onGameChanged(const QString& title, const QString& elf_override, const QString& disc_path,
|
||||
const QString& serial, quint32 disc_crc, quint32 crc)
|
||||
{
|
||||
m_current_title = title;
|
||||
m_current_elf_override = elf_override;
|
||||
m_current_disc_path = disc_path;
|
||||
m_current_disc_serial = serial;
|
||||
m_current_disc_crc = disc_crc;
|
||||
m_current_running_crc = crc;
|
||||
s_current_title = title;
|
||||
s_current_elf_override = elf_override;
|
||||
s_current_disc_path = disc_path;
|
||||
s_current_disc_serial = serial;
|
||||
s_current_disc_crc = disc_crc;
|
||||
s_current_running_crc = crc;
|
||||
updateWindowTitle();
|
||||
updateGameDependentActions();
|
||||
}
|
||||
@@ -2033,6 +2085,22 @@ void MainWindow::dropEvent(QDropEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::moveEvent(QMoveEvent* event)
|
||||
{
|
||||
QMainWindow::moveEvent(event);
|
||||
|
||||
if (g_log_window && g_log_window->isAttachedToMainWindow())
|
||||
g_log_window->reattachToMainWindow();
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QMainWindow::resizeEvent(event);
|
||||
|
||||
if (g_log_window && g_log_window->isAttachedToMainWindow())
|
||||
g_log_window->reattachToMainWindow();
|
||||
}
|
||||
|
||||
void MainWindow::registerForDeviceNotifications()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@@ -2643,8 +2711,8 @@ void MainWindow::loadSaveStateFile(const QString& filename, const QString& state
|
||||
{
|
||||
if (s_vm_valid)
|
||||
{
|
||||
if (!filename.isEmpty() && m_current_disc_path != filename)
|
||||
g_emu_thread->changeDisc(CDVD_SourceType::Iso, m_current_disc_path);
|
||||
if (!filename.isEmpty() && s_current_disc_path != filename)
|
||||
g_emu_thread->changeDisc(CDVD_SourceType::Iso, s_current_disc_path);
|
||||
g_emu_thread->loadState(state_filename);
|
||||
}
|
||||
else
|
||||
@@ -2769,13 +2837,13 @@ void MainWindow::populateSaveStateMenu(QMenu* menu, const QString& serial, quint
|
||||
|
||||
void MainWindow::updateGameDependentActions()
|
||||
{
|
||||
const bool valid_serial_and_crc = (s_vm_valid && !m_current_disc_serial.isEmpty() && m_current_disc_crc != 0);
|
||||
const bool valid_serial_and_crc = (s_vm_valid && !s_current_disc_serial.isEmpty() && s_current_disc_crc != 0);
|
||||
m_ui.menuLoadState->setEnabled(valid_serial_and_crc);
|
||||
m_ui.actionToolbarLoadState->setEnabled(valid_serial_and_crc);
|
||||
m_ui.menuSaveState->setEnabled(valid_serial_and_crc);
|
||||
m_ui.actionToolbarSaveState->setEnabled(valid_serial_and_crc);
|
||||
|
||||
const bool can_use_pnach = (s_vm_valid && !m_current_disc_serial.isEmpty() && m_current_running_crc != 0);
|
||||
const bool can_use_pnach = (s_vm_valid && !s_current_disc_serial.isEmpty() && s_current_running_crc != 0);
|
||||
m_ui.actionEditCheats->setEnabled(can_use_pnach);
|
||||
m_ui.actionEditPatches->setEnabled(can_use_pnach);
|
||||
m_ui.actionReloadPatches->setEnabled(s_vm_valid);
|
||||
@@ -2838,7 +2906,7 @@ void MainWindow::doDiscChange(CDVD_SourceType source, const QString& path)
|
||||
if (reset_system)
|
||||
{
|
||||
// Clearing ELF override will reset the system.
|
||||
if (!m_current_elf_override.isEmpty())
|
||||
if (!s_current_elf_override.isEmpty())
|
||||
g_emu_thread->setELFOverride(QString());
|
||||
else
|
||||
g_emu_thread->resetVM();
|
||||
@@ -2885,6 +2953,12 @@ MainWindow::VMLock MainWindow::pauseAndLockVM()
|
||||
// Now we'll either have a borderless window, or a regular window (if we were exclusive fullscreen).
|
||||
QWidget* dialog_parent = getDisplayContainer();
|
||||
|
||||
// Ensure main window is visible.
|
||||
if (!g_main_window->isVisible())
|
||||
g_main_window->show();
|
||||
g_main_window->raise();
|
||||
g_main_window->activateWindow();
|
||||
|
||||
return VMLock(dialog_parent, was_paused, was_fullscreen);
|
||||
}
|
||||
|
||||
@@ -2922,6 +2996,19 @@ MainWindow::VMLock::~VMLock()
|
||||
g_emu_thread->setVMPaused(false);
|
||||
}
|
||||
|
||||
MainWindow::VMLock& MainWindow::VMLock::operator=(VMLock&& lock)
|
||||
{
|
||||
m_dialog_parent = lock.m_dialog_parent;
|
||||
m_was_paused = lock.m_was_paused;
|
||||
m_was_fullscreen = lock.m_was_fullscreen;
|
||||
|
||||
lock.m_dialog_parent = nullptr;
|
||||
lock.m_was_paused = true;
|
||||
lock.m_was_fullscreen = false;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void MainWindow::VMLock::cancelResume()
|
||||
{
|
||||
m_was_paused = true;
|
||||
@@ -2938,3 +3025,18 @@ bool QtHost::IsVMPaused()
|
||||
{
|
||||
return s_vm_paused;
|
||||
}
|
||||
|
||||
const QString& QtHost::GetCurrentGameTitle()
|
||||
{
|
||||
return s_current_title;
|
||||
}
|
||||
|
||||
const QString& QtHost::GetCurrentGameSerial()
|
||||
{
|
||||
return s_current_disc_serial;
|
||||
}
|
||||
|
||||
const QString& QtHost::GetCurrentGamePath()
|
||||
{
|
||||
return s_current_disc_path;
|
||||
}
|
||||
|
||||
+7
-10
@@ -54,6 +54,9 @@ public:
|
||||
VMLock(const VMLock&) = delete;
|
||||
~VMLock();
|
||||
|
||||
VMLock& operator=(VMLock&& lock);
|
||||
VMLock& operator=(const VMLock&) = delete;
|
||||
|
||||
/// Returns the parent widget, which can be used for any popup dialogs.
|
||||
__fi QWidget* getDialogParent() const { return m_dialog_parent; }
|
||||
|
||||
@@ -155,6 +158,7 @@ private Q_SLOTS:
|
||||
void onToolsOpenDataDirectoryTriggered();
|
||||
void onToolsCoverDownloaderTriggered();
|
||||
void onToolsEditCheatsPatchesTriggered(bool cheats);
|
||||
void onCreateMemoryCardOpenRequested();
|
||||
void updateTheme();
|
||||
void reloadThemeSpecificImages();
|
||||
void updateLanguage();
|
||||
@@ -194,15 +198,14 @@ protected:
|
||||
void changeEvent(QEvent* event) override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
void moveEvent(QMoveEvent* event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
#ifdef _WIN32
|
||||
bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void setStyleFromSettings();
|
||||
static void setIconThemeFromStyle();
|
||||
|
||||
void setupAdditionalUi();
|
||||
void connectSignals();
|
||||
void createRendererSwitchMenu();
|
||||
@@ -220,6 +223,7 @@ private:
|
||||
void updateDisplayRelatedActions(bool has_surface, bool render_to_main, bool fullscreen);
|
||||
void updateGameDependentActions();
|
||||
void updateStatusBarWidgetVisibility();
|
||||
void updateAdvancedSettingsVisibility();
|
||||
void updateWindowTitle();
|
||||
void updateWindowState(bool force_visible = false);
|
||||
void setProgressBar(int current, int total);
|
||||
@@ -290,13 +294,6 @@ private:
|
||||
|
||||
QMenu* m_settings_toolbar_menu = nullptr;
|
||||
|
||||
QString m_current_title;
|
||||
QString m_current_elf_override;
|
||||
QString m_current_disc_path;
|
||||
QString m_current_disc_serial;
|
||||
quint32 m_current_disc_crc;
|
||||
quint32 m_current_running_crc;
|
||||
|
||||
bool m_display_created = false;
|
||||
bool m_relative_mouse_mode = false;
|
||||
bool m_hide_mouse_cursor = false;
|
||||
|
||||
+32
-6
@@ -146,7 +146,7 @@
|
||||
<addaction name="actionEnableIOPConsoleLogging"/>
|
||||
<addaction name="actionEnableCDVDVerboseReads"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_View">
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
@@ -176,11 +176,11 @@
|
||||
<addaction name="actionGridViewZoomOut"/>
|
||||
<addaction name="actionGridViewRefreshCovers"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Tools">
|
||||
<widget class="QMenu" name="menuTools">
|
||||
<property name="title">
|
||||
<string>&Tools</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuInput_Recording">
|
||||
<widget class="QMenu" name="menuInputRecording">
|
||||
<property name="title">
|
||||
<string>Input Recording</string>
|
||||
</property>
|
||||
@@ -206,10 +206,12 @@
|
||||
<addaction name="actionReloadPatches"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionToggleSoftwareRendering"/>
|
||||
<addaction name="menuInput_Recording"/>
|
||||
<addaction name="menuInputRecording"/>
|
||||
<addaction name="actionToolsVideoCapture"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEnableSystemConsole"/>
|
||||
<addaction name="actionEnableDebugConsole"/>
|
||||
<addaction name="actionEnableLogWindow"/>
|
||||
<addaction name="actionEnableFileLogging"/>
|
||||
<addaction name="actionEnableVerboseLogging"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -219,8 +221,8 @@
|
||||
</widget>
|
||||
<addaction name="menuSystem"/>
|
||||
<addaction name="menuSettings"/>
|
||||
<addaction name="menu_View"/>
|
||||
<addaction name="menu_Tools"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuDebug"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
@@ -901,6 +903,22 @@
|
||||
<string>Enable System Console</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnableDebugConsole">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Debug Console</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnableLogWindow">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Log Window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnableVerboseLogging">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@@ -1071,11 +1089,19 @@
|
||||
<property name="text">
|
||||
<string>Edit Cheats...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="pencil-line">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEditPatches">
|
||||
<property name="text">
|
||||
<string>Edit Patches...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="pencil-line">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
|
||||
+144
-41
@@ -4,8 +4,10 @@
|
||||
#include "AutoUpdaterDialog.h"
|
||||
#include "DisplayWidget.h"
|
||||
#include "GameList/GameListWidget.h"
|
||||
#include "LogWindow.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QtHost.h"
|
||||
#include "QtProgressCallback.h"
|
||||
#include "QtUtils.h"
|
||||
#include "SetupWizardDialog.h"
|
||||
#include "svnrev.h"
|
||||
@@ -25,16 +27,15 @@
|
||||
#include "pcsx2/ImGui/ImGuiManager.h"
|
||||
#include "pcsx2/ImGui/ImGuiOverlays.h"
|
||||
#include "pcsx2/Input/InputManager.h"
|
||||
#include "pcsx2/LogSink.h"
|
||||
#include "pcsx2/MTGS.h"
|
||||
#include "pcsx2/PerformanceMetrics.h"
|
||||
#include "pcsx2/SysForwardDefs.h"
|
||||
#include "pcsx2/VMManager.h"
|
||||
|
||||
#include "common/Assertions.h"
|
||||
#include "common/Console.h"
|
||||
#include "common/CrashHandler.h"
|
||||
#include "common/FileSystem.h"
|
||||
#include "common/HTTPDownloader.h"
|
||||
#include "common/Path.h"
|
||||
#include "common/SettingsWrapper.h"
|
||||
#include "common/StringUtil.h"
|
||||
@@ -52,6 +53,8 @@
|
||||
#include <csignal>
|
||||
|
||||
static constexpr u32 SETTINGS_SAVE_DELAY = 1000;
|
||||
static constexpr const char* RUNTIME_RESOURCES_URL =
|
||||
"https://github.com/PCSX2/pcsx2-windows-dependencies/releases/download/runtime-resources/";
|
||||
|
||||
EmuThread* g_emu_thread = nullptr;
|
||||
|
||||
@@ -60,6 +63,7 @@ EmuThread* g_emu_thread = nullptr;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
namespace QtHost
|
||||
{
|
||||
static void InitializeEarlyConsole();
|
||||
static void PrintCommandLineVersion();
|
||||
static void PrintCommandLineHelp(const std::string_view& progname);
|
||||
static std::shared_ptr<VMBootParameters>& AutoBoot(std::shared_ptr<VMBootParameters>& autoboot);
|
||||
@@ -69,6 +73,7 @@ namespace QtHost
|
||||
static void HookSignals();
|
||||
static void RegisterTypes();
|
||||
static bool RunSetupWizard();
|
||||
static std::optional<bool> DownloadFile(QWidget* parent, const QString& title, std::string url, std::vector<u8>* data);
|
||||
} // namespace QtHost
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -82,6 +87,7 @@ static bool s_start_fullscreen_ui = false;
|
||||
static bool s_start_fullscreen_ui_fullscreen = false;
|
||||
static bool s_test_config_and_exit = false;
|
||||
static bool s_run_setup_wizard = false;
|
||||
static bool s_cleanup_after_update = false;
|
||||
static bool s_boot_and_debug = false;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -96,11 +102,6 @@ EmuThread::EmuThread(QThread* ui_thread)
|
||||
|
||||
EmuThread::~EmuThread() = default;
|
||||
|
||||
bool EmuThread::isOnEmuThread() const
|
||||
{
|
||||
return QThread::currentThread() == this;
|
||||
}
|
||||
|
||||
void EmuThread::start()
|
||||
{
|
||||
pxAssertRel(!g_emu_thread, "Emu thread does not exist");
|
||||
@@ -496,7 +497,7 @@ void EmuThread::setFullscreen(bool fullscreen, bool allow_render_to_main)
|
||||
MTGS::WaitGS();
|
||||
|
||||
// If we're using exclusive fullscreen, the refresh rate may have changed.
|
||||
UpdateVSyncRate(true);
|
||||
VMManager::UpdateTargetSpeed();
|
||||
}
|
||||
|
||||
void EmuThread::setSurfaceless(bool surfaceless)
|
||||
@@ -990,7 +991,7 @@ void EmuThread::updatePerformanceMetrics(bool force)
|
||||
QMetaObject::invokeMethod(g_main_window->getStatusVerboseWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, gs_stat));
|
||||
}
|
||||
|
||||
const GSRendererType renderer = GSConfig.Renderer;
|
||||
const GSRendererType renderer = GSGetCurrentRenderer(); // Reading from GS thread, therefore racey, but it's just visual.
|
||||
const float speed = std::round(PerformanceMetrics::GetSpeed());
|
||||
const float gfps = std::round(PerformanceMetrics::GetInternalFPS());
|
||||
const float vfps = std::round(PerformanceMetrics::GetFPS());
|
||||
@@ -1116,7 +1117,12 @@ void Host::OnCoverDownloaderOpenRequested()
|
||||
emit g_emu_thread->onCoverDownloaderOpenRequested();
|
||||
}
|
||||
|
||||
void Host::VSyncOnCPUThread()
|
||||
void Host::OnCreateMemoryCardOpenRequested()
|
||||
{
|
||||
emit g_emu_thread->onCreateMemoryCardOpenRequested();
|
||||
}
|
||||
|
||||
void Host::PumpMessagesOnCPUThread()
|
||||
{
|
||||
g_emu_thread->getEventLoop()->processEvents(QEventLoop::AllEvents);
|
||||
}
|
||||
@@ -1235,9 +1241,10 @@ bool QtHost::InitializeConfig()
|
||||
s_run_setup_wizard =
|
||||
s_run_setup_wizard || s_base_settings_interface->GetBoolValue("UI", "SetupWizardIncomplete", false);
|
||||
|
||||
LogSink::SetBlockSystemConsole(QtHost::InNoGUIMode());
|
||||
// TODO: -nogui console block?
|
||||
|
||||
VMManager::Internal::LoadStartupSettings();
|
||||
InstallTranslator();
|
||||
InstallTranslator(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1334,24 +1341,7 @@ bool Host::RequestResetSettings(bool folders, bool core, bool controllers, bool
|
||||
|
||||
QString QtHost::GetAppNameAndVersion()
|
||||
{
|
||||
QString ret;
|
||||
if constexpr (!PCSX2_isReleaseVersion && GIT_TAGGED_COMMIT)
|
||||
{
|
||||
ret = QStringLiteral("PCSX2 Nightly - " GIT_TAG);
|
||||
}
|
||||
else if constexpr (PCSX2_isReleaseVersion)
|
||||
{
|
||||
#define APPNAME_STRINGIZE(x) #x
|
||||
ret = QStringLiteral(
|
||||
"PCSX2 " APPNAME_STRINGIZE(PCSX2_VersionHi) "." APPNAME_STRINGIZE(PCSX2_VersionMid) "." APPNAME_STRINGIZE(PCSX2_VersionLo));
|
||||
#undef APPNAME_STRINGIZE
|
||||
}
|
||||
else
|
||||
{
|
||||
return QStringLiteral("PCSX2 " GIT_REV);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return QStringLiteral("PCSX2 " GIT_REV);
|
||||
}
|
||||
|
||||
QString QtHost::GetAppConfigSuffix()
|
||||
@@ -1365,11 +1355,99 @@ QString QtHost::GetAppConfigSuffix()
|
||||
#endif
|
||||
}
|
||||
|
||||
QIcon QtHost::GetAppIcon()
|
||||
{
|
||||
return QIcon(QStringLiteral(":/icons/AppIcon64.png"));
|
||||
}
|
||||
|
||||
QString QtHost::GetResourcesBasePath()
|
||||
{
|
||||
return QString::fromStdString(EmuFolders::Resources);
|
||||
}
|
||||
|
||||
std::string QtHost::GetRuntimeDownloadedResourceURL(std::string_view name)
|
||||
{
|
||||
return fmt::format("{}/{}", RUNTIME_RESOURCES_URL, HTTPDownloader::URLEncode(name));
|
||||
}
|
||||
|
||||
std::optional<bool> QtHost::DownloadFile(QWidget* parent, const QString& title, std::string url, std::vector<u8>* data)
|
||||
{
|
||||
static constexpr u32 HTTP_POLL_INTERVAL = 10;
|
||||
|
||||
std::unique_ptr<HTTPDownloader> http = HTTPDownloader::Create(Host::GetHTTPUserAgent());
|
||||
if (!http)
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("EmuThread", "Error"), qApp->translate("EmuThread", "Failed to create HTTPDownloader."));
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<bool> download_result;
|
||||
const std::string::size_type url_file_part_pos = url.rfind('/');
|
||||
QtModalProgressCallback progress(parent);
|
||||
progress.GetDialog().setLabelText(
|
||||
qApp->translate("EmuThread", "Downloading %1...").arg(QtUtils::StringViewToQString(
|
||||
std::string_view(url).substr((url_file_part_pos != std::string::npos) ? (url_file_part_pos + 1) : 0))));
|
||||
progress.GetDialog().setWindowTitle(title);
|
||||
progress.GetDialog().setWindowIcon(GetAppIcon());
|
||||
progress.SetCancellable(true);
|
||||
|
||||
http->CreateRequest(
|
||||
std::move(url), [parent, data, &download_result](s32 status_code, const std::string&, std::vector<u8> hdata) {
|
||||
if (status_code == HTTPDownloader::HTTP_STATUS_CANCELLED)
|
||||
return;
|
||||
|
||||
if (status_code != HTTPDownloader::HTTP_STATUS_OK)
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("EmuThread", "Error"),
|
||||
qApp->translate("EmuThread", "Download failed with HTTP status code %1.").arg(status_code));
|
||||
download_result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (hdata.empty())
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("EmuThread", "Error"),
|
||||
qApp->translate("EmuThread", "Download failed: Data is empty.").arg(status_code));
|
||||
|
||||
download_result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
*data = std::move(hdata);
|
||||
download_result = true;
|
||||
},
|
||||
&progress);
|
||||
|
||||
// Block until completion.
|
||||
while (http->HasAnyRequests())
|
||||
{
|
||||
QApplication::processEvents(QEventLoop::AllEvents, HTTP_POLL_INTERVAL);
|
||||
http->PollRequests();
|
||||
}
|
||||
|
||||
return download_result;
|
||||
}
|
||||
|
||||
bool QtHost::DownloadFile(QWidget* parent, const QString& title, std::string url, const std::string& path)
|
||||
{
|
||||
std::vector<u8> data;
|
||||
if (!DownloadFile(parent, title, std::move(url), &data).value_or(false) || data.empty())
|
||||
return false;
|
||||
|
||||
// Directory may not exist. Create it.
|
||||
const std::string directory(Path::GetDirectory(path));
|
||||
if ((!directory.empty() && !FileSystem::DirectoryExists(directory.c_str()) &&
|
||||
!FileSystem::CreateDirectoryPath(directory.c_str(), true)) ||
|
||||
!FileSystem::WriteBinaryFile(path.c_str(), data.data(), data.size()))
|
||||
{
|
||||
QMessageBox::critical(parent, qApp->translate("EmuThread", "Error"),
|
||||
qApp->translate("EmuThread", "Failed to write '%1'.").arg(QString::fromStdString(path)));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Host::ReportErrorAsync(const std::string_view& title, const std::string_view& message)
|
||||
{
|
||||
if (!title.empty() && !message.empty())
|
||||
@@ -1482,12 +1560,27 @@ static void SignalHandler(int signal)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static BOOL WINAPI ConsoleCtrlHandler(DWORD dwCtrlType)
|
||||
{
|
||||
if (dwCtrlType != CTRL_C_EVENT)
|
||||
return FALSE;
|
||||
|
||||
SignalHandler(SIGTERM);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void QtHost::HookSignals()
|
||||
{
|
||||
std::signal(SIGINT, SignalHandler);
|
||||
std::signal(SIGTERM, SignalHandler);
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(_WIN32)
|
||||
SetConsoleCtrlHandler(ConsoleCtrlHandler, FALSE);
|
||||
#elif defined(__linux__)
|
||||
// Ignore SIGCHLD by default on Linux, since we kick off aplay asynchronously.
|
||||
struct sigaction sa_chld = {};
|
||||
sigemptyset(&sa_chld.sa_mask);
|
||||
@@ -1496,9 +1589,14 @@ void QtHost::HookSignals()
|
||||
#endif
|
||||
}
|
||||
|
||||
void QtHost::InitializeEarlyConsole()
|
||||
{
|
||||
Log::SetConsoleOutputLevel(LOGLEVEL_DEBUG);
|
||||
}
|
||||
|
||||
void QtHost::PrintCommandLineVersion()
|
||||
{
|
||||
LogSink::InitializeEarlyConsole();
|
||||
InitializeEarlyConsole();
|
||||
std::fprintf(stderr, "%s\n", (GetAppNameAndVersion() + GetAppConfigSuffix()).toUtf8().constData());
|
||||
std::fprintf(stderr, "https://pcsx2.net/\n");
|
||||
std::fprintf(stderr, "\n");
|
||||
@@ -1622,7 +1720,7 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
||||
}
|
||||
else if (CHECK_ARG_PARAM(QStringLiteral("-logfile")))
|
||||
{
|
||||
LogSink::SetFileLogPath((++it)->toStdString());
|
||||
VMManager::Internal::SetFileLogPath((++it)->toStdString());
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG(QStringLiteral("-bios")))
|
||||
@@ -1643,7 +1741,7 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
||||
}
|
||||
else if (CHECK_ARG(QStringLiteral("-earlyconsolelog")))
|
||||
{
|
||||
LogSink::InitializeEarlyConsole();
|
||||
InitializeEarlyConsole();
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG(QStringLiteral("-bigpicture")))
|
||||
@@ -1668,9 +1766,7 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
||||
}
|
||||
else if (CHECK_ARG(QStringLiteral("-updatecleanup")))
|
||||
{
|
||||
if (AutoUpdaterDialog::isSupported())
|
||||
AutoUpdaterDialog::cleanupAfterUpdate();
|
||||
|
||||
s_cleanup_after_update = AutoUpdaterDialog::isSupported();
|
||||
continue;
|
||||
}
|
||||
#ifdef ENABLE_RAINTEGRATION
|
||||
@@ -1705,7 +1801,6 @@ bool QtHost::ParseCommandLineOptions(const QStringList& args, std::shared_ptr<VM
|
||||
// or disc, we don't want to actually start.
|
||||
if (autoboot && !autoboot->source_type.has_value() && autoboot->filename.empty() && autoboot->elf_override.empty())
|
||||
{
|
||||
LogSink::InitializeEarlyConsole();
|
||||
Console.Warning("Skipping autoboot due to no boot parameters.");
|
||||
autoboot.reset();
|
||||
}
|
||||
@@ -1802,9 +1897,16 @@ int main(int argc, char* argv[])
|
||||
if (s_test_config_and_exit)
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
// Remove any previous-version remanants.
|
||||
if (s_cleanup_after_update)
|
||||
AutoUpdaterDialog::cleanupAfterUpdate();
|
||||
|
||||
// Set theme before creating any windows.
|
||||
QtHost::UpdateApplicationTheme();
|
||||
|
||||
// Start logging early.
|
||||
LogWindow::updateSettings();
|
||||
|
||||
// Start up the CPU thread.
|
||||
QtHost::HookSignals();
|
||||
EmuThread::start();
|
||||
@@ -1829,7 +1931,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
// Don't bother showing the window in no-gui mode.
|
||||
if (!s_nogui_mode)
|
||||
{
|
||||
g_main_window->show();
|
||||
g_main_window->raise();
|
||||
g_main_window->activateWindow();
|
||||
}
|
||||
|
||||
// Initialize big picture mode if requested.
|
||||
if (s_start_fullscreen_ui)
|
||||
@@ -1863,8 +1969,5 @@ shutdown_and_exit:
|
||||
if (s_base_settings_interface->IsDirty())
|
||||
s_base_settings_interface->Save();
|
||||
|
||||
// Ensure emulog is flushed.
|
||||
LogSink::CloseFileLog();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+27
-4
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "pcsx2/Host.h"
|
||||
#include "pcsx2/Input/InputManager.h"
|
||||
@@ -22,6 +24,8 @@
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
class SettingsInterface;
|
||||
|
||||
class DisplayWidget;
|
||||
@@ -59,7 +63,8 @@ public:
|
||||
__fi bool isSurfaceless() const { return m_is_surfaceless; }
|
||||
__fi bool isRunningFullscreenUI() const { return m_run_fullscreen_ui; }
|
||||
|
||||
bool isOnEmuThread() const;
|
||||
__fi bool isOnEmuThread() const { return (QThread::currentThread() == this); }
|
||||
__fi bool isOnUIThread() const { return (QThread::currentThread() == m_ui_thread); }
|
||||
bool shouldRenderToMain() const;
|
||||
|
||||
/// Called back from the GS thread when the display state changes (e.g. fullscreen, render to main).
|
||||
@@ -163,8 +168,9 @@ Q_SIGNALS:
|
||||
/// Called when hardcore mode is enabled or disabled.
|
||||
void onAchievementsHardcoreModeChanged(bool enabled);
|
||||
|
||||
/// Called when cover download is requested.
|
||||
/// Big Picture UI requests.
|
||||
void onCoverDownloaderOpenRequested();
|
||||
void onCreateMemoryCardOpenRequested();
|
||||
|
||||
/// Called when video capture starts/stops.
|
||||
void onCaptureStarted(const QString& filename);
|
||||
@@ -233,6 +239,9 @@ namespace QtHost
|
||||
/// Sets application theme according to settings.
|
||||
void UpdateApplicationTheme();
|
||||
|
||||
/// Returns true if the application theme is using dark colours.
|
||||
bool IsDarkApplicationTheme();
|
||||
|
||||
/// Sets the icon theme, based on the current style (light/dark).
|
||||
void SetIconThemeFromStyle();
|
||||
|
||||
@@ -255,7 +264,7 @@ namespace QtHost
|
||||
std::vector<std::pair<QString, QString>> GetAvailableLanguageList();
|
||||
|
||||
/// Call when the language changes.
|
||||
void InstallTranslator();
|
||||
void InstallTranslator(QWidget* dialog_parent);
|
||||
|
||||
/// Returns the application name and version, optionally including debug/devel config indicator.
|
||||
QString GetAppNameAndVersion();
|
||||
@@ -263,13 +272,27 @@ namespace QtHost
|
||||
/// Returns the debug/devel config indicator.
|
||||
QString GetAppConfigSuffix();
|
||||
|
||||
/// Returns the main application icon.
|
||||
QIcon GetAppIcon();
|
||||
|
||||
/// Returns the base path for resources. This may be : prefixed, if we're using embedded resources.
|
||||
QString GetResourcesBasePath();
|
||||
|
||||
/// Returns the URL to a runtime-downloaded resource.
|
||||
std::string GetRuntimeDownloadedResourceURL(std::string_view name);
|
||||
|
||||
/// Downloads the specified URL to the provided path.
|
||||
bool DownloadFile(QWidget* parent, const QString& title, std::string url, const std::string& path);
|
||||
|
||||
/// VM state, safe to access on UI thread.
|
||||
bool IsVMValid();
|
||||
bool IsVMPaused();
|
||||
|
||||
/// Accessors for game information.
|
||||
const QString& GetCurrentGameTitle();
|
||||
const QString& GetCurrentGameSerial();
|
||||
const QString& GetCurrentGamePath();
|
||||
|
||||
/// Compare strings in the locale of the current UI language
|
||||
int LocaleSensitiveCompare(QStringView lhs, QStringView rhs);
|
||||
} // namespace QtHost
|
||||
|
||||
+41
-2
@@ -4,6 +4,7 @@
|
||||
#include "QtUtils.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QMetaObject>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QGuiApplication>
|
||||
@@ -26,10 +27,12 @@
|
||||
#include <array>
|
||||
#include <map>
|
||||
|
||||
#include "common/CocoaTools.h"
|
||||
#include "common/Console.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "common/RedtapeWindows.h"
|
||||
#include <Shlobj.h>
|
||||
#elif !defined(APPLE)
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
@@ -129,12 +132,48 @@ namespace QtUtils
|
||||
ResizeColumnsForView(view, widths);
|
||||
}
|
||||
|
||||
void ShowInFileExplorer(QWidget* parent, const QFileInfo& file)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
std::wstring wstr = QDir::toNativeSeparators(file.absoluteFilePath()).toStdWString();
|
||||
bool ok = false;
|
||||
if (PIDLIST_ABSOLUTE pidl = ILCreateFromPath(wstr.c_str()))
|
||||
{
|
||||
ok = SUCCEEDED(SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0));
|
||||
ILFree(pidl);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
bool ok = CocoaTools::ShowInFinder(file.absoluteFilePath().toStdString());
|
||||
#else
|
||||
bool ok = QDesktopServices::openUrl(QUrl::fromLocalFile(file.absolutePath()));
|
||||
#endif
|
||||
if (!ok)
|
||||
{
|
||||
QMessageBox::critical(parent, QCoreApplication::translate("FileOperations", "Failed to show file"),
|
||||
QCoreApplication::translate("FileOperations", "Failed to show file in file explorer.\n\nThe file was: %1").arg(file.absoluteFilePath()));
|
||||
}
|
||||
}
|
||||
|
||||
QString GetShowInFileExplorerMessage()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
//: Windows action to show a file in Windows Explorer
|
||||
return QCoreApplication::translate("FileOperations", "Show in Folder");
|
||||
#elif defined(__APPLE__)
|
||||
//: macOS action to show a file in Finder
|
||||
return QCoreApplication::translate("FileOperations", "Show in Finder");
|
||||
#else
|
||||
//: Opens the system file manager to the directory containing a selected file
|
||||
return QCoreApplication::translate("FileOperations", "Open Containing Directory");
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenURL(QWidget* parent, const QUrl& qurl)
|
||||
{
|
||||
if (!QDesktopServices::openUrl(qurl))
|
||||
{
|
||||
QMessageBox::critical(parent, QObject::tr("Failed to open URL"),
|
||||
QObject::tr("Failed to open URL.\n\nThe URL was: %1").arg(qurl.toString()));
|
||||
QMessageBox::critical(parent, QCoreApplication::translate("FileOperations", "Failed to open URL"),
|
||||
QCoreApplication::translate("FileOperations", "Failed to open URL.\n\nThe URL was: %1").arg(qurl.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class ByteStream;
|
||||
|
||||
class QAction;
|
||||
class QComboBox;
|
||||
class QFileInfo;
|
||||
class QFrame;
|
||||
class QKeyEvent;
|
||||
class QTableView;
|
||||
@@ -49,6 +50,12 @@ namespace QtUtils
|
||||
/// NOTE: Defined in QtKeyCodes.cpp, not QtUtils.cpp.
|
||||
u32 KeyEventToCode(const QKeyEvent* ev);
|
||||
|
||||
/// Shows a file, or the containing folder if unsupported, with the system file explorer
|
||||
void ShowInFileExplorer(QWidget* parent, const QFileInfo& file);
|
||||
|
||||
/// Get the context menu name for the action performed by ShowInFileExplorer
|
||||
QString GetShowInFileExplorerMessage();
|
||||
|
||||
/// Opens a URL with the default handler.
|
||||
void OpenURL(QWidget* parent, const QUrl& qurl);
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.vu1Recompiler, "EmuCore/CPU/Recompiler", "EnableVU1", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.vuFlagHack, "EmuCore/Speedhacks", "vuFlagHack", true);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.eeRoundingMode, "EmuCore/CPU", "FPU.Roundmode", 3);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.vu0RoundingMode, "EmuCore/CPU", "VU0.Roundmode", 3);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.vu1RoundingMode, "EmuCore/CPU", "VU1.Roundmode", 3);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.eeRoundingMode, "EmuCore/CPU", "FPU.Roundmode", static_cast<int>(FPRoundMode::ChopZero));
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.eeDivRoundingMode, "EmuCore/CPU", "FPUDiv.Roundmode", static_cast<int>(FPRoundMode::Nearest));
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.vu0RoundingMode, "EmuCore/CPU", "VU0.Roundmode", static_cast<int>(FPRoundMode::ChopZero));
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.vu1RoundingMode, "EmuCore/CPU", "VU1.Roundmode", static_cast<int>(FPRoundMode::ChopZero));
|
||||
if (m_dialog->isPerGameSettings())
|
||||
{
|
||||
m_ui.eeClampMode->insertItem(0, tr("Use Global Setting [%1]").arg(m_ui.eeClampMode->itemText(getGlobalClampingModeIndex(-1))));
|
||||
@@ -58,6 +59,7 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.eeRoundingMode, tr("Rounding Mode"), tr("Chop/Zero (Default)"), tr("Changes how PCSX2 handles rounding while emulating the Emotion Engine's Floating Point Unit (EE FPU). "
|
||||
"Because the various FPUs in the PS2 are non-compliant with international standards, some games may need different modes to do math correctly. The default value handles the vast majority of games; <b>modifying this setting when a game is not having a visible problem can cause instability.</b>"));
|
||||
dialog->registerWidgetHelp(m_ui.eeDivRoundingMode, tr("Division Rounding Mode"), tr("Nearest (Default)"), tr("Determines how the results of floating-point division is rounded. Some games need specific settings; <b>modifying this setting when a game is not having a visible problem can cause instability.</b>"));
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.eeClampMode, tr("Clamping Mode"), tr("Normal (Default)"), tr("Changes how PCSX2 handles keeping floats in a standard x86 range. "
|
||||
"The default value handles the vast majority of games; <b>modifying this setting when a game is not having a visible problem can cause instability.</b>"));
|
||||
|
||||
@@ -95,13 +95,44 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string extracomment="Rounding refers here to the mathematical term.">Division Rounding Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="eeDivRoundingMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Nearest (Default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Negative</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Positive</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Chop/Zero</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string extracomment="Clamping: Forcing out of bounds things in bounds by changing them to the closest possible value. In this case, this refers to clamping large PS2 floating point values (which map to infinity or NaN in PCs' IEEE754 floats) to non-infinite ones.">Clamping Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="eeClampMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
@@ -125,7 +156,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="eeWaitLoopDetection">
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_21">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">Select</string>
|
||||
<string extracomment="Leave this button name as-is or uppercase it entirely.">Select</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_21">
|
||||
<property name="leftMargin">
|
||||
@@ -135,7 +135,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_22">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">Yellow (Left)</string>
|
||||
<string>Yellow (Left)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_22">
|
||||
<property name="leftMargin">
|
||||
@@ -169,7 +169,7 @@
|
||||
<item row="1" column="3">
|
||||
<widget class="QGroupBox" name="groupBox_24">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">Yellow (Right)</string>
|
||||
<string>Yellow (Right)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_24">
|
||||
<property name="leftMargin">
|
||||
@@ -203,7 +203,7 @@
|
||||
<item row="1" column="2">
|
||||
<widget class="QGroupBox" name="groupBox_26">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is or uppercase it entirely.">Blue (Right)</string>
|
||||
<string>Blue (Right)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_26">
|
||||
<property name="leftMargin">
|
||||
@@ -237,7 +237,7 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_25">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is or uppercase it entirely.">Blue (Left)</string>
|
||||
<string>Blue (Left)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_25">
|
||||
<property name="leftMargin">
|
||||
@@ -271,7 +271,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_23">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">Start</string>
|
||||
<string extracomment="Leave this button name as-is or uppercase it entirely.">Start</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_23">
|
||||
<property name="leftMargin">
|
||||
@@ -356,7 +356,7 @@
|
||||
<item row="0" column="3">
|
||||
<widget class="QGroupBox" name="groupBox_28">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">Green (Right)</string>
|
||||
<string>Green (Right)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_29">
|
||||
<property name="leftMargin">
|
||||
@@ -396,7 +396,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_27">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">White (Left)</string>
|
||||
<string>White (Left)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_28">
|
||||
<property name="leftMargin">
|
||||
@@ -436,7 +436,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_29">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">Green (Left)</string>
|
||||
<string>Green (Left)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_30">
|
||||
<property name="leftMargin">
|
||||
@@ -476,7 +476,7 @@
|
||||
<item row="0" column="4">
|
||||
<widget class="QGroupBox" name="groupBox_30">
|
||||
<property name="title">
|
||||
<string extracomment="Leave this button name as-is.">White (Right)</string>
|
||||
<string>White (Right)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_31">
|
||||
<property name="leftMargin">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "Settings/ControllerGlobalSettingsWidget.h"
|
||||
@@ -26,11 +26,23 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
|
||||
#ifdef _WIN32
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLRawInput, "InputSources", "SDLRawInput", false);
|
||||
#else
|
||||
m_ui.gridLayout_2->removeWidget(m_ui.enableSDLRawInput);
|
||||
m_ui.sdlGridLayout->removeWidget(m_ui.enableSDLRawInput);
|
||||
m_ui.enableSDLRawInput->deleteLater();
|
||||
m_ui.enableSDLRawInput = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLIOKitDriver, "InputSources", "SDLIOKitDriver", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLMFIDriver, "InputSources", "SDLMFIDriver", true);
|
||||
#else
|
||||
m_ui.sdlGridLayout->removeWidget(m_ui.enableSDLIOKitDriver);
|
||||
m_ui.enableSDLIOKitDriver->deleteLater();
|
||||
m_ui.enableSDLIOKitDriver = nullptr;
|
||||
m_ui.sdlGridLayout->removeWidget(m_ui.enableSDLMFIDriver);
|
||||
m_ui.enableSDLMFIDriver->deleteLater();
|
||||
m_ui.enableSDLMFIDriver = nullptr;
|
||||
#endif
|
||||
|
||||
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableMouseMapping, "UI", "EnableMouseMapping", false);
|
||||
connect(m_ui.mouseSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::mouseSettingsClicked);
|
||||
|
||||
@@ -40,7 +52,6 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
|
||||
#ifdef _WIN32
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableXInputSource, "InputSources", "XInput", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDInputSource, "InputSources", "DInput", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.ignoreDInputInversion, "InputSources", "IgnoreDInputInversion", false);
|
||||
#else
|
||||
m_ui.mainLayout->removeWidget(m_ui.xinputGroup);
|
||||
m_ui.xinputGroup->deleteLater();
|
||||
@@ -104,6 +115,10 @@ void ControllerGlobalSettingsWidget::updateSDLOptionsEnabled()
|
||||
#ifdef _WIN32
|
||||
m_ui.enableSDLRawInput->setEnabled(enabled);
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
m_ui.enableSDLIOKitDriver->setEnabled(enabled);
|
||||
m_ui.enableSDLMFIDriver->setEnabled(enabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
||||
@@ -176,3 +191,19 @@ ControllerMouseSettingsDialog::ControllerMouseSettingsDialog(QWidget* parent, Co
|
||||
}
|
||||
|
||||
ControllerMouseSettingsDialog::~ControllerMouseSettingsDialog() = default;
|
||||
|
||||
ControllerMappingSettingsDialog::ControllerMappingSettingsDialog(ControllerSettingsWindow* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
SettingsInterface* sif = parent->getProfileSettingsInterface();
|
||||
|
||||
m_ui.icon->setPixmap(QIcon::fromTheme(QStringLiteral("settings-3-line")).pixmap(32, 32));
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.ignoreInversion, "InputSources", "IgnoreInversion", false);
|
||||
|
||||
connect(m_ui.buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &QDialog::accept);
|
||||
}
|
||||
|
||||
ControllerMappingSettingsDialog::~ControllerMappingSettingsDialog() = default;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "ui_ControllerGlobalSettingsWidget.h"
|
||||
#include "ui_ControllerLEDSettingsDialog.h"
|
||||
#include "ui_ControllerMappingSettingsDialog.h"
|
||||
#include "ui_ControllerMouseSettingsDialog.h"
|
||||
|
||||
class ControllerSettingsWindow;
|
||||
@@ -66,3 +67,15 @@ public:
|
||||
private:
|
||||
Ui::ControllerMouseSettingsDialog m_ui;
|
||||
};
|
||||
|
||||
class ControllerMappingSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ControllerMappingSettingsDialog(ControllerSettingsWindow* parent);
|
||||
~ControllerMappingSettingsDialog();
|
||||
|
||||
private:
|
||||
Ui::ControllerMappingSettingsDialog m_ui;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>902</width>
|
||||
<height>593</height>
|
||||
<height>665</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="mainLayout" columnstretch="1,0">
|
||||
@@ -31,7 +31,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>45</height>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@@ -82,16 +82,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="ignoreDInputInversion">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Some third party controllers incorrectly flag their analog sticks as inverted on the positive component, but not negative.</p><p>As a result, the analog stick will be &quot;stuck on&quot; even while resting at neutral position. </p><p>Enabling this setting will tell PCSX2 to ignore inversion flags when creating mappings, allowing such controllers to function normally.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ignore Inversion</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
@@ -136,7 +126,7 @@
|
||||
<property name="title">
|
||||
<string>SDL Input Source</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="sdlGridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="enableSDLSource">
|
||||
<property name="text">
|
||||
@@ -183,6 +173,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="enableSDLIOKitDriver">
|
||||
<property name="text">
|
||||
<string>Enable IOKit Driver</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="enableSDLMFIDriver">
|
||||
<property name="text">
|
||||
<string>Enable MFI Driver</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ControllerMappingSettingsDialog</class>
|
||||
<widget class="QDialog" name="ControllerMappingSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>654</width>
|
||||
<height>275</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Controller Mapping Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="icon">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:700;">Controller Mapping Settings</span><br/>These settings fine-tune the behavior when mapping physical controllers to the emulated controllers.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ignoreInversion">
|
||||
<property name="text">
|
||||
<string>Ignore Inversion</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Some third party controllers incorrectly flag their analog sticks as inverted on the positive component, but not negative.</p><p>As a result, the analog stick will be &quot;stuck on&quot; even while resting at neutral position. </p><p>Enabling this setting will tell PCSX2 to ignore inversion flags when creating mappings, allowing such controllers to function normally.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -39,6 +39,7 @@ ControllerSettingsWindow::ControllerSettingsWindow()
|
||||
connect(m_ui.newProfile, &QPushButton::clicked, this, &ControllerSettingsWindow::onNewProfileClicked);
|
||||
connect(m_ui.loadProfile, &QPushButton::clicked, this, &ControllerSettingsWindow::onLoadProfileClicked);
|
||||
connect(m_ui.deleteProfile, &QPushButton::clicked, this, &ControllerSettingsWindow::onDeleteProfileClicked);
|
||||
connect(m_ui.mappingSettings, &QPushButton::clicked, this, &ControllerSettingsWindow::onMappingSettingsClicked);
|
||||
connect(m_ui.restoreDefaults, &QPushButton::clicked, this, &ControllerSettingsWindow::onRestoreDefaultsClicked);
|
||||
|
||||
connect(g_emu_thread, &EmuThread::onInputDevicesEnumerated, this, &ControllerSettingsWindow::onInputDevicesEnumerated);
|
||||
@@ -186,6 +187,12 @@ void ControllerSettingsWindow::onDeleteProfileClicked()
|
||||
switchProfile({});
|
||||
}
|
||||
|
||||
void ControllerSettingsWindow::onMappingSettingsClicked()
|
||||
{
|
||||
ControllerMappingSettingsDialog dialog(this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void ControllerSettingsWindow::onRestoreDefaultsClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Restore Defaults"),
|
||||
|
||||
@@ -76,6 +76,7 @@ private Q_SLOTS:
|
||||
void onNewProfileClicked();
|
||||
void onLoadProfileClicked();
|
||||
void onDeleteProfileClicked();
|
||||
void onMappingSettingsClicked();
|
||||
void onRestoreDefaultsClicked();
|
||||
|
||||
void onInputDevicesEnumerated(const QList<QPair<QString, QString>>& devices);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1305</width>
|
||||
<height>680</height>
|
||||
<height>690</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -123,6 +123,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mappingSettings">
|
||||
<property name="text">
|
||||
<string>Mapping Settings</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="settings-3-line">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restoreDefaults">
|
||||
<property name="text">
|
||||
|
||||
@@ -253,6 +253,8 @@ DEV9SettingsWidget::DEV9SettingsWidget(SettingsWindow* dialog, QWidget* parent)
|
||||
else
|
||||
m_ui.hddFile->setText(QString::fromUtf8(m_dialog->getStringValue("DEV9/Hdd", "HddFile", "DEV9hdd.raw").value().c_str()));
|
||||
|
||||
connect(m_ui.hddLBA48, QOverload<int>::of(&QCheckBox::stateChanged), this, &DEV9SettingsWidget::onHddLBA48Changed);
|
||||
|
||||
UpdateHddSizeUIValues();
|
||||
|
||||
connect(m_ui.hddFile, &QLineEdit::textChanged, this, &DEV9SettingsWidget::onHddFileTextChange);
|
||||
@@ -720,6 +722,19 @@ void DEV9SettingsWidget::onHddSizeAccessorSpin()
|
||||
m_ui.hddSizeSlider->setValue(m_ui.hddSizeSpinBox->value());
|
||||
}
|
||||
|
||||
void DEV9SettingsWidget::onHddLBA48Changed(int state)
|
||||
{
|
||||
m_ui.hddSizeSlider->setMaximum(state ? 2000 : 120);
|
||||
m_ui.hddSizeSpinBox->setMaximum(state ? 2000 : 120);
|
||||
m_ui.hddSizeMaxLabel->setText(state ? tr("2000") : tr("120"));
|
||||
// Bump up min size to have ticks align with 100GiB sizes
|
||||
m_ui.hddSizeSlider->setMinimum(state ? 100 : 40);
|
||||
m_ui.hddSizeSpinBox->setMinimum(state ? 100 : 40);
|
||||
m_ui.hddSizeMinLabel->setText(state ? tr("100") : tr("40"));
|
||||
|
||||
m_ui.hddSizeSlider->setTickInterval(state ? 100 : 5);
|
||||
}
|
||||
|
||||
void DEV9SettingsWidget::onHddCreateClicked()
|
||||
{
|
||||
//Do the thing
|
||||
@@ -800,6 +815,11 @@ void DEV9SettingsWidget::UpdateHddSizeUIValues()
|
||||
if (size < 0)
|
||||
return;
|
||||
|
||||
if (size > static_cast<s64>(120) * 1024 * 1024 * 1024)
|
||||
m_ui.hddLBA48->setChecked(true);
|
||||
else
|
||||
m_ui.hddLBA48->setChecked(false);
|
||||
|
||||
const int sizeGB = size / 1024 / 1024 / 1024;
|
||||
QSignalBlocker sb1(m_ui.hddSizeSpinBox);
|
||||
QSignalBlocker sb2(m_ui.hddSizeSlider);
|
||||
|
||||
@@ -39,6 +39,7 @@ private Q_SLOTS:
|
||||
void onHddFileEdit();
|
||||
void onHddSizeSlide(int i);
|
||||
void onHddSizeAccessorSpin();
|
||||
void onHddLBA48Changed(int state);
|
||||
void onHddCreateClicked();
|
||||
|
||||
public:
|
||||
|
||||
@@ -365,6 +365,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="hddLBA48Label">
|
||||
<property name="text">
|
||||
<string>48-bit LBA:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="hddLBA48">
|
||||
<property name="text">
|
||||
<string>Enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -32,6 +32,9 @@ GameCheatSettingsWidget::GameCheatSettingsWidget(SettingsWindow* dialog, QWidget
|
||||
connect(m_ui.enableAll, &QPushButton::clicked, this, [this]() { setStateForAll(true); });
|
||||
connect(m_ui.disableAll, &QPushButton::clicked, this, [this]() { setStateForAll(false); });
|
||||
connect(m_ui.allCRCsCheckbox, &QCheckBox::stateChanged, this, &GameCheatSettingsWidget::onReloadClicked);
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Cheats For All CRCs"), tr("Checked"),
|
||||
tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded."));
|
||||
}
|
||||
|
||||
GameCheatSettingsWidget::~GameCheatSettingsWidget() = default;
|
||||
|
||||
@@ -40,6 +40,7 @@ private Q_SLOTS:
|
||||
void onCheatListItemChanged(QTreeWidgetItem* item, int column);
|
||||
void onReloadClicked();
|
||||
void updateListEnabled();
|
||||
void reloadList();
|
||||
|
||||
private:
|
||||
QTreeWidgetItem* getTreeWidgetParent(const std::string_view& parent);
|
||||
@@ -47,7 +48,6 @@ private:
|
||||
void setCheatEnabled(std::string name, bool enabled, bool save_and_reload_settings);
|
||||
void setStateForAll(bool enabled);
|
||||
void setStateRecursively(QTreeWidgetItem* parent, bool enabled);
|
||||
void reloadList();
|
||||
|
||||
Ui::GameCheatSettingsWidget m_ui;
|
||||
SettingsWindow* m_dialog;
|
||||
|
||||
@@ -18,7 +18,6 @@ GameFixSettingsWidget::GameFixSettingsWidget(SettingsWindow* dialog, QWidget* pa
|
||||
m_ui.setupUi(this);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.FpuMulHack, "EmuCore/Gamefixes", "FpuMulHack", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.FpuNegDivHack, "EmuCore/Gamefixes", "FpuNegDivHack", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.GoemonTlbHack, "EmuCore/Gamefixes", "GoemonTlbHack", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.SoftwareRendererFMVHack, "EmuCore/Gamefixes", "SoftwareRendererFMVHack", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.SkipMPEGHack, "EmuCore/Gamefixes", "SkipMPEGHack", false);
|
||||
@@ -38,7 +37,6 @@ GameFixSettingsWidget::GameFixSettingsWidget(SettingsWindow* dialog, QWidget* pa
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.BlitInternalFPSHack, "EmuCore/Gamefixes", "BlitInternalFPSHack", false);
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.FpuMulHack, tr("FPU Multiply Hack"), tr("Unchecked"), tr("For Tales of Destiny."));
|
||||
dialog->registerWidgetHelp(m_ui.FpuNegDivHack, tr("FPU Negative Divide Hack"), tr("Unchecked"), tr("For Gundam Games."));
|
||||
dialog->registerWidgetHelp(m_ui.GoemonTlbHack, tr("Preload TLB Hack"), tr("Unchecked"), tr("To avoid TLB miss on Goemon."));
|
||||
dialog->registerWidgetHelp(m_ui.SoftwareRendererFMVHack, tr("Use Software Renderer For FMVs"), tr("Unchecked"), tr("Needed for some games with complex FMV rendering."));
|
||||
dialog->registerWidgetHelp(m_ui.SkipMPEGHack, tr("Skip MPEG Hack"), tr("Unchecked"), tr("Skips videos/FMVs in games to avoid game hanging/freezes."));
|
||||
|
||||
@@ -56,13 +56,6 @@
|
||||
<string>Game Fixes (NOT recommended to change globally)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="FpuNegDivHack">
|
||||
<property name="text">
|
||||
<string extracomment="FPU = Floating Point Unit. A part of the PS2's CPU. Do not translate.\nNegative Divide: mathematical term.\nGundam: a multimedia franchise name. Leave as-is or use an official translation.">FPU Negative Divide Hack</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="FpuMulHack">
|
||||
<property name="text">
|
||||
|
||||
@@ -57,11 +57,15 @@ GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget
|
||||
|
||||
setUnlabeledPatchesWarningVisibility(false);
|
||||
|
||||
connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked);
|
||||
connect(m_ui.allCRCsCheckbox, &QCheckBox::stateChanged, this, &GamePatchSettingsWidget::onReloadClicked);
|
||||
SettingsInterface* sif = m_dialog->getSettingsInterface();
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.allCRCsCheckbox, "EmuCore", "ShowPatchesForAllCRCs", false);
|
||||
|
||||
connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked);
|
||||
connect(m_ui.allCRCsCheckbox, &QCheckBox::stateChanged, this, &GamePatchSettingsWidget::reloadList);
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Patches For All CRCs"), tr("Checked"),
|
||||
tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded."));
|
||||
|
||||
reloadList();
|
||||
}
|
||||
|
||||
@@ -133,6 +137,7 @@ void GamePatchSettingsWidget::reloadList()
|
||||
m_ui.scrollArea->setWidget(container);
|
||||
}
|
||||
|
||||
void GamePatchSettingsWidget::setUnlabeledPatchesWarningVisibility(bool visible) {
|
||||
void GamePatchSettingsWidget::setUnlabeledPatchesWarningVisibility(bool visible)
|
||||
{
|
||||
m_ui.unlabeledPatchWarning->setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,6 +300,26 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get rid of widescreen/no-interlace checkboxes from per-game settings, unless the user previously had them set.
|
||||
if (m_dialog->isPerGameSettings())
|
||||
{
|
||||
if ((m_dialog->containsSettingValue("EmuCore", "EnableWideScreenPatches") || m_dialog->containsSettingValue("EmuCore", "EnableNoInterlacingPatches")) &&
|
||||
QMessageBox::question(QtUtils::GetRootWidget(this), tr("Remove Unsupported Settings"),
|
||||
tr("You currently have the <strong>Enable Widescreen Patches</strong> or <strong>Enable No-Interlacing Patches</strong> options enabled for this game.<br><br>"
|
||||
"We no longer support these options, instead <strong>you should select the \"Patches\" section, and explicitly enable the patches you want.</strong><br><br>"
|
||||
"Do you want to remove these options from your game configuration now?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
|
||||
{
|
||||
m_dialog->removeSettingValue("EmuCore", "EnableWideScreenPatches");
|
||||
m_dialog->removeSettingValue("EmuCore", "EnableNoInterlacingPatches");
|
||||
}
|
||||
|
||||
m_ui.gridLayout->removeWidget(m_ui.widescreenPatches);
|
||||
m_ui.gridLayout->removeWidget(m_ui.noInterlacingPatches);
|
||||
safe_delete(m_ui.widescreenPatches);
|
||||
safe_delete(m_ui.noInterlacingPatches);
|
||||
}
|
||||
|
||||
// Hide advanced options by default.
|
||||
if (!QtHost::ShouldShowAdvancedSettings())
|
||||
{
|
||||
@@ -714,7 +734,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
|
||||
"<b>If unsure, leave it on default.<b>"));
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.audioCaptureBitrate, tr("Audio Bitrate"), tr("160 Kbps"), tr("Sets the audio bitrate to be used."));
|
||||
dialog->registerWidgetHelp(m_ui.audioCaptureBitrate, tr("Audio Bitrate"), tr("160 kbps"), tr("Sets the audio bitrate to be used."));
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.enableAudioCaptureArguments, tr("Enable Extra Audio Arguments"), tr("Unchecked"), tr("Allows you to pass arguments to the selected audio codec."));
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<layout class="QGridLayout" name="displayGridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="PCRTCOffsets">
|
||||
<property name="text">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "common/FileSystem.h"
|
||||
@@ -36,7 +36,13 @@ MemoryCardCreateDialog::MemoryCardCreateDialog(QWidget* parent /* = nullptr */)
|
||||
connect(m_ui.buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &MemoryCardCreateDialog::restoreDefaults);
|
||||
|
||||
#ifndef _WIN32
|
||||
m_ui.ntfsCompression->setEnabled(false);
|
||||
m_ui.ntfsCompressionLayout->removeWidget(m_ui.ntfsCompression);
|
||||
safe_delete(m_ui.ntfsCompression);
|
||||
m_ui.ntfsCompressionLayout->removeWidget(m_ui.ntfsCompressionLabel);
|
||||
safe_delete(m_ui.ntfsCompressionLabel);
|
||||
m_ui.mainLayout->removeItem(m_ui.ntfsCompressionLayout);
|
||||
safe_delete(m_ui.ntfsCompressionLayout);
|
||||
resize(600, 480);
|
||||
#endif
|
||||
|
||||
updateState();
|
||||
@@ -117,10 +123,10 @@ void MemoryCardCreateDialog::createCard()
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (m_ui.ntfsCompression->isChecked() && m_type == MemoryCardType::File)
|
||||
if (m_type == MemoryCardType::File)
|
||||
{
|
||||
const std::string fullPath(Path::Combine(EmuFolders::MemoryCards, name_str));
|
||||
FileSystem::SetPathCompression(fullPath.c_str(), true);
|
||||
const std::string fullPath = Path::Combine(EmuFolders::MemoryCards, name_str);
|
||||
FileSystem::SetPathCompression(fullPath.c_str(), m_ui.ntfsCompression->isChecked());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>593</width>
|
||||
<height>545</height>
|
||||
<width>600</width>
|
||||
<height>535</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -16,13 +16,13 @@
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<layout class="QVBoxLayout" name="mainLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<property name="bottomMargin">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -39,8 +39,8 @@
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources/resources.qrc">:/icons/black/svg/memcard-line.svg</pixmap>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../resources/resources.qrc">:/icons/black/svg/memcard-line.svg</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
@@ -227,7 +227,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<layout class="QVBoxLayout" name="ntfsCompressionLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ntfsCompression">
|
||||
<property name="text">
|
||||
@@ -239,7 +239,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<widget class="QLabel" name="ntfsCompressionLabel">
|
||||
<property name="text">
|
||||
<string>NTFS compression is built-in, fast, and completely reliable. Typically compresses Memory Cards (highly recommended).</string>
|
||||
</property>
|
||||
|
||||
@@ -54,7 +54,6 @@ MemoryCardSettingsWidget::MemoryCardSettingsWidget(SettingsWindow* dialog, QWidg
|
||||
|
||||
connect(m_ui.refreshCard, &QPushButton::clicked, this, &MemoryCardSettingsWidget::refresh);
|
||||
connect(m_ui.createCard, &QPushButton::clicked, this, &MemoryCardSettingsWidget::createCard);
|
||||
connect(m_ui.duplicateCard, &QPushButton::clicked, this, &MemoryCardSettingsWidget::duplicateCard);
|
||||
connect(m_ui.renameCard, &QPushButton::clicked, this, &MemoryCardSettingsWidget::renameCard);
|
||||
connect(m_ui.convertCard, &QPushButton::clicked, this, &MemoryCardSettingsWidget::convertCard);
|
||||
connect(m_ui.deleteCard, &QPushButton::clicked, this, &MemoryCardSettingsWidget::deleteCard);
|
||||
@@ -89,22 +88,22 @@ void MemoryCardSettingsWidget::setupAdditionalUi()
|
||||
createSlotWidgets(&m_slots[i], i);
|
||||
|
||||
// button to swap Memory Cards
|
||||
QToolButton* swap_button = new QToolButton(m_ui.portGroupBox);
|
||||
QToolButton* swap_button = new QToolButton(m_ui.slotGroupBox);
|
||||
swap_button->setIcon(QIcon::fromTheme("arrow-left-right-line"));
|
||||
swap_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
swap_button->setToolTip(tr("Swap Memory Cards"));
|
||||
connect(swap_button, &QToolButton::clicked, this, &MemoryCardSettingsWidget::swapCards);
|
||||
static_cast<QGridLayout*>(m_ui.portGroupBox->layout())->addWidget(swap_button, 0, 1);
|
||||
static_cast<QGridLayout*>(m_ui.slotGroupBox->layout())->addWidget(swap_button, 0, 1);
|
||||
}
|
||||
|
||||
void MemoryCardSettingsWidget::createSlotWidgets(SlotGroup* port, u32 slot)
|
||||
{
|
||||
const bool perGame = m_dialog->isPerGameSettings();
|
||||
|
||||
port->root = new QWidget(m_ui.portGroupBox);
|
||||
port->root = new QWidget(m_ui.slotGroupBox);
|
||||
|
||||
SettingsInterface* sif = m_dialog->getSettingsInterface();
|
||||
port->enable = new QCheckBox(tr("Port %1").arg(slot + 1), port->root);
|
||||
port->enable = new QCheckBox(tr("Slot %1").arg(slot + 1), port->root);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(
|
||||
sif, port->enable, CONFIG_SECTION, StringUtil::StdStringFromFormat("Slot%u_Enable", slot + 1), true);
|
||||
connect(port->enable, &QCheckBox::stateChanged, this, &MemoryCardSettingsWidget::refresh);
|
||||
@@ -129,7 +128,7 @@ void MemoryCardSettingsWidget::createSlotWidgets(SlotGroup* port, u32 slot)
|
||||
vert_layout->addWidget(port->enable, 0);
|
||||
vert_layout->addLayout(bottom_layout, 1);
|
||||
|
||||
static_cast<QGridLayout*>(m_ui.portGroupBox->layout())->addWidget(port->root, 0, (slot != 0) ? 2 : 0);
|
||||
static_cast<QGridLayout*>(m_ui.slotGroupBox->layout())->addWidget(port->root, 0, (slot != 0) ? 2 : 0);
|
||||
}
|
||||
|
||||
void MemoryCardSettingsWidget::autoSizeUI()
|
||||
@@ -193,20 +192,10 @@ void MemoryCardSettingsWidget::updateCardActions()
|
||||
bool isPS1 = (cardInfo.has_value() ? cardInfo.value().file_type == MemoryCardFileType::PS1 : false);
|
||||
|
||||
m_ui.convertCard->setEnabled(hasSelection && !isPS1);
|
||||
m_ui.duplicateCard->setEnabled(hasSelection);
|
||||
m_ui.renameCard->setEnabled(hasSelection);
|
||||
m_ui.deleteCard->setEnabled(hasSelection);
|
||||
}
|
||||
|
||||
void MemoryCardSettingsWidget::duplicateCard()
|
||||
{
|
||||
const QString selectedCard(getSelectedCard());
|
||||
if (selectedCard.isEmpty())
|
||||
return;
|
||||
|
||||
QMessageBox::critical(this, tr("Error"), tr("Not yet implemented."));
|
||||
}
|
||||
|
||||
void MemoryCardSettingsWidget::deleteCard()
|
||||
{
|
||||
const QString selectedCard(getSelectedCard());
|
||||
@@ -289,12 +278,11 @@ void MemoryCardSettingsWidget::listContextMenuRequested(const QPoint& pos)
|
||||
{
|
||||
for (u32 slot = 0; slot < MAX_SLOTS; slot++)
|
||||
{
|
||||
connect(menu.addAction(tr("Use for Port %1").arg(slot + 1)), &QAction::triggered, this,
|
||||
connect(menu.addAction(tr("Use for Slot %1").arg(slot + 1)), &QAction::triggered, this,
|
||||
[this, &selectedCard, slot]() { tryInsertCard(slot, selectedCard); });
|
||||
}
|
||||
menu.addSeparator();
|
||||
|
||||
connect(menu.addAction(tr("Duplicate")), &QAction::triggered, this, &MemoryCardSettingsWidget::duplicateCard);
|
||||
connect(menu.addAction(tr("Rename")), &QAction::triggered, this, &MemoryCardSettingsWidget::renameCard);
|
||||
connect(menu.addAction(tr("Convert")), &QAction::triggered, this, &MemoryCardSettingsWidget::convertCard);
|
||||
connect(menu.addAction(tr("Delete")), &QAction::triggered, this, &MemoryCardSettingsWidget::deleteCard);
|
||||
@@ -336,7 +324,7 @@ void MemoryCardSettingsWidget::swapCards()
|
||||
if (!card1Name.has_value() || card1Name->empty() || !card2Name.has_value() || card2Name->empty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
QtUtils::GetRootWidget(this), tr("Error"), tr("Both ports must have a card selected to swap."));
|
||||
QtUtils::GetRootWidget(this), tr("Error"), tr("Both slots must have a card selected to swap."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ private:
|
||||
|
||||
QString getSelectedCard() const;
|
||||
void updateCardActions();
|
||||
void duplicateCard();
|
||||
void deleteCard();
|
||||
void renameCard();
|
||||
void convertCard();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="portGroupBox">
|
||||
<widget class="QGroupBox" name="slotGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -44,7 +44,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Console Ports</string>
|
||||
<string>Memory Card Slots</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout"/>
|
||||
</widget>
|
||||
@@ -146,13 +146,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="duplicateCard">
|
||||
<property name="text">
|
||||
<string>Duplicate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="renameCard">
|
||||
<property name="text">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#include "MainWindow.h"
|
||||
@@ -32,7 +32,9 @@
|
||||
#include "common/Path.h"
|
||||
#include "common/StringUtil.h"
|
||||
|
||||
#include <QtGui/QWheelEvent>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QScrollBar>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
|
||||
static QList<SettingsWindow*> s_open_game_properties_dialogs;
|
||||
@@ -110,7 +112,7 @@ void SettingsWindow::setupUi(const GameList::Entry* game)
|
||||
addWidget(m_interface_settings = new InterfaceSettingsWidget(this, m_ui.settingsContainer), tr("Interface"),
|
||||
QStringLiteral("interface-line"),
|
||||
tr("<strong>Interface Settings</strong><hr>These options control how the software looks and behaves.<br><br>Mouse over an option "
|
||||
"for additional information."));
|
||||
"for additional information, and Shift+Wheel to scroll this panel."));
|
||||
|
||||
// We don't include game list/bios settings in per-game settings.
|
||||
if (!isPerGameSettings())
|
||||
@@ -120,14 +122,15 @@ void SettingsWindow::setupUi(const GameList::Entry* game)
|
||||
tr("<strong>Game List Settings</strong><hr>The list above shows the directories which will be searched by PCSX2 to populate "
|
||||
"the game list. Search directories can be added, removed, and switched to recursive/non-recursive."));
|
||||
addWidget(m_bios_settings = new BIOSSettingsWidget(this, m_ui.settingsContainer), tr("BIOS"), QStringLiteral("chip-line"),
|
||||
tr("<strong>BIOS Settings</strong><hr>Configure your BIOS here.<br><br>Mouse over an option for additional information."));
|
||||
tr("<strong>BIOS Settings</strong><hr>Configure your BIOS here.<br><br>Mouse over an option for additional information, "
|
||||
"and Shift+Wheel to scroll this panel."));
|
||||
}
|
||||
|
||||
// Common to both per-game and global settings.
|
||||
addWidget(m_emulation_settings = new EmulationSettingsWidget(this, m_ui.settingsContainer), tr("Emulation"),
|
||||
QStringLiteral("emulation-line"),
|
||||
tr("<strong>Emulation Settings</strong><hr>These options determine the configuration of frame pacing and game "
|
||||
"settings.<br><br>Mouse over an option for additional information."));
|
||||
"settings.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
|
||||
|
||||
if (isPerGameSettings())
|
||||
{
|
||||
@@ -153,19 +156,19 @@ void SettingsWindow::setupUi(const GameList::Entry* game)
|
||||
|
||||
addWidget(m_graphics_settings = new GraphicsSettingsWidget(this, m_ui.settingsContainer), tr("Graphics"), QStringLiteral("image-fill"),
|
||||
tr("<strong>Graphics Settings</strong><hr>These options determine the configuration of the graphical output.<br><br>Mouse over an "
|
||||
"option for additional information."));
|
||||
"option for additional information, and Shift+Wheel to scroll this panel."));
|
||||
addWidget(m_audio_settings = new AudioSettingsWidget(this, m_ui.settingsContainer), tr("Audio"), QStringLiteral("volume-up-line"),
|
||||
tr("<strong>Audio Settings</strong><hr>These options control the audio output of the console.<br><br>Mouse over an option for "
|
||||
"additional information."));
|
||||
"additional information, and Shift+Wheel to scroll this panel."));
|
||||
|
||||
addWidget(m_memory_card_settings = new MemoryCardSettingsWidget(this, m_ui.settingsContainer), tr("Memory Cards"),
|
||||
QStringLiteral("memcard-line"),
|
||||
tr("<strong>Memory Card Settings</strong><hr>Create and configure Memory Cards here.<br><br>Mouse over an option for "
|
||||
"additional information."));
|
||||
"additional information, and Shift+Wheel to scroll this panel."));
|
||||
|
||||
addWidget(m_dev9_settings = new DEV9SettingsWidget(this, m_ui.settingsContainer), tr("Network & HDD"), QStringLiteral("global-line"),
|
||||
tr("<strong>Network & HDD Settings</strong><hr>These options control the network connectivity and internal HDD storage of the "
|
||||
"console.<br><br>Mouse over an option for additional information."));
|
||||
"console.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
|
||||
|
||||
if (!isPerGameSettings())
|
||||
{
|
||||
@@ -199,9 +202,9 @@ void SettingsWindow::setupUi(const GameList::Entry* game)
|
||||
addWidget(m_advanced_settings = new AdvancedSettingsWidget(this, m_ui.settingsContainer), tr("Advanced"),
|
||||
QStringLiteral("warning-line"),
|
||||
tr("<strong>Advanced Settings</strong><hr>These are advanced options to determine the configuration of the simulated "
|
||||
"console.<br><br>Mouse over an option for additional information."));
|
||||
"console.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
|
||||
addWidget(m_debug_settings = new DebugSettingsWidget(this, m_ui.settingsContainer), tr("Debug"),
|
||||
QStringLiteral("heart-monitor-line"),
|
||||
QStringLiteral("debugger-line"),
|
||||
tr("<strong>Debug Settings</strong><hr>These are options which can be used to log internal information about the application. "
|
||||
"<strong>Do not modify unless you know what you are doing</strong>, it will cause significant slowdown, and can waste large "
|
||||
"amounts of disk space."));
|
||||
@@ -399,10 +402,38 @@ bool SettingsWindow::eventFilter(QObject* object, QEvent* event)
|
||||
m_ui.helpText->setText(m_category_help_text[m_ui.settingsCategory->currentRow()]);
|
||||
}
|
||||
}
|
||||
else if (event->type() == QEvent::Wheel)
|
||||
{
|
||||
if (handleWheelEvent(static_cast<QWheelEvent*>(event)))
|
||||
return true;
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(object, event);
|
||||
}
|
||||
|
||||
bool SettingsWindow::handleWheelEvent(QWheelEvent* event)
|
||||
{
|
||||
if (!(event->modifiers() & Qt::ShiftModifier))
|
||||
return false;
|
||||
|
||||
const int amount = event->hasPixelDelta() ? event->pixelDelta().y() : (event->angleDelta().y() / 20);
|
||||
|
||||
QScrollBar* sb = m_ui.helpText->verticalScrollBar();
|
||||
if (!sb)
|
||||
return false;
|
||||
|
||||
sb->setSliderPosition(std::max(sb->sliderPosition() - amount, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
void SettingsWindow::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
if (handleWheelEvent(event))
|
||||
return;
|
||||
|
||||
QWidget::wheelEvent(event);
|
||||
}
|
||||
|
||||
void SettingsWindow::setWindowTitle(const QString& title)
|
||||
{
|
||||
if (m_filename.isEmpty())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
||||
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
|
||||
#pragma once
|
||||
@@ -9,12 +9,14 @@
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
class QWheelEvent;
|
||||
|
||||
class INISettingsInterface;
|
||||
class SettingsInterface;
|
||||
|
||||
namespace GameList
|
||||
{
|
||||
struct Entry;
|
||||
struct Entry;
|
||||
}
|
||||
|
||||
class InterfaceSettingsWidget;
|
||||
@@ -103,6 +105,7 @@ private Q_SLOTS:
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
private:
|
||||
enum : u32
|
||||
@@ -113,6 +116,7 @@ private:
|
||||
void setupUi(const GameList::Entry* game);
|
||||
|
||||
void addWidget(QWidget* widget, QString title, QString icon, QString help_text);
|
||||
bool handleWheelEvent(QWheelEvent* event);
|
||||
|
||||
SettingsWindow* reopen();
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ void SetupWizardDialog::themeChanged()
|
||||
void SetupWizardDialog::languageChanged()
|
||||
{
|
||||
// Skip the recreation, since we don't have many dynamic UI elements.
|
||||
QtHost::InstallTranslator();
|
||||
QtHost::InstallTranslator(this);
|
||||
m_ui.retranslateUi(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<enum>Qt::TextBrowserInteraction</enum>
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -233,6 +233,12 @@
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -336,7 +342,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>PCSX2 will automatically scan and identify games from the selected directories below, and populate the game list.<br>These games should be dumped from discs you own. Guides for dumping discs can be found at <a href="https://pcsx2.net/docs/usage/setup/#dumping-ps2-discs-via-imgburn">pcsx2.net</a>.</p><p>Supported formats for dumps include:</p><p><ul><li>.bin/.iso (ISO Disc Images)</li><li>.mdf (Media Descriptor File)</li><li>.chd (Compressed Hunks of Data)</li><li>.cso (Compressed ISO)</li><li>.gz (Gzip Compressed ISO)</li></ul></p></p></body></html></string>
|
||||
<string><html><head/><body><p>PCSX2 will automatically scan and identify games from the selected directories below, and populate the game list.<br>These games should be dumped from discs you own. Guides for dumping discs can be found at <a href="https://pcsx2.net/docs/usage/setup/#dumping-ps2-discs-via-imgburn">pcsx2.net</a>.</p><p>Supported formats for dumps include:</p><p><ul><li>.bin/.iso (ISO Disc Images)</li><li>.mdf (Media Descriptor File)</li><li>.chd (Compressed Hunks of Data)</li><li>.cso (Compressed ISO)</li><li>.zso (Compressed ISO)</li><li>.gz (Gzip Compressed ISO)</li></ul></p></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
@@ -344,6 +350,12 @@
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
+7
-2
@@ -476,9 +476,14 @@ void QtHost::SetStyleFromSettings()
|
||||
}
|
||||
}
|
||||
|
||||
void QtHost::SetIconThemeFromStyle()
|
||||
bool QtHost::IsDarkApplicationTheme()
|
||||
{
|
||||
QPalette palette = qApp->palette();
|
||||
bool dark = palette.windowText().color().value() > palette.window().color().value();
|
||||
return (palette.windowText().color().value() > palette.window().color().value());
|
||||
}
|
||||
|
||||
void QtHost::SetIconThemeFromStyle()
|
||||
{
|
||||
const bool dark = IsDarkApplicationTheme();
|
||||
QIcon::setThemeName(dark ? QStringLiteral("white") : QStringLiteral("black"));
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ QTableWidgetItem* InputRecordingViewer::createRowItem(std::tuple<bool, u8> butto
|
||||
|
||||
void InputRecordingViewer::loadTable()
|
||||
{
|
||||
static const auto headers = QStringList({tr("Left Analog"), tr("Right Analog"), tr("Cross"), tr("Square"), tr("Triangle"), tr("Circle"), tr("L1"), tr("R1"), tr("L2"), tr("R2"), tr("D-Pad Down"), tr("D-Pad Right️"), tr("D-Pad Up️"), tr("D-Pad Left️"), tr("L3"), tr("R3"), tr("Select"), tr("Start")});
|
||||
static const auto headers = QStringList({tr("Left Analog"), tr("Right Analog"), tr("Cross"), tr("Square"), tr("Triangle"), tr("Circle"), tr("L1"), tr("R1"), tr("L2"), tr("R2"), tr("D-Pad Down"), tr("D-Pad Right"), tr("D-Pad Up"), tr("D-Pad Left"), tr("L3"), tr("R3"), tr("Select"), tr("Start")});
|
||||
m_ui.tableWidget->setColumnCount(headers.length());
|
||||
m_ui.tableWidget->setHorizontalHeaderLabels(headers);
|
||||
|
||||
@@ -111,4 +111,4 @@ void InputRecordingViewer::closeFile()
|
||||
}
|
||||
} // TODO else error
|
||||
m_ui.actionClose->setEnabled(m_file_open);
|
||||
}
|
||||
}
|
||||
|
||||
+102
-70
File diff suppressed because one or more lines are too long
+4424
-3574
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user