Are AddressFileToLocal() and AddressLocalToFile() working properly?

I’ve been having trouble understanding how local coordinates work.

I’m working with 010 Editor 15.0a on Windows 10.
I have a template that looks like this:

OffsetClear();
OffsetSetStartLimit( 4 );
OffsetSetLimitSize( 2 );
Printf( "AddressLocalToFile(0) returned 0x%X\n", AddressLocalToFile(0) );
Printf( "AddressFileToLocal(5) returned 0x%X\n", AddressFileToLocal(5) );
FSeek( 0 );

byte b[2];

I ran the template against a text file that looks like this:

0123456789ABCDEF

Its output looks like this:

AddressLocalToFile(0) returned 0x0
AddressFileToLocal(5) returned 0x5

This output surprised me. I expected AddressLocalToFile(0) to return 4, and AddressFileToLocal(5) to return 1.

Yet in the Template Results window I can see that b[0] and b[1] do contain the ASCII characters '4' and '5' as expected.

(At first I didn’t have the FSeek(0); in the script but the need for it made sense once I thought about it.)

Oops. Above, OffsetSetStartLimit() should be OffsetSetStart().

“Copy text to brain” and “paste brain to text” isn’t 100% reliable. :slight_smile:

At first glance it looks like AddressLocalToFile and AddressFileToLocal are not taking the offset into account and they should be. The functions look like they are working for processes but not with offsets. We’ll have to look into this more and we will get this fixed up. Cheers!

Graeme
SweetScape Software