Commit Graph
60 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5 05f5668dfe Save symbols outside any module to a per-game file, and only save real names
Module symbols are keyed by module+crc so they're shared by every game that
loads that module. But symbols the user attaches to addresses that aren't in
any module - the heap, the stack, scratchpad, a hardware register, typically
after a memory.search - describe one game's own memory layout and are worthless
to any other game. Those now go to PSP/SYSTEM/SYMBOLS/<gameID>_syms.ppsym.

They're module index 0 ("absolute"), which already round-trips through the
existing per-module code: GetModuleRelativeAddr/GetModuleAbsoluteAddr are
identity for it, so the file format is unchanged, just with absolute addresses.
SaveModuleSymbols only needed to stop requiring a ModuleEntry. Auto-load/save
hang off CPU_Init/CPU_Shutdown rather than module load/unload, gated on the same
bAutoSaveLoadSymbols setting - and deliberately not on SYSPROP_HAS_DEBUGGER,
which only the Windows port reports true for, so LoadSymbolsIfSupported next to
it does nothing at all on headless. hle.game.saveSymbols/loadSymbols expose it.

Four things found while doing it:

- Symbols outside any module were being dropped on the floor. AddFunction/
  AddData/AddLabel take moduleIndex -1 as "work it out", pass it to
  GetModuleIndex(), and store whatever comes back - but that returns -1 when no
  module contains the address, and -1 is never an active module, so the symbol
  never reached the active maps: invisible to every lookup and to any save.
  hle.data.add had spotted this and normalized -1 to 0 locally; nothing else
  did, so e.g. hle.func.add outside a module silently did nothing. Fixed
  centrally in a new ResolveModuleIndex() the three of them share.
  (This only became reachable with the GetModuleIndex() fix in 29a38af37e -
  before that it returned a wrong-but-valid module index instead.)

- The saved files were almost entirely noise. Every function the analyzer finds
  is named z_un_<addr> and every import stub zz_<name>, both regenerated from
  scratch on each load. One real module wrote 13KB - 443 unnamed functions and
  64 stub names - for the four names a human had actually chosen. Worse, on the
  next run those were loaded back as authoritative and would beat the module's
  own symbols to the address. Now only names that aren't regenerated get saved,
  and a module with none writes no file at all (and removes a stale one, so
  deleting a symbol sticks). That module's file went 13020 -> 81 bytes.

- LoadModuleSymbols trusted the addresses in the file. It's meant to be
  hand-edited and can outlive the build it came from, so relative addresses past
  the end of the module are now skipped with a warning instead of landing at
  nonsense addresses.

- AddFunction and AddData both erased the map entry they were updating and then
  read back through the now-dangling iterator to refresh the active copy. Only
  latent: the refresh is guarded on the active copy's module matching the new
  one, which is false exactly when the erase happens. Re-point the iterator at
  the entry's new home instead, so it can't rot if that guard ever changes.
  AddLabel already did the equivalent correctly, via a local copy.

Filename sanitizing goes through SanitizeString with a new FileName restriction
rather than being open-coded; unlike the existing restrictions it substitutes
'_' instead of dropping, so two module names can't collapse onto one file.

Verified end to end on headless with cpu_alu.prx: named a function inside the
module and data/functions in scratchpad and the heap, let it exit, checked both
files, rebooted and confirmed all of it came back at the right addresses.
Unit tests 51/51, pspautotests 314/314.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
2026-08-17 16:53:48 +02:00
Henrik Rydgård b07fce1566 Warning fix, shutdown fix 2026-06-02 17:16:45 +02:00
Henrik Rydgård 9abd8c21e1 Finish implementing the multipart protocol, now multi file uploads work without corruption. 2025-10-27 12:20:24 +01:00
Henrik Rydgård dc682fb2c8 Basic upload via web browser support, only single file almost works 2025-10-27 12:20:24 +01:00
Henrik Rydgård 6f76c579fc Delete dead code, more std::string_view 2025-09-01 00:15:23 +02:00
Henrik Rydgård 1ef55a9a36 Delete unused code, inline a tiny function 2025-08-31 14:49:18 +02:00
Henrik Rydgård d43b1d4618 String function cleanup 2025-08-31 14:45:41 +02:00
Henrik Rydgård 6e5c567809 Fix some ini file misbehaviors 2025-08-31 14:13:12 +02:00
Henrik Rydgård a361a32f4b More minor cleanups 2025-05-29 13:39:33 +02:00
Henrik Rydgård fffbed53bc Add a ZipFileLoader, which can let us load any single-file file type from a zip.
Useful for loading framedumps from github without manually having to
unzip each one, for example.
2025-04-12 22:23:23 +02:00
Henrik Rydgård abff8a078f Work around bad null decoding (overlong) in Jak & Daxter savedata title. 2025-04-09 11:59:17 +02:00
Henrik Rydgård a79f986411 More module loading cleanup, choose better filenames for dumped PRX files 2025-03-31 12:09:25 +02:00
Henrik Rydgård 7138722f36 Do some string sanitization, which turned out not to be the issue 2025-03-29 18:48:05 +01:00
Henrik Rydgård fd620cdf30 SanitizeString: Preserve high bytes (don't break utf-8). Oops. 2025-03-28 14:33:09 +01:00
Henrik Rydgård 4e4866d1cd Fix titles in savedata manager (remove linebreaks)
Fixes #20106
2025-03-27 14:46:44 +01:00
Henrik Rydgård 70543c0363 Update AnalyzeTrack 2025-03-05 17:02:46 +01:00
Henrik Rydgård 8a58f50caf Fix some compiler warnings 2025-01-29 11:13:48 +01:00
Henrik Rydgård 6ebbb434e4 Restrict username minimum length too (3 chars) 2025-01-07 18:09:19 +01:00
Henrik Rydgård 01b06b76c9 Infrastructure username handling: Add separate username, pick Nickname as default if valid. 2025-01-07 17:43:02 +01:00
Henrik Rydgård 3e198c53b2 More include cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård 080798b5dd Move out two more functions from Core.cpp. Clean up Windows includes 2024-12-08 12:12:02 +01:00
Henrik Rydgård a859b2223a Shorten the version display on the main screen 2024-10-22 11:58:50 +02:00
Henrik Rydgård 4d6905672e Bunch more linting 2024-10-10 11:57:10 +02:00
Henrik Rydgård 62656b6e6f VS2017 buildfix
thanks nemo
2024-09-14 18:40:03 +02:00
Henrik Rydgård 10d3b253a4 More InstallZip refactoring, add options for install directory where applicable 2024-09-10 13:55:12 +02:00
Henrik Rydgård d0ab095b1d Homebrew Store: Fetch license and website URL. Add buttons to go to website and look up license info. 2024-09-02 01:05:55 +02:00
Henrik Rydgård e5178d2bc4 Remove unused code, some string_view 2024-05-05 11:58:35 +02:00
Herman Semenov 52635fca1d utils: rewrite on optimized function SplitString 2024-04-02 17:01:14 +03:00
Henrik Rydgård c5791764d8 Make the i18n T function use std::string_view
Buildfixes, crashfixes

One more

Android buildfix

Buildfix Qt
2024-02-12 18:44:39 +01:00
Henrik Rydgård 0fc3e2b777 Add string_view support to more UTF functions 2024-01-12 14:03:02 +01:00
Henrik Rydgård 71f1e29513 Remote ISO: Allow sharing a folder of ISOs instead of Recent. 2023-12-29 12:55:08 +01:00
Herman Semenov 5a0d54be83 [Common/Data/GPU/Input/System/UI] Added const reference for function params 2023-12-14 14:21:11 +03:00
Henrik Rydgård 19eeaef2ea More uses of string_view 2023-11-13 23:36:34 +01:00
Henrik Rydgård d0ee5fc308 Path: Use string_view more to avoid allocations 2023-11-13 23:24:42 +01:00
Henrik Rydgård b2f97d5934 Add support for using %1 and %2 in some more translation strings.
Requested in #18306
2023-10-04 14:36:42 +02:00
Henrik Rydgård 2bd2292bac With string_view, stripping whitespace can be done without allocs. 2023-09-26 13:19:19 +02:00
Henrik Rydgård 8a59ed0062 Add function ApplySafeSubstitution for translation strings with parameters 2023-07-16 16:26:49 +02:00
Henrik Rydgård 6945deec01 Replace a LOT of sprintf with snprintf, and a few strcpy with truncate_cpy 2023-04-28 21:04:05 +02:00
Henrik Rydgård 4ed634383f If there are multiple escapes, pick the first. 2023-04-23 14:42:36 +02:00
Henrik Rydgård 91d4ded3fd Add function UnescapeMenuString
Turns E&dit into Edit and 'd'. Double ampersands are translated to just a single one,
hence the unescaping part of this.

Useful in the Mac port to deal with desktop UI translation strings with included
Windows hotkeys.
2023-04-23 14:37:09 +02:00
Henrik Rydgård 675a046759 Fix parsing ampersands in server listings for streaming
Fixes #16263 , or so I hope - haven't actually tested it, but seems
straightforward enough.
2022-11-05 23:31:30 +01:00
lainon 3cdf72b68b Better readability and optimization insertion into container by replacing 'insert' -> 'emplace', 'push_back' -> 'emplace_back' 2022-09-30 12:35:28 +03:00
Henrik Rydgård ecb84987ef Remove allocation from the heaviest MemBlockInfo path (BlockTransfer). Required some refactoring. 2022-09-01 11:59:35 +02:00
ANR2ME 0b3fdf0cef Use safe_string when printing %s with Memory::GetCharPointer. 2022-08-06 11:22:38 +07:00
Unknown W. Brackets 2479d52202 Global: Reduce includes of common headers.
In many places, string, map, or Common.h were included but not needed.
2022-01-30 16:35:33 -08:00
Henrik Rydgård 2e16e83159 It never ends... 2021-05-13 10:39:16 +02:00
ANR2ME 8742a49e07 Replacing the inconvenient prefix string for indentation with indent number. 2021-04-19 06:14:28 +07:00
ANR2ME 40941b41a4 Fix missing hex string at the last row when data size is a multiple of 16 bytes 2021-04-19 05:48:37 +07:00
Unknown W. Brackets 3360121b5c UI: Expose lists better in descriptions.
Explicitly marks several lists, which should make exposing text better.
2021-02-21 18:41:08 -08:00
Henrik Rydgård 311fe431d0 Move buffer.cpp/h from base to Common 2020-09-29 15:51:51 +02:00