Created
January 24, 2016 11:59
-
-
Save Pupix/0b6aadaacabe3078d17c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------- | |
//--- 010 Editor v5.0.2 Binary Template | |
// | |
// File: BINTemplate | |
// Author: Pupix <[email protected]> | |
// Purpose: League of Legends .bin file parsing | |
// Licence: MIT | |
//-------------------------------------- | |
// PREDEFINE | |
struct HEADER; | |
struct PROPERTY; | |
struct DETAIL; | |
struct TYPE; | |
// STRUCTS | |
struct HEADER { | |
char magic[4]; | |
int32 version; | |
int32 propCounter; | |
uint32 propType[propCounter]; | |
}; | |
struct PROPERTY { | |
uint32 length; | |
local uint check = FTell() + length; | |
uint hash; | |
ubyte detailCount; | |
ubyte unkByte; | |
DETAIL detail[detailCount] <optimize=false>; | |
if (FTell() != check) { | |
Printf("Wrong detail size from %d to %d. It's %d, but should have been %d\n", check - length, FTell(), FTell() - (check - length), length); | |
Warning("Wrong detail size from %d to %d. It's %d, but should have been %d\n", check - length, FTell(), FTell() - (check - length), length); | |
return -1; | |
}; | |
}; | |
struct DETAIL { | |
uint32 hash; | |
ubyte type; | |
TYPE value(type); | |
}; | |
struct TYPE (ubyte type) { | |
switch(type) { | |
case 0: | |
ubyte unk[6]; | |
DETAIL value; | |
break; | |
case 1: | |
case 2: | |
case 3: | |
case 4: | |
case 12: | |
case 17: | |
ubyte value; | |
break; | |
case 6: | |
case 7: | |
uint value; | |
break; | |
case 10: | |
case 15: | |
case 21: | |
float value; | |
break; | |
case 11: | |
float value[2]; | |
break; | |
case 13: | |
float value[4]; | |
break; | |
case 16: | |
ushort nameLength; | |
char name[nameLength]; | |
break; | |
case 18: | |
byte entriesType; | |
uint entriesLength; | |
uint entriesCount; | |
TYPE value(entriesType)[entriesCount] <optimize=false>; | |
break; | |
case 19: | |
case 20: | |
uint hash; | |
uint entriesLength; | |
ushort entriesCount; | |
DETAIL value[entriesCount] <optimize=false>; | |
//ubyte value[entriesLength - 2]; | |
break; | |
case 22: | |
byte entriesType; | |
byte entriesCount; | |
TYPE value(entriesType)[entriesCount] <optimize=false>; | |
break; | |
default: | |
local uint check = FTell(); | |
Printf("Unknown detail type at : %d\n", check); | |
Warning("Unknown detail type at : %d", check); | |
return -1; | |
break; | |
} | |
}; | |
// PARSING | |
HEADER header; | |
PROPERTY properties[header.propCounter] <optimize=false>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment