Felucca 0x001A6B20
Мои изыскания начались с хотелки увеличить мир в 4 раза. Изшерстил гугуль вдоль и поперек нашел только неоднократное упоминание что размеры "hardcoded" и типа не рыпайтеь. Не наш метод, так что началась инжинерная мысля. Первое что было известно - в Ранке размеры карт - задаются... Задаются примерно так:${RunUO}/Scripts/Misc/MapDefinitions.cs
Исходный код
using System;
using Server;
namespace Server.Misc
{
public class MapDefinitions
{
public static void Configure()
{
/* Here we configure all maps. Some notes:
*
* 1) The first 32 maps are reserved for core use.
* 2) Map 0x7F is reserved for core use.
* 3) Map 0xFF is reserved for core use.
* 4) Changing or removing any predefined maps may cause server instability.
*/
RegisterMap( 0, 0, 0, 14336, 8192, 4, "Felucca", MapRules.FeluccaRules );
RegisterMap( 1, 1, 1, 7168, 4096, 0, "Trammel", MapRules.TrammelRules );
RegisterMap( 2, 2, 2, 2304, 1600, 1, "Ilshenar", MapRules.TrammelRules );
RegisterMap( 3, 3, 3, 2560, 2048, 1, "Malas", MapRules.TrammelRules );
RegisterMap( 4, 4, 4, 1448, 1448, 1, "Tokuno", MapRules.TrammelRules );
RegisterMap( 0x7F, 0x7F, 0x7F, Map.SectorSize, Map.SectorSize, 1, "Internal", MapRules.Internal );
/* Example of registering a custom map:
* RegisterMap( 32, 0, 0, 6144, 4096, 3, "Iceland", MapRules.FeluccaRules );
*
* Defined:
* RegisterMap( <index>, <mapID>, <fileIndex>, <width>, <height>, <season>, <name>, <rules> );
* - <index> : An unreserved unique index for this map
* - <mapID> : An identification number used in client communications. For any visible maps, this value must be from 0-3
* - <fileIndex> : A file identification number. For any visible maps, this value must be 0, 2, 3, or 4
* - <width>, <height> : Size of the map (in tiles)
* - <name> : Reference name for the map, used in props gump, get/set commands, region loading, etc
* - <rules> : Rules and restrictions associated with the map. See documentation for details
*/
TileMatrixPatch.Enabled = false; //OSI client patch 6.0.0.0
}
public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules )
{
Map newMap = new Map( mapID, mapIndex, fileIndex, width, height, season, name, rules );
Map.Maps[mapIndex] = newMap;
Map.AllMaps.Add( newMap );
}
}
}
То есть размеры карт лежат вообще "как угодно". И не вина RunUO что они "hardcoded" в клиенте. Значит сервер это тянет. Вся проблема в клиенте. Первое что сделал - открыл client.exe (предварительно сделав копию и вообще для меня это было Warstone.exe) и тупо поискав там слово Felucca. Поиск дал только 1 вхождение. Посмотрев вокруг - как-то не нашел ничего похожего на константы размера. Инженерная мысля пошла дальше. Судя по тому что было написано рядом с заветным словом - это просто кусок текстовых констант. Значит где-то должна быть ссылка на эту константу... Итак, константа находилась в 0x001A6B20 вспоминая тот факт, что в х86 архитектуре все числа должны быть перевернуты я начал искать 206B1A и... не нашел. И правильно что не нашел. Так как никто не будет читать константы из ехе напрямую. Все-же отмаплено в память когда ехе загружается. И в PE заголовке есть такая страшная фраза как Image Base. Вообще-то она изменяется, но по дефолту = 0x00400000. Прибавив это к своему адресу я получил 0x005A6B20, поменял местами до 206B5A и... нашел! Одно вхождение. Дальнейшие пляски с бубном показали что:using Server;
namespace Server.Misc
{
public class MapDefinitions
{
public static void Configure()
{
/* Here we configure all maps. Some notes:
*
* 1) The first 32 maps are reserved for core use.
* 2) Map 0x7F is reserved for core use.
* 3) Map 0xFF is reserved for core use.
* 4) Changing or removing any predefined maps may cause server instability.
*/
RegisterMap( 0, 0, 0, 14336, 8192, 4, "Felucca", MapRules.FeluccaRules );
RegisterMap( 1, 1, 1, 7168, 4096, 0, "Trammel", MapRules.TrammelRules );
RegisterMap( 2, 2, 2, 2304, 1600, 1, "Ilshenar", MapRules.TrammelRules );
RegisterMap( 3, 3, 3, 2560, 2048, 1, "Malas", MapRules.TrammelRules );
RegisterMap( 4, 4, 4, 1448, 1448, 1, "Tokuno", MapRules.TrammelRules );
RegisterMap( 0x7F, 0x7F, 0x7F, Map.SectorSize, Map.SectorSize, 1, "Internal", MapRules.Internal );
/* Example of registering a custom map:
* RegisterMap( 32, 0, 0, 6144, 4096, 3, "Iceland", MapRules.FeluccaRules );
*
* Defined:
* RegisterMap( <index>, <mapID>, <fileIndex>, <width>, <height>, <season>, <name>, <rules> );
* - <index> : An unreserved unique index for this map
* - <mapID> : An identification number used in client communications. For any visible maps, this value must be from 0-3
* - <fileIndex> : A file identification number. For any visible maps, this value must be 0, 2, 3, or 4
* - <width>, <height> : Size of the map (in tiles)
* - <name> : Reference name for the map, used in props gump, get/set commands, region loading, etc
* - <rules> : Rules and restrictions associated with the map. See documentation for details
*/
TileMatrixPatch.Enabled = false; //OSI client patch 6.0.0.0
}
public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules )
{
Map newMap = new Map( mapID, mapIndex, fileIndex, width, height, season, name, rules );
Map.Maps[mapIndex] = newMap;
Map.AllMaps.Add( newMap );
}
}
}
После ссылки на константу идут... РАЗМЕРЫ! следующие 4 байта после ссылки - ширина, а потом высота. Вот поменяв их на в 2 раза больше (помните о переворачивании констант) и поменяв соотв данные в RunUO, а так-же программно нагенерив соотв. размеров карту я получил и запустил это хозяйство и прекрасно бегал по этой карте.
Собственно остались проблемы: Как создать карту таких размеров, ведь ни один (разве что кроме CentrEd) редактор такого не позволяет, но и это оказалось не проблема. Так как увеличивали в 2 раза, то были подготовлены 4 карты и потом с помощью небольшой самописной программки объединены в одну. ЕХЕ версии 6.0.13.0 могу выслать по запросу.
Хочу сразу сказать, что Траммель и прочее меняется так-же.
ЗЫ: На правах рекламы: Все желающие могут присоединиться к проекту... На данном моменте нужны скриптеры... сервер RunUO.