Commit Graph
3957 Commits
Author SHA1 Message Date
Oliver Hamlet e61aeabfbb Integrate logging in the Python wrapper 2025-03-25 22:02:34 +00:00
Oliver Hamlet 2076478a4f Replace overwrite boolean with an enum 2025-03-25 22:02:33 +00:00
Oliver Hamlet 254892198d Refactor unsafe code in CXX wrapper 2025-03-25 22:02:33 +00:00
Oliver Hamlet 9912bb7bcb Refactor CXX errors 2025-03-25 22:02:33 +00:00
Oliver Hamlet 86063e437a Tweak Cargo profiles
Include limited debug info in release builds to help with profiling.

Also add another profile that's equivalent to CMake's RelWithDebInfo.
Testing suggests that although it uses a lower opt-level, it might
actually perform better (at least on Windows), though the differences
are only ~ 100 ms in startup and sorting times.
2025-03-25 22:02:33 +00:00
Oliver Hamlet 3b6752843a Use faster hashing algorithm in sorting code
The default std hasher is DoS-resistant but relatively slow, and
DoS-resistance isn't a useful property during sorting.

I tested using the rustc-hash, fnv and ahash crates against my
1600-plugin load order, and the results vs the default std hasher
were:

- AHash: 31% faster
- FNV: 33% faster
- FxHasher (from rustc-hash): 37% faster

With the std hasher the Rust libloot is 35% slower than C++, with
FxHasher it's 15% faster.
2025-03-25 22:02:33 +00:00
Oliver Hamlet de97b90618 Improve Python wrapper error handling
The new libloot-ffi-errors crate is for sharing code between the CXX and PyO3 wrappers.
2025-03-25 22:02:33 +00:00
Oliver Hamlet 3c02bfd1da Return plugins as Arc<Plugin> instead of &Plugin
This is the only way I can see for the PyO3 wrapper to work safely, and it's probably a good idea anyway (it simplifies the CXX wrapper too).
2025-03-25 22:02:33 +00:00
Oliver Hamlet d71a207c57 Add Python wrapper built using PyO3
It's missing logging integration, specific error types, and the ability to retrieve loaded plugin data.
2025-03-25 22:02:33 +00:00
Oliver Hamlet 4f53341950 Sync with libloot v0.25.5 2025-03-25 22:02:33 +00:00
Oliver Hamlet 327d9935c9 Map C++ exception types 2025-03-25 22:02:33 +00:00
Oliver Hamlet d1757df904 Implement ABI-compatible C++ wrapper
The interface tests have been tweaked slightly to expect different log messages, but that's the only intentional behavioural change.
2025-03-25 22:02:31 +00:00
Oliver Hamlet 17157f430e Fix a couple of includes in libloot API headers
I'll also make these changes to C++ libloot.
2025-03-25 22:02:15 +00:00
Oliver Hamlet 6ea0c47f37 Add libloot v0.25.3 public API tests 2025-03-25 22:02:15 +00:00
Oliver Hamlet 7b0add5e72 Add libloot v0.25.3 public API headers 2025-03-25 22:02:15 +00:00
Oliver Hamlet 3fe91be7e5 Add a C++ wrapper crate using CXX 2025-03-25 22:02:13 +00:00
Oliver Hamlet 5d53db48cd Add setters to metadata and Vertex structs
They're not provided by C++ libloot, but they're needed to usefully expose these types to C++ since it doesn't have an equivalent of the 'self' method receiver.
2025-03-25 20:56:20 +00:00
Oliver Hamlet 7f62d494e9 Port unit tests from the C++ libloot implementation
This gives function/line/region coverage of 88%/91%/84%. Most of the
translation bugs fixed in earlier commits were found while writing these
tests: the tests were kept separate to not drown out the fixes in the
commit diffs.
2025-03-25 20:56:19 +00:00
Oliver Hamlet 597ae75c3c Fix another translation bug 2025-03-25 20:56:12 +00:00
Oliver Hamlet e19f4bc45d Fix another translation bug
Though this is due to an incorrect assumption of common behaviour in dependencies rather than a mistake I made.
2025-03-25 20:56:12 +00:00
Oliver Hamlet 5e47e77ac5 Fix some more translation bugs 2025-03-25 20:56:12 +00:00
Oliver Hamlet 567998c159 Fix are_file_paths_equivalent on Windows
Trying to get an exclusive lock on the files was too flaky and also prone to false positives.
2025-03-25 20:56:12 +00:00
Oliver Hamlet b47e4389c3 Workaround RegexBuilder::case_insensitive() not working 2025-03-25 20:56:12 +00:00
Oliver Hamlet 4e41764434 Fix a few more translation bugs 2025-03-25 20:56:12 +00:00
Oliver Hamlet db60e4524a Fix another translation bug 2025-03-25 20:56:12 +00:00