User Tag List

Results 1 to 9 of 9

Thread: Convert this pseudocode please?

  1. #1
    Clicker Fusion 2.5Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2008
    Location
    Indonesia
    Posts
    694
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Convert this pseudocode please?

    Dines just give me this pseudocode http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Main=14347&Number=1020 03#Post102003 :
    Code:
    //Find out how many tables there are in the file.
      Set Pointer to '4' 
      "Number of tables" = Get Unsigned Short
    
    //Move to the list of contents
      Set Pointer to '12'
    
    //Scan each line in the list of contents
    //trying to find the 'Names Table'
    LOOP 'Number of tables' times
     {
       "Table ID" = Get ASCII String, 4 bytes long
    
       Advance Pointer by '8'
       "Table Location" = Get Unsigned Long
    
       Advance Pointer by '4'
       "Table Length" = Get Unsigned Long
    
       Advance Pointer by '4'
    
       IF ("Table ID" == "name")
       { Then: Stop loop } //Once the Name Table has been found, stop the search loop.
     }
    
    
    //Read the Name Table
      Set Pointer to 'Table Location'
      Advance Pointer by '2'
      "Number of Strings" = Get Unsigned Short
      Advance Pointer by '2'
      "Offset to String Def" = Get Unisgned Short
      Advance Pointer by '4'
    
    LOOP 'Number of Strings' times
     {
       Advance Pointer by '6'
       "String Type" = Get Unsigned Short
       Advance Pointer by '2'
       "String Length" = Get Unsigned Short
       Advance Pointer by '2'
       "String Offset" = Get Unsigned Short
    
       IF ("String Type" == '1')
       { Then: Stop loop } //Once the name string is found, stop the search loop.
     }
    
    //Read the name
      Set Pointer to 'Offset to String Def'
      Advance Pointer by 'String Offset'
      "Font Name" = Get ASCII String, 'String Length' bytes long
    
    RETURN "Font Name"
    This is for building an extension that reads a font's name. Let's say for example I have a font file named comic.ttf and I want MMF2 to return the real font name, Comic Sans MS.
    Could someone convert the pseudocode to an extension? Thanks in advance.

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Convert this pseudocode please?

    This is pretty simple with the current extensions...

    I would suggest using the binary array.

  3. #3
    Clicker Fusion 2.5Fusion 2.5 MaciOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2008
    Location
    Indonesia
    Posts
    694
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Convert this pseudocode please?

    Oh, so the binary object is the solution
    So can you/someone give me an example?

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Convert this pseudocode please?

    An extension would be neat, though.

  5. #5
    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: Convert this pseudocode please?

    Hey, I tried to put this into a mfa, but failed:
    Binary object can't get unsigned data. Signed only. (e.g. "get byte" returns something between -128 and 127, not 0 - 255)
    Binary array supports this, but it crashes for me when i load a ttf file and get some data.

  6. #6
    No Products Registered

    Join Date
    Aug 2006
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Convert this pseudocode please?

    Solution = add 128 to the signed byte.
    To place unsigned data you would likewise subtract 128 before saving.

  7. #7
    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: Convert this pseudocode please?

    You're the second person who told me that.
    Problem is: I use shorts and longs. If i add 2147483647(max of signed long), the values surprisingly are something like 1.04234+e0016... weird.

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Convert this pseudocode please?

    yeah, you have to express it with expressions, although it's a lifetime ago since I last made an app that could do it.

    I'll see if I can come up with somert.

  9. #9
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Convert this pseudocode please?

    Right, it's nearly done, I'm just having to build my own de-unicoder (font names are stored internally in unicode).

    To convert a signed value into unsigned, do this:


    (value + 256 pow A) mod (256 pow A)

    ...where 'A' is the number of bytes used.

    SO...

    Signed Bytes
    (value + 256) mod 256

    Signed Shorts (2 bytes)
    (value + 256 pow 2) mod (256 pow 2)

    Signed Longs (4 bytes)
    (value + 256 pow 4) mod (256 pow 4)


    Hope that helps


    EDIT:

    DUN DUN DUN!!
    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=106181#Post1061 81

Similar Threads

  1. Convert wav to MP3 in program?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 16th July 2013, 03:47 AM
  2. Convert Bmp. and Gif to be used in MMF2
    By OldGuy in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 1st January 2009, 05:42 PM
  3. convert to hex and binary?
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 26th December 2008, 01:35 PM
  4. Possible to convert to mac
    By MikeB in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th October 2008, 02:05 AM

Posting Permissions

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