Skip to content

Instantly share code, notes, and snippets.

@Pupix
Created December 28, 2016 16:40
Show Gist options
  • Save Pupix/c6fd98c718152b9bbb33002b040b345f to your computer and use it in GitHub Desktop.
Save Pupix/c6fd98c718152b9bbb33002b040b345f to your computer and use it in GitHub Desktop.
Read .aimesh_ngrid files from League of Legends
//--------------------------------------
//--- 010 Editor v5.0.2 Binary Template
//
// File: .aimesh_ngrid Template
// Author: Pupix <manolea.robert@gmail.com>
// Revision: 1.0
// Purpose: Read .aimesh_ngrid files from League of Legends
//--------------------------------------
//--------------------------------------
// STRUCTS
//--------------------------------------
struct POSITION {
float X;
float Y;
float Z;
};
struct HEADER {
byte MajorVersion;
short MinorVersion;
if (MajorVersion > 0) {
POSITION MinGridPos;
POSITION MaxGridPos;
float CellSize;
uint XCellCount;
uint YCellCount;
} else {
// In this version CellCount are actually
// the last 2 shorts before file end padding
// AFAIK only very old SR has it
local uint XCellCount = 294;
local uint YCellCount = 295;
}
};
struct CELL3 {
float height;
uint32 Unk1;
float Arrival;
byte Open;
float Heuristic;
uint32 Actors;
short X;
short Z;
float Unk2;
float Unk3;
uint32 Unk4;
uint32 SessionIDRelated;
float Ref;
short ArrivalDirection;
short Flags;
short RefNodes[2];
byte unk5[3];
};
struct CELL5 {
float Height;
uint32 Unk1;
float Arrival;
byte Open;
float Heuristic;
uint32 Actors;
short X;
short Z;
float Unk2;
float Unk3;
uint32 Unk4;
uint32 SessionIDRelated;
float Ref;
short ArrivalDirection;
short Flags;
short RefNodes[2];
byte unk5[3];
};
struct CELL7 {
float Height;
ushort Unk1;
float MinHeight;
ushort Unk2;
float Heuristic;
uint32 Actors;
short X;
short Z;
float Unk3;
float Unk4;
uint32 SessionIDRelated;
float Ref;
short ArrivalDirection;
short Flags;
short RefNodes[2];
};
struct FLOAT_MAP {
uint XCount;
uint YCount;
float Unk1;
float Unk2;
float Unk3[XCount * YCount];
float Unk4[810899];
short Unk5;
short Unk6;
};
//--------------------------------------
// PARSING
//--------------------------------------
HEADER header;
local int CellCounter = header.XCellCount * header.YCellCount;
switch (header.MajorVersion) {
case 3:
CELL3 NavigationGrid[CellCounter];
break;
case 5:
CELL5 NavigationGrid[CellCounter];
ushort Unk1[CellCounter];
byte Unk2[528];
break;
case 7:
CELL7 NavigationGrid[CellCounter];
ushort Unk1[CellCounter];
ushort Unk2[CellCounter];
ushort Unk3[CellCounter];
byte Unk4[1056];
break;
default:
};
// More unknowns
FLOAT_MAP unk;
/*
FLAGS
CELL_IS_BRUSH = 0x1,
CELL_WALL = 0x2,
CELL_ALWAYS_VISIBLE = 0x100,
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment