Skip to content

Instantly share code, notes, and snippets.

@skmp
Last active August 6, 2016 21:20
Show Gist options
  • Save skmp/7f43e74304b7f6286e6c191bbf608a8d to your computer and use it in GitHub Desktop.
Save skmp/7f43e74304b7f6286e6c191bbf608a8d to your computer and use it in GitHub Desktop.
$.ajax("https://raw.githubusercontent.com/reicast/reicast-emulator/master/core/emitter/generated_descriptors.h").then(function(a) {
var instructions = a.replace(/\,\n/g,"").replace(/\n/g,"").replace(/\,OP/g,"OP").split("s_LIST_END");
instructions = _.map(instructions, function(a) {
return _.chain(a.split("OP"))
.filter( function(a) { return a != ""})
.map(function(a) { return a.slice(1, -1).split(/(?!\([^),]*),(?![^(]*\))/); })
.map(function(a) { return _.object(["name", "bytes", "enc_param", "enc_imm", "byte_count", "param_1", "param_2", "param_3","opsz"],a) })
.map(function(a) { a.bytes = _(a.bytes.match(/0x[0-9a-f]*/ig)).map(function(a) { return parseInt(a); }); return a; }).value();
});
console.log(instructions);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment