HexSpy: A small hex editor for Haiku

I saw this topic Hex editor, so I started making a hex editor for Haiku (even if I saw later that there is already a hex editor, DiskProbe), because I wanted to learn how to use Haiku’s API. Currently it is a bit unstable, the code is quite messy, but it works.

Genio’s template was very useful for me, same for the Be Book. The help on the third party haiku IRC channel also helped me a lot. Thanks!

I still have a lot of refactoring and I still need to add a lot of important features like selection, copy/paste, undo/redo, search, etc.

When you open it, the default edition mode is insert, which lets you insert bytes. Use the insert key to switch to replace mode if you need to. The insert mode should behave similarly as it does in GHex.

I’m a newbie in C++ (but I know C well) so tips are welcome :D.

The source code is available here: GitHub - mibi88/HexSpy: A small hex editor for Haiku.. You can easily build it by running make in the terminal.

I can provide a x86 build.

I hope it can be useful for some people.

As stated in the MIT license, I can’t be responsible for any damage caused by this software. Also note that it is in a very early state, so it may be buggy, and cause some damage.

Any kind of feedback is welcome :D!

Here is a screenshot of it:

Ps: Please tell me if this is in the wrong category. I don’t know if the “Development” category is the right one.

EDIT:

I also don’t know if the name is good. I tried to make it similar to other names of BeOS/Haiku apps which have some really special names like “PoorMan” :sweat_smile:.

11 Likes

I have Emacs open all the time, so I typically use its hex mode for viewing/editing in hexadecimal. But not everybody likes Emacs, not to mention HexSpy is a native application, so it is worth developing.
I would say, go for refactoring, add some editing capabilities, and we have a useful application. Oh, and I think the name rocks. For the love of God/Devil/whatever, do not change it!

2 Likes

Thanks! Yes I plan to finish it :smiley:

EDIT:

I’m happy that you like the name :smiley:

1 Like

Great to see you developing a native app for this. I needed one for Linux recently and it’s so hard to find something that feels like it fits in with my other programs but also has the features I want.

Hoping to move to Haiku more permanently for my hobby coding soon but there’s a few things I need to sort out first. However when I do, HexSpy will come in handy indeed :slight_smile:

Feature request if I may: big/little endian swapping for ‘decoded’ output.

I don’t quite understand what you mean. Could you be a bit more precise/give an example?

There is zero reason i.Hex couldn’t be built for Haiku and Linux. I wonder if it has what you’re looking for? While I haven’t posted a new build since… ugh… 2018… the code still absolutely builds and runs. There are even probably a bunch of new features since then.

Edit: opps I made some builds…

Sure, there are a lot of hex editors that could run on Haiku, but the goal of HexSpy is to be native.

3 Likes

I don’t think having two hex editors for Haiku is a bad thing as long as the applications have different set of features. DiskProbe kind of focuses more on editing raw data on disks and partitions instead of files.

If you are worried about people complaining about the application causing data corruption, best way is to make it (ask and) create backup of the original file if there isn’t one already.

How do you figure that?

Besides the name?

The name and the general lack of features. The name didn’t make me realise it could be used for files initially, back in ~2001

I’d have to look at old folders of software, but there was quite a nice third party hex editor in the R5 days.

I was thinking that for types that Haiku can show preview for, the hex editor could show preview instead of the printable characters, especially if the file format is binary instead of text. This would make it useful tool for fixing corrupted files when the file structure is simple enough.

Obviously. There is no difference between a disk and a file as far as posix systems are concerned.

Still some functions don’t work on files, but work if the file is stored as raw data on a physical disk…

A long time I ago I remember trying what kind of data can be stored on a disk and be booted in addition to normal file systems.

What are you talking about? there is no “raw data” Files are just an abstraction, one that covers disks. DiskProbe doesn’t have any special drivers to interact with disks.

Diskprobe has nothing to do with how operating systems boot.

Raw data means nothing is prepended to the file contents… It’s like the difference between disk image containing partition table and disk image containing just single partition.