A runtime lua injector for games built with LÖVE
A runtime lua injector for games built with LÖVE
Lovely is a lua injector which embeds code into a LÖVE 2d game at runtime. Unlike executable patchers, mods can be installed, updated, and removed over and over again without requiring a partial or total game reinstallation. This is accomplished through in-process lua API detouring and an easy to use (and distribute) patch system.
lovely-x86_64-pc-windows-msvc.zip.version.dll into the game directory. You can navigate to the game's directory by right-clicking the game in Steam, hovering "Manage", and selecting "Browse local files".Mods folder yourself, or launch Balatro with lovely installed once to create it automatically. If you are modding Balatro, this should be%AppData%/Balatro/Mods on Windows~/.steam/steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro/Mods on Steam Deck (~/ will be called Home if you are moving files in the GUI file manager)~/.var/app/com.valvesoftware.Steam/.steam/steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro/ModsWINEDLLOVERRIDES="version=n,b" %command%.lovely-aarch64-apple-darwin.tar.gz. If you have an Intel CPU then it will be lovely-x86_64-apple-darwin.tar.gzliblovely.dylib and run_lovely_macos.sh into the game directory. You can navigate to the game's directory by right-clicking the game in Steam, hovering "Manage", and selecting "Browse local files"./Users/$USER/Library/Application Support/Balatro/Mods where $USER is your username (if you are modding Balatro).Shift-Command-. (period) to show hidden files in Finder.run_lovely_macos.sh onto Terminal.app in Applications > Utilities and then pressing enter, or by executing sh run_lovely_macos.sh in the terminal within the game directory.Note: You cannot run your game through Steam on Mac due to a bug within the Steam client. You must run it with the run_lovely_macos.sh script.
Important: Mods with Lovely patch files (lovely.toml or in lovely/*.toml) must be installed into their own folder (or zip file) within the mod directory. No exceptions!
love using your distribution's package manager. This is sudo pacman -S love on SteamOS and Arch-based distros, and sudo apt install love on Ubuntu & Debian-based ones.x86_64-unknown-linux-gnu.tar.gz.liblovely.so and run_lovely_linux.sh into the game directory. You can navigate to the game's directory by right-clicking the game in Steam, hovering "Manage", and selecting "Browse local files".~/.local/share/love/Mods../run_lovely_linux.sh in the terminal within the game directory (you can copy this file into the directory of choice).Note that the patch format is unstable and prone to change until Lovely is out of early development.
Patch files define where and how code injection occurs within the game process. A good (complex) example of this can be found in the Steamodded repo here.
…pattern patches to surgically embed code at specific locations within the target. Supports * (matches 0 or more occurrences of any character) and ? (matches exactly one occurrence of any character) wildcards.regex patches only when the pattern patch does not fulfill your needs. This is basically the pattern patch but with a backing regex query engine, capture groups and all.copy patches when you need to copy a large amount of position-independent code into the target.module patches to inject a lua module into the game's runtime. Note that this currently only supports single file modules, but this should be changing soon.Patch files are loaded from mod directories inside of the mod folder (MOD_DIR). Lovely will load any patch files present within MOD_DIR/ModName/lovely/ or load a single patch from MOD_DIR/ModName/lovely.toml. If multiple patches are loaded they will be injected into the game in the order by order of their priority.
Paths defined within the patch are rooted by the mod's directory. For example, core/deck.lua resolves to MOD_DIR/ModName/core/deck.lua.
Each patch definition has one or more patch targets. These targets are typically the relative paths of source files when dumped from the game with a tool like 7zip. For example, one can target a top-level file like main.lua, or one in a subdirectory like engine/event.lua.
For certain games/libraries, files are loaded differently. Targets (or more specifically buffer names) can be arbitrarily anything.
Lovely itself uses the format of =[lovely ""] for buffers loaded via module patch.
Lovely dumps patched lua source files to MOD_DIR/lovely/dump. Logs are likewise written to MOD_DIR/lovely/log.
manifest.versionNo open issues yet, or sync has not completed.