User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19

Thread: C++ Extension to Java template converter

  1. #1
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    C++ Extension to Java template converter

    I realized that the majority of the time taken on converting most extensions to java is spent on implementing the jump tables and creating the functions and getting the parameters.

    This program takes your C++ MMF2 extension source code folder and generates a template Java file automatically. It does the following for you:
    • Creates constants for each condition/action/expression
    • Implements getNumberOfConditions()
    • Implements the 'action','condition' and 'expression' functions.
    • Generates functions for all your conditions, actions and expressions with the same names as in you C++ source code.
    • Gets the parameters automatically for you
    Here is an example on how it works:
    Example main.cpp (simplified for your sake)
    Generated Java template from the main.cpp file

    Here is the program:

    ExtensionToJava.exe (Requires .NET 3.5 runtime. You should already have it)
    Source code (Visual Studio Project)

    EDIT: It now also parses rSDK.



  2. #2
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: C++ Extension to Java template converter

    Wonderful! That will help a lot developers to convert their extensions!

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: C++ Extension to Java template converter

    Quote Originally Posted by Andos
    I could expand it to parse rSDK as well if anyone want it.
    Please do!

  4. #4
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: C++ Extension to Java template converter

    I updated it to also parse the rSDK now. I had no other test-projects than the rSDK template to work with, so please test it on your own rSDK extensions

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Sep 2006
    Location
    Norway
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: C++ Extension to Java template converter

    cool!
    Jean Villy Edberg

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: C++ Extension to Java template converter

    I tried it with many rSDK extensions and all of them return unhandled exceptions.

    This is what it gave me (German...):

    Code:
    System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
       bei ExtensionToJava.RsdkProcessor.ParseExtension(FileInfo maincpp)
       bei ExtensionToJava.ConverterDialog.toolGenerateTemplate_Click(Object sender, EventArgs e)
       bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       bei System.Windows.Forms.Control.WndProc(Message& m)
       bei System.Windows.Forms.ToolStrip.WndProc(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  7. #7
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: C++ Extension to Java template converter

    Can you send me your main.cpp file? (maybe just a stripped version of it without the implementation code)
    Thanks

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: C++ Extension to Java template converter

    I tracked down the problem. Just add some lines of code before the first CONDITION().

    Example:

    PHP Code:
    // ============================================================================
    //
    // This file contains the actions, conditions and expressions your object uses
    // 
    // ============================================================================

    #include "common.h"

    int foobar() {      //
        
    return 100// This part will cause the exception
    }                   //

    // ============================================================================
    //
    // CONDITIONS
    // 
    // ============================================================================

    CONDITION(
        
    /* ID */            0,
        
    /* Name */            "%o: %0 == %1",
        
    /* Flags */            EVFLAGS_ALWAYS|EVFLAGS_NOTABLE,
        
    /* Params */        (2,PARAM_NUMBER,"First number",PARAM_NUMBER,"Second number")
    ) {
        
    int p1=Param(TYPE_INT);
        
    int p2=Param(TYPE_INT);
        
        return 
    p1==p2;


  9. #9
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: C++ Extension to Java template converter

    Ah sorry, slight mistake in the parsing grammar. Will fix it soon

  10. #10
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: C++ Extension to Java template converter

    Try it again, I fixed the crash + another bug. :-)

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Request Java Extension
    By Shadows_G26 in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 30th August 2011, 06:43 AM
  2. C++ Extension to Java/Flash Template Generator 1.3
    By Anders in forum Extension Development
    Replies: 1
    Last Post: 16th July 2010, 03:13 AM
  3. C++ Extension to Java template generator
    By Anders in forum Extension Development
    Replies: 3
    Last Post: 1st June 2009, 09:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •