Skip to content

feat: GTA V in game, Story Mode renders (follows #153) - #167

Closed
MichonGoddijn231849 wants to merge 8 commits into
boykopovar:mainfrom
MichonGoddijn231849:feat/gta-v-story-in-game
Closed

MichonGoddijn231849 wants to merge 8 commits into
boykopovar:mainfrom
MichonGoddijn231849:feat/gta-v-story-in-game

Conversation

@MichonGoddijn231849

@MichonGoddijn231849 MichonGoddijn231849 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What

This builds on @STL1te's #153 (and #144 before it), which does the heavy lifting. It boots GTA V with its own sce_module through the intro, the menus and into the Story Mode load, with depth/stencil and mip-chain targets, AJM MP3, direct memory and the console services. None of this would exist without that work; thank you.

This PR takes it from the Story Mode load into the world. The prologue renders and plays, with audio and UI:

GTA V in game

Tested on PPSA04264, the US version (01.005). Rebased onto current main: the draw-cache and out-of-memory changes are ported onto the split driver (Execution/src/Driver/**). The fixes that were split out and merged (#162–#165, #186, #188) are no longer part of this branch.

What was missing between the Story Mode load and a rendered frame:

  • Offline services the Story Mode load reaches: the NpUtility bandwidth test, the sign-in, web browser and player dialogs, NpAuth, entitlement consumption, reachability and account age report signed out; sceKernelMtypeprotect changes the protection; the APR ForEach resolvers. The only silent stub is the PS Store icon show/hide (UI), listed under TechnicalDebt.
  • GPU memory: the load stopped at 30% with VK_ERROR_OUT_OF_DEVICE_MEMORY. Now:
    • host imports use 64 MiB windows;
    • the budget follows the system memory heap;
    • an allocation that runs out of device memory evicts and runs once more.
  • Rendering:
    • color targets with gaps (the G-buffer MRTs);
    • DB_DEPTH_VIEW depth array slices;
    • bit-field extracts of the packed pixel ancillary VGPR as gl_SampleID and gl_Layer;
    • gl_Layer through the Geometry capability;
    • the 32-bit SPI_SHADER_Z_FORMATs with the depth and sample-mask export enables;
    • a null T#'s constant DST_SEL.
  • Draw cache: it keys on the user words the program reads, memoizes failures, and serves draws that differ only in user data (data-only hits).

Story Mode is an add-on entitlement. The game hashes each owned label (joaat) against three constants; GTAVSTORYMODE001 matches one of them. Listing it in anyps5-entitlements.ini (the #153 mechanism) enables "Resume Story".

Not done yet

Related

Tested

Windows 11 Pro, AMD Ryzen 5 7600 (6-core), NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

Checklist

🤖 Generated with Claude Code

@github-actions github-actions Bot added libc libkernel build shader core/shader relinker docs prx agc libSceAgc* needs rebase Conflicts with main, rebase needed labels Sep 29, 2026
@MichonGoddijn231849 MichonGoddijn231849 changed the title feat: GTA V in game, Story Mode renders (builds on #153) feat: GTA V in game, Story Mode renders (follows #153) Sep 30, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Sep 30, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Sep 30, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Progress report (75434ee → a2804a4)

📈 System libraries: 78.19% (+1.19%, +36 implemented functions)

✅ 36 implemented
Library Name
libSceMsgDialog.native sceMsgDialogGetResult
libSceMsgDialog.native sceMsgDialogOpen
libSceNpAuth sceNpAuthAbortRequest
libSceNpAuth sceNpAuthCreateAsyncRequest
libSceNpAuth sceNpAuthDeleteRequest
libSceNpAuth sceNpAuthGetAuthorizationCodeV3
libSceNpAuth sceNpAuthPollAsync
libSceNpCommerce sceNpCommerceHidePsStoreIcon
libSceNpCommerce sceNpCommerceShowPsStoreIcon
libSceNpEntitlementAccess sceNpEntitlementAccessAbortRequest
libSceNpEntitlementAccess sceNpEntitlementAccessDeleteRequest
libSceNpEntitlementAccess sceNpEntitlementAccessGenerateTransactionId
libSceNpEntitlementAccess sceNpEntitlementAccessPollConsumeEntitlement
libSceNpEntitlementAccess sceNpEntitlementAccessRequestConsumeUnifiedEntitlement
libSceNpManager sceNpCheckNpReachability
libSceNpManager sceNpGetAccountAge
libSceNpUtility sceNpBandwidthTestAbort
libSceNpUtility sceNpBandwidthTestGetStatus
libSceNpUtility sceNpBandwidthTestInitStartDownload
libSceNpUtility sceNpBandwidthTestInitStartUpload
libSceNpUtility sceNpBandwidthTestShutdown
libScePlayerSelectionDialog scePlayerSelectionDialogTerminate
libSceSigninDialog sceSigninDialogInitialize
libSceSigninDialog sceSigninDialogOpen
libSceSigninDialog sceSigninDialogTerminate
libSceSigninDialog sceSigninDialogUpdateStatus
libSceSystemService sceSystemServiceInitializePlayerDialogParam
libSceSystemService sceSystemServiceLaunchPlayerDialog
libSceWebBrowserDialog sceWebBrowserDialogClose
libSceWebBrowserDialog sceWebBrowserDialogGetResult
libSceWebBrowserDialog sceWebBrowserDialogOpen
libkernel sceKernelAprResolveFilepathsToIdsAndFileSizesForEach
libkernel sceKernelAprResolveFilepathsToIdsForEach
libkernel sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizesForEach
libkernel sceKernelAprResolveFilepathsWithPrefixToIdsForEach
libkernel sceKernelMtypeprotect

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 1, 2026
MichonGoddijn231849 and others added 8 commits October 1, 2026 21:13
Sign-in, web browser and player dialogs finish cancelled; the message dialog finishes at once;
NpAuth, entitlement consumption, reachability, account age and the NpUtility bandwidth test
report signed out; sceKernelMtypeprotect changes the protection (the memory type has no host
equivalent); the APR ForEach resolvers resolve every path and report each failure in its own
result entry. vswprintf's stub is dropped in favor of the existing wide-formatter
implementation, which already covers it on every platform.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… GPU out-of-memory

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…o, data-only hits

The draw cache key now covers the pixel system VGPR, sample shading, geometry and clip distance
features, and only the user words a program actually reads (a stale word left by an earlier draw
no longer misses). A draw that fails deterministically is memoized with the memory it read and
skipped without rebuilding or throwing. A sampled T# with a null base binds a 1x1 zero texture. A
draw whose registers match a cached entry except for user words and pointers reuses the entry's
decode and program prepare (data-only hit); its new key supersedes the old one's entry instead of
evicting it outright, since GTA V's user words differ every frame.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…xture swizzle

Unwritten MRT slots below the highest written one are VK_ATTACHMENT_UNUSED with a disabled
blend; targets keep their slot for export mappings and pass keys. DB_DEPTH_VIEW SLICE_START
moves the depth (and stencil) plane by whole slices, so each slice is its own depth surface. A
null texture now honours the descriptor's constant-one DST_SEL instead of always reading zero.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ia Geometry, Z export formats

Bit-field extracts of the packed ancillary VGPR become gl_SampleID and gl_Layer reads. A pixel
shader reading gl_Layer needs the Geometry capability instead of ShaderLayer and SPIR-V 1.5, and
the Geometry capability is available whenever the geometryShader feature is. 32-bit
SPI_SHADER_Z_FORMATs and 32_ABGR are accepted with the depth and sample-mask export enables.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n type

Its branches return unsigned long long and std::uint64_t, which differ on Linux.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@boykopovar

Copy link
Copy Markdown
Owner

I tried running it on Dreaming Sarah. After these changes, a strange bug appeared where the text menu buttons weren't visible until you clicked them. The rendering process also started flickering constantly.

The only suspicious message in the console: [gpu] host import budget 30699 MiB (system memory heap 32747 MiB; APS5_HOST_IMPORT_MIB overrides)

This wasn't a problem before. I think it's best to split this PR into several smaller ones that can be merged without causing regression.

@MichonGoddijn231849

Copy link
Copy Markdown
Contributor Author

Thanks for testing it on Dreaming Sarah. I reproduced the missing menu text and bisected it to the draw-cache commit. A new key of a shape replaced that shape's previous entry and took over its compiled variants. Those were compiled under the previous entry's user words, and a variant only validates the memory it captured, so each text draw drew with the previous one's data. The superseding entry now starts without those variants.

Split into independent PRs as you suggested. Each was checked on Dreaming Sarah's title menu (text shows) and with ctest:

GTA V also needs #231, #232, #249 and #261. Closing this one in favour of those.

@MichonGoddijn231849
MichonGoddijn231849 deleted the feat/gta-v-story-in-game branch October 9, 2026 20:06
MichonGoddijn231849 added a commit to MichonGoddijn231849/AnyPS5-fork that referenced this pull request Oct 12, 2026
A registered range larger than 64 MiB is imported one 64 MiB window at a
time for buffer and fill accesses instead of whole, and the live imports
stay under a budget: APS5_HOST_IMPORT_MIB, else the larger of 6 GiB and
half the physical memory, at most the largest host heap less 2 GiB
(imports and type-3 mirrors share it; boykopovar#167's rule). An import past the budget
retires the least recently used imports not used in the last 256
lookups.

- An access across window edges imports the cells it touches, grown to
  the union of the range's imports it overlaps, so uses across
  neighbouring edges share one import instead of replacing each other.
- An address-based build (AcquireRegistered) imports the range whole; a
  window over its first byte does not serve it.
- Every refusal (alignment, a failed run, a held import, the budget with
  what may be evicted) is decided before anything is retired.
- An import made when a range is mapped never evicts: the map observer
  holds no GPU lock.

The window size and the budget have setters for the tests.
MichonGoddijn231849 added a commit to MichonGoddijn231849/AnyPS5-fork that referenced this pull request Oct 12, 2026
A registered range larger than 64 MiB is imported one 64 MiB window at a
time for buffer and fill accesses instead of whole, and the live imports
stay under a budget: APS5_HOST_IMPORT_MIB, else the larger of 6 GiB and
half the physical memory, at most the largest host heap less 2 GiB
(imports and type-3 mirrors share it; boykopovar#167's rule). An import past the budget
retires the least recently used imports not used in the last 256
lookups.

- An access across window edges imports the cells it touches, grown to
  the union of the range's imports it overlaps, so uses across
  neighbouring edges share one import instead of replacing each other.
- An address-based build (AcquireRegistered) imports the range whole; a
  window over its first byte does not serve it.
- Every refusal (alignment, a failed run, a held import, the budget with
  what may be evicted) is decided before anything is retired.
- An import made when a range is mapped never evicts: the map observer
  holds no GPU lock.

The window size and the budget have setters for the tests.
MichonGoddijn231849 added a commit to MichonGoddijn231849/AnyPS5-fork that referenced this pull request Oct 13, 2026
A registered range larger than 64 MiB is imported one 64 MiB window at a
time for buffer and fill accesses instead of whole, and the live imports
stay under a budget: APS5_HOST_IMPORT_MIB, else the larger of 6 GiB and
half the physical memory, at most the largest host heap less 2 GiB
(imports and type-3 mirrors share it; boykopovar#167's rule). An import past the budget
retires the least recently used imports not used in the last 256
lookups.

- An access across window edges imports the cells it touches, grown to
  the union of the range's imports it overlaps, so uses across
  neighbouring edges share one import instead of replacing each other.
- An address-based build (AcquireRegistered) imports the range whole; a
  window over its first byte does not serve it.
- Every refusal (alignment, a failed run, a held import, the budget with
  what may be evicted) is decided before anything is retired.
- An import made when a range is mapped never evicts: the map observer
  holds no GPU lock.

The window size and the budget have setters for the tests.
oneandonlydean pushed a commit to MichonGoddijn231849/AnyPS5-fork that referenced this pull request Oct 14, 2026
A registered range larger than 64 MiB is imported one 64 MiB window at a
time for buffer and fill accesses instead of whole, and the live imports
stay under a budget: APS5_HOST_IMPORT_MIB, else the larger of 6 GiB and
half the physical memory, at most the largest host heap less 2 GiB
(imports and type-3 mirrors share it; boykopovar#167's rule). An import past the budget
retires the least recently used imports not used in the last 256
lookups.

- An access across window edges imports the cells it touches, grown to
  the union of the range's imports it overlaps, so uses across
  neighbouring edges share one import instead of replacing each other.
- An address-based build (AcquireRegistered) imports the range whole; a
  window over its first byte does not serve it.
- Every refusal (alignment, a failed run, a held import, the budget with
  what may be evicted) is decided before anything is retired.
- An import made when a range is mapped never evicts: the map observer
  holds no GPU lock.

The window size and the budget have setters for the tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants