docs(debt): name what the emulators do with the context of sceAjmInstanceCreate and sceAjmInstanceDestroy #14078

Merged
xXPBSXx merged 2 commits from upstream-pr/14078 into main 2026-11-06 14:46:29 +00:00
xXPBSXx commented 2026-10-31 18:03:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-31T18:03:06Z.


What

Adds one entry to the libSceAjm.native technical debt: sceAjmInstanceCreate and sceAjmInstanceDestroy ignore the context ID and keep every instance in one table, so an ID that sceAjmInitialize never returned still creates and destroys instances, while start, wait and cancel reject such an ID with 0x80930002. The instance calls came in with commit 91557ebade, which replaced throwing stubs, and its message names no console measurement. shadPS4 (PS4) and fpPS4 (PS4) return 0x80930002 for an unknown context in both calls, KytyPS5 (PS5) checks no context, only a null instance pointer in sceAjmInstanceCreate, and its destroy always returns 0, and destroying an unknown instance returns 0x80930003 here and in shadPS4 and 0 in fpPS4 and KytyPS5. The entry does not say which behaviour is right and no code or test changes.

Tested

Documentation only. tools/check_conventions.py --base upstream/main passes. Based on main 474030e584, and it merges with main 0f302813ce without a conflict (checked 2026-10-31 18:02 UTC). I searched each of the three emulators for the two functions by name and read them at the commits named in the entry (shadPS4 0614ce324be092791b758d79f93d9f1ca5b10a81, fpPS4 04cefd43e6fddd1ab033e7980cd356d14c964905, KytyPS5 5e837a9beac82c031868eaad9348d6a48245fb99) and our two exports in Ajm.cpp. Not run: a build or a test, because nothing but the debt file changes.

Overlap

Checked on 2026-10-31 against main 474030e58424fefdb65e5df9f3820810fbb4553c (1680 open pull requests, listed at 16:06 UTC; the merge checks ran from 16:06 UTC to 17:08 UTC). I took the changed files of each from git diff --name-only against its merge base. Three of them change libSceAjm.native files or GuestAjm.cpp: #12613 (Ajm.cpp, GuestAjm.cpp and docs/dev/debt/libSceAjm.native.md), #12231 (GuestAjm.cpp only) and #3205 (Export.cpp and GuestAjm.cpp). git merge-tree of this head with each: #12613 and #12231 merge cleanly, and #3205 conflicts but also conflicts with main on its own, so not because of this entry. None of them changes how the two calls treat the context; the only lines of #12231 that name them are two test calls with a valid context. Checked once more on 2026-10-31 at 17:19 UTC against main 474030e584: none of the 28 pull requests opened since 16:06 UTC changes those files. Checked again on 2026-10-31 at 18:02 UTC against main 0f302813ce: none of the 15 opened since 17:15 UTC changes them either.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5100161523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14078). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-31T18:03:06Z. --- ### What Adds one entry to the libSceAjm.native technical debt: `sceAjmInstanceCreate` and `sceAjmInstanceDestroy` ignore the context ID and keep every instance in one table, so an ID that `sceAjmInitialize` never returned still creates and destroys instances, while start, wait and cancel reject such an ID with `0x80930002`. The instance calls came in with commit 91557ebade, which replaced throwing stubs, and its message names no console measurement. shadPS4 (PS4) and fpPS4 (PS4) return `0x80930002` for an unknown context in both calls, KytyPS5 (PS5) checks no context, only a null `instance` pointer in `sceAjmInstanceCreate`, and its destroy always returns 0, and destroying an unknown instance returns `0x80930003` here and in shadPS4 and 0 in fpPS4 and KytyPS5. The entry does not say which behaviour is right and no code or test changes. ### Tested Documentation only. `tools/check_conventions.py --base upstream/main` passes. Based on `main` `474030e584`, and it merges with `main` `0f302813ce` without a conflict (checked 2026-10-31 18:02 UTC). I searched each of the three emulators for the two functions by name and read them at the commits named in the entry (shadPS4 0614ce324be092791b758d79f93d9f1ca5b10a81, fpPS4 04cefd43e6fddd1ab033e7980cd356d14c964905, KytyPS5 5e837a9beac82c031868eaad9348d6a48245fb99) and our two exports in `Ajm.cpp`. Not run: a build or a test, because nothing but the debt file changes. ### Overlap Checked on 2026-10-31 against `main` `474030e58424fefdb65e5df9f3820810fbb4553c` (1680 open pull requests, listed at 16:06 UTC; the merge checks ran from 16:06 UTC to 17:08 UTC). I took the changed files of each from `git diff --name-only` against its merge base. Three of them change `libSceAjm.native` files or `GuestAjm.cpp`: #12613 (`Ajm.cpp`, `GuestAjm.cpp` and `docs/dev/debt/libSceAjm.native.md`), #12231 (`GuestAjm.cpp` only) and #3205 (`Export.cpp` and `GuestAjm.cpp`). `git merge-tree` of this head with each: #12613 and #12231 merge cleanly, and #3205 conflicts but also conflicts with `main` on its own, so not because of this entry. None of them changes how the two calls treat the context; the only lines of #12231 that name them are two test calls with a valid context. Checked once more on 2026-10-31 at 17:19 UTC against `main` `474030e584`: none of the 28 pull requests opened since 16:06 UTC changes those files. Checked again on 2026-10-31 at 18:02 UTC against `main` `0f302813ce`: none of the 15 opened since 17:15 UTC changes them either. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-31 18:06:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T18:06:36Z.

Review: APPROVED


Reviewed — looks good

The new debt note clearly separates the repository's behavior from the PS4 emulator comparisons and unverified PS5 behavior, and the cited implementations support its comparison.

What I ran

Reviewed head 41dba73e5e62c7439e34d672716bb48fa412a186 against base ca073ec3ad0d766ea9f4658e418a5c977001a353; the merge preview against live main was clean. Environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. This documentation-only change does not need a build.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14078 --output-dir /tmp/anyps5-14078-review
git diff --check ca073ec3ad0d766ea9f4658e418a5c977001a353...41dba73e5e62c7439e34d672716bb48fa412a186
python3 tools/pr_stack_check.py 14078 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-14078-review/stack

Results

Check Result
Diff and conventions Passed.
Dependency and merge preview No dependencies; clean against live main ca073ec3ad0d766ea9f4658e418a5c977001a353.
Source citations Inspected the exact cited revisions: shadPS4 and fpPS4 reject an unknown context in create/destroy; KytyPS5 does not validate the context in either function and returns success after erasing the instance ID. AnyPS5 currently ignores the context in create/destroy, as the new note says.
Hosted CI Documentation-only jobs passed or were skipped; no product build was selected.
Raw outputs

Diff check produced no output:

Conventions output:

All conventions checks passed.

Stack-check command output:

/tmp/anyps5-14078-review/stack/stack-report.md
/tmp/anyps5-14078-review/stack/stack-report.json

The stack report states: PR #14078: clean against current base; head 41dba73e5e62c7439e34d672716bb48fa412a186 and No declared PR dependencies were found in the target PR chain.

Sources

Not verified

The comparison implementations are PS4 emulators and do not establish PS5 behavior; the debt note states that limitation. No console behavior was tested.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724198729 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14078#pullrequestreview-5724198729). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T18:06:36Z. **Review:** APPROVED --- # Reviewed — looks good The new debt note clearly separates the repository's behavior from the PS4 emulator comparisons and unverified PS5 behavior, and the cited implementations support its comparison. ## What I ran Reviewed head `41dba73e5e62c7439e34d672716bb48fa412a186` against base `ca073ec3ad0d766ea9f4658e418a5c977001a353`; the merge preview against live `main` was clean. Environment: Debian Linux 6.1, Python 3.11.2, GCC 12.2.0. This documentation-only change does not need a build. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14078 --output-dir /tmp/anyps5-14078-review git diff --check ca073ec3ad0d766ea9f4658e418a5c977001a353...41dba73e5e62c7439e34d672716bb48fa412a186 python3 tools/pr_stack_check.py 14078 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-14078-review/stack ``` ## Results | Check | Result | |---|---| | Diff and conventions | Passed. | | Dependency and merge preview | No dependencies; clean against live `main` `ca073ec3ad0d766ea9f4658e418a5c977001a353`. | | Source citations | Inspected the exact cited revisions: shadPS4 and fpPS4 reject an unknown context in create/destroy; KytyPS5 does not validate the context in either function and returns success after erasing the instance ID. AnyPS5 currently ignores the context in create/destroy, as the new note says. | | Hosted CI | Documentation-only jobs passed or were skipped; no product build was selected. | <details><summary>Raw outputs</summary> Diff check produced no output: ``` ``` Conventions output: ```text All conventions checks passed. ``` Stack-check command output: ```text /tmp/anyps5-14078-review/stack/stack-report.md /tmp/anyps5-14078-review/stack/stack-report.json ``` The stack report states: `PR #14078: clean against current base; head 41dba73e5e62c7439e34d672716bb48fa412a186` and `No declared PR dependencies were found in the target PR chain.` </details> ## Sources - [AnyPS5 context handling at this PR head](https://github.com/boykopovar/AnyPS5/blob/41dba73e5e62c7439e34d672716bb48fa412a186/core/libs/prx/libSceAjm.native/src/Ajm.cpp#L1737-L1763) - [shadPS4 context validation at commit `0614ce324be092791b758d79f93d9f1ca5b10a81`](https://github.com/shadps4-emu/shadPS4/blob/0614ce324be092791b758d79f93d9f1ca5b10a81/src/core/libraries/ajm/ajm.cpp#L151-L172) - [shadPS4 instance-destroy result at the same commit](https://github.com/shadps4-emu/shadPS4/blob/0614ce324be092791b758d79f93d9f1ca5b10a81/src/core/libraries/ajm/ajm_context.cpp#L186-L192) - [fpPS4 context validation and instance behavior at commit `04cefd43e6fddd1ab033e7980cd356d14c964905`](https://github.com/red-prig/fpPS4/blob/04cefd43e6fddd1ab033e7980cd356d14c964905/src/ajm/ps4_libsceajm.pas#L313-L360) - [KytyPS5 create/destroy behavior at commit `5e837a9beac82c031868eaad9348d6a48245fb99`](https://github.com/KytyPS5/KytyPS5/blob/5e837a9beac82c031868eaad9348d6a48245fb99/src/libs/ajm.cpp#L664-L704) ## Not verified The comparison implementations are PS4 emulators and do not establish PS5 behavior; the debt note states that limitation. No console behavior was tested.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14078
No description provided.