Code Monkey home page Code Monkey logo

chaudloader's Introduction

chaudloader

chaudloader is a mod loader for Mega Man Battle Network Legacy Collection.

For users

  1. Run install.exe.

  2. Start the game. Mods in the mods folder will be activated in alphabetical order.

For modders

Mods consists of the following files in a directory inside the mods folder:

  • info.toml: Required. Metadata about your mod. It should look something like this:

    title = "my cool mod"
    version = "0.0.1"
    authors = ["my cool name"]
  • init.lua: The Lua script to run on mod load.

Asset modding

In init.lua, you may use the following functions:

--
-- exe/data .dat file functions
--

-- Opens an exe/data .dat file located in exe/data (e.g. `exe6.dat`).
function chaudloader.ExeDat(dat_filename: string): ExeDat

-- Reads the contents of a file out of the .dat file.
--
-- Previous calls to write_exe_dat_contents are visible to subsequent calls to read_exe_dat_contents.
function chaudloader.ExeDat:read_file(path: string): string

-- Writes the file data into the .dat file.
--
-- Note that this does not mutate the original .dat file on disk, but for all intents and purposes to both the game and the mod loader it does.
function chaudloader.ExeDat:write_file(path: string, contents: string): string

--
-- .map + .mpak file functions
--

-- Unmarshals an .map + .mpak file.
function chaudloader.Mpak(map_contents: string, mpak_contents: string): Mpak

-- Inserts an entry at the given ROM address into the mpak. Existing entries will be clobbered. If contents is nil, the entry will be deleted.
function chaudloader.Mpak:__newindex(rom_addr: number, contents: string)

-- Reads an entry at the given ROM address.
function chaudloader.Mpak:__index(rom_addr: number): number

-- Iterates through all entries of an mpak.
function chaudloader.Mpak:__pairs(rom_addr: number): function(): (number, string)

-- Marshals an mpak back into .map + .mpak format.
function chaudloader.Mpak:to_raw(): (string, string)

--
-- Mod file functions
--

-- Reads the contents of a file from the mod folder.
function chaudloader.read_mod_file(path: string): string

-- Loads a library from the mod folder and call its chaudloader_init function.
--
--     chaudloader_init: unsafe extern "system" fn(userdata: *const u8, n: usize) -> bool
function chaudloader.init_mod_dll(path: string, userdata: string)

--
-- Utility functions
--

-- Print a log line.
function print(...)

For instance, for a simple font mod, you can write the following script:

local exe6_dat = chaudloader.ExeDat("exe6.dat")
local exe6f_dat = chaudloader.ExeDat("exe6f.dat")

local font = chaudloader.read_mod_file("eng_mojiFont.fnt")

exe6_dat.write_file("exe6/data/font/eng_mojiFont.fnt", font)
exe6f_dat.write_file("exe6f/data/font/eng_mojiFont.fnt", font)

Mods are order dependent: the DAT contents written by a previous mod will be visible to a subsequent mod.

Legacy bnlc_mod_loader API
-- Reads the contents of a file out of a .dat file located in exe/data (e.g. `exe6.dat`).
--
-- Previous calls to write_exe_dat_contents are visible to subsequent calls to read_exe_dat_contents.
function bnlc_mod_loader.read_exe_dat_contents(dat_filename: string, path: string): string

-- Writes the given data into a zip .dat file located in exe/data.
--
-- Note that this does not mutate the original .dat file on disk, but for all intents and purposes to both the game and the mod loader it does.
function bnlc_mod_loader.write_exe_dat_contents(dat_filename: string, path: string, contents: string)

-- Reads the contents of a file from the mod folder.
function bnlc_mod_loader.read_mod_contents(path: string): string

For developers

Build the binary with cargo build --release. You will need nightly Rust.

chaudloader's People

Contributors

bigfarts avatar

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.