R27_dev1 - Extract uncompressed RPF explorer option

This commit is contained in:
dexyfex 2017-09-27 02:59:39 +10:00
parent b4c481d83f
commit b6d77c9ca8
4 changed files with 184 additions and 24 deletions

View File

@ -103,6 +103,8 @@
this.ListContextCopyPathMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ListContextCopyFileListMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.ListContextOpenFileLocationMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ListContextOpenFileLocationSeparator = new System.Windows.Forms.ToolStripSeparator();
this.ListContextRenameMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ListContextReplaceMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ListContextDeleteMenu = new System.Windows.Forms.ToolStripMenuItem();
@ -118,8 +120,7 @@
this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.OpenFileDialog = new System.Windows.Forms.OpenFileDialog();
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
this.ListContextOpenFileLocationSeparator = new System.Windows.Forms.ToolStripSeparator();
this.ListContextOpenFileLocationMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ListContextExtractUncompressedMenu = new System.Windows.Forms.ToolStripMenuItem();
this.MainMenu.SuspendLayout();
this.MainToolbar.SuspendLayout();
this.StatusBar.SuspendLayout();
@ -714,6 +715,7 @@
this.toolStripSeparator2,
this.ListContextExportXmlMenu,
this.ListContextExtractRawMenu,
this.ListContextExtractUncompressedMenu,
this.ListContextExtractAllMenu,
this.toolStripSeparator5,
this.ListContextImportXmlMenu,
@ -731,7 +733,7 @@
this.ListContextEditSeparator,
this.ListContextSelectAllMenu});
this.ListContextMenu.Name = "MainContextMenu";
this.ListContextMenu.Size = new System.Drawing.Size(208, 392);
this.ListContextMenu.Size = new System.Drawing.Size(208, 414);
//
// ListContextViewMenu
//
@ -841,6 +843,18 @@
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(204, 6);
//
// ListContextOpenFileLocationMenu
//
this.ListContextOpenFileLocationMenu.Name = "ListContextOpenFileLocationMenu";
this.ListContextOpenFileLocationMenu.Size = new System.Drawing.Size(207, 22);
this.ListContextOpenFileLocationMenu.Text = "Open File Location";
this.ListContextOpenFileLocationMenu.Click += new System.EventHandler(this.ListContextOpenFileLocationMenu_Click);
//
// ListContextOpenFileLocationSeparator
//
this.ListContextOpenFileLocationSeparator.Name = "ListContextOpenFileLocationSeparator";
this.ListContextOpenFileLocationSeparator.Size = new System.Drawing.Size(204, 6);
//
// ListContextRenameMenu
//
this.ListContextRenameMenu.Image = ((System.Drawing.Image)(resources.GetObject("ListContextRenameMenu.Image")));
@ -935,17 +949,12 @@
this.TreeContextCollapseAllMenu.Text = "Collapse All";
this.TreeContextCollapseAllMenu.Click += new System.EventHandler(this.TreeContextCollapseAllMenu_Click);
//
// ListContextOpenFileLocationSeparator
// ListContextExtractUncompressedMenu
//
this.ListContextOpenFileLocationSeparator.Name = "ListContextOpenFileLocationSeparator";
this.ListContextOpenFileLocationSeparator.Size = new System.Drawing.Size(204, 6);
//
// ListContextOpenFileLocationMenu
//
this.ListContextOpenFileLocationMenu.Name = "ListContextOpenFileLocationMenu";
this.ListContextOpenFileLocationMenu.Size = new System.Drawing.Size(207, 22);
this.ListContextOpenFileLocationMenu.Text = "Open File Location";
this.ListContextOpenFileLocationMenu.Click += new System.EventHandler(this.ListContextOpenFileLocationMenu_Click);
this.ListContextExtractUncompressedMenu.Name = "ListContextExtractUncompressedMenu";
this.ListContextExtractUncompressedMenu.Size = new System.Drawing.Size(207, 22);
this.ListContextExtractUncompressedMenu.Text = "Extract Uncompressed...";
this.ListContextExtractUncompressedMenu.Click += new System.EventHandler(this.ListContextExtractUncompressedMenu_Click);
//
// ExploreForm
//
@ -1070,5 +1079,6 @@
private System.Windows.Forms.ColumnHeader MainPathColumnHeader;
private System.Windows.Forms.ToolStripMenuItem ListContextOpenFileLocationMenu;
private System.Windows.Forms.ToolStripSeparator ListContextOpenFileLocationSeparator;
private System.Windows.Forms.ToolStripMenuItem ListContextExtractUncompressedMenu;
}
}

View File

@ -1396,6 +1396,7 @@ namespace CodeWalker
ListContextExportXmlMenu.Enabled = canexportxml;
ListContextExtractRawMenu.Enabled = isfile;
ListContextExtractUncompressedMenu.Enabled = isfile;
ListContextImportRawMenu.Visible = canimport;
ListContextImportXmlMenu.Visible = canimport;
@ -1474,6 +1475,93 @@ namespace CodeWalker
return;
}
RpfResourceFileEntry rrfe = file.File as RpfResourceFileEntry;
if (rrfe != null) //add resource header if this is a resource file.
{
data = ResourceBuilder.Compress(data);
data = ResourceBuilder.AddResourceHeader(rrfe, data);
}
SaveFileDialog.FileName = file.Name;
if (SaveFileDialog.ShowDialog() == DialogResult.OK)
{
string path = SaveFileDialog.FileName;
try
{
File.WriteAllBytes(path, data);
}
catch (Exception ex)
{
MessageBox.Show("Error saving file " + path + ":\n" + ex.ToString());
}
}
}
}
else
{
if (FolderBrowserDialog.ShowDialog() != DialogResult.OK) return;
string folderpath = FolderBrowserDialog.SelectedPath;
if (!folderpath.EndsWith("\\")) folderpath += "\\";
StringBuilder errors = new StringBuilder();
for (int i = 0; i < MainListView.SelectedIndices.Count; i++)
{
var idx = MainListView.SelectedIndices[i];
if ((idx < 0) || (idx >= CurrentFiles.Count)) continue;
var file = CurrentFiles[idx];
if (file.Folder == null)
{
var path = folderpath + file.Name;
var data = GetFileData(file);
if (data == null)
{
errors.AppendLine("Unable to extract file: " + file.Path);
continue;
}
try
{
RpfResourceFileEntry rrfe = file.File as RpfResourceFileEntry;
if (rrfe != null) //add resource header if this is a resource file.
{
data = ResourceBuilder.Compress(data);
data = ResourceBuilder.AddResourceHeader(rrfe, data);
}
File.WriteAllBytes(path, data);
}
catch (Exception ex)
{
errors.AppendLine("Error saving file " + path + ":\n" + ex.ToString());
}
}
}
string errstr = errors.ToString();
if (!string.IsNullOrEmpty(errstr))
{
MessageBox.Show("Errors were encountered:\n" + errstr);
}
}
}
private void ExtractUncompressed()
{
if (MainListView.SelectedIndices.Count == 1)
{
var idx = MainListView.SelectedIndices[0];
if ((idx < 0) || (idx >= CurrentFiles.Count)) return;
var file = CurrentFiles[idx];
if (file.Folder == null)
{
byte[] data = GetFileData(file);
if (data == null)
{
MessageBox.Show("Unable to extract file: " + file.Path);
return;
}
SaveFileDialog.FileName = file.Name;
if (SaveFileDialog.ShowDialog() == DialogResult.OK)
{
@ -1551,6 +1639,13 @@ namespace CodeWalker
}
try
{
RpfResourceFileEntry rrfe = file.File as RpfResourceFileEntry;
if (rrfe != null) //add resource header if this is a resource file.
{
data = ResourceBuilder.Compress(data);
data = ResourceBuilder.AddResourceHeader(rrfe, data);
}
File.WriteAllBytes(path, data);
}
catch (Exception ex)
@ -2056,6 +2151,11 @@ namespace CodeWalker
ExtractRaw();
}
private void ListContextExtractUncompressedMenu_Click(object sender, EventArgs e)
{
ExtractUncompressed();
}
private void ListContextExtractAllMenu_Click(object sender, EventArgs e)
{
ExtractAll();

View File

@ -258,16 +258,6 @@
GvZP7/3NqMHOyEACQlVVHxGjBiOpbdu1KIokGRDjZCqQj/3WzsPozi3L8oNTCXEyAqDv+93PykyM7hyb
OEgy37QlAVUSCxs9tKCADeqLDGjzT4Gu676IErtUgaDbuTwDCUhYccAhyS2wicsjWZXIJ9R1vYsbPdjm
ePJI4uQjAWAz8UYNxvNEhJNVrq7ziMzzN2pq/DDMhNNPcE6+bs69AUIIBqGH+5QgAAAAAElFTkSuQmCC
</value>
</data>
<data name="SearchButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIxDoMwDORJfQN7pI5hz1pmytSJ7/EFhrYZ
MqSVgDXlIhslaoga9aQTsn1nOyFVDsuynNd1HTe6gCPyJDnGJrpN0+T6vnd1Xe9EjDzqJP0GJkAkhIjM
TOSpSXoTrMmTu+7qHvene9m3/7aX1udRh44sMXBWnsZmJmKuQUeWGFiPRaGZKaXMN/hrg3meTygopbyo
6A7IbIdh2KekmPwLR+amaaI4+Q6OzDiGMcafNWD8EnNmrbVFnaRppBr8bGaETYrNDG4CFpsZMJaZq+oD
NQar60zqQI0AAAAASUVORK5CYII=
</value>
</data>
<data name="SearchGlobalButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -287,6 +277,16 @@
lVY67e7NJiI/2QxXrEetVVZsAY5938U5NzUbthbgknMW7735iOnYsB0AqBXXlJL5jOnYsDUBqA1uMcbh
mYyuz6aAU/M9hKDP3GR0ffYegNrwXEpRADdZr5+aAlB7UAB3j1V/Anh1j1UD4Fub4YrN8HPL9gAVE1vf
J6IiRgAAAABJRU5ErkJggg==
</value>
</data>
<data name="SearchButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADVSURBVDhPpVIxDoMwDORJfQN7pI5hz1pmytSJ7/EFhrYZ
MqSVgDXlIhslaoga9aQTsn1nOyFVDsuynNd1HTe6gCPyJDnGJrpN0+T6vnd1Xe9EjDzqJP0GJkAkhIjM
TOSpSXoTrMmTu+7qHvene9m3/7aX1udRh44sMXBWnsZmJmKuQUeWGFiPRaGZKaXMN/hrg3meTygopbyo
6A7IbIdh2KekmPwLR+amaaI4+Q6OzDiGMcafNWD8EnNmrbVFnaRppBr8bGaETYrNDG4CFpsZMJaZq+oD
NQar60zqQI0AAAAASUVORK5CYII=
</value>
</data>
<metadata name="StatusBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
@ -300,7 +300,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo
HwAAAk1TRnQBSQFMAgEBGAEAAZABAAGQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
HwAAAk1TRnQBSQFMAgEBGAEAAZgBAAGYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAAXADAAEBAQABCAYAARwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -74,6 +74,56 @@ CodeWalker.exe explorer
Alternatively, run the CodeWalker Explorer batch file in the program's directory.
Main Toolbar:
-------------
The main toolbar is used to access most of the editing features in CodeWalker. Shortcuts for new, open and
create files are provided. The selection mode can be changed with the "pointer" button. Move, rotate and
scale buttons provide access to the different editing widget modes.
Other shortcuts on the toolbar include buttons to open the Selection Info window, and the Project window.
See the tooltips on the toolbar items for hints.
Project Window:
---------------
The project window is the starting point for editing files in CodeWalker. Project files can be created,
and files can be added to them. It is recommended to create and save a project file before adding files
to be edited and saved.
The tree view displays the files in the current project, and their contents.
YMAP editing:
-------------
New YMAP files can be created via the project window, and existing ymap files can be edited.
To edit an existing single player YMAP, first change codewalker DLC level to patchday2ng, and enable DLC.
Open the toolbar, and enable Entity selection mode. Enable the Move widget with the toolbar Move button.
Open the project window with the toolbar button. Changes made while the project window is open are
automatically added to the project.
Select an entity to edit by right clicking when the entity is moused over, and its bounding box shown in
white. Move, rotate and/or scale the selected entity with the widget. When the first change is made, the
entity's YMAP will be added to the current project. If no project is open, a new one will be created.
The edited YMAP file can be saved to the drive using the File menu in the project window.
After saving the file, it needs to be added into the mods folder. Using OpenIV, find the existing YMAP
file using the search function (note: the correct path for the edited YMAP can be found in the selection
info window in CodeWalker, when an entity is selected, look for YMap>RpfFileEntry in the selection info
property grid). Replace the edited YMAP into a copy of the correct archive in the /mods folder.
Newly created YMAPs can be added to DLC archives in the same manner.
Traffic Paths (YND) editing:
----------------------------
[TODO - write this!]
Train Tracks editing:
---------------------
[TODO - write this!]
Scenario Regions (YMT) editing:
-------------------------------
[TODO: write this!]
Regarding game files: (FYI)
----------------------------