bit-buffer icon indicating copy to clipboard operation
bit-buffer copied to clipboard

Using this with quakejs-files

Open briancullinan opened this issue 5 years ago • 0 comments

This is weird, I thought this was working because on one file it did. At least it loaded shader names, but didn't load skin names. Looking at just the header code:


function load(data) {
	var md3 = new Md3();

	var bb = new BitStream(data);

	// Load the md3's header.
	var header = new Md3Header();
	header.ident = bb.readInt32();
	header.version = bb.readInt32();

Get the error LoadMd3: Wrong version (1885434487 should be 15)

But if I look at the Buffer myself:

var buffer = fs.readFileSync(models[i])
console.log(buffer[4])

prints 15, the 5th byte in the file is in fact 0x0F.

Screen Shot 2020-02-17 at 5 02 39 PM

This line apparently does NOT do the same thing. Something with the internal pointer/offset I suspect. Considering this starts with an underscore, I don't think it should be used: https://github.com/inolen/bit-buffer/commit/646ec323edd2a3901427b057256de952b10cd0ae#diff-c2b991e5fa136ca7c3ba20c328fe5345R22

EDIT: added image

EDIT: added link to merge

briancullinan avatar Feb 18 '20 00:02 briancullinan