Code Monkey home page Code Monkey logo

bg3-imhex-patterns's Introduction

Baldur's Gate 3 Patterns for ImHex

This repository contains research for various (file) formats used in BG3, most notably the LSMF used as part of the NewAge-block in the saves.

Requirements

You need at least ImHex v1.31.0, which adds support for the [[hex::group]]-attribute used in the the patterns.

Setup ImHex

  1. Clone this repository somewhere on your system
  2. Open ImHex and go to "Settings > Folders"
  3. Add the ImHex-folder in the repository to that list.

Extracting saves

A tool is included under the Src-folder, which can extract the NewAge-block from any save. Grab a pre-compiled version from the Releases if you don't want to compile it yourself.

On Windows, simply drag/drop your .lsv save-file onto the executable.

On other systems, use a terminal as follows:

BG3.Extractor Save.lsv NewAge.lsmf

The first argument is the input save-file, the second is the output location of the .lsmf file.

Using the LSMF format

  1. Extract a NewAge-block from one of your saves
  2. In ImHex, use "File > Open File..." to load it up
  3. In the "Pattern editor", enter the following:
#pragma pattern_limit 1000000

#define BASE_OFFSET 48

#include <bg3/lsmf.pat> 

LSMF lsmf @ 0x0;

printNamesEntries(lsmf);
  1. Evaluate the pattern and the "Pattern Data" should contain all information the pattern is currently able to understand.

Dependencies

bg3-imhex-patterns's People

Contributors

lennardf1989 avatar zirrboy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zirrboy

bg3-imhex-patterns's Issues

Can't export save files (System.IO.InvalidDataException: File 'meta.lsf' has unsupported flags: 35) LSF v9?

Unfortunately it has an issue and I can't export save files. I feel like this has something to do with the implementation of LSF v9 but I'm not as knowledgeable as you and the others who worked on cracking NewAge, I'm just someone hoping to add the Summon Shovel scroll into my inventory after someone in my game used it before my wizard :( still, great work.

Worth noting LSLib had the same error on their stable version (1.18.7) but fixed it as of the beta (1.19.3), however 1.19.2 has not fixed this, leading me to believe it's the v7/v9 update. Here's the error output in cmd:

Unhandled exception. System.IO.InvalidDataException: File 'meta.lsf' has unsupported flags: 35
   at LSLib.LS.PackagedFileInfo.CreateFromEntry(FileEntry18 entry, Stream dataStream)
   at LSLib.LS.PackageReader.ReadFileListV18(BinaryReader reader, Package package)
   at LSLib.LS.PackageReader.ReadPackageV18(FileStream mainStream, BinaryReader reader)
   at LSLib.LS.PackageReader.Read()
   at BG3.Extractor.Program.Main(String[] args) in C:\Users\Lennard\Desktop\BG3-ImHex-Patterns\Src\BG3.Extractor\Program.cs:line 14```

Selective Component Loading

Running the pattern, at least on my own, no longer that high spec, machine, is starting to take a while and I think the benefit of colored sections greatly diminishes once almost everything is highlighted.

At least in my own workflow, exploring a component means frequent recompiles, where most of the others aren't required, and make it harder to see what sections that particular component references.

So I'd suggest that only deliberately selected components get parsed, reducing compile latency and visual clutter in the editor.

Some sort of loadAll obviously has its own use, but having that as a separate functionality would also allow running advanced loading, such as owner mapping.

My best idea for now would be to pack the switch case into a separate struct with a name parameter, but more handy solutions probably exist.

Something like this:

[...]
LSMF lsmf @ 0x0;

struct Component<auto name, EntryType> {...};

Component<"game.v0.EntityID", GUID> entityIDs @ 0x0;

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.