public DvarDumpEventArgs(Dvar dvar) { this.dvar = dvar; }
private void dvarDataGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (formIsLoaded) { int rPos = dvarDataGrid.CurrentCell.ColumnIndex; //Gets the column int i = dvarDataGrid.CurrentRow.Index; //Gets the row if (rPos >= 3) { // int dvarLocation = (int)dvarDataGrid.Rows[i].Cells[1].Value; //Get the memory location of the dvar from the dataGrid int dvarLocation = int.Parse(dvarDataGrid.Rows[i].Cells[1].Value.ToString(), System.Globalization.NumberStyles.HexNumber); Dvar dvar = new Dvar(dvarLocation, Manager.obj.g_dvar_info[selectedGame].typeOffset, Manager.obj.g_dvar_info[selectedGame].valueOffset); switch ((int)dvar.type) { case 0: //dvarTypeStr = "BOOL"; dvar.value = Convert.ToBoolean(dvarDataGrid.Rows[i].Cells[rPos].Value); break; case 1: //dvarTypeStr = "FLOAT"; dvar.value = Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos].Value); break; case 2: //dvarTypeStr = "VEC2"; Vector2 vec2 = new Vector2(Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 1].Value)); dvar.value = vec2; break; case 3: //dvarTypeStr = "VEC3"; Vector3 vec3 = new Vector3(Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 1].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 2].Value)); dvar.value = vec3; break; case 4: //dvarTypeStr = "VEC4"; Vector4 vec4 = new Vector4(Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 1].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 2].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 3].Value)); dvar.value = vec4; break; case 5: //dvarTypeStr = "INT"; dvar.value = Convert.ToInt32(dvarDataGrid.Rows[i].Cells[rPos].Value); break; case 7: // dvarTypeStr = "STRING"; string tmp = Convert.ToString(dvarDataGrid.Rows[i].Cells[rPos].Value) + "\0"; dvar.value = tmp; //We have to write the string to the pointer address break; case 8: //dvarTypeStr = "COLOR"; Vector4 rgba = new Vector4(Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 1].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 2].Value), Convert.ToSingle(dvarDataGrid.Rows[i].Cells[rPos + 3].Value)); dvar.value = rgba; break; case 9: //dvarTypeStr = "INT64"; dvar.value = Convert.ToInt64(dvarDataGrid.Rows[i].Cells[rPos].Value); break; } } } }