[C#] Argh... Need some help D=
I think... It'll be better if I just show you guys the coding...
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.
Re: [C#] Argh... Need some help D=
You forgot to state your problem (either that or i just couldn't understand it).
Re: [C#] Argh... Need some help 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.
I'm starting to think I'm going about this all wrong.
Nvm. I'm just gonna hard code it all. D=