Comments (7)
Hi
Could you please clarify your question a little? What offset do you mean?
from imhex.
current byte offset of file when used in a hex pattern
hopefully that makes more sense
from imhex.
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.
That is correct ^
from imhex.
This is possible now using the $
operator
from imhex.
Reference in new
can you be more specific on how to use the $ operator?
from imhex.
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)
- [Bug] Window "blinks" by becoming blurry at intervals HOT 10
- [Bug] Alt Gr key is mishandled, Ctrl key stays in pressed state, editor is unusable on AZERTY HOT 1
- [Bug] Certain setting description is clipping out of the Settings window
- [Bug] Description field in the Patterns tab of Content Store is too narrow HOT 2
- [Bug] Data Information, Byte distribution chart doesn't show bytes that occur once.
- [Bug] Double-free on exit in font manager plugin with custom font
- [Bug] Window scaling is not updated HOT 1
- [Bug] Crash on startup HOT 2
- [Bug] Existing bookmarks don't update when the base address is changed
- [Bug] Using #pragma bitfield_order crashes the application
- [Bug] placement doesn't work in if outside of a struct HOT 3
- [Bug] Hex Editor scroll don't work properly using "Jump To" HOT 1
- [Bug] UI doesn't start without raising an error on Ubuntu
- [Bug] File dialog is no longer parented properly on Linux X11 HOT 1
- [Bug] find_sequence can fail if based_address is not zero.
- [Feature] Highlight multiple paragraphs with the same color when creating a bookmark
- [Bug] Base64 provider does not work on files with newlines HOT 3
- [Bug] Graphical corruption and mouse clicking incorrect on Windows 10 HOT 2
- [Bug] Chinese(Simplified) got doubled in the language list
- [Bug] Window becomes completely unresponsive after resizing HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imhex.