READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

varint decoding

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
Szkaradek123
mega-veteran
mega-veteran
Posts: 291
Joined: Wed May 05, 2010 8:21 pm
Location: Poland Głogów
Has thanked: 21 times
Been thanked: 585 times

varint decoding

Post by Szkaradek123 » Thu Dec 18, 2014 1:22 pm


Szkaradek123
mega-veteran
mega-veteran
Posts: 291
Joined: Wed May 05, 2010 8:21 pm
Location: Poland Głogów
Has thanked: 21 times
Been thanked: 585 times

Re: varint decoding

Post by Szkaradek123 » Thu Feb 23, 2017 7:31 pm

Here is a trick how to decode varint.
I needed varint decoding to get models from Sketchfab.
So here is a way:
1.select Sketchfab site with your favorite model (best lowpoly)
2.save this site as complete html (it creates html file and folder with the same name as html file)
3.close web browser (best use mozilla firefox)
4.go to folder with saved site and doubleclick on html
5.change web browser mode to offline.
6.open web browser console
6.from saved html folder open file "viewer-c077fc97f229ec2c2f73.js" in notaped++
In offline mode and with "viewer-c077fc97f229ec2c2f73.js" you can control how translate data from function to function


7.in js file find something like that

Code: Select all

function(t,e,i){
       //data 't','e','i' on in
        console.log('t='+t)
        console.log('e='+e)
        console.log('i='+i)
	"use strict";
	var 
	n=i(1205),
	r=n.osg,
	a=function(t,e,i)
		{
		for(var n=new r[i](e),a=0,s=0;a!==e;){var o=0,u=0;do o|=(127&t[s])<<u,u+=7;while(0!==(128&t[s++]));n[a++]=o}if("U"!==i[0])
			for(var l=0;l<e;++l)
				{
				var h=n[l];n[l]=h>>1^-(1&h)
				}
			console.log(n)	
                       //or write console.log('n='+n)
                       //data "n" on out
			return n};t.exports=a},
8.in js write command "console.log(...)" you can see data in console
- example in code
9.refresh web browser and see what happen in console.
10.this method need time and patience.

deleted:2019-03-26
Last edited by Szkaradek123 on Tue Mar 26, 2019 8:26 pm, edited 5 times in total.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2768
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 688 times
Been thanked: 1428 times

Re: varint decoding

Post by shakotay2 » Fri Feb 24, 2017 4:51 am

well, nice, as always :D

btw there's many "doubles" in the Uint16Arrays:
varint.JPG
These are the face indices? Do I miss something?
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

Szkaradek123
mega-veteran
mega-veteran
Posts: 291
Joined: Wed May 05, 2010 8:21 pm
Location: Poland Głogów
Has thanked: 21 times
Been thanked: 585 times

Re: varint decoding

Post by Szkaradek123 » Fri Feb 24, 2017 7:21 am

Bytes are still encoded after unvarint.
It needs undelta, unimplicit and others use function to decode to indices.
But vertices need indices to decode and function like unpredict, unquantize.
All depend too if there are triangle_strip or triangles.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2768
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 688 times
Been thanked: 1428 times

Re: varint decoding

Post by shakotay2 » Tue Feb 28, 2017 12:17 pm

Szkaradek123 wrote:Bytes are still encoded after unvarint.
It needs undelta, unimplicit and others use function to decode to indices.
well, ok, thanks (sry, forgot this thread for a while).
I was a little bit confused because you wrote in your previous post (after that browser js action ):
Szkaradek123 wrote:Here is a finally script to import decoded models from Sketchfab.
As you may know I've extracted an orc some months ago using simple RAM logging (viewtopic.php?f=16&t=10668&p=117317&hil ... ng#p117317).
The problem was to find the (decoded!) face indices in tons of data.
(not sure whether this approach would be successful 11 months later :D )
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

feber13
ultra-n00b
Posts: 1
Joined: Tue Jun 27, 2017 9:54 pm
Has thanked: 1 time

Re: varint decoding

Post by feber13 » Sat Jul 01, 2017 10:00 pm

Szkaradek123 wrote:Here is a trick how to decode varint.
I needed varint decoding to get models from Sketchfab.
So here is a way:
1.select Sketchfab site with your favorite model (best lowpoly)
2.save this site as complete html (it creates html file and folder with the same name as html file)
3.close web browser (best use mozilla firefox)
4.go to folder with saved site and doubleclick on html
5.change web browser mode to offline.
6.open web browser console
6.from saved html folder open file "viewer-c077fc97f229ec2c2f73.js" in notaped++
In offline mode and with "viewer-c077fc97f229ec2c2f73.js" you can control how translate data from function to function


7.in js file find something like that

Code: Select all

function(t,e,i){
       //data 't','e','i' on in
        console.log('t='+t)
        console.log('e='+e)
        console.log('i='+i)
	"use strict";
	var 
	n=i(1205),
	r=n.osg,
	a=function(t,e,i)
		{
		for(var n=new r[i](e),a=0,s=0;a!==e;){var o=0,u=0;do o|=(127&t[s])<<u,u+=7;while(0!==(128&t[s++]));n[a++]=o}if("U"!==i[0])
			for(var l=0;l<e;++l)
				{
				var h=n[l];n[l]=h>>1^-(1&h)
				}
			console.log(n)	
                       //or write console.log('n='+n)
                       //data "n" on out
			return n};t.exports=a},
8.in js write command "console.log(...)" you can see data in console
- example in code
9.refresh web browser and see what happen in console.
10.this method need time and patience.

Here is a finally script to import decoded models from Sketchfab.
Install Blender249 and Python266, doubleclick Blender249.blend, in Text Window press alt+p and select file.osgjs.
To import model you need model_file.bin and file.osgjs in the same folder.
To skip bindposing change line BINDPOSE=1 to BINDPOSE=0
Hello master, I wanted to know if you can make a video tutorial about maybe I got confused in some steps and it would be great help try the blender script produces an error or maybe I am very clumsy

User avatar
M0fD
ultra-n00b
Posts: 1
Joined: Sat Nov 01, 2014 10:05 pm
Location: Les Gobelins
Has thanked: 1 time

Re: varint decoding

Post by M0fD » Wed Mar 13, 2019 6:49 pm

Aaaand a second method but who keeps the animation, love it !
:siren: Ninja Ripper doesn't work with Sketchfab

:siren: No buyable models


Image

User avatar
tpcrew
n00b
Posts: 15
Joined: Sun Jan 08, 2012 12:36 pm
Has thanked: 11 times
Been thanked: 2 times

Re: varint decoding

Post by tpcrew » Thu Mar 14, 2019 9:29 am

Szkaradek123 wrote:
Thu Feb 23, 2017 7:31 pm
edit:2019-02-18

here is a script which can not use to view textured models - for Blender version 2.49:
password:15 in polish language with english letters
How don't use:

3.clear chrome cache ctrl+shift+del - clear only cache

5.with "chrome cache view" export needed files: html, model, osgjs, and images to ONE folder
It'd be great if you could explain this a little better. Thanks.

RetroGEO
ultra-n00b
Posts: 1
Joined: Mon Mar 18, 2019 9:35 pm

Re: varint decoding

Post by RetroGEO » Mon Mar 18, 2019 10:15 pm

Keeps giving me illegal character errors clicking the html file with the model name

slipknot25
ultra-n00b
Posts: 1
Joined: Tue Mar 19, 2019 7:06 am

Re: varint decoding

Post by slipknot25 » Thu Mar 21, 2019 5:08 pm

it extract animation as .action file , how i can unpack .action file or how to use it ?

Post Reply