maziac / binary-file-viewer Goto Github PK
View Code? Open in Web Editor NEWA customizable binary file viewer.
License: MIT License
A customizable binary file viewer.
License: MIT License
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)
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 :)
Hello! I am trying to use some of the data that I read to interpret the following (IE: Reading a palette to draw an image on a canvas later on).
The thing is that calls like Object.keys
or Array(10)
give errors, as Object
and Array
are not defined. The same happens with JSON
.
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.
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!
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');
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.
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
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).
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!
maybe some reasons?
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
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.
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?
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:
Thanks!
Guy Turcotte
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.