Skip to content

Commit 958e20c

Browse files
LordLuceusclaude
andcommitted
refactor!: Rename library from MelonAccessibilityLib to UnityAccessibilityLib
BREAKING CHANGE: Package and namespace renamed for framework-agnostic usage. - Rename namespace from MelonAccessibilityLib to UnityAccessibilityLib - Update NuGet package ID to UnityAccessibilityLib - Rename .csproj and .sln files - Update README with both MelonLoader and BepInEx examples - Add migration instructions for existing users Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9da0dd7 commit 958e20c

11 files changed

Lines changed: 91 additions & 50 deletions

CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
MelonAccessibilityLib is a C# library that adds screen reader accessibility to Unity games via MelonLoader mods. It provides speech and braille output, text cleaning utilities, and P/Invoke wrappers for UniversalSpeech with SAPI fallback.
7+
UnityAccessibilityLib is a C# library that adds screen reader accessibility to Unity games. It works with any Unity mod framework (MelonLoader, BepInEx, etc.) and provides speech and braille output, text cleaning utilities, and P/Invoke wrappers for UniversalSpeech with SAPI fallback.
88

99
## Build Commands
1010

@@ -24,20 +24,20 @@ dotnet build -c Release
2424
dotnet pack -c Release
2525
```
2626

27-
Build outputs are located at `bin/{Debug|Release}/{net6.0|net472|net35}/MelonAccessibilityLib.dll`.
27+
Build outputs are located at `bin/{Debug|Release}/{net6.0|net472|net35}/UnityAccessibilityLib.dll`.
2828

2929
## Publishing a Release
3030

3131
To publish a new version to NuGet:
3232

33-
1. **Bump the version** in `MelonAccessibilityLib.csproj`:
33+
1. **Bump the version** in `UnityAccessibilityLib.csproj`:
3434
```xml
3535
<Version>1.1.0</Version>
3636
```
3737

3838
2. **Commit and tag** the release:
3939
```bash
40-
git add MelonAccessibilityLib.csproj
40+
git add UnityAccessibilityLib.csproj
4141
git commit -m "chore: Bump version to 1.1.0"
4242
git tag v1.1.0
4343
```
@@ -67,7 +67,7 @@ No test framework is currently configured. If adding tests, use standard `dotnet
6767
### Data Flow
6868

6969
```
70-
Consumer (MelonMod)
70+
Consumer (MelonMod, BepInEx Plugin, etc.)
7171
7272
├─ Sets AccessibilityLog.Logger
7373
├─ Calls SpeechManager.Initialize()
@@ -93,7 +93,7 @@ Consumer (MelonMod)
9393
- All public classes are static (no instance creation)
9494
- Private fields use `_camelCase` prefix
9595
- P/Invoke constants use `ALL_CAPS`
96-
- Single namespace: `MelonAccessibilityLib`
96+
- Single namespace: `UnityAccessibilityLib`
9797
- Comprehensive XML documentation on all public members
9898
- Multi-target build: net35 is limited to C# 7.3 features
9999

IAccessibilityLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace MelonAccessibilityLib
1+
namespace UnityAccessibilityLib
22
{
33
/// <summary>
44
/// Simple logging interface for accessibility output.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025
3+
Copyright (c) 2026
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Net35Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace MelonAccessibilityLib
1+
namespace UnityAccessibilityLib
22
{
33
/// <summary>
44
/// Polyfills for .NET 3.5 compatibility.

Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
33

4-
[assembly: AssemblyTitle("MelonAccessibilityLib")]
4+
[assembly: AssemblyTitle("UnityAccessibilityLib")]
55
[assembly: AssemblyDescription(
6-
"A reusable library for adding screen reader accessibility to Unity games via MelonLoader mods"
6+
"A reusable library for adding screen reader accessibility to Unity games"
77
)]
88
[assembly: AssemblyCompany("")]
9-
[assembly: AssemblyProduct("MelonAccessibilityLib")]
9+
[assembly: AssemblyProduct("UnityAccessibilityLib")]
1010
[assembly: AssemblyCopyright("")]
1111
[assembly: AssemblyTrademark("")]
1212
[assembly: AssemblyCulture("")]

README.md

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# MelonAccessibilityLib
1+
# UnityAccessibilityLib
22

3-
A reusable library for adding screen reader accessibility to Unity games via MelonLoader mods.
3+
A reusable library for adding screen reader accessibility to Unity games. Works with MelonLoader, BepInEx, or any Unity mod framework.
44

55
## Features
66

77
- **UniversalSpeech integration** - P/Invoke wrapper for the UniversalSpeech library with SAPI fallback
88
- **Braille display support** - Automatic output to braille displays via screen reader
99
- **High-level speech manager** - Duplicate prevention, repeat functionality, speaker formatting
1010
- **Text cleaning** - Strips Unity rich text tags (`<color>`, `<size>`, `<b>`, etc.) with extensible custom replacements
11-
- **Logging abstraction** - Integrate with MelonLoader or any logging system
11+
- **Logging abstraction** - Integrate with any logging system (MelonLoader, BepInEx, custom)
1212
- **Multi-target support** - Builds for net6.0, net472, and net35 for broad compatibility with various games
1313

1414
## Requirements
@@ -17,47 +17,47 @@ A reusable library for adding screen reader accessibility to Unity games via Mel
1717
- One of:
1818
- .NET 6.0 (IL2CPP games with MelonLoader 0.6+)
1919
- .NET Framework 4.7.2 (Mono games)
20-
- .NET Framework 3.5 (older Mono games)
20+
- .NET Framework 3.5 (older Mono games, e.g. Unity 2017)
2121

2222
## Installation
2323

2424
### Option 1: NuGet Package (Recommended)
2525

2626
```bash
27-
dotnet add package MelonAccessibilityLib
27+
dotnet add package UnityAccessibilityLib
2828
```
2929

3030
Or add to your `.csproj`:
3131

3232
```xml
33-
<PackageReference Include="MelonAccessibilityLib" Version="1.0.0" />
33+
<PackageReference Include="UnityAccessibilityLib" Version="2.0.0" />
3434
```
3535

3636
### Option 2: Project Reference
3737

3838
Add the project to your solution and reference it:
3939

4040
```xml
41-
<ProjectReference Include="..\MelonAccessibilityLib\MelonAccessibilityLib.csproj" />
41+
<ProjectReference Include="..\UnityAccessibilityLib\UnityAccessibilityLib.csproj" />
4242
```
4343

4444
### Option 3: DLL Reference
4545

4646
Build the library and reference the DLL:
4747

4848
```xml
49-
<Reference Include="MelonAccessibilityLib">
50-
<HintPath>path\to\MelonAccessibilityLib.dll</HintPath>
49+
<Reference Include="UnityAccessibilityLib">
50+
<HintPath>path\to\UnityAccessibilityLib.dll</HintPath>
5151
</Reference>
5252
```
5353

5454
## Quick Start
5555

56-
### 1. Create a Logger Adapter
56+
### MelonLoader Setup
5757

5858
```csharp
5959
using MelonLoader;
60-
using MelonAccessibilityLib;
60+
using UnityAccessibilityLib;
6161

6262
public class MelonLoggerAdapter : IAccessibilityLogger
6363
{
@@ -72,19 +72,13 @@ public class MelonLoggerAdapter : IAccessibilityLogger
7272
public void Warning(string message) => _logger.Warning(message);
7373
public void Error(string message) => _logger.Error(message);
7474
}
75-
```
76-
77-
### 2. Initialize in Your Mod
7875

79-
```csharp
8076
public class MyAccessibilityMod : MelonMod
8177
{
8278
public override void OnInitializeMelon()
8379
{
84-
// Set up logging
8580
AccessibilityLog.Logger = new MelonLoggerAdapter(LoggerInstance);
8681

87-
// Initialize speech system
8882
if (SpeechManager.Initialize())
8983
{
9084
LoggerInstance.Msg("Speech system ready");
@@ -93,7 +87,43 @@ public class MyAccessibilityMod : MelonMod
9387
}
9488
```
9589

96-
### 3. Output Speech
90+
### BepInEx Setup
91+
92+
```csharp
93+
using BepInEx;
94+
using BepInEx.Logging;
95+
using UnityAccessibilityLib;
96+
97+
public class BepInExLoggerAdapter : IAccessibilityLogger
98+
{
99+
private readonly ManualLogSource _logger;
100+
101+
public BepInExLoggerAdapter(ManualLogSource logger)
102+
{
103+
_logger = logger;
104+
}
105+
106+
public void Msg(string message) => _logger.LogInfo(message);
107+
public void Warning(string message) => _logger.LogWarning(message);
108+
public void Error(string message) => _logger.LogError(message);
109+
}
110+
111+
[BepInPlugin("com.example.mymod", "MyAccessibilityMod", "1.0.0")]
112+
public class MyPlugin : BaseUnityPlugin
113+
{
114+
void Awake()
115+
{
116+
AccessibilityLog.Logger = new BepInExLoggerAdapter(Logger);
117+
118+
if (SpeechManager.Initialize())
119+
{
120+
Logger.LogInfo("Speech system ready");
121+
}
122+
}
123+
}
124+
```
125+
126+
### Output Speech
97127

98128
```csharp
99129
// Dialogue with speaker name
@@ -124,14 +154,14 @@ SpeechManager.RepeatLast();
124154
| `Stop()` | Stop current speech. |
125155
| `ClearRepeatBuffer()` | Clear stored repeat text. |
126156

127-
| Property | Description |
128-
| ------------------------------- | -------------------------------------------------------------- |
129-
| `DuplicateWindowSeconds` | Time window for duplicate suppression (default: 0.5s) |
130-
| `EnableLogging` | Whether to log speech output (default: true) |
131-
| `EnableBraille` | Whether to output to braille displays (default: true) |
132-
| `FormatTextOverride` | Custom delegate for text formatting (see Extensibility) |
133-
| `ShouldStoreForRepeatPredicate` | Custom predicate for repeat storage (see Extensibility) |
134-
| `TextTypeNames` | Dictionary mapping text type IDs to names for logging |
157+
| Property | Description |
158+
| ------------------------------- | ------------------------------------------------------- |
159+
| `DuplicateWindowSeconds` | Time window for duplicate suppression (default: 0.5s) |
160+
| `EnableLogging` | Whether to log speech output (default: true) |
161+
| `EnableBraille` | Whether to output to braille displays (default: true) |
162+
| `FormatTextOverride` | Custom delegate for text formatting (see Extensibility) |
163+
| `ShouldStoreForRepeatPredicate` | Custom predicate for repeat storage (see Extensibility) |
164+
| `TextTypeNames` | Dictionary mapping text type IDs to names for logging |
135165

136166
### TextType Constants
137167

@@ -189,6 +219,8 @@ TextCleaner.ClearAllCustomReplacements(); // Clear all
189219
```csharp
190220
// Set your logger implementation
191221
AccessibilityLog.Logger = new MelonLoggerAdapter(loggerInstance);
222+
// or
223+
AccessibilityLog.Logger = new BepInExLoggerAdapter(loggerInstance);
192224

193225
// Or create a simple console logger for testing
194226
AccessibilityLog.Logger = new ConsoleLogger();
@@ -280,6 +312,15 @@ Supported screen readers:
280312
- ZoomText
281313
- SAPI (fallback)
282314

315+
## Migrating from MelonAccessibilityLib
316+
317+
If you're upgrading from the old `MelonAccessibilityLib` package:
318+
319+
1. Update your NuGet package reference from `MelonAccessibilityLib` to `UnityAccessibilityLib`
320+
2. Update your `using` statements from `using MelonAccessibilityLib;` to `using UnityAccessibilityLib;`
321+
322+
No API changes - all classes and methods remain the same.
323+
283324
## License
284325

285326
MIT License - see [LICENSE](LICENSE) for details.

SpeechManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace MelonAccessibilityLib
3+
namespace UnityAccessibilityLib
44
{
55
/// <summary>
66
/// High-level speech output manager.

TextCleaner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Text;
33
using System.Text.RegularExpressions;
44

5-
namespace MelonAccessibilityLib
5+
namespace UnityAccessibilityLib
66
{
77
/// <summary>
88
/// Utility class to clean text for screen reader output.
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net6.0;net472;net35</TargetFrameworks>
4-
<AssemblyName>MelonAccessibilityLib</AssemblyName>
5-
<RootNamespace>MelonAccessibilityLib</RootNamespace>
4+
<AssemblyName>UnityAccessibilityLib</AssemblyName>
5+
<RootNamespace>UnityAccessibilityLib</RootNamespace>
66
<LangVersion>latest</LangVersion>
77
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
88
<!-- NuGet Package Metadata -->
9-
<PackageId>MelonAccessibilityLib</PackageId>
10-
<Version>1.1.1</Version>
9+
<PackageId>UnityAccessibilityLib</PackageId>
10+
<Version>2.0.0</Version>
1111
<Authors>LordLuceus</Authors>
12-
<Description>A reusable library for adding screen reader accessibility to Unity games via MelonLoader mods. Provides UniversalSpeech integration with SAPI fallback, text cleaning, and speech management.</Description>
13-
<PackageTags>accessibility;screen-reader;melonloader;unity;tts;speech;blind;visually-impaired</PackageTags>
12+
<Description>A reusable library for adding screen reader accessibility to Unity games. Works with MelonLoader, BepInEx, or any Unity mod framework. Provides UniversalSpeech integration with SAPI fallback, text cleaning, and speech management.</Description>
13+
<PackageTags>accessibility;screen-reader;unity;tts;speech;blind;visually-impaired;melonloader;bepinex</PackageTags>
1414
<PackageLicenseExpression>MIT</PackageLicenseExpression>
15-
<PackageProjectUrl>https://github.com/LordLuceus/MelonAccessibilityLib</PackageProjectUrl>
16-
<RepositoryUrl>https://github.com/LordLuceus/MelonAccessibilityLib</RepositoryUrl>
15+
<PackageProjectUrl>https://github.com/LordLuceus/UnityAccessibilityLib</PackageProjectUrl>
16+
<RepositoryUrl>https://github.com/LordLuceus/UnityAccessibilityLib</RepositoryUrl>
1717
<PackageReadmeFile>README.md</PackageReadmeFile>
1818
<!-- Include documentation -->
1919
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio Version 17
33
VisualStudioVersion = 17.5.2.0
44
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MelonAccessibilityLib", "MelonAccessibilityLib.csproj", "{4691AE2F-C3D6-DA66-AEA5-9357A38A6068}"
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityAccessibilityLib", "UnityAccessibilityLib.csproj", "{4691AE2F-C3D6-DA66-AEA5-9357A38A6068}"
66
EndProject
77
Global
88
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)