Code Monkey home page Code Monkey logo

Comments (7)

WerWolv avatar WerWolv commented on May 14, 2024

Hi
Could you please clarify your question a little? What offset do you mean?

from imhex.

ProfElements avatar ProfElements commented on May 14, 2024

current byte offset of file when used in a hex pattern
hopefully that makes more sense

from imhex.

benvanik avatar benvanik commented on May 14, 2024

I was having the same usability issue I think: there doesn't seem to be a good way to get the current byte offset under the cursor in various views. For example, in the hex editor if I'm looking at a byte I literally counted the byte columns from the start of the row to manually type it in the pattern editor. Having every single byte offset be easily accessible would be super useful (imgui makes this nice - a byteOffsetText() fn that handled right clicking/shift+clicking/etc on the text to copy to clipboard would be easy to slot in, etc).

from imhex.

ProfElements avatar ProfElements commented on May 14, 2024

That is correct ^

from imhex.

WerWolv avatar WerWolv commented on May 14, 2024

This is possible now using the $ operator

from imhex.

supercherrysai avatar supercherrysai commented on May 14, 2024

Reference in new

can you be more specific on how to use the $ operator?

from imhex.

paxcut avatar paxcut commented on May 14, 2024

To copy the offset on the hex editor view place the cursor on the data whose offset you want and right click Copy As > Address. That will copy the offset to the clipboard. The $ operator in the pattern language is the operator that returns the current offset that the pattern is processing. When you place a pattern in the data using the @ operator, the value of $ is updated automatically. $ can be read, assigned to variables, written to using values or variables like for example:

std::print("{:#x}",$); //prints offset in hex
u32 offset = $;  // assigns offset to variable 'offset'
$ = a==0 ? 0x25 : a; // if a is zero set offset to 37 else set it to the value of a

from imhex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.