Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit 26b1301

Browse files
committed
[X-CELL] Remade memory patch
1 parent 45e3d24 commit 26b1301

10 files changed

Lines changed: 818 additions & 315 deletions

File tree

data/f4se/plugins/x-cell.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
# X-CELL FALLOUT 4 PLUGIN SETTINGS
22

33
[Patches]
4-
bThreads=true # All threads have priority above idle, process above normal, for adequate latency, prohibition on changing processor cores.
5-
bMemory=true # Replaced memory manager and scrap heap, also functions for working with memory.
6-
bFacegen=true # Enables facegen support and removes freezes.
7-
bIO=true # Replacing file search functions with a newer one and use OS file cache for less disk access (Actual only HDD).
8-
bLibDeflate=true # Replace old zlib decompression code with optimized libdeflate https://github.com/ebiggers/libdeflate.
9-
bProfile=true # Replacing outdated functions WritePrivateProfileStringA, GetPrivateProfileStringA, GetPrivateProfileIntA. They read INI files.
10-
bLoadScreen=false # Black loading screen.
11-
bDropItem=true # Extends structure BSExtraCount from a 16-bit number to a 32-bit number. Allows you to throw things away up to 2.147.483.647.
12-
bUpscaler=false # [Experimental] Increase FPS due to scaling, requires Win 8.1 and newer, without conflict ENB (no dlss, no fsr).
4+
bThreads=true # All threads have priority above idle, process above normal, for adequate latency, prohibition on changing processor cores.
5+
bMemory=true # Replaced memory manager and scrap heap, also functions for working with memory.
6+
bFacegen=true # Enables facegen support and removes freezes.
7+
bIO=true # Replacing file search functions with a newer one and use OS file cache for less disk access (Actual only HDD).
8+
bLibDeflate=true # Replace old zlib decompression code with optimized libdeflate https://github.com/ebiggers/libdeflate.
9+
bProfile=true # Replacing outdated functions WritePrivateProfileStringA, GetPrivateProfileStringA, GetPrivateProfileIntA. They read INI files.
10+
bLoadScreen=false # Black loading screen.
11+
bDropItem=true # Extends structure BSExtraCount from a 16-bit number to a 32-bit number. Allows you to throw things away up to 2.147.483.647.
12+
bUpscaler=false # [Experimental] Increase FPS due to scaling, requires Win 8.1 and newer, without conflict ENB (no dlss, no fsr).
1313

14-
[Fixes] # Common fixes
15-
bInitTints=true # Removes the block on loading NPCs tints of the Fallout4.esm file, as well as for NPCs with set the IsChargenPresent flag.
16-
bLODDistance=true # Fixes bugs when toggling references with LOD causing LOD to briefly enable and disable by removing the "Has Distant LOD" and "Visible When Distant" flag checks: https://www.youtube.com/watch?v=hgMm9Z8lHfU.
14+
[Fixes] # Common fixes
15+
bInitTints=true # Removes the block on loading NPCs tints of the Fallout4.esm file, as well as for NPCs with set the IsChargenPresent flag.
16+
bLODDistance=true # Fixes bugs when toggling references with LOD causing LOD to briefly enable and disable by removing the "Has Distant LOD" and "Visible When Distant" flag checks: https://www.youtube.com/watch?v=hgMm9Z8lHfU.
1717

18-
[AE_NG_Fixes] # Only NG-AE version game. Already present in Buffout 4, but are missing in Buffout 4 NG (at time 28.09.2024).
19-
bGreyMovies=true # Fixes a bug where movies that don't define "BackgroundAlpha" on their movie root could load with a grey background.
20-
bPackageAllocateLocation=true # Fixes a crash when allocating the location for a package.
21-
bWarningCreateTexture2D=false # Warns when a call to CreateTexture2D fails.
18+
[AE_NG_Fixes] # Only NG-AE version game. Already present in Buffout 4, but are missing in Buffout 4 NG (at time 28.09.2024).
19+
bGreyMovies=true # Fixes a bug where movies that don't define "BackgroundAlpha" on their movie root could load with a grey background.
20+
bPackageAllocateLocation=true # Fixes a crash when allocating the location for a package.
21+
bWarningCreateTexture2D=false # Warns when a call to CreateTexture2D fails.
2222

2323
[Additional]
24-
uScaleformPageSize=256 # The page size (in KB), vanilla size is 64. More, better, but the higher the memory consumption. Limit 2Mb (2048), number must be a multiple of 8 (Need bMemory patch).
25-
uScaleformHeapSize=512 # The heap size (in MB), vanilla size is 128. This is all the available memory, out of memory = CTD. Limit 2Gb (2048), number must be a multiple of 8 (Need bMemory patch).
26-
bUseNewRedistributable=false # Replaces the old redistributable with a new one. If option is enabled, reports will include X-Cell in case of errors related to copying or comparing memory (Need bMemory patch).
27-
bOutputRTTI=false # Create file "<FALLOUT4_DIR>\\Data\\F4SE\\Plugins\\rtti-x-cell.txt" with rtti info.
28-
bUseIORandomAccess=false # Activate a prompt for the system that you need to use a cache with random access, otherwise it will be sequential (Need bIO patch).
29-
bDbgFacegenOutput=false # Debugging messages about the presence of facegen in the NPC in console and log (Need bFacegen patch).
24+
uScaleformPageSize=256 # The page size (in KB), vanilla size is 64. More, better, but the higher the memory consumption. Limit 2Mb (2048), number must be a multiple of 8 (Need bMemory patch).
25+
uScaleformHeapSize=512 # The heap size (in MB), vanilla size is 128. This is all the available memory, out of memory = CTD. Limit 2Gb (2048), number must be a multiple of 8 (Need bMemory patch).
26+
bUseNewRedistributable=false # Replaces the old redistributable with a new one. If option is enabled, reports will include X-Cell in case of errors related to copying or comparing memory (Need bMemory patch).
27+
bOutputRTTI=false # Create file "<FALLOUT4_DIR>\\Data\\F4SE\\Plugins\\rtti-x-cell.txt" with rtti info.
28+
bUseIORandomAccess=false # Activate a prompt for the system that you need to use a cache with random access, otherwise it will be sequential (Need bIO patch).
29+
bDbgFacegenOutput=false # Debugging messages about the presence of facegen in the NPC in console and log (Need bFacegen patch).
3030

31-
[PostProccessing] # Need Upscaler patch
32-
fDisplayScale=0.85 # Scaling in for the game screen, 1.0 means native dimensions. Range: [0.5, 1]
33-
bNoUseOriginalTAA=true # Do not use Bethesda mix post effects with TAA, which causes slight ripples, will be used FXAA by Bethesda and TAA by AMD.
31+
[PostProccessing] # Need Upscaler patch
32+
fDisplayScale=0.85 # Scaling in for the game screen, 1.0 means native dimensions. Range: [0.5, 1]
33+
bNoUseOriginalTAA=true # Do not use Bethesda mix post effects with TAA, which causes slight ripples, will be used FXAA by Bethesda and TAA by AMD.

depends/vmm/source/vmmmain.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <string.h>
1414
#include <windows.h>
1515

16+
#define USE_MULTITHREADS 1
17+
1618
//#pragma warning(disable : 4996)
1719
//#include <stdio.h>
1820

@@ -120,6 +122,7 @@ namespace voltek
120122
pools[POOL_64] = new pool64_t(POOL_SIZE);
121123
}
122124

125+
#if USE_MULTITHREADS
123126
thread = new std::thread([](HANDLE* ev_close, HANDLE* ev_close_w, void** pools,
124127
voltek::core::_internal::simple_lock* lock) {
125128
while (1)
@@ -157,10 +160,12 @@ namespace voltek
157160
SetThreadPriority(thread->native_handle(), THREAD_PRIORITY_HIGHEST);
158161
_vassert(!SetThreadAffinityMask(thread->native_handle(), 1llu << (thread->hardware_concurrency() - 1)));
159162
thread->detach();
163+
#endif
160164
}
161165

162166
memory_manager::~memory_manager()
163167
{
168+
#if USE_MULTITHREADS
164169
if (thread)
165170
{
166171
SetEvent((HANDLE)event_close);
@@ -190,6 +195,7 @@ namespace voltek
190195
delete thread;
191196
thread = nullptr;
192197
}
198+
#endif
193199
}
194200

195201
void* memory_manager::alloc(size_t size)
@@ -230,8 +236,11 @@ namespace voltek
230236
}
231237

232238
void* new_ptr = nullptr;
239+
240+
#if USE_MULTITHREADS
233241
// Блокируем. Снятие блокировки будет заботить компилятор.
234242
voltek::core::_internal::simple_scope_lock scope_lock(lock);
243+
#endif
235244

236245
if (size > 65536)
237246
{
@@ -487,8 +496,11 @@ namespace voltek
487496
return nullptr;
488497

489498
void* new_ptr = nullptr;
499+
500+
#if USE_MULTITHREADS
490501
// Блокируем. Снятие блокировки будет заботить компилятор.
491502
voltek::core::_internal::simple_scope_lock scope_lock(lock);
503+
#endif
492504

493505
// Если память выделена ранее как обычный, то тут выделение новой памяти неизбежно.
494506
if (is_used_default_ptr(ptr))
@@ -659,8 +671,11 @@ namespace voltek
659671
return false;
660672

661673
bool ret = true;
674+
675+
#if USE_MULTITHREADS
662676
// Блокируем. Снятие блокировки будет заботить компилятор.
663677
voltek::core::_internal::simple_scope_lock scope_lock(lock);
678+
#endif
664679
//_fsniff("The beginning of memory release: %p", ptr);
665680

666681
if (is_used_default_ptr(ptr))
@@ -803,8 +818,10 @@ namespace voltek
803818
if ((POOL_MAX >= pool_id) || !filename)
804819
return;
805820

821+
#if USE_MULTITHREADS
806822
// Блокируем. Снятие блокировки будет заботить компилятор.
807823
voltek::core::_internal::simple_scope_lock scope_lock(lock);
824+
#endif
808825

809826
switch (pool_id)
810827
{
@@ -902,8 +919,10 @@ namespace voltek
902919
if ((POOL_MAX >= pool_id) || !filename)
903920
return;
904921

922+
#if USE_MULTITHREADS
905923
// Блокируем. Снятие блокировки будет заботить компилятор.
906924
voltek::core::_internal::simple_scope_lock scope_lock(lock);
925+
#endif
907926

908927
switch (pool_id)
909928
{

fomod/info.xml

-2 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)