Skip to content

Commit

Permalink
Switch to a much more recent branch of CommonLibSSE-NG (#97)
Browse files Browse the repository at this point in the history
There are four major changes in this PR, because one thing led to another.

1. Updated my fork of CommonLibSSE-NG to track the `ng` branch of the
alandtse/CommonLibVR fork. This might make it work with 1.6.1130, but I have not
yet tested. There are some problems that might prevent me from releasing this
immediately-- input contexts changed enough to cause trouble with my checks for
whether the HUD should be drawn or not. E.g., in the opening scene when the
player cannot control movement or attack, the HUD should never be shown. These
checks now depend on detecting 1130 and changing offsets correctly.

Introduced the namespace `soulsy` for types shared between Rust and C++, to
avoid the `Color` type name conflict with some dx things pulled in by the newer
clib.

There were other adaptations made for the newer clib, but they were
uninteresting.

2. Reworked how we equip items to handle extra data better. There are now three
functions for finding bound objects for a form: the pre-existing first-match
function, a variant that filters for only items currently being worn, and a
variant that looks for exact name matches. These implementations currently
repeat code, but I'm not ready to clean that up with any refactors until I'm
sure they work.

Updated all code paths that equip or un-equip items to use the path most
appropriate for them. This work is intended to make sure we equip the correct
variation of an object: the iron dagger with the correct temper level, or the
dagger with the correct enchant. We then pass the appropriate extra data through
to the `EquipObject()` call. This seems to work as expected. I'm still not sure
how to test bug #81 reliably. (I mean, soul trap on a dagger works. This might
be a sign that it's fixed.) 

3. Added support for every single shout variant in vanilla, Stormcrown, and
Thunderchild. (The other shout remakes don't add new shouts.) Also worked shout
KID distributions to use shout spells (three per shout) instead of effects (too
many). Komegaki's icon packs should work when he releases them. Wrote a number
of tests to make sure that my claims about coverage are correct.

Less importantly, demoted a lot of logging to trace level. Tuned up log lines
that are sticking around. Now that the logs are unified I have less tolerance
for repeated information.

4. Added the `textcode` crate to handle converting Windows code page text
encodings-- aka ISO-8859 encodings-- to UTF-8. This should *correctly* handle
all cases of item names that contain invalid UTF-8 characters. I was doing lazy
lossy conversions before, which had the virtue of preventing the mod from
crashing on encountering these strings. However, when I unified logging, I
re-introduced the crash scenario for every log line that mentioned an item name
with this problem. The fix has two parts: First, write two convenience functions
for getting item names (one for the form base name, and one for the full display
name) and have them return utf8 strings. Second, wrap every single use of item
names in log strings with one or the other of these functions.
  • Loading branch information
ceejbot authored Dec 26, 2023
1 parent 618b379 commit 3aaa710
Show file tree
Hide file tree
Showing 39 changed files with 1,951 additions and 812 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "extern/CommonLibSSE-NG"]
path = extern/CommonLibSSE-NG
url = https://github.com/ceejbot/CommonLibSSE-NG
branch = ceej/no-vr-build
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
endif()

set(NAME "SoulsyHUD")
set(VERSION 0.14.1.0)
set(VERSION 0.15.0.0)

project(
${NAME}
Expand Down Expand Up @@ -212,16 +212,16 @@ add_subdirectory(${CommonLibPath} ${CommonLibName} EXCLUDE_FROM_ALL)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/config
${CMAKE_CURRENT_SOURCE_DIR}/src/game
${CMAKE_CURRENT_SOURCE_DIR}/src/migrate_me
${CMAKE_CURRENT_SOURCE_DIR}/src/log
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin
${CMAKE_CURRENT_SOURCE_DIR}/src/renderer
${CMAKE_CURRENT_SOURCE_DIR}/src/util
${CARGO_TARGET_DIR}/cxxbridge/soulsy/src
${CARGO_TARGET_DIR}/cxxbridge
${CMAKE_CURRENT_BINARY_DIR}/include
)

# The last few of these are surprising, but are pulled in by some of the rust crates
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 23 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
[package]
name = "soulsy"
description = "A minimal Souls-like HUD & hotkeys mod for Skyrim AE. SKSE plugin."
version = "0.14.1"
edition = "2021"
authors = ["C J Silverio <[email protected]>"]
description = "A minimal Souls-like HUD & hotkeys mod for Skyrim AE. SKSE plugin."
edition = "2021"
keywords = ["c++", "skyrim"]
license = "GPL-3.0"
name = "soulsy"
readme = "README.md"
rust-version = "1.71.1"
authors = ["C J Silverio <[email protected]>"]
license = "GPL-3.0"
readme = "README.md"
keywords = ["skyrim", "c++"]
version = "0.14.1"

[lib]
crate-type = ["staticlib"]

[dependencies]
bincode = "2.0.0-rc.3"
cxx = { version = "1.0.111", features = ["c++20"] }
enumset = "1.1.3"
eyre = "0.6.9"
log = "0.4.20"
lru = "0.12.1"
bincode = "2.0.0-rc.3"
cxx = { version = "1.0.111", features = ["c++20"] }
enumset = "1.1.3"
eyre = "0.6.9"
log = "0.4.20"
lru = "0.12.1"
once_cell = "1.18.0"
resvg = "0.37.0"
rust-ini = "0.20.0"
serde = { version = "1.0.193", features = ["derive"] }
resvg = "0.37.0"
rust-ini = "0.20.0"
serde = { version = "1.0.193", features = ["derive"] }
simplelog = "0.12.1"
strfmt = "0.2.4"
strum = { version = "0.25.0", features = ["derive"] }
toml = "0.8.6"
strfmt = "0.2.4"
strum = { version = "0.25.0", features = ["derive"] }
textcode = "0.2.2"
toml = "0.8.6"

[build-dependencies]
cxx-build = "1.0.111"

[dev-dependencies]
petname = { version = "1.1.3", default-features = false, features = ["std_rng", "default_dictionary"] }
rand = "0.8.5"
petname = { version = "1.1.3", default-features = false, features = ["default_dictionary", "std_rng"] }
rand = "0.8.5"

[profile.release]
debug = true
2 changes: 1 addition & 1 deletion cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ set(headers ${headers}
src/renderer/animation_handler.h
src/renderer/image_path.h
src/renderer/ui_renderer.h
src/soulsy.h
src/util/constant.h
src/util/helpers.h
src/util/key_path.h
src/util/offset.h
src/util/string_util.h
)
set(sources ${sources}
${headers}
Expand Down
2 changes: 0 additions & 2 deletions docs/article-theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ SoulsyHUD provides decent defaults for all of these. However, all of these eleme

You can use any Truetype font to render text in the HUD. If the font supports it, you can generate glyphs for character sets beyond the usual Western alphabet glyphs. The HUD should be able to render any valid [UTF-8 character](https://www.utf8.com) if the font includes glyphs for that character.

⚠️ There are some characters the game menus can display that are invalid UTF-8 characters. Skyrim's Flash menus support an older text encoding called [UCS-2](https://en.wikipedia.org/wiki/Universal_Coded_Character_Set), and some characters in that encoding are not converted properly to UTF-8. I have encountered two mods that have item names that can't be represented properly. Fixing this bug is on my list for post-1.0. See [the ucs2-rs library](https://lib.rs/crates/ucs2). Even simple text is nothing but simple, it turns out.

Put the `.ttf` file in `SKSE/plugins/resources/fonts` and name it in the layout. The `font_size` option specifies what size to generate Imgui font billboard data. Text will look best when rendered at this size, so make this match whatever size most of your HUD text is.

Here's the full set of font options as they'd appear in a layout file:
Expand Down
2 changes: 1 addition & 1 deletion extern/CommonLibSSE-NG
Submodule CommonLibSSE-NG updated 1524 files
Loading

0 comments on commit 3aaa710

Please sign in to comment.