mirror of
https://github.com/exelix11/SwitchThemeInjector.git
synced 2024-11-23 09:49:42 +00:00
Fix crash when patching an szs without a background image
This commit is contained in:
parent
574c4077a7
commit
0147f15f21
@ -366,7 +366,10 @@ namespace SwitchThemes
|
||||
MessageBox.Show("Open a valid SZS first");
|
||||
return;
|
||||
}
|
||||
if (tbImageFile.Text.Trim() == "")
|
||||
|
||||
bool HasImage = tbImageFile.Text.Trim() != "";
|
||||
|
||||
if (!HasImage)
|
||||
{
|
||||
if (LayoutPatchList.SelectedIndex <= 0)
|
||||
{
|
||||
@ -388,6 +391,7 @@ namespace SwitchThemes
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasImage)
|
||||
{
|
||||
var dds = DDSEncoder.LoadDDS(File.ReadAllBytes(tbImageFile.Text));
|
||||
if (dds.Format != "DXT1") MessageBox.Show("WARNING: the encoding of the selected DDS is not DXT1, it may crash on the switch");
|
||||
@ -404,7 +408,7 @@ namespace SwitchThemes
|
||||
SzsPatcher Patcher = new SzsPatcher(CommonSzs, Templates);
|
||||
|
||||
var res = true;
|
||||
if (tbImageFile.Text.Trim() != "")
|
||||
if (HasImage)
|
||||
{
|
||||
res = Patcher.PatchMainBG(File.ReadAllBytes(tbImageFile.Text));
|
||||
if (!res)
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("4.4.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.4.0.0")]
|
||||
[assembly: AssemblyVersion("4.4.0.1")]
|
||||
[assembly: AssemblyFileVersion("4.4.0.1")]
|
||||
|
@ -44,13 +44,14 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
@ -255,6 +256,7 @@
|
||||
<PostBuildEvent>if "$(ConfigurationName)" == "Release" (
|
||||
rmdir Layouts /s /q
|
||||
robocopy $(ProjectDir)Layouts Layouts /E
|
||||
EXIT /b 0
|
||||
)</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user