Skip to content

feat: add configurable player name - #9

Merged
Producdevity merged 5 commits into
masterfrom
feat/config-player-name
Aug 4, 2026
Merged

feat: add configurable player name#9
Producdevity merged 5 commits into
masterfrom
feat/config-player-name

Conversation

@Producdevity

@Producdevity Producdevity commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Add a configurable player name for CODBOZ online play. We read player_name from config, validate it, and patch the game to replace the default "Player-%d". Falls back to "Player" if invalid.

  • New Features

    • New config key player_name (max 13 chars; letters, numbers, spaces, -, _, .).
    • Applied at load via s3e_host_player_name() and codboz_override_player_name().
    • Packaging and docs updated; defaults set to player_name=Player; README links cod-boz-online.
  • Bug Fixes

    • Config migration appends player_name with a leading newline to avoid corrupting existing configs.
    • Fix incremental builds by adding s3e_image.h and src/codboz_assets.c deps to s3e_config_test.

Written for commit d7346cb. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added configurable player names with a default of “Player.”
    • Player names support letters, numbers, spaces, hyphens, underscores, and periods, up to 13 characters.
    • Configured names are applied to supported multiplayer assets.
    • Existing configurations are updated while preserving current settings.
  • Documentation

    • Updated multiplayer configuration examples and online server references.
    • Documented player-name requirements and limits.
  • Bug Fixes

    • Invalid or overly long names safely fall back to “Player.”

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change adds configurable player names with validation and migration support. It exposes the name through the host API, patches relocated image references at runtime, updates examples and documentation, and adds configuration and image-patching tests.

Changes

Player Name Support

Layer / File(s) Summary
Player name configuration and migration
include/s3e_host.h, src/s3e_config.c, packaging/ports/codboz/..., README.md, tests/portmaster_launcher_test.sh, tests/s3e_config_test.c
The host stores, validates, and exposes player_name, with Player as the fallback. Packaging scripts, examples, documentation, and tests include the setting.
Runtime image player-name override
include/s3e_image.h, src/codboz_assets.c, src/main.c, tests/s3e_config_test.c, Makefile
The runtime validates BOZ image metadata and replaces the player-name reference with the configured name address. Tests cover valid and invalid signatures, and the test target links the implementation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant s3e_config
  participant main
  participant codboz_override_player_name
  participant LoadedImage
  s3e_config->>main: return configured player name
  main->>codboz_override_player_name: pass relocated image and name address
  codboz_override_player_name->>LoadedImage: validate metadata and patch reference
  LoadedImage-->>codboz_override_player_name: return patch status
  codboz_override_player_name-->>main: return success or failure
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding configurable player names.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/config-player-name

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

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai

cubic-dev-ai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

We've triggered an ultrareview automatically — Running ultrareview automatically — This PR introduces a configurable player name with memory patching of the game binary at specific offsets; a bug in offset validation or patching logic could crash the game or allow invalid names, affecting multiplayer identity and data integrity.. I'll post findings when complete.

An ultrareview is cubic's deepest review, catching hard-to-find bugs in the most critical PRs. It runs a longer, multi-pass analysis using cubic's most capable review models, and typically takes around 30 minutes. It consumes your team's reviewed-lines allowance at 3× the standard rate.

Automated ultrareviews are disabled by default. We triggered this run as part of your trial. Want cubic to do this for every high-risk PR? Enable auto-ultrareview in your settings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packaging/ports/codboz/CODBOZ.sh`:
- Around line 50-51: Update the player_name append logic in CODBOZ.sh to ensure
a line boundary before the new setting, including when the existing config lacks
a trailing newline. Add a launcher test covering config.txt ending with
voice_chat=1 without a final newline, and verify both settings remain separately
parsed.

In `@tests/s3e_config_test.c`:
- Around line 131-137: Update the test around codboz_override_player_name so the
invalid-format case reaches the format validation rather than failing earlier on
the patched relative reference. Either move the memory[format_offset] = 'X'
assertion before the successful patch, or restore the original relative
reference in memory before the second call, ensuring the test specifically
detects removal of memcmp validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d5aa47d4-477f-4ef8-a09a-50c6aa290d71

📥 Commits

Reviewing files that changed from the base of the PR and between 62123c3 and 023b894.

📒 Files selected for processing (12)
  • Makefile
  • README.md
  • include/s3e_host.h
  • include/s3e_image.h
  • packaging/ports/codboz/CODBOZ.sh
  • packaging/ports/codboz/README.md
  • packaging/ports/codboz/codboz/config.example.txt
  • src/codboz_assets.c
  • src/main.c
  • src/s3e_config.c
  • tests/portmaster_launcher_test.sh
  • tests/s3e_config_test.c

Comment thread packaging/ports/codboz/CODBOZ.sh Outdated
Comment thread tests/s3e_config_test.c Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultrareview completed in 16m 1s

1 issue found across 12 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/s3e_config_test.c">

<violation number="1" location="tests/s3e_config_test.c:117">
P2: The offset constants at the start of `test_player_name_patch` (`0x18f74c`, `0x18f60a`, `0x3af131`) duplicate the `PLAYER_NAME_REFERENCE_OFFSET`, `PLAYER_NAME_REFERENCE_PC_OFFSET`, and `PLAYER_NAME_FORMAT_OFFSET` enums defined in `src/codboz_assets.c`. If the game binary version changes and these offsets are updated in the implementation, nothing forces a corresponding update in the test — the test would silently verify against stale values. Consider moving these constants into a shared header (e.g., `s3e_image.h` or a new `codboz_patch_offsets.h`) so both the implementation and the test reference the same definitions.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread packaging/ports/codboz/CODBOZ.sh Outdated
Comment thread tests/s3e_config_test.c
}

static void test_player_name_patch(void) {
enum {

@cubic-dev-ai cubic-dev-ai Bot Aug 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The offset constants at the start of test_player_name_patch (0x18f74c, 0x18f60a, 0x3af131) duplicate the PLAYER_NAME_REFERENCE_OFFSET, PLAYER_NAME_REFERENCE_PC_OFFSET, and PLAYER_NAME_FORMAT_OFFSET enums defined in src/codboz_assets.c. If the game binary version changes and these offsets are updated in the implementation, nothing forces a corresponding update in the test — the test would silently verify against stale values. Consider moving these constants into a shared header (e.g., s3e_image.h or a new codboz_patch_offsets.h) so both the implementation and the test reference the same definitions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/s3e_config_test.c, line 117:

<comment>The offset constants at the start of `test_player_name_patch` (`0x18f74c`, `0x18f60a`, `0x3af131`) duplicate the `PLAYER_NAME_REFERENCE_OFFSET`, `PLAYER_NAME_REFERENCE_PC_OFFSET`, and `PLAYER_NAME_FORMAT_OFFSET` enums defined in `src/codboz_assets.c`. If the game binary version changes and these offsets are updated in the implementation, nothing forces a corresponding update in the test — the test would silently verify against stale values. Consider moving these constants into a shared header (e.g., `s3e_image.h` or a new `codboz_patch_offsets.h`) so both the implementation and the test reference the same definitions.</comment>

<file context>
@@ -101,6 +102,42 @@ static void test_voice_chat_opt_in(void) {
+}
+
+static void test_player_name_patch(void) {
+    enum {
+        reference_offset = 0x18f74c,
+        reference_pc_offset = 0x18f60a,
</file context>
Fix with cubic

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The game binary never changes. This loader support one exact version, and will never support any other version. Checksum of the apk is also locked

Comment thread Makefile
cubic-dev-ai Bot added 2 commits August 3, 2026 21:44
Incremental builds will now correctly rebuild s3e_config_test when
s3e_image.h changes, since both the test and codboz_assets.c include
this header.
Reorder test_player_name_patch to test format validation before
the successful patch. This ensures the memcmp guard is actually
tested, rather than failing early on the relative reference check.
@Producdevity
Producdevity merged commit 4445392 into master Aug 4, 2026
5 checks passed
@Producdevity
Producdevity deleted the feat/config-player-name branch August 4, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant