diff --git a/WolvenKit/Forms/frmCR2WtoText.Designer.cs b/WolvenKit/Forms/frmCR2WtoText.Designer.cs index 718cab7dd..937573fd6 100644 --- a/WolvenKit/Forms/frmCR2WtoText.Designer.cs +++ b/WolvenKit/Forms/frmCR2WtoText.Designer.cs @@ -29,12 +29,14 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCR2WtoText)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.btnRun = new System.Windows.Forms.Button(); this.rtfDescription = new System.Windows.Forms.RichTextBox(); this.pnlControls = new System.Windows.Forms.Panel(); + this.chkDumpYML = new System.Windows.Forms.CheckBox(); + this.chkDumpOnlyEdited = new System.Windows.Forms.CheckBox(); this.chkLocalizedString = new System.Windows.Forms.CheckBox(); this.labNumThreads = new System.Windows.Forms.Label(); this.numThreads = new System.Windows.Forms.NumericUpDown(); @@ -81,10 +83,10 @@ private void InitializeComponent() this.btnRun.Enabled = false; this.btnRun.Image = global::WolvenKit.Properties.Resources.Output_16x; this.btnRun.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.btnRun.Location = new System.Drawing.Point(292, 791); - this.btnRun.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnRun.Location = new System.Drawing.Point(260, 633); + this.btnRun.Margin = new System.Windows.Forms.Padding(4); this.btnRun.Name = "btnRun"; - this.btnRun.Size = new System.Drawing.Size(630, 35); + this.btnRun.Size = new System.Drawing.Size(560, 28); this.btnRun.TabIndex = 30; this.btnRun.Text = "Run CR2W Dump"; this.btnRun.UseVisualStyleBackColor = true; @@ -96,18 +98,20 @@ private void InitializeComponent() this.rtfDescription.CausesValidation = false; this.rtfDescription.Cursor = System.Windows.Forms.Cursors.Default; this.rtfDescription.Font = new System.Drawing.Font("Calibri", 9F); - this.rtfDescription.Location = new System.Drawing.Point(18, 18); - this.rtfDescription.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.rtfDescription.Location = new System.Drawing.Point(16, 14); + this.rtfDescription.Margin = new System.Windows.Forms.Padding(4); this.rtfDescription.Name = "rtfDescription"; this.rtfDescription.ReadOnly = true; this.rtfDescription.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - this.rtfDescription.Size = new System.Drawing.Size(1110, 262); + this.rtfDescription.Size = new System.Drawing.Size(987, 210); this.rtfDescription.TabIndex = 20; this.rtfDescription.TabStop = false; this.rtfDescription.Text = resources.GetString("rtfDescription.Text"); // // pnlControls // + this.pnlControls.Controls.Add(this.chkDumpYML); + this.pnlControls.Controls.Add(this.chkDumpOnlyEdited); this.pnlControls.Controls.Add(this.chkLocalizedString); this.pnlControls.Controls.Add(this.labNumThreads); this.pnlControls.Controls.Add(this.numThreads); @@ -127,21 +131,47 @@ private void InitializeComponent() this.pnlControls.Controls.Add(this.btnChoosePath); this.pnlControls.Controls.Add(this.txtPath); this.pnlControls.Controls.Add(this.grpRadioOutputMode); - this.pnlControls.Location = new System.Drawing.Point(18, 295); - this.pnlControls.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.pnlControls.Location = new System.Drawing.Point(16, 236); + this.pnlControls.Margin = new System.Windows.Forms.Padding(4); this.pnlControls.Name = "pnlControls"; - this.pnlControls.Size = new System.Drawing.Size(1110, 483); + this.pnlControls.Size = new System.Drawing.Size(987, 386); this.pnlControls.TabIndex = 21; // + // chkDumpYML + // + this.chkDumpYML.AutoSize = true; + this.chkDumpYML.Checked = true; + this.chkDumpYML.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkDumpYML.Location = new System.Drawing.Point(604, 202); + this.chkDumpYML.Margin = new System.Windows.Forms.Padding(4); + this.chkDumpYML.Name = "chkDumpYML"; + this.chkDumpYML.Size = new System.Drawing.Size(176, 20); + this.chkDumpYML.TabIndex = 39; + this.chkDumpYML.Text = "Dump YML (radish-style)"; + this.chkDumpYML.UseVisualStyleBackColor = true; + // + // chkDumpOnlyEdited + // + this.chkDumpOnlyEdited.AutoSize = true; + this.chkDumpOnlyEdited.Checked = true; + this.chkDumpOnlyEdited.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkDumpOnlyEdited.Location = new System.Drawing.Point(604, 156); + this.chkDumpOnlyEdited.Margin = new System.Windows.Forms.Padding(4); + this.chkDumpOnlyEdited.Name = "chkDumpOnlyEdited"; + this.chkDumpOnlyEdited.Size = new System.Drawing.Size(178, 20); + this.chkDumpOnlyEdited.TabIndex = 38; + this.chkDumpOnlyEdited.Text = "Dump only edited values"; + this.chkDumpOnlyEdited.UseVisualStyleBackColor = true; + // // chkLocalizedString // this.chkLocalizedString.AutoSize = true; this.chkLocalizedString.Checked = true; this.chkLocalizedString.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkLocalizedString.Location = new System.Drawing.Point(216, 352); - this.chkLocalizedString.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkLocalizedString.Location = new System.Drawing.Point(192, 282); + this.chkLocalizedString.Margin = new System.Windows.Forms.Padding(4); this.chkLocalizedString.Name = "chkLocalizedString"; - this.chkLocalizedString.Size = new System.Drawing.Size(297, 24); + this.chkLocalizedString.Size = new System.Drawing.Size(249, 20); this.chkLocalizedString.TabIndex = 15; this.chkLocalizedString.Text = "Dump localized strings instead of IDs"; this.chkLocalizedString.UseVisualStyleBackColor = true; @@ -149,24 +179,24 @@ private void InitializeComponent() // labNumThreads // this.labNumThreads.AutoSize = true; - this.labNumThreads.Location = new System.Drawing.Point(458, 82); + this.labNumThreads.Location = new System.Drawing.Point(407, 66); this.labNumThreads.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labNumThreads.Name = "labNumThreads"; - this.labNumThreads.Size = new System.Drawing.Size(145, 20); + this.labNumThreads.Size = new System.Drawing.Size(121, 16); this.labNumThreads.TabIndex = 37; this.labNumThreads.Text = "Number of threads:"; // // numThreads // - this.numThreads.Location = new System.Drawing.Point(609, 78); - this.numThreads.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.numThreads.Location = new System.Drawing.Point(541, 62); + this.numThreads.Margin = new System.Windows.Forms.Padding(4); this.numThreads.Minimum = new decimal(new int[] { 1, 0, 0, 0}); this.numThreads.Name = "numThreads"; - this.numThreads.Size = new System.Drawing.Size(54, 26); + this.numThreads.Size = new System.Drawing.Size(48, 22); this.numThreads.TabIndex = 6; this.numThreads.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.numThreads.Value = new decimal(new int[] { @@ -180,10 +210,10 @@ private void InitializeComponent() this.chkCreateFolders.AutoSize = true; this.chkCreateFolders.Checked = true; this.chkCreateFolders.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkCreateFolders.Location = new System.Drawing.Point(216, 195); - this.chkCreateFolders.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkCreateFolders.Location = new System.Drawing.Point(192, 156); + this.chkCreateFolders.Margin = new System.Windows.Forms.Padding(4); this.chkCreateFolders.Name = "chkCreateFolders"; - this.chkCreateFolders.Size = new System.Drawing.Size(227, 24); + this.chkCreateFolders.Size = new System.Drawing.Size(191, 20); this.chkCreateFolders.TabIndex = 10; this.chkCreateFolders.Text = "Create intermediate folders"; this.chkCreateFolders.UseVisualStyleBackColor = true; @@ -191,12 +221,10 @@ private void InitializeComponent() // chkDumpEmbedded // this.chkDumpEmbedded.AutoSize = true; - this.chkDumpEmbedded.Checked = true; - this.chkDumpEmbedded.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkDumpEmbedded.Location = new System.Drawing.Point(216, 258); - this.chkDumpEmbedded.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkDumpEmbedded.Location = new System.Drawing.Point(192, 206); + this.chkDumpEmbedded.Margin = new System.Windows.Forms.Padding(4); this.chkDumpEmbedded.Name = "chkDumpEmbedded"; - this.chkDumpEmbedded.Size = new System.Drawing.Size(172, 24); + this.chkDumpEmbedded.Size = new System.Drawing.Size(147, 20); this.chkDumpEmbedded.TabIndex = 12; this.chkDumpEmbedded.Text = "List embedded files"; this.chkDumpEmbedded.UseVisualStyleBackColor = true; @@ -205,21 +233,21 @@ private void InitializeComponent() // this.grpExistingFiles.Controls.Add(this.radExistingSkip); this.grpExistingFiles.Controls.Add(this.radExistingOverwrite); - this.grpExistingFiles.Location = new System.Drawing.Point(216, 392); - this.grpExistingFiles.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.grpExistingFiles.Location = new System.Drawing.Point(192, 314); + this.grpExistingFiles.Margin = new System.Windows.Forms.Padding(4); this.grpExistingFiles.Name = "grpExistingFiles"; - this.grpExistingFiles.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.grpExistingFiles.Size = new System.Drawing.Size(213, 86); + this.grpExistingFiles.Padding = new System.Windows.Forms.Padding(4); + this.grpExistingFiles.Size = new System.Drawing.Size(189, 69); this.grpExistingFiles.TabIndex = 20; this.grpExistingFiles.TabStop = false; // // radExistingSkip // this.radExistingSkip.AutoSize = true; - this.radExistingSkip.Location = new System.Drawing.Point(9, 51); - this.radExistingSkip.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.radExistingSkip.Location = new System.Drawing.Point(8, 41); + this.radExistingSkip.Margin = new System.Windows.Forms.Padding(4); this.radExistingSkip.Name = "radExistingSkip"; - this.radExistingSkip.Size = new System.Drawing.Size(154, 24); + this.radExistingSkip.Size = new System.Drawing.Size(131, 20); this.radExistingSkip.TabIndex = 22; this.radExistingSkip.TabStop = true; this.radExistingSkip.Text = "Skip existing files"; @@ -229,10 +257,10 @@ private void InitializeComponent() // this.radExistingOverwrite.AutoSize = true; this.radExistingOverwrite.Checked = true; - this.radExistingOverwrite.Location = new System.Drawing.Point(9, 18); - this.radExistingOverwrite.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.radExistingOverwrite.Location = new System.Drawing.Point(8, 14); + this.radExistingOverwrite.Margin = new System.Windows.Forms.Padding(4); this.radExistingOverwrite.Name = "radExistingOverwrite"; - this.radExistingOverwrite.Size = new System.Drawing.Size(189, 24); + this.radExistingOverwrite.Size = new System.Drawing.Size(160, 20); this.radExistingOverwrite.TabIndex = 21; this.radExistingOverwrite.TabStop = true; this.radExistingOverwrite.Text = "Overwrite existing files"; @@ -241,12 +269,10 @@ private void InitializeComponent() // chkPrefixFileName // this.chkPrefixFileName.AutoSize = true; - this.chkPrefixFileName.Checked = true; - this.chkPrefixFileName.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkPrefixFileName.Location = new System.Drawing.Point(216, 228); - this.chkPrefixFileName.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkPrefixFileName.Location = new System.Drawing.Point(192, 182); + this.chkPrefixFileName.Margin = new System.Windows.Forms.Padding(4); this.chkPrefixFileName.Name = "chkPrefixFileName"; - this.chkPrefixFileName.Size = new System.Drawing.Size(241, 24); + this.chkPrefixFileName.Size = new System.Drawing.Size(202, 20); this.chkPrefixFileName.TabIndex = 11; this.chkPrefixFileName.Text = "Prefix each line with file name"; this.chkPrefixFileName.UseVisualStyleBackColor = true; @@ -254,10 +280,10 @@ private void InitializeComponent() // chkDumpFCD // this.chkDumpFCD.AutoSize = true; - this.chkDumpFCD.Location = new System.Drawing.Point(216, 322); - this.chkDumpFCD.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkDumpFCD.Location = new System.Drawing.Point(192, 258); + this.chkDumpFCD.Margin = new System.Windows.Forms.Padding(4); this.chkDumpFCD.Name = "chkDumpFCD"; - this.chkDumpFCD.Size = new System.Drawing.Size(205, 24); + this.chkDumpFCD.Size = new System.Drawing.Size(173, 20); this.chkDumpFCD.TabIndex = 14; this.chkDumpFCD.Text = "Dump flatCompiledData"; this.chkDumpFCD.UseVisualStyleBackColor = true; @@ -267,10 +293,10 @@ private void InitializeComponent() this.chkDumpSDB.AutoSize = true; this.chkDumpSDB.Checked = true; this.chkDumpSDB.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkDumpSDB.Location = new System.Drawing.Point(216, 291); - this.chkDumpSDB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.chkDumpSDB.Location = new System.Drawing.Point(192, 233); + this.chkDumpSDB.Margin = new System.Windows.Forms.Padding(4); this.chkDumpSDB.Name = "chkDumpSDB"; - this.chkDumpSDB.Size = new System.Drawing.Size(267, 24); + this.chkDumpSDB.Size = new System.Drawing.Size(219, 20); this.chkDumpSDB.TabIndex = 13; this.chkDumpSDB.Text = "Dump SharedDataBuffer buffers"; this.chkDumpSDB.UseVisualStyleBackColor = true; @@ -278,20 +304,20 @@ private void InitializeComponent() // labOutputFileMode // this.labOutputFileMode.AutoSize = true; - this.labOutputFileMode.Location = new System.Drawing.Point(82, 82); + this.labOutputFileMode.Location = new System.Drawing.Point(73, 66); this.labOutputFileMode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labOutputFileMode.Name = "labOutputFileMode"; - this.labOutputFileMode.Size = new System.Drawing.Size(130, 20); + this.labOutputFileMode.Size = new System.Drawing.Size(107, 16); this.labOutputFileMode.TabIndex = 30; this.labOutputFileMode.Text = "Output file mode:"; this.labOutputFileMode.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // btnPickOutput // - this.btnPickOutput.Location = new System.Drawing.Point(904, 143); - this.btnPickOutput.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnPickOutput.Location = new System.Drawing.Point(804, 114); + this.btnPickOutput.Margin = new System.Windows.Forms.Padding(4); this.btnPickOutput.Name = "btnPickOutput"; - this.btnPickOutput.Size = new System.Drawing.Size(112, 35); + this.btnPickOutput.Size = new System.Drawing.Size(100, 28); this.btnPickOutput.TabIndex = 8; this.btnPickOutput.Text = "Set output"; this.btnPickOutput.UseVisualStyleBackColor = true; @@ -300,10 +326,10 @@ private void InitializeComponent() // labOverwrite // this.labOverwrite.AutoSize = true; - this.labOverwrite.Location = new System.Drawing.Point(93, 428); + this.labOverwrite.Location = new System.Drawing.Point(83, 342); this.labOverwrite.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labOverwrite.Name = "labOverwrite"; - this.labOverwrite.Size = new System.Drawing.Size(117, 20); + this.labOverwrite.Size = new System.Drawing.Size(100, 16); this.labOverwrite.TabIndex = 22; this.labOverwrite.Text = "File overwriting:"; this.labOverwrite.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -311,10 +337,10 @@ private void InitializeComponent() // labDumpOptions // this.labDumpOptions.AutoSize = true; - this.labDumpOptions.Location = new System.Drawing.Point(100, 258); + this.labDumpOptions.Location = new System.Drawing.Point(89, 206); this.labDumpOptions.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labDumpOptions.Name = "labDumpOptions"; - this.labDumpOptions.Size = new System.Drawing.Size(112, 20); + this.labDumpOptions.Size = new System.Drawing.Size(94, 16); this.labDumpOptions.TabIndex = 22; this.labDumpOptions.Text = "Dump options:"; this.labDumpOptions.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -322,10 +348,10 @@ private void InitializeComponent() // labOutputFile // this.labOutputFile.AutoSize = true; - this.labOutputFile.Location = new System.Drawing.Point(82, 149); + this.labOutputFile.Location = new System.Drawing.Point(73, 119); this.labOutputFile.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labOutputFile.Name = "labOutputFile"; - this.labOutputFile.Size = new System.Drawing.Size(131, 20); + this.labOutputFile.Size = new System.Drawing.Size(105, 16); this.labOutputFile.TabIndex = 23; this.labOutputFile.Text = "Output results to:"; this.labOutputFile.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -333,29 +359,29 @@ private void InitializeComponent() // labPath // this.labPath.AutoSize = true; - this.labPath.Location = new System.Drawing.Point(104, 22); + this.labPath.Location = new System.Drawing.Point(92, 18); this.labPath.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labPath.Name = "labPath"; - this.labPath.Size = new System.Drawing.Size(108, 20); + this.labPath.Size = new System.Drawing.Size(91, 16); this.labPath.TabIndex = 21; this.labPath.Text = "Source folder:"; this.labPath.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // txtOutputDestination // - this.txtOutputDestination.Location = new System.Drawing.Point(216, 145); - this.txtOutputDestination.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtOutputDestination.Location = new System.Drawing.Point(192, 116); + this.txtOutputDestination.Margin = new System.Windows.Forms.Padding(4); this.txtOutputDestination.Name = "txtOutputDestination"; - this.txtOutputDestination.Size = new System.Drawing.Size(678, 26); + this.txtOutputDestination.Size = new System.Drawing.Size(603, 22); this.txtOutputDestination.TabIndex = 7; this.txtOutputDestination.TextChanged += new System.EventHandler(this.txtOutputDestination_TextChanged); // // btnChoosePath // - this.btnChoosePath.Location = new System.Drawing.Point(904, 17); - this.btnChoosePath.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnChoosePath.Location = new System.Drawing.Point(804, 14); + this.btnChoosePath.Margin = new System.Windows.Forms.Padding(4); this.btnChoosePath.Name = "btnChoosePath"; - this.btnChoosePath.Size = new System.Drawing.Size(112, 31); + this.btnChoosePath.Size = new System.Drawing.Size(100, 25); this.btnChoosePath.TabIndex = 2; this.btnChoosePath.Text = "Select path"; this.btnChoosePath.UseVisualStyleBackColor = true; @@ -363,10 +389,10 @@ private void InitializeComponent() // // txtPath // - this.txtPath.Location = new System.Drawing.Point(216, 17); - this.txtPath.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtPath.Location = new System.Drawing.Point(192, 14); + this.txtPath.Margin = new System.Windows.Forms.Padding(4); this.txtPath.Name = "txtPath"; - this.txtPath.Size = new System.Drawing.Size(678, 26); + this.txtPath.Size = new System.Drawing.Size(603, 22); this.txtPath.TabIndex = 1; this.txtPath.TextChanged += new System.EventHandler(this.txtPath_TextChanged); // @@ -375,11 +401,11 @@ private void InitializeComponent() this.grpRadioOutputMode.Controls.Add(this.radOutputModeSeparateFiles); this.grpRadioOutputMode.Controls.Add(this.radOutputModeSingleFile); this.grpRadioOutputMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.grpRadioOutputMode.Location = new System.Drawing.Point(216, 51); - this.grpRadioOutputMode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.grpRadioOutputMode.Location = new System.Drawing.Point(192, 41); + this.grpRadioOutputMode.Margin = new System.Windows.Forms.Padding(4); this.grpRadioOutputMode.Name = "grpRadioOutputMode"; - this.grpRadioOutputMode.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.grpRadioOutputMode.Size = new System.Drawing.Size(213, 78); + this.grpRadioOutputMode.Padding = new System.Windows.Forms.Padding(4); + this.grpRadioOutputMode.Size = new System.Drawing.Size(189, 62); this.grpRadioOutputMode.TabIndex = 3; this.grpRadioOutputMode.TabStop = false; // @@ -387,10 +413,10 @@ private void InitializeComponent() // this.radOutputModeSeparateFiles.AutoSize = true; this.radOutputModeSeparateFiles.Checked = true; - this.radOutputModeSeparateFiles.Location = new System.Drawing.Point(9, 17); - this.radOutputModeSeparateFiles.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.radOutputModeSeparateFiles.Location = new System.Drawing.Point(8, 14); + this.radOutputModeSeparateFiles.Margin = new System.Windows.Forms.Padding(4); this.radOutputModeSeparateFiles.Name = "radOutputModeSeparateFiles"; - this.radOutputModeSeparateFiles.Size = new System.Drawing.Size(191, 24); + this.radOutputModeSeparateFiles.Size = new System.Drawing.Size(161, 20); this.radOutputModeSeparateFiles.TabIndex = 4; this.radOutputModeSeparateFiles.TabStop = true; this.radOutputModeSeparateFiles.Text = "One file per source file"; @@ -400,10 +426,10 @@ private void InitializeComponent() // radOutputModeSingleFile // this.radOutputModeSingleFile.AutoSize = true; - this.radOutputModeSingleFile.Location = new System.Drawing.Point(9, 45); - this.radOutputModeSingleFile.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.radOutputModeSingleFile.Location = new System.Drawing.Point(8, 36); + this.radOutputModeSingleFile.Margin = new System.Windows.Forms.Padding(4); this.radOutputModeSingleFile.Name = "radOutputModeSingleFile"; - this.radOutputModeSingleFile.Size = new System.Drawing.Size(102, 24); + this.radOutputModeSingleFile.Size = new System.Drawing.Size(87, 20); this.radOutputModeSingleFile.TabIndex = 5; this.radOutputModeSingleFile.Text = "Single file"; this.radOutputModeSingleFile.UseVisualStyleBackColor = true; @@ -415,10 +441,10 @@ private void InitializeComponent() this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.prgProgressBar}); this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; - this.statusStrip1.Location = new System.Drawing.Point(0, 1305); + this.statusStrip1.Location = new System.Drawing.Point(0, 952); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Padding = new System.Windows.Forms.Padding(2, 0, 21, 0); - this.statusStrip1.Size = new System.Drawing.Size(1146, 33); + this.statusStrip1.Padding = new System.Windows.Forms.Padding(2, 0, 19, 0); + this.statusStrip1.Size = new System.Drawing.Size(1019, 28); this.statusStrip1.SizingGrip = false; this.statusStrip1.TabIndex = 25; this.statusStrip1.Text = "statusStrip1"; @@ -427,7 +453,7 @@ private void InitializeComponent() // this.prgProgressBar.Name = "prgProgressBar"; this.prgProgressBar.Overflow = System.Windows.Forms.ToolStripItemOverflow.Always; - this.prgProgressBar.Size = new System.Drawing.Size(1140, 25); + this.prgProgressBar.Size = new System.Drawing.Size(1013, 20); // // dataStatus // @@ -436,14 +462,14 @@ private void InitializeComponent() this.dataStatus.AllowUserToResizeColumns = false; this.dataStatus.AllowUserToResizeRows = false; this.dataStatus.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataStatus.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataStatus.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dataStatus.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataStatus.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colAllFiles, @@ -452,34 +478,34 @@ private void InitializeComponent() this.colProcessedFiles, this.colSkipped, this.colExceptions}); - this.dataStatus.Location = new System.Drawing.Point(292, 843); - this.dataStatus.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.dataStatus.Location = new System.Drawing.Point(260, 674); + this.dataStatus.Margin = new System.Windows.Forms.Padding(4); this.dataStatus.MultiSelect = false; this.dataStatus.Name = "dataStatus"; this.dataStatus.ReadOnly = true; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Info; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Info; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataStatus.RowHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Info; + dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Info; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataStatus.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; this.dataStatus.RowHeadersVisible = false; this.dataStatus.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Info; - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle3.Format = "N0"; - dataGridViewCellStyle3.NullValue = "-"; - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Info; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.WindowText; - this.dataStatus.RowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Info; + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.Format = "N0"; + dataGridViewCellStyle6.NullValue = "-"; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Info; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.WindowText; + this.dataStatus.RowsDefaultCellStyle = dataGridViewCellStyle6; this.dataStatus.RowTemplate.ReadOnly = true; this.dataStatus.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.dataStatus.ScrollBars = System.Windows.Forms.ScrollBars.None; this.dataStatus.ShowEditingIcon = false; - this.dataStatus.Size = new System.Drawing.Size(630, 88); + this.dataStatus.Size = new System.Drawing.Size(560, 70); this.dataStatus.TabIndex = 31; this.dataStatus.TabStop = false; // @@ -552,22 +578,22 @@ private void InitializeComponent() // txtLog // this.txtLog.BackColor = System.Drawing.SystemColors.Window; - this.txtLog.Location = new System.Drawing.Point(18, 943); - this.txtLog.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtLog.Location = new System.Drawing.Point(13, 752); + this.txtLog.Margin = new System.Windows.Forms.Padding(4); this.txtLog.Multiline = true; this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.txtLog.Size = new System.Drawing.Size(1108, 347); + this.txtLog.Size = new System.Drawing.Size(985, 226); this.txtLog.TabIndex = 32; this.txtLog.TabStop = false; this.txtLog.WordWrap = false; // // frmCR2WtoText // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1146, 1338); + this.ClientSize = new System.Drawing.Size(1019, 980); this.Controls.Add(this.txtLog); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.dataStatus); @@ -575,13 +601,14 @@ private void InitializeComponent() this.Controls.Add(this.btnRun); this.Controls.Add(this.pnlControls); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "frmCR2WtoText"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Dump CR2W Files To Text"; + this.Text = "Dump CR2W Files To Text & YML"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmCR2WtoText_FormClosing); + this.Load += new System.EventHandler(this.frmCR2WtoText_Load); this.pnlControls.ResumeLayout(false); this.pnlControls.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numThreads)).EndInit(); @@ -634,5 +661,7 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn colSkipped; private System.Windows.Forms.DataGridViewTextBoxColumn colExceptions; private System.Windows.Forms.CheckBox chkLocalizedString; + private System.Windows.Forms.CheckBox chkDumpOnlyEdited; + private System.Windows.Forms.CheckBox chkDumpYML; } } \ No newline at end of file diff --git a/WolvenKit/Forms/frmCR2WtoText.cs b/WolvenKit/Forms/frmCR2WtoText.cs index b4745aa1f..dcac011fa 100644 --- a/WolvenKit/Forms/frmCR2WtoText.cs +++ b/WolvenKit/Forms/frmCR2WtoText.cs @@ -1,7 +1,6 @@ using Microsoft.WindowsAPICodePack.Dialogs; using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Linq; using System.Threading; @@ -11,7 +10,6 @@ using WolvenKit.Common.Model; using WolvenKit.Common.Services; using WolvenKit.CR2W; -using static WolvenKit.Forms.frmChunkProperties; using MessageBoxButtons = System.Windows.Forms.MessageBoxButtons; using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; @@ -21,7 +19,7 @@ public partial class frmCR2WtoText : Form { private readonly string[] extExclude = { ".txt", ".json", ".csv", ".xml", ".jpg", ".png", ".buffer", ".navgraph", ".navtile", ".usm", ".wem", ".dds", ".bnk", ".xbm", ".bundle", ".w3strings", ".store", ".navconfig", - ".srt", ".naviobstacles", ".navmesh", ".sav", ".subs" }; + ".srt", ".naviobstacles", ".navmesh", ".sav", ".subs", ".yml" }; private StatusController statusController; private readonly List Files = new List(); @@ -85,8 +83,10 @@ private void SetDefaults() radOutputModeSingleFile.Checked = OutputSingleFile; radOutputModeSeparateFiles.Checked = !OutputSingleFile; chkDumpSDB.Checked = true; + chkDumpYML.Checked = true; + chkDumpOnlyEdited.Checked = true; chkDumpFCD.Checked = false; - chkDumpEmbedded.Checked = true; + chkDumpEmbedded.Checked = false; numThreads.Value = Environment.ProcessorCount; numThreads.Maximum = Environment.ProcessorCount * 2; } @@ -175,6 +175,9 @@ private async Task DoRun() ListEmbedded = chkDumpEmbedded.Checked, DumpFCD = chkDumpFCD.Checked, DumpSDB = chkDumpSDB.Checked, + DumpYML = chkDumpYML.Checked, + DumpTXT = true, + DumpOnlyEdited = chkDumpOnlyEdited.Checked, LocalizeStrings = chkLocalizedString.Checked }; @@ -337,6 +340,11 @@ private void frmCR2WtoText_FormClosing(object sender, FormClosingEventArgs e) else e.Cancel = false; } + + private void frmCR2WtoText_Load(object sender, EventArgs e) + { + + } } internal class StatusController { @@ -434,6 +442,8 @@ public override async Task StartDump() Parallel.ForEach(Files, parOptions, async fileName => { string outputDestination; + string outputDestinationTxt; + string outputDestinationYml; string fileBaseName = Path.GetFileName(fileName); string fileNameNoSourcePath = FileNameNoSourcePath(fileName, WriterData.SourcePath); @@ -448,22 +458,24 @@ public override async Task StartDump() else outputDestination = WriterData.OutputLocation; - outputDestination = outputDestination + "\\" + fileBaseName + ".txt"; + outputDestinationTxt = outputDestination + "\\" + fileBaseName + ".txt"; + outputDestinationYml = outputDestination + "\\" + fileBaseName + ".yml"; try { bool skip = false; - if (File.Exists(outputDestination)) + if (File.Exists(outputDestinationTxt)) if (WriterData.OverwriteFiles) - File.Delete(outputDestination); + File.Delete(outputDestinationTxt); else skip = true; if (!skip) { - using (StreamWriter streamDestination = new StreamWriter(outputDestination, false)) + using (StreamWriter streamDestination = new StreamWriter(outputDestinationTxt, false)) + using (StreamWriter streamDestinationYml = new StreamWriter(outputDestinationYml, false)) { - await Dump(streamDestination, fileName); + await Dump(streamDestination, streamDestinationYml, fileName); lock (statusLock) WriterData.Status.Processed++; } @@ -492,15 +504,17 @@ internal LoggerWriterSingle(List files, LoggerWriterData writerData, Log public override async Task StartDump() { string outputDestination = WriterData.OutputLocation; + string outputDestinationYml = WriterData.OutputLocation + ".yml"; if (File.Exists(outputDestination)) File.Delete(outputDestination); using (StreamWriter streamDestination = new StreamWriter(outputDestination, false)) + using (StreamWriter streamDestinationYml = new StreamWriter(outputDestinationYml, false)) foreach (var fileName in Files) { if (WriterData.CancelToken.IsCancellationRequested) break; - await Dump(streamDestination, fileName); + await Dump(streamDestination, streamDestinationYml, fileName); WriterData.Status.Processed++; } } @@ -539,15 +553,22 @@ protected void ExceptionOccurred(string fileName, string msg) OnExceptionFile?.Invoke(fileName, msg); } #pragma warning disable CS1998 - protected async Task Dump(StreamWriter streamDestination, string fileName) + protected async Task Dump(StreamWriter streamDestination, StreamWriter streamDestinationYml, string fileName) #pragma warning restore CS1998 { LoggerOutputFileTxt outputFile = new LoggerOutputFileTxt(streamDestination, WriterData.PrefixFileName, Path.GetFileName(fileName)); + LoggerOutputFileYml outputFileYml = new LoggerOutputFileYml(streamDestinationYml, WriterData.PrefixFileName, + Path.GetFileName(fileName)); try { - var lCR2W = new LoggerCR2W(fileName, outputFile, CR2WOptions); + var lCR2W = new LoggerCR2W(fileName, outputFile, outputFileYml, CR2WOptions); outputFile.WriteLine("FILE: " + fileName); + if (CR2WOptions.DumpYML) + { + outputFileYml.WriteLine("templates:"); + outputFileYml.WriteLine(" ### FILE: " + fileName); + } lCR2W.OnException += (msg, ex) => { OnExceptionFile?.Invoke(fileName, msg + ex.Message); @@ -584,6 +605,35 @@ protected async Task Dump(StreamWriter streamDestination, string fileName) } } + internal class LoggerOutputFileYml : LoggerOutputFile + { + private string Prefix { get; } + private bool PrefixLine { get; } + private string TempLine { get; set; } + internal LoggerOutputFileYml(StreamWriter streamDestination, bool prefixLine, string prefix) + : base(streamDestination) + { + PrefixLine = prefixLine; + Prefix = prefix; + } + public void WriteLine(string line) + { + OutputFile.WriteLine(line); + } + public override void Write(string text, int level = 0) + { + string line; + string indent = ""; + + for (int i = 0; i < level; i++) + indent += " "; + + line = indent + text; + + WriteLine(line); + } + } + internal class LoggerOutputFileTxt : LoggerOutputFile { private string Prefix { get; } @@ -643,6 +693,9 @@ internal struct LoggerCR2WOptions public bool ListEmbedded { get; set; } public bool DumpSDB { get; set; } public bool DumpFCD { get; set; } + public bool DumpYML { get; set; } + public bool DumpTXT { get; set; } + public bool DumpOnlyEdited { get; set; } public bool LocalizeStrings { get; set; } } internal class LoggerCR2W @@ -651,10 +704,25 @@ internal class LoggerCR2W public delegate void OnExceptionDelegate(string msg, Exception e); public OnExceptionDelegate OnException; private CR2WFile CR2W { get; } + private string CR2WFilePath { get; set; } private LoggerOutputFile Writer { get; } + private LoggerOutputFile WriterYml { get; } private LoggerCR2WOptions Options { get; } private List Chunks { get; } private List Embedded { get; } + private HashSet wasDumped = new HashSet(); + private Dictionary chunkByREDName = new Dictionary(); + private List> mapInArray = new List>(); + private HashSet enumTypes = new HashSet { "EDrawableFlags", "ELightChannel", "EInterpMethodType", "EInterpCurveMode", "ECompareOp", "ESpaceFillMode", "EComboAttackResponse", "ECameraState", "ECameraShakeState", "ECameraShakeMagnitude", "EDismembermentEffectTypeFlag", "ETriggerChannel", "EDayPart", "EGameplayMimicMode", "EPlayerGameplayMimicMode", "ESoundGameState", "ESoundEventSaveBehavior", "EStaticCameraAnimState", "EStaticCameraGuiEffect", "ECharacterPowerStats", "ECharacterRegenStats", "EDirection", "EDirectionZ", "EMoonState", "EWeatherEffect", "EScriptedEventCategory", "EScriptedEventType", "EInputDeviceType", "EncumbranceBoyMode", "EActorImmortalityMode", "EActorImmortalityChanel", "ETerrainType", "EAreaName", "EDlcAreaName", "EZoneName", "EHitReactionType", "EFocusHitReaction", "EAttackSwingType", "EAttackSwingDirection", + "EManageGravity", "ECounterAttackSwitch", "EAttitudeGroupPriority", "ETimescaleSource", "EMonsterCategory", "EButtonStage", "EStaminaActionType", "EFocusModeSoundEffectType", "EStatistic", "EAchievement", "ETutorialHintDurationType", "ETutorialHintPositionType", "ESpeedType", "EBloodType", "EStatOwner", "ETestSubject", "ETargetName", "EMonsterTactic", "EOperator", "ESpawnPositionPattern", "ESpawnRotation", "EFlyingCheck", "ECriticalEffectCounterType", "EFairytaleWitchAction", "EActionInfoType", "EBossAction", "EBossSpecialAttacks", "EEredinPhaseChangeAction", "ESpawnCondition", "ENPCCollisionStance", "ENPCBaseType", "EGuardState", "ENPCType", "EChosenTarget", "ETeleportType", "ECameraAnimPriority", "ECameraBlendSpeedMode", "EMerchantMapPinType", "EScriptedDetroyableComponentState", "EFoodGroup", "EClimbProbeUsed", "ESideSelected", "EPlayerCollisionStance", "EMovementCorrectionType", "EGameplayContextInput", "EExplorationStateType", + "EBehGraphConfirmationState", "EAirCollisionSide", "EClimbRequirementType", "EClimbRequirementVault", "EClimbRequirementPlatform", "EClimbHeightType", "EClimbDistanceType", "EClimbEndReady", "EOutsideCapsuleState", "EPlayerIdleSubstate", "ExplorationInteractionType", "EJumpSubState", "EJumpType", "ELandPredictionType", "ELandType", "ELandRunForcedMode", "EPushSide", "ESlidingSubState", "ESlideCameraShakeState", "EFallType", "ECollisionTrajecoryStatus", "ECollisionTrajecoryExplorationStatus", "ECollisionTrajectoryPart", "ECollisionTrajectoryToWaterState", + "EDoorMarkingState", "EntityType", "ESkillColor", "ESkillPath", "ESkillSubPath", "EPlayerMutationType", "EActionHitAnim", "EAlchemyExceptions", "EAlchemyCookedItemType", "EBirdType", "EWhaleMovementPatern", "EJobTreeType", "ECraftsmanType", "ECraftingException", "ECraftsmanLevel", "EItemUpgradeException", "EElevatorSwitchType", "ETrapOperation", "EEffectInteract", "EEffectType", "ECriticalHandling", "EEncounterMonitorCounterType", "EEncounterSpawnGroup", "EFocusModeChooseEntityStrategy", "ETriggeredDamageType", "EIllusionDiscoveredOneliner", "EDoorOperation", "EMonsterNestType", "ENestType", "ENewDoorOperation", "EShrineBuffs", "EToxicCloudOperation", "EOilBarrelOperation", + "EArmorType", "EEquipmentSlots", "EItemGroup", "EInventoryFilterType", "EInventoryActionType", "ECompareType", "ESpendablePointType", "EEP2PoiType", "EPhysicalDamagemechanismOperation", "ESwitchState", "EResetSwitchMode", "ERequiredSwitchState", "EEncounterOperation", "EFactOperation", "EOcurrenceTime", "ELogicalOperator", "EBoidClueState", "EMonsterCluesTypes", "EMonsterSize", "EMonsterEmittedSound", "EMonsterDamageMarks", "EMonsterVictimState", "EMonsterApperance", "EMonsterSkinFacture", "EMonsterMovement", "EMonsterBehaviour", "EMonsterAttitude", "EMonsterAttackTime", "EMonsterHideout", + "EFocusClueAttributeAction", "EClueOperation", "EFocusClueMedallionReaction", "EPlayerVoicesetType", "EMonsterClueAnim", "EReputationLevel", "EFactionName", "ETutorialMessageType", "EUITutorialTriggerCondition", "EUserDialogButtons", "EUniqueMessageIDs", "ELockedControlScheme", "EGamepadType", "ECursorType", "EGuiSceneControllerRenderFocus", "EQuantityTransferFunction", "EHudVisibilitySource", "EFloatingValueType", "EUpdateEventType", "EMutationFeedbackType", "EIngameMenuConstants", "EMutationResourceType", "EBonusSkillSlot", "EInventoryMenuState", "ENotificationType", "EItemSelectionPopupMode", "EUserMessageAction", + "EUserMessageProgressType", "EPreporationItemType", "EBackgroundNPCWork_Single", "EBackgroundNPCWork_Paired", "EBgNPCType", "EBackgroundNPCWomanWork", "EConverserType", "EDeathType", "EFinisherDeathType", "EActionFail", "ETauntType", "EBehaviorGraph", "EExplorationMode", "EAgonyType", "ENPCFightStage", "ECriticalStateType", "EHitReactionDirection", "EHitReactionSide", "EDetailedHitType", "EAttackType", "EChargeAttackType", "EDodgeType", "EDodgeDirection", "ETurnDirection", "ETargetDirection", "ENpcPose", "EFlightStance", "ENPCRightItemType", "ENPCLeftItemType", "EInventoryFundsType", + "EWeaponSubType1Handed", "EWeaponSubType2Handed", "EWeaponSubTypeRanged", "ENpcWeapons", "ENpcFightingStyles", "EAnimalType", "EPlayerDeathType", "EAimType", "EPlayerMode", "EForceCombatModeReason", "EGeneralEnum", "EPlayerExplorationAction", "EPlayerBoatMountFacing", "EPlayerAttackType", "ESkill", "EItemSetBonus", "EItemSetType", "EPlayerCommentary", "EPlayerWeapon", "EPlayerRangedWeapon", "EPlayerCombatStance", "ESignType", "EMoveSwitchDirection", "EPlayerEvadeType", "EPlayerEvadeDirection", "EPlayerParryDirection", "EPlayerRepelType", "ERotationRate", "EItemType", "ESpecialAbilityInput", + "EThrowStage", "EParryStage", "EParryType", "EAttackSwingRange", "EInputActionBlock", "EPlayerMoveType", "EPlayerActionToRestore", "EPlayerInteractionLock", "EPlayerPreviewInventory", "EDismembermentWoundTypes", "ERecoilLevel", "EPlayerMovementLockType", "EHorseMode", "ECustomCameraType", "ECustomCameraController", "EInitialAction", "EDir", "EPlayerStopPose", "EVehicleCombatAction", "EBookDirection", "EQuestSword", "EFactValueChangeMethod", "EMapPinStatus", "EFocusEffectActivationAction", "ECameraEffect", "EQuestReplacerEntities", "EItemSelectionType", "EQuestNPCStates", "EDrawWeaponQuestType", "ESwarmStateOnArrival", "EAnimalReaction", + "EDoorQuestState", "EGeraltPath", "EDM_MappinType", "EGwentCardFaction", "EGwentDeckUnlock", "EEnableMode", "EHudTimeOutAction", "EQuestPadVibrationStrength", "ELanguageCheckType", "ECheckedLanguage", "EQuestConditionDLCType", "EContainerMode", "EQuestPlayerSkillLevel", "EQuestPlayerSkillCondition", "EQuestConditionPlayerState", "ESwitchStateCondition", "EPlayerReplacerType", "EStorySceneOutputAction", "EStorySceneGameplayAction", "ENegotiationResult", "ECollectItemsRes", "ECollectItemsCustomRes", "EHorseWaterTestResult" }; private static CR2WFile LoadCR2W(string fileName) { using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) @@ -666,17 +734,71 @@ private static CR2WFile LoadCR2W(string fileName) } } - internal LoggerCR2W(string fileName, LoggerOutputFile writer, LoggerCR2WOptions options) - : this(LoadCR2W(fileName), writer, options) {} - internal LoggerCR2W(CR2WFile cr2wFile, LoggerOutputFile writer, LoggerCR2WOptions options) + internal LoggerCR2W(string fileName, LoggerOutputFile writer, LoggerOutputFile writerYml, LoggerCR2WOptions options) + : this(LoadCR2W(fileName), fileName, writer, writerYml, options) {} + internal LoggerCR2W(CR2WFile cr2wFile, string filePath, + LoggerOutputFile writer, LoggerOutputFile writerYml, LoggerCR2WOptions options) { CR2W = cr2wFile; + CR2WFilePath = filePath; Chunks = CR2W.chunks; Embedded = CR2W.embedded; Writer = writer; + WriterYml = writerYml; Options = options; if (Options.LocalizeStrings) CR2W.LocalizedStringSource = MainController.Get(); + + setupYmlMapCases(); + foreach (var chunk in Chunks) + { + try + { + chunkByREDName.Add(chunk.REDName, chunk); + } + catch (ArgumentNullException) + { + Console.WriteLine("processCR2W::Null chunk!"); + } + catch (ArgumentException) + { + Console.WriteLine("processCR2W::Already existing chunk name!"); + } + } + } + private void setupYmlMapCases() + { + // --- dlc mounters + mapInArray.Add(new List { "CR4WorldDLCMounter", "worlds", "worldName" }); + // --- entity template + mapInArray.Add(new List { "CEntityTemplate", "appearances", "name" }); + mapInArray.Add(new List { "CEntityTemplate", "bodyParts", "name" }); + mapInArray.Add(new List { "CEntityTemplate", "slots", "name" }); + mapInArray.Add(new List { "CEntityTemplate", "effects", "name" }); + mapInArray.Add(new List { "CByteArray", "streamingDataBuffer", "name" }); + // --- cutscenes + mapInArray.Add(new List { "CCutsceneTemplate", "effects", "name" }); + // --- entities + mapInArray.Add(new List { "CAnimSlotsParam", "animationSlots", "name" }); + mapInArray.Add(new List { "CEntityDismemberment", "wounds", "name" }); + mapInArray.Add(new List { "SDismembermentWoundSingleSpawn", "additionalEffects", "name" }); + mapInArray.Add(new List { "CAttackRangeParam", "attackRanges", "name" }); + mapInArray.Add(new List { "CR4LootParam", "containers", "name" }); + mapInArray.Add(new List { "CVoicesetParam", "slots", "name" }); + mapInArray.Add(new List { "CEntity", "components", "name" }); + mapInArray.Add(new List { "CActionPoint", "events", "eventName" }); + mapInArray.Add(new List { "CFXDefinition", "trackGroups", "name" }); + mapInArray.Add(new List { "CFXTrackGroup", "tracks", "name" }); + // --- components + mapInArray.Add(new List { "CSoundAmbientAreaComponent", "dynamicEvents", "eventName" }); + mapInArray.Add(new List { "CDropPhysicsComponent", "dropSetups", "name" }); + mapInArray.Add(new List { "CSlotComponent", "slots", "slotName" }); + mapInArray.Add(new List { "CSoundEmitterComponent", "switchesOnAttach", "SoundSwitch" }); + mapInArray.Add(new List { "CSoundEmitterComponent", "rtpcsOnAttach", "SoundProperty" }); + mapInArray.Add(new List { "CAdvancedVehicleComponent", "passengerSeats", "name" }); + // --- particles + mapInArray.Add(new List { "CParticleSystem", "emitters", "editorName" }); + mapInArray.Add(new List { "CParticleEmitter", "modules", "editorName" }); } public void processCR2W(int overrideLevel = 0) { @@ -687,14 +809,32 @@ public void processCR2W(int overrideLevel = 0) ProcessEmbedded(level); } Writer.Write("Chunks:", level); + foreach (var chunk in Chunks) { - Writer.Write(chunk.REDName + " (" + chunk.REDType + ") : " + chunk.Preview, level); + var dumpYml = Options.DumpYML && chunkByREDName.ContainsKey(chunk.REDName); + chunkByREDName.Remove(chunk.REDName); + //var node = GetNodes(chunk); - foreach (var item in chunk.GetEditableVariables()) + if (Options.DumpTXT) { - ProcessNode(item, level + 1); + Writer.Write(chunk.REDName + " (" + chunk.REDType + ") : " + chunk.Preview, level); + foreach (var item in chunk.GetEditableVariables()) + { + if (!Options.DumpOnlyEdited || item.IsSerialized) + ProcessNode(item, level + 1); + } } + if (dumpYml) + { + WriterYml.Write(CR2WFilePath.Split('\\').Last() + ":", level); + foreach (var item in chunk.GetEditableVariables()) + { + if (!Options.DumpOnlyEdited || item.IsSerialized) + ProcessNodeYml(item, level + 1); + } + } + } } private void ProcessEmbedded(int level) @@ -712,8 +852,70 @@ private void ProcessEmbedded(int level) Writer.Write("Handle: " + embed.Handle, level + 1); } } + private void ProcessDataBuffer(IEditableVariable node, int level, bool ymlDump) + { + try + { + var ls = new LoggerService(); + CR2WFile embedcr2w = new CR2WFile(ls); + + CR2W.Types.CByteArray bArray = null; + if (node.REDType == "array:2,0,Uint8") + { + bArray = (CR2W.Types.CByteArray)node; + } + else if (node.REDType == "SharedDataBuffer") + { + CR2W.Types.SharedDataBuffer SDB = (CR2W.Types.SharedDataBuffer)node; + if (SDB != null) + bArray = SDB.Bufferdata; + } + else if (node.REDType == "DataBuffer") + { + CR2W.Types.DataBuffer DB = (CR2W.Types.DataBuffer)node; + if (DB != null) + bArray = DB.Bufferdata; + } + if (bArray == null || bArray.GetBytes() == null) + return; + + switch (embedcr2w.Read(bArray.GetBytes())) + { + case EFileReadErrorCodes.NoError: + LoggerCR2WOptions newOptions = Options; + if (ymlDump) + newOptions.DumpTXT = false; + else + newOptions.DumpYML = false; + var lc = new LoggerCR2W(embedcr2w, node.REDName, Writer, WriterYml, newOptions); + lc.processCR2W(level); + + break; + case EFileReadErrorCodes.NoCr2w: + break; + case EFileReadErrorCodes.UnsupportedVersion: + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + catch (FormatException) + { + // Embedded buffer/array:2,0,Uint8 was not a CR2W file. Do nothing. + } + catch (Exception e) + { + string msg = node.REDName + ":" + node.REDType + ": "; + string logMsg = msg + ": Buffer or 'array:2,0,Uint8' caught exception: "; + Writer.Write(logMsg + e, level); + Console.WriteLine(logMsg + e); + OnException?.Invoke(msg, e); + ExceptionCount++; + } + } private void ProcessNode(IEditableVariable node, int level) { + //Console.WriteLine(new String(' ', level) + "> node: " + node.REDName + ", type: " + node.REDType + ", value: " + node.REDValue); if (node.REDName == "unknownBytes" && node.ToString() == "0 bytes" || node.REDName == "unk1" && node.ToString() == "0") return; @@ -729,9 +931,13 @@ private void ProcessNode(IEditableVariable node, int level) if (node.GetEditableVariables().Count > 0) foreach (var child in node.GetEditableVariables()) - ProcessNode(child, level); + { + if (!Options.DumpOnlyEdited || child.IsSerialized) + ProcessNode(child, level); + } + - if ( (node.REDType == "SharedDataBuffer" && Options.DumpSDB) + if ( ( (node.REDType == "SharedDataBuffer" || node.REDType == "DataBuffer") && Options.DumpSDB) || (node.REDType == "array:2,0,Uint8" && node.REDName != "deltaTimes") ) { // Embedded CR2W dump: // Dump SharedDataBuffer if option is set. @@ -739,40 +945,617 @@ private void ProcessNode(IEditableVariable node, int level) // And dump FCD only if options.dumpFCD is set. if (node.REDName != "flatCompiledData" || Options.DumpFCD) { - try + ProcessDataBuffer(node, level, false); + } + } + } + List getUnsupportedVarsByType(string type) + { + if (type.StartsWith("CFXTrackItem")) + type = "CFXTrackItem"; + if (type.EndsWith("Attachment")) + type = "IAttachment"; + List ret = new List(); + switch (type) + { + case "IAttachment": + ret.Add("parent"); + break; + case "CEntityTemplate": + //? ret.Add("overrides"); + ret.Add("entityClass"); + ret.Add("properOverrides"); + ret.Add("cookedEffectsVersion"); + break; + case "SAppearanceAttachment": + ret.Add("Data"); + break; + case "CFXTrackItem": + ret.Add("count"); + ret.Add("unk"); + ret.Add("buffername"); + break; + case "CFXDefinition": + case "CFXTrack": + case "CFXTrackGroup": + ret.Add("name"); + break; + } + return ret; + } + string prepareName(string name) + { + if (name.All(Char.IsDigit)) + { + name = '\"' + name + '\"'; + } + int pos = name.IndexOf('#'); + if (pos > 0) + return name.Substring(0, pos - 1); + else + return name; + } + bool isArrayType(string type) + { + return !string.IsNullOrEmpty(type) && (type.StartsWith("array:") || type.StartsWith("CBuffer")); + } + string prepareValue(IEditableVariable node, string type = "") + { + if (type == "") + type = node.REDType; + string value = string.IsNullOrEmpty(node.REDValue) ? "" : node.REDValue; + + Func wrapValue = x => + { + string ret = x.Replace('\\', '/'); + int pos = ret.LastIndexOf(": "); + if (pos > 0) + ret = ret.Substring(pos + 2); + return ret; + }; + if (string.IsNullOrEmpty(type)) + { + return wrapValue(value); + } + else if (isArrayType(type)) + { + return "# " + type; + } + else if (type == "Bool") + { + return (value == "True" ? "true" : "false"); + } + else if (type == "Float") + { + string ret = value.Replace(',', '.'); + foreach (char c in ret) // check if it is correct number + { + if ((c < '0' || c > '9') && c != '-' && c != '.') { - var ls = new LoggerService(); - CR2WFile embedcr2w = new CR2WFile(ls); - switch (embedcr2w.Read(((IByteSource)node).GetBytes())) + ret = "0.0"; + break; + } + } + if (!ret.Contains('.')) + { + ret += ".0"; + } + return ret; + } + else if (type.StartsWith("Int") || type.StartsWith("Uint")) + { + foreach (char c in value) // check if it is correct number + { + if ((c < '0' || c > '9') && c != '-') + { + value = "0"; + break; + } + } + return value; + } + else if (type == "IdTag") + { + int pos = value.LastIndexOf("] "); + if (pos > 0) + value = value.Substring(pos + 1); + return value; + } + else if (type == "String") + { + return "\"" + wrapValue(value) + "\""; + } + else if (type == "CName") + { + return wrapValue(value); + } + else + { + return wrapValue(value); + } + } + private void ProcessNodeYml_EngineTransform(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + if (isArrayElement) + WriterYml.Write("- \".type\": " + node.REDType, cur_level); + else + WriterYml.Write(prepareName(node.REDName) + ":", cur_level); + string x = "0.0", y = "0.0", z = "0.0", pitch = "0.0", yaw = "0.0", roll = "0.0", scale_x = "1.0", scale_y = "1.0", scale_z = "1.0"; + List children = node.GetEditableVariables(); + + foreach (var child in children) + { + switch (child.REDName) + { + case "X": + x = prepareValue(child); + break; + case "Y": + y = prepareValue(child); + break; + case "Z": + z = prepareValue(child); + break; + case "Pitch": + pitch = prepareValue(child); + break; + case "Yaw": + yaw = prepareValue(child); + break; + case "Roll": + roll = prepareValue(child); + break; + case "Scale_x": + scale_x = prepareValue(child); + break; + case "Scale_y": + scale_y = prepareValue(child); + break; + case "Scale_z": + scale_z = prepareValue(child); + break; + } + } + WriterYml.Write("pos: [ " + x + ", " + y + ", " + z + " ]", cur_level + 1); + WriterYml.Write("rot: [ " + pitch + ", " + yaw + ", " + roll + " ]", cur_level + 1); + WriterYml.Write("scale: [ " + scale_x + ", " + scale_y + ", " + scale_z + " ]", cur_level + 1); + } + private void ProcessNodeYml_Vector(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + string X = "0.0", Y = "0.0", Z = "0.0", W = "0.0"; + List children = node.GetEditableVariables(); + + foreach (var child in children) + { + switch (child.REDName) + { + case "X": + X = prepareValue(child); + break; + case "Y": + Y = prepareValue(child); + break; + case "Z": + Z = prepareValue(child); + break; + case "W": + W = prepareValue(child); + break; + } + } + WriterYml.Write((isArrayElement ? "- " : (prepareName(node.REDName) + ": ")) + "[ " + X + ", " + Y + ", " + Z + ", " + W + " ]", cur_level); + } + private void ProcessNodeYml_EulerAngles(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + string pitch = "0.0", yaw = "0.0", roll = "0.0"; + List children = node.GetEditableVariables(); + + foreach (var child in children) + { + switch (child.REDName) + { + case "Pitch": + pitch = prepareValue(child); + break; + case "Yaw": + yaw = prepareValue(child); + break; + case "Roll": + roll = prepareValue(child); + break; + } + } + WriterYml.Write((isArrayElement ? "- " : (prepareName(node.REDName) + ": ")) + "[ " + pitch + ", " + yaw + ", " + roll + " ]", cur_level); + } + private void ProcessNodeYml_Color(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + string Red = "0.0", Green = "0.0", Blue = "0.0", Alpha = "-1.0"; + List children = node.GetEditableVariables(); + + foreach (var child in children) + { + switch (child.REDName) + { + case "Red": + Red = prepareValue(child); + break; + case "Green": + Green = prepareValue(child); + break; + case "Blue": + Blue = prepareValue(child); + break; + case "Alpha": + Alpha = prepareValue(child); + break; + } + } + WriterYml.Write((isArrayElement ? "- " : (prepareName(node.REDName) + ": ")) + "[ " + Red + ", " + Green + ", " + Blue + ((Alpha == "-1.0") ? "" : (", " + Alpha)) + " ]", cur_level); + } + private void ProcessNodeYml_cookedEffects(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + List children = node.GetEditableVariables(); + + if (children.Count() < 1) + return; + WriterYml.Write("effects:", cur_level); + ++cur_level; + int nonameEffectsCount = 0; + + foreach (var i_child in children) + { + var i_children = i_child.GetEditableVariables(); + if (i_children.Count() < 1) + return; + string name = ""; + string buffer_size = ""; + IEditableVariable bufferNode = null; + foreach (var j_child in i_children) + { + if (j_child.REDName == "name") + name = j_child.REDValue; + else if (j_child.REDType == "SharedDataBuffer") + { + bufferNode = j_child; + } + } + if (bufferNode != null) + { + if (name == "") + name = "noname_effect_" + nonameEffectsCount++; + CR2W.Types.SharedDataBuffer SDB = (CR2W.Types.SharedDataBuffer)bufferNode; + if (SDB != null) + buffer_size = SDB.Bufferdata.ToString(); + WriterYml.Write("#buffer: " + buffer_size, cur_level); + bufferNode.SetREDName(name); + ProcessDataBuffer(bufferNode, cur_level, true); + } + } + } + private void ProcessNodeYml_interpolationBuffer(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + List children = node.GetEditableVariables(); + + if (children.Count() < 1) + return; + string[,] vars = new string[16, 4]; + int rows = 0; + + foreach (var child in children) + { + List i_children = child.GetEditableVariables(); + if (i_children.Count() < 16) + return; + for (int j = 0; j < i_children.Count() && j < 16; ++j) + { + vars[j, rows] = prepareValue(i_children[j], "Float"); + } + ++rows; + } + + WriterYml.Write("interpolation:", cur_level); + for (int j = 0; j < 16; ++j) + { + string tmp_var = "- [ " + vars[j, 0]; + for (int i = 1; i < rows; ++i) + { + tmp_var += ", " + vars[j, i]; + } + tmp_var += " ]"; + + if (rows == 1) + tmp_var = "- " + vars[j, 0]; + + WriterYml.Write(tmp_var, cur_level + 1); + } + } + private void ProcessNodeYml_Enum(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + string value = node.REDValue ?? ""; + string[] enum_values = value.Split(','); + + if (enum_values.Count() < 1) + return; + + //Console.WriteLine(" > Enum value: " + node.REDName + ", type: " + node.REDType + ", class: " + node.GetType()); + WriterYml.Write(prepareName(node.REDName) + ":", cur_level); + foreach (var enum_value in enum_values) + { + WriterYml.Write("- " + enum_value, cur_level + 1); + } + } + private void ProcessNodeYml_TagList(IEditableVariable node, int cur_level, bool isArrayElement = false) + { + CR2W.Types.CBufferVLQInt32 tags = ((CR2W.Types.TagList) node).tags; + + if (tags == null || tags.Count() < 1) + return; + + WriterYml.Write(prepareName(node.REDName) + ":", cur_level); + foreach (var tag in tags) + { + WriterYml.Write("- " + tag, cur_level + 1); + } + } + string getSpecialYmlMapNameVar(IEditableVariable node) + { + if (node.ParentVar == null) + return ""; + + List pos = new List(); + for (int i = 0; i < mapInArray.Count(); ++i) + { + if (mapInArray[i][1] == node.REDName) + { + pos.Add(i); + } + } + if (pos.Count() > 0) + { + //Console.WriteLine(" ^getSpecialYmlMapNameVar: ok [" + node.REDName + "]"); + Type classInfo = node.ParentVar.GetType(); + List parentClasses = new List(); + while (classInfo != null && classInfo.Name != "CVariable") + { + parentClasses.Add(classInfo.Name); + classInfo = classInfo.BaseType; + } + + for (int i = 0; i < pos.Count(); ++i) + { + if (parentClasses.Contains(mapInArray[pos[i]][0])) + { + //Console.WriteLine(" ^getSpecialYmlMapNameVar: Found! [" + mapInArray[pos[i]][2] + "]"); + return mapInArray[pos[i]][2]; + } + } + } + return ""; + } + + private void ProcessNodeYml(IEditableVariable node, int level, bool isArrayElement = false, string useNameVar = "") + { + Console.WriteLine(new String(' ', level) + "> node: " + node.REDName + ", type: " + node.REDType + ", value: " + node.REDValue); + // special cases for rmemr encoder + if (node.REDType == "EngineTransform") + { + ProcessNodeYml_EngineTransform(node, level, isArrayElement); + return; + } + if (node.REDType == "Vector" || node.REDType == "SVector4D") + { + ProcessNodeYml_Vector(node, level, isArrayElement); + return; + } + if (node.REDType == "EulerAngles") + { + ProcessNodeYml_EulerAngles(node, level, isArrayElement); + return; + } + if (node.REDType == "Color") + { + ProcessNodeYml_Color(node, level, isArrayElement); + return; + } + if (node.REDName == "cookedEffects") + { + ProcessNodeYml_cookedEffects(node, level); + return; + } + if (node.REDName == "buffer" && node.REDType == "CCompressedBuffer:CBufferUInt16:CFloat") + { + ProcessNodeYml_interpolationBuffer(node, level); + return; + } + if (enumTypes.Contains(node.REDType)) + { + ProcessNodeYml_Enum(node, level); + return; + } + if (node.REDType == "TagList") + { + ProcessNodeYml_TagList(node, level); + return; + } + if (node.REDName == "AttachmentsChild") + { + node.SetREDName("attachments"); + } + + if (node.REDName == "BufferV1" || node.REDName == "BufferV2" || node.REDName == "unknownBytes" + || node.REDName == "flatCompiledData" || node.REDName == "AttachmentsReference" || (node.REDName == "Unk1" && node.REDValue == "0")) + return; + + //if (node.REDName == "Parent" && node.REDValue == "NULL") - Not actual for 0.7 + // return; + + bool isMeArray = isArrayType(node.REDType); + List children = node.GetEditableVariables(); + List unsupportedVars = getUnsupportedVarsByType(node.REDType); + string value = node.REDValue ?? ""; + string mapNameVar = getSpecialYmlMapNameVar(node); + if (useNameVar == "") + useNameVar = mapNameVar; + + Console.WriteLine(new String(' ', level) + "> nodeExtra: Childs: " + children.Count()); + + if (node.REDName == "AttachmentsChild" && children.Count() == 0) + return; + + if (node.REDName != node.REDType) // Chunk node is already printed in processCR2W, so don't print it again. + { + /* CHUNK-REFERENCE TYPE (ptr, handle) */ + if (value.Contains("#") && !isMeArray) + { + if (chunkByREDName.ContainsKey(value)) + { + var chunk = chunkByREDName[value]; + chunkByREDName.Remove(chunk.REDName); + + if (!isArrayElement) // avoid "0" excess chunks { - case EFileReadErrorCodes.NoError: - var lc = new LoggerCR2W(embedcr2w, Writer, Options); - lc.processCR2W(level); - break; - case EFileReadErrorCodes.NoCr2w: - break; - case EFileReadErrorCodes.UnsupportedVersion: + WriterYml.Write(prepareName(node.REDName) + ":", level); + } + + foreach (var item in chunk.GetEditableVariables()) + { + if (!Options.DumpOnlyEdited || item.IsSerialized) + { + if (unsupportedVars.Contains(item.REDName)) + { + WriterYml.Write("## " + prepareName(item.REDName) + ": " + prepareValue(item), level + (isArrayElement ? 0 : 1)); + continue; + } + if (isArrayElement) + { + ProcessNodeYml(item, level, true, useNameVar); + } + else + { + ProcessNodeYml(item, level + 1, false, useNameVar); + } + } + } + } else + { + WriterYml.Write("#" + prepareName(node.REDName) + ": (looped reference) " + value, level); + } + //return; + } + /* SIMPLE TYPE (int, float, cname, string, guid, handle-path) */ + else if (children.Count() == 0) + { + if (string.IsNullOrEmpty(node.REDValue) || value == "NULL") // empty value, ignore + { + WriterYml.Write("#" + prepareName(node.REDName) + ": ", level); + return; + } + + if (isArrayElement) + { + WriterYml.Write("- " + prepareValue(node), level); + } + else + { + WriterYml.Write(prepareName(node.REDName) + ": " + prepareValue(node), level); + } + return; + } + /* STRUCT/CLASS TYPE */ + else + { + if (isArrayElement) + { + if (useNameVar != "") + { + string mapName = node.REDType + "0"; + foreach (var child in children) + { + if (child.REDName == useNameVar) + { + mapName = child.REDValue ?? mapName; + break; + } + } + WriterYml.Write(prepareName(mapName) + ":", level); + WriterYml.Write("\".type\": " + node.REDType, level + 1); + + unsupportedVars.Add(useNameVar); + useNameVar = ""; + } else + { + WriterYml.Write("- \".type\": " + node.REDType, level); + } + } + else + { + if (isMeArray && children.Count() < 1) + WriterYml.Write("# " + prepareName(node.REDName) + ": #" + node.REDType, level); + else + WriterYml.Write(prepareName(node.REDName) + ": #" + node.REDType, level); + } + } + } else + { // chunk header - write type/name + if (isArrayElement) + { + if (useNameVar != "") + { + string mapName = node.REDType + "0"; + foreach (var child in children) + { + if (child.REDName == useNameVar) + { + mapName = child.REDValue ?? mapName; + node.RemoveVariable(child); break; - default: - throw new ArgumentOutOfRangeException(); + } } + WriterYml.Write(prepareName(mapName) + ":", level); + WriterYml.Write("\".type\": " + node.REDType, level + 1); + + unsupportedVars.Add(useNameVar); + useNameVar = ""; } - catch (FormatException) + else { - // Embedded buffer/array:2,0,Uint8 was not a CR2W file. Do nothing. + WriterYml.Write("- \".type\": " + node.REDType, level); } - catch (Exception e) + } + else + { + WriterYml.Write("\".type\": " + node.REDType, level); + --level; + } + } + + foreach (var child in children) + { + if (!Options.DumpOnlyEdited || child.IsSerialized) + { + if (unsupportedVars.Contains(child.REDName)) { - string msg = node.REDName + ":" + node.REDType + ": "; - string logMsg = msg + ": Buffer or 'array:2,0,Uint8' caught exception: "; - Writer.Write(logMsg + e, level); - Console.WriteLine(logMsg + e); - OnException?.Invoke(msg, e); - ExceptionCount++; + WriterYml.Write("## " + prepareName(child.REDName) + ": " + prepareValue(child), level + 1); + continue; } + ProcessNodeYml(child, level + 1, isMeArray, useNameVar); + } + } + + + if (((node.REDType == "SharedDataBuffer" || node.REDType == "DataBuffer") && Options.DumpSDB) + || (node.REDType == "array:2,0,Uint8" && node.REDName != "deltaTimes")) + { // Embedded CR2W dump: + // Dump SharedDataBuffer if option is set. + // Dump "array:2,0,Uint8", unless it's called "deltaTimes" (not CR2W) + // And dump FCD only if options.dumpFCD is set. + if (node.REDName != "flatCompiledData" || Options.DumpFCD) + { + ProcessDataBuffer(node, level + 1, true); } } } + //private VariableListNode GetNodes(CR2WExportWrapper chunk) //{ // return frmChunkProperties.AddListViewItems(chunk);