Skip to content

Commit

Permalink
prevent image cmd error and fix psv sw #99 #35 #87
Browse files Browse the repository at this point in the history
  • Loading branch information
UlyssesWu committed Dec 31, 2022
1 parent d65feb5 commit 5bb6cce
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 21 deletions.
6 changes: 3 additions & 3 deletions FreeMote.PsBuild/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Project AZUSA")]
[assembly: AssemblyProduct("FreeMote")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2022")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2023")]
[assembly: AssemblyTrademark("wdwxy12345@gmail.com")]
[assembly: AssemblyCulture("")]

Expand All @@ -18,5 +18,5 @@
[assembly: InternalsVisibleTo("FreeMote.Editor")]

// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.4.0.0")]
[assembly: AssemblyFileVersion("3.4.0.0")]
[assembly: AssemblyVersion("3.4.2.0")]
[assembly: AssemblyFileVersion("3.4.2.0")]
6 changes: 6 additions & 0 deletions FreeMote.PsBuild/PsbDecompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using FreeMote.Psb.Textures;
using FreeMote.Psb.Types;
using Newtonsoft.Json;
using System.Runtime.Remoting.Contexts;

// ReSharper disable AssignNullToNotNullAttribute

Expand Down Expand Up @@ -340,6 +341,11 @@ public static void ExtractImageFiles(string inputPath, PsbImageFormat format = P
}
return;
}
else if (psb.Type == PsbType.Pimg)
{
OutputResources(psb, FreeMount.CreateContext(), inputPath, PsbExtractOption.Extract);
return;
}

var texs = PsbResHelper.UnlinkImages(psb);

Expand Down
6 changes: 3 additions & 3 deletions FreeMote.Tools.EmtConvert/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Project AZUSA")]
[assembly: AssemblyProduct("FreeMote")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2022")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2023")]
[assembly: AssemblyTrademark("wdwxy12345@gmail.com")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("44270712-4acb-447d-835e-9982bd515dbb")]

[assembly: AssemblyVersion("3.4.0.0")]
[assembly: AssemblyFileVersion("3.4.0.0")]
[assembly: AssemblyVersion("3.4.2.0")]
[assembly: AssemblyFileVersion("3.4.2.0")]
6 changes: 3 additions & 3 deletions FreeMote.Tools.PsBuild/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Project AZUSA")]
[assembly: AssemblyProduct("FreeMote")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2022")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2023")]
[assembly: AssemblyTrademark("wdwxy12345@gmail.com")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("d877dbdb-41d7-4c6f-9a46-957cecdaefa8")]

[assembly: AssemblyVersion("3.4.1.0")]
[assembly: AssemblyFileVersion("3.4.1.0")]
[assembly: AssemblyVersion("3.4.2.0")]
[assembly: AssemblyFileVersion("3.4.2.0")]
4 changes: 2 additions & 2 deletions FreeMote.Tools.PsbDecompile/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ static void Main(string[] args)
app.Command("image", imageCmd =>
{
//help
imageCmd.Description = "Extract (combined) textures from PSBs";
imageCmd.Description = "Extract (combined) textures from image type PSBs (with \"imageList\")";
imageCmd.HelpOption();
imageCmd.ExtendedHelpText = @"
Example:
PsbDecompile image sample.psb
PsbDecompile image tachie.psb
PsbDecompile image sample-resource-folder
";
//args
Expand Down
6 changes: 3 additions & 3 deletions FreeMote.Tools.PsbDecompile/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Project AZUSA")]
[assembly: AssemblyProduct("FreeMote")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2022")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2023")]
[assembly: AssemblyTrademark("wdwxy12345@gmail.com")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("943fe440-32bb-4caf-a1da-5f38de7f9b92")]

[assembly: AssemblyVersion("3.4.1.0")]
[assembly: AssemblyFileVersion("3.4.1.0")]
[assembly: AssemblyVersion("3.4.2.0")]
[assembly: AssemblyFileVersion("3.4.2.0")]
3 changes: 2 additions & 1 deletion FreeMote/FreeMoteExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public static PsbPixelFormat ToPsbPixelFormat(this string typeStr, PsbSpec spec)
case "RGBA8_SW":
return useTile
? (spec.UseBigEndian() ? PsbPixelFormat.TileBeRGBA8_SW : PsbPixelFormat.TileLeRGBA8_SW)
: ((spec.UseBigEndian() ? PsbPixelFormat.BeRGBA8_SW : PsbPixelFormat.LeRGBA8_SW));
: (spec.UseBigEndian() ? PsbPixelFormat.BeRGBA8_SW : spec == PsbSpec.ps3? PsbPixelFormat.FlipLeRGBA8_SW : PsbPixelFormat.LeRGBA8_SW);
case "A8_SW":
return useTile ? PsbPixelFormat.TileA8_SW : PsbPixelFormat.A8_SW;
case "L8_SW":
Expand Down Expand Up @@ -351,6 +351,7 @@ public static string ToStringForPsb(this PsbPixelFormat pixelFormat)
case PsbPixelFormat.LeRGBA8_SW:
case PsbPixelFormat.TileBeRGBA8_SW:
case PsbPixelFormat.TileLeRGBA8_SW:
case PsbPixelFormat.FlipLeRGBA8_SW:
return "RGBA8_SW";
case PsbPixelFormat.TileA8L8_SW:
case PsbPixelFormat.A8L8_SW:
Expand Down
6 changes: 3 additions & 3 deletions FreeMote/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Project AZUSA")]
[assembly: AssemblyProduct("FreeMote")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2022")]
[assembly: AssemblyCopyright("Copyright © Ulysses 2017-2023")]
[assembly: AssemblyTrademark("wdwxy12345@gmail.com")]
[assembly: AssemblyCulture("")]

Expand All @@ -21,5 +21,5 @@
[assembly: InternalsVisibleTo("FreeMote.Tests")]

// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.4.1.0")]
[assembly: AssemblyFileVersion("3.4.1.0")]
[assembly: AssemblyVersion("3.4.2.0")]
[assembly: AssemblyFileVersion("3.4.2.0")]
10 changes: 7 additions & 3 deletions FreeMote/PsbEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,19 @@ public enum PsbPixelFormat
/// </summary>
BeRGBA8_SW,
/// <summary>
/// LeRGBA8_SW (Swizzle) for PS3
/// LeRGBA8_SW (Swizzle) for vita
/// </summary>
LeRGBA8_SW,
/// <summary>
/// LeRGBA8_SW (Tile) for PS4
/// LeRGBA8_SW (Swizzle, Flip) for PS3
/// </summary>
FlipLeRGBA8_SW,
/// <summary>
/// LeRGBA8_SW (Swizzle, Tile) for PS4
/// </summary>
TileLeRGBA8_SW,
/// <summary>
/// BeRGBA8_SW (Tile) for ?
/// BeRGBA8_SW (Swizzle, Tile) for ?
/// </summary>
TileBeRGBA8_SW,
/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions FreeMote/RL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public static Bitmap ConvertToImage(byte[] data, int width, int height,
Switch_0_2(ref data);
break;
case PsbPixelFormat.LeRGBA8_SW:
data = PostProcessing.UnswizzleTexture(data, bmp.Width, bmp.Height, bmp.PixelFormat);
break;
case PsbPixelFormat.FlipLeRGBA8_SW:
data = PostProcessing.UnswizzleTexture(data, bmp.Width, bmp.Height, bmp.PixelFormat);
data = PostProcessing.FlipTexturePs3(data, width, height, bmp.PixelFormat);
break;
Expand Down Expand Up @@ -202,6 +205,9 @@ private static byte[] PixelBytesFromImage(Bitmap bmp, PsbPixelFormat pixelFormat
Switch_0_2(ref result);
break;
case PsbPixelFormat.LeRGBA8_SW:
result = PostProcessing.SwizzleTexture(result, bmp.Width, bmp.Height, bmp.PixelFormat);
break;
case PsbPixelFormat.FlipLeRGBA8_SW:
result = PostProcessing.FlipTexturePs3(result, bmp.Width, bmp.Height, bmp.PixelFormat);
result = PostProcessing.SwizzleTexture(result, bmp.Width, bmp.Height, bmp.PixelFormat);
break;
Expand Down

0 comments on commit 5bb6cce

Please sign in to comment.