Skip to content

Commit 638fef6

Browse files
authored
Merge pull request #38 from apple1417/master
merge mods base + console mod menu with willow + switch to submodules, upgrade to python 3.13
2 parents 4048c8d + f3e1f10 commit 638fef6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+149
-3873
lines changed

.cruft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "[email protected]:bl-sdk/common_dotfiles.git",
3-
"commit": "6b31480199099e9957b18918373a75d979951919",
3+
"commit": "d03eee713ad436d20033d0598eb88f1529c56ca8",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {

.gitmodules

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
[submodule "pyunrealsdk"]
1+
[submodule "libs/pyunrealsdk"]
22
path = libs/pyunrealsdk
3-
url = [email protected]:bl-sdk/pyunrealsdk.git
3+
url = ../../bl-sdk/pyunrealsdk.git
44
[submodule "libs/pluginloader"]
55
path = libs/pluginloader
6-
url = [email protected]:bl-sdk/pluginloader.git
6+
url = ../../bl-sdk/pluginloader.git
7+
[submodule "src/mods_base"]
8+
path = src/mods_base
9+
url = ../../bl-sdk/mods_base.git
10+
[submodule "src/console_mod_menu"]
11+
path = src/console_mod_menu
12+
url = ../../bl-sdk/console_mod_menu.git

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(oak_mod_manager)
55
set(UNREALSDK_ARCH x64)
66
set(UNREALSDK_UE_VERSION UE4)
77
set(EXPLICIT_PYTHON_ARCH amd64)
8-
set(EXPLICIT_PYTHON_VERSION 3.12.3)
8+
set(EXPLICIT_PYTHON_VERSION 3.13.0)
99

1010
add_subdirectory(libs/pyunrealsdk)
1111

prepare_release.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33
import shutil
44
import subprocess
5-
import textwrap
65
import tomllib
76
from collections.abc import Iterator, Sequence
87
from functools import cache
@@ -24,6 +23,12 @@
2423

2524
LICENSE = THIS_FOLDER / "LICENSE"
2625

26+
MODS_WITH_EXISTING_LICENSE = {
27+
# These have their own due to being submodules
28+
BASE_MOD,
29+
CONSOLE_MENU,
30+
}
31+
2732
BUILD_DIR_BASE = THIS_FOLDER / "out" / "build"
2833
INSTALL_DIR_BASE = THIS_FOLDER / "out" / "install"
2934

@@ -33,6 +38,11 @@
3338
PYPROJECT_FILE = THIS_FOLDER / "manager_pyproject.toml"
3439

3540

41+
# Primarily to skip over all the dotfiles in mods which are submodules
42+
VALID_MOD_FILE_SUFFIXES = {".py", ".pyi", ".pyd", ".md"}
43+
44+
45+
# Regex to extract presets from a `cmake --list-presets` command
3646
LIST_PRESETS_RE = re.compile(' "(.+)"')
3747

3848

@@ -106,7 +116,7 @@ def iter_mod_files(mod_folder: Path, debug: bool) -> Iterator[Path]:
106116
if file.parent.name == "__pycache__":
107117
continue
108118

109-
if file.suffix == ".cpp":
119+
if file.suffix not in VALID_MOD_FILE_SUFFIXES:
110120
continue
111121
if file.suffix == ".pyd" and file.stem.endswith("_d") != debug:
112122
continue
@@ -151,7 +161,8 @@ def _zip_mod_folders(zip_file: ZipFile, mod_folders: Sequence[Path], debug: bool
151161
)
152162

153163
# Add the license
154-
zip_file.write(LICENSE, ZIP_MODS_FOLDER / mod.name / LICENSE.name)
164+
license_file = mod / "LICENSE" if mod in MODS_WITH_EXISTING_LICENSE else LICENSE
165+
zip_file.write(license_file, ZIP_MODS_FOLDER / mod.name / LICENSE.name)
155166
else:
156167
# Otherwise, we can add it as a .sdkmod
157168
buffer = BytesIO()
@@ -163,7 +174,8 @@ def _zip_mod_folders(zip_file: ZipFile, mod_folders: Sequence[Path], debug: bool
163174
)
164175

165176
# Add the license
166-
sdkmod_zip.write(LICENSE, Path(mod.name) / LICENSE.name)
177+
license_file = mod / "LICENSE" if mod in MODS_WITH_EXISTING_LICENSE else LICENSE
178+
sdkmod_zip.write(license_file, Path(mod.name) / LICENSE.name)
167179

168180
buffer.seek(0)
169181
zip_file.writestr(
@@ -212,18 +224,6 @@ def _zip_dlls(zip_file: ZipFile, install_dir: Path) -> None:
212224

213225
zip_file.write(file, dest)
214226

215-
py_stem = next(install_dir.glob("python*.zip")).stem
216-
zip_file.writestr(
217-
str(ZIP_PLUGINS_FOLDER / (py_stem + "._pth")),
218-
textwrap.dedent(
219-
f"""
220-
{path.relpath(ZIP_MODS_FOLDER, ZIP_PLUGINS_FOLDER)}
221-
{py_stem}.zip
222-
DLLs
223-
""",
224-
)[1:-1],
225-
)
226-
227227

228228
def zip_release(
229229
output: Path,

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
[tool.pyright]
2-
pythonVersion = "3.12"
2+
pythonVersion = "3.13"
33
typeCheckingMode = "strict"
4+
pythonPlatform = "Windows"
45

56
include = ["src"]
67
stubPath = "libs/pyunrealsdk/stubs"
78
reportMissingModuleSource = false
89

910
[tool.ruff]
10-
target-version = "py312"
11+
target-version = "py313"
1112
line-length = 100
1213

1314
[tool.ruff.lint]
15+
# Last time rules scrutinised: ruff 0.6.9 / 2024-10-08
1416
select = [
1517
"F",
1618
"W",

src/bl3_mod_menu/dialog_box.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def setup_callback(struct: WrappedStruct) -> None:
146146
_dialog_stack.append(self)
147147
show_dialog_box(ENGINE.GameInstance, setup_callback)
148148

149-
@hook("/Script/OakGame.OakGameInstance:OnNATHelpChoiceMade", Type.PRE, auto_enable=True)
149+
@hook("/Script/OakGame.OakGameInstance:OnNATHelpChoiceMade", Type.PRE, immediately_enable=True)
150150
@staticmethod
151151
def _on_dialog_closed_hook(
152152
_1: UObject,

src/bl3_mod_menu/native/dialog_box.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
using namespace unrealsdk::unreal;
1515
using namespace unrealsdk::memory;
1616

17+
namespace {
18+
1719
bool injecting_next_call = false;
1820
pyunrealsdk::StaticPyObject configure_callback{};
1921

@@ -67,7 +69,7 @@ UGbxGFxDialogBox* show_dialog_hook(UGbxPlayerController* player_controller,
6769
// To avoid this, swap it out with an empty array for this call
6870
auto arr = info_struct.get<UArrayProperty>(choices_prop);
6971
const TArray<void> arr_backup = *arr.base;
70-
*arr.base = TArray<void>{nullptr, 0, 0};
72+
*arr.base = TArray<void>{.data = nullptr, .count = 0, .max = 0};
7173

7274
try {
7375
const py::gil_scoped_acquire gil{};
@@ -89,6 +91,8 @@ UGbxGFxDialogBox* show_dialog_hook(UGbxPlayerController* player_controller,
8991
return show_dialog_ptr(player_controller, info);
9092
}
9193

94+
} // namespace
95+
9296
// NOLINTNEXTLINE(readability-identifier-length)
9397
PYBIND11_MODULE(dialog_box, m) {
9498
detour(SHOW_DIALOG, show_dialog_hook, &show_dialog_ptr,

src/bl3_mod_menu/native/options_getters.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
using namespace unrealsdk::unreal;
1212
using namespace unrealsdk::memory;
1313

14+
namespace {
15+
1416
const constinit Pattern<25> COMBO_BOX_GET_SELECTED_INDEX{
1517
"48 8B 81 ????????" // mov rax, [rcx+00000318]
1618
"48 85 C0" // test rax, rax
@@ -66,6 +68,8 @@ spinner_get_current_selection_index_func spinner_get_current_selection_index_ptr
6668
SPINNER_GET_CURRENT_SELECTION_INDEX.sigscan(
6769
"UGbxGFxListItemSpinner::GetCurrentSelectionIndex"));
6870

71+
} // namespace
72+
6973
// NOLINTNEXTLINE(readability-identifier-length)
7074
PYBIND11_MODULE(options_getters, m) {
7175
m.def(

0 commit comments

Comments
 (0)