libCes CP932 fix for Windows/macOS, fix SaveDataDialog lockups #878
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!878
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/878/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@EmK530 on GitHub · 2026-09-27 22:53 UTC · original
EmK530:fix/neptunia-saves→main· +409 −16 · 6 files · 5 commits · merged 2026-09-28 14:42 UTCCommits
caf66f4: Fix libCesConvertMbcsToUtf8failing on a CP932 codepage on Windows/macOS.ConvertMbcsToUtf8would previously crash in Neptunia ReVerse on save from the assertion:EXIT_IF(converter == reinterpret_cast<SDL_iconv_t>(-1));. On Windows and macOS,SDL_iconv_openis compiled using SDL3's own minimal implementation, so the converters it creates only support ASCII/Latin-1/UTF/UCS leading to a failure on the CP932 codepage.This commit replaces the usage of
SDL_iconv_openwith a platform-specific layer.Windows: Handles CP932 conversion with Win32 APIs.
macOS: macOS builds edited to link
iconv,CesIconvOpenwill directly call POSIX iconv which supports CP932.Linux: Untouched, directly maps to
SDL_iconv_openas it is compiled to support CP932 on Linux.ecf21a4: Report SaveDataDialog as running for one check before reporting as finished.Observed: After the CP932 crash was solved by commit
caf66f4, Neptunia ReVerse would get stuck trying to save and repeatedly calledSaveDataDialogOpen. It did not expect an immediate FINISHED status to be given bySaveDataDialogUpdateStatusright after a dialog open and would endlessly attempt to re-open the save data dialog.This commit changes the
SaveDataDialogOpenfunction to set the global status to RUNNING, and the status is later set to FINISHED on UpdateStatus when the guest has read the running status once.Testing
I have only been able to verify the libCes solution as functioning for Windows. Linux is untouched but I do not have a macOS environment to test games against.
AI usage
AI was involved in the process of investigating issues and was responsible for implementing changes. I have studied the changes in post and wrote this PR myself.
SDL3's SDL_SYSTEM_ICONV build option defaults off on Windows and macOS, so SDL falls back to its own bundled iconv there, which only implements ASCII/Latin-1/UTF/UCS. SDL_iconv_open("UTF-8", "CP932") always failed as a result, crashing games that convert Shift-JIS strings via sceCesMbcsStrToUtf8Str (e.g. save-data dialogs). Add a small CesIconv shim selected at compile time: Windows converts one character at a time via the Win32 codepage-932 APIs, replicating SDL_iconv's chunked semantics and error codes; macOS calls real POSIX iconv directly, since libiconv is always present there and does support CP932, unlike SDL's fallback. Linux is untouched, since SDL already links real system iconv by default there. Co-Authored-By: Claude Sonnet 5 <[email protected]>@coderabbitai[bot] on GitHub · 2026-09-27 22:59 UTC · original · edited 2026-09-27 23:24 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough
The save-data dialog now reports RUNNING on its first status poll, then reports FINISHED on later polls. MBCS-to-UTF-8 conversion now uses a platform-specific converter behind a shared iconv-compatible interface. Windows uses Win32 CP932 conversion, macOS uses POSIX iconv, and other platforms use SDL iconv wrappers. The full-emulator test target helper and
kyty_emulatortarget now link againsticonvon Apple platforms.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Bug fix
Merge Risk: 🟡 Moderate · up to
9f898Windows CP932 conversion remains unusable for valid input and should be corrected before merging.
Architecture Summary
Architecture risk: 🔵 Low · up to
9f898The change affects 2 systems.
Changed systems:
src,CMakeLists.txtArchitecture concerns
No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
SAVE_STATUS_RUNNINGconstant with value2.SaveDataDialogUpdateStatusnow snapshots and returns the current status before changingRUNNINGtoFINISHED; previously it returned the stored status without advancing it.SaveDataDialogOpennow sets the dialog status toRUNNINGinstead of immediately setting it toFINISHED.errno.h/iconv.hon macOS.🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (1 skipped: 1 unsupported.)
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 helpto get the list of available commands.@EmK530 on GitHub · 2026-09-27 23:18 UTC · original
Correction: libiconv is not always shipped. CMakeLists.txt is now changed to add the link library
iconvon macOS builds for this implementation.@coderabbitai[bot] on GitHub · 2026-09-27 23:23 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
6b6101c0-7c1e-4ae9-beb7-8164a077cbb7📥 Commits
Reviewing files that changed from the base of the PR and between
b59677901aand9f8984ca9b.📒 Files selected for processing (1)
CMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.