Author Topic: Mono  (Read 5730 times)

d0k

  • Guest
Mono
« on: July 26, 2008, 05:37:11 AM »
I thought it would be great to run dyson on linux or mac, tried it and failed. Then I ran it through MoMA and saw: Oh, there is a P/Invoke down in Wuwei.dll. I fired up .NET Reflector and the unportable class looked suspicously like the QueryPerfCounter from msdn. So I've googled some time and eventually found a class which offers the same methods as the p/invoked methods: System.Diagnostics.Stopwatch

Code: [Select]
namespace Wuwei.Core {
using System;
using System.Diagnostics;

public class PrecisionTimer
{
private static readonly Decimal multiplier = new Decimal(1.0e9);
private long start, stop;

public void Start()
{
start = Stopwatch.GetTimestamp();
}

public void Stop()
{
stop = Stopwatch.GetTimestamp();
}

public double Duration(int iterations)
{
return ((((double)(stop - start) * (double)multiplier) / (double)Stopwatch.Frequency)/iterations);
}
}
}
Then I patched it into Wuwei.dll and Dyson ran flawlessly :D

Some hints:
  • You will need the *.dll.config files from SdlDotNet, get them from their websites
  • Under OS X you will need a application bundle or you will encouter some very strange bugs, you may use macpack to create one

Other Dependencies:
  • mono (duh). 1.9.1 worked great for me
  • SDL, SDL_image, SDL_mixer and SDL_gfx
  • libvorbis and libpng
If you're running linux you may get all that stuff from the package manager of your distribution.

If you are ready you can start Dyson in the shell with mono Dyson.exe

Edit: cleanup
Edit2: submitted the patch to the Wuwei tracker, hope they will notice it

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: Mono
« Reply #1 on: July 28, 2008, 11:37:20 PM »
Hi d0k,

As I have said in my email, many many thanks for this. I've applied the patch to the source database now.

I've been looking into it for Mac but my bash is /crap/ so I've not been able to get macpack to respond to my desires.

So, let me get this straight... To make a Mono release, I need to have:
  • Include the game, the resources, my DLLs
  • Include the dll.config files for SDL.NET and Tao
  • Platform specific dependencies - with Windows releases, these are just DLLs I include but for other platforms I guess people may have to install some things - is there a way I can automate this for Linux / Mac? on Windows I can distribute the DLL dependencies and make a game installer with Innosetup that downloads .NET 2.0 framework so the user doesn't have to go searching for it. I guess I could distribute Mono with the game.
  • If not, then I need to tell users that they need to get the SDL dependencies and vorbis/png libs
  • For Mac I need to macpack the whole lot up into a .app file, for Linux just set it all into a tarball and distribute

Anyway this has given me new fervour. I'll try to get a release of Dyson working on the Mac at least. This MoMA and .NET reflector sound interesting.

zlowred

  • Guest
Re: Mono
« Reply #2 on: November 30, 2008, 04:06:27 AM »
Quote from: "d0k"
Some hints:
  • Under OS X you will need a application bundle or you will encouter some very strange bugs, you may use macpack to create one
Hi d0k!
Can you explain what you exactly did to create OS X App Bundle using macpack?
I'm new to using mono. I managed to run version 1.08 under OS X using mono but i can't create app bundle.

Running from command-line leads to mouse problems (is this "strange bugs" you've told about?

Thanks