Skip to content

Commit f971120

Browse files
committed
Quick patch to enable weather edid patch for 1170+
1 parent 162925f commit f971120

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

src/Fixes/CacheEditorIDs.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
//Cache skipped formEditorIDs
55
namespace Fixes::CacheFormEditorIDs
66
{
7+
const char* GetGameVersionImpl()
8+
{
9+
using func_t = decltype(&GetGameVersionImpl);
10+
static REL::Relocation<func_t> func{ RELOCATION_ID(15485, 15650) };
11+
return func();
12+
}
13+
14+
REL::Version GetGameVersion()
15+
{
16+
std::stringstream ss(GetGameVersionImpl());
17+
std::string token;
18+
std::array<std::uint16_t, 4> version{};
19+
20+
for (std::size_t i = 0; i < 4 && std::getline(ss, token, '.'); ++i) {
21+
version[i] = static_cast<std::uint16_t>(std::stoi(token));
22+
}
23+
24+
return REL::Version(version);
25+
}
26+
727
struct SetFormEditorID
828
{
929
static bool thunk(RE::TESForm* a_this, const char* a_str)
@@ -208,8 +228,12 @@ namespace Fixes::CacheFormEditorIDs
208228
stl::write_vfunc<RE::BGSLensFlare, SetFormEditorID>();
209229

210230
#ifdef SKYRIM_AE
211-
REL::Relocation<std::uintptr_t> target{ RELOCATION_ID(0, 20396), 0x403 }; //TESWeather::Load
212-
stl::write_thunk_call<TESFile_GetChunkData>(target.address());
231+
if (GetGameVersion() >= SKSE::RUNTIME_LATEST) {
232+
REL::Relocation<std::uintptr_t> target{ RELOCATION_ID(0, 20396), 0x403 }; //TESWeather::Load
233+
stl::write_thunk_call<TESFile_GetChunkData>(target.address());
234+
235+
logger::info("\t\tInstalled TESWeather editorID patch"sv);
236+
}
213237
#endif
214238

215239
logger::info("\t\tInstalled editorID cache"sv);

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ void InitializeLog()
9999

100100
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink));
101101

102-
log->set_level(spdlog::level::debug);
103-
log->flush_on(spdlog::level::debug);
102+
log->set_level(spdlog::level::info);
103+
log->flush_on(spdlog::level::info);
104104

105105
spdlog::set_default_logger(std::move(log));
106106
spdlog::set_pattern("[%H:%M:%S:%e] %v"s);

0 commit comments

Comments
 (0)