Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OldRepublicDevs/NCSDecomp

Repository files navigation

NCSDecomp

KotOR Script Decompiler - A decompiler for Knights of the Old Republic NCS script files.

Project Structure

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)

Building

Prerequisites

  • 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)

Build Options

Option 1: Using PowerShell Scripts (Cross-Platform)

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

The PowerShell build script will:

  1. Automatically clean up old build artifacts (.class files, build directory, JAR)
  2. Compile all Java source files from src/main/java
  3. Copy resources from src/main/resources to the build directory
  4. Create a JAR file named NCSDecompCLI.jar in the project root
  5. Optionally create self-contained executables (when using -BuildExecutable)
  6. Automatically detect the platform and use appropriate settings

Option 2: Using Maven

# 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 package

The Maven build process will:

  1. Compile all Java source files from src/main/java
  2. Copy resources from src/main/resources to the output directory
  3. Run all tests from src/test/java
  4. Create a JAR file in the target/ directory
  5. Create a fat JAR (with dependencies) named nCSDecompCLI-1.0.2.jar

Running

Using Maven

# Run the CLI application
mvn exec:java -Dexec.mainClass="com.kotor.resource.formats.ncs.NCSDecompCLI" -Dexec.args="[arguments]"

Using the JAR file

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

Usage

See docs/README-CLI.md and docs/README-USER.md for detailed usage instructions.

Development

Code Organization

  • 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/

Package Structure

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

Adding Dependencies

Dependencies are managed through Maven. Add new dependencies to pom.xml in the <dependencies> section.

Running Tests

# Install maven via chocolatey
choco install maven -y

# Run all tests
mvn test

# Run a specific test class
mvn test -Dtest=NCSDecompCLIRoundTripTest

License

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

Credits

Original DeNCS Developers:

  • JdNoa - Script Decompiler
  • Dashus - GUI

Current Maintainer:

  • th3w1zard1

Website: https://bolabaden.org Source Code: https://github.com/bolabaden

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •