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)
- [Feature] Use immersive dark mode in Windows. HOT 1
- [Feature] Disable Achievements HOT 3
- [Bug] Built-in PNG & JPEG patterns not working - "array expanded past end of the data" - even for provided test files
- [Bug] `import` fail to parse dot syntax statement if it encounter a keyword HOT 1
- [Bug] value assignment inside loop makes imhex crash HOT 1
- [Bug] including std/core and std/mem at in the same file crashes imhex HOT 2
- [Bug] Passing a (placed) struct as non-type template parameter makes it disappear HOT 2
- [Bug] Pattern setting not evaluated in multi file project
- [Bug] File provider pop-up dialog stacks with multiple external file changes
- [Bug] Crash when parsing pattern with undefined struct inside conditional HOT 1
- [Bug] readme.md claims support for MacOS Big Sur but pre-packaged 1.33.2 MacOS .DMG won't install there HOT 2
- [Bug] Nightly - text cursor is invisible in a pattern editor HOT 3
- [Bug] Undefined symbol building on Big Sur
- [Bug] 'Command Palette' shortcuts containing 'Alt' lead to focus loss after execution
- [Bug] ImHex fails to render on LLVMpipe HOT 11
- [Bug] File reload popup after Save + File size growing after resize and few saves
- [Bug] Path to files should always use the "/" separator in .hexproj files HOT 1
- [Bug] MSI installer can break installs
- [Bug] Patterns aren't erased when closing files
- [Bug] 3d visualizer becomes extremely slow without axis disabled
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.