#command-line #wrapper #lm #smw #lunar-magic

lunar-magic-wrapper

A lightweight wrapper around the command line functionality of Lunar Magic, a commonly used Super Mario World editor

2 releases (1 stable)

1.0.0 Jul 28, 2024
0.1.0 Jul 25, 2024

#242 in Text editors

MIT/Apache

34KB
463 lines

Lunar Magic Wrapper

A lightweight wrapper around the command line functionality of Lunar Magic, a commonly used Super Mario World editor.

For details on usage check the documentation.

Note that this is Windows only for now and relies on invoking cmd since Lunar Magic isn't particularly well-behaved on the command line.


lib.rs:

This crate provides a lightweight wrapper around Lunar Magic's command line functions. It supports all available command line functions as of Lunar Magic 3.40.

Note that this crate currently only works on Windows and relies on cmd to invoke Lunar Magic, as this is currently the only way I'm aware of to capture its text output.

Paths passed to functions can be any type that can be turned into AsRef<Path>, e.g., the following will all work equally well:

 # use lunar_magic_wrapper::Wrapper;
 # use std::path::Path;
 # let lm_wrapper = Wrapper::new("C:/lunar_magic.exe");
 // `&str` works fine
 let output = lm_wrapper.export_gfx("C:/hacks/my_project/my_hack.smc");

 // So does a `Path`
 let output = lm_wrapper.export_gfx(Path::new("C:/hacks/my_project/my_hack.smc"));

 // So does a `String`
 let output = lm_wrapper.export_gfx(String::from("C:/hacks/my_project/my_hack.smc"));

 // And so on

Dependencies

~1.6–10MB
~114K SLoC