Support for dot42

Is here currently anyone working on a “port” to android using dot42?

I only found a post on codeplex: https://monogame.codeplex.com/discussions/432240.

Any other news / trys / hints to port monogame to dot42?

(Since there isn’t any other Thread about it, why not start one :stuck_out_tongue: )

They still don’t support struct from what I can see, so still not happening.

There is an old blog post: http://blog.dot42.com/2013/04/10064-whats-new.html

Quote from dot42 blog:

“We added support for several .NET types (including System.TimeSpan) and improved and fixed the support of many base types such as System.Double and System.Float. With these improvements come various compiler fixes related to structs. Note that this does not mean that structs are now fully supported.”

But maybe the structs are supported enough for monogame?

Are there any special struct-types?

Give it a go if you want, but we need full struct support AFAIK.

Yea… we need full support for Struct types.

I may give it try.

If I would target Dot42, I would have to create an other android dot42 project , and than try to compile it?

Or should I use protobuild to add a dot42 project and then try it to port?

Or better asked, is there any tutorial / hint on how to add / test a different/new target?

Sooo after some hours of testing, here’s my current result:

  1. Tests on Dot42 itself:
  • :ballot_box_with_check: Dot42 can reference normal and Dot42- Class Libraries
  • :ballot_box_with_check: For me structs are working, I tried to several structs to compile, no errors, also created a struct “object” during runtime with Dot42 and also no errors here
  1. I could create a Protobuild Target for Dot42 (just copy+paste of Android, to get an Android.Dot42 Project)

Current Errors / stuff prevent from compiling:

  1. I need to add many project properties to the generated csproj in order to transform it to a Dot42-ClassLibrary:

    $(TargetFrameworkVersion)

    false
    false
    .apk

    $(Registry:HKEY_CURRENT_USER\SOFTWARE\dot42\Android@ExtensionsPath)
    $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\dot42\Android@ExtensionsPath)



Any tips on how to add them with Protobuild?
I couldn’t find anything for this.

******2. Namespace Chaos… (I think this example should be enough to explain, so that I don’t have to xD):
Xamarin: Android.OS.Build.Model
Dot42: Android.Os.Build.MODEL

Since I don’t want to copy all Android Files and change the namespaces inside the copies or to have million of #if ANDROID || ANDROID_DOT42 inside all Android-Specific Classes.

So I think a “good” workaround would be to go the same way as OpenTK does and have an own Namespace / Classes “Mockup”, and inside this file/files we could either use Xamarin Android Namespace or Dot42.

I hope my explanation is understandable :smile:, or do you have a better Idea?

******3. No OpenTK for Dot42, but if we go like in 2. explained, the main Android Classes wouldn’t need any OpenTK references, just the Mockup. Just looked at some classes and most of the OpenTK Classes are just a “link” to OpenGL and stuff?

Except an AndroidGameView which is from OpenTK, so this one should be created as a Dot42 Version.

******4. Some Classes using “Java.Lang.Object” as Base, in Dot42 there is no “Java.Lang.Object” exposed to .Net, I think the .Net Object will be transformed to a Java.Lang.Object while compiling with Dot42. This could be also handled by 2.

As soon as we have a solution for Number 1 and 2 , I’ll try more to create this port :smile:

I tried to compile OpenTK to Dot42 and failed big. xD

OpenTK uses very often MarshalAs, IntPtr and many other things that Dot42 doesn’t support. Tried it for 2 hours but now I surrender.

Now looking at MonoGame.Framework, it uses OpenTK a lot… so no OpenTK on Dot42 means no MonoGame on Dot42.

Atleast with my noob Knowledge of MonoGame, OpenTK and Dot42 it is rather impossible .

Too bad, I hope that someday someone can port OpenTK to Dot42, and once this is done, the Port of MonoGame should be “easy”.

How does Dot42 provide OpenGL access then?

If Dot42 doesn’t provide it and it can’t marshal to native code then you are stuck.

I think all C# OpenGL calls , will be replaced with the Java-Side, and then there is no need for MarshalAs, since it will be “native”.

Soon Dot42 is going to be released as opensource. Maybe after that Me or anybody else, will try it again. :slight_smile: