Giter Club home page Giter Club logo

binary-file-viewer's People

Contributors

maziac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

binary-file-viewer's Issues

read() with negative offset did not move the pointer backwards

So I was doing a little experiment around with several stuffs and I did this:

read(-1);
dbgLog('Offset: ' + getOffset() + ', Value: ' + getHexValue());
read(-1);
dbgLog('Offset: ' + getOffset() + ', Value: ' + getHexValue());
read(-1);
dbgLog('Offset: ' + getOffset() + ', Value: ' + getHexValue());

And I got this output:

	Offset: 1164, Value: 14
	Offset: 1164, Value: 14
	Offset: 1164, Value: 14

Just as a reference this is my memory dump on 00000480 is :
02 00 00 00 00 00 01 00 00 00 00 0F 14 00 00 00

I don't think that the pointer really went back in place so it kept returning the same value. And as you see in the memory dump there isn't a duplicate of values.

Maybe this is because in data.ts line 266 the negative size is coverted into its absoulute value, but when the next read is called which calls correctBitByteOffsets, the lastsize used is the positive value instead of the negative value which just brings the pointer back to its original position?

(and sorry if I said anything wrong I just started learning .js yesterday because I wanted to use your extension, I tried my best to understand all the code)

Question: Changing values

Hi,
is it possible to change values that are parsed with this specification?
I can see it super usefull.
If this is not possible, would you consider adding this functionality?
Thank you :)

Updating the view

It seems the button "reload" is useful when you change the parser so that it immediatly updates the view, however if you change the file content the viewer does not responde to the changes so you have to manually close the tab and open it again... It would be cool to add a feature that set the update to automatic keeping track of content that is changing.

Where is the JS file path?

Hi~ Thank you for the amzing plugin!

I'm trying to parse .wav file. Where is the path of wav.js?
I copyed file from yours. I don't know which path/folder should it put.

Help please , thank you!

Signed / Unsigned number

In my custom binary file i have signed values, it would be nice if the parser would support this directly
I solved it now by using:

read(1);
dy = getNumberValue();
if (dy > 128) dy = -256 + dy;
addRow('dirY', dy, 'y direction');

Feature Request: View in Hex Editor

So, there's this cool Reload button on the upper half.
Something I find myself often doing is right clicking the tab and going to Reopen Editor With... to switch to the Msft Hex Editor extension that lets me see the raw binary data.

Any thoughts of making this a button, too? Not sure best approach, just thought it may be an idea worth considering.

Reading data from any file position

Hello,

I've found the Binary File Viewer and I find it quite useful :-)
Is there any way to read some data from a binary file just from a specific file position?
As far as I have seen you can only read an input file forward with the given amount of bytes - through the "read()" function.

This is enough for easy file formats, but what about more complex ones - like the ELF or PE binary format? To be able to proper parse such files, you have to read data from specific offsets which you know after you have parsed the file header. You would need in the Parser function access to a function like "getBytesAt" to be able to freely "move around" in the binary file.

Thanks,

-Klaus

Zoom in charts not working.

Beginning with release 1.7.0 the mouse-zoom in charts (like) wav) stoped working.
Normally it should be possible to zoom in the chart by selecting a rectangle (that will be zoomed).

How to change parser?

It seems it uses the first parser it can find - or at least, it's not using my custom parser. Any way to change this?
afbeelding

Feature Request: support ${workspaceFolder} ?

Love the idea.

A tid bit not covered on the README/help
in your .vscode/settings.json, you can add:

"workbench.editorAssociations": {
    "*.mod": "binary-file-viewer.viewer",
    "*.mds": "binary-file-viewer.viewer"
}

to automatically open *.mod and *.mds files with your extension if in the workspace.

I'd like to ask for support for variable parsing like ${workspaceFolder}, so I can define the js files in a workspace and build it into my repo.. with that, this is I think perfect for me to start building out some ideas I have
e.g. in my .vscode/settings.json:

"binary-file-viewer.parserFolders": [
        "${workspaceFolder}/.vscode/parsers/"
    ]

Would let me put the parsers into the .vscode folder, out of mind of my primary work, and other folks who clone it can take advantage.

Thanks for making this!

Getting the file size

I'm writing a parser that needs to know the file size in order to workout the sizes of several blocks. it's a daft format, but that's what I have to work with.

The public API does not seem to present this information, though it looks easy enough to expose.

For now this is my clunky workaround:

function determineFileSize(){
const savedOffset = getOffset();
setOffset(0);
read();
read(0);
let fileSize = getOffset();
setOffset(savedOffset);
return fileSize;
}

FYI. The requirement to add in a read(0) held me up me for a bit

Am I missing a more obvious/nicer solution? If not, would you consider exposing the file size in the API?

Cheers, Andy

Viewing of Packed Files

Sometimes the files I'm trying to view will be compressed (lha in this case, but I have other files I want to get to that will have used zip) but I'd like the binary viewer to run on the contents.

I don't see any way through the API to handle this situation.

Do you have any suggestions? I'm guessing I most likely need to bite the bullet and write a custom viewer Extension for this.

How to read float value?

Hi, thanks to make this amazing tool. But I find it since that there is no way to read a 4-bytes float value. I've tried getNumberValue() and getDecimalValue() which both return integers. Also tried to search 'float' in help document and get nothing. Did I miss something or it just not supported yet?

Can't use a variable with the read() function

Hello, thanks a lot for this addOn!

Is it possible to use a variable to contain the number of bytes to read using the read() function?

My tests just don't work with a variable. The for loop doesn't seems to work too. Here is an example of .js file:

registerFileType((fileExt, filePath, fileData) => {
	// Check for wav extension
	if (fileExt == 'ibmf') {
		const headerArray = fileData.getBytesAt(0, 4);
		const header = String.fromCharCode(...headerArray)
		if (header == 'IBMF')
			return true;
	}
	return false;
});

registerParser(() => {
	var faceCount;

	read(6);
	addRow('PREAMBLE', '', 'IBMF Preamble');
	addDetails(() => {
		read(4);
		addRow('Marker', getStringValue());
		read(1);
		faceCount = getNumberValue();
		addRow('Face Count', faceCount);
		readBits(5);
		addRow('File Version', getNumberValue(), '0 = LATIN, 1 = UTF32');
		readBits(3);
		addRow("Font Format", getNumberValue());
	});

	var byteCount = 4 * faceCount;
	read(byteCount);
	addRow('FACES OFFSETS', '', 'Faces Offsets');
	addDetails(() => {
		for (let i = 0; i < faceCount; i++) {
			read(4);
			addRow('Face', getNumberValue(), 'Offset from the beginning of the file');
		}
	});
});

Here is the result:

image

Thanks!
Guy Turcotte

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.