Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
/ dso.js Public archive

**DEPRECATED** A DSO decompiler for Blockland. This is here for legacy purposes only. Use DSO Sharp instead!

Notifications You must be signed in to change notification settings

Elletra/dso.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

!!! DEPRECATED !!!

Use DSO Sharp instead!

dso.js

A DSO decompiler for Blockland.

Installation

npm install dso.js

Usage

For client-side, use with the buffer package.

For server-side, you can just use the native Buffer class.

Browser Example:

import { Buffer }     from 'buffer/';
import { decompiler } from 'dso.js';


// An HTML <input> element with the type "file" and an ID of "fileUpload"
document.getElementById ('fileUpload').onchange = function ( event )
{
	if ( event.target.files.length <= 0 )
	{
		return;
	}

	const file   = event.target.files[0];
	const reader = new FileReader ();

	reader.readAsArrayBuffer (file);

	reader.onload = function ( readerEvent )
	{
		const buffer = Buffer.from (readerEvent.target.result);

		let codeString;

		try
		{
			codeString = decompiler.decompileDSO (buffer);
		}
		catch ( error )
		{
			console.error ('Decompiler Error:', error);
			return;
		}

		console.log (codeString);
	};
};

Node.js Example:

const fs = require ('fs');

const { decompiler } = require ('dso.js');


fs.readFile ('./myFile.cs.dso', ( error, buffer ) =>
{
	if ( error )
	{
		console.error (error);
		return;
	}

	let codeString;

	try
	{
		codeString = decompiler.decompileDSO (buffer);
	}
	catch ( decompilerError )
	{
		console.error ('[!] Decompiler Error:', decompilerError);
		return;
	}

	fs.writeFileSync ('./myFile.cs', codeString);
});

Decompiler Options

The optional second argument of decompileDSO is an options object.

The only one at the moment is the outputArray boolean, which is false by default. When set to true, it makes decompileDSO output a nested code array instead of a string.

Enable the option like this:

decompiler.decompileDSO (buffer, { outputArray: true });

About

**DEPRECATED** A DSO decompiler for Blockland. This is here for legacy purposes only. Use DSO Sharp instead!

Topics

Resources

Stars

Watchers

Forks