Skip to content

Commit

Permalink
Merge pull request #263 from lastbattle/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
lastbattle authored Nov 4, 2024
2 parents da59908 + c76fc56 commit 6feff4f
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 40 deletions.
28 changes: 0 additions & 28 deletions HaCreator/Converter/QuestStateIdToQuestStateConverter.cs

This file was deleted.

8 changes: 5 additions & 3 deletions HaCreator/GUI/Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public void ExtractMobFile()
string mobIdStr = mobImage.Name.Replace(".img", "");
int mobId = int.Parse(mobIdStr);

WzImageProperty standCanvas = (WzCanvasProperty) mobImage["stand"]?["0"].GetLinkedWzImageProperty();
WzImageProperty standCanvas = (WzCanvasProperty) mobImage["stand"]?["0"]?.GetLinkedWzImageProperty();

if (standCanvas == null) continue;

Expand Down Expand Up @@ -777,7 +777,8 @@ public void ExtractItemFile()

lock (Program.InfoManager.ItemIconCache)
{
Program.InfoManager.ItemIconCache.Add(intName, icon);
if (!Program.InfoManager.ItemIconCache.ContainsKey(intName))
Program.InfoManager.ItemIconCache.Add(intName, icon);
}
}
}
Expand All @@ -797,7 +798,8 @@ public void ExtractItemFile()

lock (Program.InfoManager.ItemIconCache)
{
Program.InfoManager.ItemIconCache.Add(intName, icon);
if (!Program.InfoManager.ItemIconCache.ContainsKey(intName))
Program.InfoManager.ItemIconCache.Add(intName, icon);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions HaCreator/GUI/Quest/QuestEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<converter:JobIdToJobNameConverter x:Key="jobIdToJobNameConverter"/>
<converter:NegativeOneToTrueConverter x:Key="negativeOneToTrueConverter"/>
<converter:SkillIdToSkillNameConverter x:Key="skillIdToSkillNameConverter"/>
<converter:QuestStateIdToQuestStateConverter x:Key="questStateIdToQuestStateConverter"/>
<converter:JobClassBitfieldToClassNamesConverter x:Key="jobClassBitfieldToClassNamesConverter"/>
<converter:EnumNameIntValueConverter x:Key="enumNameIntValueConverter"/>
<converter:CharacterSubJobTypeConverter x:Key="characterSubJobTypeConverter"/>
Expand Down Expand Up @@ -921,7 +920,7 @@
<TextBlock Text="State:" Width="70" Margin="10,0,0,0"/>
<ComboBox x:Name="comboBox_questState"
ItemsSource="{Binding Source={StaticResource QuestStateTypeEnum}}"
SelectedValue="{Binding QuestState, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource questStateIdToQuestStateConverter}}"
SelectedValue="{Binding QuestState, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="."
DisplayMemberPath=".">
<ComboBox.ItemTemplate>
Expand Down Expand Up @@ -1899,7 +1898,7 @@
<TextBlock Text="State:" Width="70" Margin="10,0,0,0"/>
<ComboBox x:Name="comboBox_questState"
ItemsSource="{Binding Source={StaticResource QuestStateTypeEnum}}"
SelectedValue="{Binding QuestState, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource questStateIdToQuestStateConverter}}"
SelectedValue="{Binding QuestState, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="."
DisplayMemberPath=".">
<ComboBox.ItemTemplate>
Expand Down Expand Up @@ -1989,7 +1988,7 @@
</StackPanel>
<!--<ComboBox x:Name="comboBox_questInfoEx_Condition"
ItemsSource="{Binding Source={StaticResource QuestStateTypeEnum}}"
SelectedValue="{Binding Condition, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource questStateIdToQuestStateConverter}}"
SelectedValue="{Binding Condition, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="."
DisplayMemberPath=".">
<ComboBox.ItemTemplate>
Expand Down
39 changes: 39 additions & 0 deletions HaCreator/HaCreator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,43 @@
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>

<!-- AOT and Trimming Configuration -->
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<PublishAot>false</PublishAot>

<!-- Required for WinForms AOT -->
<!--<IlcDisableReflection>false</IlcDisableReflection>
<IlcTrimMetadata>false</IlcTrimMetadata>
<IlcFoldIdenticalMethodBodies>false</IlcFoldIdenticalMethodBodies>
<IlcGenerateStackTraceData>true</IlcGenerateStackTraceData>
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>-->

<!-- Trimming Configuration -->
<!--<PublishTrimmed>true</PublishTrimmed>
<CustomResourceTypesSupport>true</CustomResourceTypesSupport>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
<_SuppressWpfTrimError>true</_SuppressWpfTrimError>-->

<!-- Enable Native debugging -->
<StripSymbols>false</StripSymbols>

<!-- Required for WinForms -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<!-- x64-specific configuration -->
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<PublishAot>false</PublishAot>
</PropertyGroup>
<!-- x86-specific configuration -->
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
<PublishAot>false</PublishAot>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -16,10 +52,12 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup>
<Win32Resource>
</Win32Resource>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisLogFile>bin\x86\Debug\HaCreator.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
Expand Down Expand Up @@ -159,6 +197,7 @@
<Resource Include="Images\new_icon.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="8.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="MonoGame.Framework.WindowsDX">
Expand Down
30 changes: 30 additions & 0 deletions HaCreator/rd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<Directives>
<Application>
<!-- Windows Forms -->
<Assembly Name="System.Windows.Forms" Dynamic="Required All" />
<Assembly Name="System.Drawing" Dynamic="Required All" />
<Assembly Name="System.Drawing.Common" Dynamic="Required All" />

<!-- WPF -->
<Assembly Name="PresentationFramework" Dynamic="Required All" />
<Assembly Name="PresentationCore" Dynamic="Required All" />
<Assembly Name="WindowsBase" Dynamic="Required All" />

<!-- Your application assembly -->
<Assembly Name="HaCreator" Dynamic="Required All">
<Type Name="HaCreator.Program" Dynamic="Required All" />
<!-- Add other types that need reflection -->
</Assembly>

<!-- SharpDX -->
<Assembly Name="SharpDX" Dynamic="Required All" />
<Assembly Name="SharpDX.Direct2D1" Dynamic="Required All" />
<Assembly Name="SharpDX.Direct3D11" Dynamic="Required All" />
<Assembly Name="SharpDX.Direct3D9" Dynamic="Required All" />
<Assembly Name="SharpDX.DXGI" Dynamic="Required All" />

<!-- MonoGame -->
<Assembly Name="MonoGame.Framework" Dynamic="Required All" />
</Application>
</Directives>
19 changes: 16 additions & 3 deletions HaRepacker/GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
using System.Runtime.CompilerServices;
using HaSharedLibrary.Util;
using MapleLib.WzLib.Serializer;
using static HaSharedLibrary.Util.AssemblyBitnessDetector;

namespace HaRepacker.GUI
{
Expand Down Expand Up @@ -783,11 +784,23 @@ private async void OpenFileInternal(string[] fileNames) {

if (filePathLowerCase.EndsWith("zlz.dll") || filePathLowerCase.EndsWith("zlz64.dll"))
{
var state = ApplicationStateDetector.DetectApplicationState();

var is64BitDll = filePathLowerCase.EndsWith("zlz64.dll");
var (bitness, architecture) = AssemblyBitnessDetector.GetAssemblyInfo();

bool isCompatible = (is64BitDll && (bitness == AssemblyBitnessDetector.Bitness.Bit64)) ||
(!is64BitDll && (bitness == AssemblyBitnessDetector.Bitness.Bit32));
bool isCompatible = false;
if (state.IsPublished)
{
bool is64BitProcess = Environment.Is64BitProcess;
isCompatible = (is64BitDll && (is64BitProcess)) ||
(!is64BitDll && (!is64BitProcess));
}
else
{
var (bitness, architecture) = AssemblyBitnessDetector.GetAssemblyInfo();
isCompatible = (is64BitDll && (bitness == AssemblyBitnessDetector.Bitness.Bit64)) ||
(!is64BitDll && (bitness == AssemblyBitnessDetector.Bitness.Bit32));
}

if (isCompatible)
{
Expand Down
38 changes: 37 additions & 1 deletion HaRepacker/Harepacker-resurrected.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>WinExe</OutputType>
<RootNamespace>HaRepacker</RootNamespace>
<AssemblyName>HaRepackerResurrected</AssemblyName>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>

<!-- AOT and Trimming Configuration -->
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<PublishAot>false</PublishAot>

<!-- Required for WinForms AOT -->
<!--<IlcDisableReflection>false</IlcDisableReflection>
<IlcTrimMetadata>false</IlcTrimMetadata>
<IlcFoldIdenticalMethodBodies>false</IlcFoldIdenticalMethodBodies>
<IlcGenerateStackTraceData>true</IlcGenerateStackTraceData>
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>-->

<!-- Trimming Configuration -->
<!--<PublishTrimmed>true</PublishTrimmed>
<CustomResourceTypesSupport>true</CustomResourceTypesSupport>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
<_SuppressWpfTrimError>true</_SuppressWpfTrimError>-->

<!-- Enable Native debugging -->
<StripSymbols>false</StripSymbols>

<!-- Required for WinForms -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<!-- x64-specific configuration -->
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<PublishAot>false</PublishAot>
</PropertyGroup>
<!-- x86-specific configuration -->
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x86'">
<PublishAot>false</PublishAot>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -47,6 +82,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 6feff4f

Please sign in to comment.