From f921cb712e67893b44496192e5297335ed65caf7 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 28 May 2019 06:19:38 +1000 Subject: Add [Region] .ini block. For including actual region definition in the normal .ini stack. Same as the usual Region.ini format, except we add a RegionName parameter. --- INSTALL.md | 4 +- .../LoadRegions/RegionLoaderFileSystem.cs | 20 +++- OpenSim/Framework/RegionInfo.cs | 22 ++++- bin/OpenSimDefaults.ini | 2 +- bin/Regions/Regions.ini.example | 101 +++++++++++++++++++++ example/config/sim_skeleton/My_sim.xml | 20 ---- example/config/sim_skeleton/ThisSim.ini | 23 ++++- scripts/common.sh | 4 +- scripts/install/create_sim.sh | 15 ++- scripts/start-sim | 2 +- 10 files changed, 167 insertions(+), 46 deletions(-) create mode 100644 bin/Regions/Regions.ini.example delete mode 100644 example/config/sim_skeleton/My_sim.xml diff --git a/INSTALL.md b/INSTALL.md index 8186383..c4c0fee 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -47,8 +47,8 @@ want your new random sim to be part of Infinite Grid (IG) or Misfitz Grid (MG) then you'll have to change that syml/ink to point to config_IG.ini or config_MG.ini respectively. -/opt/opensim_SC/config/sim01 now contains the aactual configuration of -your randomly created sim. Edit the .xml file to make that sim a little +/opt/opensim_SC/config/sim01 now contains the actual configuration of +your randomly created sim. Edit the .ini file to make that sim a little less random. Finally run - diff --git a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs index 0187418..4160483 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs @@ -68,9 +68,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions } string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); -//// Causes problems with the actual .ini files if they are in the same place. -//// Coz it tries to load each .ini section as a sim, and hangs. -//// string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); + + string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); // Create an empty Regions.xml if there are no existing config files. if (!allowRegionless && configFiles.Length == 0 /*&& iniFiles.Length == 0*/) @@ -84,7 +83,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions List regionInfos = new List(); int i = 0; -/* + + IConfig regionConfig = (IConfig)m_configSource.Configs["Region"]; + string name = regionConfig.GetString("RegionName", string.Empty).Trim(); + if (string.Empty != name) + { + RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), string.Empty, false, m_configSource, name); + regionInfos.Add(regionInfo); + + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); + i++; + } + foreach (string file in iniFiles) { m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); @@ -101,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions i++; } } -*/ + foreach (string file in configFiles) { m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 75ed999..8dac0ac 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -197,6 +197,12 @@ namespace OpenSim.Framework { // m_configSource = configSource; + if (string.Empty == filename) + { + ReadNiniConfig(configSource, "Region", configName); + return; + } + if (filename.ToLower().EndsWith(".ini")) { if (!File.Exists(filename)) // New region config request @@ -420,7 +426,7 @@ namespace OpenSim.Framework set { m_remotingPort = value; } } - + /// /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// @@ -509,6 +515,10 @@ namespace OpenSim.Framework private void ReadNiniConfig(IConfigSource source, string name) { + ReadNiniConfig(source, name, name); + } + private void ReadNiniConfig(IConfigSource source, string section, string name) + { bool creatingNew = false; if (source.Configs.Count == 0) @@ -544,8 +554,7 @@ namespace OpenSim.Framework source.AddConfig(name); } - RegionName = name; - IConfig config = source.Configs[name]; + IConfig config = source.Configs[section]; // Track all of the keys in this config and remove as they are processed // The remaining keys will be added to generic key-value storage for @@ -556,6 +565,11 @@ namespace OpenSim.Framework allKeys.Add(s); } + // RegionName + // + allKeys.Remove("RegionName"); + RegionName = config.GetString("RegionName", name); + // RegionUUID // allKeys.Remove("RegionUUID"); @@ -670,7 +684,7 @@ namespace OpenSim.Framework m_externalHostName = Util.GetLocalHost().ToString(); m_log.InfoFormat( "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", - m_externalHostName, name); + m_externalHostName, RegionName); } else if (!m_resolveAddress) { diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 228b59d..a2de4ba 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -109,7 +109,7 @@ ; Determines where the region XML files are stored if you are loading these from the filesystem. ; Defaults to bin/Regions in your OpenSimulator installation directory - regionload_regionsdir="${Paths|ConfigPath}Regions" + regionload_regionsdir="Regions" ; Determines the page from which regions xml is retrieved if you are loading these from the web ; The XML here has the same format as it does on the filesystem (including the tag), diff --git a/bin/Regions/Regions.ini.example b/bin/Regions/Regions.ini.example new file mode 100644 index 0000000..97d1c4f --- /dev/null +++ b/bin/Regions/Regions.ini.example @@ -0,0 +1,101 @@ +; * This is an example region config file. +; * +; * If OpenSimulator is started up without any regions, it will ask you configuration questions to generate a Regions.ini file for you. +; * So there is no need to change this file directly, it is only for reference. +; * However, if you prefer you can also copy this file to Regions.ini and appropriately change the parameters below. +; * Only files ending with .ini and .xml in this directly will be loaded by OpenSimulator. +; * +; * You can multiple regions into one file or make one file per region +; * The section name is the region name +; * + +[Default Region] + +; * +; * You MUST change this! It will NOT be done for you! +; * + +RegionUUID = 11111111-2222-3333-4444-555555555555 + +Location = 1000,1000 +InternalAddress = 0.0.0.0 +InternalPort = 9000 +AllowAlternatePorts = False +ExternalHostName = SYSTEMIP + +; * +; * Variable-sized regions allows the creation of large, borderless spaces. +; * The default is 256 meters. For larger spaces, set these to multiples of 256. +; * For the time being, X and Y need to be the same. +; * +; SizeX = 512 +; SizeY = 512 + +; * Default region landing point used when no teleport coords are specified +; DefaultLanding = <128,128,30> + +; * +; * Prim data +; * This allows limiting the sizes of prims and the region prim count +; * + +; NonPhysicalPrimMax = 256 +; PhysicalPrimMax = 64 +; ClampPrimSize = False +; MaxPrims = 15000 +; MaxAgents = 100 + +; * Max prims per user (per parcel). +; * Negative values will disable the check. +; MaxPrimsPerUser = -1 + +; * +; * Multi-Tenancy. Only set if needed +; * + +; ScopeID = "00000000-0000-0000-0000-000000000000" + +; * +; * Product name (used in search from viewer 1.23 +; * + +; RegionType = "Mainland" + +; * Region Specific Static Maptiles: +; * Important: To use any kind of texture *assets* as a static maptile, the following +; * things must be set in the [Map] section of OpenSim.ini : +; * +; * MapImageModule = "MapImageModule" +; * GenerateMaptiles = false +; * +; * Now, there is a setting in [Map] in OpenSim.ini called +; * +; * MaptileStaticUUID = 00000000-0000-0000-0000-000000000000 +; * +; * where, given the criteria above, lets you specify the UUID of a texture asset to use +; * as a maptile *Simulator Wide*. Here, you can override that on a per region basis for +; * Simulators that run multiple regions: + +; MaptileStaticUUID = 00000000-0000-0000-0000-000000000000 + + +; * Region Specific Static Maptiles from file: +; * It is also possible to create maptiles using external image files of the right size +; * and supported formats (bmp,png,jpg in RGB 24bpp format) +; * +; * Important: To use any kind of texture *files* as a static maptile, the following +; * things must be set in the [Map] section of OpenSim.ini : +; * +; * MapImageModule = "MapImageModule" +; * GenerateMaptiles = true +; * +; * The image must be the same size in pixels as the region or varregion is in meters. +; * i.e. 256x256 pixels for single region of 256x256m, or 1280x1280 pixels for a varregion +; * of size 1280x1280m. The image can be loaded from anywhere by setting the path +; * ie: MaptileStaticFile = "maptiles/SomeFile.png" +; * +; * If this setting is used, then the base map is generated from this file instead of being +; * built using MapImageModule's terrain and prim renderer. Parcel 'for sale' overlays are +; * still drawn on top of the static map by the World Map module. + +; MaptileStaticFile = "SomeFile.png" diff --git a/example/config/sim_skeleton/My_sim.xml b/example/config/sim_skeleton/My_sim.xml deleted file mode 100644 index f71df57..0000000 --- a/example/config/sim_skeleton/My_sim.xml +++ /dev/null @@ -1,20 +0,0 @@ - -
- - - - - - - - - - - - - - - - -
-
diff --git a/example/config/sim_skeleton/ThisSim.ini b/example/config/sim_skeleton/ThisSim.ini index 140cf3b..a1a209a 100644 --- a/example/config/sim_skeleton/ThisSim.ini +++ b/example/config/sim_skeleton/ThisSim.ini @@ -5,7 +5,25 @@ PIDFile = "${Paths|CachePath}/sim${Const|mysim}.pid" LogFile = "${Paths|LogPath}/OpenSim_sim${Const|mysim}.log" ConsoleHistoryFile = "${Paths|LogPath}/OpenSimConsoleHistory_sim${Const|mysim}.txt" - regionload_regionsdir="../../config/sim${Const|mysim}" + +[Region] + RegionName = "SIM_NAME" + RegionUUID = "SIM_UUID" + Location = "SIM_POS" + InternalAddress = "SIM_IP" + InternalPort = "SIM_INT_PORT" + AllowAlternatePorts = False + ExternalHostName = "SIM_URL" + RegionType = "private sim" + SizeX = SIM_SIZE + SizeY = SIM_SIZE + SizeZ = 16384 + MaxAgents = 100 + MaxPrims = 45000 + PhysicalPrimMax = 640 + NonphysicalPrimMax = 2560 + ClampPrimSize = False + MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" [Map] enablePosition = true @@ -21,5 +39,4 @@ Include-Performance = "config-include/SimBalanced.ini" ; Include-Performance = "config-include/SimDefault.ini" ; Include-Performance = "config-include/SimLean.ini" - │ 2621 mysql 20 0 4131620 483696 17640 S 0.3 2.9 8:07.82 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/x86_64-linux-gnu/mariadb18/plugin --user=m+ - \ No newline at end of file + diff --git a/scripts/common.sh b/scripts/common.sh index c5a86ab..9d985f2 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -42,11 +42,11 @@ sanitize() } -# Grab the first Section line of the sims .xml file, cut it down to the name. +# Grab the first Section line of the sims .ini file, cut it down to the name. # name=$(getSimName 1) getSimName() { - grep "