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] NullablePtr inside namespace crashes editor upon invalid member type in pointed struct HOT 8
- [Bug] Export selection to file infinite loop HOT 1
- [Bug] Search backward never finished in some file HOT 2
- [Feature] "Go to Start/End" for Arrays in Pattern Viewer
- [Bug] Commit 72d5707d (v1.34.0) build error HOT 1
- [Bug] When multiple files have been modified, ImHex will ask once for every file sequentially
- [Feature] Framing clicked 'pattern data' not only in the hex editor (indicated by a range of bytes) but also in the 'Pattern Data' (indicatd by a range of elements)
- [Feature] Mouse-over on 'Pattern Data' element shows affected bytes in 'hex-view' as framed.
- [Feature] Don't scroll the hex-editor view down if values fit completely in 'visible range'
- [Bug] DDS pattern is incorrect HOT 4
- [Feature] Bookmarks: Change order of bookmarks HOT 5
- [Feature] Renaming view
- [Bug] Bookmark: Tooltip for "open in new view" is not shown
- [Bug] Highlight Rules not saved
- [Feature] ASCII only view
- [Bug] GUI Layout is broken in 1.34
- [Bug] Imhex shows incorrectly version in Winget even after update
- [Bug] Linking CXX shared library libimhex.dll FAILED: libimhex.dll lib/libimhex/liblibimhex.dll.a HOT 1
- zlib_decompress to process raw deflate data (w/o zlib or gzip header).
- [Bug] Keyboard shortcuts in editor for macOS no long work in 1.34.0 HOT 7
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.