User Tag List

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

Thread: Unicode Programming Help Visual C and Objective C :)

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleUnicode Add-on
    Tim's Avatar
    Join Date
    Apr 2007
    Location
    NSW - Australia
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Unicode Programming Help Visual C and Objective C :)

    Hey guys,
    I'm trying to build my first Unicode compatible extension and was wondering if someone can help me
    (hinting at Francois, Anders, Yves, and anyone else who can help )

    Is it possible for someone to provide sample source code on how to:

    1. Create a property using EDIF (Visual C++ source code would be great)
    2. Determine if the user is using the Unicode version, (Visual C++ code)
    3. Do I need to handle the data differently if it is the unicode version (Visual C++), i.e. different variables types? (char* for non unicode, wchar_t* for unicode??)
    4. Is ho->hoAdRunHeader->rhApp->bUnicode the correct statement in Objective C to use to check for unicode?
    5. Read in the property in both Visual C++ and Objective C

    Sorry if the list is extensive :P

    Kind Regards
    Tim

  2. #2
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    In the C++ version:
    Just make a habit of using the T_CHAR type. If the build-mode is set to 'Unicode' then T_CHAR will resolve to a 16bit sized character, if not it will just resolve to a regular 'char'.
    Also use functions such as '_tcscmp' instead of 'strcmp' as it uses the same compile-time macro trick. (http://msdn.microsoft.com/en-us/libr.../e0z9k731.aspx)

    In Objective-C:
    The CFile class handles everything automatically concerning unicode and strings. Just just it's "readAString" functions (and similar). It knows the unicode setting already.
    Behind the scenes the iOS runtime is fully unicode

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleUnicode Add-on
    Tim's Avatar
    Join Date
    Apr 2007
    Location
    NSW - Australia
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the TCHAR tip Anders

    Can I get any help at making a property with EDIF?
    I've tried several times but failed

    Regards
    Tim

  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)
    AFAIK making properties in EDIF is exactly the same as making them with the official SDK.

  5. #5
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Check out the example properties in my fork of EDIF:
    https://github.com/LB--/windows-edif...Properties.cpp
    It is true that it is the same as in rSDK, but that doesn't mean you already know how to do it. Hopefully one day I will get around to writing the Wiki article on it.

    You don't determine if the user is using unicode; you tell MMF2 whether a particular version of your MFX file is meant for Unicode; you can use the macros defined by the build configurations (just check if _UNICODE is defined).

    As for saving/loading properties, that has to do with the editdata - that gets complicated, but I've tried to simplify it in my fork of EDIF. Basically you have to store everything in a serialized state as though it were in a file.
    Working as fast as I can on Fusion 3

  6. #6
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I just look at some code for detecting it and I got the following (this is for an extension that looks at internal structures and so must know if it is unicode version or not at runtime):



    #define EF_ISUNICODE 113 // Returns TRUE if the editor or runtime is in Unicode mode
    #define EF_GETAPPCODEPAGE 115 // Returns the code page of the application
    __inline BOOL mvIsUnicodeVersion(LPMV mV) \
    { return mV->mvCallFunction(NULL, EF_ISUNICODE, (LPARAM)0, (LPARAM)0, (LPARAM)0); }
    __inline int mvGetAppCodePage(LPMV mV, LPVOID pApp) \
    { return mV->mvCallFunction(NULL, EF_GETAPPCODEPAGE, (LPARAM)pApp, (LPARAM)0, (LPARAM)0); }




    void toMultiByte( LPRDATA rdPtr, const char* source , int nchars, char* dest ) {


    LPMV pMV = rdPtr->rHo.hoAdRunHeader->rh4.rh4Mv;
    if ( mvIsUnicodeVersion(pMV) )
    {
    LPCWSTR pNameW = (LPCWSTR)source;
    WideCharToMultiByte(mvGetAppCodePage(pMV,rdPtr->rHo.hoAdRunHeader->rhApp), 0, pNameW, nchars, dest, nchars+1, NULL, NULL);
    }
    else
    strncpy(dest,(char *)source,nchars);
    }

    // etc...

  7. #7
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I thought the whole purpose of building separate versions or the MFX for Unicode and Non-Unicode was so that you could use #ifdef _UNICODE, not to mention it changes the parameter lists for some functions.

  8. #8
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Indeed, but you'll at least want to verify that your choice is correct. The above code was useful for me because I did not create unicode and non-unicode versions (as it was only for interacting with internal MMF structures. It would be silly to create a whole new version for such a minor change)

  9. #9
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Ah, jax - I had not realized your project was set up that way. The EDIF SDK has separate build modes for each of Nromal, Unicode, and HWA.

    EDIF also has Runtime.IsUnicode() and Runtime.IsHWA() which basically check the values in the MMF2 structs, which is why I criticized your lengthy solution.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleUnicode Add-on
    Tim's Avatar
    Join Date
    Apr 2007
    Location
    NSW - Australia
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @LB: Thank you, very useful because I hadn't ever successfully made a property before

    I'm trying to save/load properties and I'm doing something really wrong

    Code:
    struct EDITDATA
    {
        // Header - required
        extHeader        eHeader;
    
        // Object's data
        TCHAR *appID;
        TCHAR *appSig;
    };
    
    //--------------------------------
    
    LPVOID WINAPI DLLExport GetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID)
    {
    #ifndef RUN_ONLY
    
        switch(nPropID)
        {
            case Prop::Version:
                return new CPropDataValue(__CURRENT_VERSION__);
            case Prop::AppID:
                return new CPropDataValue(edPtr->appID);
            case Prop::AppSig:
                return new CPropDataValue(edPtr->appSig);
        }
    #endif // !defined(RUN_ONLY)
        return NULL;
    }
    
    void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID lParam)
    {
    #ifndef RUN_ONLY
        // Gets the pointer to the CPropValue structure
        CPropValue* pValue = (CPropValue*)lParam;
    
        switch (nPropID){
            case Prop::AppID:
                #ifdef _UNICODE
                edPtr->appID = ((CPropStringValue *)pValue)->m_pWStr;
                #else
                edPtr->appID = ((CPropStringValue *)pValue)->m_pStr;
                #endif
        }
    #endif // !defined(RUN_ONLY)
    LB (or anyone else), can you help point out where I've gone totally wrong?

    I'm a keen learner but definitely still new to properties

    Kind Regards
    Tim

Page 1 of 2 1 2 LastLast

Similar Threads

  1. error: statically allocated instance of Objective-C class 'BoidType" at build
    By MTCMusic in forum iOS Export Module Version 2.0
    Replies: 7
    Last Post: 27th February 2013, 12:03 PM
  2. Does the iOS Exporter support unicode without the MMF unicode-addon?
    By jimmyorpheus in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 17th November 2012, 06:30 AM
  3. visual problem
    By ZayLong in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 8th December 2010, 08:16 AM
  4. Visual Effects
    By camelman in forum File Archive
    Replies: 4
    Last Post: 22nd November 2008, 09:27 AM
  5. Visual novel
    By Link in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 14th March 2008, 05:00 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
  •