cleanup
This commit is contained in:
@@ -113,7 +113,7 @@ namespace SplashEdit.EditorCode
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(tempFile, installDir);
|
||||
|
||||
// Fix nested directory (archives often have one extra level)
|
||||
FixNestedDirectory(installDir);
|
||||
SplashEdit.RuntimeCode.Utils.FixNestedDirectory(installDir);
|
||||
|
||||
try { File.Delete(tempFile); } catch { }
|
||||
|
||||
@@ -142,27 +142,6 @@ namespace SplashEdit.EditorCode
|
||||
}
|
||||
}
|
||||
|
||||
private static void FixNestedDirectory(string dir)
|
||||
{
|
||||
// If extraction created exactly one subdirectory, flatten it
|
||||
var subdirs = Directory.GetDirectories(dir);
|
||||
if (subdirs.Length == 1)
|
||||
{
|
||||
string nested = subdirs[0];
|
||||
foreach (string file in Directory.GetFiles(nested))
|
||||
{
|
||||
string dest = Path.Combine(dir, Path.GetFileName(file));
|
||||
if (!File.Exists(dest)) File.Move(file, dest);
|
||||
}
|
||||
foreach (string sub in Directory.GetDirectories(nested))
|
||||
{
|
||||
string dest = Path.Combine(dir, Path.GetFileName(sub));
|
||||
if (!Directory.Exists(dest)) Directory.Move(sub, dest);
|
||||
}
|
||||
try { Directory.Delete(nested, true); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs mkpsxiso with the given XML catalog to produce a BIN/CUE image.
|
||||
/// </summary>
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace SplashEdit.EditorCode
|
||||
else
|
||||
{
|
||||
// The zip might have a nested directory — try to find the exe
|
||||
FixNestedDirectory(installDir);
|
||||
SplashEdit.RuntimeCode.Utils.FixNestedDirectory(installDir);
|
||||
if (SplashBuildPaths.IsPCSXReduxInstalled())
|
||||
{
|
||||
log?.Invoke("PCSX-Redux installed successfully!");
|
||||
@@ -187,29 +187,6 @@ namespace SplashEdit.EditorCode
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the zip extracts into a nested directory, move files up.
|
||||
/// </summary>
|
||||
private static void FixNestedDirectory(string installDir)
|
||||
{
|
||||
var subdirs = Directory.GetDirectories(installDir);
|
||||
if (subdirs.Length == 1)
|
||||
{
|
||||
string nested = subdirs[0];
|
||||
foreach (string file in Directory.GetFiles(nested))
|
||||
{
|
||||
string dest = Path.Combine(installDir, Path.GetFileName(file));
|
||||
File.Move(file, dest);
|
||||
}
|
||||
foreach (string dir in Directory.GetDirectories(nested))
|
||||
{
|
||||
string dest = Path.Combine(installDir, Path.GetFileName(dir));
|
||||
Directory.Move(dir, dest);
|
||||
}
|
||||
try { Directory.Delete(nested); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse the latest build ID from the master manifest JSON.
|
||||
/// Expected format: {"builds":[{"id":1234,...},...],...}
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace SplashEdit.EditorCode
|
||||
}
|
||||
|
||||
// Fix nested directory (sometimes archives have one extra level)
|
||||
FixNestedDirectory(installDir);
|
||||
SplashEdit.RuntimeCode.Utils.FixNestedDirectory(installDir);
|
||||
|
||||
try { File.Delete(tempFile); } catch { }
|
||||
|
||||
@@ -155,27 +155,6 @@ namespace SplashEdit.EditorCode
|
||||
}
|
||||
}
|
||||
|
||||
private static void FixNestedDirectory(string dir)
|
||||
{
|
||||
// If extraction created exactly one subdirectory, flatten it
|
||||
var subdirs = Directory.GetDirectories(dir);
|
||||
if (subdirs.Length == 1)
|
||||
{
|
||||
string nested = subdirs[0];
|
||||
foreach (string file in Directory.GetFiles(nested))
|
||||
{
|
||||
string dest = Path.Combine(dir, Path.GetFileName(file));
|
||||
if (!File.Exists(dest)) File.Move(file, dest);
|
||||
}
|
||||
foreach (string sub in Directory.GetDirectories(nested))
|
||||
{
|
||||
string dest = Path.Combine(dir, Path.GetFileName(sub));
|
||||
if (!Directory.Exists(dest)) Directory.Move(sub, dest);
|
||||
}
|
||||
try { Directory.Delete(nested, true); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Unity AudioClip to PS1 SPU ADPCM format using psxavenc.
|
||||
/// Returns the ADPCM byte array, or null on failure.
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace SplashEdit.EditorCode
|
||||
private Texture2D quantizedTexture;
|
||||
private Texture2D vramTexture; // VRAM representation of the texture
|
||||
private List<VRAMPixel> clut; // Color Lookup Table (CLUT), stored as a 1D list
|
||||
private ushort[] indexedPixelData; // Indexed pixel data for VRAM storage
|
||||
private PSXBPP bpp = PSXBPP.TEX_4BIT;
|
||||
private readonly int previewSize = 256;
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace SplashEdit.EditorCode
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label("Original Texture", PSXEditorStyles.CardHeaderStyle);
|
||||
DrawTexturePreview(originalTexture, previewSize, false);
|
||||
DrawTexturePreview(originalTexture, previewSize);
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
@@ -88,27 +87,6 @@ namespace SplashEdit.EditorCode
|
||||
|
||||
PSXEditorStyles.DrawSeparator(4, 4);
|
||||
|
||||
// Export indexed pixel data
|
||||
if (indexedPixelData != null)
|
||||
{
|
||||
if (GUILayout.Button("Export texture data", PSXEditorStyles.SecondaryButton, GUILayout.Height(24)))
|
||||
{
|
||||
string path = EditorUtility.SaveFilePanel("Save texture data", "", "pixel_data", "bin");
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
|
||||
using (BinaryWriter writer = new BinaryWriter(fileStream))
|
||||
{
|
||||
foreach (ushort value in indexedPixelData)
|
||||
{
|
||||
writer.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Export CLUT data
|
||||
if (clut != null)
|
||||
{
|
||||
@@ -146,7 +124,7 @@ namespace SplashEdit.EditorCode
|
||||
clut = psxTex.ColorPalette;
|
||||
}
|
||||
|
||||
private void DrawTexturePreview(Texture2D texture, int size, bool flipY = true)
|
||||
private void DrawTexturePreview(Texture2D texture, int size)
|
||||
{
|
||||
// Renders a texture preview within the editor window
|
||||
Rect rect = GUILayoutUtility.GetRect(size, size, GUILayout.ExpandWidth(false));
|
||||
|
||||
Reference in New Issue
Block a user