Skip to content

tbl localization documentation + minor cpk sorting change - #51

Merged
Sewer56 merged 3 commits into
Sewer56:masterfrom
oceanstuck:master
May 29, 2026
Merged

tbl localization documentation + minor cpk sorting change#51
Sewer56 merged 3 commits into
Sewer56:masterfrom
oceanstuck:master

Conversation

@oceanstuck

Copy link
Copy Markdown
Contributor
  • Adds documentation for localizing TBLs, as well as clarifying behavior when a localized TBL is not available
  • Separates list of base cpks in Mod_Merging.cs from list of Japanese cpks, as P5R uses a separate JP.CPK for Japanese files. This probably won't affect much, some files are duped across both though I doubt they have substantial differences, but this should prioritize JP.CPK anyway just to be sure

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR updates both documentation and code to improve TBL localization support. The documentation changes add a clarification note that certain language-dependent TBL files are ignored unless the game language matches, along with a new example section showing how to localize TBL changes by providing English TBLs in essentials and language-specific overrides. The code changes refactor base CPK naming by introducing a dedicated _baseCpkNames field, updating the Japanese CPK mapping from BASE.CPK to JP.CPK, and adjusting ForceBaseCpkSecond to use this centralized field instead of deriving names from language settings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title accurately summarizes both main changes: TBL localization documentation and the CPK sorting adjustment in Mod_Merging.cs.
Description check ✅ Passed The description is directly related to the changeset, explaining the two primary modifications: TBL localization documentation and CPK list separation.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@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.

🧹 Nitpick comments (1)
p5rpc.modloader/Mod_Merging.cs (1)

68-68: 💤 Low value

Misleading comment.

The comment states "force a specific cpk to be first" but the code swaps with position 1, making it second.

📝 Suggested fix
-    // Reorder array to force a specific cpk to be first
+    // Reorder array to force a specific cpk to be second
🤖 Prompt for 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.

In `@p5rpc.modloader/Mod_Merging.cs` at line 68, The comment "Reorder array to
force a specific cpk to be first" is misleading because the code swaps the
target element with position 1 (making it second); either update the comment to
accurately state it forces the cpk to be second, or change the swap index from 1
to 0 so the target becomes first; locate the swap in Mod_Merging.cs where the
code swaps the element with position 1 and either modify that index to 0 (to
make it first) or rewrite the comment to reflect the actual behavior.
🤖 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.

Nitpick comments:
In `@p5rpc.modloader/Mod_Merging.cs`:
- Line 68: The comment "Reorder array to force a specific cpk to be first" is
misleading because the code swaps the target element with position 1 (making it
second); either update the comment to accurately state it forces the cpk to be
second, or change the swap index from 1 to 0 so the target becomes first; locate
the swap in Mod_Merging.cs where the code swaps the element with position 1 and
either modify that index to 0 (to make it first) or rewrite the comment to
reflect the actual behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 41ad407e-4c1c-4421-b97d-9bab1849c6f6

📥 Commits

Reviewing files that changed from the base of the PR and between b657ef9 and a915d08.

⛔ Files ignored due to path filters (2)
  • docs/images/TblLocalizedExample1.png is excluded by !**/*.png
  • docs/images/TblLocalizedExample2.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • docs/usage.md
  • p5rpc.modloader/Mod_Merging.cs
📜 Review details
🧰 Additional context used
🪛 LanguageTool
docs/usage.md

[style] ~248-~248: Consider a more expressive alternative.
Context: ...ng in a language other than English. To do this you would first place an English-l...

(DO_ACHIEVE)

🔇 Additional comments (2)
docs/usage.md (1)

183-186: LGTM!

Also applies to: 246-255

p5rpc.modloader/Mod_Merging.cs (1)

11-11: 🏗️ Heavy lift

Fix CPK prioritization + misleading comment in Mod_Merging.cs

  • ForceBaseCpkSecond’s comment says it forces a CPK “to be first”, but it swaps into index 1 (second).
  • ForceCpkFirst uses a single Array.FindIndex with an OR across JP.CPK / DATA.CPK / data\\umd0.cpk, so if DATA.CPK is earlier in cpkFiles, it can get moved to index 0 ahead of JP.CPK.
  • Because MergeUtils.TryFindFileInAnyCpk iterates cpkFiles in order and returns on the first CPK containing filePath, this can change which CPK’s data gets used when the same path exists in multiple CPKs.

Use explicit priority ordering (e.g., pick JP.CPK index first, else DATA.CPK, else data\\umd0.cpk) instead of OR-ing all candidates into one FindIndex.

@Sewer56

Sewer56 commented May 27, 2026

Copy link
Copy Markdown
Owner

Looks good to me.
Second pair of eyes? @AnimatedSwine37

@AnimatedSwine37 AnimatedSwine37 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me too :)

@Sewer56
Sewer56 merged commit ccc1d7f into Sewer56:master May 29, 2026
2 checks passed
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.

3 participants