This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Build the project:
dotnet buildorMSBuild DDLCPlusAccess.csproj - Clean build:
dotnet clean && dotnet build - Release build:
dotnet build --configuration Release
- Post-build automatically copies
DDLCPlusAccess.dllandUnityAccessibilityLib.dllto the DDLC PlusModsfolder - Launch DDLC Plus with MelonLoader to test
Main.cs - Main mod entry point (MelonMod)
- Initializes UnityAccessibilityLib (
SpeechManager,TextCleaner,AccessibilityLog) - Registers Ren'Py/TMP-specific text cleaning patterns with
TextCleaner.AddRegexReplacement() - Handles scene loading events
- Implements hotkeys:
- R key: Repeat last dialogue (
SpeechManager.RepeatLast()) - C key: Announce data collection percentage (in Settings app)
- P key: Announce jukebox position (in Jukebox app)
- Up/Down arrows: Navigate history entries (when history screen has focus) or lines in file content viewer
- R key: Repeat last dialogue (
ClipboardUtils.cs - Thin wrapper around UnityAccessibilityLib's SpeechManager
OutputGameText(speaker, text, textType)→SpeechManager.Output()orSpeechManager.Announce()OutputPoemText(text)→SpeechManager.Announce()RepeatCurrentDialogue()→SpeechManager.RepeatLast()- Maintains API compatibility with all patch files
GameTextType.cs - Text type constants and mapping
- Maps legacy
TextTypeenum to library'sTextTypeconstants - Defines custom types: PoetryGame, FileBrowser, Poem, Settings, Mail, Jukebox
- Provides
GetTextTypeNames()for logging andShouldStoreForRepeat()predicate
MelonLoggerAdapter.cs - Bridges MelonLoader logging to UnityAccessibilityLib
TextHelper.cs - Supplementary text processing utilities
CleanText()- WrapsTextCleaner.Clean()IsNarrativeText()- Determines if text is narrative (no speaker)
SpeakerMapping.cs - Speaker name resolution
GetLocalizedSpeakerName(tag, character)- Gets localized speaker name using game's localization system- Replicates game's exact logic from
RenpyWindowManager.Sayfor accurate speaker names - Handles player name (MC) via
GetPlayerName() ShouldFilterText()- Filters developer commentary and technical strings
DescriptionManager.cs - Centralized image description system
- Manages descriptions for gallery images (CGs, Wallpapers, Poems, Backgrounds, etc.)
- Provides lookup methods by image name or section
The mod uses Harmony to patch game methods. All patches output text via ClipboardUtils.OutputGameText():
| Patch File | Purpose |
|---|---|
DialoguePatches.cs |
Character dialogue via RenpyWindowManager.Say patch |
HistoryPatches.cs |
History screen navigation with Up/Down arrow keys |
MenuPatches.cs |
Menu navigation, choices, settings |
LauncherPatches.cs |
DDLC Plus launcher accessibility |
FileBrowserPatches.cs |
File browser navigation |
FileContentPatches.cs |
File content viewing |
PoetryPatches.cs |
Poetry minigame |
PoemPatches.cs |
Poem reading |
SideStoriesPatches.cs |
Side stories navigation |
GalleryPatches.cs |
Gallery navigation and descriptions |
ImagePatches.cs |
Background/CG announcements |
JukeboxPatches.cs |
Music player |
MailPatches.cs |
Email application |
SelectorPatches.cs |
Generic selector UI |
TextPatches.cs |
Fallback text capture |
Defined in GameTextType.cs (legacy enum in same file for patch compatibility):
- Dialogue (0): Character speech with speaker names
- Narrator (1): Descriptive text without speakers
- Menu (2): Menu navigation
- MenuChoice (3): Game choices
- SystemMessage (4): System notifications
- PoetryGame (101): Poetry minigame
- FileBrowser (102): File browser
- Poem (103): Poem content
- Settings (104): Settings values
- Mail (105): Email content
- Jukebox (106): Music player info
Text cleaning is handled by UnityAccessibilityLib's TextCleaner with custom patterns registered in ScreenReaderMod.RegisterTextCleanerPatterns():
- Ren'Py tags:
{w},{nw},{clear}, etc. (pattern:\{[^}]*\}) - TMP square bracket tags:
[color=...],[size=...],[b],[i], etc. - Special replacements: keyboard sprite → "Press Enter to Apply"
- .NET Framework 4.7.2 target
- UnityAccessibilityLib (NuGet) - Speech output, text cleaning, duplicate detection
- MelonLoader - Mod loading framework
- Harmony - Runtime method patching
- Unity Engine - Game engine APIs
- DDLC/RenpyParser - Game-specific assemblies
- Decompiled DDLC assemblies in
../Decompfolder for reference
- Identify the game method that displays the text
- Create Harmony patch in relevant Patches file
- Call
ClipboardUtils.OutputGameText(speaker, text, TextType.X) - Library handles text cleaning and duplicate detection automatically
- Identify the image asset name in the game
- Add description to appropriate file in
ImageDescriptions/folder - Dictionary key = asset name, value = description text
- Use MelonLoader console to monitor patch application and speech output
- Library logs all speech output with text type names
- All logging enabled by default
This mod improves game accessibility for blind and visually impaired players. All changes should:
- Preserve screen reader compatibility
- Maintain clear, descriptive text output
- Avoid excessive or duplicate announcements