Commit graph

216 commits

Author SHA1 Message Date
Megamouse
7a90d09cfe Qt: move guest memory dump code to own class 2026-07-23 10:58:18 +02:00
caner
5ecfc95c13
Qt: add guest memory dump utility (#19068)
This adds a tool that writes a snapshot of the full PS3 guest address
space to disk for offline analysis.

This tool produces a flat image that any hex editor or script can index
directly by guest address. It dumps allocated PS3 guest memory only, not
RPCS3 host-process memory, host registers, or GPU-side state.

What it does:

1. Pauses emulation and waits up to five seconds for every PPU, SPU, and
RSX thread to settle. If they do not settle, nothing is written.
2. Copies every allocated guest page into an intermediate buffer on a
named worker thread, then writes it to a sparse `guest_memory.bin` whose
file offset equals the PS3 effective address. Reads go through
`vm::g_sudo_addr` so guest protected pages are captured too.
3. Saves each live SPU thread's 256 KB local store to its own file, with
its ID, LV2 ID, PC, and type recorded.
4. Writes `manifest.json`, listing every allocated region with its
addresses and permissions, the storage mode, and the SPU local-store
table.
5. Resumes emulation.

The menu entry is under Utilities next to Memory Viewer and is enabled
while a game is loaded. Free space is checked before writing. If sparse
file setup fails, the incomplete attempt is removed and the user can
choose another destination or cancel. Failed or cancelled dumps remove
their output folder instead of leaving a partial image.

Tested on Windows using an NTFS destination with a build from this
branch: dumped a running game with 479,535,104 allocated guest bytes
across 76 regions and five SPU local stores. The image was sparse, its
offsets matched guest addresses, and emulation resumed cleanly. The
sparse file failure path was also exercised with a temporary local test:
choosing another location reopened the destination picker, while
cancelling aborted the attempt without leaving partial output. Runtime
behavior on Linux and macOS is untested.

The first draft of this implementation was AI assisted. I reviewed and
adjusted the code and tested the Windows/NTFS path myself. I am happy to
rework anything or answer any questions.
2026-07-23 00:08:05 +00:00
Antonino Di Guardo
026297334f
Some fixes (#18686)
### FIXES + MINOR IMPROVEMENTS:
- Fixed issue18685: Not a real issue. PR18648 added some logging that made
evident a missing check on the validity of the paths in `games.yml`
before trying to manage the path as a possible ISO file. That missing
check was already present but simply invisible due to missing log
- Fixed `bytes_to_hex()` function used to store file hash hex string: In
some cases the integrity check wrongly reported the check as failed
- Optimized `fs::get_optical_raw_device()` function: Moved under
`_WIN32` block a check valid only on `Windows` and simplified the logic
to detect a CDROM / BD as raw device
- Used `iso_file` objects instead of `fs:file` in `ISO.cpp`: It allows
to use proper `bool()` operator on some checks
2026-05-07 06:38:57 +03:00
Megamouse
a8dd053593 Fix some warnings 2026-04-30 20:41:35 +02:00
digant73
79d0e0eb3c reduce check for raw device 2026-04-30 10:39:10 +03:00
digant73
570b2bddca Avoid to open bd drive if no content is present 2026-04-30 10:39:10 +03:00
Antonino Di Guardo
b212935c70
Add support to play from a BD Drive (currently only on Windows) (#18648)
Follow up of #18345 to add support (currently only on `Windows`; see
notes below) for playing a PS3 disc game directly from a Blu-Ray Disc
Drive.

### HOW IT WORKS:
- The BD drive can be added as any other game so from `VFS games` or
from `Add Games` menu. In case it is selected from `VFS games`, any
attempt to write files is discarded, e.g. file `Disc Games Can Be Put
Here For Automatic Detection.txt`
- It scans the default redump keys folder `<rpcs3>/data/redump` (it
currently needs to be manually created due it is not yet provided by
rpcs3 installation) to find a matching decryption key

### NOTES:
- Support is currently provided on `Windows` where I can fully test it.
I cannot test under other OS. However, the additions needed for the
other OS are limited only on `fs::file.h/cpp`. In particular inside the
following new functions:
  - `bool is_optical_raw_device(const std::string& path);`
- `bool get_optical_raw_device(const std::string& path, std::string*
raw_device = nullptr);`
- Icons etc. are always refreshed (ISO cache cannot be used due `mtime`
on raw device is not available and any cache check would always fail)
- Code in `ISO.h/cpp` needed some rework to properly manage a read on a
raw device (alignment on offset, size and memory is mandatory). The BD
drive needs to be detected as a file, not as a folder

### MINOR FIXES:
- Fixed wrong specifier used in logging on `ISO.h/cpp`
2026-04-29 05:42:49 +03:00
Elad
bd95c728f0 sys_fs: Implement ENOTDIR 2026-03-31 21:56:30 +02:00
Elad
35ccd63dbc Win32/File.cpp: Fix fs::file constraints to avoid crashes 2026-02-28 10:58:25 +02:00
Megamouse
ff992a67c8 win/fs: check file handle with GetFileInformationByHandle when creating fs::file
On empty mounted drives CreateFileW may return a valid handle even if the drive is not usable.
We have to check the file handle early. Otherwise other functions may fail later as a result.
2026-02-20 11:25:39 +02:00
digant73
9fb7c8f52c Add multi-selection context menu
fix compile errors on Mac and provide reviewed changes

fix wrong resolved conflict

removed duplicate

cleanup after latest merged PRs

minor cleanup

rename and move get_existing_dir() to File.cpp

apply reviewed changes
2026-01-06 09:47:15 +01:00
Megamouse
9897a80216 CMake: fix gcc build 2025-04-30 10:08:16 +02:00
DH
d766baef12 fs::file: implement release_handle
cleanup
2025-03-10 21:09:27 +01:00
DH
95d0cb18e4 Coding style issues fixes
Thanks @Megamouse
2025-03-10 21:09:27 +01:00
DH
f3d988d8ab fs::file: add from_native_handle constructor
fs::get_*_dir tweaks for android
2025-03-10 21:09:27 +01:00
RipleyTom
cd87a64621 Headers cleanup 2025-02-11 20:38:35 +01:00
Megamouse
a7edfa221e windows: move logs to log dir 2025-01-16 21:33:33 +01:00
Megamouse
451e953d26 windows: move config.yml and games.yml to /config/ 2025-01-16 21:33:33 +01:00
Megamouse
1966171838 Use string_view in rXml 2025-01-14 21:35:57 +01:00
Elad
2b9f076024 fs: Minor fix of fs::dir::open
Did not close previous handle on fs::dir::open like on fs::file
2024-11-28 05:47:40 +02:00
oltolm
2b0f786b2d
Fix std::basic_string warnings (#16261) 2024-11-11 21:54:44 +02:00
Megamouse
2262ac1684 Qt: Replace QMap with std::map
This should reduce the amount of string conversions during list refreshes
2024-11-06 09:34:32 +01:00
Elad
b053b1e200 Another attempt to fix fs::pending_file for hardlinks 2024-11-02 21:43:35 +02:00
Elad
d3c0ec5651 Print last system error on fs::error::unknown 2024-11-02 21:43:35 +02:00
Elad
4206b022b6 Win32/File.cpp: Use ReplaceFile for hardlink overwrite 2024-11-01 07:37:57 +02:00
elad335
8b8396b945 Filesystem/Win32: Recreate hardlinks on fs::pending_file 2024-10-29 19:26:33 +02:00
Elad Ashkenazi
a2dcbb9c13 Replace src_loc with std::soource_location 2024-05-21 14:19:12 +03:00
Elad Ashkenazi
91a54c11eb Savestates: Fixup file write 2024-05-05 06:57:11 +03:00
Eladash
88ba3c47c2 ELF.h: Avoid using seek operations 2024-02-16 10:42:57 +02:00
Megamouse
0d1fbfb755 VFS: Fix some potential .back() segfaults 2024-01-25 17:03:58 +01:00
Steveice10
3ef48cbdd5 rpcs3qt: Add macOS support to the updater. 2024-01-24 09:44:56 +01:00
Megamouse
50fcec63e0 fs: fix get_executable_dir 2024-01-21 00:11:16 +01:00
Megamouse
8edd7d54cf fs: fix warning. fix size argument in report_fatal_error 2024-01-20 21:59:02 +01:00
Steveice10
9c354ee269
Utilities: Add support for portable user directory. (#15064) 2024-01-20 10:04:25 +02:00
Megamouse
3d974eed03 fs: move buf from stack to heap to silence VS warning 2024-01-14 06:40:35 +01:00
Megamouse
329b58c8cd fs: remove duplicate to_utf8 function 2024-01-14 06:40:35 +01:00
Megamouse
59c58aa3cf fix some warnings 2023-12-30 19:07:35 +01:00
Eladash
f60bdbaece Savestates: Compressed state files 2023-11-27 12:36:17 +02:00
Eladash
66d01b688c Savestates: Implement initial RAM ventilation system 2023-11-10 08:45:49 +02:00
Megamouse
6bc7d7c698 fs::utime: fallback to 01/01/1980 00:00:00 if the date is too low 2023-09-04 10:07:23 +03:00
Eladash
66b6bae596 Win32/File.cpp: Avoid potential race in concurrent writes
Uninitialized data is better than overwritten data. Affects SPU Cache (unprotected writes).
2023-09-02 12:31:11 +03:00
oltolm
bc40b61ef1 rename fs::stat to fs::get_stat 2023-07-25 12:15:08 +03:00
Eladash
9291e2777d File.h: Implement fs::error::xdev 2023-07-21 12:27:35 +03:00
Eladash
eecadab387 Implement fs::file::get_id()
File descripor ID with 2 provided ways to compare between them:
1. is_mirror_of():
 Test if identical:
  For example: when LHS writes one byte to a file at X offset, RHS file be able to read that exact byte at X offset)

2. is_coherent_with():
 Test if both files point to the same file:
  For example: if a file descriptor pointing to the complete file exists and is being truncated to 0 bytes from non-
  -zero size state: this has to affect both RHS and LHS files.
2023-07-17 08:09:09 +03:00
oltolm
0c94606fcf
Make compile with msvc, clang and gcc on Windows 2023-07-11 21:40:30 +03:00
brian218
cf4ae38699 sys_fs: Implemented get_normalized_path() 2023-06-25 09:08:20 +02:00
Eladash
09f83e48ff fs: Add get_parent_dir_view
string view version of the argument path, use with care.
2023-06-24 12:00:04 +03:00
Eladash
bcbce5dd48 File.cpp: revert get_parent_dir change 2023-06-24 12:00:04 +03:00
Megamouse
635fed0427 fs/linux: fix potential copy_file issue
sendfile is meant to be run in a loop, since there is no guarantee that a single call copies all the data.
The current implementation may lead to corrupt files on linux.
2023-06-12 15:59:32 +03:00
brian218
a131a41874 Fixed a bug in fs::get_parent_dir() 2023-06-05 20:15:43 +02:00