Coder Social home page Coder Social logo

parkerokonek / paradoxpatcher Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 349 KB

Parker's Paradox Patcher

License: MIT License

Rust 99.50% Shell 0.50%
paradox-interactive crusader-kings-ii crusader-kings-2 ck2 modding-tools mod parker-paradox-patcher eu4 hoi4 ck3

paradoxpatcher's Introduction

Parker's Paradox Patcher

GUI Build CLI Build Tests

This project is mostly aimed at generating large Crusader Kings 2 modpacks for private use. The patcher reads the settings.txt file of the game and uses those mods as the list to determine mod conflicts and what mod content to package. By default, the patcher will only generate a mod that contains the files which conflicted and an accompanying .mod description file that lists its dependencies to ensure load order.

These patches seem to work for most mods, but run into issues specifically with overhaul mods, or other mods which conflict in the same files as their specified replacement paths.

Using the extract flag is recommended, as it ensures that every person using the modpack has identical data and only needs to enable a single mod.

Building

The current state of the project is experimental at best. Requires rust's cargo/rustup to compile.

Install cargo and clone the repository.

CLI Interface

cd /path/to/repository
cargo build --release --features command-line --bin merger-cli

GUI Interface

Requires the GTK-3 dev libraries for your OS or distribution.

On Arch:

# pacman -S gtk3

On Ubuntu:

# apt install libgtk-3-dev

On Windows:

Install the gtk3 libraries using MSYS2

After installing the dependencies run cargo using the following flags.

and then build using:

cargo build --release --features gui-interface --bin merger-gui

Usage

CLI Usage

USAGE:
    paradoxmerger [FLAGS] [OPTIONS] <patch_name> [game_id]

FLAGS:
    -d, --dry-run    list file conflicts without merging
    -x, --extract    extract all non-conflicting files to a folder
    -h, --help       Prints help information
    -V, --version    Prints version information
    -v, --verbose    print information about processed mods

OPTIONS:
    -c, --config <CONFIG_FILE>    configuration file to load, defaults to current directory

ARGS:
    <patch_name>    name of the generated mod
    <game_id>       game in the config to use

An example merging mod conflicts for CK2 using the supplied config file.

cd PATH/TO/MERGER
paradoxmerger "Merged Patch" CK2

Appendix

Diff Match Patch: library used for diffing mod files and patching them together

paradox-tools: a set of Paradox modding utilities written in Ruby

cwtools: a library for manipulating Paradox scripts written in F#

Pdoxcl2Sharp: a C# library for parsing and manipulating Paradox scripts

paradoxpatcher's People

Contributors

parkerokonek avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

songorlick

paradoxpatcher's Issues

Clean-up Function Parameters, Standardize Arguments and Options

Currently function parameters are a bit of a mess and could use standardization. At minimum all public facing options should only really call the current configuration option. The Arguments for a per run should either be solidified as the main application options (and include the configuration in them) or be integrated with the current configuration with a builder or similar.

Add New Functionality to Paradox mods

Allow for stand-alone files in mod structure or in-line commented out code in otherwise typical Paradox mod files that allow for:

  • defining flags/mod presence (DEFINE flag_name, LET a = 0, INCR 0, SET a = 3, etc)
  • Making conditionals based off the presence of these flags or values (IFDEF, IFNDEF, IF, ELSE, NOR, etc)
  • execute regex or uncomment/comment specific strips of code scoped to certain files or folders (REPLACE orthodox heterodox)

Diff Match Patch Doesn't Always Fail

Diff Match Patch will reliably patch conflicting file changes without issue. This causes some information to be lost and for malformed files.

For example, patching Bob to Bib and Bob to Beb results in Bob being Beb, not a failure to patch.

Support for New Paradox Game Launcher

Currently the tool is built around Paradox's old launcher, this is fine for games like CK2 or Vic2, but will need to be changed to support games like EU4. This may be possible with a weird config set-up with the current tool, but this should be built-in functionality.

Allow Users to Select their Mods

For the GUI, there should be a mod organizer style screen where users can enable which mods they wish to use. As the purpose of the program is to resolve conflicts, not do load order, no load order will be available.

Remove Pyo3 / Python & DMP dependency

There does exist an implementation/wrapper for Diff Match Patch for Rust, here.

Need to try rewriting with this crate to reduce the number of explicitly installed requirements for users, and decreasing over all code spaghetti factor.

Look into Parallelizing

Rayon is one library for data parallelism that could be useful for speeding up the merging and conflict detection on mods. Not sure that this would have any improvement for indexing or generating the initial mod list, that is mostly file IO.

Inconsistency When Loading Folder Mods

Had some issues when merging files from mods in folders (Paradox Forums). Will need to see if there is an issue in the directory walking code, single file read code, or the all path read code.

Allow Reading of Diffs

Allow mods to contain diffs or patches of vanilla files instead of the literal file text.

Update Tests for Library

Tests need to be updated to reflect newly added functionality and to cover all of main library files.

Finish and Polish GTK Interface

To-do functionality:

  • Conflict scanning
  • Displaying which mods conflict where
  • UI for adding and modifying game presets
  • folder search dialog for patch output
  • warnings for when mods fail to load/patch
  • save user load order to launcher files

Multiple Encodings for Sources Garble Localization

In Ck2, text files for mods are expected to be in Windows-1252 encoding, certain mods or base game files (on Linux or MacOS) may be encoded in UTF-8. In the base game and with unmerged mods this poses no issue, but all mods need to be transliterated into a standard encoding (UTF-8) for doing file comparisons before being exported into the preferred encoding for each game.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.