Ради вашего удобства наш сайт использует cookies! Узнать больше! Мы используем cookies

Better Map Sizes Fix

Better Map Sizes Fix — VEF Compatibility Patch

Fixes the System.OverflowException crash that occurs when using Better Map Sizes with some mods depending on Vanilla Expanded Framework and editing the map structure such as Vanilla Landmarks Expanded or Alpha Biomes.

The Problem

If you use Better Map Sizes (BMS) alongside VEF mods, generating a map at any custom size crashes with an overflow error in HaulDestinationManager during Map.ConstructComponents(). Even sizes that should be perfectly fine (250x250, 325x325) will crash. The game never reaches biome or landmark generation; it dies immediately during map setup.

What Causes It

BMS rewrites the IL bytecode of Game.InitNewGame using a Harmony Transpiler. VEF does the same thing to the same method with its own Transpiler (TweakMapSizes). When both Transpilers rewrite the same method, the instruction layout shifts and BMS ends up reading the wrong local variable, producing garbage values for the map dimensions. The crash was never about the map being too large. It was corrupted data from two Transpilers colliding.

What This Mod Does

  • Removes BMS's broken Transpiler from Game.InitNewGame
  • Replaces it with a safe Prefix that reads BMS's custom size settings via reflection
  • Sets Find.GameInitData.mapSize before the method runs
  • Handles non-square maps by also prefixing MapGenerator.GenerateMap
  • Leaves BMS's UI patches completely untouched

Important: Setting Custom Map Size

Set your custom map size through BMS's Mod Settings page or Options → Mod Options → Custom Map Sizes for best results. The world creation screen input fields sometimes do not pick up the custom size properly, so you may end up with something else other than the 600x600 you wanted.

Load Order

Load this after all of the following:

  • Harmony
  • Vanilla Expanded Framework

Requirements

Tested With

395 mods active, VLE + Alpha Biomes both loaded, 500x500 custom map. No crash.

Source Code

Full C# source and build instructions are included in the mod folder. Licensed under WTFPL (same as BMS).

Coding Disclaimer

Problem diagnosed and fixed with Claude, it works and that's all that matters to me. If this doesn't sit well with you, please don't use it.

Рейтинг

Войдите, чтобы голосовать.
🏅 Нет оценок

Базовые теги:

Загрузить 94.5 KB