Forwarder with meta.xml support

Discussion in 'Wii - Hacking' started by FIX94, Jan 6, 2011.

  1. CatmanFan

    CatmanFan TrashTemp Advanced Fan

    Member
    797
    194
    Aug 14, 2016
    Morocco
    Stately West Manor
    Sorry for the bumping, but I need help on changing the meta.xml directory.
    I just need to ask, what does the "%.*s" in the code below mean?
    Code:
    snprintf(meta_path, sizeof(meta_path), "%.*smeta.xml", p ? p-exe_path+1 : 0, exe_path);
     


  2. GreyWolf

    GreyWolf GBAtemp Psycho!

    Member
    3,713
    702
    Mar 2, 2015
    United States
    This explains printf format strings. "snprintf" is a derivative of printf.
     
  3. CatmanFan

    CatmanFan TrashTemp Advanced Fan

    Member
    797
    194
    Aug 14, 2016
    Morocco
    Stately West Manor
    Can you please tell me what this snprintf string means? Is this how to change the meta.xml directory?
    Code:
    snprintf(meta_path, sizeof(meta_path), "%.*smeta.xml", p ? p-exe_path+1 : 0, exe_path);
     
  4. GreyWolf

    GreyWolf GBAtemp Psycho!

    Member
    3,713
    702
    Mar 2, 2015
    United States
    "%.*s" means combine whatever the argument is as a string with "meta.xml" but limit the size to the number passed before it.

    So... combine whatever "meta_path" is with the string "meta.xml" but do not exceed the lenght of "meta_path".

    The section "p ? -exe_path+1 : 0" is a tertiary expression. It means use the value "p-exe_path+1" if "p" has a value, otherwise use "0", which would be an empty string. I'm not sure what "p" is but it's probably a pointer to the beginning of the exe_path string.

    Tertiary operators work like this: A ? B : C

    It means if A is true then use B's value, otherwise use C's value.
     
  5. CatmanFan

    CatmanFan TrashTemp Advanced Fan

    Member
    797
    194
    Aug 14, 2016
    Morocco
    Stately West Manor
    I still don't get it. How do you change the meta.xml directory in the main.c? Reexplain that meaning of the string with simplicity please.
     
  6. GreyWolf

    GreyWolf GBAtemp Psycho!

    Member
    3,713
    702
    Mar 2, 2015
    United States
    That's about as simple as it can be explained. You should probably read up on the printf() function and pointers in C. Just that one line doesn't have enough information in it to answer your question. Essentially, that function combines whatever text is in the meta_path variable with "meta.xml". (For example, "sd:/apps/" + "meta.xml" = "sd:/apps/meta.xml")

    If you're trying to put the meta.xml file in a different folder you need to pass a different path as meta_path.
     
  7. CatmanFan

    CatmanFan TrashTemp Advanced Fan

    Member
    797
    194
    Aug 14, 2016
    Morocco
    Stately West Manor
    The current location of my DOL is in "sd:/apps/retroarch/forwarders". What should I do and which part should I edit?

    I forgot to tell one more thing, I successfully forwarded the DOL, but I don't think I could forward the meta.xml yet.
     
    Last edited by CatmanFan, Jul 17, 2017 at 10:55 PM