RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Fixes for RunUO 2.0 RC1 on Linux

RavonTUS

Sorceror
Greetings,

Thank you seirge. I took advise and install MONO from their SVN and it seems to get past this error.

Now it appears to be having problems with either finding the scripts folder or there are problems with the way MONO handles the Console.ReadKey or both.

I will play with it a little more today.

-Ravon
 

RavonTUS

Sorceror
Greetings,

Not making any progress.

seirge - would you consider posting your changes for us?!? Please!

-Ravon
 

seirge

Wanderer
Try this ScriptCompiler.
One of the mono problem is the fact, that it cannot handle command lines with more, then 64k symbols (due to shell restriction). So, standard RunUO ScriptCompiler will not work.
Another problem in ScriptCompiler is MakeRelativeUri function (that is not implemented in Mono).
I attach modified ScriptCompiler.cs and diff to SVN 156.

If smth goes wrong, show errors, please.
 

Attachments

  • ScriptCompiler.cs
    19.9 KB · Views: 29
  • ScriptCompiler.cs.diff.txt
    2.3 KB · Views: 25

RavonTUS

Sorceror
Greetings,

It WORKS! It WORKS!

I will document and post everything on Monday. Thanks guys!

-Ravon

EDIT: GRRR!! I spoke too soon, serialization errors after I create a player, save, and restart...

Code:
  at Server.Mobile.Deserialize (Server.GenericReader) <0xffffffff>
  at Server.Mobile.Deserialize (Server.GenericReader) <0x002ee>
  at Server.Mobiles.PlayerMobile.Deserialize (Server.GenericReader) <0x000bd>
  at Server.World.Load () <0x016bd>
  at Server.ScriptCompiler.Compile (bool,bool) <0x00320>
  at Server.Core.Main (string[]) <0x0086d>
 

Attachments

  • kubuntUO.jpg
    kubuntUO.jpg
    513.8 KB · Views: 79

RavonTUS

Sorceror
Greetings,

Here is as far as I have gotten. The server loads, I can log in. I am down to three things I can't seem to work around. Do you have any suggestions?

ERRORS:
You must have a "SAVE" folder and an account already created. Mono does not seem to support console.Read commnads. One included has an account call ADMIN with a password of ADMIN. (OK, sorta fixed).

GUMPS do not work because it cannot find zlib32.dll, even if it is in the same directory (not sure why not).

WORLDSAVES cause the server to crash on restart - see below. I have tried with and without groboclown's Serialization.cs changes.

Stacktrace:

at Server.Mobile.Deserialize (Server.GenericReader) <0xffffffff>
at Server.Mobile.Deserialize (Server.GenericReader) <0x002ee>
at Server.Mobiles.PlayerMobile.Deserialize (Server.GenericReader) <0x000bd>
at Server.World.Load () <0x016bd>
at Server.ScriptCompiler.Compile (bool,bool) <0x00320>
at Server.Core.Main (string[]) <0x0086d>
at (wrapper runtime-invoke) System.Object.runtime_invoke_void_string[] (object,intptr,intptr,intptr) <0xffffffff>
 

Attachments

  • kubuntUO.zip
    20.7 KB · Views: 48

seirge

Wanderer
Quick solution:

gmcs doesn't understand the different between Function() and Function<T> in derived classes. I try to trace the problem down, but failed.

So, you should rename methods ReadItem<T>, ReadMobile<T> and ReadGuild<T> to smth different. I use ReadItemG<T>, ReadMobileG<T>, ReadGuildG<T>. (it is in Serialization.cs).

Right solution:
- fix this bug in mono. but I can't provide patch. I simply don't know how to fix it.

hope, this help.
(now I'm starting new shard on FreeBSD, hope, it will work).
 

RavonTUS

Sorceror
Greetings,

If I change ReadItem<T>, ReadMobile<T> and ReadGuild<T>, I would have to change them in all the scripts (Scripts Folder) too, correct?

Am I making the correct change?

Code:
#if MONO
        public abstract T ReadItemG<T>() where T : Item;
        public abstract T ReadMobileG<T>() where T : Mobile;
        public abstract T ReadGuildG<T>() where T : BaseGuild;
#else
        public abstract T ReadItem<T>() where T : Item;
        public abstract T ReadMobile<T>() where T : Mobile;
        public abstract T ReadGuild<T>() where T : BaseGuild;
#endif
(and there are several other places to, however, I end up with (after the compile and running runuo.exe)...

Code:
/RunUO-v2.0-SVN159/Scripts/Engines/CannedEvil/ChampionSpawn.cs:
    CS0308: Line 960: The non-generic method `ReadItem' cannot be used with type arguments
    CS0308: Line 961: The non-generic method `ReadItem' cannot be used with type arguments

So, I would then have to change all the "ReadItems" or is this back to the MONO issue of not knowning the difference between Function() and Function<T>?

-Ravon
 

RavonTUS

Sorceror
Greetings,

Nevermind, I think I changed too much stuff. I have gotten serialization.cs to work!

Now just need to figure out how to (or maybe when) to get zlib32.dll to work. Is it part of the compile or how would you add it in?

Code:
Error:
System.DllNotFoundException: zlib32
  at (wrapper managed-to-native) Server.Network.Compressor32:compress2 (byte[],int&,byte[],int,Server.Network.ZLibQuality)

-Ravon
 

seirge

Wanderer
Zlib solution is easy:

These lines in config (mono config, it is located in /etc/mono/)
Code:
<dllmap dll="zlib32" target="libz.so" />
<dllmap dll="zlib32.dll" target="libz.so" />
definitely solve problem for i386 system. (change to zlib64 for amd64 system)

And about prev. hack - yes, i change all scripts not to use functions with the same name. We can always revert it back when mono fixes it.
 

nemeri

Wanderer
Thank you.
I managed to get it running on FC5 after some modifications. The ones listed by GroboClown and Seirge together rendered both the RC1 and the SVN version runnable. Although I also had to skip the console input in the scripts and remove references to PageInfo in PageQueue.cs and MyRunUO in Mobiles.cs . The loading works fine but it cannot start the server again automatically (minor issue though, also due to mono).

* Set CustomPath in Scripts/Misc/DataPath.cs

for Scripts/Misc/AccountPrompt.cs (as noted by RavonTUS)
Code:
00011:			if ( Accounts.Count == 0 && !Core.Service )
			{
+ #if MONO
+				Account a = new Account( "admin", "admin" );
+				a.AccessLevel = AccessLevel.Owner;
+ #else
				Console.WriteLine( "This server has no accounts." );
...
+ #endif
			}

Scripts/Engines/Help/PageQueue.cs
(following the convention of groboclown's ant file)
Code:
+#if !NOREPORTS
00010: using Server.Engines.Reports;
+#endif
...
+#if !NOREPORTS
00045:		private PageInfo m_PageInfo;

		public PageInfo PageInfo
		{
			get{ return m_PageInfo; }
		}
+#endif
...
+#if !NOREPORTS
00134:			if ( m_PageInfo != null )
			{
				lock ( m_PageInfo )
					m_PageInfo.Responses.Add( PageInfo.GetAccount( mob ), text );

				if ( PageInfo.ResFromResp( text ) != PageResolution.None )
					m_PageInfo.UpdateResolver();
			}
+#endif
...
+#if !NOREPORTS
00161:			StaffHistory history = Reports.Reports.StaffHistory;

			if ( history != null )
			{
				m_PageInfo = new PageInfo( this );

				history.AddPage( m_PageInfo );
			}
+#endif

Scripts/Mobiles/PlayerMobile.cs
Code:
+#if MYRUNUO
02957:				Engines.MyRunUO.MyRunUO.QueueMobileUpdate( this );
+#endif


----



However, it does not seem as though the maps are handled correctly. The z levels are wrong here and there, falling through the ground at some but not all places, as well as certain (about half) of the tiles not being passable.

My map definitions:
Code:
			RegisterMap( 0, 0, 0, 7168, 4096, 4, "Felucca",		MapRules.FeluccaRules );
			RegisterMap( 1, 1, 0, 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 );

Renaming the map files in the UO folder with only lowercase characters seems to help somewhat. My less areas are blocked and you do not fall through as frequently, about a loss of 90%. But you still do fall through the floor and run into invisible walls.
 

nemeri

Wanderer
Gumps work by default, however the account list in the admin dialog does not (crashing the server). This is cause it cannot typecast the dictionary's generic ValueCollection into a non-generic ICollection for some reason. Perhaps mono's fault.

fix (but somewhat, not noticably, slower):
Scripts/Accounting/Accounts.cs
Code:
00027:-			return m_Accounts.Values;
+			return new List<IAccount>(m_Accounts.Values);
(You could also change the AdminGump to make it faster, only enumerating the values once but this would cause brittle code).


-----


The documentation generation causes teh server to crash

Scripts/Commands/Docs.cs
Code:
List<Assembly> assemblies = new List<Assembly>();

			assemblies.Add( Core.Assembly );

			foreach( Assembly asm in ScriptCompiler.Assemblies )
				assemblies.Add( asm );

			Assembly[] asms = assemblies.ToArray();

			for( int i = 0; i < asms.Length; ++i )
*				LoadTypes( asms[i], asms );
The marked line causes it with the message
System.NullReferenceException: Object reference not set to an instance of an object
at Server.Commands.Docs.DontLink (System.Type type) [0x00000]
at Server.Commands.Docs.FormatGeneric (System.Type type, System.String& typeName, System.String& fileName, System.String& linkName) [0x00000]
at Server.Commands.Docs+TypeInfo..ctor (System.Type type) [0x00000]
at Server.Commands.Docs.LoadTypes (System.Reflection.Assembly a, System.Reflection.Assembly[] asms) [0x00000]
...
 

RavonTUS

Sorceror
Greetings,

It's been awhile. Here is my latest update. I would agree with nemeri that it works, however, there are alot of holes, invisible blocks, and when you create doors most are off the mark.

I am not sure how to address this issue at this time.

Hopefully, someone smarter than I will be able to use what we have put together and post back here some improvements.

-Ravon

INSTALLATION NOTES:
  • Get SVN 160
  • Copy these files over the top and compile the server.
  • Change datapath.cs to reflect the location of your UO files.

Note: I have used "#if MONO" statement so the files will still work with a Windows base system. If the DEV team would like to add them to the SVN, I would be so honored.
 

Attachments

  • kubuntUO-08MAR2007.zip
    47.6 KB · Views: 88

RavonTUS

Sorceror
Greetings,

Well, I guess I will make one last stab at this and then let it rest for awhile.

It appears that TileMatrix.cs and TileMatrixPatch.cs are written differently for .NET and MONO. This script is needed to correctly read the OSI files and for some reason, it does not appear to be reading static files correctly. You end up with invisible walls, holes in the map and z levels are off.

It appears to me that Runtime.InteropServices is still not supported in MONO v1.2.3.1, so the RunUO devs coded a section for MONO. However, IMHO, it does not work correctly. Maybe MONO has changed since the original coding.

In any case, would someone with more knowledge than me take a look at this section of code and see if you happen to notice why it is not reading the files correctly and maybe suggest a way to add code to help check for upper and lower case file names?

TileMatrix.cs
Code:
#if !MONO
		[System.Runtime.InteropServices.DllImport( "Kernel32" )]
		private unsafe static extern int _lread( IntPtr hFile, void *lpBuffer, int wBytes );
#endif

Code:
#if !MONO
						_lread( m_Statics.SafeFileHandle.DangerousGetHandle(), pTiles, length );
#else
						if ( m_Buffer == null || length > m_Buffer.Length )
							m_Buffer = new byte[length];

						m_Statics.Read( m_Buffer, 0, length );

						fixed ( byte *pbBuffer = m_Buffer )
						{
							StaticTile *pCopyBuffer = (StaticTile *)pbBuffer;
							StaticTile *pCopyEnd = pCopyBuffer + count;
							StaticTile *pCopyCur = pTiles;

							while ( pCopyBuffer < pCopyEnd )
								*pCopyCur++ = *pCopyBuffer++;
						}
#endif

Code:
#if !MONO
					_lread( m_Map.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
#else
					if ( m_Buffer == null || 192 > m_Buffer.Length )
						m_Buffer = new byte[192];

					m_Map.Read( m_Buffer, 0, 192 );

					fixed ( byte *pbBuffer = m_Buffer )
					{
						Tile *pBuffer = (Tile *)pbBuffer;
						Tile *pEnd = pBuffer + 64;
						Tile *pCur = pTiles;

						while ( pBuffer < pEnd )
							*pCur++ = *pBuffer++;
					}
#endif

and here is the TileMatrixPatch.cs
Code:
#if !MONO
		[System.Runtime.InteropServices.DllImport( "Kernel32" )]
		private unsafe static extern int _lread( IntPtr hFile, void *lpBuffer, int wBytes );
#endif

Code:
#if !MONO
							_lread( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192 );
#else
							if ( m_Buffer == null || 192 > m_Buffer.Length )
								m_Buffer = new byte[192];

							fsData.Read( m_Buffer, 0, 192 );

							fixed ( byte *pbBuffer = m_Buffer )
							{
								Tile *pBuffer = (Tile *)pbBuffer;
								Tile *pEnd = pBuffer + 64;
								Tile *pCur = pTiles;

								while ( pBuffer < pEnd )
									*pCur++ = *pBuffer++;
							}
#endif

Code:
#if !MONO
								_lread( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
#else
								if ( m_Buffer == null || length > m_Buffer.Length )
									m_Buffer = new byte[length];

								fsData.Read( m_Buffer, 0, length );

								fixed ( byte *pbBuffer = m_Buffer )
								{
									StaticTile *pCopyBuffer = (StaticTile *)pbBuffer;
									StaticTile *pCopyEnd = pCopyBuffer + tileCount;
									StaticTile *pCopyCur = pTiles;

									while ( pCopyBuffer < pCopyEnd )
										*pCopyCur++ = *pCopyBuffer++;
								}
#endif

Thank you for your help.

-Ravon
 

SysError

Wanderer
i have this errors, when starting server

RunUO - [www.runuo.com] Version 2.0, Build 2641.27108
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (4 errors, 0 warnings)
Errors:
+ /usr/home/uo/TEST/Scripts/Commands/Generic/Extensions/WhereExtension.cs:
CS1706: Line 11: Anonymous methods are not allowed in attribute declaration
+ /usr/home/uo/TEST/Scripts/Commands/Generic/Extensions/DistinctExtension.cs:
CS1706: Line 11: Anonymous methods are not allowed in attribute declaration
+ /usr/home/uo/TEST/Scripts/Commands/Generic/Extensions/LimitExtension.cs:
CS1706: Line 9: Anonymous methods are not allowed in attribute declaration
+ /usr/home/uo/TEST/Scripts/Commands/Generic/Extensions/SortExtension.cs:
CS1706: Line 11: Anonymous methods are not allowed in attribute declaration
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
Error:
System.NullReferenceException: A null value was found where an object instance was required.
at System.TermInfoDriver.ReadKeyInternal () [0x00000]
at System.TermInfoDriver.ReadKey (Boolean intercept) [0x00000]
at System.ConsoleDriver.ReadKey (Boolean intercept) [0x00000]
at System.Console.ReadKey (Boolean intercept) [0x00000]
at Server.Core.Main (System.String[] args) [0x00000]

patching and compiled using your instructions (revision 160)
 

RavonTUS

Sorceror
Greetings,

Sorry, I don't know. I have not ran across that error. I am not sure if BSD vs Linux would make a difference, I know they are "close" but not exactly the same. I would tend to think it is more MONO than the OS.

-Ravon
 

SysError

Wanderer
os: winxp
mono: 1.2.2.1 for windows
rev: 162 patched (kubuntUO-08MAR2007)


C:\162\Server>gmcs -out:../runuo.exe -d:MONO -optimize+ -unsafe -r:System,System
.Configuration.Install,System.Data,System.Drawing,System.EnterpriseServices,Syst
em.Management,System.Runtime.Remoting,System.Runtime.Serialization.Formatters.So
ap,System.Security,System.ServiceProcess,System.Web,System.Web.Services,System.W
indows.Forms,System.Xml -nowarn:219 -recurse:*.cs
.\Serialization.cs(691,18): error CS0117: `T' does not contain a definition for
`Deleted'
.\Serialization.cs(739,18): error CS0117: `T' does not contain a definition for
`Deleted'
.\Serialization.cs(787,18): error CS0117: `T' does not contain a definition for
`Disbanded'
Compilation failed: 3 error(s), 0 warnings
 

RavonTUS

Sorceror
Greetings,

That's odd, maybe because your using Mono for Windows, however, I would not think it would make a difference.

Take a look at the very first post in this thread, under Serialization.CS. The line numbers are a little off. I did not need all the changes, it seemed to work. Maybe I do need this one after all.

-Ravon
 

SysError

Wanderer
under "mono 1.2.3.1 for windows" my scripts compiled without errors
under "mono 1.2.2.1 for windows" that error still available

C:\162\Server>gmcs -out:../runuo.exe -d:MONO -optimize+ -unsafe -r:System,System
.Configuration.Install,System.Data,System.Drawing, System.EnterpriseServices,Syst
em.Management,System.Runtime.Remoting,System.Runti me.Serialization.Formatters.So
ap,System.Security,System.ServiceProcess,System.We b,System.Web.Services,System.W
indows.Forms,System.Xml -nowarn:219 -recurse:*.cs
.\Serialization.cs(691,18): error CS0117: `T' does not contain a definition for
`Deleted'
.\Serialization.cs(739,18): error CS0117: `T' does not contain a definition for
`Deleted'
.\Serialization.cs(787,18): error CS0117: `T' does not contain a definition for
`Disbanded'
Compilation failed: 3 error(s), 0 warnings


if anybody have this error after patching (including Serialization.cs) make sure that you have the latest version of mono (or 1.2.3.1)
 
Top