Hacking Forwarder with meta.xml support

CatmanFan

Anxious and regretful
Member
Joined
Aug 14, 2016
Messages
1,963
Trophies
0
Website
www.youtube.com
XP
2,605
Country
Morocco
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);
 

GreyWolf

Well-Known Member
Member
Joined
Mar 2, 2015
Messages
5,399
Trophies
0
Age
54
XP
1,516
Country
United States
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.
 

CatmanFan

Anxious and regretful
Member
Joined
Aug 14, 2016
Messages
1,963
Trophies
0
Website
www.youtube.com
XP
2,605
Country
Morocco
"%.*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.
 

GreyWolf

Well-Known Member
Member
Joined
Mar 2, 2015
Messages
5,399
Trophies
0
Age
54
XP
1,516
Country
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.
 

CatmanFan

Anxious and regretful
Member
Joined
Aug 14, 2016
Messages
1,963
Trophies
0
Website
www.youtube.com
XP
2,605
Country
Morocco
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

General chit-chat
Help Users
    BigOnYa @ BigOnYa: Sounds good actually.