Home Download Buy Blog Forum Support

Binary File Reading Plugin

Re: Binary File Reading Plugin

Postby facelessuser on Tue Nov 01, 2011 3:50 pm

Don't worry about a fix. I have one that I will commit tonight. It took only a couple of minutes. Thanks for the feedback. Let me know if you run into anything else or you have any ideas or good pull requests.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: Binary File Reading Plugin

Postby facelessuser on Wed Nov 02, 2011 12:32 am

The font settings have been committed.

Also, there is a new command to open the hex view in an output panel opposed to the buffer if you like. The panel cannot have its settings change on the fly currently, but it gives you a quick way to peek at the hex and still leave the source file open.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: Binary File Reading Plugin

Postby bizoo on Wed Nov 02, 2011 9:45 am

facelessuser wrote:The font settings have been committed.

Thanks.
Tried it and work great.

Didn't have time to look more at it now, but anyway for me it perfectly usable and look nice.

Some ideas for future development (when I have more free time):
-Add visual mark to see which char. link to which byte when you move cursor in chars or bytes column (using 2 cursors or probably better using marked regions)
-Goto address
-Find bytes/chars
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Binary File Reading Plugin

Postby facelessuser on Wed Nov 02, 2011 3:00 pm

I do have some things already on my todo list that align with your ideas:

1. highlight current byte - highlight a byte when your cursor is inside it
2. display current address - display the current byte address in status bar (possibly byte range if a range is selected)
3. goto address - goto requested address
4. highlight corresponding chars - highlight the currently selected byte's printable char in the ascii column
5. reverse select and highlight byte - highlight and select the byte when a printable char is selected.

I am not sure how the definition of the tasks will change when I attempt to do these things, but that is the basic things I am shooting for; these tasks may be modified if I find usability or functionality hindered when attempting them.

I will probably approach the tasks in the mentioned order as well. I want to hit the most important (needed) features first and deal with the wants last.

The output panel view right now is kind of an experiment, it might not make it to the final version. Since panels cannot be searched etc. like normal buffers, it may not prove as useful. General highlighting etc. in the panel should work fine...we will just have to wait and see.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: Binary File Reading Plugin

Postby mah on Wed Nov 02, 2011 8:36 pm

I've downloaded this and it looks pretty nice to start with. A few things that I think would be nice (if they're possible):
1) Obvious -- having edits able to be saved for proper binary editing. I can see that this might be rather difficult though, unless you can control how the user applies edits (in which case, things could get very slow!)
2) A list of file extensions; if a file with an extension in the list is opened, the real file is closed and the hex_viewer representation is automatically opened.
3) An ability to add extension-specific representation. For example, if the extension is BMP, rather than just displaying a simple set of words and their ascii, display the BMP structure header and display the body in standard hex format. Perhaps this is well beyond the intention of Hex Viewer.

Is there a way to bind a key to the "Hex Viewer: Toggle Hex View" command?
mah
 
Posts: 13
Joined: Mon Aug 29, 2011 3:47 pm

Re: Binary File Reading Plugin

Postby facelessuser on Wed Nov 02, 2011 9:10 pm

1) Obvious -- having edits able to be saved for proper binary editing. I can see that this might be rather difficult though, unless you can control how the user applies edits (in which case, things could get very slow!)

This is not impossible, but will be a little tricky. I will probably need to restrict some things and give warnings to malformed data. I am saving this for the very very end. The viewer will be released without edit capability and then I will revisit and see how I may go about adding this.

2) A list of file extensions; if a file with an extension in the list is opened, the real file is closed and the hex_viewer representation is automatically opened.

I have experimented with this, but ST2 doesn't always fire the event for opening a file correctly...or at least as expected. It has caused me some issues to do this. I may revisit this again when I get the essentials in.

3) An ability to add extension-specific representation. For example, if the extension is BMP, rather than just displaying a simple set of words and their ascii, display the BMP structure header and display the body in standard hex format. Perhaps this is well beyond the intention of Hex Viewer.

Can you provide more in depth explanation to BMP structure headers? Is there an hex editor that does this sort of thing that I could view as an example? I would like to take a look into this before I give a yes or a no.

Is there a way to bind a key to the "Hex Viewer: Toggle Hex View" command?

Yes, you just use the standard key binding methodology. I will post an example in a bit.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: Binary File Reading Plugin

Postby facelessuser on Thu Nov 03, 2011 7:01 am

Its a work in progress, but following features have been added.

1. highlight current byte - highlight a byte when your cursor is inside it
4. highlight corresponding chars - highlight the currently selected byte's printable char in the ascii column


It might be a little rough, but it works. I need to make sure and smooth it out and add expose some knobs to be tweaked in settings file.

Overall, not too bad.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: Binary File Reading Plugin

Postby facelessuser on Thu Nov 03, 2011 3:24 pm

Looked at it again this morning and made a couple of tweaks to the highlight code; should be pretty reliable now.

@mah oh yeah...shorcut. As promised. Just change the shortcut to what you want.

Code: Select all
{ "keys": ["ctrl+shift+b", "ctrl+shift+h"], "command": "hex_viewer" },
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: Binary File Reading Plugin

Postby bizoo on Thu Nov 03, 2011 4:03 pm

The performance of file loading isn't great right now.
A 2.25MB file take more than 11 seconds to load.

I made some changes in the code and the same file open now in less than 3 seconds.
I suppose that it's acceptable and it look difficult to optimize the code a lot more.
Note that half this time is spend in the view.replace() call.

I need a little more time to cleanup the code and test it. After that I will put it on github and place a pull request.
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Binary File Reading Plugin

Postby facelessuser on Thu Nov 03, 2011 4:13 pm

bizoo wrote:I made some changes in the code and the same file open now in less than 3 seconds.
I suppose that it's acceptable and it look difficult to optimize the code a lot more.

Yeah, having to go through python slows things down a bit; doing this in native code would be tremendously faster. I haven't spent much time optimizing it yet, so this effort is much appreciated. :)

Note that half this time is spend in the view.replace() call.

I am afraid there is not much we can do about that. Well there might be other ways, but none that I am willing to traverse at this time.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

PreviousNext

Return to Plugin Development

Who is online

Users browsing this forum: buzzsawddog, pete340 and 5 guests