Can't get the custom formatter working #1464
-
I have a format describing a filesystem image. To save on clicks, I want to see the filename of a directory entry directly in the "Value" column of the "Pattern Data" view. However, I just can't get it to convert the entry's name to be displayable. I've tried returning Pattern code:
Example dummy file: hello.rom.zip P.S. Not sure if there's a better way to handle the P.P.S. Sometimes the strings I encounter are NOT utf-8 encoded (they are in Shift-JIS). Is there a way to specify the string encoding in pattern language? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
isnt directory_offset always 0x10? you don't need a template if the argument never changes. You can then create a pointer relative to 0x10 by offset that will point to the name. Try to avoid using @ inside structs if possible that creates a view of the data which doesnt advance the cursor. When using strings as arguments it may be necessary to use ref and make them references. The way you read the name assumes it is zero terminated. is that assumption correct? Finally you don't state what actually is displayed or any error messages shown. What actually happens when you try? |
Beta Was this translation helpful? Give feedback.
-
this seems to work fn entry_formatter(ref auto e) {
return "hello " + e.name;
}; |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
this seems to work