Various bug reports and feature requests

Hey there. Thank you very much for your work on 010 Editor! The software has been an incredibly useful tool for me over the past few years, helping me to reverse engineer various difficult binary file formats using the powerful script and template features. In this post I have listed some bug reports that I’d like to see fixed, and some feature requests that I’d like some consideration for.

Bug Reports

Random() does not return a new value for each run of a template

If you create a template that makes use of the built-in Random() function and run that template on a file multiple times, it will return the exact same value each time.

Printf() width format specifier uses byte size for UTF-8 strings and not character count

This bug can be observed using the following test:

local char s1[] = "e";
Printf("%-2s.\n", s1); // Output: e .

local char s2[] = "é";
Printf("%-2s.\n", s2); // Output: é.

As you can see, the Printf() width format specifier instead makes use of the byte size of the string rather than the number of characters in the string.

sizeof() cannot compute sizes higher than 2^32 - 1

You can achieve this by doing the following:

struct Data {
    ubyte a[0x7FFFFFFF];
    ubyte b[0x1];
} data;

local uint64 size = sizeof(data);

This results in the error Could not compute sizeof operation..

CTRL+V in the Floating Tab Group pastes as Hex Text

If you copy text to your clipboard and paste it into a script or template you are editing in the Floating Tab Group using CTRL+V, it will paste it as Hex Text, while pasting via the right-click menu correctly pastes it as normal text.

Feature Requests

Additional formatting for Hexadecimal numbers in the user interface

Currently, the user interface displays all Hexadecimal numbers with a h suffix. It would be nice if the formatting could instead be changed to use a 0x prefix. You can achieve this in the Inspector tab and the Value column of the Variables tab using custom read functions, but you cannot do so for things like the Start or Size columns, or anywhere else in the user interface.

Anonymous struct and union support in templates

Anonymous unions are a feature that you can find in the C and C++ programming languages. It allows for declaring a union without assigning it a name or to a variable, and its members are made accessible via the parent struct or union.

For example, the following is possible:

struct {
	union {
		uint32 a;
		float b;
	};
} s;

Rather than assigning a name to the declared union and accessing the members by writing s.u.a or s.u.b, an anonymous union would instead allow you to access the members by writing s.a or s.b.

This feature would help greatly when porting over C or C++ structures that make use of anonymous unions. Additionally, it would be nice if anonymous struct support would also be added, though those are not supported in C and C++.

Allow for docking the Floating Tab Group alongside the Workspace/Inspector/Output windows

I was able to achieve this in a previous version of 010 Editor, but one of the 13.x updates stopped it from working, suggesting that it may have been caused by a bug. It would be nice if this functionality could be officially added in an update.

Hello rigel. Thanks so much for your feedback and bug reports. You are correct that there are problems with the Random function and the sizeof function and we’ll get those fixed up. For the Printf function that is not going to be easy to fix. We are using the underlying C printf function which is not utf-8 aware. We’ll see if there is any way to make this function aware of utf-8 or we might have to try to find a different solution. For the Ctrl+V bug report, we couldn’t replicate this and could you give more steps to show this error?

Thanks for your feature suggestions and we will add in a way to change the hex format in the future. Anonymous union support would be nice to have too and we’ll take a look. Not sure about anonymous structs but it’s worth checking into. We did remove the ability to dock the Floating Tab Group in v13. This is because v13 allows multiple Floating Tab Groups to be created and our user interface library had issues with multiple windows and docking. There is a chance upgrading to a new version of our user interface library would allow docking Floating Tabs again but it’s probably best just to create multiple horizontal or vertical tag groups in the main interface. Let us know if you have any questions on this. Cheers!

Graeme Sweet
SweetScape Software

It would be great to see an srand type function exposed to be able to set the random seed, in case a script wants “random” but reproducible results.

Yes, having an srand function would be a good idea and we’ll add this in. Cheers!

Graeme Sweet
SweetScape Software

The Printf() issue is what I expected, and is understandable. For now, any scenarios where I would need to use the width format specifier for UTF-8 strings can be substituted by just outputting data in CSV format delimited by commas or tabs and viewing it in different software, since my main use case was just outputting data in a table-like format.

Sorry, I should have elaborated on the CTRL+V issue a bit more. It happens when I CTRL+C text from something like Notepad and then CTRL+V that text into a template in the Floating Tab Group. It usually shows the error Invalid text bytes detected on line ... of clipboard data., which is the same error that I get when I manually navigate to Edit -> Paste From -> Paste from Hex Text and press it. The only way to have the text actually paste correctly in the template is to use the right-click context menu and press Paste. In retrospect, this probably isn’t a bug, since Paste from Hex Text does have its shortcut set as CTRL+V, though I feel that this should probably change depending on the View -> Edit As mode.

As for the Floating Tab Group stuff, that is unfortunate. Hopefully the docking functionality can come back in the future, since using horizontal or vertical tag groups tends to obscure part of the main tab group, which I usually need a full view of when creating templates.

It looks like ‘Paste from Hex Text’ has the shortcut ‘Ctrl+V’. By default this action usually has the shortcut ‘Shift+Ctrl+V’. If it is set to ‘Ctrl+V’ then you should change it since there would be conflict the the regular Paste command. You can set shortcuts using ‘Tools > Options’ and then go to the ‘Shortcuts’ page. In the future we may change how pasting from hex text works to make it more intelligent. Cheers!

Graeme Sweet
SweetScape Software

Ah, okay. You are correct, I must have changed the shortcut for some reason in the past and forgot about it. Resetting it back to the default seems to have fixed my issues with using CTRL+V. Thank you.