Hacking Forwarder with meta.xml support

  • Thread starter Thread starter FIX94
  • Start date Start date
  • Views Views 92,178
  • Replies Replies 106
  • Likes Likes 5
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);
 
snprintf(meta_path, sizeof(meta_path), "%.*smeta.xml", p ? p-exe_path+1 : 0, exe_path);

"%.*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.
 
"%.*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.
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.
 
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.
 
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.
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,

Site & Scene News

Popular threads in this forum