I'm trying to parse a custom binary file to be used for a cheat module. To do that I wanted to detect the extension of the file inside SDLoader module to see if a cheat file is availabe for the selected ROM file. To do that, I thought about doing something like this:
if (fn + file_start == sd_list_file) begin
if (FONT[sd_list_name[ch]][ny[2:0]][nx[2:0]])
if(
sd_list_name[sd_list_namelen - 8] == "." &&
sd_list_name[sd_list_namelen - 7] == "c" &&
sd_list_name[sd_list_namelen - 6] == "h" &&
sd_list_name[sd_list_namelen - 5] == "e" &&
sd_list_name[sd_list_namelen - 4] == "a" &&
sd_list_name[sd_list_namelen - 3] == "t" &&
sd_list_name[sd_list_namelen - 2] == "e" &&
sd_list_name[sd_list_namelen - 1] == "x" &&
sd_list_name[sd_list_namelen] == "t"
) begin
color <= COLOR_TEXT_CHEAT;
end else begin
color <= COLOR_TEXT; // yellow
end
Test code was supposed to change text colour to gray if there's a *.cheatext file. I realised it wasn't changing any filename colour so I tried substracting 1, 2 and 3 to the indices, with the same result.
After that I tried something different, to check what sd_list_namelen actually was:
if (fn + file_start == sd_list_file) begin
if (FONT[sd_list_name[ch]][ny[2:0]][nx[2:0]])
if(ch == sd_list_namelen) begin
color <= COLOR_TEXT_CHEAT;
end else begin
color <= COLOR_TEXT; // yellow
end
The result was that every first letter of every filename is being changed to gray colour, meaning that sd_list_namelen is always 8'h00. At least that's my interpretation given my results.
If there's a more direct and easy way to detect the end of the filename, or the extension, then I'd appreciate any support 🙂
SNESTang has a new version of sd_file_list_reader that streams the file name byte by byte. If you want you can try that. I may use that for NESTang later too.
I'm trying to parse a custom binary file to be used for a cheat module. To do that I wanted to detect the extension of the file inside
SDLoader module
to see if a cheat file is availabe for the selected ROM file. To do that, I thought about doing something like this:Test code was supposed to change text colour to gray if there's a
*.cheatext
file. I realised it wasn't changing any filename colour so I tried substracting 1, 2 and 3 to the indices, with the same result.After that I tried something different, to check what
sd_list_namelen
actually was:The result was that every first letter of every filename is being changed to gray colour, meaning that
sd_list_namelen
is always8'h00
. At least that's my interpretation given my results.If there's a more direct and easy way to detect the end of the filename, or the extension, then I'd appreciate any support 🙂