kubuntUO - RunUO linux for human beings

Wednesday, January 31, 2007

GMCS - Update

Greetings,

I have make a little bit of progress by modifying the compile command. I am now using this...

$ gmcs -out:../runuo.exe -d:MONO -optimize+ -unsafe -r:System.Drawing,System.Web,System.Windows.Forms,System.Xml -nowarn:219 -recurse:*.cs
I have now come to believe that when you compile RunUO on a Linux box, you must compile everything (server, scripts and data folders) all at the same time. Unlike Microsoft, where you compile the server, then the server.exe compiles the scripts and data folders.

This being the case I have had to make the following changes...

Remove the MyRunUO folder from /scripts/engines and modifying the playermobile.cs around line 2953 (see below).
public void InvalidateMyRunUO()
{
if ( !Deleted && !m_ChangedMyRunUO )
{
m_ChangedMyRunUO = true;
#if !MONO
Engines.MyRunUO.MyRunUO.QueueMobileUpdate( this );
#endif
}
}
I also modified the DataPath.cs. I am not sure if this is needed, but for the sake of making sure to find the files, I changed it. Look around line 16. Enter you Wine folder and path to UO.

* private const string CustomPath = @"C:\Program Files\Ultima Online";
*/
private static string CustomPath = @"/home/test/.wine/drive_c/Program Files/EA Games/Ultima Online Mondain's Legacy";

/* The following is a list of files which a required for proper execution:
*
* Multi.idx



It will now compile (using Mono SVN 20070131), after running the MONO RunUO.exe I get the follow error.

[www.runuo.com] Version 2.0, Build 2587.16047
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...no files found.
Scripts: Compiling VB.NET scripts...no files found.
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.InvalidCastException: Cannot cast from source type to destination type.
at System.TermInfoDriver.WriteConsole (System.String str) [0x00000]
at System.TermInfoDriver.Init () [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]
This exception is fatal, press return to exit

** (RunUO.exe:6444): WARNING **: exception inside UnhandledException handler: Object reference not set to an instance of an object


I still think the section in red is related to the TInput/TOut, not working in Mono. I have submitted this as a bug to the MONO team.

Any suggestions?

-Ravon

Tuesday, January 16, 2007

NANT

Greetings,

Following the suggestion of ??, I tried a program called NANT. I placed this file in the directory, so that it could see the following folders, Server, Scripts, and Data.

Simple enter the command...

$ nant
Here is the resulting error...

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)

Total time: 3.7 seconds.

Here is the section of 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


Any Suggestion?

-Ravon

GMCS

Greetings,

My next attempt is to compile using GMCS. Here is the command...

$ gmcs -define:MONO -debug -nologo -out:./test.exe -unsafe -recurse:*.cs
This begins to compile, but it will abort with this error message...
./Utility.cs(388,34): warning CS0168: The variable `e' is declared but never used
./Utility.cs(1098,109): error CS0030: Cannot convert type `TInput' to `TOutput'
./Utility.cs(1098,109): 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)
Compilation failed: 1 error(s), 5 warnings
Here is the section of code...

public static List CastConvertList(List list) where TOutput : TInput
{
return list.ConvertAll(new Converter(delegate(TInput value) { return (TOutput)value; }));
}

public static List SafeConvertList(List list) where TOutput : class
{
List output = new List(list.Capacity);

for (int i = 0; i < list.Count; i++)
{
TOutput t = list[i] as TOutput;

if (t != null)
output.Add(t);
}

return output;
}

Any Suggestions?

-Ravon



MonoDevelop

Greetings,

Using MonoDevelop, you first need to start a project and then change some of the default settings.

Starting a Project:

  1. Open MonoDevelop
  2. Select File, New Project.
  3. Click "Console Project"
  4. Enter a Name (for example "RunUOv2-Mono")
  5. Click New.

Default Settings
  1. Switch to .Net 2, instead of .Net 1 - Do this by click Project, then Options. Under Genernal, Runtime Options, select 2.0.
  2. Allow Unsafe Code - On the same screen, go to Configuration, Debug, Code Generation. Check "Allow Unsafe Code". Do the same under Release.
  3. Save your settings.
Import Files:
  1. Right click in the "Solutions" pane and add your "*.cs" files.
  2. Right click in the "Solutions" pand and add each folder (ContextMenus, Gumps, Items, Menus, Network, and Persistence.
  3. Now add the files under the folders.
  4. Right click on "References", then Edit References. Add all the "System.???" files. I also threw in the ones call "Microsoft.???".
  5. Save your settings.
Now you can make modification to your server scripts. After all my changes (see in other posts), I can compile the files and create an .exe. However, it will fail when it runs.

If I run the files in MonoDevelop this is the error I get...

RunUO - [www.runuo.com] Version 2.0, Build 2572.23833
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.Compiler.CompilerParameters options, System.String[] fileNames) [0x00255] in /home/test/src/mono-1.2.2.1/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:235
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00012] in /home/test/src/mono-1.2.2.1/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:138
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00014] in /home/test/src/mono-1.2.2.1/mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs:119
at Server.ScriptCompiler.CompileCSScripts (Boolean debug, Boolean cache, System.Reflection.Assembly& assembly) [0x00197] in /home/test/Projects/RunUOv2-MD/RunUOv2-MD/ScriptCompiler.cs:227
at Server.ScriptCompiler.Compile (Boolean debug, Boolean cache) [0x00034] in /home/test/Projects/RunUOv2-MD/RunUOv2-MD/ScriptCompiler.cs:529
at Server.Core.Main (System.String[] args) [0x002ac] in /home/test/Projects/RunUOv2-MD/RunUOv2-MD/Main.cs:427
This exception is fatal, press return to exit

Any suggestions?

-Ravon

3 Ways to Failure

Greetings,

I have cleaned up our little blog here and have deciede to post my findings at this point in time.

There are 3 ways to complie RunUO, using MonoDevelop, GMCS, and NANT. So far, none have been successful. In the next three post, I will discuss how I setup up kubuntu and the finial results.

Mono - http://kubuntuo.blogspot.com/2007/01/monodevelop.html
GMCS - http://kubuntuo.blogspot.com/2007/01/gmcs.html
NANT - http://kubuntuo.blogspot.com/2007/01/nant.html

-Ravon

Notes: Install NVidia Driver

Greetings,

This is a personal note, I can never seem to find how to update my Nvidia drivers for kubuntu.

How to install Graphics Driver (NVIDIA)

sudo apt-get install nvidia-glx nvidia-kernel-common
sudo nvidia-xconfig


-Ravon

Friday, January 05, 2007

Notes: Compiling RunUO with MonoDevelop

Greetings,

I am now trying to compile the RunUO source using MonoDevelop. I have set the runtime option to v2.0 (for .net2) and checked "Allow unsafe code", in the options section of MonoDevelop.

After a long and manual process of importing the files, I have this error when I go to compile the program...

Type=Error, Description=The type or namespace name `Xml.XPath' could not be found. Are you missing a using directive or an assembly reference?(CS0246)

Here is the code...

using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using Server.Network;
using Server.Targeting;

namespace Server
{
public enum MusicName
{

It's just a "using" statement. I have searched and it appears that XML should be supported, but it too just doesn't work. Any ideas? Anyone?

-Ravon

UPDATE:

I found the answer at the follow website. You must turn on System.XML, not just add it in your statements.

http://www.nabble.com/monodevelop-not-finding-System.Xml-tf1810135.html

Well it's not something you do in the source code, but in the project:

Right-click the project icon/name in the solution tree and choose "Add
Reference". In the upcoming dialog, select the System.Xml.dll in the
appropriate list and click OK.

That's it. And is very similar to what you have to do in VS.NET, the
difference here is that VS.NET assumes a LONG list of implicit
references, that include that dll, and MD want you to be explicit,
because that way compilation will be faster (noticeably) as well as it
will reduce the application startup time (not so noticeably).