mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-23 19:46:06 +00:00
Update OMI submodule
This commit is contained in:
@@ -273,7 +273,7 @@ namespace PckStudio.Features
|
||||
client.UploadFile(ms, GetGameContentPath() + "/Common/Media/MediaWiiU.arc");
|
||||
}
|
||||
archive.Clear();
|
||||
currentPCK?.Files.Clear();
|
||||
//currentPCK?.Files.Clear();
|
||||
currentPCK = null;
|
||||
}
|
||||
GC.Collect();
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace PckStudio.Forms.Editor
|
||||
selectTilePictureBox.UseBlendColor = applyColorMaskToolStripMenuItem.Checked;
|
||||
|
||||
bool hasAnimation =
|
||||
_pckFile.Files.TryGetValue($"res/textures/{_atlasType}/{_selectedTile.Tile.InternalName}.png", PckFileType.TextureFile, out var animationFile);
|
||||
_pckFile.TryGetValue($"res/textures/{_atlasType}/{_selectedTile.Tile.InternalName}.png", PckFileType.TextureFile, out var animationFile);
|
||||
animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation";
|
||||
replaceButton.Enabled = !hasAnimation;
|
||||
|
||||
@@ -394,14 +394,10 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void animationButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool isNewFile;
|
||||
if (isNewFile = !_pckFile.Files.TryGetValue(
|
||||
var file = _pckFile.GetOrCreate(
|
||||
$"res/textures/{_atlasType}/{_selectedTile.Tile.InternalName}.png",
|
||||
PckFileType.TextureFile, out var file
|
||||
))
|
||||
{
|
||||
file = new PckFileData($"res/textures/{_atlasType}/{_selectedTile.Tile.InternalName}.png", PckFileType.TextureFile);
|
||||
}
|
||||
PckFileType.TextureFile
|
||||
);
|
||||
|
||||
var animation = AnimationHelper.GetAnimationFromFile(file);
|
||||
|
||||
@@ -412,11 +408,6 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
|
||||
AnimationHelper.SaveAnimationToFile(file, animation);
|
||||
|
||||
if (isNewFile)
|
||||
{
|
||||
_pckFile.Files.Add(file);
|
||||
}
|
||||
}
|
||||
|
||||
private void extractTileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -37,14 +37,14 @@ namespace PckStudio.Popups
|
||||
{
|
||||
if (fileTypeComboBox.SelectedIndex >= 0 && fileTypeComboBox.SelectedIndex <= 13)
|
||||
{
|
||||
applyBulkProperties(_pckFile.Files, fileTypeComboBox.SelectedIndex - 1);
|
||||
applyBulkProperties(_pckFile.GetFiles(), fileTypeComboBox.SelectedIndex - 1);
|
||||
DialogResult = DialogResult.OK;
|
||||
return;
|
||||
}
|
||||
MessageBox.Show("Please select a filetype before applying");
|
||||
}
|
||||
|
||||
private void applyBulkProperties(FileCollection files, int index)
|
||||
private void applyBulkProperties(IReadOnlyCollection<PckFileData> files, int index)
|
||||
{
|
||||
foreach (PckFileData file in files)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ namespace PckStudio.Popups
|
||||
var reader = new PckFileReader(_endianness);
|
||||
using var ms = new MemoryStream(file.Data);
|
||||
PckFile subPCK = reader.FromStream(ms);
|
||||
applyBulkProperties(subPCK.Files, index);
|
||||
applyBulkProperties(subPCK.GetFiles(), index);
|
||||
file.SetData(new PckFileWriter(subPCK, _endianness));
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
|
||||
@@ -426,7 +426,7 @@ namespace PckStudio.Forms.Utilities
|
||||
string Outpath = "assets\\minecraft\\textures\\";
|
||||
|
||||
|
||||
foreach (PckFileData mf in Pck.Files)
|
||||
foreach (PckFileData mf in Pck.GetFiles())
|
||||
{
|
||||
FileInfo file = new FileInfo(Environment.CurrentDirectory + "\\Temp\\" + @"\" + mf.Filename);
|
||||
file.Directory.Create(); // If the directory already exists, this method does nothing.
|
||||
@@ -451,7 +451,7 @@ namespace PckStudio.Forms.Utilities
|
||||
string Outpath = "assets\\minecraft\\textures\\";
|
||||
|
||||
|
||||
foreach (PckFileData mf in Pck.Files)
|
||||
foreach (PckFileData mf in Pck.GetFiles())
|
||||
{
|
||||
FileInfo file = new FileInfo(Environment.CurrentDirectory + "\\Temp\\" + @"\" + mf.Filename);
|
||||
file.Directory.Create(); // If the directory already exists, this method does nothing.
|
||||
@@ -476,7 +476,7 @@ namespace PckStudio.Forms.Utilities
|
||||
string Outpath = "assets\\minecraft\\textures\\";
|
||||
|
||||
|
||||
foreach (PckFileData mf in Pck.Files)
|
||||
foreach (PckFileData mf in Pck.GetFiles())
|
||||
{
|
||||
FileInfo file = new FileInfo(Environment.CurrentDirectory + "\\Temp\\" + @"\" + mf.Filename);
|
||||
file.Directory.Create(); // If the directory already exists, this method does nothing.
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace PckStudio.Forms
|
||||
List<PckFileData> capesList = new List<PckFileData>();
|
||||
var reader = new PckFileReader();
|
||||
PckFile currentPCK = reader.FromFile(Program.AppData + "/PCK-Center/myPcks/" + mod + ".pck");
|
||||
foreach (PckFileData skin in currentPCK.Files)
|
||||
foreach (PckFileData skin in currentPCK.GetFiles())
|
||||
{
|
||||
if (skin.Filename.Count() == 19)
|
||||
{
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace PckStudio
|
||||
|
||||
private void LoadEditorTab()
|
||||
{
|
||||
fileEntryCountLabel.Text = "Files:" + currentPCK.Files.Count;
|
||||
fileEntryCountLabel.Text = "Files:" + currentPCK.FileCount;
|
||||
if (isTemplateFile)
|
||||
pckFileLabel.Text = "Unsaved File!";
|
||||
else
|
||||
@@ -298,11 +298,11 @@ namespace PckStudio
|
||||
|
||||
private void BuildPckTreeView(TreeNodeCollection root, PckFile pckFile, string parentPath = "")
|
||||
{
|
||||
foreach (var file in pckFile.Files)
|
||||
foreach (var file in pckFile.GetFiles())
|
||||
{
|
||||
// fix any file paths that may be incorrect
|
||||
if (file.Filename.StartsWith(parentPath))
|
||||
file.Filename = file.Filename.Remove(0, parentPath.Length);
|
||||
//if (file.Filename.StartsWith(parentPath))
|
||||
// file.Filename = file.Filename.Remove(0, parentPath.Length);
|
||||
TreeNode node = BuildNodeTreeBySeperator(root, file.Filename, '/');
|
||||
node.Tag = file;
|
||||
if (Settings.Default.LoadSubPcks &&
|
||||
@@ -361,7 +361,7 @@ namespace PckStudio
|
||||
|
||||
private void HandleTextureFile(PckFileData file)
|
||||
{
|
||||
_ = file.IsMipmappedFile() && currentPCK.Files.TryGetValue(file.GetNormalPath(), PckFileType.TextureFile, out file);
|
||||
_ = file.IsMipmappedFile() && currentPCK.TryGetValue(file.GetNormalPath(), PckFileType.TextureFile, out file);
|
||||
|
||||
if (file.Size <= 0)
|
||||
{
|
||||
@@ -601,7 +601,7 @@ namespace PckStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var _file in currentPCK.Files)
|
||||
foreach (var _file in currentPCK.GetFiles())
|
||||
{
|
||||
if (_file.Filename.StartsWith(selectedFolder))
|
||||
{
|
||||
@@ -716,7 +716,7 @@ namespace PckStudio
|
||||
|
||||
if (node.TryGetTagData(out PckFileData file))
|
||||
{
|
||||
if (!BeforeFileRemove(file) && currentPCK.Files.Remove(file))
|
||||
if (!BeforeFileRemove(file) && currentPCK.RemoveFile(file))
|
||||
{
|
||||
node.Remove();
|
||||
wasModified = true;
|
||||
@@ -726,7 +726,7 @@ namespace PckStudio
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
string pckFolderDir = node.FullPath;
|
||||
currentPCK.Files.RemoveAll(file => !BeforeFileRemove(file) && file.Filename.StartsWith(pckFolderDir));
|
||||
currentPCK.RemoveAll(file => !BeforeFileRemove(file) && file.Filename.StartsWith(pckFolderDir));
|
||||
node.Remove();
|
||||
wasModified = true;
|
||||
}
|
||||
@@ -789,7 +789,7 @@ namespace PckStudio
|
||||
else
|
||||
{
|
||||
if (treeViewMain.Nodes.ContainsKey("Skins")) add.SkinFile.Filename = add.SkinFile.Filename.Insert(0, "Skins/"); // Then Skins folder
|
||||
currentPCK.Files.Add(add.SkinFile);
|
||||
currentPCK.AddFile(add.SkinFile);
|
||||
}
|
||||
if (add.HasCape)
|
||||
{
|
||||
@@ -807,7 +807,7 @@ namespace PckStudio
|
||||
else
|
||||
{
|
||||
if (treeViewMain.Nodes.ContainsKey("Skins")) add.CapeFile.Filename = add.CapeFile.Filename.Insert(0, "Skins/"); // Then Skins folder
|
||||
currentPCK.Files.Add(add.CapeFile);
|
||||
currentPCK.AddFile(add.CapeFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -824,13 +824,13 @@ namespace PckStudio
|
||||
audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Nether);
|
||||
audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.End);
|
||||
PckFileData pckFileData = new PckFileData("audio.pck", PckFileType.AudioFile);
|
||||
pckFileData .SetData(new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
pckFileData.SetData(new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
return pckFileData;
|
||||
}
|
||||
|
||||
private void audiopckToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (currentPCK.Files.Contains("audio.pck", PckFileType.AudioFile))
|
||||
if (currentPCK.Contains("audio.pck", PckFileType.AudioFile))
|
||||
{
|
||||
// the chance of this happening is really really slim but just in case
|
||||
MessageBox.Show("There is already a file in this PCK named \"audio.pck\"!", "Can't create audio.pck");
|
||||
@@ -846,7 +846,7 @@ namespace PckStudio
|
||||
AudioEditor diag = new AudioEditor(file, LittleEndianCheckBox.Checked);
|
||||
if(diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
currentPCK.Files.Add(file);
|
||||
currentPCK.AddFile(file);
|
||||
}
|
||||
diag.Dispose();
|
||||
BuildMainTreeView();
|
||||
@@ -858,6 +858,12 @@ namespace PckStudio
|
||||
if (diag.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (currentPCK.Contains($"res/textures/{Animation.GetCategoryName(diag.Category)}/{diag.SelectedTile}.png", PckFileType.TextureFile))
|
||||
{
|
||||
MessageBox.Show($"{diag.SelectedTile} is already present.", "File already present");
|
||||
return;
|
||||
}
|
||||
|
||||
var file = new PckFileData(
|
||||
$"res/textures/{Animation.GetCategoryName(diag.Category)}/{diag.SelectedTile}.png",
|
||||
PckFileType.TextureFile);
|
||||
@@ -869,7 +875,7 @@ namespace PckStudio
|
||||
{
|
||||
wasModified = true;
|
||||
AnimationHelper.SaveAnimationToFile(file, animation);
|
||||
currentPCK.Files.Add(file);
|
||||
currentPCK.AddFile(file);
|
||||
BuildMainTreeView();
|
||||
ReloadMetaTreeView();
|
||||
}
|
||||
@@ -960,7 +966,7 @@ namespace PckStudio
|
||||
{
|
||||
if (file.Size <= 0)
|
||||
{
|
||||
Trace.WriteLine($"'{file.Filename}' has no data attached.", category: nameof(HandleTextureFile));
|
||||
Trace.WriteLine($"'{file.Filename}' has no data attached.", category: nameof(treeViewMain_DoubleClick));
|
||||
return;
|
||||
}
|
||||
pckFileTypeHandler[file.Filetype]?.Invoke(file);
|
||||
@@ -1084,7 +1090,7 @@ namespace PckStudio
|
||||
if (node.Parent == null) treeViewMain.Nodes.Insert(node.Index + 1, newNode); //adds generated file node
|
||||
else node.Parent.Nodes.Insert(node.Index + 1, newNode);//adds generated file node to selected folder
|
||||
|
||||
if (!IsSubPCKNode(node.FullPath)) currentPCK.Files.Insert(node.Index + 1, newFile);
|
||||
if (!IsSubPCKNode(node.FullPath)) currentPCK.InsertFile(node.Index + 1, newFile);
|
||||
else RebuildSubPCK(node.FullPath);
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
@@ -1345,7 +1351,7 @@ namespace PckStudio
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
foreach (PckFileData file in pckfile.Files)
|
||||
foreach (PckFileData file in pckfile.GetFiles())
|
||||
{
|
||||
string filepath = $"{sfd.SelectedPath}/{file.Filename}";
|
||||
FileInfo fileinfo = new FileInfo(filepath);
|
||||
@@ -1460,7 +1466,7 @@ namespace PckStudio
|
||||
{
|
||||
var reader = new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
var skinspck = reader.FromStream(ms);
|
||||
skinspck.Files.Add(newFile);
|
||||
skinspck.AddFile(newFile);
|
||||
ms.Position = 0;
|
||||
var writer = new PckFileWriter(skinspck, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(ms);
|
||||
@@ -1468,7 +1474,7 @@ namespace PckStudio
|
||||
}
|
||||
continue;
|
||||
}
|
||||
currentPCK.Files.Add(newFile);
|
||||
currentPCK.AddFile(newFile);
|
||||
}
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
@@ -1887,7 +1893,7 @@ namespace PckStudio
|
||||
string mippedPath = $"{textureDirectory}/{textureName}MipMapLevel{i}{textureExtension}";
|
||||
Debug.WriteLine(mippedPath);
|
||||
if (currentPCK.HasFile(mippedPath, PckFileType.TextureFile))
|
||||
currentPCK.Files.Remove(currentPCK.GetFile(mippedPath, PckFileType.TextureFile));
|
||||
currentPCK.RemoveFile(currentPCK.GetFile(mippedPath, PckFileType.TextureFile));
|
||||
PckFileData MipMappedFile = new PckFileData(mippedPath, PckFileType.TextureFile);
|
||||
|
||||
|
||||
@@ -1907,7 +1913,7 @@ namespace PckStudio
|
||||
|
||||
MipMappedFile.SetData(mippedTexture, ImageFormat.Png);
|
||||
|
||||
currentPCK.Files.Insert(currentPCK.Files.IndexOf(file) + i - 1, MipMappedFile);
|
||||
currentPCK.InsertFile(currentPCK.IndexOfFile(file) + i - 1, MipMappedFile);
|
||||
}
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
2
Vendor/OMI-Lib
vendored
2
Vendor/OMI-Lib
vendored
Submodule Vendor/OMI-Lib updated: 9f9736fc50...a154ce2b89
Reference in New Issue
Block a user