Venomalia / DolphinTextureExtraction-tool

Dumps GC and Wii textures, compatible with the Dolphin texture hash.
MIT License
29 stars 5 forks source link

System.Drawing.Common will be unavailable for non-Windows systems #36

Closed Neui closed 1 year ago

Neui commented 1 year ago

In my attempt to get this tool working on Linux, I get warnings during building like:

DolphinTextureExtraction-tool/lib/AuroraLip/Common/Extensions/BitmapEx.cs(42,111): warning CA1416: This call site is reachable on all platforms. 'Image.PixelFormat' is only supported on: 'windows'. [DolphinTextureExtraction-tool/lib/AuroraLip/AuroraLib.csproj]

These classes are/will be unavailable on non-Windows systems. So maybe switch to something else to get cross-operating system compatibility.

These are only warnings, so it does run but no textures get dumped and I get exceptions such as:

Exception: wzx_naminori_damage/0F5E2000_naminori_damage/000181C0.GSscene Object reference not set to an instance of an object.
DolphinTextureExtraction.tool:   at DolphinTextureExtraction.TextureExtractor.Save(JUTTexture texture, String& subdirectory) in DolphinTextureExtraction-tool/TextureExtraction tool/Data/TextureExtractor.cs:line 308
   at DolphinTextureExtraction.TextureExtractor.Scan(ScanObjekt so) in DolphinTextureExtraction-tool/TextureExtraction tool/Data/TextureExtractor.cs:line 188

https://github.com/Venomalia/DolphinTextureExtraction-tool/blob/55aa39f34bf50069a7fad0bca03764c303eafd4e/TextureExtraction%20tool/Data/TextureExtractor.cs#L285-L311

I haven't checked what the real exception is (as in what exception is getting thrown that is caught before erroring out again), but I guess it is related to the above.

I did try adding the suggested config value into the .csproj file, but it doesn't appear to work. I still get the same error.

diff --git a/TextureExtraction tool/DolphinTextureExtraction tool.csproj b/TextureExtraction tool/DolphinTextureExtraction tool.csproj
index b92a024..44f40e4 100644
--- a/TextureExtraction tool/DolphinTextureExtraction tool.csproj       
+++ b/TextureExtraction tool/DolphinTextureExtraction tool.csproj       
@@ -52,4 +52,8 @@
     </None>
   </ItemGroup>

-</Project>
\ No newline at end of file
+  <ItemGroup>
+    <RuntimeHostConfigurationOption Include="System.Drawing.EnableUnixSupport" Value="true" />
+  </ItemGroup>
+
+</Project>
diff --git a/lib/AuroraLip/AuroraLib.csproj b/lib/AuroraLip/AuroraLib.csproj
index 1f22632..1176d8c 100644
--- a/lib/AuroraLip/AuroraLib.csproj
+++ b/lib/AuroraLip/AuroraLib.csproj
@@ -33,5 +33,9 @@
     <ProjectReference Include="..\AFSLib\AFSLib.csproj" />
     <ProjectReference Include="..\LibCPK\LibCPK.csproj" />
   </ItemGroup>
-  
-</Project>
\ No newline at end of file
+
+  <ItemGroup>
+    <RuntimeHostConfigurationOption Include="System.Drawing.EnableUnixSupport" Value="true" />
+  </ItemGroup>
+
+</Project>
Venomalia commented 1 year ago

thanks for the info, i know that System.Drawing.Common only works under windows.

I will soon change this to SixLabors.ImageSharp which also works under other platforms.