Compare commits

..
218 Commits
Author SHA1 Message Date
meehl 17bb3c6b39 chore: Release rusty-path-of-building version 0.3.1
Release / create-release (push) Successful in 7s
2026-10-21 17:50:12 +02:00
meehl ce62fe64e1 Update CHANGELOG 2026-10-21 17:49:55 +02:00
meehl 4b997447b5 Strip #@ script headers before loading Lua
LuaJIT now only treats a leading `#!` line as a shebang and interprets other
lines beginning with `#` as line number directives.

https://github.com/LuaJIT/LuaJIT/commit/c41d727dbffa5ec4f346dd9be0f4c64740f124aa
2026-10-21 17:45:11 +02:00
meehl a1e92fa94e chore: Release rusty-path-of-building version 0.3.0
Release / create-release (push) Successful in 7s
2026-10-21 15:33:33 +02:00
meehl a24beac554 Update Cargo.lock 2026-10-21 14:59:41 +02:00
meehl 4affef3e62 Move fonts to assets directory 2026-10-21 14:53:08 +02:00
meehl e6ba149516 README formatting 2026-10-21 12:29:56 +02:00
meehl c2222c641b Update changelog 2026-10-21 12:28:58 +02:00
meehl 6427263f2d Update README 2026-10-21 11:52:56 +02:00
meehl f47a2657f6 Add vendored-lua feature for building LuaJIT from source 2026-10-21 11:21:09 +02:00
meehl 6cca05f2f5 Upgrade parley to v0.12 2026-10-21 11:11:02 +02:00
meehl f8a821d310 Upgrade zstd to v0.14 2026-10-21 10:49:40 +02:00
meehl 50e0af6cad cargo update 2026-10-21 10:45:45 +02:00
meehl 0886ad693a Register luazip module
This removes the runtime dependency on the external `lzip` C library.
2026-10-21 10:39:02 +02:00
meehl a4f7353ce6 Implement missing luasocket method 2026-10-17 17:05:13 +02:00
meehl f3c065debd Add feature for registering bundled Lua modules
Enabled by default.
2026-10-17 16:04:54 +02:00
meehl 9b98c65060 Register luacurl module
This removes the runtime dependency on the external `Lua-cURLv3` C library.
2026-10-17 15:04:50 +02:00
meehl b70d612a1d Remove unneeded return statement 2026-10-16 08:30:52 +02:00
meehl 36d2697754 Register luasocket module
This removes the runtime dependency on the external `luasocket` C library.
2026-10-15 23:31:23 +02:00
meehl 8ddcbf89f7 Fix re-entrant context borrow during subscript calls
Move `SubscriptManager` to its own app data slot and dispatch subscript
calls only after releasing the context and manager borrow.
2026-10-15 18:58:11 +02:00
meehl c6d5241b98 Expose luautf8 module through runtime
This removes the runtime dependency on the external `luautf8` C library.
2026-10-14 11:34:23 +02:00
vaisest ae9c59d132 Fix Windows canonical paths (#59) 2026-09-18 10:33:28 +02:00
meehl 41d9c9dbd7 Remove blend mode and mask index from API 2026-09-09 09:21:53 +02:00
meehl e72a271006 Add support for gzip compression 2026-09-08 08:36:23 +02:00
meehl d886f585f8 Adjust CI workflow 2026-09-06 09:02:11 +02:00
zakaluka bc2d245368 Add link to homebrew from README (#56) 2026-09-06 09:00:56 +02:00
meehl 51476da1d9 Make clippy happy 2026-09-02 18:46:37 +02:00
meehl 30bc02252b Add libluajit-5.1-dev as system dependency in CI workflow 2026-09-02 18:42:24 +02:00
meehl d5f9801d49 Add missing system dependency to CI workflow 2026-09-02 18:35:12 +02:00
meehl 0b608602d1 Disable the system feature for parley
System fonts are not needed since we provide our own custom fonts.
Disabling the system feature also removes the dependency on fontconfig
during compilation, which was previously undocumented.
2026-09-02 18:03:56 +02:00
meehl ef32139e14 Add CI workflow 2026-09-02 17:45:44 +02:00
meehl 20a1db073d Lint 2026-09-02 16:37:59 +02:00
meehl aa1bfb768e Add helpers for appending to Lua's package.path 2026-09-02 11:16:21 +02:00
meehl 29e2958dd3 Replace unwrap 2026-09-02 11:15:42 +02:00
meehl 5cbabed095 Simplify return value 2026-09-01 22:05:37 +02:00
meehl 5ba4100589 Small cleanup 2026-09-01 19:18:58 +02:00
meehl fc4d913930 Remove misleading comment 2026-09-01 17:47:37 +02:00
meehl dc9300bca2 Ensure compatibility of partial update with existing texture.
+ some improvements around querying texture loading status.
2026-09-01 14:47:00 +02:00
meehl e90396ff28 Add support for partial GPU texture updates
Mainly used for font atlas changes. Each glyph allocation now only
triggers a partial texture update instead of creating a full new
texture.
2026-09-01 10:17:34 +02:00
meehl e3288b96ac Implement get_draw_layer API function 2026-08-29 23:36:50 +02:00
meehl 749dd69589 Fix double regex matching and iteration in get_index_at_cur 2026-08-29 23:09:08 +02:00
meehl 1a6631c4ad Refactor PoBStringSegmentIterator 2026-08-29 21:46:51 +02:00
meehl 078269653e Restructure api functions 2026-08-29 19:08:49 +02:00
meehl fe96786aca Update comments about PoB alignment argument 2026-08-29 16:35:11 +02:00
meehl 4b344d15ae Refactor mouse and keyboard input handling 2026-08-29 16:12:45 +02:00
meehl c297eeaca6 Improve ergonomics of calling Lua callbacks 2026-08-29 11:28:30 +02:00
meehl 77e1d615e0 Lint 2026-08-28 20:12:42 +02:00
meehl 6f0d678790 Add better docs for subscripts 2026-08-28 20:11:25 +02:00
meehl 38f81cab3e Restructure Subscript::handle_calls 2026-08-28 19:37:18 +02:00
meehl a6c158424f Simply conversion to/from NativeMultiValue 2026-08-28 19:04:13 +02:00
meehl 8556ebf772 Lint 2026-08-28 18:19:16 +02:00
meehl 09f1a16071 Update README 2026-08-28 16:25:12 +02:00
meehl 6f0eef7cf8 Get rid of unwraps 2026-08-27 18:02:24 +02:00
meehl 8cfc82d668 Construct wgpu::VertexBufferLayout directly from Vertex 2026-08-27 17:48:17 +02:00
meehl 9d45b78d64 Use channel to handle async image load results in texture manager 2026-08-27 16:56:03 +02:00
meehl 692e530867 Add profiling scope for call to OnInit 2026-08-27 16:34:40 +02:00
meehl 4e67aa72c0 Acquire context reference after argument validation in image_handle_load
luaL_error can perform a long jump and never return. `drop` might not
get called on the AppDataRef, leaving it permanently borrowed.
2026-08-27 15:31:03 +02:00
meehl ac8cf3946e Remove TODO comment 2026-08-27 13:00:43 +02:00
meehl 49fab3c787 Use constant for number of texture slots in batch 2026-08-27 12:59:23 +02:00
meehl 93ce072d40 Remove unnecessary binding array size constant in shader 2026-08-27 12:43:29 +02:00
meehl 1f5e30ae5a Decouple anchor offset from parley alignment 2026-08-26 17:59:01 +02:00
meehl d217af94c3 Pass scale factor to layout builder.
This means `parley::Layout`'s internal coordinates are now in physical
space.
2026-08-26 17:34:11 +02:00
meehl fe9434e4f0 Warm glyph cache for correct scale factor 2026-08-26 16:16:14 +02:00
meehl f0be43cbdd Add helper for iterating glyph runs 2026-08-26 15:51:42 +02:00
meehl a678c8148d Clean up glyph rasterization 2026-08-26 14:41:32 +02:00
meehl 963a9ba1d1 Add comments about glyph baseline offset 2026-08-26 11:59:01 +02:00
meehl e6c5ec3d42 Move font style cache into separate file 2026-08-26 11:18:16 +02:00
meehl 8f98a9c8f1 Store size instead of rect for cached glyphs.
Their origin is always at (0.0, 0.0).
2026-08-26 10:24:13 +02:00
meehl a50ea4cdaf Introduce new coordinate space for glyph positions within a layout 2026-08-25 12:11:49 +02:00
meehl 7b925876a5 Cleanup of UV space handling 2026-08-25 10:46:12 +02:00
meehl 8d17f8e64f Use euclid::Scale to convert between physical and logical coord spaces 2026-08-24 23:57:19 +02:00
meehl 8ba72fd7df Cull draw command if shape does not intersect viewport. 2026-08-24 11:41:57 +02:00
meehl 2bbfd14c1b Add profileing scope around OnFrame and remove mut ref to context 2026-08-24 10:48:31 +02:00
meehl 99dd50de62 cargo update 2026-08-24 10:38:51 +02:00
meehl 6224a1b0a4 Lint 2026-08-24 10:24:51 +02:00
meehl 8cf5110eb2 Fix trailing whitespaces being ignored by string width query 2026-08-24 09:46:33 +02:00
meehl 493a2ba9cf Fix typo 2026-08-24 08:58:00 +02:00
meehl cc6de120f2 Refactor context handling and redraw requests
Remove unsafe pointer shenanigans and give Lua instance ownership over
`Context`. Event handlers now directly mutate Context instead of using a
shared app state which is then hooked up to Context via unsafe pointers.
The removal of a shared state means stages (previously called "modes")
are now responsible for keeping their own internal state.

Additionally, clean up draw request handling and module hierarchy.
2026-08-23 23:55:43 +02:00
meehl 337e876571 Fix off-by-one error in batcher 2026-08-23 15:24:14 +02:00
meehl d4ca16f07e Remove unnecessary Box around Context 2026-08-20 10:50:30 +02:00
meehl 6fe15c63fe DrawCommandRecorder::finish() doesn't need mutable reference 2026-08-18 11:06:38 +02:00
meehl 1cd62c2b1c Fix absolute positioning of text 2026-08-18 11:04:34 +02:00
meehl d43a1cf392 Hash draw commands directly from their byte representation 2026-08-18 10:58:06 +02:00
meehl e5bd0157d3 Update dependencies 2026-08-18 09:54:21 +02:00
meehl 43ef18c2e3 Align text with physical pixel grid to reduce blurriness 2026-08-16 11:08:45 +02:00
meehl 4d6c258932 Major renderer refactor
Replace old per-mesh bind group model with a better batching schema
built around wgpu's TEXTURE_BINDING_ARRAY support. Each batch now
holds multiple textures. Vertex and index buffers are now only set once
per frame. Massively improves rendering performance.
2026-08-16 01:25:22 +02:00
meehl 3fc87339ca Refactor draw command recording.
Remove distinct draw primitives and unify them into one shared form.
2026-08-15 19:19:55 +02:00
meehl a6d18a320c Fix comment 2026-08-15 19:19:34 +02:00
meehl e20a28fef7 Use layered font atlas.
Add layers instead of growing in height as more and more glyphs are
added. This allows us to return normalized UV coordinates since the
dimensions of each layer stay the same.
2026-08-15 15:49:25 +02:00
meehl b48edb72e1 Clean up return values of some API functions 2026-08-12 21:05:34 +02:00
meehl e43da1b9e8 Lint 2026-08-12 20:46:43 +02:00
meehl 99fc9f608e Improve performance of image handle access in API draw calls.
Use raw Lua C API to store image handles in Lua userdata instead
of using `mlua::UserData`. `mlua` wraps UserData in a special way
to maintain Rust safety guarantees which prevents direct access
of the underlying data from a raw Lua state.
The `DrawImage` and `DrawImageQuad` API calls used a workaround to
access the underlying image handle before which added significant
overhead. The overhead is eliminated by manually constructing the
userdata metatable for `ImageHandle` at the cost of weaker safety
guarantees.
2026-08-12 18:03:41 +02:00
meehl c1d91768bb Improve parsing of color escapes 2026-08-12 14:37:01 +02:00
meehl 4c581f92a8 Fix color escape regex 2026-08-12 14:10:00 +02:00
meehl a2afd2de54 Upgrade parley to v0.11 2026-08-11 23:17:58 +02:00
meehl a1cea10218 Upgrade wgpu to v30 2026-08-11 20:30:21 +02:00
meehl cee6f848ea Upgrade dds to v0.2 2026-08-11 19:26:24 +02:00
meehl 5c44328e16 Upgrade mlua to v0.12.0 2026-08-11 17:37:53 +02:00
meehl 6b6098d331 chore: Release rusty-path-of-building version 0.2.18
Release / create-release (push) Successful in 8s
2026-05-29 15:09:23 +02:00
meehl 69d70e4712 Update CHANGELOG 2026-05-29 15:08:27 +02:00
meehl 32fd954952 Raise max_texture_array_layers requirement to support new gem tooltips 2026-05-29 15:02:35 +02:00
Aleksandr Timofeev 40ea4445cd Fix doubleclick handling (#49) 2026-05-24 21:11:19 +02:00
meehl 3ca5f984de chore: Release rusty-path-of-building version 0.2.17
Release / create-release (push) Successful in 8s
2026-05-24 09:29:31 +02:00
meehl 6dbf6c0e3c Update CHANGELOG 2026-05-24 09:29:09 +02:00
meehl 6a05d86801 Adjust index to account for color escape sequences
get_text_index_at_cursor() returns an index into the stripped string,
but PoB expects an index into the original unstripped text. Accumulate
the total length of all escape sequences preceding the cursor position
and add it to the returned index.

Fixes #45
2026-05-14 10:42:26 +02:00
meehl 068dfce7ca Use correct font names to register generic font families
Fixes #48
2026-05-13 15:37:54 +02:00
Game Monster 28a9089443 Add macOS development setup guide to CONTRIBUTING 2026-04-08 15:23:38 +02:00
Game Monster e42776a2c8 Improve macOS compatibility
Enables wgpu's metal backend and restricts usage of smithay-clipboard, which provides access to the Wayland clipboard, to linux systems.
2026-04-08 14:48:21 +02:00
meehl c8bda4b76f chore: Release rusty-path-of-building version 0.2.16
Release / create-release (push) Successful in 4s
2026-03-23 08:54:23 +01:00
meehl fe10962c4b Update CHANGELOG 2026-03-23 08:53:54 +01:00
meehl 4dc8db6921 Fix tar extraction 2026-03-23 08:49:59 +01:00
meehl 716add6d76 chore: Release rusty-path-of-building version 0.2.15
Release / create-release (push) Successful in 7s
2026-03-22 22:53:27 +01:00
meehl 98af75c725 Update CHANGELOG 2026-03-22 22:52:54 +01:00
meehl 88bd3fa403 Installer refactor
Uses reqwest instead of ureq for better IPv6 handling.
2026-03-22 22:45:48 +01:00
meehl b16f7f528d chore: cargo update and bump fast_image_resize to v6.0.0 2026-03-22 10:22:45 +01:00
meehl e2c0f2fffc chore: Release rusty-path-of-building version 0.2.14
Release / create-release (push) Successful in 6s
2026-03-14 10:35:33 +01:00
meehl a6be413190 Update CHANGELOG 2026-03-14 10:35:21 +01:00
AiSatan 8034eef8c7 fix removing build directory 2026-03-11 16:48:11 +01:00
meehl 3b0d5295d3 installer: only install release versions
This prevents the installer from trying to download a beta version which
leads to a 404.
2026-03-10 16:07:54 +01:00
meehl ff46a570fc chore: Release rusty-path-of-building version 0.2.13
Release / create-release (push) Successful in 4s
2026-03-09 18:17:47 +01:00
meehl 7db64e337d Update CHANGELOG 2026-03-09 18:17:33 +01:00
meehl 522ab489cd Fix ascendancy flavour text size. 2026-03-09 18:13:58 +01:00
meehl 8217aca6f2 chore: Release rusty-path-of-building version 0.2.12
Release / create-release (push) Successful in 4s
2026-03-09 16:35:19 +01:00
meehl 249116af52 Update CHANGELOG 2026-03-09 16:35:06 +01:00
meehl c47bf48556 Add more fine-grained logging and UI feedback to installer 2026-03-09 16:30:00 +01:00
meehl 1f89e31f30 Set global timeout for ureq requests 2026-03-09 16:30:00 +01:00
AiSatan 913d2127d8 Fix to enable "Save changes" popup 2026-03-09 14:10:30 +01:00
meehl 1c99e9fabc chore: Release rusty-path-of-building version 0.2.11
Release / create-release (push) Successful in 4s
2026-03-05 08:50:53 +01:00
meehl 12fc773958 Update CHANGELOG 2026-03-05 08:50:34 +01:00
meehl ef4f86eac8 Track state and forward events for logical keys.
Using physical key codes leads to unexpected bevahior on different
keyboard layouts. Use logical keys like SimpleGraphic.

Closes #27
2026-03-05 08:30:56 +01:00
Ac5000 966363a859 Added method to InputState to clear pressed keys, mods, and mouse. Call method on window focus loss. 2026-02-28 10:23:56 +01:00
Ac5000 9d33a7704c Added documentation to src/input.rs 2026-02-28 10:23:56 +01:00
Ac5000 3a66f15b49 Added documentation. 2026-02-28 10:23:56 +01:00
meehl 7d02ca098c Use repology to display packaging status 2025-12-17 12:19:40 +01:00
meehl a858af2c38 chore: Release rusty-path-of-building version 0.2.10
Release / create-release (push) Successful in 4s
2025-12-15 23:20:27 +01:00
meehl 7fc3e340e7 Implement GetDrawColor 2025-12-15 17:56:52 +01:00
meehl dadf5c8804 Remove leftover dbg statement 2025-12-15 17:25:46 +01:00
meehl 031df6ed9c Store script directory in app context
This enables easier testing of the dev branch by providing a custom
script directory. Additionally, a Launch file is now searched for
in nearby locations and if found, used to determine a custom script
directory.
2025-12-15 17:18:56 +01:00
meehl e395e729e8 Add link to nixpkgs 2025-12-05 13:30:23 +01:00
meehl 76b5449bad installer: Write checksum of modified update script to manifest
This prevent having to perform a redundant update on first startup.
2025-12-05 13:03:11 +01:00
meehl f9f05aad08 Fix variable name 2025-12-03 23:09:03 +01:00
meehl 3eacd43837 chore: Release rusty-path-of-building version 0.2.9
Release / create-release (push) Successful in 6s
2025-12-03 16:10:25 +01:00
meehl 523d5ffe29 Update CHANGELOG 2025-12-03 16:09:53 +01:00
meehl e18623edb4 Update README 2025-11-30 11:22:18 +01:00
meehl 1812edcbe9 Implement UI scale overriding
Closes #16
2025-11-30 11:16:04 +01:00
meehl df06c8f9c6 installer: Download highest supported version instead of latest version
Closes #17
2025-11-30 10:05:43 +01:00
meehl ae6a24f82c Reduce CPU usage while window is unfocused and not hovered over
Only render if window is focused, hovered, subscript is running,
or coroutine is active.

Closes #18
2025-11-28 18:30:25 +01:00
meehl 0066a05e13 Register AbortSubscript function under right name 2025-11-27 10:54:43 +01:00
meehl 3d8143c4d1 Add help text to import url argument 2025-11-27 10:54:43 +01:00
meehl a3ef4b39d0 Remove unneeded 'return' statement 2025-11-27 10:54:43 +01:00
meehl f48ab50633 Create CONTRIBUTING.md 2025-11-23 20:51:17 +01:00
meehl b86486d5aa Move config.yml into right directory 2025-11-23 18:05:05 +01:00
meehl 1f1a331cc2 Create config.yml 2025-11-23 18:01:45 +01:00
meehl 27b93c4a9d Update issue templates 2025-11-23 17:48:35 +01:00
meehl c95514036f Fix compiler warning caused by uninitialized variable 2025-11-22 13:48:13 +01:00
meehl 37bc3c5dbb chore: Release rusty-path-of-building version 0.2.8
Release / create-release (push) Successful in 5s
2025-11-07 07:55:07 +01:00
meehl 56155d066a Remove note about clipboard support in known issues section of README 2025-11-07 01:00:06 +01:00
meehl f27e83b467 Use smithay-clipboard crate for clipboard support on Wayland
Fixes #8
2025-11-07 00:59:37 +01:00
meehl 50d4b4b09c Replace non-ASCII characters in text input with '?'
This matches `SimpleGraphics` behavior and prevents a crash that can
happen if PoB tries to delete a non-ASCII character.

Fixes #9.
2025-11-06 16:55:31 +01:00
meehl 51e6881cb0 Simplify input event handling 2025-11-06 16:30:24 +01:00
meehl 8a69d15b49 Set app_id only on platforms that support it.
This fixes a build error on windows.
2025-11-03 13:26:03 +01:00
meehl 3af5e3dccb chore: Release rusty-path-of-building version 0.2.7
Release / create-release (push) Successful in 5s
2025-11-02 17:52:39 +01:00
meehl 76a1b4691d Add missing icon 2025-11-02 17:06:21 +01:00
meehl e877b599c1 Fix UI scaling factor not being applied at startup on X11
On wayland an event it dispatched right after window creation.
 This is not the case on X11 so we need to set it manually.
2025-11-02 15:42:53 +01:00
meehl cc38e31dbb Update known issues section in README 2025-11-02 10:08:44 +01:00
meehl 2739c45181 Use better name for context 2025-11-02 09:53:37 +01:00
meehl 18b05338bf Tweak wording of README 2025-11-02 00:40:33 +01:00
meehl 73ebb1655a Add Flatpak to README
Close #7
2025-11-01 23:40:59 +01:00
meehl 87ff0968d8 Fix missing window title during installation step 2025-10-31 16:39:09 +01:00
meehl 54b454f8b9 chore: Release rusty-path-of-building version 0.2.6
Release / create-release (push) Successful in 7s
2025-10-31 01:06:18 +01:00
meehl 6d0975fe15 Update CHANGELOG 2025-10-31 01:05:49 +01:00
meehl 64960b8c3c Add stubs for DPI scale overrides 2025-10-31 00:17:50 +01:00
meehl cf518a2c40 Add regular variant of Fontin font 2025-10-31 00:07:49 +01:00
meehl bf588528ca chore: Release rusty-path-of-building version 0.2.5
Release / create-release (push) Successful in 5s
2025-10-30 20:18:42 +01:00
meehl db98ba627b Update CHANGELOG for new release 2025-10-30 20:17:50 +01:00
meehl 479b7196cf Add support for "faux italics" 2025-10-30 20:15:02 +01:00
David Truby a338ff02f1 Fix bug accidentally requiring extra features for surface format
On my system, surface_formats() has `Rgba16Unorm` as the first format in
the surface_caps.formats vector that isn't SRGB. However if this format
is used it requires a couple of extra WGPU features that weren't
requested for the device.

This specific format isn't actually required and so the features aren't
required, so instead we can just skip over any formats that require
features when skipping srgb ones. This results in an appropriate format
being selected and gets rid of a potential wgpu crash.
2025-10-30 19:32:31 +01:00
meehl f9b29d4645 chore: Release rusty-path-of-building version 0.2.4
Release / create-release (push) Successful in 4s
2025-10-30 15:59:10 +01:00
meehl 33f1984862 Update CHANGELOG for new release 2025-10-30 15:57:57 +01:00
K900 c2318f9929 api/paths: fix Lua interop, use data directory for storage 2025-10-30 15:34:10 +01:00
meehl 1648aa5736 Add support for new 'fontin' fonts 2025-10-30 13:20:58 +01:00
meehl 43b20ecd0d Refactor font loading 2025-10-30 13:10:42 +01:00
meehl fff5aa8596 Add support for loading webp images 2025-10-30 10:00:26 +01:00
meehl 032a450d7e Fix scrolling of gem selection dropdown 2025-10-30 08:46:36 +01:00
meehl 0881080b3f chore: Release rusty-path-of-building version 0.2.3
Release / create-release (push) Successful in 7s
2025-10-29 16:26:44 +01:00
meehl 07784a848c Prepare CHANGELOG for patch release 2025-10-29 16:26:12 +01:00
Mykola bdf128addc Implement exponential backoff for github HTTP GET requests (#4) 2025-10-29 16:08:21 +01:00
meehl 7e7b4a75c8 chore: Release rusty-path-of-building version 0.2.2
Release / create-release (push) Canceled after 0s
2025-10-29 15:28:50 +01:00
meehl f5954446d1 Fix version file 2025-10-29 12:12:52 +01:00
meehl e6bdba1137 Add missing runtime dependency to README and adjust wording 2025-10-28 23:36:40 +01:00
meehl 9716157e3b chore: Release rusty-path-of-building version 0.2.1
Release / create-release (push) Successful in 4s
2025-10-28 23:28:03 +01:00
meehl 6e35123b5d Add stub for TakeScreenshot api function 2025-10-28 23:15:24 +01:00
meehl 38e3a39782 Implement missing SetForeground api function. Fixes #2 2025-10-28 23:12:09 +01:00
meehl f2387804c1 chore: Release rusty-path-of-building version 0.2.0
Release / create-release (push) Canceled after 0s
2025-10-28 17:35:57 +01:00
meehl 6b5b87cd8a Update dependencies 2025-10-28 17:32:19 +01:00
meehl 6a5135a6a6 Cleanup image loading 2025-10-28 17:18:07 +01:00
meehl 3352152ef6 Handle dpi awareness api feature flag 2025-10-28 16:54:44 +01:00
meehl 3ff483ad19 Notify windowing system right before presenting 2025-10-28 16:29:18 +01:00
meehl 3cdfbc823b Remove modified manifest and use new custom update checker 2025-10-27 23:31:03 +01:00
meehl d8e52218f8 Remove global context 2025-10-27 23:10:11 +01:00
meehl f3d2f73925 chore: Release rusty-path-of-building version 0.1.2
Release / create-release (push) Canceled after 0s
2025-10-20 22:36:39 +02:00
meehl 6108a6eec4 Change wording in README 2025-10-20 15:26:08 +02:00
meehl 3fa1ffbd5c Add instructions on how to work around clipboard issue to README 2025-10-20 13:23:02 +02:00
meehl 8d0f9502e3 Align layout origins with physical pixel grid for sharper text rendering 2025-10-20 12:24:31 +02:00
meehl a096547b7f Fix position hashing bug that causes incorrect frame elision 2025-10-20 11:24:13 +02:00
meehl 6c4c61b8cb Rewrite comment about possible layer index optimization 2025-10-20 11:09:00 +02:00
meehl f1e4b21d7f Add line breaks to comment 2025-10-20 09:32:43 +02:00
meehl 3e986ae3c0 chore: Release rusty-path-of-building version 0.1.1
Release / create-release (push) Canceled after 0s
2025-10-19 21:12:04 +02:00
meehl 9eabe73c81 Update CHANGELOG 2025-10-19 21:09:20 +02:00
meehl 019db5468c Update README 2025-10-19 21:07:05 +02:00
meehl e52aed0890 Use right buffer type for inflate and deflate. fixes #1
Using a String for zlib decoder/encoder output doesn't work because
it can only hold valid utf8. Read into a Vec<u8> instead and construct
a lua string from it.
2025-10-19 20:15:01 +02:00
meehl 50b4450c8b Change script directory name to avoid conflict with official PoB 2025-10-19 18:51:03 +02:00
meehl 7126061645 Move manifests into separate repo.
New repo: https://github.com/meehl/rusty-pob-manifest
2025-10-19 18:48:03 +02:00
meehl fc7f4481d7 Remove modification of lua cpath.
This means c libraries must be installed into LUA_CPATH_DEFAULT
or LUA_CPATH must be used to define custom location.
2025-10-19 17:05:04 +02:00
meehl 2175cbec79 Add install target to lzip Makefile 2025-10-19 16:59:22 +02:00
meehl 0fb10d1fc4 Update README 2025-10-18 21:20:08 +02:00
meehl 767324daa0 Follow naming conventions for github repo name 2025-10-18 19:57:23 +02:00
meehl da1acf4103 Setup cargo-release 2025-10-18 18:07:10 +02:00
91 changed files with 10337 additions and 8548 deletions

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
# Contributing to Rusty Path Of Building
## Reporting bugs
- Ensure the bug was not already reported by searching through existing [issues](https://github.com/meehl/rusty-path-of-building/issues).
- If the bug can also be reproduced with the official runtime (e.g. by running through wine), please open an issue in the [PoB1](https://github.com/PathOfBuildingCommunity/PathOfBuilding) or [PoB2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2) repo instead. If you're unsure, feel free to just open it here.
- If possible, use the bug report template to create the issue and provide as much information as possible.
## Contributing code
- Get familiar with the code base before you start. I'll try to add more documentation providing a high-level overview of the architecture in the future. Until then, feel free to reach out through [Discussions](https://github.com/meehl/rusty-path-of-building/discussions) if you have any questions.
- If you intend to work on the API functions, also check out the [SimpleGraphic](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic) code base. A great place to ask questions about it is the PoB dev discord server. [Here](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic) is more info on how to join.
- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
## macOS Development Setup
### 1. Install Lua runtime dependencies
The application requires several Lua C libraries at runtime. Install them using LuaRocks with the LuaJIT backend:
```bash
brew install luajit luarocks
luarocks --lua-version 5.1 install luasocket
luarocks --lua-version 5.1 install luautf8
luarocks --lua-version 5.1 install lua-curl
```
Build and install `lzip` from the bundled source (requires zlib, which is pre-installed on macOS):
```bash
cd lua/libs/lzip && make LUA_IMPL=luajit install
```
### 2. Configure LUA_CPATH
Add the following to your shell profile (`~/.zshrc` or `~/.bash_profile`) so the runtime can locate the installed libraries:
```bash
eval $(luarocks --lua-version 5.1 path)
```
Then reload your shell or run `source ~/.bash_profile`.
### 3. Startup
```bash
cargo run <poe1|poe2>
```
Path of Building files are automatically downloaded to the following directories on first startup:
- poe1: `~/Library/Application Support/RustyPathOfBuilding1`
- poe2: `~/Library/Application Support/RustyPathOfBuilding2`
### Troubleshooting
**Build fails with `library 'luajit-5.1' not found`**
This usually means the build cache points to an old LuaJIT version after a Homebrew upgrade. Run:
```bash
cargo clean && cargo run <poe1|poe2>
```
+30
View File
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A description of what you expected to happen.
**System information:**
- OS: [e.g. Linux, Windows, macOS]
- Desktop Environment/Compositor: [e.g. KDE, Gnome, sway, etc.] (only on Linux)
- Rusty Path of Building Version: [e.g. v0.2.8]
- Path of Building Version: [e.g. PoB1 v2.59.0 or PoB2 v0.12.2]
**Additional context**
Add any other context about the problem here. Feel free to add screenshots or any other info like PoB build codes if relevant.
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: yes
contact_links:
- name: GitHub Discussions
url: https://github.com/meehl/rusty-path-of-building/discussions
about: Please ask questions unrelated to actual bugs/issues here.
+31
View File
@@ -0,0 +1,31 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y luajit libluajit-5.1-dev
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Test
run: cargo test
+2
View File
@@ -1 +1,3 @@
/target/
*.so
*.so.dSYM
+252 -2
View File
@@ -2,6 +2,233 @@
## [Unreleased] - ReleaseDate
## [0.3.1] - 2026-10-21
### Fixed
- Strip `#@` script headers before loading Lua files to fix syntax error with recent LuaJIT versions
## [0.3.0] - 2026-10-21
### Added
- Add `bundled-lua-modules` feature (enabled by default) for registering Rust implementations of required C libaries. Enabling this features removes the runtime dependencies on `Lua-cURLv3`, `luautf8`, `luasocket`, and `lzip`. Disable it use the original C libraries like before.
- Add `vendored-lua` feature for building LuaJIT from source
- Add support for gzip compression to `inflate`/`deflate` API functions
### Changed
- Rework renderer for significantly improved render performance
- Rework context handling
- Improve performance of image handle access in draw API
- Remove blend mode and mask index from draw API
- Bump dependencies
### Fixed
- Fix color escape regex
- Fix Windows canonical path handling
## [0.2.18] - 2026-05-29
### Changed
- Raise `max_texture_array_layers` GPU requirement to support new gem tooltips
### Fixed
- Fix doubleclick handling
## [0.2.17] - 2026-05-24
### Changed
- Improve macOS compatibility
### Fixed
- Fix broken selection and display of colored text
- Fix black screen during installation on nixOS
## [0.2.16] - 2026-03-23
### Fixed
- Fix bug that causes tarball extraction to fail
## [0.2.15] - 2026-03-22
### Changed
- Replace `ureq` crate with `reqwest` for better IPv4/IPv6 dual stack support
- Refactor installer
- Bump dependencies
## [0.2.14] - 2026-03-14
### Fixed
- Fix deletion of character build directories
- Prevent installer from downloading beta versions
## [0.2.13] - 2026-03-09
### Fixed
- Fix size of ascendancy flavour texts
## [0.2.12] - 2026-03-09
### Changed
- Add better logging and UI feedback for initial install
- Set global timeout for network requests
### Fixed
- Fix confirmation dialog not showing on close with unsaved changes
## [0.2.11] - 2026-03-05
### Fixed
- Clear pressed keys on focus loss to avoid stuck keys
- Use logical keys for input handling to fix unexpected behavior with different keyboard layouts
## [0.2.10] - 2025-12-15
### Added
- Implement GetDrawColor
### Fixed
- Avoid redundant update after initial download
## [0.2.9] - 2025-12-03
### Added
- Implement UI scale overriding
### Changed
- Reduce CPU usage while window is unfocused and not hovered over
- Download highest compatible PoB version instead of latest version
### Fixed
- Register `AbortSubscript` function under right name
## [0.2.8] - 2025-11-07
### Changed
- Replace non-ASCII characters in text input with '?'
- Use `smithay-clipboard` crate for clipboard support on Wayland
## [0.2.7] - 2025-11-02
### Added
- Add missing window icon. Note for package maintainers: On Wayland, the name of the `.desktop` file entries needs to match RustyPoB's `app_id`. `app_id` is set to either `rusty-path-of-building-1` or `rusty-path-of-building-2`, depending on the game argument.
### Fixed
- Fix missing window title during installation step
- Fix UI scaling factor not being applied at startup on X11
## [0.2.6] - 2025-10-31
### Added
- Add regular variant of Fontin font
- Add stubs for DPI scale overrides
## [0.2.5] - 2025-10-30
### Added
- Add support for "faux italics"
### Fixed
- Fix crash that occurs due to surface format selection not filtering out formats that require unrequested GPU features
## [0.2.4] - 2025-10-30
### Added
- Add support for loading webp images
- Add support for new 'fontin' fonts
### Changed
- Use `~/.local/share/RustyPathOfBuilding{1,2}/userdata` as default location for settings and build files. Builds files created prior to this change need to be manually copied from the old location in `~/Documents/`. Sorry about the inconvenience.
### Fixed
- Fix scrolling of gem selection dropdown
## [0.2.3] - 2025-10-29
### Added
- Add exponential backoff for github requests
## [0.2.2] - 2025-10-29
### Fixed
- Fix version file
## [0.2.1] - 2025-10-28
### Added
- Add stub for `TakeScreenshot` api function
### Fixed
- Fix crash caused by missing `SetForeground` api function
## [0.2.0] - 2025-10-28
### Added
- Add visual indicator for download progress in installer
- Handle dpi awareness feature flag
### Changed
- Remove global context
- Notify windowing system before presenting
- Cleanup image loading
## [0.1.2] - 2025-10-20
### Fixed
- Fix problem that causes non-identical frames to be elided.
- Correctly align layout origins with physical pixel grid for sharper text rendering.
## [0.1.1] - 2025-10-19
### Added
- Add install target to lzip Makefile
- Setup `cargo-release`
### Fixed
- Fix problem caused by wrong buffer type in inflate and deflate (#1)
### Changed
- Move manifests into separate repo
- Change script directory name to avoid conflicts with official PoB
- Remove modification of lua `package.cpath`. Libraries installed outside of the default path can be specified with the `LUA_CPATH` env variable.
## [0.1.0] - 2025-10-18
### Added
@@ -9,6 +236,29 @@
- First release
<!-- next-url -->
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.1...HEAD
[Unreleased]: https://github.com/meehl/RustyPathOfBuilding/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/meehl/RustyPathOfBuilding/releases/tag/v0.1.0
[0.3.1]: https://github.com/meehl/rusty-path-of-building/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.18...v0.3.0
[0.2.18]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.17...v0.2.18
[0.2.17]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.16...v0.2.17
[0.2.16]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.15...v0.2.16
[0.2.15]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.14...v0.2.15
[0.2.14]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.13...v0.2.14
[0.2.13]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.12...v0.2.13
[0.2.12]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.11...v0.2.12
[0.2.11]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.10...v0.2.11
[0.2.10]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.9...v0.2.10
[0.2.9]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.8...v0.2.9
[0.2.8]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.7...v0.2.8
[0.2.7]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.6...v0.2.7
[0.2.6]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.5...v0.2.6
[0.2.5]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.4...v0.2.5
[0.2.4]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.3...v0.2.4
[0.2.3]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.2...v0.2.0
[0.1.2]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/meehl/rusty-path-of-building/releases/tag/v0.1.0
Generated
+2318 -1148
View File
File diff suppressed because it is too large. Load diff
+27 -14
View File
@@ -2,42 +2,55 @@
name = "rusty-path-of-building"
authors = ["meehl"]
description = "Cross-platform runtime for Path of Building"
repository = "https://github.com/meehl/RustyPathOfBuilding"
repository = "https://github.com/meehl/rusty-path-of-building"
license = "MIT"
version = "0.1.0"
version = "0.3.1"
edition = "2024"
publish = false
[dependencies]
ahash = "0.8.12"
anyhow = "1.0"
arboard = { version = "3.6.1", default-features = false, features = ["wayland-data-control"] }
arboard = { version = "3.6.1", default-features = false }
bytemuck = "1.23.2"
clap = { version = "4.5.46", features = ["derive"] }
dds = "0.1.0"
curl = { version = "0.4.51", optional = true }
dds = "0.2.0"
directories = "6.0.0"
env_logger = "0.10"
env_logger = "0.11"
euclid = { version = "0.22.11", features = ["bytemuck"] }
fast_image_resize = { version = "5.3.0", features = ["image"] }
fast_image_resize = { version = "6.0.0", features = ["image"] }
flate2 = "1.1.2"
glob = "0.3.3"
image = { version = "0.25.8", default-features = false, features = ["rayon", "jpeg", "png"] }
image = { version = "0.25.8", default-features = false, features = ["rayon", "jpeg", "png", "webp"] }
log = "0.4"
mlua = { version = "0.11.2", features = ["luajit", "anyhow"] }
luautf8-rs = { git = "https://github.com/meehl/luautf8-rs.git", rev = "dc74b734e5285108068cf2ffb674c1dc840073c1", features = ["luajit"], optional = true }
mlua = { version = "0.12.0", features = ["luajit", "anyhow"] }
nohash-hasher = "0.2.0"
num-traits = "0.2.19"
open = "5.3.2"
ordered-float = "5.0.0"
parley = "0.6.0"
pollster = "0.3"
parley = { version = "0.12.0", default-features = false, features = ["std"] }
pollster = "1.0"
profiling = "1.0"
puffin_http = { version = "0.16", optional = true }
puffin_http = { version = "0.17", optional = true }
raw-window-handle = "0.6.2"
regex = "1.11.2"
reqwest = { version = "0.13.2", features = ["blocking"] }
swash = "0.2.5"
tar = "0.4.44"
ureq = "3.1.2"
wgpu = { version = "27.0.1", default-features = false, features = ["std", "parking_lot", "vulkan", "wgsl"] }
wgpu = { version = "30.0.0", default-features = false, features = ["std", "parking_lot", "vulkan", "metal", "wgsl"] }
winit = "0.30"
zstd = "0.13.3"
zstd = "0.14"
[target.'cfg(target_os = "linux")'.dependencies]
smithay-clipboard = "0.7.3"
[features]
default = ["bundled-lua-modules"]
# Register Rust implementations of the Lua modules required by PoB's Lua code.
# Disable this to use the original C libraries.
bundled-lua-modules = ["dep:curl", "dep:luautf8-rs"]
# Build LuaJIT from source instead of linking against a system installation.
vendored-lua = ["mlua/vendored"]
profile-with-puffin = ["profiling/profile-with-puffin", "dep:puffin_http"]
+30 -15
View File
@@ -1,37 +1,52 @@
# Rusty Path of Building
Rusty Path of Building is a cross-platform runtime for [Path of Building](https://github.com/PathOfBuildingCommunity/PathOfBuilding) and [Path of Building 2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2). It implements the API used by PoB's Lua code and handles rendering, window management, and input. It essentially provides the same functionality as PoB's official runtime, [SimpleGraphic.dll](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic).
Rusty Path of Building is a cross-platform runtime environment for [Path of Building](https://github.com/PathOfBuildingCommunity/PathOfBuilding) and [Path of Building 2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2). It serves as a replacement for [SimpleGraphic](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic), the official runtime environment for PoB.
The main motivation behind this project was to enable Path of Building to run natively on Linux. It is written in Rust (in case you couldn't already tell from the unimaginative name) and should work on all platforms (though actual testing has only been done on Linux so far).
The main focus of this project is native Linux support for Path of Building. It also runs on Windows and macOS, though most of my testing and development is focused on Linux, with support for other platforms largely based on user reports. Contributions that improve support or fix bugs on other platforms are welcome.
## Running
## Usage
```bash
./rusty-path-of-building [poe1|poe2]
rusty-path-of-building [poe1|poe2]
```
The first run takes a bit longer as PoB's assets need to be downloaded. (NOTE: The whole installation process was hacked together and needs a lot of improvement)
## Installation
## Dependencies
[![Packaging status](https://repology.org/badge/vertical-allrepos/rusty-path-of-building.svg)](https://repology.org/project/rusty-path-of-building/versions)
Most runtime dependencies are handled automatically by `cargo`. [LuaJIT](https://github.com/LuaJIT/LuaJIT) needs to be installed on your system for `mlua` to work and to compile the libraries mentioned below.
### Flathub
Path of Building's Lua code also requires a few dynamic libraries:
[![Stable version badge](https://img.shields.io/flathub/v/community.pathofbuilding.PathOfBuilding)](https://flathub.org/en/apps/community.pathofbuilding.PathOfBuilding)
- [Lua-cURLv3](https://github.com/Lua-cURL/Lua-cURLv3)
- [luautf8](https://github.com/starwing/luautf8)
- [zlib](https://www.zlib.net/) - The Lua module source is included in this repo under `lua/libs/lzip` and requires `zlib` to compile. Build it with `make LUA_IMPL=luajit`.
### Homebrew
These libraries (`.dll` on Windows, `.so` on Linux) should be placed either in the same directory as the executable or in a `lua` subdirectory alongside it.
[Homebrew Tap](https://github.com/meehl/homebrew-rusty-path-of-building) (NOTE: This has been tested on macOS only)
## Building
### Building from source
```bash
cargo build --release
```
COMING SOON: PKGBUILD for Arch Linux
#### Build Dependencies
- `LuaJIT` - Required by the `mlua` crate. Alternatively, enable the `vendored-lua` feature to build LuaJIT from source instead of using a system installation.
- `libcurl` - Required when the `bundled-lua-modules` feature (enabled by default) is used.
## Runtime Dependencies
Path of Building's Lua code requires the following C libraries:
- [Lua-cURLv3](https://github.com/Lua-cURL/Lua-cURLv3)
- [luautf8](https://github.com/starwing/luautf8)
- [luasocket](https://github.com/lunarmodules/luasocket)
- [lzip](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/tree/master/libs/LZip)
By default, the `bundled-lua-modules` feature is enabled and registers Rust implementations of these libraries with the Lua runtime. The original C libraries don't need to be installed if this feature is enabled.
To use the original C libraries instead, disable the feature and make sure Lua can locate them. Please refer to the [Lua documentation](https://www.lua.org/manual/5.1/manual.html#pdf-package.cpath) for details on that.
## Known Issues
- Clipboard might not work on some Wayland compositors. Check this for compositor support and temporary workaround: https://github.com/1Password/arboard?tab=readme-ov-file#backend-support
- If automatic updates fail, navigate to `~/.local/share/RustyPathOfBuilding{1,2}/` and delete the `rpob.version` file and the `Update` directory. This will force a complete re-download of PoB's latest assets and Lua code on the next startup.
- Automatic updates for weekly beta builds are supported, but compatibility is not checked. If you run into problems with a beta version, please don't open an issue for it.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

-80
View File
@@ -1,80 +0,0 @@
T=lzip
UNAME ?= $(shell uname)
DESTDIR ?= /
PKG_CONFIG ?= pkg-config
INSTALL ?= install
RM ?= rm
LUA_IMPL ?= luajit
CC ?= $(MAC_ENV) g++
LUA_VERSION = $(shell $(PKG_CONFIG) --print-provides --silence-errors $(LUA_IMPL))
ifeq ($(LUA_VERSION),)
LUA_CMOD ?= /usr/lib/lua/5.1
LUA_LMOD ?= /usr/share/lua/5.1
LIBDIR ?= /usr/lib
LUA_INC ?= /usr/include
ZLIB_LIBS = -L/usr/lib -lz
else
LUA_CMOD ?= $(shell $(PKG_CONFIG) --variable INSTALL_CMOD $(LUA_IMPL))
LUA_LMOD ?= $(shell $(PKG_CONFIG) --variable INSTALL_LMOD $(LUA_IMPL))
LIBDIR ?= $(shell $(PKG_CONFIG) --variable libdir $(LUA_IMPL))
LUA_INC ?= $(shell $(PKG_CONFIG) --variable includedir $(LUA_IMPL))
LUA_LIBS = $(shell $(PKG_CONFIG) --libs $(LUA_IMPL))
ZLIB_LIBS = $(shell $(PKG_CONFIG) --libs zlib)
endif
ifeq ($(UNAME), Linux)
OS_FLAGS ?= -shared
endif
ifeq ($(UNAME), Darwin)
OS_FLAGS ?= -bundle -undefined dynamic_lookup
MAC_ENV ?= env MACOSX_DEPLOYMENT_TARGET='10.3'
endif
ifneq ($(DEBUG),)
DBG = -ggdb
endif
ifeq ($(DEV),)
WARN = -Wall -Wno-unused-value
else
WARN = -Wall -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic
endif
INCLUDES = -I$(LUA_INC)
DEFINES =
LIBS = $(ZLIB_LIBS) -lstdc++
COMMONFLAGS = -O2 -g -pipe -fPIC $(OS_FLAGS) $(DBG)
LF = $(LIBS) $(LDFLAGS)
CF = $(INCLUDES) $(DEFINES) $(COMMONFLAGS) $(WARN) -DPTHREADS $(CFLAGS)
#SCR = src/lua/*.lua src/lua/cURL/*.lua src/lua/cURL/impl/*.lua
SRCS = src/*.cpp
OBJS = $(subst src/,,$(subst .c,.o,$(SRCS)))
BIN = $(T).so
STATIC_LIB = $(T).a
all: $(BIN)
$(BIN): $(SRCS)
$(CC) $(CF) -o $@ $^ $(LF)
$(OBJS): $(SRCS)
$(CC) $(CF) -c $^ $(LF)
$(STATIC_LIB): $(OBJS)
ar rcs $@ $^
#install: all
# $(INSTALL) -d $(DESTDIR)$(LUA_CMOD) $(DESTDIR)$(LUA_LMOD)/cURL/impl
# $(INSTALL) $(BIN) $(DESTDIR)$(LUA_CMOD)
# $(INSTALL) src/lua/cURL.lua $(DESTDIR)$(LUA_LMOD)
# $(INSTALL) src/lua/cURL/safe.lua $(DESTDIR)$(LUA_LMOD)/cURL
# $(INSTALL) src/lua/cURL/utils.lua $(DESTDIR)$(LUA_LMOD)/cURL
# $(INSTALL) src/lua/cURL/impl/cURL.lua $(DESTDIR)$(LUA_LMOD)/cURL/impl
clean:
$(RM) -f $(BIN) $(OBJS) $(STATIC_LIB)
-735
View File
@@ -1,735 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#ifdef _WIN32
#define LZIP_EXPORT __declspec(dllexport)
#else
#define LZIP_EXPORT
#endif
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include "luajit.h"
}
typedef unsigned char byte;
typedef unsigned int dword;
typedef unsigned long lword;
char* AllocString(char* st)
{
if (st == NULL) {
return NULL;
}
int aslen = strlen(st) + 1;
char* al = new char[aslen];
strcpy(al, st);
return al;
}
char* AllocStringLen(int len)
{
char* al = new char[len+1];
al[len] = 0;
return al;
}
void FreeString(char* st)
{
if (st) delete st;
}
// =============
// Configuration
// =============
static const int FS_INFLATE_BUFFER = 65536;
// ==========================
// Zip File format structures
// ==========================
#pragma pack(push, 1)
struct zf_cdHeader_s {
int sig; // 0x02014b50 (50,4B,01,02)
short ver_made;
short ver_ext;
short flag;
short method;
short ftime;
short fdate;
int crc32;
lword szComp;
lword szUcomp;
short szName;
short szExtra;
short szComm;
short nDisk;
short attInt;
int attExt;
int hOffset;
};
struct zf_localHeader_s {
int sig; // 0x04034b50 (50,4B,03,04)
short ver_ext;
short flag;
short method;
short ftime;
short fdate;
int crc32;
lword szComp;
lword szUcomp;
short szName;
short szExtra;
};
struct zf_dataDesc_s {
int crc32;
lword szComp;
lword szUcomp;
};
struct zf_cdEnd_s {
int sig; // 0x06054b50 (50,4B,05,06)
short nDisk;
short stDisk;
short noeDisk;
short noeTotal;
int szTotal;
int cdOffset;
short szComm;
};
#pragma pack(pop)
// =========================
// Zip File format constants
// =========================
static const int ZF_MAXVER = 20;
static const int ZF_GPBF_ENC = 0x0001;
static const int ZF_GPBF_DD = 0x0008;
static const int ZF_METHOD_STORE = 0;
static const int ZF_METHOD_DEFLATE = 8;
static const int ZF_SIG_CDHEADER = 0x02014B50;
static const int ZF_SIG_LOCALHEADER = 0x04034B50;
static const int ZF_SIG_CDEND = 0x06054B50;
// ===============
// ZLib Alloc/Free
// ===============
static void* ZF_Alloc(void* unused, dword num, dword size)
{
return new byte[num*size];
}
static void ZF_Free(void* unused, void* ptr)
{
delete (byte*)ptr;
}
// =======
// Classes
// =======
struct fs_fileInfo_s {
FILE* f; // Zip file
char* name; // Filename
int fo; // File offset
int szU; // Uncompressed size
int szC; // Compressed size, 0 if not compressed
};
// ================
// fsInflator class
// ================
class fs_inflator_c {
public:
fs_inflator_c(fs_fileInfo_s* i);
~fs_inflator_c();
int Inflate(byte* buf, int len);// Inflate
private:
int pC; // Read pointer
byte* ibuf; // Input buffer
int ibuflen; // Input buffer length
fs_fileInfo_s* i; // Info structure
z_stream* zst; // ZLib stream
void FillInput();// Fill decompression input
};
fs_inflator_c::fs_inflator_c(fs_fileInfo_s* info)
{
i = info;
// Initialise stream
zst = new z_stream;
memset(zst, 0, sizeof(z_stream));
zst->zalloc = ZF_Alloc;
zst->zfree = ZF_Free;
// Initialise decompression input
pC = 0;
if (i->szC < FS_INFLATE_BUFFER) {
ibuflen = i->szC;
} else {
ibuflen = FS_INFLATE_BUFFER;
}
ibuf = new byte[ibuflen];
FillInput();
// Start decompressor
inflateInit2(zst, -MAX_WBITS);
}
fs_inflator_c::~fs_inflator_c()
{
// Stop decompressor
inflateEnd(zst);
// Release stream and input buffer
delete ibuf;
delete zst;
}
void fs_inflator_c::FillInput()
{
// Relocate any remaining input
int remin = zst->avail_in;
if (remin) {
memcpy(ibuf, zst->next_in, remin);
}
// Get reading amount
int rdmax = ibuflen - remin;
int rd = i->szC - pC;
if (rd > rdmax) {
rd = rdmax;
}
// Read into buffer
if (rd) {
fseek(i->f, i->fo + pC, SEEK_SET);
fread(ibuf + remin, rd, 1, i->f);
}
// Update stream
zst->next_in = ibuf;
zst->avail_in+= rd;
pC+= rd;
}
int fs_inflator_c::Inflate(byte* out, int len)
{
// Prepare stream
zst->next_out = out;
zst->avail_out = len;
while (1) {
// Decompress some data
int r = inflate(zst, Z_SYNC_FLUSH);
switch (r) {
case Z_OK:
// Progress made, check if we're done
if (zst->avail_out == 0) {
return len;
}
break;
case Z_BUF_ERROR:
// No progress made, so give it more input
FillInput();
break;
default:
// We got an error
case Z_STREAM_END:
// Reached the end of the stream
return len - zst->avail_out;
}
}
}
// =============
// fsFile class
// =============
enum vf_state_e {
VF_OPEN =0x01, // Open
VF_SEEK =0x04 // Seek enabled
};
class fs_file_c {
public:
fs_file_c(fs_fileInfo_s* i);
~fs_file_c();
void Seek(int pos, int mode); // Seek
int Read(byte* buf, int len); // Read data
int Length(); // Return the file length
int Tell(); // Return the read pointer
private:
fs_fileInfo_s* i; // Info structure
int pU; // Read pointer
fs_inflator_c* inf; // Inflator
};
fs_file_c::fs_file_c(fs_fileInfo_s* info)
{
i = info;
// Create inflator
if (i->szC) {
inf = new fs_inflator_c(i);
} else {
inf = NULL;
}
// Set position
pU = 0;
}
fs_file_c::~fs_file_c()
{
delete inf;
}
void fs_file_c::Seek(int pos, int mode)
{
int seekto;
switch (mode) {
case SEEK_SET:
seekto = pos;
break;
case SEEK_CUR:
seekto = pU + pos;
break;
case SEEK_END:
seekto = i->szU - pos;
break;
default:
return;
}
if (i->szC) {
int diff = seekto - pU;
if (diff > 0) {
// Seek forward
byte* sk = new byte[diff];
Read(sk, diff);
delete[] sk;
} else if (diff < 0) {
// Restart reading
pU = 0;
// Recreate inflator
delete inf;
inf = new fs_inflator_c(i);
if (seekto) {
// Seek forward
byte* sk = new byte[seekto];
Read(sk, seekto);
delete[] sk;
}
}
} else {
pU = seekto;
if (pU < 0) {
pU = 0;
} else if (pU > i->szU) {
pU = i->szU;
}
}
}
int fs_file_c::Read(byte* out, int len)
{
// Determine read length
int rp = len + pU;
if (rp > i->szU) len = i->szU - pU;
if (len == 0) {
return 0;
}
if (i->szC) {
// Decompress
len = inf->Inflate(out, len);
} else {
// Raw read
fseek(i->f, i->fo + pU, SEEK_SET);
len = fread(out, 1, len, i->f);
}
pU+= len;
return len;
}
int fs_file_c::Length()
{
return i->szU;
}
int fs_file_c::Tell()
{
return pU;
}
// =============
// zipFile class
// =============
class fs_zipFile_c {
public:
fs_zipFile_c(const char* zname);
~fs_zipFile_c();
int numFiles;
fs_fileInfo_s** files;
private:
FILE* zf; // File handle
int filesSz;
int GetSignature(); // Get next signature
};
int fs_zipFile_c::GetSignature()
{
int sig = 0;
if (fread(&sig, 4, 1, zf) == 0) {
return 0;
}
fseek(zf, -4, SEEK_CUR);
return sig;
}
fs_zipFile_c::fs_zipFile_c(const char* zname)
{
numFiles = 0;
filesSz = 32;
files = new fs_fileInfo_s*[filesSz];
int sig;
// Open and lock file
zf = fopen(zname, "rb");
if (zf == NULL) {
return;
}
// Check signature
sig = GetSignature();
if (strncmp((char*)&sig, "Rar", 3) == 0) {
fclose(zf);
return;
}
// Read local headers
while (sig == ZF_SIG_LOCALHEADER) {
zf_localHeader_s lh;
if (fread(&lh, sizeof(lh), 1, zf) == 0) {
fclose(zf);
return;
}
if (lh.szName) {
// Read filename
char* fname = AllocStringLen(lh.szName);
fread(fname, lh.szName, 1, zf);
// Add it in if it is a file
if (fname[lh.szName-1] != '/') {
// Fill in info
fs_fileInfo_s* fi = new fs_fileInfo_s;
fi->f = zf;
fi->name = fname;
fi->fo = ftell(zf) + lh.szExtra;
fi->szU = lh.szUcomp;
fi->szC = (lh.method == ZF_METHOD_DEFLATE)? lh.szComp : 0;
// Record file
if (numFiles == filesSz) {
filesSz<<= 1;
files = (fs_fileInfo_s**)realloc(files, sizeof(fs_fileInfo_s*)*filesSz);
}
files[numFiles++] = fi;
} else {
FreeString(fname);
}
// Skip the extra information and file data
fseek(zf, lh.szExtra + lh.szComp, SEEK_CUR);
}
sig = GetSignature();
}
}
fs_zipFile_c::~fs_zipFile_c()
{
fclose(zf);
for (int f = 0; f < numFiles; f++) {
delete files[f]->name;
delete files[f];
}
delete files;
}
// =============
// Lua Interface
// =============
static int IsUserData(lua_State* L, int index, const char* metaName)
{
if (lua_type(L, index) != LUA_TUSERDATA || lua_getmetatable(L, index) == 0) {
return 0;
}
lua_getfield(L, lua_upvalueindex(1), metaName);
int ret = lua_rawequal(L, -2, -1);
lua_pop(L, 2);
return ret;
}
struct lzip_s {
fs_zipFile_c* zipFile;
};
static lzip_s* GetZip(lua_State* L, const char* method, bool valid)
{
if ( !IsUserData(L, 1, "zipMeta") ) {
luaL_error(L, "zip:%s() must be used on a zip handle", method);
}
lzip_s* lz = (lzip_s*)lua_touserdata(L, 1);
lua_remove(L, 1);
if (valid && lz->zipFile == NULL) {
luaL_error(L, "zip:%s(): zip handle is closed");
}
return lz;
}
struct lzipFile_s {
fs_file_c* file;
};
static lzipFile_s* GetZipFile(lua_State* L, const char* method, bool valid)
{
if ( !IsUserData(L, 1, "zipFileMeta") ) {
luaL_error(L, "zipFile:%s() must be used on a zip file handle", method);
}
lzipFile_s* lzf = (lzipFile_s*)lua_touserdata(L, 1);
lua_remove(L, 1);
if (valid && lzf->file == NULL) {
luaL_error(L, "zipFile:%s(): zip file handle is closed");
}
return lzf;
}
static int l_open(lua_State* L)
{
int n = lua_gettop(L);
if (n < 1 || !lua_isstring(L, 1)) {
luaL_error(L, "Usage: lzip.open(fileName)");
}
fs_zipFile_c* zipFile = new fs_zipFile_c(lua_tostring(L, 1));
if (zipFile->numFiles == 0) {
delete zipFile;
return 0;
}
lzip_s* lz = (lzip_s*)lua_newuserdata(L, sizeof(lzip_s));
lz->zipFile = zipFile;
lua_pushvalue(L, lua_upvalueindex(2));
lua_setmetatable(L, -2);
return 1;
}
static int l_zip_Close(lua_State* L)
{
lzip_s* lz = GetZip(L, "Closea", false);
delete lz->zipFile;
lz->zipFile = NULL;
return 0;
}
static int l_zip_GetNumFiles(lua_State* L)
{
lzip_s* lz = GetZip(L, "GetNumFiles", true);
lua_pushinteger(L, lz->zipFile->numFiles);
return 1;
}
static int l_zip_GetFileName(lua_State* L)
{
lzip_s* lz = GetZip(L, "GetFileName", true);
int n = lua_gettop(L);
if (n < 1 || !lua_isnumber(L, 1)) {
luaL_error(L, "Usage: zip:GetFileName(index)");
}
int index = lua_tointeger(L, 1);
if (index < 1 || index > lz->zipFile->numFiles) {
return 0;
}
lua_pushstring(L, lz->zipFile->files[index - 1]->name);
return 1;
}
static int l_zip_GetFileSize(lua_State* L)
{
lzip_s* lz = GetZip(L, "GetFileSize", true);
int n = lua_gettop(L);
if (n < 1 || !lua_isnumber(L, 1)) {
luaL_error(L, "Usage: zip:GetFileSize(index)");
}
int index = lua_tointeger(L, 1);
if (index < 1 || index > lz->zipFile->numFiles) {
return 0;
}
lua_pushinteger(L, lz->zipFile->files[index - 1]->szU);
return 1;
}
static int l_zip_OpenFile(lua_State* L)
{
lzip_s* lz = GetZip(L, "OpenFile", true);
int n = lua_gettop(L);
if (n < 1 || !(lua_isnumber(L, 1) || lua_isstring(L, 1))) {
luaL_error(L, "Usage: zip:OpenFile(index) or zip:OpenFile(fileName)");
}
fs_fileInfo_s* i = NULL;
if (lua_isnumber(L, 1)) {
int index = lua_tointeger(L, 1);
if (index < 1 || index > lz->zipFile->numFiles) {
luaL_error(L, "zip:OpenFile(): invalid index");
}
i = lz->zipFile->files[index - 1];
} else {
const char* name = lua_tostring(L, 1);
for (int index = 0; index < lz->zipFile->numFiles; index++) {
if ( !strcmp(name, lz->zipFile->files[index]->name) ) {
i = lz->zipFile->files[index];
break;
}
}
if ( !i ) {
return 0;
}
}
fs_file_c* file = new fs_file_c(i);
lzipFile_s* lzf = (lzipFile_s*)lua_newuserdata(L, sizeof(lzipFile_s));
lzf->file = file;
lua_pushvalue(L, lua_upvalueindex(2));
lua_setmetatable(L, -2);
return 1;
}
static int l_zipFile_Close(lua_State* L)
{
lzipFile_s* lzf = GetZipFile(L, "Close", false);
delete lzf->file;
lzf->file = NULL;
return 0;
}
static int l_zipFile_Read(lua_State* L)
{
lzipFile_s* lzf = GetZipFile(L, "Read", true);
int n = lua_gettop(L);
if (n < 1) {
luaL_error(L, "Usage: zipFile:Read(count) or zipFile:read(\"*a\")");
}
int count;
if (lua_isnumber(L, 1)) {
count = lua_tointeger(L, 1);
} else {
if ( !strcmp(lua_tostring(L, 1), "*a") ) {
count = lzf->file->Length() - lzf->file->Tell();
} else {
luaL_error(L, "zipFile:Read(): unrecognised format: %s", lua_tostring(L, 1));
}
}
if (count < 1) {
lua_pushstring(L, "");
return 1;
}
byte* buf = new byte[count];
lzf->file->Read(buf, count);
lua_pushlstring(L, (char*)buf, count);
return 1;
}
static int l_zipFile_Length(lua_State* L)
{
lzipFile_s* lzf = GetZipFile(L, "Read", true);
lua_pushinteger(L, lzf->file->Length());
return 1;
}
extern "C" LZIP_EXPORT int luaopen_lzip(lua_State* L)
{
lua_settop(L, 0);
lua_newtable(L); // Library table
lua_newtable(L); // Zip metatable
lua_newtable(L); // Zip file metatable
lua_pushvalue(L, 2);
lua_setfield(L, 1, "zipMeta");
lua_pushvalue(L, 2);
lua_setfield(L, 2, "__index");
lua_pushvalue(L, 3);
lua_setfield(L, 1, "zipFileMeta");
lua_pushvalue(L, 3);
lua_setfield(L, 3, "__index");
lua_pushvalue(L, 1);
lua_pushvalue(L, 2);
lua_pushcclosure(L, l_open, 2);
lua_setfield(L, 1, "open");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zip_Close, 1);
lua_setfield(L, 2, "__gc");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zip_Close, 1);
lua_setfield(L, 2, "Close");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zip_GetNumFiles, 1);
lua_setfield(L, 2, "GetNumFiles");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zip_GetFileName, 1);
lua_setfield(L, 2, "GetFileName");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zip_GetFileSize, 1);
lua_setfield(L, 2, "GetFileSize");
lua_pushvalue(L, 1);
lua_pushvalue(L, 3);
lua_pushcclosure(L, l_zip_OpenFile, 2);
lua_setfield(L, 2, "OpenFile");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zipFile_Close, 1);
lua_setfield(L, 3, "__gc");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zipFile_Close, 1);
lua_setfield(L, 3, "Close");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zipFile_Read, 1);
lua_setfield(L, 3, "Read");
lua_pushvalue(L, 1);
lua_pushcclosure(L, l_zipFile_Length, 1);
lua_setfield(L, 3, "Length");
// Pop metatables
lua_pop(L, 2);
return 1;
}
-301
View File
@@ -1,301 +0,0 @@
#@
-- Path of Building
--
-- Module: Update Check
-- Checks for updates
--
local connectionProtocol, proxyURL = ...
local xml = require("xml")
local sha1 = require("sha1")
local curl = require("lcurl.safe")
local lzip = require("lzip")
local globalRetryLimit = 10
local function downloadFileText(source, file)
for i = 1, 5 do
if i > 1 then
ConPrintf("Retrying... (%d of 5)", i)
end
local text = ""
local easy = curl.easy()
local escapedUrl = source..easy:escape(file)
easy:setopt_url(escapedUrl)
easy:setopt(curl.OPT_ACCEPT_ENCODING, "")
if connectionProtocol then
easy:setopt(curl.OPT_IPRESOLVE, connectionProtocol)
end
if proxyURL then
easy:setopt(curl.OPT_PROXY, proxyURL)
end
easy:setopt_writefunction(function(data)
text = text..data
return true
end)
local _, error = easy:perform()
easy:close()
if not error then
return text
end
ConPrintf("Download failed (%s)", error:msg())
if globalRetryLimit == 0 or i == 5 then
return nil, error:msg()
end
globalRetryLimit = globalRetryLimit - 1
end
end
local function downloadFile(source, file, outName)
for i = 1, 5 do
if i > 1 then
ConPrintf("Retrying... (%d of 5)", i)
end
local easy = curl.easy()
local escapedUrl = source..easy:escape(file)
easy:setopt_url(escapedUrl)
easy:setopt(curl.OPT_ACCEPT_ENCODING, "")
if connectionProtocol then
easy:setopt(curl.OPT_IPRESOLVE, connectionProtocol)
end
if proxyURL then
easy:setopt(curl.OPT_PROXY, proxyURL)
end
local file = io.open(outName, "wb+")
easy:setopt_writefunction(file)
local _, error = easy:perform()
easy:close()
file:close()
if not error then
return true
end
ConPrintf("Download failed (%s)", error:msg())
if globalRetryLimit == 0 or i == 5 then
return nil, error:msg()
end
globalRetryLimit = globalRetryLimit - 1
end
return true
end
ConPrintf("Checking for update...")
-- Use built-in helpers to obtain absolute paths without spawning a shell.
local scriptPath = (GetScriptPath and GetScriptPath()) or "."
local runtimePath = (GetRuntimePath and GetRuntimePath()) or scriptPath
-- Load and process local manifest
local localVer
local localPlatform, localBranch
local localFiles = { }
local localManXML = xml.LoadXMLFile(scriptPath.."/manifest.xml")
local localSource
if localManXML and localManXML[1].elem == "PoBVersion" then
for _, node in ipairs(localManXML[1]) do
if type(node) == "table" then
if node.elem == "Version" then
localVer = node.attrib.number
localPlatform = node.attrib.platform
localBranch = node.attrib.branch
elseif node.elem == "Source" then
if node.attrib.part == "default" then
localSource = node.attrib.url
end
elseif node.elem == "File" then
local fullPath
node.attrib.name = node.attrib.name:gsub("{space}", " ")
fullPath = scriptPath .. "/" .. node.attrib.name
localFiles[node.attrib.name] = { sha1 = node.attrib.sha1, part = node.attrib.part, platform = node.attrib.platform, fullPath = fullPath }
end
end
end
end
if not localVer or not localSource or not localBranch or not next(localFiles) then
ConPrintf("Update check failed: invalid local manifest")
return nil, "Invalid local manifest"
end
localSource = localSource:gsub("{branch}", localBranch)
-- Download and process remote manifest
local remoteVer
local remoteFiles = { }
local remoteSources = { }
local remoteManText, errMsg = downloadFileText(localSource, "manifest.xml")
if not remoteManText then
ConPrintf("Update check failed: couldn't download version manifest")
return nil, "Couldn't download version manifest.\nReason: "..errMsg.."\nCheck your internet connectivity.\nIf you are using a proxy, specify it in Options."
end
local remoteManXML = xml.ParseXML(remoteManText)
if remoteManXML and remoteManXML[1].elem == "PoBVersion" then
for _, node in ipairs(remoteManXML[1]) do
if type(node) == "table" then
if node.elem == "Version" then
remoteVer = node.attrib.number
elseif node.elem == "Source" then
if not remoteSources[node.attrib.part] then
remoteSources[node.attrib.part] = { }
end
remoteSources[node.attrib.part][node.attrib.platform or "any"] = node.attrib.url
elseif node.elem == "File" then
if not node.attrib.platform or node.attrib.platform == localPlatform then
local fullPath
fullPath = scriptPath .. "/" .. node.attrib.name
remoteFiles[node.attrib.name] = { sha1 = node.attrib.sha1, part = node.attrib.part, platform = node.attrib.platform, fullPath = fullPath }
end
end
end
end
end
if not remoteVer or not next(remoteSources) or not next(remoteFiles) then
ConPrintf("Update check failed: invalid remote manifest")
return nil, "Invalid remote manifest"
end
-- Build lists of files to be updated or deleted
local updateFiles = { }
for name, data in pairs(remoteFiles) do
data.name = name
local sanitizedName = name:gsub("{space}", " ")
if (not localFiles[name] or localFiles[name].sha1 ~= data.sha1) and (not localFiles[sanitizedName] or localFiles[sanitizedName].sha1 ~= data.sha1) then
table.insert(updateFiles, data)
elseif localFiles[name] then
local file = io.open(localFiles[name].fullPath, "rb")
if not file then
ConPrintf("Warning: '%s' doesn't exist, it will be re-downloaded", data.name)
table.insert(updateFiles, data)
else
local content = file:read("*a")
file:close()
if data.sha1 ~= sha1(content) and data.sha1 ~= sha1(content:gsub("\n", "\r\n")) then
ConPrintf("Warning: Integrity check on '%s' failed, it will be replaced", data.name)
table.insert(updateFiles, data)
end
end
end
end
local deleteFiles = { }
for name, data in pairs(localFiles) do
data.name = name
local unSanitizedName = name:gsub(" ", "{space}")
if not remoteFiles[name] and not remoteFiles[unSanitizedName] then
table.insert(deleteFiles, data)
end
end
if #updateFiles == 0 and #deleteFiles == 0 then
ConPrintf("No update available.")
return "none"
end
MakeDir("Update")
ConPrintf("Downloading update...")
-- Download changelog
downloadFile(localSource, "changelog.txt", scriptPath.."/changelog.txt")
-- Download files that need updating
local failedFile = false
local zipFiles = { }
for index, data in ipairs(updateFiles) do
if UpdateProgress then
UpdateProgress("Downloading %d/%d", index, #updateFiles)
end
local partSources = remoteSources[data.part]
local source = partSources[localPlatform] or partSources["any"]
source = source:gsub("{branch}", localBranch)
local fileName = scriptPath.."/Update/"..data.name:gsub("[\\/]","{slash}")
data.updateFileName = fileName
local zipName = source:match("/([^/]+%.zip)$")
if zipName then
if not zipFiles[zipName] then
ConPrintf("Downloading %s...", zipName)
local zipFileName = scriptPath.."/Update/"..zipName
downloadFile(source, "", zipFileName)
zipFiles[zipName] = lzip.open(zipFileName)
end
local zip = zipFiles[zipName]
if zip then
local zippedFile = zip:OpenFile(data.name)
if zippedFile then
local file = io.open(fileName, "wb+")
file:write(zippedFile:Read("*a"))
file:close()
zippedFile:Close()
else
ConPrintf("Couldn't extract '%s' from '%s' (extract failed)", data.name, zipName)
end
else
ConPrintf("Couldn't extract '%s' from '%s' (zip open failed)", data.name, zipName)
end
else
local skipDownload
local file = io.open(fileName, "rb")
if file then
local content = file:read("*all")
if data.sha1 == sha1(content) or data.sha1 == sha1(content:gsub("\n", "\r\n")) then
ConPrintf("Using file from previous update attempt '%s'", fileName)
skipDownload = true
end
file:close()
end
if not skipDownload then
ConPrintf("Downloading %s... (%d of %d)", data.name, index, #updateFiles)
downloadFile(source, data.name, fileName)
end
end
local file = io.open(fileName, "rb")
if not file then
failedFile = true
else
local content = file:read("*all")
if data.sha1 ~= sha1(content) and data.sha1 ~= sha1(content:gsub("\n", "\r\n")) then
ConPrintf("Hash mismatch on '%s'", fileName)
failedFile = true
end
file:close()
end
end
for name, zip in pairs(zipFiles) do
zip:Close()
os.remove(scriptPath.."/Update/"..name)
end
if failedFile then
ConPrintf("Update failed: one or more files couldn't be downloaded")
return nil, "One or more files couldn't be downloaded.\nCheck your internet connectivity,\nor try again later."
end
-- Create new manifest
localManXML = { elem = "PoBVersion" }
table.insert(localManXML, { elem = "Version", attrib = { number = remoteVer, platform = localPlatform, branch = localBranch } })
for part, platforms in pairs(remoteSources) do
for platform, url in pairs(platforms) do
table.insert(localManXML, { elem = "Source", attrib = { part = part, platform = platform ~= "any" and platform, url = url } })
end
end
for name, data in pairs(remoteFiles) do
table.insert(localManXML, { elem = "File", attrib = { name = data.name, sha1 = data.sha1, part = data.part, platform = data.platform } })
end
xml.SaveXMLFile(localManXML, scriptPath.."/Update/manifest.xml")
-- Build list of operations to apply the update
local updateMode = "normal"
local ops = { }
for _, data in pairs(updateFiles) do
-- Ensure that the destination path of this file exists
local dirStr = ""
for dir in data.fullPath:gmatch("([^/]*/)") do
dirStr = dirStr .. dir
MakeDir(dirStr)
end
table.insert(ops, 'move "'..data.updateFileName..'" "'..data.fullPath..'"')
end
for _, data in pairs(deleteFiles) do
table.insert(ops, 'delete "'..data.fullPath..'"')
end
table.insert(ops, 'move "'..scriptPath..'/Update/manifest.xml" "'..scriptPath..'/manifest.xml"')
-- Write operations file
local opFile = io.open(scriptPath.."/Update/opFile.txt", "w+")
opFile:write(table.concat(ops, "\n"))
opFile:close()
ConPrintf("Update is ready.")
return updateMode
-843
View File
@@ -1,843 +0,0 @@
<PoBVersion>
<Version number="2.56.0" branch="master" platform="any" />
<Source part="default" url="https://raw.githubusercontent.com/meehl/RustyPathOfBuilding/main/lua/poe1/" />
<Source part="origin" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding/{branch}/" />
<Source part="runtime" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding/{branch}/runtime/" />
<Source part="program" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding/{branch}/src/" />
<Source part="tree" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding/{branch}/src/" />
<File name="changelog.txt" part="origin" sha1="933ef317b5a11557ce262cdc883cfa9e4e87b55c" />
<File name="help.txt" part="origin" sha1="e486cb63a78f5ca355430b67fa23e02fd30f5771" />
<File name="LICENSE.md" part="origin" sha1="c77635aa1ba0a2ffe8eb72f93b3376e3a3d2041a" />
<File name="Assets/ascendants/ascendant.jpeg" part="program" sha1="c9edaa10dad44c5361f873e68fa39a831338e9ec" />
<File name="Assets/ascendants/assassin.jpeg" part="program" sha1="82d8d31e9a1d264c08ef4a957fe28177fb67f5bf" />
<File name="Assets/ascendants/berserker.jpeg" part="program" sha1="70ccdec8abbe2a9a4168ab38831ca26bb2fc7255" />
<File name="Assets/ascendants/champion.jpeg" part="program" sha1="3c11e9d2b2b08cd28ff06bf0e13f0b41fb0698ed" />
<File name="Assets/ascendants/chieftain.jpeg" part="program" sha1="2c6426835fbf3027c89408d1f5fa0b7c65811c44" />
<File name="Assets/ascendants/deadeye.jpeg" part="program" sha1="db3c642f1efc677df0139249d93075f4c0c2b19c" />
<File name="Assets/ascendants/duelist.jpeg" part="program" sha1="315ad783038d13b20f1f038f3f0e32aca4aa6b17" />
<File name="Assets/ascendants/elementalist.jpeg" part="program" sha1="693e024f76ef69270933fb10070e41696e4cf4f2" />
<File name="Assets/ascendants/gladiator.jpeg" part="program" sha1="cd71323728b591f79200a8ce6ec9e0fcc10fae3a" />
<File name="Assets/ascendants/guardian.jpeg" part="program" sha1="5797165fa27ff6cb62d9a709c171d4c0a0c2e503" />
<File name="Assets/ascendants/hierophant.jpeg" part="program" sha1="41c03949a987a380074ec78848154be3a84ed618" />
<File name="Assets/ascendants/inquisitor.jpeg" part="program" sha1="a7b100990fc8d74c7de8182495d2840fa47dc7e2" />
<File name="Assets/ascendants/juggernaut.jpeg" part="program" sha1="381fb7fa80da82a8560b544c9566042ec6438ba5" />
<File name="Assets/ascendants/marauder.jpeg" part="program" sha1="6dda7b04e864c66841272b42c93955831378de3f" />
<File name="Assets/ascendants/necromancer.jpeg" part="program" sha1="b09dc962e2c539ee371c398e3f862da2f73ec49d" />
<File name="Assets/ascendants/occultist.jpeg" part="program" sha1="3c3124c4acfd2dab0163a2cc886c7f9d7da5c7d7" />
<File name="Assets/ascendants/pathfinder.jpeg" part="program" sha1="9b2d1b29c794f8c8f77945ac8c25395c94095583" />
<File name="Assets/ascendants/raider.jpeg" part="program" sha1="4dda4b034c1f58404b98179b64d08599273fd544" />
<File name="Assets/ascendants/ranger.jpeg" part="program" sha1="d4fef8b5e0e6581acf467652371299469fc1b4c5" />
<File name="Assets/ascendants/saboteur.jpeg" part="program" sha1="6644c93405c7303f190716f6ac65e3784daee862" />
<File name="Assets/ascendants/scion.jpeg" part="program" sha1="0a1cda2e166199a23825599c063a0362ede0364f" />
<File name="Assets/ascendants/shadow.jpeg" part="program" sha1="07d5aa2cffad83917d42f767509f5c71c0b8d20d" />
<File name="Assets/ascendants/slayer.jpeg" part="program" sha1="a49448923dd0423b232c3ef51d3c747c2326aa68" />
<File name="Assets/ascendants/templar.jpeg" part="program" sha1="29ad35a62925836d1a74c3f1778710fd393087de" />
<File name="Assets/ascendants/trickster.jpeg" part="program" sha1="379afc28a6caee74b4649f674ab1ff1d34cbbcbf" />
<File name="Assets/ascendants/warden.jpeg" part="program" sha1="4dda4b034c1f58404b98179b64d08599273fd544" />
<File name="Assets/ascendants/witch.jpeg" part="program" sha1="e4d3efec008934c6d24d4be0178fd8934da1244e" />
<File name="Assets/game_ui_small.png" part="program" sha1="3e3f01a7c21ffe5ee7dfb644e9f3b7188c319d4d" />
<File name="Assets/icon_amulet.png" part="program" sha1="5979958dc0975fea63d57b15ef311ecda56f3fda" />
<File name="Assets/icon_belt.png" part="program" sha1="a6739f6a6d5ebb100ea57732227c2bb568483eb6" />
<File name="Assets/icon_body_armour.png" part="program" sha1="c5237359ed6ea5b81772b1d35029b757c87041cc" />
<File name="Assets/icon_boots.png" part="program" sha1="7e52b33f4c72802cf6b63056abe21e26719b857c" />
<File name="Assets/icon_bow.png" part="program" sha1="c0a5e9c8b8030b0f3f331782a0a161b901be0999" />
<File name="Assets/icon_gloves.png" part="program" sha1="9fe16986f5c2858b40149416e89f036a9e9582a0" />
<File name="Assets/icon_helmet.png" part="program" sha1="eb3271f3e9e94e2523ce2d0b90c6fd2b1c3e0435" />
<File name="Assets/icon_quiver.png" part="program" sha1="719bd6edc05f655ff5c7ec4a047dde34b6006e0e" />
<File name="Assets/icon_ring_left.png" part="program" sha1="01b88d06e8e505af62a776e818b77fb20a8661d6" />
<File name="Assets/icon_ring_right.png" part="program" sha1="dc1ab4a69f7199970a28cac489b0ba9aeeff028b" />
<File name="Assets/icon_shield.png" part="program" sha1="7ed6a0b926e593588daffc9149041cd817ca264c" />
<File name="Assets/icon_shield_swap.png" part="program" sha1="d82df8de7a60827d81007f141db5867eca080f8a" />
<File name="Assets/icon_weapon.png" part="program" sha1="24fd23457f7b609324ad5f5bb8cb576cc4a7c058" />
<File name="Assets/icon_weapon_2.png" part="program" sha1="10a946226cfe1832ff839b77c0d927d4be2bb43c" />
<File name="Assets/icon_weapon_2_swap.png" part="program" sha1="2e0ee90278daa40da9177e0658f2900c49a69127" />
<File name="Assets/icon_weapon_swap.png" part="program" sha1="2fe92098fb38157483928bad3a26c623d4fefae1" />
<File name="Assets/range_guide.png" part="program" sha1="825cef1fe84d30da6e280799f0a885e270807f31" />
<File name="Assets/ring.png" part="program" sha1="6ef89c50f3505dd2c114b3edbcac017ab969d176" />
<File name="Assets/ShadedInnerRing.png" part="program" sha1="6ad9088ebaed6646dbd3d231d563dc9611ba4bc6" />
<File name="Assets/ShadedInnerRingFlipped.png" part="program" sha1="c13f41ef7cbfc14017a10776d21b121f0e558667" />
<File name="Assets/ShadedOuterRing.png" part="program" sha1="988dee6e0cf9906d78015bc1762b1d95983e89cb" />
<File name="Assets/ShadedOuterRingFlipped.png" part="program" sha1="ffffef32179d39d48db697e9c9e07fdf022457f7" />
<File name="Assets/small_ring.png" part="program" sha1="03e2039559d686a7df2d66bd6f92938e7e02da76" />
<File name="Classes/BuildListControl.lua" part="program" sha1="dd5b90a9f901096ed9d88783398ca5060b2419bf" />
<File name="Classes/ButtonControl.lua" part="program" sha1="697870f9f43eee2c804be087849b46849c83153a" />
<File name="Classes/CalcBreakdownControl.lua" part="program" sha1="bd5ce2ddfdca47d7945f9029f134cbfa93511fd4" />
<File name="Classes/CalcSectionControl.lua" part="program" sha1="468063496e5e998ba4f79450df5b70e9ebb06077" />
<File name="Classes/CalcsTab.lua" part="program" sha1="e825dbbf97f114ac1425a6cdef04e3ac00841857" />
<File name="Classes/CheckBoxControl.lua" part="program" sha1="d828081e58f493f7688f8a3eed5af1ee389e3326" />
<File name="Classes/ConfigSetListControl.lua" part="program" sha1="dcd4b1ef3e7a19be3c8e551c446c509865dbcedc" />
<File name="Classes/ConfigTab.lua" part="program" sha1="d093c29624275c92beade4e8eff186ac7bdee5f8" />
<File name="Classes/Control.lua" part="program" sha1="1e1502ee51ba61006c346e9360131b7d3754b542" />
<File name="Classes/ControlHost.lua" part="program" sha1="8521dcf6c04880f22c2972618e58aa50fbea1be7" />
<File name="Classes/DraggerControl.lua" part="program" sha1="239b2fbc675d4fe9a8fe36a79fe93870ae298bc6" />
<File name="Classes/DropDownControl.lua" part="program" sha1="a67f62e62c480d77ae82f9a6cf6b440ec0b79e3c" />
<File name="Classes/EditControl.lua" part="program" sha1="123ec882687fc517145dad2ad91c7e80acdfbb4e" />
<File name="Classes/ExtBuildListControl.lua" part="program" sha1="4d1dedc752e5c979ae0ad3928faaec8b8ea052be" />
<File name="Classes/ExtBuildListProvider.lua" part="program" sha1="79d6bab71c0e0194e7c5b48e6cfb348d85e20263" />
<File name="Classes/FolderListControl.lua" part="program" sha1="b1ac8024c4eb927edd69220bf66c082778de25e6" />
<File name="Classes/GemSelectControl.lua" part="program" sha1="ce865b58670f6f049aeadedc9177b7200cf2c21a" />
<File name="Classes/ImportTab.lua" part="program" sha1="28c1991ba60b04501c36f2046ee4314ee4110d7c" />
<File name="Classes/Item.lua" part="program" sha1="4288a1d8baaf532e1c0e94a10f320256d3e852a8" />
<File name="Classes/ItemDBControl.lua" part="program" sha1="da94e83db8cc655861dafb774c7110729129ffcf" />
<File name="Classes/ItemListControl.lua" part="program" sha1="909a4efe03ac4b993954627819bc0a02cd951fa1" />
<File name="Classes/ItemSetListControl.lua" part="program" sha1="443038191a6ba3a17c3ce6683b96ab2797cf5d39" />
<File name="Classes/ItemSlotControl.lua" part="program" sha1="b8fe8523bd8c1d475ded6ae73c1f1cad4b434145" />
<File name="Classes/ItemsTab.lua" part="program" sha1="4271ddab915b026e21c51961f95106b84c1757c0" />
<File name="Classes/LabelControl.lua" part="program" sha1="b6c56903b054e14c302a5e4e60ed8e91764bc6a0" />
<File name="Classes/ListControl.lua" part="program" sha1="ba5079fe6a1a38bc8c1cf758d42a62a4a7209e84" />
<File name="Classes/MinionListControl.lua" part="program" sha1="b9324d7c16d20ac4d7508ecd151c2e9838fdb98c" />
<File name="Classes/MinionSearchListControl.lua" part="program" sha1="475c5d7f1ab35d088ed62947a27e19a9fe26b87d" />
<File name="Classes/ModDB.lua" part="program" sha1="b98d03ad7398aacf7782c0b1bbd813bc90528301" />
<File name="Classes/ModList.lua" part="program" sha1="f42809e4219ec3b887e1f55cfcc85f73462d397a" />
<File name="Classes/ModStore.lua" part="program" sha1="9e03937e6e5772ca6e4b001313ae7c29e26bd332" />
<File name="Classes/NotableDBControl.lua" part="program" sha1="8a01029c56ea354efeea213c664b723c1f14c63d" />
<File name="Classes/NotesTab.lua" part="program" sha1="de067274e65a7d71940caead279c3a1f8d6fce3e" />
<File name="Classes/PartyTab.lua" part="program" sha1="8f2fc8b8e4d98db34520c5b2f94b3459911e6e41" />
<File name="Classes/PassiveMasteryControl.lua" part="program" sha1="d26082d3fa6485b0813c3a988d180208fdd652ef" />
<File name="Classes/PassiveSpec.lua" part="program" sha1="be6f2416987f9ae7e78b1ee6fe6b9df204ab55cd" />
<File name="Classes/PassiveSpecListControl.lua" part="program" sha1="694d7b088e895348857b97a78babb00d612469f8" />
<File name="Classes/PassiveTree.lua" part="program" sha1="f230517c9f4d7186c9e3afca6175a33f552a4dfb" />
<File name="Classes/PassiveTreeView.lua" part="program" sha1="b4e80b76801d882aa4f6fb7ed6be42a1a1923ddb" />
<File name="Classes/PathControl.lua" part="program" sha1="2107211dc604f4382da52ba757114665ab5862ba" />
<File name="Classes/PoBArchivesProvider.lua" part="program" sha1="c2f3f922c82a48a92faaf125b5207c41eb1a2c5a" />
<File name="Classes/PopupDialog.lua" part="program" sha1="f37b60b6589d4ff0c721c2418d78409f2dc69452" />
<File name="Classes/PowerReportListControl.lua" part="program" sha1="9308c76ea2cdf04ff9d00ffd7fa77d0ea7112eb6" />
<File name="Classes/RectangleOutlineControl.lua" part="program" sha1="4da285dbe76549deae46d3835e00c382c59c18b4" />
<File name="Classes/ResizableEditControl.lua" part="program" sha1="1270c263bd762759cc1121c3eeb4906018136e05" />
<File name="Classes/ScrollBarControl.lua" part="program" sha1="58f68ca961c625d3aba4c8946f7894371c74d335" />
<File name="Classes/SearchHost.lua" part="program" sha1="1fd99b9fbd2c9d26e99397cece708771ce2ad0e1" />
<File name="Classes/SectionControl.lua" part="program" sha1="56f40224d0766ed2699b1ff839f79c43fd5cbf44" />
<File name="Classes/SharedItemListControl.lua" part="program" sha1="907f697112a9738028c8a358e996a7ca8766ea1b" />
<File name="Classes/SharedItemSetListControl.lua" part="program" sha1="0925d72eeb17b464b835289bb71e912056bc6565" />
<File name="Classes/SkillListControl.lua" part="program" sha1="e600c266088ec0f68bda0f5e79d0dd4ac344b715" />
<File name="Classes/SkillSetListControl.lua" part="program" sha1="2694184c7fec8b25a3af11f228b830f55859bc69" />
<File name="Classes/SkillsTab.lua" part="program" sha1="beb0246c7385af0d4839b20b28368aaa30da1991" />
<File name="Classes/SliderControl.lua" part="program" sha1="a668ed8ac5bcc6d12277bd8c406d9d754032861e" />
<File name="Classes/TextListControl.lua" part="program" sha1="08444ee7a89fac97d6727541b0e94b4997c1c7af" />
<File name="Classes/TimelessJewelListControl.lua" part="program" sha1="474caa03d4c6e6d9d5f01a95eaf500f3bacec814" />
<File name="Classes/TimelessJewelSocketControl.lua" part="program" sha1="a47645db39133957917a0d0f090cf4cc70c4f980" />
<File name="Classes/Tooltip.lua" part="program" sha1="7942a38f6179b9234de93162da75b72f94981787" />
<File name="Classes/TooltipHost.lua" part="program" sha1="c9854fd295d8305b0d2b1a31ac28b44a53ec791d" />
<File name="Classes/TradeQuery.lua" part="program" sha1="52b4113ff2cfb75e542c88cc7ce634228d88f3a8" />
<File name="Classes/TradeQueryGenerator.lua" part="program" sha1="4159bc81895ee113b1dc7fe18bb613533c8d4f0f" />
<File name="Classes/TradeQueryRateLimiter.lua" part="program" sha1="85c8a28c7d2bacf5bf91a97165a2ebd89bc238c0" />
<File name="Classes/TradeQueryRequests.lua" part="program" sha1="7fcc19a8d12e90dcbd38c2b8327a30200134d91e" />
<File name="Classes/TradeStatWeightMultiplierListControl.lua" part="program" sha1="2d3c11bb563279bffc4f93763a652a6f430ffd59" />
<File name="Classes/TreeTab.lua" part="program" sha1="93e1113eb9597ae66affc18306b1560ba263765d" />
<File name="Classes/UndoHandler.lua" part="program" sha1="ce4835c384c834da0de47b0302b1e774c8300c6b" />
<File name="Data/Bases/amulet.lua" part="program" sha1="58d127510adccde11930f0ab0426800d3552aa56" />
<File name="Data/Bases/axe.lua" part="program" sha1="44a3e4fc2a44a8b46b78e74961f37943a8119af6" />
<File name="Data/Bases/belt.lua" part="program" sha1="3aec735e68cdaabd8d14aa200a998e916454eafa" />
<File name="Data/Bases/body.lua" part="program" sha1="6cf992e9510f7e2ba7b00087c30cba7bda87edb7" />
<File name="Data/Bases/boots.lua" part="program" sha1="3ec6c75649868e75d5eb2348f063e11245c8fae4" />
<File name="Data/Bases/bow.lua" part="program" sha1="7043106eff0115e346dc8af0ed3a817f0c027539" />
<File name="Data/Bases/claw.lua" part="program" sha1="ab33fac15e211050ddf27cc67a7ae58eaa29f6c9" />
<File name="Data/Bases/dagger.lua" part="program" sha1="30c2f0504fcef511cada84894f7ca8975a065255" />
<File name="Data/Bases/fishing.lua" part="program" sha1="f080afa67f98dbd62a0eaa6f2a9494e5c5a27198" />
<File name="Data/Bases/flask.lua" part="program" sha1="da9d87e9c562b51e16833544dc3afc83996420b2" />
<File name="Data/Bases/gloves.lua" part="program" sha1="807f85ba2f60953f36400d5f059c93718830a270" />
<File name="Data/Bases/helmet.lua" part="program" sha1="f7f858bd89689b31f3cf0c4bc187500bec7e8ec1" />
<File name="Data/Bases/jewel.lua" part="program" sha1="31b864e0d3bf906d220ecaff5aac93b179b81f2b" />
<File name="Data/Bases/mace.lua" part="program" sha1="c41ba938c7a93bae08407d300f4c65d36a9b9069" />
<File name="Data/Bases/quiver.lua" part="program" sha1="f18199ebacbf449635be19c272bd79f4fb130b07" />
<File name="Data/Bases/ring.lua" part="program" sha1="148d8e1711469bb0e8b8c79dab86cea66e02a5fb" />
<File name="Data/Bases/shield.lua" part="program" sha1="d9d7511fb7ce19ffce6817918935775fe9dcfaa4" />
<File name="Data/Bases/staff.lua" part="program" sha1="ca23f0d162d1dba97c2b8ea4112c277c119b94d2" />
<File name="Data/Bases/sword.lua" part="program" sha1="ff5e7559b9657c35b812979aea3562892647d2c1" />
<File name="Data/Bases/tincture.lua" part="program" sha1="9c7818795876f50cd8eef377d2316208664432d9" />
<File name="Data/Bases/wand.lua" part="program" sha1="571a19b409b8557e88a6e6c29f00273ae1da5217" />
<File name="Data/BeastCraft.lua" part="program" sha1="023099cd50d7ab8cace27434746e212a981760b0" />
<File name="Data/Bosses.lua" part="program" sha1="81591b7eeaeebdf743ae032b8bf41714f2860e70" />
<File name="Data/BossSkills.lua" part="program" sha1="04ba9d9cece737a23af6e455b1c88e9a0e98ee5b" />
<File name="Data/ClusterJewels.lua" part="program" sha1="09a9c978bea8c63926cdda92bdd60eacd6a0162d" />
<File name="Data/Costs.lua" part="program" sha1="d93b6d71b4b8a2b5bf47135917b942770b30cb28" />
<File name="Data/Crucible.lua" part="program" sha1="05e08e6199cb03bb4a8db6371c76c967a69d8347" />
<File name="Data/EnchantmentBelt.lua" part="program" sha1="85409c93fa36ce5a7bd0b5684660190f0d33ebf4" />
<File name="Data/EnchantmentBody.lua" part="program" sha1="9328e81eeb950d4736cd8ec5d4548086b2180942" />
<File name="Data/EnchantmentBoots.lua" part="program" sha1="c3716b9da75cddf05f19ee08927409c22f7b5c80" />
<File name="Data/EnchantmentFlask.lua" part="program" sha1="4570f69a726386c86bb8704380dec2be1690c3ca" />
<File name="Data/EnchantmentGloves.lua" part="program" sha1="1fcdacb6f5e454b41163c0ddef1e4aa3444fe0fb" />
<File name="Data/EnchantmentHelmet.lua" part="program" sha1="02a3d157ba63ae767a9756e8a02f1fc5ca7ab986" />
<File name="Data/EnchantmentWeapon.lua" part="program" sha1="bcab0a9917aa30b78ee17624555912cc18f35bfd" />
<File name="Data/Essence.lua" part="program" sha1="6288bbcdc39e0830a31865c4940ffef6dcf2a5ac" />
<File name="Data/Gems.lua" part="program" sha1="4e51684bd626301d52fdb65d06f8cf45b69c888a" />
<File name="Data/Global.lua" part="program" sha1="e09f834de118bae2bf103aa5fccbec8d4f6a2b08" />
<File name="Data/Minions.lua" part="program" sha1="a1e9bd57f86a61a36e1de14e5bae4be4003dc275" />
<File name="Data/Misc.lua" part="program" sha1="457da8369d82b5b2f9d3704d4b58bf3581da65e6" />
<File name="Data/ModCache.lua" part="program" sha1="665fbe9b3bf2ad60727bbb92aae32e1b0aa82639" />
<File name="Data/ModFlask.lua" part="program" sha1="e58069a2ac5761564895f251745c96e6304a0e4b" />
<File name="Data/ModItem.lua" part="program" sha1="32a8fc04a4effa331f2d5467b732656473da6f28" />
<File name="Data/ModJewel.lua" part="program" sha1="633ddf71ab5af0af4dac1683b02c42d8acc88ddc" />
<File name="Data/ModJewelAbyss.lua" part="program" sha1="2252bccda6e3b70fbe93d06c6cbab0335dc04346" />
<File name="Data/ModJewelCharm.lua" part="program" sha1="06a89ae5d5dfbdf1be9dbb2f105e64efbd439657" />
<File name="Data/ModJewelCluster.lua" part="program" sha1="7754e7e236168e1b5393b3288963a0eaa47fa768" />
<File name="Data/ModMap.lua" part="program" sha1="29edb01606d86bf46267fbe91ad1dd51eef52dae" />
<File name="Data/ModMaster.lua" part="program" sha1="4c59bc77f199ddcc27cfa4edf1b4c5f322e8ad57" />
<File name="Data/ModNecropolis.lua" part="program" sha1="2cfb8dd49935c2661447dea226668c2b231fbc34" />
<File name="Data/ModTincture.lua" part="program" sha1="573e5fc25316fdaafad842fea181a520d42607b8" />
<File name="Data/ModVeiled.lua" part="program" sha1="6313fdf97113710bcc40fc6acc29e008fa7c1699" />
<File name="Data/Pantheons.lua" part="program" sha1="af9178675d2dc390891176e77209d8fd95dfcb77" />
<File name="Data/QueryMods.lua" part="program" sha1="54f813e5298c98c69a4e6d9039da17cadec7f9c5" />
<File name="Data/Rares.lua" part="program" sha1="7a2cf2496de9bd4fbdd042bece8214d60f57adb5" />
<File name="Data/Skills/act_dex.lua" part="program" sha1="a06aebf1ac5d0f68be38e220d473a897f4444389" />
<File name="Data/Skills/act_int.lua" part="program" sha1="2b82d9d3a2f272ea1b42461f07acca3358d42ce9" />
<File name="Data/Skills/act_str.lua" part="program" sha1="1a0bf74be5134ee56ca3fe1ffcbaef17709201ca" />
<File name="Data/Skills/glove.lua" part="program" sha1="260b66a5d3480d4619c7b752cb4b0a4fb12f8312" />
<File name="Data/Skills/minion.lua" part="program" sha1="ed8a0d25e481b4cc4c6b9d924ebcfd02aa03b33f" />
<File name="Data/Skills/other.lua" part="program" sha1="e00a8f0ca7c8ca5e72cfcb4e4e0695ae08d7b3d4" />
<File name="Data/Skills/spectre.lua" part="program" sha1="d25dce4e2bd212904a9fc1a00ac9e8d985e98582" />
<File name="Data/Skills/sup_dex.lua" part="program" sha1="ea672b25d063844f3b8f66e5819f99b0c0da7dca" />
<File name="Data/Skills/sup_int.lua" part="program" sha1="bf7a0ba908e660df358eeed62386da9c1e458ce3" />
<File name="Data/Skills/sup_str.lua" part="program" sha1="a4539df41f578ceecf6e22bf3ed656dd0e647e54" />
<File name="Data/SkillStatMap.lua" part="program" sha1="c590c3e093c3e2243502025a77e03a52c8151977" />
<File name="Data/Spectres.lua" part="program" sha1="e62923a4669da0f7403652afd6866ef118e8322e" />
<File name="Data/StatDescriptions/active_skill_gem_stat_descriptions.lua" part="program" sha1="78cb97df2ada6a16504595bb7849f86de1b62eae" />
<File name="Data/StatDescriptions/aura_skill_stat_descriptions.lua" part="program" sha1="cf1f7c4db13fb272d74e678a053b6e3ba91dccba" />
<File name="Data/StatDescriptions/banner_aura_skill_stat_descriptions.lua" part="program" sha1="2995f8b8685edb6324e1ed1a734a8667008133d9" />
<File name="Data/StatDescriptions/beam_skill_stat_descriptions.lua" part="program" sha1="9bb2253d65b7ffa70abb82de701b3294fea518b7" />
<File name="Data/StatDescriptions/brand_skill_stat_descriptions.lua" part="program" sha1="cdffcba2f7b50419b872d98adac7672216d94ab8" />
<File name="Data/StatDescriptions/buff_skill_stat_descriptions.lua" part="program" sha1="3c7c3e9dd6a571ebeda8ff49a410a9006d9829fe" />
<File name="Data/StatDescriptions/curse_skill_stat_descriptions.lua" part="program" sha1="b1ffacb9faabf5ab146ad853411b3acc21add9ab" />
<File name="Data/StatDescriptions/debuff_skill_stat_descriptions.lua" part="program" sha1="ed055b2ed43829ba3c676f52d2dccfed5856015d" />
<File name="Data/StatDescriptions/gem_stat_descriptions.lua" part="program" sha1="090f2f7192fe5d490df26ac42ac2435e7ace0575" />
<File name="Data/StatDescriptions/minion_attack_skill_stat_descriptions.lua" part="program" sha1="a61b63ca16573a7ecb17556fae77eeb06b47700d" />
<File name="Data/StatDescriptions/minion_skill_stat_descriptions.lua" part="program" sha1="bb4000302a79bdba60a8fa5c12fd08701ebea149" />
<File name="Data/StatDescriptions/minion_spell_damage_skill_stat_descriptions.lua" part="program" sha1="d9b57a9b3c5135b770046acef4a5dc7cbe72b90e" />
<File name="Data/StatDescriptions/minion_spell_skill_stat_descriptions.lua" part="program" sha1="4d6cdf0dcf7ae53a8e149cabf67bfbde9f5fdc98" />
<File name="Data/StatDescriptions/monster_stat_descriptions.lua" part="program" sha1="5754f489603586597c1cbe2605121da623d4d9b3" />
<File name="Data/StatDescriptions/offering_skill_stat_descriptions.lua" part="program" sha1="d462b786bfe0f16443c366d1347769875e9a41de" />
<File name="Data/StatDescriptions/secondary_debuff_skill_stat_descriptions.lua" part="program" sha1="77c64e32a13f04d661dc34bb5f24c2d01c67baea" />
<File name="Data/StatDescriptions/single_minion_spell_skill_stat_descriptions.lua" part="program" sha1="3c9a68e0af6ebb8c210460f108c062502e247be3" />
<File name="Data/StatDescriptions/skill_stat_descriptions.lua" part="program" sha1="3bf1626159a539df7dfc390794f3bca31d4d0fc0" />
<File name="Data/StatDescriptions/stat_descriptions.lua" part="program" sha1="475f66b1210599a61b75c797199a3edfa5ffa123" />
<File name="Data/StatDescriptions/tincture_stat_descriptions.lua" part="program" sha1="7bf558f9692f531c58fae338787fc73c39cf0979" />
<File name="Data/StatDescriptions/variable_duration_skill_stat_descriptions.lua" part="program" sha1="035f263f6f0f6a149a5fad3f7a16070f7e13c98d" />
<File name="Data/TattooPassives.lua" part="program" sha1="e24a7265d0cb6779ab9788a5435b07ea5d9bfb24" />
<File name="Data/TimelessJewelData/BrutalRestraint.zip" part="program" sha1="a0ba29b6daf0f08b84a5fcc64455e44f3c369c68" />
<File name="Data/TimelessJewelData/ElegantHubris.zip" part="program" sha1="ec474e3c9f052129fce1966858194c54cef681bd" />
<File name="Data/TimelessJewelData/GloriousVanity.zip.part0" part="program" sha1="8cef826fcaf0373a0989a998f46a993b82f99a1e" />
<File name="Data/TimelessJewelData/GloriousVanity.zip.part1" part="program" sha1="7934a7e878e1b7e87c89d35b8ea6491943d58375" />
<File name="Data/TimelessJewelData/GloriousVanity.zip.part2" part="program" sha1="40897375056d28dc171ab54b4e0aba13a6e7465a" />
<File name="Data/TimelessJewelData/GloriousVanity.zip.part3" part="program" sha1="9afd246eece1bfa97183784db36d0532eace9e4b" />
<File name="Data/TimelessJewelData/GloriousVanity.zip.part4" part="program" sha1="972c07b50bcedf290d8fbedc90556fb814f9cb14" />
<File name="Data/TimelessJewelData/LegionPassives.lua" part="program" sha1="62d9d37f16fa15f8b6acc4fd259d5e204e846907" />
<File name="Data/TimelessJewelData/LegionTradeIds.lua" part="program" sha1="a852a234591481dcd4c8ddf937fb0f75b69036bb" />
<File name="Data/TimelessJewelData/LethalPride.zip" part="program" sha1="0795c485e0d6b9c79705a6aa2bebf19fbb87024d" />
<File name="Data/TimelessJewelData/MilitantFaith.zip" part="program" sha1="a1cb40a6176920c5ba36750e81583c92dec26558" />
<File name="Data/TimelessJewelData/NodeIndexMapping.lua" part="program" sha1="ffd323e3bdb71e2e6b6a6aaea39bac8f222c667a" />
<File name="Data/Uniques/amulet.lua" part="program" sha1="ae1294b78044674c70c9f1272dd8363668c22b40" />
<File name="Data/Uniques/axe.lua" part="program" sha1="8bb784afa7f55dab9dfe30238e66e5c908b7121a" />
<File name="Data/Uniques/belt.lua" part="program" sha1="71a2140d4c626ad2f23afd5ed0e601cd0a8c7e74" />
<File name="Data/Uniques/body.lua" part="program" sha1="2e1ff2588699bc1e127da61a3182579e8461cbfa" />
<File name="Data/Uniques/boots.lua" part="program" sha1="695ee9297e8318ef9f2799f8603b0aa5b34cf7cf" />
<File name="Data/Uniques/bow.lua" part="program" sha1="16978c20d522db5d8d4034a84b945520833cba19" />
<File name="Data/Uniques/claw.lua" part="program" sha1="c1cf3b7b6cc655b71dddf060bdbfc9bce65b0899" />
<File name="Data/Uniques/dagger.lua" part="program" sha1="221a07501b6f32395a63543da7afb9c0498cf7c8" />
<File name="Data/Uniques/fishing.lua" part="program" sha1="51bfa6a311f69ef89cc83170daeb2004162ed67d" />
<File name="Data/Uniques/flask.lua" part="program" sha1="dcd988489786822f63c5a02c5e29942303d80312" />
<File name="Data/Uniques/gloves.lua" part="program" sha1="9eef518da4d3212bede915a6b2f235b799d5d32c" />
<File name="Data/Uniques/helmet.lua" part="program" sha1="28d586feb75e3200832fddef22bfb77a0b88abb6" />
<File name="Data/Uniques/jewel.lua" part="program" sha1="7705d92f38de5a7522190056dfcad5810c5c76df" />
<File name="Data/Uniques/mace.lua" part="program" sha1="845f20bddcc12e6b7ac72e97fc3e6f50f2360f68" />
<File name="Data/Uniques/quiver.lua" part="program" sha1="b99a019d76640092c763634232f62dd8d8b19b6b" />
<File name="Data/Uniques/ring.lua" part="program" sha1="8fbbde9b42d6524f6620e5a180d7b0075a6241ff" />
<File name="Data/Uniques/shield.lua" part="program" sha1="30c861c7bac3bea2405e1e8247e01d2a26627b07" />
<File name="Data/Uniques/Special/BoundByDestiny.lua" part="program" sha1="d8a431d78427cb9c6dd5ae080f8d4809b10400e2" />
<File name="Data/Uniques/Special/Generated.lua" part="program" sha1="aa56b9dccd772077d29f0abd6294b66022f55f7a" />
<File name="Data/Uniques/Special/New.lua" part="program" sha1="e117c4792f287b271ce86c35f2d3bc933e2d7bf2" />
<File name="Data/Uniques/Special/race.lua" part="program" sha1="fbe785fd8e6fc460ac459dd0d394ad5f6ba2661c" />
<File name="Data/Uniques/Special/WatchersEye.lua" part="program" sha1="12ca716983ce62e4630f49d0fd9c2c9a232adb0e" />
<File name="Data/Uniques/staff.lua" part="program" sha1="d50e78f3b952df43928124863c72c7de0d3a54c6" />
<File name="Data/Uniques/sword.lua" part="program" sha1="81fe736554d28b9970b3407ffa7845de91c11e6d" />
<File name="Data/Uniques/tincture.lua" part="program" sha1="840794783a1edb60a77f297411dd775ce4095cb1" />
<File name="Data/Uniques/wand.lua" part="program" sha1="009d9e452128e2e36eefa809c974296f013e5808" />
<File name="GameVersions.lua" part="program" sha1="d253257ea11b6117c6f4bee577c031a265ecaee0" />
<File name="Launch.lua" part="program" sha1="2a9eba3dbac31597e7357a3fc9121993c7902fb1" />
<File name="Modules/Build.lua" part="program" sha1="fd3f4825c724a9858c66ebf49da6b87966129cd5" />
<File name="Modules/BuildDisplayStats.lua" part="program" sha1="bb8517ccd372e3cfad8e68b7a65962ab0cf66269" />
<File name="Modules/BuildList.lua" part="program" sha1="99ac52b6fa77f0d6c9521b6b2f13621bfd7cbb07" />
<File name="Modules/BuildSiteTools.lua" part="program" sha1="7f3a76ee0f53b50972f53db2a96a7fac02b5c285" />
<File name="Modules/CalcActiveSkill.lua" part="program" sha1="2df26aa6b1ca7921c73b40033942fb22842e7363" />
<File name="Modules/CalcBreakdown.lua" part="program" sha1="edd6c08679fa4c7ed667895f86c7ee67257bfcf0" />
<File name="Modules/CalcDefence.lua" part="program" sha1="7d3fb206da65a85d3e5799be83a93bc630d4d283" />
<File name="Modules/CalcMirages.lua" part="program" sha1="3b1b8e427253bc360c4cd59b8af2308135058294" />
<File name="Modules/CalcOffence.lua" part="program" sha1="77fdd7b3a5a68c048d6e7491792618c338894ec9" />
<File name="Modules/CalcPerform.lua" part="program" sha1="b69790e03b8209995a6feb385c3a0659631ab5a9" />
<File name="Modules/Calcs.lua" part="program" sha1="f8777f3a48d7c7da3c9baf956dbae9e854a7c7ca" />
<File name="Modules/CalcSections.lua" part="program" sha1="20f0c7050e1d4681254872a51dc34eaa2cbf05a0" />
<File name="Modules/CalcSetup.lua" part="program" sha1="4b5e66b2098830d8584555512e4997cc95edd921" />
<File name="Modules/CalcTools.lua" part="program" sha1="7f1b90ad57b02eeb1ad9aebf0f00416a9f4bea75" />
<File name="Modules/CalcTriggers.lua" part="program" sha1="532c7c21e78a0adb235e43430bc85948bf5377c2" />
<File name="Modules/Common.lua" part="program" sha1="c21b9584cb570fb06896f6c870f59ffa385efb86" />
<File name="Modules/ConfigOptions.lua" part="program" sha1="70db40c7972dfe877d2e84014fc5e494d027664d" />
<File name="Modules/Data.lua" part="program" sha1="cf4d2529f7f20d8868c8c9b3f712db2ac623a1b5" />
<File name="Modules/DataLegionLookUpTableHelper.lua" part="program" sha1="170699925a438275137ba621206800e29f453eb3" />
<File name="Modules/ItemTools.lua" part="program" sha1="0c60e108e3b0a67ab9c3aac753b7f57bd2faa013" />
<File name="Modules/Main.lua" part="program" sha1="bfd493eaf4e793010b4da060fa78575cc4b5d122" />
<File name="Modules/ModParser.lua" part="program" sha1="c09c39819df6f116ed042c440b6cc87caf490fcf" />
<File name="Modules/ModTools.lua" part="program" sha1="cfb4065936e0916d0424cd1c6cb8102eef132856" />
<File name="Modules/PantheonTools.lua" part="program" sha1="ebe91a7d8f8444a6061acf4758da0e775cc8c314" />
<File name="Modules/StatDescriber.lua" part="program" sha1="c4f9c72fa319c798710926720b8519eb38c40c31" />
<File name="UpdateApply.lua" part="program" sha1="4dd42f413cb89a963e4ae1b40e214985b909c05b" />
<File name="UpdateCheck.lua" part="default" sha1="2ae35a08c9445d68c4fc92254fcf50c8b780bf72" />
<File name="lua/base64.lua" part="runtime" sha1="18629865eb351e483178b6524fb3935cbc9b8297" />
<File name="lua/dkjson.lua" part="runtime" sha1="d2c9e5433a24b8593886a36cfc267cb05d3bc529" />
<File name="lua/sha1/bit32_ops.lua" part="runtime" sha1="25bc8def626fd8d8bd3d37dcd96808c6b8b00087" />
<File name="lua/sha1/bit_ops.lua" part="runtime" sha1="53ce6b3174386d1e4565ced0c1a7f1b3df3bb83f" />
<File name="lua/sha1/common.lua" part="runtime" sha1="70faf0efa48e6d44c7b8a4279467f0025257b84f" />
<File name="lua/sha1/init.lua" part="runtime" sha1="e23c730650ac2ffe595b4ed2a5f3484225414ebd" />
<File name="lua/sha1/lua53_ops.lua" part="runtime" sha1="b10c732f322358c4112226df61af61f53a21b911" />
<File name="lua/sha1/pure_lua_ops.lua" part="runtime" sha1="0dff15b1cfd171a3572032346613adcf5e9962c2" />
<File name="lua/xml.lua" part="runtime" sha1="859e09104842f91a4aaa9a4d9fadf667535877e2" />
<File name="TreeData/2_6/skill_sprite-3-32f639bbfc42783ca7ec218a787dd918.jpg" part="tree" sha1="dc7a2a0383847ac28eade8a31a57a8bfa7b298e4" />
<File name="TreeData/2_6/skill_sprite-active-3-3e73c4c4534433ecfc340c7287093bd5.png" part="tree" sha1="baa878007cfac73bee50958d25617b95c0e73a2d" />
<File name="TreeData/2_6/skill_sprite-active-3-7798fabab8a21829831293c20ac9c414.jpg" part="tree" sha1="526654400851f032d3d2f46980c0ecc077aa0c4c" />
<File name="TreeData/2_6/tree.lua" part="tree" sha1="ee02b7e6e521896c498d8b222b1efab04538eaa7" />
<File name="TreeData/3_6/groups-3.png" part="tree" sha1="ea7ce14f355f5389cc5133c0999c53b943e6141b" />
<File name="TreeData/3_6/skills-3.jpg" part="tree" sha1="b5277c97e46807feeb98c241be5a77267fa56a85" />
<File name="TreeData/3_6/skills-disabled-3.jpg" part="tree" sha1="22ab849bbe94942c199c9b218f76da14fba58413" />
<File name="TreeData/3_6/tree.lua" part="tree" sha1="9c28311886cf10799b745e843c3b06b1c40f0c24" />
<File name="TreeData/3_7/groups-3.png" part="tree" sha1="6c1a0b5721a866755292721a097ee1520a100a95" />
<File name="TreeData/3_7/skills-3.jpg" part="tree" sha1="c3262896ffb085f04d0f4c830294a5c99982b7e2" />
<File name="TreeData/3_7/skills-disabled-3.jpg" part="tree" sha1="8b312d618e14a948628e9716861d1c6eb0b65774" />
<File name="TreeData/3_7/tree.lua" part="tree" sha1="2c73d57dabd0054b884b2a63b8af9948592fd6ef" />
<File name="TreeData/3_8/groups-3.png" part="tree" sha1="9ad64986cd50d2ac198b8e2b6f8c4aa1b6b3227a" />
<File name="TreeData/3_8/skills-3.jpg" part="tree" sha1="bf8f56caa6a57e1dd39782c5b692290b05fd55bd" />
<File name="TreeData/3_8/skills-disabled-3.jpg" part="tree" sha1="744565abb088b75fa335c0b3024a13f0e1a21033" />
<File name="TreeData/3_8/tree.lua" part="tree" sha1="e5ff335980875ef278038fa46f40e1f18a4b5f7a" />
<File name="TreeData/3_9/groups-3.png" part="tree" sha1="ddf012e0184c29bc1aee994badd8ede83aaebb73" />
<File name="TreeData/3_9/skills-3.jpg" part="tree" sha1="119218595a02d38e11ac331d4920d23f8acc86de" />
<File name="TreeData/3_9/skills-disabled-3.jpg" part="tree" sha1="e73624e16e81cb5393d07685a766dc3afc8f9e39" />
<File name="TreeData/3_9/tree.lua" part="tree" sha1="55bef2fbee9f9fc63e35d92b37b95f428c8d5ac2" />
<File name="TreeData/3_10/groups-3.png" part="tree" sha1="85a5d6410e38d62c567538caba62d1c20c306453" />
<File name="TreeData/3_10/skills-3.jpg" part="tree" sha1="5e178407366f55bd46739ecba312fcb3e0d515dc" />
<File name="TreeData/3_10/skills-disabled-3.jpg" part="tree" sha1="ef12b39c6dad5448e6f10c92a1b4e7cf38e00843" />
<File name="TreeData/3_10/tree.lua" part="tree" sha1="8328acf9bfecc4a2991348adbf0f683908ecb9fa" />
<File name="TreeData/3_11/groups-3.png" part="tree" sha1="351b940efd39cf3210babd01f8843b930a3c6165" />
<File name="TreeData/3_11/skills-3.jpg" part="tree" sha1="e24100ec6bc1a20486424f95f878f0ff75753f97" />
<File name="TreeData/3_11/skills-disabled-3.jpg" part="tree" sha1="b7a63aecf727ccc8e826d1cefd8d6ee7029714e0" />
<File name="TreeData/3_11/tree.lua" part="tree" sha1="2c66328deede4395fef5d7b1b81b697cdc8e0813" />
<File name="TreeData/3_12/groups-3.png" part="tree" sha1="5d0781818aa0fc971e40c71606794167f399b010" />
<File name="TreeData/3_12/skills-3.jpg" part="tree" sha1="250196fea41d29ba3a70f6f906bf909615fadb71" />
<File name="TreeData/3_12/skills-disabled-3.jpg" part="tree" sha1="5b955112389654a805be7f76a09d23efeb40b7f3" />
<File name="TreeData/3_12/tree.lua" part="tree" sha1="973784f215cdf0ea8889fcf019ca59c4213f4ba3" />
<File name="TreeData/3_13/groups-3.png" part="tree" sha1="5bfa14f0073f8835c12cb3297f0855dfc68eb869" />
<File name="TreeData/3_13/skills-3.jpg" part="tree" sha1="4e066860145766ebe0c606833f4cf41fe4bf90e4" />
<File name="TreeData/3_13/skills-disabled-3.jpg" part="tree" sha1="435f782d319f5457d75ca98fb3f1e75fac64e2c5" />
<File name="TreeData/3_13/tree.lua" part="tree" sha1="f9ab50ea0d56c60516829b1952b1709be308b6d3" />
<File name="TreeData/3_14/groups-3.png" part="tree" sha1="fe91708e0c16dc1bab7ee3f436914ef7201df9c9" />
<File name="TreeData/3_14/skills-3.jpg" part="tree" sha1="bcb605cce06852fb5a6961369229afe4a6bdff0f" />
<File name="TreeData/3_14/skills-disabled-3.jpg" part="tree" sha1="1f8841f20d25396f0a4b9ae2e5ba7ce28036ac45" />
<File name="TreeData/3_14/tree.lua" part="tree" sha1="77e80cea5bc31877fea3c17b6b640c54799ccc45" />
<File name="TreeData/3_15/groups-3.png" part="tree" sha1="ad86bd7b8d189d37eb1aa3e5bdc1f3c6c5e7aadc" />
<File name="TreeData/3_15/skills-3.jpg" part="tree" sha1="a2fb3f5bab2819204b80afbde7a27ba3e3b7f08e" />
<File name="TreeData/3_15/skills-disabled-3.jpg" part="tree" sha1="d1fcdec9f039bc9f16fb1bac837804bed42df6d7" />
<File name="TreeData/3_15/tree.lua" part="tree" sha1="ee8ffb8adab5728d6a8748d25244d9bcb58fe800" />
<File name="TreeData/3_16/mastery-active-effect-3.png" part="tree" sha1="3842bee3d952f6363b1f88e546519d2b0691849b" />
<File name="TreeData/3_16/mastery-active-selected-3.png" part="tree" sha1="3838d80b08d8789b455558e814dcbde686a1df14" />
<File name="TreeData/3_16/mastery-connected-3.png" part="tree" sha1="5b13e5f2d88d5118421f97042ce91e7ba3f80f1f" />
<File name="TreeData/3_16/mastery-disabled-3.png" part="tree" sha1="2401a6162eb0a9d831c15f987d972145e530bb77" />
<File name="TreeData/3_16/skills-3.jpg" part="tree" sha1="c638888d1c61852c9fbcafd49a54a9f9c7208598" />
<File name="TreeData/3_16/skills-disabled-3.jpg" part="tree" sha1="f637d86d9457c569e3327a424f34586b93bd1753" />
<File name="TreeData/3_16/tree.lua" part="tree" sha1="6558feaf4e34ec4cddfc6ffa10a88c2e212c7abd" />
<File name="TreeData/3_17/mastery-active-effect-3.png" part="tree" sha1="9a982c9da450c3e083d8043146fb6d77e4833819" />
<File name="TreeData/3_17/mastery-active-selected-3.png" part="tree" sha1="4e62d2dbcd68865fa4de780822a5485bf78d356a" />
<File name="TreeData/3_17/mastery-connected-3.png" part="tree" sha1="a7a9de0b0696e6a0084488c883e5e4a1031cfe43" />
<File name="TreeData/3_17/mastery-disabled-3.png" part="tree" sha1="33fdf3073f2a08809ec9009b4c1bddb311856cee" />
<File name="TreeData/3_17/skills-3.jpg" part="tree" sha1="d1680fbf429af45ef69eb82d39a3181b22694d18" />
<File name="TreeData/3_17/skills-disabled-3.jpg" part="tree" sha1="ac1e410f10e70277f6e17da02c22e02eba769d69" />
<File name="TreeData/3_17/tree.lua" part="tree" sha1="ef9a685526eb39c4e24e903269abe26a7e6061d8" />
<File name="TreeData/3_18/mastery-3.png" part="tree" sha1="e5b2b6f3e3c8c7cf851f388fcf50d52b26ff459e" />
<File name="TreeData/3_18/mastery-active-effect-3.png" part="tree" sha1="9a982c9da450c3e083d8043146fb6d77e4833819" />
<File name="TreeData/3_18/mastery-active-selected-3.png" part="tree" sha1="4e62d2dbcd68865fa4de780822a5485bf78d356a" />
<File name="TreeData/3_18/mastery-connected-3.png" part="tree" sha1="a7a9de0b0696e6a0084488c883e5e4a1031cfe43" />
<File name="TreeData/3_18/mastery-disabled-3.png" part="tree" sha1="33fdf3073f2a08809ec9009b4c1bddb311856cee" />
<File name="TreeData/3_18/skills-3.jpg" part="tree" sha1="d1680fbf429af45ef69eb82d39a3181b22694d18" />
<File name="TreeData/3_18/skills-disabled-3.jpg" part="tree" sha1="ac1e410f10e70277f6e17da02c22e02eba769d69" />
<File name="TreeData/3_18/tree.lua" part="tree" sha1="514b36ab6b68affd0b9868e85c2b45c92b27bb67" />
<File name="TreeData/3_19/Assets.lua" part="tree" sha1="45f21bb289acd71420a13b856ddd00e99c547ebc" />
<File name="TreeData/3_19/mastery-3.png" part="tree" sha1="eba9d0e2c14383bd03999bde470da87c549e0937" />
<File name="TreeData/3_19/mastery-active-effect-3.png" part="tree" sha1="4970ee4961dd0b8e17d0b9fb88a5a872156d6685" />
<File name="TreeData/3_19/mastery-active-selected-3.png" part="tree" sha1="af171059d970a888f371c721473c34386b67d712" />
<File name="TreeData/3_19/mastery-connected-3.png" part="tree" sha1="8d471f06922b04d128eef15f986a0df93bf73f95" />
<File name="TreeData/3_19/mastery-disabled-3.png" part="tree" sha1="65f7b13ce853806f30a3d7bdc35f65c0b9bb58bc" />
<File name="TreeData/3_19/skills-3.jpg" part="tree" sha1="d2a99f9d2280e5f35b725ba1b199a0299e9dac2d" />
<File name="TreeData/3_19/skills-disabled-3.jpg" part="tree" sha1="9eef2b38ffca230d21a265fd1729f6230bc22a69" />
<File name="TreeData/3_19/tree.lua" part="tree" sha1="e4cf555216dc69484f7accc96767eb28638de50b" />
<File name="TreeData/3_20/ascendancy-3.png" part="tree" sha1="2d94e5b833d843fecad23f1f42a1dc74e046cb65" />
<File name="TreeData/3_20/ascendancy-background-3.jpg" part="tree" sha1="e49ef2f589e5fa54b755b4efdf01fd9cecf5671c" />
<File name="TreeData/3_20/background-3.png" part="tree" sha1="1879f7fc11de729dd3b96592f08f011d386c3b56" />
<File name="TreeData/3_20/frame-3.png" part="tree" sha1="a65a54776892fcbf22209e8cbd0500cd594c3334" />
<File name="TreeData/3_20/group-background-3.png" part="tree" sha1="03f69c99e8208039966a9f59af75d2ce489b1d33" />
<File name="TreeData/3_20/jewel-3.png" part="tree" sha1="3435200b7a840357d132aad060a76fa3d4939bec" />
<File name="TreeData/3_20/jewel-radius.png" part="tree" sha1="d9056986fc84c673cdd6d45ca55792fa21847a7f" />
<File name="TreeData/3_20/line-3.png" part="tree" sha1="fac1fc847c200fef24ab2e069ea8253944d14645" />
<File name="TreeData/3_20/mastery-3.png" part="tree" sha1="eba9d0e2c14383bd03999bde470da87c549e0937" />
<File name="TreeData/3_20/mastery-active-effect-3.png" part="tree" sha1="4970ee4961dd0b8e17d0b9fb88a5a872156d6685" />
<File name="TreeData/3_20/mastery-active-selected-3.png" part="tree" sha1="af171059d970a888f371c721473c34386b67d712" />
<File name="TreeData/3_20/mastery-connected-3.png" part="tree" sha1="8d471f06922b04d128eef15f986a0df93bf73f95" />
<File name="TreeData/3_20/mastery-disabled-3.png" part="tree" sha1="65f7b13ce853806f30a3d7bdc35f65c0b9bb58bc" />
<File name="TreeData/3_20/PassiveMasteryConnectedButton.png" part="tree" sha1="514a1e5e95c69d02c393c3738970f4140e51a07a" />
<File name="TreeData/3_20/skills-3.jpg" part="tree" sha1="439d7a8cedf88baa67331b8b5577cf2fdc59105a" />
<File name="TreeData/3_20/skills-disabled-3.jpg" part="tree" sha1="a01660f5e8831d909effc5b26deabc93139c9741" />
<File name="TreeData/3_20/tree.lua" part="tree" sha1="d5587cb838db90f788e670cf6a31051a05ded047" />
<File name="TreeData/3_21/ascendancy-3.png" part="tree" sha1="464a66c648f66fababda6c9b98886f60c7f462ed" />
<File name="TreeData/3_21/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_21/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_21/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_21/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_21/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_21/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_21/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_21/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_21/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_21/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_21/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_21/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_21/PassiveMasteryConnectedButton.png" part="tree" sha1="514a1e5e95c69d02c393c3738970f4140e51a07a" />
<File name="TreeData/3_21/skills-3.jpg" part="tree" sha1="e7017f5f1edbf68b7e075216b15c8f19d08f2767" />
<File name="TreeData/3_21/skills-disabled-3.jpg" part="tree" sha1="58288be0171deaa51a1344942e20064661290925" />
<File name="TreeData/3_21/tree.lua" part="tree" sha1="1883c83e942d0bcd5086d8510c7367f97b3915dc" />
<File name="TreeData/3_22/ascendancy-3.png" part="tree" sha1="464a66c648f66fababda6c9b98886f60c7f462ed" />
<File name="TreeData/3_22/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_22/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_22/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_22/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_22/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_22/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_22/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_22/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_22/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_22/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_22/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_22/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_22/PassiveMasteryConnectedButton.png" part="tree" sha1="514a1e5e95c69d02c393c3738970f4140e51a07a" />
<File name="TreeData/3_22/skills-3.jpg" part="tree" sha1="3c19c01ab91c821861fc8ee16cc1844409b7c4da" />
<File name="TreeData/3_22/skills-disabled-3.jpg" part="tree" sha1="a3e836364fbce07ffc3d86b35fa9bcf9bf47c7fa" />
<File name="TreeData/3_22/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_22/tree.lua" part="tree" sha1="eadbbbfa71eafdb73e752edbdab4733361866483" />
<File name="TreeData/3_22_ruthless/ascendancy-3.png" part="tree" sha1="464a66c648f66fababda6c9b98886f60c7f462ed" />
<File name="TreeData/3_22_ruthless/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_22_ruthless/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_22_ruthless/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_22_ruthless/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_22_ruthless/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_22_ruthless/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_22_ruthless/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_22_ruthless/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_22_ruthless/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_22_ruthless/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_22_ruthless/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_22_ruthless/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_22_ruthless/skills-3.jpg" part="tree" sha1="3c19c01ab91c821861fc8ee16cc1844409b7c4da" />
<File name="TreeData/3_22_ruthless/skills-disabled-3.jpg" part="tree" sha1="a3e836364fbce07ffc3d86b35fa9bcf9bf47c7fa" />
<File name="TreeData/3_22_ruthless/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_22_ruthless/tree.lua" part="tree" sha1="ca5fcd2f9fc9a94645a371c71cf8cd3894607650" />
<File name="TreeData/3_23/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_23/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_23/ascendancy-background-3.png" part="tree" sha1="fafbd532bfd6e87b977fceb7f5c54ebeba556879" />
<File name="TreeData/3_23/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_23/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_23/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_23/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_23/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_23/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_23/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_23/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_23/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_23/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_23/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_23/PassiveMasteryConnectedButton.png" part="tree" sha1="514a1e5e95c69d02c393c3738970f4140e51a07a" />
<File name="TreeData/3_23/skills-3.jpg" part="tree" sha1="49b686a8c38927a073b7c0f642c19bd65890e293" />
<File name="TreeData/3_23/skills-disabled-3.jpg" part="tree" sha1="b279b6bf030f7dd9562f4277659b7f5f1cd7efdd" />
<File name="TreeData/3_23/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_23/tree.lua" part="tree" sha1="0cfbd4f5ad62086234618523c51b9d8980cf4d71" />
<File name="TreeData/3_23_ruthless/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_23_ruthless/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_23_ruthless/ascendancy-background-3.png" part="tree" sha1="fafbd532bfd6e87b977fceb7f5c54ebeba556879" />
<File name="TreeData/3_23_ruthless/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_23_ruthless/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_23_ruthless/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_23_ruthless/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_23_ruthless/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_23_ruthless/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_23_ruthless/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_23_ruthless/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_23_ruthless/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_23_ruthless/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_23_ruthless/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_23_ruthless/skills-3.jpg" part="tree" sha1="49b686a8c38927a073b7c0f642c19bd65890e293" />
<File name="TreeData/3_23_ruthless/skills-disabled-3.jpg" part="tree" sha1="b279b6bf030f7dd9562f4277659b7f5f1cd7efdd" />
<File name="TreeData/3_23_ruthless/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_23_ruthless/tree.lua" part="tree" sha1="594c6e6ee285aab6a64503566c6bbf24aeb79889" />
<File name="TreeData/3_24/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_24/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_24/ascendancy-background-3.png" part="tree" sha1="fafbd532bfd6e87b977fceb7f5c54ebeba556879" />
<File name="TreeData/3_24/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_24/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_24/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_24/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_24/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_24/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_24/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_24/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_24/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_24/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_24/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_24/PassiveMasteryConnectedButton.png" part="tree" sha1="514a1e5e95c69d02c393c3738970f4140e51a07a" />
<File name="TreeData/3_24/skills-3.jpg" part="tree" sha1="33b3264569110e642539a5f032b3ad6463770511" />
<File name="TreeData/3_24/skills-disabled-3.jpg" part="tree" sha1="f17518de203928c9f5905f0ad811964225f35e3e" />
<File name="TreeData/3_24/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_24/tree.lua" part="tree" sha1="81648ce52017b69a3539fe92a51f6189efb69b64" />
<File name="TreeData/3_24_ruthless/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_24_ruthless/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_24_ruthless/ascendancy-background-3.png" part="tree" sha1="fafbd532bfd6e87b977fceb7f5c54ebeba556879" />
<File name="TreeData/3_24_ruthless/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_24_ruthless/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_24_ruthless/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_24_ruthless/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_24_ruthless/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_24_ruthless/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_24_ruthless/mastery-3.png" part="tree" sha1="409f25a0fb89968967780b2573514f5047ff794d" />
<File name="TreeData/3_24_ruthless/mastery-active-effect-3.png" part="tree" sha1="7abf14dfed47ebc2d10d36a86a93ba41f151e673" />
<File name="TreeData/3_24_ruthless/mastery-active-selected-3.png" part="tree" sha1="b2d44de86c46292cf11dc89af6bcc7bd46bb9aa8" />
<File name="TreeData/3_24_ruthless/mastery-connected-3.png" part="tree" sha1="d53f9ceeab2df3a97e0e02214db582fd83bf55fc" />
<File name="TreeData/3_24_ruthless/mastery-disabled-3.png" part="tree" sha1="352e06181b1369497e8b9a13f4b30bd8bbc57ad9" />
<File name="TreeData/3_24_ruthless/skills-3.jpg" part="tree" sha1="33b3264569110e642539a5f032b3ad6463770511" />
<File name="TreeData/3_24_ruthless/skills-disabled-3.jpg" part="tree" sha1="f17518de203928c9f5905f0ad811964225f35e3e" />
<File name="TreeData/3_24_ruthless/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_24_ruthless/tree.lua" part="tree" sha1="0605c24348e7ebf96fb5a1e9eac9e3cd23a6bc76" />
<File name="TreeData/3_25/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_25/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_25/ascendancy-background-3.png" part="tree" sha1="5fa92be470099926c4281f723b0b4fee56f5be70" />
<File name="TreeData/3_25/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_25/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_25/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_25/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_25/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_25/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_25/mastery-3.png" part="tree" sha1="bf1e176d3f8905b5ec72e076dee4ef76a29763fa" />
<File name="TreeData/3_25/mastery-active-effect-3.png" part="tree" sha1="ffe6ad7528545ed043c08a31ecceb87d30d7453d" />
<File name="TreeData/3_25/mastery-active-selected-3.png" part="tree" sha1="7f5e45911247cd339943473516ab1dfb062b51d9" />
<File name="TreeData/3_25/mastery-connected-3.png" part="tree" sha1="5d5cb7a7e706e61c39c988073dffb9bc8343e545" />
<File name="TreeData/3_25/mastery-disabled-3.png" part="tree" sha1="da03b6fc68f28e7921eb89d0ba71d27ec4fc4a10" />
<File name="TreeData/3_25/skills-3.jpg" part="tree" sha1="4de55e7466365960faec3c49153f50f2987ff0c2" />
<File name="TreeData/3_25/skills-disabled-3.jpg" part="tree" sha1="007ad663947f77bde56ad2b2f20171eb3c67df76" />
<File name="TreeData/3_25/sprites.lua" part="tree" sha1="0a067e68f203f4698c5b4e14f16b0a7fe52bf170" />
<File name="TreeData/3_25/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_25/tree.lua" part="tree" sha1="e293f6ce15bb54ac7c01eabfdd8e8676538dfd49" />
<File name="TreeData/3_25_alternate/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_25_alternate/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_25_alternate/ascendancy-background-3.png" part="tree" sha1="b7ae547eb114a95048bee06578a821f81aba770b" />
<File name="TreeData/3_25_alternate/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_25_alternate/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_25_alternate/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_25_alternate/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_25_alternate/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_25_alternate/mastery-3.png" part="tree" sha1="bf1e176d3f8905b5ec72e076dee4ef76a29763fa" />
<File name="TreeData/3_25_alternate/mastery-active-effect-3.png" part="tree" sha1="ffe6ad7528545ed043c08a31ecceb87d30d7453d" />
<File name="TreeData/3_25_alternate/mastery-active-selected-3.png" part="tree" sha1="7f5e45911247cd339943473516ab1dfb062b51d9" />
<File name="TreeData/3_25_alternate/mastery-connected-3.png" part="tree" sha1="5d5cb7a7e706e61c39c988073dffb9bc8343e545" />
<File name="TreeData/3_25_alternate/mastery-disabled-3.png" part="tree" sha1="da03b6fc68f28e7921eb89d0ba71d27ec4fc4a10" />
<File name="TreeData/3_25_alternate/skills-3.jpg" part="tree" sha1="3ddcabbb422d4458a061df622239f6b1fcdbd553" />
<File name="TreeData/3_25_alternate/skills-disabled-3.jpg" part="tree" sha1="8b2e1b15e4101d8d92ac968f3f546e2937b900d2" />
<File name="TreeData/3_25_alternate/sprites.lua" part="tree" sha1="8771333e922da83245a65994a382084f3e101e29" />
<File name="TreeData/3_25_alternate/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_25_alternate/tree.lua" part="tree" sha1="e624bdf2956bad4ccc422bfd6c4ae40424fcd8af" />
<File name="TreeData/3_25_ruthless/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_25_ruthless/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_25_ruthless/ascendancy-background-3.png" part="tree" sha1="5fa92be470099926c4281f723b0b4fee56f5be70" />
<File name="TreeData/3_25_ruthless/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_25_ruthless/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_25_ruthless/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_25_ruthless/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_25_ruthless/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_25_ruthless/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_25_ruthless/mastery-3.png" part="tree" sha1="bf1e176d3f8905b5ec72e076dee4ef76a29763fa" />
<File name="TreeData/3_25_ruthless/mastery-active-effect-3.png" part="tree" sha1="ffe6ad7528545ed043c08a31ecceb87d30d7453d" />
<File name="TreeData/3_25_ruthless/mastery-active-selected-3.png" part="tree" sha1="7f5e45911247cd339943473516ab1dfb062b51d9" />
<File name="TreeData/3_25_ruthless/mastery-connected-3.png" part="tree" sha1="5d5cb7a7e706e61c39c988073dffb9bc8343e545" />
<File name="TreeData/3_25_ruthless/mastery-disabled-3.png" part="tree" sha1="da03b6fc68f28e7921eb89d0ba71d27ec4fc4a10" />
<File name="TreeData/3_25_ruthless/skills-3.jpg" part="tree" sha1="4de55e7466365960faec3c49153f50f2987ff0c2" />
<File name="TreeData/3_25_ruthless/skills-disabled-3.jpg" part="tree" sha1="007ad663947f77bde56ad2b2f20171eb3c67df76" />
<File name="TreeData/3_25_ruthless/sprites.lua" part="tree" sha1="0a067e68f203f4698c5b4e14f16b0a7fe52bf170" />
<File name="TreeData/3_25_ruthless/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_25_ruthless/tree.lua" part="tree" sha1="42d09b07ba706479413604c744f2bfc9a93dcd36" />
<File name="TreeData/3_25_ruthless_alternate/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_25_ruthless_alternate/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_25_ruthless_alternate/ascendancy-background-3.png" part="tree" sha1="b7ae547eb114a95048bee06578a821f81aba770b" />
<File name="TreeData/3_25_ruthless_alternate/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_25_ruthless_alternate/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_25_ruthless_alternate/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_25_ruthless_alternate/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_25_ruthless_alternate/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_25_ruthless_alternate/mastery-3.png" part="tree" sha1="bf1e176d3f8905b5ec72e076dee4ef76a29763fa" />
<File name="TreeData/3_25_ruthless_alternate/mastery-active-effect-3.png" part="tree" sha1="ffe6ad7528545ed043c08a31ecceb87d30d7453d" />
<File name="TreeData/3_25_ruthless_alternate/mastery-active-selected-3.png" part="tree" sha1="7f5e45911247cd339943473516ab1dfb062b51d9" />
<File name="TreeData/3_25_ruthless_alternate/mastery-connected-3.png" part="tree" sha1="5d5cb7a7e706e61c39c988073dffb9bc8343e545" />
<File name="TreeData/3_25_ruthless_alternate/mastery-disabled-3.png" part="tree" sha1="da03b6fc68f28e7921eb89d0ba71d27ec4fc4a10" />
<File name="TreeData/3_25_ruthless_alternate/skills-3.jpg" part="tree" sha1="3ddcabbb422d4458a061df622239f6b1fcdbd553" />
<File name="TreeData/3_25_ruthless_alternate/skills-disabled-3.jpg" part="tree" sha1="8b2e1b15e4101d8d92ac968f3f546e2937b900d2" />
<File name="TreeData/3_25_ruthless_alternate/sprites.lua" part="tree" sha1="8771333e922da83245a65994a382084f3e101e29" />
<File name="TreeData/3_25_ruthless_alternate/tattoo-active-effect-3.png" part="tree" sha1="065db8af17e487b91347dfda84c9a1e3be73ed5c" />
<File name="TreeData/3_25_ruthless_alternate/tree.lua" part="tree" sha1="2dd77407c7cbd7ff037c362b7741ed6dec59e63a" />
<File name="TreeData/3_26/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_26/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_26/ascendancy-background-3.png" part="tree" sha1="b7ae547eb114a95048bee06578a821f81aba770b" />
<File name="TreeData/3_26/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_26/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_26/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_26/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_26/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_26/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_26/mastery-3.png" part="tree" sha1="ba9c16a9b3608bd2c7f82ab2f8c679700a75eea3" />
<File name="TreeData/3_26/mastery-active-effect-3.png" part="tree" sha1="dc238fef8a7c69c5b2b41a16008418c390aace25" />
<File name="TreeData/3_26/mastery-active-selected-3.png" part="tree" sha1="636f19b9efa0c7d106d24c4c43b93684d5f9bf3d" />
<File name="TreeData/3_26/mastery-connected-3.png" part="tree" sha1="6de05de82a4916ca9e492071ae7533c529ac4b60" />
<File name="TreeData/3_26/mastery-disabled-3.png" part="tree" sha1="b5f14579abd5a52fc761ba0d013f1a4b2253b611" />
<File name="TreeData/3_26/skills-3.jpg" part="tree" sha1="142788c23289a60ca1cbbd9ea8413e030999b068" />
<File name="TreeData/3_26/skills-disabled-3.jpg" part="tree" sha1="cc15193961b4a31055eb46b33b27b57bf09b8098" />
<File name="TreeData/3_26/sprites.lua" part="tree" sha1="93fd965ee0b2e668eb8277dbc7f5e2233ce94d99" />
<File name="TreeData/3_26/tattoo-active-effect-3.png" part="tree" sha1="8d1f8944f2f92f48c42522f1a34b9deea83fdf25" />
<File name="TreeData/3_26/tree.lua" part="tree" sha1="e75db83a7c4dbf32579ca9f7c56922ca9924d375" />
<File name="TreeData/3_26_alternate/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_26_alternate/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_26_alternate/ascendancy-background-3.png" part="tree" sha1="b7ae547eb114a95048bee06578a821f81aba770b" />
<File name="TreeData/3_26_alternate/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_26_alternate/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_26_alternate/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_26_alternate/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_26_alternate/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_26_alternate/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_26_alternate/mastery-3.png" part="tree" sha1="ba9c16a9b3608bd2c7f82ab2f8c679700a75eea3" />
<File name="TreeData/3_26_alternate/mastery-active-effect-3.png" part="tree" sha1="dc238fef8a7c69c5b2b41a16008418c390aace25" />
<File name="TreeData/3_26_alternate/mastery-active-selected-3.png" part="tree" sha1="636f19b9efa0c7d106d24c4c43b93684d5f9bf3d" />
<File name="TreeData/3_26_alternate/mastery-connected-3.png" part="tree" sha1="6de05de82a4916ca9e492071ae7533c529ac4b60" />
<File name="TreeData/3_26_alternate/mastery-disabled-3.png" part="tree" sha1="b5f14579abd5a52fc761ba0d013f1a4b2253b611" />
<File name="TreeData/3_26_alternate/skills-3.jpg" part="tree" sha1="142788c23289a60ca1cbbd9ea8413e030999b068" />
<File name="TreeData/3_26_alternate/skills-disabled-3.jpg" part="tree" sha1="cc15193961b4a31055eb46b33b27b57bf09b8098" />
<File name="TreeData/3_26_alternate/sprites.lua" part="tree" sha1="93fd965ee0b2e668eb8277dbc7f5e2233ce94d99" />
<File name="TreeData/3_26_alternate/tattoo-active-effect-3.png" part="tree" sha1="8d1f8944f2f92f48c42522f1a34b9deea83fdf25" />
<File name="TreeData/3_26_alternate/tree.lua" part="tree" sha1="be673cd933f1e8d5c7d6180137feee96375bef35" />
<File name="TreeData/3_26_ruthless/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_26_ruthless/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_26_ruthless/ascendancy-background-3.png" part="tree" sha1="b7ae547eb114a95048bee06578a821f81aba770b" />
<File name="TreeData/3_26_ruthless/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_26_ruthless/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_26_ruthless/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_26_ruthless/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_26_ruthless/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_26_ruthless/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_26_ruthless/mastery-3.png" part="tree" sha1="ba9c16a9b3608bd2c7f82ab2f8c679700a75eea3" />
<File name="TreeData/3_26_ruthless/mastery-active-effect-3.png" part="tree" sha1="dc238fef8a7c69c5b2b41a16008418c390aace25" />
<File name="TreeData/3_26_ruthless/mastery-active-selected-3.png" part="tree" sha1="636f19b9efa0c7d106d24c4c43b93684d5f9bf3d" />
<File name="TreeData/3_26_ruthless/mastery-connected-3.png" part="tree" sha1="6de05de82a4916ca9e492071ae7533c529ac4b60" />
<File name="TreeData/3_26_ruthless/mastery-disabled-3.png" part="tree" sha1="b5f14579abd5a52fc761ba0d013f1a4b2253b611" />
<File name="TreeData/3_26_ruthless/skills-3.jpg" part="tree" sha1="142788c23289a60ca1cbbd9ea8413e030999b068" />
<File name="TreeData/3_26_ruthless/skills-disabled-3.jpg" part="tree" sha1="cc15193961b4a31055eb46b33b27b57bf09b8098" />
<File name="TreeData/3_26_ruthless/sprites.lua" part="tree" sha1="93fd965ee0b2e668eb8277dbc7f5e2233ce94d99" />
<File name="TreeData/3_26_ruthless/tattoo-active-effect-3.png" part="tree" sha1="8d1f8944f2f92f48c42522f1a34b9deea83fdf25" />
<File name="TreeData/3_26_ruthless/tree.lua" part="tree" sha1="e8b8993d61e936461922bc3f62c99cd866673112" />
<File name="TreeData/3_26_ruthless_alternate/ascendancy-3.png" part="tree" sha1="caed47911e769df545a764fd5e81748f02a200c4" />
<File name="TreeData/3_26_ruthless_alternate/ascendancy-background-3.jpg" part="tree" sha1="7c2d1bf35472dcf931a6b60cca7441dde5f5a837" />
<File name="TreeData/3_26_ruthless_alternate/ascendancy-background-3.png" part="tree" sha1="b7ae547eb114a95048bee06578a821f81aba770b" />
<File name="TreeData/3_26_ruthless_alternate/background-3.png" part="tree" sha1="be530e9012afe953967420ef2aab06db68fbf341" />
<File name="TreeData/3_26_ruthless_alternate/frame-3.png" part="tree" sha1="523092448a1cdf8364abd9df20000c23c982d544" />
<File name="TreeData/3_26_ruthless_alternate/group-background-3.png" part="tree" sha1="b0aa020c855beabb2f7c47d00241379b1ec6de0a" />
<File name="TreeData/3_26_ruthless_alternate/jewel-3.png" part="tree" sha1="758ae69e9644926fc8f4b60b45a77a438305d99a" />
<File name="TreeData/3_26_ruthless_alternate/jewel-radius.png" part="tree" sha1="6f10b1a56349d14fba4247cb399f09771ae92be7" />
<File name="TreeData/3_26_ruthless_alternate/line-3.png" part="tree" sha1="2e4698a40a457f13ac69ba2505acaf574efcc1a5" />
<File name="TreeData/3_26_ruthless_alternate/mastery-3.png" part="tree" sha1="ba9c16a9b3608bd2c7f82ab2f8c679700a75eea3" />
<File name="TreeData/3_26_ruthless_alternate/mastery-active-effect-3.png" part="tree" sha1="dc238fef8a7c69c5b2b41a16008418c390aace25" />
<File name="TreeData/3_26_ruthless_alternate/mastery-active-selected-3.png" part="tree" sha1="636f19b9efa0c7d106d24c4c43b93684d5f9bf3d" />
<File name="TreeData/3_26_ruthless_alternate/mastery-connected-3.png" part="tree" sha1="6de05de82a4916ca9e492071ae7533c529ac4b60" />
<File name="TreeData/3_26_ruthless_alternate/mastery-disabled-3.png" part="tree" sha1="b5f14579abd5a52fc761ba0d013f1a4b2253b611" />
<File name="TreeData/3_26_ruthless_alternate/skills-3.jpg" part="tree" sha1="142788c23289a60ca1cbbd9ea8413e030999b068" />
<File name="TreeData/3_26_ruthless_alternate/skills-disabled-3.jpg" part="tree" sha1="cc15193961b4a31055eb46b33b27b57bf09b8098" />
<File name="TreeData/3_26_ruthless_alternate/sprites.lua" part="tree" sha1="93fd965ee0b2e668eb8277dbc7f5e2233ce94d99" />
<File name="TreeData/3_26_ruthless_alternate/tattoo-active-effect-3.png" part="tree" sha1="8d1f8944f2f92f48c42522f1a34b9deea83fdf25" />
<File name="TreeData/3_26_ruthless_alternate/tree.lua" part="tree" sha1="b2f06d98c8eb81fdee7107438f0c6f105cbe0086" />
<File name="TreeData/AmberOil.png" part="tree" sha1="2fd670aeee1c39ae99eef78cc351f9f7fbc091bc" />
<File name="TreeData/AscendancyButton.png" part="tree" sha1="60d0e1334840a6f143b4c3cbe7f0675709701691" />
<File name="TreeData/AscendancyButtonHighlight.png" part="tree" sha1="fcb6cd198a3b85c3b08623591bc0ba6d0ba4b991" />
<File name="TreeData/AscendancyButtonPressed.png" part="tree" sha1="0fd975cf9d1c22276c06e9905cae12c8fff8b417" />
<File name="TreeData/AscendancyFrameLargeAllocated.png" part="tree" sha1="3d13ba17db0f61b20d737c703414ff0263c2a1dc" />
<File name="TreeData/AscendancyFrameLargeCanAllocate.png" part="tree" sha1="e11c24a1cb92489c9f29eb6a48a4927d2cc854f4" />
<File name="TreeData/AscendancyFrameLargeNormal.png" part="tree" sha1="2560b194a15c342ec93ca8cfeba3a719229b48c8" />
<File name="TreeData/AscendancyFrameSmallAllocated.png" part="tree" sha1="6dcd147b904c470af0a66412e7184ad03eba462b" />
<File name="TreeData/AscendancyFrameSmallCanAllocate.png" part="tree" sha1="a67ab7791d2058b4322039f42b4ff49214fbcbb7" />
<File name="TreeData/AscendancyFrameSmallNormal.png" part="tree" sha1="76574b733671962c07d4a6974abc6403ad764ab0" />
<File name="TreeData/AscendancyMiddle.png" part="tree" sha1="fa33df0224c4f48c90f170cbe3c1382a5ec07642" />
<File name="TreeData/AzmeriAscendancyFrameLargeAllocated.png" part="tree" sha1="153ee339b837b7c2e570cb1673e8076ff8f34545" />
<File name="TreeData/AzmeriAscendancyFrameLargeCanAllocate.png" part="tree" sha1="6b8d8de45ec6fa101efeb0e5b3d9111aa6aa8192" />
<File name="TreeData/AzmeriAscendancyFrameLargeNormal.png" part="tree" sha1="9fa77cf0e0080ab1f71503f448b5b6e3d756a51c" />
<File name="TreeData/AzmeriAscendancyFrameSmallAllocated.png" part="tree" sha1="ae7f2d1b88e11f77dccb504d959e71bad90fb339" />
<File name="TreeData/AzmeriAscendancyFrameSmallCanAllocate.png" part="tree" sha1="0673c937dba9041c6345d3ef51cd61387750e1e3" />
<File name="TreeData/AzmeriAscendancyFrameSmallNormal.png" part="tree" sha1="c4327a07f5dd04192b78ca47c2ec8f2271023623" />
<File name="TreeData/AzmeriAscendancyMiddle.png" part="tree" sha1="f7128d54f417967871e1f1f5347c2446aa41d39c" />
<File name="TreeData/AzmeriJewelFrameAllocated.png" part="tree" sha1="0e6ed20722c86cf75064ab6e0937e6082137b629" />
<File name="TreeData/AzmeriJewelFrameCanAllocate.png" part="tree" sha1="bd1c55ae05befb1aa5556a65f9d3262a9d82f4b9" />
<File name="TreeData/AzmeriJewelFrameUnallocated.png" part="tree" sha1="3d04638ddb43350769dc667cad18b0a8be3dabb6" />
<File name="TreeData/AzureOil.png" part="tree" sha1="eec575d9afbc63dfe674e48847cd904b56217da4" />
<File name="TreeData/Background1.png" part="tree" sha1="5ca14dfc325b1875d8fc50676766cbcc8607cee4" />
<File name="TreeData/Background2.png" part="tree" sha1="d42c7cfd18a119280b3b4eb747095f79e9abba15" />
<File name="TreeData/BackgroundDex.png" part="tree" sha1="a62eab7a2bd6e9c55d71b6c3b468e16991788ebf" />
<File name="TreeData/BackgroundDexInt.png" part="tree" sha1="8e4505a50daf80d55ab92dfc482fea03d0efbe9c" />
<File name="TreeData/BackgroundInt.png" part="tree" sha1="1d27eaf60b578247830e3ea4b1c75ad9f6a31cde" />
<File name="TreeData/BackgroundStr.png" part="tree" sha1="5d2fbcff5b012177c7cb3d60e65b0ed0f8496a3e" />
<File name="TreeData/BackgroundStrDex.png" part="tree" sha1="ace742515fb246d5e83a5bdf7f52d1c1e5f1bb0b" />
<File name="TreeData/BackgroundStrInt.png" part="tree" sha1="02e516da646da75ad6d68d391c95f58b28211eb2" />
<File name="TreeData/BlackOil.png" part="tree" sha1="4362c3ffc24fca10756118815105dc8f17e9c459" />
<File name="TreeData/BlightedNotableFrameAllocated.png" part="tree" sha1="623d10bc07da4ab626bb29aa862f59e01c21fe4a" />
<File name="TreeData/BlightedNotableFrameCanAllocate.png" part="tree" sha1="f2e0d3af59c602d1e05d4243b578d910d516da4f" />
<File name="TreeData/BlightedNotableFrameUnallocated.png" part="tree" sha1="d509753cbfd2dad5faeef687e654ca6aff8d8b95" />
<File name="TreeData/centerduelist.png" part="tree" sha1="1c7494f3771b3b9c91a03ffe50c7f018f967c684" />
<File name="TreeData/centermarauder.png" part="tree" sha1="2188a9ed5f122d9284d002dd628f2091bc196841" />
<File name="TreeData/centerranger.png" part="tree" sha1="54afada86d4cf2894af3bcaac9e6ccf509fd54bf" />
<File name="TreeData/centerscion.png" part="tree" sha1="f57437370e64ffc22bc754cddeb9a6a4f4497b41" />
<File name="TreeData/centershadow.png" part="tree" sha1="578e4fa9762261762be2714572edc436e0adddea" />
<File name="TreeData/centertemplar.png" part="tree" sha1="55bf345efacbf3e08a18d2e44e51beffffbb2a95" />
<File name="TreeData/centerwitch.png" part="tree" sha1="d333706ca7a10f998d6b5240c679e598a60edf90" />
<File name="TreeData/CharmSocketActiveDex.png" part="tree" sha1="88186ac7ef35edccc01d809f228ec3e4782bbc0b" />
<File name="TreeData/CharmSocketActiveInt.png" part="tree" sha1="8c751c2452922a399f8e66210e3d08a36ef00549" />
<File name="TreeData/CharmSocketActiveStr.png" part="tree" sha1="d13f319cc3206dcb0cdea13d0f6d1e39be40c86a" />
<File name="TreeData/ClassesAscendant.png" part="tree" sha1="30c010e605c6b5bdc9f22c43330bee360e6bc98b" />
<File name="TreeData/ClassesAssassin.png" part="tree" sha1="680948488f95027f182ea4b7eefd12f66e26e173" />
<File name="TreeData/ClassesBerserker.png" part="tree" sha1="0f2c9b5752ea8d9115d713f79305f2347d5bc943" />
<File name="TreeData/ClassesChampion.png" part="tree" sha1="9065bc7b37deaa3f3bc9fdef8ba2047ea44002e6" />
<File name="TreeData/ClassesChieftain.png" part="tree" sha1="65fad45b4b4ddcb9118ebb9dd63c60f7d0586d3e" />
<File name="TreeData/ClassesDeadeye.png" part="tree" sha1="20be006424044f91d3a7eb8c80fc1b695f033cc9" />
<File name="TreeData/ClassesElementalist.png" part="tree" sha1="8d42b88c7f63f16ed8516234940a9cb6af6d2d65" />
<File name="TreeData/ClassesGladiator.png" part="tree" sha1="4b89078a1b34d204aadd59e1c284bc6b1a3d6271" />
<File name="TreeData/ClassesGuardian.png" part="tree" sha1="9fa535b0c3e6e21b2a18333d6eddcfb323be1cda" />
<File name="TreeData/ClassesHierophant.png" part="tree" sha1="330ea3e4afda54e826a251b9bb6d3c5589551be3" />
<File name="TreeData/ClassesInquisitor.png" part="tree" sha1="a949301f0c852c54c8dce465249b648d4d3ae285" />
<File name="TreeData/ClassesJuggernaut.png" part="tree" sha1="3ac5920d583e885758dc9f0434a3dde91273ccc2" />
<File name="TreeData/ClassesNecromancer.png" part="tree" sha1="50d4b793b1150b54d9805e4c4b68080fc79d1e1e" />
<File name="TreeData/ClassesOccultist.png" part="tree" sha1="c21c3fb8a472454edbb99e3377b90299bd54ebfa" />
<File name="TreeData/ClassesPathfinder.png" part="tree" sha1="c65dd580ac2583737829eac55fe4d9ec552648c1" />
<File name="TreeData/ClassesPrimalist.png" part="tree" sha1="cec4eca4ff4704a24fa459cb7787920038b19f26" />
<File name="TreeData/ClassesRaider.png" part="tree" sha1="f755c1a3d1e47c847ef096bd4ad019c5ef50f880" />
<File name="TreeData/ClassesSaboteur.png" part="tree" sha1="c5cef3aaba22f472fd032b6531ae672722ed9002" />
<File name="TreeData/ClassesSlayer.png" part="tree" sha1="4a245709feb0f5aeca64e3407a4ac76b72cf3163" />
<File name="TreeData/ClassesTrickster.png" part="tree" sha1="66799e65d7c68ec371e45781c44e857c28276bce" />
<File name="TreeData/ClassesWarden.png" part="tree" sha1="847fe86c5671c5839afad84ca0c4d814ef291884" />
<File name="TreeData/ClassesWarlock.png" part="tree" sha1="0a5476c9fbd3e1541b9011dfc76f24ebbc5f24f8" />
<File name="TreeData/ClearOil.png" part="tree" sha1="9319447ffae59ca9dbaf7b40ce130f193c746571" />
<File name="TreeData/CrimsonOil.png" part="tree" sha1="1fb94eb2f65c7b9b5395e2daf6c887f43bd0f4cd" />
<File name="TreeData/EternalEmpireJewelCircle1.png" part="tree" sha1="5ff686f46e7798c11e835a83027039d0c14ba3f4" />
<File name="TreeData/EternalEmpireJewelCircle2.png" part="tree" sha1="578b54ff2208f9387d52e40b78fc533e9978ee97" />
<File name="TreeData/GoldenOil.png" part="tree" sha1="8475b6862fbc2a8b11fff241ff3390b76aba5f8b" />
<File name="TreeData/GroupBackgroundLargeHalfAlt.png" part="tree" sha1="de51eab5094586b2ab5e369b5a845713ceba0149" />
<File name="TreeData/GroupBackgroundMediumAlt.png" part="tree" sha1="fdb250610ea0f6b7d19f6c4a8b55158f43c84fab" />
<File name="TreeData/GroupBackgroundSmallAlt.png" part="tree" sha1="2bcdea282eaa55f2cefdebb3af54cdebd3488221" />
<File name="TreeData/imgPSFadeCorner.png" part="tree" sha1="b74e007cd3c61059f3a4e303c7caf34f15e2cad3" />
<File name="TreeData/imgPSFadeSide.png" part="tree" sha1="e27bb4ab38d3865f8bb7c5dd46f0dcc53a599a26" />
<File name="TreeData/IndigoOil.png" part="tree" sha1="92cba0521ea4eac6fb1b3fc75a0c1d45c6e676c5" />
<File name="TreeData/JewelCircle1.png" part="tree" sha1="ed2b4dfdb469433632e59738efc1319f462a3670" />
<File name="TreeData/JewelCircle1Inverse.png" part="tree" sha1="9cd9f26f4271b99a514e5771bf6f87f6261b5133" />
<File name="TreeData/JewelFrameAllocated.png" part="tree" sha1="d0f946ce6d138909ebb4f1341b29d32c74df7718" />
<File name="TreeData/JewelFrameCanAllocate.png" part="tree" sha1="a8b2f840cdde3a8821ca1790a5109d9abd0e3f32" />
<File name="TreeData/JewelFrameUnallocated.png" part="tree" sha1="aa457e8183c9f805992027512d8879cda5538d72" />
<File name="TreeData/JewelSocketActiveAbyss.png" part="tree" sha1="4f675d3e44ee8f989fb0164a3c6e87c580374c45" />
<File name="TreeData/JewelSocketActiveAbyssAlt.png" part="tree" sha1="f376d0700aa55e12af6a547025f096c39b3d5d48" />
<File name="TreeData/JewelSocketActiveAltBlue.png" part="tree" sha1="e960df28e43119c60b86281d0dd584be9a57e285" />
<File name="TreeData/JewelSocketActiveAltPurple.png" part="tree" sha1="8e4d77dee8048b8da4d9556c7a6c51a69a231670" />
<File name="TreeData/JewelSocketActiveAltRed.png" part="tree" sha1="1aa3d97654fc0c09856d9668aceb1fbc50af8c83" />
<File name="TreeData/JewelSocketActiveBlue.png" part="tree" sha1="39796196dc48f0a5cfd648d6b87631960c165891" />
<File name="TreeData/JewelSocketActiveBlueAlt.png" part="tree" sha1="6a10f1e1eb0400ef81057467fc38cca719b52418" />
<File name="TreeData/JewelSocketActiveGreen.png" part="tree" sha1="c0e4c8192a0593e2174152412c1744897c4dc79b" />
<File name="TreeData/JewelSocketActiveGreenAlt.png" part="tree" sha1="1842721b8ea21b4a591c40be9756d46068f9fdd0" />
<File name="TreeData/JewelSocketActiveLegion.png" part="tree" sha1="78c4efa11be1783af1649f1917f29c30ee82300c" />
<File name="TreeData/JewelSocketActiveLegionAlt.png" part="tree" sha1="02b0f4e8d7a2e1c0038327582099a1667095cfa8" />
<File name="TreeData/JewelSocketActivePrismatic.png" part="tree" sha1="333bbd5ec8e58dbc37958fb5c5cb4cbc70df1cb8" />
<File name="TreeData/JewelSocketActivePrismaticAlt.png" part="tree" sha1="fe83b21f238dd03788a1d7ebff9b572970cf27ee" />
<File name="TreeData/JewelSocketActiveRed.png" part="tree" sha1="32487978b9c0ec456b8a4b8f189c84d3c86ae21c" />
<File name="TreeData/JewelSocketActiveRedAlt.png" part="tree" sha1="9c236bad2d8f7c45d295d59466bf2d01ebbf0c2e" />
<File name="TreeData/JewelSocketActiveTimeless.png" part="tree" sha1="abed5c654cb450aac8ab1c9bef5d1377a7b18d67" />
<File name="TreeData/JewelSocketAltActive.png" part="tree" sha1="3fdaca72ea72173b4f54ad32ddf2d627ed1faefa" />
<File name="TreeData/JewelSocketAltCanAllocate.png" part="tree" sha1="691b66d167a37b9c00392fd047b1949635611527" />
<File name="TreeData/JewelSocketAltNormal.png" part="tree" sha1="6bc256ab46f67b26c5c51aaa30d85bca42baa4d4" />
<File name="TreeData/JewelSocketClusterAltCanAllocate1Large.png" part="tree" sha1="bacfc3363c4266123f6b55e4e701e62590da24b0" />
<File name="TreeData/JewelSocketClusterAltCanAllocate1Medium.png" part="tree" sha1="e9d89e2142ee68d6ec0bd828d508bc1b08777e5e" />
<File name="TreeData/JewelSocketClusterAltCanAllocate1Small.png" part="tree" sha1="3c296d18df70dd1920cf0956e25975fdc8cba5f3" />
<File name="TreeData/JewelSocketClusterAltNormal1Large.png" part="tree" sha1="731b1fa4a776520d342e783fc5934782dbe22090" />
<File name="TreeData/JewelSocketClusterAltNormal1Medium.png" part="tree" sha1="eb1c39beec586c6814c55c289e4164f8256e576e" />
<File name="TreeData/JewelSocketClusterAltNormal1Small.png" part="tree" sha1="6877504dcd6900f7b6218d35ecdab49b818a261d" />
<File name="TreeData/KaruiJewelCircle1.png" part="tree" sha1="662633c5424b325983f3d9ad50ce35e9390c0218" />
<File name="TreeData/KaruiJewelCircle2.png" part="tree" sha1="a25f741e0423354300b4e550e9cd57eb29d1a99f" />
<File name="TreeData/KeystoneFrameAllocated.png" part="tree" sha1="a7ec147315e57e95d8440a14920c852f15c0cdcf" />
<File name="TreeData/KeystoneFrameCanAllocate.png" part="tree" sha1="56bb163714febf13463baf12bd758739a57e6a70" />
<File name="TreeData/KeystoneFrameUnallocated.png" part="tree" sha1="d424ac607ea6c2696b5e27f6a566e47c772072cd" />
<File name="TreeData/legion/skills-additional-3.jpg" part="tree" sha1="b98c0a2b9ac6dd585450789e2b53437e246592bf" />
<File name="TreeData/legion/skills-additional-disabled-3.jpg" part="tree" sha1="988e3d5a1b489fb8ae4eb3647f32fec689c6eddb" />
<File name="TreeData/legion/tree-legion.lua" part="tree" sha1="3b57c9eae4553c66407b8ce4981aca5c06c7ad92" />
<File name="TreeData/LineConnectorActive.png" part="tree" sha1="1c743489dae753c10e9395ca15f6775e49e623a0" />
<File name="TreeData/LineConnectorIntermediate.png" part="tree" sha1="f6a12a47d663a26fa9e51c44c5bee9a906e1af73" />
<File name="TreeData/LineConnectorNormal.png" part="tree" sha1="f2b009c3e735a4a456977f0b06faed633aea1635" />
<File name="TreeData/MarakethJewelCircle1.png" part="tree" sha1="2e6dd08eed2b3f68b14063541f08a0ff95750c46" />
<File name="TreeData/MarakethJewelCircle2.png" part="tree" sha1="af822f164d05c035c4ffa3d5035e4cd6fe67f678" />
<File name="TreeData/NotableFrameAllocated.png" part="tree" sha1="e0c01cd83cc50dd333d11299b29ddc02ff8c20aa" />
<File name="TreeData/NotableFrameCanAllocate.png" part="tree" sha1="87973c184c904a4f7655d12cfd695d13c4108ab0" />
<File name="TreeData/NotableFrameUnallocated.png" part="tree" sha1="b897b879edcb1f0f73ff8609926fc9ff0fa2da5f" />
<File name="TreeData/OpalescentOil.png" part="tree" sha1="ec857841ed5837c87e873de187502d77a77664ea" />
<File name="TreeData/Orbit1Active.png" part="tree" sha1="6c762b8fed697771114fed94c260643f1fda75ea" />
<File name="TreeData/Orbit1Intermediate.png" part="tree" sha1="1fdfa55f70a3404435b70a154813f9daf44af6f0" />
<File name="TreeData/Orbit1Normal.png" part="tree" sha1="315aad48e6886b49d45cc76a8dfd172508d6d737" />
<File name="TreeData/Orbit2Active.png" part="tree" sha1="dc233d911c271982e8cc692492c4a5335edba69a" />
<File name="TreeData/Orbit2Intermediate.png" part="tree" sha1="1ceede85be616351e856108a5e49dc8637daeebe" />
<File name="TreeData/Orbit2Normal.png" part="tree" sha1="dfd66a02f3dae87eae9f245c48978085de45a7ba" />
<File name="TreeData/Orbit3Active.png" part="tree" sha1="c3ca9d3f8892ffe295e952d8e476b5d688dee8ac" />
<File name="TreeData/Orbit3Intermediate.png" part="tree" sha1="1190bd91f89845c8a2bbf7eff15b9f8c8e3e3884" />
<File name="TreeData/Orbit3Normal.png" part="tree" sha1="fba8ad863046297cb982bc96514fc58b99c7d2f0" />
<File name="TreeData/Orbit4Active.png" part="tree" sha1="c5b6faf95cf819bc84e3abb7d212f53210372fa5" />
<File name="TreeData/Orbit4Intermediate.png" part="tree" sha1="ce337f314f0b69fb441d1861e00ac702d2261cfa" />
<File name="TreeData/Orbit4Normal.png" part="tree" sha1="208638cbd1c482d035dc249774d0141328b78d7b" />
<File name="TreeData/Orbit5Active.png" part="tree" sha1="a0fcd97482116b0c0d5321b9f63dbcf77b647e9c" />
<File name="TreeData/Orbit5Intermediate.png" part="tree" sha1="03595348ee1ae534d770419fd8cc59b628d464ba" />
<File name="TreeData/Orbit5Normal.png" part="tree" sha1="f86312e0df861d513562353320da2ab4c5a0fd71" />
<File name="TreeData/Orbit6Active.png" part="tree" sha1="dab85883e0a82bf5f5ca6c09014b2eb003bbebfd" />
<File name="TreeData/Orbit6Intermediate.png" part="tree" sha1="f299091746a297c69d28020b53d854ff91157a93" />
<File name="TreeData/Orbit6Normal.png" part="tree" sha1="58bd59fda0cdc1c7504a6093ff9041080588d654" />
<File name="TreeData/PassiveSkillScreenAscendancyButton.png" part="tree" sha1="570f34a29da650e6d6781890db7ff5d5a8dd18be" />
<File name="TreeData/PassiveSkillScreenAscendancyButtonHighlight.png" part="tree" sha1="c24ff0df6d4a5228dd46d29b49fe1b68d1133e48" />
<File name="TreeData/PassiveSkillScreenAscendancyButtonPressed.png" part="tree" sha1="bfdf7398d89e94ade00ee3a35e12827f2933465b" />
<File name="TreeData/PassiveSkillScreenAscendancyFrameLargeAllocated.png" part="tree" sha1="f7a5a410f5bf598e7d5363604dd8875db062453f" />
<File name="TreeData/PassiveSkillScreenAscendancyFrameLargeCanAllocate.png" part="tree" sha1="15774c60f76ec5c3d390b261abb8d19647fe75d7" />
<File name="TreeData/PassiveSkillScreenAscendancyFrameLargeNormal.png" part="tree" sha1="5c2f1bc140b0fb7afdf78bf8c3bd9e7651cababc" />
<File name="TreeData/PassiveSkillScreenAscendancyFrameSmallAllocated.png" part="tree" sha1="d914bdfc4a1a63daff44bbae550ba8d1fdfefaa4" />
<File name="TreeData/PassiveSkillScreenAscendancyFrameSmallCanAllocate.png" part="tree" sha1="81e9df4424a49c38ab55767434078690e35a0d1c" />
<File name="TreeData/PassiveSkillScreenAscendancyFrameSmallNormal.png" part="tree" sha1="58caea3a42eadf821e2dae5b7ed4e236e07c700f" />
<File name="TreeData/PassiveSkillScreenAscendancyMiddle.png" part="tree" sha1="7bad658a6a0140d747c7f403d73b1fe6b8b3939e" />
<File name="TreeData/PassiveSkillScreenEternalEmpireJewelCircle1.png" part="tree" sha1="176d82b2b3cef255d96233bf0d3cc6f52856a10d" />
<File name="TreeData/PassiveSkillScreenEternalEmpireJewelCircle2.png" part="tree" sha1="4608694066030f98d03f12bb4c0f8637bb67ff50" />
<File name="TreeData/PassiveSkillScreenJewelCircle1.png" part="tree" sha1="61eb7f289f38b87cf92a6ab08110c70e9ea76a22" />
<File name="TreeData/PassiveSkillScreenKaruiJewelCircle1.png" part="tree" sha1="b482fde617eee347a5eaae7f59214374776d18ce" />
<File name="TreeData/PassiveSkillScreenKaruiJewelCircle2.png" part="tree" sha1="6ab37a27f6682d7dc1663d33e0d72cb2be9dc186" />
<File name="TreeData/PassiveSkillScreenMarakethJewelCircle1.png" part="tree" sha1="43146cfe341910d2bc3344335bb941ed051bfc59" />
<File name="TreeData/PassiveSkillScreenMarakethJewelCircle2.png" part="tree" sha1="c374c6df84a3722f1e76736efd4c319663a41c43" />
<File name="TreeData/PassiveSkillScreenTemplarJewelCircle1.png" part="tree" sha1="278c73cb6fc8cf570624495272ef261959b6582f" />
<File name="TreeData/PassiveSkillScreenTemplarJewelCircle2.png" part="tree" sha1="b0ea15b6228a293c152d3fe4a0d087a5ca6a32f8" />
<File name="TreeData/PassiveSkillScreenVaalJewelCircle1.png" part="tree" sha1="4ab002b077e40968738c0cfaef99c409e2fc65a5" />
<File name="TreeData/PassiveSkillScreenVaalJewelCircle2.png" part="tree" sha1="98fe9b58bbd2b17c71baf9e1d769bfe5bc056f99" />
<File name="TreeData/PrismaticOil.png" part="tree" sha1="d9784aa11e251ed4b90505df4581f4efbf077237" />
<File name="TreeData/PSGroupBackground1.png" part="tree" sha1="fddf3f37d9a661a14eb8c00914c9a4b50a0005dd" />
<File name="TreeData/PSGroupBackground2.png" part="tree" sha1="6172580c6a143274487cb1b0fee6fe5d3babf7e3" />
<File name="TreeData/PSGroupBackground3.png" part="tree" sha1="c1921ff01a66d345945cfb4e8562d2878dbf8e95" />
<File name="TreeData/PSLineDeco.png" part="tree" sha1="5585d3d7fd7ac8f946c52111f24f09880b5c2413" />
<File name="TreeData/PSLineDecoHighlighted.png" part="tree" sha1="8e0d7b6c12f27218e8c3a86f96b8390582d2bc63" />
<File name="TreeData/PSPointsFrame.png" part="tree" sha1="276149031e29550b668a195b10fa68b02178211d" />
<File name="TreeData/PSSkillFrame.png" part="tree" sha1="82fbfcd4d9c7b61464614f69aeeb6912712b7dde" />
<File name="TreeData/PSSkillFrameActive.png" part="tree" sha1="e820f2fd0187c7fb5e255b89a53115fd25847831" />
<File name="TreeData/PSSkillFrameHighlighted.png" part="tree" sha1="876508200ac2043ec9af17cc0d34382b990480e9" />
<File name="TreeData/PSStartNodeBackgroundInactive.png" part="tree" sha1="d04c106596d6b7a67d17cdecb1dd6850142ac6cd" />
<File name="TreeData/SepiaOil.png" part="tree" sha1="bdb1e7d716599d5cd1b6fb5f4c919cb7cab24530" />
<File name="TreeData/SilverOil.png" part="tree" sha1="9120b5adf5a4c5e4162798b50e1c4c70735e1288" />
<File name="TreeData/TealOil.png" part="tree" sha1="b520f0814555df5b7f9ac9d2831cace63e4f822e" />
<File name="TreeData/TemplarJewelCircle1.png" part="tree" sha1="610b42ac157bca85247b81a534427f9fa80253c4" />
<File name="TreeData/TemplarJewelCircle2.png" part="tree" sha1="4778a3c3acc8c4d32b8cd677be0e2db7d32bb0f6" />
<File name="TreeData/VaalJewelCircle1.png" part="tree" sha1="a84d7a44d160e1480a3036b547de3ae2153a0c52" />
<File name="TreeData/VaalJewelCircle2.png" part="tree" sha1="facc5d2fea2f0027d09fdb6e4692f9f298aff293" />
<File name="TreeData/VerdantOil.png" part="tree" sha1="97e77b6e96accf440c17a81d622bf629b8c78fe7" />
<File name="TreeData/VioletOil.png" part="tree" sha1="1e9e4f0683a5156c27cb7ddafada8bed877e1c25" />
</PoBVersion>
-301
View File
@@ -1,301 +0,0 @@
#@
-- Path of Building
--
-- Module: Update Check
-- Checks for updates
--
local connectionProtocol, proxyURL = ...
local xml = require("xml")
local sha1 = require("sha1")
local curl = require("lcurl.safe")
local lzip = require("lzip")
local globalRetryLimit = 10
local function downloadFileText(source, file)
for i = 1, 5 do
if i > 1 then
ConPrintf("Retrying... (%d of 5)", i)
end
local text = ""
local easy = curl.easy()
local escapedUrl = source..easy:escape(file)
easy:setopt_url(escapedUrl)
easy:setopt(curl.OPT_ACCEPT_ENCODING, "")
if connectionProtocol then
easy:setopt(curl.OPT_IPRESOLVE, connectionProtocol)
end
if proxyURL then
easy:setopt(curl.OPT_PROXY, proxyURL)
end
easy:setopt_writefunction(function(data)
text = text..data
return true
end)
local _, error = easy:perform()
easy:close()
if not error then
return text
end
ConPrintf("Download failed (%s)", error:msg())
if globalRetryLimit == 0 or i == 5 then
return nil, error:msg()
end
globalRetryLimit = globalRetryLimit - 1
end
end
local function downloadFile(source, file, outName)
for i = 1, 5 do
if i > 1 then
ConPrintf("Retrying... (%d of 5)", i)
end
local easy = curl.easy()
local escapedUrl = source..easy:escape(file)
easy:setopt_url(escapedUrl)
easy:setopt(curl.OPT_ACCEPT_ENCODING, "")
if connectionProtocol then
easy:setopt(curl.OPT_IPRESOLVE, connectionProtocol)
end
if proxyURL then
easy:setopt(curl.OPT_PROXY, proxyURL)
end
local file = io.open(outName, "wb+")
easy:setopt_writefunction(file)
local _, error = easy:perform()
easy:close()
file:close()
if not error then
return true
end
ConPrintf("Download failed (%s)", error:msg())
if globalRetryLimit == 0 or i == 5 then
return nil, error:msg()
end
globalRetryLimit = globalRetryLimit - 1
end
return true
end
ConPrintf("Checking for update...")
-- Use built-in helpers to obtain absolute paths without spawning a shell.
local scriptPath = (GetScriptPath and GetScriptPath()) or "."
local runtimePath = (GetRuntimePath and GetRuntimePath()) or scriptPath
-- Load and process local manifest
local localVer
local localPlatform, localBranch
local localFiles = { }
local localManXML = xml.LoadXMLFile(scriptPath.."/manifest.xml")
local localSource
if localManXML and localManXML[1].elem == "PoBVersion" then
for _, node in ipairs(localManXML[1]) do
if type(node) == "table" then
if node.elem == "Version" then
localVer = node.attrib.number
localPlatform = node.attrib.platform
localBranch = node.attrib.branch
elseif node.elem == "Source" then
if node.attrib.part == "default" then
localSource = node.attrib.url
end
elseif node.elem == "File" then
local fullPath
node.attrib.name = node.attrib.name:gsub("{space}", " ")
fullPath = scriptPath .. "/" .. node.attrib.name
localFiles[node.attrib.name] = { sha1 = node.attrib.sha1, part = node.attrib.part, platform = node.attrib.platform, fullPath = fullPath }
end
end
end
end
if not localVer or not localSource or not localBranch or not next(localFiles) then
ConPrintf("Update check failed: invalid local manifest")
return nil, "Invalid local manifest"
end
localSource = localSource:gsub("{branch}", localBranch)
-- Download and process remote manifest
local remoteVer
local remoteFiles = { }
local remoteSources = { }
local remoteManText, errMsg = downloadFileText(localSource, "manifest.xml")
if not remoteManText then
ConPrintf("Update check failed: couldn't download version manifest")
return nil, "Couldn't download version manifest.\nReason: "..errMsg.."\nCheck your internet connectivity.\nIf you are using a proxy, specify it in Options."
end
local remoteManXML = xml.ParseXML(remoteManText)
if remoteManXML and remoteManXML[1].elem == "PoBVersion" then
for _, node in ipairs(remoteManXML[1]) do
if type(node) == "table" then
if node.elem == "Version" then
remoteVer = node.attrib.number
elseif node.elem == "Source" then
if not remoteSources[node.attrib.part] then
remoteSources[node.attrib.part] = { }
end
remoteSources[node.attrib.part][node.attrib.platform or "any"] = node.attrib.url
elseif node.elem == "File" then
if not node.attrib.platform or node.attrib.platform == localPlatform then
local fullPath
fullPath = scriptPath .. "/" .. node.attrib.name
remoteFiles[node.attrib.name] = { sha1 = node.attrib.sha1, part = node.attrib.part, platform = node.attrib.platform, fullPath = fullPath }
end
end
end
end
end
if not remoteVer or not next(remoteSources) or not next(remoteFiles) then
ConPrintf("Update check failed: invalid remote manifest")
return nil, "Invalid remote manifest"
end
-- Build lists of files to be updated or deleted
local updateFiles = { }
for name, data in pairs(remoteFiles) do
data.name = name
local sanitizedName = name:gsub("{space}", " ")
if (not localFiles[name] or localFiles[name].sha1 ~= data.sha1) and (not localFiles[sanitizedName] or localFiles[sanitizedName].sha1 ~= data.sha1) then
table.insert(updateFiles, data)
elseif localFiles[name] then
local file = io.open(localFiles[name].fullPath, "rb")
if not file then
ConPrintf("Warning: '%s' doesn't exist, it will be re-downloaded", data.name)
table.insert(updateFiles, data)
else
local content = file:read("*a")
file:close()
if data.sha1 ~= sha1(content) and data.sha1 ~= sha1(content:gsub("\n", "\r\n")) then
ConPrintf("Warning: Integrity check on '%s' failed, it will be replaced", data.name)
table.insert(updateFiles, data)
end
end
end
end
local deleteFiles = { }
for name, data in pairs(localFiles) do
data.name = name
local unSanitizedName = name:gsub(" ", "{space}")
if not remoteFiles[name] and not remoteFiles[unSanitizedName] then
table.insert(deleteFiles, data)
end
end
if #updateFiles == 0 and #deleteFiles == 0 then
ConPrintf("No update available.")
return "none"
end
MakeDir("Update")
ConPrintf("Downloading update...")
-- Download changelog
downloadFile(localSource, "changelog.txt", scriptPath.."/changelog.txt")
-- Download files that need updating
local failedFile = false
local zipFiles = { }
for index, data in ipairs(updateFiles) do
if UpdateProgress then
UpdateProgress("Downloading %d/%d", index, #updateFiles)
end
local partSources = remoteSources[data.part]
local source = partSources[localPlatform] or partSources["any"]
source = source:gsub("{branch}", localBranch)
local fileName = scriptPath.."/Update/"..data.name:gsub("[\\/]","{slash}")
data.updateFileName = fileName
local zipName = source:match("/([^/]+%.zip)$")
if zipName then
if not zipFiles[zipName] then
ConPrintf("Downloading %s...", zipName)
local zipFileName = scriptPath.."/Update/"..zipName
downloadFile(source, "", zipFileName)
zipFiles[zipName] = lzip.open(zipFileName)
end
local zip = zipFiles[zipName]
if zip then
local zippedFile = zip:OpenFile(data.name)
if zippedFile then
local file = io.open(fileName, "wb+")
file:write(zippedFile:Read("*a"))
file:close()
zippedFile:Close()
else
ConPrintf("Couldn't extract '%s' from '%s' (extract failed)", data.name, zipName)
end
else
ConPrintf("Couldn't extract '%s' from '%s' (zip open failed)", data.name, zipName)
end
else
local skipDownload
local file = io.open(fileName, "rb")
if file then
local content = file:read("*all")
if data.sha1 == sha1(content) or data.sha1 == sha1(content:gsub("\n", "\r\n")) then
ConPrintf("Using file from previous update attempt '%s'", fileName)
skipDownload = true
end
file:close()
end
if not skipDownload then
ConPrintf("Downloading %s... (%d of %d)", data.name, index, #updateFiles)
downloadFile(source, data.name, fileName)
end
end
local file = io.open(fileName, "rb")
if not file then
failedFile = true
else
local content = file:read("*all")
if data.sha1 ~= sha1(content) and data.sha1 ~= sha1(content:gsub("\n", "\r\n")) then
ConPrintf("Hash mismatch on '%s'", fileName)
failedFile = true
end
file:close()
end
end
for name, zip in pairs(zipFiles) do
zip:Close()
os.remove(scriptPath.."/Update/"..name)
end
if failedFile then
ConPrintf("Update failed: one or more files couldn't be downloaded")
return nil, "One or more files couldn't be downloaded.\nCheck your internet connectivity,\nor try again later."
end
-- Create new manifest
localManXML = { elem = "PoBVersion" }
table.insert(localManXML, { elem = "Version", attrib = { number = remoteVer, platform = localPlatform, branch = localBranch } })
for part, platforms in pairs(remoteSources) do
for platform, url in pairs(platforms) do
table.insert(localManXML, { elem = "Source", attrib = { part = part, platform = platform ~= "any" and platform, url = url } })
end
end
for name, data in pairs(remoteFiles) do
table.insert(localManXML, { elem = "File", attrib = { name = data.name, sha1 = data.sha1, part = data.part, platform = data.platform } })
end
xml.SaveXMLFile(localManXML, scriptPath.."/Update/manifest.xml")
-- Build list of operations to apply the update
local updateMode = "normal"
local ops = { }
for _, data in pairs(updateFiles) do
-- Ensure that the destination path of this file exists
local dirStr = ""
for dir in data.fullPath:gmatch("([^/]*/)") do
dirStr = dirStr .. dir
MakeDir(dirStr)
end
table.insert(ops, 'move "'..data.updateFileName..'" "'..data.fullPath..'"')
end
for _, data in pairs(deleteFiles) do
table.insert(ops, 'delete "'..data.fullPath..'"')
end
table.insert(ops, 'move "'..scriptPath..'/Update/manifest.xml" "'..scriptPath..'/manifest.xml"')
-- Write operations file
local opFile = io.open(scriptPath.."/Update/opFile.txt", "w+")
opFile:write(table.concat(ops, "\n"))
opFile:close()
ConPrintf("Update is ready.")
return updateMode
-934
View File
@@ -1,934 +0,0 @@
<PoBVersion>
<Version number="0.12.2" branch="master" platform="any" />
<Source part="default" url="https://raw.githubusercontent.com/meehl/RustyPathOfBuilding/main/lua/poe2/" />
<Source part="origin" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/{branch}/" />
<Source part="runtime" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/{branch}/runtime/" />
<Source part="program" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/{branch}/src/" />
<Source part="tree" url="https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/{branch}/src/" />
<File name="changelog.txt" part="origin" sha1="1a60522e403d5d00cf750e81a2ca3bff52f7afce" />
<File name="help.txt" part="origin" sha1="eb788d20352333fad99bcf6092306f0c3bca3122" />
<File name="LICENSE.md" part="origin" sha1="e81bd01e60cdf8646f3308ec71fa0e8e638d544e" />
<File name="Assets/ascendancypassiveheaderleft.png" part="program" sha1="c1c73a71cc742de4f2964da78e9ed8841ab7039d" />
<File name="Assets/ascendancypassiveheadermiddle.png" part="program" sha1="7fdf2e33023dd056dc97aea1ff40326798b18acf" />
<File name="Assets/ascendancypassiveheaderright.png" part="program" sha1="cb86351a2240240752654f72f0178f95d63496cc" />
<File name="Assets/fractureditemsymbol.png" part="program" sha1="54c43aeda91e1e2e4f7928ff942a0cd40da9b0e4" />
<File name="Assets/game_ui_small.png" part="program" sha1="3e3f01a7c21ffe5ee7dfb644e9f3b7188c319d4d" />
<File name="Assets/icon_amulet.png" part="program" sha1="5979958dc0975fea63d57b15ef311ecda56f3fda" />
<File name="Assets/icon_belt.png" part="program" sha1="a6739f6a6d5ebb100ea57732227c2bb568483eb6" />
<File name="Assets/icon_body_armour.png" part="program" sha1="c5237359ed6ea5b81772b1d35029b757c87041cc" />
<File name="Assets/icon_boots.png" part="program" sha1="7e52b33f4c72802cf6b63056abe21e26719b857c" />
<File name="Assets/icon_bow.png" part="program" sha1="c0a5e9c8b8030b0f3f331782a0a161b901be0999" />
<File name="Assets/icon_gloves.png" part="program" sha1="9fe16986f5c2858b40149416e89f036a9e9582a0" />
<File name="Assets/icon_helmet.png" part="program" sha1="eb3271f3e9e94e2523ce2d0b90c6fd2b1c3e0435" />
<File name="Assets/icon_quiver.png" part="program" sha1="719bd6edc05f655ff5c7ec4a047dde34b6006e0e" />
<File name="Assets/icon_ring_left.png" part="program" sha1="01b88d06e8e505af62a776e818b77fb20a8661d6" />
<File name="Assets/icon_ring_right.png" part="program" sha1="dc1ab4a69f7199970a28cac489b0ba9aeeff028b" />
<File name="Assets/icon_shield.png" part="program" sha1="7ed6a0b926e593588daffc9149041cd817ca264c" />
<File name="Assets/icon_shield_swap.png" part="program" sha1="d82df8de7a60827d81007f141db5867eca080f8a" />
<File name="Assets/icon_weapon.png" part="program" sha1="24fd23457f7b609324ad5f5bb8cb576cc4a7c058" />
<File name="Assets/icon_weapon_2.png" part="program" sha1="10a946226cfe1832ff839b77c0d927d4be2bb43c" />
<File name="Assets/icon_weapon_2_swap.png" part="program" sha1="2e0ee90278daa40da9177e0658f2900c49a69127" />
<File name="Assets/icon_weapon_swap.png" part="program" sha1="2fe92098fb38157483928bad3a26c623d4fefae1" />
<File name="Assets/itemsheaderfoilleft.png" part="program" sha1="af947f23c93e750dd8a18701c9fbffbbfed4a86f" />
<File name="Assets/itemsheaderfoilmiddle.png" part="program" sha1="c1bc20f0a70a8ab6aa72643272db0b53ce9b792e" />
<File name="Assets/itemsheaderfoilright.png" part="program" sha1="39e4ca7291ec88481ad2b46465a615cedfe62ada" />
<File name="Assets/itemsheadergemleft.png" part="program" sha1="cac8cfbc1e0701183edc1ef9bb972aacc7b50735" />
<File name="Assets/itemsheadergemmiddle.png" part="program" sha1="09c3b7888a77034848d58c74ac4de23dcbd5b6fd" />
<File name="Assets/itemsheadergemright.png" part="program" sha1="ce879556e4b1d32b75e05419354fa4156b6f53bf" />
<File name="Assets/itemsheadermagicleft.png" part="program" sha1="a6418c0163ae2210b404738c5f7ccd9d74355eff" />
<File name="Assets/itemsheadermagicmiddle.png" part="program" sha1="3494a136711c55522d9cf08c4893373f7877c5c7" />
<File name="Assets/itemsheadermagicright.png" part="program" sha1="55ff3d655cd91571ba89cbe01109516fcd9f971d" />
<File name="Assets/itemsheaderrareleft.png" part="program" sha1="2af93dd7eecceb140446cd37fa770e76a574c8dd" />
<File name="Assets/itemsheaderraremiddle.png" part="program" sha1="219eb4b05089914c2053686b15770c1f2f33be8f" />
<File name="Assets/itemsheaderrareright.png" part="program" sha1="9025ee901a0e0054b7ea3624ebb705e52d1ab816" />
<File name="Assets/itemsheaderuniqueleft.png" part="program" sha1="0b7f65d64b9077672402e303f73c1039e62d4f00" />
<File name="Assets/itemsheaderuniquemiddle.png" part="program" sha1="ad1d3ba627e71a57127dd599a6a8e7c812bc36be" />
<File name="Assets/itemsheaderuniqueright.png" part="program" sha1="7625fcc787be9234c042e066721b012aae01520a" />
<File name="Assets/itemsheaderwhiteleft.png" part="program" sha1="9ab53b15963bf221a44b5638bf318dc6bc1dea79" />
<File name="Assets/itemsheaderwhitemiddle.png" part="program" sha1="80b5cb869801a7ced9f06c22c135dad18a7f095e" />
<File name="Assets/itemsheaderwhiteright.png" part="program" sha1="938c332116cb6aca0bb155f7f7bb232be8f87cc1" />
<File name="Assets/itemsseparatorfoil.png" part="program" sha1="b69de967b90f10e8ec9c88847afd8418ed2b8625" />
<File name="Assets/itemsseparatorgem.png" part="program" sha1="24f8c9de7a8c7d4f7d2562d811b0400e1a9e2ccf" />
<File name="Assets/itemsseparatormagic.png" part="program" sha1="482af9808d5f0b65897e867132a34b33b1df787c" />
<File name="Assets/itemsseparatorrare.png" part="program" sha1="c723885e45a57edc0395b895a8e4562ad6777dc1" />
<File name="Assets/itemsseparatorunique.png" part="program" sha1="5082eccd77c4b39a03eb7bf154e3bfad82dc43a5" />
<File name="Assets/itemsseparatorwhite.png" part="program" sha1="9b03c75998089f3c51228b4a8d16cca15bc1518d" />
<File name="Assets/jewelpassiveheaderleft.png" part="program" sha1="6227a4bce1c14bcf1cb7c2e85f8fda6063c5ef72" />
<File name="Assets/jewelpassiveheadermiddle.png" part="program" sha1="6b03d6db8beb877f69981f75dfff377a92e94fe8" />
<File name="Assets/jewelpassiveheaderright.png" part="program" sha1="44d9b5e58dc98a3a0c07ed4fc1b308df84a6751f" />
<File name="Assets/keystonepassiveheaderleft.png" part="program" sha1="cfc1eeab8e6a2d46c87a6e1c686c329047f2fe68" />
<File name="Assets/keystonepassiveheadermiddle.png" part="program" sha1="3b26e74193615636be4d406d42ef67ee438eeeae" />
<File name="Assets/keystonepassiveheaderright.png" part="program" sha1="9761fe0d5af44bf43f51300ecf0cb19d3afc03e0" />
<File name="Assets/normalpassiveheaderleft.png" part="program" sha1="91e3d2b9f925be28f7fa652556f9a8fc71f91937" />
<File name="Assets/normalpassiveheadermiddle.png" part="program" sha1="717303949d781a60e0bfb9bcc7187da7d1649517" />
<File name="Assets/normalpassiveheaderright.png" part="program" sha1="2e3af754505e96447a9ba7df5cbc79c17757b5d8" />
<File name="Assets/notablepassiveheaderleft.png" part="program" sha1="3c989a4869de0f7cd79dc6b6156c3eef227c20b9" />
<File name="Assets/notablepassiveheadermiddle.png" part="program" sha1="50d700cd2ce5097f746116012ec1192e19a1c3a4" />
<File name="Assets/notablepassiveheaderright.png" part="program" sha1="d62856c69227cb00d3ce9b43b0363a5c0b0f4e1f" />
<File name="Assets/range_guide.png" part="program" sha1="825cef1fe84d30da6e280799f0a885e270807f31" />
<File name="Assets/ring.png" part="program" sha1="6ef89c50f3505dd2c114b3edbcac017ab969d176" />
<File name="Assets/ShadedInnerRing.png" part="program" sha1="6ad9088ebaed6646dbd3d231d563dc9611ba4bc6" />
<File name="Assets/ShadedInnerRingFlipped.png" part="program" sha1="c13f41ef7cbfc14017a10776d21b121f0e558667" />
<File name="Assets/ShadedOuterRing.png" part="program" sha1="988dee6e0cf9906d78015bc1762b1d95983e89cb" />
<File name="Assets/ShadedOuterRingFlipped.png" part="program" sha1="ffffef32179d39d48db697e9c9e07fdf022457f7" />
<File name="Assets/small_ring.png" part="program" sha1="03e2039559d686a7df2d66bd6f92938e7e02da76" />
<File name="Assets/veileditemsymbol.png" part="program" sha1="4a2c99043eece6b53048bed0b4ae179f1c1082ec" />
<File name="Classes/BuildListControl.lua" part="program" sha1="dd5b90a9f901096ed9d88783398ca5060b2419bf" />
<File name="Classes/ButtonControl.lua" part="program" sha1="697870f9f43eee2c804be087849b46849c83153a" />
<File name="Classes/CalcBreakdownControl.lua" part="program" sha1="24988d1410aa34f707ce3e4cc6151d215a8844ea" />
<File name="Classes/CalcSectionControl.lua" part="program" sha1="468063496e5e998ba4f79450df5b70e9ebb06077" />
<File name="Classes/CalcsTab.lua" part="program" sha1="068b8b48ded47c34ab92ae7838eb75cc53608bb6" />
<File name="Classes/CheckBoxControl.lua" part="program" sha1="578b7ad2b1311cd9c09591e61ecfe8b04d5a729d" />
<File name="Classes/ConfigSetListControl.lua" part="program" sha1="dcd4b1ef3e7a19be3c8e551c446c509865dbcedc" />
<File name="Classes/ConfigTab.lua" part="program" sha1="454b363dca7849435d931dc30e20e168161a4101" />
<File name="Classes/Control.lua" part="program" sha1="1e1502ee51ba61006c346e9360131b7d3754b542" />
<File name="Classes/ControlHost.lua" part="program" sha1="8521dcf6c04880f22c2972618e58aa50fbea1be7" />
<File name="Classes/DraggerControl.lua" part="program" sha1="239b2fbc675d4fe9a8fe36a79fe93870ae298bc6" />
<File name="Classes/DropDownControl.lua" part="program" sha1="2aa730f15fa3876b528998fa48006e4ac94f78a0" />
<File name="Classes/EditControl.lua" part="program" sha1="123ec882687fc517145dad2ad91c7e80acdfbb4e" />
<File name="Classes/ExtBuildListControl.lua" part="program" sha1="4d1dedc752e5c979ae0ad3928faaec8b8ea052be" />
<File name="Classes/ExtBuildListProvider.lua" part="program" sha1="79d6bab71c0e0194e7c5b48e6cfb348d85e20263" />
<File name="Classes/FolderListControl.lua" part="program" sha1="b1ac8024c4eb927edd69220bf66c082778de25e6" />
<File name="Classes/GemSelectControl.lua" part="program" sha1="be27c189d7bcc8ce2efde14ff0833f1c09aebb11" />
<File name="Classes/ImportTab.lua" part="program" sha1="86715391f6ac36b1f741d50534623fdd96cbb09d" />
<File name="Classes/Item.lua" part="program" sha1="b0fb77d04923574814ce1f2f66091ab2ee9ad981" />
<File name="Classes/ItemDBControl.lua" part="program" sha1="4ab0a48b37e0ddc1224ce10fc44c6874672663e5" />
<File name="Classes/ItemListControl.lua" part="program" sha1="a1703a75de1235b4947dea6d7454211ba1498e99" />
<File name="Classes/ItemSetListControl.lua" part="program" sha1="443038191a6ba3a17c3ce6683b96ab2797cf5d39" />
<File name="Classes/ItemSlotControl.lua" part="program" sha1="d1cdcace4872db388d9e8fd1a7e8b4a02ae4534f" />
<File name="Classes/ItemsTab.lua" part="program" sha1="cdcc9e5cbadc9fc428b7611737d970f0e6a1560f" />
<File name="Classes/LabelControl.lua" part="program" sha1="b6c56903b054e14c302a5e4e60ed8e91764bc6a0" />
<File name="Classes/ListControl.lua" part="program" sha1="ba5079fe6a1a38bc8c1cf758d42a62a4a7209e84" />
<File name="Classes/MinionListControl.lua" part="program" sha1="791e346838616c40b973509b30a775c23037665b" />
<File name="Classes/MinionSearchListControl.lua" part="program" sha1="3356a7bd34ee93279a5183445ebd435fa6a6cbc5" />
<File name="Classes/ModDB.lua" part="program" sha1="9a5f5fde621cd72b9fefcf6ea0e3a5b3c232ae23" />
<File name="Classes/ModList.lua" part="program" sha1="5c8ee80bc2f279a88b63dd6d9975436e7717e6b1" />
<File name="Classes/ModStore.lua" part="program" sha1="b63b046a34c7afb1e8ff58484e7febb7e0c27d8a" />
<File name="Classes/NotableDBControl.lua" part="program" sha1="00a9b3adc857487a62707aa821319ccf5b876e2e" />
<File name="Classes/NotesTab.lua" part="program" sha1="de067274e65a7d71940caead279c3a1f8d6fce3e" />
<File name="Classes/PartyTab.lua" part="program" sha1="4ee6e648ecfa675f96bef7f74eef394b096a3821" />
<File name="Classes/PassiveMasteryControl.lua" part="program" sha1="d26082d3fa6485b0813c3a988d180208fdd652ef" />
<File name="Classes/PassiveSpec.lua" part="program" sha1="a0afe84afdde4dd85bd554bc6f7d1f0334f9e1c9" />
<File name="Classes/PassiveSpecListControl.lua" part="program" sha1="694d7b088e895348857b97a78babb00d612469f8" />
<File name="Classes/PassiveTree.lua" part="program" sha1="6762241f37666ade5eab4b92b91ae73be27585f9" />
<File name="Classes/PassiveTreeView.lua" part="program" sha1="e9efb06e9ac10ab5b450a2294b58c946983e49ef" />
<File name="Classes/PathControl.lua" part="program" sha1="2107211dc604f4382da52ba757114665ab5862ba" />
<File name="Classes/PoBArchivesProvider.lua" part="program" sha1="c2f3f922c82a48a92faaf125b5207c41eb1a2c5a" />
<File name="Classes/PoEAPI.lua" part="program" sha1="63134541436320c151e7beebcbac66209adf76bc" />
<File name="Classes/PopupDialog.lua" part="program" sha1="f37b60b6589d4ff0c721c2418d78409f2dc69452" />
<File name="Classes/PowerReportListControl.lua" part="program" sha1="9308c76ea2cdf04ff9d00ffd7fa77d0ea7112eb6" />
<File name="Classes/RectangleOutlineControl.lua" part="program" sha1="4da285dbe76549deae46d3835e00c382c59c18b4" />
<File name="Classes/ResizableEditControl.lua" part="program" sha1="1270c263bd762759cc1121c3eeb4906018136e05" />
<File name="Classes/ScrollBarControl.lua" part="program" sha1="58f68ca961c625d3aba4c8946f7894371c74d335" />
<File name="Classes/SearchHost.lua" part="program" sha1="1fd99b9fbd2c9d26e99397cece708771ce2ad0e1" />
<File name="Classes/SectionControl.lua" part="program" sha1="56f40224d0766ed2699b1ff839f79c43fd5cbf44" />
<File name="Classes/SharedItemListControl.lua" part="program" sha1="907f697112a9738028c8a358e996a7ca8766ea1b" />
<File name="Classes/SharedItemSetListControl.lua" part="program" sha1="0925d72eeb17b464b835289bb71e912056bc6565" />
<File name="Classes/SkillListControl.lua" part="program" sha1="ab2999151dadf4a73054fa424aa06ebc1166d099" />
<File name="Classes/SkillSetListControl.lua" part="program" sha1="2694184c7fec8b25a3af11f228b830f55859bc69" />
<File name="Classes/SkillsTab.lua" part="program" sha1="c6cac87059d9483d41ded9371e4681a41fb3ffc2" />
<File name="Classes/SliderControl.lua" part="program" sha1="a668ed8ac5bcc6d12277bd8c406d9d754032861e" />
<File name="Classes/TextListControl.lua" part="program" sha1="08444ee7a89fac97d6727541b0e94b4997c1c7af" />
<File name="Classes/TimelessJewelListControl.lua" part="program" sha1="474caa03d4c6e6d9d5f01a95eaf500f3bacec814" />
<File name="Classes/TimelessJewelSocketControl.lua" part="program" sha1="a47645db39133957917a0d0f090cf4cc70c4f980" />
<File name="Classes/Tooltip.lua" part="program" sha1="98c5fe13147fe8f3aa19870ad692e53f7d7931ee" />
<File name="Classes/TooltipHost.lua" part="program" sha1="c9854fd295d8305b0d2b1a31ac28b44a53ec791d" />
<File name="Classes/TradeQuery.lua" part="program" sha1="25184786e3e4c889b7ea27ac7eb5273d0822bf83" />
<File name="Classes/TradeQueryGenerator.lua" part="program" sha1="71b8b0f9239d28d5baacdd5f152cf477ab167c49" />
<File name="Classes/TradeQueryRateLimiter.lua" part="program" sha1="63673cfc3fcfde93cd8e626d877a744fd5ca537b" />
<File name="Classes/TradeQueryRequests.lua" part="program" sha1="6bc46b3276970192f954754d044b6959c49eb890" />
<File name="Classes/TradeStatWeightMultiplierListControl.lua" part="program" sha1="2d3c11bb563279bffc4f93763a652a6f430ffd59" />
<File name="Classes/TreeTab.lua" part="program" sha1="021fd89d1af4a25fb1f17b833647b66031387ce1" />
<File name="Classes/UndoHandler.lua" part="program" sha1="ce4835c384c834da0de47b0302b1e774c8300c6b" />
<File name="Data/Bases/amulet.lua" part="program" sha1="d8ce370ece475f4c73d22b1fff98e0f3157bd17c" />
<File name="Data/Bases/axe.lua" part="program" sha1="3f0f326c812163f8843cb0a7e1e5b073e32585f8" />
<File name="Data/Bases/belt.lua" part="program" sha1="82e317900f0a7a505a6418b430b08007fc0a51a3" />
<File name="Data/Bases/body.lua" part="program" sha1="2fc2e6eb8d9215e4d8b3db50e8e710883af59ac6" />
<File name="Data/Bases/boots.lua" part="program" sha1="87f1387fe68fe7244394e2e7f187a77bcccfcc30" />
<File name="Data/Bases/bow.lua" part="program" sha1="d71b631cd9750ab4abcb1cf723df2c0cc5f11846" />
<File name="Data/Bases/claw.lua" part="program" sha1="423a4dd50cfb8147c1f802a241c2e81cae030ac7" />
<File name="Data/Bases/crossbow.lua" part="program" sha1="a4cc6fbe6b114bdb6335e8932bfb30f4e5b75dd5" />
<File name="Data/Bases/dagger.lua" part="program" sha1="d978382070b7a66b183ade83c9389a9db5bc5eda" />
<File name="Data/Bases/fishing.lua" part="program" sha1="dee7585897d3d045143c317a066c7bcf100ddee7" />
<File name="Data/Bases/flail.lua" part="program" sha1="25d8866d52b7481c7b7ca129fcf094e57ba2b73a" />
<File name="Data/Bases/flask.lua" part="program" sha1="e68bea125b60a88a801956bcaee9e86195f7d5d3" />
<File name="Data/Bases/focus.lua" part="program" sha1="4aef7a2dffa79a108a467357ce2226019743b47f" />
<File name="Data/Bases/gloves.lua" part="program" sha1="77d0a3cbabb59e772a7010dedb5fdd8f357ba299" />
<File name="Data/Bases/helmet.lua" part="program" sha1="d24459d8b89757f0e30360d7345c28a198f66348" />
<File name="Data/Bases/jewel.lua" part="program" sha1="a67a798d8eb0a2d3e5da9483afbd9e10f0bb3854" />
<File name="Data/Bases/mace.lua" part="program" sha1="13bd5c1975af7fdb8baf43a461336daeeab2a3bb" />
<File name="Data/Bases/quiver.lua" part="program" sha1="fb76005fd58f16c03e4553f0b767b640047f4668" />
<File name="Data/Bases/ring.lua" part="program" sha1="d5572677ddc3c47e75f1c1d711d8a35cbbccf0db" />
<File name="Data/Bases/sceptre.lua" part="program" sha1="ddce6f69845abcc922279e5850c8aee5d33aec84" />
<File name="Data/Bases/shield.lua" part="program" sha1="bd13c2756f025e78d655f135dd5f9f2dd98109ae" />
<File name="Data/Bases/soulcore.lua" part="program" sha1="07829474a87b629386ae303c93d92a8012ce4d74" />
<File name="Data/Bases/spear.lua" part="program" sha1="ba722fcb88492f8f04bece7056f2b3871fcadc4d" />
<File name="Data/Bases/staff.lua" part="program" sha1="111c2a9123c6df90c42883ec37773854b3ec85ad" />
<File name="Data/Bases/sword.lua" part="program" sha1="974c356d466c855e2f0d85d722886baf8f8f56a5" />
<File name="Data/Bases/traptool.lua" part="program" sha1="8309df6922af375bfebdc226ae4b3545357effde" />
<File name="Data/Bases/wand.lua" part="program" sha1="032f0a53a98c72c8143995d287baa853b73570ad" />
<File name="Data/Bosses.lua" part="program" sha1="81591b7eeaeebdf743ae032b8bf41714f2860e70" />
<File name="Data/BossSkills.lua" part="program" sha1="04ba9d9cece737a23af6e455b1c88e9a0e98ee5b" />
<File name="Data/ClusterJewels.lua" part="program" sha1="6d6016ece7faa214aeb8c0ebfabe9e557e153767" />
<File name="Data/Costs.lua" part="program" sha1="e95fe4606505c4a71f243efbd4f1be0448ffd067" />
<File name="Data/Essence.lua" part="program" sha1="5519e64f4f654978f5f3faced4a6e845def7754e" />
<File name="Data/FlavourText.lua" part="program" sha1="5efd007718af0fec5e0d454101adea57936e42ad" />
<File name="Data/Gems.lua" part="program" sha1="8daca6de69c5aed788a0c55fac2e3c80574d7eee" />
<File name="Data/Global.lua" part="program" sha1="035fbf8480ceb1f7fe422a9d388c34fdd09e77e6" />
<File name="Data/Minions.lua" part="program" sha1="8d9ee7118ff32a62b9f82b7c04efcfa91fad1e3c" />
<File name="Data/Misc.lua" part="program" sha1="e2ed8bf9acacfacf19982f57b6b50b7433565d6c" />
<File name="Data/ModCache.lua" part="program" sha1="ca35f8b6d5178fed06c2175d5820f03c2aee57c1" />
<File name="Data/ModCharm.lua" part="program" sha1="73c45fed94f6d7310a203e559670fb259e87362d" />
<File name="Data/ModCorrupted.lua" part="program" sha1="71be0197895218a7ff080382f7b5f41dcbcd3745" />
<File name="Data/ModFlask.lua" part="program" sha1="6ac6cde764a57585c274556a2ee2c6c6bde60de3" />
<File name="Data/ModItem.lua" part="program" sha1="08c11a1020f2b1fec6879486f50b3303556fba6f" />
<File name="Data/ModItemExclusive.lua" part="program" sha1="c5f47cdfe259ad63a2686599b330d0ba37f28603" />
<File name="Data/ModJewel.lua" part="program" sha1="3cc42541eccc867eefc2449e341da2dc5d376fc7" />
<File name="Data/ModMap.lua" part="program" sha1="29edb01606d86bf46267fbe91ad1dd51eef52dae" />
<File name="Data/ModRunes.lua" part="program" sha1="157b65c2a67028d1023ae1ce6bb6e91781c90430" />
<File name="Data/ModScalability.lua" part="program" sha1="59f1352af3eb09d290f006a0f69f1322ff410435" />
<File name="Data/ModVeiled.lua" part="program" sha1="7cbefaddc52d84c59287dea325ef03898f41ecce" />
<File name="Data/QueryMods.lua" part="program" sha1="1ae4d165c669ca76488bd4dca8aa8a8628d4fe7c" />
<File name="Data/QuestRewards.lua" part="program" sha1="799561cc4cb8dc64f0000695f2853814ed61ad07" />
<File name="Data/Rares.lua" part="program" sha1="41078908a7437ede59cba5de05866a7947ff8882" />
<File name="Data/Skills/act_dex.lua" part="program" sha1="e23c8b21e6743f1687f6f6e9f66890b023de6ce4" />
<File name="Data/Skills/act_int.lua" part="program" sha1="2db04c017f0c894f22bf9bef698619a057d466ec" />
<File name="Data/Skills/act_str.lua" part="program" sha1="299a8344d05db2d185fad12483d00ca0239c8356" />
<File name="Data/Skills/minion.lua" part="program" sha1="4251ee2e964784586e581f9f087509ade6eb6e39" />
<File name="Data/Skills/other.lua" part="program" sha1="db114a6775ecf3f2ca6497d4956fa5036ba9df21" />
<File name="Data/Skills/spectre.lua" part="program" sha1="185f4447fa20d7a3c4619691d3a52d1a69291db7" />
<File name="Data/Skills/sup_dex.lua" part="program" sha1="097ede0c58f734eee45f1318da740db1e83c1964" />
<File name="Data/Skills/sup_int.lua" part="program" sha1="a20bf6f72df2bc6c1eda36229a9e2ea7585ec033" />
<File name="Data/Skills/sup_str.lua" part="program" sha1="415f68cee2409edf0e0e09021939b4d834b20107" />
<File name="Data/SkillStatMap.lua" part="program" sha1="65818937d7b07a3b2ffc1811fc7f14cf3c6d48b5" />
<File name="Data/Spectres.lua" part="program" sha1="5181f94b0f6b66eaff7418fb5b97ac4f5035fb3f" />
<File name="Data/StatDescriptions/active_skill_gem_stat_descriptions.lua" part="program" sha1="9193411d82a10a7342e1168ac0b757d70960b23c" />
<File name="Data/StatDescriptions/advanced_mod_stat_descriptions.lua" part="program" sha1="e63ecf3d4d90381e17bfbe481c4fb2ed0fc2c69b" />
<File name="Data/StatDescriptions/gem_stat_descriptions.lua" part="program" sha1="81f12186bb7b18f27f8e261d4cb8b05f8485040f" />
<File name="Data/StatDescriptions/meta_gem_stat_descriptions.lua" part="program" sha1="b99e6286f9c741973d800b925845836e666804c0" />
<File name="Data/StatDescriptions/monster_stat_descriptions.lua" part="program" sha1="d117b7b1df8e67514c6b29d4c7c1219452ace3cf" />
<File name="Data/StatDescriptions/passive_skill_aura_stat_descriptions.lua" part="program" sha1="9ff473e2c4148f88636adebc656c05f8f9faa1da" />
<File name="Data/StatDescriptions/passive_skill_stat_descriptions.lua" part="program" sha1="79fd5e4d513b6a6ea6ec417afa46c458994274b1" />
<File name="Data/StatDescriptions/skill_stat_descriptions.lua" part="program" sha1="591afeff077bd14cbe290eb27acd7314da4ad860" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/add_buff_to_target.lua" part="program" sha1="718ca5770b58395c171f67b7c947aca5157f0942" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/advancing_strike.lua" part="program" sha1="8bda2bfb0eb5cac27b0beecf80263389a217881b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ailment_bearer.lua" part="program" sha1="cb96dadca4972342ff23e31959b1e7c7143d3bc1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/alchemist_boon.lua" part="program" sha1="facf7717fabf13112659f561a2d612202387f620" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ancestral_cry_projectile.lua" part="program" sha1="ed842b6ed72998ba52ecffeebba0400ff6b133d8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ancestral_cry_shockwave.lua" part="program" sha1="55516507135c133418efc5399b0c3f45a46f3668" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ancestral_cry_statset_0.lua" part="program" sha1="8feacb4b416edd3db134aa9d08117b6d26ef880c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ancestral_cry_statset_1.lua" part="program" sha1="f28fcf5d868b87a672436707270ecfe27af4198e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/apply_rimeshield.lua" part="program" sha1="61d846bd20114d72ae9ae647dae15a06bd96c209" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/arc.lua" part="program" sha1="e43dffe485469abef2388c8f7799230aefcdebe2" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/archmage.lua" part="program" sha1="c95b787d81427f562bd935b4935bec1fcb4659e4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/armour_explosion.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/artillery_ballista_projectile.lua" part="program" sha1="b4971ea9079aa7bd66160911655eead14de8ee98" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/attrition.lua" part="program" sha1="0ef1558f21f0ae3330276ccf5d25181c2872fb99" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/aura_crit_against_enemy.lua" part="program" sha1="bf81665ff31232f77b7dadb6001c048201d4c1af" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/awakened_forest.lua" part="program" sha1="0b371ac6f9fa8bc08ffa69ae2d93bf090c60d3bb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ball_lightning.lua" part="program" sha1="e291abe6c15dae554ac29ff5b4e708bf4a275d07" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ball_lightning_statset_0.lua" part="program" sha1="03e5db8f5774ab66f2dfcf8738abef46c43fc22d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ball_lightning_statset_1.lua" part="program" sha1="d59be4dca487f91e93ad90d4fd7d2fb9efeddc1f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ball_lightning_statset_2.lua" part="program" sha1="67d774b5951cad5109e23a6c662f31d10732a04c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ballistic_ice_projectile.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bear_slam.lua" part="program" sha1="712ac7e5ad43579bafcec6b2e3798f25177736fc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/berserk.lua" part="program" sha1="3bbbc9ef58ed05f1aaf932b365cdc232d75cfacf" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bind_spectre.lua" part="program" sha1="09b9bbd7623dbd1fab25b3403a51267d118256e2" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/black_powder_blitz.lua" part="program" sha1="d23af7c381c52b0ed9079a097be3286a9c000ac6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/blazing_cluster_statset_0.lua" part="program" sha1="6330a37832b2f7d994f80673386d8f291d7046ba" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/blazing_cluster_statset_1.lua" part="program" sha1="d741efbc07e8c0548e7b6c0892676f05d6785a81" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/blazing_cluster_statset_2.lua" part="program" sha1="46bf0cd17cd46d105a2928b76135de12d119196c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bleeding_concoction.lua" part="program" sha1="4ff2aab040be9b166708f87a8142195837e6c478" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/blood_boil.lua" part="program" sha1="dbb9060a25fb11bf0f917e7fcabe3a22092e61a7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bombadier_destructive_link.lua" part="program" sha1="c06b584b539d4779c2507c5f34444f46682c672f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bone_blast.lua" part="program" sha1="af3bb111f7e1dcaf44957cd88f2618cb76a3d800" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bone_cone.lua" part="program" sha1="f5d9c206fc87c6a828c66ec36e9e2407a4418f33" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bone_offering.lua" part="program" sha1="8711e73588530b50c9ac64943a0447b9e314243b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bone_spike_statset_0.lua" part="program" sha1="408ddc62b1fff5528c808bd84884f35f23dc5cdc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/bone_spike_statset_1.lua" part="program" sha1="6565d3f180dd6507da2f77129573b2ced7ec1bf9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/boneshatter.lua" part="program" sha1="b3560d6a1b296691f1a57e04e4813417aa9cd43c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/breach_walk.lua" part="program" sha1="22d962c98ad37e58365b87f3473047473eed2623" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/brute_warcry.lua" part="program" sha1="af83a8e7c1c614862cd8088294db509b173ad102" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burning_runes.lua" part="program" sha1="8016e35c7a10e67526051ee700291af39c158708" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burst_shot_incendiary.lua" part="program" sha1="b6c296dc7946619efd34abba4fed1b3cdae25686" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burst_shot_permafrost.lua" part="program" sha1="563b689175b82320e0265252d41cd0bb1ca63527" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burst_shot_piercing.lua" part="program" sha1="94c032a11d8c9788b7882991240c04497afad119" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burst_shot_piercing_statset_0.lua" part="program" sha1="6714a695dcc9329d6586ef2e92b3434126032f16" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burst_shot_piercing_statset_1.lua" part="program" sha1="5db8028a2d0dc4b7d0ff1771959ec5bc302b0946" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/burst_shot_stormblast.lua" part="program" sha1="e95df8e4657dca9e509d37018faeb7085cc4e4b8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/cast_fire_spell_on_hit.lua" part="program" sha1="49a73ad0c232f961bdd23079a21cca7e5df6c3cd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/cast_lightning_spell_on_hit.lua" part="program" sha1="86df3331a121bdaf612a2ef262f244f916255231" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channel_shield_charge.lua" part="program" sha1="1e038e0cf1f4d743ad43279be6190fe9d69a5cea" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channel_stampede_statset_0.lua" part="program" sha1="7644413c6bae0ef548c9c07d9817eb73f647d9d3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channel_stampede_statset_1.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channel_stampede_statset_2.lua" part="program" sha1="238ab837ed0578c4fea430dcb00d865f37452ccb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_slam_statset_0.lua" part="program" sha1="58b4f44609da13a4dd4ba58f6bab8025cda18d11" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_slam_statset_1.lua" part="program" sha1="110c803bf23f1a844c647b9c9207c6109d291607" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_snipe.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_snipe_statset_0.lua" part="program" sha1="320897dccfd1a611b87e97b9bd2788b406d85d71" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_snipe_statset_1.lua" part="program" sha1="d60e0087d1a25fd359a60c577c650604801c333a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_snipe_statset_2.lua" part="program" sha1="d60e0087d1a25fd359a60c577c650604801c333a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/channelled_snipe_statset_3.lua" part="program" sha1="fcdc4841d02d5d7ef27374ee4d6bc4744d0a455a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/chaos_resist_aura.lua" part="program" sha1="85d0912a8859a09605aa66027b006d540a12a93f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/charge_mastery.lua" part="program" sha1="077746665c8dbc7a244ea52f5a4357924d616884" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/charged_staff.lua" part="program" sha1="eb99491073849a0185e62cbcd2d49dbfecbd516c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/charged_staff_shockwave.lua" part="program" sha1="94a88f5c5ba0f240356f9d37718bb937ab08530c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/charged_strike.lua" part="program" sha1="7dad40031abba08e4d91e054e39d543c8c006887" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/chilling_aura.lua" part="program" sha1="dc41d9951a6b9de4cb890b0b1ab38dc33392866a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/circle_of_power.lua" part="program" sha1="39f5684ba05a9b53ef7880aaba3c0c264ec98951" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/cluster_grenade.lua" part="program" sha1="2548c205e6735158a80ace61fdf50ceb23f0a6ce" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/cluster_grenade_mini.lua" part="program" sha1="4a276f7dffa4acf3e98bde702a20e2c821ceed66" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/cold_resist_aura.lua" part="program" sha1="542adf826d6022a8715d96c5112e97e59a1bbc7a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/cold_weakness.lua" part="program" sha1="43dfdcd9f588040a9e2a5aa8394ef4980a368c4c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/combat_frenzy.lua" part="program" sha1="7642ff1f47b1a99cf9c7b1989ccad47acbd8e51d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/comet.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/consecrate.lua" part="program" sha1="8889f033d8274d92d96a5ee535b839f21dfcaef3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/contagion.lua" part="program" sha1="43d9e2093f0c6c22c36835fa602608bfb987ddc4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/convalescence_active.lua" part="program" sha1="221446d6b4046b53a88f2e4b1438e17eb0ff10dd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/corpse_beetles.lua" part="program" sha1="e8e5db478b0ce9b1fcbf5fb6d8ba8cc6200d084b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/corpse_cloud_statset_0.lua" part="program" sha1="2afbd8ad4e31dea10f2988576b8226b662137d99" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/corpse_cloud_statset_1.lua" part="program" sha1="cb4c7be2d7152d88fd823b46f5b3055a7c52d516" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/create_illusion.lua" part="program" sha1="7c72db0d1939274b97f141573a7f9b451bf3d04d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/create_mirage.lua" part="program" sha1="9f9ebc13229a8160629f282f11b7e41f433f8bcd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/create_void_illusion.lua" part="program" sha1="e6e14029c61dc77a5cb00766a460ff354cbe56dc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/dark_effigy_projectile.lua" part="program" sha1="a084374cfd029ed0bca02ca0f62ad7b6dba67ac0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/dark_tempest.lua" part="program" sha1="55505521b0d6e35f9570c5bb5d809a9e1285bec9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/death_from_above.lua" part="program" sha1="f17adc44cb7081119f280b2ef686a5940a1154ad" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/death_storm.lua" part="program" sha1="b2a0678b189c4e5a4a6eb33fe9a5c1f60151051f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/defiance_banner.lua" part="program" sha1="8741a03c9e79402cd0c65d4da716057dd5c2a2f8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/demon_transformation.lua" part="program" sha1="2bb6d3270e91153fafb5541a11e5acc31d091a57" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/despair.lua" part="program" sha1="f55f966d9048d764fe857c1f982e76a4ea445c93" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/detonate_dead.lua" part="program" sha1="d44303cd18a9c927bb242bdbcc17a8e5bc5fa63f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/detonating_arrow.lua" part="program" sha1="fa2658603409749f489ca6fe0838330d2f5c482b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/discipline.lua" part="program" sha1="83547f4da8e10794bfb619dad49b97098b8f3ca5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_explosive_teleport.lua" part="program" sha1="c17589d5ac89483d8d61c6450eb5195bb014b867" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_fire_rune.lua" part="program" sha1="6cdf4d1cd98c2d8d1176add19494dbce1a084dbc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_fire_slice.lua" part="program" sha1="3b1e9da3db9d4672eb42e761bb0c746f078f8d4f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_force_recharge.lua" part="program" sha1="290b9ebc267cf025636a76d04f908f09998f36e4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_ground_burst.lua" part="program" sha1="f463a74e3d263cb95e6a19b5a85ce11ee92d48ad" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_knife_throw.lua" part="program" sha1="6a95678f8d61aab3cd376c0331edab725d4e894b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_mass_fusillade.lua" part="program" sha1="601aab627222aaf1648856c0dcb08789576d234c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_meteor.lua" part="program" sha1="40412f101787f2dfde24d300d85e2aabcd4051a0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/djinn_triggered_wave.lua" part="program" sha1="253b8b13eb44441d695320d079629a81634c6e1d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/doom_blast.lua" part="program" sha1="278d4434cd0b3ef83ec8c8168c24a3a9560aa4c1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/double_slam.lua" part="program" sha1="90a9ff5a0c95b8fc029ec4acdbcf1fb244fddb29" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/dread_banner.lua" part="program" sha1="f79c5c855f20ccd32df214a1640f016e10155d0b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/earthquake_statset_0.lua" part="program" sha1="df68cd832aac4f5620e18e740a13d963581a0dba" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/earthquake_statset_1.lua" part="program" sha1="e72f5bc3670007512a3e1c4e42383676fbb80b71" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/electrocuting_arrow.lua" part="program" sha1="b0c36a255c2b9a12387eb14392404daec8b1ced9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_conflux.lua" part="program" sha1="83d7c32932f5cd9f373abf923c557ed2dd4d4c56" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_power.lua" part="program" sha1="9298fbc513bd12307d97fce70990b2d615ecdad0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_strike_trigger_statset_0.lua" part="program" sha1="e5a1bad6a7762efbdc6bf9d0d6dc4e204878e5c6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_strike_trigger_statset_1.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_strike_trigger_statset_2.lua" part="program" sha1="bb35e77862fcc6f0855241b1ee031f8407ef9c22" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_strike_trigger_statset_3.lua" part="program" sha1="3584d10dfbdf73f73308304211f391c29a4b5462" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/elemental_weakness.lua" part="program" sha1="762fc1a83e2d9b865b98a3989495611f5ba81fc7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/emergency_reload.lua" part="program" sha1="17405fe72ffb05cd21e179bb7259fffef4082379" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/empower_barrage.lua" part="program" sha1="f453100f51e3b731e0b7e2f2e7671fa0af59cf33" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/encase_in_jade.lua" part="program" sha1="8687db04a9d51488372c5fb6684734517a1e2542" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/enfeeble.lua" part="program" sha1="b92e54e27cd04405adb14f477bc79074612c0407" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/entangle_statset_0.lua" part="program" sha1="1b6bd792b4fc2b8edb890206be8cd684de113aa6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/entangle_statset_1.lua" part="program" sha1="f3eed0f1c4d24b2be17b479a04760e873daf0039" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/escape_shot.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/essence_drain.lua" part="program" sha1="bc83f3df7fe4fee9ba825c55147f8ba1795a91b8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/exploding_poison_toad.lua" part="program" sha1="58af422c35185f8c5f9669bb13c7a16c7c74160d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/explosive_concoction.lua" part="program" sha1="1d8f1e01f1ea1e2e63ce8b80896b95ef6cb05384" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/explosive_grenade.lua" part="program" sha1="2759673e32c89638c7ff6835f672b5b7d4f26566" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/exsanguinate.lua" part="program" sha1="a7779e25d08c3faf821628ed0e17012f230ca3dd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/extract_elements_statset_0.lua" part="program" sha1="93814d9762dfb5e6f5ceca50d310b4dd115e4fa9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/extract_elements_statset_1.lua" part="program" sha1="95731d4711609b1a7a8989c2b6ea893a54092964" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/extract_elements_statset_2.lua" part="program" sha1="da2759ec5791a18ef98cb648bb84fae2851c13fd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/extract_elements_statset_3.lua" part="program" sha1="da2759ec5791a18ef98cb648bb84fae2851c13fd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/eye_of_winter_new.lua" part="program" sha1="1b39db1d5af61531669019aebbce34398fff878f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/feast_of_flesh.lua" part="program" sha1="a2d0e3cdf1c4a45f410c237c15491ce72affe458" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_mortar.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_resist_aura.lua" part="program" sha1="d1aad68d193c8cfba37e022ef033d9e80a32bed5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_storm.lua" part="program" sha1="233913a537f210fd858a19f6b7a8edbd2212c8af" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_storm_statset_0.lua" part="program" sha1="1615bd17446099d288a67ba9b0a43ab1d875b128" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_storm_statset_1.lua" part="program" sha1="79c3af6b2fd6dcb0a69f30291114e86e670e0821" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_storm_statset_2.lua" part="program" sha1="79c3af6b2fd6dcb0a69f30291114e86e670e0821" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fire_weakness.lua" part="program" sha1="e7ea43ec522056624904d99d061b81380b885371" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fireball.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/firewall.lua" part="program" sha1="53c335c8125fc617b66976945853b71657af4d58" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/flash_grenade.lua" part="program" sha1="2759673e32c89638c7ff6835f672b5b7d4f26566" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/foresight.lua" part="program" sha1="a16a21b7af1635a6c4228336fd0156fa0c390acc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/forge_hammer_statset_0.lua" part="program" sha1="48684690faae0aa2f19ebdcc1279a5cf4bf9eaf0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/forge_hammer_statset_1.lua" part="program" sha1="f12361d1dee02dbde5bcf48c3088bf0ba1e336d1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/forge_hammer_statset_2.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/freezing_mark.lua" part="program" sha1="e2af1dd2a5a94fe4bcd2b6a0a1bf64b8d2786191" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/freezing_mark_nova.lua" part="program" sha1="cb61d8424110ead20126ee97c11d50bfcf1c6c18" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/freezing_salvo.lua" part="program" sha1="746a09ac5eaa2e10ed131029299d6c27eaef0ed1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/freezing_word.lua" part="program" sha1="c1edc17bb2ebd22e91ec1790bcbba170f60e6b78" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_bolt.lua" part="program" sha1="eab1a52e46b15586f0f740322648ed2a31e0a6dc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_bomb.lua" part="program" sha1="22bec88423b83373ad0d39d9f240760bc68da9d8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_darts_statset_0.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_darts_statset_1.lua" part="program" sha1="a13ec64671825218816a6b73a3d6e75daa7eb0fa" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_darts_statset_2.lua" part="program" sha1="17cf9aa5989046aedbdd3ab0bc1a775f9536badd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_wall_new.lua" part="program" sha1="429245a837099ae6d68bfb15acf1675f23df1377" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_wall_new_statset_0.lua" part="program" sha1="429245a837099ae6d68bfb15acf1675f23df1377" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frost_wall_new_statset_1.lua" part="program" sha1="a9ec127229a93ab1fcc7dffe2532e02aca641f6d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/frostwhirl.lua" part="program" sha1="e6047e1fc7f8eadb01d06ab5063aa530eaa1ed1c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/fulminating_concoction.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gale_strike.lua" part="program" sha1="1965b1c9af59b39ec36df53582a0c4d1e89591e9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/galvanic_field.lua" part="program" sha1="a3b3ebb58e4e90b7cd60029c8d6064837033cd31" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gas_cloud_arrow_statset_0.lua" part="program" sha1="5de28e231c810ca1c80a77ec57a49dc4c13e3283" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gas_cloud_arrow_statset_1.lua" part="program" sha1="f7c587031f6889e4e044687d89abdeb061b62e52" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gas_cloud_arrow_statset_2.lua" part="program" sha1="3d2c396b307c1e4510a9a006311349544c0c25b4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gathering_storm_statset_0.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gathering_storm_statset_1.lua" part="program" sha1="abf2f0f9f523663275bf184fcb14d12e1ab3047d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/gathering_storm_statset_2.lua" part="program" sha1="3a88da9a9d4f8f68af04b70e7fa5315f74cf8452" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/geometry_spell.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ghost_dance.lua" part="program" sha1="21ab366820f2424d2f87fb2693710629c1cfd499" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ghostfuse_arrow.lua" part="program" sha1="bdd3f491db1a8a93c79243c58bb33d80c8cf0400" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/glacial_cascade_attack.lua" part="program" sha1="402bf639b9dc10abe1a5a7310be3635cb018aa4c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/glacial_lance_statset_0.lua" part="program" sha1="58b6df5b3085aad00fc9d9fdef6a9692d02334a2" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/glacial_lance_statset_1.lua" part="program" sha1="84a2aa05bfa9323e0179d6f3edf20a40874c0913" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/greater_fireball.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/grim_feast.lua" part="program" sha1="7aace9e238051406533ef60eb4ab987f498fa274" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hammer_of_ngamahu_statset_0.lua" part="program" sha1="27533246addd8377b18cf2e49e43b52c39a05021" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hammer_of_ngamahu_statset_1.lua" part="program" sha1="f2d4643462b57844d3aec3772d4c42f8939c638f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hammer_of_ngamahu_statset_2.lua" part="program" sha1="a3c4c8fb87176d3a1c6016fecc8822be50b8b9e5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hammer_of_the_gods.lua" part="program" sha1="a3c4c8fb87176d3a1c6016fecc8822be50b8b9e5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hand_of_chayula.lua" part="program" sha1="7b2cc6ac6182ece34f8fdc1cb99bb5206c2108d1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/harvester.lua" part="program" sha1="5e7dd767a9a2f743065358ff34c86f5939f4b437" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/heavy_strike.lua" part="program" sha1="5ac61da078cc914ab01892683f37be0d1fd85473" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/herald_of_agony.lua" part="program" sha1="40cae0f887ec21ce6a9b81cc1e03428f720ef124" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/herald_of_ash.lua" part="program" sha1="358feb06772965a6625e338a8c2fc90706bfca56" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/herald_of_blood.lua" part="program" sha1="f6cd8e64f3100573c2d2af3534213231fb2a9f59" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/herald_of_ice.lua" part="program" sha1="873748cef7bd11a6d0c3d06089b9a0079bb11883" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/herald_of_thunder_statset_0.lua" part="program" sha1="8b2c5eb114eec0bb6bb39c8ef0448140a2b6eb9d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/herald_of_thunder_statset_1.lua" part="program" sha1="d7224a7f3ab43b613342f4f7b77459e94e9c2863" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hexblast.lua" part="program" sha1="20a3636174783573f59f52897b0e88b9150276a2" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hunters_mark.lua" part="program" sha1="c0d23d815583a6833683de58b362a5d80ad5a3b2" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/hunters_mark_explosion.lua" part="program" sha1="69b798eed2d61a9fae8658c7f88de25f292d0549" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_ambush_explode.lua" part="program" sha1="d6b7ecb89a8f3d1c6966399d96d9d2ada6703fe3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_ambush_statset_0.lua" part="program" sha1="ba41fe79ecdb25047615a9f745e8f4e504bf101e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_ambush_statset_1.lua" part="program" sha1="9ca9a30a0595c8665434b37253424676378818f5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_ambush_statset_2.lua" part="program" sha1="d4eb3dc03548f63ca8958bf32c281a2a5e720878" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_ambush_statset_3.lua" part="program" sha1="9ca9a30a0595c8665434b37253424676378818f5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_bomb.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_nova.lua" part="program" sha1="0e01dfb086b6b16147af8849de6b692938a5f670" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_nova_statset_0.lua" part="program" sha1="0e01dfb086b6b16147af8849de6b692938a5f670" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_nova_statset_1.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_nova_statset_2.lua" part="program" sha1="0fca71b07d2c793cce3e916cc5e394475cd5d089" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_shot.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ice_storm.lua" part="program" sha1="590fb7eea33a0d6e8d04dfa0aab14fa2a98fb3ac" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/icewalker.lua" part="program" sha1="03f8e86c12f69e4c1bec5c05e7335ca78ac756ab" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/igneous_shield.lua" part="program" sha1="aa6648fa701b023c1bf8fb7a45ac6d16ee98db12" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/igneous_shield_explosion.lua" part="program" sha1="85813bc6b71eac4e26c14562d1d91a7b5246e82a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/incinerate_player_statset_0.lua" part="program" sha1="35d88f035abb0f29d053d2efb4daeabf2437e06e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/incinerate_player_statset_1.lua" part="program" sha1="22c5598cf25750170e8fad9c212c2b07a5c3965f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/infernal_cry.lua" part="program" sha1="d3ab594844175a62cd2ae55fe6cc6f6ed4f143eb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/infernal_cry_corpse_explosion.lua" part="program" sha1="54062849a0b010604070fb57d0568479c2a5358d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/infusing_strike.lua" part="program" sha1="2cfb142aefbb8cc4c08cfa4991d362944bfea3e8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/killing_palm.lua" part="program" sha1="bb87177c8b77ee0e0efcb4c0cc415278c9a3bb45" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/knockback_wave.lua" part="program" sha1="6c1d885b5d64e0cb6542a700b0e53db73d428235" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/leap_slam.lua" part="program" sha1="e318872d413a6da021d1157d9ed569465f4d8a21" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/life_remnants.lua" part="program" sha1="7c9b881a278c4f2d729963caaa0a0ea3363b3f87" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_arrow_statset_0.lua" part="program" sha1="53c89ce092fbc9c6c89e60dd864582ae5a1c21f6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_arrow_statset_1.lua" part="program" sha1="e7ee1bf88d8bf42a5cdb2ad372476575e54c10dc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_bolt.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_burst_statset_0.lua" part="program" sha1="9f1169cdc96a76d72a6bd0cd3c12d44349460f53" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_burst_statset_1.lua" part="program" sha1="2e29220e7ab0c39c9a4dfe357d4cb1a5c671905a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_conduit.lua" part="program" sha1="07592058fe3acae59bc2a6130205fc98d328054b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_resist_aura.lua" part="program" sha1="3332ce514eb64940f28082e8a8feb88842d24c08" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_rod_rain.lua" part="program" sha1="0841de1f5c1785183d0c5427e7fc1ea443c89d55" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lightning_weakness.lua" part="program" sha1="4d717266fee00b312dbb5a07f2518d12ee551eeb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/lingering_mirage.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/living_bomb_player.lua" part="program" sha1="6268458fd3aa68c7ca04cb531ae7e9f091caf6d3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/magnetic_salvo_statset_0.lua" part="program" sha1="bc7ca401679b7f057048316afc625f1373915f9a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/magnetic_salvo_statset_1.lua" part="program" sha1="b88e6ed7a7b9d11efb7992b6888a24383fd828cd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/mana_drain.lua" part="program" sha1="c83bb92be4701b6fd316590d9ed72d15767c6b41" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/mana_remnants.lua" part="program" sha1="6ae975ae3972764d9baa50003ff80c6d215aa1eb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/mana_tempest.lua" part="program" sha1="55505521b0d6e35f9570c5bb5d809a9e1285bec9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/mantra_of_destruction.lua" part="program" sha1="c59c268ae0103e6acdd24343fe913a90edcee5ee" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/meta_arcane_archery.lua" part="program" sha1="44f42d849c4299141461146f693a035c4560d229" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/meta_deadeye_marks.lua" part="program" sha1="fe8603e4f2950bb95bd0d5d56abf24c857826197" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/meta_mantra_of_illusions.lua" part="program" sha1="f57fa305fad35c9e7ce9eac3d275a4d545b6ebac" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/meta_ranged_attack_on_freeze.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/meta_ranged_attack_on_ignite.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/meta_ranged_attack_on_shock.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/molten_blast_statset_0.lua" part="program" sha1="d6629259a409c7df4d9e0849d018cf40f5862221" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/molten_blast_statset_1.lua" part="program" sha1="55f404ec9eefe4580c27c80e6e88794cebb06190" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/multistab_spear.lua" part="program" sha1="3adc9e4f8591506ed2e75463a0ef714322c41061" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/new_new_lightning_strike.lua" part="program" sha1="386552c8be1675cc2d54aa1728af6008a5a680e6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/new_shock_nova.lua" part="program" sha1="a3ce665386a093088cce4fa2c1428644621a78e7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/new_sunder_statset_0.lua" part="program" sha1="8e28d91be4854d75578533eb53964c063bea9c05" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/new_sunder_statset_1.lua" part="program" sha1="13cb6e9319bbaa710a05f19ccc9c4987c5dbaf85" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/oil_grenade.lua" part="program" sha1="784d4d8e7d5a3880e0b776836b4e7667809654b0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/orb_of_storms.lua" part="program" sha1="ca0d7bb0820e98329eb71788d4176b528aca48ba" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/overcharged_spear_statset_0.lua" part="program" sha1="d45ffff6ccba8ea792d98304f5f47eeb24c971f9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/overcharged_spear_statset_1.lua" part="program" sha1="58136545704872d3596200021e7dcacb042476b0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/overcharged_spear_statset_2.lua" part="program" sha1="39d6d6f9e39e0de684eb4c246feb5806d5c701b6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/overcharged_spear_statset_3.lua" part="program" sha1="57a40aaa822e4871e88b3a8110e328a2f1b32e55" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/overwhelming_pressure.lua" part="program" sha1="a4f0156faa786ff9a36b7c2a0b6933707d4c1482" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/pain_offering.lua" part="program" sha1="a0cfd7568b218fd66c42feb78d7e9ff6875e340e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/parry.lua" part="program" sha1="22f8e8c4a9501d78eab87e0a19f23743de29e72c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/plague_bearer_nova.lua" part="program" sha1="3bdd434bc89a9ab8e7540c98a6cfb56caf92b8e7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/plague_burst.lua" part="program" sha1="e6f0026cd601a43c2183067004fe85285e9614bc" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/player_ranged_spear.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poison_burst_arrow.lua" part="program" sha1="358fd47dc19a099d00026c2110c18aaef2e29e65" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poison_vine_arrow_statset_0.lua" part="program" sha1="1ddbc881f8ab57bf27adfc87c17054fa30c914db" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poison_vine_arrow_statset_1.lua" part="program" sha1="aefa9d3dd508308c75b64cc20f2e4c8af5f81f3e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poisonbloom_arrow.lua" part="program" sha1="987cd723a0e10af25d9ddf35026227f3b6b72966" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poisonbloom_arrow_statset_0.lua" part="program" sha1="387c6549ac7b80e5f1c348fb5d2d9500be15bae3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poisonbloom_arrow_statset_1.lua" part="program" sha1="00a9cfcd3cd145705524a8d0b5e7b97088ec1e69" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/poisonous_concoction.lua" part="program" sha1="c822cc5b76551046d492e679666d3cd7a02a4266" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/power_offering.lua" part="program" sha1="003d6511440354d4b23fca43072412c2311c1bb5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/power_shot_incendiary.lua" part="program" sha1="0aea46048c2c2bc1d99bf1d24dc2e0ec51a16412" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/power_shot_permafrost.lua" part="program" sha1="4fac6ee90acab0241b662e1175c908868092dac4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/power_shot_piercing.lua" part="program" sha1="f78e9a7165a88e6c462aab9f2cd1726be8554972" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/power_shot_stormblast.lua" part="program" sha1="0aea46048c2c2bc1d99bf1d24dc2e0ec51a16412" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/power_siphon.lua" part="program" sha1="49e5ceb21ed11c2820e8103556c23a0a15e30ca0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/primal_strikes.lua" part="program" sha1="e879823074fd5d7e0ab46ed2bb1506b52e7e6da5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/quarterstaff_frost_burst.lua" part="program" sha1="d0f0239bfa65839daf06fec218ec476e7540dfa5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/raging_spirits.lua" part="program" sha1="3b9898ecee70e15b573c5c6d1c4ef61ff2919de1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rain_of_arrows_new.lua" part="program" sha1="169447e631fcc93634bb35580ae1b363b5e0c7ec" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/raise_zombie.lua" part="program" sha1="96e6558877060a29c9a0bfb4629bf3b78a6ce55c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rake.lua" part="program" sha1="94fafc616acb66ce7f4b47addf3b3ca78d07157c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rapid_shot_incendiary.lua" part="program" sha1="230a1d29b0eb32e3d08028beaf1a362a5343b736" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rapid_shot_permafrost.lua" part="program" sha1="7d8e62c1f91e623c88112658e61d2696488522fb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rapid_shot_piercing.lua" part="program" sha1="dee61f9bc53aeb16835312fe2d67678502879a21" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rapid_shot_requiem.lua" part="program" sha1="7606bcfc842f735822ea34bafe56f384ebb85862" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rapid_shot_requiem_ammo.lua" part="program" sha1="6c55722c9d40cd281a08316494b30b2d4a877ac7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rapid_shot_stormblast.lua" part="program" sha1="1026ea91bbe14bca13219bd454c1a9adc14960ec" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ravenous_swarm.lua" part="program" sha1="66cdc67d05f496c9786df73f51f713ff8a0fa111" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/reap.lua" part="program" sha1="f8be972c3cc7fc0d4f1caf0845b167ccc3395ddf" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/remote_spear_mine_statset_0.lua" part="program" sha1="8404461ee793dedc414c47c2400678fb90ea8655" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/remote_spear_mine_statset_1.lua" part="program" sha1="da2759ec5791a18ef98cb648bb84fae2851c13fd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/remote_spear_mine_statset_2.lua" part="program" sha1="c10944a75225007c89667100fafc1d3c7b9c16f1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/retreating_throw.lua" part="program" sha1="8401b4711e2bd5078851986d524fcec55bb96f06" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ring_of_bone.lua" part="program" sha1="84b28a8180b56a9b61a9ab8092ab229bf58c7627" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/rip_from_time.lua" part="program" sha1="56fdd0bff1554af1a95895d033da80854220ac90" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ripwire_arrow.lua" part="program" sha1="0916e42f5e9dfebb631fd9a4a95b301cfb6d1f44" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ritual_of_power.lua" part="program" sha1="b3b94538a23319f72a141001fc22a925437cea8b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/ritual_sacrifice.lua" part="program" sha1="df9c90f4542fa46c8c22fee832e67de785804534" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/runic_tempering.lua" part="program" sha1="3d6493d1ffa19f123d89b7e763c43f310d118ac5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/sandstorm_swipe.lua" part="program" sha1="6d231255ffb0d232fc8001c00789f099f982c7be" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/scattering_calamity_statset_0.lua" part="program" sha1="95dcdcc469b6c480c304f0a4bce50b0945d8d01f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/scattering_calamity_statset_1.lua" part="program" sha1="8bec6b995fb8f75ec4bc048ebe3116d0a462f4f6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/scavenged_plating.lua" part="program" sha1="ee3b8d0b820e24e6ff76ea19ff2d205c4599df22" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/screaming_devastation.lua" part="program" sha1="c5f141bb6f6865d068e9bac0b256fa0a440daff7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/seismic_cry.lua" part="program" sha1="dd770f08c12da66626e091380f355c85228f5d9a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/serpent_spear_statset_0.lua" part="program" sha1="d60da0a17dbd17661611501d709184f389fe468e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/serpent_spear_statset_1.lua" part="program" sha1="8a3a039ba16bdde8f1cbd7e99a0f28d09b2b1bf4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/serpent_spear_statset_2.lua" part="program" sha1="a76dfe5b478bd96d95c5aa69b35c42974aa6a55a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shard_despoiler.lua" part="program" sha1="7e7680d1bb347e6e42b2828ec57d6a8c75015975" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shatter.lua" part="program" sha1="878141d0904ccd84422773993fee25bf4b0e6361" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shattering_concoction.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shattering_palm.lua" part="program" sha1="9c78804f89c91b877bb7466782bf360be39fbe3d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shearing_bolts.lua" part="program" sha1="beb3eb03e016f0d0e67882eb716cf3c5993072a3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shield_barricade.lua" part="program" sha1="3dac6c34faaec3e7172ac94b46c607528790caee" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shield_block.lua" part="program" sha1="524ec8633205ff204ddd31f2ab923f61f20fa73d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shield_drum.lua" part="program" sha1="56c9d856de212dde32fef16bf43048b731d158f8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shielding_cry.lua" part="program" sha1="3ee1476a05e2b813933aa76686db25bf2490d874" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shielding_cry_shockwave.lua" part="program" sha1="8ccd55df5a909a37be06a05b95da43f584b8d5b8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shock_grenade.lua" part="program" sha1="149f2accd929564a971c0198cb48e37cc9401f91" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/shocking_arrow.lua" part="program" sha1="eccb7a692f46ecd5b94df19065445292df17be90" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/siege_cascade_permafrost.lua" part="program" sha1="8b55d5669ff3a6395009af9eb3b34ec77f0fae47" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/siege_cascade_permafrost_ammo.lua" part="program" sha1="e2e813d199daafa589829cc69fe3134e86554556" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/siege_cascade_piercing.lua" part="program" sha1="6e19427ad8590dcea5200c3f947997cfd211f33c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/siege_cascade_stormblast_statset_0.lua" part="program" sha1="c876066bd3631d218d2400f708933942ac344fba" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/siege_cascade_stormblast_statset_1.lua" part="program" sha1="2a4245d55e713ae1e5bb7cc4078cf120d6352d5e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/sniper_gas_shot_statset_0.lua" part="program" sha1="0c210736bef60a139e54132385f0f72f5faa6a9d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/sniper_gas_shot_statset_1.lua" part="program" sha1="b401363499fe1b5e28ded8d967ba40f6c4620055" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/sniper_gas_shot_statset_2.lua" part="program" sha1="33670c2d154ed65e42e7910cc15936ac528145ee" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/snipers_mark.lua" part="program" sha1="4450998290b71cda32a8307a56efce3e5856697b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/solar_orb_statset_0.lua" part="program" sha1="4fc83d46b81b69d04ccd4f442cad8207ad6bb649" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/solar_orb_statset_1.lua" part="program" sha1="41292481f4da7ae6f9e4d78da999c47eb1ade9fd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/solaris_spear_statset_0.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/solaris_spear_statset_1.lua" part="program" sha1="43375a07ce64305f7d2725a037ad799c946f62a5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/solaris_spear_statset_2.lua" part="program" sha1="b1efca257e2d2a7adc462403c858baa9866d24ce" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/sorcery_ward.lua" part="program" sha1="d5bcadc3a9c1491bf454d6e5780dd571087409cb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/soulrend.lua" part="program" sha1="a7779e25d08c3faf821628ed0e17012f230ca3dd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spark.lua" part="program" sha1="5213082a4c8e675ad445177271fbf1ddd73ee436" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spark_statset_0.lua" part="program" sha1="5213082a4c8e675ad445177271fbf1ddd73ee436" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spark_statset_1.lua" part="program" sha1="d979f80846aa271efa8160563676e4032e234382" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spear_discharge.lua" part="program" sha1="66f15f83a64f6c9a8af16e22fefedf7f557a81b7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spear_lightning_warp.lua" part="program" sha1="fe45253775cb37b366e39b18fc1201c515579638" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spear_storm.lua" part="program" sha1="9db575b95f4cea145955341d8d3c828028279034" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spear_wall_statset_0.lua" part="program" sha1="9e6846cf5502671da18af49b8710a908a22a76c8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spear_wall_statset_1.lua" part="program" sha1="159fb597502604c7c5b71c313c5f419049a19097" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spear_wind_vortex.lua" part="program" sha1="0ff7af13ab41538715e2a51e9c53c8770a3419db" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spectral_bell_carried.lua" part="program" sha1="493523c3d163863cb794ba11c174d2b3279e3bae" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spectral_bells.lua" part="program" sha1="ac278d9cd550213d99ee1027ed4b38fb8c5e377c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spike_slam_statset_0.lua" part="program" sha1="62502031ca0e6b0d8da598e149734af40cc8b4af" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spike_slam_statset_1.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/spiral_volley.lua" part="program" sha1="7cf6adb2fcef2a14b7a7f5bcee061a335832e853" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/stomping_ground_shockwave.lua" part="program" sha1="e7fa354ebfb29c965b0c6e8655ddd30cdcf7c96c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/storm_wave.lua" part="program" sha1="ee81a7e7b0b8897052225dcd65723afc2ee35fe6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/summon_infernal_familiar.lua" part="program" sha1="145ab4288f6a9c6244d7d23dbb4c2135e91d2f3d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/summon_meta_totem_slams.lua" part="program" sha1="b22605ebb89f5c25ce15d4c1307d2312ee21392a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/summon_rhoa_mount.lua" part="program" sha1="4f888fab12068d722128f707b066e16e73a1eb40" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/synchronisation_of_pain.lua" part="program" sha1="a0db3072c9f80b1383e12346a4b4612db5e57fe1" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tame_beast.lua" part="program" sha1="fe04de26848afc266757e8475dcbf7d5786e0ec9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/teleport_ball.lua" part="program" sha1="1b848af8e988f74942ca989defd31e41e2e41e92" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/temper_weapon_combustion.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tempest_bell_statset_0.lua" part="program" sha1="d5544cf7de11fd9b8d58c0078c7891455d0fed3f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tempest_bell_statset_1.lua" part="program" sha1="0d3da9052762455fc841097facde83ede9663aa6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tempest_bell_statset_2.lua" part="program" sha1="2a41bc53b9c36d94d3d656d6fb157150fcee7513" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/temporal_chains.lua" part="program" sha1="7c74b8142fccbecd89e9c49cd80dfca053619494" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/temporal_rift.lua" part="program" sha1="222a74462e01ea3f023e3a064f526711b2eb1e42" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/thaumaturgist_mark.lua" part="program" sha1="dd3190ac52bff121ef569b00e8a9470c347d7cee" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/thaumaturgist_mark_nova.lua" part="program" sha1="b2a747071eb99b80052239cb5ce694df1c6185b7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/the_flawed_edict.lua" part="program" sha1="617ec832661384e8df09852dcfc0aa17af3fa800" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/throw_flask_bleed.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/throw_flask_cold.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/throw_flask_fire.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/throw_flask_lightning.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/throw_flask_poison.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/thunderfist_statset_0.lua" part="program" sha1="68da0b1cb1f3d98b1c15179678e6a1a8100ff50b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/thunderfist_statset_1.lua" part="program" sha1="8befa3c3d3d53eb4a775715d36f467f300364782" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/time_of_need.lua" part="program" sha1="58e947ddc3b721d97da125cbc105c22806bb7eb3" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/time_stop.lua" part="program" sha1="a1b536f384f1200793ad7511098fa83b2041b80d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tornado_shot_statset_0.lua" part="program" sha1="fbe856e84577645304d2c854ae315c9eee8c10e5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tornado_shot_statset_1.lua" part="program" sha1="dfb1c9dd0da06d0ed48c14b4add3c05ec5961fff" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/tornado_triggered.lua" part="program" sha1="aefebea316ab03684da04ef008d837459b119aa7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/totem_shockwave_quake.lua" part="program" sha1="56c9d856de212dde32fef16bf43048b731d158f8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/toxic_domain_statset_0.lua" part="program" sha1="d0e57808d364613c74e754d649fd368dd23a0cb7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/toxic_domain_statset_1.lua" part="program" sha1="9a3e5e80b8b2b1e902638b950946f2dc44b76439" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/toxic_grenade_statset_0.lua" part="program" sha1="badb7dd66321dde51b1cfe5ca70bd09733a0e7b0" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/toxic_grenade_statset_1.lua" part="program" sha1="60e696b22072c72551cf1d994ecafef0411918da" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/toxic_grenade_statset_2.lua" part="program" sha1="ae7badf2d7344d8afaa4daf90ae84b1d3cce976b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/trick_shot.lua" part="program" sha1="914c1878e3c0504b181ea38adb89d0c43926aa80" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/trigger_chaos_infusion.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/trigger_elemental_infusion.lua" part="program" sha1="32464ebf8e4618d0971fd0eca06660fe1b2456b9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_battershout_explosion.lua" part="program" sha1="571eb089556ec198db6589739b240529b8e5a37d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_bone_shrapnel.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_briar_patch.lua" part="program" sha1="8594cb78bb5e5996bddc0171fda4c7d1e196dd6f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_caltrops.lua" part="program" sha1="1eb28e58be0265446c62408e590e77f94dd1d3bd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_caltrops_on_dodge.lua" part="program" sha1="d190a34610aeb32e0413537b1ff2b42ab6955c95" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_curse_zone_hazard_explosion.lua" part="program" sha1="62188f963faa2696e3eb5073fb38031460051277" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_elemental_discharge.lua" part="program" sha1="363130623394e87682f0b106e5cd3cc74c8cf09a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_fiery_death.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_fissure_on_landing.lua" part="program" sha1="e7239b495104bd8d3388957e0d12bd3b7fe66c28" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_freezing_word_explosion.lua" part="program" sha1="cb61d8424110ead20126ee97c11d50bfcf1c6c18" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_frozen_vortex.lua" part="program" sha1="afc8314d52ce4b049b6e8eada3307a00608c9757" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_grounding_shocks.lua" part="program" sha1="a26379cc670bd6818f159acff257318efe041b64" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_haemocrystals.lua" part="program" sha1="588b9d58d57152fbd0d79c56cc8acc34e56fe293" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_hatching_elementals.lua" part="program" sha1="cabf16a1e198657c997ee597d92dfac4311138b7" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_living_lightning.lua" part="program" sha1="ae546eed51bf8afe819bd1433cd74c713f1d826a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_mana_flare.lua" part="program" sha1="d5f46fd6e15e69468b0f10222cdd1adb314cd6be" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_pillar_of_flame.lua" part="program" sha1="3b8bcd3a24a2912706ee7c66910de4068c8ed6cd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_shocking_rift.lua" part="program" sha1="12c296876817c117add5102fed222575372eed2e" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_spiked_gauntlets.lua" part="program" sha1="6c67419944aa522cf38f06e54a0a45b2000f6770" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_splinter_explosion.lua" part="program" sha1="940340ba6bb9503dcaf498398e634281c4c647eb" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_support_from_the_grave_ice_fragment.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_support_frozen_spite_ice_fragment.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_titanic_arrows.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_volcanic_eruption.lua" part="program" sha1="2dcaea0643f54e3d3ae77c809cd738ba7b6eab2d" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_wind_dancer.lua" part="program" sha1="389a5c6bf663380065117539eae984c6a814e4d6" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/triggered_winnowing_flame_pillars.lua" part="program" sha1="9fd892fbca6054098e4828ffb5bc8f970b5d4542" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/unleash.lua" part="program" sha1="1677e43fe0f311d67bbe3acf8c67598598362d81" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/valakos_luck.lua" part="program" sha1="bb60eb2a8fd692bdc43f8fa192b4221b17fa0dd5" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/vaulting_impact.lua" part="program" sha1="76ecc0e166a7cfd20a1cece613b7c297995c5e26" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/vaulting_impact_statset_0.lua" part="program" sha1="be3ac038869263fa3dc6f44865450defe4ea99ab" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/vaulting_impact_statset_1.lua" part="program" sha1="e4905f9761f0e907183643eadbbf10afded6fb24" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/vile_disruption.lua" part="program" sha1="5f74ddc2ee7e259fdc4111e0e1585c5c4260debd" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/vivid_stags.lua" part="program" sha1="5348d88b9291895644f356f0d7146582edf6d637" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/volatile_dead.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/volatile_dead_statset_0.lua" part="program" sha1="b742054c5058e603820653836babb76e2febaf14" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/volatile_dead_statset_1.lua" part="program" sha1="5d0c58559983ed48a3da3492588d57db0e46091f" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/volcanic_fissure.lua" part="program" sha1="a29ca06c05c0395a5adc0426a766aa85deb7ff5b" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/voltaic_mark.lua" part="program" sha1="dd3190ac52bff121ef569b00e8a9470c347d7cee" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/voltaic_mark_nova.lua" part="program" sha1="cb61d8424110ead20126ee97c11d50bfcf1c6c18" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/vulnerability.lua" part="program" sha1="b4029882bd75f71e7e1adb0c63e00582bb648259" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/war_banner.lua" part="program" sha1="306e5c6f6b837dff9164076c278898cc7fad571a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/warding_steel_nova.lua" part="program" sha1="990fdb432a4b0fcfdd41f683e381ccfd85717b5c" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/wind_dancer.lua" part="program" sha1="3eede16bd941cf1ca7b0c37ed03a9e200841cbf8" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/wind_palm.lua" part="program" sha1="608dc9fdd1377bea9c08b0b29b2a7e6130bac526" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/windstorm_lance.lua" part="program" sha1="5fe4c6367d83b3e245a5436755a4cc2532b7b7d9" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/winnowing_flame.lua" part="program" sha1="ab41f3626a5ddc6a411d9914c4f90683cb9b5352" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/witch_hunter_mark.lua" part="program" sha1="ed244dae6e644b2a4a6bfc521ab781a7aa291bf4" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/withering_presence.lua" part="program" sha1="6e7187aaa267c84d48d8cec0c8304adb8f40184a" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/wolf_warcry.lua" part="program" sha1="009e64a970ec47b3c5716545510e85ace560b309" />
<File name="Data/StatDescriptions/Specific_Skill_Stat_Descriptions/wrath_aura.lua" part="program" sha1="f2704638ecc43e15da78506c39d0d2767eff15fb" />
<File name="Data/StatDescriptions/stat_descriptions.lua" part="program" sha1="c4670d4350055911b4b70dd41493638b1f7fd086" />
<File name="Data/StatDescriptions/utility_flask_buff_stat_descriptions.lua" part="program" sha1="165db6bc6a05c8f27e372b022d07d03c6c744b81" />
<File name="Data/TimelessJewelData/LegionPassives.lua" part="program" sha1="eef1e3f5b37de276f19e28e36aa66d3ea29d91d6" />
<File name="Data/TimelessJewelData/LegionTradeIds.lua" part="program" sha1="a852a234591481dcd4c8ddf937fb0f75b69036bb" />
<File name="Data/TimelessJewelData/NodeIndexMapping.lua" part="program" sha1="0590786d62b135bf4a0afea8ec14c446baeda03f" />
<File name="Data/Uniques/amulet.lua" part="program" sha1="7c0e55a52d7cefe280b3ab7c204ae32c21196545" />
<File name="Data/Uniques/axe.lua" part="program" sha1="d6f1880693f105ccb99416fc66894972396cd8a1" />
<File name="Data/Uniques/belt.lua" part="program" sha1="15c2f28e9a911cc1123b13b5a070b5bb66b5946b" />
<File name="Data/Uniques/body.lua" part="program" sha1="9062f7c8be7958441c49e007a63698388397baaf" />
<File name="Data/Uniques/boots.lua" part="program" sha1="6da824c0138fc523db05db1fd08aba00f20f892d" />
<File name="Data/Uniques/bow.lua" part="program" sha1="f2bc1f2691adb84bf0359b219409e5b591d32d52" />
<File name="Data/Uniques/claw.lua" part="program" sha1="bb2ca99f686832ca6416de8afbdffcea22ad225d" />
<File name="Data/Uniques/crossbow.lua" part="program" sha1="875f29ac88fed897d417cd0bb8e6a0398ab8106f" />
<File name="Data/Uniques/dagger.lua" part="program" sha1="42c020324c762a295937551f3f1af53c9b114358" />
<File name="Data/Uniques/fishing.lua" part="program" sha1="75817432db7701b129a2399453166aa3dfbf0779" />
<File name="Data/Uniques/flail.lua" part="program" sha1="ea43920b747ee3ea3051a6d48ad7cb64f915f14e" />
<File name="Data/Uniques/flask.lua" part="program" sha1="b7b6a8db83191d2e3e89ec4ac8e52d7235b66a19" />
<File name="Data/Uniques/focus.lua" part="program" sha1="f9246b9e0fdc2553f71af7212eb38a748c04f6f5" />
<File name="Data/Uniques/gloves.lua" part="program" sha1="1ed0656f0a1c2f056e6023f33d07a70da2fe054f" />
<File name="Data/Uniques/helmet.lua" part="program" sha1="6b30d2985b25669306df526dc0eaafe163a2bd03" />
<File name="Data/Uniques/jewel.lua" part="program" sha1="a0ea15b74e2f94ba2a81f5e97c4376d062adedf9" />
<File name="Data/Uniques/mace.lua" part="program" sha1="6b6be0901a2d980cd326fcbad5c376006d24be1b" />
<File name="Data/Uniques/quiver.lua" part="program" sha1="2e823b3eaa0b31485d32ddfba9a67e6cf0bbdaa1" />
<File name="Data/Uniques/ring.lua" part="program" sha1="1216bc2e13e2d5df2418cccfa2d5eeea85fb61b4" />
<File name="Data/Uniques/sceptre.lua" part="program" sha1="6120d3e9649382378b512751fa986c4fda983798" />
<File name="Data/Uniques/shield.lua" part="program" sha1="613e2a484ea5e456327b56a23d37a48d882afcd7" />
<File name="Data/Uniques/soulcore.lua" part="program" sha1="eb6f53c18be92f26189632dc6602f25a73f85fe1" />
<File name="Data/Uniques/spear.lua" part="program" sha1="e888aaa9ee4391811ec6a6f4cf98a19328510e85" />
<File name="Data/Uniques/Special/Generated.lua" part="program" sha1="c3e7bb275c5168ab198abdc22d296210bfe79bbb" />
<File name="Data/Uniques/Special/New.lua" part="program" sha1="6f179d1e96131b07c33d46d979216fba6d3b4e6c" />
<File name="Data/Uniques/Special/race.lua" part="program" sha1="74cd16a8a7ed4464ed65c027c50f4dbafe879339" />
<File name="Data/Uniques/staff.lua" part="program" sha1="7f6bb645646996e402daeb31c3199c216f9c72d4" />
<File name="Data/Uniques/sword.lua" part="program" sha1="74a524e9989378bee3f973a0d658911bbd76f8db" />
<File name="Data/Uniques/tincture.lua" part="program" sha1="23d7934df6cfd42218d9104410e3c7aeebe24cac" />
<File name="Data/Uniques/traptool.lua" part="program" sha1="270d509148ff296706be7790d3e5f56d70202afa" />
<File name="Data/Uniques/wand.lua" part="program" sha1="76e37e9d20d1beb51f67ef6bdfc7a842769bb51d" />
<File name="Data/WorldAreas.lua" part="program" sha1="dada110456bfd76e04786e2a8816a75d5dc54e0b" />
<File name="GameVersions.lua" part="program" sha1="70ca762c6a8f026104e467b4345a9f2a5f54fb02" />
<File name="Launch.lua" part="program" sha1="5845a1b85e386108d97255f6058b9c822fcb3e16" />
<File name="LaunchServer.lua" part="program" sha1="94c6ba4bc2054e1739f77afcf0be1aece78a7347" />
<File name="Modules/Build.lua" part="program" sha1="e15cb7224582385591e8620a9c725d28b8ed807e" />
<File name="Modules/BuildDisplayStats.lua" part="program" sha1="3c33ee1bc6b7ea96eab67760c4955b2bcaf83640" />
<File name="Modules/BuildList.lua" part="program" sha1="99ac52b6fa77f0d6c9521b6b2f13621bfd7cbb07" />
<File name="Modules/BuildSiteTools.lua" part="program" sha1="c26122f97ec8b09a2af553e8dbc7b196ff46e782" />
<File name="Modules/CalcActiveSkill.lua" part="program" sha1="9f0f5c7cc4e68f0ca198f7d3810831ed5b5fd3ed" />
<File name="Modules/CalcBreakdown.lua" part="program" sha1="7a22c6d1f2ff0af8d8254a0f4895ea43d4b6b740" />
<File name="Modules/CalcDefence.lua" part="program" sha1="2c71a317d700da689f63d3efe2eaada1d01e1406" />
<File name="Modules/CalcMirages.lua" part="program" sha1="64dfcbb7530fc7a69c483348cce0833912e2416f" />
<File name="Modules/CalcOffence.lua" part="program" sha1="2c62d31cd6f73a81ba002d701d2176820732deb6" />
<File name="Modules/CalcPerform.lua" part="program" sha1="5c45b1d1321d4d2f3de44f2202ba25fe0c42d981" />
<File name="Modules/Calcs.lua" part="program" sha1="a6b10a4cd8bc6dad486ca742c4a70451f707b295" />
<File name="Modules/CalcSections.lua" part="program" sha1="b3fe48a7feae68d14f1430936aed404772ecb9d1" />
<File name="Modules/CalcSetup.lua" part="program" sha1="70c591be4db82b732225e12ce761259afd0c2f11" />
<File name="Modules/CalcTools.lua" part="program" sha1="b267879379e9ea29601e805e2d1506264591bb45" />
<File name="Modules/CalcTriggers.lua" part="program" sha1="e4f2cf926ef7f192c126da0a340215d7a572cf7d" />
<File name="Modules/Common.lua" part="program" sha1="80fdee369827474f6bd6e12d90ea8c6bab56a33e" />
<File name="Modules/ConfigOptions.lua" part="program" sha1="b82c4971342c826b8dc8ffcbfef07aa1e87c8faa" />
<File name="Modules/Data.lua" part="program" sha1="dc9a7bb393b034b99d26b49242492d713d320f77" />
<File name="Modules/DataLegionLookUpTableHelper.lua" part="program" sha1="170699925a438275137ba621206800e29f453eb3" />
<File name="Modules/ItemTools.lua" part="program" sha1="44c63fb06069b78012e9ca9be49c3b38a11694a4" />
<File name="Modules/Main.lua" part="program" sha1="c152b1c340ccb60c6fc6a2c145ae0b40b3aaa8ab" />
<File name="Modules/ModParser.lua" part="program" sha1="f002daa40c6dbcb931e6fcde6fa805702dfe9693" />
<File name="Modules/ModTools.lua" part="program" sha1="311df7cede5d9af0953476e49f9002aa1492b12b" />
<File name="Modules/StatDescriber.lua" part="program" sha1="f18538f4b8852eb0631d39ee5c856bc782528529" />
<File name="UpdateApply.lua" part="program" sha1="4dd42f413cb89a963e4ae1b40e214985b909c05b" />
<File name="UpdateCheck.lua" part="default" sha1="2ae35a08c9445d68c4fc92254fcf50c8b780bf72" />
<File name="lua/base64.lua" part="runtime" sha1="18629865eb351e483178b6524fb3935cbc9b8297" />
<File name="lua/dkjson.lua" part="runtime" sha1="d2c9e5433a24b8593886a36cfc267cb05d3bc529" />
<File name="lua/sha1/bit32_ops.lua" part="runtime" sha1="25bc8def626fd8d8bd3d37dcd96808c6b8b00087" />
<File name="lua/sha1/bit_ops.lua" part="runtime" sha1="53ce6b3174386d1e4565ced0c1a7f1b3df3bb83f" />
<File name="lua/sha1/common.lua" part="runtime" sha1="70faf0efa48e6d44c7b8a4279467f0025257b84f" />
<File name="lua/sha1/init.lua" part="runtime" sha1="e23c730650ac2ffe595b4ed2a5f3484225414ebd" />
<File name="lua/sha1/lua53_ops.lua" part="runtime" sha1="b10c732f322358c4112226df61af61f53a21b911" />
<File name="lua/sha1/pure_lua_ops.lua" part="runtime" sha1="0dff15b1cfd171a3572032346613adcf5e9962c2" />
<File name="lua/sha2.lua" part="runtime" sha1="be1204772be5b5cb29f0ba65f1323b08f561bf6b" />
<File name="lua/socket.lua" part="runtime" sha1="d05ae2b3085427cdd8f213d3d7ea4e9a1c446357" />
<File name="lua/xml.lua" part="runtime" sha1="859e09104842f91a4aaa9a4d9fadf667535877e2" />
<File name="TreeData/0_1/ascendancy-background_1500_1500_BC7.dds.zst" part="tree" sha1="fc5111b72c5da72ddfa60149e40aa24235743580" />
<File name="TreeData/0_1/ascendancy-background_4000_4000_BC7.dds.zst" part="tree" sha1="3b55cc6cc196eb4e5fc198e59b131d7f0fcb3c06" />
<File name="TreeData/0_1/background_348_348_BC7.dds.zst" part="tree" sha1="d0ca1a91ddd57a3d8f37902fdb8a93adf0766967" />
<File name="TreeData/0_1/background_1024_1024_BC7.dds.zst" part="tree" sha1="9075f0f0e4db5fedd3ac542cfab37a15de5bcafe" />
<File name="TreeData/0_1/group-background_92_92_BC7.dds.zst" part="tree" sha1="715411b1326fcd5a4bddc2e803db945f5e65a838" />
<File name="TreeData/0_1/group-background_104_104_BC7.dds.zst" part="tree" sha1="3ece257b4bca23cc2420cec7944d1b72f5b464f2" />
<File name="TreeData/0_1/group-background_124_124_BC7.dds.zst" part="tree" sha1="fc01635b062e9924d034422b5db75d666bc8b0b3" />
<File name="TreeData/0_1/group-background_140_140_BC7.dds.zst" part="tree" sha1="141f383ed3e525424e682eec677c18719aec4651" />
<File name="TreeData/0_1/group-background_152_156_BC7.dds.zst" part="tree" sha1="e5c8f23bb08f2e0fc8eef3e86279f352a85914d0" />
<File name="TreeData/0_1/group-background_160_164_BC7.dds.zst" part="tree" sha1="1d3ba32446b154f568fa0c8af1a8b698ab4d621c" />
<File name="TreeData/0_1/group-background_208_208_BC7.dds.zst" part="tree" sha1="13a94e3dff9d68d874551007ff89a3869cfbee09" />
<File name="TreeData/0_1/group-background_216_220_BC7.dds.zst" part="tree" sha1="167d0b705933be7ab096adf52fd9f3a9c7c71503" />
<File name="TreeData/0_1/group-background_220_224_BC7.dds.zst" part="tree" sha1="0f0e60382303c823b1329e854220013b896158be" />
<File name="TreeData/0_1/group-background_280_276_BC7.dds.zst" part="tree" sha1="bb9198a6cacff6bed35d9884efacc2a0e31fe09e" />
<File name="TreeData/0_1/group-background_296_300_BC7.dds.zst" part="tree" sha1="335d5382271e0d9ec09cc9188b1810f4913908d3" />
<File name="TreeData/0_1/group-background_360_360_BC7.dds.zst" part="tree" sha1="bfb8d85cba99f771cdc1b7040eb8dd2d0c73a324" />
<File name="TreeData/0_1/group-background_440_440_BC7.dds.zst" part="tree" sha1="8ff068091fab7172775b44c7a819f5ff922e251c" />
<File name="TreeData/0_1/group-background_468_468_BC7.dds.zst" part="tree" sha1="9c8073a6be6d326a172e976bf584b3d4e72b019c" />
<File name="TreeData/0_1/group-background_488_488_BC7.dds.zst" part="tree" sha1="ce40cebca2c51892c2296b04842273925d736978" />
<File name="TreeData/0_1/group-background_528_528_BC7.dds.zst" part="tree" sha1="0b80c15a639ced3e51e9609de4070d30518086a6" />
<File name="TreeData/0_1/group-background_632_632_BC7.dds.zst" part="tree" sha1="6a01f6b6a3c1fdf03c4d99685d4ef11751eed301" />
<File name="TreeData/0_1/group-background_712_712_BC7.dds.zst" part="tree" sha1="efaca12d4e040aad7d9474118bae15c730c9ce99" />
<File name="TreeData/0_1/group-background_740_376_BC7.dds.zst" part="tree" sha1="833569f99a2f4b9d7dab6165a04a2751578362a4" />
<File name="TreeData/0_1/group-background_756_756_BC7.dds.zst" part="tree" sha1="4693658151e36cdeadfefa1624ac3377a6dfaab7" />
<File name="TreeData/0_1/group-background_952_988_BC7.dds.zst" part="tree" sha1="de711bc6fbcbd383a0b7c436d22afd0caca72d6e" />
<File name="TreeData/0_1/group-background_1000_508_BC7.dds.zst" part="tree" sha1="c243630f8caae501447f772addd2e46c454fd912" />
<File name="TreeData/0_1/jewel-sockets_152_156_BC7.dds.zst" part="tree" sha1="14cbee1366257f9f29c90f439dab8b3bd9844718" />
<File name="TreeData/0_1/jewel-sockets_208_208_BC7.dds.zst" part="tree" sha1="ec025e1e282d6382637d869ea2ad61903f8a385f" />
<File name="TreeData/0_1/legion_64_64_BC1.dds.zst" part="tree" sha1="57780219eb8c0f839ff1954d511983c7c7cae656" />
<File name="TreeData/0_1/legion_128_128_BC1.dds.zst" part="tree" sha1="a8e4aa7b6fbc7e9d1666bd91c9113c804d0d6fa8" />
<File name="TreeData/0_1/legion_564_564_BC7.dds.zst" part="tree" sha1="bb68096499abd163de7727034be292ba4d5d61aa" />
<File name="TreeData/0_1/legion_756_756_BC7.dds.zst" part="tree" sha1="83533c5ac2019314b5365dfb11b97684e2aba6bb" />
<File name="TreeData/0_1/legion_1860_1864_BC7.dds.zst" part="tree" sha1="cd5745e300933fca94b174de6af243d616e22f02" />
<File name="TreeData/0_1/lines_1436_1436_BC7.dds.zst" part="tree" sha1="f39e159b40fafcc9687e37ce6efaf4c4ed4f5455" />
<File name="TreeData/0_1/lines_1940_1940_BC7.dds.zst" part="tree" sha1="8b8d6cf89ca4bda8c0b785f706962d9ab39b9e2b" />
<File name="TreeData/0_1/mastery-active-effect_776_768_BC7.dds.zst" part="tree" sha1="8b9f986fb49df4bbeec38269997e30eaaaef562d" />
<File name="TreeData/0_1/oils_108_108_RGBA.dds.zst" part="tree" sha1="abf58ace0c8b9987d7b2d9b79dc047226c970a50" />
<File name="TreeData/0_1/orbit_active0.png" part="tree" sha1="c17c7c0682240494614ccc3dd183a0ca9aca2cc4" />
<File name="TreeData/0_1/orbit_active1.png" part="tree" sha1="182cf3b511e0c3351c6893008b284fd9cd3b82f8" />
<File name="TreeData/0_1/orbit_active2.png" part="tree" sha1="5fce3cc77cfc325eb495d72529f080941cf0036c" />
<File name="TreeData/0_1/orbit_active3.png" part="tree" sha1="23fa36975a975295f699f4fe69cba286e39f7b1d" />
<File name="TreeData/0_1/orbit_active4.png" part="tree" sha1="efb316bce82e32f1bfc5962557d60a1aa51593bb" />
<File name="TreeData/0_1/orbit_active5.png" part="tree" sha1="2355ac517d5d16dc7fac4be67efc69471f06ff85" />
<File name="TreeData/0_1/orbit_active6.png" part="tree" sha1="2021dde3435b3b9187b4c5384bc6b9af45201c8d" />
<File name="TreeData/0_1/orbit_active7.png" part="tree" sha1="d3bf38c8a19ccf53eaab61201ee7f9cdfde288ed" />
<File name="TreeData/0_1/orbit_active8.png" part="tree" sha1="cf0a2d180dc561a0c514bde64f173728209ee141" />
<File name="TreeData/0_1/orbit_active9.png" part="tree" sha1="25374c4ea9ddef7af2671d85a762242d22763060" />
<File name="TreeData/0_1/orbit_intermediate0.png" part="tree" sha1="e4d2aba19e88a6a70d76248fd3a8dcc31563795d" />
<File name="TreeData/0_1/orbit_intermediate1.png" part="tree" sha1="25cc1b849c7462f346885c56c309ba8c470f5c3b" />
<File name="TreeData/0_1/orbit_intermediate2.png" part="tree" sha1="be81b097e0aac09868d67bba6101dc7a463b65f2" />
<File name="TreeData/0_1/orbit_intermediate3.png" part="tree" sha1="f4fc716133d741c6fd81fa6831a9caf37ace4f3b" />
<File name="TreeData/0_1/orbit_intermediate4.png" part="tree" sha1="b397dd785899c1f4b7083fc33a37c7071037836e" />
<File name="TreeData/0_1/orbit_intermediate5.png" part="tree" sha1="31809aafddec8ef88eaf33b48e564cc8e300ed05" />
<File name="TreeData/0_1/orbit_intermediate6.png" part="tree" sha1="0b41329c5ee3e73756a05c01be7bc6c8c21ecf02" />
<File name="TreeData/0_1/orbit_intermediate7.png" part="tree" sha1="b6d94b7824fa65cd06df24548b49cd4884ec9e51" />
<File name="TreeData/0_1/orbit_intermediate8.png" part="tree" sha1="e56ea575cbffda91aa8f1309edab0a0828a8a3ae" />
<File name="TreeData/0_1/orbit_intermediate9.png" part="tree" sha1="d1eb7291dcc5a1fd6126a19ec07451d45764c6ba" />
<File name="TreeData/0_1/orbit_normal0.png" part="tree" sha1="d4508db82db53063d50750d3ba9d97dad27bd13b" />
<File name="TreeData/0_1/orbit_normal1.png" part="tree" sha1="bca7b52d00475e9e64812caeb8066072c64dd601" />
<File name="TreeData/0_1/orbit_normal2.png" part="tree" sha1="691057a335256406ac324d836ba6a09b05ec00f2" />
<File name="TreeData/0_1/orbit_normal3.png" part="tree" sha1="c45792c111142135c18dcc9d58d3654c88c70687" />
<File name="TreeData/0_1/orbit_normal4.png" part="tree" sha1="64bff9325467cf8266af8112758c64ec4f4ed0fb" />
<File name="TreeData/0_1/orbit_normal5.png" part="tree" sha1="44bd2eafbbeea02171e5e6888aa12cdb34522b53" />
<File name="TreeData/0_1/orbit_normal6.png" part="tree" sha1="e4f3c73cfe00f1c61d7e321c9f1ccb03149bf3d5" />
<File name="TreeData/0_1/orbit_normal7.png" part="tree" sha1="8f9bdd89396d66eb098ac6fa5554d051674dbd41" />
<File name="TreeData/0_1/orbit_normal8.png" part="tree" sha1="88611a0daf1fb9618f022ab651bb44a82232aab6" />
<File name="TreeData/0_1/orbit_normal9.png" part="tree" sha1="a689c028ab279085c65a6d291a124442492dab92" />
<File name="TreeData/0_1/skills-disabled_64_64_BC1.dds.zst" part="tree" sha1="18c50003a0625b57ca29176d618b064784761154" />
<File name="TreeData/0_1/skills-disabled_88_88_BC1.dds.zst" part="tree" sha1="0947e7e4e7c0bd2269e0ba2f2636b6a4fa2ba554" />
<File name="TreeData/0_1/skills-disabled_128_128_BC1.dds.zst" part="tree" sha1="ac5657395821d0d8c412ee3035095bd07f447942" />
<File name="TreeData/0_1/skills-disabled_172_172_BC1.dds.zst" part="tree" sha1="5251feaaaae895998f21b69e16c4772037485763" />
<File name="TreeData/0_1/skills-disabled_176_176_BC1.dds.zst" part="tree" sha1="e95984aec764b7c4b1e35b78e92da9d195be6dc0" />
<File name="TreeData/0_1/skills-disabled_232_232_BC1.dds.zst" part="tree" sha1="145b1c78f762a0006b932495eb76124c806d177e" />
<File name="TreeData/0_1/skills_64_64_BC1.dds.zst" part="tree" sha1="ac76db101a5065d160edae968c91b0e254004dfc" />
<File name="TreeData/0_1/skills_88_88_BC1.dds.zst" part="tree" sha1="ce5e6dd789894de188b8caf49b764e83db536ef2" />
<File name="TreeData/0_1/skills_128_128_BC1.dds.zst" part="tree" sha1="eab301f7a00239d798bc4fac706da2294bcf6780" />
<File name="TreeData/0_1/skills_172_172_BC1.dds.zst" part="tree" sha1="5251feaaaae895998f21b69e16c4772037485763" />
<File name="TreeData/0_1/skills_176_176_BC1.dds.zst" part="tree" sha1="e95984aec764b7c4b1e35b78e92da9d195be6dc0" />
<File name="TreeData/0_1/skills_232_232_BC1.dds.zst" part="tree" sha1="145b1c78f762a0006b932495eb76124c806d177e" />
<File name="TreeData/0_1/tree.json" part="tree" sha1="d76844f6cb1e2a2ad22928b001d30e5d09770754" />
<File name="TreeData/0_1/tree.lua" part="tree" sha1="45872f4911f48b483b161648fbc380c18f693e64" />
<File name="TreeData/0_2/ascendancy-background_1500_1500_BC7.dds.zst" part="tree" sha1="fbcc756df4f15d209201ed56c01bb31a661433be" />
<File name="TreeData/0_2/ascendancy-background_4000_4000_BC7.dds.zst" part="tree" sha1="b8915444bd4f812207cbbc52d9ab75336da9c9a1" />
<File name="TreeData/0_2/background_1024_1024_BC7.dds.zst" part="tree" sha1="9075f0f0e4db5fedd3ac542cfab37a15de5bcafe" />
<File name="TreeData/0_2/group-background_64_64_BC7.dds.zst" part="tree" sha1="9bcb96b1469b9591efe09053a509d6f51668f2bd" />
<File name="TreeData/0_2/group-background_92_92_BC7.dds.zst" part="tree" sha1="715411b1326fcd5a4bddc2e803db945f5e65a838" />
<File name="TreeData/0_2/group-background_104_104_BC7.dds.zst" part="tree" sha1="3ece257b4bca23cc2420cec7944d1b72f5b464f2" />
<File name="TreeData/0_2/group-background_152_156_BC7.dds.zst" part="tree" sha1="c65f3beeedaed132e8f17477443b23c91553e5a1" />
<File name="TreeData/0_2/group-background_160_164_BC7.dds.zst" part="tree" sha1="1d3ba32446b154f568fa0c8af1a8b698ab4d621c" />
<File name="TreeData/0_2/group-background_208_208_BC7.dds.zst" part="tree" sha1="13a94e3dff9d68d874551007ff89a3869cfbee09" />
<File name="TreeData/0_2/group-background_220_224_BC7.dds.zst" part="tree" sha1="0f0e60382303c823b1329e854220013b896158be" />
<File name="TreeData/0_2/group-background_360_360_BC7.dds.zst" part="tree" sha1="bfb8d85cba99f771cdc1b7040eb8dd2d0c73a324" />
<File name="TreeData/0_2/group-background_440_440_BC7.dds.zst" part="tree" sha1="8ff068091fab7172775b44c7a819f5ff922e251c" />
<File name="TreeData/0_2/group-background_468_468_BC7.dds.zst" part="tree" sha1="9c8073a6be6d326a172e976bf584b3d4e72b019c" />
<File name="TreeData/0_2/group-background_528_528_BC7.dds.zst" part="tree" sha1="0b80c15a639ced3e51e9609de4070d30518086a6" />
<File name="TreeData/0_2/group-background_740_376_BC7.dds.zst" part="tree" sha1="833569f99a2f4b9d7dab6165a04a2751578362a4" />
<File name="TreeData/0_2/group-background_756_756_BC7.dds.zst" part="tree" sha1="4693658151e36cdeadfefa1624ac3377a6dfaab7" />
<File name="TreeData/0_2/group-background_952_988_BC7.dds.zst" part="tree" sha1="de711bc6fbcbd383a0b7c436d22afd0caca72d6e" />
<File name="TreeData/0_2/jewel-sockets_152_156_BC7.dds.zst" part="tree" sha1="14cbee1366257f9f29c90f439dab8b3bd9844718" />
<File name="TreeData/0_2/legion_64_64_BC1.dds.zst" part="tree" sha1="57780219eb8c0f839ff1954d511983c7c7cae656" />
<File name="TreeData/0_2/legion_128_128_BC1.dds.zst" part="tree" sha1="a8e4aa7b6fbc7e9d1666bd91c9113c804d0d6fa8" />
<File name="TreeData/0_2/legion_564_564_BC7.dds.zst" part="tree" sha1="bb68096499abd163de7727034be292ba4d5d61aa" />
<File name="TreeData/0_2/lines_1436_1436_BC7.dds.zst" part="tree" sha1="f39e159b40fafcc9687e37ce6efaf4c4ed4f5455" />
<File name="TreeData/0_2/mastery-active-effect_776_768_BC7.dds.zst" part="tree" sha1="46b7fdc57b6ba33b907292deae40f552d68cee6f" />
<File name="TreeData/0_2/monster-categories_36_36_BC7.dds.zst" part="tree" sha1="9fe139d351cdd3c6022a50fea28641b3e56cca90" />
<File name="TreeData/0_2/oils_108_108_RGBA.dds.zst" part="tree" sha1="abf58ace0c8b9987d7b2d9b79dc047226c970a50" />
<File name="TreeData/0_2/orbit_active0.png" part="tree" sha1="e00ae894f159daaf37b3f1e7e95750e9000ec1a7" />
<File name="TreeData/0_2/orbit_active1.png" part="tree" sha1="06393366d99404c344ba9059a80b60947868d480" />
<File name="TreeData/0_2/orbit_active2.png" part="tree" sha1="34a67550db3f00e7bc8b20eface3818f32086578" />
<File name="TreeData/0_2/orbit_active3.png" part="tree" sha1="62242c60271453033098ee2cf7c3701a133a27bc" />
<File name="TreeData/0_2/orbit_active4.png" part="tree" sha1="754d425ee4cc75813232e93b08a52a9d6f25695b" />
<File name="TreeData/0_2/orbit_active5.png" part="tree" sha1="1caf6508def0cce588b5e9a7ec0c878e98264007" />
<File name="TreeData/0_2/orbit_active6.png" part="tree" sha1="d00d01c0d598370aec7df7b31f5c2f18b3540dd4" />
<File name="TreeData/0_2/orbit_active7.png" part="tree" sha1="868893007ca8f84b84cb160e3402d352baaa7206" />
<File name="TreeData/0_2/orbit_active8.png" part="tree" sha1="6fc4ede4eb379df3ef8dbe7b1e18aa28b5d8dd91" />
<File name="TreeData/0_2/orbit_active9.png" part="tree" sha1="23679dd6d1dd0c39ef30e7be343932226386aeac" />
<File name="TreeData/0_2/orbit_intermediate0.png" part="tree" sha1="685791f48639916879532e23cec393852bc147df" />
<File name="TreeData/0_2/orbit_intermediate1.png" part="tree" sha1="a811fb774d1fa3ead89112dad835f552b4ddc913" />
<File name="TreeData/0_2/orbit_intermediate2.png" part="tree" sha1="ee38ef27cbfc525022a3c3f60dbcbb8dc0beb48c" />
<File name="TreeData/0_2/orbit_intermediate3.png" part="tree" sha1="cf3785f85bccbd3a5afdf77059f9e7ca43dfc313" />
<File name="TreeData/0_2/orbit_intermediate4.png" part="tree" sha1="3af7f8390606e8dc3e56715d3b79a8192b35a131" />
<File name="TreeData/0_2/orbit_intermediate5.png" part="tree" sha1="78385c1958353ca7eb5d90dbf69119cb779d69ec" />
<File name="TreeData/0_2/orbit_intermediate6.png" part="tree" sha1="20bc80d9fce771beb074c533768799b46ce691e8" />
<File name="TreeData/0_2/orbit_intermediate7.png" part="tree" sha1="402689ac9b70b90c1d386f6493e64e28846a91fb" />
<File name="TreeData/0_2/orbit_intermediate8.png" part="tree" sha1="ce86156b98d526e061aff68ca7b220ae65c15f3e" />
<File name="TreeData/0_2/orbit_intermediate9.png" part="tree" sha1="72bce84f422f4f2512cff06f6bc59cced9ca366d" />
<File name="TreeData/0_2/orbit_normal0.png" part="tree" sha1="ec07540c2f3f4884f3ac7c21586603d6718c27fc" />
<File name="TreeData/0_2/orbit_normal1.png" part="tree" sha1="a130efd15258a5c88b45551c69067b614f1f9b8a" />
<File name="TreeData/0_2/orbit_normal2.png" part="tree" sha1="c25d4c2174ccdd69bdf95b2e4030da2f95ea4bde" />
<File name="TreeData/0_2/orbit_normal3.png" part="tree" sha1="69841d23264a9466a80938bc35410a2cb5d4eaba" />
<File name="TreeData/0_2/orbit_normal4.png" part="tree" sha1="1f9b964426a27a587b4ada63a7fa2e1a51cf1c5b" />
<File name="TreeData/0_2/orbit_normal5.png" part="tree" sha1="578391a285727ea688a06f9b765a94c7499f97ac" />
<File name="TreeData/0_2/orbit_normal6.png" part="tree" sha1="2ad8e68f8f73a3b3fc0805ed2a5625d97641ce60" />
<File name="TreeData/0_2/orbit_normal7.png" part="tree" sha1="0ee11795f938aec37d21e177639a4b981bc5985c" />
<File name="TreeData/0_2/orbit_normal8.png" part="tree" sha1="f1f25fc965ad71a21df580fed1af924d42cd5d70" />
<File name="TreeData/0_2/orbit_normal9.png" part="tree" sha1="35b17068d109657d8f55c5ba89d13e461b48c64b" />
<File name="TreeData/0_2/skills-disabled_64_64_BC1.dds.zst" part="tree" sha1="7a7f1f12d3e2f2967071a09eebfbc0327b6e2ae3" />
<File name="TreeData/0_2/skills-disabled_128_128_BC1.dds.zst" part="tree" sha1="c9f6e7c5f904de970eed5c2826631dfffd45d8ba" />
<File name="TreeData/0_2/skills-disabled_172_172_BC1.dds.zst" part="tree" sha1="5251feaaaae895998f21b69e16c4772037485763" />
<File name="TreeData/0_2/skills-disabled_176_176_BC1.dds.zst" part="tree" sha1="e95984aec764b7c4b1e35b78e92da9d195be6dc0" />
<File name="TreeData/0_2/skills_64_64_BC1.dds.zst" part="tree" sha1="9f63d697329488e5bd6161f31a7ac3cb204589ca" />
<File name="TreeData/0_2/skills_128_128_BC1.dds.zst" part="tree" sha1="d147c838f7e6efffcaff56b231b844ec71856bc2" />
<File name="TreeData/0_2/skills_172_172_BC1.dds.zst" part="tree" sha1="5251feaaaae895998f21b69e16c4772037485763" />
<File name="TreeData/0_2/skills_176_176_BC1.dds.zst" part="tree" sha1="e95984aec764b7c4b1e35b78e92da9d195be6dc0" />
<File name="TreeData/0_2/tree.json" part="tree" sha1="356f7d66cda5151c6652f68b4548d9e93dbb2c78" />
<File name="TreeData/0_2/tree.lua" part="tree" sha1="ade2329a90715e7c11c96319ab6ef7caea72da61" />
<File name="TreeData/0_3/ascendancy-background_1500_1500_BC7.dds.zst" part="tree" sha1="942356d3b86733a3ed51021965654c6897e43ba7" />
<File name="TreeData/0_3/ascendancy-background_4000_4000_BC7.dds.zst" part="tree" sha1="b8915444bd4f812207cbbc52d9ab75336da9c9a1" />
<File name="TreeData/0_3/background_1024_1024_BC7.dds.zst" part="tree" sha1="9075f0f0e4db5fedd3ac542cfab37a15de5bcafe" />
<File name="TreeData/0_3/group-background_92_92_BC7.dds.zst" part="tree" sha1="715411b1326fcd5a4bddc2e803db945f5e65a838" />
<File name="TreeData/0_3/group-background_104_104_BC7.dds.zst" part="tree" sha1="4ae4be6fde8a0e640f6c52442d9f09270068fb4f" />
<File name="TreeData/0_3/group-background_152_156_BC7.dds.zst" part="tree" sha1="89273cc656bca8ede4f9233a24d96cfaf808bcbc" />
<File name="TreeData/0_3/group-background_160_164_BC7.dds.zst" part="tree" sha1="1d3ba32446b154f568fa0c8af1a8b698ab4d621c" />
<File name="TreeData/0_3/group-background_208_208_BC7.dds.zst" part="tree" sha1="3ba15a835072e2ee56099593c5aa1b6f3f6a6561" />
<File name="TreeData/0_3/group-background_220_224_BC7.dds.zst" part="tree" sha1="0f0e60382303c823b1329e854220013b896158be" />
<File name="TreeData/0_3/group-background_360_360_BC7.dds.zst" part="tree" sha1="bfb8d85cba99f771cdc1b7040eb8dd2d0c73a324" />
<File name="TreeData/0_3/group-background_468_468_BC7.dds.zst" part="tree" sha1="9c8073a6be6d326a172e976bf584b3d4e72b019c" />
<File name="TreeData/0_3/group-background_528_528_BC7.dds.zst" part="tree" sha1="0b80c15a639ced3e51e9609de4070d30518086a6" />
<File name="TreeData/0_3/group-background_740_376_BC7.dds.zst" part="tree" sha1="833569f99a2f4b9d7dab6165a04a2751578362a4" />
<File name="TreeData/0_3/jewel-sockets_152_156_BC7.dds.zst" part="tree" sha1="94134ad9b5c6031c789b5dff4bfc6287f87127b6" />
<File name="TreeData/0_3/legion_64_64_BC1.dds.zst" part="tree" sha1="f829d5ae460b3f6130e06524c99cb94ffcc7311e" />
<File name="TreeData/0_3/legion_128_128_BC1.dds.zst" part="tree" sha1="45072083b538e31e25599a605795ad5e16f7c8ec" />
<File name="TreeData/0_3/legion_564_564_BC7.dds.zst" part="tree" sha1="51eb2e9cdae5cdc72749760b5614a1aed91c3d75" />
<File name="TreeData/0_3/legion_1024_1024_BC7.dds.zst" part="tree" sha1="8f7383ff8ec4611a2091372936bb324557b899fa" />
<File name="TreeData/0_3/lines_1436_1436_BC7.dds.zst" part="tree" sha1="f39e159b40fafcc9687e37ce6efaf4c4ed4f5455" />
<File name="TreeData/0_3/mastery-active-effect_776_768_BC7.dds.zst" part="tree" sha1="554e54cc675071896e31c3129a2c151ab1b74493" />
<File name="TreeData/0_3/monster-categories_36_36_BC7.dds.zst" part="tree" sha1="9fe139d351cdd3c6022a50fea28641b3e56cca90" />
<File name="TreeData/0_3/oils_108_108_RGBA.dds.zst" part="tree" sha1="165072670df794c47d1bea366b8ca2787214e4c5" />
<File name="TreeData/0_3/orbit_active0.png" part="tree" sha1="845dc1e9939f56f3c4095832e914a766d37a5bf5" />
<File name="TreeData/0_3/orbit_active1.png" part="tree" sha1="8a52e1df34828dce5780f852ff3a072d20edac89" />
<File name="TreeData/0_3/orbit_active2.png" part="tree" sha1="3ae30986c4e8bc20d557c4b7f12f6548e9d5deeb" />
<File name="TreeData/0_3/orbit_active3.png" part="tree" sha1="5196dd17d9f0f8264f5389bd489a4b496bd86eda" />
<File name="TreeData/0_3/orbit_active4.png" part="tree" sha1="6f1cf66649aeeb1feff20a55cbdf3385327ce2f9" />
<File name="TreeData/0_3/orbit_active5.png" part="tree" sha1="e2bca5da9960c3eb0cc2b7cb0282d213e337ef9d" />
<File name="TreeData/0_3/orbit_active6.png" part="tree" sha1="26a1eb1c4518236975e208d61d9ac611eb769e78" />
<File name="TreeData/0_3/orbit_active7.png" part="tree" sha1="ca013eb3f8acab123864ea7feb35c190c45f730f" />
<File name="TreeData/0_3/orbit_active8.png" part="tree" sha1="dd9883e266ce76b1dc84372cef991375b69702e8" />
<File name="TreeData/0_3/orbit_active9.png" part="tree" sha1="9b269636c0fb00f053a223c6ef70db326d53f583" />
<File name="TreeData/0_3/orbit_intermediate0.png" part="tree" sha1="7078a5a9568569cee03c852f39a030490e5b209d" />
<File name="TreeData/0_3/orbit_intermediate1.png" part="tree" sha1="7263b973f4fc5af686578f7b0bec5ff733b59d61" />
<File name="TreeData/0_3/orbit_intermediate2.png" part="tree" sha1="c46c57faab3fc22fff49bfbabf41237f92822bff" />
<File name="TreeData/0_3/orbit_intermediate3.png" part="tree" sha1="b98e724732710b668429adf94de71b608e6b98b8" />
<File name="TreeData/0_3/orbit_intermediate4.png" part="tree" sha1="65a3ab4d5666df4e451758b3e2bf0293e0ac3298" />
<File name="TreeData/0_3/orbit_intermediate5.png" part="tree" sha1="e54387447ff47c68e9b25d74394ea1c592b6a27c" />
<File name="TreeData/0_3/orbit_intermediate6.png" part="tree" sha1="7d4705c005f26bce62ea62b7bd115be1c00a8c0b" />
<File name="TreeData/0_3/orbit_intermediate7.png" part="tree" sha1="dfa2d4496fba4cfdb9126638b4cfea7a07474bf6" />
<File name="TreeData/0_3/orbit_intermediate8.png" part="tree" sha1="d2cdcbfb4b9c532c3555aa1710a4c91dec55485f" />
<File name="TreeData/0_3/orbit_intermediate9.png" part="tree" sha1="611aa0c7a6a57f01f21fcd31017749d6daf76150" />
<File name="TreeData/0_3/orbit_normal0.png" part="tree" sha1="be3e1f9c7daa279094f0c9dd8a33bc0710fcab35" />
<File name="TreeData/0_3/orbit_normal1.png" part="tree" sha1="aa3698932941201cf1b91000ab4e09ad819cf498" />
<File name="TreeData/0_3/orbit_normal2.png" part="tree" sha1="fee0af1c53cd94860eec7ab1cb137683fe23cfd6" />
<File name="TreeData/0_3/orbit_normal3.png" part="tree" sha1="e5cd7cb23f09125a3c54872d20284fa451e66f5d" />
<File name="TreeData/0_3/orbit_normal4.png" part="tree" sha1="91a1b253a1f53d87e5fdd5455645870fbfc4582d" />
<File name="TreeData/0_3/orbit_normal5.png" part="tree" sha1="7bbcadf5a2b93dd2830e09e9ae194049eb486c83" />
<File name="TreeData/0_3/orbit_normal6.png" part="tree" sha1="1c583126b84b6755e08697b2f9aa4b13babe0617" />
<File name="TreeData/0_3/orbit_normal7.png" part="tree" sha1="c29a33a369e15c7f0efa1be201435fe63b7e4a49" />
<File name="TreeData/0_3/orbit_normal8.png" part="tree" sha1="e5d445c196e8e16692582be1848dc48ea3e9cda8" />
<File name="TreeData/0_3/orbit_normal9.png" part="tree" sha1="33c1aef26bdda33e17bfb4bd1f426c63ef267763" />
<File name="TreeData/0_3/skills-disabled_64_64_BC1.dds.zst" part="tree" sha1="bf590783fec6af27ba2ce34f15c297ac47626e37" />
<File name="TreeData/0_3/skills-disabled_128_128_BC1.dds.zst" part="tree" sha1="c9c00e5b82a8df3094515e6bde1fe0bdf595851f" />
<File name="TreeData/0_3/skills-disabled_172_172_BC1.dds.zst" part="tree" sha1="5251feaaaae895998f21b69e16c4772037485763" />
<File name="TreeData/0_3/skills-disabled_176_176_BC1.dds.zst" part="tree" sha1="e95984aec764b7c4b1e35b78e92da9d195be6dc0" />
<File name="TreeData/0_3/skills_64_64_BC1.dds.zst" part="tree" sha1="881df35c9b06c6c13f36963b57e47b033a59df42" />
<File name="TreeData/0_3/skills_128_128_BC1.dds.zst" part="tree" sha1="bdc99642dea06c3f01710aefa67003f4ddcc010c" />
<File name="TreeData/0_3/skills_172_172_BC1.dds.zst" part="tree" sha1="5251feaaaae895998f21b69e16c4772037485763" />
<File name="TreeData/0_3/skills_176_176_BC1.dds.zst" part="tree" sha1="e95984aec764b7c4b1e35b78e92da9d195be6dc0" />
<File name="TreeData/0_3/tree.json" part="tree" sha1="16a40f693a67cc6e34ba8e9098f04652c9607ac5" />
<File name="TreeData/0_3/tree.lua" part="tree" sha1="f28785d218631fdd034576ca6fd88173b1c3562b" />
<File name="TreeData/legion/skills-additional-3.jpg" part="tree" sha1="b98c0a2b9ac6dd585450789e2b53437e246592bf" />
<File name="TreeData/legion/skills-additional-disabled-3.jpg" part="tree" sha1="988e3d5a1b489fb8ae4eb3647f32fec689c6eddb" />
<File name="TreeData/legion/tree-legion.lua" part="tree" sha1="3b57c9eae4553c66407b8ce4981aca5c06c7ad92" />
</PoBVersion>
-83
View File
@@ -1,83 +0,0 @@
import argparse
import hashlib
import urllib.request
import xml.etree.ElementTree as Et
from pathlib import Path
# Downloads the official PoB manifest file and performs the following modifications:
# - set platform and branch
# - add a new 'default' source that points to this repo
# - rename old 'default' source to 'origin'
# - remove win32 libraries and executables
# - remove font files
# - use modified UpdateCheck.lua from this repo, which is compatible with unix paths and disables the 'basic' update mode
repo = "meehl/RustyPathOfBuilding"
def is_font_file(name: str) -> bool:
return name.endswith(".tga") or name.endswith(".tgf")
def is_tar_file(name: str) -> bool:
return name.endswith(".tar") or name.endswith(".tgf")
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--game", choices=["poe1", "poe2"], required=True)
args = parser.parse_args()
if args.game == "poe1":
origin_url = "https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding/master/manifest.xml"
else:
origin_url = "https://raw.githubusercontent.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/master/manifest.xml"
with urllib.request.urlopen(origin_url) as f:
manifest_root = Et.fromstring(f.read().decode("utf-8"))
for child in list(manifest_root):
if child.tag == "Version":
child.set("branch", "master")
child.set("platform", "any")
elif child.tag == "Source":
if child.get("part") == "default":
child.set("part", "origin")
if child.get("platform") is not None:
child.attrib.pop("platform")
elif child.tag == "File":
if child.get("part") == "default":
child.set("part", "origin")
if (
child.get("runtime") is not None
or is_font_file(child.get("name"))
or is_tar_file(child.get("name"))
):
manifest_root.remove(child)
if child.get("name") == "UpdateCheck.lua":
child.set("part", "default")
path = Path(f"./{args.game}/UpdateCheck.lua")
data = path.read_bytes()
sha1 = hashlib.sha1(data).hexdigest()
child.set("sha1", sha1)
default_source = Et.Element(
"Source",
{
"part": "default",
"url": f"https://raw.githubusercontent.com/{repo}/main/lua/{args.game}/",
},
)
manifest_root.insert(1, default_source)
tree = Et.ElementTree(manifest_root)
Et.indent(tree, "\t")
tree.write(f"./{args.game}/manifest.xml")
if __name__ == "__main__":
main()
+7
View File
@@ -0,0 +1,7 @@
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}"},
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}"},
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n\n## [Unreleased] - ReleaseDate", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/{{tag_name}}...HEAD", exactly=1},
]
-396
View File
@@ -1,396 +0,0 @@
use std::{
fs,
io::{Read, Write, stdout},
path::PathBuf,
time::{SystemTime, UNIX_EPOCH},
};
use anyhow::anyhow;
use directories::UserDirs;
use flate2::{
Compression,
read::{ZlibDecoder, ZlibEncoder},
};
use glob::glob;
use mlua::{
Function, IntoLua, IntoLuaMulti, Lua, MultiValue, Result as LuaResult, String as LuaString,
Table, Value, Variadic,
};
use crate::{
Game,
api::{image_handle::ImageHandle, rendering::PoBString, search_handle::SearchHandle},
context::CONTEXT,
input::{str_as_keycode, str_as_mousebutton},
util::{change_working_directory, get_executable_dir},
};
mod image_handle;
mod rendering;
mod search_handle;
/// Register functions that can be called from lua
pub fn register_globals(lua: &Lua) -> LuaResult<()> {
let globals = lua.globals();
globals.set("SetMainObject", lua.create_function(set_main_object)?)?;
globals.set("SetCallback", lua.create_function(set_custom_callback)?)?;
globals.set("GetCallback", lua.create_function(get_custom_callback)?)?;
globals.set("GetUserPath", lua.create_function(get_user_path)?)?;
globals.set("GetScriptPath", lua.create_function(get_script_path)?)?;
globals.set("GetRuntimePath", lua.create_function(get_runtime_path)?)?;
globals.set("ConPrintf", lua.create_function(console_printf)?)?;
globals.set("ConExecute", lua.create_function(console_execute)?)?;
globals.set("ConClear", lua.create_function(console_clear)?)?;
globals.set("ConPrintTable", lua.create_function(console_print_table)?)?;
globals.set("PCall", lua.create_function(protected_call)?)?;
globals.set("GetTime", lua.create_function(get_time)?)?;
globals.set("MakeDir", lua.create_function(make_dir)?)?;
globals.set("StripEscapes", lua.create_function(strip_escapes)?)?;
globals.set("Inflate", lua.create_function(inflate)?)?;
globals.set("Deflate", lua.create_function(deflate)?)?;
globals.set("NewFileSearch", lua.create_function(new_search_handle)?)?;
globals.set("GetWorkDir", lua.create_function(get_work_dir)?)?;
globals.set("SetWorkDir", lua.create_function(set_work_dir)?)?;
globals.set("Copy", lua.create_function(copy)?)?;
globals.set("Paste", lua.create_function(paste)?)?;
globals.set("GetScreenSize", lua.create_function(get_screen_size)?)?;
globals.set("GetScreenScale", lua.create_function(get_screen_scale)?)?;
globals.set("GetCursorPos", lua.create_function(get_cursor_pos)?)?;
globals.set("IsKeyDown", lua.create_function(is_key_down)?)?;
globals.set("LoadModule", lua.create_function(load_module)?)?;
globals.set("PLoadModule", lua.create_function(protected_load_module)?)?;
globals.set("NewImageHandle", lua.create_function(new_image_handle)?)?;
globals.set("SetWindowTitle", lua.create_function(set_window_title)?)?;
globals.set("Restart", lua.create_function(restart)?)?;
globals.set("OpenURL", lua.create_function(open_url)?)?;
globals.set("RenderInit", lua.create_function(render_init)?)?;
// NOTE: not used by PoB
let get_draw_layer = |_: &Lua, ()| -> LuaResult<()> { unimplemented!() };
let set_blend_mode = |_: &Lua, ()| -> LuaResult<()> { unimplemented!() };
let get_async_count = |_: &Lua, ()| -> LuaResult<()> { unimplemented!() };
let set_cursor_pos = |_: &Lua, ()| -> LuaResult<()> { unimplemented!() };
let show_cursor = |_: &Lua, ()| -> LuaResult<()> { unimplemented!() };
let set_clear_color = |_: &Lua, ()| -> LuaResult<()> { unimplemented!() };
globals.set("GetDrawLayer", lua.create_function(get_draw_layer)?)?;
globals.set("SetBlendMode", lua.create_function(set_blend_mode)?)?;
globals.set("GetAsyncCount", lua.create_function(get_async_count)?)?;
globals.set("SetCursorPos", lua.create_function(set_cursor_pos)?)?;
globals.set("ShowCursor", lua.create_function(show_cursor)?)?;
globals.set("SetClearColor", lua.create_function(set_clear_color)?)?;
rendering::register_globals(lua)?;
Ok(())
}
// During initialization, PoB calls `SetMainObject` with a callback table.
// Functions defined in this table are used to call back into Lua from Rust.
// Custom callback functions can be added with `SetCallback` and retrieved
// with `GetCallback`.
const CALLBACK_REGISTRY_NAME: &str = "uicallbacks";
pub fn get_callback(lua: &Lua, name: &str) -> LuaResult<Function> {
let callback_table: Table = lua.named_registry_value(CALLBACK_REGISTRY_NAME)?;
let callback_function: Value = callback_table.get(name)?;
if callback_function.is_function() {
// function defined through `SetCallback`
return Ok(callback_function.as_function().unwrap().clone());
} else {
// look for function in `MainObject`
let main_object: Table = callback_table.get("MainObject")?;
let callback_function: Value = main_object.get(name)?;
if callback_function.is_function() {
// these functions expect `MainObject` as first argument so we bind it here
return callback_function.as_function().unwrap().bind(main_object);
}
}
Err(anyhow::anyhow!("Function '{}' not found", name).into())
}
fn set_main_object(l: &Lua, main_object: Table) -> LuaResult<()> {
let callback_table = l.create_table()?;
callback_table.set("MainObject", main_object)?;
l.set_named_registry_value(CALLBACK_REGISTRY_NAME, callback_table)?;
Ok(())
}
fn set_custom_callback(l: &Lua, (name, func): (String, Function)) -> LuaResult<()> {
let callback_table: Table = l.named_registry_value(CALLBACK_REGISTRY_NAME)?;
callback_table.set(name, func)?;
Ok(())
}
fn get_custom_callback(l: &Lua, name: String) -> LuaResult<Function> {
let callback_table: Table = l.named_registry_value(CALLBACK_REGISTRY_NAME)?;
let callback_function: Function = callback_table.get(name)?;
Ok(callback_function)
}
fn get_user_path(_: &Lua, _: ()) -> LuaResult<anyhow::Result<PathBuf>> {
let user_dirs = match UserDirs::new() {
Some(user_dirs) => user_dirs,
None => return Ok(Err(anyhow!("Failed to retrieve user's home directory"))),
};
match user_dirs.document_dir() {
Some(docs_dir) => Ok(Ok(docs_dir.canonicalize().unwrap())),
None => Ok(Err(anyhow!(
"Failed to retrieve user's documents directory"
))),
}
}
// parent directory of Launch.lua script
fn get_script_path(_: &Lua, _: ()) -> LuaResult<PathBuf> {
Ok(Game::script_dir())
}
// parent directory of executable
fn get_runtime_path(_: &Lua, _: ()) -> LuaResult<PathBuf> {
match get_executable_dir() {
Ok(exe_path) => Ok(exe_path),
Err(_) => Ok(PathBuf::new()),
}
}
fn console_printf(l: &Lua, (fmt, args): (String, MultiValue)) -> LuaResult<()> {
// uses lua's builtin string.format function
let string_module: Table = l.globals().get("string")?;
let format_func: Function = string_module.get("format")?;
let formatted_string = format_func.call::<String>((fmt, args))?;
println!("{formatted_string}");
Ok(())
}
fn console_execute(_l: &Lua, _cmd: String) -> LuaResult<()> {
Ok(())
}
fn console_clear(_l: &Lua, _: ()) -> LuaResult<()> {
Ok(())
}
fn print_table(table: &Table, indent: usize, recursive: bool) -> LuaResult<()> {
let mut lock = stdout().lock();
writeln!(lock, "{{")?;
for pair in table.pairs::<Value, Value>() {
let inner_ind = indent + 2;
let (key, value) = pair?;
if key.is_string() {
write!(lock, "{0:>1$}\"{2}\" = ", "", inner_ind, key.to_string()?,)?;
} else {
write!(lock, "{0:>1$}{2} = ", "", inner_ind, key.to_string()?,)?;
}
if value.is_table() {
if recursive {
print_table(value.as_table().unwrap(), indent + 2, recursive)?;
} else {
writeln!(lock, "{}", value.to_string()?)?;
}
} else if value.is_string() {
writeln!(lock, "\"{}\"", value.to_string()?)?;
} else {
writeln!(lock, "{}", value.to_string()?)?;
}
}
writeln!(lock, "{0:>1$}}}", "", indent)?;
Ok(())
}
fn console_print_table(_l: &Lua, (table, no_recursive): (Table, Option<bool>)) -> LuaResult<()> {
print_table(&table, 0, !no_recursive.unwrap_or(true))?;
Ok(())
}
fn protected_call(l: &Lua, (func, args): (Function, MultiValue)) -> LuaResult<MultiValue> {
match func.call::<MultiValue>(args) {
// callers expect first return value to be Nil on success
Ok(return_values) => Ok(std::iter::once(Value::Nil).chain(return_values).collect()),
// otherwise it is set to error message.
Err(err) => Ok(err.to_string().into_lua_multi(l)?),
}
}
fn get_time(_l: &Lua, _: ()) -> LuaResult<u128> {
Ok(SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis())
}
fn make_dir(l: &Lua, path: String) -> LuaResult<MultiValue> {
match fs::create_dir_all(path) {
// callers expect first return value to be true on success
Ok(_) => Ok(Value::Boolean(true).into_lua_multi(l)?),
// otherwise it is set to Nil and second return value is set to error msg
Err(err) => Ok((Value::Nil, err.to_string()).into_lua_multi(l)?),
}
}
fn strip_escapes(_: &Lua, text: String) -> LuaResult<String> {
Ok(PoBString(&text).strip_escapes())
}
fn inflate(l: &Lua, compressed: LuaString) -> LuaResult<MultiValue> {
let compressed_bytes = &compressed.as_bytes()[..];
// prevent decompression of input larger than 128MiB
if compressed_bytes.len() > (128 << 20) {
return Ok((Value::Nil, "Input larger than 128 MiB")
.into_lua_multi(l)
.unwrap());
}
let mut decoder = ZlibDecoder::new(compressed_bytes);
let mut decompressed = String::new();
match decoder.read_to_string(&mut decompressed) {
Ok(_) => Ok(decompressed.into_lua_multi(l).unwrap()),
Err(e) => Ok((Value::Nil, e.to_string()).into_lua_multi(l).unwrap()),
}
}
fn deflate(l: &Lua, uncompressed: LuaString) -> LuaResult<MultiValue> {
let uncompressed_bytes = &uncompressed.as_bytes()[..];
// prevent compression of input larger than 128MiB
if uncompressed_bytes.len() > (128 << 20) {
return Ok((Value::Nil, "Input larger than 128 MiB")
.into_lua_multi(l)
.unwrap());
}
let mut encoder = ZlibEncoder::new(uncompressed_bytes, Compression::fast());
let mut compressed = String::new();
match encoder.read_to_string(&mut compressed) {
Ok(_) => Ok(compressed.into_lua_multi(l).unwrap()),
Err(e) => Ok((Value::Nil, e.to_string()).into_lua_multi(l).unwrap()),
}
}
fn new_search_handle(
l: &Lua,
(pattern, find_directories): (String, Option<bool>),
) -> LuaResult<Value> {
if let Ok(paths) = glob(&pattern) {
let directories_only = find_directories.is_some_and(|x| x);
let mut handle = SearchHandle::new(paths, directories_only);
// try to get the first result
handle.next();
// only return a handle if at least one file/directory is found
if handle.current.is_some() {
return handle.into_lua(l);
}
};
Ok(Value::Nil)
}
fn get_work_dir(_: &Lua, _: ()) -> LuaResult<PathBuf> {
Ok(CONTEXT.with_borrow(|ctx| ctx.current_working_dir().to_path_buf()))
}
// NOTE: unused
fn set_work_dir(_: &Lua, path: String) -> LuaResult<()> {
CONTEXT.with_borrow_mut(|ctx| ctx.set_current_working_dir(path.into()));
Ok(())
}
fn copy(_: &Lua, text: String) -> LuaResult<()> {
CONTEXT.with_borrow_mut(|ctx| {
ctx.clipboard
.set_text(text)
.map_err(|e| anyhow::anyhow!("{}", e))
})?;
Ok(())
}
fn paste(_: &Lua, _: ()) -> LuaResult<String> {
let text = CONTEXT.with_borrow_mut(|ctx| {
ctx.clipboard
.get_text()
.map_err(|e| anyhow::anyhow!("{}", e))
})?;
Ok(text)
}
// NOTE: needs to return physical size if this MR gets merged:
// https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/pull/1420
fn get_screen_size(_: &Lua, _: ()) -> LuaResult<(u32, u32)> {
let size = CONTEXT.with_borrow(|ctx| ctx.screen_size_logical());
Ok((size.width, size.height))
}
fn get_screen_scale(_: &Lua, _: ()) -> LuaResult<f32> {
Ok(CONTEXT.with_borrow(|ctx| ctx.pixels_per_point() as f32))
}
fn get_cursor_pos(_: &Lua, _: ()) -> LuaResult<(u32, u32)> {
let pos = CONTEXT.with_borrow(|ctx| ctx.mouse_pos_logical());
Ok((pos.x as u32, pos.y as u32))
}
fn is_key_down(_: &Lua, key_name: String) -> LuaResult<bool> {
if let Some(code) = str_as_keycode(&key_name) {
Ok(CONTEXT.with_borrow(|ctx| ctx.input_state.key_pressed(code)))
} else if let Some(button) = str_as_mousebutton(&key_name) {
Ok(CONTEXT.with_borrow(|ctx| ctx.input_state.mouse_pressed(button)))
} else {
Ok(false)
}
}
fn load_module(l: &Lua, (name, args): (String, MultiValue)) -> LuaResult<MultiValue> {
let mut module_path = Game::script_dir().join(name);
if module_path.extension().is_none() {
module_path.set_extension("lua");
}
change_working_directory(Game::script_dir().as_path())?;
let result = l.load(module_path).call::<MultiValue>(args);
CONTEXT.with_borrow(|ctx| change_working_directory(ctx.current_working_dir()))?;
result
}
fn protected_load_module(l: &Lua, (name, args): (String, MultiValue)) -> LuaResult<MultiValue> {
let mut module_path = Game::script_dir().join(name);
if module_path.extension().is_none() {
module_path.set_extension("lua");
}
change_working_directory(Game::script_dir().as_path())?;
let result = match l.load(module_path).call::<MultiValue>(args) {
// on success, callers expect a Nil followed by return values
Ok(res) => Ok(std::iter::once(Value::Nil).chain(res).collect()),
// otherwise it is set to error message.
Err(err) => Ok(err.to_string().into_lua_multi(l)?),
};
CONTEXT.with_borrow(|ctx| change_working_directory(ctx.current_working_dir()))?;
result
}
fn new_image_handle(_: &Lua, _: ()) -> LuaResult<ImageHandle> {
Ok(ImageHandle::Unloaded)
}
fn set_window_title(_: &Lua, title: String) -> LuaResult<()> {
CONTEXT.with_borrow(|ctx| ctx.set_window_title(&title));
Ok(())
}
fn restart(_: &Lua, _: ()) -> LuaResult<()> {
CONTEXT.with_borrow_mut(|ctx| ctx.needs_restart = true);
Ok(())
}
fn open_url(l: &Lua, url: String) -> LuaResult<MultiValue> {
match open::that(url) {
Ok(_) => Ok(().into_lua_multi(l)?),
Err(_) => Ok("Unable to open url!".into_lua_multi(l)?),
}
}
fn render_init(_: &Lua, _features: Variadic<String>) -> LuaResult<()> {
Ok(())
}
-94
View File
@@ -1,94 +0,0 @@
use mlua::{MultiValue, UserData};
use crate::{
context::CONTEXT,
renderer::textures::{TextureHandle, TextureOptions},
};
#[derive(Clone)]
pub enum ImageHandle {
Loaded(TextureHandle),
Unloaded,
}
impl UserData for ImageHandle {
fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
methods.add_method_mut(
"Load",
|_, this, (image_path, flags): (String, MultiValue)| {
let mut is_async = false;
let mut options = TextureOptions::LINEAR_REPEAT;
for flag in flags.iter() {
if let Some(flag) = flag.as_string() {
match flag.to_string_lossy().as_str() {
"CLAMP" => options.wrap_mode = wgpu::AddressMode::ClampToEdge,
"NEAREST" => options.magnification = wgpu::FilterMode::Nearest,
"ASYNC" => is_async = true,
"MIPMAP" => options.generate_mipmaps = true,
_ => {}
}
}
}
match this {
// replace image data if already allocated
ImageHandle::Loaded(texture_handle) => {
CONTEXT.with_borrow(|ctx| {
// in case of error, stay loaded with current texture
let _ = ctx.texture_manager.update_texture(
texture_handle.id(),
image_path,
options,
is_async,
);
});
}
// create new texture handle
ImageHandle::Unloaded => {
CONTEXT.with_borrow(|ctx| {
if let Ok(handle) = ctx
.texture_manager
.load_texture(image_path, options, is_async)
{
*this = ImageHandle::Loaded(handle);
}
});
}
}
Ok(())
},
);
methods.add_method_mut("Unload", |_, this, ()| {
match this {
ImageHandle::Loaded(_) => {
// dropping the handle frees the texture
*this = ImageHandle::Unloaded;
}
ImageHandle::Unloaded => {}
}
Ok(())
});
methods.add_method("IsValid", |_, this, ()| {
Ok(matches!(this, ImageHandle::Loaded(_)))
});
methods.add_method("IsLoading", |_, this, ()| match &this {
ImageHandle::Loaded(texture_handle) => {
let size = texture_handle.size();
Ok(size[0] == 0)
}
ImageHandle::Unloaded => Ok(true),
});
methods.add_method("ImageSize", |_, this, ()| match &this {
ImageHandle::Loaded(texture_handle) => {
let size = texture_handle.size();
Ok((size[0], size[1]))
}
ImageHandle::Unloaded => Ok((0, 0)),
});
}
}
-621
View File
@@ -1,621 +0,0 @@
use crate::{
api::image_handle::ImageHandle,
color::Srgba,
context::CONTEXT,
dpi::Uv,
fonts::{Alignment, LayoutJob},
math::{Point, Quad, Rect, Size},
};
use core::ffi::{c_int, c_void};
use mlua::{
LightUserData, Lua, Result as LuaResult, UserDataRefMut, Value,
ffi::{self},
};
use regex::Regex;
use std::sync::LazyLock;
pub fn register_globals(lua: &Lua) -> LuaResult<()> {
let globals = lua.globals();
// rendering functions
// NOTE: unfortunately, mlua's conversion of function arguments adds a lot of
// overhead. this is very noticeable for the draw functions which can be called
// thousands of times per frame. C functions are used to get raw access to
// the lua stack without the overhead.
unsafe { globals.set("SetDrawColor", lua.create_c_function(set_draw_color)?)? };
unsafe { globals.set("SetViewport", lua.create_c_function(set_viewport)?)? };
unsafe {
globals.set("SetDrawLayer", lua.create_c_function(set_draw_layer)?)?;
}
unsafe { globals.set("DrawImage", lua.create_c_function(draw_image)?)? };
unsafe { globals.set("DrawImageQuad", lua.create_c_function(draw_image_quad)?)? };
unsafe {
globals.set("DrawString", lua.create_c_function(draw_string)?)?;
}
unsafe {
globals.set("DrawStringWidth", lua.create_c_function(get_string_width)?)?;
}
globals.set(
"DrawStringCursorIndex",
lua.create_function_mut(get_index_at_cur)?,
)?;
// NOTE: mlua wraps UserData in a special way to maintain safety guarantees.
// This wrapper is not exposed by mlua, making it difficult to access the
// underlying user data from within C functions.
// This is a helper function that unwraps an ImageHandle and returns a pointer to it
// See: https://github.com/mlua-rs/mlua/discussions/545#discussioncomment-12530475
let get_img_handle = lua.create_function(|_, mut ud: UserDataRefMut<ImageHandle>| {
let vec: *mut ImageHandle = &mut *ud;
Ok(Value::LightUserData(LightUserData(vec as *mut c_void)))
})?;
lua.set_named_registry_value("get_img_handle", get_img_handle)?;
Ok(())
}
macro_rules! str_from_stack {
($s:ident, $i:expr) => {
unsafe {
let mut size = 0;
let data = ffi::luaL_checklstring($s, $i, &mut size);
let bytes = std::slice::from_raw_parts(data as *const u8, size);
std::str::from_utf8_unchecked(bytes)
}
};
}
macro_rules! f32_from_stack {
($s:ident, $i:expr) => {
unsafe { ffi::luaL_checknumber($s, $i) } as f32
};
}
macro_rules! i32_from_stack {
($s:ident, $i:expr) => {
unsafe { ffi::luaL_checkinteger($s, $i) } as i32
};
}
macro_rules! img_handle_from_stack {
($s:ident, $i:expr) => {
unsafe {
match ffi::lua_type($s, $i) {
ffi::LUA_TNIL => None,
ffi::LUA_TUSERDATA => {
let img_handle = lua_toimghandle($s, $i);
if !img_handle.is_null() {
if let ImageHandle::Loaded(ref handle) = *img_handle {
Some(handle.id())
} else {
None
}
} else {
None
}
}
t => panic!("Expected Nil or ImageHandle, got {:?}", t),
}
}
};
}
unsafe extern "C" fn lua_toimghandle(state: *mut ffi::lua_State, idx: c_int) -> *mut ImageHandle {
unsafe {
let idx = ffi::lua_absindex(state, idx);
ffi::lua_getfield(state, ffi::LUA_REGISTRYINDEX, c"get_img_handle".as_ptr());
ffi::lua_pushvalue(state, idx);
let img_handle = match ffi::lua_pcall(state, 1, 1, 0) {
ffi::LUA_OK => ffi::lua_touserdata(state, -1) as *mut ImageHandle,
_ => std::ptr::null_mut(),
};
ffi::lua_pop(state, 1);
img_handle
}
}
unsafe extern "C-unwind" fn set_draw_color(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("set_draw_color");
let nargs = unsafe { ffi::lua_gettop(state) };
match nargs {
// escape_code
1 => {
let esc_str = str_from_stack!(state, -nargs);
let color = Srgba::from_escape_code(esc_str);
CONTEXT.with_borrow_mut(|ctx| ctx.set_draw_color(color));
}
// rgb
3 => {
let r = f32_from_stack!(state, -nargs);
let g = f32_from_stack!(state, -nargs + 1);
let b = f32_from_stack!(state, -nargs + 2);
let color = Srgba::new_f32(r, g, b, 1.0);
CONTEXT.with_borrow_mut(|ctx| ctx.set_draw_color(color));
}
// rgba
4 => {
let r = f32_from_stack!(state, -nargs);
let g = f32_from_stack!(state, -nargs + 1);
let b = f32_from_stack!(state, -nargs + 2);
let a = f32_from_stack!(state, -nargs + 3);
let color = Srgba::new_f32(r, g, b, a);
CONTEXT.with_borrow_mut(|ctx| ctx.set_draw_color(color));
}
_ => panic!("Unexpected number of arguments"),
};
0
}
unsafe extern "C-unwind" fn set_viewport(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("set_viewport");
let nargs = unsafe { ffi::lua_gettop(state) };
match nargs {
0 => CONTEXT.with_borrow_mut(|ctx| ctx.reset_viewport()),
4 => {
let x = f32_from_stack!(state, -nargs);
let y = f32_from_stack!(state, -nargs + 1);
let w = f32_from_stack!(state, -nargs + 2);
let h = f32_from_stack!(state, -nargs + 3);
let rect = Rect::from_origin_and_size(Point::new(x, y), Size::new(w, h));
CONTEXT.with_borrow_mut(|ctx| ctx.set_viewport(rect));
}
_ => panic!("Unexpected number of arguments"),
};
0
}
unsafe extern "C-unwind" fn set_draw_layer(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("set_draw_layer");
let nargs = unsafe { ffi::lua_gettop(state) };
match nargs {
1 => {
let layer = i32_from_stack!(state, -nargs);
CONTEXT.with_borrow_mut(|ctx| ctx.set_draw_layer(layer, 0));
}
2 => {
let layer = match unsafe { ffi::lua_type(state, -nargs) } {
ffi::LUA_TNIL => None,
ffi::LUA_TNUMBER => {
let layer = i32_from_stack!(state, -nargs);
Some(layer)
}
t => panic!("Expected Nil or Number, got {:?}", t),
};
let sublayer = i32_from_stack!(state, -nargs + 1);
if let Some(layer) = layer {
CONTEXT.with_borrow_mut(|ctx| ctx.set_draw_layer(layer, sublayer));
} else {
CONTEXT.with_borrow_mut(|ctx| ctx.set_draw_sublayer(sublayer));
}
}
_ => panic!("Unexpected number of arguments"),
};
0
}
unsafe extern "C-unwind" fn draw_image(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("draw_image");
let nargs = unsafe { ffi::lua_gettop(state) };
if !matches!(nargs, 5 | 6 | 7 | 9 | 10 | 11) {
panic!("Unexpected number of arguments");
}
#[allow(clippy::manual_range_patterns)]
let parse_uv = matches!(nargs, 9 | 10 | 11);
let parse_layer_idx = matches!(nargs, 6 | 7 | 10 | 11);
let texture_id = img_handle_from_stack!(state, -nargs);
// left, top, width, height
let x = f32_from_stack!(state, -nargs + 1);
let y = f32_from_stack!(state, -nargs + 2);
let w = f32_from_stack!(state, -nargs + 3);
let h = f32_from_stack!(state, -nargs + 4);
let rect = Rect::from_origin_and_size(Point::new(x, y), Size::new(w, h));
// u1, v1, u2, v2
let mut i = 5;
let uv = if parse_uv {
let u1 = f32_from_stack!(state, -nargs + i);
let v1 = f32_from_stack!(state, -nargs + i + 1);
let u2 = f32_from_stack!(state, -nargs + i + 2);
let v2 = f32_from_stack!(state, -nargs + i + 3);
i += 4;
Rect::new(Point::new(u1, v1), Point::new(u2, v2))
} else {
Rect::default_uv()
};
let layer_idx = if parse_layer_idx {
let layer_idx = i32_from_stack!(state, -nargs + i);
(layer_idx - 1) as u32
} else {
0
};
CONTEXT.with_borrow_mut(|ctx| ctx.draw_rect(texture_id, rect, uv, layer_idx));
0
}
unsafe extern "C-unwind" fn draw_image_quad(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("draw_image_quad", format!("args: {:?}", args));
let nargs = unsafe { ffi::lua_gettop(state) };
if !matches!(nargs, 9 | 10 | 11 | 17 | 18 | 19) {
panic!("Unexpected number of arguments");
}
#[allow(clippy::manual_range_patterns)]
let parse_uv = matches!(nargs, 17 | 18 | 19);
let parse_layer_idx = matches!(nargs, 10 | 11 | 18 | 19);
let texture_id = img_handle_from_stack!(state, -nargs);
// x1, y1, x2, y2, ...
let x1 = f32_from_stack!(state, -nargs + 1);
let y1 = f32_from_stack!(state, -nargs + 2);
let x2 = f32_from_stack!(state, -nargs + 3);
let y2 = f32_from_stack!(state, -nargs + 4);
let x3 = f32_from_stack!(state, -nargs + 5);
let y3 = f32_from_stack!(state, -nargs + 6);
let x4 = f32_from_stack!(state, -nargs + 7);
let y4 = f32_from_stack!(state, -nargs + 8);
let quad = Quad::new(
Point::new(x1, y1),
Point::new(x2, y2),
Point::new(x3, y3),
Point::new(x4, y4),
);
// u1, v1, u2, v2, ...
let mut i = 9;
let uv = if parse_uv {
let u1 = f32_from_stack!(state, -nargs + i);
let v1 = f32_from_stack!(state, -nargs + i + 1);
let u2 = f32_from_stack!(state, -nargs + i + 2);
let v2 = f32_from_stack!(state, -nargs + i + 3);
let u3 = f32_from_stack!(state, -nargs + i + 4);
let v3 = f32_from_stack!(state, -nargs + i + 5);
let u4 = f32_from_stack!(state, -nargs + i + 6);
let v4 = f32_from_stack!(state, -nargs + i + 7);
i += 8;
Quad::new(
Point::new(u1, v1),
Point::new(u2, v2),
Point::new(u3, v3),
Point::new(u4, v4),
)
} else {
Quad::default_uv()
};
let layer_idx = if parse_layer_idx {
let layer_idx = i32_from_stack!(state, -nargs + i);
(layer_idx - 1) as u32
} else {
0
};
CONTEXT.with_borrow_mut(|ctx| ctx.draw_quad(texture_id, quad, uv, layer_idx));
0
}
unsafe extern "C-unwind" fn draw_string(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("draw_string");
let nargs = unsafe { ffi::lua_gettop(state) };
let x = f32_from_stack!(state, -nargs);
let y = f32_from_stack!(state, -nargs + 1);
let alignment = str_from_stack!(state, -nargs + 2);
let line_height = i32_from_stack!(state, -nargs + 3);
let font_type = str_from_stack!(state, -nargs + 4);
let text = str_from_stack!(state, -nargs + 5);
let alignment = match alignment.parse::<PoBTextAlignment>() {
Ok(alignment) => alignment,
Err(_) => panic!("Invalid alignment"),
};
let font_type = match font_type.parse::<PoBFontType>() {
Ok(font_type) => font_type,
Err(_) => panic!("Invalid font type"),
};
let mut position = Point::new(x, y);
let mut is_absolute_position = false;
CONTEXT.with_borrow_mut(|ctx| {
// the position needs to be adjusted for some alignments to match PoBs behavior
let screen_size = ctx.screen_size_logical();
let halign = match alignment {
PoBTextAlignment::Left => Alignment::Min,
PoBTextAlignment::Center => {
position.x += screen_size.width as f32 / 2.0;
is_absolute_position = true;
Alignment::Center
}
PoBTextAlignment::Right => {
position.x = screen_size.width as f32 - position.x;
is_absolute_position = true;
Alignment::Max
}
PoBTextAlignment::CenterX => Alignment::Center,
PoBTextAlignment::RightX => Alignment::Max,
};
let current_draw_color = ctx.get_draw_color();
let job = build_layout_job(
text,
current_draw_color,
font_type,
line_height,
Some(halign),
);
// NOTE: color escape codes modify the current draw color.
// set current draw color to color of last segment to match PoB's behavior
if let Some(last_segment) = job.segments.last() {
ctx.set_draw_color(last_segment.color);
}
ctx.draw_text(position, job, is_absolute_position);
});
0
}
unsafe extern "C-unwind" fn get_string_width(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("get_string_width");
let nargs = unsafe { ffi::lua_gettop(state) };
let line_height = i32_from_stack!(state, -nargs);
let font_type = str_from_stack!(state, -nargs + 1);
let text = str_from_stack!(state, -nargs + 2);
let font_type = match font_type.parse::<PoBFontType>() {
Ok(font_type) => font_type,
Err(_) => panic!("Invalid font type"),
};
let job = build_layout_job(text, Srgba::WHITE, font_type, line_height, None);
let width = CONTEXT.with_borrow_mut(|ctx| ctx.get_text_width(job));
unsafe { ffi::lua_pushnumber(state, width as f64) };
1
}
fn get_index_at_cur(
_: &Lua,
(line_height, font_type, text, cur_x, cur_y): (i32, String, String, f32, f32),
) -> LuaResult<usize> {
//profiling::scope!("get_char_index_at_cur");
let font_type = font_type.parse::<PoBFontType>()?;
let job = build_layout_job(&text, Srgba::WHITE, font_type, line_height, None);
let index =
CONTEXT.with_borrow_mut(|ctx| ctx.get_text_index_at_cursor(job, Point::new(cur_x, cur_y)));
// convert to lua's 1-based indexing
Ok(index + 1)
}
pub static ESCAPE_STR_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"\^(?<idx>[0-9])|\^[x|X](?<hex>[0-9A-Fa-f]{6})").unwrap());
fn build_layout_job<'a>(
text: &'a str,
current_color: Srgba,
font_type: PoBFontType,
line_height: i32,
alignment: Option<Alignment>,
) -> LayoutJob<'a> {
let mut font_weight = None;
let font_family = match font_type {
PoBFontType::Fixed => parley::GenericFamily::Monospace,
PoBFontType::Var => parley::GenericFamily::SansSerif,
PoBFontType::VarBold => {
font_weight = Some(700.0);
parley::GenericFamily::SansSerif
}
};
// TODO: check how PoB determines font size
let font_size = (line_height - 2).clamp(11, 32) as f32;
let mut job = LayoutJob::new(
font_family,
font_size,
line_height as f32,
alignment,
font_weight,
);
for (color, segment) in PoBString(text).into_iter() {
job.append(segment, color.unwrap_or(current_color));
}
job
}
// PoB strings can contain escape codes that affect the color of subsequent text
pub struct PoBString<'a>(pub &'a str);
impl<'a> PoBString<'a> {
pub fn strip_escapes(&self) -> String {
ESCAPE_STR_REGEX.replace_all(self.0, "").to_string()
}
}
type ColoredSegment<'a> = (Option<Srgba>, &'a str);
impl<'a> IntoIterator for PoBString<'a> {
type Item = ColoredSegment<'a>;
type IntoIter = PoBStringSegmentIterator<'a>;
fn into_iter(self) -> Self::IntoIter {
PoBStringSegmentIterator::new(self.0)
}
}
// Iterates over colored segments
pub struct PoBStringSegmentIterator<'a> {
haystack: &'a str,
captures: std::iter::Peekable<regex::CaptureMatches<'static, 'a>>,
is_first: bool,
is_done: bool,
}
impl<'a> PoBStringSegmentIterator<'a> {
fn new(haystack: &'a str) -> Self {
let captures = ESCAPE_STR_REGEX.captures_iter(haystack).peekable();
Self {
haystack,
captures,
is_first: true,
is_done: false,
}
}
}
impl<'a> Iterator for PoBStringSegmentIterator<'a> {
type Item = ColoredSegment<'a>;
fn next(&mut self) -> Option<Self::Item> {
let is_first = core::mem::replace(&mut self.is_first, false);
match self.captures.peek() {
Some(capture) => {
let code_start = capture.get(0).unwrap().start();
let code_end = capture.get(0).unwrap().end();
// string didn't start with an escape code.
// return text up to first code without color.
if is_first && code_start > 0 {
return Some((None, &self.haystack[..code_start]));
}
let escape_str = capture.get(0).unwrap().as_str();
let color = Some(Srgba::from_escape_code(escape_str));
let _ = self.captures.next(); // pop current code to peek the next one
match self.captures.peek() {
Some(next_code) => {
// found another escape code. return text up the next code
let next_code_start = next_code.get(0).unwrap().start();
Some((color, &self.haystack[code_end..next_code_start]))
}
None => {
// no additional escape codes found. return rest of string
self.is_done = true;
Some((color, &self.haystack[code_end..]))
}
}
}
None => {
if self.is_done {
None
} else {
// string doesn't contain any escape codes.
// return entire string without color
self.is_done = true;
Some((None, self.haystack))
}
}
}
}
}
// PoB's text alignment is weird
#[derive(Clone, Copy, Debug)]
enum PoBTextAlignment {
// left-aligned, x coordinate describes top-left corner
Left,
// centered in screen space, x coordinate describes offset of text center
// from screen center. positive values of x move text to right, negative to left.
Center,
// right-aligned in screen space, x coordinate describes distance from right edge
// of text to right edge of screen. positive values move text further to left.
Right,
// makes text centered around position, i.e. position.x = horizontal center of text
CenterX,
// makes text right-aligned to position, i.e. position.x = right edge of text
RightX,
}
impl std::str::FromStr for PoBTextAlignment {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"LEFT" => Ok(Self::Left),
"CENTER" => Ok(Self::Center),
"RIGHT" => Ok(Self::Right),
"CENTER_X" => Ok(Self::CenterX),
"RIGHT_X" => Ok(Self::RightX),
_ => Err(anyhow::anyhow!(
"'{}' is not a valid TextFontType variant",
s
)),
}
}
}
#[derive(Clone, Copy, Debug)]
enum PoBFontType {
Fixed,
Var,
VarBold,
}
impl std::str::FromStr for PoBFontType {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"FIXED" => Ok(Self::Fixed),
"VAR" => Ok(Self::Var),
"VAR BOLD" => Ok(Self::VarBold),
_ => Err(anyhow::anyhow!(
"'{}' is not a valid TextFontType variant",
s
)),
}
}
}
impl Srgba {
fn from_escape_code(escape_str: &str) -> Srgba {
if let Some(caps) = ESCAPE_STR_REGEX.captures(escape_str) {
if let Some(idx) = caps.name("idx") {
return match idx.as_str() {
"0" => Srgba::from_rgb(0, 0, 0), //black
"1" => Srgba::from_rgb(255, 0, 0), //red
"2" => Srgba::from_rgb(0, 255, 0), //green
"3" => Srgba::from_rgb(0, 0, 255), //blue
"4" => Srgba::from_rgb(255, 255, 0), //yellow
"5" => Srgba::from_rgb(255, 0, 255), //purple
"6" => Srgba::from_rgb(0, 255, 255), //aqua
"7" => Srgba::from_rgb(255, 255, 255), //white
"8" => Srgba::from_rgb(178, 178, 178), //gray
"9" => Srgba::from_rgb(102, 102, 102), //dark gray
_ => unreachable!(),
};
}
if let Some(hex) = caps.name("hex")
&& let Ok(hex_color) = Srgba::from_hex(hex.as_str())
{
return hex_color;
}
}
Srgba::WHITE
}
}
+312 -117
View File
@@ -1,79 +1,171 @@
use std::sync::Arc;
use crate::{
args::Game,
batcher::build_render_job,
dpi::{PhysicalPoint, PhysicalSize},
fonts::{FontData, FontDefinitions, Fonts},
gfx::GraphicsContext,
installer::Installer,
pob::PathOfBuilding,
renderer::{RenderJob, textures::TextureManager},
stage::{ActiveStage, StageEvent, StageTransition},
};
use anyhow::Result;
use std::sync::Arc;
use std::{cell::RefCell, path::PathBuf, rc::Rc};
use winit::{
application::ApplicationHandler,
dpi::PhysicalPosition,
event::*,
event::{ElementState, MouseScrollDelta, WindowEvent},
event_loop::ActiveEventLoop,
keyboard::{ModifiersState, PhysicalKey},
platform::modifier_supplement::KeyEventExtModifierSupplement,
window::Window,
};
use crate::{
context::{CONTEXT, FrameOutput},
gfx::GraphicsContext,
input::{keycode_as_str, mousebutton_as_str},
lua::LuaInstance,
};
struct FrameOutput {
pub render_job: Option<RenderJob>,
pub request_redraw: bool,
}
pub struct App {
gfx_context: Option<GraphicsContext>,
lua_instance: LuaInstance,
fonts: Rc<RefCell<Fonts>>,
texture_manager: Rc<RefCell<TextureManager>>,
stage: ActiveStage,
game: Game,
script_dir: PathBuf,
needs_reconfigure: bool,
}
impl App {
pub fn new() -> Result<Self> {
let lua_instance = LuaInstance::new()?;
pub fn new(game: Game, custom_script_dir: Option<PathBuf>) -> Result<Self> {
let uses_custom_script_dir = custom_script_dir.is_some();
let script_dir = custom_script_dir.unwrap_or_else(|| game.script_dir());
let fonts = Rc::new(RefCell::new(Fonts::new(pob_font_definitions())));
let texture_manager = Rc::new(RefCell::new(TextureManager::new()));
let stage = if uses_custom_script_dir {
// skip installer if custom script dir is provided. used for local testing.
let pob =
PathOfBuilding::new(&script_dir, Rc::clone(&fonts), Rc::clone(&texture_manager))?;
ActiveStage::Main(pob)
} else {
ActiveStage::Startup(Installer::new(game, Rc::clone(&fonts)))
};
Ok(Self {
gfx_context: None,
lua_instance,
fonts,
texture_manager,
stage,
game,
script_dir,
needs_reconfigure: true,
})
}
fn frame(&mut self) -> FrameOutput {
// Handle restart requests
if CONTEXT.with_borrow(|ctx| ctx.needs_restart) {
match self.lua_instance.restart() {
Ok(_) => CONTEXT.with_borrow_mut(|ctx| ctx.needs_restart = false),
Err(e) => panic!("Error occused while restarting lua instance: {}", e),
fn update(&mut self, event_loop: &ActiveEventLoop) -> anyhow::Result<()> {
let transition = self.stage.update();
if let Some(transition) = transition? {
match transition {
StageTransition::ToMain => {
self.stage = ActiveStage::Main(PathOfBuilding::new(
&self.script_dir,
Rc::clone(&self.fonts),
Rc::clone(&self.texture_manager),
)?);
if let Some(gfx) = &self.gfx_context {
self.stage.set_window(Arc::clone(&gfx.window));
}
}
StageTransition::ToShutdown => {
self.handle_event(StageEvent::Exit);
event_loop.exit();
}
}
}
Ok(())
}
fn frame(&mut self, inhibit_elision: bool) -> anyhow::Result<FrameOutput> {
self.fonts.borrow_mut().begin_frame();
let stage_output = self.stage.frame()?;
let font_image_delta = self.fonts.borrow_mut().font_atlas_delta();
self.texture_manager
.borrow()
.update_font_texture(font_image_delta);
let textures_delta = self.texture_manager.borrow().take_delta();
let render_job = if stage_output.can_elide && textures_delta.is_empty() && !inhibit_elision
{
None
} else {
Some(build_render_job(
&stage_output.draw_commands,
textures_delta,
stage_output.scale_factor,
))
};
self.lua_instance.handle_subscripts();
Ok(FrameOutput {
render_job,
request_redraw: stage_output.request_redraw,
})
}
// Clear data from previous frame and prepare for new one
CONTEXT.with_borrow_mut(|ctx| ctx.begin_frame());
fn handle_event(&mut self, event: StageEvent) {
if let Err(err) = self.stage.handle_event(event) {
log::error!("{err}");
}
}
// Call back into lua and tell it to draw a frame
self.lua_instance.on_frame().unwrap();
fn create_window(&mut self, event_loop: &ActiveEventLoop) -> anyhow::Result<()> {
let (title, _app_id) = match self.game {
Game::Poe1 => ("Path of Building 1", "rusty-path-of-building-1"),
Game::Poe2 => ("Path of Building 2", "rusty-path-of-building-2"),
};
// End frame and get outupts
CONTEXT.with_borrow_mut(|ctx| ctx.end_frame())
#[allow(unused_mut)]
let mut window_attributes = Window::default_attributes()
.with_title(title)
.with_window_icon(load_icon());
#[cfg(target_os = "linux")]
{
use winit::platform::wayland::ActiveEventLoopExtWayland;
use winit::platform::x11::ActiveEventLoopExtX11;
if event_loop.is_x11() {
use winit::platform::x11::WindowAttributesExtX11;
window_attributes = window_attributes.with_name(_app_id, _app_id);
} else if event_loop.is_wayland() {
use winit::platform::wayland::WindowAttributesExtWayland;
window_attributes = window_attributes.with_name(_app_id, _app_id);
}
}
let window = event_loop.create_window(window_attributes)?;
let window = Arc::new(window);
self.stage.set_window(Arc::clone(&window));
self.gfx_context = Some(pollster::block_on(GraphicsContext::new(window))?);
Ok(())
}
fn request_redraw(&self) {
if let Some(gfx) = &self.gfx_context {
gfx.window.request_redraw();
}
}
}
impl ApplicationHandler<GraphicsContext> for App {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let window = match event_loop.create_window(Window::default_attributes()) {
Ok(window) => Arc::new(window),
Err(err) => {
log::error!("{err}");
event_loop.exit();
return;
}
};
CONTEXT.with_borrow_mut(|ctx| ctx.set_window(Arc::clone(&window)));
self.gfx_context = match pollster::block_on(GraphicsContext::new(window)) {
Ok(gfx) => Some(gfx),
Err(err) => {
log::error!("{err}");
event_loop.exit();
return;
}
if let Err(err) = self.create_window(event_loop) {
log::error!("{err}");
event_loop.exit();
}
}
@@ -83,106 +175,209 @@ impl ApplicationHandler<GraphicsContext> for App {
_window_id: winit::window::WindowId,
event: WindowEvent,
) {
CONTEXT.with_borrow_mut(|ctx| ctx.on_window_event(&event));
match event {
WindowEvent::CloseRequested => {
self.lua_instance.on_exit().unwrap();
event_loop.exit()
}
WindowEvent::Resized(size) => {
if let Some(ref mut gfx) = self.gfx_context {
gfx.resize(size.width, size.height);
CONTEXT.with_borrow_mut(|ctx| ctx.force_render = true)
if self.stage.can_exit() {
self.handle_event(StageEvent::Exit);
event_loop.exit();
}
}
WindowEvent::RedrawRequested => {
profiling::scope!("RedrawRequested");
let FrameOutput { render_job } = self.frame();
if let Err(err) = self.update(event_loop) {
log::error!("{err}");
event_loop.exit();
return;
}
let mut inhibit_elision = false;
if self.needs_reconfigure {
if let Some(ref mut gfx) = self.gfx_context {
let size = gfx.window.inner_size();
gfx.resize(size.width, size.height);
// resizing recreates the blip texture (previous frame) thus elision needs to
// be inhibited for at least one frame.
inhibit_elision = true;
}
self.needs_reconfigure = false;
}
let FrameOutput {
render_job,
request_redraw,
} = match self.frame(inhibit_elision) {
Ok(frame_output) => frame_output,
Err(err) => {
log::error!("{err}");
event_loop.exit();
return;
}
};
if let Some(ref mut gfx) = self.gfx_context {
match gfx.render(render_job) {
Ok(_) => {}
// Reconfigure the surface if it's lost or outdated
Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
let size = gfx.window.inner_size();
gfx.resize(size.width, size.height);
CONTEXT.with_borrow_mut(|ctx| ctx.force_render = true)
}
Ok(()) => {}
Err(err) => {
log::error!("Unable to render: {err}");
}
}
}
if request_redraw {
self.request_redraw();
}
profiling::finish_frame!();
}
WindowEvent::KeyboardInput {
event:
KeyEvent {
physical_key: PhysicalKey::Code(code),
state,
text,
..
},
..
} => {
// Only call OnChar if no modifier key except SHIFT is pressed.
// This prevents 'v' from getting inserted into a text field
// when 'CTRL + v' is used to paste.
if state.is_pressed()
&& CONTEXT.with_borrow(|ctx| {
ctx.input_state
.modifiers()
.difference(ModifiersState::SHIFT)
.is_empty()
})
&& let Some(text) = text
{
self.lua_instance.on_char(&text).unwrap();
WindowEvent::Resized(size) => {
self.needs_reconfigure = true;
self.handle_event(StageEvent::Resized(PhysicalSize::new(
size.width,
size.height,
)));
self.request_redraw();
}
WindowEvent::Focused(focused) => {
self.handle_event(StageEvent::FocusChanged(focused));
if focused {
self.request_redraw();
} else {
// Clear inputs on lost focus to avoid "stuck" keys on Wayland systems.
self.stage.clear_pressed();
}
}
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
self.handle_event(StageEvent::ScaleFactorChanged(scale_factor));
self.request_redraw();
}
WindowEvent::KeyboardInput { event, .. } => {
let state = event.state;
if let Some(key_string) = keycode_as_str(code) {
match state {
ElementState::Pressed => {
self.lua_instance.on_key_down(&key_string, false).unwrap();
}
ElementState::Released => {
self.lua_instance.on_key_up(&key_string).unwrap();
}
// forward KeyUp/KeyDown events
let stage_event = match state {
ElementState::Pressed => StageEvent::KeyDown {
key: event.logical_key.clone(),
},
ElementState::Released => StageEvent::KeyUp {
key: event.logical_key.clone(),
},
};
self.handle_event(stage_event);
// handle text input
if let Some(text) = event.text_with_all_modifiers()
&& state.is_pressed()
{
for ch in text.chars() {
let event = StageEvent::CharacterInput { ch };
self.handle_event(event);
}
}
self.request_redraw();
}
WindowEvent::ModifiersChanged(modifiers) => {
self.handle_event(StageEvent::ModifiersChanged {
state: modifiers.state(),
});
self.request_redraw();
}
WindowEvent::MouseInput { state, button, .. } => {
if let Some(button_string) = mousebutton_as_str(button) {
match state {
ElementState::Pressed => {
let is_double_click = CONTEXT
.with_borrow_mut(|ctx| ctx.input_state.is_double_click(button));
self.lua_instance
.on_key_down(&button_string, is_double_click)
.unwrap();
}
ElementState::Released => {
self.lua_instance.on_key_up(&button_string).unwrap();
}
}
}
let event = match state {
ElementState::Pressed => StageEvent::MouseDown { button },
ElementState::Released => StageEvent::MouseUp { button },
};
self.handle_event(event);
self.request_redraw();
}
WindowEvent::CursorMoved { position, .. } => {
let pos = PhysicalPoint::new(position.x as f32, position.y as f32);
self.handle_event(StageEvent::MouseMoved { pos });
self.request_redraw();
}
WindowEvent::CursorEntered { .. } => {
self.handle_event(StageEvent::HoverChanged(true));
self.request_redraw();
}
WindowEvent::CursorLeft { .. } => {
self.handle_event(StageEvent::HoverChanged(false));
}
WindowEvent::MouseWheel { delta, .. } => {
let vertical_scroll_amount = match delta {
MouseScrollDelta::LineDelta(_, y) => y as f64,
MouseScrollDelta::PixelDelta(PhysicalPosition { y, .. }) => y,
let delta = match delta {
MouseScrollDelta::LineDelta(_, y) => y,
MouseScrollDelta::PixelDelta(winit::dpi::PhysicalPosition { y, .. }) => {
y as f32
}
};
if vertical_scroll_amount > 0.0 {
self.lua_instance.on_key_up("WHEELUP").unwrap();
} else if vertical_scroll_amount < 0.0 {
self.lua_instance.on_key_up("WHEELDOWN").unwrap();
}
self.handle_event(StageEvent::MouseWheel { delta });
self.request_redraw();
}
_ => {}
}
}
}
fn pob_font_definitions() -> FontDefinitions {
let mut definitions = FontDefinitions::default();
definitions.font_data.insert(
"bitstream-vera-sans-mono".to_owned(),
Arc::new(FontData::from_static(include_bytes!(
"../assets/fonts/VeraMono.ttf"
))),
);
definitions.font_data.insert(
"liberation-sans".to_owned(),
Arc::new(FontData::from_static(include_bytes!(
"../assets/fonts/LiberationSans-Regular.ttf"
))),
);
definitions.font_data.insert(
"liberation-sans-bold".to_owned(),
Arc::new(FontData::from_static(include_bytes!(
"../assets/fonts/LiberationSans-Bold.ttf"
))),
);
definitions.font_data.insert(
"fontin-regular".to_owned(),
Arc::new(FontData::from_static(include_bytes!(
"../assets/fonts/fontin-regular.ttf"
))),
);
definitions.font_data.insert(
"fontin-italic".to_owned(),
Arc::new(FontData::from_static(include_bytes!(
"../assets/fonts/fontin-italic.ttf"
))),
);
definitions.font_data.insert(
"fontin-smallcaps".to_owned(),
Arc::new(FontData::from_static(include_bytes!(
"../assets/fonts/fontin-smallcaps.ttf"
))),
);
definitions.generic_families.insert(
parley::GenericFamily::Monospace,
vec!["Bitstream Vera Sans Mono".to_owned()],
);
definitions.generic_families.insert(
parley::GenericFamily::SansSerif,
vec!["Liberation Sans".to_owned()],
);
definitions.generic_families.insert(
parley::GenericFamily::Serif,
vec!["Fontin".to_owned(), "Fontin SmallCaps".to_owned()],
);
definitions
}
fn load_icon() -> Option<winit::window::Icon> {
let image_data = include_bytes!("../assets/icon.png");
let image = image::load_from_memory(image_data).ok()?.into_rgba8();
let (width, height) = image.dimensions();
winit::window::Icon::from_rgba(image.into_raw(), width, height).ok()
}
+22 -16
View File
@@ -3,39 +3,45 @@ use clap::ValueEnum;
use directories::BaseDirs;
use std::path::PathBuf;
/// CLI arguments passed to the application.
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct Args {
/// Used to determine which PoB to start. (PoE1 or PoE2)
#[arg(value_enum)]
pub game: Game,
pub build_path: Option<String>,
/// Specify a build to load on start using a URL. (Optional)
#[arg(
help = "URL of build to import on startup. Needs to use custom protocol schema, e.g. `pob://pobbin/<id>`"
)]
pub import_url: Option<String>,
}
#[derive(Debug, Clone, ValueEnum)]
/// Enum representing the game version.
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum Game {
/// Path of Exile 1
#[value(name = "poe1")]
Poe1,
/// Path of Exile 2
#[value(name = "poe2")]
Poe2,
}
static GAME_CONFIG: std::sync::OnceLock<Game> = std::sync::OnceLock::new();
impl Game {
pub fn init(game: Game) {
GAME_CONFIG.set(game).expect("Game should be uninitialized");
}
pub fn current() -> &'static Game {
GAME_CONFIG.get().expect("Game should be initialized")
}
pub fn script_dir() -> PathBuf {
let directory_name = match Self::current() {
Game::Poe1 => "PathOfBuilding1",
Game::Poe2 => "PathOfBuilding2",
/// Returns the path to the user’s data directory based on which `Game` option was used to
/// start the application.
pub fn data_dir(&self) -> PathBuf {
let directory_name = match self {
Self::Poe1 => "RustyPathOfBuilding1",
Self::Poe2 => "RustyPathOfBuilding2",
};
BaseDirs::new().unwrap().data_dir().join(directory_name)
}
/// Returns the path to the user's data directory.
pub fn script_dir(&self) -> PathBuf {
self.data_dir()
}
}
+169
View File
@@ -0,0 +1,169 @@
use std::num::NonZeroU32;
use ahash::HashMap;
use crate::{
dpi::{LogicalRect, ScaleFactor},
draw_commands::DrawCommand,
renderer::{
BATCH_TEX_SLOTS, Batch, RenderJob, Vertex,
textures::{TextureId, TexturesDelta},
},
};
struct BatchBuilder {
textures: Vec<TextureId>,
// maps TextureId to index into textures array
texture_mapping: HashMap<TextureId, u32>,
clip_rect: LogicalRect<f32>,
// index into batch's indecies array
start_index: u32,
}
impl BatchBuilder {
fn new(clip_rect: LogicalRect<f32>, start_index: u32) -> Self {
// seed slot 0 with font atlas.
// the font atlas texture is used for solid color and text
// rendering so it needs to be present in almost every batch.
let textures = vec![TextureId::default()];
let texture_mapping = HashMap::from_iter([(TextureId::default(), 0)]);
Self {
textures,
texture_mapping,
clip_rect,
start_index,
}
}
/// Tries to assign a texture to the batch.
///
/// Returns `slot_index` into textures array if texture can be assigned.
/// Returns `None` if maximum amount of texture slots is reached.
fn try_assign(&mut self, id: TextureId, max_slots: NonZeroU32) -> Option<u32> {
if let Some(&slot) = self.texture_mapping.get(&id) {
return Some(slot);
}
if self.textures.len() as u32 >= max_slots.get() {
return None;
}
let slot = self.textures.len() as u32;
self.textures.push(id);
self.texture_mapping.insert(id, slot);
Some(slot)
}
fn finish(self, end_index: u32) -> Option<Batch> {
if self.start_index < end_index {
Some(Batch {
clip_rect: self.clip_rect,
textures: self.textures,
index_range: self.start_index..end_index,
})
} else {
None
}
}
}
pub fn build_render_job(
commands: &[DrawCommand],
textures_delta: TexturesDelta,
scale_factor: ScaleFactor<f32>,
) -> RenderJob {
profiling::scope!("build_render_job");
let max_slots = BATCH_TEX_SLOTS;
let mut vertices = Vec::with_capacity(commands.len() * 4);
let mut indices = Vec::with_capacity(commands.len() * 6);
let mut batches = Vec::new();
let Some(first_cmd) = commands.first() else {
// no draw commands, only texture updates
return RenderJob {
vertices,
indices,
batches,
textures_delta,
scale_factor,
};
};
let mut builder = BatchBuilder::new(first_cmd.clip_rect, 0);
for cmd in commands {
// start new batch if clip_rects don't match
if cmd.clip_rect != builder.clip_rect {
let next_builder = BatchBuilder::new(cmd.clip_rect, indices.len() as u32);
if let Some(batch) =
std::mem::replace(&mut builder, next_builder).finish(indices.len() as u32)
{
batches.push(batch);
}
}
let slot = builder
.try_assign(cmd.texture_id, max_slots)
.unwrap_or_else(|| {
let next_builder = BatchBuilder::new(cmd.clip_rect, indices.len() as u32);
if let Some(batch) =
std::mem::replace(&mut builder, next_builder).finish(indices.len() as u32)
{
batches.push(batch);
}
builder
.try_assign(cmd.texture_id, max_slots)
.expect("new batch always has enough space")
});
let i = vertices.len() as u32;
indices.extend_from_slice(&[i, i + 1, i + 3, i + 1, i + 2, i + 3]);
vertices.extend_from_slice(&[
Vertex {
pos: cmd.positions.p0,
uv: cmd.uvs.p0,
color: cmd.color,
texture_slot: slot,
layer_idx: cmd.texture_layer_idx,
},
Vertex {
pos: cmd.positions.p1,
uv: cmd.uvs.p1,
color: cmd.color,
texture_slot: slot,
layer_idx: cmd.texture_layer_idx,
},
Vertex {
pos: cmd.positions.p2,
uv: cmd.uvs.p2,
color: cmd.color,
texture_slot: slot,
layer_idx: cmd.texture_layer_idx,
},
Vertex {
pos: cmd.positions.p3,
uv: cmd.uvs.p3,
color: cmd.color,
texture_slot: slot,
layer_idx: cmd.texture_layer_idx,
},
]);
}
if let Some(batch) = builder.finish(indices.len() as u32) {
batches.push(batch);
}
RenderJob {
vertices,
indices,
batches,
textures_delta,
scale_factor,
}
}
+81
View File
@@ -0,0 +1,81 @@
use raw_window_handle::RawDisplayHandle;
/// Abstraction over clipboard crates
///
/// `smithay_clipboard`: Used on wayland
/// `arboard`: All other platforms (check arboard docs for platform support)
pub struct Clipboard {
#[cfg(target_os = "linux")]
smithay: Option<smithay_clipboard::Clipboard>,
arboard: Option<arboard::Clipboard>,
// fallback if everything else fails. only supports intra-application copy/paste
fallback: Option<String>,
}
impl Clipboard {
pub fn new(_raw_display_handle: Option<RawDisplayHandle>) -> Self {
Self {
#[cfg(target_os = "linux")]
smithay: create_smithay_clipboard(_raw_display_handle),
arboard: create_arboard_clipboard(),
fallback: None,
}
}
/// Sets the text content of clipboard
pub fn set_text(&mut self, text: String) {
#[cfg(target_os = "linux")]
if let Some(clipboard) = &mut self.smithay {
clipboard.store(text);
return;
}
if let Some(clipboard) = &mut self.arboard {
let _ = clipboard.set_text(text);
return;
}
self.fallback = Some(text);
}
/// Gets the text content of clipboard
pub fn get_text(&mut self) -> Option<String> {
#[cfg(target_os = "linux")]
if let Some(clipboard) = &mut self.smithay {
return clipboard.load().ok();
}
if let Some(clipboard) = &mut self.arboard {
return clipboard.get_text().ok();
}
if let Some(text) = &self.fallback {
return Some(text.clone());
}
None
}
}
#[cfg(target_os = "linux")]
fn create_smithay_clipboard(
raw_display_handle: Option<RawDisplayHandle>,
) -> Option<smithay_clipboard::Clipboard> {
if let Some(RawDisplayHandle::Wayland(handle)) = raw_display_handle {
log::debug!("Creating smithay clipboard...");
Some(unsafe { smithay_clipboard::Clipboard::new(handle.display.as_ptr()) })
} else {
None
}
}
fn create_arboard_clipboard() -> Option<arboard::Clipboard> {
log::debug!("Creating arboard clipboard...");
match arboard::Clipboard::new() {
Ok(clipboard) => Some(clipboard),
Err(err) => {
log::warn!("Failed to create arboard clipboard: {err}");
None
}
}
}
+12
View File
@@ -67,8 +67,20 @@ impl From<Srgba> for image::Rgba<u8> {
}
}
impl From<Srgba> for [f32; 4] {
fn from(value: Srgba) -> Self {
value.0.map(u8_to_f32)
}
}
/// f32 [0.0, 1.0] -> u8 [0, 255]
#[inline(always)]
const fn f32_to_u8(c: f32) -> u8 {
((c * 255.0) + 0.5) as u8
}
/// u8 [0, 255] -> f32 [0.0, 1.0]
#[inline(always)]
const fn u8_to_f32(c: u8) -> f32 {
c as f32 / 255.0
}
-249
View File
@@ -1,249 +0,0 @@
use crate::{
Game,
color::Srgba,
dpi::{
ConvertToLogical, LogicalPoint, LogicalQuad, LogicalRect, LogicalSize, NormalizedQuad,
NormalizedRect, PhysicalRect, PhysicalSize,
},
fonts::{Fonts, LayoutJob},
input::InputState,
layers::Layers,
renderer::{
mesh::ClippedMesh,
primitives::{QuadPrimitive, QuadTexture, RectPrimitive, RectTexture, TextPrimitive},
tessellator::Tessellator,
textures::{TextureId, TexturesDelta, WrappedTextureManager},
},
util::{calculate_hash, change_working_directory},
};
use arboard::Clipboard;
use std::{
cell::RefCell,
path::{Path, PathBuf},
sync::Arc,
};
use winit::{event::WindowEvent, window::Window};
// NOTE: This looks ugly but i haven't found a better way to do it yet.
// The C functions used for rendering need a way to access the context.
// They can't be defined as closures like all other lua callback functions
// and we can't change their arguments. The only way for them to access
// something outside their scope is to have some kind of static variable.
thread_local! {
pub static CONTEXT: RefCell<Context> = RefCell::new(Context::new());
}
pub struct Context {
window: Option<Arc<Window>>,
screen_size: PhysicalSize<u32>,
pixels_per_point: f32,
pub input_state: InputState,
pub clipboard: Clipboard,
pub texture_manager: WrappedTextureManager,
tessellator: Tessellator,
fonts: Fonts,
layers: Layers,
current_draw_color: Srgba,
previous_layers_hash: u64,
current_working_dir: PathBuf,
pub needs_restart: bool,
pub force_render: bool,
}
impl Context {
pub fn new() -> Self {
Self {
window: None,
screen_size: PhysicalSize::new(0, 0),
pixels_per_point: 1.0,
input_state: InputState::default(),
clipboard: Clipboard::new().unwrap(),
texture_manager: WrappedTextureManager::new(),
tessellator: Tessellator::default(),
fonts: Fonts::new(),
layers: Layers::new(),
current_draw_color: Srgba::WHITE,
previous_layers_hash: 0,
current_working_dir: Game::script_dir().clone(),
needs_restart: false,
force_render: false,
}
}
pub fn begin_frame(&mut self) {
profiling::scope!("begin_frame");
self.fonts.begin_frame();
self.layers.reset();
self.reset_viewport();
}
pub fn end_frame(&mut self) -> FrameOutput {
profiling::scope!("end_frame");
let font_atlas_size = self.fonts.font_atlas().size();
if let Some(font_image_delta) = self.fonts.font_atlas_delta() {
self.texture_manager.update_font_texture(font_image_delta);
}
let textures_delta = self.texture_manager.take_delta();
// Skip rendering this frame if identical to last one and no textures changed
let layers_hash = calculate_hash(&self.layers);
let elide_frame = layers_hash == self.previous_layers_hash && textures_delta.is_empty();
let render_job = if elide_frame && !self.force_render {
RenderJob::Skip
} else {
self.force_render = false;
self.previous_layers_hash = layers_hash;
let primitives = self.layers.consume_layers();
let meshes = self
.tessellator
.convert_clipped_primitives(primitives, font_atlas_size);
RenderJob::Render {
meshes,
textures_delta,
}
};
FrameOutput { render_job }
}
pub fn on_window_event(&mut self, event: &WindowEvent) {
match event {
WindowEvent::Resized(size) => {
self.screen_size = PhysicalSize::new(size.width, size.height);
}
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
self.pixels_per_point = *scale_factor as f32;
}
_ => {}
}
self.input_state.on_window_event(event);
}
pub fn screen_size_logical(&self) -> LogicalSize<u32> {
self.screen_size.to_logical(self.pixels_per_point)
}
pub fn mouse_pos_logical(&self) -> LogicalPoint<f32> {
self.input_state
.mouse_pos()
.to_logical(self.pixels_per_point)
}
pub fn pixels_per_point(&self) -> f32 {
self.pixels_per_point
}
pub fn current_working_dir(&self) -> &Path {
&self.current_working_dir
}
pub fn set_current_working_dir(&mut self, path: PathBuf) {
if change_working_directory(&path).is_ok() {
self.current_working_dir = path;
}
}
pub fn set_window(&mut self, window: Arc<Window>) {
self.window = Some(window);
}
pub fn set_window_title(&self, title: &str) {
if let Some(ref window) = self.window {
window.set_title(title);
}
}
}
pub enum RenderJob {
Render {
meshes: Vec<ClippedMesh>,
textures_delta: TexturesDelta,
},
Skip,
}
pub struct FrameOutput {
pub render_job: RenderJob,
}
impl Context {
pub fn set_draw_layer(&mut self, layer: i32, sublayer: i32) {
self.layers.set_draw_layer(layer, sublayer);
}
pub fn set_draw_sublayer(&mut self, sublayer: i32) {
self.layers.set_draw_sublayer(sublayer);
}
pub fn set_viewport(&mut self, viewport: LogicalRect<f32>) {
self.layers.set_viewport(viewport);
}
pub fn reset_viewport(&mut self) {
let viewport = PhysicalRect::from_size(self.screen_size);
self.layers
.set_viewport(viewport.to_logical(self.pixels_per_point));
}
pub fn set_draw_color(&mut self, color: Srgba) {
self.current_draw_color = color;
}
pub fn get_draw_color(&self) -> Srgba {
self.current_draw_color
}
pub fn draw_rect(
&mut self,
texture_id: Option<TextureId>,
rect: LogicalRect<f32>,
uv: NormalizedRect,
layer_idx: u32,
) {
let texture = texture_id.map(|id| RectTexture::new(id, uv, layer_idx));
let primitive = RectPrimitive::new(rect, self.current_draw_color, texture);
self.layers.add_rect(primitive);
}
pub fn draw_quad(
&mut self,
texture_id: Option<TextureId>,
quad: LogicalQuad<f32>,
uv: NormalizedQuad,
layer_idx: u32,
) {
let texture = texture_id.map(|id| QuadTexture::new(id, uv, layer_idx));
let primitive = QuadPrimitive::new(quad, self.current_draw_color, texture);
self.layers.add_quad(primitive);
}
pub fn draw_text(
&mut self,
position: LogicalPoint<f32>,
job: LayoutJob,
is_absolute_position: bool,
) {
let layout = self.fonts.layout(job, self.pixels_per_point as f32);
let primitive = TextPrimitive::new(position, layout);
self.layers.add_text(primitive, is_absolute_position);
}
/// Width of laid out text
pub fn get_text_width(&mut self, job: LayoutJob) -> i32 {
let layout = self.fonts.layout(job, self.pixels_per_point as f32);
layout.width() as i32
}
/// Text index based on where cursor is positioned within text
pub fn get_text_index_at_cursor(&mut self, job: LayoutJob, cursor: LogicalPoint<f32>) -> usize {
let layout = self.fonts.layout(job, self.pixels_per_point as f32);
layout.cursor_index(cursor)
}
}
+2 -170
View File
@@ -1,10 +1,7 @@
use crate::math::{Point, Quad, Rect, Size, Vector};
use core::f32;
use num_traits::{Float, NumCast, ToPrimitive};
use crate::math::{Point, Quad, Rect, Scale, Size, Vector};
pub struct LogicalScreenSpace;
pub struct PhysicalScreenSpace;
pub struct Normalized;
pub type LogicalPoint<T> = Point<T, LogicalScreenSpace>;
pub type LogicalVector<T> = Vector<T, LogicalScreenSpace>;
@@ -17,169 +14,4 @@ pub type PhysicalVector<T> = Vector<T, PhysicalScreenSpace>;
pub type PhysicalSize<T> = Size<T, PhysicalScreenSpace>;
pub type PhysicalRect<T> = Rect<T, PhysicalScreenSpace>;
pub type NormalizedPoint = Point<f32, Normalized>;
pub type NormalizedRect = Rect<f32, Normalized>;
pub type NormalizedQuad = Quad<f32, Normalized>;
pub trait Normalize<T, U> {
type Output<F>;
fn normalize<F: Float>(&self, size: Size<T, U>) -> Self::Output<F>;
}
impl<T, U> Normalize<T, U> for Point<T, U>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = Point<V, Normalized>;
#[inline]
fn normalize<F: Float>(&self, size: Size<T, U>) -> Self::Output<F> {
Point::new(
F::from(self.x).unwrap() / F::from(size.width).unwrap(),
F::from(self.y).unwrap() / F::from(size.height).unwrap(),
)
}
}
impl<T, U> Normalize<T, U> for Rect<T, U>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = Rect<V, Normalized>;
#[inline]
fn normalize<F: Float>(&self, size: Size<T, U>) -> Self::Output<F> {
Rect::new(self.min.normalize(size), self.max.normalize(size))
}
}
pub trait ConvertToLogical {
type Output<V>;
fn to_logical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V>;
}
pub trait ConvertToPhysical {
type Output<V>;
fn to_physical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V>;
}
#[inline]
pub fn validate_scale_factor<F: Float>(scale_factor: F) -> bool {
scale_factor.is_sign_positive() && scale_factor.is_normal()
}
impl<T> ConvertToLogical for PhysicalPoint<T>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = LogicalPoint<V>;
#[inline]
fn to_logical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V> {
assert!(validate_scale_factor(scale_factor));
let x = F::from(self.x).unwrap() / scale_factor;
let y = F::from(self.y).unwrap() / scale_factor;
LogicalPoint::new(x, y).cast()
}
}
impl<T> ConvertToLogical for PhysicalSize<T>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = LogicalSize<V>;
#[inline]
fn to_logical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V> {
assert!(validate_scale_factor(scale_factor));
let width = F::from(self.width).unwrap() / scale_factor;
let height = F::from(self.height).unwrap() / scale_factor;
LogicalSize::new(width, height).cast()
}
}
impl<T> ConvertToLogical for PhysicalRect<T>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = LogicalRect<V>;
#[inline]
fn to_logical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V> {
assert!(validate_scale_factor(scale_factor));
let min = self.min.to_logical(scale_factor);
let max = self.max.to_logical(scale_factor);
LogicalRect::new(min, max)
}
}
impl<T> ConvertToPhysical for LogicalPoint<T>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = PhysicalPoint<V>;
#[inline]
fn to_physical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V> {
assert!(validate_scale_factor(scale_factor));
let x = F::from(self.x).unwrap() * scale_factor;
let y = F::from(self.y).unwrap() * scale_factor;
PhysicalPoint::new(x, y).cast()
}
}
impl<T> ConvertToPhysical for LogicalRect<T>
where
T: Copy + std::ops::Div<Output = T> + ToPrimitive,
{
type Output<V> = PhysicalRect<V>;
#[inline]
fn to_physical<V: NumCast, F: Float>(&self, scale_factor: F) -> Self::Output<V> {
assert!(validate_scale_factor(scale_factor));
let min = self.min.to_physical(scale_factor);
let max = self.max.to_physical(scale_factor);
PhysicalRect::new(min, max)
}
}
pub trait Uv {
fn default_uv() -> Self;
fn white_uv() -> Self;
}
impl Uv for NormalizedPoint {
#[inline]
fn default_uv() -> Self {
Self::zero()
}
#[inline]
fn white_uv() -> Self {
Self::zero()
}
}
impl Uv for NormalizedRect {
#[inline]
fn default_uv() -> Self {
Self::from_size(Size::new(1.0, 1.0))
}
#[inline]
fn white_uv() -> Self {
Self::zero()
}
}
impl Uv for NormalizedQuad {
#[inline]
fn default_uv() -> Self {
Self::from_size(Size::new(1.0, 1.0))
}
#[inline]
fn white_uv() -> Self {
Self::zero()
}
}
pub type ScaleFactor<F> = Scale<F, LogicalScreenSpace, PhysicalScreenSpace>;
+179
View File
@@ -0,0 +1,179 @@
use std::{collections::BTreeMap, hash::Hasher};
use ahash::AHasher;
use crate::{
color::Srgba,
dpi::{LogicalQuad, LogicalRect, LogicalSize},
math::Size,
renderer::textures::TextureId,
uv::{UvConstructors, UvQuad, UvRect},
};
#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
pub struct DrawCommand {
pub positions: LogicalQuad<f32>,
pub uvs: UvQuad,
pub texture_id: TextureId,
pub clip_rect: LogicalRect<f32>,
pub texture_layer_idx: u32,
pub color: Srgba,
}
impl DrawCommand {
#[inline(always)]
fn hash_into<H: Hasher>(&self, state: &mut H) {
state.write(bytemuck::bytes_of(self));
}
}
#[derive(Default)]
pub struct DrawCommandRecorder {
layers: BTreeMap<(i32, i32), Vec<DrawCommand>>,
current_layer: (i32, i32),
current_viewport: LogicalRect<f32>,
current_draw_color: Srgba,
hasher: AHasher,
}
impl DrawCommandRecorder {
fn push(&mut self, cmd: DrawCommand) {
cmd.hash_into(&mut self.hasher);
self.layers.entry(self.current_layer).or_default().push(cmd);
}
pub fn reset(&mut self) {
for layer in self.layers.values_mut() {
layer.clear();
}
self.current_layer = (0, 0);
self.current_viewport = LogicalRect::from_size(Size::new(f32::INFINITY, f32::INFINITY));
self.current_draw_color = Srgba::WHITE;
self.hasher = AHasher::default();
}
pub fn set_viewport(&mut self, viewport: LogicalRect<f32>) {
self.current_viewport = viewport;
}
pub fn set_viewport_from_size(&mut self, size: LogicalSize<f32>) {
self.set_viewport(LogicalRect::from_size(size));
}
pub fn set_draw_layer(&mut self, layer: i32, sublayer: i32) {
self.current_layer = (layer, sublayer);
}
pub fn set_draw_sublayer(&mut self, sublayer: i32) {
self.set_draw_layer(self.current_layer.0, sublayer);
}
pub fn get_draw_layer(&self) -> (i32, i32) {
self.current_layer
}
pub fn set_draw_color(&mut self, color: Srgba) {
self.current_draw_color = color;
}
pub fn get_draw_color(&self) -> Srgba {
self.current_draw_color
}
pub fn draw_image(
&mut self,
rect: LogicalRect<f32>,
texture_id: Option<TextureId>,
uv: Option<UvRect>,
layer_idx: u32,
) {
let (texture_id, uvs, texture_layer_idx) = match texture_id {
Some(texture_id) => (
texture_id,
uv.map_or_else(UvQuad::full_uv, |uv_rect| uv_rect.into()),
layer_idx,
),
None => (TextureId::default(), UvQuad::white_uv(), 0),
};
let positions = rect.translate(self.current_viewport.min.to_vector());
// cull if outside of viewport
if !positions.intersects(&self.current_viewport) {
return;
}
self.push(DrawCommand {
positions: positions.into(),
uvs,
color: self.current_draw_color,
texture_id,
texture_layer_idx,
clip_rect: self.current_viewport,
});
}
pub fn draw_image_quad(
&mut self,
quad: LogicalQuad<f32>,
texture_id: Option<TextureId>,
uv: Option<UvQuad>,
layer_idx: u32,
) {
let (texture_id, uvs, texture_layer_idx) = match texture_id {
Some(texture_id) => (texture_id, uv.unwrap_or_else(UvQuad::full_uv), layer_idx),
None => (TextureId::default(), UvQuad::white_uv(), 0),
};
let positions = quad.translate(self.current_viewport.min.to_vector());
// cull if outside of viewport
if !positions.aabb_intersects_rect(&self.current_viewport) {
return;
}
self.push(DrawCommand {
positions,
uvs,
color: self.current_draw_color,
texture_id,
texture_layer_idx,
clip_rect: self.current_viewport,
});
}
pub fn draw_glyph(
&mut self,
rect: LogicalRect<f32>,
uv: UvRect,
color: Srgba,
layer_idx: u32,
is_absolute_position: bool,
) {
let positions = if is_absolute_position {
rect
} else {
rect.translate(self.current_viewport.min.to_vector())
};
// cull if outside of viewport
if !positions.intersects(&self.current_viewport) {
return;
}
self.push(DrawCommand {
positions: positions.into(),
uvs: uv.into(),
color,
// font atlas always lives at default texture ID
texture_id: TextureId::default(),
texture_layer_idx: layer_idx,
clip_rect: self.current_viewport,
});
}
pub fn finish(&self) -> (u64, &BTreeMap<(i32, i32), Vec<DrawCommand>>) {
(self.hasher.finish(), &self.layers)
}
}
+134 -191
View File
@@ -1,30 +1,32 @@
use crate::{
color::Srgba,
dpi::LogicalVector,
dpi::{PhysicalVector, ScaleFactor},
fonts::{
atlas::FontAtlas, glyph_key::SubpixelBin, layout::LayoutRow, rasterizer::GlyphRasterizer,
atlas::FontAtlas, glyph_key::SubpixelBin, layout::PositionedGlyph,
layout_cache::LayoutCache, rasterizer::GlyphRasterizer,
},
renderer::image::ImageDelta,
util::calculate_hash,
};
use ahash::HashMap;
use ordered_float::OrderedFloat;
use parley::{
FontContext, FontWeight, GenericFamily, LayoutContext, StyleProperty, TextStyle, fontique::Blob,
FontContext, FontFamily, FontFamilyName, FontWeight, GenericFamily, LayoutContext,
StyleProperty, TextStyle, fontique::Blob,
};
use std::sync::Arc;
use std::{rc::Rc, sync::Arc};
pub use atlas::FontAtlasSize;
pub use layout::{Alignment, Layout, LayoutJob};
pub use layout::{Alignment, FontStyle, Layout, LayoutJob, LayoutToLogical};
mod atlas;
mod glyph_key;
mod layout;
mod layout_cache;
mod rasterizer;
mod style_cache;
pub const BITSTREAM_VERA_SANS_MONO: &[u8] = include_bytes!("../fonts/VeraMono.ttf");
pub const LIBERATION_SANS: &[u8] = include_bytes!("../fonts/LiberationSans-Regular.ttf");
pub const LIBERATION_SANS_BOLD: &[u8] = include_bytes!("../fonts/LiberationSans-Bold.ttf");
/// Data of a .ttf or .otf file
#[derive(Clone, Debug)]
pub struct FontData {
data: std::borrow::Cow<'static, [u8]>,
}
@@ -43,13 +45,14 @@ impl AsRef<[u8]> for FontData {
}
}
pub struct FontDefinition {
pub generic_families: Vec<GenericFamily>,
pub data: Arc<FontData>,
#[derive(Clone, Debug, Default)]
pub struct FontDefinitions {
pub font_data: HashMap<String, Arc<FontData>>,
pub generic_families: HashMap<GenericFamily, Vec<String>>,
}
pub struct Fonts {
font_definitions: Vec<FontDefinition>,
definitions: FontDefinitions,
font_context: FontContext,
layout_context: LayoutContext<Srgba>,
atlas: FontAtlas,
@@ -58,66 +61,51 @@ pub struct Fonts {
}
impl Fonts {
pub fn new() -> Self {
// add fonts used by PoB
let font_definitions = vec![
FontDefinition {
generic_families: vec![GenericFamily::Monospace],
data: Arc::new(FontData::from_static(BITSTREAM_VERA_SANS_MONO)),
},
FontDefinition {
generic_families: vec![GenericFamily::SansSerif],
data: Arc::new(FontData::from_static(LIBERATION_SANS)),
},
FontDefinition {
generic_families: vec![GenericFamily::SansSerif],
data: Arc::new(FontData::from_static(LIBERATION_SANS_BOLD)),
},
];
pub fn new(definitions: FontDefinitions) -> Self {
let mut fonts = Self {
font_definitions,
definitions,
font_context: FontContext::new(),
layout_context: LayoutContext::new(),
atlas: FontAtlas::new(1024),
atlas: FontAtlas::new(1024, 1024),
glyph_rasterizer: GlyphRasterizer::new(),
layout_cache: LayoutCache::default(),
};
fonts.register_fonts();
fonts.preload_common_characters(14.0);
fonts.preload_common_characters(16.0);
fonts
}
fn register_fonts(&mut self) {
for definition in &self.font_definitions {
let blob = Blob::new(Arc::new(definition.data.data.clone()));
let registered_fonts = self.font_context.collection.register_fonts(blob, None);
for generic_family in &definition.generic_families {
self.font_context
.collection
.append_generic_families(*generic_family, registered_fonts.iter().map(|f| f.0));
}
for data in self.definitions.font_data.values() {
let blob = Blob::new(Arc::new(data.data.clone()));
self.font_context.collection.register_fonts(blob, None);
}
for (generic_family, family_fonts) in &self.definitions.generic_families {
let family_ids: Vec<_> = family_fonts
.iter()
.filter_map(|family_name| self.font_context.collection.family_id(family_name))
.collect();
self.font_context
.collection
.set_generic_families(*generic_family, family_ids.into_iter());
}
}
/// Needs to be called at beginning of each frame.
pub fn begin_frame(&mut self) {
// recreate atlas when it becomes too full or overflowed
if self.atlas.capacity() > 0.9 {
self.clear_atlas();
}
self.layout_cache.flush();
}
/// Gets changes to the font atlas texture since last call.
pub fn font_atlas_delta(&mut self) -> Option<ImageDelta> {
pub fn font_atlas_delta(&mut self) -> Vec<ImageDelta> {
self.atlas.take_delta()
}
pub fn preload_common_characters(&mut self, font_size: f32) {
/// Warms the glyph cache for common ACSII characters
pub fn preload_common_characters(&mut self, font_size: f32, scale_factor: ScaleFactor<f32>) {
const ASCII_PRINTABLE_START: u8 = 32;
const ASCII_PRINTABLE_END: u8 = 126;
@@ -128,13 +116,29 @@ impl Fonts {
common_chars.push(c as char);
}
self.preload_text(&common_chars, font_size, GenericFamily::Monospace, None);
self.preload_text(&common_chars, font_size, GenericFamily::SansSerif, None);
self.preload_text(
&common_chars,
font_size,
GenericFamily::SansSerif,
FontFamily::Single(FontFamilyName::Generic(GenericFamily::Monospace)),
None,
parley::FontStyle::Normal,
scale_factor,
);
self.preload_text(
&common_chars,
font_size,
FontFamily::Single(FontFamilyName::Generic(GenericFamily::SansSerif)),
None,
parley::FontStyle::Normal,
scale_factor,
);
self.preload_text(
&common_chars,
font_size,
FontFamily::Single(FontFamilyName::Generic(GenericFamily::SansSerif)),
Some(FontWeight::BOLD),
parley::FontStyle::Normal,
scale_factor,
);
}
@@ -142,73 +146,77 @@ impl Fonts {
&mut self,
text: &str,
font_size: f32,
generic_family: GenericFamily,
font_family: FontFamily,
font_weight: Option<FontWeight>,
font_style: parley::FontStyle,
scale_factor: ScaleFactor<f32>,
) {
profiling::scope!("preload_text");
let style = TextStyle {
font_stack: parley::FontStack::Single(parley::FontFamily::Generic(generic_family)),
font_family,
font_weight: font_weight.unwrap_or(FontWeight::NORMAL),
font_style,
font_size,
..Default::default()
};
let mut builder =
self.layout_context
.tree_builder(&mut self.font_context, 1.0, true, &style);
let mut builder = self.layout_context.tree_builder(
&mut self.font_context,
scale_factor.get(),
false,
&style,
);
builder.push_text(text);
let (mut layout, _) = builder.build();
layout.break_all_lines(None);
let (mut parley_layout, _) = builder.build();
parley_layout.break_all_lines(None);
for line in layout.lines() {
for item in line.items() {
let parley::PositionedLayoutItem::GlyphRun(run) = item else {
continue;
};
for horizontal_offset in SubpixelBin::<4>::BIN_OFFSETS {
self.glyph_rasterizer
.rasterize_glyph_run(
&mut self.atlas,
&run,
LogicalVector::new(horizontal_offset, 0.0),
1.0,
)
.for_each(|_| {});
}
for_each_glyph_run(&parley_layout, |run| {
for horizontal_offset in SubpixelBin::<4>::BIN_OFFSETS {
self.glyph_rasterizer
.rasterize_glyph_run(
&mut self.atlas,
run,
PhysicalVector::new(horizontal_offset, 0.0),
scale_factor,
)
.for_each(|_| {});
}
}
});
}
pub fn font_atlas(&self) -> &FontAtlas {
&self.atlas
}
pub fn layout(&mut self, job: LayoutJob, pixels_per_point: f32) -> Arc<Layout> {
let hash = calculate_hash(&(&job, OrderedFloat(pixels_per_point)));
pub fn layout(&mut self, job: LayoutJob, scale_factor: ScaleFactor<f32>) -> Rc<Layout> {
let hash = calculate_hash(&(&job, OrderedFloat(scale_factor.get())));
if let Some(cached_layout) = self.layout_cache.get(hash) {
return cached_layout;
}
let layout = Rc::new(self.build_layout(job, scale_factor));
self.layout_cache.insert(hash, Rc::clone(&layout));
layout
}
fn build_layout(&mut self, job: LayoutJob, scale_factor: ScaleFactor<f32>) -> Layout {
let default_style = TextStyle::default();
let style = TextStyle {
font_stack: parley::FontStack::Single(parley::FontFamily::Generic(job.font_family)),
font_family: job.font_family,
font_size: job.font_size.into(),
line_height: parley::LineHeight::Absolute(job.line_height.into()),
font_weight: job
.font_weight
.map(|w| parley::FontWeight::new(w.into()))
.unwrap_or(default_style.font_weight),
font_weight: job.font_weight.map_or(default_style.font_weight, |w| {
parley::FontWeight::new(w.into())
}),
font_style: job.font_style.into(),
..default_style
};
// scale factor is passed to builder so coordinates in resulting layout will be physical
let mut builder = self.layout_context.tree_builder(
&mut self.font_context,
1.0,
// TODO: quantize true or false?
true,
scale_factor.get(),
false,
&style,
);
@@ -222,118 +230,53 @@ impl Fonts {
let (mut parley_layout, _) = builder.build();
parley_layout.break_all_lines(None);
// extra offset applied to each glyph to get position relative to layout origin
let mut glyph_offset = LogicalVector::new(0.0, 0.0);
if let Some(alignment) = job.alignment {
let alignment = match alignment {
let parley_alignment = match alignment {
Alignment::Min => parley::Alignment::Start,
Alignment::Center => {
glyph_offset.x += -parley_layout.full_width() * 0.5;
parley::Alignment::Center
}
Alignment::Max => {
glyph_offset.x += -parley_layout.full_width();
parley::Alignment::End
}
Alignment::Center => parley::Alignment::Center,
Alignment::Max => parley::Alignment::End,
};
parley_layout.align(None, alignment, parley::AlignmentOptions::default());
parley_layout.align(parley_alignment, parley::AlignmentOptions::default());
}
let mut layout_rows = Vec::new();
let mut num_of_vertices = 0;
let mut num_of_indices = 0;
let mut glyphs = Vec::new();
for line in parley_layout.lines() {
let mut layout_row = LayoutRow::default();
for item in line.items() {
let parley::PositionedLayoutItem::GlyphRun(run) = item else {
continue;
};
for rasterized_glyph in self.glyph_rasterizer.rasterize_glyph_run(
&mut self.atlas,
&run,
glyph_offset,
pixels_per_point,
) {
let Some(glyph) = rasterized_glyph else {
continue;
};
layout_row.glyphs.push(glyph);
num_of_vertices += 4;
num_of_indices += 6;
}
for_each_glyph_run(&parley_layout, |run| {
for rasterized in self.glyph_rasterizer.rasterize_glyph_run(
&mut self.atlas,
run,
PhysicalVector::zero(),
scale_factor,
) {
let Some(glyph) = rasterized else { continue };
glyphs.push(PositionedGlyph {
rect: glyph.rect,
uv: glyph.uv,
layer_idx: glyph.texture_layer_idx,
color: glyph.color,
});
}
if !layout_row.glyphs.is_empty() {
layout_rows.push(layout_row);
}
}
let layout = Arc::new(Layout {
job_hash: hash,
parley_layout,
rows: layout_rows,
num_of_vertices,
num_of_indices,
});
self.layout_cache.insert(hash, Arc::clone(&layout));
layout
}
/// Clear atlas and invalidate caches depend on atlas state
fn clear_atlas(&mut self) {
self.atlas.clear();
self.glyph_rasterizer.clear();
self.layout_cache.clear();
}
}
struct CachedLayout {
generation: u32,
layout: Arc<Layout>,
}
#[derive(Default)]
struct LayoutCache {
current_generation: u32,
cache: nohash_hasher::IntMap<u64, CachedLayout>,
}
impl LayoutCache {
fn get(&mut self, hash: u64) -> Option<Arc<Layout>> {
match self.cache.entry(hash) {
std::collections::hash_map::Entry::Occupied(entry) => {
let cached = entry.into_mut();
cached.generation = self.current_generation;
Some(Arc::clone(&cached.layout))
}
std::collections::hash_map::Entry::Vacant(_) => None,
Layout {
// full_width is physical so it needs to be converted back to logical
width: parley_layout.full_width() / scale_factor.get(),
glyphs,
parley_layout,
}
}
}
fn insert(&mut self, hash: u64, layout: Arc<Layout>) {
self.cache.insert(
hash,
CachedLayout {
generation: self.current_generation,
layout,
},
);
}
/// Removes unused layouts
pub fn flush(&mut self) {
self.cache
.retain(|_key, cached| cached.generation == self.current_generation);
self.current_generation = self.current_generation.wrapping_add(1);
}
pub fn clear(&mut self) {
self.cache.clear();
/// Applies a function to each glyph run in a `parley::Layout`
fn for_each_glyph_run<'a>(
layout: &'a parley::Layout<Srgba>,
mut f: impl FnMut(&parley::GlyphRun<'a, Srgba>),
) {
for line in layout.lines() {
for item in line.items() {
if let parley::PositionedLayoutItem::GlyphRun(run) = item {
f(&run);
}
}
}
}
+177 -89
View File
@@ -1,137 +1,225 @@
use std::num::NonZeroU32;
use crate::{
color::Srgba,
math::{Point, Rect, Size},
dpi::PhysicalSize,
math::{Point, Rect, Scale, Size},
renderer::{
image::{ImageData, ImageDelta},
image::{DataOrder, ImageData, ImageDelta, MipStrategy, PartialDeltaOrigin},
textures::TextureOptions,
},
uv::{UvRect, UvSpace},
};
use image::{GenericImage, RgbaImage, SubImage, imageops};
use image::{GenericImage, RgbaImage, SubImage};
pub struct FontAtlasSpace;
pub type FontAtlasPoint = Point<u32, FontAtlasSpace>;
pub type FontAtlasSize = Size<u32, FontAtlasSpace>;
pub type FontAtlasRect = Rect<u32, FontAtlasSpace>;
pub struct FontAtlas {
// max width/height of atlas texture
max_texture_side: u32,
pub struct AllocatedGlyph<'a> {
pub sub_image: SubImage<&'a mut RgbaImage>,
pub layer_idx: u32,
pub uv: UvRect,
}
struct Layer {
image: RgbaImage,
// position of next allocation
/// Position of next allocation
cursor: FontAtlasPoint,
current_row_height: u32,
// atlas has been altered and needs to be reuploaded to the GPU
// TODO: only mark changed region as dirty and perform partial texture update
dirty: bool,
// atlas has overflowed and needs to be recreated
overflowed: bool,
/// Dirty region
dirty: FontAtlasRect,
}
pub struct FontAtlas {
layer_size: FontAtlasSize,
// maximum amount of layers
max_layers: u32,
layers: Vec<Layer>,
// used to convert to normalized UV coordinates
to_uv: Scale<f32, FontAtlasSpace, UvSpace>,
/// Set when a full texture upload is required
needs_full_update: bool,
}
impl FontAtlas {
pub fn new(max_texture_side: u32) -> Self {
// start out with maximum width and let height grow as needed
let width = max_texture_side;
let initial_height = 256;
pub fn new(layer_size: u32, max_layers: u32) -> Self {
let mut atlas = Self {
max_texture_side,
image: RgbaImage::new(width, initial_height),
cursor: FontAtlasPoint::zero(),
current_row_height: 0,
dirty: false,
overflowed: false,
layer_size: Size::new(layer_size, layer_size),
max_layers,
layers: Vec::new(),
to_uv: Scale::new(1.0 / layer_size as f32),
needs_full_update: false,
};
atlas.push_layer();
atlas.initialize();
atlas
}
fn initialize(&mut self) {
// Puts white pixel at (0, 0).
// NOTE: Rendering a solid color shape is done by setting the texture to
// the font atlas and sampling the white pixel at (0, 0).
let mut sub_image = self.allocate(FontAtlasSize::new(1, 1));
sub_image.put_pixel(0, 0, Srgba::WHITE.into());
/// Adds a new empty layer
fn push_layer(&mut self) {
self.layers.push(Layer {
image: RgbaImage::new(self.layer_size.width, self.layer_size.height),
cursor: FontAtlasPoint::zero(),
current_row_height: 0,
dirty: FontAtlasRect::zero(),
});
// adding a new layer requires a full texture re-allocation
self.needs_full_update = true;
}
// TODO: use an actual bin packing algorithm for tighter packing
/// Returns a mutable view into the atlas of given size.
pub fn allocate(&mut self, size: FontAtlasSize) -> SubImage<&mut RgbaImage> {
/// Initializes the atlas.
///
/// Puts a white pixel at (0, 0) of layer 0 for solid color texturing.
fn initialize(&mut self) {
let mut allocation = self.allocate(FontAtlasSize::new(1, 1));
allocation.sub_image.put_pixel(0, 0, Srgba::WHITE.into());
}
/// Allocates a new glyph
fn allocate(&mut self, requested_size: FontAtlasSize) -> AllocatedGlyph<'_> {
const PADDING: u32 = 1;
if self.cursor.x + size.width > self.image.width() {
self.cursor.x = 0;
self.cursor.y += self.current_row_height + PADDING;
self.current_row_height = 0;
}
let mut idx = self.layers.len() - 1;
self.current_row_height = self.current_row_height.max(size.height);
{
let layer = &mut self.layers[idx];
let required_atlas_height = self.cursor.y + self.current_row_height;
if required_atlas_height > self.max_texture_side {
log::warn!("font atlas overflowed!");
// start overwriting old glyphs
self.cursor = Point::new(0, self.image.height() / 3);
// setting this flag causes atlas to be recreated next frame
self.overflowed = true;
} else if required_atlas_height > self.image().height() {
// increase height
let mut new_height = self.image.height();
while new_height < required_atlas_height {
new_height *= 2;
// start new row if new allocation doesn't fit on current row
if layer.cursor.x + requested_size.width > self.layer_size.width {
layer.cursor.x = 0;
layer.cursor.y += layer.current_row_height + PADDING;
layer.current_row_height = 0;
}
// add new layer if new allocation doesn't fit on current layer
if layer.cursor.y + requested_size.height > self.layer_size.height {
if (self.layers.len() as u32) < self.max_layers {
self.push_layer();
idx = self.layers.len() - 1;
} else {
// just choose a sufficiently large layer size and count to
// avoid panic. a more sophisticated approach can be implemented
// later if needed
panic!("font atlas reached maximum size!");
}
}
self.image = extend_image_height(&self.image, new_height, Srgba::TRANSPARENT);
}
let pos = self.cursor;
self.cursor.x += size.width + PADDING;
let layer = &mut self.layers[idx];
layer.current_row_height = layer.current_row_height.max(requested_size.height);
let pos = layer.cursor;
layer.cursor.x += requested_size.width + PADDING;
self.dirty = true;
let glyph_rect = FontAtlasRect::from_origin_and_size(pos, requested_size);
let uv = self.to_uv.transform_box2d(&glyph_rect.cast());
self.image.sub_image(pos.x, pos.y, size.width, size.height)
// extend dirty region to include new glyph allocation
layer.dirty = layer.dirty.union(&glyph_rect);
AllocatedGlyph {
sub_image: layer.image.sub_image(
pos.x,
pos.y,
requested_size.width,
requested_size.height,
),
layer_idx: idx as u32,
uv,
}
}
pub fn take_delta(&mut self) -> Option<ImageDelta> {
let dirty = std::mem::replace(&mut self.dirty, false);
if dirty {
Some(ImageDelta::new(
ImageData::from(self.image.clone()),
pub fn take_delta(&mut self) -> Vec<ImageDelta> {
// first check if full update is required
if std::mem::replace(&mut self.needs_full_update, false) {
let mut bytes = Vec::with_capacity(
self.layers.len() * (self.layer_size.width * self.layer_size.height * 4) as usize,
);
for layer in &mut self.layers {
bytes.extend_from_slice(layer.image.as_raw());
// reset layer's dirty region since we're doing a full update anyway
layer.dirty = FontAtlasRect::zero();
}
return vec![ImageDelta::full(
ImageData {
format: wgpu::TextureFormat::Rgba8Unorm,
width: self.layer_size.width,
height: self.layer_size.height,
array_layers: self.layers.len() as u32,
mipmap_count: NonZeroU32::new(1).expect("1 is non-zero"),
data_order: DataOrder::default(),
bytes,
},
TextureOptions::LINEAR,
))
} else {
None
MipStrategy::None,
)];
}
}
pub fn capacity(&self) -> f32 {
if self.overflowed {
1.0
} else {
(self.cursor.y + self.current_row_height) as f32 / self.max_texture_side as f32
// add partial update for each dirty layer
let mut partial_updates = Vec::new();
for (i, layer) in self.layers.iter_mut().enumerate() {
let dirty = std::mem::replace(&mut layer.dirty, FontAtlasRect::zero());
if dirty.is_empty() {
continue;
}
let bytes = layer
.image
.sub_image(dirty.min.x, dirty.min.y, dirty.width(), dirty.height())
.to_image()
.into_vec();
partial_updates.push(ImageDelta::partial(
ImageData {
format: wgpu::TextureFormat::Rgba8Unorm,
width: dirty.width(),
height: dirty.height(),
array_layers: 1,
mipmap_count: NonZeroU32::new(1).expect("1 is non-zero"),
data_order: DataOrder::default(),
bytes,
},
PartialDeltaOrigin {
x: dirty.min.x,
y: dirty.min.y,
layer: i as u32,
},
));
}
partial_updates
}
pub fn clear(&mut self) {
self.image.fill(0);
self.cursor = FontAtlasPoint::zero();
self.current_row_height = 0;
self.dirty = false;
self.overflowed = false;
self.initialize();
}
pub fn write_mask(
&mut self,
image: &swash::scale::image::Image,
) -> (PhysicalSize<u32>, UvRect, u32) {
debug_assert!(matches!(image.content, swash::scale::image::Content::Mask));
pub fn image(&self) -> &RgbaImage {
&self.image
}
let size = Size::new(image.placement.width, image.placement.height);
let mut allocation = self.allocate(size);
pub fn size(&self) -> FontAtlasSize {
FontAtlasSize::new(self.image.width(), self.image.height())
let mut i = 0;
for y in 0..size.height {
for x in 0..size.width {
let a = image.data[i];
// SAFETY: allocated atlas region and swash image have the same size
unsafe {
allocation.sub_image.unsafe_put_pixel(
x,
y,
Srgba::new(255, 255, 255, a).into(),
);
}
i += 1;
}
}
(size.cast_unit(), allocation.uv, allocation.layer_idx)
}
}
fn extend_image_height(image: &RgbaImage, new_height: u32, fill_color: Srgba) -> RgbaImage {
let width = image.width();
let mut extended_image = RgbaImage::from_pixel(width, new_height, fill_color.into());
imageops::overlay(&mut extended_image, image, 0, 0);
extended_image
}
+11 -17
View File
@@ -1,36 +1,30 @@
use ordered_float::OrderedFloat;
use parley::Glyph;
use crate::{dpi::PhysicalPoint, fonts::rasterizer::StyleId};
use crate::{dpi::PhysicalPoint, fonts::style_cache::StyleId};
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct GlyphKey {
glyph_id: swash::GlyphId,
style_id: StyleId,
x_bin: SubpixelBin<4>,
pixels_per_point: OrderedFloat<f32>,
}
impl GlyphKey {
pub fn from_glyph(
glyph: &Glyph,
pub fn from_position(
position: PhysicalPoint<f32>,
glyph_id: u32,
style_id: StyleId,
pixels_per_point: f32,
) -> (Self, PhysicalPoint<i32>) {
// Use subpixel binning for x coordinate
let (x, x_bin) = SubpixelBin::<4>::new(glyph.x * pixels_per_point);
// No binning for y coordinate, just rounding
let y = (glyph.y * pixels_per_point).round() as i32;
let glyph_pos = PhysicalPoint::new(x, y);
// x: use subpixel binning so bitmap encodes sub-pixel position
let (x, x_bin) = SubpixelBin::<4>::new(position.x);
// y: just rounded. not much benefit from sub-pixel vertical positioning
let y = position.y.round() as i32;
(
Self {
glyph_id: glyph.id as u16,
glyph_id: glyph_id as u16,
style_id,
x_bin,
pixels_per_point: OrderedFloat(pixels_per_point),
},
glyph_pos,
PhysicalPoint::new(x, y),
)
}
@@ -72,7 +66,7 @@ impl<const NUM_OF_BINS: usize> SubpixelBin<NUM_OF_BINS> {
#[test]
fn test_subpixel_bins() {
assert_eq!(SubpixelBin::<4>::new(3.14), (3, SubpixelBin(1)));
assert_eq!(SubpixelBin::<4>::new(3.13), (3, SubpixelBin(1)));
assert_eq!(SubpixelBin::<4>::new(0.11), (0, SubpixelBin(0)));
assert_eq!(SubpixelBin::<4>::new(-0.8), (-1, SubpixelBin(1)));
assert_eq!(SubpixelBin::<2>::new(0.24), (0, SubpixelBin(0)));
+89 -22
View File
@@ -1,37 +1,68 @@
use crate::{color::Srgba, dpi::LogicalPoint, fonts::rasterizer::RasterizedGlyph};
use crate::{
color::Srgba,
dpi::{LogicalPoint, LogicalScreenSpace, LogicalVector},
math::{Rect, Translation},
uv::UvRect,
};
use ordered_float::OrderedFloat;
use parley::GenericFamily;
use parley::{FontFamily, FontFamilyName};
#[derive(Copy, Clone, Debug, Hash)]
// All coordinates relative to layout origin
pub struct LayoutSpace;
pub type LayoutRect<T> = Rect<T, LayoutSpace>;
pub type LayoutToLogical = Translation<f32, LayoutSpace, LogicalScreenSpace>;
#[derive(Copy, Clone, Default, Debug, Hash, Eq, PartialEq)]
pub enum Alignment {
#[default]
Min,
Center,
Max,
}
#[derive(Copy, Clone, Default, Debug, Hash, Eq, PartialEq)]
pub enum FontStyle {
#[default]
Normal,
Italic,
}
impl From<FontStyle> for parley::FontStyle {
fn from(value: FontStyle) -> Self {
match value {
FontStyle::Normal => Self::Normal,
FontStyle::Italic => Self::Italic,
}
}
}
#[derive(Clone, Debug, Hash)]
pub struct LayoutSegment<'s> {
pub text: &'s str,
pub color: Srgba,
}
#[derive(Clone, Debug, Hash)]
#[derive(Clone, Debug)]
pub struct LayoutJob<'s> {
pub segments: Vec<LayoutSegment<'s>>,
pub font_family: GenericFamily,
pub font_family: FontFamily<'static>,
pub font_size: OrderedFloat<f32>,
pub line_height: OrderedFloat<f32>,
pub alignment: Option<Alignment>,
pub font_weight: Option<OrderedFloat<f32>>,
pub font_style: FontStyle,
}
impl<'s> LayoutJob<'s> {
pub fn new(
font_family: GenericFamily,
font_family: FontFamily<'static>,
font_size: f32,
line_height: f32,
alignment: Option<Alignment>,
font_weight: Option<f32>,
font_style: FontStyle,
) -> Self {
Self {
segments: Vec::new(),
@@ -40,6 +71,7 @@ impl<'s> LayoutJob<'s> {
line_height: line_height.into(),
alignment,
font_weight: font_weight.map(OrderedFloat),
font_style,
}
}
@@ -48,33 +80,68 @@ impl<'s> LayoutJob<'s> {
}
}
#[derive(Default)]
pub struct LayoutRow {
pub glyphs: Vec<RasterizedGlyph>,
impl std::hash::Hash for LayoutJob<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.segments.hash(state);
match &self.font_family {
FontFamily::Single(FontFamilyName::Named(cow)) | FontFamily::Source(cow) => {
cow.hash(state);
}
FontFamily::Single(FontFamilyName::Generic(generic_family)) => {
generic_family.hash(state);
}
FontFamily::List(cow) => {
for name in cow.iter() {
match name {
FontFamilyName::Named(cow) => {
cow.hash(state);
}
FontFamilyName::Generic(generic_family) => {
generic_family.hash(state);
}
}
}
}
}
self.font_size.hash(state);
self.line_height.hash(state);
self.alignment.hash(state);
self.font_weight.hash(state);
self.font_style.hash(state);
}
}
pub struct PositionedGlyph {
pub rect: LayoutRect<f32>,
pub uv: UvRect,
pub layer_idx: u32,
pub color: Srgba,
}
pub struct Layout {
pub job_hash: u64,
pub glyphs: Vec<PositionedGlyph>,
pub width: f32,
// kept for parley's cursor helper.
pub parley_layout: parley::Layout<Srgba>,
pub rows: Vec<LayoutRow>,
pub num_of_vertices: usize,
pub num_of_indices: usize,
}
impl Layout {
pub fn width(&self) -> f32 {
self.parley_layout.full_width()
self.width
}
/// Returns text index at cursor position
pub fn cursor_index(&self, cursor: LogicalPoint<f32>) -> usize {
let cursor = parley::Cursor::from_point(&self.parley_layout, cursor.x, cursor.y);
cursor.index()
pub fn anchor_offset(&self, anchor: Alignment) -> LogicalVector<f32> {
match anchor {
Alignment::Min => LogicalVector::zero(),
Alignment::Center => LogicalVector::new(-self.width * 0.5, 0.0),
Alignment::Max => LogicalVector::new(-self.width, 0.0),
}
}
}
impl std::hash::Hash for Layout {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.job_hash.hash(state);
pub fn cursor_index_at(&self, point: LogicalPoint<f32>) -> usize {
// `parley_layout` was built at the real display scale factor so its internal coordinates
// are physical. Scale the query point to match.
let scale = self.parley_layout.scale();
parley::Cursor::from_point(&self.parley_layout, point.x * scale, point.y * scale).index()
}
}
+45
View File
@@ -0,0 +1,45 @@
use std::rc::Rc;
use crate::fonts::Layout;
struct CachedLayout {
layout: Rc<Layout>,
// used to identify unused layouts
generation: u32,
}
#[derive(Default)]
pub struct LayoutCache {
cache: nohash_hasher::IntMap<u64, CachedLayout>,
current_generation: u32,
}
impl LayoutCache {
pub fn get(&mut self, hash: u64) -> Option<Rc<Layout>> {
match self.cache.entry(hash) {
std::collections::hash_map::Entry::Occupied(entry) => {
let cached = entry.into_mut();
cached.generation = self.current_generation;
Some(Rc::clone(&cached.layout))
}
std::collections::hash_map::Entry::Vacant(_) => None,
}
}
pub fn insert(&mut self, hash: u64, layout: Rc<Layout>) {
self.cache.insert(
hash,
CachedLayout {
generation: self.current_generation,
layout,
},
);
}
/// Removes unused layouts
pub fn flush(&mut self) {
self.cache
.retain(|_key, cached| cached.generation == self.current_generation);
self.current_generation = self.current_generation.wrapping_add(1);
}
}
+90 -170
View File
@@ -1,93 +1,41 @@
use crate::{
color::Srgba,
dpi::{
ConvertToLogical, LogicalRect, LogicalVector, PhysicalPoint, PhysicalRect, PhysicalVector,
},
fonts::{
atlas::{FontAtlas, FontAtlasRect},
glyph_key::GlyphKey,
},
math::{Point, Size},
dpi::{PhysicalPoint, PhysicalRect, PhysicalSize, PhysicalVector, ScaleFactor},
fonts::{atlas::FontAtlas, glyph_key::GlyphKey, layout::LayoutRect, style_cache::StyleCache},
uv::UvRect,
};
use ahash::HashMap;
use image::GenericImage;
use ordered_float::OrderedFloat;
use parley::{FontData, GlyphRun};
use std::borrow::Cow;
use swash::zeno;
type FontBlobId = u64;
type FontIndex = u32;
type SwashFontOffset = u32;
pub type StyleId = u32;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct StyleKey<'a> {
font_blob_id: FontBlobId,
font_size: OrderedFloat<f32>,
normalized_coords: Cow<'a, [i16]>,
}
impl<'a> StyleKey<'a> {
fn new(font_blob_id: FontBlobId, font_size: f32, normalized_coords: &'a [i16]) -> Self {
Self {
font_blob_id,
font_size: font_size.into(),
normalized_coords: Cow::Borrowed(normalized_coords),
}
}
fn to_static(&self) -> StyleKey<'static> {
StyleKey {
normalized_coords: self.normalized_coords.clone().into_owned().into(),
..*self
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CachedGlyph {
// absolute uv rect within font atlas
pub uv: FontAtlasRect,
// offset from top/left to baseline
/// Size of the trimmed bitmap. Swash crops away transparant rows/columns so this is smaller
/// than the glyph's full advance box.
pub size: PhysicalSize<u32>,
pub uv: UvRect,
pub texture_layer_idx: u32,
/// Offset from the glyph's origin (top-left) to the trimmed bitmap's top-left corner.
pub baseline_offset: PhysicalVector<i32>,
}
pub struct RasterizedGlyph {
// NOTE: this is relative to the layout origin
pub rect: LogicalRect<f32>,
pub uv: FontAtlasRect,
pub rect: LayoutRect<f32>,
pub uv: UvRect,
pub texture_layer_idx: u32,
pub color: Srgba,
}
impl RasterizedGlyph {
fn from_cached(
cached: CachedGlyph,
position: PhysicalPoint<i32>,
color: Srgba,
pixels_per_point: f32,
) -> Self {
let glyph_rect = PhysicalRect::from_origin_and_size(
position + cached.baseline_offset,
cached.uv.cast_unit().cast().size(),
);
RasterizedGlyph {
rect: glyph_rect.to_logical(pixels_per_point),
uv: cached.uv,
color,
}
}
}
pub struct GlyphRasterizer {
scale_context: swash::scale::ScaleContext,
swash_keys: HashMap<(FontBlobId, FontIndex), (SwashFontOffset, swash::CacheKey)>,
// Style properties (font, size, etc.) are the same for each glyph run and don't
// need to be part of each glyph key. Instead, associate each style with its own
// ID and include that in the glyph key.
style_ids: HashMap<StyleKey<'static>, StyleId>,
next_style_id: StyleId,
style_cache: StyleCache,
cached_glyphs: HashMap<GlyphKey, Option<CachedGlyph>>,
// scratch image buffer used to write bitmap data into
/// Scratch image buffer used to temporarily write bitmap data into
scratch: swash::scale::image::Image,
}
@@ -95,22 +43,14 @@ impl GlyphRasterizer {
pub fn new() -> Self {
Self {
scale_context: swash::scale::ScaleContext::new(),
swash_keys: Default::default(),
style_ids: Default::default(),
next_style_id: 0,
cached_glyphs: Default::default(),
scratch: Default::default(),
swash_keys: HashMap::default(),
style_cache: StyleCache::default(),
cached_glyphs: HashMap::default(),
scratch: swash::scale::image::Image::default(),
}
}
pub fn clear(&mut self) {
self.swash_keys.clear();
self.style_ids.clear();
self.next_style_id = 0;
self.cached_glyphs.clear();
}
/// Gets a swash::FontRef from FontData
/// Gets a [`swash::FontRef`] from [`FontData`]
fn get_font_ref<'a>(&mut self, font: &'a FontData) -> swash::FontRef<'a> {
let font_blob_id = font.data.id();
@@ -130,43 +70,31 @@ impl GlyphRasterizer {
}
}
fn get_style_id(
&mut self,
font_data: &FontData,
font_size: f32,
norm_coords: &[i16],
) -> StyleId {
let style_key = StyleKey::new(font_data.data.id(), font_size, norm_coords);
match self.style_ids.get(&style_key) {
Some(key) => *key,
None => *self
.style_ids
.entry(style_key.to_static())
.or_insert_with(|| {
let id = self.next_style_id;
self.next_style_id += 1;
id
}),
}
}
/// Rasterizes glyph run and returns the placement and UV for each glyph.
/// Can return `None` if glyph doesn't take up any space (e.g. whitespace).
/// Rasterizes a glyph run and returns the placement and UV for each glyph.
/// Returns `None` for glyphs that doesn't take up visible space (e.g. whitespace).
pub fn rasterize_glyph_run<'slf: 'run, 'run, 'atlas>(
&'slf mut self,
atlas: &'atlas mut FontAtlas,
glyph_run: &'run GlyphRun<'_, Srgba>,
// additional offset relative to layout origin
glyph_offset: LogicalVector<f32>,
pixels_per_point: f32,
// additional offset applied to every glyph's raw parley position before quantization
offset: PhysicalVector<f32>,
scale_factor: ScaleFactor<f32>,
) -> impl Iterator<Item = Option<RasterizedGlyph>> + use<'slf, 'run, 'atlas> {
let run = glyph_run.run();
let color = glyph_run.style().brush;
let font_size = run.font_size() * pixels_per_point;
let normalized_coords = run.normalized_coords();
let font_size = run.font_size();
let normalized_coords =
&Vec::from_iter(run.normalized_coords().iter().map(|c| c.to_bits()));
let skew = run.synthesis().skew(); // skew angle for faux italic
let font_ref = self.get_font_ref(run.font());
let style_id = self.get_style_id(run.font(), font_size, normalized_coords);
let style_id = self.style_cache.get_or_insert(
run.font().data.id(),
font_size,
normalized_coords,
// parley stores skew as i8 internally so this conversion is ok
skew.unwrap_or_default() as i8,
);
let mut scaler = self
.scale_context
@@ -178,76 +106,68 @@ impl GlyphRasterizer {
let image = &mut self.scratch;
let cached_glyphs = &mut self.cached_glyphs;
glyph_run.positioned_glyphs().map(move |mut glyph| {
glyph.x += glyph_offset.x;
glyph.y += glyph_offset.y;
let (glyph_key, glyph_pos) = GlyphKey::from_glyph(&glyph, style_id, pixels_per_point);
glyph_run.positioned_glyphs().map(move |glyph| {
let glyph_position = PhysicalPoint::new(glyph.x, glyph.y) + offset;
if let Some(cached_glyph) = cached_glyphs.get(&glyph_key) {
return cached_glyph.map(|cached| {
RasterizedGlyph::from_cached(cached, glyph_pos, color, pixels_per_point)
});
}
let (glyph_key, physical_position) =
GlyphKey::from_position(glyph_position, glyph.id, style_id);
let fract_offset = glyph_key.get_fractional_offset();
let cached = *cached_glyphs.entry(glyph_key).or_insert_with(|| {
rasterize_glyph(&mut scaler, image, atlas, glyph.id, &glyph_key, skew)
});
image.clear();
let did_render = swash::scale::Render::new(&[
swash::scale::Source::ColorOutline(0),
swash::scale::Source::ColorBitmap(swash::scale::StrikeWith::BestFit),
swash::scale::Source::Outline,
])
.format(swash::zeno::Format::Alpha)
.offset(fract_offset)
.render_into(&mut scaler, glyph.id as u16, image);
cached.map(|cached| {
// apply the baseline offset to get the actual bitmap position
let bitmap_top_left = physical_position + cached.baseline_offset;
let physical_rect =
PhysicalRect::from_origin_and_size(bitmap_top_left, cached.size.cast());
if !did_render || image.placement.width == 0 || image.placement.height == 0 {
cached_glyphs.insert(glyph_key, None);
return None;
};
let atlas_region = write_to_atlas(image, atlas);
let cached_glyph = CachedGlyph {
uv: atlas_region,
baseline_offset: PhysicalVector::new(image.placement.left, -image.placement.top),
};
cached_glyphs.insert(glyph_key, Some(cached_glyph));
Some(RasterizedGlyph::from_cached(
cached_glyph,
glyph_pos,
color,
pixels_per_point,
))
RasterizedGlyph {
rect: (physical_rect.cast() / scale_factor).cast_unit(),
uv: cached.uv,
texture_layer_idx: cached.texture_layer_idx,
color,
}
})
})
}
}
/// Writes rasterized glyph to atlas and returns region it wrote into
fn write_to_atlas(image: &swash::scale::image::Image, atlas: &mut FontAtlas) -> FontAtlasRect {
let mut atlas_region = atlas.allocate(Size::new(image.placement.width, image.placement.height));
/// Renders glyph's bitmap into the atlas
fn rasterize_glyph(
scaler: &mut swash::scale::Scaler,
image: &mut swash::scale::image::Image,
atlas: &mut FontAtlas,
glyph_id: u32,
glyph_key: &GlyphKey,
skew: Option<f32>,
) -> Option<CachedGlyph> {
image.clear();
match image.content {
swash::scale::image::Content::Mask => {
let mut i = 0;
for y in 0..image.placement.height {
for x in 0..image.placement.width {
let a = image.data[i];
// SAFETY: allocated atlas region and swash image have the same size
unsafe {
atlas_region.unsafe_put_pixel(x, y, Srgba::new(255, 255, 255, a).into())
};
i += 1;
}
}
}
_ => unreachable!(),
};
FontAtlasRect::from_origin_and_size(
Point::new(atlas_region.offsets().0, atlas_region.offsets().1),
Size::new(image.placement.width, image.placement.height),
let did_render = swash::scale::Render::new(&[
swash::scale::Source::ColorOutline(0),
swash::scale::Source::ColorBitmap(swash::scale::StrikeWith::BestFit),
swash::scale::Source::Outline,
])
.format(zeno::Format::Alpha)
.transform(
skew.map(|skew| zeno::Transform::skew(zeno::Angle::from_degrees(skew), zeno::Angle::ZERO)),
)
.offset(glyph_key.get_fractional_offset())
.render_into(scaler, glyph_id as u16, image);
if !did_render || image.placement.width == 0 || image.placement.height == 0 {
return None;
}
let (size, uv, layer_idx) = atlas.write_mask(image);
Some(CachedGlyph {
size,
uv,
texture_layer_idx: layer_idx,
// swash uses `Origin::BottomLeft` so we need to negate the vertical component
baseline_offset: PhysicalVector::new(image.placement.left, -image.placement.top),
})
}
+60
View File
@@ -0,0 +1,60 @@
use ahash::HashMap;
use ordered_float::OrderedFloat;
use std::borrow::Cow;
pub type StyleId = u32;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct StyleKey<'a> {
font_blob_id: u64,
font_size: OrderedFloat<f32>,
normalized_coords: Cow<'a, [i16]>,
skew: i8,
}
impl<'a> StyleKey<'a> {
fn new(font_blob_id: u64, font_size: f32, normalized_coords: &'a [i16], skew: i8) -> Self {
Self {
font_blob_id,
font_size: font_size.into(),
normalized_coords: Cow::Borrowed(normalized_coords),
skew,
}
}
fn to_static(&self) -> StyleKey<'static> {
StyleKey {
normalized_coords: self.normalized_coords.clone().into_owned().into(),
..*self
}
}
}
/// Associates font style combinations (font, size, norm coords, skew) with a small `StyleId`, so
/// `GlyphKey` never has to compare full style data per glyph, just once per run.
#[derive(Default)]
pub struct StyleCache {
ids: HashMap<StyleKey<'static>, StyleId>,
next_id: StyleId,
}
impl StyleCache {
pub fn get_or_insert(
&mut self,
font_blob_id: u64,
font_size: f32,
normalized_coords: &[i16],
skew: i8,
) -> StyleId {
let key = StyleKey::new(font_blob_id, font_size, normalized_coords, skew);
if let Some(id) = self.ids.get(&key) {
return *id;
}
let id = self.next_id;
self.next_id += 1;
self.ids.insert(key.to_static(), id);
id
}
}
+50 -32
View File
@@ -1,8 +1,14 @@
use crate::{context::RenderJob, dpi::PhysicalSize, renderer::Renderer};
use crate::{
dpi::PhysicalSize,
renderer::{RenderJob, Renderer},
};
use std::sync::Arc;
use wgpu::{Texture, TextureFormat, TextureView};
use winit::window::Window;
const REQUIRED_TEXTURE_LAYERS: u32 = 1024;
const REQUIRED_TEXTURE_ARRAY_SLOTS: u32 = 64;
pub struct GraphicsContext {
surface: wgpu::Surface<'static>,
device: wgpu::Device,
@@ -20,9 +26,12 @@ impl GraphicsContext {
pub async fn new(window: Arc<Window>) -> anyhow::Result<Self> {
let size = window.inner_size();
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY,
..Default::default()
flags: Default::default(),
memory_budget_thresholds: Default::default(),
backend_options: Default::default(),
display: None,
});
let surface = instance.create_surface(Arc::clone(&window)).unwrap();
@@ -32,12 +41,17 @@ impl GraphicsContext {
power_preference: wgpu::PowerPreference::default(),
compatible_surface: Some(&surface),
force_fallback_adapter: false,
apply_limit_buckets: true,
})
.await?;
let required_features = wgpu::Features::TEXTURE_COMPRESSION_BC;
let required_features = wgpu::Features::TEXTURE_COMPRESSION_BC
| wgpu::Features::TEXTURE_BINDING_ARRAY
| wgpu::Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING;
let required_limits = wgpu::Limits {
max_texture_array_layers: 512,
max_texture_array_layers: REQUIRED_TEXTURE_LAYERS,
max_binding_array_elements_per_shader_stage: REQUIRED_TEXTURE_ARRAY_SLOTS,
max_binding_array_sampler_elements_per_shader_stage: REQUIRED_TEXTURE_ARRAY_SLOTS,
..Default::default()
};
@@ -84,7 +98,7 @@ impl GraphicsContext {
let surface_format = surface_caps
.formats
.iter()
.find(|f| !f.is_srgb())
.find(|f| !f.is_srgb() && f.required_features().is_empty())
.copied()
.unwrap_or(surface_caps.formats[0]);
@@ -93,11 +107,11 @@ impl GraphicsContext {
format: surface_format,
width: size.width,
height: size.height,
//present_mode: surface_caps.present_modes[0],
present_mode: wgpu::PresentMode::Fifo,
alpha_mode: surface_caps.alpha_modes[0],
view_formats: vec![],
desired_maximum_frame_latency: 2,
color_space: wgpu::SurfaceColorSpace::Auto,
};
let (blit_texture, blit_texture_view) =
@@ -133,17 +147,27 @@ impl GraphicsContext {
}
}
pub fn render(&mut self, render_job: RenderJob) -> Result<(), wgpu::SurfaceError> {
pub fn render(&mut self, render_job: Option<RenderJob>) -> anyhow::Result<()> {
profiling::scope!("render");
self.window.request_redraw();
if !self.is_surface_configured {
return Ok(());
}
let output = self.surface.get_current_texture()?;
let suboptimal = output.suboptimal;
let output = match self.surface.get_current_texture() {
wgpu::CurrentSurfaceTexture::Success(surface_tex) => surface_tex,
wgpu::CurrentSurfaceTexture::Suboptimal(surface_tex) => surface_tex,
wgpu::CurrentSurfaceTexture::Timeout
| wgpu::CurrentSurfaceTexture::Occluded
| wgpu::CurrentSurfaceTexture::Validation => {
// Skip frame
return Ok(());
}
wgpu::CurrentSurfaceTexture::Outdated | wgpu::CurrentSurfaceTexture::Lost => {
self.surface.configure(&self.device, &self.config);
return Ok(());
}
};
let surface_view = output
.texture
@@ -155,27 +179,22 @@ impl GraphicsContext {
label: Some("Render Encoder"),
});
// If render_job is [`RenderJob::Skip`], skip rendering and just
// blit the texture of the previous frame onto the surface texture.
if let RenderJob::Render {
meshes,
textures_delta,
} = render_job
{
// If render_job is `None`, skip rendering and just blit the texture
// of the previous frame onto the surface texture.
if let Some(render_job) = render_job {
let screen_size = PhysicalSize::new(self.config.width, self.config.height);
let pixels_per_point = self.window.as_ref().scale_factor() as f32;
// upload new textures
self.renderer
.update_textures(&self.device, &self.queue, &textures_delta);
.update_textures(&self.device, &self.queue, &render_job.textures_delta);
// upload vertex, index, and uniform buffers
self.renderer.update_buffers(
&self.device,
&self.queue,
&meshes,
&render_job,
screen_size,
pixels_per_point,
render_job.scale_factor,
);
let rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
@@ -197,16 +216,18 @@ impl GraphicsContext {
timestamp_writes: None,
label: Some("main render pass"),
occlusion_query_set: None,
multiview_mask: None,
});
self.renderer.render(
&self.device,
&mut rpass.forget_lifetime(),
&meshes,
&render_job,
screen_size,
pixels_per_point,
render_job.scale_factor,
);
self.renderer.free_textures(&textures_delta)
self.renderer.free_textures(&render_job.textures_delta);
}
{
@@ -220,13 +241,10 @@ impl GraphicsContext {
}
self.queue.submit(std::iter::once(encoder.finish()));
output.present();
self.window.pre_present_notify();
self.queue.present(output);
if suboptimal {
Err(wgpu::SurfaceError::Outdated)
} else {
Ok(())
}
Ok(())
}
}
+88 -275
View File
@@ -1,295 +1,108 @@
use crate::dpi::PhysicalPoint;
//! Module to handle user inputs like keyboard keys and mouse buttons.
use crate::dpi::LogicalPoint;
use ahash::{HashMap, HashSet};
use std::time::{Duration, Instant};
use winit::{
event::{KeyEvent, MouseButton, WindowEvent},
keyboard::{KeyCode, ModifiersState, PhysicalKey},
};
pub type Key = winit::keyboard::Key;
pub type MouseButton = winit::event::MouseButton;
pub type ModifiersState = winit::keyboard::ModifiersState;
/// Max gap between two clicks for them to count as a double-click.
const DOUBLE_CLICK_DURATION: Duration = Duration::from_millis(500);
/// Max cursor movement between two clicks for them to count as a double-click.
const DOUBLE_CLICK_MOVE_THRESHOLD: f32 = 5.0;
/// When and where a mouse button was last pressed, for double-click detection.
#[derive(Debug, Clone)]
struct MousePressState {
time: Instant,
pos: LogicalPoint<f32>,
}
/// Tracks currently-pressed keys/buttons and cursor position.
#[derive(Default)]
pub struct InputState {
key_modifiers: ModifiersState,
keys_pressed: HashSet<KeyCode>,
/// Currently held modifier keys (Shift/Ctrl/Alt/Super).
pub key_modifiers: ModifiersState,
/// Keys currently held down.
keys_pressed: HashSet<Key>,
/// Mouse buttons currently held down.
mouse_pressed: HashSet<MouseButton>,
mouse_last_pressed: HashMap<MouseButton, Instant>,
cursor_pos: PhysicalPoint<f32>,
/// Last press time/position per mouse button, for double-click detection.
mouse_last_pressed: HashMap<MouseButton, MousePressState>,
/// Current mouse cursor position.
cursor_pos: LogicalPoint<f32>,
}
impl InputState {
pub fn key_pressed(&self, code: KeyCode) -> bool {
self.keys_pressed.contains(&code)
}
pub fn mouse_pressed(&self, button: MouseButton) -> bool {
self.mouse_pressed.contains(&button)
}
pub fn mouse_pos(&self) -> PhysicalPoint<f32> {
self.cursor_pos
}
pub fn modifiers(&self) -> ModifiersState {
self.key_modifiers
}
pub fn on_window_event(&mut self, event: &WindowEvent) {
match event {
WindowEvent::ModifiersChanged(modifiers) => {
self.key_modifiers = modifiers.state();
}
WindowEvent::CursorMoved { position, .. } => {
self.cursor_pos = PhysicalPoint::new(position.x as f32, position.y as f32);
}
WindowEvent::KeyboardInput {
event:
KeyEvent {
physical_key: PhysicalKey::Code(code),
state,
..
},
..
} => {
if state.is_pressed() {
self.keys_pressed.insert(*code);
} else {
self.keys_pressed.remove(code);
}
}
WindowEvent::MouseInput { state, button, .. } => {
if state.is_pressed() {
self.mouse_pressed.insert(*button);
} else {
self.mouse_pressed.remove(button);
}
}
_ => {}
/// Marks 'key' as pressed or released.
pub fn set_key_pressed(&mut self, key: &Key, is_pressed: bool) {
if is_pressed {
self.keys_pressed.insert(key.clone());
} else {
self.keys_pressed.remove(key);
}
}
pub fn is_double_click(&mut self, button: MouseButton) -> bool {
let now = Instant::now();
let last = self.mouse_last_pressed.entry(button);
/// Returns whether `key` is currently pressed.
pub fn key_pressed(&self, key: &Key) -> bool {
self.keys_pressed.contains(key)
}
match last {
std::collections::hash_map::Entry::Occupied(mut occupied_entry) => {
let last = occupied_entry.insert(now);
now.duration_since(last) < Duration::from_millis(400)
/// Marks `button` as pressed or released.
/// Returns `true` if this press counts as a double-click (always `false` on release).
pub fn set_mouse_pressed(&mut self, button: MouseButton, is_pressed: bool) -> bool {
if !is_pressed {
self.mouse_pressed.remove(&button);
return false;
}
self.mouse_pressed.insert(button);
let now = Instant::now();
let pos = self.cursor_pos;
match self.mouse_last_pressed.entry(button) {
std::collections::hash_map::Entry::Occupied(mut entry) => {
let last = entry.get();
let delta = (last.pos - pos).abs();
let is_double = now.duration_since(last.time) < DOUBLE_CLICK_DURATION
&& delta.x <= DOUBLE_CLICK_MOVE_THRESHOLD
&& delta.y <= DOUBLE_CLICK_MOVE_THRESHOLD;
if is_double {
// Reset so that a triple-click is not treated as two consecutive
// double-clicks; the next click starts a fresh timing window.
entry.remove();
} else {
entry.insert(MousePressState { time: now, pos });
}
is_double
}
std::collections::hash_map::Entry::Vacant(vacant_entry) => {
vacant_entry.insert(now);
std::collections::hash_map::Entry::Vacant(entry) => {
entry.insert(MousePressState { time: now, pos });
false
}
}
}
}
pub fn str_as_keycode(s: &str) -> Option<KeyCode> {
Some(match s.to_uppercase().as_str() {
// Letters
"A" => KeyCode::KeyA,
"B" => KeyCode::KeyB,
"C" => KeyCode::KeyC,
"D" => KeyCode::KeyD,
"E" => KeyCode::KeyE,
"F" => KeyCode::KeyF,
"G" => KeyCode::KeyG,
"H" => KeyCode::KeyH,
"I" => KeyCode::KeyI,
"J" => KeyCode::KeyJ,
"K" => KeyCode::KeyK,
"L" => KeyCode::KeyL,
"M" => KeyCode::KeyM,
"N" => KeyCode::KeyN,
"O" => KeyCode::KeyO,
"P" => KeyCode::KeyP,
"Q" => KeyCode::KeyQ,
"R" => KeyCode::KeyR,
"S" => KeyCode::KeyS,
"T" => KeyCode::KeyT,
"U" => KeyCode::KeyU,
"V" => KeyCode::KeyV,
"W" => KeyCode::KeyW,
"X" => KeyCode::KeyX,
"Y" => KeyCode::KeyY,
"Z" => KeyCode::KeyZ,
// Digits
"0" => KeyCode::Digit0,
"1" => KeyCode::Digit1,
"2" => KeyCode::Digit2,
"3" => KeyCode::Digit3,
"4" => KeyCode::Digit4,
"5" => KeyCode::Digit5,
"6" => KeyCode::Digit6,
"7" => KeyCode::Digit7,
"8" => KeyCode::Digit8,
"9" => KeyCode::Digit9,
// Modifiers
"SHIFT" => KeyCode::ShiftLeft,
"CTRL" => KeyCode::ControlLeft,
"ALT" => KeyCode::AltLeft,
// F Keys
"F1" => KeyCode::F1,
"F2" => KeyCode::F2,
"F3" => KeyCode::F3,
"F4" => KeyCode::F4,
"F5" => KeyCode::F5,
"F6" => KeyCode::F6,
"F7" => KeyCode::F7,
"F8" => KeyCode::F8,
"F9" => KeyCode::F9,
"F10" => KeyCode::F10,
"F11" => KeyCode::F11,
"F12" => KeyCode::F12,
// Rest
" " => KeyCode::Space,
"BACK" => KeyCode::Backspace,
"TAB" => KeyCode::Tab,
"RETURN" => KeyCode::Enter,
"ESCAPE" => KeyCode::Escape,
"PAUSE" => KeyCode::Pause,
"PAGEUP" => KeyCode::PageUp,
"PAGEDOWN" => KeyCode::PageDown,
"END" => KeyCode::End,
"HOME" => KeyCode::Home,
"PRINTSCREEN" => KeyCode::PrintScreen,
"INSERT" => KeyCode::Insert,
"DELETE" => KeyCode::Delete,
"UP" => KeyCode::ArrowUp,
"DOWN" => KeyCode::ArrowDown,
"LEFT" => KeyCode::ArrowLeft,
"RIGHT" => KeyCode::ArrowRight,
"NUMLOCK" => KeyCode::NumLock,
"SCROLL" => KeyCode::ScrollLock,
_ => return None,
})
}
pub fn keycode_as_str(code: KeyCode) -> Option<String> {
Some(
match code {
// Letters
KeyCode::KeyA => "a",
KeyCode::KeyB => "b",
KeyCode::KeyC => "c",
KeyCode::KeyD => "d",
KeyCode::KeyE => "e",
KeyCode::KeyF => "f",
KeyCode::KeyG => "g",
KeyCode::KeyH => "h",
KeyCode::KeyI => "i",
KeyCode::KeyJ => "j",
KeyCode::KeyK => "k",
KeyCode::KeyL => "l",
KeyCode::KeyM => "m",
KeyCode::KeyN => "n",
KeyCode::KeyO => "o",
KeyCode::KeyP => "p",
KeyCode::KeyQ => "q",
KeyCode::KeyR => "r",
KeyCode::KeyS => "s",
KeyCode::KeyT => "t",
KeyCode::KeyU => "u",
KeyCode::KeyV => "v",
KeyCode::KeyW => "w",
KeyCode::KeyX => "x",
KeyCode::KeyY => "y",
KeyCode::KeyZ => "z",
// Digits
KeyCode::Digit0 => "0",
KeyCode::Digit1 => "1",
KeyCode::Digit2 => "2",
KeyCode::Digit3 => "3",
KeyCode::Digit4 => "4",
KeyCode::Digit5 => "5",
KeyCode::Digit6 => "6",
KeyCode::Digit7 => "7",
KeyCode::Digit8 => "8",
KeyCode::Digit9 => "9",
// Modifiers
KeyCode::ShiftLeft => "SHIFT",
KeyCode::ControlLeft => "CTRL",
KeyCode::AltLeft => "ALT",
// F Keys
KeyCode::F1 => "F1",
KeyCode::F2 => "F2",
KeyCode::F3 => "F3",
KeyCode::F4 => "F4",
KeyCode::F5 => "F5",
KeyCode::F6 => "F6",
KeyCode::F7 => "F7",
KeyCode::F8 => "F8",
KeyCode::F9 => "F9",
KeyCode::F10 => "F10",
KeyCode::F11 => "F11",
KeyCode::F12 => "F12",
// Rest
KeyCode::Space => " ",
KeyCode::Backspace => "BACK",
KeyCode::Tab => "TAB",
KeyCode::Enter => "RETURN",
KeyCode::Escape => "ESCAPE",
KeyCode::Pause => "PAUSE",
KeyCode::PageUp => "PAGEUP",
KeyCode::PageDown => "PAGEDOWN",
KeyCode::End => "END",
KeyCode::Home => "HOME",
KeyCode::PrintScreen => "PRINTSCREEN",
KeyCode::Insert => "INSERT",
KeyCode::Delete => "DELETE",
KeyCode::ArrowUp => "UP",
KeyCode::ArrowDown => "DOWN",
KeyCode::ArrowLeft => "LEFT",
KeyCode::ArrowRight => "RIGHT",
KeyCode::NumLock => "NUMLOCK",
KeyCode::ScrollLock => "SCROLL",
KeyCode::Equal => "+", // This is what PoB does
KeyCode::Minus => "-",
KeyCode::Comma => ",",
KeyCode::Period => ".",
KeyCode::Slash => "/",
KeyCode::NumpadAdd => "+",
KeyCode::NumpadSubtract => "-",
KeyCode::NumpadEnter => "RETURN",
KeyCode::Numpad0 => "0",
_ => return None,
}
.to_string(),
)
}
pub fn str_as_mousebutton(s: &str) -> Option<MouseButton> {
Some(match s.to_uppercase().as_str() {
"LEFTBUTTON" => MouseButton::Left,
"RIGHTBUTTON" => MouseButton::Right,
"MIDDLEBUTTON" => MouseButton::Middle,
"MOUSE4" => MouseButton::Back,
"MOUSE5" => MouseButton::Forward,
_ => return None,
})
}
pub fn mousebutton_as_str(button: MouseButton) -> Option<String> {
Some(
match button {
MouseButton::Left => "LEFTBUTTON",
MouseButton::Right => "RIGHTBUTTON",
MouseButton::Middle => "MIDDLEBUTTON",
MouseButton::Back => "MOUSE4",
MouseButton::Forward => "MOUSE5",
_ => return None,
}
.to_string(),
)
/// Returns whether `button` is currently pressed.
pub fn mouse_pressed(&self, button: MouseButton) -> bool {
self.mouse_pressed.contains(&button)
}
/// Returns the last known cursor position.
pub fn mouse_pos(&self) -> LogicalPoint<f32> {
self.cursor_pos
}
/// Updates the cursor position.
pub fn set_mouse_pos(&mut self, pos: LogicalPoint<f32>) {
self.cursor_pos = pos;
}
/// Clears all pressed keys, buttons, and modifier states.
pub fn clear_pressed(&mut self) {
self.keys_pressed.clear();
self.mouse_pressed.clear();
self.mouse_last_pressed.clear();
self.key_modifiers = ModifiersState::empty();
}
}
+507 -109
View File
@@ -1,134 +1,532 @@
use crate::args::Game;
use anyhow::bail;
use flate2::read::GzDecoder;
use std::{
fs::{self},
io::copy,
path::{Path, PathBuf},
use crate::{
args::Game,
color::Srgba,
dpi::{LogicalPoint, LogicalRect},
draw_commands::DrawCommand,
fonts::{Alignment, FontStyle, Fonts, LayoutJob, LayoutToLogical},
installer::download::{
DownloadEvent, ExtractionRule, build_client, download_and_extract_tarball,
download_file_to_disk, fetch_file_contents,
},
renderer::textures::TextureId,
stage::{StageEvent, StageFrameOutput, StageTransition},
util::replace_in_matching_lines,
window::WindowState,
};
use parley::{FontFamily, FontFamilyName, GenericFamily};
use regex::Regex;
use std::{
cell::RefCell,
fs,
path::Path,
rc::Rc,
sync::{
Arc, LazyLock,
mpsc::{self, Receiver, TryRecvError},
},
thread,
};
use winit::window::Window;
const REPO_NAME: &str = "meehl/RustyPathOfBuilding";
mod download;
pub fn run_installer() -> anyhow::Result<()> {
let script_dir = Game::script_dir();
const COMPAT_REPO: &str = "meehl/rusty-pob-manifest";
// run installer iff Launch.lua doesn't exist, meaning this is likely the first run
if script_dir.join("Launch.lua").exists() {
return Ok(());
}
static VERSION_RE: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"^(\d+)\.(\d+)\.(\d+)$").unwrap());
download_path_of_building(script_dir.as_path())?;
replace_manifest(script_dir.as_path())?;
static MANIFEST_VERSION_RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"<Version").unwrap());
Ok(())
enum Progress {
Status(String),
Complete,
Error(anyhow::Error),
}
/// Download latest release of Path of Building
fn download_path_of_building<P: AsRef<Path>>(target_dir: P) -> anyhow::Result<()> {
println!("Downloading latest release of Path of Building...");
pub struct Installer {
progress_rx: Option<Receiver<Progress>>,
status: String,
window_state: WindowState,
fonts: Rc<RefCell<Fonts>>,
}
let repo = match Game::current() {
Game::Poe1 => "PathOfBuildingCommunity/PathOfBuilding",
Game::Poe2 => "PathOfBuildingCommunity/PathOfBuilding-PoE2",
};
let url = format!(
"https://github.com/{}/archive/refs/heads/master.tar.gz",
repo
);
impl Installer {
pub fn new(game: Game, fonts: Rc<RefCell<Fonts>>) -> Self {
let script_dir = game.script_dir();
let (progress_tx, progress_rx) = mpsc::channel();
let mut response = ureq::get(url).call()?;
let body_reader = response.body_mut().as_reader();
let mut archive = tar::Archive::new(GzDecoder::new(body_reader));
for file in archive.entries()? {
let mut file = file?;
let file_path = file.path()?;
let components: Vec<_> = file_path.components().collect();
let target_path = match components.len() {
0..=1 => None,
// put these into target_dir/
2 => {
let filename = components[1].as_os_str();
if filename == "manifest.xml"
|| filename == "help.txt"
|| filename == "changelog.txt"
|| filename == "LICENSE.md"
{
Some(target_dir.as_ref().join(filename))
} else {
None
}
thread::spawn(move || {
if let Err(err) = install(script_dir.as_path(), game, &progress_tx) {
let _ = progress_tx.send(Progress::Error(err));
return;
}
// put lua runtime files into target_dir/lua/
3.. => {
if components[1].as_os_str() == "src"
|| (components[1].as_os_str() == "runtime"
&& components[2].as_os_str() == "lua")
{
Some(
target_dir
.as_ref()
.join(components[2..].iter().collect::<PathBuf>()),
)
} else {
None
}
}
};
let _ = progress_tx.send(Progress::Complete);
});
// create needed directories and extract
if let Some(target_path) = target_path {
if let Some(parent) = target_path.parent() {
fs::create_dir_all(parent)?;
}
file.unpack(&target_path)?;
Self {
progress_rx: Some(progress_rx),
status: String::from("Starting installation..."),
window_state: WindowState::default(),
fonts,
}
}
Ok(())
}
pub fn frame(&self) -> anyhow::Result<StageFrameOutput> {
let draw_commands = self.draw_current_progress();
/// Replace manifest and UpdateCheck with RustyPathOfBuilding's modified versions
/// This is needed to make updating work without writing our own update system.
fn replace_manifest<P: AsRef<Path>>(target_dir: P) -> anyhow::Result<()> {
log::info!("Replacing manifest...");
Ok(StageFrameOutput {
draw_commands,
can_elide: false,
request_redraw: true,
scale_factor: self.window_state.scale_factor(),
})
}
let game_path = match Game::current() {
Game::Poe1 => "lua/poe1",
Game::Poe2 => "lua/poe2",
};
pub fn update(&mut self) -> anyhow::Result<Option<StageTransition>> {
if let Some(progress_rx) = &self.progress_rx {
loop {
match progress_rx.try_recv() {
Ok(Progress::Status(msg)) => self.status = msg,
Ok(Progress::Complete) => return Ok(Some(StageTransition::ToMain)),
Ok(Progress::Error(err)) => {
return Err(anyhow::anyhow!("Installation failed: {err}"));
}
Err(TryRecvError::Disconnected) => {
return Err(anyhow::anyhow!("Install thread disconnected unexpectedly"));
}
Err(TryRecvError::Empty) => {
break;
}
}
}
}
// Download on overwrite files
download_file(
&format!(
"https://raw.githubusercontent.com/{REPO_NAME}/master/{}/{}",
game_path, "manifest.xml"
),
target_dir.as_ref().join("manifest.xml"),
)?;
Ok(None)
}
download_file(
&format!(
"https://raw.githubusercontent.com/{REPO_NAME}/master/{}/{}",
game_path, "UpdateCheck.lua"
),
target_dir.as_ref().join("UpdateCheck.lua"),
)?;
pub fn handle_event(&mut self, event: StageEvent) -> anyhow::Result<Option<StageTransition>> {
match event {
StageEvent::Resized(size) => self.window_state.size = size,
StageEvent::ScaleFactorChanged(factor) => {
#[allow(clippy::cast_possible_truncation)]
self.window_state.set_scale_factor(factor as f32);
}
_ => {}
}
Ok(None)
}
Ok(())
}
pub fn set_window(&mut self, window: Arc<Window>) {
self.window_state.set_window(window);
}
fn download_file<P: AsRef<Path>>(url: &str, file_path: P) -> anyhow::Result<()> {
let mut response = ureq::get(url).call()?;
fn draw_current_progress(&self) -> Vec<DrawCommand> {
let mut draw_commands = Vec::new();
if response.status().is_success() {
let body = response.body_mut();
let mut file = fs::File::create(file_path)?;
copy(&mut body.as_reader(), &mut file)?;
Ok(())
let screen_size = self.window_state.logical_size().cast::<f32>();
let pos = LogicalPoint::new(screen_size.width / 2.0, screen_size.height / 2.0);
let mut job = LayoutJob::new(
FontFamily::Single(FontFamilyName::Generic(GenericFamily::SansSerif)),
32.0,
34.0,
Some(Alignment::Center),
Some(700.0),
FontStyle::Normal,
);
job.append(&self.status, Srgba::WHITE);
let layout = self
.fonts
.borrow_mut()
.layout(job, self.window_state.scale_factor());
for glyph in &layout.glyphs {
draw_commands.push(DrawCommand {
positions: LayoutToLogical::new(pos.x, pos.y)
.transform_box(&glyph.rect)
.into(),
uvs: glyph.uv.into(),
color: glyph.color,
// font atlas always lives at default texture ID
texture_id: TextureId::default(),
texture_layer_idx: glyph.layer_idx,
clip_rect: LogicalRect::from_size(screen_size),
});
}
draw_commands
}
}
// Helper function for writing status to both the message channel and the log
fn report(tx: &mpsc::Sender<Progress>, msg: impl Into<String>) {
let msg = msg.into();
log::info!("{msg}");
let _ = tx.send(Progress::Status(msg));
}
/// Performs full installation of PoB assets into `target_dir`.
///
/// Skips installation if `rpob.version` already exists.
///
/// Steps:
/// 1. Fetch the compatibility table to determine which PoB version is
/// supported by the current Rusty PoB version.
/// 2. Download and extract the PoB release tarball into `target_dir`.
/// 3. Replace `UpdateCheck.lua` with a patched version and update its
/// checksum in `manifest.xml`. This is needed to support PoB native updater.
/// 4. Set the branch and platform fields in `manifest.xml`.
/// 5. Write `rpob.version` to mark the installation as complete.
fn install<P: AsRef<Path>>(
target_dir: P,
game: Game,
progress_tx: &mpsc::Sender<Progress>,
) -> anyhow::Result<()> {
let target_dir = target_dir.as_ref();
let client = build_client()?;
let version_file_path = target_dir.join("rpob.version");
let current_version = env!("CARGO_PKG_VERSION");
if version_file_path.exists() {
let old_version = fs::read_to_string(&version_file_path)?;
if old_version != current_version {
log::info!("Version changed: {old_version} -> {current_version}");
fs::write(&version_file_path, current_version).unwrap();
}
return Ok(());
}
report(progress_tx, "Fetching compatibility info...");
let compat_info = fetch_compatibility_info(&client, game)?;
let pob_version = highest_supported_pob_version(&compat_info, current_version)
.ok_or_else(|| anyhow::anyhow!("Unable to determine supported PoB version"))?;
log::info!("Using PoB version: {pob_version}");
report(progress_tx, "Downloading assets...");
download_pob(&client, target_dir, game, pob_version, progress_tx)?;
report(progress_tx, "Finalizing installation...");
replace_updatecheck(&client, target_dir)?;
set_branch_and_platform(target_dir)?;
fs::write(&version_file_path, current_version)?;
log::info!("Installation complete.");
Ok(())
}
#[derive(Debug)]
struct VersionReq {
pob_ver: String,
min_rpob_ver: String,
}
/// Fetches compatibility info
fn fetch_compatibility_info(
client: &reqwest::blocking::Client,
game: Game,
) -> anyhow::Result<Vec<VersionReq>> {
let file_name = match game {
Game::Poe1 => "Compatibility_pob1.lua",
Game::Poe2 => "Compatibility_pob2.lua",
};
let compatibility_info_file = fetch_file_contents(client, COMPAT_REPO, file_name)?;
// Load and evaluate compatibility file contents as Lua code
let lua = mlua::Lua::new();
let compatibility_table = lua.load(compatibility_info_file).eval::<mlua::Table>()?;
// Compatibility table maps PoB version to minimum required Rusty PoB version.
// Beta versions have a non-semver suffix and are filtered out by the regex.
Ok(compatibility_table
.pairs::<String, String>()
.filter_map(Result::ok)
.filter(|(pob_version, _)| VERSION_RE.is_match(pob_version))
.map(|(pob_version, min_req_rpob_ver)| VersionReq {
pob_ver: pob_version,
min_rpob_ver: min_req_rpob_ver,
})
.collect())
}
/// Determines the highest PoB version supported by the given Rusty PoB version.
fn highest_supported_pob_version<'a>(
compatibility_info: &'a [VersionReq],
rpob_version: &str,
) -> Option<&'a str> {
let mut highest: Option<&str> = None;
for VersionReq {
pob_ver,
min_rpob_ver,
} in compatibility_info
{
if is_higher_version(min_rpob_ver, rpob_version).unwrap_or(false) {
match highest {
Some(h) if !is_higher_version(h, pob_ver).unwrap_or(false) => {}
_ => highest = Some(pob_ver.as_str()),
}
}
}
highest
}
fn download_pob<P: AsRef<Path>>(
client: &reqwest::blocking::Client,
target_dir: P,
game: Game,
pob_version: &str,
progress_tx: &mpsc::Sender<Progress>,
) -> anyhow::Result<()> {
let target_dir = target_dir.as_ref();
let pob_repo = match game {
Game::Poe1 => "PathOfBuildingCommunity/PathOfBuilding",
Game::Poe2 => "PathOfBuildingCommunity/PathOfBuilding-PoE2",
};
let rules = vec![
ExtractionRule::File {
tarball_path: "manifest.xml".into(),
dest_path: target_dir.join("manifest.xml"),
},
ExtractionRule::File {
tarball_path: "help.txt".into(),
dest_path: target_dir.join("help.txt"),
},
ExtractionRule::File {
tarball_path: "changelog.txt".into(),
dest_path: target_dir.join("changelog.txt"),
},
ExtractionRule::File {
tarball_path: "LICENSE.md".into(),
dest_path: target_dir.join("LICENSE.md"),
},
ExtractionRule::RewritePrefix {
prefix: "src/".into(),
dest_dir: target_dir.to_path_buf(),
},
ExtractionRule::RewritePrefix {
prefix: "runtime/lua/".into(),
dest_dir: target_dir.join("lua"),
},
];
download_and_extract_tarball(
client,
pob_repo,
&format!("v{pob_version}"),
&rules,
5,
&mut |event| {
let msg = match event {
DownloadEvent::Progress {
downloaded,
total: Some(total),
} => {
let pct = (downloaded as f32 / total as f32 * 100.0) as u32;
format!("Downloading assets... ({pct}%)")
}
DownloadEvent::Progress {
downloaded,
total: None,
} => {
format!("Downloading assets... ({})", format_bytes(downloaded))
}
DownloadEvent::Retrying { attempt } => {
format!("Retrying... (Attempt {attempt})")
}
};
let _ = progress_tx.send(Progress::Status(msg));
},
)?;
Ok(())
}
/// Replaces UpdateCheck.lua with rusty-path-of-building's modified version and
/// updates its checksum in manifest.xml.
fn replace_updatecheck<P: AsRef<Path>>(
client: &reqwest::blocking::Client,
target_dir: P,
) -> anyhow::Result<()> {
let target_dir = target_dir.as_ref();
let file_name = "UpdateCheck.lua";
download_file_to_disk(client, COMPAT_REPO, file_name, target_dir.join(file_name))?;
// .sha1 file format: "<checksum> UpdateCheck.lua" - we only need the checksum.
let sha1_contents = fetch_file_contents(client, COMPAT_REPO, "UpdateCheck.lua.sha1")?;
let new_checksum = sha1_contents
.split_whitespace()
.next()
.ok_or_else(|| anyhow::anyhow!("Invalid checksum file format"))?;
let manifest_path = target_dir.join("manifest.xml");
let manifest = fs::read_to_string(&manifest_path)?;
let new_manifest = replace_in_matching_lines(
&manifest,
r#"name="UpdateCheck.lua""#,
r#"sha1="([0-9A-Za-z]+)""#,
&format!(r#"sha1="{new_checksum}""#),
);
fs::write(&manifest_path, &new_manifest)?;
Ok(())
}
/// Sets branch and platform in manifest.xml
fn set_branch_and_platform<P: AsRef<Path>>(target_dir: P) -> anyhow::Result<()> {
let path = target_dir.as_ref().join("manifest.xml");
let manifest = fs::read_to_string(&path)?;
#[cfg(target_os = "windows")]
let platform = "win32";
#[cfg(not(target_os = "windows"))]
let platform = std::env::consts::OS;
let replacement = format!(r#"<Version branch="master" platform="{platform}""#);
let new_manifest = MANIFEST_VERSION_RE.replace(&manifest, replacement);
fs::write(&path, new_manifest.as_ref())?;
Ok(())
}
fn format_bytes(size_in_bytes: u64) -> String {
const KB: u64 = 1024;
const MB: u64 = KB * 1024;
const GB: u64 = MB * 1024;
if size_in_bytes >= GB {
format!("{:.2} GB", size_in_bytes as f64 / GB as f64)
} else if size_in_bytes >= MB {
format!("{:.2} MB", size_in_bytes as f64 / MB as f64)
} else if size_in_bytes >= KB {
format!("{:.2} KB", size_in_bytes as f64 / KB as f64)
} else {
bail!("Unable to download: {}", url);
format!("{size_in_bytes} bytes")
}
}
/// Returns true if `v2` is greater than or equal to `v1`.
fn is_higher_version(v1: &str, v2: &str) -> anyhow::Result<bool> {
let parse_version = |v: &str| -> anyhow::Result<(u32, u32, u32)> {
let caps = VERSION_RE
.captures(v)
.ok_or_else(|| anyhow::anyhow!("Invalid semver format: {v}"))?;
let major = caps[1].parse::<u32>().unwrap();
let minor = caps[2].parse::<u32>().unwrap();
let patch = caps[3].parse::<u32>().unwrap();
Ok((major, minor, patch))
};
let (major1, minor1, patch1) = parse_version(v1)?;
let (major2, minor2, patch2) = parse_version(v2)?;
Ok(major2 > major1
|| (major2 == major1 && minor2 > minor1)
|| (major2 == major1 && minor2 == minor1 && patch2 >= patch1))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_major_version() {
assert!(is_higher_version("1.0.0", "2.0.0").unwrap());
assert!(!is_higher_version("2.0.0", "1.0.0").unwrap());
}
#[test]
fn test_minor_version() {
assert!(is_higher_version("1.5.0", "1.6.0").unwrap());
assert!(!is_higher_version("1.10.0", "1.9.0").unwrap());
}
#[test]
fn test_patch_version() {
assert!(is_higher_version("1.0.3", "1.0.4").unwrap());
assert!(!is_higher_version("1.0.10", "1.0.9").unwrap());
}
#[test]
fn test_same_version() {
assert!(is_higher_version("1.5.3", "1.5.3").unwrap());
}
#[test]
fn test_invalid_semver_format() {
assert!(is_higher_version("1.0", "2.0.0").is_err());
assert!(is_higher_version("1.0.0", "2.0").is_err());
assert!(is_higher_version("invalid", "2.0.0").is_err());
assert!(is_higher_version("1.0.0", "a.bb.ccc").is_err());
}
#[test]
fn test_highest_supported_pob_ver() {
let compat_info = vec![
VersionReq {
pob_ver: "2.56.0".into(),
min_rpob_ver: "0.1.0".into(),
},
// compat info might not be sorted by pob_version
VersionReq {
pob_ver: "2.58.0".into(),
min_rpob_ver: "0.2.6".into(),
},
VersionReq {
pob_ver: "2.57.0".into(),
min_rpob_ver: "0.2.6".into(),
},
VersionReq {
pob_ver: "2.58.1".into(),
min_rpob_ver: "0.2.8".into(),
},
VersionReq {
pob_ver: "2.59.0".into(),
min_rpob_ver: "0.2.9".into(),
},
VersionReq {
pob_ver: "2.59.1".into(),
min_rpob_ver: "0.2.10".into(),
},
VersionReq {
pob_ver: "2.59.2".into(),
min_rpob_ver: "0.2.10".into(),
},
];
assert_eq!(highest_supported_pob_version(&compat_info, "0.0.2"), None);
assert_eq!(highest_supported_pob_version(&compat_info, "a.b.c"), None);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.1.0"),
Some("2.56.0")
);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.2.0"),
Some("2.56.0")
);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.2.6"),
Some("2.58.0")
);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.2.7"),
Some("2.58.0")
);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.2.8"),
Some("2.58.1")
);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.2.9"),
Some("2.59.0")
);
assert_eq!(
highest_supported_pob_version(&compat_info, "0.2.10"),
Some("2.59.2")
);
}
}
+266
View File
@@ -0,0 +1,266 @@
use std::{
fmt,
fs::{self, File},
io::{self, Read, Write},
path::{Path, PathBuf},
thread,
time::{Duration, Instant},
};
use flate2::read::GzDecoder;
use reqwest::blocking::{Client, Response};
use tar::Archive;
#[derive(Debug)]
pub enum DownloadEvent {
Progress { downloaded: u64, total: Option<u64> },
Retrying { attempt: u32 },
}
/// Build a reqwest blocking client
pub fn build_client() -> Result<Client, reqwest::Error> {
Client::builder().timeout(Duration::from_mins(1)).build()
}
// Rate-limit-aware GET.
//
// `raw.githubusercontent.com` doesn't seem to use `x-ratelimit-reset` and
// `x-ratelimit-remaining` headers like the API so only the status code is checked.
fn get_checked(client: &Client, url: &str) -> Result<Response, GithubError> {
let response = client.get(url).send()?;
let status = response.status();
if status == reqwest::StatusCode::TOO_MANY_REQUESTS {
let retry_after_secs = response
.headers()
.get("retry-after")
.and_then(|v| v.to_str().ok())
.and_then(|s| s.parse::<u64>().ok())
.unwrap_or(60);
return Err(GithubError::RateLimited {
retry_after_s: retry_after_secs,
});
}
if !status.is_success() {
return Err(GithubError::Http {
status: status.as_u16(),
url: url.to_string(),
});
}
Ok(response)
}
/// Wrapper to retry `f` up to `max_retries` times
pub fn with_retry<T, F>(max_retries: u32, base_delay: Duration, mut f: F) -> Result<T, GithubError>
where
F: FnMut(u32) -> Result<T, GithubError>,
{
let mut attempt = 0;
loop {
match f(attempt) {
Err(GithubError::RateLimited {
retry_after_s: retry_after_secs,
}) if attempt < max_retries => {
log::warn!("Rate limited – sleeping {retry_after_secs}s (attempt {attempt})");
thread::sleep(Duration::from_secs(retry_after_secs));
attempt += 1;
}
Err(GithubError::Network(e)) if attempt < max_retries => {
let delay = base_delay * (attempt + 1);
log::warn!("Network error on attempt {attempt}: {e}. Retrying in {delay:?}");
thread::sleep(delay);
attempt += 1;
}
other => return other,
}
}
}
/// Download file contents from raw.githubusercontent.com into a `String`.
pub fn fetch_file_contents(
client: &Client,
repo: &str,
file_name: &str,
) -> Result<String, GithubError> {
let url = format!("https://raw.githubusercontent.com/{repo}/main/{file_name}");
let response = get_checked(client, &url)?;
Ok(response.text()?)
}
/// Download a file from raw.githubusercontent.com and write it to `dest_path`.
pub fn download_file_to_disk<P: AsRef<Path>>(
client: &Client,
repo: &str,
file_name: &str,
dest_path: P,
) -> Result<(), GithubError> {
let dest_path = dest_path.as_ref();
let url = format!("https://raw.githubusercontent.com/{repo}/main/{file_name}");
let mut response = get_checked(client, &url)?;
if let Some(parent) = dest_path.parent() {
fs::create_dir_all(parent)?;
}
let mut file = File::create(dest_path)?;
io::copy(&mut response, &mut file)?;
Ok(())
}
/// A rule describing how to map tarball entries to destination paths.
///
/// The root prefix is automatically striped and doesn't need to be specified.
pub enum ExtractionRule {
/// Map a single file to an exact destination path.
File {
tarball_path: String,
dest_path: PathBuf,
},
/// Strip prefix from matching entries and place the remainder under `dest_dir`.
RewritePrefix { prefix: String, dest_dir: PathBuf },
}
const CHUNK_SIZE: usize = 512 * 1024;
const PROGRESS_INTERVAL: Duration = Duration::from_millis(50);
/// Download a GitHub release tarball and extract entries to specified destinations.
pub fn download_and_extract_tarball(
client: &Client,
repo_name: &str,
tag: &str,
rules: &[ExtractionRule],
max_retries: u32,
on_progress: &mut impl FnMut(DownloadEvent),
) -> Result<(), GithubError> {
let url = format!("https://github.com/{repo_name}/archive/refs/tags/{tag}.tar.gz");
let tmp_path =
std::env::temp_dir().join(format!("gh-{}-{}.tar.gz", repo_name.replace('/', "-"), tag));
// Download to temp file
with_retry(max_retries, Duration::from_secs(5), |attempt| {
if attempt > 0 {
on_progress(DownloadEvent::Retrying { attempt });
}
let response = get_checked(client, &url)?;
let content_length = response.content_length();
let mut tmp_file = File::create(&tmp_path)?;
let mut chunk = vec![0u8; CHUNK_SIZE];
let mut downloaded: u64 = 0;
let mut body = response;
let mut last_progress = Instant::now();
loop {
let n = body.read(&mut chunk)?;
if n == 0 {
break;
}
tmp_file.write_all(&chunk[..n])?;
downloaded += n as u64;
if last_progress.elapsed() >= PROGRESS_INTERVAL {
on_progress(DownloadEvent::Progress {
downloaded,
total: content_length,
});
last_progress = Instant::now();
}
}
on_progress(DownloadEvent::Progress {
downloaded,
total: content_length,
});
Ok(())
})?;
// Extract tarball to destination based on extract rules
let tmp_file = File::open(&tmp_path)?;
let gz = GzDecoder::new(io::BufReader::new(tmp_file));
let mut archive = Archive::new(gz);
for entry_result in archive.entries()? {
let mut entry = entry_result?;
let entry_path = entry.path()?.to_path_buf();
let entry_str = entry_path.to_string_lossy();
// Skip directory entries
if entry_str.ends_with('/') {
continue;
}
// Strip root folder before matching against rules
let Some((_, relative)) = entry_str.split_once('/') else {
continue;
};
let dest: Option<PathBuf> = rules.iter().find_map(|rule| match rule {
ExtractionRule::File {
tarball_path,
dest_path,
} => (tarball_path == relative).then(|| dest_path.clone()),
ExtractionRule::RewritePrefix { prefix, dest_dir } => relative
.strip_prefix(prefix)
.map(|tail| dest_dir.join(tail)),
});
if let Some(dest_path) = dest {
if let Some(parent) = dest_path.parent() {
fs::create_dir_all(parent)?;
}
let mut dest_file = File::create(&dest_path)?;
io::copy(&mut entry, &mut dest_file)?;
}
}
fs::remove_file(&tmp_path)?;
Ok(())
}
#[derive(Debug)]
pub enum GithubError {
Http { status: u16, url: String },
RateLimited { retry_after_s: u64 },
Network(reqwest::Error),
Io(io::Error),
}
impl fmt::Display for GithubError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Http { status, url } => write!(f, "HTTP error {status}: {url}"),
Self::RateLimited { retry_after_s } => {
write!(f, "Rate limited – retry after {retry_after_s}s")
}
Self::Network(e) => write!(f, "Network error: {e}"),
Self::Io(e) => write!(f, "I/O error: {e}"),
}
}
}
impl std::error::Error for GithubError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::Network(e) => Some(e),
Self::Io(e) => Some(e),
_ => None,
}
}
}
impl From<reqwest::Error> for GithubError {
fn from(e: reqwest::Error) -> Self {
Self::Network(e)
}
}
impl From<io::Error> for GithubError {
fn from(e: io::Error) -> Self {
Self::Io(e)
}
}
-102
View File
@@ -1,102 +0,0 @@
use std::collections::BTreeMap;
use crate::{
dpi::LogicalRect,
math::Rect,
renderer::primitives::{
ClippedPrimitive, DrawPrimitive, QuadPrimitive, RectPrimitive, TextPrimitive,
},
};
/// Holds the draw primitives for each layer.
///
/// Adding a primitive places it in currently set layer. Positions are interpreted as being relative to
/// the current viewport. They are translated into absolute positions (screen positions) and
/// clipped by the viewport.
pub struct Layers {
layers: BTreeMap<(i32, i32), Vec<ClippedPrimitive>>,
current_layer: (i32, i32),
viewport: LogicalRect<f32>,
}
impl Layers {
pub fn new() -> Self {
Self {
layers: Default::default(),
current_layer: (0, 0),
viewport: Rect::zero(),
}
}
pub fn reset(&mut self) {
self.current_layer = (0, 0);
self.layers.clear();
}
/// Consume primitives and return an iterator over them in drawing order.
pub fn consume_layers(&mut self) -> impl Iterator<Item = ClippedPrimitive> {
let layers = std::mem::take(&mut self.layers);
layers.into_values().flatten()
}
pub fn set_viewport(&mut self, viewport: LogicalRect<f32>) {
self.viewport = viewport;
}
pub fn set_draw_layer(&mut self, layer: i32, sublayer: i32) {
self.current_layer = (layer, sublayer);
}
pub fn set_draw_sublayer(&mut self, sublayer: i32) {
self.set_draw_layer(self.current_layer.0, sublayer);
}
pub fn add_rect(&mut self, mut rect: RectPrimitive) {
rect.translate(self.viewport.min.to_vector());
let clipped_primitive = ClippedPrimitive {
clip_rect: self.viewport,
primitive: DrawPrimitive::Rect(rect),
};
self.push(clipped_primitive);
}
pub fn add_quad(&mut self, mut quad: QuadPrimitive) {
quad.translate(self.viewport.min.to_vector());
let clipped_primitive = ClippedPrimitive {
clip_rect: self.viewport,
primitive: DrawPrimitive::Quad(quad),
};
self.push(clipped_primitive);
}
pub fn add_text(&mut self, mut text: TextPrimitive, is_absolute_position: bool) {
if !is_absolute_position {
text.translate(self.viewport.min.to_vector());
};
let clipped_primitive = ClippedPrimitive {
clip_rect: self.viewport,
primitive: DrawPrimitive::Text(text),
};
self.push(clipped_primitive);
}
#[inline]
fn push(&mut self, clipped_primitive: ClippedPrimitive) {
self.layers
.entry(self.current_layer)
.or_default()
.push(clipped_primitive);
}
}
impl std::hash::Hash for Layers {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.layers.hash(state);
}
}
-157
View File
@@ -1,157 +0,0 @@
use std::{cell::RefCell, rc::Rc};
use clap::Parser;
use mlua::{Lua, Result as LuaResult, Table};
use crate::{
Game,
api::{self, get_callback},
args::Args,
subscript::{NativeMultiValue, SubscriptManager, SubscriptResult, register_subscript_globals},
util::{change_working_directory, get_executable_dir},
};
pub struct LuaInstance {
lua: Lua,
subscript_manager: Rc<RefCell<SubscriptManager>>,
}
impl LuaInstance {
pub fn new() -> anyhow::Result<Self> {
let subscript_manager = Rc::new(RefCell::new(SubscriptManager::new()));
let lua = Self::create_lua_state()?;
register_subscript_globals(&lua, &subscript_manager)?;
let instance = Self {
lua,
subscript_manager,
};
instance.init()?;
Ok(instance)
}
fn create_lua_state() -> LuaResult<Lua> {
// SAFETY: use `unsafe_new` to allow loading of C modules
let lua = unsafe { Lua::unsafe_new() };
// expose build arg to lua
let args = Args::parse();
let args_table = lua.create_sequence_from(std::iter::once(args.build_path))?;
lua.globals().set("arg", args_table)?;
// add ./lua to package.path and package.cpath
Self::register_package_paths(&lua)?;
// register callbacks
api::register_globals(&lua)?;
Ok(lua)
}
pub fn init(&self) -> LuaResult<()> {
let script_dir = Game::script_dir();
change_working_directory(script_dir.as_path())?;
self.load(script_dir.join("Launch.lua")).exec()?;
self.on_init()?;
Ok(())
}
pub fn restart(&mut self) -> LuaResult<()> {
self.lua = Self::create_lua_state()?;
register_subscript_globals(&self.lua, &self.subscript_manager)?;
self.init()?;
Ok(())
}
/// Run functions for subscripts and handle their completion/failure.
pub fn handle_subscripts(&self) {
let subscript_events = self.subscript_manager.borrow_mut().process(self);
// Handle finished/errored subscripts.
for event in subscript_events {
match event {
SubscriptResult::SubscriptFinished { id, return_values } => {
self.on_sub_finished(id, return_values).unwrap();
}
SubscriptResult::SubscriptError { id, error } => {
self.on_sub_error(id, &error).unwrap();
}
}
}
}
fn on_init(&self) -> LuaResult<()> {
let on_init = get_callback(&self.lua, "OnInit")?;
on_init.call::<()>(())
}
pub fn on_frame(&self) -> LuaResult<()> {
profiling::scope!("on_frame");
let on_frame = get_callback(&self.lua, "OnFrame")?;
on_frame.call::<()>(())
}
pub fn on_char(&self, ch: &str) -> LuaResult<()> {
let on_char = get_callback(&self.lua, "OnChar")?;
on_char.call::<()>(ch)
}
pub fn on_key_down(&self, key: &str, is_double_click: bool) -> LuaResult<()> {
let on_key_down = get_callback(&self.lua, "OnKeyDown")?;
on_key_down.call::<()>((key, is_double_click))
}
pub fn on_key_up(&self, key: &str) -> LuaResult<()> {
let on_key_up = get_callback(&self.lua, "OnKeyUp")?;
on_key_up.call::<()>(key)
}
pub fn on_sub_finished(&self, id: u64, return_values: NativeMultiValue) -> LuaResult<()> {
let on_sub_finished = get_callback(&self.lua, "OnSubFinished")?;
on_sub_finished.call::<()>((id, return_values))
}
pub fn on_sub_error(&self, id: u64, error: &str) -> LuaResult<()> {
let on_sub_error = get_callback(&self.lua, "OnSubError")?;
on_sub_error.call::<()>((id, error))
}
pub fn on_exit(&self) -> LuaResult<()> {
let on_exit = get_callback(&self.lua, "OnExit")?;
on_exit.call::<()>(())
}
pub fn register_package_paths(lua: &Lua) -> LuaResult<()> {
let script_dir = Game::script_dir();
let package: Table = lua.globals().get("package")?;
let mut package_path: String = package.get("path")?;
package_path.push(';');
package_path.push_str(script_dir.join("lua/?.lua").to_str().unwrap());
package_path.push(';');
package_path.push_str(script_dir.join("lua/?/init.lua").to_str().unwrap());
package.set("path", package_path)?;
let mut package_cpath: String = package.get("cpath")?;
let exe_dir = get_executable_dir()?;
package_cpath.push(';');
#[cfg(target_os = "linux")]
package_cpath.push_str(exe_dir.join("lua/?.so").to_str().unwrap());
#[cfg(target_os = "windows")]
package_cpath.push_str(exe_dir.join("lua/?.dll").to_str().unwrap());
package.set("cpath", package_cpath)?;
Ok(())
}
}
impl std::ops::Deref for LuaInstance {
type Target = Lua;
fn deref(&self) -> &Self::Target {
&self.lua
}
}
+40 -12
View File
@@ -1,25 +1,26 @@
use crate::app::App;
use crate::args::{Args, Game};
use crate::installer::run_installer;
use crate::{app::App, args::Args};
use clap::Parser;
use std::path::{Path, PathBuf};
use winit::event_loop::EventLoop;
mod api;
mod app;
mod args;
mod batcher;
mod clipboard;
mod color;
mod context;
mod dpi;
mod draw_commands;
mod fonts;
mod gfx;
mod input;
mod installer;
mod layers;
mod lua;
mod math;
mod pob;
mod renderer;
mod subscript;
mod stage;
mod util;
mod uv;
mod window;
mod worker_pool;
fn main() -> anyhow::Result<()> {
@@ -36,14 +37,41 @@ fn main() -> anyhow::Result<()> {
};
let args = Args::parse();
Game::init(args.game);
let script_dir = find_nearby_launch_script();
run_installer()?;
let mut app = App::new()?;
let mut app = App::new(args.game, script_dir)?;
let event_loop = EventLoop::with_user_event().build()?;
event_loop.run_app(&mut app)?;
Ok(())
}
/// Search for the Launch.lua file in nearby locations
fn find_nearby_launch_script() -> Option<PathBuf> {
let mut candidates = vec![Path::new("Launch.lua"), Path::new("src/Launch.lua")];
if let Ok(cwd) = std::env::current_dir()
&& cwd.ends_with("runtime")
{
candidates.push(Path::new("../src/Launch.lua"));
}
for candidate in candidates {
if candidate.try_exists().is_ok_and(|exists| exists)
&& let Ok(candidate) = candidate.canonicalize()
&& let Some(dir) = candidate.parent()
{
// remove the windows extended length path syntax as it contains a
// question mark which will interfere with lua's require()
const WINDOWS_PREFIX: &str = r#"\\?\"#;
let path_str = dir.display().to_string();
return match path_str.strip_prefix(WINDOWS_PREFIX) {
Some(stripped) => Some(PathBuf::from(stripped)),
None => Some(dir.to_path_buf()),
};
};
}
None
}
+2
View File
@@ -1,6 +1,8 @@
pub use euclid::Box2D as Rect;
pub use euclid::Point2D as Point;
pub use euclid::Scale;
pub use euclid::Size2D as Size;
pub use euclid::Translation2D as Translation;
pub use euclid::Vector2D as Vector;
pub use quad::Quad;
+44 -7
View File
@@ -1,5 +1,6 @@
use crate::math::{Point, Size, Vector};
use crate::math::{Corners, Point, Rect, Size, Vector};
use bytemuck::{Pod, Zeroable};
use euclid::approxord::{max, min};
use euclid::num::Zero;
use std::fmt;
use std::hash::Hash;
@@ -51,10 +52,10 @@ impl<T: fmt::Debug, U> fmt::Debug for Quad<T, U> {
impl<T: Default, U> Default for Quad<T, U> {
fn default() -> Self {
Self::new(
Default::default(),
Default::default(),
Default::default(),
Default::default(),
Point::default(),
Point::default(),
Point::default(),
Point::default(),
)
}
}
@@ -92,7 +93,7 @@ where
where
T: Zero,
{
Quad {
Self {
p0: Point::zero(),
p1: Point::new(size.width, Zero::zero()),
p2: Point::new(size.width, size.height),
@@ -107,7 +108,7 @@ where
{
/// Constructor, setting all points to zero.
pub fn zero() -> Self {
Quad::new(Point::zero(), Point::zero(), Point::zero(), Point::zero())
Self::new(Point::zero(), Point::zero(), Point::zero(), Point::zero())
}
}
@@ -121,3 +122,39 @@ where
Self::new(self.p0 + by, self.p1 + by, self.p2 + by, self.p3 + by)
}
}
impl<T, U> From<Rect<T, U>> for Quad<T, U>
where
T: Copy,
{
fn from(value: Rect<T, U>) -> Self {
Self::new(
value.top_left(),
value.top_right(),
value.bottom_right(),
value.bottom_left(),
)
}
}
impl<T, U> Quad<T, U>
where
T: Copy + PartialOrd,
{
/// Returns the axis-aligned bounding box containing this quad.
#[inline]
pub fn aabb(&self) -> Rect<T, U> {
let min_x = min(min(min(self.p0.x, self.p1.x), self.p2.x), self.p3.x);
let max_x = max(max(max(self.p0.x, self.p1.x), self.p2.x), self.p3.x);
let min_y = min(min(min(self.p0.y, self.p1.y), self.p2.y), self.p3.y);
let max_y = max(max(max(self.p0.y, self.p1.y), self.p2.y), self.p3.y);
Rect::new(Point::new(min_x, min_y), Point::new(max_x, max_y))
}
/// Tests intersection between this quad's AABB and a rectangle.
#[inline]
pub fn aabb_intersects_rect(&self, rect: &Rect<T, U>) -> bool {
self.aabb().intersects(rect)
}
}
+379
View File
@@ -0,0 +1,379 @@
use clap::Parser;
use mlua::{
AppDataRef, AppDataRefMut, Function, Lua, Result as LuaResult, Table, thread::ThreadStatus,
};
use winit::window::Window;
use crate::{
args::Args,
dpi::{PhysicalPoint, ScaleFactor},
draw_commands::DrawCommandRecorder,
fonts::Fonts,
input::InputState,
pob::subscript::{NativeMultiValue, SubscriptEvent, SubscriptManager},
renderer::textures::TextureManager,
stage::{StageEvent, StageFrameOutput, StageTransition},
util::{append_lua_package_dir, change_working_directory, load_lua_file},
window::WindowState,
};
use std::{
cell::RefCell,
path::{Path, PathBuf},
rc::Rc,
sync::Arc,
};
mod api;
mod modules;
mod subscript;
/// Holds all state shared between Rust and the API functions exposed to Lua.
///
/// Accessed via `lua.app_data_ref::<Context>()`/`app_data_mut::<Context>()`.
pub struct Context {
pub input_state: InputState,
pub window_state: WindowState,
/// Collects draw commands issued by API functions
pub recorder: DrawCommandRecorder,
pub fonts: Rc<RefCell<Fonts>>,
pub texture_manager: Rc<RefCell<TextureManager>>,
/// Directory containing the PoB Lua scripts
pub script_dir: PathBuf,
pub current_working_dir: PathBuf,
/// Set by Lua to request a full Lua restart
pub needs_restart: bool,
/// Set by Lua to request application shutdown
pub should_exit: bool,
pub is_dpi_aware: bool,
}
impl Context {
pub fn new(
script_dir: &Path,
fonts: Rc<RefCell<Fonts>>,
texture_manager: Rc<RefCell<TextureManager>>,
) -> Self {
Self {
input_state: InputState::default(),
window_state: WindowState::default(),
recorder: DrawCommandRecorder::default(),
fonts,
texture_manager,
script_dir: script_dir.to_owned(),
current_working_dir: PathBuf::default(),
needs_restart: false,
should_exit: false,
is_dpi_aware: false,
}
}
/// Resizes the recorder's viewport to match the current window size.
/// Call at the start of every frame before any draw calls are recorded.
pub fn set_recorder_viewport_to_window_size(&mut self) {
self.recorder
.set_viewport_from_size(self.window_state.logical_size());
}
fn set_mouse_pos(&mut self, pos: PhysicalPoint<f32>) {
self.input_state
.set_mouse_pos(pos / self.window_state.scale_factor());
}
}
/// Represents the interface to Path of Building's Lua code.
///
/// Exposes API, forwards events to Path of Building's event handlers, and manages subscripts.
pub struct PathOfBuilding {
lua: Lua,
/// Hash of the previous frame's draw commands. Used to skip rerendering identical frames.
previous_layers_hash: u64,
}
impl PathOfBuilding {
pub fn new(
script_dir: &Path,
fonts: Rc<RefCell<Fonts>>,
texture_manager: Rc<RefCell<TextureManager>>,
) -> anyhow::Result<Self> {
let ctx = Context::new(script_dir, fonts, texture_manager);
let lua = Self::create_lua(ctx, SubscriptManager::default())?;
Self::launch(&lua, script_dir)?;
Ok(Self {
lua,
previous_layers_hash: Default::default(),
})
}
/// Builds a `Lua` state with package paths, context, and all API functions registered.
fn create_lua(ctx: Context, subscript_manager: SubscriptManager) -> LuaResult<Lua> {
// `unsafe_new` needed to allow loading of C modules
let lua = unsafe { Lua::unsafe_new() };
append_lua_package_dir(&lua, &ctx.script_dir.join("lua"))?;
// expose import url to lua
let args = Args::parse();
let args_table = lua.create_sequence_from(std::iter::once(args.import_url))?;
lua.globals().set("arg", args_table)?;
// make context and subscript manager accessible to API functions
lua.set_app_data(ctx);
lua.set_app_data(subscript_manager);
// register API functions
api::register_globals(&lua)?;
// register modules
modules::register(&lua)?;
Ok(lua)
}
/// Loads and runs `Launch.lua`, then calls PoB's `OnInit` handler.
fn launch(lua: &Lua, script_dir: &Path) -> LuaResult<()> {
change_working_directory(script_dir)?;
load_lua_file(lua, &script_dir.join("Launch.lua"))?.exec()?;
{
profiling::scope!("OnInit");
api::on_init(lua)?;
}
Ok(())
}
/// Rebuilds the Lua instance from scratch. Preserves the current `Context`.
fn restart(&mut self) -> LuaResult<()> {
// move context and subscript manager out of current lua instance
let mut ctx = self.lua.remove_app_data::<Context>().unwrap();
let script_dir = ctx.script_dir.clone();
ctx.needs_restart = false;
let subscript_manager = self
.lua
.remove_app_data::<SubscriptManager>()
.unwrap_or_default();
// and move both into the new instance
self.lua = Self::create_lua(ctx, subscript_manager)?;
Self::launch(&self.lua, &script_dir)?;
Ok(())
}
/// Handles events by updating context and forwarding them to PoB's event handlers.
pub fn handle_event(&self, event: StageEvent) -> anyhow::Result<Option<StageTransition>> {
match event {
StageEvent::KeyDown { key } => {
self.ctx_mut().input_state.set_key_pressed(&key, true);
api::on_key_down(&self.lua, &api::Input::Keyboard(key), false)?;
}
StageEvent::KeyUp { key } => {
self.ctx_mut().input_state.set_key_pressed(&key, false);
api::on_key_up(&self.lua, &api::Input::Keyboard(key))?;
}
StageEvent::ModifiersChanged { state } => {
self.ctx_mut().input_state.key_modifiers = state;
}
StageEvent::CharacterInput { ch } => {
let ch = if ch.is_ascii() { ch } else { '?' };
api::on_char(&self.lua, ch)?;
}
StageEvent::MouseDown { button } => {
let is_double_click = self.ctx_mut().input_state.set_mouse_pressed(button, true);
api::on_key_down(&self.lua, &api::Input::Mouse(button), is_double_click)?;
}
StageEvent::MouseUp { button } => {
self.ctx_mut().input_state.set_mouse_pressed(button, false);
api::on_key_up(&self.lua, &api::Input::Mouse(button))?;
}
StageEvent::MouseWheel { delta } => {
if delta > 0.0 {
api::on_key_down(&self.lua, &api::Input::WheelUp, false)?;
api::on_key_up(&self.lua, &api::Input::WheelUp)?;
} else if delta < 0.0 {
api::on_key_down(&self.lua, &api::Input::WheelDown, false)?;
api::on_key_up(&self.lua, &api::Input::WheelDown)?;
}
}
StageEvent::Exit => api::on_exit(&self.lua)?,
StageEvent::MouseMoved { pos } => {
self.ctx_mut().set_mouse_pos(pos);
}
StageEvent::Resized(size) => {
self.ctx_mut().window_state.size = size;
}
StageEvent::ScaleFactorChanged(scale_factor) => {
#[allow(clippy::cast_possible_truncation)]
let mut ctx = self.ctx_mut();
ctx.window_state.set_scale_factor(scale_factor as f32);
ctx.fonts
.borrow_mut()
.preload_common_characters(16.0, ScaleFactor::new(scale_factor as f32));
}
StageEvent::FocusChanged(focused) => {
self.ctx_mut().window_state.is_focused = focused;
}
StageEvent::HoverChanged(hovered) => {
self.ctx_mut().window_state.is_hovered = hovered;
}
}
Ok(None)
}
/// Applies any pending restart/exit requests set by Lua via `Context`.
/// Should be called once before `frame()`.
pub fn update(&mut self) -> anyhow::Result<Option<StageTransition>> {
let (needs_restart, should_exit) = {
let ctx = self.ctx();
(ctx.needs_restart, ctx.should_exit)
};
if needs_restart {
self.restart()?;
}
if should_exit {
return Ok(Some(StageTransition::ToShutdown));
}
Ok(None)
}
/// Runs one PoB frame.
///
/// Resets the draw command recorder, advances subscripts, calls `OnFrame` (which issues draw
/// calls via the API), then collects the resulting draw commands.
///
/// Returns `can_elide: true` if the output is identical to the previous frame, letting the
/// caller skip rerendering.
pub fn frame(&mut self) -> anyhow::Result<StageFrameOutput> {
profiling::scope!("frame");
{
let mut ctx = self.ctx_mut();
ctx.recorder.reset();
ctx.set_recorder_viewport_to_window_size();
}
self.handle_subscripts()?;
{
profiling::scope!("lua_OnFrame");
api::on_frame(&self.lua)?;
}
let ctx = self.lua.app_data_ref::<Context>().unwrap();
let (layers_hash, layers) = ctx.recorder.finish();
let identical = layers_hash == self.previous_layers_hash;
self.previous_layers_hash = layers_hash;
// determine if another redraw needs to be requested after this frame.
// this mirrors SimpleGraphic's behavior.
let is_focused = ctx.window_state.is_focused;
let is_hovered = ctx.window_state.is_hovered;
let has_active_subscript = self.has_active_subscript();
let has_active_coroutine = self.has_active_coroutine();
let request_redraw =
is_focused || is_hovered || has_active_subscript || has_active_coroutine;
Ok(StageFrameOutput {
draw_commands: layers.values().flatten().copied().collect(),
can_elide: identical,
request_redraw,
scale_factor: ctx.window_state.scale_factor(),
})
}
/// Advances all running subscripts and forwards their results to Lua handlers.
/// Call once per frame.
fn handle_subscripts(&self) -> LuaResult<()> {
profiling::scope!("handle_subscripts");
// advance the subscripts and collect the work they produced
let subscript_events = self
.lua
.app_data_mut::<SubscriptManager>()
.unwrap()
.process();
for event in subscript_events {
match event {
SubscriptEvent::Call {
function_name,
arguments,
reply_tx,
} => {
let result = api::on_sub_call(&self.lua, function_name, arguments)
.map_err(anyhow::Error::from)
.and_then(NativeMultiValue::try_from);
// non-blocking calls have no reply channel and discard their result
if let Some(reply_tx) = reply_tx {
// if the subscript's thread has already gone away, there's nowhere to send
// the result, so ignore the error
let _ = reply_tx.send(result);
}
}
SubscriptEvent::Finished { id, return_values } => {
api::on_sub_finished(&self.lua, id, return_values)?;
}
SubscriptEvent::Error { id, error } => {
api::on_sub_error(&self.lua, id, error)?;
}
}
}
Ok(())
}
fn has_active_subscript(&self) -> bool {
self.lua
.app_data_ref::<SubscriptManager>()
.unwrap()
.has_running_subscripts()
}
fn has_active_coroutine(&self) -> bool {
self.get_coroutines().is_ok_and(|coroutines| {
coroutines.pairs::<mlua::Thread, bool>().any(|pair| {
pair.is_ok_and(|(thread, _)| {
matches!(
thread.status(),
ThreadStatus::Resumable | ThreadStatus::Running
)
})
})
})
}
fn get_coroutines(&self) -> LuaResult<Table> {
let coroutine_module: Table = self.lua.globals().get("coroutine")?;
let list_func: Function = coroutine_module.get("_list")?;
list_func.call::<Table>(())
}
pub fn clear_pressed(&self) {
self.ctx_mut().input_state.clear_pressed();
}
/// Calls PoB's `CanExit` handler. Used for unsaved changes prompt.
pub fn can_exit(&self) -> bool {
api::can_exit(&self.lua).unwrap_or(false)
}
/// Attaches the render-target window to the context
pub fn set_window(&self, window: Arc<Window>) {
self.ctx_mut().window_state.set_window(window);
}
/// Helper for accessing `Context`
#[inline]
fn ctx(&self) -> AppDataRef<'_, Context> {
self.lua.app_data_ref().unwrap()
}
/// Helper for getting mutable access to `Context`
#[inline]
fn ctx_mut(&self) -> AppDataRefMut<'_, Context> {
self.lua.app_data_mut().unwrap()
}
}
+224
View File
@@ -0,0 +1,224 @@
use crate::{
input::{Key, MouseButton},
pob::{
api::{
callback::{call_callback, get_custom_callback, set_custom_callback, set_main_object},
clipboard::{copy, paste},
compression::{deflate, inflate},
console::{console_clear, console_execute, console_print_table, console_printf},
general::{exit, get_time, open_url, render_init, restart, take_screenshot},
image_handle::register_image_handle_api,
input::{
get_cursor_pos, is_key_down, key_as_str, mousebutton_as_str, set_cursor_pos,
show_cursor,
},
lua::{load_module, protected_call, protected_load_module},
paths::{
get_runtime_path, get_script_path, get_user_path, get_work_dir, make_dir,
remove_dir, set_work_dir,
},
rendering::{
draw_image, draw_image_quad, get_async_count, get_draw_color, get_draw_layer,
set_clear_color, set_draw_color, set_draw_layer, set_viewport,
},
search_handle::new_search_handle,
subscript::{abort_subscript, is_subscript_running, launch_subscript},
text::{draw_string, get_index_at_cur, get_string_width, strip_escapes},
window::{
get_dpi_scale_override, get_screen_scale, get_screen_size, set_dpi_scale_override,
set_foreground, set_window_title,
},
},
subscript::NativeMultiValue,
},
};
use mlua::{Lua, MultiValue, Result as LuaResult};
use winit::keyboard::SmolStr;
mod callback;
mod clipboard;
mod color;
mod compression;
mod console;
mod general;
mod image_handle;
mod input;
mod lua;
mod paths;
mod rendering;
mod search_handle;
mod subscript;
mod text;
mod window;
/// Register functions that can be called from Lua
pub fn register_globals(lua: &Lua) -> LuaResult<()> {
let globals = lua.globals();
// callbacks
globals.set("SetMainObject", lua.create_function(set_main_object)?)?;
globals.set("SetCallback", lua.create_function(set_custom_callback)?)?;
globals.set("GetCallback", lua.create_function(get_custom_callback)?)?;
// paths
globals.set("GetUserPath", lua.create_function(get_user_path)?)?;
globals.set("GetScriptPath", lua.create_function(get_script_path)?)?;
globals.set("GetRuntimePath", lua.create_function(get_runtime_path)?)?;
globals.set("GetWorkDir", lua.create_function(get_work_dir)?)?;
globals.set("SetWorkDir", lua.create_function(set_work_dir)?)?;
globals.set("MakeDir", lua.create_function(make_dir)?)?;
globals.set("RemoveDir", lua.create_function(remove_dir)?)?;
// console
globals.set("ConPrintf", lua.create_function(console_printf)?)?;
globals.set("ConExecute", lua.create_function(console_execute)?)?;
globals.set("ConClear", lua.create_function(console_clear)?)?;
globals.set("ConPrintTable", lua.create_function(console_print_table)?)?;
// general
globals.set("GetTime", lua.create_function(get_time)?)?;
globals.set("Exit", lua.create_function(exit)?)?;
globals.set("Restart", lua.create_function(restart)?)?;
globals.set("OpenURL", lua.create_function(open_url)?)?;
globals.set("RenderInit", lua.create_function(render_init)?)?;
globals.set("TakeScreenshot", lua.create_function(take_screenshot)?)?;
// compression
globals.set("Inflate", lua.create_function(inflate)?)?;
globals.set("Deflate", lua.create_function(deflate)?)?;
// search handle
globals.set("NewFileSearch", lua.create_function(new_search_handle)?)?;
// image handle
register_image_handle_api(lua)?;
// clipboard
globals.set("Copy", lua.create_function(copy)?)?;
globals.set("Paste", lua.create_function(paste)?)?;
// input
globals.set("GetCursorPos", lua.create_function(get_cursor_pos)?)?;
globals.set("SetCursorPos", lua.create_function(set_cursor_pos)?)?;
globals.set("ShowCursor", lua.create_function(show_cursor)?)?;
globals.set("IsKeyDown", lua.create_function(is_key_down)?)?;
// window
globals.set("GetScreenSize", lua.create_function(get_screen_size)?)?;
globals.set("GetScreenScale", lua.create_function(get_screen_scale)?)?;
globals.set("SetWindowTitle", lua.create_function(set_window_title)?)?;
globals.set("SetForeground", lua.create_function(set_foreground)?)?;
globals.set(
"SetDPIScaleOverridePercent",
lua.create_function(set_dpi_scale_override)?,
)?;
globals.set(
"GetDPIScaleOverridePercent",
lua.create_function(get_dpi_scale_override)?,
)?;
// lua
globals.set("PCall", lua.create_function(protected_call)?)?;
globals.set("LoadModule", lua.create_function(load_module)?)?;
globals.set("PLoadModule", lua.create_function(protected_load_module)?)?;
// subscripts
globals.set(
"LaunchSubScript",
lua.create_function_mut(launch_subscript)?,
)?;
globals.set(
"IsSubScriptRunning",
lua.create_function(is_subscript_running)?,
)?;
globals.set("AbortSubScript", lua.create_function(abort_subscript)?)?;
// rendering
// NOTE: unfortunately, mlua's conversion of function arguments adds a lot of
// overhead. this is very noticeable for the draw functions which can be called
// thousands of times per frame. C functions are used to get raw access to
// the lua stack without the overhead.
unsafe { globals.set("SetDrawColor", lua.create_c_function(set_draw_color)?)? };
unsafe { globals.set("GetDrawColor", lua.create_c_function(get_draw_color)?)? };
unsafe { globals.set("SetViewport", lua.create_c_function(set_viewport)?)? };
unsafe {
globals.set("SetDrawLayer", lua.create_c_function(set_draw_layer)?)?;
}
unsafe { globals.set("DrawImage", lua.create_c_function(draw_image)?)? };
unsafe { globals.set("DrawImageQuad", lua.create_c_function(draw_image_quad)?)? };
globals.set("GetDrawLayer", lua.create_function(get_draw_layer)?)?;
globals.set("GetAsyncCount", lua.create_function(get_async_count)?)?;
globals.set("SetClearColor", lua.create_function(set_clear_color)?)?;
// text
// see comment above about why C functions are used for these
unsafe {
globals.set("DrawString", lua.create_c_function(draw_string)?)?;
}
unsafe {
globals.set("DrawStringWidth", lua.create_c_function(get_string_width)?)?;
}
globals.set(
"DrawStringCursorIndex",
lua.create_function_mut(get_index_at_cur)?,
)?;
globals.set("StripEscapes", lua.create_function(strip_escapes)?)?;
Ok(())
}
// Registers Lua callback functions that can be called from Rust
macro_rules! define_callbacks {
($($fn_name:ident => $lua_name:literal ($($arg:ident : $arg_ty:ty),*) -> $ret_ty:ty;)*) => {
$(
pub fn $fn_name(lua: &Lua, $($arg: $arg_ty),*) -> LuaResult<$ret_ty> {
call_callback(lua, $lua_name, ($($arg,)*))
}
)*
};
}
define_callbacks! {
on_init => "OnInit"() -> ();
on_exit => "OnExit"() -> ();
on_frame => "OnFrame"() -> ();
can_exit => "CanExit"() -> bool;
on_char => "OnChar"(ch: char) -> ();
on_sub_call => "OnSubCall"(name: String, args: NativeMultiValue) -> MultiValue;
on_sub_finished => "OnSubFinished"(id: u64, return_values: NativeMultiValue) -> ();
on_sub_error => "OnSubError"(id: u64, error_msg: String) -> ();
}
// `on_key_up` and `on_key_down` are manually defined because they require additional conversions
// between key representations.
pub enum Input {
Keyboard(Key),
Mouse(MouseButton),
WheelUp,
WheelDown,
}
impl Input {
fn as_pob_key_str(&self) -> Option<SmolStr> {
match self {
Self::Keyboard(key) => key_as_str(key.clone()),
Self::Mouse(button) => mousebutton_as_str(*button),
Self::WheelUp => Some("WHEELUP".into()),
Self::WheelDown => Some("WHEELDOWN".into()),
}
}
}
pub fn on_key_down(lua: &Lua, key: &Input, double_click: bool) -> LuaResult<()> {
let Some(key_str) = key.as_pob_key_str() else {
return Ok(());
};
call_callback(lua, "OnKeyDown", (key_str.as_str(), double_click))
}
pub fn on_key_up(lua: &Lua, key: &Input) -> LuaResult<()> {
let Some(key_str) = key.as_pob_key_str() else {
return Ok(());
};
call_callback(lua, "OnKeyUp", (key_str.as_str(),))
}
+56
View File
@@ -0,0 +1,56 @@
//! During initialization, PoB calls `set_main_object` with a callback table. Functions defined in
//! this table are used to call back into Lua from Rust.
//!
//! Custom callback functions can be added with `set_custom_callback` and retrieved with
//! `get_custom_callback`. Functions defined in the main object are shadowed by custom functions
//! with the same name.
use mlua::{FromLuaMulti, Function, IntoLuaMulti, Lua, Result as LuaResult, Table, Value};
const CALLBACK_REGISTRY_NAME: &str = "uicallbacks";
pub fn set_main_object(l: &Lua, main_object: Table) -> LuaResult<()> {
let callback_table = l.create_table()?;
callback_table.set("MainObject", main_object)?;
l.set_named_registry_value(CALLBACK_REGISTRY_NAME, callback_table)
}
pub fn set_custom_callback(l: &Lua, (name, func): (String, Function)) -> LuaResult<()> {
let callback_table: Table = l.named_registry_value(CALLBACK_REGISTRY_NAME)?;
callback_table.set(name, func)
}
pub fn get_custom_callback(l: &Lua, name: String) -> LuaResult<Function> {
let callback_table: Table = l.named_registry_value(CALLBACK_REGISTRY_NAME)?;
callback_table.get(name)
}
/// Looks up a callback by name.
///
/// Custom callbacks shadow callbacks defined in main object.
fn get_callback(lua: &Lua, name: &str) -> LuaResult<Function> {
let callback_table: Table = lua.named_registry_value(CALLBACK_REGISTRY_NAME)?;
// check for custom callbacks first
if let Value::Function(f) = callback_table.get(name)? {
return Ok(f);
}
// then look look in main object
if let Value::Table(main_object) = callback_table.get("MainObject")?
&& let Value::Function(f) = main_object.get(name)?
{
// these functions expect the main object as first argument so we bind it here
return f.bind(main_object);
}
Err(anyhow::anyhow!("Callback '{name}' not found").into())
}
#[inline]
pub fn call_callback<A, R>(lua: &Lua, name: &str, args: A) -> LuaResult<R>
where
A: IntoLuaMulti,
R: FromLuaMulti,
{
get_callback(lua, name)?.call(args)
}
+13
View File
@@ -0,0 +1,13 @@
use crate::pob::Context;
use mlua::{Lua, Result as LuaResult};
pub fn copy(l: &Lua, text: String) -> LuaResult<()> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
ctx.window_state.set_clipboard_text(text);
Ok(())
}
pub fn paste(l: &Lua, _: ()) -> LuaResult<Option<String>> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
Ok(ctx.window_state.get_clipboard_text())
}
+41
View File
@@ -0,0 +1,41 @@
use crate::color::Srgba;
#[inline]
fn hex_byte(a: u8, b: u8) -> u8 {
(hex_digit(a) << 4) | hex_digit(b)
}
#[inline]
fn hex_digit(c: u8) -> u8 {
match c {
b'0'..=b'9' => c - b'0',
b'a'..=b'f' => c - b'a' + 10,
b'A'..=b'F' => c - b'A' + 10,
_ => unreachable!("invalid hex digit"),
}
}
impl Srgba {
pub fn from_escape_code(escape_str: &str) -> Self {
let bytes = escape_str.as_bytes();
match bytes {
[b'^', b'0'] => Self::from_rgb(0, 0, 0),
[b'^', b'1'] => Self::from_rgb(255, 0, 0),
[b'^', b'2'] => Self::from_rgb(0, 255, 0),
[b'^', b'3'] => Self::from_rgb(0, 0, 255),
[b'^', b'4'] => Self::from_rgb(255, 255, 0),
[b'^', b'5'] => Self::from_rgb(255, 0, 255),
[b'^', b'6'] => Self::from_rgb(0, 255, 255),
[b'^', b'7'] => Self::from_rgb(255, 255, 255),
[b'^', b'8'] => Self::from_rgb(178, 178, 178),
[b'^', b'9'] => Self::from_rgb(102, 102, 102),
[b'^', b'x' | b'X', r1, r2, g1, g2, b1, b2] => {
Self::from_rgb(hex_byte(*r1, *r2), hex_byte(*g1, *g2), hex_byte(*b1, *b2))
}
_ => Self::WHITE,
}
}
}
+57
View File
@@ -0,0 +1,57 @@
use flate2::{
Compression,
read::{GzDecoder, GzEncoder, ZlibDecoder, ZlibEncoder},
};
use mlua::{IntoLuaMulti, Lua, LuaString, MultiValue, Result as LuaResult, Value};
use std::io::Read;
pub fn inflate(l: &Lua, compressed: LuaString) -> LuaResult<MultiValue> {
let compressed_bytes = &compressed.as_bytes()[..];
// prevent decompression of input larger than 128MiB
if compressed_bytes.len() > (128 << 20) {
return (Value::Nil, "Input larger than 128 MiB").into_lua_multi(l);
}
let mut decompressed = Vec::new();
let result = if is_gzip(compressed_bytes) {
GzDecoder::new(compressed_bytes).read_to_end(&mut decompressed)
} else {
ZlibDecoder::new(compressed_bytes).read_to_end(&mut decompressed)
};
match result {
Ok(_) => l.create_string(&decompressed)?.into_lua_multi(l),
Err(e) => (Value::Nil, e.to_string()).into_lua_multi(l),
}
}
fn is_gzip(data: &[u8]) -> bool {
data.len() >= 2 && data[0] == 0x1f && data[1] == 0x8b
}
pub fn deflate(
l: &Lua,
(uncompressed, use_gzip): (LuaString, Option<bool>),
) -> LuaResult<MultiValue> {
let uncompressed_bytes = &uncompressed.as_bytes()[..];
// prevent compression of input larger than 128MiB
if uncompressed_bytes.len() > (128 << 20) {
return (Value::Nil, "Input larger than 128 MiB").into_lua_multi(l);
}
let mut compressed = Vec::new();
let result = if use_gzip.unwrap_or(false) {
GzEncoder::new(uncompressed_bytes, Compression::best()).read_to_end(&mut compressed)
} else {
ZlibEncoder::new(uncompressed_bytes, Compression::best()).read_to_end(&mut compressed)
};
match result {
Ok(_) => l.create_string(&compressed)?.into_lua_multi(l),
Err(e) => (Value::Nil, e.to_string()).into_lua_multi(l),
}
}
+56
View File
@@ -0,0 +1,56 @@
use mlua::{Function, Lua, MultiValue, Result as LuaResult, Table, Value};
use std::io::{Write, stdout};
pub fn console_printf(l: &Lua, (fmt, args): (String, MultiValue)) -> LuaResult<()> {
// uses lua's builtin string.format function
let string_module: Table = l.globals().get("string")?;
let format_func: Function = string_module.get("format")?;
let formatted_string = format_func.call::<String>((fmt, args))?;
println!("{formatted_string}");
Ok(())
}
pub fn console_execute(_l: &Lua, _cmd: String) -> LuaResult<()> {
Ok(())
}
pub fn console_clear(_l: &Lua, _: ()) -> LuaResult<()> {
Ok(())
}
pub fn console_print_table(
_l: &Lua,
(table, no_recursive): (Table, Option<bool>),
) -> LuaResult<()> {
print_table(&table, 0, !no_recursive.unwrap_or(true))?;
Ok(())
}
fn print_table(table: &Table, indent: usize, recursive: bool) -> LuaResult<()> {
let mut lock = stdout().lock();
writeln!(lock, "{{")?;
for pair in table.pairs::<Value, Value>() {
let inner_ind = indent + 2;
let (key, value) = pair?;
if key.is_string() {
write!(lock, "{0:>1$}\"{2}\" = ", "", inner_ind, key.to_string()?)?;
} else {
write!(lock, "{0:>1$}{2} = ", "", inner_ind, key.to_string()?)?;
}
if value.is_table() {
if recursive {
print_table(value.as_table().unwrap(), indent + 2, recursive)?;
} else {
writeln!(lock, "{}", value.to_string()?)?;
}
} else if value.is_string() {
writeln!(lock, "\"{}\"", value.to_string()?)?;
} else {
writeln!(lock, "{}", value.to_string()?)?;
}
}
writeln!(lock, "{0:>1$}}}", "", indent)?;
Ok(())
}
+43
View File
@@ -0,0 +1,43 @@
use crate::pob::Context;
use mlua::{IntoLuaMulti, Lua, MultiValue, Result as LuaResult, Variadic};
use std::time::{SystemTime, UNIX_EPOCH};
pub fn get_time(_l: &Lua, _: ()) -> LuaResult<u128> {
Ok(SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("UNIX_EPOCH is before now")
.as_millis())
}
pub fn exit(l: &Lua, exit_msg: Option<String>) -> LuaResult<()> {
if let Some(exit_msg) = exit_msg {
println!("{exit_msg}");
}
let mut ctx = l.app_data_mut::<Context>().unwrap();
ctx.should_exit = true;
Ok(())
}
pub fn restart(l: &Lua, _: ()) -> LuaResult<()> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
ctx.needs_restart = true;
Ok(())
}
pub fn open_url(l: &Lua, url: String) -> LuaResult<MultiValue> {
match open::that(url) {
Ok(()) => ().into_lua_multi(l),
Err(_) => "Unable to open url!".into_lua_multi(l),
}
}
pub fn render_init(l: &Lua, features: Variadic<String>) -> LuaResult<()> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
ctx.is_dpi_aware = features.iter().any(|feat| feat == "DPI_AWARE");
Ok(())
}
pub fn take_screenshot(_l: &Lua, _: ()) -> LuaResult<()> {
log::warn!("take_screenshot is not implemented!");
Ok(())
}
+322
View File
@@ -0,0 +1,322 @@
use std::{
ffi::{CStr, c_int},
ptr,
};
use mlua::{Lua, Result as LuaResult, ffi};
use crate::{
dpi::PhysicalSize,
pob::Context,
renderer::textures::{TextureHandle, TextureId, TextureOptions},
};
pub struct ImageHandle {
texture: Option<TextureHandle>,
}
impl ImageHandle {
#[inline]
pub const fn new() -> Self {
Self { texture: None }
}
#[inline]
pub fn texture_id(&self) -> Option<TextureId> {
self.texture.as_ref().map(TextureHandle::id)
}
#[inline]
pub fn is_valid(&self) -> bool {
self.texture.is_some()
}
#[inline]
pub fn is_loading(&self) -> bool {
self.texture.as_ref().is_none_or(TextureHandle::is_loading)
}
#[inline]
pub fn image_size(&self) -> PhysicalSize<u32> {
self.texture
.as_ref()
.and_then(TextureHandle::size)
.unwrap_or_else(PhysicalSize::zero)
}
}
// Lua userdata implementation for `ImageHandle`.
//
// `mlua::UserData` instances are wrapped in a special way to maintain Rust
// safety guarantees which introduces additional overhead.
// https://github.com/mlua-rs/mlua/discussions/545#discussioncomment-12518251
//
// To avoid this overhead, `ImageHandle` is stored directly in Lua userdata
// using the raw Lua C API.
const IMAGE_HANDLE_METATABLE: &[u8] = b"runtime.ImageHandle\0";
#[inline]
unsafe fn push_image_handle(state: *mut ffi::lua_State) -> *mut ImageHandle {
let ptr = unsafe { ffi::lua_newuserdata(state, std::mem::size_of::<ImageHandle>()) }
.cast::<ImageHandle>();
// Construct the Rust object directly in Lua-owned memory
unsafe {
ptr.write(ImageHandle::new());
}
ptr
}
/// Puts `ImageHandle` on the Lua stack
unsafe extern "C-unwind" fn new_image_handle(state: *mut ffi::lua_State) -> c_int {
unsafe {
push_image_handle(state);
// The metatable must already have been registered.
ffi::luaL_getmetatable(state, IMAGE_HANDLE_METATABLE.as_ptr().cast());
ffi::lua_setmetatable(state, -2);
}
1
}
/// Gets an `ImageHandle` from the Lua stack.
#[inline]
unsafe fn get_image_handle(state: *mut ffi::lua_State, index: c_int) -> *mut ImageHandle {
unsafe {
ffi::luaL_checkudata(state, index, IMAGE_HANDLE_METATABLE.as_ptr().cast())
.cast::<ImageHandle>()
}
}
#[inline]
pub unsafe fn image_handle_texture_id(
state: *mut ffi::lua_State,
index: c_int,
) -> Option<TextureId> {
if unsafe { ffi::lua_isnil(state, index) } != 0 {
return None;
}
let ptr = unsafe { ffi::lua_touserdata(state, index) }.cast::<ImageHandle>();
if ptr.is_null() {
return None;
}
unsafe { (*ptr).texture_id() }
}
// Drops the `ImageHandle`
unsafe extern "C-unwind" fn image_handle_gc(state: *mut ffi::lua_State) -> c_int {
let ptr = unsafe { ffi::lua_touserdata(state, 1) }.cast::<ImageHandle>();
if !ptr.is_null() {
unsafe {
ptr::drop_in_place(ptr);
}
}
0
}
unsafe extern "C-unwind" fn image_handle_is_valid(state: *mut ffi::lua_State) -> c_int {
let handle = unsafe { get_image_handle(state, 1) };
let valid = unsafe { (*handle).is_valid() };
unsafe {
ffi::lua_pushboolean(state, c_int::from(valid));
}
1
}
unsafe extern "C-unwind" fn image_handle_is_loading(state: *mut ffi::lua_State) -> c_int {
let handle = unsafe { get_image_handle(state, 1) };
let loading = unsafe { (*handle).is_loading() };
unsafe {
ffi::lua_pushboolean(state, c_int::from(loading));
}
1
}
unsafe extern "C-unwind" fn image_handle_image_size(state: *mut ffi::lua_State) -> c_int {
let handle = unsafe { get_image_handle(state, 1) };
let size = unsafe { (*handle).image_size() };
unsafe {
ffi::lua_pushinteger(state, size.width as ffi::lua_Integer);
ffi::lua_pushinteger(state, size.height as ffi::lua_Integer);
}
2
}
unsafe extern "C-unwind" fn image_handle_unload(state: *mut ffi::lua_State) -> c_int {
let handle = unsafe { get_image_handle(state, 1) };
unsafe {
(*handle).texture = None;
}
0
}
unsafe extern "C-unwind" fn image_handle_load(state: *mut ffi::lua_State) -> c_int {
let handle = unsafe { get_image_handle(state, 1) };
// Path
let path_ptr = unsafe { ffi::luaL_checklstring(state, 2, ptr::null_mut()) };
if path_ptr.is_null() {
unsafe {
ffi::luaL_error(state, c"Invalid image path".as_ptr());
}
unreachable!();
}
let path = unsafe { CStr::from_ptr(path_ptr) };
let path = match path.to_str() {
Ok(path) => path.to_owned(),
Err(_) => {
unsafe {
ffi::luaL_error(state, c"Image path is not valid UTF-8".as_ptr());
}
unreachable!();
}
};
// Flags
let mut is_async = false;
let mut generate_mipmaps = false;
let mut options = TextureOptions::LINEAR_REPEAT;
let nargs = unsafe { ffi::lua_gettop(state) };
for index in 3..=nargs {
if unsafe { ffi::lua_type(state, index) } != ffi::LUA_TSTRING {
continue;
}
let mut len = 0;
let ptr = unsafe { ffi::lua_tolstring(state, index, &raw mut len) };
if ptr.is_null() {
continue;
}
let bytes = unsafe { std::slice::from_raw_parts(ptr.cast::<u8>(), len) };
match bytes {
b"CLAMP" => {
options.wrap_mode = wgpu::AddressMode::ClampToEdge;
}
b"NEAREST" => {
options.magnification = wgpu::FilterMode::Nearest;
}
b"ASYNC" => {
is_async = true;
}
b"MIPMAP" => {
generate_mipmaps = true;
}
_ => {}
}
}
// Load / update
let handle = unsafe { &mut *handle };
let lua = unsafe { Lua::get_or_init_from_ptr(state) };
let ctx = lua.app_data_ref::<Context>().unwrap();
match &mut handle.texture {
Some(texture_handle) => {
// Keep the existing TextureHandle and update underlying texture
let _ = ctx.texture_manager.borrow().update_texture(
texture_handle.id(),
path,
options,
is_async,
generate_mipmaps,
);
}
None => {
if let Ok(texture_handle) =
ctx.texture_manager
.borrow()
.load_texture(path, options, is_async, generate_mipmaps)
{
handle.texture = Some(texture_handle);
}
}
}
0
}
unsafe fn register_image_handle_metatable(state: *mut ffi::lua_State) {
unsafe {
let created = ffi::luaL_newmetatable(state, IMAGE_HANDLE_METATABLE.as_ptr().cast());
// Create metatable if it doesn't exist already
if created != 0 {
// metatable.__gc = image_handle_gc
ffi::lua_pushcfunction(state, image_handle_gc);
ffi::lua_setfield(state, -2, c"__gc".as_ptr());
// Create method table.
ffi::lua_newtable(state);
// Load
ffi::lua_pushcfunction(state, image_handle_load);
ffi::lua_setfield(state, -2, c"Load".as_ptr());
// Unload
ffi::lua_pushcfunction(state, image_handle_unload);
ffi::lua_setfield(state, -2, c"Unload".as_ptr());
// IsValid
ffi::lua_pushcfunction(state, image_handle_is_valid);
ffi::lua_setfield(state, -2, c"IsValid".as_ptr());
// IsLoading
ffi::lua_pushcfunction(state, image_handle_is_loading);
ffi::lua_setfield(state, -2, c"IsLoading".as_ptr());
// ImageSize
ffi::lua_pushcfunction(state, image_handle_image_size);
ffi::lua_setfield(state, -2, c"ImageSize".as_ptr());
// metatable.__index = method table
ffi::lua_setfield(state, -2, c"__index".as_ptr());
}
// Pop metatable.
ffi::lua_pop(state, 1);
}
}
pub fn register_image_handle_api(lua: &Lua) -> LuaResult<()> {
let globals = lua.globals();
unsafe {
lua.exec_raw::<()>((), |state| {
register_image_handle_metatable(state);
})
}?;
globals.set("NewImageHandle", unsafe {
lua.create_c_function(new_image_handle)
}?)?;
Ok(())
}
+127
View File
@@ -0,0 +1,127 @@
use crate::{
input::{Key, MouseButton},
pob::Context,
};
use mlua::{Lua, Result as LuaResult};
use winit::keyboard::{NamedKey, SmolStr};
pub fn get_cursor_pos(l: &Lua, _: ()) -> LuaResult<(u32, u32)> {
let ctx = l.app_data_ref::<Context>().unwrap();
let pos = ctx.input_state.mouse_pos();
Ok((pos.x as u32, pos.y as u32))
}
pub fn set_cursor_pos(_l: &Lua, _: ()) -> LuaResult<()> {
unimplemented!()
}
pub fn show_cursor(_l: &Lua, _: ()) -> LuaResult<()> {
unimplemented!()
}
pub fn is_key_down(l: &Lua, key_name: String) -> LuaResult<bool> {
let ctx = l.app_data_ref::<Context>().unwrap();
if let Some(key) = str_as_key(&key_name) {
Ok(ctx.input_state.key_pressed(&key))
} else if let Some(button) = str_as_mousebutton(&key_name) {
Ok(ctx.input_state.mouse_pressed(button))
} else {
Ok(false)
}
}
const NAMED_KEYS: &[(&str, NamedKey)] = &[
("BACK", NamedKey::Backspace),
("TAB", NamedKey::Tab),
("RETURN", NamedKey::Enter),
("ESCAPE", NamedKey::Escape),
("SHIFT", NamedKey::Shift),
("CTRL", NamedKey::Control),
("ALT", NamedKey::Alt),
("PAUSE", NamedKey::Pause),
("PAGEUP", NamedKey::PageUp),
("PAGEDOWN", NamedKey::PageDown),
("END", NamedKey::End),
("HOME", NamedKey::Home),
("PRINTSCREEN", NamedKey::PrintScreen),
("INSERT", NamedKey::Insert),
("DELETE", NamedKey::Delete),
("UP", NamedKey::ArrowUp),
("DOWN", NamedKey::ArrowDown),
("LEFT", NamedKey::ArrowLeft),
("RIGHT", NamedKey::ArrowRight),
("F1", NamedKey::F1),
("F2", NamedKey::F2),
("F3", NamedKey::F3),
("F4", NamedKey::F4),
("F5", NamedKey::F5),
("F6", NamedKey::F6),
("F7", NamedKey::F7),
("F8", NamedKey::F8),
("F9", NamedKey::F9),
("F10", NamedKey::F10),
("F11", NamedKey::F11),
("F12", NamedKey::F12),
("F13", NamedKey::F13),
("F14", NamedKey::F14),
("F15", NamedKey::F15),
(" ", NamedKey::Space),
("NUMLOCK", NamedKey::NumLock),
("SCROLL", NamedKey::ScrollLock),
];
/// Atempts to convert PoB's key representation into a `Key`.
fn str_as_key(s: &str) -> Option<Key> {
let upper = s.to_uppercase();
// named keys
if let Some((_, named)) = NAMED_KEYS.iter().find(|(name, _)| *name == upper) {
return Some(Key::Named(*named));
}
// single-character keys
let mut chars = upper.chars();
let first = chars.next()?;
chars
.next()
.is_none()
.then(|| Key::Character(SmolStr::new(first.to_string())))
}
/// Atempts to convert a `Key` into PoB's key representation
pub fn key_as_str(key: Key) -> Option<SmolStr> {
match key {
Key::Character(ch) if ch == "=" => Some(SmolStr::new("+")), // matches PoB's behavior
Key::Character(ch) => Some(ch),
Key::Named(named) => NAMED_KEYS
.iter()
.find(|(_, n)| *n == named)
.map(|(name, _)| SmolStr::new(*name)),
_ => None,
}
}
const MOUSE_BUTTONS: &[(&str, MouseButton)] = &[
("LEFTBUTTON", MouseButton::Left),
("RIGHTBUTTON", MouseButton::Right),
("MIDDLEBUTTON", MouseButton::Middle),
("MOUSE4", MouseButton::Back),
("MOUSE5", MouseButton::Forward),
];
/// Atempts to convert PoB's key representation into a `MouseButton`.
fn str_as_mousebutton(s: &str) -> Option<MouseButton> {
MOUSE_BUTTONS
.iter()
.find(|(name, _)| *name == s.to_uppercase())
.map(|(_, button)| *button)
}
/// Atempts to convert a `MouseButton` into PoB's key representation
pub fn mousebutton_as_str(button: MouseButton) -> Option<SmolStr> {
MOUSE_BUTTONS
.iter()
.find(|(_, b)| *b == button)
.map(|(name, _)| SmolStr::new(*name))
}
+55
View File
@@ -0,0 +1,55 @@
use crate::{
pob::Context,
util::{change_working_directory, load_lua_file},
};
use mlua::{Function, IntoLuaMulti, Lua, MultiValue, Result as LuaResult, Value};
use std::env;
pub fn protected_call(l: &Lua, (func, args): (Function, MultiValue)) -> LuaResult<MultiValue> {
match func.call::<MultiValue>(args) {
// callers expect first return value to be Nil on success
Ok(return_values) => Ok(std::iter::once(Value::Nil).chain(return_values).collect()),
// otherwise it is set to error message.
Err(err) => err.to_string().into_lua_multi(l),
}
}
pub fn load_module(l: &Lua, (name, args): (String, MultiValue)) -> LuaResult<MultiValue> {
let script_dir = {
let ctx = l.app_data_ref::<Context>().unwrap();
ctx.script_dir.clone()
};
let mut module_path = script_dir.join(name);
if module_path.extension().is_none() {
module_path.set_extension("lua");
}
let current_dir = env::current_dir()?;
change_working_directory(script_dir.as_path())?;
let result = load_lua_file(l, &module_path).and_then(|chunk| chunk.call::<MultiValue>(args));
change_working_directory(current_dir)?;
result
}
pub fn protected_load_module(l: &Lua, (name, args): (String, MultiValue)) -> LuaResult<MultiValue> {
let script_dir = {
let ctx = l.app_data_ref::<Context>().unwrap();
ctx.script_dir.clone()
};
let mut module_path = script_dir.join(name);
if module_path.extension().is_none() {
module_path.set_extension("lua");
}
let current_dir = env::current_dir()?;
change_working_directory(script_dir.as_path())?;
let result =
match load_lua_file(l, &module_path).and_then(|chunk| chunk.call::<MultiValue>(args)) {
// on success, callers expect a Nil followed by return values
Ok(res) => Ok(std::iter::once(Value::Nil).chain(res).collect()),
// otherwise it is set to error message.
Err(err) => err.to_string().into_lua_multi(l),
};
change_working_directory(current_dir)?;
result
}
+58
View File
@@ -0,0 +1,58 @@
use mlua::{IntoLuaMulti, Lua, MultiValue, Result as LuaResult, Value};
use std::{fs, path::PathBuf};
use crate::{
pob::Context,
util::{change_working_directory, get_executable_dir},
};
pub fn get_user_path(l: &Lua, _: ()) -> LuaResult<PathBuf> {
let ctx = l.app_data_ref::<Context>().unwrap();
Ok(ctx.script_dir.join("userdata"))
}
// parent directory of Launch.lua script
pub fn get_script_path(l: &Lua, _: ()) -> LuaResult<PathBuf> {
let ctx = l.app_data_ref::<Context>().unwrap();
Ok(ctx.script_dir.clone())
}
// parent directory of executable
pub fn get_runtime_path(_: &Lua, _: ()) -> LuaResult<PathBuf> {
Ok(get_executable_dir().unwrap_or_default())
}
pub fn get_work_dir(l: &Lua, _: ()) -> LuaResult<PathBuf> {
let ctx = l.app_data_ref::<Context>().unwrap();
Ok(ctx.current_working_dir.clone())
}
// NOTE: unused
pub fn set_work_dir(l: &Lua, path: String) -> LuaResult<()> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
if change_working_directory(&path).is_ok() {
ctx.current_working_dir = path.into();
}
Ok(())
}
pub fn make_dir(l: &Lua, path: String) -> LuaResult<MultiValue> {
match fs::create_dir_all(path) {
// callers expect first return value to be true on success
Ok(()) => (true).into_lua_multi(l),
// otherwise it is set to Nil and second return value is set to error msg
Err(err) => (Value::Nil, err.to_string()).into_lua_multi(l),
}
}
pub fn remove_dir(l: &Lua, (path, recursive): (String, Option<bool>)) -> LuaResult<MultiValue> {
let result = if recursive.unwrap_or(false) {
fs::remove_dir_all(&path)
} else {
fs::remove_dir(&path)
};
match result {
Ok(()) => (true).into_lua_multi(l),
Err(err) => (Value::Nil, err.to_string()).into_lua_multi(l),
}
}
+270
View File
@@ -0,0 +1,270 @@
use crate::{
color::Srgba,
math::{Point, Quad, Rect, Size},
pob::{Context, api::image_handle::image_handle_texture_id},
};
use core::ffi::c_int;
use mlua::{
Lua, Result as LuaResult,
ffi::{self},
};
macro_rules! str_from_stack {
($s:ident, $i:expr) => {
unsafe {
let mut size = 0;
let data = ffi::luaL_checklstring($s, $i, &mut size);
let bytes = std::slice::from_raw_parts(data.cast::<u8>(), size);
std::str::from_utf8_unchecked(bytes)
}
};
}
macro_rules! f32_from_stack {
($s:ident, $i:expr) => {
unsafe { ffi::luaL_checknumber($s, $i) } as f32
};
}
macro_rules! i32_from_stack {
($s:ident, $i:expr) => {
unsafe { ffi::luaL_checkinteger($s, $i) } as i32
};
}
pub unsafe extern "C-unwind" fn set_draw_color(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("set_draw_color");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let mut ctx = lua_instance.app_data_mut::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
match nargs {
// escape_code
1 => {
let esc_str = str_from_stack!(state, -nargs);
let color = Srgba::from_escape_code(esc_str);
ctx.recorder.set_draw_color(color);
}
// rgb
3 => {
let r = f32_from_stack!(state, -nargs);
let g = f32_from_stack!(state, -nargs + 1);
let b = f32_from_stack!(state, -nargs + 2);
let color = Srgba::new_f32(r, g, b, 1.0);
ctx.recorder.set_draw_color(color);
}
// rgba
4 => {
let r = f32_from_stack!(state, -nargs);
let g = f32_from_stack!(state, -nargs + 1);
let b = f32_from_stack!(state, -nargs + 2);
let a = f32_from_stack!(state, -nargs + 3);
let color = Srgba::new_f32(r, g, b, a);
ctx.recorder.set_draw_color(color);
}
_ => panic!("Unexpected number of arguments"),
}
0
}
pub unsafe extern "C-unwind" fn get_draw_color(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("get_draw_color");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let ctx = lua_instance.app_data_ref::<Context>().unwrap();
let color: [f32; 4] = ctx.recorder.get_draw_color().into();
unsafe { ffi::lua_pushnumber(state, f64::from(color[0])) };
unsafe { ffi::lua_pushnumber(state, f64::from(color[1])) };
unsafe { ffi::lua_pushnumber(state, f64::from(color[2])) };
unsafe { ffi::lua_pushnumber(state, f64::from(color[3])) };
4
}
pub unsafe extern "C-unwind" fn set_viewport(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("set_viewport");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let mut ctx = lua_instance.app_data_mut::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
match nargs {
0 => ctx.set_recorder_viewport_to_window_size(),
4 => {
let x = f32_from_stack!(state, -nargs);
let y = f32_from_stack!(state, -nargs + 1);
let w = f32_from_stack!(state, -nargs + 2);
let h = f32_from_stack!(state, -nargs + 3);
let rect = Rect::from_origin_and_size(Point::new(x, y), Size::new(w, h));
ctx.recorder.set_viewport(rect);
}
_ => panic!("Unexpected number of arguments"),
}
0
}
pub unsafe extern "C-unwind" fn set_draw_layer(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("set_draw_layer");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let mut ctx = lua_instance.app_data_mut::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
match nargs {
1 => {
let layer = i32_from_stack!(state, -nargs);
ctx.recorder.set_draw_layer(layer, 0);
}
2 => {
let layer = match unsafe { ffi::lua_type(state, -nargs) } {
ffi::LUA_TNIL => None,
ffi::LUA_TNUMBER => {
let layer = i32_from_stack!(state, -nargs);
Some(layer)
}
t => panic!("Expected Nil or Number, got {t:?}"),
};
let sublayer = i32_from_stack!(state, -nargs + 1);
if let Some(layer) = layer {
ctx.recorder.set_draw_layer(layer, sublayer);
} else {
ctx.recorder.set_draw_sublayer(sublayer);
}
}
_ => panic!("Unexpected number of arguments"),
}
0
}
pub unsafe extern "C-unwind" fn draw_image(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("draw_image");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let mut ctx = lua_instance.app_data_mut::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
assert!(
matches!(nargs, 5 | 6 | 9 | 10),
"Unexpected number of arguments"
);
#[allow(clippy::manual_range_patterns)]
let parse_uv = matches!(nargs, 9 | 10);
let parse_layer_idx = matches!(nargs, 6 | 10);
let texture_id = unsafe { image_handle_texture_id(state, -nargs) };
// left, top, width, height
let x = f32_from_stack!(state, -nargs + 1);
let y = f32_from_stack!(state, -nargs + 2);
let w = f32_from_stack!(state, -nargs + 3);
let h = f32_from_stack!(state, -nargs + 4);
let rect = Rect::from_origin_and_size(Point::new(x, y), Size::new(w, h));
// u1, v1, u2, v2
let mut i = 5;
let uv = if parse_uv {
let u1 = f32_from_stack!(state, -nargs + i);
let v1 = f32_from_stack!(state, -nargs + i + 1);
let u2 = f32_from_stack!(state, -nargs + i + 2);
let v2 = f32_from_stack!(state, -nargs + i + 3);
i += 4;
Some(Rect::new(Point::new(u1, v1), Point::new(u2, v2)))
} else {
None
};
let layer_idx = if parse_layer_idx {
let layer_idx = i32_from_stack!(state, -nargs + i);
(layer_idx - 1) as u32
} else {
0
};
ctx.recorder.draw_image(rect, texture_id, uv, layer_idx);
0
}
pub unsafe extern "C-unwind" fn draw_image_quad(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("draw_image_quad");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let mut ctx = lua_instance.app_data_mut::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
assert!(
matches!(nargs, 9 | 10 | 17 | 18),
"Unexpected number of arguments"
);
#[allow(clippy::manual_range_patterns)]
let parse_uv = matches!(nargs, 17 | 18);
let parse_layer_idx = matches!(nargs, 10 | 18);
let texture_id = unsafe { image_handle_texture_id(state, -nargs) };
// x1, y1, x2, y2, ...
let x1 = f32_from_stack!(state, -nargs + 1);
let y1 = f32_from_stack!(state, -nargs + 2);
let x2 = f32_from_stack!(state, -nargs + 3);
let y2 = f32_from_stack!(state, -nargs + 4);
let x3 = f32_from_stack!(state, -nargs + 5);
let y3 = f32_from_stack!(state, -nargs + 6);
let x4 = f32_from_stack!(state, -nargs + 7);
let y4 = f32_from_stack!(state, -nargs + 8);
let quad = Quad::new(
Point::new(x1, y1),
Point::new(x2, y2),
Point::new(x3, y3),
Point::new(x4, y4),
);
// u1, v1, u2, v2, ...
let mut i = 9;
let uv = if parse_uv {
let u1 = f32_from_stack!(state, -nargs + i);
let v1 = f32_from_stack!(state, -nargs + i + 1);
let u2 = f32_from_stack!(state, -nargs + i + 2);
let v2 = f32_from_stack!(state, -nargs + i + 3);
let u3 = f32_from_stack!(state, -nargs + i + 4);
let v3 = f32_from_stack!(state, -nargs + i + 5);
let u4 = f32_from_stack!(state, -nargs + i + 6);
let v4 = f32_from_stack!(state, -nargs + i + 7);
i += 8;
Some(Quad::new(
Point::new(u1, v1),
Point::new(u2, v2),
Point::new(u3, v3),
Point::new(u4, v4),
))
} else {
None
};
let layer_idx = if parse_layer_idx {
let layer_idx = i32_from_stack!(state, -nargs + i);
(layer_idx - 1) as u32
} else {
0
};
ctx.recorder
.draw_image_quad(quad, texture_id, uv, layer_idx);
0
}
pub fn get_draw_layer(l: &Lua, _: ()) -> LuaResult<i32> {
let ctx = l.app_data_ref::<Context>().unwrap();
// matching PoB's behavior where only the sublayer is returned
Ok(ctx.recorder.get_draw_layer().1)
}
pub fn get_async_count(_: &Lua, _: ()) -> LuaResult<()> {
unimplemented!()
}
pub fn set_clear_color(_: &Lua, _: ()) -> LuaResult<()> {
unimplemented!()
}
@@ -1,9 +1,27 @@
use std::fs;
use std::path::{Path, PathBuf};
use std::time::SystemTime;
use glob::{Paths, glob};
use mlua::{IntoLua, Lua, Result as LuaResult, UserData, Value};
use std::{
fs,
path::{Path, PathBuf},
time::SystemTime,
};
use glob::Paths;
use mlua::{IntoLua, UserData};
pub fn new_search_handle(
l: &Lua,
(pattern, find_directories): (String, Option<bool>),
) -> LuaResult<Value> {
if let Ok(paths) = glob(&pattern) {
let directories_only = find_directories.is_some_and(|x| x);
let mut handle = SearchHandle::new(paths, directories_only);
// try to get the first result
handle.next();
// only return a handle if at least one file/directory is found
if handle.current.is_some() {
return handle.into_lua(l);
}
}
Ok(Value::Nil)
}
pub struct SearchHandle {
paths: Paths,
@@ -46,16 +64,19 @@ impl UserData for SearchHandle {
methods.add_method_mut("GetFileName", |l, this, ()| {
Ok(this.current.as_ref().unwrap().file_name().into_lua(l))
});
methods.add_method("GetFileSize", |_, this, ()| match &this.current {
Some(path) => match fs::metadata(path) {
Ok(metadata) => Ok(metadata.len()),
Err(_) => Ok(0),
},
None => Ok(0),
methods.add_method("GetFileSize", |_, this, ()| {
Ok(this
.current
.as_ref()
.and_then(|path| fs::metadata(path).ok())
.map_or(0, |metadata| metadata.len()))
});
methods.add_method("GetFileModifiedTime", |_, this, ()| match &this.current {
Some(path) => get_time_modified(path).map_or(Ok(0), Ok),
None => Ok(0),
methods.add_method("GetFileModifiedTime", |_, this, ()| {
Ok(this
.current
.as_ref()
.and_then(|path| get_time_modified(path).ok())
.unwrap_or(0))
});
}
}
+42
View File
@@ -0,0 +1,42 @@
use mlua::{Lua, MultiValue, Result as LuaResult};
use crate::pob::{Context, subscript::SubscriptManager};
pub fn launch_subscript(
l: &Lua,
(script_text, func_list, sub_list, args): (String, String, String, MultiValue),
) -> LuaResult<u64> {
let blocking_calls = func_list
.split(',')
.map(str::trim)
.filter(|&s| !s.is_empty())
.map(String::from)
.collect();
let nonblocking_calls = sub_list
.split(',')
.map(str::trim)
.filter(|&s| !s.is_empty())
.map(String::from)
.collect();
let arguments = args.try_into()?;
let script_dir = l.app_data_ref::<Context>().unwrap().script_dir.clone();
let subscript_id = l.app_data_mut::<SubscriptManager>().unwrap().push(
script_dir,
script_text,
blocking_calls,
nonblocking_calls,
arguments,
);
Ok(subscript_id)
}
pub fn is_subscript_running(l: &Lua, subscript_id: u64) -> LuaResult<bool> {
let manager = l.app_data_ref::<SubscriptManager>().unwrap();
Ok(manager.is_running(subscript_id))
}
pub fn abort_subscript(_: &Lua, _subscript_id: u64) -> LuaResult<()> {
unimplemented!()
}
+561
View File
@@ -0,0 +1,561 @@
use crate::{
color::Srgba,
dpi::LogicalPoint,
fonts::{Alignment, FontStyle, LayoutJob, LayoutToLogical},
math::Point,
pob::Context,
};
use core::ffi::c_int;
use mlua::{
Lua, Result as LuaResult,
ffi::{self},
};
use parley::{FontFamily, FontFamilyName};
use regex::Regex;
use std::{borrow::Cow, sync::LazyLock};
macro_rules! str_from_stack {
($s:ident, $i:expr) => {
unsafe {
let mut size = 0;
let data = ffi::luaL_checklstring($s, $i, &mut size);
let bytes = std::slice::from_raw_parts(data.cast::<u8>(), size);
std::str::from_utf8_unchecked(bytes)
}
};
}
macro_rules! f32_from_stack {
($s:ident, $i:expr) => {
unsafe { ffi::luaL_checknumber($s, $i) } as f32
};
}
macro_rules! i32_from_stack {
($s:ident, $i:expr) => {
unsafe { ffi::luaL_checkinteger($s, $i) } as i32
};
}
pub fn strip_escapes(_: &Lua, text: String) -> LuaResult<String> {
Ok(PoBString(&text).strip_escapes())
}
pub unsafe extern "C-unwind" fn draw_string(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("draw_string");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let mut ctx = lua_instance.app_data_mut::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
let x = f32_from_stack!(state, -nargs);
let y = f32_from_stack!(state, -nargs + 1);
let alignment = str_from_stack!(state, -nargs + 2);
let line_height = i32_from_stack!(state, -nargs + 3);
let font_type = str_from_stack!(state, -nargs + 4);
let text = str_from_stack!(state, -nargs + 5);
let Ok(alignment) = alignment.parse::<PoBTextAlignment>() else {
panic!("Invalid alignment");
};
let Ok(font_type) = font_type.parse::<PoBFontType>() else {
panic!("Invalid font type");
};
let mut position = LogicalPoint::new(x, y);
let mut is_absolute_position = false;
// the position needs to be adjusted for some alignments to match PoBs behavior
let screen_size = ctx.window_state.logical_size();
let halign = match alignment {
PoBTextAlignment::Left => Alignment::Min,
PoBTextAlignment::Center => {
position.x += screen_size.width / 2.0;
is_absolute_position = true;
Alignment::Center
}
PoBTextAlignment::Right => {
position.x = screen_size.width - position.x;
is_absolute_position = true;
Alignment::Max
}
PoBTextAlignment::CenterX => Alignment::Center,
PoBTextAlignment::RightX => Alignment::Max,
};
let current_draw_color = ctx.recorder.get_draw_color();
let job = build_layout_job(
text,
current_draw_color,
font_type,
line_height,
Some(halign),
);
// NOTE: color escape codes modify the current draw color.
// set current draw color to color of last segment to match PoB's behavior
if let Some(last_segment) = job.segments.last() {
ctx.recorder.set_draw_color(last_segment.color);
}
let scale_factor = ctx.window_state.scale_factor();
let layout = ctx.fonts.borrow_mut().layout(job, scale_factor);
// apply offset to account for anchor position
let position = position + layout.anchor_offset(halign);
// align layout anchor with the physical pixel grid to reduce blurriness
let position = (position * scale_factor).round() / scale_factor;
for glyph in &layout.glyphs {
ctx.recorder.draw_glyph(
LayoutToLogical::new(position.x, position.y).transform_box(&glyph.rect),
glyph.uv,
glyph.color,
glyph.layer_idx,
is_absolute_position,
);
}
0
}
pub unsafe extern "C-unwind" fn get_string_width(state: *mut ffi::lua_State) -> c_int {
//profiling::scope!("get_string_width");
let lua_instance = unsafe { Lua::get_or_init_from_ptr(state) };
let ctx = lua_instance.app_data_ref::<Context>().unwrap();
let nargs = unsafe { ffi::lua_gettop(state) };
let line_height = i32_from_stack!(state, -nargs);
let font_type = str_from_stack!(state, -nargs + 1);
let text = str_from_stack!(state, -nargs + 2);
let Ok(font_type) = font_type.parse::<PoBFontType>() else {
panic!("Invalid font type");
};
let job = build_layout_job(text, Srgba::WHITE, font_type, line_height, None);
let layout = ctx
.fonts
.borrow_mut()
.layout(job, ctx.window_state.scale_factor());
let width = layout.width();
unsafe { ffi::lua_pushnumber(state, f64::from(width)) };
1
}
pub fn get_index_at_cur(
l: &Lua,
(line_height, font_type, text, cur_x, cur_y): (i32, String, String, f32, f32),
) -> LuaResult<usize> {
//profiling::scope!("get_char_index_at_cur");
let ctx = l.app_data_ref::<Context>().unwrap();
let font_type = font_type.parse::<PoBFontType>()?;
let (job, offset_map) =
build_layout_job_with_offsets(&text, Srgba::WHITE, font_type, line_height, None);
let layout = ctx
.fonts
.borrow_mut()
.layout(job, ctx.window_state.scale_factor());
// `cursor_index_at` returns an offset into the **stripped** text, but PoB expects on offset
// into the original, **unstripped** text. A `StrippedToOriginalOffsetMap` is used to do the
// conversion.
let stripped_index = layout.cursor_index_at(Point::new(cur_x, cur_y));
let original_index = offset_map.to_original(stripped_index);
// convert to lua's 1-based indexing
Ok(original_index + 1)
}
pub static ESCAPE_STR_REGEX: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"\^(?<idx>[0-9])|\^[xX](?<hex>[0-9A-Fa-f]{6})").unwrap());
fn new_layout_job<'a>(
font_type: PoBFontType,
line_height: i32,
alignment: Option<Alignment>,
) -> LayoutJob<'a> {
let mut font_weight = None;
let mut font_style = FontStyle::default();
let font_family = match font_type {
PoBFontType::Fixed => FontFamily::Single(FontFamilyName::Named(Cow::Borrowed(
"Bitstream Vera Sans Mono",
))),
PoBFontType::Var => {
FontFamily::Single(FontFamilyName::Named(Cow::Borrowed("Liberation Sans")))
}
PoBFontType::VarBold => {
font_weight = Some(700.0);
FontFamily::Single(FontFamilyName::Named(Cow::Borrowed("Liberation Sans")))
}
PoBFontType::Fontin => FontFamily::Single(FontFamilyName::Named(Cow::Borrowed("Fontin"))),
PoBFontType::FontinItalic => {
FontFamily::Single(FontFamilyName::Named(Cow::Borrowed("Fontin")))
}
PoBFontType::FontinSmallcaps => {
FontFamily::Single(FontFamilyName::Named(Cow::Borrowed("Fontin SmallCaps")))
}
PoBFontType::FontinSmallcapsItalic => {
font_style = FontStyle::Italic;
// use regular Smallcaps with "faux italics"
FontFamily::Single(FontFamilyName::Named(Cow::Borrowed("Fontin SmallCaps")))
}
};
// NOTE: This is just an approximation and was chosen based on how it looks.
//
// PoB uses pre-rendered font atlases of discrete sizes and selects the appropriate
// atlas based on the provided height. Rusty-PoB dynamically renders fonts to a
// cached font atlas to support the selection of arbitrary sizes.
//
// TODO: font size in some dropdowns is too small, e.g. socket group selection in
// 'Calcs' tab
let font_size = (line_height - 2).max(1) as f32;
LayoutJob::new(
font_family,
font_size,
line_height as f32,
alignment,
font_weight,
font_style,
)
}
fn build_layout_job<'a>(
text: &'a str,
current_color: Srgba,
font_type: PoBFontType,
line_height: i32,
alignment: Option<Alignment>,
) -> LayoutJob<'a> {
let mut job = new_layout_job(font_type, line_height, alignment);
for ColoredSegment {
color,
text,
original_start: _,
} in PoBString(text)
{
job.append(text, color.unwrap_or(current_color));
}
job
}
/// Maps byte offset in stripped text back to offset in original text.
#[derive(Debug, Default, Clone)]
struct StrippedToOriginalOffsetMap {
segments: Vec<(usize, usize)>,
}
impl StrippedToOriginalOffsetMap {
fn push_segment(&mut self, stripped_start: usize, original_start: usize) {
self.segments.push((stripped_start, original_start));
}
fn to_original(&self, stripped_index: usize) -> usize {
assert!(!self.segments.is_empty());
let i = self
.segments
.partition_point(|&(stripped_start, _)| stripped_start <= stripped_index);
let (stripped_start, original_start) = self.segments[i - 1];
original_start + (stripped_index - stripped_start)
}
}
/// Returns a `StrippedToOriginalOffsetMap` alongside the `LayoutJob`.
fn build_layout_job_with_offsets<'a>(
text: &'a str,
current_color: Srgba,
font_type: PoBFontType,
line_height: i32,
alignment: Option<Alignment>,
) -> (LayoutJob<'a>, StrippedToOriginalOffsetMap) {
let mut job = new_layout_job(font_type, line_height, alignment);
let mut offset_map = StrippedToOriginalOffsetMap::default();
let mut stripped_offset = 0;
for ColoredSegment {
color,
text,
original_start,
} in PoBString(text)
{
offset_map.push_segment(stripped_offset, original_start);
job.append(text, color.unwrap_or(current_color));
stripped_offset += text.len();
}
(job, offset_map)
}
/// A string constructed by Lua which may contain color escapes.
pub struct PoBString<'a>(pub &'a str);
impl<'a> PoBString<'a> {
/// Returns a copy of the string with all color escapes removed.
pub fn strip_escapes(&self) -> String {
ESCAPE_STR_REGEX.replace_all(self.0, "").to_string()
}
}
impl<'a> IntoIterator for PoBString<'a> {
type Item = ColoredSegment<'a>;
type IntoIter = PoBStringSegmentIterator<'a>;
fn into_iter(self) -> Self::IntoIter {
PoBStringSegmentIterator::new(self.0)
}
}
/// A segment of text that shares the same color.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct ColoredSegment<'a> {
pub color: Option<Srgba>,
pub text: &'a str,
/// The byte offset of `text` within the **original**, unstripped string.
pub original_start: usize,
}
/// Iterates over the [`ColoredSegment`]s of a [`PoBString`].
pub struct PoBStringSegmentIterator<'a> {
haystack: &'a str,
captures: regex::CaptureMatches<'static, 'a>,
/// Byte offset in `haystack` where the next segment's text begins.
cursor: usize,
/// Color of the next segment.
color: Option<Srgba>,
done: bool,
}
impl<'a> PoBStringSegmentIterator<'a> {
fn new(haystack: &'a str) -> Self {
Self {
haystack,
captures: ESCAPE_STR_REGEX.captures_iter(haystack),
cursor: 0,
color: None,
done: false,
}
}
}
impl<'a> Iterator for PoBStringSegmentIterator<'a> {
type Item = ColoredSegment<'a>;
fn next(&mut self) -> Option<Self::Item> {
if self.done {
return None;
}
loop {
if let Some(captures) = self.captures.next() {
let m = &captures.get(0).expect("group 0 always matches");
let start = self.cursor;
let text = &self.haystack[start..m.start()];
let color = self.color;
self.cursor = m.end();
self.color = Some(Srgba::from_escape_code(m.as_str()));
// check for case where string starts with escape code
if text.is_empty() && color.is_none() {
continue;
}
return Some(ColoredSegment {
color,
text,
original_start: start,
});
}
self.done = true;
return Some(ColoredSegment {
color: self.color,
text: &self.haystack[self.cursor..],
original_start: self.cursor,
});
}
}
}
// PoB's alignment argument is weird!
// It controls:
// - the alignment within the text box
// - the anchor point of the box
// - the relative/absolute positioning of the box
#[derive(Clone, Copy, Debug)]
enum PoBTextAlignment {
// alignment: left | anchor: top-left corner | position: relative to viewport
Left,
// alignment: center | anchor: top-center | position: relative to center of screen
Center,
// alignment: right | anchor: top-right | position: relative to right edge of screen
Right,
// alignment: center | anchor: top-center | position: relative to viewport
CenterX,
// alignment: right | anchor: top-right corner | position: relative to viewport
RightX,
}
impl std::str::FromStr for PoBTextAlignment {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"LEFT" => Ok(Self::Left),
"CENTER" => Ok(Self::Center),
"RIGHT" => Ok(Self::Right),
"CENTER_X" => Ok(Self::CenterX),
"RIGHT_X" => Ok(Self::RightX),
_ => Err(anyhow::anyhow!(
"'{s}' is not a valid PoBTextAlignment variant"
)),
}
}
}
#[derive(Clone, Copy, Debug)]
enum PoBFontType {
Fixed,
Var,
VarBold,
FontinSmallcaps,
FontinSmallcapsItalic,
Fontin,
FontinItalic,
}
impl std::str::FromStr for PoBFontType {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"FIXED" => Ok(Self::Fixed),
"VAR" => Ok(Self::Var),
"VAR BOLD" => Ok(Self::VarBold),
"FONTIN SC" => Ok(Self::FontinSmallcaps),
"FONTIN SC ITALIC" => Ok(Self::FontinSmallcapsItalic),
"FONTIN" => Ok(Self::Fontin),
"FONTIN ITALIC" => Ok(Self::FontinItalic),
_ => Err(anyhow::anyhow!("'{s}' is not a valid PoBFontType variant")),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
// helper for collecting segments
fn segs(text: &str) -> Vec<(Option<Srgba>, &str, usize)> {
PoBString(text)
.into_iter()
.map(|s| (s.color, s.text, s.original_start))
.collect()
}
#[test]
fn single_segment() {
assert_eq!(segs("Hello, world!"), vec![(None, "Hello, world!", 0)]);
}
#[test]
fn empty_string() {
assert_eq!(segs(""), vec![(None, "", 0)]);
}
#[test]
fn escape_at_start() {
assert_eq!(
segs("^3Hello, world!"),
vec![(Some(Srgba::from_rgb(0, 0, 255)), "Hello, world!", 2)]
);
}
#[test]
fn no_escape_at_start() {
assert_eq!(
segs("Hello, ^1world!"),
vec![
(None, "Hello, ", 0),
(Some(Srgba::from_rgb(255, 0, 0)), "world!", 9)
]
);
}
#[test]
fn adjacent_escapes() {
assert_eq!(
segs("Hello, ^1^2world!"),
vec![
(None, "Hello, ", 0),
(Some(Srgba::from_rgb(255, 0, 0)), "", 9),
(Some(Srgba::from_rgb(0, 255, 0)), "world!", 11)
]
);
}
#[test]
fn trailing_escape() {
assert_eq!(
segs("Hello, world!^3"),
vec![
(None, "Hello, world!", 0),
(Some(Srgba::from_rgb(0, 0, 255)), "", 15),
]
);
}
#[test]
fn hex_escape() {
assert_eq!(
segs("^xFF0000Hello, ^X00ff00world!"),
vec![
(Some(Srgba::from_rgb(255, 0, 0)), "Hello, ", 8),
(Some(Srgba::from_rgb(0, 255, 0)), "world!", 23),
]
);
}
#[test]
fn cursor_offset_empty() {
let mut offset_map = StrippedToOriginalOffsetMap::default();
for seg in PoBString("") {
offset_map.push_segment(0, seg.original_start);
}
assert_eq!(offset_map.to_original(0), 0);
}
#[test]
fn cursor_offset_no_escape() {
let mut offset_map = StrippedToOriginalOffsetMap::default();
let mut stripped_offset = 0;
for seg in PoBString("Hello, World!") {
offset_map.push_segment(stripped_offset, seg.original_start);
stripped_offset += seg.text.len();
}
assert_eq!(offset_map.to_original(0), 0);
assert_eq!(offset_map.to_original(3), 3);
assert_eq!(offset_map.to_original(6), 6);
}
#[test]
fn cursor_offset() {
let mut offset_map = StrippedToOriginalOffsetMap::default();
let mut stripped_offset = 0;
for seg in PoBString("^1Hello^xFF0000World^3!") {
offset_map.push_segment(stripped_offset, seg.original_start);
stripped_offset += seg.text.len();
}
assert_eq!(offset_map.to_original(0), 2);
assert_eq!(offset_map.to_original(3), 5);
assert_eq!(offset_map.to_original(6), 16);
assert_eq!(offset_map.to_original(11), 23);
}
}
+55
View File
@@ -0,0 +1,55 @@
use crate::{
dpi::{LogicalSize, PhysicalSize},
pob::Context,
};
use mlua::{Lua, Result as LuaResult};
pub fn get_screen_size(l: &Lua, _: ()) -> LuaResult<(u32, u32)> {
let ctx = l.app_data_ref::<Context>().unwrap();
let size = if ctx.is_dpi_aware {
let PhysicalSize { width, height, .. } = ctx.window_state.size;
(width, height)
} else {
let LogicalSize { width, height, .. } = ctx.window_state.logical_size().cast();
(width, height)
};
Ok(size)
}
pub fn get_screen_scale(l: &Lua, _: ()) -> LuaResult<f32> {
let ctx = l.app_data_ref::<Context>().unwrap();
let scale_factor = ctx.window_state.scale_factor();
Ok(scale_factor.get())
}
pub fn set_window_title(l: &Lua, title: String) -> LuaResult<()> {
let ctx = l.app_data_ref::<Context>().unwrap();
ctx.window_state.set_window_title(&title);
Ok(())
}
pub fn set_foreground(l: &Lua, _: ()) -> LuaResult<()> {
let ctx = l.app_data_ref::<Context>().unwrap();
ctx.window_state.focus();
Ok(())
}
pub fn set_dpi_scale_override(l: &Lua, percent: i32) -> LuaResult<()> {
let mut ctx = l.app_data_mut::<Context>().unwrap();
match percent {
0 => ctx.window_state.set_scale_factor_override(None),
p if p > 0 => ctx
.window_state
.set_scale_factor_override(Some(p as f32 / 100.0)),
_ => {}
}
Ok(())
}
pub fn get_dpi_scale_override(l: &Lua, _: ()) -> LuaResult<i32> {
let ctx = l.app_data_ref::<Context>().unwrap();
match ctx.window_state.scale_factor_override() {
Some(scale_factor) => Ok((scale_factor * 100.0) as i32),
None => Ok(0),
}
}
+23
View File
@@ -0,0 +1,23 @@
#[cfg(feature = "bundled-lua-modules")]
pub mod luacurl;
#[cfg(feature = "bundled-lua-modules")]
pub mod luasocket;
#[cfg(feature = "bundled-lua-modules")]
pub mod luazip;
use mlua::{Lua, Result as LuaResult};
/// Registers Rust implementations of the Lua modules required by PoB's Lua code.
pub fn register(lua: &Lua) -> LuaResult<()> {
lua.register_module("lua-utf8", luautf8::create_module(lua)?)?;
lua.register_module("socket", luasocket::create_module(lua)?)?;
lua.register_module("lcurl.safe", luacurl::create_module(lua)?)?;
lua.register_module("lzip", luazip::create_module(lua)?)?;
Ok(())
}
/// Nothing is registered so Lua resolves the required modules through `package.cpath`.
#[cfg(not(feature = "bundled-lua-modules"))]
pub fn register(_lua: &Lua) -> LuaResult<()> {
Ok(())
}
+29
View File
@@ -0,0 +1,29 @@
use mlua::{Lua, Result as LuaResult, Table};
use crate::pob::modules::luacurl::easy::EasyHandle;
mod constants;
mod easy;
pub fn create_module(lua: &Lua) -> LuaResult<Table> {
let exports = lua.create_table()?;
exports.set("easy", lua.create_function(|_, ()| Ok(EasyHandle::new()))?)?;
exports.set("OPT_ACCEPT_ENCODING", constants::OPT_ACCEPT_ENCODING)?;
exports.set("OPT_FOLLOWLOCATION", constants::OPT_FOLLOWLOCATION)?;
exports.set("OPT_HTTPHEADER", constants::OPT_HTTPHEADER)?;
exports.set("OPT_IPRESOLVE", constants::OPT_IPRESOLVE)?;
exports.set("OPT_POST", constants::OPT_POST)?;
exports.set("OPT_POSTFIELDS", constants::OPT_POSTFIELDS)?;
exports.set("OPT_PROXY", constants::OPT_PROXY)?;
exports.set("OPT_SSL_VERIFYHOST", constants::OPT_SSL_VERIFYHOST)?;
exports.set("OPT_SSL_VERIFYPEER", constants::OPT_SSL_VERIFYPEER)?;
exports.set("OPT_USERAGENT", constants::OPT_USERAGENT)?;
exports.set("INFO_RESPONSE_CODE", constants::INFO_RESPONSE_CODE)?;
exports.set("INFO_SIZE_DOWNLOAD", constants::INFO_SIZE_DOWNLOAD)?;
exports.set("INFO_REDIRECT_URL", constants::INFO_REDIRECT_URL)?;
Ok(exports)
}
+25
View File
@@ -0,0 +1,25 @@
pub type CURLoption = i64;
pub type CURLinfo = i64;
const CURLOPTTYPE_LONG: CURLoption = 0;
const CURLOPTTYPE_OBJECTPOINT: CURLoption = 10_000;
pub const OPT_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 2;
pub const OPT_PROXY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 4;
pub const OPT_POSTFIELDS: CURLoption = CURLOPTTYPE_OBJECTPOINT + 15;
pub const OPT_USERAGENT: CURLoption = CURLOPTTYPE_OBJECTPOINT + 18;
pub const OPT_HTTPHEADER: CURLoption = CURLOPTTYPE_OBJECTPOINT + 23;
pub const OPT_POST: CURLoption = CURLOPTTYPE_LONG + 47;
pub const OPT_FOLLOWLOCATION: CURLoption = CURLOPTTYPE_LONG + 52;
pub const OPT_SSL_VERIFYPEER: CURLoption = CURLOPTTYPE_LONG + 64;
pub const OPT_SSL_VERIFYHOST: CURLoption = CURLOPTTYPE_LONG + 81;
pub const OPT_ACCEPT_ENCODING: CURLoption = CURLOPTTYPE_OBJECTPOINT + 102;
pub const OPT_IPRESOLVE: CURLoption = CURLOPTTYPE_LONG + 113;
const CURLINFO_STRING: CURLinfo = 0x100000;
const CURLINFO_LONG: CURLinfo = 0x200000;
const CURLINFO_DOUBLE: CURLinfo = 0x300000;
pub const INFO_RESPONSE_CODE: CURLinfo = CURLINFO_LONG + 2;
pub const INFO_SIZE_DOWNLOAD: CURLinfo = CURLINFO_DOUBLE + 8;
pub const INFO_REDIRECT_URL: CURLinfo = CURLINFO_STRING + 31;
+290
View File
@@ -0,0 +1,290 @@
use curl::easy::{Easy, IpResolve};
use mlua::{
Error as LuaError, IntoLua, Lua, LuaString, RegistryKey, Result as LuaResult, UserData,
UserDataMethods,
};
use crate::pob::modules::luacurl::constants;
/// Helper for constructing a `mlua::Error::BadArgument`
fn bad_argument(to: impl Into<String>, pos: usize, cause: &'static str) -> LuaError {
#[allow(clippy::arc_with_non_send_sync)]
LuaError::BadArgument {
to: Some(to.into()),
pos: pos + 1,
name: None,
cause: std::sync::Arc::new(LuaError::runtime(cause)),
}
}
#[derive(Default)]
pub struct EasyHandle {
easy: Option<Easy>,
write_callback: Option<RegistryKey>,
header_callback: Option<RegistryKey>,
}
impl EasyHandle {
pub fn new() -> Self {
Self {
easy: Some(Easy::new()),
write_callback: None,
header_callback: None,
}
}
fn curl(&mut self) -> LuaResult<&mut Easy> {
self.easy
.as_mut()
.ok_or_else(|| LuaError::runtime("curl handle is closed"))
}
pub fn close(&mut self, lua: &Lua) -> LuaResult<()> {
if let Some(key) = self.write_callback.take() {
lua.remove_registry_value(key)?;
}
if let Some(key) = self.header_callback.take() {
lua.remove_registry_value(key)?;
}
self.easy = None;
Ok(())
}
// TODO: handling of `value` might not be 100% correct w.r.t. casting and mapping
// of number values to arguments of `easy` methods. extract to helper functions.
pub fn set_option(&mut self, option: i64, value: mlua::Value) -> LuaResult<()> {
let easy = self.curl()?;
match option {
constants::OPT_ACCEPT_ENCODING => {
let encoding = match value {
mlua::Value::String(s) => s.to_str(),
_ => Err(bad_argument("setopt", 1, "string expected")),
}?;
easy.accept_encoding(&encoding)
.map_err(LuaError::external)?;
}
constants::OPT_FOLLOWLOCATION => {
let enable = match value {
mlua::Value::Boolean(b) => Ok(b),
mlua::Value::Integer(n) => Ok(n != 0),
mlua::Value::Number(n) => Ok(n != 0.0),
_ => Err(bad_argument("setopt", 1, "number or boolean expected")),
}?;
easy.follow_location(enable).map_err(LuaError::external)?;
}
constants::OPT_HTTPHEADER => {
let headers = match value {
mlua::Value::Table(t) => Ok(t),
_ => Err(bad_argument("setopt", 1, "array expected")),
}?;
let mut list = curl::easy::List::new();
for header in headers.sequence_values::<String>() {
list.append(&header?).map_err(LuaError::external)?;
}
easy.http_headers(list).map_err(LuaError::external)?;
}
constants::OPT_IPRESOLVE => {
let resolve = match value {
mlua::Value::Integer(0) => Ok(IpResolve::Any),
mlua::Value::Integer(1) => Ok(IpResolve::V4),
mlua::Value::Integer(2) => Ok(IpResolve::V6),
_ => Err(bad_argument("setopt", 1, "number or boolean expected")),
}?;
easy.ip_resolve(resolve).map_err(LuaError::external)?;
}
constants::OPT_POST => {
let enable = match value {
mlua::Value::Boolean(b) => Ok(b),
mlua::Value::Integer(n) => Ok(n != 0),
mlua::Value::Number(n) => Ok(n != 0.0),
_ => Err(bad_argument("setopt", 1, "number or boolean expected")),
}?;
easy.post(enable).map_err(LuaError::external)?;
}
constants::OPT_POSTFIELDS => {
let data = match value {
mlua::Value::String(s) => Ok(s.as_bytes()),
_ => Err(bad_argument("setopt", 1, "string expected")),
}?;
easy.post_fields_copy(&data).map_err(LuaError::external)?;
}
constants::OPT_PROXY => {
let proxy = match value {
mlua::Value::String(s) => s.to_str(),
_ => Err(bad_argument("setopt", 1, "string expected")),
}?;
easy.proxy(&proxy).map_err(LuaError::external)?;
}
constants::OPT_SSL_VERIFYHOST => {
let verify = match value {
mlua::Value::Boolean(b) => Ok(b),
mlua::Value::Integer(n) => Ok(n != 0),
mlua::Value::Number(n) => Ok(n != 0.0),
_ => Err(bad_argument("setopt", 1, "number or boolean expected")),
}?;
easy.ssl_verify_host(verify).map_err(LuaError::external)?;
}
constants::OPT_SSL_VERIFYPEER => {
let verify = match value {
mlua::Value::Boolean(b) => Ok(b),
mlua::Value::Integer(n) => Ok(n != 0),
mlua::Value::Number(n) => Ok(n != 0.0),
_ => Err(bad_argument("setopt", 1, "number or boolean expected")),
}?;
easy.ssl_verify_peer(verify).map_err(LuaError::external)?;
}
constants::OPT_USERAGENT => {
let useragent = match value {
mlua::Value::String(s) => s.to_str(),
_ => Err(bad_argument("setopt", 1, "string expected")),
}?;
easy.useragent(&useragent).map_err(LuaError::external)?;
}
constants::OPT_URL => {
let url = match value {
mlua::Value::String(s) => s.to_str(),
_ => Err(bad_argument("setopt", 1, "string expected")),
}?;
easy.url(&url).map_err(LuaError::external)?;
}
_ => unimplemented!("Unsupported `setopt` option: {option}"),
}
Ok(())
}
fn set_callback(
lua: &Lua,
slot: &mut Option<RegistryKey>,
value: mlua::Value,
) -> LuaResult<()> {
let new_key = match value {
mlua::Value::Nil => None,
mlua::Value::Function(f) => Some(lua.create_registry_value(f)?),
_ => return Err(LuaError::runtime("invalid object type")),
};
if let Some(old_key) = slot.take() {
lua.remove_registry_value(old_key)?;
}
*slot = new_key;
Ok(())
}
fn perform(&mut self, lua: &Lua) -> LuaResult<()> {
let write_fn = self
.write_callback
.as_ref()
.map(|key| lua.registry_value::<mlua::Function>(key))
.transpose()?;
let header_fn = self
.header_callback
.as_ref()
.map(|key| lua.registry_value::<mlua::Function>(key))
.transpose()?;
let transfer_result = {
let mut transfer = self.curl()?.transfer();
if let Some(function) = write_fn {
transfer
.write_function(move |data| {
let Ok(argument) = lua.create_string(data) else {
return Ok(0);
};
match function.call::<()>(argument) {
Ok(()) => Ok(data.len()),
Err(_) => Ok(0),
}
})
.map_err(LuaError::external)?;
}
if let Some(function) = header_fn {
transfer
.header_function(move |data| {
let Ok(argument) = lua.create_string(data) else {
return false;
};
function.call::<bool>(argument).unwrap_or(false)
})
.map_err(LuaError::external)?;
}
transfer.perform()
};
transfer_result.map_err(LuaError::external)?;
Ok(())
}
fn get_info(&mut self, lua: &Lua, info: i64) -> LuaResult<mlua::Value> {
let easy = self.curl()?;
match info {
constants::INFO_REDIRECT_URL => {
let url = easy.redirect_url().map_err(LuaError::external)?;
url.into_lua(lua)
}
constants::INFO_RESPONSE_CODE => {
let code = easy.response_code().map_err(LuaError::external)?;
code.into_lua(lua)
}
constants::INFO_SIZE_DOWNLOAD => {
let size = easy.download_size().map_err(LuaError::external)?;
size.into_lua(lua)
}
_ => unimplemented!("Unsupported `getinfo` key: {info}"),
}
}
}
impl UserData for EasyHandle {
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
methods.add_method("escape", |lua, _, value: LuaString| {
let input = value.as_bytes();
let mut easy = Easy::new();
let escaped = easy.url_encode(input.as_ref());
lua.create_string(escaped)
});
methods.add_method_mut("close", |lua, this, ()| this.close(lua));
methods.add_method_mut("setopt", |_, this, (option, value): (i64, mlua::Value)| {
this.set_option(option, value)
});
methods.add_method_mut("setopt_url", |_, this, value: mlua::Value| {
this.set_option(constants::OPT_URL, value)
});
methods.add_method_mut("setopt_useragent", |_, this, value: mlua::Value| {
this.set_option(constants::OPT_USERAGENT, value)
});
methods.add_method_mut("setopt_writefunction", |lua, this, value: mlua::Value| {
Self::set_callback(lua, &mut this.write_callback, value)
});
methods.add_method_mut("setopt_headerfunction", |lua, this, value: mlua::Value| {
Self::set_callback(lua, &mut this.header_callback, value)
});
methods.add_method_mut("perform", |lua, this, ()| this.perform(lua));
methods.add_method_mut("getinfo", |lua, this, info: i64| this.get_info(lua, info));
methods.add_method_mut("getinfo_response_code", |lua, this, ()| {
this.get_info(lua, constants::INFO_RESPONSE_CODE)
});
}
}
+243
View File
@@ -0,0 +1,243 @@
//! Rust port of subset of [`luasocket`](https://github.com/lunarmodules/luasocket) API.
use std::{
io::{self, BufRead, BufReader, Write},
net::{TcpListener, TcpStream, ToSocketAddrs},
thread,
time::{Duration, Instant},
};
use mlua::{Integer as LuaInteger, Lua, Result as LuaResult, Table, UserData, UserDataMethods};
pub fn create_module(lua: &Lua) -> LuaResult<Table> {
let exports = lua.create_table()?;
exports.set(
"tcp4",
lua.create_function(|_, ()| {
Ok(LuaTcpIp4Server {
listener: None,
timeout: None,
})
})?,
)?;
Ok(exports)
}
/// Helper for constructing a `mlua::Error::BadArgument`
fn bad_argument(to: impl Into<String>, pos: usize, cause: mlua::Error) -> mlua::Error {
#[allow(clippy::arc_with_non_send_sync)]
mlua::Error::BadArgument {
to: Some(to.into()),
pos: pos + 1,
name: None,
cause: std::sync::Arc::new(cause),
}
}
struct LuaTcpIp4Server {
listener: Option<TcpListener>,
timeout: Option<Duration>,
}
struct LuaTcpClient {
reader: BufReader<TcpStream>,
timeout: Option<Duration>,
}
impl UserData for LuaTcpIp4Server {
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
methods.add_method_mut("bind", |_, this, (host, port): (String, u16)| {
let addr = (host.as_str(), port)
.to_socket_addrs()?
.find(|a| a.is_ipv4());
let Some(addr) = addr else {
return Err(mlua::Error::external("no IPv4 address found"));
};
match TcpListener::bind(addr) {
Ok(listener) => {
this.listener = Some(listener);
Ok(1)
}
Err(e) => Err(mlua::Error::external(e)),
}
});
// `TcpListener::bind` handles the binding and immediately starts listening.
// `listen` can therefore be a no-op if `bind` succeeded.
methods.add_method("listen", |_, this, _backlog: u32| match &this.listener {
Some(_) => Ok(1),
None => Err(mlua::Error::external("socket is not bound")),
});
methods.add_method_mut("close", |_, this, ()| {
this.listener = None;
Ok(1)
});
methods.add_method("getsockname", |_, this, ()| match &this.listener {
Some(listener) => {
let addr = listener.local_addr()?;
Ok((addr.ip().to_string(), addr.port()))
}
None => Err(mlua::Error::external("socket is not bound")),
});
methods.add_method_mut("settimeout", |_, this, seconds: f64| {
this.timeout = if seconds < 0.0 {
None
} else {
Some(Duration::from_secs_f64(seconds))
};
Ok(())
});
methods.add_method_mut(
"setoption",
|_, _this, (name, _value): (String, mlua::Value)| {
match name.as_str() {
"reuseaddr" => {
// NOTE: ignore for now. not sure why this is even set by PoB.
// `TcpListener` doesn't give access to this options so if this
// turns out to be important, switch to `socket2` crate which
// offers more advanced configurations options.
Ok(1)
}
_ => Err(mlua::Error::external(format!(
"unsupported socket option `{name}`"
))),
}
},
);
methods.add_method_mut("accept", |lua, this, ()| {
let Some(listener) = &this.listener else {
return Err(mlua::Error::external("socket is not bound"));
};
// the listener blocks indefinitely until a connection is established.
// in order to set a timeout, we move it into nonblocking mode and repeatedly call
// `accept`. if it returns `WouldBlock`, return if the deadline is reached or try again
// after a short sleep.
listener.set_nonblocking(true)?;
let deadline = this.timeout.map(|t| Instant::now() + t);
loop {
match listener.accept() {
Ok((stream, _addr)) => {
let client = LuaTcpClient {
reader: BufReader::new(stream),
timeout: None,
};
let userdata = lua.create_userdata(client)?;
return Ok(userdata);
}
Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
if deadline.is_some_and(|d| Instant::now() >= d) {
return Err(mlua::Error::external("timeout"));
}
thread::sleep(Duration::from_millis(20));
}
Err(e) if e.kind() == io::ErrorKind::Interrupted => continue,
Err(e) => return Err(mlua::Error::external(e)),
}
}
});
}
}
impl UserData for LuaTcpClient {
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
methods.add_method_mut("settimeout", |_, this, seconds: f64| {
let timeout = if seconds < 0.0 {
None
} else {
Some(Duration::from_secs_f64(seconds))
};
this.timeout = timeout;
this.reader.get_ref().set_read_timeout(timeout)?;
this.reader.get_ref().set_write_timeout(timeout)?;
Ok(())
});
methods.add_method_mut("close", |_, this, ()| {
let _ = this.reader.get_ref().shutdown(std::net::Shutdown::Both);
Ok(())
});
// TODO: map correct errors to `closed` and `timeout`
methods.add_method_mut(
"receive",
|_, this, (pattern, prefix, maxsize): (Option<String>, Option<String>, Option<u64>)| {
if prefix.is_some() || maxsize.is_some() {
unimplemented!();
}
match pattern.as_deref().unwrap_or("*l") {
"*l" => {
let mut line = Vec::new();
match this.reader.read_until(b'\n', &mut line) {
Ok(0) => Err(mlua::Error::external("closed")),
Ok(_) => {
if line.last() == Some(&b'\n') {
line.pop();
}
if line.last() == Some(&b'\r') {
line.pop();
}
Ok(String::from_utf8_lossy(&line).into_owned())
}
Err(e)
if matches!(
e.kind(),
io::ErrorKind::TimedOut | io::ErrorKind::WouldBlock
) =>
{
Err(mlua::Error::external("timeout"))
}
Err(e) => Err(mlua::Error::external(e)),
}
}
"*a" => {
unimplemented!()
}
other => match other.parse::<u64>() {
Ok(_) => {
unimplemented!()
}
Err(_) => Err(bad_argument(
"receive",
1,
mlua::Error::external("invalid receive pattern"),
)),
},
}
},
);
// TODO: map correct errors to `closed` and `timeout`
// TODO: handle i and j
// TODO: on error, return index of the last byte (within [i, j]) sent
methods.add_method_mut(
"send",
|_, this, (data, i, j): (String, Option<LuaInteger>, Option<LuaInteger>)| {
if i.is_some() || j.is_some() {
unimplemented!()
}
match this.reader.get_mut().write_all(data.as_bytes()) {
Ok(()) => Ok(data.len()),
Err(e) => Err(mlua::Error::external(e)),
}
},
);
}
}
+158
View File
@@ -0,0 +1,158 @@
//! Rust port of SimpleGraphic's `lzip`, a library for reading zip files.
//! <https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/master/libs/LZip/lzip.cpp>
use std::{fs::File, io::Read};
use mlua::{Integer as LuaInteger, Lua, Result as LuaResult, Table, UserData, UserDataMethods};
use crate::pob::modules::luazip::archive::{ZipArchive, ZipFile};
mod archive;
pub fn create_module(lua: &Lua) -> LuaResult<Table> {
let exports = lua.create_table()?;
exports.set(
"open",
lua.create_function(|_, path: String| {
let file = File::open(&path).map_err(mlua::Error::external)?;
let archive = ZipArchive::new(file).map_err(mlua::Error::external)?;
Ok(ZipArchiveHandle {
archive: Some(archive),
})
})?,
)?;
Ok(exports)
}
fn to_index(i: LuaInteger, len: usize) -> Option<usize> {
usize::try_from(i.checked_sub(1)?).ok().filter(|&i| i < len)
}
struct ZipArchiveHandle {
archive: Option<ZipArchive<File>>,
}
impl ZipArchiveHandle {
fn get(&self) -> LuaResult<&ZipArchive<File>> {
self.archive
.as_ref()
.ok_or_else(|| mlua::Error::runtime("zip handle is closed"))
}
}
impl UserData for ZipArchiveHandle {
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
methods.add_method_mut("Close", |_, this, ()| {
this.archive = None;
Ok(())
});
methods.add_method("GetNumFiles", |_, this, ()| Ok(this.get()?.entries().len()));
methods.add_method("GetFileName", |lua, this, index: LuaInteger| {
let entries = this.get()?.entries();
let len = entries.len();
match to_index(index, len) {
Some(i) => Ok(Some(lua.create_string(entries[i].name())?)),
None => Ok(None),
}
});
methods.add_method("GetFileSize", |_, this, index: LuaInteger| {
let entries = this.get()?.entries();
let len = entries.len();
match to_index(index, len) {
Some(i) => Ok(Some(entries[i].uncompressed_size())),
None => Ok(None),
}
});
methods.add_method_mut("OpenFile", |_, this, index_or_name: mlua::Value| {
let archive = this.get()?;
let entries = archive.entries();
let index = match index_or_name {
mlua::Value::Integer(i) => {
let Some(index) = to_index(i, entries.len()) else {
return Err(mlua::Error::runtime("zip:OpenFile(): invalid index"));
};
index
}
mlua::Value::String(s) => {
let name = s.as_bytes();
let Some(index) = entries.iter().position(|e| e.name()[..] == *name) else {
return Ok(None);
};
index
}
_ => {
return Err(mlua::Error::runtime(
"Usage: zip:OpenFile(index) or zip:OpenFile(fileName)",
));
}
};
let file = archive.by_index(index).map_err(mlua::Error::external)?;
Ok(Some(ZipFileHandle { file: Some(file) }))
});
}
}
struct ZipFileHandle {
file: Option<ZipFile<File>>,
}
impl ZipFileHandle {
fn get(&mut self) -> LuaResult<&ZipFile<File>> {
self.file
.as_ref()
.ok_or_else(|| mlua::Error::runtime("zip file handle is closed"))
}
fn get_mut(&mut self) -> LuaResult<&mut ZipFile<File>> {
self.file
.as_mut()
.ok_or_else(|| mlua::Error::runtime("zip file handle is closed"))
}
}
impl UserData for ZipFileHandle {
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
methods.add_method_mut("Close", |_, this, ()| {
this.file = None;
Ok(())
});
methods.add_method_mut("Length", |_, this, ()| Ok(this.get()?.size()));
methods.add_method_mut("Read", |lua, this, arg: mlua::Value| {
let file = this.get_mut()?;
let mut buf = Vec::new();
match arg {
mlua::Value::String(s) if s.as_bytes() == b"*a" => {
file.read_to_end(&mut buf).map_err(mlua::Error::external)?;
}
mlua::Value::Integer(n) if n >= 0 => {
if n == 0 {
return lua.create_string("");
}
file.take(n as u64)
.read_to_end(&mut buf)
.map_err(mlua::Error::external)?;
}
other => {
return Err(mlua::Error::runtime(format!(
"zipFile:Read(): unrecognised format: {}",
other.to_string()?
)));
}
}
lua.create_string(buf)
});
}
}
+716
View File
@@ -0,0 +1,716 @@
use std::{
cell::RefCell,
io::{self, Read, Seek, SeekFrom, Take},
rc::Rc,
};
use flate2::read::DeflateDecoder;
const EOCD_LEN: usize = 22;
const EOCD_MAGIC_BYTES: &[u8] = &[0x50, 0x4B, 0x05, 0x06];
const EOCD_MAX_SIZE: usize = EOCD_LEN + u16::MAX as usize; // fixed fields + variable-sized comment
const EOCD64_LEN: usize = 56;
const EOCD64_MAGIC_BYTES: &[u8] = &[0x50, 0x4B, 0x06, 0x06];
const EOCD64_LOCATOR_LEN: usize = 20;
const EOCD64_LOCATOR_MAGIC_BYTES: &[u8] = &[0x50, 0x4B, 0x06, 0x07];
const CDFH_LEN: usize = 46;
const CDFH_MAGIC_BYTES: &[u8] = &[0x50, 0x4B, 0x01, 0x02];
const LFH_LEN: usize = 30;
const LFH_MAGIC_BYTES: &[u8] = &[0x50, 0x4B, 0x03, 0x04];
// 0 = encrypted | 6 = strong encryption | 13 = header masked
const ENCRYPTED_FLAGS: u16 = (1 << 0) | (1 << 6) | (1 << 13);
#[inline]
fn parse_u16(b: &[u8], at: usize) -> u16 {
u16::from_le_bytes(b[at..at.saturating_add(2)].try_into().unwrap())
}
#[inline]
fn parse_u32(b: &[u8], at: usize) -> u32 {
u32::from_le_bytes(b[at..at.saturating_add(4)].try_into().unwrap())
}
#[inline]
fn parse_u64(b: &[u8], at: usize) -> u64 {
u64::from_le_bytes(b[at..at.saturating_add(8)].try_into().unwrap())
}
#[inline]
fn read_u8_slice<R: Read>(reader: &mut R, size: usize) -> io::Result<Box<[u8]>> {
let mut buf = vec![0; size];
reader.read_exact(&mut buf)?;
Ok(buf.into_boxed_slice())
}
#[inline]
fn take_u32(data: &[u8], at: &mut usize) -> io::Result<u32> {
let bytes = data
.get(*at..at.saturating_add(4))
.ok_or_else(|| invalid("truncated extra field"))?;
*at += 4;
Ok(u32::from_le_bytes(bytes.try_into().unwrap()))
}
#[inline]
fn take_u64(data: &[u8], at: &mut usize) -> io::Result<u64> {
let bytes = data
.get(*at..at.saturating_add(8))
.ok_or_else(|| invalid("truncated extra field"))?;
*at += 8;
Ok(u64::from_le_bytes(bytes.try_into().unwrap()))
}
#[inline]
fn invalid(msg: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> io::Error {
io::Error::new(io::ErrorKind::InvalidData, msg)
}
#[inline]
fn unsupported(msg: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> io::Error {
io::Error::new(io::ErrorKind::Unsupported, msg)
}
struct SharedReader<R> {
inner: Rc<RefCell<R>>,
pos: u64,
}
impl<R: Read + Seek> Read for SharedReader<R> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let mut r = self.inner.borrow_mut();
r.seek(SeekFrom::Start(self.pos))?;
let n = r.read(buf)?;
self.pos += n as u64;
Ok(n)
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
enum CompressionMethod {
Stored,
Deflate,
Other(u16),
}
impl From<u16> for CompressionMethod {
fn from(value: u16) -> Self {
match value {
0 => Self::Stored,
8 => Self::Deflate,
other => Self::Other(other),
}
}
}
#[derive(Debug)]
pub struct ZipArchive<R> {
reader: Rc<RefCell<R>>,
entries: Vec<ZipEntry>,
}
impl<R: Read + Seek> ZipArchive<R> {
pub fn new(mut reader: R) -> io::Result<Self> {
let cd_info = read_central_directory_info(&mut reader)?;
let entries = parse_central_directory(
&mut reader,
cd_info.cd_offset,
cd_info.cd_size,
cd_info.cd_records_on_disk as usize,
)?;
Ok(Self {
reader: Rc::new(RefCell::new(reader)),
entries,
})
}
pub fn entries(&self) -> &[ZipEntry] {
&self.entries
}
pub fn by_index(&self, index: usize) -> io::Result<ZipFile<R>> {
let entry = self
.entries
.get(index)
.ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "entry not found"))?;
// reject unsupported entries
if entry.flags & ENCRYPTED_FLAGS != 0 {
return Err(unsupported("encrypted entries are not supported"));
}
let deflated = match entry.compression {
CompressionMethod::Stored => {
if entry.compressed_size != entry.uncompressed_size {
return Err(invalid("uncompressed entry has mismatched sizes"));
}
false
}
CompressionMethod::Deflate => true,
CompressionMethod::Other(method) => {
return Err(unsupported(format!(
"unsupported compression method {method}"
)));
}
};
let start = data_start(&mut *self.reader.borrow_mut(), entry)?;
let limited = SharedReader {
inner: Rc::clone(&self.reader),
pos: start,
}
.take(entry.compressed_size);
Ok(ZipFile {
inner: if deflated {
Inner::Deflate(DeflateDecoder::new(limited))
} else {
Inner::Stored(limited)
},
expected_size: entry.uncompressed_size,
produced: 0,
})
}
}
/// Entry metadata
#[derive(Debug)]
pub struct ZipEntry {
name: Box<[u8]>,
flags: u16,
compression: CompressionMethod,
_crc32: u32,
compressed_size: u64,
uncompressed_size: u64,
file_start_disk: u32,
local_header_offset: u64,
extra_fields: Box<[ExtraField]>,
}
impl ZipEntry {
pub fn name(&self) -> &[u8] {
&self.name
}
pub fn uncompressed_size(&self) -> u64 {
self.uncompressed_size
}
}
impl From<CDFH> for ZipEntry {
fn from(cdfh: CDFH) -> Self {
Self {
name: cdfh.file_name,
flags: cdfh.general_purpose_bit_flag,
compression: CompressionMethod::from(cdfh.compression_method),
_crc32: cdfh.crc32,
compressed_size: u64::from(cdfh.compressed_size),
uncompressed_size: u64::from(cdfh.uncompressed_size),
local_header_offset: u64::from(cdfh.local_file_header_offset),
file_start_disk: u32::from(cdfh.file_start_disk),
extra_fields: cdfh.extra_fields,
}
}
}
enum Inner<R: Read + Seek> {
Stored(Take<SharedReader<R>>),
Deflate(DeflateDecoder<Take<SharedReader<R>>>),
}
pub struct ZipFile<R: Read + Seek> {
inner: Inner<R>,
expected_size: u64,
produced: u64,
}
impl<R: Read + Seek> ZipFile<R> {
pub fn size(&self) -> u64 {
self.expected_size
}
}
impl<R: Read + Seek> Read for ZipFile<R> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
if buf.is_empty() {
return Ok(0);
}
// don't hand out more than one byte past the declared size to protect against malicious
// archives
let remaining = self.expected_size - self.produced.min(self.expected_size);
let max = remaining.saturating_add(1).min(buf.len() as u64) as usize;
let buf = &mut buf[..max];
let n = match &mut self.inner {
Inner::Stored(r) => r.read(buf)?,
Inner::Deflate(r) => r.read(buf)?,
};
if n > 0 {
self.produced += n as u64;
if self.produced > self.expected_size {
return Err(invalid("entry is larger than declared"));
}
} else {
if self.produced != self.expected_size {
return Err(invalid("entry is smaller than declared"));
}
}
Ok(n)
}
}
/// Returns the start position of an entrys payload.
fn data_start<R: Read + Seek>(r: &mut R, entry: &ZipEntry) -> io::Result<u64> {
r.seek(SeekFrom::Start(entry.local_header_offset))?;
let mut buf = [0u8; LFH_LEN];
r.read_exact(&mut buf)?;
if [buf[0], buf[1], buf[2], buf[3]] != LFH_MAGIC_BYTES {
return Err(invalid("Invalid LFH magic number"));
}
let name_len = parse_u16(&buf, 26) as u64;
let extra_len = parse_u16(&buf, 28) as u64;
Ok(entry.local_header_offset + LFH_LEN as u64 + name_len + extra_len)
}
fn parse_central_directory<R: Read + Seek>(
reader: &mut R,
start: u64,
size: u64,
num_of_entries: usize,
) -> io::Result<Vec<ZipEntry>> {
reader.seek(SeekFrom::Start(start))?;
let end = start
.checked_add(size)
.ok_or_else(|| invalid("central directory too big"))?;
let mut entries = Vec::new();
for _ in 0..num_of_entries {
if reader.stream_position()? > end {
return Err(invalid("invalid number of entries"));
}
let cdfh = parse_cdfh(reader)?;
// check for ZIP64 sentinel values
let need_uncompressed = cdfh.uncompressed_size == u32::MAX;
let need_compressed = cdfh.compressed_size == u32::MAX;
let need_offset = cdfh.local_file_header_offset == u32::MAX;
let need_start_disk = cdfh.file_start_disk == u16::MAX;
let mut entry = ZipEntry::from(cdfh);
// update entry with info from ZIP64 extra field
if need_compressed || need_uncompressed || need_offset || need_start_disk {
let zip64_extra = entry
.extra_fields
.iter()
.find(|extra| extra.header == 0x0001)
.ok_or_else(|| invalid("ZIP64 extra field missing"))?;
let data = &zip64_extra.data[..];
let mut at = 0;
if need_uncompressed {
entry.uncompressed_size = take_u64(data, &mut at)?;
}
if need_compressed {
entry.compressed_size = take_u64(data, &mut at)?;
}
if need_offset {
entry.local_header_offset = take_u64(data, &mut at)?;
}
if need_start_disk {
entry.file_start_disk = take_u32(data, &mut at)?;
}
}
if entry.file_start_disk != 0 {
return Err(unsupported("split archives are not supported"));
}
entries.push(entry);
}
Ok(entries)
}
/// Central Directory File Header (CDFH).
#[derive(Debug)]
#[allow(clippy::upper_case_acronyms)]
struct CDFH {
/// Version made by.
_version_made_by: u16,
/// Version needed to extract (minimum).
_version_needed_to_extract: u16,
/// General purpose bit flag.
general_purpose_bit_flag: u16,
/// Compression method.
compression_method: u16,
/// File last modification time.
_last_modification_time: u16,
/// File last modification date.
_last_modification_date: u16,
/// CRC-32 of uncompressed data.
crc32: u32,
/// Compressed size (or FF FF FF FF for ZIP64).
compressed_size: u32,
/// Uncompressed size (or FF FF FF FF for ZIP64).
uncompressed_size: u32,
/// Disk number where file starts (or FF FF for ZIP64).
file_start_disk: u16,
/// Internal file attributes.
_internal_file_attributes: u16,
/// External file attributes.
_external_file_attributes: u32,
/// Relative offset of local file header (or FF FF FF FF for ZIP64). This is the number of
/// bytes between the start of the first disk on which the file occurs, and the start of the
/// local file header. This allows software reading the central directory to locate the
/// position of the file inside the ZIP file.
local_file_header_offset: u32,
/// File name.
file_name: Box<[u8]>,
/// Extra field.
extra_fields: Box<[ExtraField]>,
/// File comment.
_file_comment: Box<[u8]>,
}
/// Parses a CDFH. `reader` must be positioned at the start of a CDFH.
fn parse_cdfh<R: Read>(reader: &mut R) -> io::Result<CDFH> {
let mut buf = [0u8; CDFH_LEN];
reader.read_exact(&mut buf)?;
if [buf[0], buf[1], buf[2], buf[3]] != CDFH_MAGIC_BYTES {
return Err(invalid("Invalid CDFH magic number"));
}
let file_name_length = parse_u16(&buf, 28) as usize;
let extra_fields_length = parse_u16(&buf, 30);
let file_comment_length = parse_u16(&buf, 32) as usize;
Ok(CDFH {
_version_made_by: parse_u16(&buf, 4),
_version_needed_to_extract: parse_u16(&buf, 6),
general_purpose_bit_flag: parse_u16(&buf, 8),
compression_method: parse_u16(&buf, 10),
_last_modification_time: parse_u16(&buf, 12),
_last_modification_date: parse_u16(&buf, 14),
crc32: parse_u32(&buf, 16),
compressed_size: parse_u32(&buf, 20),
uncompressed_size: parse_u32(&buf, 24),
file_start_disk: parse_u16(&buf, 34),
_internal_file_attributes: parse_u16(&buf, 36),
_external_file_attributes: parse_u32(&buf, 38),
local_file_header_offset: parse_u32(&buf, 42),
file_name: read_u8_slice(reader, file_name_length)?,
extra_fields: read_extra_fields(reader, extra_fields_length)?,
_file_comment: read_u8_slice(reader, file_comment_length)?,
})
}
#[derive(Debug)]
struct ExtraField {
pub header: u16,
pub data: Box<[u8]>,
}
fn read_extra_fields<R: Read>(reader: &mut R, size: u16) -> io::Result<Box<[ExtraField]>> {
let mut remaining = usize::from(size);
let mut fields = Vec::new();
while remaining > 0 {
if remaining < 4 {
return Err(invalid("truncated ZIP extra field"));
}
let mut header = [0u8; 4];
reader.read_exact(&mut header)?;
let id = parse_u16(&header, 0);
let data_size = usize::from(parse_u16(&header, 2));
remaining -= 4;
if data_size > remaining {
return Err(invalid("ZIP extra field data exceeds remaining length"));
}
let mut data = vec![0u8; data_size];
reader.read_exact(&mut data)?;
fields.push(ExtraField {
header: id,
data: data.into_boxed_slice(),
});
remaining -= data_size;
}
Ok(fields.into_boxed_slice())
}
/// Central directory metadata.
#[derive(Debug)]
struct CentralDirectoryInfo {
/// Number of this disk.
disk_number: u32,
/// Disk where central directory starts.
cd_start_disk: u32,
/// Number of central directory records on this disk.
cd_records_on_disk: u64,
/// Total number of central directory records.
cd_records_total: u64,
/// Size of central directory in bytes.
cd_size: u64,
/// Offset of start of central directory, relative to start of archive.
cd_offset: u64,
/// Comment
_comment: Box<[u8]>,
}
impl CentralDirectoryInfo {
fn validate_single_disk(&self) -> io::Result<()> {
if self.disk_number != 0
|| self.cd_start_disk != 0
|| self.cd_records_on_disk != self.cd_records_total
{
return Err(unsupported("split archives are not supported"));
}
Ok(())
}
}
impl From<EOCD> for CentralDirectoryInfo {
fn from(eocd: EOCD) -> Self {
Self {
disk_number: u32::from(eocd.disk_number),
cd_start_disk: u32::from(eocd.cd_start_disk),
cd_records_on_disk: u64::from(eocd.cd_records_on_disk),
cd_records_total: u64::from(eocd.cd_records_total),
cd_size: u64::from(eocd.cd_size),
cd_offset: u64::from(eocd.cd_offset),
_comment: eocd.comment,
}
}
}
impl From<EOCD64> for CentralDirectoryInfo {
fn from(eocd: EOCD64) -> Self {
Self {
disk_number: eocd.disk_number,
cd_start_disk: eocd.cd_start_disk,
cd_records_on_disk: eocd.cd_records_on_disk,
cd_records_total: eocd.cd_records_total,
cd_size: eocd.cd_size,
cd_offset: eocd.cd_offset,
_comment: eocd.comment,
}
}
}
fn read_central_directory_info<R: Read + Seek>(reader: &mut R) -> io::Result<CentralDirectoryInfo> {
let eocd_start = find_eocd(reader)?;
reader.seek(SeekFrom::Start(eocd_start))?;
let eocd = parse_eocd(reader)?;
let needs_zip64 = eocd.has_zip64_sentinels();
// check for presence of EOCD64 Locator which sits right before the EOCD
let locator_start = eocd_start.saturating_sub(EOCD64_LOCATOR_LEN as u64);
reader.seek(SeekFrom::Start(locator_start))?;
let eocd64_locator = parse_eocd64_locator(reader);
let info = match eocd64_locator {
Ok(locator) => {
if locator.cd_start_disk != 0 || locator.disks_total != 1 {
return Err(unsupported("split archives are not supported"));
}
// seek to and parse EOCD64
reader.seek(SeekFrom::Start(locator.cd_offset))?;
let eocd64 = parse_eocd64(reader)?;
CentralDirectoryInfo::from(eocd64)
}
Err(_) if needs_zip64 => return Err(invalid("missing EOCD64")),
Err(_) => CentralDirectoryInfo::from(eocd),
};
info.validate_single_disk()?;
Ok(info)
}
#[derive(Debug)]
struct EOCD64 {
/// Version made by.
_version_made_by: u16,
/// Version needed to extract (minimum).
_version_needed_to_extract: u16,
/// Number of this disk.
disk_number: u32,
/// Disk where central directory starts.
cd_start_disk: u32,
/// Number of central directory records on this disk.
cd_records_on_disk: u64,
/// Total number of central directory records.
cd_records_total: u64,
/// Size of central directory in bytes.
cd_size: u64,
/// Offset of start of central directory, relative to start of archive.
cd_offset: u64,
/// Comment.
comment: Box<[u8]>,
}
/// Parses the EOCD64. `reader` must be positioned at the start of the EOCD64.
fn parse_eocd64<R: Read>(reader: &mut R) -> io::Result<EOCD64> {
let mut buf = [0u8; EOCD64_LEN];
reader.read_exact(&mut buf)?;
if [buf[0], buf[1], buf[2], buf[3]] != EOCD64_MAGIC_BYTES {
return Err(invalid("Invalid EOCD64 magic number"));
}
let size_minus_12 = parse_u64(&buf, 4) + 12;
let comment_length = size_minus_12 as usize - (EOCD64_LEN - 12);
Ok(EOCD64 {
_version_made_by: parse_u16(&buf, 12),
_version_needed_to_extract: parse_u16(&buf, 14),
disk_number: parse_u32(&buf, 16),
cd_start_disk: parse_u32(&buf, 20),
cd_records_on_disk: parse_u64(&buf, 24),
cd_records_total: parse_u64(&buf, 32),
cd_size: parse_u64(&buf, 40),
cd_offset: parse_u64(&buf, 48),
comment: read_u8_slice(reader, comment_length)?,
})
}
#[derive(Debug)]
struct EOCD64Locator {
/// Disk where EOCD64 starts.
cd_start_disk: u32,
/// Offset to start of EOCD64, relative to start of archive.
cd_offset: u64,
/// Total number of disks.
disks_total: u32,
}
/// Parses the EOCD64 Locator. `reader` must be positioned at the start of the EOCD64 Locator.
fn parse_eocd64_locator<R: Read>(reader: &mut R) -> io::Result<EOCD64Locator> {
let mut buf = [0u8; EOCD64_LOCATOR_LEN];
reader.read_exact(&mut buf)?;
if [buf[0], buf[1], buf[2], buf[3]] != EOCD64_LOCATOR_MAGIC_BYTES {
return Err(invalid("Invalid EOCD64 Locator magic number"));
}
Ok(EOCD64Locator {
cd_start_disk: parse_u32(&buf, 4),
cd_offset: parse_u64(&buf, 8),
disks_total: parse_u32(&buf, 16),
})
}
/// End Of Central Directory record (EOCD).
#[derive(Debug)]
#[allow(clippy::upper_case_acronyms)]
struct EOCD {
/// Number of this disk (or FF FF for ZIP64).
disk_number: u16,
/// Disk where central directory starts (or FF FF for ZIP64).
cd_start_disk: u16,
/// Number of central directory records on this disk (or FF FF for ZIP64).
cd_records_on_disk: u16,
/// Total number of central directory records (or FF FF for ZIP64).
cd_records_total: u16,
/// Size of central directory in bytes (or FF FF FF FF for ZIP64).
cd_size: u32,
/// Offset of start of central directory, relative to start of archive (or FF FF FF FF for ZIP64).
cd_offset: u32,
/// Comment.
comment: Box<[u8]>,
}
impl EOCD {
fn has_zip64_sentinels(&self) -> bool {
self.disk_number == u16::MAX
|| self.cd_start_disk == u16::MAX
|| self.cd_records_on_disk == u16::MAX
|| self.cd_records_total == u16::MAX
|| self.cd_size == u32::MAX
|| self.cd_offset == u32::MAX
}
}
/// Returns the start byte position of the EOCD.
fn find_eocd<R: Read + Seek>(reader: &mut R) -> io::Result<u64> {
// the EOCD is located at the end of the file and is at most `EOCD_MAX_SIZE` bytes long so the
// search is restricted to that region.
let file_len = reader.seek(SeekFrom::End(0))?;
let search_start = file_len.saturating_sub(EOCD_MAX_SIZE as u64);
reader.seek(SeekFrom::Start(search_start))?;
let mut search_area = Vec::with_capacity((file_len - search_start) as usize);
reader.read_to_end(&mut search_area)?;
let eocd_start_in_search_area = search_area
.windows(EOCD_MAGIC_BYTES.len())
.enumerate()
.rev()
.find_map(|(pos, window)| {
if window != EOCD_MAGIC_BYTES {
return None;
}
// we found the magic bytes!
// but they can theoretically appear in the comment so we need to verify that this
// candidate header ends exactly at the end of the search area.
let header_end = pos.checked_add(EOCD_LEN)?;
let header = search_area.get(pos..header_end)?;
let comment_length = u16::from_le_bytes([header[20], header[21]]) as usize;
if header_end.checked_add(comment_length)? == search_area.len() {
Some(pos)
} else {
None
}
})
.ok_or_else(|| invalid("EOCD not found"))?;
let eocd_start = search_start + eocd_start_in_search_area as u64;
Ok(eocd_start)
}
/// Parses the EOCD. `reader` must be positioned at the start of the EOCD.
fn parse_eocd<R: Read>(reader: &mut R) -> io::Result<EOCD> {
let mut buf = [0u8; EOCD_LEN];
reader.read_exact(&mut buf)?;
if [buf[0], buf[1], buf[2], buf[3]] != EOCD_MAGIC_BYTES {
return Err(invalid("Invalid EOCD magic number"));
}
let comment_length = parse_u16(&buf, 20) as usize;
Ok(EOCD {
disk_number: parse_u16(&buf, 4),
cd_start_disk: parse_u16(&buf, 6),
cd_records_on_disk: parse_u16(&buf, 8),
cd_records_total: parse_u16(&buf, 10),
cd_size: parse_u32(&buf, 12),
cd_offset: parse_u32(&buf, 16),
comment: read_u8_slice(reader, comment_length)?,
})
}
+323
View File
@@ -0,0 +1,323 @@
use crate::{
pob::modules,
util::{append_lua_package_dir, fix_script_header},
};
use anyhow::{Result, anyhow};
use mlua::{Integer, IntoLuaMulti, Lua, MultiValue, Number, Value};
use std::{
path::PathBuf,
sync::mpsc::{Receiver, Sender, channel},
thread::JoinHandle,
};
/// A unit of work produced by advancing the running subscripts.
pub enum SubscriptEvent {
/// A subscript requested that a function in the main Lua instance be called on its behalf.
Call {
function_name: String,
arguments: NativeMultiValue,
/// Present for blocking calls. The return values of the callback must be sent back over it.
reply_tx: Option<Sender<Result<NativeMultiValue>>>,
},
/// A subscript finished successfully.
Finished {
id: u64,
return_values: NativeMultiValue,
},
/// A subscript errored or panicked.
Error { id: u64, error: String },
}
#[derive(Default)]
pub struct SubscriptManager {
next_id: u64,
scripts: Vec<Subscript>,
}
impl SubscriptManager {
/// Starts a new subscript running `script_text` on its own thread and returns the id it was
/// assigned.
pub fn push(
&mut self,
script_dir: PathBuf,
script_text: String,
blocking_calls: Vec<String>,
nonblocking_calls: Vec<String>,
arguments: NativeMultiValue,
) -> u64 {
let id = self.next_id;
self.next_id += 1;
let subscript = Subscript::new(
id,
script_text,
blocking_calls,
nonblocking_calls,
arguments,
script_dir,
);
self.scripts.push(subscript);
id
}
/// Advances all running subscripts by one step.
pub fn process(&mut self) -> Vec<SubscriptEvent> {
let mut events = vec![];
self.scripts.retain_mut(|subscript| {
subscript.take_call(&mut events);
subscript.try_join().is_none_or(|event| {
events.push(event);
// subscript has finished or errored, remove it
false
})
});
events
}
/// Returns `true` if at least one subscript is running.
pub fn has_running_subscripts(&self) -> bool {
!self.scripts.is_empty()
}
/// Returns `true` if the subscript with the given id is running.
pub fn is_running(&self, subscript_id: u64) -> bool {
self.scripts
.iter()
.any(|subscript| subscript.id == subscript_id)
}
}
/// A request sent from a subscript's thread to the main thread, asking it to invoke a function
/// defined in the main Lua instance on the subscript's behalf.
enum SubscriptCall {
Blocking {
function_name: String,
arguments: NativeMultiValue,
// used to send return values of function back to thread
reply_tx: Sender<Result<NativeMultiValue>>,
},
NonBlocking {
function_name: String,
arguments: NativeMultiValue,
},
}
/// A Lua script running on its own thread, in a separate `Lua` instance.
pub struct Subscript {
id: u64,
handle: Option<JoinHandle<anyhow::Result<NativeMultiValue>>>,
/// Receives `SubscriptCall`s sent by the proxy functions running in the subscript's s thread.
call_rx: Receiver<SubscriptCall>,
}
// Subscripts are lua scripts that are executed in their own instance on a separate thread.
//
// When a subscript needs to call a function defined in the main instance, a `SubscriptCall`
// message is send over a channel. At the beginning of each frame, the main thread checks for
// messages and executes the requested function with the provided arguments on behalf of the
// subscript. For `BlockingCall`, the subscript waits for the main thread to send the return
// values of the function back over another channel. For `NonBlockingCall`, the subscript doesn't
// wait on any return values and keeps executing the script after sending the message. Subscripts
// are required to explicitly specify the names of all (non)-blocking function calls that appear in
// the script.
impl Subscript {
/// Spawns a new thread, creates a fresh `Lua` instance on it, registers proxy functions for
/// `blocking_calls` and `nonblocking_calls`, and starts running `script_text` with
/// `arguments`.
pub fn new(
id: u64,
script_text: String,
blocking_calls: Vec<String>,
nonblocking_calls: Vec<String>,
arguments: NativeMultiValue,
script_dir: PathBuf,
) -> Self {
let (call_tx, call_rx) = channel();
let handle = std::thread::spawn(move || {
profiling::register_thread!(format!("Subscript {id} Thread"));
// unsafe required to load C modules (curl)
let lua = unsafe { Lua::unsafe_new() };
append_lua_package_dir(&lua, &script_dir.join("lua"))?;
// register modules
modules::register(&lua)?;
// register a proxy for each allowed blocking call.
// forwards the call to the main thread and blocks on `reply_rx` until the main thread
// sends back the return values
for function_name in blocking_calls {
let call_tx = call_tx.clone();
lua.globals().set(
function_name.clone(),
lua.create_function(move |_, args: MultiValue| {
let (reply_tx, reply_rx) = channel();
call_tx
.send(SubscriptCall::Blocking {
function_name: function_name.clone(),
arguments: args.try_into()?,
reply_tx,
})
.unwrap();
let return_values = reply_rx.recv().map_err(|e| anyhow!("{e}"))??;
Ok(return_values)
})?,
)?;
}
// register a proxy for each allowed non-blocking call.
// forwards the call to the main thread and returns immediately
for function_name in nonblocking_calls {
let call_tx = call_tx.clone();
lua.globals().set(
function_name.clone(),
lua.create_function(move |_, args: MultiValue| {
call_tx
.send(SubscriptCall::NonBlocking {
function_name: function_name.clone(),
arguments: args.try_into()?,
})
.map_err(|e| anyhow!("{e}"))?;
Ok(())
})?,
)?;
}
let mut script_text = script_text.into_bytes();
fix_script_header(&mut script_text);
let result = lua.load(script_text).call::<MultiValue>(arguments)?;
result.try_into()
});
Self {
id,
handle: Some(handle),
call_rx,
}
}
/// Collects a pending `SubscriptCall` into `events`.
///
/// Does nothing if there is no pending call.
fn take_call(&self, events: &mut Vec<SubscriptEvent>) {
let Ok(call) = self.call_rx.try_recv() else {
// no pending call, or thread disconnected which is handled on join
return;
};
events.push(match call {
SubscriptCall::Blocking {
function_name,
arguments,
reply_tx,
} => SubscriptEvent::Call {
function_name,
arguments,
reply_tx: Some(reply_tx),
},
SubscriptCall::NonBlocking {
function_name,
arguments,
} => SubscriptEvent::Call {
function_name,
arguments,
reply_tx: None,
},
});
}
/// If the subscript's thread has finished, joins it and returns the resulting
/// `SubscriptEvent`.
fn try_join(&mut self) -> Option<SubscriptEvent> {
if !self.handle.as_ref().is_some_and(JoinHandle::is_finished) {
return None;
}
let event = match self.handle.take().unwrap().join() {
Ok(Ok(return_values)) => SubscriptEvent::Finished {
id: self.id,
return_values,
},
Ok(Err(err)) => SubscriptEvent::Error {
id: self.id,
error: err.to_string(),
},
// the thread panicked
Err(_) => SubscriptEvent::Error {
id: self.id,
error: String::from("Subscript thread panicked!"),
},
};
Some(event)
}
}
/// Instance-independent stand-in for `mlua::Value`.
///
/// Values produced by one Lua instance (in particular strings) cannot be used directly with
/// another Lua instance. `NativeValue` acts as a stand-in to freely move between the main instance
/// and a subscript's instance. It only covers the types that are actually exchanged, namely `nil`,
/// booleans, numbers, and string.
#[derive(Debug)]
pub enum NativeValue {
Nil,
Number(Number),
Integer(Integer),
Boolean(bool),
// Lua strings may not be valid UTF-8, so store as raw bytes instead of String
String(Vec<u8>),
}
/// Instance-independent stand-in for `mlua::MultiValue`.
///
/// Used to pass function arguments and return values between the main Lua instance and a
/// subscript's Lua instance.
#[derive(Debug)]
pub struct NativeMultiValue(Vec<NativeValue>);
impl TryFrom<Value> for NativeValue {
type Error = anyhow::Error;
fn try_from(value: Value) -> Result<Self, Self::Error> {
match value {
Value::Nil => Ok(Self::Nil),
Value::Boolean(b) => Ok(Self::Boolean(b)),
Value::Integer(i) => Ok(Self::Integer(i)),
Value::Number(n) => Ok(Self::Number(n)),
Value::String(s) => Ok(Self::String(s.as_bytes().to_vec())),
other => Err(anyhow!("Unsupported value type: {}", other.type_name())),
}
}
}
impl TryFrom<MultiValue> for NativeMultiValue {
type Error = anyhow::Error;
fn try_from(values: MultiValue) -> Result<Self, Self::Error> {
values
.into_iter()
.map(NativeValue::try_from)
.collect::<Result<_, _>>()
.map(Self)
}
}
impl IntoLuaMulti for NativeMultiValue {
fn into_lua_multi(self, lua: &Lua) -> mlua::Result<MultiValue> {
self.0
.into_iter()
.map(|v| match v {
NativeValue::Nil => Ok(Value::Nil),
NativeValue::Boolean(b) => Ok(Value::Boolean(b)),
NativeValue::Integer(i) => Ok(Value::Integer(i)),
NativeValue::Number(n) => Ok(Value::Number(n)),
NativeValue::String(s) => lua.create_string(s).map(Value::String),
})
.collect::<mlua::Result<Vec<_>>>()
.map(MultiValue::from_vec)
}
}
+293 -221
View File
@@ -1,27 +1,84 @@
use crate::{
dpi::{ConvertToLogical, ConvertToPhysical, LogicalSize, PhysicalRect, PhysicalSize},
color::Srgba,
dpi::{LogicalPoint, LogicalRect, LogicalSize, PhysicalRect, PhysicalSize, ScaleFactor},
math::Point,
renderer::{
image::ImageData,
mesh::{ClippedMesh, Vertex},
image::MipStrategy,
textures::{TextureId, TextureOptions, TexturesDelta},
},
util::calculate_hash,
uv::UvPoint,
};
use ahash::HashMap;
use std::{borrow::Cow, num::NonZeroU64, ops::Range};
use wgpu::util::DeviceExt;
use std::{
borrow::Cow,
num::{NonZeroU32, NonZeroU64},
ops::Range,
};
use wgpu::{Origin3d, util::DeviceExt};
pub mod image;
pub mod mesh;
mod mipmap;
pub mod primitives;
pub mod tessellator;
pub mod textures;
pub const BATCH_TEX_SLOTS: NonZeroU32 = NonZeroU32::new(32).expect("32 is non-zero");
const DUMMY_TEXTURE_ID: TextureId = 0;
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, bytemuck::Pod, bytemuck::Zeroable)]
pub struct Vertex {
pub pos: LogicalPoint<f32>,
pub uv: UvPoint,
pub color: Srgba,
/// Index into batch's texture array
pub texture_slot: u32,
/// Index into texture array
pub layer_idx: u32,
}
impl Vertex {
const ATTRIBS: [wgpu::VertexAttribute; 5] = wgpu::vertex_attr_array![
// 0: vec2 position
0 => Float32x2,
// 1: vec2 uv
1 => Float32x2,
// 2: uint color
2 => Uint32,
// 3: uint texture_idx
3 => Uint32,
// 4: uint layer_idx
4 => Uint32
];
fn desc() -> wgpu::VertexBufferLayout<'static> {
wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<Self>() as wgpu::BufferAddress,
step_mode: wgpu::VertexStepMode::Vertex,
attributes: &Self::ATTRIBS,
}
}
}
pub struct Batch {
pub clip_rect: LogicalRect<f32>,
pub textures: Vec<TextureId>,
/// Points into combined index buffer of `RenderJob`
pub index_range: Range<u32>,
}
pub struct RenderJob {
pub vertices: Vec<Vertex>,
pub indices: Vec<u32>,
pub batches: Vec<Batch>,
pub textures_delta: TexturesDelta,
pub scale_factor: ScaleFactor<f32>,
}
#[derive(Debug)]
struct Texture {
struct TextureEntry {
texture: wgpu::Texture,
bind_group: wgpu::BindGroup,
view: wgpu::TextureView,
options: TextureOptions,
}
#[repr(C)]
@@ -33,16 +90,17 @@ struct Globals {
pub struct Renderer {
pipeline: wgpu::RenderPipeline,
index_buffer: SlicedBuffer,
vertex_buffer: SlicedBuffer,
index_buffer: Buffer,
vertex_buffer: Buffer,
globals_buffer: wgpu::Buffer,
previous_globals: Globals,
globals_bind_group: wgpu::BindGroup,
texture_bind_group_layout: wgpu::BindGroupLayout,
textures_bind_group_layout: wgpu::BindGroupLayout,
textures: HashMap<TextureId, Texture>,
textures: HashMap<TextureId, TextureEntry>,
samplers: HashMap<TextureOptions, wgpu::Sampler>,
batch_bind_group_cache: HashMap<u64, wgpu::BindGroup>,
}
impl Renderer {
@@ -92,7 +150,7 @@ impl Renderer {
}],
});
let texture_bind_group_layout =
let textures_bind_group_layout =
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: Some("texture_bind_group_layout"),
entries: &[
@@ -104,27 +162,30 @@ impl Renderer {
sample_type: wgpu::TextureSampleType::Float { filterable: true },
view_dimension: wgpu::TextureViewDimension::D2Array,
},
count: None,
count: Some(BATCH_TEX_SLOTS),
},
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
count: Some(BATCH_TEX_SLOTS),
},
],
});
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("pipeline_layout"),
bind_group_layouts: &[&globals_bind_group_layout, &texture_bind_group_layout],
push_constant_ranges: &[],
bind_group_layouts: &[
Some(&globals_bind_group_layout),
Some(&textures_bind_group_layout),
],
immediate_size: 0,
});
let depth_stencil = output_depth_format.map(|format| wgpu::DepthStencilState {
format,
depth_write_enabled: false,
depth_compare: wgpu::CompareFunction::Always,
depth_write_enabled: None,
depth_compare: None,
stencil: wgpu::StencilState::default(),
bias: wgpu::DepthBiasState::default(),
});
@@ -135,17 +196,8 @@ impl Renderer {
vertex: wgpu::VertexState {
entry_point: Some("vs_main"),
module: &shader_module,
buffers: &[wgpu::VertexBufferLayout {
// 4x f32, 2x u32 -> 6 * 4 bytes
array_stride: 6 * 4,
step_mode: wgpu::VertexStepMode::Vertex,
// 0: vec2 position
// 1: vec2 texture coordinates
// 2: uint color
// 3: uint layer_idx
attributes: &wgpu::vertex_attr_array![0 => Float32x2, 1 => Float32x2, 2 => Uint32, 3 => Uint32],
}],
compilation_options: wgpu::PipelineCompilationOptions::default()
buffers: &[Some(Vertex::desc())],
compilation_options: wgpu::PipelineCompilationOptions::default(),
},
primitive: wgpu::PrimitiveState {
topology: wgpu::PrimitiveTopology::TriangleList,
@@ -170,20 +222,20 @@ impl Renderer {
blend: Some(wgpu::BlendState::ALPHA_BLENDING),
write_mask: wgpu::ColorWrites::ALL,
})],
compilation_options: wgpu::PipelineCompilationOptions::default()
compilation_options: wgpu::PipelineCompilationOptions::default(),
}),
multiview: None,
multiview_mask: None,
cache: None,
});
let vertex_buffer = SlicedBuffer::new(
let vertex_buffer = Buffer::new(
device,
wgpu::BufferUsages::VERTEX,
NonZeroU64::new(2048).expect("2048 is non-zero"),
NonZeroU64::new(std::mem::size_of::<Vertex>() as u64)
.expect("size of vertex is non-zero"),
);
let index_buffer = SlicedBuffer::new(
let index_buffer = Buffer::new(
device,
wgpu::BufferUsages::INDEX,
NonZeroU64::new(2048 * 3).expect("2048 * 3 is non-zero"),
@@ -199,25 +251,24 @@ impl Renderer {
screen_size: LogicalSize::zero(),
},
globals_bind_group,
texture_bind_group_layout,
textures_bind_group_layout,
textures: HashMap::default(),
samplers: HashMap::default(),
batch_bind_group_cache: HashMap::default(),
}
}
pub fn render(
&self,
&mut self,
device: &wgpu::Device,
render_pass: &mut wgpu::RenderPass<'static>,
paint_jobs: &[ClippedMesh],
render_job: &RenderJob,
screen_size: PhysicalSize<u32>,
pixels_per_point: f32,
scale_factor: ScaleFactor<f32>,
) {
profiling::scope!("render");
let screen_rect = PhysicalRect::from_origin_and_size(Point::zero(), screen_size);
let mut index_buffer_slices = self.index_buffer.slices.iter();
let mut vertex_buffer_slices = self.vertex_buffer.slices.iter();
render_pass.set_viewport(
0.0,
0.0,
@@ -228,18 +279,25 @@ impl Renderer {
);
render_pass.set_pipeline(&self.pipeline);
render_pass.set_bind_group(0, &self.globals_bind_group, &[]);
render_pass.set_index_buffer(
self.index_buffer.buffer.slice(..),
wgpu::IndexFormat::Uint32,
);
render_pass.set_vertex_buffer(0, self.vertex_buffer.buffer.slice(..));
for ClippedMesh { clip_rect, mesh } in paint_jobs {
let phys_clip_rect = clip_rect.to_physical::<f32, _>(pixels_per_point).round();
for batch in &render_job.batches {
// set textures array bind group
let bind_group = self.get_or_build_batch_bind_group(device, batch);
render_pass.set_bind_group(1, bind_group, &[]);
// scissor
let phys_clip_rect = batch.clip_rect * scale_factor;
let scissor = phys_clip_rect
// NOTE: can't cast to u32 directly because negative values cause a panic
.cast::<i32>()
.intersection(&screen_rect.to_i32())
.map(|s| s.to_u32());
.intersection(&screen_rect.cast())
.map(|s| s.round().to_u32());
// skip batch if scissor doesn't intersect screen
let Some(scissor) = scissor else {
index_buffer_slices.next().unwrap();
vertex_buffer_slices.next().unwrap();
continue;
};
@@ -250,27 +308,8 @@ impl Renderer {
scissor.height(),
);
let index_buffer_slice = index_buffer_slices.next().unwrap();
let vertex_buffer_slice = vertex_buffer_slices.next().unwrap();
if let Some(Texture { bind_group, .. }) = self.textures.get(&mesh.texture_id) {
render_pass.set_bind_group(1, bind_group, &[]);
render_pass.set_index_buffer(
self.index_buffer
.buffer
.slice(index_buffer_slice.start as u64..index_buffer_slice.end as u64),
wgpu::IndexFormat::Uint32,
);
render_pass.set_vertex_buffer(
0,
self.vertex_buffer
.buffer
.slice(vertex_buffer_slice.start as u64..vertex_buffer_slice.end as u64),
);
render_pass.draw_indexed(0..mesh.indices.len() as u32, 0, 0..1);
} else {
log::warn!("Missing texture: {:?}", mesh.texture_id);
}
// draw batch
render_pass.draw_indexed(batch.index_range.clone(), 0, 0..1);
}
render_pass.set_scissor_rect(0, 0, screen_size.width, screen_size.height);
@@ -287,96 +326,113 @@ impl Renderer {
profiling::scope!("update_textures");
for (id, image_delta) in &textures_delta.update {
let ImageData {
format,
width,
height,
array_layers,
mipmap_count,
data_order,
ref bytes,
} = image_delta.image;
match image_delta {
image::ImageDelta::Full {
image,
options,
mip_strategy,
} => {
let generate_mipmaps = matches!(mip_strategy, MipStrategy::GenerateOnUpload);
let mip_level_count = mip_strategy.resolve_mip_level_count(image);
let size = wgpu::Extent3d {
width,
height,
depth_or_array_layers: array_layers,
};
let size = wgpu::Extent3d {
width: image.width,
height: image.height,
depth_or_array_layers: image.array_layers,
};
// only generate mipmaps for uncompressed images that don't already have mipmaps
let gen_mipmaps = image_delta.options.generate_mipmaps
&& mipmap_count.get() == 1
&& !format.is_compressed();
let label_str = format!("texture_{id:?}");
let label = Some(label_str.as_str());
let mip_level_count = if gen_mipmaps {
size.max_mips(wgpu::TextureDimension::D2)
} else {
mipmap_count.get()
};
let texture = create_texture_with_data(
device,
queue,
&wgpu::TextureDescriptor {
label,
size,
mip_level_count,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: image.format,
usage: wgpu::TextureUsages::TEXTURE_BINDING
| wgpu::TextureUsages::COPY_DST,
view_formats: &[image.format.add_srgb_suffix()],
},
image.data_order.into(),
&image.bytes,
generate_mipmaps,
);
let label_str = format!("texture_{id:?}");
let label = Some(label_str.as_str());
if generate_mipmaps {
mipmap::generate_mipmap_chain(queue, &texture, &image.bytes);
}
let texture = create_texture_with_data(
device,
queue,
&wgpu::TextureDescriptor {
label,
size,
mip_level_count,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format,
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
view_formats: &[format.add_srgb_suffix()],
},
data_order.into(),
bytes,
gen_mipmaps,
);
let view = texture.create_view(&wgpu::TextureViewDescriptor {
dimension: Some(wgpu::TextureViewDimension::D2Array),
..Default::default()
});
if gen_mipmaps {
mipmap::generate_mipmap_chain(queue, &texture, bytes);
self.samplers
.entry(*options)
.or_insert_with(|| create_sampler(*options, device));
self.textures.insert(
*id,
TextureEntry {
texture,
view,
options: *options,
},
);
self.batch_bind_group_cache.clear();
}
image::ImageDelta::Partial {
image: source,
origin,
} => {
let destination = self.textures.get(id).expect("Texture is allocated");
let size = wgpu::Extent3d {
width: source.width,
height: source.height,
depth_or_array_layers: 1,
};
let origin = Origin3d {
x: origin.x,
y: origin.y,
z: origin.layer,
};
// NOTE: this doesn't handle mipmaps or formats other than RBGA
queue.write_texture(
wgpu::TexelCopyTextureInfo {
texture: &destination.texture,
mip_level: 0,
origin,
aspect: wgpu::wgt::TextureAspect::All,
},
&source.bytes,
wgpu::TexelCopyBufferLayout {
offset: 0,
bytes_per_row: Some(4 * source.width),
rows_per_image: Some(source.height),
},
size,
);
}
}
let texture_view = texture.create_view(&wgpu::TextureViewDescriptor {
dimension: Some(wgpu::TextureViewDimension::D2Array),
..Default::default()
});
let sampler = self
.samplers
.entry(image_delta.options)
.or_insert_with(|| create_sampler(image_delta.options, device));
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label,
layout: &self.texture_bind_group_layout,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::TextureView(&texture_view),
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::Sampler(sampler),
},
],
});
self.textures.insert(
*id,
Texture {
texture,
bind_group,
},
);
}
}
pub fn free_textures(&mut self, textures_delta: &TexturesDelta) {
profiling::scope!("free_textures");
if !textures_delta.free.is_empty() {
self.batch_bind_group_cache.clear();
}
for id in &textures_delta.free {
if let Some(texture) = self.textures.remove(id) {
texture.texture.destroy();
@@ -390,14 +446,14 @@ impl Renderer {
&mut self,
device: &wgpu::Device,
queue: &wgpu::Queue,
paint_jobs: &[ClippedMesh],
render_job: &RenderJob,
screen_size: PhysicalSize<u32>,
pixels_per_point: f32,
scale_factor: ScaleFactor<f32>,
) {
profiling::scope!("update_buffers");
let uniform_buffer_content = Globals {
screen_size: screen_size.to_logical(pixels_per_point),
screen_size: screen_size.cast() / scale_factor,
};
// update globals uniform buffer
@@ -410,65 +466,90 @@ impl Renderer {
self.previous_globals = uniform_buffer_content;
}
// count how many vertices & indices need to be rendered
let (vertex_count, index_count) = {
paint_jobs.iter().fold((0, 0), |acc, clipped_mesh| {
(
acc.0 + clipped_mesh.mesh.vertices.len(),
acc.1 + clipped_mesh.mesh.indices.len(),
)
})
};
let vertex_count = render_job.vertices.len();
let index_count = render_job.indices.len();
if !(index_count > 0 && vertex_count > 0) {
return;
}
// update index and vertex buffers
if index_count > 0 && vertex_count > 0 {
self.index_buffer.slices.clear();
self.vertex_buffer.slices.clear();
let mut staging_index_buffer = self.index_buffer.create_staging_buffer(
device,
queue,
NonZeroU64::new(index_count as u64).expect("index_count > 0"),
);
let mut staging_vertex_buffer = self.vertex_buffer.create_staging_buffer(
device,
queue,
NonZeroU64::new(vertex_count as u64).expect("vertex_count > 0"),
);
let mut staging_index_buffer = self.index_buffer.create_staging_buffer(
device,
queue,
NonZeroU64::new(index_count as u64).expect("index_count > 0"),
);
let mut staging_vertex_buffer = self.vertex_buffer.create_staging_buffer(
device,
queue,
NonZeroU64::new(vertex_count as u64).expect("vertex_count > 0"),
);
staging_index_buffer
.slice(..)
.copy_from_slice(bytemuck::cast_slice(&render_job.indices));
let mut index_offset = 0;
let mut vertex_offset = 0;
for ClippedMesh { mesh, .. } in paint_jobs {
{
let size = mesh.indices.len() * std::mem::size_of::<u32>();
let slice = index_offset..(index_offset + size);
staging_index_buffer[slice.clone()]
.copy_from_slice(bytemuck::cast_slice(&mesh.indices));
self.index_buffer.slices.push(slice);
index_offset += size;
}
{
let size = mesh.vertices.len() * std::mem::size_of::<Vertex>();
let slice = vertex_offset..(vertex_offset + size);
staging_vertex_buffer[slice.clone()]
.copy_from_slice(bytemuck::cast_slice(&mesh.vertices));
self.vertex_buffer.slices.push(slice);
vertex_offset += size;
}
}
}
staging_vertex_buffer
.slice(..)
.copy_from_slice(bytemuck::cast_slice(&render_job.vertices));
}
fn get_or_build_batch_bind_group(
&mut self,
device: &wgpu::Device,
batch: &Batch,
) -> &wgpu::BindGroup {
let key = calculate_hash(&batch.textures);
self.batch_bind_group_cache.entry(key).or_insert_with(|| {
let mut views: Vec<_> = batch
.textures
.iter()
.map(|id| &self.textures[id].view)
.collect();
let mut samplers: Vec<_> = batch
.textures
.iter()
.map(|id| {
self.samplers
.get(&self.textures[id].options)
.expect("sampler is present from update_textures")
})
.collect();
// Metal doesn't support the PARTIALLY_BOUND_BINDING_ARRAY feature
// so we pad to up MAX_SLOTS with a dummy view/sampler
let dummy = &self.textures[&DUMMY_TEXTURE_ID];
let dummy_sampler = self.samplers.get(&dummy.options).unwrap();
views.resize(BATCH_TEX_SLOTS.get() as usize, &dummy.view);
samplers.resize(BATCH_TEX_SLOTS.get() as usize, dummy_sampler);
device.create_bind_group(&wgpu::BindGroupDescriptor {
label: Some("batch_textures_bind_group"),
layout: &self.textures_bind_group_layout,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::TextureViewArray(&views),
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::SamplerArray(&samplers),
},
],
})
})
}
}
struct SlicedBuffer {
struct Buffer {
buffer: wgpu::Buffer,
slices: Vec<Range<usize>>,
size: wgpu::BufferSize,
usage: wgpu::BufferUsages,
stride: NonZeroU64,
}
impl SlicedBuffer {
impl Buffer {
fn new(
device: &wgpu::Device,
usage: wgpu::BufferUsages,
@@ -486,7 +567,6 @@ impl SlicedBuffer {
Self {
buffer,
slices: Vec::with_capacity(64),
size,
usage,
stride,
@@ -542,7 +622,7 @@ fn create_sampler(options: TextureOptions, device: &wgpu::Device) -> wgpu::Sampl
}
/// Adapted from `wgpu::Device::create_texture_with_data`.
/// Doesn't upload any data for mip level > 0 if skip_mipmaps is true.
/// Doesn't upload any data for mip level > 0 if `skip_mipmaps` is true.
fn create_texture_with_data(
device: &wgpu::Device,
queue: &wgpu::Queue,
@@ -551,30 +631,22 @@ fn create_texture_with_data(
data: &[u8],
skip_mipmaps: bool,
) -> wgpu::Texture {
// Implicitly add the COPY_DST usage
// implicitly add the COPY_DST usage
let mut desc = desc.to_owned();
desc.usage |= wgpu::TextureUsages::COPY_DST;
let texture = device.create_texture(&desc);
// Will return None only if it's a combined depth-stencil format
// If so, default to 4, validation will fail later anyway since the depth or stencil
// aspect needs to be written to individually
// will return None only if it's a combined depth-stencil format. if so, default to 4,
// validation will fail later anyway since the depth or stencil aspect needs to be written to
// individually
let block_size = desc.format.block_copy_size(None).unwrap_or(4);
let (block_width, block_height) = desc.format.block_dimensions();
let layer_iterations = desc.array_layer_count();
let outer_iteration;
let inner_iteration;
match order {
wgpu::wgt::TextureDataOrder::LayerMajor => {
outer_iteration = layer_iterations;
inner_iteration = desc.mip_level_count;
}
wgpu::wgt::TextureDataOrder::MipMajor => {
outer_iteration = desc.mip_level_count;
inner_iteration = layer_iterations;
}
}
let (outer_iteration, inner_iteration) = match order {
wgpu::wgt::TextureDataOrder::LayerMajor => (layer_iterations, desc.mip_level_count),
wgpu::wgt::TextureDataOrder::MipMajor => (desc.mip_level_count, layer_iterations),
};
let mut binary_offset = 0;
for outer in 0..outer_iteration {
@@ -590,13 +662,13 @@ fn create_texture_with_data(
mip_size.depth_or_array_layers = 1;
}
// When uploading mips of compressed textures and the mip is supposed to be
// a size that isn't a multiple of the block size, the mip needs to be uploaded
// as its "physical size" which is the size rounded up to the nearest block size.
// when uploading mips of compressed textures and the mip is supposed to be a size that
// isn't a multiple of the block size, the mip needs to be uploaded as its "physical
// size" which is the size rounded up to the nearest block size.
let mip_physical = mip_size.physical_size(desc.format);
// All these calculations are performed on the physical size as that's the
// data that exists in the buffer.
// all these calculations are performed on the physical size as that's the data that
// exists in the buffer.
let width_blocks = mip_physical.width / block_width;
let height_blocks = mip_physical.height / block_height;
+165 -66
View File
@@ -2,17 +2,99 @@ use crate::{color::Srgba, renderer::textures::TextureOptions};
use image::{DynamicImage, RgbaImage};
use std::{io::Read, num::NonZeroU32, path::Path};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MipStrategy {
/// Single mip level.
None,
/// Generate mip chain from mip 0 on upload.
GenerateOnUpload,
/// Upload as is. Used when `ImageData` already contains a full mip chain (e.g. when loaded from DDS).
Provided,
}
impl MipStrategy {
/// Resolves to a `MipStrategy` based on the actual `ImageData` and the callers request to
/// generate a mip chain if possible.
pub fn resolve(image: &ImageData, generate_if_possible: bool) -> Self {
if image.mipmap_count.get() > 1 {
Self::Provided
} else if generate_if_possible && !image.format.is_compressed() {
Self::GenerateOnUpload
} else {
Self::None
}
}
/// Determine mip level count of given `ImageData` after mip strategy has been applied
pub fn resolve_mip_level_count(&self, image: &ImageData) -> u32 {
match self {
Self::None => 1,
Self::Provided => image.mipmap_count.get(),
Self::GenerateOnUpload => {
let size = wgpu::Extent3d {
width: image.width,
height: image.height,
depth_or_array_layers: image.array_layers,
};
size.max_mips(wgpu::TextureDimension::D2)
}
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct PartialDeltaOrigin {
pub x: u32,
pub y: u32,
pub layer: u32,
}
/// Represents the change to a GPU texture.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ImageDelta {
pub image: ImageData,
pub options: TextureOptions,
pub enum ImageDelta {
/// Creates a whole new texture.
Full {
image: ImageData,
options: TextureOptions,
mip_strategy: MipStrategy,
},
/// Updates a sub-region starting at `origin` of an existing texture.
Partial {
image: ImageData,
origin: PartialDeltaOrigin,
},
}
impl ImageDelta {
pub fn new<I: Into<ImageData>>(image: I, options: TextureOptions) -> Self {
Self {
image: image.into(),
pub fn full<I: Into<ImageData>>(
image: I,
options: TextureOptions,
mip_strategy: MipStrategy,
) -> Self {
let image = image.into();
debug_assert!(
match mip_strategy {
MipStrategy::None => true,
MipStrategy::GenerateOnUpload => {
image.mipmap_count.get() == 1 && !image.format.is_compressed()
}
MipStrategy::Provided => image.mipmap_count.get() > 1,
},
"MipStrategy inconsistent with image data"
);
Self::Full {
image,
options,
mip_strategy,
}
}
pub fn partial<I: Into<ImageData>>(image: I, origin: PartialDeltaOrigin) -> Self {
Self::Partial {
image: image.into(),
origin,
}
}
}
@@ -61,7 +143,7 @@ impl ImageData {
height,
array_layers: 1,
mipmap_count: NonZeroU32::new(1).expect("1 is non-zero"),
data_order: Default::default(),
data_order: DataOrder::default(),
bytes: RgbaImage::from_pixel(width, height, color.0.into()).into_raw(),
}
}
@@ -75,7 +157,7 @@ impl From<DynamicImage> for ImageData {
height: image.height(),
array_layers: 1,
mipmap_count: NonZeroU32::new(1).expect("1 is non-zero"),
data_order: Default::default(),
data_order: DataOrder::default(),
bytes: image.to_rgba8().into_raw(),
}
}
@@ -89,7 +171,7 @@ impl From<RgbaImage> for ImageData {
height: image.height(),
array_layers: 1,
mipmap_count: NonZeroU32::new(1).expect("1 is non-zero"),
data_order: Default::default(),
data_order: DataOrder::default(),
bytes: image.into_raw(),
}
}
@@ -103,69 +185,86 @@ impl std::fmt::Debug for ImageData {
.field("height", &self.height)
.field("array_layers", &self.array_layers)
.field("mipmap_count", &self.mipmap_count)
.finish()
.finish_non_exhaustive()
}
}
// TODO: clean this up
pub fn load_image_file<P: AsRef<Path>>(path: P) -> anyhow::Result<ImageData> {
// PoB2 assumes a case insensitive filesystem is used. This can lead to some
// files not being found on case sensitive systems.
// As a workaround, try using a lower-cased path if the original path doesn't
// exist.
let path = if path.as_ref().exists() {
path.as_ref().to_owned()
let path = resolve_path(path);
if is_compressed_dds(&path) {
load_compressed_dds(&path)
} else {
let mut path = path.as_ref().to_owned();
let lowercase_filename = path.file_name().unwrap().to_ascii_lowercase();
path.set_file_name(lowercase_filename);
path
};
// let image crate deal with other file types
let image = image::ImageReader::open(&path)?.decode()?;
Ok(image.into())
}
}
// special handling for compressed dds files
if path.extension().and_then(|s| s.to_str()) == Some("zst")
&& path
.file_stem()
.and_then(|s| s.to_str())
.map(|s| s.ends_with(".dds"))
.unwrap_or(false)
{
let f = std::fs::File::open(&path)?;
let file_len = f.metadata().ok().map(|m| m.len());
let mut zstd_decoder = zstd::Decoder::new(f)?;
let parse_option = dds::header::ParseOptions::new_permissive(file_len);
let header = dds::header::Header::read(&mut zstd_decoder, &parse_option)?;
let dxgi_format = dds::Format::from_header(&header)?;
// zstd_decoder will now be at start of pixel data
let non_data_len = dds::header::Header::MAGIC.len() + header.byte_len();
let data_len = file_len.and_then(|l| (l as usize).checked_sub(non_data_len));
let mut pixel_data = Vec::with_capacity(data_len.unwrap_or(0));
zstd_decoder.read_to_end(&mut pixel_data)?;
let format = match dxgi_format {
dds::Format::BC1_UNORM => wgpu::TextureFormat::Bc1RgbaUnorm,
dds::Format::BC2_UNORM => wgpu::TextureFormat::Bc2RgbaUnorm,
dds::Format::BC3_UNORM => wgpu::TextureFormat::Bc3RgbaUnorm,
dds::Format::BC7_UNORM => wgpu::TextureFormat::Bc7RgbaUnorm,
dds::Format::R8G8B8A8_UNORM => wgpu::TextureFormat::Rgba8Unorm,
_ => anyhow::bail!("Unsupported dxgi format"),
};
let image_data = ImageData {
format,
width: header.width(),
height: header.height(),
array_layers: header.array_size(),
mipmap_count: header.mipmap_count(),
data_order: DataOrder::LayerMajor,
bytes: pixel_data,
};
return Ok(image_data);
/// Attempts to find the file, trying lowercase filename if it doesn't exist.
///
/// NOTE: PoB2 assumes a case insensitive filesystem, so checking the lowercase name
/// helps on case sensitive systems in some cases (no pun intended).
fn resolve_path<P: AsRef<Path>>(path: P) -> std::path::PathBuf {
let path_ref = path.as_ref();
if path_ref.exists() {
return path_ref.to_owned();
}
// let image crate deal with other file types
let image = image::ImageReader::open(&path)?.decode()?;
Ok(image.into())
let mut lowercase_path = path_ref.to_owned();
if let Some(filename) = path_ref.file_name() {
lowercase_path.set_file_name(filename.to_ascii_lowercase());
}
lowercase_path
}
/// Checks if file is a compressed DDS file (.dds.zst)
fn is_compressed_dds<P: AsRef<Path>>(path: P) -> bool {
path.as_ref()
.to_string_lossy()
.to_ascii_lowercase()
.ends_with(".dds.zst")
}
fn dds_format_to_wgpu(format: dds::Format) -> anyhow::Result<wgpu::TextureFormat> {
Ok(match format {
dds::Format::BC1_UNORM => wgpu::TextureFormat::Bc1RgbaUnorm,
dds::Format::BC2_UNORM => wgpu::TextureFormat::Bc2RgbaUnorm,
dds::Format::BC3_UNORM => wgpu::TextureFormat::Bc3RgbaUnorm,
dds::Format::BC7_UNORM => wgpu::TextureFormat::Bc7RgbaUnorm,
dds::Format::R8G8B8A8_UNORM => wgpu::TextureFormat::Rgba8Unorm,
_ => anyhow::bail!("Unsupported DDS format: {format:?}"),
})
}
/// Loads a compressed DDS file (.dds.zst)
fn load_compressed_dds<P: AsRef<Path>>(path: P) -> anyhow::Result<ImageData> {
let file = std::fs::File::open(path.as_ref())?;
let file_len = file.metadata().ok().map(|m| m.len());
let mut decoder = zstd::Decoder::new(file)?;
let parse_options = dds::header::ParseOptions::new_permissive(file_len);
let header = dds::header::Header::read(&mut decoder, &parse_options)?;
let dxgi_format = dds::Format::from_header(&header)?;
// zstd_decoder will now be at start of pixel data
// Read pixel data
let non_data_len = dds::header::Header::MAGIC.len() + header.byte_len();
let expected_data_len = file_len
.and_then(|len| (len as usize).checked_sub(non_data_len))
.unwrap_or(0);
let mut pixel_data = Vec::with_capacity(expected_data_len);
decoder.read_to_end(&mut pixel_data)?;
Ok(ImageData {
format: dds_format_to_wgpu(dxgi_format)?,
width: header.width(),
height: header.height(),
array_layers: header.array_size(),
mipmap_count: header.mipmap_count(),
data_order: DataOrder::LayerMajor,
bytes: pixel_data,
})
}
+11 -6
View File
@@ -1,8 +1,11 @@
enable wgpu_binding_array;
// Vertex shader bindings
struct VertexOutput {
@location(0) tex_coord: vec2<f32>,
@location(1) color: vec4<f32>, // linear
@location(2) layer_idx: u32,
@location(1) color: vec4<f32>,
@location(2) @interpolate(flat) texture_idx: u32,
@location(3) @interpolate(flat) layer_idx: u32,
@builtin(position) position: vec4<f32>,
};
@@ -36,18 +39,20 @@ fn vs_main(
@location(0) a_pos: vec2<f32>,
@location(1) a_tex_coord: vec2<f32>,
@location(2) a_color: u32, // non-linear
@location(3) a_layer_idx: u32,
@location(3) a_texture_idx: u32,
@location(4) a_layer_idx: u32,
) -> VertexOutput {
var out: VertexOutput;
out.tex_coord = a_tex_coord;
out.texture_idx = a_texture_idx;
out.layer_idx = a_layer_idx;
out.color = unpack_color(a_color);
out.position = position_from_screen(a_pos);
return out;
}
@group(1) @binding(0) var r_tex_color: texture_2d_array<f32>;
@group(1) @binding(1) var r_tex_sampler: sampler;
@group(1) @binding(0) var textures: binding_array<texture_2d_array<f32>>;
@group(1) @binding(1) var samplers: binding_array<sampler>;
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
@@ -56,7 +61,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
// Vertex colors, texture samples, and the output color are all in sRGB.
// Texture formats and output surface formats are selected such that no automatic
// conversion between linear <-> sRGB is performed.
let tex_color = textureSample(r_tex_color, r_tex_sampler, in.tex_coord, in.layer_idx);
let tex_color = textureSample(textures[in.texture_idx], samplers[in.texture_idx], in.tex_coord, in.layer_idx);
var out_color = in.color * tex_color;
return out_color;
}
-119
View File
@@ -1,119 +0,0 @@
use crate::{
color::Srgba,
dpi::{
LogicalPoint, LogicalQuad, LogicalRect, NormalizedPoint, NormalizedQuad, NormalizedRect,
},
math::Corners,
renderer::textures::TextureId,
};
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, bytemuck::Pod, bytemuck::Zeroable)]
pub struct Vertex {
pub pos: LogicalPoint<f32>,
pub uv: NormalizedPoint,
pub color: Srgba,
// TODO: layer_idx is the same for all vertices. use a uniform buffer
// and bind it along with the texture. move into Mesh or make part of
// TextureId (change into tuple)
pub layer_idx: u32,
}
#[derive(Clone, Debug, Default)]
pub struct Mesh {
pub vertices: Vec<Vertex>,
pub indices: Vec<u32>,
pub texture_id: TextureId,
}
impl Mesh {
#[inline]
pub fn add_rect(
&mut self,
rect: LogicalRect<f32>,
uv: NormalizedRect,
color: Srgba,
layer_idx: u32,
) {
let i = self.vertices.len() as u32;
self.indices
.extend_from_slice(&[i, i + 1, i + 3, i + 1, i + 2, i + 3]);
self.vertices.extend_from_slice(&[
Vertex {
pos: rect.top_left(),
uv: uv.top_left(),
color,
layer_idx,
},
Vertex {
pos: rect.top_right(),
uv: uv.top_right(),
color,
layer_idx,
},
Vertex {
pos: rect.bottom_right(),
uv: uv.bottom_right(),
color,
layer_idx,
},
Vertex {
pos: rect.bottom_left(),
uv: uv.bottom_left(),
color,
layer_idx,
},
]);
}
#[inline]
pub fn add_quad(
&mut self,
quad: LogicalQuad<f32>,
uv: NormalizedQuad,
color: Srgba,
layer_idx: u32,
) {
let i = self.vertices.len() as u32;
self.indices
.extend_from_slice(&[i, i + 1, i + 3, i + 1, i + 2, i + 3]);
self.vertices.extend_from_slice(&[
Vertex {
pos: quad.p0,
uv: uv.p0,
color,
layer_idx,
},
Vertex {
pos: quad.p1,
uv: uv.p1,
color,
layer_idx,
},
Vertex {
pos: quad.p2,
uv: uv.p2,
color,
layer_idx,
},
Vertex {
pos: quad.p3,
uv: uv.p3,
color,
layer_idx,
},
]);
}
pub fn is_empty(&self) -> bool {
self.vertices.is_empty() && self.indices.is_empty()
}
}
pub struct ClippedMesh {
// Only parts of the mesh that intersect with this will be rendered
pub clip_rect: LogicalRect<f32>,
pub mesh: Mesh,
}
+1 -1
View File
@@ -2,7 +2,7 @@
/// Assumes data to contain one mip level 0 image for each layer in RGBA format.
pub fn generate_mipmap_chain(queue: &wgpu::Queue, texture: &wgpu::Texture, data: &[u8]) {
assert!(!texture.format().is_compressed());
assert!(texture.format().components() == 4);
assert_eq!(texture.format().components(), 4);
let size = texture.size();
let block_size = texture.format().block_copy_size(None).unwrap_or(4);
-192
View File
@@ -1,192 +0,0 @@
use crate::{
color::Srgba,
dpi::{LogicalPoint, LogicalQuad, LogicalRect, LogicalVector, NormalizedQuad, NormalizedRect},
fonts::Layout,
math::Point,
renderer::textures::TextureId,
};
use ordered_float::OrderedFloat;
use std::{
hash::{Hash, Hasher},
sync::Arc,
};
#[derive(Clone)]
pub struct ClippedPrimitive {
pub clip_rect: LogicalRect<f32>,
pub primitive: DrawPrimitive,
}
impl Hash for ClippedPrimitive {
fn hash<H: Hasher>(&self, state: &mut H) {
hash_pos(&self.clip_rect.min, state);
hash_pos(&self.clip_rect.max, state);
self.primitive.hash(state);
}
}
#[derive(Clone, Hash)]
pub enum DrawPrimitive {
Rect(RectPrimitive),
Quad(QuadPrimitive),
Text(TextPrimitive),
}
impl DrawPrimitive {
pub fn texture_id(&self) -> TextureId {
match self {
DrawPrimitive::Rect(rect_primitive) => rect_primitive
.texture
.map_or_else(TextureId::default, |tex| tex.texture_id),
DrawPrimitive::Quad(quad_primitive) => quad_primitive
.texture
.map_or_else(TextureId::default, |tex| tex.texture_id),
_ => TextureId::default(),
}
}
}
#[derive(Clone, Copy)]
pub struct RectPrimitive {
pub rect: LogicalRect<f32>,
pub color: Srgba,
pub texture: Option<RectTexture>,
}
impl RectPrimitive {
pub fn new(rect: LogicalRect<f32>, color: Srgba, texture: Option<RectTexture>) -> Self {
Self {
rect,
color,
texture,
}
}
pub fn translate(&mut self, direction: LogicalVector<f32>) {
self.rect = self.rect.translate(direction);
}
}
impl Hash for RectPrimitive {
fn hash<H: Hasher>(&self, state: &mut H) {
hash_pos(&self.rect.min, state);
hash_pos(&self.rect.max, state);
self.color.hash(state);
self.texture.hash(state);
}
}
#[derive(Clone, Copy)]
pub struct RectTexture {
pub texture_id: TextureId,
pub uv: NormalizedRect,
pub layer_idx: u32,
}
impl RectTexture {
pub fn new(texture_id: TextureId, uv: NormalizedRect, layer_idx: u32) -> Self {
Self {
texture_id,
uv,
layer_idx,
}
}
}
impl Hash for RectTexture {
fn hash<H: Hasher>(&self, state: &mut H) {
self.texture_id.hash(state);
hash_pos(&self.uv.min, state);
hash_pos(&self.uv.max, state);
self.layer_idx.hash(state);
}
}
#[derive(Clone, Copy)]
pub struct QuadPrimitive {
pub quad: LogicalQuad<f32>,
pub color: Srgba,
pub texture: Option<QuadTexture>,
}
impl QuadPrimitive {
pub fn new(quad: LogicalQuad<f32>, color: Srgba, texture: Option<QuadTexture>) -> Self {
Self {
quad,
color,
texture,
}
}
pub fn translate(&mut self, direction: LogicalVector<f32>) {
self.quad = self.quad.translate(direction);
}
}
impl Hash for QuadPrimitive {
fn hash<H: Hasher>(&self, state: &mut H) {
hash_pos(&self.quad.p0, state);
hash_pos(&self.quad.p1, state);
hash_pos(&self.quad.p2, state);
hash_pos(&self.quad.p3, state);
self.color.hash(state);
self.texture.hash(state);
}
}
#[derive(Clone, Copy)]
pub struct QuadTexture {
pub texture_id: TextureId,
pub uv: NormalizedQuad,
pub layer_idx: u32,
}
impl QuadTexture {
pub fn new(texture_id: TextureId, uv: NormalizedQuad, layer_idx: u32) -> Self {
Self {
texture_id,
uv,
layer_idx,
}
}
}
impl Hash for QuadTexture {
fn hash<H: Hasher>(&self, state: &mut H) {
self.texture_id.hash(state);
hash_pos(&self.uv.p0, state);
hash_pos(&self.uv.p1, state);
hash_pos(&self.uv.p2, state);
hash_pos(&self.uv.p3, state);
self.layer_idx.hash(state);
}
}
#[derive(Clone)]
pub struct TextPrimitive {
pub pos: LogicalPoint<f32>,
pub layout: Arc<Layout>,
}
impl TextPrimitive {
pub fn new(pos: LogicalPoint<f32>, layout: Arc<Layout>) -> Self {
Self { pos, layout }
}
#[inline(always)]
pub fn translate(&mut self, direction: LogicalVector<f32>) {
self.pos += direction;
}
}
impl Hash for TextPrimitive {
fn hash<H: Hasher>(&self, state: &mut H) {
hash_pos(&self.pos, state);
self.layout.hash(state);
}
}
fn hash_pos<H: Hasher, U>(pos: &Point<f32, U>, state: &mut H) {
OrderedFloat(pos.x).hash(state);
OrderedFloat(pos.x).hash(state);
}
-161
View File
@@ -1,161 +0,0 @@
use crate::{
dpi::{Normalize, NormalizedQuad, NormalizedRect, Uv},
fonts::FontAtlasSize,
renderer::{
mesh::{ClippedMesh, Mesh},
primitives::{
ClippedPrimitive, DrawPrimitive, QuadPrimitive, QuadTexture, RectPrimitive,
RectTexture, TextPrimitive,
},
textures::TextureId,
},
};
/// Converts [`DrawPrimitive`]s into [`Mesh`]es.
#[derive(Default)]
pub struct Tessellator {
last_clipped_meshes_size: usize,
}
impl Tessellator {
pub fn convert_clipped_primitives(
&mut self,
clipped_primitives: impl Iterator<Item = ClippedPrimitive>,
font_atlas_size: FontAtlasSize,
) -> Vec<ClippedMesh> {
profiling::scope!("convert_primitives");
let mut clipped_meshes = Vec::with_capacity(self.last_clipped_meshes_size);
for clipped_primitive in clipped_primitives {
self.convert_clipped_primitive(clipped_primitive, font_atlas_size, &mut clipped_meshes);
}
self.last_clipped_meshes_size = clipped_meshes.len();
clipped_meshes
}
pub fn convert_clipped_primitive(
&mut self,
clipped_primitive: ClippedPrimitive,
font_atlas_size: FontAtlasSize,
out_clipped_meshes: &mut Vec<ClippedMesh>,
) {
let ClippedPrimitive {
clip_rect,
primitive,
} = clipped_primitive;
if clip_rect.is_empty() {
return;
}
let start_new_mesh = match out_clipped_meshes.last() {
None => true,
Some(last_clipped_mesh) => {
// append to previous mesh if clip_rect and texture_id match.
// otherwise, start a new mesh.
!(last_clipped_mesh.clip_rect == clip_rect
&& last_clipped_mesh.mesh.texture_id == primitive.texture_id())
}
};
if start_new_mesh {
out_clipped_meshes.push(ClippedMesh {
clip_rect,
mesh: Mesh::default(),
});
}
let last_clipped_mesh = out_clipped_meshes.last_mut().unwrap();
match primitive {
DrawPrimitive::Rect(rect_primitive) => {
self.convert_rect_primitive(rect_primitive, &mut last_clipped_mesh.mesh)
}
DrawPrimitive::Quad(quad_primitive) => {
self.convert_quad_primitive(quad_primitive, &mut last_clipped_mesh.mesh)
}
DrawPrimitive::Text(text_primitive) => self.convert_text_primitive(
text_primitive,
font_atlas_size,
&mut last_clipped_mesh.mesh,
),
}
// This can be empty if a new mesh was started but the conversion from a text primitive
// didn't add any vertices. Our renderer doesn't support empty meshes so remove it
if last_clipped_mesh.mesh.is_empty() {
out_clipped_meshes.pop();
}
}
fn convert_rect_primitive(&self, rect_primitive: RectPrimitive, out: &mut Mesh) {
let RectPrimitive {
rect,
color,
texture,
} = rect_primitive;
let (texture_id, uv, layer_idx) = match texture {
Some(RectTexture {
texture_id,
uv,
layer_idx,
}) => (texture_id, uv, layer_idx),
None => (TextureId::default(), NormalizedRect::white_uv(), 0),
};
out.add_rect(rect, uv, color, layer_idx);
out.texture_id = texture_id;
}
fn convert_quad_primitive(&self, quad_primitive: QuadPrimitive, out: &mut Mesh) {
let QuadPrimitive {
quad,
color,
texture,
} = quad_primitive;
let (texture_id, uv, layer_idx) = match texture {
Some(QuadTexture {
texture_id,
uv,
layer_idx,
}) => (texture_id, uv, layer_idx),
None => (TextureId::default(), NormalizedQuad::white_uv(), 0),
};
out.add_quad(quad, uv, color, layer_idx);
out.texture_id = texture_id;
}
fn convert_text_primitive(
&self,
text_primitive: TextPrimitive,
font_atlas_size: FontAtlasSize,
out: &mut Mesh,
) {
let TextPrimitive {
pos: layout_pos,
layout,
} = text_primitive;
if layout.rows.is_empty() {
return;
}
out.vertices.reserve(layout.num_of_vertices);
out.indices.reserve(layout.num_of_indices);
// TODO: align to pixel grid?
for row in &layout.rows {
for glyph in &row.glyphs {
let rect = glyph.rect.translate(layout_pos.to_vector());
let normalized_uv = glyph.uv.normalize(font_atlas_size);
out.add_rect(rect, normalized_uv, glyph.color, 0);
}
}
}
}
+215 -103
View File
@@ -1,27 +1,24 @@
use std::{
collections::hash_map::Entry,
path::Path,
sync::{Arc, RwLock},
};
use std::{cell::RefCell, collections::hash_map::Entry, path::Path, rc::Rc, sync::mpsc};
use ahash::HashMap;
use anyhow::bail;
use crate::{
color::Srgba,
renderer::image::{ImageData, ImageDelta, load_image_file},
dpi::PhysicalSize,
renderer::image::{ImageData, ImageDelta, MipStrategy, load_image_file},
worker_pool::WorkerPool,
};
pub type TextureId = u64;
pub struct TextureHandle {
tex_mngr: Arc<RwLock<TextureManager>>,
tex_mngr: Rc<RefCell<TextureRegistry>>,
id: TextureId,
}
impl TextureHandle {
pub fn new(tex_mngr: Arc<RwLock<TextureManager>>, id: TextureId) -> Self {
fn new(tex_mngr: Rc<RefCell<TextureRegistry>>, id: TextureId) -> Self {
Self { tex_mngr, id }
}
@@ -29,26 +26,44 @@ impl TextureHandle {
self.id
}
pub fn size(&self) -> [usize; 2] {
self.tex_mngr
.read()
.unwrap()
pub fn size(&self) -> Option<PhysicalSize<u32>> {
match self
.tex_mngr
.borrow()
.get_meta_data(self.id)
.map_or([0, 0], |tex| tex.size)
.expect("Texture exists because we hold a handle")
.state
{
TextureState::AsyncLoading => None,
TextureState::Loaded(shape) => Some(shape.size),
}
}
pub fn is_loading(&self) -> bool {
match self
.tex_mngr
.borrow()
.get_meta_data(self.id)
.expect("Texture exists because we hold a handle")
.state
{
TextureState::AsyncLoading => true,
TextureState::Loaded(_) => false,
}
}
}
impl Drop for TextureHandle {
fn drop(&mut self) {
self.tex_mngr.write().unwrap().free(self.id);
self.tex_mngr.borrow_mut().free(self.id);
}
}
impl Clone for TextureHandle {
fn clone(&self) -> Self {
self.tex_mngr.write().unwrap().retain(self.id);
self.tex_mngr.borrow_mut().retain(self.id);
Self {
tex_mngr: Arc::clone(&self.tex_mngr),
tex_mngr: Rc::clone(&self.tex_mngr),
id: self.id,
}
}
@@ -66,75 +81,144 @@ impl TexturesDelta {
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
struct TextureShape {
size: PhysicalSize<u32>,
format: wgpu::TextureFormat,
array_layers: u32,
mip_level_count: u32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum TextureState {
/// Texture is being loaded asynchronously
AsyncLoading,
Loaded(TextureShape),
}
/// Metadata about an allocated texture.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TextureMetaData {
pub name: String,
pub size: [usize; 2],
name: String,
options: TextureOptions,
state: TextureState,
/// Texture is freed when this reaches zero
retain_count: usize,
pub options: TextureOptions,
}
#[derive(Default)]
pub struct TextureManager {
struct TextureRegistry {
next_id: u64,
meta_data: HashMap<TextureId, TextureMetaData>,
delta: TexturesDelta,
}
impl TextureManager {
impl TextureRegistry {
/// Allocates a new Texture.
pub fn alloc(&mut self, name: String, image: ImageData, options: TextureOptions) -> TextureId {
pub fn alloc(
&mut self,
name: String,
image: ImageData,
options: TextureOptions,
generate_mipmaps: bool,
) -> TextureId {
let id = self.next_id;
self.next_id += 1;
self.meta_data.entry(id).or_insert_with(|| TextureMetaData {
name,
size: [image.width as usize, image.height as usize],
retain_count: 1,
options,
});
let mip_strategy = MipStrategy::resolve(&image, generate_mipmaps);
self.meta_data.insert(
id,
TextureMetaData {
name,
retain_count: 1,
options,
state: TextureState::Loaded(TextureShape {
size: PhysicalSize::new(image.width, image.height),
format: image.format,
array_layers: image.array_layers,
mip_level_count: mip_strategy.resolve_mip_level_count(&image),
}),
},
);
self.delta
.update
.push((id, ImageDelta::new(image, options)));
.push((id, ImageDelta::full(image, options, mip_strategy)));
id
}
/// Reserves a new TextureId for later assignment.
/// Reserves a new `TextureId` for later assignment.
pub fn reserve(&mut self, name: String, options: TextureOptions) -> TextureId {
let id = self.next_id;
self.next_id += 1;
self.meta_data.entry(id).or_insert_with(|| TextureMetaData {
name,
size: [0, 0],
retain_count: 1,
options,
});
self.meta_data.insert(
id,
TextureMetaData {
name,
retain_count: 1,
options,
state: TextureState::AsyncLoading,
},
);
id
}
/// Assigns a new image to an existing texture.
pub fn set(&mut self, id: TextureId, delta: ImageDelta) {
if let Some(meta_data) = self.meta_data.get_mut(&id) {
meta_data.size = [delta.image.width as usize, delta.image.height as usize];
// discard all old enqueued deltas
self.delta.update.retain(|(x, _)| x != &id);
self.delta.update.push((id, delta));
} else {
debug_assert!(false, "Tried setting texture {id:?} which is not allocated");
let Some(meta_data) = self.meta_data.get_mut(&id) else {
// the handle may have been dropped while the async load was in flight.
// just discard the result.
log::debug!("Discarding load result for freed texture {id:?}");
return;
};
match &delta {
ImageDelta::Full {
image,
mip_strategy,
..
} => {
meta_data.state = TextureState::Loaded(TextureShape {
size: PhysicalSize::new(image.width, image.height),
format: image.format,
array_layers: image.array_layers,
mip_level_count: mip_strategy.resolve_mip_level_count(image),
});
// discard all old enqueued deltas since we're doing a full update
self.delta.update.retain(|(x, _)| x != &id);
}
ImageDelta::Partial { image, .. } => {
let TextureState::Loaded(shape) = &meta_data.state else {
panic!("partial update for texture {id:?} which hasn't finished loading!");
};
assert_eq!(
shape.format, image.format,
"format of partial update must match format of existing texture {id:?}"
);
assert_eq!(
shape.mip_level_count, 1,
"partial updates are not supported for textures with mipmaps (texture {id:?})"
);
}
}
self.delta.update.push((id, delta));
}
/// Frees an existing texture.
pub fn free(&mut self, id: TextureId) {
if let Entry::Occupied(mut entry) = self.meta_data.entry(id) {
let meta = entry.get_mut();
meta.retain_count -= 1;
debug_assert!(
meta.retain_count > 0,
"Tried freeing texture {id:?} with retain_count == 0"
);
meta.retain_count = meta.retain_count.saturating_sub(1);
if meta.retain_count == 0 {
entry.remove();
self.delta.free.push(id);
@@ -169,39 +253,56 @@ impl TextureManager {
}
}
pub struct WrappedTextureManager {
manager: Arc<RwLock<TextureManager>>,
worker_pool: WorkerPool,
enum LoadResult {
Loaded {
id: TextureId,
image: ImageData,
options: TextureOptions,
generate_mipmaps: bool,
},
}
impl WrappedTextureManager {
pub struct TextureManager {
manager: Rc<RefCell<TextureRegistry>>,
worker_pool: WorkerPool,
// channel for handling async image loads
results_tx: mpsc::Sender<LoadResult>,
results_rx: mpsc::Receiver<LoadResult>,
}
impl TextureManager {
pub fn new() -> Self {
let manager = Arc::new(RwLock::new(TextureManager::default()));
let mut manager = TextureRegistry::default();
// allocate default texture (id: 0) for font atlas
manager.write().unwrap().alloc(
manager.alloc(
"font_atlas_texture".into(),
ImageData::from_solid_color([0, 0], Srgba::TRANSPARENT),
ImageData::from_solid_color([1, 1], Srgba::WHITE),
TextureOptions::default(),
false,
);
let (tx, rx) = mpsc::channel();
Self {
manager,
manager: Rc::new(RefCell::new(manager)),
worker_pool: WorkerPool::new(4),
results_tx: tx,
results_rx: rx,
}
}
#[inline]
pub fn update_font_texture(&self, delta: ImageDelta) {
self.manager
.write()
.unwrap()
.set(TextureId::default(), delta);
pub fn update_font_texture(&self, delta: Vec<ImageDelta>) {
for d in delta {
self.manager.borrow_mut().set(TextureId::default(), d);
}
}
#[inline]
pub fn take_delta(&self) -> TexturesDelta {
self.manager.write().unwrap().take_delta()
self.apply_pending_loads();
self.manager.borrow_mut().take_delta()
}
pub fn load_texture(
@@ -209,43 +310,48 @@ impl WrappedTextureManager {
image_path: String,
options: TextureOptions,
is_async: bool,
generate_mipmaps: bool,
) -> anyhow::Result<TextureHandle> {
let manager = Arc::clone(&self.manager);
profiling::scope!("load_texture");
let handle = if is_async {
let id = manager
.write()
.unwrap()
if is_async {
let id = self
.manager
.borrow_mut()
.reserve(image_path.clone(), options);
// load image in background worker
let mngr_clone = Arc::clone(&manager);
let tx = self.results_tx.clone();
self.worker_pool
.execute(move || match load_image_file(Path::new(&image_path)) {
Ok(image) => {
mngr_clone
.write()
.unwrap()
.set(id, ImageDelta::new(image, options));
let _ = tx.send(LoadResult::Loaded {
id,
image,
options,
generate_mipmaps,
});
}
Err(e) => log::warn!("Unable to load image fron {}: {}", &image_path, e),
Err(e) => log::warn!("Unable to load image from {image_path}: {e}"),
});
TextureHandle::new(manager, id)
Ok(TextureHandle::new(Rc::clone(&self.manager), id))
} else {
match load_image_file(Path::new(&image_path)) {
Ok(image) => {
let id = manager.write().unwrap().alloc(image_path, image, options);
TextureHandle::new(manager, id)
let id = self.manager.borrow_mut().alloc(
image_path,
image,
options,
generate_mipmaps,
);
Ok(TextureHandle::new(Rc::clone(&self.manager), id))
}
Err(e) => {
log::warn!("Unable to load image fron {}: {}", &image_path, e);
log::warn!("Unable to load image from {image_path}: {e}");
bail!(e);
}
}
};
Ok(handle)
}
}
pub fn update_texture(
@@ -254,29 +360,32 @@ impl WrappedTextureManager {
image_path: String,
options: TextureOptions,
is_async: bool,
generate_mipmaps: bool,
) -> anyhow::Result<()> {
if is_async {
let mngr_clone = Arc::clone(&self.manager);
let tx = self.results_tx.clone();
self.worker_pool
.execute(move || match load_image_file(Path::new(&image_path)) {
Ok(image) => {
mngr_clone
.write()
.unwrap()
.set(texture_id, ImageDelta::new(image, options));
let _ = tx.send(LoadResult::Loaded {
id: texture_id,
image,
options,
generate_mipmaps,
});
}
Err(e) => log::warn!("Unable to load image fron {}: {}", &image_path, e),
Err(e) => log::warn!("Unable to load image from {image_path}: {e}"),
});
} else {
match load_image_file(Path::new(&image_path)) {
Ok(image) => {
let mip_strategy = MipStrategy::resolve(&image, generate_mipmaps);
self.manager
.write()
.unwrap()
.set(texture_id, ImageDelta::new(image, options));
.borrow_mut()
.set(texture_id, ImageDelta::full(image, options, mip_strategy));
}
Err(e) => {
log::warn!("Unable to load image fron {}: {}", &image_path, e);
log::warn!("Unable to load image from {image_path}: {e}");
bail!(e);
}
}
@@ -284,15 +393,29 @@ impl WrappedTextureManager {
Ok(())
}
/// Drains completed async image loads and assigns them to textures
fn apply_pending_loads(&self) {
let mut manager = self.manager.borrow_mut();
while let Ok(LoadResult::Loaded {
id,
image,
options,
generate_mipmaps,
}) = self.results_rx.try_recv()
{
let mip_strategy = MipStrategy::resolve(&image, generate_mipmaps);
manager.set(id, ImageDelta::full(image, options, mip_strategy));
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct TextureOptions {
pub magnification: wgpu::FilterMode,
pub minification: wgpu::FilterMode,
pub wrap_mode: wgpu::AddressMode,
pub mipmap_mode: wgpu::FilterMode,
pub generate_mipmaps: bool,
pub mipmap_mode: wgpu::MipmapFilterMode,
}
impl TextureOptions {
@@ -300,16 +423,14 @@ impl TextureOptions {
magnification: wgpu::FilterMode::Linear,
minification: wgpu::FilterMode::Linear,
wrap_mode: wgpu::AddressMode::Repeat,
mipmap_mode: wgpu::FilterMode::Linear,
generate_mipmaps: false,
mipmap_mode: wgpu::MipmapFilterMode::Linear,
};
pub const LINEAR: Self = Self {
magnification: wgpu::FilterMode::Linear,
minification: wgpu::FilterMode::Linear,
wrap_mode: wgpu::AddressMode::ClampToEdge,
mipmap_mode: wgpu::FilterMode::Linear,
generate_mipmaps: false,
mipmap_mode: wgpu::MipmapFilterMode::Linear,
};
}
@@ -318,12 +439,3 @@ impl Default for TextureOptions {
Self::LINEAR
}
}
impl std::hash::Hash for TextureOptions {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.magnification.hash(state);
self.minification.hash(state);
self.wrap_mode.hash(state);
self.mipmap_mode.hash(state);
}
}
+88
View File
@@ -0,0 +1,88 @@
use std::sync::Arc;
use winit::window::Window;
use crate::{
dpi::{PhysicalPoint, PhysicalSize, ScaleFactor},
draw_commands::DrawCommand,
input::{Key, ModifiersState, MouseButton},
installer::Installer,
pob::PathOfBuilding,
};
pub enum StageEvent {
KeyDown { key: Key },
KeyUp { key: Key },
CharacterInput { ch: char },
ModifiersChanged { state: ModifiersState },
MouseDown { button: MouseButton },
MouseUp { button: MouseButton },
MouseWheel { delta: f32 },
MouseMoved { pos: PhysicalPoint<f32> },
Exit,
Resized(PhysicalSize<u32>),
ScaleFactorChanged(f64),
FocusChanged(bool),
HoverChanged(bool),
}
pub enum StageTransition {
ToMain,
ToShutdown,
}
pub struct StageFrameOutput {
pub draw_commands: Vec<DrawCommand>,
pub can_elide: bool,
pub request_redraw: bool,
pub scale_factor: ScaleFactor<f32>,
}
pub enum ActiveStage {
Startup(Installer),
Main(PathOfBuilding),
}
impl ActiveStage {
pub fn update(&mut self) -> anyhow::Result<Option<StageTransition>> {
match self {
Self::Startup(s) => s.update(),
Self::Main(s) => s.update(),
}
}
pub fn frame(&mut self) -> anyhow::Result<StageFrameOutput> {
match self {
Self::Startup(s) => s.frame(),
Self::Main(s) => s.frame(),
}
}
pub fn handle_event(&mut self, event: StageEvent) -> anyhow::Result<Option<StageTransition>> {
match self {
Self::Startup(s) => s.handle_event(event),
Self::Main(s) => s.handle_event(event),
}
}
pub fn set_window(&mut self, window: Arc<Window>) {
match self {
Self::Startup(s) => s.set_window(window),
Self::Main(s) => s.set_window(window),
}
}
pub fn can_exit(&mut self) -> bool {
match self {
Self::Startup(_) => true,
Self::Main(s) => s.can_exit(),
}
}
pub fn clear_pressed(&mut self) {
match self {
Self::Startup(_) => {}
Self::Main(s) => s.clear_pressed(),
}
}
}
-358
View File
@@ -1,358 +0,0 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, Sender, TryRecvError};
use std::{collections::VecDeque, sync::mpsc::channel, thread::JoinHandle};
use anyhow::{Result, anyhow};
use mlua::{Function, IntoLuaMulti, Lua, Value};
use mlua::{Integer, MultiValue, Number, Result as LuaResult};
use crate::api::get_callback;
use crate::lua::LuaInstance;
#[derive(Debug)]
pub enum SubscriptResult {
SubscriptFinished {
id: u64,
return_values: NativeMultiValue,
},
SubscriptError {
id: u64,
error: String,
},
}
pub struct SubscriptManager {
current_id: u64,
scripts: Vec<Subscript>,
}
impl SubscriptManager {
pub fn new() -> Self {
Self {
current_id: 0,
scripts: Vec::new(),
}
}
pub fn push(
&mut self,
script_text: String,
blocking_calls: Vec<String>,
nonblocking_calls: Vec<String>,
arguments: NativeMultiValue,
) -> u64 {
let id = self.current_id;
self.current_id += 1;
let subscript = Subscript::new(
id,
script_text,
blocking_calls,
nonblocking_calls,
arguments,
);
self.scripts.push(subscript);
id
}
pub fn process(&mut self, lua: &LuaInstance) -> Vec<SubscriptResult> {
let mut results = vec![];
self.scripts.retain_mut(|subscript| {
subscript.handle_calls(lua);
if let Some(event) = subscript.try_join() {
results.push(event);
// subscript has finished or errored, remove it
false
} else {
// subscript has not finished yet, keep it
true
}
});
results
}
}
enum SubscriptCall {
Blocking {
function_name: String,
arguments: NativeMultiValue,
// used to send return values of function back to thread
return_values_sender: Sender<Result<NativeMultiValue>>,
},
NonBlocking {
function_name: String,
arguments: NativeMultiValue,
},
}
pub struct Subscript {
id: u64,
handle: Option<JoinHandle<anyhow::Result<NativeMultiValue>>>,
receiver: Receiver<SubscriptCall>,
}
// Subscripts are lua scripts that are executed in their own instance on a separate thread.
//
// When a subscript needs to call a function defined in the main instance, a `SubscriptCall` message is send over a channel. At the beginning of each frame, the main thread checks for messages and executes the requested function with the provided arguments on behalf of the subscript.
// For `BlockingCall`, the main thread sends the return values of the function back to the subscript which is waiting on them.
// For `NonBlockingCall`, the subscript doesn't wait on any return values and keeps executing the script after sending the message.
// Subscripts are required to explicitly specify the names of all (non)-blocking function calls that appear in the script.
impl Subscript {
pub fn new(
id: u64,
script_text: String,
blocking_calls: Vec<String>,
nonblocking_calls: Vec<String>,
arguments: NativeMultiValue,
) -> Self {
let (tx, rx) = channel();
let handle = std::thread::spawn(move || {
profiling::register_thread!(format!("Subscript {} Thread", id));
// unsafe required to load C modules (curl)
let lua = unsafe { Lua::unsafe_new() };
// add ./lua to package.path and package.cpath
LuaInstance::register_package_paths(&lua)?;
for function_name in blocking_calls {
let thread_tx = tx.clone();
lua.globals().set(
function_name.clone(),
lua.create_function(move |_, args: MultiValue| {
let (tx_return, rx_return) = channel();
thread_tx
.send(SubscriptCall::Blocking {
function_name: function_name.clone(),
arguments: args.try_into()?,
return_values_sender: tx_return,
})
.unwrap();
// this blocks until we receive return values
let return_values = rx_return.recv().map_err(|e| anyhow!("{}", e))??;
Ok(return_values)
})?,
)?;
}
for function_name in nonblocking_calls {
let thread_tx = tx.clone();
lua.globals().set(
function_name.clone(),
lua.create_function(move |_, args: MultiValue| {
thread_tx
.send(SubscriptCall::NonBlocking {
function_name: function_name.clone(),
arguments: args.try_into()?,
})
.map_err(|e| anyhow!("{}", e))?;
Ok(())
})?,
)?;
}
let result = lua.load(script_text).call::<MultiValue>(arguments)?;
result.try_into()
});
Self {
id,
handle: Some(handle),
receiver: rx,
}
}
fn handle_calls(&mut self, lua: &Lua) {
match self.receiver.try_recv() {
Ok(SubscriptCall::Blocking {
function_name,
arguments,
return_values_sender,
}) => {
let func: Result<Function, _> = get_callback(lua, "OnSubCall");
match func {
Ok(func) => {
match func.call::<MultiValue>((function_name, arguments)) {
Ok(return_values) => {
// send return values back to thread
let _ = return_values_sender.send(return_values.try_into());
}
// function returned error, forward it to thread
Err(err) => {
let _ = return_values_sender.send(Err(err.into()));
}
}
}
// function not found
Err(err) => {
let _ = return_values_sender.send(Err(err.into()));
}
}
}
Ok(SubscriptCall::NonBlocking {
function_name,
arguments,
}) => {
let func: Result<Function, _> = get_callback(lua, "OnSubCall");
if let Ok(func) = func {
// we can ignore return values for non-blocking calls
let _ = func.call::<()>((function_name, arguments));
}
}
// ignore disconnects. potential errors are handled during thread join
Err(TryRecvError::Disconnected) => {}
// no outstanding calls from thread
Err(TryRecvError::Empty) => {}
}
}
fn try_join(&mut self) -> Option<SubscriptResult> {
if self
.handle
.as_ref()
.map(|h| h.is_finished())
.unwrap_or(false)
{
let event = match self.handle.take().unwrap().join() {
Ok(Ok(return_values)) => SubscriptResult::SubscriptFinished {
id: self.id,
return_values,
},
Ok(Err(err)) => SubscriptResult::SubscriptError {
id: self.id,
error: err.to_string(),
},
// the thread panicked
Err(_) => SubscriptResult::SubscriptError {
id: self.id,
error: String::from("Subscript thread panicked!"),
},
};
Some(event)
} else {
None
}
}
}
pub fn register_subscript_globals(
lua: &Lua,
subscripts: &Rc<RefCell<SubscriptManager>>,
) -> LuaResult<()> {
let globals = lua.globals();
// ssID = LaunchSubScript("<scriptText>", "<funcList>", "<subList>"[, ...])
let subscripts_clone = Rc::clone(subscripts);
let launch_sub_script = move |_: &Lua,
(script_text, func_list, sub_list, args): (
String,
String,
String,
MultiValue,
)| {
let blocking_calls = func_list
.split(',')
.map(|s| s.trim())
.filter(|&s| !s.is_empty())
.map(String::from)
.collect();
let nonblocking_calls = sub_list
.split(',')
.map(|s| s.trim())
.filter(|&s| !s.is_empty())
.map(String::from)
.collect();
let arguments = args.try_into()?;
let subscript_id = subscripts_clone.borrow_mut().push(
script_text,
blocking_calls,
nonblocking_calls,
arguments,
);
Ok(subscript_id)
};
let subscripts_clone = Rc::clone(subscripts);
let is_subscript_running = move |_: &Lua, subscript_id: u64| {
Ok(subscripts_clone
.borrow()
.scripts
.iter()
.any(|ss| ss.id == subscript_id))
};
let abort_subscript = |_: &Lua, _subscript_id: u64| -> LuaResult<()> { unimplemented!() };
globals.set(
"LaunchSubScript",
lua.create_function_mut(launch_sub_script)?,
)?;
globals.set(
"IsSubScriptRunning",
lua.create_function(is_subscript_running)?,
)?;
globals.set("IsSubScriptRunning", lua.create_function(abort_subscript)?)?;
Ok(())
}
// used to move arguments and return values between lua instances
// some lua values are associated with their instance and using them with another
// instance is not allowed.
#[derive(Debug)]
pub struct NativeMultiValue(VecDeque<NativeValue>);
#[derive(Debug)]
pub enum NativeValue {
Nil,
Number(Number),
Integer(Integer),
Boolean(bool),
// Lua strings may not be valid UTF-8, so store Vec<u8> instead
String(Vec<u8>),
}
impl TryFrom<MultiValue> for NativeMultiValue {
type Error = anyhow::Error;
fn try_from(values: MultiValue) -> Result<Self, Self::Error> {
let native = values
.iter()
.map(|v| match v.type_name() {
"nil" => Ok(NativeValue::Nil),
"boolean" => Ok(NativeValue::Boolean(v.as_boolean().unwrap())),
"number" => Ok(NativeValue::Number(v.as_number().unwrap())),
"integer" => Ok(NativeValue::Integer(v.as_integer().unwrap())),
"string" => Ok(NativeValue::String(
v.as_string().unwrap().as_bytes().to_vec(),
)),
_ => Err(anyhow!("Unsupported value type")),
})
.collect::<Result<VecDeque<_>, _>>()?;
Ok(NativeMultiValue(native))
}
}
impl IntoLuaMulti for NativeMultiValue {
fn into_lua_multi(self, lua: &Lua) -> mlua::Result<MultiValue> {
let values = self
.0
.iter()
.map(|v| match v {
NativeValue::Nil => Ok(Value::Nil),
NativeValue::Boolean(b) => Ok(Value::Boolean(*b)),
NativeValue::Number(n) => Ok(Value::Number(*n)),
NativeValue::Integer(n) => Ok(Value::Integer(*n)),
NativeValue::String(s) => lua.create_string(s).map(Value::String),
})
.collect::<Result<Vec<_>, _>>()?;
Ok(MultiValue::from_vec(values))
}
}
+87 -5
View File
@@ -1,11 +1,11 @@
use ahash::AHasher;
use mlua::{Lua, Result as LuaResult, Table, chunk::Chunk};
use std::{
env,
env, fs,
hash::{Hash, Hasher},
path::{Path, PathBuf},
};
use ahash::AHasher;
pub fn get_executable_dir() -> anyhow::Result<PathBuf> {
let exe_path = env::current_exe()?;
let exe_parent_dir = exe_path.parent().unwrap().canonicalize()?;
@@ -15,8 +15,8 @@ pub fn get_executable_dir() -> anyhow::Result<PathBuf> {
pub fn change_working_directory<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
env::set_current_dir(path.as_ref()).map_err(|e| {
anyhow::anyhow!(
"Failed to change working directory {:?}: {}",
path.as_ref(),
"Failed to change working directory {}: {}",
path.as_ref().display(),
e
)
})
@@ -27,3 +27,85 @@ pub fn calculate_hash<T: Hash>(t: &T) -> u64 {
t.hash(&mut state);
state.finish()
}
/// Performs replacement only in lines that match a given pattern
pub fn replace_in_matching_lines(
input: &str,
match_pattern: &str,
replace_pattern: &str,
replacement_text: &str,
) -> String {
let match_re = regex::Regex::new(match_pattern).expect("Invalid match regex");
let replace_re = regex::Regex::new(replace_pattern).expect("Invalid replace regex");
let mut output = String::new();
for line in input.lines() {
if match_re.is_match(line) {
// if line matches the pattern, replace
let replaced_line = replace_re.replace_all(line, replacement_text);
output.push_str(&replaced_line);
} else {
// otherwise, keep original line
output.push_str(line);
}
output.push('\n');
}
output
}
/// Appends a search pattern to Lua's `package.path`.
pub fn append_lua_package_path(lua: &Lua, pattern: &str) -> LuaResult<()> {
let package: Table = lua.globals().get("package")?;
let mut package_path: String = package.get("path")?;
if !package_path.is_empty() {
package_path.push(';');
}
package_path.push_str(pattern);
package.set("path", package_path)?;
Ok(())
}
/// Adds a directory to Lua's `package.path`.
///
/// This adds the following patterns:
/// - `<path>/?.lua`
/// - `<path>/?/init.lua`
pub fn append_lua_package_dir(lua: &Lua, path: &Path) -> LuaResult<()> {
let path = path.to_string_lossy();
append_lua_package_path(lua, &format!("{path}/?.lua"))?;
append_lua_package_path(lua, &format!("{path}/?/init.lua"))?;
Ok(())
}
/// Rewrites PoB's `#@ <label>` script header into a Lua comment.
///
/// Some Path of Building scripts start with a line such as `#@ <optional_text>`. Recent LuaJIT
/// versions interpret a leading `#` as a line number directive and reject this header so we
/// replace them with a comment.
///
/// commit that introduced changes to the lexer to enable parsing of line number directives:
/// <https://github.com/LuaJIT/LuaJIT/commit/c41d727dbffa5ec4f346dd9be0f4c64740f124aa>
pub fn fix_script_header(source: &mut [u8]) {
// skip utf8-bom
let start = if source.starts_with(b"\xEF\xBB\xBF") {
3
} else {
0
};
if source[start..].starts_with(b"#@") {
source[start..start + 2].copy_from_slice(b"--");
}
}
/// Loads a Lua script from `path` and applies `fix_script_header`.
///
/// The chunk name is set to `@<path>` to match `Lua::load`'s behavior for paths, so error messages
/// keep referring to the file.
pub fn load_lua_file<'lua>(lua: &'lua Lua, path: &Path) -> LuaResult<Chunk<'lua>> {
let mut source = fs::read(path)?;
fix_script_header(&mut source);
Ok(lua.load(source).set_name(format!("@{}", path.display())))
}
+36
View File
@@ -0,0 +1,36 @@
use crate::math::{Point, Quad, Rect, Size};
pub struct UvSpace;
pub type UvPoint = Point<f32, UvSpace>;
pub type UvRect = Rect<f32, UvSpace>;
pub type UvQuad = Quad<f32, UvSpace>;
pub trait UvConstructors {
fn full_uv() -> Self;
fn white_uv() -> Self;
}
impl UvConstructors for UvRect {
#[inline]
fn full_uv() -> Self {
Self::from_size(Size::new(1.0, 1.0))
}
#[inline]
fn white_uv() -> Self {
Self::zero()
}
}
impl UvConstructors for UvQuad {
#[inline]
fn full_uv() -> Self {
Self::from_size(Size::new(1.0, 1.0))
}
#[inline]
fn white_uv() -> Self {
Self::zero()
}
}
+94
View File
@@ -0,0 +1,94 @@
use crate::{
clipboard::Clipboard,
dpi::{LogicalSize, PhysicalSize, ScaleFactor},
};
use raw_window_handle::HasDisplayHandle;
use std::sync::Arc;
use winit::window::Window;
pub struct WindowState {
// NOTE: clipboard needs to be destroyed before window
clipboard: Option<Clipboard>,
pub window: Option<Arc<Window>>,
pub size: PhysicalSize<u32>,
scale_factor: ScaleFactor<f32>,
scale_factor_override: Option<ScaleFactor<f32>>,
pending_window_title: std::cell::Cell<Option<String>>,
pub is_hovered: bool,
pub is_focused: bool,
}
impl Default for WindowState {
fn default() -> Self {
Self {
window: None,
size: PhysicalSize::default(),
scale_factor: ScaleFactor::identity(),
scale_factor_override: None,
pending_window_title: std::cell::Cell::new(None),
clipboard: None,
is_hovered: true,
is_focused: true,
}
}
}
impl WindowState {
pub fn set_window(&mut self, window: Arc<Window>) {
if let Some(title) = self.pending_window_title.take() {
window.set_title(&title);
}
let winit::dpi::PhysicalSize { width, height } = window.inner_size();
self.size = PhysicalSize::new(width, height);
self.scale_factor = ScaleFactor::new(window.scale_factor() as f32);
let raw_display_handle = window.display_handle().ok().map(|h| h.as_raw());
self.clipboard = Some(Clipboard::new(raw_display_handle));
self.window = Some(window);
}
pub fn set_window_title(&self, title: &str) {
if let Some(ref window) = self.window {
window.set_title(title);
} else {
self.pending_window_title.set(Some(title.to_string()));
}
}
pub fn logical_size(&self) -> LogicalSize<f32> {
self.size.cast() / self.scale_factor()
}
pub fn scale_factor(&self) -> ScaleFactor<f32> {
self.scale_factor_override.unwrap_or(self.scale_factor)
}
pub fn set_scale_factor(&mut self, scale_factor: f32) {
self.scale_factor = ScaleFactor::new(scale_factor);
}
pub fn scale_factor_override(&self) -> Option<f32> {
self.scale_factor_override.map(ScaleFactor::get)
}
pub fn set_scale_factor_override(&mut self, scale_factor: Option<f32>) {
self.scale_factor_override = scale_factor.map(ScaleFactor::new);
}
pub fn focus(&self) {
if let Some(ref window) = self.window {
window.focus_window();
}
}
pub fn set_clipboard_text(&mut self, text: String) {
if let Some(clipboard) = &mut self.clipboard {
clipboard.set_text(text);
}
}
pub fn get_clipboard_text(&mut self) -> Option<String> {
self.clipboard.as_mut().and_then(Clipboard::get_text)
}
}