ngs2: accept and ignore mastering control 2 that Trackmania sends (PPSA02195) #2364

Open
github-bot wants to merge 2 commits from github-bot/gh-2364 into main AGit
Owner

@⁠simonbronk on GitHub · 2026-11-17 22:43 UTC · original
simonbronk:fix/trackmania-ngs2-mastering → main · +33 −0 · 2 files · 2 commits · open

Fixes #2252.

Trackmania (PPSA02195) stops at boot with:

unsupported mastering control: 0x30000002 in src/libs/ngs2.cpp:3006

The game sends control 2 to a Mastering rack voice, with an 8-byte payload. The case 0x3000 branch of Ngs2VoiceControl only handles controls 0, 1, 4 and 5, so control 2 hits the EXIT.

Change

  • Control 2 is accepted and ignored, with a one-time warning in the log. I couldn't find what this control does, so it isn't emulated, only no longer fatal.
  • TestMasteringUnknownControl in tests/Ngs2SamplerTests.cpp sends {size=16, next=0, id=0x30000002} to a Mastering voice and checks it returns OK.

Testing

  • Windows 11, clang-cl (VS 2022 Build Tools), Release.
  • ngs2_sampler_tests: passes with the change; without it, it aborts with the same message as the issue.
  • I don't own the game, so I couldn't check whether Trackmania gets further after this. @⁠Ekt0re, could you try a build with this change and attach the new log?

AI disclosure
I'm not an experienced C++ developer. I wrote this with an AI assistant (Claude). I reviewed the diff and ran the test above with and without the change myself.

**@⁠simonbronk** on GitHub · 2026-11-17 22:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364) `simonbronk:fix/trackmania-ngs2-mastering` → `main` · +33 −0 · 2 files · 2 commits · open Fixes #2252. Trackmania (PPSA02195) stops at boot with: unsupported mastering control: 0x30000002 in src/libs/ngs2.cpp:3006 The game sends control 2 to a Mastering rack voice, with an 8-byte payload. The `case 0x3000` branch of `Ngs2VoiceControl` only handles controls 0, 1, 4 and 5, so control 2 hits the `EXIT`. **Change** - Control 2 is accepted and ignored, with a one-time warning in the log. I couldn't find what this control does, so it isn't emulated, only no longer fatal. - `TestMasteringUnknownControl` in `tests/Ngs2SamplerTests.cpp` sends `{size=16, next=0, id=0x30000002}` to a Mastering voice and checks it returns OK. **Testing** - Windows 11, clang-cl (VS 2022 Build Tools), Release. - `ngs2_sampler_tests`: passes with the change; without it, it aborts with the same message as the issue. - I don't own the game, so I couldn't check whether Trackmania gets further after this. @⁠Ekt0re, could you try a build with this change and attach the new log? **AI disclosure** I'm not an experienced C++ developer. I wrote this with an AI assistant (Claude). I reviewed the diff and ran the test above with and without the change myself.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:18:56 +00:00
Author
Owner

@⁠Ekt0re on GitHub · 2026-11-17 22:45 UTC · original

Hey, I'm going to try this solution myself this Friday!

**@⁠Ekt0re** on GitHub · 2026-11-17 22:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-6963200756) Hey, I'm going to try this solution myself this Friday!
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 22:47 UTC · original · edited 2026-11-21 11:10 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mastering control handler now accepts control IDs 2 and 3. It logs a warning once for each ID and ignores the control. The new test submits control IDs 0x30000002 and 0x30000003, verifies that both calls return OK, and runs from the test runner.

Suggested reviewers: nmzik, mrbigbritches

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to bb284

This change stops Trackmania from halting on mastering controls 2 and 3 by accepting and ignoring them with a one-time warning. The risk is low and contained to these two controls. The author has not yet reported an in-game retest, so the startup fix is unconfirmed.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the NGS2 mastering control 2 used by Trackmania (PPSA02195) is now accepted and ignored. The code also accepts control 3, which the title does not mention, but that is…
Description check Passed The description states the problem (Trackmania stops at boot on unsupported mastering control 0x30000002), the fix (accept and ignore the control with a one-time warning), the added test, testing resu…
Linked Issues check Passed [#2252] The issue requires that Trackmania (PPSA02195) no longer stops on the fatal error unsupported mastering control: 0x30000002. The whole-PR diff against the merge base adds case 2: and `case…
Out of Scope Changes check Passed The whole-PR diff touches only src/libs/ngs2.cpp and tests/Ngs2SamplerTests.cpp. The source change adds two case labels that share one warning and break path. Control 3 is included because the rep…
Full details: Title check

Explanation

The title names the main change: the NGS2 mastering control 2 used by Trackmania (PPSA02195) is now accepted and ignored. The code also accepts control 3, which the title does not mention, but that is a secondary detail. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description states the problem (Trackmania stops at boot on unsupported mastering control 0x30000002), the fix (accept and ignore the control with a one-time warning), the added test, testing results, and an AI disclosure. It relates directly to the changeset.

Full details: Linked Issues check

Explanation

[#2252] The issue requires that Trackmania (PPSA02195) no longer stops on the fatal error unsupported mastering control: 0x30000002. The whole-PR diff against the merge base adds case 2: and case 3: to the mastering Ngs2VoiceControl switch in src/libs/ngs2.cpp. Both cases log a one-time warning per control ID and then break, so neither reaches the fatal default path. The per-ID warning flag uses param->id & 1u, which maps IDs 2 and 3 to separate flags. TestMasteringUnknownControl in tests/Ngs2SamplerTests.cpp sends a 16-byte header with a 2-element zeroed payload for 0x30000002 and 0x30000003, checks both return OK, and is called from main. The objectives report an in-game test where control 0x30000002 was ignored and the game then stopped on 0x30000003. Control 3 handling is therefore needed for the reported startup path. The issue's expected outcome, that the game reaches the logos, is a runtime result. No retest result is provided, so that outcome is not verified. The coding requirement to remove the fatal failure is implemented and covered by a test.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff touches only src/libs/ngs2.cpp and tests/Ngs2SamplerTests.cpp. The source change adds two case labels that share one warning and break path. Control 3 is included because the reported in-game test stopped on 0x30000003 after control 2 was accepted. This links the change to #2252. The test adds one function that covers both controls and one call in main. No unrelated files or hunks appear. The controls are ignored, not emulated, which matches the PR description. The PR description still mentions only control 2, but the current code and test cover control 3 as well. This is a stale description, not an unrelated change.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8a8f53ba9d and bb2840be4c.

Files selected for processing: 2

  • src/libs/ngs2.cpp
  • tests/Ngs2SamplerTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-6963241934) · edited 2026-11-21 11:10 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2364?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The mastering control handler now accepts control IDs 2 and 3. It logs a warning once for each ID and ignores the control. The new test submits control IDs 0x30000002 and 0x30000003, verifies that both calls return OK, and runs from the test runner. **Suggested reviewers:** `nmzik`, `mrbigbritches` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"bb2840be4cbb1520cda57f402cc716ecdbc4fc4e" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>bb284</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `bb284` --> <!-- final_review_risk_coverage:{"sourceCommitId":"bb2840be4cbb1520cda57f402cc716ecdbc4fc4e","coveredCommitId":"bb2840be4cbb1520cda57f402cc716ecdbc4fc4e","kind":"reviewed"} --> This change stops Trackmania from halting on mastering controls 2 and 3 by accepting and ignoring them with a one-time warning. The risk is low and contained to these two controls. The author has not yet reported an in-game retest, so the startup fix is unconfirmed. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: the NGS2 mastering control 2 used by Trackmania (PPSA02195) is now accepted and ignored. The code also accepts control 3, which the title does not mention, but that is… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description states the problem (Trackmania stops at boot on unsupported mastering control 0x30000002), the fix (accept and ignore the control with a one-time warning), the added test, testing resu… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | [`#2252`] The issue requires that Trackmania (PPSA02195) no longer stops on the fatal error `unsupported mastering control: 0x30000002`. The whole-PR diff against the merge base adds `case 2:` and `case… | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The whole-PR diff touches only `src/libs/ngs2.cpp` and `tests/Ngs2SamplerTests.cpp`. The source change adds two case labels that share one warning and break path. Control 3 is included because the rep… | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: the NGS2 mastering control 2 used by Trackmania (PPSA02195) is now accepted and ignored. The code also accepts control 3, which the title does not mention, but that is a secondary detail. The title is specific and matches the changeset. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description states the problem (Trackmania stops at boot on unsupported mastering control 0x30000002), the fix (accept and ignore the control with a one-time warning), the added test, testing results, and an AI disclosure. It relates directly to the changeset. </dd> </dl> </details> <details> <summary><strong>Full details: Linked Issues check</strong></summary> <dl> <dd> <br> **Explanation** [`#2252`] The issue requires that Trackmania (PPSA02195) no longer stops on the fatal error `unsupported mastering control: 0x30000002`. The whole-PR diff against the merge base adds `case 2:` and `case 3:` to the mastering `Ngs2VoiceControl` switch in `src/libs/ngs2.cpp`. Both cases log a one-time warning per control ID and then break, so neither reaches the fatal default path. The per-ID warning flag uses `param-&gt;id &amp; 1u`, which maps IDs 2 and 3 to separate flags. `TestMasteringUnknownControl` in `tests/Ngs2SamplerTests.cpp` sends a 16-byte header with a 2-element zeroed payload for `0x30000002` and `0x30000003`, checks both return `OK`, and is called from `main`. The objectives report an in-game test where control `0x30000002` was ignored and the game then stopped on `0x30000003`. Control 3 handling is therefore needed for the reported startup path. The issue's expected outcome, that the game reaches the logos, is a runtime result. No retest result is provided, so that outcome is not verified. The coding requirement to remove the fatal failure is implemented and covered by a test. </dd> </dl> </details> <details> <summary><strong>Full details: Out of Scope Changes check</strong></summary> <dl> <dd> <br> **Explanation** The whole-PR diff touches only `src/libs/ngs2.cpp` and `tests/Ngs2SamplerTests.cpp`. The source change adds two case labels that share one warning and break path. Control 3 is included because the reported in-game test stopped on `0x30000003` after control 2 was accepted. This links the change to `#2252`. The test adds one function that covers both controls and one call in `main`. No unrelated files or hunks appear. The controls are ignored, not emulated, which matches the PR description. The PR description still mentions only control 2, but the current code and test cover control 3 as well. This is a stale description, not an unrelated change. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2364)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/2638b1b07613dc32a4708d2cd61a75711b84b6cf/.coderabbit.yaml>) - **Commit**: [2638b1b](<https://github.com/KytyPS5/KytyPS5/commit/2638b1b07613dc32a4708d2cd61a75711b84b6cf>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `128941c7-c0e5-483f-af8f-7f74acd80b3d` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 8a8f53ba9d3ca5f7192fa0e55d9cdd932770ff9c and bb2840be4cbb1520cda57f402cc716ecdbc4fc4e. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</strong></summary> <dl> <dd> <br> * `src/libs/ngs2.cpp` * `tests/Ngs2SamplerTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 22:47 UTC · original · edited 2026-11-21 11:07 UTC
On src/libs/ngs2.cpp line 3003 (outdated):

@@ -2996,6 +2996,18 @@ int KYTY_SYSV_ABI Ngs2VoiceControl(uintptr_t voice_handle, const Ngs2VoiceParamH
 						                            matrix->levels + matrix->num_levels);
 						break;
 					}
+					case 2: {
+						// Seen from Trackmania (PPSA02195) with an 8-byte payload; its meaning
+						// is unknown, so it is accepted and ignored.
+						static bool warned = false;
+						if (!warned) {

Minor · Stability & Availability · Quick win

Use an atomic exchange for the one-time mastering control warning.

The warned flag is a plain static bool shared by all callers. Each caller holds only its own system's lock (voice->rack->ngs->mutex), so calls on voices from different systems can access warned at the same time. That is a data race. It can also log the warning more than once.

Replace the flag with an atomic. exchange sets the flag and returns the previous value, so exactly one call logs the warning.

Suggested fix

--- "a/src/libs/ngs2.cpp"
+++ "b/src/libs/ngs2.cpp"
@@ -2999,13 +2999,12 @@
 					case 2: {
 						// Seen from Trackmania (PPSA02195) with an 8-byte payload; its meaning
 						// is unknown, so it is accepted and ignored.
-						static bool warned = false;
-						if (!warned) {
+						static std::atomic_bool warned{false};
+						if (!warned.exchange(true)) {
 							Log::WriteToConsoleAndLog(fmt::sprintf(
 							    "warning: NGS2 mastering control 0x%08" PRIx32 " is ignored\n",
 							    param->id));
-							warned = true;
 						}
 						break;
 					}
 					case 4: {

✅ Addressed in commit bb2840b

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#discussion_r4606835936) · edited 2026-11-21 11:07 UTC On `src/libs/ngs2.cpp` line 3003 (outdated): ```diff @@ -2996,6 +2996,18 @@ int KYTY_SYSV_ABI Ngs2VoiceControl(uintptr_t voice_handle, const Ngs2VoiceParamH matrix->levels + matrix->num_levels); break; } + case 2: { + // Seen from Trackmania (PPSA02195) with an 8-byte payload; its meaning + // is unknown, so it is accepted and ignored. + static bool warned = false; + if (!warned) { ``` <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/amber-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minor** · **Stability & Availability** · **Quick win** **Use an atomic exchange for the one-time mastering control warning.** The `warned` flag is a plain `static bool` shared by all callers. Each caller holds only its own system's lock (`voice->rack->ngs->mutex`), so calls on voices from different systems can access `warned` at the same time. That is a data race. It can also log the warning more than once. Replace the flag with an atomic. `exchange` sets the flag and returns the previous value, so exactly one call logs the warning. <details> <summary>Suggested fix</summary> <dl> <dd> <br> ```diff --- "a/src/libs/ngs2.cpp" +++ "b/src/libs/ngs2.cpp" @@ -2999,13 +2999,12 @@ case 2: { // Seen from Trackmania (PPSA02195) with an 8-byte payload; its meaning // is unknown, so it is accepted and ignored. - static bool warned = false; - if (!warned) { + static std::atomic_bool warned{false}; + if (!warned.exchange(true)) { Log::WriteToConsoleAndLog(fmt::sprintf( "warning: NGS2 mastering control 0x%08" PRIx32 " is ignored\n", param->id)); - warned = true; } break; } case 4: { ``` </dd> </dl> </details> <!-- fingerprinting:phantom:triton:okapi --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:1cec319f9f5eae1ef0b98d7e --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit bb2840b
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 22:47 UTC · original · reviewed

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2638b1b076 and 8a8f53ba9d.

Files selected for processing: 2

  • src/libs/ngs2.cpp
  • tests/Ngs2SamplerTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 22:47 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#pullrequestreview-5947919698) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/2638b1b07613dc32a4708d2cd61a75711b84b6cf/.coderabbit.yaml>) - **Commit**: [2638b1b](<https://github.com/KytyPS5/KytyPS5/commit/2638b1b07613dc32a4708d2cd61a75711b84b6cf>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `2717387e-e538-413e-a82b-6c75efa43f95` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 2638b1b07613dc32a4708d2cd61a75711b84b6cf and 8a8f53ba9d3ca5f7192fa0e55d9cdd932770ff9c. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 2</summary> <dl> <dd> <br> * `src/libs/ngs2.cpp` * `tests/Ngs2SamplerTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=4f1838a3-43f6-4a3e-96e7-c57645e2cced attempt=6fd9cd0b-09d0-4ea5-a5d1-5d40a1e94cfc batch=1/1 -->
Author
Owner

@⁠Ekt0re on GitHub · 2026-11-19 21:13 UTC · original

@⁠simonbronk Hi, I tested your fix!

The game crashes with the following error:

warning: NGS2 mastering control 0x30000002 is ignored
--- Build ---
Source build 5ad27cd-dirty
--- Error ---
unsupported mastering control: 0x30000003
 in D:/Projects/KytyPS5/src/libs/ngs2.cpp:3018

Without the crash, it is as follows:

Starting Trackmania date=2025-06-19_21_00 git=127527-9def2ceea10 GameVersion=3.3.0...
--- Build ---
Source build 5ad27cd-dirty
--- Error ---
unsupported mastering control: 0x30000002
 in D:/Progetti/KytyPS5/src/libs/ngs2.cpp:3006
**@⁠Ekt0re** on GitHub · 2026-11-19 21:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7022378570) @⁠simonbronk Hi, I tested your fix! **The game crashes with the following error:** ``` warning: NGS2 mastering control 0x30000002 is ignored --- Build --- Source build 5ad27cd-dirty --- Error --- unsupported mastering control: 0x30000003 in D:/Projects/KytyPS5/src/libs/ngs2.cpp:3018 ``` **Without the crash, it is as follows:** ``` Starting Trackmania date=2025-06-19_21_00 git=127527-9def2ceea10 GameVersion=3.3.0... --- Build --- Source build 5ad27cd-dirty --- Error --- unsupported mastering control: 0x30000002 in D:/Progetti/KytyPS5/src/libs/ngs2.cpp:3006 ```
Author
Owner

@⁠simonbronk on GitHub · 2026-11-21 11:08 UTC · original

Thanks for testing! I pushed bb2840be: mastering control 3 (0x30000003) is now accepted and ignored like control 2, and the warning flag is atomic per CodeRabbit's review. Could you retest? If another unsupported mastering control shows up, please post the id and I'll extend it.

**@⁠simonbronk** on GitHub · 2026-11-21 11:08 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7061691512) Thanks for testing! I pushed bb2840be: mastering control 3 (0x30000003) is now accepted and ignored like control 2, and the warning flag is atomic per CodeRabbit's review. Could you retest? If another `unsupported mastering control` shows up, please post the id and I'll extend it.
Author
Owner

@⁠Ekt0re on GitHub · 2026-11-21 13:20 UTC · original

@⁠simonbronk Hi, I tested your fix!

Now there is a new error:

The game crashes with the following error:unsupported mastering control: 0x30000006
 in D:/Progetti/KytyPS5/src/libs/ngs2.cpp:3759
**@⁠Ekt0re** on GitHub · 2026-11-21 13:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7063204542) @⁠simonbronk Hi, I tested your fix! **Now there is a new error:** ``` The game crashes with the following error:unsupported mastering control: 0x30000006 in D:/Progetti/KytyPS5/src/libs/ngs2.cpp:3759 ```
Author
Owner

@⁠Ekt0re on GitHub · 2026-11-21 13:36 UTC · original

Hey, I'm personally working on a fix for the game! And for the NGS2 module.

I'm using your fix and adding the following:


case 6: {
		static std::atomic<bool> warned = false;
		if (!warned.exchange(true)) {
			Log::WriteToConsoleAndLog(fmt::sprintf(
			    "warning: NGS2 mastering control 0x%08" PRIx32 " is ignored\n",
			    param->id));
		}
		break;
	}

I was able to access the game menus.

I encountered an infinite loop caused by:
Unresolved import stub called: IZ-qjhRqvjk[Http2_v1][Http2_v1.1][Func]

By disabling it online in the emulator settings, I got past the login screen and reached a crash:


warning: NGS2 custom control 0x40001300 is ignored
warning: NGS2 custom control 0x40001300 is ignored
warning: NGS2 custom control 0x40001300 is ignored
warning: NGS2 custom control 0x40001300 is ignored
--- Fatal Error ---
Not implemented (format.waveform_type != 0x12) in D:/Progetti/KytyPS5/src/libs/ngs2.cpp:1220
**@⁠Ekt0re** on GitHub · 2026-11-21 13:36 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7063418969) Hey, I'm personally working on a fix for the game! And for the NGS2 module. I'm using your fix and adding the following: ``` case 6: { static std::atomic<bool> warned = false; if (!warned.exchange(true)) { Log::WriteToConsoleAndLog(fmt::sprintf( "warning: NGS2 mastering control 0x%08" PRIx32 " is ignored\n", param->id)); } break; } ``` **I was able to access the game menus.** I encountered an infinite loop caused by: `Unresolved import stub called: IZ-qjhRqvjk[Http2_v1][Http2_v1.1][Func]` By disabling it online in the emulator settings, I got past the login screen and reached a crash: ``` warning: NGS2 custom control 0x40001300 is ignored warning: NGS2 custom control 0x40001300 is ignored warning: NGS2 custom control 0x40001300 is ignored warning: NGS2 custom control 0x40001300 is ignored --- Fatal Error --- Not implemented (format.waveform_type != 0x12) in D:/Progetti/KytyPS5/src/libs/ngs2.cpp:1220 ```
Author
Owner

@⁠Ekt0re on GitHub · 2026-11-21 13:52 UTC · original · edited 2026-11-21 13:53 UTC

Bug fix: Not implemented (format.waveform_type != 0x12) in src/libs/ngs2.cpp:1220

The error was caused by the fact that the NGS2 Sampler assumed that all linear PCM streams were exclusively 16-bit (0x12 / SCE_NGS2_WAVEFORM_TYPE_PCM_I16L). When a game (such as Trackmania) or an application configures the voice with another standard PCM format (for example, 0x18 for 32-bit floating-point PCM, 0x11 for 8-bit, 0x14 for 24-bit, 0x16 for 32-bit integer, 0x1a for 64-bit floating-point), the strict check EXIT_NOT_IMPLEMENTED(format.waveform_type != 0x12) would halt execution.

image
**@⁠Ekt0re** on GitHub · 2026-11-21 13:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7063643537) · edited 2026-11-21 13:53 UTC Bug fix: Not implemented (format.waveform_type != 0x12) in src/libs/ngs2.cpp:1220 The error was caused by the fact that the NGS2 Sampler assumed that all linear PCM streams were exclusively 16-bit (0x12 / SCE_NGS2_WAVEFORM_TYPE_PCM_I16L). When a game (such as Trackmania) or an application configures the voice with another standard PCM format (for example, 0x18 for 32-bit floating-point PCM, 0x11 for 8-bit, 0x14 for 24-bit, 0x16 for 32-bit integer, 0x1a for 64-bit floating-point), the strict check EXIT_NOT_IMPLEMENTED(format.waveform_type != 0x12) would halt execution. <img width="1276" height="752" alt="image" src="https://github.com/user-attachments/assets/a9bf9b35-4ff1-4b82-bd85-4ac26e030a6b" />
Author
Owner

@⁠Ekt0re on GitHub · 2026-11-21 15:27 UTC · original

@⁠simonbronk Hi, I've created a pull request with the fix I made for Trackmania, which extends NGS2. (I've added you as a collaborator.)
Link: https://git.gtahub.st/github/KytyPS5--KytyPS5/pulls/2493

**@⁠Ekt0re** on GitHub · 2026-11-21 15:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7064886919) @⁠simonbronk Hi, I've created a pull request with the fix I made for Trackmania, which extends NGS2. (I've added you as a collaborator.) Link: [https://git.gtahub.st/github/KytyPS5--KytyPS5/pulls/2493](https://git.gtahub.st/github/KytyPS5--KytyPS5/pulls/2493)
Author
Owner

@⁠simonbronk on GitHub · 2026-11-21 17:52 UTC · original

Thanks a lot for testing it and for going much further! #2493 covers my change and the rest of the NGS2 work, so I'll close this PR once yours is merged.

**@⁠simonbronk** on GitHub · 2026-11-21 17:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7066819368) Thanks a lot for testing it and for going much further! #2493 covers my change and the rest of the NGS2 work, so I'll close this PR once yours is merged.
Author
Owner

@⁠lordra9-svg on GitHub · 2026-11-25 13:02 UTC · original

This branch looks superseded by main now. The controls it accepts-and-ignores are implemented there:

  • 0x30000002 is the LFE enable/cutoff: case 2 sets lfe_enable_flag and calls
    Ngs2SetMasteringLfe (src/libs/ngs2.cpp:4111-4116 on main), from
    e04070ad "ngs2: low-pass the mastering voice's LFE channel" (2026-11-23).
  • 0x30000003 is the limiter: case 3 sets limiter_enable_flag, threshold, attack and release
    (src/libs/ngs2.cpp:4118-4128), from 11dc92d6 "ngs2: limit the mastering voice with a linked
    32-sample peak limiter" (2026-11-23).
  • 0x30000006 is the peak meter detect type: case 6 (src/libs/ngs2.cpp:4139-4144), from
    bb1a4dbb "ngs2: meter the mastering voice's input and output peaks" (2026-11-23).

GitHub reports this branch CONFLICTING (base 2638b1b0, head bb2840be). Resolving it by
keeping the added case 2/case 3 would shadow the LFE filter and limiter with no-ops instead of
applying them.

Since #2493 already extends the NGS2 surface for Trackmania and covers the remaining controls,
closing this in favour of #2493 looks right; nothing from this branch is needed on current main.

**@⁠lordra9-svg** on GitHub · 2026-11-25 13:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2364#issuecomment-7163200030) This branch looks superseded by main now. The controls it accepts-and-ignores are implemented there: - `0x30000002` is the LFE enable/cutoff: `case 2` sets `lfe_enable_flag` and calls `Ngs2SetMasteringLfe` (`src/libs/ngs2.cpp:4111-4116` on main), from `e04070ad` "ngs2: low-pass the mastering voice's LFE channel" (2026-11-23). - `0x30000003` is the limiter: `case 3` sets `limiter_enable_flag`, threshold, attack and release (`src/libs/ngs2.cpp:4118-4128`), from `11dc92d6` "ngs2: limit the mastering voice with a linked 32-sample peak limiter" (2026-11-23). - `0x30000006` is the peak meter detect type: `case 6` (`src/libs/ngs2.cpp:4139-4144`), from `bb1a4dbb` "ngs2: meter the mastering voice's input and output peaks" (2026-11-23). GitHub reports this branch `CONFLICTING` (base `2638b1b0`, head `bb2840be`). Resolving it by keeping the added `case 2`/`case 3` would shadow the LFE filter and limiter with no-ops instead of applying them. Since #2493 already extends the NGS2 surface for Trackmania and covers the remaining controls, closing this in favour of #2493 looks right; nothing from this branch is needed on current main.
This pull request has changes conflicting with the target branch.
  • tests/Ngs2SamplerTests.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2364/head:github-bot/gh-2364'
git switch 'github-bot/gh-2364'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2364'
git switch 'github-bot/gh-2364'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2364'
git switch 'github-bot/gh-2364'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2364'
git switch 'main'
git merge --squash 'github-bot/gh-2364'
git switch 'main'
git merge --ff-only 'github-bot/gh-2364'
git switch 'main'
git merge 'github-bot/gh-2364'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.