|
||
|
|||||||
| Other Cant find a category above, use this one! Core mods not listed above go here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Newbie
Join Date: Jan 2006
Posts: 6
|
Here's a list of the patches I made to get RunUO 2.0 RC1 running on Linux (tested with Mono 1.1.14). I can't guarantee that it's as stable as the non-patched version, but it compiles and runs, at least.
Network/Listener.cs: Code:
@@ -93,8 +93,10 @@
try
{
+#if !MONO
s.LingerState.Enabled = false;
s.ExclusiveAddressUse = false;
+#endif
s.Bind( ipep );
Code:
@@ -87,4 +87,8 @@
public static FileStream OpenSequentialStream( string path, FileMode mode, FileAccess access, FileShare share ) {
+
+#if MONO
+ return new FileStream( path, mode, access, share, bufferSize, concurrency > 0 );
+#else
FileOptions options = FileOptions.SequentialScan;
@@ -92,8 +96,5 @@
options |= FileOptions.Asynchronous;
}
-
-#if MONO
- return new FileStream( path, mode, access, share, bufferSize, options );
-#else
+
if ( unbuffered ) {
options |= NoBuffering;
Code:
@@ -76,5 +76,9 @@
);
+#if MONO
+ PerformanceCounterCategory.Create( PerformanceCategoryName, PerformanceCategoryDesc, counters );
+#else
PerformanceCounterCategory.Create( PerformanceCategoryName, PerformanceCategoryDesc, PerformanceCounterCategoryType.SingleInstance, counters );
+#endif
}
Code:
[@@ -672,5 +672,5 @@
for( int i = 0; i < list.Count; )
{
- if( list[i].Deleted )
+ if( ((Item) list[i]).Deleted )
list.RemoveAt( i );
else
@@ -720,5 +720,5 @@
for( int i = 0; i < list.Count; )
{
- if( list[i].Deleted )
+ if( ((Mobile) list[i]).Deleted )
list.RemoveAt( i );
else
@@ -768,5 +768,5 @@
for( int i = 0; i < list.Count; )
{
- if( list[i].Disbanded )
+ if( ((BaseGuild)list[i]).Disbanded )
list.RemoveAt( i );
else
@@ -968,15 +968,15 @@
public override T ReadItem<T>()
{
- return ReadItem() as T;
+ return (T) ReadItem();
}
public override T ReadMobile<T>()
{
- return ReadMobile() as T;
+ return (T) ReadMobile();
}
public override T ReadGuild<T>()
{
- return ReadGuild() as T;
+ return (T) ReadGuild();
}
@@ -1057,5 +1057,5 @@
for( int i = 0; i < count; ++i )
{
- T item = ReadItem() as T;
+ T item = ReadItem<T>();
if( item != null )
@@ -1091,5 +1091,5 @@
for( int i = 0; i < count; ++i )
{
- T m = ReadMobile() as T;
+ T m = ReadMobile<T>();
if( m != null )
@@ -1125,5 +1125,5 @@
for( int i = 0; i < count; ++i )
{
- T g = ReadGuild() as T;
+ T g = ReadGuild<T>();
if( g != null )
@@ -1589,5 +1589,5 @@
for( int i = 0; i < list.Count; )
{
- if( list[i].Deleted )
+ if( ((Item)list[i]).Deleted )
list.RemoveAt( i );
else
@@ -1637,5 +1637,5 @@
for( int i = 0; i < list.Count; )
{
- if( list[i].Deleted )
+ if( ((Mobile)list[i]).Deleted )
list.RemoveAt( i );
else
@@ -1685,5 +1685,5 @@
for( int i = 0; i < list.Count; )
{
- if( list[i].Disbanded )
+ if( ((BaseGuild)list[i]).Disbanded )
list.RemoveAt( i );
else
Code:
@@ -316,4 +316,7 @@
int i;
+ if( value == null || value.Length <= 0 )
+ return -1;
+
if( value.StartsWith( "0x" ) )
int.TryParse( value.Substring( 2 ), NumberStyles.HexNumber, null, out i );
@@ -371,10 +374,18 @@
catch
{
- DateTime d;
-
- if( DateTime.TryParse( dateTimeString, out d ) )+#if MONO
+ try {
+ DateTime d = DateTime.Parse( dateTimeString );
return d;
+ } catch (Exception e) {
+ return defaultValue;
+ }
+#else
+ DateTime d;
- return defaultValue;
+ if( DateTime.TryParse( dateTimeString, out d )
) return d;
+
+ return defaultValue;
+#endif
}
}
|
|
|
|
|
|
#3 (permalink) |
|
Forum Newbie
Join Date: Mar 2005
Age: 23
Posts: 10
|
Hey man, thanks for the mono patches.
I got the sourcecode to compile, but unfortunately I couldn't get the binary to run. It gives the following error: Code:
Error: System.EntryPointNotFoundException: SetConsoleCtrlHandler at (wrapper managed-to-native) Server.Core:SetConsoleCtrlHandler (Server.Core/ConsoleEventHandler,bool) at Server.Core.Main (System.String[] args) [0x00000] This exception is fatal, press return to exit Any help on this would be greatly appreciated ![]() |
|
|
|
|
|
#4 (permalink) |
|
Forum Newbie
Join Date: Jan 2006
Posts: 6
|
I had to manually add the "-define:MONO" argument to the mono compiler to avoid getting these bits compiled into the binary. I wrote a custom NANT script to help out with all of this.
Note that the default scripts need lots of work, as well. I'm going to move up to the SVN version and Mono 1.1.17. I'll post my customizations as I go along. |
|
|
|
|
|
#7 (permalink) |
|
Forum Novice
|
I haven't had any luck getting it to work with 1.1.18, though it may just be me. RunUO starts fine, but once it starts to compile the scripts it crashes. I'd post the error but I'm not on my linux computer right now. I haven't really had a chance to look into the problem yet, please let me know if you have any ideas on this.
I hadn't tried running RunUO 2.0 under mono until this latest version came out, so it's very possible that the error is on my end. Though I'm using a stock core with only these patches applied. I'll mess with it some more tomorrow. ![]() EDIT: Ok here's the error: Code:
> mono RunUO.exe RunUO - [www.runuo.com] Version 2.0, Build 2480.29346 Core: Running on .NET Framework Version 2.0.50727 Scripts: Compiling C# scripts...Error: System.Exception: Compiler failed to produce the assembly. Stderr='', Stdout='' at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compile r.CompilerParameters options, System.String[] fileNames) [0x00000] at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom .Compiler.CompilerParameters options, System.String[] fileNames) [0x00000] at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.Cod eDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00000] at Server.ScriptCompiler.CompileCSScripts (Boolean debug, System.Reflection.As sembly& assembly) [0x00000] at Server.ScriptCompiler.Compile (Boolean debug) [0x00000] at Server.Core.Main (System.String[] args) [0x00000] This exception is fatal, press return to exit ** (RunUO.exe:16940): WARNING **: exception inside UnhandledException handler: C annot cast from source type to destination type.
__________________
Make music online with Splice! Last edited by TheNorthStar; 10-19-2006 at 02:59 PM. |
|
|
|
|
|
#8 (permalink) |
|
Forum Novice
|
Well I give up for now, this is frustrating me too much. I'll try installing 1.1.17 next time I get a chance. Has anyone had any success with 1.1.18?
EDIT: I think the problem must be my own, I tried installing 1.1.17 and got the same error. So now I don't even have a clue what to do. ![]() EDIT 2: Well here's the line that causes the problem: Code:
CompilerParameters parms = new CompilerParameters( GetReferenceAssemblies(), path, debug );
string defines = GetDefines();
if ( defines != null )
parms.CompilerOptions = string.Format( "/define:{0}", defines );
CompilerResults results = provider.CompileAssemblyFromFile( parms, files );
__________________
Make music online with Splice! Last edited by TheNorthStar; 10-19-2006 at 10:36 PM. |
|
|
|
|
|
#10 (permalink) |
|
Forum Expert
|
Greetings,
I used RunUO SVN 120 and MONO 1.2.2.1 and most of the fixes above. It will compile up to this point (see below). The error is a known bug in mono and there is a code fix for it. However, I am not knowledgable enought to apply it. Would someone have a minute to look at the Mono Fix here, and apply it to the code below? Error Message: Code:
./Utility.cs(1096,104): error CS0030: Cannot convert type `TInput' to `TOutput' ./Utility.cs(1096,104): The type has two conflicting definitions, one comes from .test, Version=0.0.0.0, Culture=neutral and the other from .test, Version=0.0.0.0, Culture=neutralerror) Code:
public static List<TOutput> CastConvertList<TInput, TOutput>(List<TInput> list) where TOutput : TInput
{
return list.ConvertAll<TOutput>
(new Converter<TInput, TOutput>
(delegate(TInput value)
{
//./Utility.cs(1096,28): error CS0030: Cannot convert type `TInput' to `TOutput'
return (TOutput)value; //<-- This is 1096
}
)
);
}
public static List<TOutput> SafeConvertList<TInput, TOutput>(List<TInput> list) where TOutput : class
{
List<TOutput> output = new List<TOutput>(list.Capacity);
for (int i = 0; i < list.Count; i++)
{
TOutput t = list[i] as TOutput;
if (t != null)
output.Add(t);
}
return output;
}
-Ravon
__________________
Last edited by RavonTUS; 12-21-2006 at 03:23 PM. Reason: Update |
|
|
|
|
|
#11 (permalink) |
|
Forum Expert
|
How do I compile RunUO with Mono? I have never compiled a application bigger than 1 file before... Im running mono 1.1.17.1 on Ubuntu Linux.
Thanks, Nott32.
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh. |
|
|
|
|
|
#14 (permalink) |
|
Forum Expert
|
Greetings,
It COMPILED!! However, it still doesn't work. I managed to use MonoDevelop to compile the files and after several modification as posted above it did compile. However, when I open the console and run the file I end up with the following message... Code:
root@ubuntu://RunUO-v2.0-SVN# mono RunUOv2r129-Mono.exe Error:System.EntryPointNotFoundException: SetConsoleCtrlHandler at (wrapper managed-to-native) Server.Core:SetConsoleCtrlHandler (Server.Core/ConsoleEventHandler,bool) at Server.Core.Main (System.String[] args) [0x00000] This exception is fatal, press return to exit ** (RunUOv2r129-Mono.exe:6708): WARNING **: exception inside UnhandledException handler: Cannot cast from source type to destination type. -Ravon |
|
|
|
|
|
#16 (permalink) | |
|
Forum Newbie
Join Date: Jan 2006
Posts: 6
|
Quote:
|
|
|
|
|
|
|
#17 (permalink) |
|
Forum Expert
|
Greetings,
OK, I don't quite understand the NANT, I tried that and came up with this. I would assume I am not getting the subdirectories. What command should I be using? Code:
nant -buildfile:RunUO.build *.cs NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///Projects/RunUOv2r129/RunUOv2r129/RunUO.build Target framework: Mono 2.0 Profile Target(s) specified: AggressorInfo.cs AssemblyInfo.cs Attributes.cs BaseVendor.cs Body.cs ClientVersion.cs Commands.cs Effects.cs EventLog.cs EventSink.cs ExpansionInfo.cs Geometry.cs Guild.cs HuePicker.cs IAccount.cs IEntity.cs Insensitive.cs Interfaces.cs ItemBounds.cs Item.cs KeywordList.cs Main.cs Map.cs Mobile.cs Movement.cs MultiData.cs Notoriety.cs ObjectPropertyList.cs Party.cs Point3DList.cs Poison.cs Prompt.cs QuestArrow.cs Race.cs Region.cs ScriptCompiler.cs Sector.cs SecureTrade.cs Serial.cs Serialization.cs Skills.cs TileData.cs TileList.cs TileMatrix.cs TileMatrixPatch.cs Timer.cs Utility.cs VirtueInfo.cs World.cs BUILD FAILED Target 'AggressorInfo.cs' does not exist in this project. Total time: 0 seconds. The build file must be in the same directory a the folders - Server, Scripts and DATA. However, you still get the following error... Code:
BUILD FAILED - 0 non-fatal error(s), 62 warning(s) /home/test/runuo/RunUO-v2.0-SVN/RunUO.build(25,10): External Program Failed: /usr/local/lib/pkgconfig/../../lib/mono/2.0/gmcs.exe (return code was 1) Code:
<target name="compile:server">
<csc debug="${debug}" unsafe="true" target="exe"
main="Server.Core" win32icon="${src.ico}"
define="MONO"
output="${out.server}">
<sources>
<include name="${src.server}/**/*.cs" />
</sources>
</csc>
</target>
-Ravon
__________________
Last edited by RavonTUS; 01-17-2007 at 08:48 AM. |
|
|
|
|
|
#18 (permalink) |
|
Newbie
Join Date: Aug 2004
Age: 24
Posts: 35
|
Compilation can be easyly achieved by the following command
Code:
gmcs -out:../RunUO.exe -d:MONO -optimize+ -unsafe -nowarn:219,169,414 -recurse:*.cs It should be done in core folder (and it will create RunUO.exe file one directory above) But you should change some core scripts (as mentioned in previous posts). But compiled exe wouldn't work as expected. I managed to edit source code so it is running: 2 patches should be done to mono (already in Mono SVN, waiting for mono 1.2.3) and several #if MONO #endif in RunUO Core. The main questiong is: can patches to core be reviewed by RunUO Core team and add to RunUO SVN? Then several users of Linux will be able to run RunUO. Or such changes are unsupported by RunUO team? Last edited by seirge; 01-31-2007 at 12:47 AM. |
|
|
|
|
|
#19 (permalink) |
|
Forum Expert
|
Greetings,
Seirge can you post your "utility.cs" script from /server? I would like to see how your getting the "public static List<TOutput> CastConvertList<TInput, TOutput>(List<TInput> list) where TOutput : TInput" to work. This is the point at which I am stuck. I have tried the latest version of Mono (SVN) and it still doesn't seem to help. I keep ending up with one of the two following errors... Code:
System.Exception: Compiler failed to produce the assembly. Stderr='', Stdout='' Code:
System.InvalidCastException: Cannot cast from source type to destination type.
__________________
|
|
|
|
|
|
#20 (permalink) |
|
Newbie
Join Date: Aug 2004
Age: 24
Posts: 35
|
here is it:
Code:
#if MONO
public static List<TOutput> CastConvertList<TInput, TOutput>( List<TInput> list )
where TInput : class
where TOutput : class
{
return list.ConvertAll<TOutput>( new Converter<TInput, TOutput>( delegate( TInput value ) { return value as TOutput; } ) );
}
#else
public static List<TOutput> CastConvertList<TInput, TOutput>( List<TInput> list ) where TOutput : TInput
{
return list.ConvertAll<TOutput>( new Converter<TInput, TOutput>( delegate( TInput value ) { return (TOutput)value; } ) );
}
#endif
Of course, you should define MONO symbol while compiling. |
|
|
|
|
|
#21 (permalink) |
|
Forum Expert
|
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
__________________
|
|
|
|
|
|
#23 (permalink) |
|
Newbie
Join Date: Aug 2004
Age: 24
Posts: 35
|
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. |
|
|
|