- Joined
- Jul 1, 2008
- Messages
- 178
- Reaction score
- 83
I think... It'll be better if I just show you guys the coding...
The idea is that DATABASE_MAP item will match up with the byte[] data and then I need to get from DATABASE_MAP the name variable as a string so I can add it to the dictionary D=...
DATABASE_MAP->Name
I need to get it to a string from the pointer. It's supposed to be an array of 32 chars.
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.IO.Compression;
using ComponentAce.Compression;
using ComponentAce.Compression.Libs.ZLib;
using System.Runtime.InteropServices;
namespace Inumedia.Tools
{
public static partial class RoundDataReader
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct DATABASE_MAP
{
public uint UNK;
public uint mapid;
[MarshalAs(UnmanagedType.U8)]
public fixed char name[32];
}
public const byte MAPITEM_SIZE = 0x28;
public static Dictionary<uint, string> GetMapNames()
{
Dictionary<uint, string> MapNames = new Dictionary<uint, string>();
string path = "basemapdata.dat";
path = GetAbsolutePath(path);
byte[] fData = FileData(path);
fData = Dexor(fData, fData.Length);
UInt32 mapCount = 0;
unsafe
{
fixed (byte* Data = fData)
{
mapCount = *(uint*)&Data[5];
for (int i = 0; i < mapCount; i++)
{
DATABASE_MAP* item = (DATABASE_MAP*)&Data[9 + (i*MAPITEM_SIZE)];
char[] cname = (char[])item->name;
MapNames.Add(item->mapid, cname.ToString());
}
}
}
return MapNames;
}
}
}
The idea is that DATABASE_MAP item will match up with the byte[] data and then I need to get from DATABASE_MAP the name variable as a string so I can add it to the dictionary D=...
DATABASE_MAP->Name
I need to get it to a string from the pointer. It's supposed to be an array of 32 chars.
Last edited:

