mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16b1095a7b | ||
|
|
3b5b3ffa91 | ||
|
|
7ebcca36d2 | ||
|
|
501c543d1b | ||
|
|
4dafea65f2 | ||
|
|
e7cdd89577 | ||
|
|
1a508439b3 | ||
|
|
3548d103f4 | ||
|
|
b1d4101490 | ||
|
|
a714582c1c | ||
|
|
0e7da0f1a8 | ||
|
|
4f7c8a77f6 | ||
|
|
1842fe6db8 | ||
|
|
1feb31498d | ||
|
|
f3632c44c8 | ||
|
|
32a6e62212 | ||
|
|
575ec07553 | ||
|
|
18308b6525 | ||
|
|
d52f29dcd7 | ||
|
|
288d8047ae | ||
|
|
26b232292c | ||
|
|
1fff69b0aa | ||
|
|
4d347305b5 | ||
|
|
2fd6f8e4ac | ||
|
|
97f316eca7 | ||
|
|
f7ba355697 | ||
|
|
c334040a96 | ||
|
|
b01359e06f | ||
|
|
905f9431a5 | ||
|
|
424951e1bb | ||
|
|
2167d9e4f5 | ||
|
|
82a38a7124 | ||
|
|
eb6a52c55c | ||
|
|
234b8f6abf | ||
|
|
843566eb49 | ||
|
|
d63733830f | ||
|
|
3ebd496c37 | ||
|
|
f0f2b013fc | ||
|
|
9a75509614 | ||
|
|
c513a29bcf | ||
|
|
5d39c884b5 | ||
|
|
6a0f811812 | ||
|
|
f509fb6950 | ||
|
|
33a475a456 | ||
|
|
d2fb90a700 | ||
|
|
a34467dccd | ||
|
|
c6d0f5e3cd | ||
|
|
34c9590cf1 | ||
|
|
a2c7542e48 | ||
|
|
72a9f18456 | ||
|
|
7f59757eea | ||
|
|
3b89020082 | ||
|
|
a7b07eb53f | ||
|
|
58d13dac34 | ||
|
|
5a8921dd22 | ||
|
|
f964dfaa5e | ||
|
|
17274eb397 | ||
|
|
2f0b00a7a1 | ||
|
|
260380abec | ||
|
|
57fc87061d | ||
|
|
cc9f7e723a | ||
|
|
6a41e05694 | ||
|
|
c8e1dc5328 | ||
|
|
c2ee5a0234 | ||
|
|
3cafd2dc69 |
@@ -22,7 +22,7 @@ jobs:
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
title: "PAD: Update to latest controller database"
|
||||
commit-message: "PAD: Update to latest controller database."
|
||||
commit-message: "[ci skip] PAD: Update to latest controller database."
|
||||
committer: "PCSX2 Bot <PCSX2Bot@users.noreply.github.com>"
|
||||
author: "PCSX2 Bot <PCSX2Bot@users.noreply.github.com>"
|
||||
body: "Weekly automatic update of SDL Controller DB."
|
||||
|
||||
@@ -206,7 +206,7 @@ GIT_VERSION=$(git tag --points-at HEAD)
|
||||
|
||||
if [[ "${GIT_VERSION}" == "" ]]; then
|
||||
# In the odd event that we run this script before the release gets tagged.
|
||||
GIT_VERSION=$(git describe --tags)
|
||||
GIT_VERSION=$(git describe --tags || true)
|
||||
if [[ "${GIT_VERSION}" == "" ]]; then
|
||||
GIT_VERSION=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
@@ -19,7 +19,7 @@ LIBJPEG=9f
|
||||
LIBPNG=1.6.44
|
||||
LIBWEBP=1.4.0
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
SDL=SDL2-2.30.10
|
||||
SDL=SDL2-2.30.11
|
||||
QT=6.8.1
|
||||
ZSTD=1.5.6
|
||||
|
||||
@@ -37,7 +37,7 @@ fd6f417fe9e3a071cf1424a5152d926a34c4a3c5070745470be6cf12a404ed79 $LIBBACKTRACE.
|
||||
60c4da1d5b7f0aa8d158da48e8f8afa9773c1c8baa5d21974df61f1886b8ce8e libpng-$LIBPNG.tar.xz
|
||||
61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 libwebp-$LIBWEBP.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
f59adf36a0fcf4c94198e7d3d776c1b3824211ab7aeebeb31fe19836661196aa $SDL.tar.gz
|
||||
8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f $SDL.tar.gz
|
||||
8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 zstd-$ZSTD.tar.gz
|
||||
40b14562ef3bd779bc0e0418ea2ae08fa28235f8ea6e8c0cb3bce1d6ad58dcaf qtbase-everywhere-src-$QT.tar.xz
|
||||
138cc2909aa98f5ff7283e36eb3936eb5e625d3ca3b4febae2ca21d8903dd237 qtimageformats-everywhere-src-$QT.tar.xz
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://libsdl.org/release/SDL2-2.30.10.tar.gz",
|
||||
"sha256": "f59adf36a0fcf4c94198e7d3d776c1b3824211ab7aeebeb31fe19836661196aa"
|
||||
"url": "https://libsdl.org/release/SDL2-2.30.11.tar.gz",
|
||||
"sha256": "8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f"
|
||||
}
|
||||
],
|
||||
"cleanup": [
|
||||
|
||||
@@ -40,7 +40,7 @@ fi
|
||||
|
||||
FREETYPE=2.13.3
|
||||
HARFBUZZ=10.0.1
|
||||
SDL=SDL2-2.30.10
|
||||
SDL=SDL2-2.30.11
|
||||
ZSTD=1.5.6
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
LIBPNG=1.6.44
|
||||
@@ -76,7 +76,7 @@ CMAKE_ARCH_UNIVERSAL=-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
|
||||
cat > SHASUMS <<EOF
|
||||
0550350666d427c74daeb85d5ac7bb353acba5f76956395995311a9c6f063289 freetype-$FREETYPE.tar.xz
|
||||
e7358ea86fe10fb9261931af6f010d4358dac64f7074420ca9bc94aae2bdd542 harfbuzz-$HARFBUZZ.tar.gz
|
||||
f59adf36a0fcf4c94198e7d3d776c1b3824211ab7aeebeb31fe19836661196aa $SDL.tar.gz
|
||||
8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f $SDL.tar.gz
|
||||
8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 zstd-$ZSTD.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
60c4da1d5b7f0aa8d158da48e8f8afa9773c1c8baa5d21974df61f1886b8ce8e libpng-$LIBPNG.tar.xz
|
||||
|
||||
@@ -22,7 +22,7 @@ fi
|
||||
|
||||
FREETYPE=2.13.3
|
||||
HARFBUZZ=10.0.1
|
||||
SDL=SDL2-2.30.10
|
||||
SDL=SDL2-2.30.11
|
||||
ZSTD=1.5.6
|
||||
LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
LIBPNG=1.6.44
|
||||
@@ -56,7 +56,7 @@ CMAKE_COMMON=(
|
||||
cat > SHASUMS <<EOF
|
||||
0550350666d427c74daeb85d5ac7bb353acba5f76956395995311a9c6f063289 freetype-$FREETYPE.tar.xz
|
||||
e7358ea86fe10fb9261931af6f010d4358dac64f7074420ca9bc94aae2bdd542 harfbuzz-$HARFBUZZ.tar.gz
|
||||
f59adf36a0fcf4c94198e7d3d776c1b3824211ab7aeebeb31fe19836661196aa $SDL.tar.gz
|
||||
8b8d4aef2038533da814965220f88f77d60dfa0f32685f80ead65e501337da7f $SDL.tar.gz
|
||||
8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1 zstd-$ZSTD.tar.gz
|
||||
0728800155f3ed0a0c87e03addbd30ecbe374f7b080678bbca1506051d50dec3 $LZ4.tar.gz
|
||||
60c4da1d5b7f0aa8d158da48e8f8afa9773c1c8baa5d21974df61f1886b8ce8e libpng-$LIBPNG.tar.xz
|
||||
|
||||
@@ -49,7 +49,7 @@ set LIBPNG=1643
|
||||
set LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
set QT=6.8.1
|
||||
set QTMINOR=6.8
|
||||
set SDL=SDL2-2.30.10
|
||||
set SDL=SDL2-2.30.11
|
||||
set WEBP=1.4.0
|
||||
set ZLIB=1.3.1
|
||||
set ZLIBSHORT=131
|
||||
@@ -66,7 +66,7 @@ call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lp
|
||||
call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error
|
||||
call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 || goto error
|
||||
call :downloadfile "lz4-%LZ4%.zip" "https://github.com/lz4/lz4/archive/%LZ4%.zip" 0c33119688d6b180c7e760b0acd70059222389cfd581632623784bee27e51a31 || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" 14b06b30d3400953875e73b0c4771cad1483488a1ef816803610f22b32300ce8 || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" a0b3e7ac5f708042683ff0f22e069bdf75563540c615f9854ecc9bc8913e2488 || goto error
|
||||
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" e22d997bd15b795a176c8da62c8c1da0a674eb534e02f7c01ca507bf11bce0c3 || goto error
|
||||
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 247a0a58039275a5a4fb499a600a90f66dc6e00321bb6f86a9b8d8020344d853 || goto error
|
||||
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 57bd332e5550ff70a852560c591b786b6ba587c5e41cb5ef91038d82db137ab9 || goto error
|
||||
|
||||
@@ -47,7 +47,7 @@ set LIBPNG=1643
|
||||
set LZ4=b8fd2d15309dd4e605070bd4486e26b6ef814e29
|
||||
set QT=6.8.1
|
||||
set QTMINOR=6.8
|
||||
set SDL=SDL2-2.30.10
|
||||
set SDL=SDL2-2.30.11
|
||||
set WEBP=1.4.0
|
||||
set ZLIB=1.3.1
|
||||
set ZLIBSHORT=131
|
||||
@@ -64,7 +64,7 @@ call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lp
|
||||
call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error
|
||||
call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 61f873ec69e3be1b99535634340d5bde750b2e4447caa1db9f61be3fd49ab1e5 || goto error
|
||||
call :downloadfile "lz4-%LZ4%.zip" "https://github.com/lz4/lz4/archive/%LZ4%.zip" 0c33119688d6b180c7e760b0acd70059222389cfd581632623784bee27e51a31 || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" 14b06b30d3400953875e73b0c4771cad1483488a1ef816803610f22b32300ce8 || goto error
|
||||
call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" a0b3e7ac5f708042683ff0f22e069bdf75563540c615f9854ecc9bc8913e2488 || goto error
|
||||
call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" e22d997bd15b795a176c8da62c8c1da0a674eb534e02f7c01ca507bf11bce0c3 || goto error
|
||||
call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 247a0a58039275a5a4fb499a600a90f66dc6e00321bb6f86a9b8d8020344d853 || goto error
|
||||
call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 57bd332e5550ff70a852560c591b786b6ba587c5e41cb5ef91038d82db137ab9 || goto error
|
||||
|
||||
3031
3rdparty/include/xxhash.h
vendored
3031
3rdparty/include/xxhash.h
vendored
File diff suppressed because it is too large
Load Diff
26
3rdparty/libchdr/include/libchdr/cdrom.h
vendored
26
3rdparty/libchdr/include/libchdr/cdrom.h
vendored
@@ -10,12 +10,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifndef __CDROM_H__
|
||||
#define __CDROM_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <libchdr/chdconfig.h>
|
||||
|
||||
/***************************************************************************
|
||||
@@ -49,15 +47,11 @@ enum
|
||||
|
||||
enum
|
||||
{
|
||||
CD_SUB_NONE = 0, /* no subcode data stored */
|
||||
CD_SUB_RAW_INTERLEAVED, /* raw interleaved 96 bytes per sector */
|
||||
CD_SUB_RAW, /* raw non-interleaved 96 bytes per sector */
|
||||
CD_SUB_NORMAL = 0, /* "cooked" 96 bytes per sector */
|
||||
CD_SUB_RAW, /* raw uninterleaved 96 bytes per sector */
|
||||
CD_SUB_NONE /* no subcode data stored */
|
||||
};
|
||||
|
||||
const char* cdrom_get_subtype_string(uint32_t subtype);
|
||||
bool cdrom_parse_subtype_string(const char* typestring, uint32_t* subtype, uint32_t* subsize);
|
||||
|
||||
|
||||
#define CD_FLAG_GDROM 0x00000001 /* disc is a GD-ROM, all tracks should be stored with GD-ROM metadata */
|
||||
#define CD_FLAG_GDROMLE 0x00000002 /* legacy GD-ROM, with little-endian CDDA data */
|
||||
|
||||
@@ -87,10 +81,10 @@ static inline uint32_t lba_to_msf(uint32_t lba)
|
||||
{
|
||||
uint8_t m, s, f;
|
||||
|
||||
m = (uint8_t)(lba / (60 * 75));
|
||||
m = lba / (60 * 75);
|
||||
lba -= m * (60 * 75);
|
||||
s = (uint8_t)(lba / 75);
|
||||
f = (uint8_t)(lba % 75);
|
||||
s = lba / 75;
|
||||
f = lba % 75;
|
||||
|
||||
return ((m / 10) << 20) | ((m % 10) << 16) |
|
||||
((s / 10) << 12) | ((s % 10) << 8) |
|
||||
@@ -113,6 +107,4 @@ static inline uint32_t lba_to_msf_alt(int lba)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
#endif /* __CDROM_H__ */
|
||||
|
||||
205
3rdparty/libchdr/include/libchdr/chd.h
vendored
205
3rdparty/libchdr/include/libchdr/chd.h
vendored
@@ -48,7 +48,6 @@ extern "C" {
|
||||
|
||||
#include <libchdr/coretypes.h>
|
||||
#include <libchdr/chdconfig.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@@ -59,67 +58,67 @@ extern "C" {
|
||||
V1 header:
|
||||
|
||||
[ 0] char tag[8]; // 'MComprHD'
|
||||
[ 8] UINT32 length; // length of header (including tag and length fields)
|
||||
[ 12] UINT32 version; // drive format version
|
||||
[ 16] UINT32 flags; // flags (see below)
|
||||
[ 20] UINT32 compression; // compression type
|
||||
[ 24] UINT32 hunksize; // 512-byte sectors per hunk
|
||||
[ 28] UINT32 totalhunks; // total # of hunks represented
|
||||
[ 32] UINT32 cylinders; // number of cylinders on hard disk
|
||||
[ 36] UINT32 heads; // number of heads on hard disk
|
||||
[ 40] UINT32 sectors; // number of sectors on hard disk
|
||||
[ 44] UINT8 md5[16]; // MD5 checksum of raw data
|
||||
[ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
|
||||
[ 8] uint32_t length; // length of header (including tag and length fields)
|
||||
[ 12] uint32_t version; // drive format version
|
||||
[ 16] uint32_t flags; // flags (see below)
|
||||
[ 20] uint32_t compression; // compression type
|
||||
[ 24] uint32_t hunksize; // 512-byte sectors per hunk
|
||||
[ 28] uint32_t totalhunks; // total # of hunks represented
|
||||
[ 32] uint32_t cylinders; // number of cylinders on hard disk
|
||||
[ 36] uint32_t heads; // number of heads on hard disk
|
||||
[ 40] uint32_t sectors; // number of sectors on hard disk
|
||||
[ 44] uint8_t md5[16]; // MD5 checksum of raw data
|
||||
[ 60] uint8_t parentmd5[16]; // MD5 checksum of parent file
|
||||
[ 76] (V1 header length)
|
||||
|
||||
V2 header:
|
||||
|
||||
[ 0] char tag[8]; // 'MComprHD'
|
||||
[ 8] UINT32 length; // length of header (including tag and length fields)
|
||||
[ 12] UINT32 version; // drive format version
|
||||
[ 16] UINT32 flags; // flags (see below)
|
||||
[ 20] UINT32 compression; // compression type
|
||||
[ 24] UINT32 hunksize; // seclen-byte sectors per hunk
|
||||
[ 28] UINT32 totalhunks; // total # of hunks represented
|
||||
[ 32] UINT32 cylinders; // number of cylinders on hard disk
|
||||
[ 36] UINT32 heads; // number of heads on hard disk
|
||||
[ 40] UINT32 sectors; // number of sectors on hard disk
|
||||
[ 44] UINT8 md5[16]; // MD5 checksum of raw data
|
||||
[ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
|
||||
[ 76] UINT32 seclen; // number of bytes per sector
|
||||
[ 8] uint32_t length; // length of header (including tag and length fields)
|
||||
[ 12] uint32_t version; // drive format version
|
||||
[ 16] uint32_t flags; // flags (see below)
|
||||
[ 20] uint32_t compression; // compression type
|
||||
[ 24] uint32_t hunksize; // seclen-byte sectors per hunk
|
||||
[ 28] uint32_t totalhunks; // total # of hunks represented
|
||||
[ 32] uint32_t cylinders; // number of cylinders on hard disk
|
||||
[ 36] uint32_t heads; // number of heads on hard disk
|
||||
[ 40] uint32_t sectors; // number of sectors on hard disk
|
||||
[ 44] uint8_t md5[16]; // MD5 checksum of raw data
|
||||
[ 60] uint8_t parentmd5[16]; // MD5 checksum of parent file
|
||||
[ 76] uint32_t seclen; // number of bytes per sector
|
||||
[ 80] (V2 header length)
|
||||
|
||||
V3 header:
|
||||
|
||||
[ 0] char tag[8]; // 'MComprHD'
|
||||
[ 8] UINT32 length; // length of header (including tag and length fields)
|
||||
[ 12] UINT32 version; // drive format version
|
||||
[ 16] UINT32 flags; // flags (see below)
|
||||
[ 20] UINT32 compression; // compression type
|
||||
[ 24] UINT32 totalhunks; // total # of hunks represented
|
||||
[ 28] UINT64 logicalbytes; // logical size of the data (in bytes)
|
||||
[ 36] UINT64 metaoffset; // offset to the first blob of metadata
|
||||
[ 44] UINT8 md5[16]; // MD5 checksum of raw data
|
||||
[ 60] UINT8 parentmd5[16]; // MD5 checksum of parent file
|
||||
[ 76] UINT32 hunkbytes; // number of bytes per hunk
|
||||
[ 80] UINT8 sha1[20]; // SHA1 checksum of raw data
|
||||
[100] UINT8 parentsha1[20];// SHA1 checksum of parent file
|
||||
[ 8] uint32_t length; // length of header (including tag and length fields)
|
||||
[ 12] uint32_t version; // drive format version
|
||||
[ 16] uint32_t flags; // flags (see below)
|
||||
[ 20] uint32_t compression; // compression type
|
||||
[ 24] uint32_t totalhunks; // total # of hunks represented
|
||||
[ 28] uint64_t logicalbytes; // logical size of the data (in bytes)
|
||||
[ 36] uint64_t metaoffset; // offset to the first blob of metadata
|
||||
[ 44] uint8_t md5[16]; // MD5 checksum of raw data
|
||||
[ 60] uint8_t parentmd5[16]; // MD5 checksum of parent file
|
||||
[ 76] uint32_t hunkbytes; // number of bytes per hunk
|
||||
[ 80] uint8_t sha1[20]; // SHA1 checksum of raw data
|
||||
[100] uint8_t parentsha1[20];// SHA1 checksum of parent file
|
||||
[120] (V3 header length)
|
||||
|
||||
V4 header:
|
||||
|
||||
[ 0] char tag[8]; // 'MComprHD'
|
||||
[ 8] UINT32 length; // length of header (including tag and length fields)
|
||||
[ 12] UINT32 version; // drive format version
|
||||
[ 16] UINT32 flags; // flags (see below)
|
||||
[ 20] UINT32 compression; // compression type
|
||||
[ 24] UINT32 totalhunks; // total # of hunks represented
|
||||
[ 28] UINT64 logicalbytes; // logical size of the data (in bytes)
|
||||
[ 36] UINT64 metaoffset; // offset to the first blob of metadata
|
||||
[ 44] UINT32 hunkbytes; // number of bytes per hunk
|
||||
[ 48] UINT8 sha1[20]; // combined raw+meta SHA1
|
||||
[ 68] UINT8 parentsha1[20];// combined raw+meta SHA1 of parent
|
||||
[ 88] UINT8 rawsha1[20]; // raw data SHA1
|
||||
[ 8] uint32_t length; // length of header (including tag and length fields)
|
||||
[ 12] uint32_t version; // drive format version
|
||||
[ 16] uint32_t flags; // flags (see below)
|
||||
[ 20] uint32_t compression; // compression type
|
||||
[ 24] uint32_t totalhunks; // total # of hunks represented
|
||||
[ 28] uint64_t logicalbytes; // logical size of the data (in bytes)
|
||||
[ 36] uint64_t metaoffset; // offset to the first blob of metadata
|
||||
[ 44] uint32_t hunkbytes; // number of bytes per hunk
|
||||
[ 48] uint8_t sha1[20]; // combined raw+meta SHA1
|
||||
[ 68] uint8_t parentsha1[20];// combined raw+meta SHA1 of parent
|
||||
[ 88] uint8_t rawsha1[20]; // raw data SHA1
|
||||
[108] (V4 header length)
|
||||
|
||||
Flags:
|
||||
@@ -131,17 +130,17 @@ extern "C" {
|
||||
V5 header:
|
||||
|
||||
[ 0] char tag[8]; // 'MComprHD'
|
||||
[ 8] uint32_t length; // length of header (including tag and length fields)
|
||||
[ 12] uint32_t version; // drive format version
|
||||
[ 16] uint32_t compressors[4];// which custom compressors are used?
|
||||
[ 32] uint64_t logicalbytes; // logical size of the data (in bytes)
|
||||
[ 40] uint64_t mapoffset; // offset to the map
|
||||
[ 48] uint64_t metaoffset; // offset to the first blob of metadata
|
||||
[ 56] uint32_t hunkbytes; // number of bytes per hunk (512k maximum)
|
||||
[ 60] uint32_t unitbytes; // number of bytes per unit within each hunk
|
||||
[ 64] uint8_t rawsha1[20]; // raw data SHA1
|
||||
[ 84] uint8_t sha1[20]; // combined raw+meta SHA1
|
||||
[104] uint8_t parentsha1[20];// combined raw+meta SHA1 of parent
|
||||
[ 8] uint32_t_t length; // length of header (including tag and length fields)
|
||||
[ 12] uint32_t_t version; // drive format version
|
||||
[ 16] uint32_t_t compressors[4];// which custom compressors are used?
|
||||
[ 32] uint64_t_t logicalbytes; // logical size of the data (in bytes)
|
||||
[ 40] uint64_t_t mapoffset; // offset to the map
|
||||
[ 48] uint64_t_t metaoffset; // offset to the first blob of metadata
|
||||
[ 56] uint32_t_t hunkbytes; // number of bytes per hunk (512k maximum)
|
||||
[ 60] uint32_t_t unitbytes; // number of bytes per unit within each hunk
|
||||
[ 64] uint8_t_t rawsha1[20]; // raw data SHA1
|
||||
[ 84] uint8_t_t sha1[20]; // combined raw+meta SHA1
|
||||
[104] uint8_t_t parentsha1[20];// combined raw+meta SHA1 of parent
|
||||
[124] (V5 header length)
|
||||
|
||||
If parentsha1 != 0, we have a parent (no need for flags)
|
||||
@@ -149,22 +148,22 @@ extern "C" {
|
||||
|
||||
V5 uncompressed map format:
|
||||
|
||||
[ 0] uint32_t offset; // starting offset / hunk size
|
||||
[ 0] uint32_t_t offset; // starting offset / hunk size
|
||||
|
||||
V5 compressed map format header:
|
||||
|
||||
[ 0] uint32_t length; // length of compressed map
|
||||
[ 0] uint32_t_t length; // length of compressed map
|
||||
[ 4] UINT48 datastart; // offset of first block
|
||||
[ 10] uint16_t crc; // crc-16 of the map
|
||||
[ 12] uint8_t lengthbits; // bits used to encode complength
|
||||
[ 13] uint8_t hunkbits; // bits used to encode self-refs
|
||||
[ 14] uint8_t parentunitbits; // bits used to encode parent unit refs
|
||||
[ 15] uint8_t reserved; // future use
|
||||
[ 12] uint8_t_t lengthbits; // bits used to encode complength
|
||||
[ 13] uint8_t_t hunkbits; // bits used to encode self-refs
|
||||
[ 14] uint8_t_t parentunitbits; // bits used to encode parent unit refs
|
||||
[ 15] uint8_t_t reserved; // future use
|
||||
[ 16] (compressed header length)
|
||||
|
||||
Each compressed map entry, once expanded, looks like:
|
||||
|
||||
[ 0] uint8_t compression; // compression type
|
||||
[ 0] uint8_t_t compression; // compression type
|
||||
[ 1] UINT24 complength; // compressed length
|
||||
[ 4] UINT48 offset; // offset
|
||||
[ 10] uint16_t crc; // crc-16 of the data
|
||||
@@ -221,7 +220,7 @@ extern "C" {
|
||||
|
||||
/* metadata parameters */
|
||||
#define CHDMETATAG_WILDCARD 0
|
||||
#define CHD_METAINDEX_APPEND ((UINT32)-1)
|
||||
#define CHD_METAINDEX_APPEND ((uint32_t)-1)
|
||||
|
||||
/* metadata flags */
|
||||
#define CHD_MDFLAGS_CHECKSUM 0x01 /* indicates data is checksummed */
|
||||
@@ -259,7 +258,6 @@ extern "C" {
|
||||
/* CHD open values */
|
||||
#define CHD_OPEN_READ 1
|
||||
#define CHD_OPEN_READWRITE 2
|
||||
#define CHD_OPEN_TRANSFER_FILE 4 /* Freeing of the FILE* is now libchdr's responsibility if open was successful */
|
||||
|
||||
/* error types */
|
||||
enum _chd_error
|
||||
@@ -291,8 +289,7 @@ enum _chd_error
|
||||
CHDERR_INVALID_STATE,
|
||||
CHDERR_OPERATION_PENDING,
|
||||
CHDERR_NO_ASYNC_OPERATION,
|
||||
CHDERR_UNSUPPORTED_FORMAT,
|
||||
CHDERR_CANCELLED,
|
||||
CHDERR_UNSUPPORTED_FORMAT
|
||||
};
|
||||
typedef enum _chd_error chd_error;
|
||||
|
||||
@@ -310,32 +307,32 @@ typedef struct _chd_file chd_file;
|
||||
typedef struct _chd_header chd_header;
|
||||
struct _chd_header
|
||||
{
|
||||
UINT32 length; /* length of header data */
|
||||
UINT32 version; /* drive format version */
|
||||
UINT32 flags; /* flags field */
|
||||
UINT32 compression[4]; /* compression type */
|
||||
UINT32 hunkbytes; /* number of bytes per hunk */
|
||||
UINT32 totalhunks; /* total # of hunks represented */
|
||||
UINT64 logicalbytes; /* logical size of the data */
|
||||
UINT64 metaoffset; /* offset in file of first metadata */
|
||||
UINT64 mapoffset; /* TOOD V5 */
|
||||
UINT8 md5[CHD_MD5_BYTES]; /* overall MD5 checksum */
|
||||
UINT8 parentmd5[CHD_MD5_BYTES]; /* overall MD5 checksum of parent */
|
||||
UINT8 sha1[CHD_SHA1_BYTES]; /* overall SHA1 checksum */
|
||||
UINT8 rawsha1[CHD_SHA1_BYTES]; /* SHA1 checksum of raw data */
|
||||
UINT8 parentsha1[CHD_SHA1_BYTES]; /* overall SHA1 checksum of parent */
|
||||
UINT32 unitbytes; /* TODO V5 */
|
||||
UINT64 unitcount; /* TODO V5 */
|
||||
UINT32 hunkcount; /* TODO V5 */
|
||||
uint32_t length; /* length of header data */
|
||||
uint32_t version; /* drive format version */
|
||||
uint32_t flags; /* flags field */
|
||||
uint32_t compression[4]; /* compression type */
|
||||
uint32_t hunkbytes; /* number of bytes per hunk */
|
||||
uint32_t totalhunks; /* total # of hunks represented */
|
||||
uint64_t logicalbytes; /* logical size of the data */
|
||||
uint64_t metaoffset; /* offset in file of first metadata */
|
||||
uint64_t mapoffset; /* TOOD V5 */
|
||||
uint8_t md5[CHD_MD5_BYTES]; /* overall MD5 checksum */
|
||||
uint8_t parentmd5[CHD_MD5_BYTES]; /* overall MD5 checksum of parent */
|
||||
uint8_t sha1[CHD_SHA1_BYTES]; /* overall SHA1 checksum */
|
||||
uint8_t rawsha1[CHD_SHA1_BYTES]; /* SHA1 checksum of raw data */
|
||||
uint8_t parentsha1[CHD_SHA1_BYTES]; /* overall SHA1 checksum of parent */
|
||||
uint32_t unitbytes; /* TODO V5 */
|
||||
uint64_t unitcount; /* TODO V5 */
|
||||
uint32_t hunkcount; /* TODO V5 */
|
||||
|
||||
/* map information */
|
||||
UINT32 mapentrybytes; /* length of each entry in a map (V5) */
|
||||
UINT8* rawmap; /* raw map data */
|
||||
uint32_t mapentrybytes; /* length of each entry in a map (V5) */
|
||||
uint8_t* rawmap; /* raw map data */
|
||||
|
||||
UINT32 obsolete_cylinders; /* obsolete field -- do not use! */
|
||||
UINT32 obsolete_sectors; /* obsolete field -- do not use! */
|
||||
UINT32 obsolete_heads; /* obsolete field -- do not use! */
|
||||
UINT32 obsolete_hunksize; /* obsolete field -- do not use! */
|
||||
uint32_t obsolete_cylinders; /* obsolete field -- do not use! */
|
||||
uint32_t obsolete_sectors; /* obsolete field -- do not use! */
|
||||
uint32_t obsolete_heads; /* obsolete field -- do not use! */
|
||||
uint32_t obsolete_hunksize; /* obsolete field -- do not use! */
|
||||
};
|
||||
|
||||
|
||||
@@ -343,10 +340,10 @@ struct _chd_header
|
||||
typedef struct _chd_verify_result chd_verify_result;
|
||||
struct _chd_verify_result
|
||||
{
|
||||
UINT8 md5[CHD_MD5_BYTES]; /* overall MD5 checksum */
|
||||
UINT8 sha1[CHD_SHA1_BYTES]; /* overall SHA1 checksum */
|
||||
UINT8 rawsha1[CHD_SHA1_BYTES]; /* SHA1 checksum of raw data */
|
||||
UINT8 metasha1[CHD_SHA1_BYTES]; /* SHA1 checksum of metadata */
|
||||
uint8_t md5[CHD_MD5_BYTES]; /* overall MD5 checksum */
|
||||
uint8_t sha1[CHD_SHA1_BYTES]; /* overall SHA1 checksum */
|
||||
uint8_t rawsha1[CHD_SHA1_BYTES]; /* SHA1 checksum of raw data */
|
||||
uint8_t metasha1[CHD_SHA1_BYTES]; /* SHA1 checksum of metadata */
|
||||
};
|
||||
|
||||
|
||||
@@ -372,10 +369,10 @@ struct _chd_verify_result
|
||||
/* ----- CHD file management ----- */
|
||||
|
||||
/* create a new CHD file fitting the given description */
|
||||
/* chd_error chd_create(const char *filename, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 compression, chd_file *parent); */
|
||||
/* chd_error chd_create(const char *filename, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t compression, chd_file *parent); */
|
||||
|
||||
/* same as chd_create(), but accepts an already-opened core_file object */
|
||||
/* chd_error chd_create_file(core_file *file, UINT64 logicalbytes, UINT32 hunkbytes, UINT32 compression, chd_file *parent); */
|
||||
/* chd_error chd_create_file(core_file *file, uint64_t logicalbytes, uint32_t hunkbytes, uint32_t compression, chd_file *parent); */
|
||||
|
||||
/* open an existing CHD file */
|
||||
CHD_EXPORT chd_error chd_open_core_file(core_file *file, int mode, chd_file *parent, chd_file **chd);
|
||||
@@ -384,7 +381,6 @@ CHD_EXPORT chd_error chd_open(const char *filename, int mode, chd_file *parent,
|
||||
|
||||
/* precache underlying file */
|
||||
CHD_EXPORT chd_error chd_precache(chd_file *chd);
|
||||
CHD_EXPORT chd_error chd_precache_progress(chd_file* chd, bool(*progress)(size_t pos, size_t total, void* param), void* param);
|
||||
|
||||
/* close a CHD file */
|
||||
CHD_EXPORT void chd_close(chd_file *chd);
|
||||
@@ -392,13 +388,11 @@ CHD_EXPORT void chd_close(chd_file *chd);
|
||||
/* return the associated core_file */
|
||||
CHD_EXPORT core_file *chd_core_file(chd_file *chd);
|
||||
|
||||
/* return the overall size of a CHD, and any of its parents */
|
||||
CHD_EXPORT UINT64 chd_get_compressed_size(chd_file* chd);
|
||||
|
||||
/* return an error string for the given CHD error */
|
||||
CHD_EXPORT const char *chd_error_string(chd_error err);
|
||||
|
||||
|
||||
|
||||
/* ----- CHD header management ----- */
|
||||
|
||||
/* return a pointer to the extracted CHD header data */
|
||||
@@ -408,21 +402,20 @@ CHD_EXPORT const chd_header *chd_get_header(chd_file *chd);
|
||||
CHD_EXPORT chd_error chd_read_header_core_file(core_file *file, chd_header *header);
|
||||
CHD_EXPORT chd_error chd_read_header_file(FILE *file, chd_header *header);
|
||||
CHD_EXPORT chd_error chd_read_header(const char *filename, chd_header *header);
|
||||
CHD_EXPORT bool chd_is_matching_parent(const chd_header* header, const chd_header* parent_header);
|
||||
|
||||
|
||||
|
||||
/* ----- core data read/write ----- */
|
||||
|
||||
/* read one hunk from the CHD file */
|
||||
CHD_EXPORT chd_error chd_read(chd_file *chd, UINT32 hunknum, void *buffer);
|
||||
CHD_EXPORT chd_error chd_read(chd_file *chd, uint32_t hunknum, void *buffer);
|
||||
|
||||
|
||||
|
||||
/* ----- metadata management ----- */
|
||||
|
||||
/* get indexed metadata of a particular sort */
|
||||
CHD_EXPORT chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 *resultlen, UINT32 *resulttag, UINT8 *resultflags);
|
||||
CHD_EXPORT chd_error chd_get_metadata(chd_file *chd, uint32_t searchtag, uint32_t searchindex, void *output, uint32_t outputlen, uint32_t *resultlen, uint32_t *resulttag, uint8_t *resultflags);
|
||||
|
||||
|
||||
|
||||
@@ -433,7 +426,7 @@ CHD_EXPORT chd_error chd_get_metadata(chd_file *chd, UINT32 searchtag, UINT32 se
|
||||
CHD_EXPORT chd_error chd_codec_config(chd_file *chd, int param, void *config);
|
||||
|
||||
/* return a string description of a codec */
|
||||
CHD_EXPORT const char *chd_get_codec_name(UINT32 codec);
|
||||
CHD_EXPORT const char *chd_get_codec_name(uint32_t codec);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
31
3rdparty/libchdr/include/libchdr/coretypes.h
vendored
31
3rdparty/libchdr/include/libchdr/coretypes.h
vendored
@@ -8,26 +8,13 @@
|
||||
#include <streams/file_stream_transforms.h>
|
||||
#endif
|
||||
|
||||
#ifndef ARRAY_LENGTH
|
||||
#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
#if defined(__PS3__) || defined(__PSL1GHT__)
|
||||
#undef UINT32
|
||||
#undef UINT16
|
||||
#undef UINT8
|
||||
#undef INT32
|
||||
#undef INT16
|
||||
#undef INT8
|
||||
#endif
|
||||
|
||||
typedef uint64_t UINT64;
|
||||
typedef uint32_t UINT32;
|
||||
typedef uint16_t UINT16;
|
||||
typedef uint8_t UINT8;
|
||||
|
||||
typedef int64_t INT64;
|
||||
typedef int32_t INT32;
|
||||
typedef int16_t INT16;
|
||||
typedef int8_t INT8;
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
typedef struct chd_core_file {
|
||||
/*
|
||||
@@ -41,9 +28,9 @@ typedef struct chd_core_file {
|
||||
* undefined because many implementations will seek to the end of the
|
||||
* file and call ftell.
|
||||
*
|
||||
* on error, (UINT64)-1 is returned.
|
||||
* on error, (uint64_t)-1 is returned.
|
||||
*/
|
||||
UINT64(*fsize)(struct chd_core_file*);
|
||||
uint64_t(*fsize)(struct chd_core_file*);
|
||||
|
||||
/*
|
||||
* should match the behavior of fread, except the FILE* argument at the end
|
||||
@@ -55,7 +42,7 @@ typedef struct chd_core_file {
|
||||
int (*fclose)(struct chd_core_file*);
|
||||
|
||||
// fseek clone
|
||||
int (*fseek)(struct chd_core_file*, INT64, int);
|
||||
int (*fseek)(struct chd_core_file*, int64_t, int);
|
||||
} core_file;
|
||||
|
||||
static inline int core_fclose(core_file *fp) {
|
||||
@@ -66,11 +53,11 @@ static inline size_t core_fread(core_file *fp, void *ptr, size_t len) {
|
||||
return fp->fread(ptr, 1, len, fp);
|
||||
}
|
||||
|
||||
static inline int core_fseek(core_file* fp, INT64 offset, int whence) {
|
||||
static inline int core_fseek(core_file* fp, int64_t offset, int whence) {
|
||||
return fp->fseek(fp, offset, whence);
|
||||
}
|
||||
|
||||
static inline UINT64 core_fsize(core_file *fp)
|
||||
static inline uint64_t core_fsize(core_file *fp)
|
||||
{
|
||||
return fp->fsize(fp);
|
||||
}
|
||||
|
||||
2
3rdparty/libchdr/include/libchdr/huffman.h
vendored
2
3rdparty/libchdr/include/libchdr/huffman.h
vendored
@@ -85,6 +85,6 @@ int huffman_build_tree(struct huffman_decoder* decoder, uint32_t totaldata, uint
|
||||
enum huffman_error huffman_assign_canonical_codes(struct huffman_decoder* decoder);
|
||||
enum huffman_error huffman_compute_tree_from_histo(struct huffman_decoder* decoder);
|
||||
|
||||
void huffman_build_lookup_table(struct huffman_decoder* decoder);
|
||||
enum huffman_error huffman_build_lookup_table(struct huffman_decoder* decoder);
|
||||
|
||||
#endif
|
||||
|
||||
29
3rdparty/libchdr/src/libchdr_cdrom.c
vendored
29
3rdparty/libchdr/src/libchdr_cdrom.c
vendored
@@ -20,35 +20,6 @@
|
||||
|
||||
#include <libchdr/cdrom.h>
|
||||
|
||||
const char* cdrom_get_subtype_string(uint32_t subtype)
|
||||
{
|
||||
switch (subtype)
|
||||
{
|
||||
case CD_SUB_RAW: return "RW";
|
||||
case CD_SUB_RAW_INTERLEAVED: return "RW_RAW";
|
||||
default: return "NONE";
|
||||
}
|
||||
}
|
||||
|
||||
bool cdrom_parse_subtype_string(const char* typestring, uint32_t* subtype, uint32_t* subsize)
|
||||
{
|
||||
// https://github.com/mamedev/mame/blob/d2d54fb8ed53a2e86d308067da8414f85b5929b0/src/lib/util/cdrom.cpp#L767
|
||||
if (!strcmp(typestring, "RW"))
|
||||
{
|
||||
*subtype = CD_SUB_RAW;
|
||||
*subsize = 96;
|
||||
return true;
|
||||
}
|
||||
else if (!strcmp(typestring, "RW_RAW"))
|
||||
{
|
||||
*subtype = CD_SUB_RAW_INTERLEAVED;
|
||||
*subsize = 96;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef WANT_RAW_DATA_SECTOR
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
630
3rdparty/libchdr/src/libchdr_chd.c
vendored
630
3rdparty/libchdr/src/libchdr_chd.c
vendored
File diff suppressed because it is too large
Load Diff
32
3rdparty/libchdr/src/libchdr_huffman.c
vendored
32
3rdparty/libchdr/src/libchdr_huffman.c
vendored
@@ -230,7 +230,9 @@ enum huffman_error huffman_import_tree_rle(struct huffman_decoder* decoder, stru
|
||||
return error;
|
||||
|
||||
/* build the lookup table */
|
||||
huffman_build_lookup_table(decoder);
|
||||
error = huffman_build_lookup_table(decoder);
|
||||
if (error != HUFFERR_NONE)
|
||||
return error;
|
||||
|
||||
/* determine final input length and report errors */
|
||||
return bitstream_overflow(bitbuf) ? HUFFERR_INPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
|
||||
@@ -271,8 +273,16 @@ enum huffman_error huffman_import_tree_huffman(struct huffman_decoder* decoder,
|
||||
/* then regenerate the tree */
|
||||
error = huffman_assign_canonical_codes(smallhuff);
|
||||
if (error != HUFFERR_NONE)
|
||||
{
|
||||
delete_huffman_decoder(smallhuff);
|
||||
return error;
|
||||
huffman_build_lookup_table(smallhuff);
|
||||
}
|
||||
error = huffman_build_lookup_table(smallhuff);
|
||||
if (error != HUFFERR_NONE)
|
||||
{
|
||||
delete_huffman_decoder(smallhuff);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* determine the maximum length of an RLE count */
|
||||
temp = decoder->numcodes - 9;
|
||||
@@ -308,7 +318,9 @@ enum huffman_error huffman_import_tree_huffman(struct huffman_decoder* decoder,
|
||||
return error;
|
||||
|
||||
/* build the lookup table */
|
||||
huffman_build_lookup_table(decoder);
|
||||
error = huffman_build_lookup_table(decoder);
|
||||
if (error != HUFFERR_NONE)
|
||||
return error;
|
||||
|
||||
/* determine final input length and report errors */
|
||||
return bitstream_overflow(bitbuf) ? HUFFERR_INPUT_BUFFER_TOO_SMALL : HUFFERR_NONE;
|
||||
@@ -523,8 +535,9 @@ enum huffman_error huffman_assign_canonical_codes(struct huffman_decoder* decode
|
||||
*-------------------------------------------------
|
||||
*/
|
||||
|
||||
void huffman_build_lookup_table(struct huffman_decoder* decoder)
|
||||
enum huffman_error huffman_build_lookup_table(struct huffman_decoder* decoder)
|
||||
{
|
||||
const lookup_value* lookupend = &decoder->lookup[(1u << decoder->maxbits)];
|
||||
uint32_t curcode;
|
||||
/* iterate over all codes */
|
||||
for (curcode = 0; curcode < decoder->numcodes; curcode++)
|
||||
@@ -533,9 +546,10 @@ void huffman_build_lookup_table(struct huffman_decoder* decoder)
|
||||
struct node_t* node = &decoder->huffnode[curcode];
|
||||
if (node->numbits > 0)
|
||||
{
|
||||
int shift;
|
||||
lookup_value *dest;
|
||||
lookup_value *destend;
|
||||
int shift;
|
||||
lookup_value *dest;
|
||||
lookup_value *destend;
|
||||
|
||||
/* set up the entry */
|
||||
lookup_value value = MAKE_LOOKUP(curcode, node->numbits);
|
||||
|
||||
@@ -543,8 +557,12 @@ void huffman_build_lookup_table(struct huffman_decoder* decoder)
|
||||
shift = decoder->maxbits - node->numbits;
|
||||
dest = &decoder->lookup[node->bits << shift];
|
||||
destend = &decoder->lookup[((node->bits + 1) << shift) - 1];
|
||||
if (dest >= lookupend || destend >= lookupend || destend < dest)
|
||||
return HUFFERR_INTERNAL_INCONSISTENCY;
|
||||
while (dest <= destend)
|
||||
*dest++ = value;
|
||||
}
|
||||
}
|
||||
|
||||
return HUFFERR_NONE;
|
||||
}
|
||||
|
||||
217
3rdparty/vulkan/include/CHANGELOG.md
vendored
Normal file
217
3rdparty/vulkan/include/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
# 3.2.0 (2024-12-30)
|
||||
|
||||
Additions to the library API:
|
||||
|
||||
- Added support for Vulkan 1.4.
|
||||
- Added support for VK_KHR_external_memory_win32 extension - `VMA_ALLOCATOR_CREATE_KHR_EXTERNAL_MEMORY_WIN32_BIT` flag, `vmaGetMemoryWin32Handle` function, and a whole new documentation chapter about it (#442).
|
||||
|
||||
Other changes:
|
||||
|
||||
- Fixed thread safety issue (#451).
|
||||
- Many other bug fixes and improvements in the library code, documentation, sample app, Cmake script, mostly to improve compatibility with various compilers and GPUs.
|
||||
|
||||
# 3.1.0 (2024-05-27)
|
||||
|
||||
This release gathers fixes and improvements made during many months of continuous development on the main branch, mostly based on issues and pull requests on GitHub.
|
||||
|
||||
Additions to the library API:
|
||||
|
||||
- Added convenience functions `vmaCopyMemoryToAllocation`, `vmaCopyAllocationToMemory`.
|
||||
- Added functions `vmaCreateAliasingBuffer2`, `vmaCreateAliasingImage2` that offer creating a buffer/image in an existing allocation with additional `allocationLocalOffset`.
|
||||
- Added function `vmaGetAllocationInfo2`, structure `VmaAllocationInfo2` that return additional information about an allocation, useful for interop with other APIs (#383, #340).
|
||||
- Added callback `VmaDefragmentationInfo::pfnBreakCallback` that allows breaking long execution of `vmaBeginDefragmentation`.
|
||||
Also added `PFN_vmaCheckDefragmentationBreakFunction`, `VmaDefragmentationInfo::pBreakCallbackUserData`.
|
||||
- Added support for VK_KHR_maintenance4 extension - `VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE4_BIT` flag (#397).
|
||||
- Added support for VK_KHR_maintenance5 extension - `VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE5_BIT` flag (#411).
|
||||
|
||||
Other changes:
|
||||
|
||||
- Changes in debug and configuration macros:
|
||||
- Split macros into separate `VMA_DEBUG_LOG` and `VMA_DEBUG_LOG_FORMAT` (#297).
|
||||
- Added macros `VMA_ASSERT_LEAK`, `VMA_LEAK_LOG_FORMAT` separate from normal `VMA_ASSERT`, `VMA_DEBUG_LOG_FORMAT` (#379, #385).
|
||||
- Added macro `VMA_EXTENDS_VK_STRUCT` (#347).
|
||||
- Countless bug fixes and improvements in the code and documentation, mostly to improve compatibility with various compilers and GPUs, including:
|
||||
- Fixed missing `#include` that resulted in compilation error about `snprintf` not declared on some compilers (#312).
|
||||
- Fixed main memory type selection algorithm for GPUs that have no `HOST_CACHED` memory type, like Raspberry Pi (#362).
|
||||
- Major changes in Cmake script.
|
||||
- Fixes in GpuMemDumpVis.py script.
|
||||
|
||||
# 3.0.1 (2022-05-26)
|
||||
|
||||
- Fixes in defragmentation algorithm.
|
||||
- Fixes in GpuMemDumpVis.py regarding image height calculation.
|
||||
- Other bug fixes, optimizations, and improvements in the code and documentation.
|
||||
|
||||
# 3.0.0 (2022-03-25)
|
||||
|
||||
It has been a long time since the previous official release, so hopefully everyone has been using the latest code from "master" branch, which is always maintained in a good state, not the old version. For completeness, here is the list of changes since v2.3.0. The major version number has changed, so there are some compatibility-breaking changes, but the basic API stays the same and is mostly backward-compatible.
|
||||
|
||||
Major features added (some compatibility-breaking):
|
||||
|
||||
- Added new API for selecting preferred memory type: flags `VMA_MEMORY_USAGE_AUTO`, `VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE`, `VMA_MEMORY_USAGE_AUTO_PREFER_HOST`, `VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT`, `VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT`, `VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT`. Old values like `VMA_MEMORY_USAGE_GPU_ONLY` still work as before, for backward compatibility, but are not recommended.
|
||||
- Added new defragmentation API and algorithm, replacing the old one. See structure `VmaDefragmentationInfo`, `VmaDefragmentationMove`, `VmaDefragmentationPassMoveInfo`, `VmaDefragmentationStats`, function `vmaBeginDefragmentation`, `vmaEndDefragmentation`, `vmaBeginDefragmentationPass`, `vmaEndDefragmentationPass`.
|
||||
- Redesigned API for statistics, replacing the old one. See structures: `VmaStatistics`, `VmaDetailedStatistics`, `VmaTotalStatistics`. `VmaBudget`, functions: `vmaGetHeapBudgets`, `vmaCalculateStatistics`, `vmaGetPoolStatistics`, `vmaCalculatePoolStatistics`, `vmaGetVirtualBlockStatistics`, `vmaCalculateVirtualBlockStatistics`.
|
||||
- Added "Virtual allocator" feature - possibility to use core allocation algorithms for allocation of custom memory, not necessarily Vulkan device memory. See functions like `vmaCreateVirtualBlock`, `vmaDestroyVirtualBlock` and many more.
|
||||
- `VmaAllocation` now keeps both `void* pUserData` and `char* pName`. Added function `vmaSetAllocationName`, member `VmaAllocationInfo::pName`. Flag `VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT` is now deprecated.
|
||||
- Clarified and cleaned up various ways of importing Vulkan functions. See macros `VMA_STATIC_VULKAN_FUNCTIONS`, `VMA_DYNAMIC_VULKAN_FUNCTIONS`, structure `VmaVulkanFunctions`. Added members `VmaVulkanFunctions::vkGetInstanceProcAddr`, `vkGetDeviceProcAddr`, which are now required when using `VMA_DYNAMIC_VULKAN_FUNCTIONS`.
|
||||
|
||||
Removed (compatibility-breaking):
|
||||
|
||||
- Removed whole "lost allocations" feature. Removed from the interface: `VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT`, `VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT`, `vmaCreateLostAllocation`, `vmaMakePoolAllocationsLost`, `vmaTouchAllocation`, `VmaAllocatorCreateInfo::frameInUseCount`, `VmaPoolCreateInfo::frameInUseCount`.
|
||||
- Removed whole "record & replay" feature. Removed from the API: `VmaAllocatorCreateInfo::pRecordSettings`, `VmaRecordSettings`, `VmaRecordFlagBits`, `VmaRecordFlags`. Removed VmaReplay application.
|
||||
- Removed "buddy" algorithm - removed flag `VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT`.
|
||||
|
||||
Minor but compatibility-breaking changes:
|
||||
|
||||
- Changes in `ALLOCATION_CREATE_STRATEGY` flags. Removed flags: `VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT`, `VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT`, `VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT`, which were aliases to other existing flags.
|
||||
- Added a member `void* pUserData` to `VmaDeviceMemoryCallbacks`. Updated `PFN_vmaAllocateDeviceMemoryFunction`, `PFN_vmaFreeDeviceMemoryFunction` to use the new `pUserData` member.
|
||||
- Removed function `vmaResizeAllocation` that was already deprecated.
|
||||
|
||||
Other major changes:
|
||||
|
||||
- Added new features to custom pools: support for dedicated allocations, new member `VmaPoolCreateInfo::pMemoryAllocateNext`, `minAllocationAlignment`.
|
||||
- Added support for Vulkan 1.2, 1.3.
|
||||
- Added support for VK_KHR_buffer_device_address extension - flag `VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT`.
|
||||
- Added support for VK_EXT_memory_priority extension - flag `VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT`, members `VmaAllocationCreateInfo::priority`, `VmaPoolCreateInfo::priority`.
|
||||
- Added support for VK_AMD_device_coherent_memory extension - flag `VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT`.
|
||||
- Added member `VmaAllocatorCreateInfo::pTypeExternalMemoryHandleTypes`.
|
||||
- Added function `vmaGetAllocatorInfo`, structure `VmaAllocatorInfo`.
|
||||
- Added functions `vmaFlushAllocations`, `vmaInvalidateAllocations` for multiple allocations at once.
|
||||
- Added flag `VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT`.
|
||||
- Added function `vmaCreateBufferWithAlignment`.
|
||||
- Added convenience function `vmaGetAllocationMemoryProperties`.
|
||||
- Added convenience functions: `vmaCreateAliasingBuffer`, `vmaCreateAliasingImage`.
|
||||
|
||||
Other minor changes:
|
||||
|
||||
- Implemented Two-Level Segregated Fit (TLSF) allocation algorithm, replacing previous default one. It is much faster, especially when freeing many allocations at once or when `bufferImageGranularity` is large.
|
||||
- Renamed debug macro `VMA_DEBUG_ALIGNMENT` to `VMA_MIN_ALIGNMENT`.
|
||||
- Added CMake support - CMakeLists.txt files. Removed Premake support.
|
||||
- Changed `vmaInvalidateAllocation` and `vmaFlushAllocation` to return `VkResult`.
|
||||
- Added nullability annotations for Clang: `VMA_NULLABLE`, `VMA_NOT_NULL`, `VMA_NULLABLE_NON_DISPATCHABLE`, `VMA_NOT_NULL_NON_DISPATCHABLE`, `VMA_LEN_IF_NOT_NULL`.
|
||||
- JSON dump format has changed.
|
||||
- Countless fixes and improvements, including performance optimizations, compatibility with various platforms and compilers, documentation.
|
||||
|
||||
# 2.3.0 (2019-12-04)
|
||||
|
||||
Major release after a year of development in "master" branch and feature branches. Notable new features: supporting Vulkan 1.1, supporting query for memory budget.
|
||||
|
||||
Major changes:
|
||||
|
||||
- Added support for Vulkan 1.1.
|
||||
- Added member `VmaAllocatorCreateInfo::vulkanApiVersion`.
|
||||
- When Vulkan 1.1 is used, there is no need to enable VK_KHR_dedicated_allocation or VK_KHR_bind_memory2 extensions, as they are promoted to Vulkan itself.
|
||||
- Added support for query for memory budget and staying within the budget.
|
||||
- Added function `vmaGetBudget`, structure `VmaBudget`. This can also serve as simple statistics, more efficient than `vmaCalculateStats`.
|
||||
- By default the budget it is estimated based on memory heap sizes. It may be queried from the system using VK_EXT_memory_budget extension if you use `VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT` flag and `VmaAllocatorCreateInfo::instance` member.
|
||||
- Added flag `VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT` that fails an allocation if it would exceed the budget.
|
||||
- Added new memory usage options:
|
||||
- `VMA_MEMORY_USAGE_CPU_COPY` for memory that is preferably not `DEVICE_LOCAL` but not guaranteed to be `HOST_VISIBLE`.
|
||||
- `VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED` for memory that is `LAZILY_ALLOCATED`.
|
||||
- Added support for VK_KHR_bind_memory2 extension:
|
||||
- Added `VMA_ALLOCATION_CREATE_DONT_BIND_BIT` flag that lets you create both buffer/image and allocation, but don't bind them together.
|
||||
- Added flag `VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT`, functions `vmaBindBufferMemory2`, `vmaBindImageMemory2` that let you specify additional local offset and `pNext` pointer while binding.
|
||||
- Added functions `vmaSetPoolName`, `vmaGetPoolName` that let you assign string names to custom pools. JSON dump file format and VmaDumpVis tool is updated to show these names.
|
||||
- Defragmentation is legal only on buffers and images in `VK_IMAGE_TILING_LINEAR`. This is due to the way it is currently implemented in the library and the restrictions of the Vulkan specification. Clarified documentation in this regard. See discussion in #59.
|
||||
|
||||
Minor changes:
|
||||
|
||||
- Made `vmaResizeAllocation` function deprecated, always returning failure.
|
||||
- Made changes in the internal algorithm for the choice of memory type. Be careful! You may now get a type that is not `HOST_VISIBLE` or `HOST_COHERENT` if it's not stated as always ensured by some `VMA_MEMORY_USAGE_*` flag.
|
||||
- Extended VmaReplay application with more detailed statistics printed at the end.
|
||||
- Added macros `VMA_CALL_PRE`, `VMA_CALL_POST` that let you decorate declarations of all library functions if you want to e.g. export/import them as dynamically linked library.
|
||||
- Optimized `VmaAllocation` objects to be allocated out of an internal free-list allocator. This makes allocation and deallocation causing 0 dynamic CPU heap allocations on average.
|
||||
- Updated recording CSV file format version to 1.8, to support new functions.
|
||||
- Many additions and fixes in documentation. Many compatibility fixes for various compilers and platforms. Other internal bugfixes, optimizations, updates, refactoring...
|
||||
|
||||
# 2.2.0 (2018-12-13)
|
||||
|
||||
Major release after many months of development in "master" branch and feature branches. Notable new features: defragmentation of GPU memory, buddy algorithm, convenience functions for sparse binding.
|
||||
|
||||
Major changes:
|
||||
|
||||
- New, more powerful defragmentation:
|
||||
- Added structure `VmaDefragmentationInfo2`, functions `vmaDefragmentationBegin`, `vmaDefragmentationEnd`.
|
||||
- Added support for defragmentation of GPU memory.
|
||||
- Defragmentation of CPU memory now uses `memmove`, so it can move data to overlapping regions.
|
||||
- Defragmentation of CPU memory is now available for memory types that are `HOST_VISIBLE` but not `HOST_COHERENT`.
|
||||
- Added structure member `VmaVulkanFunctions::vkCmdCopyBuffer`.
|
||||
- Major internal changes in defragmentation algorithm.
|
||||
- VmaReplay: added parameters: `--DefragmentAfterLine`, `--DefragmentationFlags`.
|
||||
- Old interface (structure `VmaDefragmentationInfo`, function `vmaDefragment`) is now deprecated.
|
||||
- Added buddy algorithm, available for custom pools - flag `VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT`.
|
||||
- Added convenience functions for multiple allocations and deallocations at once, intended for sparse binding resources - functions `vmaAllocateMemoryPages`, `vmaFreeMemoryPages`.
|
||||
- Added function that tries to resize existing allocation in place: `vmaResizeAllocation`.
|
||||
- Added flags for allocation strategy: `VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT`, `VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT`, `VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT`, and their aliases: `VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT`, `VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT`, `VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT`.
|
||||
|
||||
Minor changes:
|
||||
|
||||
- Changed behavior of allocation functions to return `VK_ERROR_VALIDATION_FAILED_EXT` when trying to allocate memory of size 0, create buffer with size 0, or image with one of the dimensions 0.
|
||||
- VmaReplay: Added support for Windows end of lines.
|
||||
- Updated recording CSV file format version to 1.5, to support new functions.
|
||||
- Internal optimization: using read-write mutex on some platforms.
|
||||
- Many additions and fixes in documentation. Many compatibility fixes for various compilers. Other internal bugfixes, optimizations, refactoring, added more internal validation...
|
||||
|
||||
# 2.1.0 (2018-09-10)
|
||||
|
||||
Minor bugfixes.
|
||||
|
||||
# 2.1.0-beta.1 (2018-08-27)
|
||||
|
||||
Major release after many months of development in "development" branch and features branches. Many new features added, some bugs fixed. API stays backward-compatible.
|
||||
|
||||
Major changes:
|
||||
|
||||
- Added linear allocation algorithm, accessible for custom pools, that can be used as free-at-once, stack, double stack, or ring buffer. See "Linear allocation algorithm" documentation chapter.
|
||||
- Added `VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT`, `VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT`.
|
||||
- Added feature to record sequence of calls to the library to a file and replay it using dedicated application. See documentation chapter "Record and replay".
|
||||
- Recording: added `VmaAllocatorCreateInfo::pRecordSettings`.
|
||||
- Replaying: added VmaReplay project.
|
||||
- Recording file format: added document "docs/Recording file format.md".
|
||||
- Improved support for non-coherent memory.
|
||||
- Added functions: `vmaFlushAllocation`, `vmaInvalidateAllocation`.
|
||||
- `nonCoherentAtomSize` is now respected automatically.
|
||||
- Added `VmaVulkanFunctions::vkFlushMappedMemoryRanges`, `vkInvalidateMappedMemoryRanges`.
|
||||
- Improved debug features related to detecting incorrect mapped memory usage. See documentation chapter "Debugging incorrect memory usage".
|
||||
- Added debug macro `VMA_DEBUG_DETECT_CORRUPTION`, functions `vmaCheckCorruption`, `vmaCheckPoolCorruption`.
|
||||
- Added debug macro `VMA_DEBUG_INITIALIZE_ALLOCATIONS` to initialize contents of allocations with a bit pattern.
|
||||
- Changed behavior of `VMA_DEBUG_MARGIN` macro - it now adds margin also before first and after last allocation in a block.
|
||||
- Changed format of JSON dump returned by `vmaBuildStatsString` (not backward compatible!).
|
||||
- Custom pools and memory blocks now have IDs that don't change after sorting.
|
||||
- Added properties: "CreationFrameIndex", "LastUseFrameIndex", "Usage".
|
||||
- Changed VmaDumpVis tool to use these new properties for better coloring.
|
||||
- Changed behavior of `vmaGetAllocationInfo` and `vmaTouchAllocation` to update `allocation.lastUseFrameIndex` even if allocation cannot become lost.
|
||||
|
||||
Minor changes:
|
||||
|
||||
- Changes in custom pools:
|
||||
- Added new structure member `VmaPoolStats::blockCount`.
|
||||
- Changed behavior of `VmaPoolCreateInfo::blockSize` = 0 (default) - it now means that pool may use variable block sizes, just like default pools do.
|
||||
- Improved logic of `vmaFindMemoryTypeIndex` for some cases, especially integrated GPUs.
|
||||
- VulkanSample application: Removed dependency on external library MathFu. Added own vector and matrix structures.
|
||||
- Changes that improve compatibility with various platforms, including: Visual Studio 2012, 32-bit code, C compilers.
|
||||
- Changed usage of "VK_KHR_dedicated_allocation" extension in the code to be optional, driven by macro `VMA_DEDICATED_ALLOCATION`, for compatibility with Android.
|
||||
- Many additions and fixes in documentation, including description of new features, as well as "Validation layer warnings".
|
||||
- Other bugfixes.
|
||||
|
||||
# 2.0.0 (2018-03-19)
|
||||
|
||||
A major release with many compatibility-breaking changes.
|
||||
|
||||
Notable new features:
|
||||
|
||||
- Introduction of `VmaAllocation` handle that you must retrieve from allocation functions and pass to deallocation functions next to normal `VkBuffer` and `VkImage`.
|
||||
- Introduction of `VmaAllocationInfo` structure that you can retrieve from `VmaAllocation` handle to access parameters of the allocation (like `VkDeviceMemory` and offset) instead of retrieving them directly from allocation functions.
|
||||
- Support for reference-counted mapping and persistently mapped allocations - see `vmaMapMemory`, `VMA_ALLOCATION_CREATE_MAPPED_BIT`.
|
||||
- Support for custom memory pools - see `VmaPool` handle, `VmaPoolCreateInfo` structure, `vmaCreatePool` function.
|
||||
- Support for defragmentation (compaction) of allocations - see function `vmaDefragment` and related structures.
|
||||
- Support for "lost allocations" - see appropriate chapter on documentation Main Page.
|
||||
|
||||
# 1.0.1 (2017-07-04)
|
||||
|
||||
- Fixes for Linux GCC compilation.
|
||||
- Changed "CONFIGURATION SECTION" to contain #ifndef so you can define these macros before including this header, not necessarily change them in the file.
|
||||
|
||||
# 1.0.0 (2017-06-16)
|
||||
|
||||
First public release.
|
||||
196
3rdparty/vulkan/include/README.md
vendored
Normal file
196
3rdparty/vulkan/include/README.md
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
# Vulkan Memory Allocator
|
||||
|
||||
Easy to integrate Vulkan memory allocation library.
|
||||
|
||||
**Documentation:** Browse online: [Vulkan Memory Allocator](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/) (generated from Doxygen-style comments in [include/vk_mem_alloc.h](include/vk_mem_alloc.h))
|
||||
|
||||
**License:** MIT. See [LICENSE.txt](LICENSE.txt)
|
||||
|
||||
**Changelog:** See [CHANGELOG.md](CHANGELOG.md)
|
||||
|
||||
**Product page:** [Vulkan Memory Allocator on GPUOpen](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)
|
||||
|
||||
**Build status:**
|
||||
|
||||
- Windows: [](https://ci.appveyor.com/project/adam-sawicki-amd/vulkanmemoryallocator/branch/master)
|
||||
- Linux: [](https://app.travis-ci.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
|
||||
|
||||
[](http://isitmaintained.com/project/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator "Average time to resolve an issue")
|
||||
|
||||
# Problem
|
||||
|
||||
Memory allocation and resource (buffer and image) creation in Vulkan is difficult (comparing to older graphics APIs, like D3D11 or OpenGL) for several reasons:
|
||||
|
||||
- It requires a lot of boilerplate code, just like everything else in Vulkan, because it is a low-level and high-performance API.
|
||||
- There is additional level of indirection: `VkDeviceMemory` is allocated separately from creating `VkBuffer`/`VkImage` and they must be bound together.
|
||||
- Driver must be queried for supported memory heaps and memory types. Different GPU vendors provide different types of it.
|
||||
- It is recommended to allocate bigger chunks of memory and assign parts of them to particular resources, as there is a limit on maximum number of memory blocks that can be allocated.
|
||||
|
||||
# Features
|
||||
|
||||
This library can help game developers to manage memory allocations and resource creation by offering some higher-level functions:
|
||||
|
||||
1. Functions that help to choose correct and optimal memory type based on intended usage of the memory.
|
||||
- Required or preferred traits of the memory are expressed using higher-level description comparing to Vulkan flags.
|
||||
2. Functions that allocate memory blocks, reserve and return parts of them (`VkDeviceMemory` + offset + size) to the user.
|
||||
- Library keeps track of allocated memory blocks, used and unused ranges inside them, finds best matching unused ranges for new allocations, respects all the rules of alignment and buffer/image granularity.
|
||||
3. Functions that can create an image/buffer, allocate memory for it and bind them together - all in one call.
|
||||
|
||||
Additional features:
|
||||
|
||||
- Well-documented - description of all functions and structures provided, along with chapters that contain general description and example code.
|
||||
- Thread-safety: Library is designed to be used in multithreaded code. Access to a single device memory block referred by different buffers and textures (binding, mapping) is synchronized internally. Memory mapping is reference-counted.
|
||||
- Configuration: Fill optional members of `VmaAllocatorCreateInfo` structure to provide custom CPU memory allocator, pointers to Vulkan functions and other parameters.
|
||||
- Customization and integration with custom engines: Predefine appropriate macros to provide your own implementation of all external facilities used by the library like assert, mutex, atomic.
|
||||
- Support for memory mapping, reference-counted internally. Support for persistently mapped memory: Just allocate with appropriate flag and access the pointer to already mapped memory.
|
||||
- Support for non-coherent memory. Functions that flush/invalidate memory. `nonCoherentAtomSize` is respected automatically.
|
||||
- Support for resource aliasing (overlap).
|
||||
- Support for sparse binding and sparse residency: Convenience functions that allocate or free multiple memory pages at once.
|
||||
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it.
|
||||
- Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion.
|
||||
- Support for Vulkan 1.0...1.4.
|
||||
- Support for extensions (and equivalent functionality included in new Vulkan versions):
|
||||
- VK_KHR_dedicated_allocation: Just enable it and it will be used automatically by the library.
|
||||
- VK_KHR_bind_memory2.
|
||||
- VK_KHR_maintenance4.
|
||||
- VK_KHR_maintenance5, including `VkBufferUsageFlags2CreateInfoKHR`.
|
||||
- VK_EXT_memory_budget: Used internally if available to query for current usage and budget. If not available, it falls back to an estimation based on memory heap sizes.
|
||||
- VK_KHR_buffer_device_address: Flag `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR` is automatically added to memory allocations where needed.
|
||||
- VK_EXT_memory_priority: Set `priority` of allocations or custom pools and it will be set automatically using this extension.
|
||||
- VK_AMD_device_coherent_memory.
|
||||
- VK_KHR_external_memory_win32.
|
||||
- Defragmentation of GPU and CPU memory: Let the library move data around to free some memory blocks and make your allocations better compacted.
|
||||
- Statistics: Obtain brief or detailed statistics about the amount of memory used, unused, number of allocated blocks, number of allocations etc. - globally, per memory heap, and per memory type.
|
||||
- Debug annotations: Associate custom `void* pUserData` and debug `char* pName` with each allocation.
|
||||
- JSON dump: Obtain a string in JSON format with detailed map of internal state, including list of allocations, their string names, and gaps between them.
|
||||
- Convert this JSON dump into a picture to visualize your memory. See [tools/GpuMemDumpVis](tools/GpuMemDumpVis/README.md).
|
||||
- Debugging incorrect memory usage: Enable initialization of all allocated memory with a bit pattern to detect usage of uninitialized or freed memory. Enable validation of a magic number after every allocation to detect out-of-bounds memory corruption.
|
||||
- Support for interoperability with OpenGL.
|
||||
- Virtual allocator: Interface for using core allocation algorithm to allocate any custom data, e.g. pieces of one large buffer.
|
||||
|
||||
# Prerequisites
|
||||
|
||||
- Self-contained C++ library in single header file. No external dependencies other than standard C and C++ library and of course Vulkan. Some features of C++14 used. STL containers, RTTI, or C++ exceptions are not used.
|
||||
- Public interface in C, in same convention as Vulkan API. Implementation in C++.
|
||||
- Error handling implemented by returning `VkResult` error codes - same way as in Vulkan.
|
||||
- Interface documented using Doxygen-style comments.
|
||||
- Platform-independent, but developed and tested on Windows using Visual Studio. Continuous integration setup for Windows and Linux. Used also on Android, MacOS, and other platforms.
|
||||
|
||||
# Example
|
||||
|
||||
Basic usage of this library is very simple. Advanced features are optional. After you created global `VmaAllocator` object, a complete code needed to create a buffer may look like this:
|
||||
|
||||
```cpp
|
||||
VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufferInfo.size = 65536;
|
||||
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
|
||||
VmaAllocationCreateInfo allocInfo = {};
|
||||
allocInfo.usage = VMA_MEMORY_USAGE_AUTO;
|
||||
|
||||
VkBuffer buffer;
|
||||
VmaAllocation allocation;
|
||||
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
|
||||
```
|
||||
|
||||
With this one function call:
|
||||
|
||||
1. `VkBuffer` is created.
|
||||
2. `VkDeviceMemory` block is allocated if needed.
|
||||
3. An unused region of the memory block is bound to this buffer.
|
||||
|
||||
`VmaAllocation` is an object that represents memory assigned to this buffer. It can be queried for parameters like `VkDeviceMemory` handle and offset.
|
||||
|
||||
# How to build
|
||||
|
||||
On Windows it is recommended to use [CMake GUI](https://cmake.org/runningcmake/).
|
||||
|
||||
Alternatively you can generate/open a Visual Studio from the command line:
|
||||
|
||||
```sh
|
||||
# By default CMake picks the newest version of Visual Studio it can use
|
||||
cmake -S . -B build -D VMA_BUILD_SAMPLES=ON
|
||||
cmake --open build
|
||||
```
|
||||
|
||||
On Linux:
|
||||
|
||||
```sh
|
||||
cmake -S . -B build
|
||||
# Since VMA has no source files, you can skip to installation immediately
|
||||
cmake --install build --prefix build/install
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
After calling either `find_package` or `add_subdirectory` simply link the library.
|
||||
This automatically handles configuring the include directory. Example:
|
||||
|
||||
```cmake
|
||||
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
|
||||
target_link_libraries(YourGameEngine PRIVATE GPUOpen::VulkanMemoryAllocator)
|
||||
```
|
||||
|
||||
For more info on using CMake visit the official [CMake documentation](https://cmake.org/cmake/help/latest/index.html).
|
||||
|
||||
## Building using vcpkg
|
||||
|
||||
You can download and install VulkanMemoryAllocator using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
./vcpkg install vulkan-memory-allocator
|
||||
|
||||
The VulkanMemoryAllocator port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||
|
||||
# Binaries
|
||||
|
||||
The release comes with precompiled binary executable for "VulkanSample" application which contains test suite. It is compiled using Visual Studio 2022, so it requires appropriate libraries to work, including "MSVCP140.dll", "VCRUNTIME140.dll", "VCRUNTIME140_1.dll". If the launch fails with error message telling about those files missing, please download and install [Microsoft Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads), "X64" version.
|
||||
|
||||
# Read more
|
||||
|
||||
See **[Documentation](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/)**.
|
||||
|
||||
# Software using this library
|
||||
|
||||
- **[Blender](https://www.blender.org)**
|
||||
- **[Qt Project](https://github.com/qt)**
|
||||
- **[Baldur's Gate III](https://www.mobygames.com/game/150689/baldurs-gate-iii/credits/windows/?autoplatform=true)**
|
||||
- **[Cyberpunk 2077](https://www.mobygames.com/game/128136/cyberpunk-2077/credits/windows/?autoplatform=true)**
|
||||
- **[X-Plane](https://x-plane.com/)**
|
||||
- **[Detroit: Become Human](https://gpuopen.com/learn/porting-detroit-3/)**
|
||||
- **[Vulkan Samples](https://github.com/LunarG/VulkanSamples)** - official Khronos Vulkan samples. License: Apache-style.
|
||||
- **[GFXReconstruct](https://github.com/LunarG/gfxreconstruct)** - a tools for the capture and replay of graphics API calls. License: MIT.
|
||||
- **[Anvil](https://github.com/GPUOpen-LibrariesAndSDKs/Anvil)** - cross-platform framework for Vulkan. License: MIT.
|
||||
- **[Filament](https://github.com/google/filament)** - physically based rendering engine for Android, Windows, Linux and macOS, from Google. Apache License 2.0.
|
||||
- **[Atypical Games - proprietary game engine](https://developer.samsung.com/galaxy-gamedev/gamedev-blog/infinitejet.html)**
|
||||
- **[Flax Engine](https://flaxengine.com/)**
|
||||
- **[Godot Engine](https://github.com/godotengine/godot/)** - multi-platform 2D and 3D game engine. License: MIT.
|
||||
- **[Lightweight Java Game Library (LWJGL)](https://www.lwjgl.org/)** - includes binding of the library for Java. License: BSD.
|
||||
- **[LightweightVK](https://github.com/corporateshark/lightweightvk)** - lightweight C++ bindless Vulkan 1.3 wrapper. License: MIT.
|
||||
- **[PowerVR SDK](https://github.com/powervr-graphics/Native_SDK)** - C++ cross-platform 3D graphics SDK, from Imagination. License: MIT.
|
||||
- **[Skia](https://github.com/google/skia)** - complete 2D graphic library for drawing Text, Geometries, and Images, from Google.
|
||||
- **[The Forge](https://github.com/ConfettiFX/The-Forge)** - cross-platform rendering framework. Apache License 2.0.
|
||||
- **[VK9](https://github.com/disks86/VK9)** - Direct3D 9 compatibility layer using Vulkan. Zlib license.
|
||||
- **[vkDOOM3](https://github.com/DustinHLand/vkDOOM3)** - Vulkan port of GPL DOOM 3 BFG Edition. License: GNU GPL.
|
||||
- **[vkQuake2](https://github.com/kondrak/vkQuake2)** - vanilla Quake 2 with Vulkan support. License: GNU GPL.
|
||||
- **[Vulkan Best Practice for Mobile Developers](https://github.com/ARM-software/vulkan_best_practice_for_mobile_developers)** from ARM. License: MIT.
|
||||
- **[RPCS3](https://github.com/RPCS3/rpcs3)** - PlayStation 3 emulator/debugger. License: GNU GPLv2.
|
||||
- **[PPSSPP](https://github.com/hrydgard/ppsspp)** - Playstation Portable emulator/debugger. License: GNU GPLv2+.
|
||||
- **[Wicked Engine](https://github.com/turanszkij/WickedEngine)** - 3D engine with modern graphics
|
||||
|
||||
[Many other projects on GitHub](https://github.com/search?q=AMD_VULKAN_MEMORY_ALLOCATOR_H&type=Code) and some game development studios that use Vulkan in their games.
|
||||
|
||||
# See also
|
||||
|
||||
- **[D3D12 Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator)** - equivalent library for Direct3D 12. License: MIT.
|
||||
- **[Awesome Vulkan](https://github.com/vinjn/awesome-vulkan)** - a curated list of awesome Vulkan libraries, debuggers and resources.
|
||||
- **[vcpkg](https://github.com/Microsoft/vcpkg)** dependency manager from Microsoft also offers a port of this library.
|
||||
- **[VulkanMemoryAllocator-Hpp](https://github.com/YaaZ/VulkanMemoryAllocator-Hpp)** - C++ binding for this library. License: CC0-1.0.
|
||||
- **[PyVMA](https://github.com/realitix/pyvma)** - Python wrapper for this library. Author: Jean-Sébastien B. (@realitix). License: Apache 2.0.
|
||||
- **[vk-mem](https://github.com/gwihlidal/vk-mem-rs)** - Rust binding for this library. Author: Graham Wihlidal. License: Apache 2.0 or MIT.
|
||||
- **[Haskell bindings](https://hackage.haskell.org/package/VulkanMemoryAllocator)**, **[github](https://github.com/expipiplus1/vulkan/tree/master/VulkanMemoryAllocator)** - Haskell bindings for this library. Author: Ellie Hermaszewska (@expipiplus1). License BSD-3-Clause.
|
||||
- **[vma_sample_sdl](https://github.com/rextimmy/vma_sample_sdl)** - SDL port of the sample app of this library (with the goal of running it on multiple platforms, including MacOS). Author: @rextimmy. License: MIT.
|
||||
- **[vulkan-malloc](https://github.com/dylanede/vulkan-malloc)** - Vulkan memory allocation library for Rust. Based on version 1 of this library. Author: Dylan Ede (@dylanede). License: MIT / Apache 2.0.
|
||||
26
3rdparty/vulkan/include/vk_mem_alloc.h
vendored
26
3rdparty/vulkan/include/vk_mem_alloc.h
vendored
@@ -25,7 +25,7 @@
|
||||
|
||||
/** \mainpage Vulkan Memory Allocator
|
||||
|
||||
<b>Version 3.1.0</b>
|
||||
<b>Version 3.2.0</b>
|
||||
|
||||
Copyright (c) 2017-2024 Advanced Micro Devices, Inc. All rights reserved. \n
|
||||
License: MIT \n
|
||||
@@ -133,7 +133,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(VMA_VULKAN_VERSION)
|
||||
#if defined(VK_VERSION_1_3)
|
||||
#if defined(VK_VERSION_1_4)
|
||||
#define VMA_VULKAN_VERSION 1004000
|
||||
#elif defined(VK_VERSION_1_3)
|
||||
#define VMA_VULKAN_VERSION 1003000
|
||||
#elif defined(VK_VERSION_1_2)
|
||||
#define VMA_VULKAN_VERSION 1002000
|
||||
@@ -1121,7 +1123,7 @@ typedef struct VmaAllocatorCreateInfo
|
||||
|
||||
It must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`.
|
||||
The patch version number specified is ignored. Only the major and minor versions are considered.
|
||||
Only versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation.
|
||||
Only versions 1.0...1.4 are supported by the current implementation.
|
||||
Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.
|
||||
It must match the Vulkan version used by the application and supported on the selected physical device,
|
||||
so it must be no higher than `VkApplicationInfo::apiVersion` passed to `vkCreateInstance`
|
||||
@@ -12977,23 +12979,17 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
|
||||
VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro.");
|
||||
}
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1004000
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 4, 0) && "vulkanApiVersion >= VK_API_VERSION_1_4 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1003000
|
||||
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 3, 0))
|
||||
{
|
||||
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros.");
|
||||
}
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 3, 0) && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1002000
|
||||
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0))
|
||||
{
|
||||
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
|
||||
}
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 2, 0) && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1001000
|
||||
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
|
||||
{
|
||||
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");
|
||||
}
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0) && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if !(VMA_MEMORY_PRIORITY)
|
||||
if(m_UseExtMemoryPriority)
|
||||
|
||||
26
3rdparty/vulkan/include/vulkan/vk_mem_alloc.h
vendored
26
3rdparty/vulkan/include/vulkan/vk_mem_alloc.h
vendored
@@ -25,7 +25,7 @@
|
||||
|
||||
/** \mainpage Vulkan Memory Allocator
|
||||
|
||||
<b>Version 3.1.0</b>
|
||||
<b>Version 3.2.0</b>
|
||||
|
||||
Copyright (c) 2017-2024 Advanced Micro Devices, Inc. All rights reserved. \n
|
||||
License: MIT \n
|
||||
@@ -133,7 +133,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(VMA_VULKAN_VERSION)
|
||||
#if defined(VK_VERSION_1_3)
|
||||
#if defined(VK_VERSION_1_4)
|
||||
#define VMA_VULKAN_VERSION 1004000
|
||||
#elif defined(VK_VERSION_1_3)
|
||||
#define VMA_VULKAN_VERSION 1003000
|
||||
#elif defined(VK_VERSION_1_2)
|
||||
#define VMA_VULKAN_VERSION 1002000
|
||||
@@ -1121,7 +1123,7 @@ typedef struct VmaAllocatorCreateInfo
|
||||
|
||||
It must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`.
|
||||
The patch version number specified is ignored. Only the major and minor versions are considered.
|
||||
Only versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation.
|
||||
Only versions 1.0...1.4 are supported by the current implementation.
|
||||
Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.
|
||||
It must match the Vulkan version used by the application and supported on the selected physical device,
|
||||
so it must be no higher than `VkApplicationInfo::apiVersion` passed to `vkCreateInstance`
|
||||
@@ -12977,23 +12979,17 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
|
||||
VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT is set but required extension or Vulkan 1.2 is not available in your Vulkan header or its support in VMA has been disabled by a preprocessor macro.");
|
||||
}
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1004000
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 4, 0) && "vulkanApiVersion >= VK_API_VERSION_1_4 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1003000
|
||||
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 3, 0))
|
||||
{
|
||||
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros.");
|
||||
}
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 3, 0) && "vulkanApiVersion >= VK_API_VERSION_1_3 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1002000
|
||||
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0))
|
||||
{
|
||||
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
|
||||
}
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 2, 0) && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION < 1001000
|
||||
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
|
||||
{
|
||||
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");
|
||||
}
|
||||
VMA_ASSERT(m_VulkanApiVersion < VK_MAKE_VERSION(1, 1, 0) && "vulkanApiVersion >= VK_API_VERSION_1_1 but required Vulkan version is disabled by preprocessor macros.");
|
||||
#endif
|
||||
#if !(VMA_MEMORY_PRIORITY)
|
||||
if(m_UseExtMemoryPriority)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -593,6 +593,7 @@
|
||||
030000009b2800002c00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows,
|
||||
030000009b2800008000000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows,
|
||||
03000000790000008f18000000000000,Rapoo Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b3,y:b0,platform:Windows,
|
||||
0300000032150000a602000000000000,Razer Huntsman V3 Pro,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b12,dpright:b13,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000321500000003000000000000,Razer Hydra,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,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000f8270000bf0b000000000000,Razer Kishi,a:b6,b:b7,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b18,leftshoulder:b12,leftstick:b19,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b13,rightstick:b20,righttrigger:b15,rightx:a3,righty:a4,start:b17,x:b9,y:b10,platform:Windows,
|
||||
03000000321500000204000000000000,Razer Panthera 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,
|
||||
@@ -701,7 +702,6 @@
|
||||
03000000381000003014000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,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,
|
||||
03000000381000003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,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,
|
||||
03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,platform:Windows,
|
||||
03000000790000001c18000000000000,STK 7024X,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:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
|
||||
03000000380700003847000000000000,Street Fighter Fightstick TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b11,start:b7,x:b2,y:b3,platform:Windows,
|
||||
030000001f08000001e4000000000000,Super Famicom Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Windows,
|
||||
03000000790000000418000000000000,Super Famicom Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b33,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Windows,
|
||||
@@ -716,7 +716,8 @@
|
||||
03000000b50700001203000000000000,Techmobility X6-38V,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:Windows,
|
||||
03000000ba2200000701000000000000,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:a3,righty:a2,start:b9,x:b3,y:b2,platform:Windows,
|
||||
03000000c61100001000000000000000,Tencent Xianyou Gamepad,a:b0,b:b1,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:a3,righty:a4,x:b3,y:b4,platform:Windows,
|
||||
03000000790000002601000000000000,TGZ,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:a5,start:b9,x:b3,y:b0,platform:Windows,
|
||||
03000000790000001c18000000000000,TGZ Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows,
|
||||
03000000790000002601000000000000,TGZ 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:a5,start:b9,x:b3,y:b0,platform:Windows,
|
||||
03000000591c00002400000000000000,THEC64 Joystick,a:b0,b:b1,back:b6,leftshoulder:b4,leftx:a0,lefty:a4,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Windows,
|
||||
03000000591c00002600000000000000,THEGamepad,a:b2,b:b1,back:b6,leftx:a0,lefty:a1,start:b7,x:b3,y:b0,platform:Windows,
|
||||
030000004f04000015b3000000000000,Thrustmaster Dual Analog 4,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,
|
||||
@@ -883,7 +884,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,rightx:a2,righty:a31,start:b11,x:b4,y:b3,platform:Mac OS X,
|
||||
03000000491900001904000001010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Mac OS X,
|
||||
03000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Mac OS X,
|
||||
0300000008100000e501000019040000,Anbernic Gamepad,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:a4,start:b11,x:b4,y:b3,platform:Mac OS X,
|
||||
0300000008100000e501000019040000,Anbernic Handheld,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:a4,start:b11,x:b4,y:b3,platform:Mac OS X,
|
||||
03000000373500004610000001000000,Anbernic RG P01,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,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X,
|
||||
03000000a30c00002700000003030000,Astro City Mini,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
|
||||
03000000a30c00002800000003030000,Astro City Mini,a:b2,b:b1,back:b8,leftx:a3,lefty:a4,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Mac OS X,
|
||||
@@ -997,6 +998,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
030000007e0500001720000001000000,NSO SNES Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b15,start:b9,x:b2,y:b3,platform:Mac OS X,
|
||||
03000000550900001472000025050000,NVIDIA Controller,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Mac OS X,
|
||||
030000004b120000014d000000010000,Nyko Airflo EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Mac OS X,
|
||||
03000000790000001c18000000010000,PB Tails Choc,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,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,
|
||||
030000006f0e00000901000002010000,PDP PS3 Versus Fighting,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X,
|
||||
030000008f0e00000300000000000000,Piranha Xtreme PS3 Controller,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:a3,righty:a2,start:b9,x:b3,y:b0,platform:Mac OS X,
|
||||
03000000d620000011a7000000020000,PowerA Core Plus 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,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,
|
||||
@@ -1049,6 +1051,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000b40400000a01000000000000,Sega Saturn,a:b0,b:b1,back:b5,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b2,leftshoulder:b6,rightshoulder:b7,start:b8,x:b3,y:b4,platform:Mac OS X,
|
||||
030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Mac OS X,
|
||||
0300000000f00000f100000000000000,SNES RetroPort,a:b2,b:b3,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b5,rightshoulder:b7,start:b6,x:b0,y:b1,platform:Mac OS X,
|
||||
03000000bc2000000155000000010000,SNK NEOGEO Arcade Stick Pro,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b2,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b11,x:b0,y:b3,platform:Mac OS X,
|
||||
030000004c050000a00b000000000000,Sony DualShock 4 Adapter,a:b1,b:b2,back:b13,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,touchpad:b13,x:b0,y:b3,platform:Mac OS X,
|
||||
030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,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,touchpad:b13,x:b0,y:b3,platform:Mac OS X,
|
||||
03000000666600006706000088020000,Sony PlayStation Adapter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Mac OS X,
|
||||
@@ -1207,10 +1210,9 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
05000000491900000204000021000000,Amazon Fire Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000491900001904000011010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,platform:Linux,
|
||||
05000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Linux,
|
||||
0300000008100000e501000001010000,Anbernic Gamepad,a:b1,b:b0,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:a4,start:b11,x:b3,y:b4,platform:Linux,
|
||||
0300000008100000e501000001010000,Anbernic Handheld,a:b1,b:b0,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:a4,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000020500000913000010010000,Anbernic RG P01,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,
|
||||
03000000373500000710000010010000,Anbernic RG P01,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,
|
||||
030000005e0400008e02000072050000,Anbernic RG P01,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,
|
||||
05000000373500004610000001000000,Anbernic RG P01,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,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux,
|
||||
03000000790000003018000011010000,Arcade Fightstick F300,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000a30c00002700000011010000,Astro City Mini,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,rightshoulder:b4,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux,
|
||||
@@ -1301,7 +1303,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
030000000d0f00008400000011010000,Hori Fighting Commander,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,
|
||||
030000000d0f00005f00000011010000,Hori Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
030000000d0f00005e00000011010000,Hori Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Linux,
|
||||
030000000d0f00005001000009040000,Hori Fighting Commander OCTA Xbox One,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,
|
||||
030000000d0f00005001000009040000,Hori Fighting Commander Octa Xbox One,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,
|
||||
030000000d0f00008500000010010000,Hori Fighting Commander 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,
|
||||
030000000d0f00008600000002010000,Hori Fighting Commander Xbox 360,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux,
|
||||
030000000d0f00003701000013010000,Hori Fighting Stick Mini,a:b1,b:b0,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b3,y:b2,platform:Linux,
|
||||
@@ -1323,7 +1325,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
030000000d0f00008501000015010000,Hori Switch Split Pad Pro,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,
|
||||
030000000d0f00006e00000011010000,Horipad 4 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,
|
||||
030000000d0f00006600000011010000,Horipad 4 PS4,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,touchpad:b13,x:b0,y:b3,platform:Linux,
|
||||
030000000d0f0000ee00000011010000,Horipad Mini 4,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:a5,start:b9,x:b0,y:b3,platform:Linux,
|
||||
030000000d0f0000ee00000011010000,Horipad Mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,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,
|
||||
030000000d0f0000c100000011010000,Horipad Nintendo Switch 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,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux,
|
||||
030000000d0f00006700000001010000,Horipad One,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,
|
||||
050000000d0f0000f600000001000000,Horipad Switch Pro Controller,a:b0,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:b2,y:b3,platform:Linux,
|
||||
@@ -1346,6 +1348,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000632500007505000011010000,Ipega PG 9099,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,
|
||||
0500000049190000030400001b010000,Ipega PG9099,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,
|
||||
05000000491900000204000000000000,Ipega PG9118,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:Linux,
|
||||
03000000300f00001101000010010000,Jess Tech Colour Rumble Pad,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,
|
||||
03000000300f00001001000010010000,Jess Tech Dual Analog Rumble,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,
|
||||
03000000300f00000b01000010010000,Jess Tech GGE909 PC Recoil,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:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
|
||||
03000000ba2200002010000001010000,Jess Technology Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux,
|
||||
@@ -1607,6 +1610,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
03000000a30600001005000000010000,Saitek P150,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b7,lefttrigger:b6,rightshoulder:b2,righttrigger:b5,x:b3,y:b4,platform:Linux,
|
||||
03000000a30600000701000000010000,Saitek P220,a:b2,b:b3,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,lefttrigger:b7,rightshoulder:b4,righttrigger:b5,x:b0,y:b1,platform:Linux,
|
||||
03000000a30600000cff000010010000,Saitek P2500 Force Rumble,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b0,y:b1,platform:Linux,
|
||||
03000000a30600000d5f000010010000,Saitek P2600,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,platform:Linux,
|
||||
03000000a30600000c04000011010000,Saitek P2900,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,platform:Linux,
|
||||
03000000a306000018f5000010010000,Saitek P3200 Rumble,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Linux,
|
||||
03000000300f00001201000010010000,Saitek P380,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,
|
||||
@@ -1668,7 +1672,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
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,
|
||||
03000000790000001c18000011010000,TGZ Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,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,
|
||||
03000000591c00002600000010010000,THEGamepad,a:b2,b:b1,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b0,platform:Linux,
|
||||
030000004f04000015b3000001010000,Thrustmaster Dual Analog 3.2,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:Linux,
|
||||
@@ -1717,10 +1721,11 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
|
||||
030000006f0e00001503000000020000,Xbox 360 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:b2,y:b3,platform:Linux,
|
||||
030000005e0400008e02000000010000,Xbox 360 EasySMX,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,
|
||||
030000005e040000a102000014010000,Xbox 360 Receiver,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,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,
|
||||
0000000058626f782047616d65706100,Xbox 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:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000005e0400000202000000010000,Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
|
||||
030000005e0400008e02000072050000,Xbox 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:b2,y:b3,platform:Linux,
|
||||
030000006f0e00001304000000010000,Xbox 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:b2,y:b3,platform:Linux,
|
||||
03000000ffff0000ffff000000010000,Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux,
|
||||
0000000058626f782047616d65706100,Xbox Gamepad,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:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux,
|
||||
030000005e0400000a0b000005040000,Xbox One Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux,
|
||||
030000005e040000d102000002010000,Xbox One 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:b2,y:b3,platform:Linux,
|
||||
030000005e040000ea02000000000000,Xbox One 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:b2,y:b3,platform:Linux,
|
||||
|
||||
422
bin/utils/bulk_compression.py
Executable file
422
bin/utils/bulk_compression.py
Executable file
@@ -0,0 +1,422 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# PCSX2 - PS2 Emulator for PCs
|
||||
# Copyright (C) 2024 PCSX2 Dev Team
|
||||
#
|
||||
# PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
# of the GNU General Public License as published by the Free Software Found-
|
||||
# ation, either version 3 of the License, or (at your option) any later version.
|
||||
#
|
||||
# PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
# If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
from os.path import exists
|
||||
|
||||
gamecount = [0]
|
||||
|
||||
# =================================================================================================
|
||||
|
||||
def deletionChoice(source_extension): # Choose to delete source files
|
||||
|
||||
yesno = {
|
||||
"n" : 0,
|
||||
"no" : 0,
|
||||
"y" : 1,
|
||||
"yes" : 1,
|
||||
}
|
||||
|
||||
print("╟-------------------------------------------------------------------------------╢")
|
||||
print(f"║ Do you want to delete the original {source_extension.upper()} files as they are converted?")
|
||||
choice = input("║ Type Y or N then press ENTER: ").lower()
|
||||
|
||||
if (not choice in yesno):
|
||||
exitInvalidOption()
|
||||
|
||||
return (yesno[choice])
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def blockSizeChoice(is_cd, decompressing): # Choose block size
|
||||
|
||||
if (decompressing):
|
||||
return 0
|
||||
|
||||
sizes = {
|
||||
"1" : 16384,
|
||||
"2" : 131072,
|
||||
"3" : 262144,
|
||||
} if not is_cd else {
|
||||
"1": 17136,
|
||||
"2": 132192,
|
||||
"3": 264384,
|
||||
}
|
||||
|
||||
print("╟-------------------------------------------------------------------------------╢")
|
||||
print("║ Please pick the block size you would like to use:")
|
||||
print("║")
|
||||
print("║ 1 - 16 kB (bigger files, faster access/less CPU, choose this if unsure)")
|
||||
print("║ 2 - 128 kB (balanced)")
|
||||
print("║ 3 - 256 kB (smaller files, slower access/more CPU)")
|
||||
print("║")
|
||||
blocksize = input("║ Type the number corresponding to your selection then press ENTER: ")
|
||||
|
||||
if (not blocksize in sizes):
|
||||
exitInvalidOption()
|
||||
|
||||
return (sizes[blocksize])
|
||||
|
||||
# =================================================================================================
|
||||
|
||||
def checkSuccess(compressing, fname, extension, error_code): # Ensure file created properly
|
||||
|
||||
target_fname = f"{fname}.{extension}"
|
||||
if (error_code):
|
||||
|
||||
print("╠===============================================================================╣")
|
||||
|
||||
if (compressing):
|
||||
print(f"║ Compression to {extension.upper()} failed for the following:{(37 - len(extension)) * ' '}║")
|
||||
else:
|
||||
print(f"║ Extraction to {extension.upper()} failed for the following:{(38 - len(extension)) * ' '}║")
|
||||
|
||||
print(f"║ {target_fname}{(77 - len(target_fname)) * ' '}║")
|
||||
print("╚===============================================================================╝")
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
print(f"║ {target_fname} created.{(69 - len(target_fname)) * ' '}║")
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def checkProgramMissing(program):
|
||||
|
||||
if (sys.platform.startswith('win32') and exists(f"./{program}.exe")):
|
||||
return # Windows
|
||||
|
||||
else: # Linux, macOS
|
||||
from shutil import which
|
||||
if (which(program) is not None):
|
||||
return
|
||||
|
||||
print("╠===============================================================================╗")
|
||||
print(f"║ {program} failed, {program} is missing.{(39 - (len(program) * 2)) * ' '}║")
|
||||
print("╚===============================================================================╝")
|
||||
sys.exit(1)
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def checkBinCueMismatch(bin_files, cue_files): # Ensure all bins and cues match
|
||||
|
||||
if (len(bin_files) != len(cue_files)): # Ensure numerical parity
|
||||
exitBinCueMismatch()
|
||||
|
||||
for fname in bin_files: # Ensure filename parity
|
||||
if (f"{fname[:-4]}.cue" not in cue_files):
|
||||
exitBinCueMismatch()
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def checkDuplicates(source_files, target_extensions, crash_protection_type=0):
|
||||
|
||||
dupe_options = {
|
||||
"s" : 0,
|
||||
"skip" : 0,
|
||||
"o" : 1,
|
||||
"overwrite" : 1,
|
||||
}
|
||||
|
||||
dupe_files = []
|
||||
dupe_names = []
|
||||
target_files = []
|
||||
|
||||
for extension in target_extensions:
|
||||
target_files[len(target_files):] = returnFilteredPwdContents(extension)
|
||||
|
||||
for fname in source_files:
|
||||
for extension in target_extensions:
|
||||
target_fname = f"{fname[:-4]}.{extension}"
|
||||
if (target_fname in target_files):
|
||||
dupe_files.append(target_fname)
|
||||
|
||||
match crash_protection_type:
|
||||
case 0:
|
||||
pass
|
||||
case 1: # Skip any dupe files no matter what
|
||||
[dupe_names.append(fname[:-4]) for fname in dupe_files if fname[:-4] not in dupe_names]
|
||||
return dupe_names
|
||||
case 2: # Only skip if intermediate .iso present
|
||||
[dupe_names.append(fname[:-4]) for fname in dupe_files if fname[:-4] not in dupe_names and fname[-4:] == ".iso"]
|
||||
case _:
|
||||
pass
|
||||
|
||||
if (not dupe_files):
|
||||
return dupe_names
|
||||
|
||||
print("╟-------------------------------------------------------------------------------╢")
|
||||
print("║ The following files were found which would be overwritten:")
|
||||
|
||||
for fname in dupe_files:
|
||||
print(f"║ - {fname}")
|
||||
|
||||
print("║")
|
||||
print("║ You may choose to OVERWRITE or SKIP all of these.")
|
||||
if (crash_protection_type == 2):
|
||||
# chdman CLI just crashes trying to overwrite a .iso file
|
||||
print("║ NOTE: chdman cannot overwrite .iso files, which are used as an intermediate format.")
|
||||
print("║ These will be skipped regardless.")
|
||||
choice = input("║ Press 'O' to overwrite or 'S' to skip and press ENTER: ").lower()
|
||||
|
||||
if (choice in dupe_options):
|
||||
if (not dupe_options[choice]): # Skip
|
||||
[dupe_names.append(fname[:-4]) for fname in dupe_files if fname[:-4] not in dupe_names]
|
||||
return dupe_names
|
||||
else:
|
||||
exitInvalidOption()
|
||||
|
||||
# =================================================================================================
|
||||
|
||||
def printInitialStatus(decompressing, target_fname):
|
||||
|
||||
if (gamecount[0] != 0):
|
||||
print("╟-------------------------------------------------------------------------------╢")
|
||||
gamecount[0] += 1
|
||||
|
||||
if (decompressing):
|
||||
print(f"║ Extracting to {target_fname}... ({gamecount[0]}){(58 - len(target_fname) - len(str(gamecount[0]))) * ' '}║")
|
||||
else:
|
||||
print(f"║ Compressing to {target_fname}... ({gamecount[0]}){(57 - len(target_fname) - len(str(gamecount[0]))) * ' '}║")
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def printSkip(target_fname):
|
||||
|
||||
if (gamecount[0] != 0):
|
||||
print("╟-------------------------------------------------------------------------------╢")
|
||||
gamecount[0] += 1
|
||||
print(f"║ Skipping creation of {target_fname}{(57 - len(target_fname)) * ' '}║")
|
||||
|
||||
# =================================================================================================
|
||||
|
||||
def createCommandList(mode, source_fname, target_fname, blocksize=0):
|
||||
|
||||
match mode:
|
||||
case 1:
|
||||
return [["maxcso", f"--block={blocksize}", source_fname]]
|
||||
case 2:
|
||||
return [["chdman", "createraw", "-us", "2048", "-hs", f"{blocksize}", "-f", "-i", source_fname, "-o", target_fname]]
|
||||
case 3:
|
||||
return [["chdman", "createcd", "-hs", f"{blocksize}", "-i", source_fname, "-o", f"{source_fname[:-4]}.chd"]]
|
||||
case 4:
|
||||
return [["maxcso", "--decompress", source_fname],
|
||||
["chdman", "createraw", "-us", "2048", "-hs", f"{blocksize}", "-f", "-i", f"{source_fname[:-4]}.iso", "-o", f"{source_fname[:-4]}.chd"]]
|
||||
case 5:
|
||||
return [["chdman", "extractraw", "-i", source_fname, "-o", f"{source_fname[:-4]}.iso"],
|
||||
["maxcso", f"--block={blocksize}", f"{source_fname[:-4]}.iso"]]
|
||||
case 6:
|
||||
return [["chdman", "extractraw", "-i", source_fname, "-o", target_fname]]
|
||||
case 7:
|
||||
return [["chdman", "extractcd", "-i", source_fname, "-o", target_fname]]
|
||||
case 8:
|
||||
return [["maxcso", "--decompress", source_fname]]
|
||||
case _:
|
||||
print("You have somehow chosen an invalid mode, and this was not correctly caught by the program.\nPlease report this as a bug.")
|
||||
sys.exit(1)
|
||||
|
||||
# =================================================================================================
|
||||
|
||||
def returnFilteredPwdContents(file_extension): # Get files in pwd with extension
|
||||
|
||||
extension_pattern = r".*\." + file_extension.lower()
|
||||
extension_reg = re.compile(extension_pattern)
|
||||
return [fname for fname in os.listdir('.') if extension_reg.match(fname)]
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def deleteFile(fname): # Delete a file in pwd
|
||||
|
||||
print(f"║ Deleting {fname}...{(66 - len(fname)) * ' '}║")
|
||||
os.remove(f"./{fname}")
|
||||
|
||||
# =================================================================================================
|
||||
|
||||
def exitInvalidOption():
|
||||
|
||||
print("╠===============================================================================╗")
|
||||
print("║ Invalid option. ║")
|
||||
print("╚===============================================================================╝")
|
||||
sys.exit(1)
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
def exitBinCueMismatch():
|
||||
|
||||
print("╠===============================================================================╗")
|
||||
print("║ All BIN files must have a matching CUE. ║")
|
||||
print("╚===============================================================================╝")
|
||||
sys.exit(1)
|
||||
|
||||
# =================================================================================================
|
||||
# /////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
# =================================================================================================
|
||||
|
||||
options = { # Options listings
|
||||
1 : "Convert ISO to CSO",
|
||||
2 : "Convert ISO to CHD",
|
||||
3 : "Convert CUE/BIN to CHD",
|
||||
4 : "Convert CSO to CHD",
|
||||
5 : "Convert DVD CHD to CSO",
|
||||
6 : "Extract DVD CHD to ISO",
|
||||
7 : "Extract CD CHD to CUE/BIN",
|
||||
8 : "Extract CSO to ISO",
|
||||
9 : "Exit script",
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
sources = { # Source file extensions
|
||||
1 : "iso",
|
||||
2 : "iso",
|
||||
3 : "cue/bin",
|
||||
4 : "cso",
|
||||
5 : "chd",
|
||||
6 : "chd",
|
||||
7 : "chd",
|
||||
8 : "cso",
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
targets = { # Target file extensions
|
||||
1 : ["cso"],
|
||||
2 : ["chd"],
|
||||
3 : ["chd"],
|
||||
4 : ["iso", "chd"],
|
||||
5 : ["iso", "cso"],
|
||||
6 : ["iso"],
|
||||
7 : ["cue", "bin"],
|
||||
8 : ["iso"],
|
||||
}
|
||||
|
||||
# # -------------------------------------------------------------------------------------------------
|
||||
|
||||
reqs = { # Selection dependencies
|
||||
1 : ["maxcso"],
|
||||
2 : ["chdman"],
|
||||
3 : ["chdman"],
|
||||
4 : ["maxcso", "chdman"],
|
||||
5 : ["maxcso", "chdman"],
|
||||
6 : ["chdman"],
|
||||
7 : ["chdman"],
|
||||
8 : ["maxcso"],
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
print("╔===============================================================================╗")
|
||||
print("║ CSO/CHD/ISO/CUEBIN Conversion by Refraction, RedDevilus and TheTechnician27 ║")
|
||||
print("║ (Version Jul 16 2024) ║")
|
||||
print("╠===============================================================================╣")
|
||||
print("║ ║")
|
||||
print("║ PLEASE NOTE: This will affect all files in this folder! ║")
|
||||
print("║ Be sure to run this from the same directory as the files you wish to convert. ║")
|
||||
print("║ ║")
|
||||
|
||||
for number, message in options.items():
|
||||
print("║ ", number, " - ", message, f"{(70 - len(message)) * ' '}║")
|
||||
|
||||
print("║ ║")
|
||||
print("╠===============================================================================╝")
|
||||
#print("║")
|
||||
mode = input("║ Type the number corresponding to your selection then press ENTER: ")
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
try:
|
||||
mode = int(mode)
|
||||
|
||||
except ValueError:
|
||||
exitInvalidOption()
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
if (mode < 9 and mode > 0):
|
||||
|
||||
for program in reqs[mode]: # Check for dependencies
|
||||
checkProgramMissing(program)
|
||||
|
||||
delete = deletionChoice(sources[mode]) # Choose to delete source files
|
||||
blocksize = blockSizeChoice(mode == 3, mode > 5) # Choose block size if compressing
|
||||
|
||||
match mode:
|
||||
case 3:
|
||||
bin_files = returnFilteredPwdContents("bin") # Get all BIN files in pwd
|
||||
source_files = returnFilteredPwdContents("cue") # Get all CUE files in pwd
|
||||
checkBinCueMismatch(bin_files, source_files)
|
||||
dupe_list = checkDuplicates(source_files, targets[mode], 1)
|
||||
case 5:
|
||||
source_files = returnFilteredPwdContents(sources[mode]) # Get source files in pwd
|
||||
dupe_list = checkDuplicates(source_files, targets[mode], 2)
|
||||
case 6:
|
||||
source_files = returnFilteredPwdContents(sources[mode]) # Get source files in pwd
|
||||
dupe_list = checkDuplicates(source_files, targets[mode], 1)
|
||||
case _:
|
||||
source_files = returnFilteredPwdContents(sources[mode]) # Get source files in pwd
|
||||
dupe_list = checkDuplicates(source_files, targets[mode])
|
||||
|
||||
|
||||
print("╠===============================================================================╗")
|
||||
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
|
||||
for fname in source_files:
|
||||
|
||||
target_fname = f"{fname[:-4]}.{targets[mode][0]}"
|
||||
commands = createCommandList(mode, fname, target_fname, blocksize)
|
||||
if (fname[:-4] in dupe_list):
|
||||
printSkip(target_fname)
|
||||
continue
|
||||
|
||||
printInitialStatus(mode > 5, f"{fname[:-4]}.{targets[mode][-1]}")
|
||||
|
||||
for step, command in enumerate (commands):
|
||||
|
||||
process = Popen(commands[step], stdout=PIPE, stderr=PIPE) # Execute process
|
||||
stdout, stderr = process.communicate() # Suppress output
|
||||
checkSuccess(mode < 6, fname[:-4], # Ensure target creation
|
||||
targets[mode][step], process.returncode)
|
||||
|
||||
if (step == 1): # Delete intermediate file
|
||||
deleteFile(f"{fname[:-4]}.iso")
|
||||
|
||||
if (delete): # Delete source requested
|
||||
deleteFile(fname)
|
||||
if (mode == 3):
|
||||
deleteFile(f"{fname[:-4]}.bin")
|
||||
|
||||
# ===== EXIT SCRIPT ===============================================================================
|
||||
|
||||
elif (mode == 9):
|
||||
print("╠===============================================================================╗")
|
||||
print("║ Goodbye! :) ║")
|
||||
print("╚===============================================================================╝")
|
||||
sys.exit(0)
|
||||
|
||||
# ===== EXIT SCRIPT WITH ERROR ====================================================================
|
||||
|
||||
else:
|
||||
exitInvalidOption()
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
print("╠===============================================================================╣")
|
||||
print("║ Process complete! ║")
|
||||
print("╚===============================================================================╝")
|
||||
sys.exit(0)
|
||||
@@ -1230,6 +1230,14 @@ size_t FileSystem::ReadFileWithProgress(std::FILE* fp, void* dst, size_t length,
|
||||
{
|
||||
progress->SetProgressRange(100);
|
||||
|
||||
return FileSystem::ReadFileWithPartialProgress(fp, dst, length, progress, 0, 100, error, chunk_size);
|
||||
}
|
||||
|
||||
size_t FileSystem::ReadFileWithPartialProgress(std::FILE* fp, void* dst, size_t length,
|
||||
ProgressCallback* progress, int startPercent, int endPercent, Error* error, size_t chunk_size)
|
||||
{
|
||||
const int deltaPercent = endPercent - startPercent;
|
||||
|
||||
size_t done = 0;
|
||||
while (done < length)
|
||||
{
|
||||
@@ -1243,7 +1251,7 @@ size_t FileSystem::ReadFileWithProgress(std::FILE* fp, void* dst, size_t length,
|
||||
break;
|
||||
}
|
||||
|
||||
progress->SetProgressValue((done * 100) / length);
|
||||
progress->SetProgressValue(startPercent + (done * deltaPercent) / length);
|
||||
done += read_size;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,8 @@ namespace FileSystem
|
||||
bool WriteStringToFile(const char* filename, const std::string_view sv);
|
||||
size_t ReadFileWithProgress(std::FILE* fp, void* dst, size_t length, ProgressCallback* progress,
|
||||
Error* error = nullptr, size_t chunk_size = 16 * 1024 * 1024);
|
||||
size_t ReadFileWithPartialProgress(std::FILE* fp, void* dst, size_t length, ProgressCallback* progress,
|
||||
int startPercent, int endPercent, Error* error = nullptr, size_t chunk_size = 16 * 1024 * 1024);
|
||||
|
||||
/// creates a directory in the local filesystem
|
||||
/// if the directory already exists, the return value will be true.
|
||||
|
||||
@@ -52,10 +52,10 @@
|
||||
|
||||
<!-- MSVC automatically adds __AVX__ and __AVX2__ appropriately -->
|
||||
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_M_X86;__SSE4_1__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet Condition="!$(Configuration.Contains(AVX2)) Or $(Configuration.Contains(Clang))">NotSet</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet Condition="$(Configuration.Contains(AVX2)) And !$(Configuration.Contains(Clang))">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet Condition="'$(Platform)'=='ARM64' Or !$(Configuration.Contains(AVX2))">NotSet</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet Condition="'$(Platform)'=='x64' And $(Configuration.Contains(AVX2))">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
<!-- Allow SSE4 intrinsics on non-AVX Clang-cl builds -->
|
||||
<AdditionalOptions Condition="'$(Platform)'=='x64' And $(Configuration.Contains(Clang)) And !$(Configuration.Contains(AVX2))"> -march=nehalem %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Platform)'=='x64' And $(Configuration.Contains(Clang)) And $(Configuration.Contains(AVX2))"> -march=haswell %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Platform)'=='ARM64' And $(Configuration.Contains(Clang))"> -march=armv8.4-a %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="!$(Configuration.Contains(Clang))">%(AdditionalOptions) /Zc:externConstexpr /Zc:__cplusplus /Zo /utf-8</AdditionalOptions>
|
||||
|
||||
|
||||
@@ -460,8 +460,8 @@ std::vector<std::unique_ptr<SymbolTreeNode>> SymbolTreeModel::populateChildren(
|
||||
|
||||
for (const ccc::ast::StructOrUnion::FlatField& field : fields)
|
||||
{
|
||||
if (symbol)
|
||||
parent_handle = ccc::NodeHandle(*symbol, nullptr);
|
||||
if (field.symbol)
|
||||
parent_handle = ccc::NodeHandle(*field.symbol, nullptr);
|
||||
|
||||
SymbolTreeLocation field_location = location.addOffset(field.base_offset + field.node->offset_bytes);
|
||||
if (field_location.type == SymbolTreeLocation::NONE)
|
||||
|
||||
@@ -38,6 +38,7 @@ ControllerSettingsWindow::ControllerSettingsWindow()
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::rejected, this, &ControllerSettingsWindow::close);
|
||||
connect(m_ui.newProfile, &QPushButton::clicked, this, &ControllerSettingsWindow::onNewProfileClicked);
|
||||
connect(m_ui.applyProfile, &QPushButton::clicked, this, &ControllerSettingsWindow::onApplyProfileClicked);
|
||||
connect(m_ui.renameProfile, &QPushButton::clicked, this, &ControllerSettingsWindow::onRenameProfileClicked);
|
||||
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);
|
||||
@@ -176,6 +177,48 @@ void ControllerSettingsWindow::onApplyProfileClicked()
|
||||
switchProfile({});
|
||||
}
|
||||
|
||||
void ControllerSettingsWindow::onRenameProfileClicked()
|
||||
{
|
||||
const QString profile_name(QInputDialog::getText(this, tr("Rename Input Profile"),
|
||||
tr("Enter the new name for the input profile:").arg(m_profile_name)));
|
||||
|
||||
if (profile_name.isEmpty())
|
||||
return;
|
||||
|
||||
std::string old_profile_name(m_profile_name.toStdString());
|
||||
std::string old_profile_path(VMManager::GetInputProfilePath(m_profile_name.toStdString()));
|
||||
std::string profile_path(VMManager::GetInputProfilePath(profile_name.toStdString()));
|
||||
if (FileSystem::FileExists(profile_path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("A profile with the name '%1' already exists.").arg(profile_name));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FileSystem::RenamePath(old_profile_path.c_str(), profile_path.c_str()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to rename '%1'.").arg(QString::fromStdString(old_profile_path)));
|
||||
return;
|
||||
}
|
||||
|
||||
FileSystem::FindResultsArray files;
|
||||
FileSystem::FindFiles(EmuFolders::GameSettings.c_str(), "*", FILESYSTEM_FIND_FILES, &files);
|
||||
for (const auto& game_settings : files)
|
||||
{
|
||||
std::string game_settings_path(game_settings.FileName.c_str());
|
||||
std::unique_ptr<INISettingsInterface> update_sif(std::make_unique<INISettingsInterface>(std::move(game_settings_path)));
|
||||
|
||||
update_sif->Load();
|
||||
|
||||
if (!old_profile_name.compare(update_sif->GetStringValue("EmuCore", "InputProfileName")))
|
||||
{
|
||||
update_sif->SetStringValue("EmuCore", "InputProfileName", profile_name.toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
refreshProfileList();
|
||||
switchProfile({profile_name});
|
||||
}
|
||||
|
||||
void ControllerSettingsWindow::onDeleteProfileClicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Delete Input Profile"),
|
||||
@@ -451,6 +494,7 @@ void ControllerSettingsWindow::createWidgets()
|
||||
}
|
||||
|
||||
m_ui.applyProfile->setEnabled(isEditingProfile());
|
||||
m_ui.renameProfile->setEnabled(isEditingProfile());
|
||||
m_ui.deleteProfile->setEnabled(isEditingProfile());
|
||||
m_ui.restoreDefaults->setEnabled(isEditingGlobalSettings());
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ private Q_SLOTS:
|
||||
void onCurrentProfileChanged(int index);
|
||||
void onNewProfileClicked();
|
||||
void onApplyProfileClicked();
|
||||
void onRenameProfileClicked();
|
||||
void onDeleteProfileClicked();
|
||||
void onMappingSettingsClicked();
|
||||
void onRestoreDefaultsClicked();
|
||||
|
||||
@@ -113,6 +113,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="renameProfile">
|
||||
<property name="text">
|
||||
<string>Rename Profile</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="pencil-line"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteProfile">
|
||||
<property name="text">
|
||||
|
||||
@@ -151,6 +151,14 @@ void DebugSettingsWidget::onDrawDumpingChanged()
|
||||
m_ui.saveFrame->setEnabled(enabled);
|
||||
m_ui.saveTexture->setEnabled(enabled);
|
||||
m_ui.saveDepth->setEnabled(enabled);
|
||||
m_ui.startDraw->setEnabled(enabled);
|
||||
m_ui.dumpCount->setEnabled(enabled);
|
||||
m_ui.hwDumpDirectory->setEnabled(enabled);
|
||||
m_ui.hwDumpBrowse->setEnabled(enabled);
|
||||
m_ui.hwDumpOpen->setEnabled(enabled);
|
||||
m_ui.swDumpDirectory->setEnabled(enabled);
|
||||
m_ui.swDumpBrowse->setEnabled(enabled);
|
||||
m_ui.swDumpOpen->setEnabled(enabled);
|
||||
}
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="saveRT">
|
||||
<property name="text">
|
||||
<string>Save RT</string>
|
||||
@@ -181,7 +181,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="saveTexture">
|
||||
<property name="text">
|
||||
<string>Save Texture</string>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::string& author,
|
||||
const std::string& description, bool enabled, SettingsWindow* dialog, QWidget* parent)
|
||||
const std::string& description, bool tristate, Qt::CheckState checkState, SettingsWindow* dialog, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_dialog(dialog)
|
||||
, m_name(name)
|
||||
@@ -30,7 +30,8 @@ GamePatchDetailsWidget::GamePatchDetailsWidget(std::string name, const std::stri
|
||||
.arg(description.empty() ? tr("No description provided.") : QString::fromStdString(description)));
|
||||
|
||||
pxAssert(dialog->getSettingsInterface());
|
||||
m_ui.enabled->setChecked(enabled);
|
||||
m_ui.enabled->setTristate(tristate);
|
||||
m_ui.enabled->setCheckState(checkState);
|
||||
connect(m_ui.enabled, &QCheckBox::checkStateChanged, this, &GamePatchDetailsWidget::onEnabledStateChanged);
|
||||
}
|
||||
|
||||
@@ -40,9 +41,25 @@ void GamePatchDetailsWidget::onEnabledStateChanged(int state)
|
||||
{
|
||||
SettingsInterface* si = m_dialog->getSettingsInterface();
|
||||
if (state == Qt::Checked)
|
||||
si->AddToStringList("Patches", "Enable", m_name.c_str());
|
||||
{
|
||||
si->AddToStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY, m_name.c_str());
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, m_name.c_str());
|
||||
}
|
||||
else
|
||||
si->RemoveFromStringList("Patches", "Enable", m_name.c_str());
|
||||
{
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY, m_name.c_str());
|
||||
if (m_ui.enabled->isTristate())
|
||||
{
|
||||
if (state == Qt::Unchecked)
|
||||
{
|
||||
si->AddToStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, m_name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, m_name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
si->Save();
|
||||
g_emu_thread->reloadGameSettings();
|
||||
@@ -56,6 +73,8 @@ GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget
|
||||
m_ui.scrollArea->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
setUnlabeledPatchesWarningVisibility(false);
|
||||
setGlobalWsPatchNoteVisibility(false);
|
||||
setGlobalNiPatchNoteVisibility(false);
|
||||
|
||||
SettingsInterface* sif = m_dialog->getSettingsInterface();
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.allCRCsCheckbox, "EmuCore", "ShowPatchesForAllCRCs", false);
|
||||
@@ -88,14 +107,22 @@ void GamePatchSettingsWidget::disableAllPatches()
|
||||
|
||||
void GamePatchSettingsWidget::reloadList()
|
||||
{
|
||||
const SettingsInterface* si = m_dialog->getSettingsInterface();
|
||||
// Patches shouldn't have any unlabelled patch groups, because they're new.
|
||||
u32 number_of_unlabeled_patches = 0;
|
||||
bool showAllCRCS = m_ui.allCRCsCheckbox->isChecked();
|
||||
std::vector<Patch::PatchInfo> patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, showAllCRCS, &number_of_unlabeled_patches);
|
||||
std::vector<std::string> enabled_list =
|
||||
m_dialog->getSettingsInterface()->GetStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY);
|
||||
si->GetStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY);
|
||||
std::vector<std::string> disabled_list =
|
||||
si->GetStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY);
|
||||
|
||||
const bool ws_patches_enabled_globally = m_dialog->getEffectiveBoolValue("EmuCore", "EnableWideScreenPatches", false);
|
||||
const bool ni_patches_enabled_globally = m_dialog->getEffectiveBoolValue("EmuCore", "EnableNoInterlacingPatches", false);
|
||||
|
||||
setUnlabeledPatchesWarningVisibility(number_of_unlabeled_patches > 0);
|
||||
setGlobalWsPatchNoteVisibility(ws_patches_enabled_globally);
|
||||
setGlobalNiPatchNoteVisibility(ni_patches_enabled_globally);
|
||||
delete m_ui.scrollArea->takeWidget();
|
||||
|
||||
QWidget* container = new QWidget(m_ui.scrollArea);
|
||||
@@ -106,7 +133,7 @@ void GamePatchSettingsWidget::reloadList()
|
||||
{
|
||||
bool first = true;
|
||||
|
||||
for (Patch::PatchInfo& pi : patches)
|
||||
for (const Patch::PatchInfo& pi : patches)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
@@ -120,9 +147,35 @@ void GamePatchSettingsWidget::reloadList()
|
||||
first = false;
|
||||
}
|
||||
|
||||
const bool enabled = (std::find(enabled_list.begin(), enabled_list.end(), pi.name) != enabled_list.end());
|
||||
const bool is_on_enable_list = std::find(enabled_list.begin(), enabled_list.end(), pi.name) != enabled_list.end();
|
||||
const bool is_on_disable_list = std::find(disabled_list.begin(), disabled_list.end(), pi.name) != disabled_list.end();
|
||||
const bool globally_toggleable_option = Patch::IsGloballyToggleablePatch(pi);
|
||||
|
||||
Qt::CheckState check_state;
|
||||
if (!globally_toggleable_option)
|
||||
{
|
||||
// Normal patches
|
||||
check_state = is_on_enable_list && !is_on_disable_list ? Qt::CheckState::Checked : Qt::CheckState::Unchecked;
|
||||
}
|
||||
else
|
||||
{
|
||||
// WS/NI patches
|
||||
if (is_on_disable_list)
|
||||
{
|
||||
check_state = Qt::CheckState::Unchecked;
|
||||
}
|
||||
else if (is_on_enable_list)
|
||||
{
|
||||
check_state = Qt::CheckState::Checked;
|
||||
}
|
||||
else
|
||||
{
|
||||
check_state = Qt::CheckState::PartiallyChecked;
|
||||
}
|
||||
}
|
||||
|
||||
GamePatchDetailsWidget* it =
|
||||
new GamePatchDetailsWidget(std::move(pi.name), pi.author, pi.description, enabled, m_dialog, container);
|
||||
new GamePatchDetailsWidget(std::move(pi.name), pi.author, pi.description, globally_toggleable_option, check_state, m_dialog, container);
|
||||
layout->addWidget(it);
|
||||
}
|
||||
}
|
||||
@@ -141,3 +194,13 @@ void GamePatchSettingsWidget::setUnlabeledPatchesWarningVisibility(bool visible)
|
||||
{
|
||||
m_ui.unlabeledPatchWarning->setVisible(visible);
|
||||
}
|
||||
|
||||
void GamePatchSettingsWidget::setGlobalWsPatchNoteVisibility(bool visible)
|
||||
{
|
||||
m_ui.globalWsPatchState->setVisible(visible);
|
||||
}
|
||||
|
||||
void GamePatchSettingsWidget::setGlobalNiPatchNoteVisibility(bool visible)
|
||||
{
|
||||
m_ui.globalNiPatchState->setVisible(visible);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class GamePatchDetailsWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GamePatchDetailsWidget(std::string name, const std::string& author, const std::string& description, bool enabled,
|
||||
GamePatchDetailsWidget(std::string name, const std::string& author, const std::string& description, bool tristate, Qt::CheckState checkState,
|
||||
SettingsWindow* dialog, QWidget* parent);
|
||||
~GamePatchDetailsWidget();
|
||||
|
||||
@@ -50,6 +50,8 @@ private Q_SLOTS:
|
||||
private:
|
||||
void reloadList();
|
||||
void setUnlabeledPatchesWarningVisibility(bool visible);
|
||||
void setGlobalWsPatchNoteVisibility(bool visible);
|
||||
void setGlobalNiPatchNoteVisibility(bool visible);
|
||||
|
||||
Ui::GamePatchSettingsWidget m_ui;
|
||||
SettingsWindow* m_dialog;
|
||||
|
||||
@@ -38,6 +38,29 @@
|
||||
<property name="text">
|
||||
<string>Any patches bundled with PCSX2 for this game will be disabled since you have unlabeled patches loaded.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="globalWsPatchState">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Widescreen patches are currently <span style=" font-weight:600;">ENABLED</span> globally.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="globalNiPatchState">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>No-Interlacing patches are currently <span style=" font-weight:600;">ENABLED</span> globally.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
#include "pcsx2/Host.h"
|
||||
#include "pcsx2/Patch.h"
|
||||
#include "pcsx2/GS/GS.h"
|
||||
#include "pcsx2/GS/GSCapture.h"
|
||||
#include "pcsx2/GS/GSUtil.h"
|
||||
@@ -321,24 +322,61 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get rid of widescreen/no-interlace checkboxes from per-game settings, unless the user previously had them set.
|
||||
// Get rid of widescreen/no-interlace checkboxes from per-game settings, and migrate them to Patches if necessary.
|
||||
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)
|
||||
SettingsInterface* si = m_dialog->getSettingsInterface();
|
||||
bool needs_save = false;
|
||||
|
||||
if (si->ContainsValue("EmuCore", "EnableWideScreenPatches"))
|
||||
{
|
||||
m_dialog->removeSettingValue("EmuCore", "EnableWideScreenPatches");
|
||||
m_dialog->removeSettingValue("EmuCore", "EnableNoInterlacingPatches");
|
||||
const bool ws_enabled = si->GetBoolValue("EmuCore", "EnableWideScreenPatches");
|
||||
si->DeleteValue("EmuCore", "EnableWideScreenPatches");
|
||||
|
||||
const char* WS_PATCH_NAME = "Widescreen 16:9";
|
||||
if (ws_enabled)
|
||||
{
|
||||
si->AddToStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY, WS_PATCH_NAME);
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, WS_PATCH_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
si->AddToStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, WS_PATCH_NAME);
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY, WS_PATCH_NAME);
|
||||
}
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (si->ContainsValue("EmuCore", "EnableNoInterlacingPatches"))
|
||||
{
|
||||
const bool ni_enabled = si->GetBoolValue("EmuCore", "EnableNoInterlacingPatches");
|
||||
si->DeleteValue("EmuCore", "EnableNoInterlacingPatches");
|
||||
|
||||
const char* NI_PATCH_NAME = "No-Interlacing";
|
||||
if (ni_enabled)
|
||||
{
|
||||
si->AddToStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY, NI_PATCH_NAME);
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, NI_PATCH_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
si->AddToStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_DISABLE_CONFIG_KEY, NI_PATCH_NAME);
|
||||
si->RemoveFromStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY, NI_PATCH_NAME);
|
||||
}
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (needs_save)
|
||||
{
|
||||
m_dialog->saveAndReloadGameSettings();
|
||||
}
|
||||
|
||||
m_ui.displayGridLayout->removeWidget(m_ui.widescreenPatches);
|
||||
m_ui.displayGridLayout->removeWidget(m_ui.noInterlacingPatches);
|
||||
safe_delete(m_ui.widescreenPatches);
|
||||
safe_delete(m_ui.noInterlacingPatches);
|
||||
m_ui.widescreenPatches->deleteLater();
|
||||
m_ui.noInterlacingPatches->deleteLater();
|
||||
m_ui.widescreenPatches = nullptr;
|
||||
m_ui.noInterlacingPatches = nullptr;
|
||||
}
|
||||
|
||||
// Hide advanced options by default.
|
||||
@@ -350,10 +388,13 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
m_ui.advancedTab = nullptr;
|
||||
m_ui.gsDownloadMode = nullptr;
|
||||
m_ui.gsDumpCompression = nullptr;
|
||||
m_ui.texturePreloading = nullptr;
|
||||
m_ui.exclusiveFullscreenControl = nullptr;
|
||||
m_ui.useBlitSwapChain = nullptr;
|
||||
m_ui.disableMailboxPresentation = nullptr;
|
||||
m_ui.extendedUpscales = nullptr;
|
||||
m_ui.spinCPUDuringReadbacks = nullptr;
|
||||
m_ui.spinGPUDuringReadbacks = nullptr;
|
||||
m_ui.skipPresentingDuplicateFrames = nullptr;
|
||||
m_ui.overrideTextureBarriers = nullptr;
|
||||
m_ui.disableFramebufferFetch = nullptr;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
22125
pcsx2-qt/Translations/pcsx2-qt_gn-PY.ts
Normal file
22125
pcsx2-qt/Translations/pcsx2-qt_gn-PY.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
22132
pcsx2-qt/Translations/pcsx2-qt_qu-PE.ts
Normal file
22132
pcsx2-qt/Translations/pcsx2-qt_qu-PE.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -300,7 +300,7 @@ std::string Achievements::GetGameHash(const std::string& elf_path)
|
||||
Error error;
|
||||
if (!cdvdLoadElf(&elfo, elf_path, false, &error))
|
||||
{
|
||||
Console.Error(fmt::format("(Achievements) Failed to read ELF '{}' on disc: {}", elf_path, error.GetDescription()));
|
||||
Console.Error(fmt::format("Achievements: Failed to read ELF '{}' on disc: {}", elf_path, error.GetDescription()));
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ bool Achievements::Initialize()
|
||||
const std::string api_token = Host::GetBaseStringSettingValue("Achievements", "Token");
|
||||
if (!username.empty() && !api_token.empty())
|
||||
{
|
||||
Console.WriteLn("(Achievements) Attempting login with user '%s'...", username.c_str());
|
||||
Console.WriteLn("Achievements: Attempting login with user '%s'...", username.c_str());
|
||||
s_login_request =
|
||||
rc_client_begin_login_with_token(s_client, username.c_str(), api_token.c_str(), ClientLoginWithTokenCallback, nullptr);
|
||||
}
|
||||
@@ -608,7 +608,7 @@ void Achievements::EnsureCacheDirectoriesExist()
|
||||
|
||||
void Achievements::ClientMessageCallback(const char* message, const rc_client_t* client)
|
||||
{
|
||||
Console.WriteLn("(Achievements) %s", message);
|
||||
Console.WriteLn("Achievements: %s", message);
|
||||
}
|
||||
|
||||
uint32_t Achievements::ClientReadMemory(uint32_t address, uint8_t* buffer, uint32_t num_bytes, rc_client_t* client)
|
||||
@@ -865,7 +865,7 @@ void Achievements::IdentifyGame(u32 disc_crc, u32 crc)
|
||||
// bail out if we're not logged in, just save the hash
|
||||
if (!IsLoggedInOrLoggingIn())
|
||||
{
|
||||
Console.WriteLn(Color_StrongYellow, "(Achievements) Skipping load game because we're not logged in.");
|
||||
Console.WriteLn(Color_StrongYellow, "Achievements: Skipping load game because we're not logged in.");
|
||||
DisableHardcoreMode();
|
||||
return;
|
||||
}
|
||||
@@ -908,7 +908,7 @@ void Achievements::ClientLoadGameCallback(int result, const char* error_message,
|
||||
if (result == RC_NO_GAME_LOADED)
|
||||
{
|
||||
// Unknown game.
|
||||
Console.WriteLn(Color_StrongYellow, "(Achievements) Unknown game '%s', disabling achievements.", s_game_hash.c_str());
|
||||
Console.WriteLn(Color_StrongYellow, "Achievements: Unknown game '%s', disabling achievements.", s_game_hash.c_str());
|
||||
DisableHardcoreMode();
|
||||
return;
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@ void Achievements::HandleUnlockEvent(const rc_client_event_t* event)
|
||||
const rc_client_achievement_t* cheevo = event->achievement;
|
||||
pxAssert(cheevo);
|
||||
|
||||
Console.WriteLn("(Achievements) Achievement %s (%u) for game %u unlocked", cheevo->title, cheevo->id, s_game_id);
|
||||
Console.WriteLn("Achievements: Achievement %s (%u) for game %u unlocked", cheevo->title, cheevo->id, s_game_id);
|
||||
UpdateGameSummary();
|
||||
|
||||
if (EmuConfig.Achievements.Notifications)
|
||||
@@ -1109,7 +1109,7 @@ void Achievements::HandleUnlockEvent(const rc_client_event_t* event)
|
||||
|
||||
void Achievements::HandleGameCompleteEvent(const rc_client_event_t* event)
|
||||
{
|
||||
Console.WriteLn("(Achievements) Game %u complete", s_game_id);
|
||||
Console.WriteLn("Achievements: Game %u complete", s_game_id);
|
||||
UpdateGameSummary();
|
||||
|
||||
if (EmuConfig.Achievements.Notifications)
|
||||
@@ -1133,7 +1133,7 @@ void Achievements::HandleGameCompleteEvent(const rc_client_event_t* event)
|
||||
|
||||
void Achievements::HandleLeaderboardStartedEvent(const rc_client_event_t* event)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Leaderboard %u (%s) started", event->leaderboard->id, event->leaderboard->title);
|
||||
DevCon.WriteLn("Achievements: Leaderboard %u (%s) started", event->leaderboard->id, event->leaderboard->title);
|
||||
|
||||
if (EmuConfig.Achievements.LeaderboardNotifications)
|
||||
{
|
||||
@@ -1152,7 +1152,7 @@ void Achievements::HandleLeaderboardStartedEvent(const rc_client_event_t* event)
|
||||
|
||||
void Achievements::HandleLeaderboardFailedEvent(const rc_client_event_t* event)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Leaderboard %u (%s) failed", event->leaderboard->id, event->leaderboard->title);
|
||||
DevCon.WriteLn("Achievements: Leaderboard %u (%s) failed", event->leaderboard->id, event->leaderboard->title);
|
||||
|
||||
if (EmuConfig.Achievements.LeaderboardNotifications)
|
||||
{
|
||||
@@ -1171,7 +1171,7 @@ void Achievements::HandleLeaderboardFailedEvent(const rc_client_event_t* event)
|
||||
|
||||
void Achievements::HandleLeaderboardSubmittedEvent(const rc_client_event_t* event)
|
||||
{
|
||||
Console.WriteLn("(Achievements) Leaderboard %u (%s) submitted", event->leaderboard->id, event->leaderboard->title);
|
||||
Console.WriteLn("Achievements: Leaderboard %u (%s) submitted", event->leaderboard->id, event->leaderboard->title);
|
||||
|
||||
if (EmuConfig.Achievements.LeaderboardNotifications)
|
||||
{
|
||||
@@ -1203,7 +1203,7 @@ void Achievements::HandleLeaderboardSubmittedEvent(const rc_client_event_t* even
|
||||
|
||||
void Achievements::HandleLeaderboardScoreboardEvent(const rc_client_event_t* event)
|
||||
{
|
||||
Console.WriteLn("(Achievements) Leaderboard %u scoreboard rank %u of %u", event->leaderboard_scoreboard->leaderboard_id,
|
||||
Console.WriteLn("Achievements: Leaderboard %u scoreboard rank %u of %u", event->leaderboard_scoreboard->leaderboard_id,
|
||||
event->leaderboard_scoreboard->new_rank, event->leaderboard_scoreboard->num_entries);
|
||||
|
||||
if (EmuConfig.Achievements.LeaderboardNotifications)
|
||||
@@ -1234,7 +1234,7 @@ void Achievements::HandleLeaderboardScoreboardEvent(const rc_client_event_t* eve
|
||||
void Achievements::HandleLeaderboardTrackerShowEvent(const rc_client_event_t* event)
|
||||
{
|
||||
DevCon.WriteLn(
|
||||
"(Achievements) Showing leaderboard tracker: %u: %s", event->leaderboard_tracker->id, event->leaderboard_tracker->display);
|
||||
"Achievements: Showing leaderboard tracker: %u: %s", event->leaderboard_tracker->id, event->leaderboard_tracker->display);
|
||||
|
||||
LeaderboardTrackerIndicator indicator;
|
||||
indicator.tracker_id = event->leaderboard_tracker->id;
|
||||
@@ -1251,7 +1251,7 @@ void Achievements::HandleLeaderboardTrackerHideEvent(const rc_client_event_t* ev
|
||||
if (it == s_active_leaderboard_trackers.end())
|
||||
return;
|
||||
|
||||
DevCon.WriteLn("(Achievements) Hiding leaderboard tracker: %u", id);
|
||||
DevCon.WriteLn("Achievements: Hiding leaderboard tracker: %u", id);
|
||||
it->active = false;
|
||||
it->show_hide_time.Reset();
|
||||
}
|
||||
@@ -1265,7 +1265,7 @@ void Achievements::HandleLeaderboardTrackerUpdateEvent(const rc_client_event_t*
|
||||
return;
|
||||
|
||||
DevCon.WriteLn(
|
||||
"(Achievements) Updating leaderboard tracker: %u: %s", event->leaderboard_tracker->id, event->leaderboard_tracker->display);
|
||||
"Achievements: Updating leaderboard tracker: %u: %s", event->leaderboard_tracker->id, event->leaderboard_tracker->display);
|
||||
|
||||
it->text = event->leaderboard_tracker->display;
|
||||
it->active = true;
|
||||
@@ -1288,7 +1288,7 @@ void Achievements::HandleAchievementChallengeIndicatorShowEvent(const rc_client_
|
||||
indicator.active = true;
|
||||
s_active_challenge_indicators.push_back(std::move(indicator));
|
||||
|
||||
DevCon.WriteLn("(Achievements) Show challenge indicator for %u (%s)", event->achievement->id, event->achievement->title);
|
||||
DevCon.WriteLn("Achievements: Show challenge indicator for %u (%s)", event->achievement->id, event->achievement->title);
|
||||
}
|
||||
|
||||
void Achievements::HandleAchievementChallengeIndicatorHideEvent(const rc_client_event_t* event)
|
||||
@@ -1298,14 +1298,14 @@ void Achievements::HandleAchievementChallengeIndicatorHideEvent(const rc_client_
|
||||
if (it == s_active_challenge_indicators.end())
|
||||
return;
|
||||
|
||||
DevCon.WriteLn("(Achievements) Hide challenge indicator for %u (%s)", event->achievement->id, event->achievement->title);
|
||||
DevCon.WriteLn("Achievements: Hide challenge indicator for %u (%s)", event->achievement->id, event->achievement->title);
|
||||
it->show_hide_time.Reset();
|
||||
it->active = false;
|
||||
}
|
||||
|
||||
void Achievements::HandleAchievementProgressIndicatorShowEvent(const rc_client_event_t* event)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Showing progress indicator: %u (%s): %s", event->achievement->id, event->achievement->title,
|
||||
DevCon.WriteLn("Achievements: Showing progress indicator: %u (%s): %s", event->achievement->id, event->achievement->title,
|
||||
event->achievement->measured_progress);
|
||||
|
||||
if (!s_active_progress_indicator.has_value())
|
||||
@@ -1323,14 +1323,14 @@ void Achievements::HandleAchievementProgressIndicatorHideEvent(const rc_client_e
|
||||
if (!s_active_progress_indicator.has_value())
|
||||
return;
|
||||
|
||||
DevCon.WriteLn("(Achievements) Hiding progress indicator");
|
||||
DevCon.WriteLn("Achievements: Hiding progress indicator");
|
||||
s_active_progress_indicator->show_hide_time.Reset();
|
||||
s_active_progress_indicator->active = false;
|
||||
}
|
||||
|
||||
void Achievements::HandleAchievementProgressIndicatorUpdateEvent(const rc_client_event_t* event)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Updating progress indicator: %u (%s): %s", event->achievement->id, event->achievement->title,
|
||||
DevCon.WriteLn("Achievements: Updating progress indicator: %u (%s): %s", event->achievement->id, event->achievement->title,
|
||||
event->achievement->measured_progress);
|
||||
s_active_progress_indicator->achievement = event->achievement;
|
||||
s_active_progress_indicator->active = true;
|
||||
@@ -1341,13 +1341,13 @@ void Achievements::HandleServerErrorEvent(const rc_client_event_t* event)
|
||||
std::string message = fmt::format(TRANSLATE_FS("Achievements", "Server error in {0}:\n{1}"),
|
||||
event->server_error->api ? event->server_error->api : "UNKNOWN",
|
||||
event->server_error->error_message ? event->server_error->error_message : "UNKNOWN");
|
||||
Console.Error("(Achievements) %s", message.c_str());
|
||||
Console.Error("Achievements: %s", message.c_str());
|
||||
Host::AddOSDMessage(std::move(message), Host::OSD_ERROR_DURATION);
|
||||
}
|
||||
|
||||
void Achievements::HandleServerDisconnectedEvent(const rc_client_event_t* event)
|
||||
{
|
||||
Console.Warning("(Achievements) Server disconnected.");
|
||||
Console.Warning("Achievements: Server disconnected.");
|
||||
|
||||
MTGS::RunOnGSThread([]() {
|
||||
if (ImGuiManager::InitializeFullscreenUI())
|
||||
@@ -1360,7 +1360,7 @@ void Achievements::HandleServerDisconnectedEvent(const rc_client_event_t* event)
|
||||
|
||||
void Achievements::HandleServerReconnectedEvent(const rc_client_event_t* event)
|
||||
{
|
||||
Console.Warning("(Achievements) Server reconnected.");
|
||||
Console.Warning("Achievements: Server reconnected.");
|
||||
|
||||
MTGS::RunOnGSThread([]() {
|
||||
if (ImGuiManager::InitializeFullscreenUI())
|
||||
@@ -1385,7 +1385,7 @@ void Achievements::ResetClient()
|
||||
if (!IsActive())
|
||||
return;
|
||||
|
||||
Console.WriteLn("(Achievements) Reset client");
|
||||
Console.WriteLn("Achievements: Reset client");
|
||||
rc_client_reset(s_client);
|
||||
}
|
||||
|
||||
@@ -1811,11 +1811,11 @@ void Achievements::Logout()
|
||||
if (HasActiveGame())
|
||||
ClearGameInfo();
|
||||
|
||||
Console.WriteLn("(Achievements) Logging out...");
|
||||
Console.WriteLn("Achievements: Logging out...");
|
||||
rc_client_logout(s_client);
|
||||
}
|
||||
|
||||
Console.WriteLn("(Achievements) Clearing credentials...");
|
||||
Console.WriteLn("Achievements: Clearing credentials...");
|
||||
Host::RemoveBaseSettingValue("Achievements", "Username");
|
||||
Host::RemoveBaseSettingValue("Achievements", "Token");
|
||||
Host::RemoveBaseSettingValue("Achievements", "LoginTimestamp");
|
||||
@@ -1961,7 +1961,7 @@ void Achievements::DrawGameOverlays()
|
||||
|
||||
if (!indicator.active && opacity <= 0.01f)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Remove challenge indicator");
|
||||
DevCon.WriteLn("Achievements: Remove challenge indicator");
|
||||
it = s_active_challenge_indicators.erase(it);
|
||||
}
|
||||
else
|
||||
@@ -2004,7 +2004,7 @@ void Achievements::DrawGameOverlays()
|
||||
|
||||
if (!indicator.active && opacity <= 0.01f)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Remove progress indicator");
|
||||
DevCon.WriteLn("Achievements: Remove progress indicator");
|
||||
s_active_progress_indicator.reset();
|
||||
}
|
||||
|
||||
@@ -2046,7 +2046,7 @@ void Achievements::DrawGameOverlays()
|
||||
|
||||
if (!indicator.active && opacity <= 0.01f)
|
||||
{
|
||||
DevCon.WriteLn("(Achievements) Remove tracker indicator");
|
||||
DevCon.WriteLn("Achievements: Remove tracker indicator");
|
||||
it = s_active_leaderboard_trackers.erase(it);
|
||||
}
|
||||
else
|
||||
@@ -2151,7 +2151,7 @@ bool Achievements::PrepareAchievementsWindow()
|
||||
RC_CLIENT_ACHIEVEMENT_LIST_GROUPING_PROGRESS /*RC_CLIENT_ACHIEVEMENT_LIST_GROUPING_LOCK_STATE*/);
|
||||
if (!s_achievement_list)
|
||||
{
|
||||
Console.Error("(Achievements) rc_client_create_achievement_list() returned null");
|
||||
Console.Error("Achievements: rc_client_create_achievement_list() returned null");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2489,7 +2489,7 @@ bool Achievements::PrepareLeaderboardsWindow()
|
||||
s_leaderboard_list = rc_client_create_leaderboard_list(client, RC_CLIENT_LEADERBOARD_LIST_GROUPING_NONE);
|
||||
if (!s_leaderboard_list)
|
||||
{
|
||||
Console.Error("(Achievements) rc_client_create_leaderboard_list() returned null");
|
||||
Console.Error("Achievements: rc_client_create_leaderboard_list() returned null");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2920,7 +2920,7 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
|
||||
|
||||
void Achievements::OpenLeaderboard(const rc_client_leaderboard_t* lboard)
|
||||
{
|
||||
Console.WriteLn("(Achievements) Opening leaderboard '%s' (%u)", lboard->title, lboard->id);
|
||||
Console.WriteLn("Achievements: Opening leaderboard '%s' (%u)", lboard->title, lboard->id);
|
||||
|
||||
CloseLeaderboard();
|
||||
|
||||
@@ -2974,7 +2974,7 @@ void Achievements::FetchNextLeaderboardEntries()
|
||||
for (rc_client_leaderboard_entry_list_t* list : s_leaderboard_entry_lists)
|
||||
start += list->num_entries;
|
||||
|
||||
Console.WriteLn("(Achievements) Fetching entries %u to %u", start, start + LEADERBOARD_ALL_FETCH_SIZE);
|
||||
Console.WriteLn("Achievements: Fetching entries %u to %u", start, start + LEADERBOARD_ALL_FETCH_SIZE);
|
||||
|
||||
if (s_leaderboard_fetch_handle)
|
||||
rc_client_abort_async(s_client, s_leaderboard_fetch_handle);
|
||||
|
||||
@@ -20,6 +20,186 @@ static constexpr u32 MAX_PARENTS = 32; // Surely someone wouldn't be insane enou
|
||||
static std::vector<std::pair<std::string, chd_header>> s_chd_hash_cache; // <filename, header>
|
||||
static std::recursive_mutex s_chd_hash_cache_mutex;
|
||||
|
||||
// Provides an implementation of core_file which allows us to control if the underlying FILE handle is freed.
|
||||
// Additionally, this class allows greater control and feedback while precaching CHD files.
|
||||
// The lifetime of ChdCoreFileWrapper will be equal to that of the relevant chd_file,
|
||||
// ChdCoreFileWrapper will also get destroyed if chd_open_core_file fails.
|
||||
class ChdCoreFileWrapper
|
||||
{
|
||||
DeclareNoncopyableObject(ChdCoreFileWrapper);
|
||||
|
||||
private:
|
||||
core_file m_core;
|
||||
std::FILE* m_file;
|
||||
bool m_free_file = false;
|
||||
ChdCoreFileWrapper* m_parent = nullptr;
|
||||
std::unique_ptr<u8[]> m_file_cache;
|
||||
s64 m_file_cache_size;
|
||||
s64 m_file_cache_pos;
|
||||
|
||||
public:
|
||||
ChdCoreFileWrapper(std::FILE* file, ChdCoreFileWrapper* parent)
|
||||
: m_file{file}
|
||||
, m_parent{parent}
|
||||
{
|
||||
m_core.argp = this;
|
||||
m_core.fsize = FSize;
|
||||
m_core.fread = FRead;
|
||||
m_core.fclose = FClose;
|
||||
m_core.fseek = FSeek;
|
||||
}
|
||||
|
||||
~ChdCoreFileWrapper()
|
||||
{
|
||||
if (m_free_file && m_file)
|
||||
std::fclose(m_file);
|
||||
}
|
||||
|
||||
core_file* GetCoreFile()
|
||||
{
|
||||
return &m_core;
|
||||
}
|
||||
|
||||
static ChdCoreFileWrapper* FromCoreFile(core_file* file)
|
||||
{
|
||||
return reinterpret_cast<ChdCoreFileWrapper*>(file->argp);
|
||||
}
|
||||
|
||||
void SetFileOwner(bool isOwner)
|
||||
{
|
||||
m_free_file = isOwner;
|
||||
}
|
||||
|
||||
s64 GetPrecacheSize()
|
||||
{
|
||||
const s64 size = static_cast<size_t>(FileSystem::FSize64(m_file));
|
||||
if (m_parent != nullptr)
|
||||
return m_parent->GetPrecacheSize() + size;
|
||||
else
|
||||
return size;
|
||||
}
|
||||
|
||||
bool Precache(ProgressCallback* progress, Error* error)
|
||||
{
|
||||
progress->SetProgressRange(100);
|
||||
|
||||
const s64 size = GetPrecacheSize();
|
||||
return PrecacheInternal(progress, error, 0, size);
|
||||
}
|
||||
|
||||
private:
|
||||
bool PrecacheInternal(ProgressCallback* progress, Error* error, s64 startSize, s64 finalSize)
|
||||
{
|
||||
m_file_cache_size = FileSystem::FSize64(m_file);
|
||||
if (m_file_cache_size <= 0)
|
||||
{
|
||||
Error::SetStringView(error, "Failed to determine file size.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the current file position.
|
||||
m_file_cache_pos = FileSystem::FTell64(m_file);
|
||||
if (m_file_cache_pos <= 0)
|
||||
{
|
||||
Error::SetStringView(error, "Failed to determine file position.");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_file_cache = std::make_unique_for_overwrite<u8[]>(m_file_cache_size);
|
||||
if (FileSystem::FSeek64(m_file, 0, SEEK_SET) != 0 ||
|
||||
FileSystem::ReadFileWithPartialProgress(
|
||||
m_file, m_file_cache.get(), m_file_cache_size, progress,
|
||||
(startSize * 100) / finalSize,
|
||||
((startSize + m_file_cache_size) * 100) / finalSize,
|
||||
error) != static_cast<size_t>(m_file_cache_size))
|
||||
{
|
||||
m_file_cache.reset();
|
||||
// Precache failed, continue using file
|
||||
// Restore file position incase it's used for subsequent reads
|
||||
FileSystem::FSeek64(m_file, m_file_cache_pos, SEEK_SET);
|
||||
Error::SetStringView(error, "Failed to read part of the file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
startSize += m_file_cache_size;
|
||||
|
||||
if (m_parent)
|
||||
{
|
||||
if (!m_parent->PrecacheInternal(progress, error, startSize, finalSize))
|
||||
{
|
||||
// Precache failed, continue using file
|
||||
// Restore file position incase it's used for subsequent reads
|
||||
FileSystem::FSeek64(m_file, m_file_cache_pos, SEEK_SET);
|
||||
m_file_cache.reset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_free_file)
|
||||
std::fclose(m_file);
|
||||
m_file = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static u64 FSize(core_file* file)
|
||||
{
|
||||
ChdCoreFileWrapper* fileWrapper = FromCoreFile(file);
|
||||
if (fileWrapper->m_file_cache)
|
||||
return fileWrapper->m_file_cache_size;
|
||||
else
|
||||
return static_cast<u64>(FileSystem::FSize64(fileWrapper->m_file));
|
||||
}
|
||||
|
||||
static size_t FRead(void* buffer, size_t elmSize, size_t elmCount, core_file* file)
|
||||
{
|
||||
ChdCoreFileWrapper* fileWrapper = FromCoreFile(file);
|
||||
if (fileWrapper->m_file_cache)
|
||||
{
|
||||
// While currently libchdr only uses an elmCount of 1, we can't guarantee that will always be the case.
|
||||
elmCount = std::min<size_t>(elmCount, std::max<s64>(fileWrapper->m_file_cache_size - fileWrapper->m_file_cache_pos, 0) / elmSize);
|
||||
const size_t size = elmSize * elmCount;
|
||||
std::memcpy(buffer, &fileWrapper->m_file_cache[fileWrapper->m_file_cache_pos], size);
|
||||
return elmCount;
|
||||
}
|
||||
else
|
||||
return std::fread(buffer, elmSize, elmCount, fileWrapper->m_file);
|
||||
}
|
||||
|
||||
static int FClose(core_file* file)
|
||||
{
|
||||
// Destructor handles freeing the FILE handle.
|
||||
delete FromCoreFile(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int FSeek(core_file* file, int64_t offset, int whence)
|
||||
{
|
||||
ChdCoreFileWrapper* fileWrapper = FromCoreFile(file);
|
||||
if (fileWrapper->m_file_cache)
|
||||
{
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
fileWrapper->m_file_cache_pos = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
fileWrapper->m_file_cache_pos += offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
fileWrapper->m_file_cache_pos = fileWrapper->m_file_cache_size + offset;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return FileSystem::FSeek64(fileWrapper->m_file, offset, whence);
|
||||
}
|
||||
};
|
||||
|
||||
ChdFileReader::ChdFileReader() = default;
|
||||
|
||||
ChdFileReader::~ChdFileReader()
|
||||
@@ -27,13 +207,40 @@ ChdFileReader::~ChdFileReader()
|
||||
pxAssert(!ChdFile);
|
||||
}
|
||||
|
||||
static bool IsHeaderParentCHD(const chd_header& header, const chd_header& parent_header)
|
||||
{
|
||||
static const u8 nullmd5[CHD_MD5_BYTES]{};
|
||||
static const u8 nullsha1[CHD_SHA1_BYTES]{};
|
||||
|
||||
// Check MD5 if it isn't empty.
|
||||
if (std::memcmp(nullmd5, header.parentmd5, CHD_MD5_BYTES) != 0 &&
|
||||
std::memcmp(nullmd5, parent_header.md5, CHD_MD5_BYTES) != 0 &&
|
||||
std::memcmp(parent_header.md5, header.parentmd5, CHD_MD5_BYTES) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check SHA1 if it isn't empty.
|
||||
if (std::memcmp(nullsha1, header.parentsha1, CHD_SHA1_BYTES) != 0 &&
|
||||
std::memcmp(nullsha1, parent_header.sha1, CHD_SHA1_BYTES) != 0 &&
|
||||
std::memcmp(parent_header.sha1, header.parentsha1, CHD_SHA1_BYTES) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static chd_file* OpenCHD(const std::string& filename, FileSystem::ManagedCFilePtr fp, Error* error, u32 recursion_level)
|
||||
{
|
||||
chd_file* chd;
|
||||
chd_error err = chd_open_file(fp.get(), CHD_OPEN_READ | CHD_OPEN_TRANSFER_FILE, nullptr, &chd);
|
||||
ChdCoreFileWrapper* core_wrapper = new ChdCoreFileWrapper(fp.get(), nullptr);
|
||||
// libchdr will take ownership of core_wrapper, and will close/free it on failure.
|
||||
chd_error err = chd_open_core_file(core_wrapper->GetCoreFile(), CHD_OPEN_READ, nullptr, &chd);
|
||||
if (err == CHDERR_NONE)
|
||||
{
|
||||
// fp is now managed by libchdr
|
||||
// core_wrapper should manage fp.
|
||||
core_wrapper->SetFileOwner(true);
|
||||
fp.release();
|
||||
return chd;
|
||||
}
|
||||
@@ -73,14 +280,14 @@ static chd_file* OpenCHD(const std::string& filename, FileSystem::ManagedCFilePt
|
||||
if (!StringUtil::compareNoCase(parent_dir, Path::GetDirectory(it->first)))
|
||||
continue;
|
||||
|
||||
if (!chd_is_matching_parent(&header, &it->second))
|
||||
if (!IsHeaderParentCHD(header, it->second))
|
||||
continue;
|
||||
|
||||
// Re-check the header, it might have changed since we last opened.
|
||||
chd_header parent_header;
|
||||
auto parent_fp = FileSystem::OpenManagedSharedCFile(it->first.c_str(), "rb", FileSystem::FileShareMode::DenyWrite);
|
||||
if (parent_fp && chd_read_header_file(parent_fp.get(), &parent_header) == CHDERR_NONE &&
|
||||
chd_is_matching_parent(&header, &parent_header))
|
||||
IsHeaderParentCHD(header, parent_header))
|
||||
{
|
||||
// Need to take a copy of the string, because the parent might add to the list and invalidate the iterator.
|
||||
const std::string filename_to_open = it->first;
|
||||
@@ -121,7 +328,7 @@ static chd_file* OpenCHD(const std::string& filename, FileSystem::ManagedCFilePt
|
||||
else
|
||||
s_chd_hash_cache.emplace_back(fd.FileName, parent_header);
|
||||
|
||||
if (!chd_is_matching_parent(&header, &parent_header))
|
||||
if (!IsHeaderParentCHD(header, parent_header))
|
||||
continue;
|
||||
|
||||
// Match! Open this one.
|
||||
@@ -140,8 +347,10 @@ static chd_file* OpenCHD(const std::string& filename, FileSystem::ManagedCFilePt
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Our last core file wrapper got freed, so make a new one.
|
||||
core_wrapper = new ChdCoreFileWrapper(fp.get(), ChdCoreFileWrapper::FromCoreFile(chd_core_file(parent_chd)));
|
||||
// Now try re-opening with the parent.
|
||||
err = chd_open_file(fp.get(), CHD_OPEN_READ | CHD_OPEN_TRANSFER_FILE, parent_chd, &chd);
|
||||
err = chd_open_core_file(core_wrapper->GetCoreFile(), CHD_OPEN_READ, parent_chd, &chd);
|
||||
if (err != CHDERR_NONE)
|
||||
{
|
||||
Console.Error(fmt::format("Failed to open CHD '{}': {}", filename, chd_error_string(err)));
|
||||
@@ -149,7 +358,8 @@ static chd_file* OpenCHD(const std::string& filename, FileSystem::ManagedCFilePt
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// fp now owned by libchdr
|
||||
// core_wrapper should manage fp.
|
||||
core_wrapper->SetFileOwner(true);
|
||||
fp.release();
|
||||
return chd;
|
||||
}
|
||||
@@ -192,28 +402,11 @@ bool ChdFileReader::Open2(std::string filename, Error* error)
|
||||
|
||||
bool ChdFileReader::Precache2(ProgressCallback* progress, Error* error)
|
||||
{
|
||||
if (!CheckAvailableMemoryForPrecaching(chd_get_compressed_size(ChdFile), error))
|
||||
ChdCoreFileWrapper* fileWrapper = ChdCoreFileWrapper::FromCoreFile(chd_core_file(ChdFile));
|
||||
if (!CheckAvailableMemoryForPrecaching(fileWrapper->GetPrecacheSize(), error))
|
||||
return false;
|
||||
|
||||
progress->SetProgressRange(100);
|
||||
|
||||
const auto callback = [](size_t pos, size_t total, void* param) -> bool {
|
||||
ProgressCallback* progress = static_cast<ProgressCallback*>(param);
|
||||
const u32 percent = static_cast<u32>((pos * 100) / total);
|
||||
progress->SetProgressValue(std::min<u32>(percent, 100));
|
||||
return !progress->IsCancelled();
|
||||
};
|
||||
|
||||
const chd_error cerror = chd_precache_progress(ChdFile, callback, progress);
|
||||
if (cerror != CHDERR_NONE)
|
||||
{
|
||||
if (cerror != CHDERR_CANCELLED)
|
||||
Error::SetStringView(error, "Failed to read part of the file.");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return fileWrapper->Precache(progress, error);
|
||||
}
|
||||
|
||||
ThreadedFileReader::Chunk ChdFileReader::ChunkForOffset(u64 offset)
|
||||
|
||||
177
pcsx2/COP0.cpp
177
pcsx2/COP0.cpp
@@ -230,49 +230,49 @@ void MapTLB(const tlbs& t, int i)
|
||||
u32 saddr, eaddr;
|
||||
|
||||
COP0_LOG("MAP TLB %d: 0x%08X-> [0x%08X 0x%08X] S=%d G=%d ASID=%d Mask=0x%03X EntryLo0 PFN=%x EntryLo0 Cache=%x EntryLo1 PFN=%x EntryLo1 Cache=%x VPN2=%x",
|
||||
i, t.VPN2, t.PFN0, t.PFN1, t.S >> 31, t.G, t.ASID,
|
||||
t.Mask, t.EntryLo0 >> 6, (t.EntryLo0 & 0x38) >> 3, t.EntryLo1 >> 6, (t.EntryLo1 & 0x38) >> 3, t.VPN2);
|
||||
i, t.VPN2(), t.PFN0(), t.PFN1(), t.isSPR() >> 31, t.isGlobal(), t.EntryHi.ASID,
|
||||
t.Mask(), t.EntryLo0.PFN, t.EntryLo0.C, t.EntryLo1.PFN, t.EntryLo1.C, t.VPN2());
|
||||
|
||||
// According to the manual
|
||||
// 'It [SPR] must be mapped into a contiguous 16 KB of virtual address space that is
|
||||
// aligned on a 16KB boundary.Results are not guaranteed if this restriction is not followed.'
|
||||
// Assume that the game isn't doing anything less-than-ideal with the scratchpad mapping and map it directly to eeMem->Scratch.
|
||||
if (t.S)
|
||||
if (t.isSPR())
|
||||
{
|
||||
if (t.VPN2 != 0x70000000)
|
||||
Console.Warning("COP0: Mapping Scratchpad to non-default address 0x%08X", t.VPN2);
|
||||
if (t.VPN2() != 0x70000000)
|
||||
Console.Warning("COP0: Mapping Scratchpad to non-default address 0x%08X", t.VPN2());
|
||||
|
||||
vtlb_VMapBuffer(t.VPN2, eeMem->Scratch, Ps2MemSize::Scratch);
|
||||
vtlb_VMapBuffer(t.VPN2(), eeMem->Scratch, Ps2MemSize::Scratch);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (t.EntryLo0 & 0x2)
|
||||
if (t.EntryLo0.V)
|
||||
{
|
||||
mask = ((~t.Mask) << 1) & 0xfffff;
|
||||
saddr = t.VPN2 >> 12;
|
||||
eaddr = saddr + t.Mask + 1;
|
||||
mask = ((~t.Mask()) << 1) & 0xfffff;
|
||||
saddr = t.VPN2() >> 12;
|
||||
eaddr = saddr + t.Mask() + 1;
|
||||
|
||||
for (addr = saddr; addr < eaddr; addr++)
|
||||
{
|
||||
if ((addr & mask) == ((t.VPN2 >> 12) & mask))
|
||||
if ((addr & mask) == ((t.VPN2() >> 12) & mask))
|
||||
{ //match
|
||||
memSetPageAddr(addr << 12, t.PFN0 + ((addr - saddr) << 12));
|
||||
memSetPageAddr(addr << 12, t.PFN0() + ((addr - saddr) << 12));
|
||||
Cpu->Clear(addr << 12, 0x400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (t.EntryLo1 & 0x2)
|
||||
if (t.EntryLo1.V)
|
||||
{
|
||||
mask = ((~t.Mask) << 1) & 0xfffff;
|
||||
saddr = (t.VPN2 >> 12) + t.Mask + 1;
|
||||
eaddr = saddr + t.Mask + 1;
|
||||
mask = ((~t.Mask()) << 1) & 0xfffff;
|
||||
saddr = (t.VPN2() >> 12) + t.Mask() + 1;
|
||||
eaddr = saddr + t.Mask() + 1;
|
||||
|
||||
for (addr = saddr; addr < eaddr; addr++)
|
||||
{
|
||||
if ((addr & mask) == ((t.VPN2 >> 12) & mask))
|
||||
if ((addr & mask) == ((t.VPN2() >> 12) & mask))
|
||||
{ //match
|
||||
memSetPageAddr(addr << 12, t.PFN1 + ((addr - saddr) << 12));
|
||||
memSetPageAddr(addr << 12, t.PFN1() + ((addr - saddr) << 12));
|
||||
Cpu->Clear(addr << 12, 0x400);
|
||||
}
|
||||
}
|
||||
@@ -280,27 +280,36 @@ void MapTLB(const tlbs& t, int i)
|
||||
}
|
||||
}
|
||||
|
||||
__inline u32 ConvertPageMask(const u32 PageMask)
|
||||
{
|
||||
const u32 mask = std::popcount(PageMask >> 13);
|
||||
|
||||
pxAssertMsg(!((mask & 1) || mask > 12), "Invalid page mask for this TLB entry. EE cache doesn't know what to do here.");
|
||||
|
||||
return (1 << (12 + mask)) - 1;
|
||||
}
|
||||
|
||||
void UnmapTLB(const tlbs& t, int i)
|
||||
{
|
||||
//Console.WriteLn("Clear TLB %d: %08x-> [%08x %08x] S=%d G=%d ASID=%d Mask= %03X", i,t.VPN2,t.PFN0,t.PFN1,t.S,t.G,t.ASID,t.Mask);
|
||||
u32 mask, addr;
|
||||
u32 saddr, eaddr;
|
||||
|
||||
if (t.S)
|
||||
if (t.isSPR())
|
||||
{
|
||||
vtlb_VMapUnmap(t.VPN2, 0x4000);
|
||||
vtlb_VMapUnmap(t.VPN2(), 0x4000);
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.EntryLo0 & 0x2)
|
||||
if (t.EntryLo0.V)
|
||||
{
|
||||
mask = ((~t.Mask) << 1) & 0xfffff;
|
||||
saddr = t.VPN2 >> 12;
|
||||
eaddr = saddr + t.Mask + 1;
|
||||
mask = ((~t.Mask()) << 1) & 0xfffff;
|
||||
saddr = t.VPN2() >> 12;
|
||||
eaddr = saddr + t.Mask() + 1;
|
||||
// Console.WriteLn("Clear TLB: %08x ~ %08x",saddr,eaddr-1);
|
||||
for (addr = saddr; addr < eaddr; addr++)
|
||||
{
|
||||
if ((addr & mask) == ((t.VPN2 >> 12) & mask))
|
||||
if ((addr & mask) == ((t.VPN2() >> 12) & mask))
|
||||
{ //match
|
||||
memClearPageAddr(addr << 12);
|
||||
Cpu->Clear(addr << 12, 0x400);
|
||||
@@ -308,38 +317,74 @@ void UnmapTLB(const tlbs& t, int i)
|
||||
}
|
||||
}
|
||||
|
||||
if (t.EntryLo1 & 0x2)
|
||||
if (t.EntryLo1.V)
|
||||
{
|
||||
mask = ((~t.Mask) << 1) & 0xfffff;
|
||||
saddr = (t.VPN2 >> 12) + t.Mask + 1;
|
||||
eaddr = saddr + t.Mask + 1;
|
||||
mask = ((~t.Mask()) << 1) & 0xfffff;
|
||||
saddr = (t.VPN2() >> 12) + t.Mask() + 1;
|
||||
eaddr = saddr + t.Mask() + 1;
|
||||
// Console.WriteLn("Clear TLB: %08x ~ %08x",saddr,eaddr-1);
|
||||
for (addr = saddr; addr < eaddr; addr++)
|
||||
{
|
||||
if ((addr & mask) == ((t.VPN2 >> 12) & mask))
|
||||
if ((addr & mask) == ((t.VPN2() >> 12) & mask))
|
||||
{ //match
|
||||
memClearPageAddr(addr << 12);
|
||||
Cpu->Clear(addr << 12, 0x400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < cachedTlbs.count; i++)
|
||||
{
|
||||
if (cachedTlbs.PFN0s[i] == t.PFN0() && cachedTlbs.PFN1s[i] == t.PFN1() && cachedTlbs.PageMasks[i] == ConvertPageMask(t.PageMask.UL))
|
||||
{
|
||||
for (size_t j = i; j < cachedTlbs.count - 1; j++)
|
||||
{
|
||||
cachedTlbs.CacheEnabled0[j] = cachedTlbs.CacheEnabled0[j + 1];
|
||||
cachedTlbs.CacheEnabled1[j] = cachedTlbs.CacheEnabled1[j + 1];
|
||||
cachedTlbs.PFN0s[j] = cachedTlbs.PFN0s[j + 1];
|
||||
cachedTlbs.PFN1s[j] = cachedTlbs.PFN1s[j + 1];
|
||||
cachedTlbs.PageMasks[j] = cachedTlbs.PageMasks[j + 1];
|
||||
}
|
||||
cachedTlbs.count--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WriteTLB(int i)
|
||||
{
|
||||
tlb[i].PageMask = cpuRegs.CP0.n.PageMask;
|
||||
tlb[i].EntryHi = cpuRegs.CP0.n.EntryHi;
|
||||
tlb[i].EntryLo0 = cpuRegs.CP0.n.EntryLo0;
|
||||
tlb[i].EntryLo1 = cpuRegs.CP0.n.EntryLo1;
|
||||
tlb[i].PageMask.UL = cpuRegs.CP0.n.PageMask;
|
||||
tlb[i].EntryHi.UL = cpuRegs.CP0.n.EntryHi;
|
||||
tlb[i].EntryLo0.UL = cpuRegs.CP0.n.EntryLo0;
|
||||
tlb[i].EntryLo1.UL = cpuRegs.CP0.n.EntryLo1;
|
||||
|
||||
tlb[i].Mask = (cpuRegs.CP0.n.PageMask >> 13) & 0xfff;
|
||||
tlb[i].nMask = (~tlb[i].Mask) & 0xfff;
|
||||
tlb[i].VPN2 = ((cpuRegs.CP0.n.EntryHi >> 13) & (~tlb[i].Mask)) << 13;
|
||||
tlb[i].ASID = cpuRegs.CP0.n.EntryHi & 0xfff;
|
||||
tlb[i].G = cpuRegs.CP0.n.EntryLo0 & cpuRegs.CP0.n.EntryLo1 & 0x1;
|
||||
tlb[i].PFN0 = (((cpuRegs.CP0.n.EntryLo0 >> 6) & 0xFFFFF) & (~tlb[i].Mask)) << 12;
|
||||
tlb[i].PFN1 = (((cpuRegs.CP0.n.EntryLo1 >> 6) & 0xFFFFF) & (~tlb[i].Mask)) << 12;
|
||||
tlb[i].S = cpuRegs.CP0.n.EntryLo0 & 0x80000000;
|
||||
// Setting the cache mode to reserved values is vaguely defined in the manual.
|
||||
// I found that SPR is set to cached regardless.
|
||||
// Non-SPR entries default to uncached on reserved cache modes.
|
||||
if (tlb[i].isSPR())
|
||||
{
|
||||
tlb[i].EntryLo0.C = 3;
|
||||
tlb[i].EntryLo1.C = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!tlb[i].EntryLo0.isValidCacheMode())
|
||||
tlb[i].EntryLo0.C = 2;
|
||||
if (!tlb[i].EntryLo1.isValidCacheMode())
|
||||
tlb[i].EntryLo1.C = 2;
|
||||
}
|
||||
|
||||
if (!tlb[i].isSPR() && ((tlb[i].EntryLo0.V && tlb[i].EntryLo0.isCached()) || (tlb[i].EntryLo1.V && tlb[i].EntryLo1.isCached())))
|
||||
{
|
||||
const size_t idx = cachedTlbs.count;
|
||||
cachedTlbs.CacheEnabled0[idx] = tlb[i].EntryLo0.isCached() ? ~0 : 0;
|
||||
cachedTlbs.CacheEnabled1[idx] = tlb[i].EntryLo1.isCached() ? ~0 : 0;
|
||||
cachedTlbs.PFN1s[idx] = tlb[i].PFN1();
|
||||
cachedTlbs.PFN0s[idx] = tlb[i].PFN0();
|
||||
cachedTlbs.PageMasks[idx] = ConvertPageMask(tlb[i].PageMask.UL);
|
||||
|
||||
cachedTlbs.count++;
|
||||
}
|
||||
|
||||
MapTLB(tlb[i], i);
|
||||
}
|
||||
@@ -355,49 +400,57 @@ namespace COP0 {
|
||||
cpuRegs.CP0.n.Index, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
|
||||
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);
|
||||
|
||||
int i = cpuRegs.CP0.n.Index & 0x3f;
|
||||
const u8 i = cpuRegs.CP0.n.Index & 0x3f;
|
||||
|
||||
cpuRegs.CP0.n.PageMask = tlb[i].PageMask;
|
||||
cpuRegs.CP0.n.EntryHi = tlb[i].EntryHi & ~(tlb[i].PageMask | 0x1f00);
|
||||
cpuRegs.CP0.n.EntryLo0 = (tlb[i].EntryLo0 & ~1) | ((tlb[i].EntryHi >> 12) & 1);
|
||||
cpuRegs.CP0.n.EntryLo1 = (tlb[i].EntryLo1 & ~1) | ((tlb[i].EntryHi >> 12) & 1);
|
||||
if (i > 47)
|
||||
{
|
||||
Console.Warning("TLBR with index > 47! (%d)", i);
|
||||
return;
|
||||
}
|
||||
|
||||
cpuRegs.CP0.n.PageMask = tlb[i].PageMask.Mask << 13;
|
||||
cpuRegs.CP0.n.EntryHi = tlb[i].EntryHi.UL & ~((tlb[i].PageMask.Mask << 13) | 0x1f00);
|
||||
cpuRegs.CP0.n.EntryLo0 = tlb[i].EntryLo0.UL & ~(0xFC000000) & ~1;
|
||||
cpuRegs.CP0.n.EntryLo1 = tlb[i].EntryLo1.UL & ~(0x7C000000) & ~1;
|
||||
// "If both the Global bit of EntryLo0 and EntryLo1 are set to 1, the processor ignores the ASID during TLB lookup."
|
||||
// This is reflected during TLBR, where G is only set if both EntryLo0 and EntryLo1 are global.
|
||||
cpuRegs.CP0.n.EntryLo0 |= (tlb[i].EntryLo0.UL & 1) & (tlb[i].EntryLo1.UL & 1);
|
||||
cpuRegs.CP0.n.EntryLo1 |= (tlb[i].EntryLo0.UL & 1) & (tlb[i].EntryLo1.UL & 1);
|
||||
}
|
||||
|
||||
void TLBWI()
|
||||
{
|
||||
int j = cpuRegs.CP0.n.Index & 0x3f;
|
||||
const u8 j = cpuRegs.CP0.n.Index & 0x3f;
|
||||
|
||||
//if (j > 48) return;
|
||||
if (j > 47)
|
||||
{
|
||||
Console.Warning("TLBWI with index > 47! (%d)", j);
|
||||
return;
|
||||
}
|
||||
|
||||
COP0_LOG("COP0_TLBWI %d:%x,%x,%x,%x",
|
||||
cpuRegs.CP0.n.Index, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
|
||||
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);
|
||||
|
||||
UnmapTLB(tlb[j], j);
|
||||
tlb[j].PageMask = cpuRegs.CP0.n.PageMask;
|
||||
tlb[j].EntryHi = cpuRegs.CP0.n.EntryHi;
|
||||
tlb[j].EntryLo0 = cpuRegs.CP0.n.EntryLo0;
|
||||
tlb[j].EntryLo1 = cpuRegs.CP0.n.EntryLo1;
|
||||
WriteTLB(j);
|
||||
}
|
||||
|
||||
void TLBWR()
|
||||
{
|
||||
int j = cpuRegs.CP0.n.Random & 0x3f;
|
||||
const u8 j = cpuRegs.CP0.n.Random & 0x3f;
|
||||
|
||||
//if (j > 48) return;
|
||||
if (j > 47)
|
||||
{
|
||||
Console.Warning("TLBWR with random > 47! (%d)", j);
|
||||
return;
|
||||
}
|
||||
|
||||
DevCon.Warning("COP0_TLBWR %d:%x,%x,%x,%x\n",
|
||||
cpuRegs.CP0.n.Random, cpuRegs.CP0.n.PageMask, cpuRegs.CP0.n.EntryHi,
|
||||
cpuRegs.CP0.n.EntryLo0, cpuRegs.CP0.n.EntryLo1);
|
||||
|
||||
//if (j > 48) return;
|
||||
|
||||
UnmapTLB(tlb[j], j);
|
||||
tlb[j].PageMask = cpuRegs.CP0.n.PageMask;
|
||||
tlb[j].EntryHi = cpuRegs.CP0.n.EntryHi;
|
||||
tlb[j].EntryLo0 = cpuRegs.CP0.n.EntryLo0;
|
||||
tlb[j].EntryLo1 = cpuRegs.CP0.n.EntryLo1;
|
||||
WriteTLB(j);
|
||||
}
|
||||
|
||||
@@ -422,7 +475,7 @@ namespace COP0 {
|
||||
cpuRegs.CP0.n.Index = 0xFFFFFFFF;
|
||||
for (i = 0; i < 48; i++)
|
||||
{
|
||||
if (tlb[i].VPN2 == ((~tlb[i].Mask) & (EntryHi32.s.VPN2)) && ((tlb[i].G & 1) || ((tlb[i].ASID & 0xff) == EntryHi32.s.ASID)))
|
||||
if (tlb[i].VPN2() == ((~tlb[i].Mask()) & (EntryHi32.s.VPN2)) && ((tlb[i].isGlobal()) || ((tlb[i].EntryHi.ASID & 0xff) == EntryHi32.s.ASID)))
|
||||
{
|
||||
cpuRegs.CP0.n.Index = i;
|
||||
break;
|
||||
|
||||
@@ -23,10 +23,11 @@ namespace
|
||||
// When this happens, the cache still fills with the data and when it gets evicted the data is lost.
|
||||
// We don't emulate memory access on a logic level, so we need to ensure that we don't try to load/store to a non-existant physical address.
|
||||
// This fixes the Find My Own Way demo.
|
||||
bool validPFN = true;
|
||||
|
||||
// The lower parts of a cache tags structure is as follows:
|
||||
// 31 - 12: The physical address cache tag.
|
||||
// 11 - 7: Unused.
|
||||
// 11: Used by PCSX2 to indicate if the physical address is valid.
|
||||
// 10 - 7: Unused.
|
||||
// 6: Dirty flag.
|
||||
// 5: Valid flag.
|
||||
// 4: LRF flag - least recently filled flag.
|
||||
@@ -39,7 +40,8 @@ namespace
|
||||
VALID_FLAG = 0x20,
|
||||
LRF_FLAG = 0x10,
|
||||
LOCK_FLAG = 0x8,
|
||||
ALL_FLAGS = 0xFFF
|
||||
ALL_FLAGS = 0x7FF,
|
||||
ALL_BITS = 0xFFF
|
||||
};
|
||||
|
||||
int flags() const
|
||||
@@ -65,23 +67,36 @@ namespace
|
||||
void clearLocked() { rawValue &= ~LOCK_FLAG; }
|
||||
void toggleLRF() { rawValue ^= LRF_FLAG; }
|
||||
|
||||
uptr addr() const { return rawValue & ~ALL_FLAGS; }
|
||||
uptr addr() const { return rawValue & ~ALL_BITS; }
|
||||
|
||||
void setAddr(uptr addr)
|
||||
{
|
||||
rawValue &= ALL_FLAGS;
|
||||
rawValue |= (addr & ~ALL_FLAGS);
|
||||
rawValue &= ALL_BITS;
|
||||
rawValue |= (addr & ~ALL_BITS);
|
||||
}
|
||||
|
||||
bool matches(uptr other) const
|
||||
{
|
||||
return isValid() && addr() == (other & ~ALL_FLAGS);
|
||||
return isValid() && addr() == (other & ~ALL_BITS);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
rawValue &= LRF_FLAG;
|
||||
}
|
||||
|
||||
constexpr bool isValidPFN() const
|
||||
{
|
||||
return rawValue & 0x800;
|
||||
}
|
||||
|
||||
constexpr void setValidPFN(bool valid)
|
||||
{
|
||||
if (valid)
|
||||
rawValue |= 0x800;
|
||||
else
|
||||
rawValue &= ~0x800;
|
||||
}
|
||||
};
|
||||
|
||||
struct CacheLine
|
||||
@@ -103,7 +118,7 @@ namespace
|
||||
uptr target = addr();
|
||||
|
||||
CACHE_LOG("Write back at %zx", target);
|
||||
if (tag.validPFN)
|
||||
if (tag.isValidPFN())
|
||||
*reinterpret_cast<CacheData*>(target) = data;
|
||||
tag.clearDirty();
|
||||
}
|
||||
@@ -113,7 +128,7 @@ namespace
|
||||
pxAssertMsg(!tag.isDirtyAndValid(), "Loaded a value into cache without writing back the old one!");
|
||||
|
||||
tag.setAddr(ppf);
|
||||
if (!tag.validPFN)
|
||||
if (!tag.isValidPFN())
|
||||
{
|
||||
// Reading from invalid physical addresses seems to return 0 on hardware
|
||||
std::memset(&data, 0, sizeof(data));
|
||||
@@ -238,7 +253,7 @@ static int getFreeCache(u32 mem, int* way, bool validPFN)
|
||||
|
||||
CacheLine line = cache.lineAt(setIdx, newWay);
|
||||
line.writeBackIfNeeded();
|
||||
line.tag.validPFN = validPFN;
|
||||
line.tag.setValidPFN(validPFN);
|
||||
line.load(ppf);
|
||||
line.tag.toggleLRF();
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ void UpdateVSyncRate(bool force)
|
||||
vSyncInfoCalc(&vSyncInfo, frames_per_second, total_scanlines);
|
||||
|
||||
if (video_mode_initialized)
|
||||
Console.WriteLn(Color_Green, "(UpdateVSyncRate) Mode Changed to %s.", ReportVideoMode());
|
||||
Console.WriteLn(Color_Green, "UpdateVSyncRate: Mode Changed to %s.", ReportVideoMode());
|
||||
|
||||
if (custom && video_mode_initialized)
|
||||
Console.WriteLn(Color_StrongGreen, " ... with user configured refresh rate: %.02f Hz", vertical_frequency);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
|
||||
#include <ccc/ast.h>
|
||||
|
||||
@@ -22,7 +22,7 @@ MULTI_ISA_UNSHARED_IMPL;
|
||||
u64 __noinline CURRENT_ISA::GSXXH3_64_Long(const void* data, size_t len)
|
||||
{
|
||||
// XXH marks its function that calls this noinline, and it would be silly to stack noinline functions, so call the internal function directly
|
||||
return XXH3_hashLong_64b_internal(data, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc);
|
||||
return XXH3_hashLong_64b_internal(data, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate, XXH3_scrambleAcc);
|
||||
}
|
||||
|
||||
u32 CURRENT_ISA::GSXXH3_64_Update(void* state, const void* data, size_t len)
|
||||
|
||||
@@ -112,7 +112,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
{
|
||||
Host::ReportErrorAsync("GS",
|
||||
fmt::format(
|
||||
TRANSLATE_FS("GS", "Failed to create D3D device: 0x{:08X}. A GPU which supports Direct3D Feature Level 10.0 is required."),
|
||||
TRANSLATE_FS("GS", "Failed to create D3D11 device: 0x{:08X}. A GPU which supports Direct3D Feature Level 10.0 is required."),
|
||||
hr));
|
||||
return false;
|
||||
}
|
||||
@@ -149,10 +149,10 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
if (m_dev.try_query_to(&dxgi_device) && SUCCEEDED(dxgi_device->GetParent(IID_PPV_ARGS(dxgi_adapter.put()))))
|
||||
{
|
||||
m_name = D3D::GetAdapterName(dxgi_adapter.get());
|
||||
Console.WriteLn(fmt::format("D3D Adapter: {}", m_name));
|
||||
Console.WriteLn(fmt::format("D3D11: Adapter: {}", m_name));
|
||||
}
|
||||
else
|
||||
Console.Error("Failed to obtain D3D adapter name.");
|
||||
Console.Error("D3D11: Failed to obtain adapter name.");
|
||||
|
||||
BOOL allow_tearing_supported = false;
|
||||
hr = m_dxgi_factory->CheckFeatureSupport(
|
||||
@@ -172,7 +172,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
m_annotation = m_ctx.try_query<ID3DUserDefinedAnnotation>();
|
||||
|
||||
if (!m_shader_cache.Open(m_feature_level, GSConfig.UseDebugDevice))
|
||||
Console.Warning("Shader cache failed to open.");
|
||||
Console.Warning("D3D11: Shader cache failed to open.");
|
||||
|
||||
{
|
||||
// HACK: check AMD
|
||||
@@ -341,7 +341,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
if (FAILED(m_dev->CreateBuffer(&bd, nullptr, m_vb.put())))
|
||||
{
|
||||
Console.Error("Failed to create vertex buffer.");
|
||||
Console.Error("D3D11: Failed to create vertex buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
if (FAILED(m_dev->CreateBuffer(&bd, nullptr, m_ib.put())))
|
||||
{
|
||||
Console.Error("Failed to create index buffer.");
|
||||
Console.Error("D3D11: Failed to create index buffer.");
|
||||
return false;
|
||||
}
|
||||
IASetIndexBuffer(m_ib.get());
|
||||
@@ -363,7 +363,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
|
||||
if (FAILED(m_dev->CreateBuffer(&bd, nullptr, m_expand_vb.put())))
|
||||
{
|
||||
Console.Error("Failed to create expand vertex buffer.");
|
||||
Console.Error("D3D11: Failed to create expand vertex buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
D3D11_SRV_DIMENSION_BUFFER, DXGI_FORMAT_UNKNOWN, 0, VERTEX_BUFFER_SIZE / sizeof(GSVertex));
|
||||
if (FAILED(m_dev->CreateShaderResourceView(m_expand_vb.get(), &vb_srv_desc, m_expand_vb_srv.put())))
|
||||
{
|
||||
Console.Error("Failed to create expand vertex buffer SRV.");
|
||||
Console.Error("D3D11: Failed to create expand vertex buffer SRV.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
const D3D11_SUBRESOURCE_DATA srd = {expand_data.get()};
|
||||
if (FAILED(m_dev->CreateBuffer(&bd, &srd, m_expand_ib.put())))
|
||||
{
|
||||
Console.Error("Failed to create expand index buffer.");
|
||||
Console.Error("D3D11: Failed to create expand index buffer.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -440,7 +440,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
|
||||
if (FAILED(m_dev->CreateBuffer(&bd, nullptr, m_vs_cb.put())))
|
||||
{
|
||||
Console.Error("Failed to create vertex shader constant buffer.");
|
||||
Console.Error("D3D11: Failed to create vertex shader constant buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
|
||||
if (FAILED(m_dev->CreateBuffer(&bd, nullptr, m_ps_cb.put())))
|
||||
{
|
||||
Console.Error("Failed to create pixel shader constant buffer.");
|
||||
Console.Error("D3D11: Failed to create pixel shader constant buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ bool GSDevice11::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
if (m_feature_level < D3D_FEATURE_LEVEL_11_0)
|
||||
{
|
||||
Host::AddIconOSDMessage("d3d11_feature_level_warning", ICON_FA_EXCLAMATION_TRIANGLE,
|
||||
TRANSLATE_SV("GS", "The Direct3D renderer is running at feature level 10.0. This is an UNSUPPORTED configuration.\n"
|
||||
TRANSLATE_SV("GS", "The Direct3D11 renderer is running at feature level 10.0. This is an UNSUPPORTED configuration.\n"
|
||||
"Do not request support, please upgrade your hardware/drivers first."),
|
||||
Host::OSD_WARNING_DURATION);
|
||||
}
|
||||
@@ -594,7 +594,7 @@ void GSDevice11::SetFeatures(IDXGIAdapter1* adapter)
|
||||
if (SUCCEEDED(m_dev->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &options, sizeof(options))) &&
|
||||
!options.TypedUAVLoadAdditionalFormats)
|
||||
{
|
||||
Console.Warning("Disabling VS expand due to potentially buggy NVIDIA driver.");
|
||||
Console.Warning("D3D11: Disabling VS expand due to potentially buggy NVIDIA driver.");
|
||||
m_features.vs_expand = false;
|
||||
}
|
||||
}
|
||||
@@ -616,7 +616,7 @@ void GSDevice11::SetVSyncMode(GSVSyncMode mode, bool allow_present_throttle)
|
||||
// Using mailbox-style no-allow-tearing causes tearing in exclusive fullscreen.
|
||||
if (mode == GSVSyncMode::Mailbox && m_is_exclusive_fullscreen)
|
||||
{
|
||||
WARNING_LOG("Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
WARNING_LOG("D3D11: Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
mode = GSVSyncMode::FIFO;
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ void GSDevice11::SetVSyncMode(GSVSyncMode mode, bool allow_present_throttle)
|
||||
{
|
||||
DestroySwapChain();
|
||||
if (!CreateSwapChain())
|
||||
pxFailRel("Failed to recreate swap chain after vsync change.");
|
||||
pxFailRel("D3D11: Failed to recreate swap chain after vsync change.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ bool GSDevice11::CreateSwapChain()
|
||||
// Using mailbox-style no-allow-tearing causes tearing in exclusive fullscreen.
|
||||
if (m_vsync_mode == GSVSyncMode::Mailbox && m_is_exclusive_fullscreen)
|
||||
{
|
||||
WARNING_LOG("Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
WARNING_LOG("D3D11: Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
m_vsync_mode = GSVSyncMode::FIFO;
|
||||
}
|
||||
}
|
||||
@@ -709,12 +709,12 @@ bool GSDevice11::CreateSwapChain()
|
||||
fs_desc.Scaling = fullscreen_mode.Scaling;
|
||||
fs_desc.Windowed = FALSE;
|
||||
|
||||
Console.WriteLn("Creating a %dx%d exclusive fullscreen swap chain", fs_sd_desc.Width, fs_sd_desc.Height);
|
||||
Console.WriteLn("D3D11: Creating a %dx%d exclusive fullscreen swap chain", fs_sd_desc.Width, fs_sd_desc.Height);
|
||||
hr = m_dxgi_factory->CreateSwapChainForHwnd(
|
||||
m_dev.get(), window_hwnd, &fs_sd_desc, &fs_desc, fullscreen_output.get(), m_swap_chain.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("Failed to create fullscreen swap chain, trying windowed.");
|
||||
Console.Warning("D3D11: Failed to create fullscreen swap chain, trying windowed.");
|
||||
m_is_exclusive_fullscreen = false;
|
||||
m_using_allow_tearing = m_allow_tearing_supported && m_using_flip_model_swap_chain;
|
||||
}
|
||||
@@ -722,7 +722,7 @@ bool GSDevice11::CreateSwapChain()
|
||||
|
||||
if (!m_is_exclusive_fullscreen)
|
||||
{
|
||||
Console.WriteLn("Creating a %dx%d %s windowed swap chain", swap_chain_desc.Width, swap_chain_desc.Height,
|
||||
Console.WriteLn("D3D11: Creating a %dx%d %s windowed swap chain", swap_chain_desc.Width, swap_chain_desc.Height,
|
||||
m_using_flip_model_swap_chain ? "flip-discard" : "discard");
|
||||
hr = m_dxgi_factory->CreateSwapChainForHwnd(
|
||||
m_dev.get(), window_hwnd, &swap_chain_desc, nullptr, nullptr, m_swap_chain.put());
|
||||
@@ -730,7 +730,7 @@ bool GSDevice11::CreateSwapChain()
|
||||
|
||||
if (FAILED(hr) && m_using_flip_model_swap_chain)
|
||||
{
|
||||
Console.Warning("Failed to create a flip-discard swap chain, trying discard.");
|
||||
Console.Warning("D3D11: Failed to create a flip-discard swap chain, trying discard.");
|
||||
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
||||
swap_chain_desc.Flags = 0;
|
||||
m_using_flip_model_swap_chain = false;
|
||||
@@ -740,7 +740,7 @@ bool GSDevice11::CreateSwapChain()
|
||||
m_dev.get(), window_hwnd, &swap_chain_desc, nullptr, nullptr, m_swap_chain.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateSwapChainForHwnd failed: 0x%08X", hr);
|
||||
Console.Error("D3D11: CreateSwapChainForHwnd failed: 0x%08X", hr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -752,11 +752,11 @@ bool GSDevice11::CreateSwapChain()
|
||||
{
|
||||
hr = swap_chain_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||
if (FAILED(hr))
|
||||
Console.ErrorFmt("MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
Console.ErrorFmt("D3D11: MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ErrorFmt("GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
Console.ErrorFmt("D3D11: GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
}
|
||||
|
||||
if (!CreateSwapChainRTV())
|
||||
@@ -777,7 +777,7 @@ bool GSDevice11::CreateSwapChainRTV()
|
||||
HRESULT hr = m_swap_chain->GetBuffer(0, IID_PPV_ARGS(backbuffer.put()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("GetBuffer for RTV failed: 0x%08X", hr);
|
||||
Console.Error("D3D11: GetBuffer for RTV failed: 0x%08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -789,14 +789,14 @@ bool GSDevice11::CreateSwapChainRTV()
|
||||
hr = m_dev->CreateRenderTargetView(backbuffer.get(), &rtv_desc, m_swap_chain_rtv.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateRenderTargetView for swap chain failed: 0x%08X", hr);
|
||||
Console.Error("D3D11: CreateRenderTargetView for swap chain failed: 0x%08X", hr);
|
||||
m_swap_chain_rtv.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_window_info.surface_width = backbuffer_desc.Width;
|
||||
m_window_info.surface_height = backbuffer_desc.Height;
|
||||
DevCon.WriteLn("Swap chain buffer size: %ux%u", m_window_info.surface_width, m_window_info.surface_height);
|
||||
DevCon.WriteLn("D3D11: Swap chain buffer size: %ux%u", m_window_info.surface_width, m_window_info.surface_height);
|
||||
|
||||
if (m_window_info.type == WindowInfo::Type::Win32)
|
||||
{
|
||||
@@ -838,7 +838,7 @@ bool GSDevice11::UpdateWindow()
|
||||
|
||||
if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain())
|
||||
{
|
||||
Console.WriteLn("Failed to create swap chain on updated window");
|
||||
Console.WriteLn("D3D11: Failed to create swap chain on updated window");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ void GSDevice11::ResizeWindow(s32 new_window_width, s32 new_window_height, float
|
||||
HRESULT hr = m_swap_chain->ResizeBuffers(
|
||||
0, 0, 0, DXGI_FORMAT_UNKNOWN, m_using_allow_tearing ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0);
|
||||
if (FAILED(hr))
|
||||
Console.Error("ResizeBuffers() failed: 0x%08X", hr);
|
||||
Console.Error("D3D11: ResizeBuffers() failed: 0x%08X", hr);
|
||||
|
||||
if (!CreateSwapChainRTV())
|
||||
pxFailRel("Failed to recreate swap chain RTV after resize");
|
||||
@@ -1031,7 +1031,7 @@ void GSDevice11::PopTimestampQuery()
|
||||
|
||||
if (disjoint.Disjoint)
|
||||
{
|
||||
DevCon.WriteLn("GPU timing disjoint, resetting.");
|
||||
DevCon.WriteLn("D3D11: GPU timing disjoint, resetting.");
|
||||
m_read_timestamp_query = 0;
|
||||
m_write_timestamp_query = 0;
|
||||
m_waiting_timestamp_queries = 0;
|
||||
@@ -1217,7 +1217,7 @@ GSTexture* GSDevice11::CreateSurface(GSTexture::Type type, int width, int height
|
||||
HRESULT hr = m_dev->CreateTexture2D(&desc, nullptr, texture.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("DX11: Failed to allocate %dx%d surface", width, height);
|
||||
Console.Error("D3D11: Failed to allocate %dx%d surface", width, height);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1630,7 +1630,7 @@ void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
||||
const std::optional<std::string> shader = ReadShaderSource("shaders/common/fxaa.fx");
|
||||
if (!shader.has_value())
|
||||
{
|
||||
Console.Error("FXAA shader is missing");
|
||||
Console.Error("D3D11: FXAA shader is missing");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1957,7 +1957,7 @@ bool GSDevice11::CreateCASShaders()
|
||||
m_cas.cs_upscale = m_shader_cache.GetComputeShader(m_dev.get(), cas_source.value(), nullptr, "main");
|
||||
if (!m_cas.cs_sharpen || !m_cas.cs_upscale)
|
||||
{
|
||||
Console.Error("Failed to create CAS compute shaders.");
|
||||
Console.Error("D3D11: Failed to create CAS compute shaders.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1996,7 +1996,7 @@ bool GSDevice11::CreateImGuiResources()
|
||||
const std::optional<std::string> hlsl = ReadShaderSource("shaders/dx11/imgui.fx");
|
||||
if (!hlsl.has_value())
|
||||
{
|
||||
Console.Error("Failed to read imgui.fx");
|
||||
Console.Error("D3D11: Failed to read imgui.fx");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2013,7 +2013,7 @@ bool GSDevice11::CreateImGuiResources()
|
||||
std::size(layout), hlsl.value(), nullptr, "vs_main") ||
|
||||
!(m_imgui.ps = m_shader_cache.GetPixelShader(m_dev.get(), hlsl.value(), nullptr, "ps_main")))
|
||||
{
|
||||
Console.Error("Failed to compile ImGui shaders");
|
||||
Console.Error("D3D11: Failed to compile ImGui shaders");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2029,7 +2029,7 @@ bool GSDevice11::CreateImGuiResources()
|
||||
hr = m_dev->CreateBlendState(&blend_desc, m_imgui.bs.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateImGuiResources(): CreateBlendState() failed: %08X", hr);
|
||||
Console.Error("D3D11: CreateImGuiResources(): CreateBlendState() failed: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2040,7 +2040,7 @@ bool GSDevice11::CreateImGuiResources()
|
||||
hr = m_dev->CreateBuffer(&buffer_desc, nullptr, m_imgui.vs_cb.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateImGuiResources(): CreateBlendState() failed: %08X", hr);
|
||||
Console.Error("D3D11: CreateImGuiResources(): CreateBlendState() failed: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2566,7 +2566,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
if (!IASetExpandVertexBuffer(config.verts, sizeof(*config.verts), config.nverts))
|
||||
{
|
||||
Console.Error("Failed to upload structured vertices (%u)", config.nverts);
|
||||
Console.Error("D3D11: Failed to upload structured vertices (%u)", config.nverts);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2576,7 +2576,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
if (!IASetVertexBuffer(config.verts, sizeof(*config.verts), config.nverts))
|
||||
{
|
||||
Console.Error("Failed to upload vertices (%u)", config.nverts);
|
||||
Console.Error("D3D11: Failed to upload vertices (%u)", config.nverts);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2591,7 +2591,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
if (!IASetIndexBuffer(config.indices, config.nindices))
|
||||
{
|
||||
Console.Error("Failed to upload indices (%u)", config.nindices);
|
||||
Console.Error("D3D11: Failed to upload indices (%u)", config.nindices);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ GSDevice12::ComPtr<ID3D12RootSignature> GSDevice12::CreateRootSignature(const D3
|
||||
m_device->CreateRootSignature(0, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(rs.put()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateRootSignature() failed: %08X", hr);
|
||||
Console.Error("D3D12: CreateRootSignature() failed: %08X", hr);
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error("Debug layer requested but not available.");
|
||||
Console.Error("D3D12: Debug layer requested but not available.");
|
||||
enable_debug_layer = false;
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
|
||||
hr = D3D12CreateDevice(m_adapter.get(), isIntel ? D3D_FEATURE_LEVEL_12_0 : D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to create D3D12 device: %08X", hr);
|
||||
Console.Error("D3D12: Failed to create device: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
|
||||
{
|
||||
const LUID luid(m_device->GetAdapterLuid());
|
||||
if (FAILED(m_dxgi_factory->EnumAdapterByLuid(luid, IID_PPV_ARGS(m_adapter.put()))))
|
||||
Console.Error("Failed to get lookup adapter by device LUID");
|
||||
Console.Error("D3D12: Failed to get lookup adapter by device LUID");
|
||||
}
|
||||
|
||||
if (enable_debug_layer)
|
||||
@@ -226,7 +226,7 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
|
||||
hr = m_device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&m_command_queue));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to create command queue: %08X", hr);
|
||||
Console.Error("D3D12: Failed to create command queue: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -240,21 +240,21 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
|
||||
hr = D3D12MA::CreateAllocator(&allocatorDesc, m_allocator.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("D3D12MA::CreateAllocator() failed with HRESULT %08X", hr);
|
||||
Console.Error("D3D12: CreateAllocator() failed with HRESULT %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = m_device->CreateFence(m_completed_fence_value, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to create fence: %08X", hr);
|
||||
Console.Error("D3D12: Failed to create fence: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fence_event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||
if (m_fence_event == NULL)
|
||||
{
|
||||
Console.Error("Failed to create fence event: %08X", GetLastError());
|
||||
Console.Error("D3D12: Failed to create fence event: %08X", GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ bool GSDevice12::CreateCommandLists()
|
||||
nullptr, IID_PPV_ARGS(res.command_lists[i].put()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to create command list: %08X", hr);
|
||||
Console.Error("D3D12: Failed to create command list: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -325,13 +325,13 @@ bool GSDevice12::CreateCommandLists()
|
||||
|
||||
if (!res.descriptor_allocator.Create(m_device.get(), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, MAX_GPU_SRVS))
|
||||
{
|
||||
Console.Error("Failed to create per frame descriptor allocator");
|
||||
Console.Error("D3D12: Failed to create per frame descriptor allocator");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!res.sampler_allocator.Create(m_device.get(), MAX_GPU_SAMPLERS))
|
||||
{
|
||||
Console.Error("Failed to create per frame sampler allocator");
|
||||
Console.Error("D3D12: Failed to create per frame sampler allocator");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -378,7 +378,7 @@ void GSDevice12::MoveToNextCommandList()
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("Map() for timestamp query failed: %08X", hr);
|
||||
Console.Warning("D3D12: Map() for timestamp query failed: %08X", hr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ bool GSDevice12::ExecuteCommandList(WaitType wait_for_completion)
|
||||
hr = res.command_lists[0]->Close();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Closing init command list failed with HRESULT %08X", hr);
|
||||
Console.Error("D3D12: Closing init command list failed with HRESULT %08X", hr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -441,7 +441,7 @@ bool GSDevice12::ExecuteCommandList(WaitType wait_for_completion)
|
||||
hr = res.command_lists[1]->Close();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Closing main command list failed with HRESULT %08X", hr);
|
||||
Console.Error("D3D12: Closing main command list failed with HRESULT %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ bool GSDevice12::CreateTimestampQuery()
|
||||
HRESULT hr = m_device->CreateQueryHeap(&desc, IID_PPV_ARGS(m_timestamp_query_heap.put()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateQueryHeap() for timestamp failed with %08X", hr);
|
||||
Console.Error("D3D12: CreateQueryHeap() for timestamp failed with %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ bool GSDevice12::CreateTimestampQuery()
|
||||
m_timestamp_query_allocation.put(), IID_PPV_ARGS(m_timestamp_query_buffer.put()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateResource() for timestamp failed with %08X", hr);
|
||||
Console.Error("D3D12: CreateResource() for timestamp failed with %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ bool GSDevice12::CreateTimestampQuery()
|
||||
hr = m_command_queue->GetTimestampFrequency(&frequency);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("GetTimestampFrequency() failed: %08X", hr);
|
||||
Console.Error("D3D12: GetTimestampFrequency() failed: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ bool GSDevice12::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
|
||||
if (!CheckFeatures(vendor_id))
|
||||
{
|
||||
Console.Error("Your GPU does not support the required D3D12 features.");
|
||||
Console.Error("D3D12: Your GPU does not support the required D3D12 features.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ bool GSDevice12::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
}
|
||||
|
||||
if (!m_shader_cache.Open(m_feature_level, GSConfig.UseDebugDevice))
|
||||
Console.Warning("Shader cache failed to open.");
|
||||
Console.Warning("D3D12: Shader cache failed to open.");
|
||||
|
||||
if (!CreateNullTexture())
|
||||
{
|
||||
@@ -769,7 +769,7 @@ void GSDevice12::SetVSyncMode(GSVSyncMode mode, bool allow_present_throttle)
|
||||
// Using mailbox-style no-allow-tearing causes tearing in exclusive fullscreen.
|
||||
if (mode == GSVSyncMode::Mailbox && m_is_exclusive_fullscreen)
|
||||
{
|
||||
WARNING_LOG("Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
WARNING_LOG("D3D12: Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
mode = GSVSyncMode::FIFO;
|
||||
}
|
||||
|
||||
@@ -822,7 +822,7 @@ bool GSDevice12::CreateSwapChain()
|
||||
// Using mailbox-style no-allow-tearing causes tearing in exclusive fullscreen.
|
||||
if (m_vsync_mode == GSVSyncMode::Mailbox && m_is_exclusive_fullscreen)
|
||||
{
|
||||
WARNING_LOG("Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
WARNING_LOG("D3D12: Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
|
||||
m_vsync_mode = GSVSyncMode::FIFO;
|
||||
}
|
||||
}
|
||||
@@ -859,12 +859,12 @@ bool GSDevice12::CreateSwapChain()
|
||||
fs_desc.Scaling = fullscreen_mode.Scaling;
|
||||
fs_desc.Windowed = FALSE;
|
||||
|
||||
Console.WriteLn("Creating a %dx%d exclusive fullscreen swap chain", fs_sd_desc.Width, fs_sd_desc.Height);
|
||||
Console.WriteLn("D3D12: Creating a %dx%d exclusive fullscreen swap chain", fs_sd_desc.Width, fs_sd_desc.Height);
|
||||
hr = m_dxgi_factory->CreateSwapChainForHwnd(m_command_queue.get(), window_hwnd, &fs_sd_desc,
|
||||
&fs_desc, fullscreen_output.get(), m_swap_chain.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("Failed to create fullscreen swap chain, trying windowed.");
|
||||
Console.Warning("D3D12: Failed to create fullscreen swap chain, trying windowed.");
|
||||
m_is_exclusive_fullscreen = false;
|
||||
m_using_allow_tearing = m_allow_tearing_supported;
|
||||
}
|
||||
@@ -872,12 +872,12 @@ bool GSDevice12::CreateSwapChain()
|
||||
|
||||
if (!m_is_exclusive_fullscreen)
|
||||
{
|
||||
Console.WriteLn("Creating a %dx%d windowed swap chain", swap_chain_desc.Width, swap_chain_desc.Height);
|
||||
Console.WriteLn("D3D12: Creating a %dx%d windowed swap chain", swap_chain_desc.Width, swap_chain_desc.Height);
|
||||
hr = m_dxgi_factory->CreateSwapChainForHwnd(
|
||||
m_command_queue.get(), window_hwnd, &swap_chain_desc, nullptr, nullptr, m_swap_chain.put());
|
||||
|
||||
if (FAILED(hr))
|
||||
Console.Warning("Failed to create windowed swap chain.");
|
||||
Console.Warning("D3D12: Failed to create windowed swap chain.");
|
||||
}
|
||||
|
||||
// MWA needs to be called on the correct factory.
|
||||
@@ -887,11 +887,11 @@ bool GSDevice12::CreateSwapChain()
|
||||
{
|
||||
hr = swap_chain_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||
if (FAILED(hr))
|
||||
Console.ErrorFmt("MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
Console.ErrorFmt("D3D12: MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ErrorFmt("GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
Console.ErrorFmt("D3D12: GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||
}
|
||||
|
||||
if (!CreateSwapChainRTV())
|
||||
@@ -926,7 +926,7 @@ bool GSDevice12::CreateSwapChainRTV()
|
||||
hr = m_swap_chain->GetBuffer(i, IID_PPV_ARGS(backbuffer.put()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("GetBuffer for RTV failed: 0x%08X", hr);
|
||||
Console.Error("D3D12: GetBuffer for RTV failed: 0x%08X", hr);
|
||||
m_swap_chain_buffers.clear();
|
||||
return false;
|
||||
}
|
||||
@@ -946,7 +946,7 @@ bool GSDevice12::CreateSwapChainRTV()
|
||||
|
||||
m_window_info.surface_width = swap_chain_desc.BufferDesc.Width;
|
||||
m_window_info.surface_height = swap_chain_desc.BufferDesc.Height;
|
||||
DevCon.WriteLn("Swap chain buffer size: %ux%u", m_window_info.surface_width, m_window_info.surface_height);
|
||||
DevCon.WriteLn("D3D12: Swap chain buffer size: %ux%u", m_window_info.surface_width, m_window_info.surface_height);
|
||||
|
||||
if (m_window_info.type == WindowInfo::Type::Win32)
|
||||
{
|
||||
@@ -998,7 +998,7 @@ bool GSDevice12::UpdateWindow()
|
||||
|
||||
if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain())
|
||||
{
|
||||
Console.WriteLn("Failed to create swap chain on updated window");
|
||||
Console.WriteLn("D3D12: Failed to create swap chain on updated window");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1066,7 +1066,7 @@ void GSDevice12::ResizeWindow(s32 new_window_width, s32 new_window_height, float
|
||||
HRESULT hr = m_swap_chain->ResizeBuffers(
|
||||
0, 0, 0, DXGI_FORMAT_UNKNOWN, m_using_allow_tearing ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0);
|
||||
if (FAILED(hr))
|
||||
Console.Error("ResizeBuffers() failed: 0x%08X", hr);
|
||||
Console.Error("D3D12: ResizeBuffers() failed: 0x%08X", hr);
|
||||
|
||||
if (!CreateSwapChainRTV())
|
||||
pxFailRel("Failed to recreate swap chain RTV after resize");
|
||||
@@ -1931,7 +1931,7 @@ bool GSDevice12::CompileCASPipelines()
|
||||
m_cas_sharpen_pipeline = cpb.Create(m_device.get(), m_shader_cache, false);
|
||||
if (!m_cas_upscale_pipeline || !m_cas_sharpen_pipeline)
|
||||
{
|
||||
Console.Error("Failed to create CAS pipelines");
|
||||
Console.Error("D3D12: Failed to create CAS pipelines");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1943,7 +1943,7 @@ bool GSDevice12::CompileImGuiPipeline()
|
||||
const std::optional<std::string> hlsl = ReadShaderSource("shaders/dx11/imgui.fx");
|
||||
if (!hlsl.has_value())
|
||||
{
|
||||
Console.Error("Failed to read imgui.fx");
|
||||
Console.Error("D3D12: Failed to read imgui.fx");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1951,7 +1951,7 @@ bool GSDevice12::CompileImGuiPipeline()
|
||||
const ComPtr<ID3DBlob> ps = m_shader_cache.GetPixelShader(hlsl.value(), nullptr, "ps_main");
|
||||
if (!vs || !ps)
|
||||
{
|
||||
Console.Error("Failed to compile ImGui shaders");
|
||||
Console.Error("D3D12: Failed to compile ImGui shaders");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1972,7 +1972,7 @@ bool GSDevice12::CompileImGuiPipeline()
|
||||
m_imgui_pipeline = gpb.Create(m_device.get(), m_shader_cache, false);
|
||||
if (!m_imgui_pipeline)
|
||||
{
|
||||
Console.Error("Failed to compile ImGui pipeline");
|
||||
Console.Error("D3D12: Failed to compile ImGui pipeline");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2015,7 +2015,7 @@ void GSDevice12::RenderImGui()
|
||||
// just skip if we run out.. we can't resume the present render pass :/
|
||||
if (!GetSamplerAllocator().LookupSingle(&m_utility_sampler_gpu, m_linear_sampler_cpu))
|
||||
{
|
||||
Console.Warning("Skipping ImGui draw because of no descriptors");
|
||||
Console.Warning("D3D12: Skipping ImGui draw because of no descriptors");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2032,7 +2032,7 @@ void GSDevice12::RenderImGui()
|
||||
const u32 size = sizeof(ImDrawVert) * static_cast<u32>(cmd_list->VtxBuffer.Size);
|
||||
if (!m_vertex_stream_buffer.ReserveMemory(size, sizeof(ImDrawVert)))
|
||||
{
|
||||
Console.Warning("Skipping ImGui draw because of no vertex buffer space");
|
||||
Console.Warning("D3D12: Skipping ImGui draw because of no vertex buffer space");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2072,7 +2072,7 @@ void GSDevice12::RenderImGui()
|
||||
|
||||
if (!GetTextureGroupDescriptors(&m_utility_texture_gpu, &handle, 1))
|
||||
{
|
||||
Console.Warning("Skipping ImGui draw because of no descriptors");
|
||||
Console.Warning("D3D12: Skipping ImGui draw because of no descriptors");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2103,7 +2103,7 @@ bool GSDevice12::DoCAS(
|
||||
if (!GetTextureGroupDescriptors(&sTexDH, &sTex12->GetSRVDescriptor(), 1) ||
|
||||
!GetTextureGroupDescriptors(&dTexDH, &dTex12->GetUAVDescriptor(), 1))
|
||||
{
|
||||
Console.Error("Failed to allocate CAS descriptors.");
|
||||
Console.Error("D3D12: Failed to allocate CAS descriptors.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3567,7 +3567,7 @@ bool GSDevice12::ApplyTFXState(bool already_execed)
|
||||
{
|
||||
if (already_execed)
|
||||
{
|
||||
Console.Error("Failed to reserve vertex uniform space");
|
||||
Console.Error("D3D12: Failed to reserve vertex uniform space");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3588,7 +3588,7 @@ bool GSDevice12::ApplyTFXState(bool already_execed)
|
||||
{
|
||||
if (already_execed)
|
||||
{
|
||||
Console.Error("Failed to reserve pixel uniform space");
|
||||
Console.Error("D3D12: Failed to reserve pixel uniform space");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3846,7 +3846,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
date_image = SetupPrimitiveTrackingDATE(config, pipe);
|
||||
if (!date_image)
|
||||
{
|
||||
Console.WriteLn("Failed to allocate DATE image, aborting draw.");
|
||||
Console.WriteLn("D3D12: Failed to allocate DATE image, aborting draw.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3874,7 +3874,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
hdr_rt = static_cast<GSTexture12*>(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::HDRColor, false));
|
||||
if (!hdr_rt)
|
||||
{
|
||||
Console.WriteLn("Failed to allocate HDR render target, aborting draw.");
|
||||
Console.WriteLn("D3D12: Failed to allocate HDR render target, aborting draw.");
|
||||
if (date_image)
|
||||
Recycle(date_image);
|
||||
return;
|
||||
|
||||
@@ -1012,7 +1012,8 @@ bool GSRendererHW::NextDrawMatchesShuffle() const
|
||||
{
|
||||
// Make sure nothing unexpected has changed.
|
||||
// Twinsanity seems to screw with ZBUF here despite it being irrelevant.
|
||||
const GSDrawingContext& next_ctx = m_env.CTXT[m_backed_up_ctx];
|
||||
const int get_next_ctx = (m_state_flush_reason == CONTEXTCHANGE) ? m_env.PRIM.CTXT : m_backed_up_ctx;
|
||||
const GSDrawingContext& next_ctx = m_env.CTXT[get_next_ctx];
|
||||
if (((m_context->TEX0.U64 ^ next_ctx.TEX0.U64) & (~0x3FFF)) != 0 ||
|
||||
m_context->TEX1.U64 != next_ctx.TEX1.U64 ||
|
||||
m_context->CLAMP.U64 != next_ctx.CLAMP.U64 ||
|
||||
@@ -2548,11 +2549,11 @@ void GSRendererHW::Draw()
|
||||
}
|
||||
}
|
||||
const bool possible_shuffle = !no_rt && (((shuffle_target && GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].bpp == 16) || (m_cached_ctx.FRAME.Block() == m_cached_ctx.TEX0.TBP0 && ((m_cached_ctx.TEX0.PSM & 0x6) || m_cached_ctx.FRAME.PSM != m_cached_ctx.TEX0.PSM))) || IsPossibleChannelShuffle());
|
||||
const bool need_aem_color = GSLocalMemory::m_psm[m_cached_ctx.TEX0.PSM].trbpp <= 24 && GSLocalMemory::m_psm[m_cached_ctx.TEX0.PSM].pal == 0 && m_context->ALPHA.C == 0 && m_env.TEXA.AEM;
|
||||
const bool need_aem_color = GSLocalMemory::m_psm[m_cached_ctx.TEX0.PSM].trbpp <= 24 && GSLocalMemory::m_psm[m_cached_ctx.TEX0.PSM].pal == 0 && ((PRIM->ABE && m_context->ALPHA.C == 0) || IsDiscardingDstAlpha()) && m_draw_env->TEXA.AEM;
|
||||
const u32 color_mask = (m_vt.m_max.c > GSVector4i::zero()).mask();
|
||||
const bool texture_function_color = m_cached_ctx.TEX0.TFX == TFX_DECAL || (color_mask & 0xFFF) || (m_cached_ctx.TEX0.TFX > TFX_DECAL && (color_mask & 0xF000));
|
||||
const bool texture_function_alpha = m_cached_ctx.TEX0.TFX != TFX_MODULATE || (color_mask & 0xF000);
|
||||
const bool req_color = texture_function_color && (!PRIM->ABE || (PRIM->ABE && (IsUsingCsInBlend() || need_aem_color))) && (possible_shuffle || (m_cached_ctx.FRAME.FBMSK & (fm_mask & 0x00FFFFFF)) != (fm_mask & 0x00FFFFFF));
|
||||
const bool req_color = texture_function_color && (!PRIM->ABE || (PRIM->ABE && IsUsingCsInBlend())) && (possible_shuffle || (m_cached_ctx.FRAME.FBMSK & (fm_mask & 0x00FFFFFF)) != (fm_mask & 0x00FFFFFF)) || need_aem_color;
|
||||
const bool alpha_used = (GSUtil::GetChannelMask(m_context->TEX0.PSM) == 0x8 || (m_context->TEX0.TCC && texture_function_alpha)) && ((PRIM->ABE && IsUsingAsInBlend()) || (m_cached_ctx.TEST.ATE && m_cached_ctx.TEST.ATST > ATST_ALWAYS) || (possible_shuffle || (m_cached_ctx.FRAME.FBMSK & (fm_mask & 0xFF000000)) != (fm_mask & 0xFF000000)));
|
||||
const bool req_alpha = (GSUtil::GetChannelMask(m_context->TEX0.PSM) & 0x8) && alpha_used;
|
||||
|
||||
@@ -7271,7 +7272,8 @@ bool GSRendererHW::IsDiscardingDstRGB()
|
||||
bool GSRendererHW::IsDiscardingDstAlpha() const
|
||||
{
|
||||
return ((!PRIM->ABE || m_context->ALPHA.C != 1) && // not using Ad
|
||||
((m_cached_ctx.FRAME.FBMSK & GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].fmsk) & 0xFF000000u) == 0); // alpha isn't masked
|
||||
((m_cached_ctx.FRAME.FBMSK & GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].fmsk) & 0xFF000000u) == 0) && // alpha isn't masked
|
||||
(!m_cached_ctx.TEST.ATE || !(m_cached_ctx.TEST.ATST == ATST_NEVER && m_cached_ctx.TEST.AFAIL == AFAIL_RGB_ONLY && m_cached_ctx.FRAME.PSM == PSMCT32)); // No alpha test or no rbg only
|
||||
}
|
||||
|
||||
// Like PrimitiveCoversWithoutGaps but with texture coordinates.
|
||||
|
||||
@@ -170,13 +170,13 @@ bool GSDeviceOGL::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
m_gl_context = GLContext::Create(m_window_info, &error);
|
||||
if (!m_gl_context)
|
||||
{
|
||||
Console.ErrorFmt("Failed to create any GL context: {}", error.GetDescription());
|
||||
Console.ErrorFmt("GL: Failed to create any context: {}", error.GetDescription());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_gl_context->MakeCurrent())
|
||||
{
|
||||
Console.Error("Failed to make GL context current");
|
||||
Console.Error("GL: Failed to make context current");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -196,11 +196,11 @@ bool GSDeviceOGL::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
if (!GSConfig.DisableShaderCache)
|
||||
{
|
||||
if (!m_shader_cache.Open())
|
||||
Console.Warning("Shader cache failed to open.");
|
||||
Console.Warning("GL: Shader cache failed to open.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLn("Not using shader cache.");
|
||||
Console.WriteLn("GL: Not using shader cache.");
|
||||
}
|
||||
|
||||
// because of fbo bindings below...
|
||||
@@ -544,7 +544,7 @@ bool GSDeviceOGL::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error("Failed to create texture upload buffer. Using slow path.");
|
||||
Console.Error("GL: Failed to create texture upload buffer. Using slow path.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,17 +617,17 @@ bool GSDeviceOGL::CheckFeatures(bool& buggy_pbo)
|
||||
if (std::strstr(vendor, "Advanced Micro Devices") || std::strstr(vendor, "ATI Technologies Inc.") ||
|
||||
std::strstr(vendor, "ATI"))
|
||||
{
|
||||
Console.WriteLn(Color_StrongRed, "OGL: AMD GPU detected.");
|
||||
Console.WriteLn(Color_StrongRed, "GL: AMD GPU detected.");
|
||||
//vendor_id_amd = true;
|
||||
}
|
||||
else if (std::strstr(vendor, "NVIDIA Corporation"))
|
||||
{
|
||||
Console.WriteLn(Color_StrongGreen, "OGL: NVIDIA GPU detected.");
|
||||
Console.WriteLn(Color_StrongGreen, "GL: NVIDIA GPU detected.");
|
||||
vendor_id_nvidia = true;
|
||||
}
|
||||
else if (std::strstr(vendor, "Intel"))
|
||||
{
|
||||
Console.WriteLn(Color_StrongBlue, "OGL: Intel GPU detected.");
|
||||
Console.WriteLn(Color_StrongBlue, "GL: Intel GPU detected.");
|
||||
//vendor_id_intel = true;
|
||||
}
|
||||
|
||||
@@ -706,13 +706,13 @@ bool GSDeviceOGL::CheckFeatures(bool& buggy_pbo)
|
||||
// using the normal texture update routines and letting the driver take care of it.
|
||||
buggy_pbo = !GLAD_GL_VERSION_4_4 && !GLAD_GL_ARB_buffer_storage && !GLAD_GL_EXT_buffer_storage;
|
||||
if (buggy_pbo)
|
||||
Console.Warning("Not using PBOs for texture uploads because buffer_storage is unavailable.");
|
||||
Console.Warning("GL: Not using PBOs for texture uploads because buffer_storage is unavailable.");
|
||||
|
||||
// Give the user the option to disable PBO usage for downloads.
|
||||
// Most drivers seem to be faster with PBO.
|
||||
m_disable_download_pbo = Host::GetBoolSettingValue("EmuCore/GS", "DisableGLDownloadPBO", false);
|
||||
if (m_disable_download_pbo)
|
||||
Console.Warning("Not using PBOs for texture downloads, this may reduce performance.");
|
||||
Console.Warning("GL: Not using PBOs for texture downloads, this may reduce performance.");
|
||||
|
||||
// optional features based on context
|
||||
m_features.broken_point_sampler = false;
|
||||
@@ -751,7 +751,7 @@ bool GSDeviceOGL::CheckFeatures(bool& buggy_pbo)
|
||||
const bool buggy_vs_expand =
|
||||
vendor_id_nvidia && (!GLAD_GL_ARB_bindless_texture && !GLAD_GL_NV_bindless_texture);
|
||||
if (buggy_vs_expand)
|
||||
Console.Warning("Disabling vertex shader expand due to broken NVIDIA driver.");
|
||||
Console.Warning("GL: Disabling vertex shader expand due to broken NVIDIA driver.");
|
||||
|
||||
if (GLAD_GL_ARB_shader_storage_buffer_object)
|
||||
{
|
||||
@@ -762,7 +762,7 @@ bool GSDeviceOGL::CheckFeatures(bool& buggy_pbo)
|
||||
GLAD_GL_ARB_gpu_shader5);
|
||||
}
|
||||
if (!m_features.vs_expand)
|
||||
Console.Warning("Vertex expansion is not supported. This will reduce performance.");
|
||||
Console.Warning("GL: Vertex expansion is not supported. This will reduce performance.");
|
||||
|
||||
GLint point_range[2] = {};
|
||||
glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_range);
|
||||
@@ -774,7 +774,7 @@ bool GSDeviceOGL::CheckFeatures(bool& buggy_pbo)
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
m_max_texture_size = std::max(1024u, static_cast<u32>(max_texture_size));
|
||||
|
||||
Console.WriteLn("Using %s for point expansion, %s for line expansion and %s for sprite expansion.",
|
||||
Console.WriteLn("GL: Using %s for point expansion, %s for line expansion and %s for sprite expansion.",
|
||||
m_features.point_expand ? "hardware" : (m_features.vs_expand ? "vertex expanding" : "UNSUPPORTED"),
|
||||
m_features.line_expand ? "hardware" : (m_features.vs_expand ? "vertex expanding" : "UNSUPPORTED"),
|
||||
m_features.vs_expand ? "vertex expanding" : "CPU");
|
||||
@@ -798,7 +798,7 @@ void GSDeviceOGL::SetSwapInterval()
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
if (!m_gl_context->SetSwapInterval(interval))
|
||||
WARNING_LOG("Failed to set swap interval to {}", interval);
|
||||
WARNING_LOG("GL: Failed to set swap interval to {}", interval);
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current_fbo);
|
||||
}
|
||||
@@ -881,7 +881,7 @@ bool GSDeviceOGL::UpdateWindow()
|
||||
|
||||
if (!m_gl_context->ChangeSurface(m_window_info))
|
||||
{
|
||||
Console.Error("Failed to change surface");
|
||||
Console.Error("GL: Failed to change surface");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ void GSDeviceOGL::DestroySurface()
|
||||
{
|
||||
m_window_info = {};
|
||||
if (!m_gl_context->ChangeSurface(m_window_info))
|
||||
Console.Error("Failed to switch to surfaceless");
|
||||
Console.Error("GL: Failed to switch to surfaceless");
|
||||
}
|
||||
|
||||
std::string GSDeviceOGL::GetDriverInfo() const
|
||||
@@ -1336,7 +1336,7 @@ std::string GSDeviceOGL::GenGlslHeader(const std::string_view entry, GLenum type
|
||||
|
||||
std::string GSDeviceOGL::GetVSSource(VSSelector sel)
|
||||
{
|
||||
DevCon.WriteLn("Compiling new vertex shader with selector 0x%" PRIX64, sel.key);
|
||||
DevCon.WriteLn("GL: Compiling new vertex shader with selector 0x%" PRIX64, sel.key);
|
||||
|
||||
std::string macro = fmt::format("#define VS_FST {}\n", static_cast<u32>(sel.fst))
|
||||
+ fmt::format("#define VS_IIP {}\n", static_cast<u32>(sel.iip))
|
||||
@@ -1350,7 +1350,7 @@ std::string GSDeviceOGL::GetVSSource(VSSelector sel)
|
||||
|
||||
std::string GSDeviceOGL::GetPSSource(const PSSelector& sel)
|
||||
{
|
||||
DevCon.WriteLn("Compiling new pixel shader with selector 0x%" PRIX64 "%08X", sel.key_hi, sel.key_lo);
|
||||
DevCon.WriteLn("GL: Compiling new pixel shader with selector 0x%" PRIX64 "%08X", sel.key_hi, sel.key_lo);
|
||||
|
||||
std::string macro = fmt::format("#define PS_FST {}\n", sel.fst)
|
||||
+ fmt::format("#define PS_WMS {}\n", sel.wms)
|
||||
@@ -1834,7 +1834,7 @@ bool GSDeviceOGL::CompileFXAAProgram()
|
||||
const std::optional<std::string> shader = ReadShaderSource("shaders/common/fxaa.fx");
|
||||
if (!shader.has_value())
|
||||
{
|
||||
Console.Error("Failed to read fxaa.fs");
|
||||
Console.Error("GL: Failed to read fxaa.fs");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1842,7 +1842,7 @@ bool GSDeviceOGL::CompileFXAAProgram()
|
||||
std::optional<GLProgram> prog = m_shader_cache.GetProgram(m_convert.vs, ps);
|
||||
if (!prog.has_value())
|
||||
{
|
||||
Console.Error("Failed to compile FXAA fragment shader");
|
||||
Console.Error("GL: Failed to compile FXAA fragment shader");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2065,7 +2065,7 @@ bool GSDeviceOGL::CreateImGuiProgram()
|
||||
const std::optional<std::string> glsl = ReadShaderSource("shaders/opengl/imgui.glsl");
|
||||
if (!glsl.has_value())
|
||||
{
|
||||
Console.Error("Failed to read imgui.glsl");
|
||||
Console.Error("GL: Failed to read imgui.glsl");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2074,7 +2074,7 @@ bool GSDeviceOGL::CreateImGuiProgram()
|
||||
GetShaderSource("ps_main", GL_FRAGMENT_SHADER, glsl.value()));
|
||||
if (!prog.has_value())
|
||||
{
|
||||
Console.Error("Failed to compile imgui shaders");
|
||||
Console.Error("GL: Failed to compile imgui shaders");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ bool GSDeviceVK::SelectInstanceExtensions(ExtensionList* extension_list, const W
|
||||
|
||||
if (extension_count == 0)
|
||||
{
|
||||
Console.Error("Vulkan: No extensions supported by instance.");
|
||||
Console.Error("VK: No extensions supported by instance.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -170,13 +170,13 @@ bool GSDeviceVK::SelectInstanceExtensions(ExtensionList* extension_list, const W
|
||||
[name](const VkExtensionProperties& properties) { return !strcmp(name, properties.extensionName); }) !=
|
||||
available_extension_list.end())
|
||||
{
|
||||
DevCon.WriteLn("Enabling extension: %s", name);
|
||||
DevCon.WriteLn("VK: Enabling extension: %s", name);
|
||||
extension_list->push_back(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (required)
|
||||
Console.Error("Vulkan: Missing required extension %s.", name);
|
||||
Console.Error("VK: Missing required extension %s.", name);
|
||||
|
||||
return false;
|
||||
};
|
||||
@@ -204,7 +204,7 @@ bool GSDeviceVK::SelectInstanceExtensions(ExtensionList* extension_list, const W
|
||||
|
||||
// VK_EXT_debug_utils
|
||||
if (enable_debug_utils && !SupportsExtension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, false))
|
||||
Console.Warning("Vulkan: Debug report requested, but extension is not available.");
|
||||
Console.Warning("VK: Debug report requested, but extension is not available.");
|
||||
|
||||
oe->vk_ext_swapchain_maintenance1 = (wi.type != WindowInfo::Type::Surfaceless &&
|
||||
SupportsExtension(VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME, false));
|
||||
@@ -231,7 +231,7 @@ GSDeviceVK::GPUList GSDeviceVK::EnumerateGPUs(VkInstance instance)
|
||||
res = vkEnumeratePhysicalDevices(instance, &gpu_count, physical_devices.data());
|
||||
if (res == VK_INCOMPLETE)
|
||||
{
|
||||
Console.Warning("First vkEnumeratePhysicalDevices() call returned %zu devices, but second returned %u",
|
||||
Console.Warning("VK: First vkEnumeratePhysicalDevices() call returned %zu devices, but second returned %u",
|
||||
physical_devices.size(), gpu_count);
|
||||
}
|
||||
else if (res != VK_SUCCESS)
|
||||
@@ -254,7 +254,7 @@ GSDeviceVK::GPUList GSDeviceVK::EnumerateGPUs(VkInstance instance)
|
||||
if (VK_API_VERSION_VARIANT(props.apiVersion) == 0 && VK_API_VERSION_MAJOR(props.apiVersion) <= 1 &&
|
||||
VK_API_VERSION_MINOR(props.apiVersion) < 1)
|
||||
{
|
||||
Console.Warning(fmt::format("Ignoring Vulkan GPU '{}' because it only claims support for Vulkan {}.{}.{}",
|
||||
Console.Warning(fmt::format("VK: Ignoring GPU '{}' because it only claims support for Vulkan {}.{}.{}",
|
||||
props.deviceName, VK_API_VERSION_MAJOR(props.apiVersion), VK_API_VERSION_MINOR(props.apiVersion),
|
||||
VK_API_VERSION_PATCH(props.apiVersion)));
|
||||
continue;
|
||||
@@ -265,7 +265,7 @@ GSDeviceVK::GPUList GSDeviceVK::EnumerateGPUs(VkInstance instance)
|
||||
res = vkEnumerateDeviceExtensionProperties(device, nullptr, &extension_count, nullptr);
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
Console.Warning(fmt::format("Ignoring Vulkan GPU '{}' because vkEnumerateInstanceExtensionProperties() failed: ",
|
||||
Console.Warning(fmt::format("VK: Ignoring GPU '{}' because vkEnumerateInstanceExtensionProperties() failed: ",
|
||||
props.deviceName, Vulkan::VkResultToString(res)));
|
||||
continue;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ GSDeviceVK::GPUList GSDeviceVK::EnumerateGPUs(VkInstance instance)
|
||||
return (std::strcmp(required_extension_name, ext.extensionName) == 0);
|
||||
}) == available_extension_list.end())
|
||||
{
|
||||
Console.Warning(fmt::format("Ignoring Vulkan GPU '{}' because is is missing required extension {}",
|
||||
Console.Warning(fmt::format("VK: Ignoring GPU '{}' because is is missing required extension {}",
|
||||
props.deviceName, required_extension_name));
|
||||
has_missing_extension = true;
|
||||
}
|
||||
@@ -360,7 +360,7 @@ bool GSDeviceVK::SelectDeviceExtensions(ExtensionList* extension_list, bool enab
|
||||
|
||||
if (extension_count == 0)
|
||||
{
|
||||
Console.Error("Vulkan: No extensions supported by device.");
|
||||
Console.Error("VK: No extensions supported by device.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ bool GSDeviceVK::SelectDeviceExtensions(ExtensionList* extension_list, bool enab
|
||||
if (std::none_of(extension_list->begin(), extension_list->end(),
|
||||
[name](const char* existing_name) { return (std::strcmp(existing_name, name) == 0); }))
|
||||
{
|
||||
DevCon.WriteLn("Enabling extension: %s", name);
|
||||
DevCon.WriteLn("VK: Enabling extension: %s", name);
|
||||
extension_list->push_back(name);
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ bool GSDeviceVK::SelectDeviceExtensions(ExtensionList* extension_list, bool enab
|
||||
}
|
||||
|
||||
if (required)
|
||||
Console.Error("Vulkan: Missing required extension %s.", name);
|
||||
Console.Error("VK: Missing required extension %s.", name);
|
||||
|
||||
return false;
|
||||
};
|
||||
@@ -531,12 +531,12 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
}
|
||||
if (m_graphics_queue_family_index == queue_family_count)
|
||||
{
|
||||
Console.Error("Vulkan: Failed to find an acceptable graphics queue.");
|
||||
Console.Error("VK: Failed to find an acceptable graphics queue.");
|
||||
return false;
|
||||
}
|
||||
if (surface != VK_NULL_HANDLE && m_present_queue_family_index == queue_family_count)
|
||||
{
|
||||
Console.Error("Vulkan: Failed to find an acceptable present queue.");
|
||||
Console.Error("VK: Failed to find an acceptable present queue.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ bool GSDeviceVK::ProcessDeviceExtensions()
|
||||
// confirm we actually support it
|
||||
if (push_descriptor_properties.maxPushDescriptors < NUM_TFX_TEXTURES)
|
||||
{
|
||||
Console.Error("maxPushDescriptors (%u) is below required (%u)", push_descriptor_properties.maxPushDescriptors,
|
||||
Console.Error("VK: maxPushDescriptors (%u) is below required (%u)", push_descriptor_properties.maxPushDescriptors,
|
||||
NUM_TFX_TEXTURES);
|
||||
return false;
|
||||
}
|
||||
@@ -766,7 +766,7 @@ bool GSDeviceVK::ProcessDeviceExtensions()
|
||||
if (!line_rasterization_feature.bresenhamLines)
|
||||
{
|
||||
// See note in SelectDeviceExtensions().
|
||||
Console.Error("bresenhamLines is not supported.");
|
||||
Console.Error("VK: bresenhamLines is not supported.");
|
||||
#ifndef __APPLE__
|
||||
return false;
|
||||
#else
|
||||
@@ -870,7 +870,7 @@ bool GSDeviceVK::CreateAllocator()
|
||||
|
||||
if (heap_size_limits[type.heapIndex] == VK_WHOLE_SIZE)
|
||||
{
|
||||
Console.Warning("Disabling allocation from upload heap #%u (%.2f MB) due to debug device.",
|
||||
Console.Warning("VK: Disabling allocation from upload heap #%u (%.2f MB) due to debug device.",
|
||||
type.heapIndex, static_cast<float>(heap.size) / 1048576.0f);
|
||||
heap_size_limits[type.heapIndex] = 0;
|
||||
has_upload_heap = true;
|
||||
@@ -1447,22 +1447,22 @@ VKAPI_ATTR VkBool32 VKAPI_CALL DebugMessengerCallback(VkDebugUtilsMessageSeverit
|
||||
{
|
||||
if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
|
||||
{
|
||||
Console.Error("Vulkan debug report: (%s) %s",
|
||||
Console.Error("VK: debug report: (%s) %s",
|
||||
pCallbackData->pMessageIdName ? pCallbackData->pMessageIdName : "", pCallbackData->pMessage);
|
||||
}
|
||||
else if (severity & (VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT))
|
||||
{
|
||||
Console.Warning("Vulkan debug report: (%s) %s",
|
||||
Console.Warning("VK: debug report: (%s) %s",
|
||||
pCallbackData->pMessageIdName ? pCallbackData->pMessageIdName : "", pCallbackData->pMessage);
|
||||
}
|
||||
else if (severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT)
|
||||
{
|
||||
Console.WriteLn("Vulkan debug report: (%s) %s",
|
||||
Console.WriteLn("VK: debug report: (%s) %s",
|
||||
pCallbackData->pMessageIdName ? pCallbackData->pMessageIdName : "", pCallbackData->pMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
DevCon.WriteLn("Vulkan debug report: (%s) %s",
|
||||
DevCon.WriteLn("VK: debug report: (%s) %s",
|
||||
pCallbackData->pMessageIdName ? pCallbackData->pMessageIdName : "", pCallbackData->pMessage);
|
||||
}
|
||||
|
||||
@@ -2173,7 +2173,7 @@ bool GSDeviceVK::UpdateWindow()
|
||||
VkSurfaceKHR surface = VKSwapChain::CreateVulkanSurface(m_instance, m_physical_device, &m_window_info);
|
||||
if (surface == VK_NULL_HANDLE)
|
||||
{
|
||||
Console.Error("Failed to create new surface for swap chain");
|
||||
Console.Error("VK: Failed to create new surface for swap chain");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2182,7 +2182,7 @@ bool GSDeviceVK::UpdateWindow()
|
||||
!(m_swap_chain = VKSwapChain::Create(m_window_info, surface, present_mode,
|
||||
Pcsx2Config::GSOptions::TriStateToOptionalBoolean(GSConfig.ExclusiveFullscreenControl))))
|
||||
{
|
||||
Console.Error("Failed to create swap chain");
|
||||
Console.Error("VK: Failed to create swap chain");
|
||||
VKSwapChain::DestroyVulkanSurface(m_instance, &m_window_info, surface);
|
||||
return false;
|
||||
}
|
||||
@@ -2210,7 +2210,7 @@ void GSDeviceVK::ResizeWindow(s32 new_window_width, s32 new_window_height, float
|
||||
if (!m_swap_chain->ResizeSwapChain(new_window_width, new_window_height, new_window_scale))
|
||||
{
|
||||
// AcquireNextImage() will fail, and we'll recreate the surface.
|
||||
Console.Error("Failed to resize swap chain. Next present will fail.");
|
||||
Console.Error("VK: Failed to resize swap chain. Next present will fail.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2316,10 +2316,10 @@ GSDevice::PresentResult GSDeviceVK::BeginPresent(bool frame_skip)
|
||||
}
|
||||
else if (res == VK_ERROR_SURFACE_LOST_KHR)
|
||||
{
|
||||
Console.Warning("Surface lost, attempting to recreate");
|
||||
Console.Warning("VK: Surface lost, attempting to recreate");
|
||||
if (!m_swap_chain->RecreateSurface(m_window_info))
|
||||
{
|
||||
Console.Error("Failed to recreate surface after loss");
|
||||
Console.Error("VK: Failed to recreate surface after loss");
|
||||
ExecuteCommandBuffer(false);
|
||||
return PresentResult::FrameSkipped;
|
||||
}
|
||||
@@ -2494,7 +2494,7 @@ bool GSDeviceVK::CreateDeviceAndSwapChain()
|
||||
return false;
|
||||
}
|
||||
|
||||
ERROR_LOG("Vulkan validation/debug layers requested but are unavailable. Creating non-debug device.");
|
||||
ERROR_LOG("VK: validation/debug layers requested but are unavailable. Creating non-debug device.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2624,7 +2624,7 @@ bool GSDeviceVK::CheckFeatures()
|
||||
m_features.vs_expand = !GSConfig.DisableVertexShaderExpand;
|
||||
|
||||
if (!m_features.texture_barrier)
|
||||
Console.Warning("Texture buffers are disabled. This may break some graphical effects.");
|
||||
Console.Warning("VK: Texture buffers are disabled. This may break some graphical effects.");
|
||||
|
||||
// Test for D32S8 support.
|
||||
{
|
||||
@@ -2670,7 +2670,7 @@ bool GSDeviceVK::CheckFeatures()
|
||||
vkGetPhysicalDeviceFormatProperties(m_physical_device, vkfmt, &props);
|
||||
if ((props.optimalTilingFeatures & bits) != bits)
|
||||
{
|
||||
Host::ReportFormattedErrorAsync("Vulkan Renderer Unavailable",
|
||||
Host::ReportFormattedErrorAsync("VK: Renderer Unavailable",
|
||||
"Required format %u is missing bits, you may need to update your driver. (vk:%u, has:0x%x, needs:0x%x)",
|
||||
fmt, static_cast<unsigned>(vkfmt), props.optimalTilingFeatures, bits);
|
||||
return false;
|
||||
@@ -4387,14 +4387,14 @@ bool GSDeviceVK::CompileImGuiPipeline()
|
||||
const std::optional<std::string> glsl = ReadShaderSource("shaders/vulkan/imgui.glsl");
|
||||
if (!glsl.has_value())
|
||||
{
|
||||
Console.Error("Failed to read imgui.glsl");
|
||||
Console.Error("VK: Failed to read imgui.glsl");
|
||||
return false;
|
||||
}
|
||||
|
||||
VkShaderModule vs = GetUtilityVertexShader(glsl.value(), "vs_main");
|
||||
if (vs == VK_NULL_HANDLE)
|
||||
{
|
||||
Console.Error("Failed to compile ImGui vertex shader");
|
||||
Console.Error("VK: Failed to compile ImGui vertex shader");
|
||||
return false;
|
||||
}
|
||||
ScopedGuard vs_guard([this, &vs]() { vkDestroyShaderModule(m_device, vs, nullptr); });
|
||||
@@ -4402,7 +4402,7 @@ bool GSDeviceVK::CompileImGuiPipeline()
|
||||
VkShaderModule ps = GetUtilityFragmentShader(glsl.value(), "ps_main");
|
||||
if (ps == VK_NULL_HANDLE)
|
||||
{
|
||||
Console.Error("Failed to compile ImGui pixel shader");
|
||||
Console.Error("VK: Failed to compile ImGui pixel shader");
|
||||
return false;
|
||||
}
|
||||
ScopedGuard ps_guard([this, &ps]() { vkDestroyShaderModule(m_device, ps, nullptr); });
|
||||
@@ -4429,7 +4429,7 @@ bool GSDeviceVK::CompileImGuiPipeline()
|
||||
m_imgui_pipeline = gpb.Create(m_device, g_vulkan_shader_cache->GetPipelineCache(), false);
|
||||
if (!m_imgui_pipeline)
|
||||
{
|
||||
Console.Error("Failed to compile ImGui pipeline");
|
||||
Console.Error("VK: Failed to compile ImGui pipeline");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4474,7 +4474,7 @@ void GSDeviceVK::RenderImGui()
|
||||
const u32 size = sizeof(ImDrawVert) * static_cast<u32>(cmd_list->VtxBuffer.Size);
|
||||
if (!m_vertex_stream_buffer.ReserveMemory(size, sizeof(ImDrawVert)))
|
||||
{
|
||||
Console.Warning("Skipping ImGui draw because of no vertex buffer space");
|
||||
Console.Warning("VK: Skipping ImGui draw because of no vertex buffer space");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4518,7 +4518,7 @@ void GSDeviceVK::RenderBlankFrame()
|
||||
VkResult res = m_swap_chain->AcquireNextImage();
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
Console.Error("Failed to acquire image for blank frame present");
|
||||
Console.Error("VK: Failed to acquire image for blank frame present");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5021,13 +5021,13 @@ void GSDeviceVK::ExecuteCommandBuffer(bool wait_for_completion, const char* reas
|
||||
const std::string reason_str(StringUtil::StdStringFromFormatV(reason, ap));
|
||||
va_end(ap);
|
||||
|
||||
Console.Warning("Vulkan: Executing command buffer due to '%s'", reason_str.c_str());
|
||||
Console.Warning("VK: Executing command buffer due to '%s'", reason_str.c_str());
|
||||
ExecuteCommandBuffer(wait_for_completion);
|
||||
}
|
||||
|
||||
void GSDeviceVK::ExecuteCommandBufferAndRestartRenderPass(bool wait_for_completion, const char* reason)
|
||||
{
|
||||
Console.Warning("Vulkan: Executing command buffer due to '%s'", reason);
|
||||
Console.Warning("VK: Executing command buffer due to '%s'", reason);
|
||||
|
||||
const VkRenderPass render_pass = m_current_render_pass;
|
||||
const GSVector4i render_pass_area = m_current_render_pass_area;
|
||||
@@ -5344,7 +5344,7 @@ bool GSDeviceVK::ApplyTFXState(bool already_execed)
|
||||
{
|
||||
if (already_execed)
|
||||
{
|
||||
Console.Error("Failed to reserve vertex uniform space");
|
||||
Console.Error("VK: Failed to reserve vertex uniform space");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5365,7 +5365,7 @@ bool GSDeviceVK::ApplyTFXState(bool already_execed)
|
||||
{
|
||||
if (already_execed)
|
||||
{
|
||||
Console.Error("Failed to reserve pixel uniform space");
|
||||
Console.Error("VK: Failed to reserve pixel uniform space");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5991,7 +5991,7 @@ void GSDeviceVK::SendHWDraw(const GSHWDrawConfig& config, GSTextureVK* draw_rt,
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if ((one_barrier || full_barrier) && !m_pipeline_selector.ps.IsFeedbackLoop()) [[unlikely]]
|
||||
Console.Warning("GS: Possible unnecessary barrier detected.");
|
||||
Console.Warning("VK: Possible unnecessary barrier detected.");
|
||||
#endif
|
||||
const VkDependencyFlags barrier_flags = GetColorBufferBarrierFlags();
|
||||
if (full_barrier)
|
||||
|
||||
@@ -118,7 +118,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
if (eeVal >= 0 && eeVal < static_cast<int>(FPRoundMode::MaxCount))
|
||||
gameEntry.eeRoundMode = static_cast<FPRoundMode>(eeVal);
|
||||
else
|
||||
Console.Error(fmt::format("[GameDB] Invalid EE round mode '{}', specified for serial: '{}'.", eeVal, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid EE round mode '{}', specified for serial: '{}'.", eeVal, serial));
|
||||
}
|
||||
if (node["roundModes"].has_child("eeDivRoundMode"))
|
||||
{
|
||||
@@ -127,7 +127,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
if (eeVal >= 0 && eeVal < static_cast<int>(FPRoundMode::MaxCount))
|
||||
gameEntry.eeDivRoundMode = static_cast<FPRoundMode>(eeVal);
|
||||
else
|
||||
Console.Error(fmt::format("[GameDB] Invalid EE division round mode '{}', specified for serial: '{}'.", eeVal, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid EE division round mode '{}', specified for serial: '{}'.", eeVal, serial));
|
||||
}
|
||||
if (node["roundModes"].has_child("vuRoundMode"))
|
||||
{
|
||||
@@ -140,7 +140,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Invalid VU round mode '{}', specified for serial: '{}'.", vuVal, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid VU round mode '{}', specified for serial: '{}'.", vuVal, serial));
|
||||
}
|
||||
}
|
||||
if (node["roundModes"].has_child("vu0RoundMode"))
|
||||
@@ -150,7 +150,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
if (vuVal >= 0 && vuVal < static_cast<int>(FPRoundMode::MaxCount))
|
||||
gameEntry.vu0RoundMode = static_cast<FPRoundMode>(vuVal);
|
||||
else
|
||||
Console.Error(fmt::format("[GameDB] Invalid VU0 round mode '{}', specified for serial: '{}'.", vuVal, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid VU0 round mode '{}', specified for serial: '{}'.", vuVal, serial));
|
||||
}
|
||||
if (node["roundModes"].has_child("vu1RoundMode"))
|
||||
{
|
||||
@@ -159,7 +159,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
if (vuVal >= 0 && vuVal < static_cast<int>(FPRoundMode::MaxCount))
|
||||
gameEntry.vu1RoundMode = static_cast<FPRoundMode>(vuVal);
|
||||
else
|
||||
Console.Error(fmt::format("[GameDB] Invalid VU1 round mode '{}', specified for serial: '{}'.", vuVal, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid VU1 round mode '{}', specified for serial: '{}'.", vuVal, serial));
|
||||
}
|
||||
}
|
||||
if (node.has_child("clampModes"))
|
||||
@@ -217,7 +217,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
|
||||
if (!fixValidated)
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Invalid gamefix: '{}', specified for serial: '{}'. Dropping!", fix, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid gamefix: '{}', specified for serial: '{}'. Dropping!", fix, serial));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Invalid speedhack: '{}={}', specified for serial: '{}'. Dropping!",
|
||||
Console.Error(fmt::format("GameDB: Invalid speedhack: '{}={}', specified for serial: '{}'. Dropping!",
|
||||
id_view, value_view, serial));
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
|
||||
if (value.value_or(-1) < 0)
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Invalid GS HW Fix Value for '{}' in '{}': '{}'", id_name, serial, str_value));
|
||||
Console.Error(fmt::format("GameDB: Invalid GS HW Fix Value for '{}' in '{}': '{}'", id_name, serial, str_value));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -276,7 +276,7 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
}
|
||||
if (!id.has_value() || !value.has_value())
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Invalid GS HW Fix: '{}' specified for serial '{}'. Dropping!", id_name, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid GS HW Fix: '{}' specified for serial '{}'. Dropping!", id_name, serial));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -305,12 +305,12 @@ void GameDatabase::parseAndInsert(const std::string_view serial, const c4::yml::
|
||||
const std::optional<u32> crc = (StringUtil::compareNoCase(crc_str, "default")) ? std::optional<u32>(0) : StringUtil::FromChars<u32>(crc_str, 16);
|
||||
if (!crc.has_value())
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Invalid CRC '{}' found for serial: '{}'. Skipping!", crc_str, serial));
|
||||
Console.Error(fmt::format("GameDB: Invalid CRC '{}' found for serial: '{}'. Skipping!", crc_str, serial));
|
||||
continue;
|
||||
}
|
||||
if (gameEntry.patches.find(crc.value()) != gameEntry.patches.end())
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Duplicate CRC '{}' found for serial: '{}'. Skipping, CRCs are case-insensitive!", crc_str, serial));
|
||||
Console.Error(fmt::format("GameDB: Duplicate CRC '{}' found for serial: '{}'. Skipping, CRCs are case-insensitive!", crc_str, serial));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -442,18 +442,18 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
{
|
||||
// Only apply core game fixes if the user has enabled them.
|
||||
if (!applyAuto)
|
||||
Console.Warning("[GameDB] Game Fixes are disabled");
|
||||
Console.Warning("GameDB: Game Fixes are disabled");
|
||||
|
||||
if (eeRoundMode < FPRoundMode::MaxCount)
|
||||
{
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeRoundMode)]);
|
||||
Console.WriteLn("GameDB: Changing EE/FPU roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeRoundMode)]);
|
||||
config.Cpu.FPUFPCR.SetRoundMode(eeRoundMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("[GameDB] Skipping changing EE/FPU roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeRoundMode)]);
|
||||
Console.Warning("GameDB: Skipping changing EE/FPU roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeRoundMode)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,12 +461,12 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
{
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing EE/FPU divison roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeDivRoundMode)]);
|
||||
Console.WriteLn("GameDB: Changing EE/FPU divison roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeDivRoundMode)]);
|
||||
config.Cpu.FPUDivFPCR.SetRoundMode(eeDivRoundMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("[GameDB] Skipping changing EE/FPU roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeRoundMode)]);
|
||||
Console.Warning("GameDB: Skipping changing EE/FPU roundmode to %d [%s]", eeRoundMode, s_round_modes[static_cast<u8>(eeRoundMode)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,12 +474,12 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
{
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing VU0 roundmode to %d [%s]", vu0RoundMode, s_round_modes[static_cast<u8>(vu0RoundMode)]);
|
||||
Console.WriteLn("GameDB: Changing VU0 roundmode to %d [%s]", vu0RoundMode, s_round_modes[static_cast<u8>(vu0RoundMode)]);
|
||||
config.Cpu.VU0FPCR.SetRoundMode(vu0RoundMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("[GameDB] Skipping changing VU0 roundmode to %d [%s]", vu0RoundMode, s_round_modes[static_cast<u8>(vu0RoundMode)]);
|
||||
Console.Warning("GameDB: Skipping changing VU0 roundmode to %d [%s]", vu0RoundMode, s_round_modes[static_cast<u8>(vu0RoundMode)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,12 +487,12 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
{
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing VU1 roundmode to %d [%s]", vu1RoundMode, s_round_modes[static_cast<u8>(vu1RoundMode)]);
|
||||
Console.WriteLn("GameDB: Changing VU1 roundmode to %d [%s]", vu1RoundMode, s_round_modes[static_cast<u8>(vu1RoundMode)]);
|
||||
config.Cpu.VU1FPCR.SetRoundMode(vu1RoundMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("[GameDB] Skipping changing VU1 roundmode to %d [%s]", vu1RoundMode, s_round_modes[static_cast<u8>(vu1RoundMode)]);
|
||||
Console.Warning("GameDB: Skipping changing VU1 roundmode to %d [%s]", vu1RoundMode, s_round_modes[static_cast<u8>(vu1RoundMode)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,13 +501,13 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
const int clampMode = enum_cast(eeClampMode);
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode);
|
||||
Console.WriteLn("GameDB: Changing EE/FPU clamp mode [mode=%d]", clampMode);
|
||||
config.Cpu.Recompiler.fpuOverflow = (clampMode >= 1);
|
||||
config.Cpu.Recompiler.fpuExtraOverflow = (clampMode >= 2);
|
||||
config.Cpu.Recompiler.fpuFullMode = (clampMode >= 3);
|
||||
}
|
||||
else
|
||||
Console.Warning("[GameDB] Skipping changing EE/FPU clamp mode [mode=%d]", clampMode);
|
||||
Console.Warning("GameDB: Skipping changing EE/FPU clamp mode [mode=%d]", clampMode);
|
||||
}
|
||||
|
||||
if (vu0ClampMode != GameDatabaseSchema::ClampMode::Undefined)
|
||||
@@ -515,13 +515,13 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
const int clampMode = enum_cast(vu0ClampMode);
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing VU0 clamp mode [mode=%d]", clampMode);
|
||||
Console.WriteLn("GameDB: Changing VU0 clamp mode [mode=%d]", clampMode);
|
||||
config.Cpu.Recompiler.vu0Overflow = (clampMode >= 1);
|
||||
config.Cpu.Recompiler.vu0ExtraOverflow = (clampMode >= 2);
|
||||
config.Cpu.Recompiler.vu0SignOverflow = (clampMode >= 3);
|
||||
}
|
||||
else
|
||||
Console.Warning("[GameDB] Skipping changing VU0 clamp mode [mode=%d]", clampMode);
|
||||
Console.Warning("GameDB: Skipping changing VU0 clamp mode [mode=%d]", clampMode);
|
||||
}
|
||||
|
||||
if (vu1ClampMode != GameDatabaseSchema::ClampMode::Undefined)
|
||||
@@ -529,13 +529,13 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
const int clampMode = enum_cast(vu1ClampMode);
|
||||
if (applyAuto)
|
||||
{
|
||||
Console.WriteLn("(GameDB) Changing VU1 clamp mode [mode=%d]", clampMode);
|
||||
Console.WriteLn("GameDB: Changing VU1 clamp mode [mode=%d]", clampMode);
|
||||
config.Cpu.Recompiler.vu1Overflow = (clampMode >= 1);
|
||||
config.Cpu.Recompiler.vu1ExtraOverflow = (clampMode >= 2);
|
||||
config.Cpu.Recompiler.vu1SignOverflow = (clampMode >= 3);
|
||||
}
|
||||
else
|
||||
Console.Warning("[GameDB] Skipping changing VU1 clamp mode [mode=%d]", clampMode);
|
||||
Console.Warning("GameDB: Skipping changing VU1 clamp mode [mode=%d]", clampMode);
|
||||
}
|
||||
|
||||
// TODO - config - this could be simplified with maps instead of bitfields and enums
|
||||
@@ -543,14 +543,14 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
{
|
||||
if (!applyAuto)
|
||||
{
|
||||
Console.Warning("[GameDB] Skipping setting Speedhack '%s' to [mode=%d]",
|
||||
Console.Warning("GameDB: Skipping setting Speedhack '%s' to [mode=%d]",
|
||||
Pcsx2Config::SpeedhackOptions::GetSpeedHackName(it.first), it.second);
|
||||
continue;
|
||||
}
|
||||
// Legacy note - speedhacks are setup in the GameDB as integer values, but
|
||||
// are effectively booleans like the gamefixes
|
||||
config.Speedhacks.Set(it.first, it.second);
|
||||
Console.WriteLn("(GameDB) Setting Speedhack '%s' to [mode=%d]",
|
||||
Console.WriteLn("GameDB: Setting Speedhack '%s' to [mode=%d]",
|
||||
Pcsx2Config::SpeedhackOptions::GetSpeedHackName(it.first), it.second);
|
||||
}
|
||||
|
||||
@@ -559,12 +559,12 @@ void GameDatabaseSchema::GameEntry::applyGameFixes(Pcsx2Config& config, bool app
|
||||
{
|
||||
if (!applyAuto)
|
||||
{
|
||||
Console.Warning("[GameDB] Skipping Gamefix: %s", Pcsx2Config::GamefixOptions::GetGameFixName(id));
|
||||
Console.Warning("GameDB: Skipping Gamefix: %s", Pcsx2Config::GamefixOptions::GetGameFixName(id));
|
||||
continue;
|
||||
}
|
||||
// if the fix is present, it is said to be enabled
|
||||
config.Gamefixes.Set(id, true);
|
||||
Console.WriteLn("(GameDB) Enabled Gamefix: %s", Pcsx2Config::GamefixOptions::GetGameFixName(id));
|
||||
Console.WriteLn("GameDB: Enabled Gamefix: %s", Pcsx2Config::GamefixOptions::GetGameFixName(id));
|
||||
|
||||
// The LUT is only used for 1 game so we allocate it only when the gamefix is enabled (save 4MB)
|
||||
if (id == Fix_GoemonTlbMiss && true)
|
||||
@@ -694,7 +694,7 @@ void GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
|
||||
const bool apply_auto_fixes = !config.ManualUserHacks;
|
||||
const bool is_sw_renderer = EmuConfig.GS.Renderer == GSRendererType::SW;
|
||||
if (!apply_auto_fixes)
|
||||
Console.Warning("[GameDB] Manual GS hardware renderer fixes are enabled, not using automatic hardware renderer fixes from GameDB.");
|
||||
Console.Warning("GameDB: Manual GS hardware renderer fixes are enabled, not using automatic hardware renderer fixes from GameDB.");
|
||||
|
||||
for (const auto& [id, value] : gsHWFixes)
|
||||
{
|
||||
@@ -703,7 +703,7 @@ void GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
|
||||
if (configMatchesHWFix(config, id, value))
|
||||
continue;
|
||||
|
||||
Console.Warning("[GameDB] Skipping GS Hardware Fix: %s to [mode=%d]", getHWFixName(id), value);
|
||||
Console.Warning("GameDB: Skipping GS Hardware Fix: %s to [mode=%d]", getHWFixName(id), value);
|
||||
fmt::format_to(std::back_inserter(disabled_fixes), "{} {} = {}", disabled_fixes.empty() ? " " : "\n ", getHWFixName(id), value);
|
||||
continue;
|
||||
}
|
||||
@@ -790,7 +790,7 @@ void GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
|
||||
if (config.TriFilter == TriFiltering::Automatic)
|
||||
config.TriFilter = static_cast<TriFiltering>(value);
|
||||
else if (config.TriFilter > TriFiltering::Off)
|
||||
Console.Warning("[GameDB] Game requires trilinear filtering to be disabled.");
|
||||
Console.Warning("GameDB: Game requires trilinear filtering to be disabled.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -832,7 +832,7 @@ void GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
|
||||
if (config.InterlaceMode == GSInterlaceMode::Automatic)
|
||||
config.InterlaceMode = static_cast<GSInterlaceMode>(value);
|
||||
else
|
||||
Console.Warning("[GameDB] Game requires different deinterlace mode but it has been overridden by user setting.");
|
||||
Console.Warning("GameDB: Game requires different deinterlace mode but it has been overridden by user setting.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -919,7 +919,7 @@ void GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLn("[GameDB] Enabled GS Hardware Fix: %s to [mode=%d]", getHWFixName(id), value);
|
||||
Console.WriteLn("GameDB: Enabled GS Hardware Fix: %s to [mode=%d]", getHWFixName(id), value);
|
||||
}
|
||||
|
||||
// fixup skipdraw range just in case the db has a bad range (but the linter should catch this)
|
||||
@@ -954,7 +954,7 @@ void GameDatabase::initDatabase()
|
||||
auto buf = FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, GAMEDB_YAML_FILE_NAME).c_str());
|
||||
if (!buf.has_value())
|
||||
{
|
||||
Console.Error("[GameDB] Unable to open GameDB file, file does not exist.");
|
||||
Console.Error("GameDB: Unable to open GameDB file, file does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -971,7 +971,7 @@ void GameDatabase::initDatabase()
|
||||
// However, YAML's keys are as expected case-sensitive, so we have to explicitly do our own duplicate checking
|
||||
if (s_game_db.count(serial) == 1)
|
||||
{
|
||||
Console.Error(fmt::format("[GameDB] Duplicate serial '{}' found in GameDB. Skipping, Serials are case-insensitive!", serial));
|
||||
Console.Error(fmt::format("GameDB: Duplicate serial '{}' found in GameDB. Skipping, Serials are case-insensitive!", serial));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -988,9 +988,9 @@ void GameDatabase::ensureLoaded()
|
||||
{
|
||||
std::call_once(s_load_once_flag, []() {
|
||||
Common::Timer timer;
|
||||
Console.WriteLn(fmt::format("[GameDB] Has not been initialized yet, initializing..."));
|
||||
Console.WriteLn(fmt::format("GameDB: Has not been initialized yet, initializing..."));
|
||||
initDatabase();
|
||||
Console.WriteLn("[GameDB] %zu games on record (loaded in %.2fms)", s_game_db.size(), timer.GetTimeMilliseconds());
|
||||
Console.WriteLn("GameDB: %zu games on record (loaded in %.2fms)", s_game_db.size(), timer.GetTimeMilliseconds());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,7 @@ bool GameDatabase::loadHashDatabase()
|
||||
auto buf = FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, HASHDB_YAML_FILE_NAME).c_str());
|
||||
if (!buf.has_value())
|
||||
{
|
||||
Console.Error("[GameDB] Unable to open hash database file, file does not exist.");
|
||||
Console.Error("GameDB: Unable to open hash database file, file does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -540,14 +540,14 @@ bool SDLInputSource::ProcessSDLEvent(const SDL_Event* event)
|
||||
{
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
{
|
||||
Console.WriteLn("(SDLInputSource) Controller %d inserted", event->cdevice.which);
|
||||
Console.WriteLn("SDLInputSource: Controller %d inserted", event->cdevice.which);
|
||||
OpenDevice(event->cdevice.which, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
{
|
||||
Console.WriteLn("(SDLInputSource) Controller %d removed", event->cdevice.which);
|
||||
Console.WriteLn("SDLInputSource: Controller %d removed", event->cdevice.which);
|
||||
CloseDevice(event->cdevice.which);
|
||||
return true;
|
||||
}
|
||||
@@ -558,7 +558,7 @@ bool SDLInputSource::ProcessSDLEvent(const SDL_Event* event)
|
||||
if (SDL_IsGameController(event->jdevice.which))
|
||||
return false;
|
||||
|
||||
Console.WriteLn("(SDLInputSource) Joystick %d inserted", event->jdevice.which);
|
||||
Console.WriteLn("SDLInputSource: Joystick %d inserted", event->jdevice.which);
|
||||
OpenDevice(event->cdevice.which, false);
|
||||
return true;
|
||||
}
|
||||
@@ -569,7 +569,7 @@ bool SDLInputSource::ProcessSDLEvent(const SDL_Event* event)
|
||||
if (auto it = GetControllerDataForJoystickId(event->cdevice.which); it != m_controllers.end() && it->game_controller)
|
||||
return false;
|
||||
|
||||
Console.WriteLn("(SDLInputSource) Joystick %d removed", event->jdevice.which);
|
||||
Console.WriteLn("SDLInputSource: Joystick %d removed", event->jdevice.which);
|
||||
CloseDevice(event->cdevice.which);
|
||||
return true;
|
||||
}
|
||||
@@ -657,7 +657,7 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
|
||||
if (!gcontroller && !joystick)
|
||||
{
|
||||
ERROR_LOG("(SDLInputSource) Failed to open controller {}", index);
|
||||
ERROR_LOG("SDLInputSource: Failed to open controller {}", index);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
{
|
||||
if (it->joystick_id == joystick_id)
|
||||
{
|
||||
ERROR_LOG("(SDLInputSource) Controller {}, instance {}, player {} already connected, ignoring.", index, joystick_id, player_id);
|
||||
ERROR_LOG("SDLInputSource: Controller {}, instance {}, player {} already connected, ignoring.", index, joystick_id, player_id);
|
||||
if (gcontroller)
|
||||
SDL_GameControllerClose(gcontroller);
|
||||
else
|
||||
@@ -680,7 +680,7 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
if (player_id < 0 || GetControllerDataForPlayerId(player_id) != m_controllers.end())
|
||||
{
|
||||
const int free_player_id = GetFreePlayerId();
|
||||
WARNING_LOG("(SDLInputSource) Controller {} (joystick {}) returned player ID {}, which is invalid or in "
|
||||
WARNING_LOG("SDLInputSource: Controller {} (joystick {}) returned player ID {}, which is invalid or in "
|
||||
"use. Using ID {} instead.",
|
||||
index, joystick_id, player_id, free_player_id);
|
||||
player_id = free_player_id;
|
||||
@@ -690,7 +690,7 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
if (!name)
|
||||
name = "Unknown Device";
|
||||
|
||||
INFO_LOG("(SDLInputSource) Opened {} {} (instance id {}, player id {}): {}", is_gamecontroller ? "game controller" : "joystick",
|
||||
INFO_LOG("SDLInputSource: Opened {} {} (instance id {}, player id {}): {}", is_gamecontroller ? "game controller" : "joystick",
|
||||
index, joystick_id, player_id, name);
|
||||
|
||||
ControllerData cd = {};
|
||||
@@ -717,7 +717,7 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
for (size_t i = 0; i < std::size(s_sdl_button_names); i++)
|
||||
mark_bind(SDL_GameControllerGetBindForButton(gcontroller, static_cast<SDL_GameControllerButton>(i)));
|
||||
|
||||
INFO_LOG("(SDLInputSource) Controller {} has {} axes and {} buttons", player_id, num_axes, num_buttons);
|
||||
INFO_LOG("SDLInputSource: Controller {} has {} axes and {} buttons", player_id, num_axes, num_buttons);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -726,14 +726,14 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
if (num_hats > 0)
|
||||
cd.last_hat_state.resize(static_cast<size_t>(num_hats), u8(0));
|
||||
|
||||
INFO_LOG("(SDLInputSource) Joystick {} has {} axes, {} buttons and {} hats", player_id,
|
||||
INFO_LOG("SDLInputSource: Joystick {} has {} axes, {} buttons and {} hats", player_id,
|
||||
SDL_JoystickNumAxes(joystick), SDL_JoystickNumButtons(joystick), num_hats);
|
||||
}
|
||||
|
||||
cd.use_game_controller_rumble = (gcontroller && SDL_GameControllerRumble(gcontroller, 0, 0, 0) == 0);
|
||||
if (cd.use_game_controller_rumble)
|
||||
{
|
||||
INFO_LOG("(SDLInputSource) Rumble is supported on '{}' via gamecontroller", name);
|
||||
INFO_LOG("SDLInputSource: Rumble is supported on '{}' via gamecontroller", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -752,25 +752,25 @@ bool SDLInputSource::OpenDevice(int index, bool is_gamecontroller)
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG("(SDLInputSource) Failed to create haptic left/right effect: {}", SDL_GetError());
|
||||
ERROR_LOG("SDLInputSource: Failed to create haptic left/right effect: {}", SDL_GetError());
|
||||
if (SDL_HapticRumbleSupported(haptic) && SDL_HapticRumbleInit(haptic) != 0)
|
||||
{
|
||||
cd.haptic = haptic;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG("(SDLInputSource) No haptic rumble supported: {}", SDL_GetError());
|
||||
ERROR_LOG("SDLInputSource: No haptic rumble supported: {}", SDL_GetError());
|
||||
SDL_HapticClose(haptic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cd.haptic)
|
||||
INFO_LOG("(SDLInputSource) Rumble is supported on '{}' via haptic", name);
|
||||
INFO_LOG("SDLInputSource: Rumble is supported on '{}' via haptic", name);
|
||||
}
|
||||
|
||||
if (!cd.haptic && !cd.use_game_controller_rumble)
|
||||
WARNING_LOG("(SDLInputSource) Rumble is not supported on '{}'", name);
|
||||
WARNING_LOG("SDLInputSource: Rumble is not supported on '{}'", name);
|
||||
|
||||
if (player_id >= 0 && static_cast<u32>(player_id) < MAX_LED_COLORS && gcontroller && SDL_GameControllerHasLED(gcontroller))
|
||||
{
|
||||
|
||||
@@ -852,8 +852,16 @@ namespace R3000A
|
||||
|
||||
v0 = file->read(buf.get(), count);
|
||||
|
||||
for (s32 i = 0; i < (s32)v0; i++)
|
||||
iopMemWrite8(data + i, buf[i]);
|
||||
[[likely]]
|
||||
if (v0 >= 0 && iopMemSafeWriteBytes(data, buf.get(), v0))
|
||||
{
|
||||
psxCpu->Clear(data, (v0 + 3) / 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (s32 i = 0; i < static_cast<s32>(v0); i++)
|
||||
iopMemWrite8(data + i, buf[i]);
|
||||
}
|
||||
|
||||
pc = ra;
|
||||
return 1;
|
||||
@@ -899,8 +907,12 @@ namespace R3000A
|
||||
{
|
||||
auto buf = std::make_unique<char[]>(count);
|
||||
|
||||
for (u32 i = 0; i < count; i++)
|
||||
buf[i] = iopMemRead8(data + i);
|
||||
[[unlikely]]
|
||||
if (!iopMemSafeReadBytes(data, buf.get(), count))
|
||||
{
|
||||
for (u32 i = 0; i < count; i++)
|
||||
buf[i] = iopMemRead8(data + i);
|
||||
}
|
||||
|
||||
v0 = file->write(buf.get(), count);
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Patch
|
||||
static bool PatchStringHasUnlabelledPatch(const std::string& pnach_data);
|
||||
static void ExtractPatchInfo(PatchInfoList* dst, const std::string& pnach_data, u32* num_unlabelled_patches);
|
||||
static void ReloadEnabledLists();
|
||||
static u32 EnablePatches(const PatchList& patches, const EnablePatchList& enable_list);
|
||||
static u32 EnablePatches(const PatchList& patches, const EnablePatchList& enable_list, const EnablePatchList& enable_immediately_list);
|
||||
|
||||
static void ApplyPatch(const PatchCommand* p);
|
||||
static void ApplyDynaPatch(const DynamicPatch& patch, u32 address);
|
||||
@@ -171,6 +171,7 @@ namespace Patch
|
||||
const char* PATCHES_CONFIG_SECTION = "Patches";
|
||||
const char* CHEATS_CONFIG_SECTION = "Cheats";
|
||||
const char* PATCH_ENABLE_CONFIG_KEY = "Enable";
|
||||
const char* PATCH_DISABLE_CONFIG_KEY = "Disable";
|
||||
|
||||
static zip_t* s_patches_zip;
|
||||
static PatchList s_gamedb_patches;
|
||||
@@ -182,6 +183,8 @@ namespace Patch
|
||||
static std::vector<DynamicPatch> s_active_pnach_dynamic_patches;
|
||||
static EnablePatchList s_enabled_cheats;
|
||||
static EnablePatchList s_enabled_patches;
|
||||
static EnablePatchList s_just_enabled_cheats;
|
||||
static EnablePatchList s_just_enabled_patches;
|
||||
static u32 s_patches_crc;
|
||||
static std::optional<AspectRatioType> s_override_aspect_ratio;
|
||||
static std::optional<GSInterlaceMode> s_override_interlace_mode;
|
||||
@@ -582,12 +585,14 @@ std::string Patch::GetPnachFilename(const std::string_view serial, u32 crc, bool
|
||||
|
||||
void Patch::ReloadEnabledLists()
|
||||
{
|
||||
const EnablePatchList prev_enabled_cheats = std::move(s_enabled_cheats);
|
||||
if (EmuConfig.EnableCheats && !Achievements::IsHardcoreModeActive())
|
||||
s_enabled_cheats = Host::GetStringListSetting(CHEATS_CONFIG_SECTION, PATCH_ENABLE_CONFIG_KEY);
|
||||
else
|
||||
s_enabled_cheats = {};
|
||||
|
||||
s_enabled_patches = Host::GetStringListSetting(PATCHES_CONFIG_SECTION, PATCH_ENABLE_CONFIG_KEY);
|
||||
const EnablePatchList prev_enabled_patches = std::exchange(s_enabled_patches, Host::GetStringListSetting(PATCHES_CONFIG_SECTION, PATCH_ENABLE_CONFIG_KEY));
|
||||
const EnablePatchList disabled_patches = Host::GetStringListSetting(PATCHES_CONFIG_SECTION, PATCH_DISABLE_CONFIG_KEY);
|
||||
|
||||
// Name based matching for widescreen/NI settings.
|
||||
if (EmuConfig.EnableWideScreenPatches)
|
||||
@@ -606,10 +611,41 @@ void Patch::ReloadEnabledLists()
|
||||
s_enabled_patches.emplace_back(NI_PATCH_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = s_enabled_patches.begin(); it != s_enabled_patches.end();)
|
||||
{
|
||||
if (std::find(disabled_patches.begin(), disabled_patches.end(), *it) != disabled_patches.end())
|
||||
{
|
||||
it = s_enabled_patches.erase(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
s_just_enabled_cheats.clear();
|
||||
s_just_enabled_patches.clear();
|
||||
for (const auto& p : s_enabled_cheats)
|
||||
{
|
||||
if (std::find(prev_enabled_cheats.begin(), prev_enabled_cheats.end(), p) == prev_enabled_cheats.end())
|
||||
{
|
||||
s_just_enabled_cheats.emplace_back(p);
|
||||
}
|
||||
}
|
||||
for (const auto& p : s_enabled_patches)
|
||||
{
|
||||
if (std::find(prev_enabled_patches.begin(), prev_enabled_patches.end(), p) == prev_enabled_patches.end())
|
||||
{
|
||||
s_just_enabled_patches.emplace_back(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 Patch::EnablePatches(const PatchList& patches, const EnablePatchList& enable_list)
|
||||
u32 Patch::EnablePatches(const PatchList& patches, const EnablePatchList& enable_list, const EnablePatchList& enable_immediately_list)
|
||||
{
|
||||
ActivePatchList patches_to_apply_immediately;
|
||||
|
||||
u32 count = 0;
|
||||
for (const PatchGroup& p : patches)
|
||||
{
|
||||
@@ -621,6 +657,7 @@ u32 Patch::EnablePatches(const PatchList& patches, const EnablePatchList& enable
|
||||
Console.WriteLn(Color_Green, fmt::format("Enabled patch: {}",
|
||||
p.name.empty() ? std::string_view("<unknown>") : std::string_view(p.name)));
|
||||
|
||||
const bool apply_immediately = std::find(enable_immediately_list.begin(), enable_immediately_list.end(), p.name) != enable_immediately_list.end();
|
||||
for (const PatchCommand& ip : p.patches)
|
||||
{
|
||||
// print the actual patch lines only in verbose mode (even in devel)
|
||||
@@ -628,6 +665,8 @@ u32 Patch::EnablePatches(const PatchList& patches, const EnablePatchList& enable
|
||||
DevCon.WriteLnFmt(" {}", ip.ToString());
|
||||
|
||||
s_active_patches.push_back(&ip);
|
||||
if (apply_immediately && ip.placetopatch == PPT_ONCE_ON_LOAD)
|
||||
patches_to_apply_immediately.push_back(&ip);
|
||||
}
|
||||
|
||||
for (const DynamicPatch& dp : p.dpatches)
|
||||
@@ -644,6 +683,16 @@ u32 Patch::EnablePatches(const PatchList& patches, const EnablePatchList& enable
|
||||
count += p.name.empty() ? (static_cast<u32>(p.patches.size()) + static_cast<u32>(p.dpatches.size())) : 1;
|
||||
}
|
||||
|
||||
if (!patches_to_apply_immediately.empty())
|
||||
{
|
||||
Host::RunOnCPUThread([patches = std::move(patches_to_apply_immediately)]() {
|
||||
for (const PatchCommand* i : patches)
|
||||
{
|
||||
ApplyPatch(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -688,10 +737,10 @@ void Patch::ReloadPatches(const std::string& serial, u32 crc, bool reload_files,
|
||||
});
|
||||
}
|
||||
|
||||
UpdateActivePatches(reload_enabled_list, verbose, verbose_if_changed);
|
||||
UpdateActivePatches(reload_enabled_list, verbose, verbose_if_changed, false);
|
||||
}
|
||||
|
||||
void Patch::UpdateActivePatches(bool reload_enabled_list, bool verbose, bool verbose_if_changed)
|
||||
void Patch::UpdateActivePatches(bool reload_enabled_list, bool verbose, bool verbose_if_changed, bool apply_new_patches)
|
||||
{
|
||||
if (reload_enabled_list)
|
||||
ReloadEnabledLists();
|
||||
@@ -706,19 +755,19 @@ void Patch::UpdateActivePatches(bool reload_enabled_list, bool verbose, bool ver
|
||||
u32 gp_count = 0;
|
||||
if (EmuConfig.EnablePatches)
|
||||
{
|
||||
gp_count = EnablePatches(s_gamedb_patches, EnablePatchList());
|
||||
gp_count = EnablePatches(s_gamedb_patches, EnablePatchList(), EnablePatchList());
|
||||
if (gp_count > 0)
|
||||
message.append(TRANSLATE_PLURAL_STR("Patch", "%n GameDB patches are active.", "OSD Message", gp_count));
|
||||
}
|
||||
|
||||
const u32 p_count = EnablePatches(s_game_patches, s_enabled_patches);
|
||||
const u32 p_count = EnablePatches(s_game_patches, s_enabled_patches, apply_new_patches ? s_just_enabled_patches : EnablePatchList());
|
||||
if (p_count > 0)
|
||||
{
|
||||
message.append_format("{}{}", message.empty() ? "" : "\n",
|
||||
TRANSLATE_PLURAL_STR("Patch", "%n game patches are active.", "OSD Message", p_count));
|
||||
}
|
||||
|
||||
const u32 c_count = EmuConfig.EnableCheats ? EnablePatches(s_cheat_patches, s_enabled_cheats) : 0;
|
||||
const u32 c_count = EmuConfig.EnableCheats ? EnablePatches(s_cheat_patches, s_enabled_cheats, apply_new_patches ? s_just_enabled_cheats : EnablePatchList()) : 0;
|
||||
if (c_count > 0)
|
||||
{
|
||||
message.append_format("{}{}", message.empty() ? "" : "\n",
|
||||
@@ -1027,6 +1076,11 @@ void Patch::ApplyLoadedPatches(patch_place_type place)
|
||||
}
|
||||
}
|
||||
|
||||
bool Patch::IsGloballyToggleablePatch(const PatchInfo& patch_info)
|
||||
{
|
||||
return patch_info.name == WS_PATCH_NAME || patch_info.name == NI_PATCH_NAME;
|
||||
}
|
||||
|
||||
void Patch::ApplyDynamicPatches(u32 pc)
|
||||
{
|
||||
for (const auto& dynpatch : s_active_pnach_dynamic_patches)
|
||||
|
||||
@@ -4,18 +4,16 @@
|
||||
#pragma once
|
||||
|
||||
// Note about terminology:
|
||||
// "patch" in pcsx2 terminology is a single pnach style patch line, e.g. patch=1,EE,001110e0,word,00000000
|
||||
// "Patch" in PCSX2 terminology refers to a single pnach style patch line, e.g. `patch=1,EE,001110e0,word,00000000`
|
||||
// Such patches can appear in several places:
|
||||
// - At <CRC>.pnach files where each file could have several such patches:
|
||||
// - At the "cheats" folder
|
||||
// - UI name: "Cheats", controlled via system -> enable cheats
|
||||
// - At the "cheats_ws" folder or inside "cheats_ws.zip" (the zip also called "widescreen cheats DB")
|
||||
// - the latter is searched if the former is not found for a CRC
|
||||
// - UI name: "Widescreen hacks/patches", controlled via system -> enable widescreen patches
|
||||
// - At GameIndex.yaml inside a [patches] section
|
||||
// - UI name: "Patches", controlled via system -> enable automatic game fixes
|
||||
// - note that automatic game fixes also controls automatic config changes from GameIndex.dbf (UI name: "fixes")
|
||||
//
|
||||
// - At the "patches" folder or on the "patches.zip file inside the 'resources' folder
|
||||
// - UI name: "Patch", Controlled via Per-Game Settings -> Patches
|
||||
// - At the "cheats" folder
|
||||
// - UI name: "Cheats", Controlled via Per-Game Settings -> Cheats -> Enable Cheat
|
||||
// - At GameIndex.yaml inside a [patches] section
|
||||
// - UI name: "Enable Compatibility Patches", controlled via Advanced section -> Enable compatability settings
|
||||
// Note: The file name has to be exactly "<Serial>_<CRC>.pnach" (For example "SLPS-25399_CD62245A.pnach")
|
||||
// Note #2: the old sytle of cheats are also supported but arent supported by the UI
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
@@ -80,6 +78,7 @@ namespace Patch
|
||||
extern const char* PATCHES_CONFIG_SECTION;
|
||||
extern const char* CHEATS_CONFIG_SECTION;
|
||||
extern const char* PATCH_ENABLE_CONFIG_KEY;
|
||||
extern const char* PATCH_DISABLE_CONFIG_KEY;
|
||||
|
||||
extern PatchInfoList GetPatchInfo(const std::string_view serial, u32 crc, bool cheats, bool showAllCRCS, u32* num_unlabelled_patches);
|
||||
|
||||
@@ -89,7 +88,7 @@ namespace Patch
|
||||
/// Reloads cheats/patches. If verbose is set, the number of patches loaded will be shown in the OSD.
|
||||
extern void ReloadPatches(const std::string& serial, u32 crc, bool reload_files, bool reload_enabled_list, bool verbose, bool verbose_if_changed);
|
||||
|
||||
extern void UpdateActivePatches(bool reload_enabled_list, bool verbose, bool verbose_if_changed);
|
||||
extern void UpdateActivePatches(bool reload_enabled_list, bool verbose, bool verbose_if_changed, bool apply_new_patches);
|
||||
extern void ApplyPatchSettingOverrides();
|
||||
extern bool ReloadPatchAffectingOptions();
|
||||
extern void UnloadPatches();
|
||||
@@ -105,4 +104,6 @@ namespace Patch
|
||||
// and then it loads only the ones which are enabled according to the current config
|
||||
// (this happens at AppCoreThread::ApplySettings(...) )
|
||||
extern void ApplyLoadedPatches(patch_place_type place);
|
||||
|
||||
extern bool IsGloballyToggleablePatch(const PatchInfo& patch_info);
|
||||
} // namespace Patch
|
||||
@@ -237,7 +237,7 @@ static void doBranch(s32 tar) {
|
||||
// This detects when SYSMEM is called and clears the modules then
|
||||
if(tar == 0x890)
|
||||
{
|
||||
DevCon.WriteLn(Color_Gray, "[R3000 Debugger] Branch to 0x890 (SYSMEM). Clearing modules.");
|
||||
DevCon.WriteLn(Color_Gray, "R3000 Debugger: Branch to 0x890 (SYSMEM). Clearing modules.");
|
||||
R3000SymbolGuardian.ClearIrxModules();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ u32 EEoCycle;
|
||||
|
||||
alignas(16) cpuRegistersPack _cpuRegistersPack;
|
||||
alignas(16) tlbs tlb[48];
|
||||
cachedTlbs_t cachedTlbs;
|
||||
|
||||
R5900cpu *Cpu = NULL;
|
||||
|
||||
static constexpr uint eeWaitCycles = 3072;
|
||||
@@ -59,6 +61,7 @@ void cpuReset()
|
||||
std::memset(&cpuRegs, 0, sizeof(cpuRegs));
|
||||
std::memset(&fpuRegs, 0, sizeof(fpuRegs));
|
||||
std::memset(&tlb, 0, sizeof(tlb));
|
||||
cachedTlbs.count = 0;
|
||||
|
||||
cpuRegs.pc = 0xbfc00000; //set pc reg to stack
|
||||
cpuRegs.CP0.n.Config = 0x440;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "common/Pcsx2Defs.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// EE Bios function name tables.
|
||||
// --------------------------------------------------------------------------------------
|
||||
@@ -160,17 +162,68 @@ struct fpuRegisters {
|
||||
u32 ACCflag; // an internal accumulator overflow flag
|
||||
};
|
||||
|
||||
union PageMask_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 : 13;
|
||||
u32 Mask : 12;
|
||||
u32 : 7;
|
||||
};
|
||||
u32 UL;
|
||||
};
|
||||
|
||||
union EntryHi_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 ASID:8;
|
||||
u32 : 5;
|
||||
u32 VPN2:19;
|
||||
};
|
||||
u32 UL;
|
||||
};
|
||||
|
||||
union EntryLo_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 G:1;
|
||||
u32 V:1;
|
||||
u32 D:1;
|
||||
u32 C:3;
|
||||
u32 PFN:20;
|
||||
u32 : 5;
|
||||
u32 S : 1; // Only used in EntryLo0
|
||||
};
|
||||
u32 UL;
|
||||
|
||||
constexpr bool isCached() const { return C == 0x3; }
|
||||
constexpr bool isValidCacheMode() const { return C == 0x2 || C == 0x3 || C == 0x7; }
|
||||
};
|
||||
|
||||
struct tlbs
|
||||
{
|
||||
u32 PageMask,EntryHi;
|
||||
u32 EntryLo0,EntryLo1;
|
||||
u32 Mask, nMask;
|
||||
u32 G;
|
||||
u32 ASID;
|
||||
u32 VPN2;
|
||||
u32 PFN0;
|
||||
u32 PFN1;
|
||||
u32 S;
|
||||
PageMask_t PageMask;
|
||||
EntryHi_t EntryHi;
|
||||
EntryLo_t EntryLo0;
|
||||
EntryLo_t EntryLo1;
|
||||
|
||||
// (((cpuRegs.CP0.n.EntryLo0 >> 6) & 0xFFFFF) & (~tlb[i].Mask())) << 12;
|
||||
constexpr u32 PFN0() const { return (EntryLo0.PFN & ~Mask()) << 12; }
|
||||
constexpr u32 PFN1() const { return (EntryLo1.PFN & ~Mask()) << 12; }
|
||||
constexpr u32 VPN2() const {return ((EntryHi.VPN2) & (~Mask())) << 13; }
|
||||
constexpr u32 Mask() const { return PageMask.Mask; }
|
||||
constexpr bool isGlobal() const { return EntryLo0.G && EntryLo1.G; }
|
||||
constexpr bool isSPR() const { return EntryLo0.S; }
|
||||
|
||||
constexpr bool operator==(const tlbs& other) const
|
||||
{
|
||||
return PageMask.UL == other.PageMask.UL &&
|
||||
EntryHi.UL == other.EntryHi.UL &&
|
||||
EntryLo0.UL == other.EntryLo0.UL &&
|
||||
EntryLo1.UL == other.EntryLo1.UL;
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef _PC_
|
||||
@@ -211,6 +264,19 @@ struct cpuRegistersPack
|
||||
alignas(16) extern cpuRegistersPack _cpuRegistersPack;
|
||||
alignas(16) extern tlbs tlb[48];
|
||||
|
||||
struct cachedTlbs_t
|
||||
{
|
||||
u32 count;
|
||||
|
||||
alignas(16) std::array<u32, 48> PageMasks;
|
||||
alignas(16) std::array<u32, 48> PFN1s;
|
||||
alignas(16) std::array<u32, 48> CacheEnabled1;
|
||||
alignas(16) std::array<u32, 48> PFN0s;
|
||||
alignas(16) std::array<u32, 48> CacheEnabled0;
|
||||
};
|
||||
|
||||
extern cachedTlbs_t cachedTlbs;
|
||||
|
||||
static cpuRegisters& cpuRegs = _cpuRegistersPack.cpuRegs;
|
||||
static fpuRegisters& fpuRegs = _cpuRegistersPack.fpuRegs;
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ void FileMemoryCard::Open()
|
||||
}
|
||||
}
|
||||
|
||||
if (fname.ends_with(".bin"))
|
||||
if (fname.ends_with(".bin") || fname.ends_with(".mc2"))
|
||||
{
|
||||
std::string newname(fname + "x");
|
||||
if (!ConvertNoECCtoRAW(fname.c_str(), newname.c_str()))
|
||||
@@ -346,7 +346,7 @@ void FileMemoryCard::Close()
|
||||
std::fclose(m_file[slot]);
|
||||
m_file[slot] = nullptr;
|
||||
|
||||
if (m_filenames[slot].ends_with(".bin"))
|
||||
if (m_filenames[slot].ends_with(".bin") || m_filenames[slot].ends_with(".mc2"))
|
||||
{
|
||||
const std::string name_in(m_filenames[slot] + 'x');
|
||||
if (ConvertRAWtoNoECC(name_in.c_str(), m_filenames[slot].c_str()))
|
||||
@@ -786,13 +786,14 @@ int FileMcd_ReIndex(uint port, uint slot, const std::string& filter)
|
||||
|
||||
static MemoryCardFileType GetMemoryCardFileTypeFromSize(s64 size)
|
||||
{
|
||||
if (size == (8 * MC2_MBSIZE))
|
||||
// Handle both ecc and non ecc versions
|
||||
if (size == (8 * MC2_MBSIZE) || size == _8mb)
|
||||
return MemoryCardFileType::PS2_8MB;
|
||||
else if (size == (16 * MC2_MBSIZE))
|
||||
else if (size == (16 * MC2_MBSIZE) || size == _16mb)
|
||||
return MemoryCardFileType::PS2_16MB;
|
||||
else if (size == (32 * MC2_MBSIZE))
|
||||
else if (size == (32 * MC2_MBSIZE) || size == _32mb)
|
||||
return MemoryCardFileType::PS2_32MB;
|
||||
else if (size == (64 * MC2_MBSIZE))
|
||||
else if (size == (64 * MC2_MBSIZE) || size == _64mb)
|
||||
return MemoryCardFileType::PS2_64MB;
|
||||
else if (size == MCD_SIZE)
|
||||
return MemoryCardFileType::PS1;
|
||||
@@ -862,7 +863,8 @@ std::vector<AvailableMcdInfo> FileMcd_GetAvailableCards(bool include_in_use_card
|
||||
|
||||
// We only want relevant file types.
|
||||
if (!(fd.FileName.ends_with(".ps2") || fd.FileName.ends_with(".mcr") ||
|
||||
fd.FileName.ends_with(".mcd") || fd.FileName.ends_with(".bin")))
|
||||
fd.FileName.ends_with(".mcd") || fd.FileName.ends_with(".bin") ||
|
||||
fd.FileName.ends_with(".mc2")))
|
||||
continue;
|
||||
|
||||
if (fd.Attributes & FILESYSTEM_FILE_ATTRIBUTE_DIRECTORY)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user