KotOR Script Decompiler - A decompiler for Knights of the Old Republic NCS script files.
This project follows standard Maven directory layout conventions:
.
├── pom.xml # Maven project configuration
├── src/
│ ├── main/
│ │ ├── java/ # Main Java source code
│ │ │ └── com/
│ │ │ └── kotor/
│ │ │ └── resource/
│ │ │ └── formats/
│ │ │ └── ncs/
│ │ └── resources/ # Main resources (config files, data files)
│ │ ├── com/kotor/resource/formats/ncs/
│ │ │ ├── lexer/lexer.dat
│ │ │ └── parser/parser.dat
│ │ ├── k1_nwscript.nss
│ │ ├── tsl_nwscript.nss
│ │ └── nwscript.sablecc
│ └── test/
│ ├── java/ # Test Java source code
│ │ └── com/kotor/resource/formats/ncs/
│ └── resources/ # Test resources
├── scripts/ # Build and utility scripts
├── docs/ # Documentation files
└── lib/ # External JAR dependencies (legacy, now managed by Maven)- Java Development Kit (JDK) 8 or later
- Apache Maven 3.6.0 or later (optional, for Maven builds)
- PowerShell Core 6+ (for cross-platform build scripts) or Windows PowerShell 5.1+ (Windows only)
- PowerShell Core works on Windows, macOS, and Linux
- Download from: https://github.com/PowerShell/PowerShell/releases
Note: These scripts work on Windows, macOS, and Linux when using PowerShell Core 6+.
# Build JAR file only
.\scripts\build.ps1
# Build JAR and self-contained executable (requires JDK 14+ with jpackage)
# On Windows: creates .exe
# On macOS: creates .app
# On Linux: creates executable binary
.\scripts\build.ps1 -BuildExecutable
# Show build script help
.\scripts\build.ps1 -Help
# Build and publish distribution package
.\scripts\publish.ps1The PowerShell build script will:
- Automatically clean up old build artifacts (.class files, build directory, JAR)
- Compile all Java source files from
src/main/java - Copy resources from
src/main/resourcesto the build directory - Create a JAR file named
NCSDecompCLI.jarin the project root - Optionally create self-contained executables (when using
-BuildExecutable) - Automatically detect the platform and use appropriate settings
# Compile the project
mvn compile
# Run tests
mvn test
# Package the application (creates JAR file)
mvn package
# Clean build artifacts
mvn clean
# Full clean and build
mvn clean packageThe Maven build process will:
- Compile all Java source files from
src/main/java - Copy resources from
src/main/resourcesto the output directory - Run all tests from
src/test/java - Create a JAR file in the
target/directory - Create a fat JAR (with dependencies) named
nCSDecompCLI-1.0.2.jar
# Run the CLI application
mvn exec:java -Dexec.mainClass="com.kotor.resource.formats.ncs.NCSDecompCLI" -Dexec.args="[arguments]"# After building with PowerShell script
java -jar NCSDecompCLI.jar [arguments]
# Or after building with Maven
java -jar target/nCSDecompCLI-1.0.2.jar [arguments]Note: When using the JAR file, ensure k1_nwscript.nss or tsl_nwscript.nss is in the tools/ directory (or current working directory for legacy support), or use the --nwscript <path> option to specify the location.
See docs/README-CLI.md and docs/README-USER.md for detailed usage instructions.
- Source Code: All production Java code is in
src/main/java/ - Test Code: All test Java code is in
src/test/java/ - Resources: Configuration files, data files, and other resources are in
src/main/resources/ - Test Resources: Test-specific resources are in
src/test/resources/
The main package is com.kotor.resource.formats.ncs, which contains:
- Core decompiler logic
- Lexer and parser components
- Script node representations
- Stack and variable management
- Utility classes
Dependencies are managed through Maven. Add new dependencies to pom.xml in the <dependencies> section.
# Install maven via chocolatey
choco install maven -y
# Run all tests
mvn test
# Run a specific test class
mvn test -Dtest=NCSDecompCLIRoundTripTestCopyright 2021-2025 NCSDecomp Licensed under the Business Source License 1.1 (BSL 1.1). See LICENSE.txt file in the project root for full license information.
Original DeNCS Developers:
- JdNoa - Script Decompiler
- Dashus - GUI
Current Maintainer:
- th3w1zard1
Website: https://bolabaden.org Source Code: https://github.com/bolabaden