Commit Graph
61 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årdandClaude Sonnet 5 29a38af37e Per-module symbol save/load, module identity via crc, GetModuleIndex fix
SymbolMap:
- Fix GetModuleIndex(): it only checked the end of an active module's range
  (via activeModuleEnds.upper_bound), never the start, so an address sitting
  in the gap before a module was silently misattributed to it. Added
  GetModuleIndexByName() as a companion lookup.
- AddModule() gains an optional crc param, stored per ModuleEntry. Reactivating
  a module by name now also requires the crc to agree when both sides know it,
  so two unrelated binaries that happen to share a name no longer get merged
  into one symbol table (addresses the old TODO at the top of SymbolMap.h).
- AddLabel()/AddFunction() gain an updateName param (default false, preserving
  existing "first writer wins" behavior) so a trusted source - like a loaded
  symbol file - can be allowed to overwrite a name that a lower-confidence
  automatic pass already assigned.
- New SaveModuleSymbols()/LoadModuleSymbols()/GetModuleSymbolsPath(): save or
  restore one module's functions/data/labels to/from a small human-editable
  text file, addressed relative to the module (so the file stays valid however
  the module ends up positioned on a later run). Keyed by
  PSP/SYSTEM/SYMBOLS/<moduleName>_<crc>.ppsym - deliberately by module+crc
  rather than by game, so it's shared by every game/homebrew that loads the
  exact same module. A "# game <id> <title>" comment records who last saved
  it, informational only.

WebSocket debugger: hle.module.saveSymbols/loadSymbols expose the above.

sceKernelModule.cpp: auto-load a module's saved symbols right after it's
registered with the symbol map (both the real ELF-load path and the
savestate-load path), and auto-save on unload (before UnloadModule(), while
its symbols are still active) - gated behind the new bAutoSaveLoadSymbols
config setting (default off), with a matching Developer Tools checkbox and
a --auto-save-load-symbols command-line override for headless use.

Includes some in-progress cleanup already staged: DescribeAddress now calls
g_symbolMap->GetDescription() directly instead of through the now-removed
MIPSDebugInterface::getDescription() wrapper.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
2026-08-17 16:01:23 +02:00
Henrik Rydgård 67ddf899ba Plumb through the PC value for syscalls, so we can get better diagnostics for unresolved ones. 2026-08-15 19:14:13 +02:00
Henrik Rydgård 7219cd2f5a Split off ScreenManager from Screen.cpp 2026-08-07 14:30:36 +02:00
Henrik Rydgård db30fabf03 Add a setting (defaulting to false) for enabling file handler plugins 2026-08-03 11:24:36 +02:00
Henrik Rydgård 5265422c0e Remove the old "Fragment ubershader" setting. It's been on by default for years and is not really an ubershader. 2026-06-10 09:54:52 +02:00
Henrik Rydgård cc0ece038c Clean up the string type in RequestCallback - somehow was both char* and std::string????
Might be related to #21695
2026-05-18 14:16:34 +02:00
Henrik Rydgård a128d2caa1 Add a translation string for the "Show player port numbers" setting, and for player ports.
See #21661
2026-05-12 00:00:31 +02:00
Henrik Rydgård 487801cf81 Don't show the keyboard when switching to imgui on mobile.
Fixes #21477
2026-05-01 16:52:52 +02:00
Henrik Rydgård bfadd2539b Some code hardening in TextEdit view 2026-04-27 20:55:46 +02:00
Henrik Rydgård 56ca89a6e3 Adhoc: Don't show player ports by default (control with developer setting) 2026-04-16 12:48:14 -06:00
Henrik Rydgård 49d3d3dc37 Settings and dev settings: Preserve the current tab. Minor UI tweaks. 2026-04-06 12:09:40 -06:00
Henrik Rydgård 8304d8622a Hide the save/load indicator by default, add a (developer) setting. Also sneak in an adhoc server list bug fix.
Fixes #21523
2026-04-06 10:04:09 -06:00
Henrik Rydgård 0e55129fab Prepare for dumping NPDRM isos, use shared_ptr to manage lifetime of BlockDevice 2026-03-19 13:59:04 +01:00
Henrik Rydgård b7f257152d Fix logging to file
Fixes #21411
2026-03-11 14:14:58 +01:00
Henrik Rydgård 4501550faa More settings tweaks 2026-02-19 00:15:49 +01:00
Henrik Rydgård 1a2e32d451 Fix some untranslatable strings, thanks TotalCaesar569 2026-02-18 18:39:44 +01:00
Henrik Rydgård e65013201f Fix color of setting hints. Minor tweak to clipboard notifications
See #21223
2026-02-17 11:32:10 +01:00
Henrik Rydgård ab4ca14773 Add a simple utility to help bug reporting: Copy ppsspp.ini to clipboard 2026-02-17 10:18:08 +01:00
Henrik Rydgård 1846163985 Replace Path::ToVisualString with GetFriendlyPath which shortens. Much better on iOS 2026-02-13 21:16:00 +01:00
Henrik Rydgård a92ff89d5f Clean up the OSD click callback code 2026-02-09 13:08:44 +01:00
Henrik Rydgård 11a9430e5a Improve a translation string 2026-01-07 19:51:16 +01:00
Henrik Rydgård 5b7b1f76eb Add an in-app crash history viewer to Developer Tool on Android (v30+) 2025-12-15 17:16:47 +01:00
Henrik Rydgård 56feb8692f Implement correct word wrapping for popup notices that don't fit on the screen 2025-11-27 19:34:46 +01:00
Henrik Rydgård 6f2742a2cb Some UI polish 2025-11-09 16:49:15 +01:00
Henrik Rydgård 19f723d579 Notifications should obey insets 2025-10-29 14:22:17 +01:00
Henrik Rydgård e7a9a10aac Fix issue with hiding certain notifications when not in-game (should be per type, not per edge) 2025-10-29 13:39:34 +01:00
Henrik Rydgård 7ffd72b32e Rename some screen classes 2025-10-29 00:02:43 +01:00
Henrik Rydgård 28b9bc2fb3 Make more dev screens usable in portrait by converting them to TabbedDialogScreen 2025-10-23 15:33:09 +02:00
Henrik Rydgård a656496953 Remove setting for fast-forward mode 2025-10-20 19:53:21 +02:00
Henrik Rydgård 5bb8ea759b Move the debug-only sysinfo "Internals" tab into the Developer Tools' screen's UI tab 2025-09-23 11:37:21 -06:00
Henrik Rydgård 21354c8671 Add a way to force recreating the UI atlas in developer tools 2025-09-17 09:49:54 -06:00
Henrik Rydgård 527a35f155 Fix crash in debug mode entering developer tools 2025-09-17 09:49:54 -06:00
Henrik Rydgård 58456ae950 Remove the UI::EventReturn return values. Makes editing the UI nicer. 2025-09-15 11:09:00 -06:00
Nab 5200ace606 GUI margin and Back button adjustments 2025-09-07 20:10:50 +02:00
Henrik Rydgård 621cee686f Fix another translation issue, more strings 2025-08-29 01:07:55 +02:00
Henrik Rydgård e017775538 Allow configuring the server port from the developer tools screen 2025-08-26 10:13:21 +02:00
Henrik Rydgård 7315e7a2a9 Add translations for the new setting (AI) 2025-08-24 11:17:48 +02:00
Henrik Rydgård f6050a442c Fix serving the remote debugger locally, add a setting for the auto-launcher 2025-08-24 11:17:19 +02:00
Henrik Rydgård 2a77846971 Developer tools: Add UI to force-enable HLE of modules that we have disabled HLE of
Can be useful for debugging.
2025-06-13 12:54:49 +02:00
Nemoumbra 7df52582c6 MIPSTracer filepicker fix 2025-05-31 00:01:34 +03:00
Henrik Rydgård 4edbc14025 Fix the background image selector on MacOS and Linux (with pfd)
Forgot that the backends need changes too, after I split out image file selection from the other types.
2025-05-27 23:04:18 +02:00
Henrik Rydgård d07a542d85 Fix strings pointed out by TotalCaesar659
See #20402
2025-05-26 20:23:46 +02:00
Henrik Rydgård 65229026bb Add a checkbox to enable file logging from the UI, in developer settings.
Fixes issue #20372.

The file is written to PSP/SYSTEM/DUMP/log.txt by default, but you can
override from the command line if needed.
2025-05-25 18:54:30 +02:00
Henrik Rydgård 2dbb54667d IAP work 2025-05-25 11:22:04 +02:00
Henrik Rydgård 6035ef0652 Implement image file picker on iOS, various buildfixes 2025-05-19 20:41:16 +02:00
Henrik Rydgård 30e0834c0a Remove the legacy CPU test runner from developer tools 2025-05-19 10:47:33 +02:00
Henrik Rydgård faeaf0b723 Remove the redundant setting "Show on-screen messages". (you can set notification position to None)
Remove now-redundant string
2025-05-18 10:29:53 +02:00
Henrik Rydgård dde3099d0c Expose the hidden ShaderCache option in developer tools 2025-05-14 09:39:14 +02:00
Henrik Rydgård ff37cbe184 Minor memory safety fixes 2025-05-14 09:39:09 +02:00