|
12 | 12 |
|
13 | 13 | #include <memory> |
14 | 14 |
|
| 15 | +#include <f4se/GameSettings.h> |
| 16 | + |
15 | 17 | namespace XCell |
16 | 18 | { |
17 | 19 | std::map<UInt64, shared_ptr<ParseINI>> _cache_inifiles; |
@@ -118,8 +120,8 @@ namespace XCell |
118 | 120 | if (!DefaultValue) |
119 | 121 | DefaultValue = ""; |
120 | 122 |
|
121 | | - /*_MESSAGE("AppName: \"%s\", KeyName: \"%s\", DefaultValue: \"%s\", Size: \"%u\", FileName: \"%s\"", |
122 | | - AppName, KeyName, DefaultValue, Size, FileName);*/ |
| 123 | + //_MESSAGE("AppName: \"%s\", KeyName: \"%s\", DefaultValue: \"%s\", Size: \"%u\", FileName: \"%s\"", |
| 124 | + // AppName, KeyName, DefaultValue, Size, FileName); |
123 | 125 |
|
124 | 126 | ParseINI* Data; |
125 | 127 | // Enum all sections or error parse file |
@@ -210,8 +212,8 @@ namespace XCell |
210 | 212 |
|
211 | 213 | SetLastError(0); |
212 | 214 |
|
213 | | - /*_MESSAGE("AppName: \"%s\", KeyName: \"%s\", DefaultValue: \"%i\", FileName: \"%s\"", |
214 | | - AppName, KeyName, DefaultValue, FileName);*/ |
| 215 | + //_MESSAGE("AppName: \"%s\", KeyName: \"%s\", DefaultValue: \"%i\", FileName: \"%s\"", |
| 216 | + // AppName, KeyName, DefaultValue, FileName); |
215 | 217 |
|
216 | 218 | ParseINI* Data; |
217 | 219 | if (!ParseINIAndStoreCache(&Data, FileName)) |
@@ -285,6 +287,29 @@ namespace XCell |
285 | 287 | return TRUE; |
286 | 288 | } |
287 | 289 |
|
| 290 | + static bool hk_subC30008() |
| 291 | + { |
| 292 | + auto iniDef = *(g_iniSettings.GetPtr()); |
| 293 | + auto iniPref = *(g_iniPrefSettings.GetPtr()); |
| 294 | + |
| 295 | + auto pSettingSrc = iniPref->data; |
| 296 | + |
| 297 | + do |
| 298 | + { |
| 299 | + auto pSettingDst = iniDef->Get(pSettingSrc->data->name); |
| 300 | + if (!pSettingDst) |
| 301 | + { |
| 302 | + auto pNewNode = new SettingCollectionList::Node; |
| 303 | + pNewNode->next = iniDef->data; |
| 304 | + pNewNode->data = pSettingSrc->data; |
| 305 | + iniDef->data = pNewNode; |
| 306 | + } |
| 307 | + |
| 308 | + } while (pSettingSrc = pSettingSrc->next); |
| 309 | + |
| 310 | + return false; |
| 311 | + } |
| 312 | + |
288 | 313 | ModuleProfile::ModuleProfile(void* Context) : |
289 | 314 | Module(Context, SourceName, CVarProfile) |
290 | 315 | {} |
@@ -315,6 +340,9 @@ namespace XCell |
315 | 340 | REL::Impl::DetourIAT(base, "kernel32.dll", "GetPrivateProfileStringA", (uintptr_t)&HKGetPrivateProfileStringA); |
316 | 341 | REL::Impl::DetourIAT(base, "kernel32.dll", "GetPrivateProfileIntA", (uintptr_t)&HKGetPrivateProfileIntA); |
317 | 342 |
|
| 343 | + // Add new settings for plugins .ini |
| 344 | + REL::Impl::DetourCall(REL::ID(300), (UInt64)&hk_subC30008); |
| 345 | + |
318 | 346 | return S_OK; |
319 | 347 | } |
320 | 348 |
|
|
0 commit comments