Hey!
Im trying to change values from LightIntBand.dbc in memory. It worked good for the Light.dbc but now ive got a problem. I use the following code to change the DBC according to LightIntBand.dbc - WoW.Dev Wiki
Code:
[StructLayout(LayoutKind.Sequential)]
internal struct LightIntBand
{
public uint ID;
public uint NumEntries;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public uint[] TimeValues;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public int[] ColorValues;
}
public class Light
{
public static void ChangeLightColor(Color value)
{
byte[] tmp = new byte[4];
for (uint i = 0; i < Utils.Statics.dbcIntBand.numRows; ++i)
{
EntryPoint.ReadProcessMemory(Process.GetCurrentProcess().Handle, new IntPtr(Statics.dbcIntBand.rowPointer.ToInt32() + i * 4), tmp, 4, IntPtr.Zero);
IntPtr strucPtr = new IntPtr(BitConverter.ToInt32(tmp, 0));
try
{
LightIntBand ent = (LightIntBand)Marshal.PtrToStructure(strucPtr, typeof(LightIntBand));
if ((i % 18) == 2 || (i % 18) == 3 || (i % 18) == 4 || (i % 18) == 5 || (i % 18) == 6)
{
for (uint j = 0; j < 16 && j < ent.NumEntries; ++j)
ent.ColorValues[j] = (value.R >> 8 | (value.G >> 16) | (value.B >> 24) | (0x00));
}
Marshal.StructureToPtr(ent, strucPtr, false);
}
catch (Exception)
{
}
}
}
}
The same code ive used to change Values in Light.dbc where it worked good and changed ingame. But here ive got a problem:
As soon as the code runs i get "WoW has stopped working". No exception, no crash or error, just the Windows JIT Debugger arguing, that WoW had an error.
Does anyone have a clue about this?
Greetings
Cromon