Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions HSDLib.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
# Visual Studio Version 16
VisualStudioVersion = 16.0.30406.217
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSDRawViewer", "HSDRawViewer\HSDRawViewer.csproj", "{755580A7-D09D-4EEC-9129-2DD7A6951A31}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HSDRaw", "HSDRaw\HSDRaw.csproj", "{ED9126AF-8A1E-465D-840A-8754A945414D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCDiff", "VCDiff\VCDiff.csproj", "{4D676F4E-E66D-4A41-861F-600F0FFCD052}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{ED9126AF-8A1E-465D-840A-8754A945414D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED9126AF-8A1E-465D-840A-8754A945414D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED9126AF-8A1E-465D-840A-8754A945414D}.Release|Any CPU.Build.0 = Release|Any CPU
{4D676F4E-E66D-4A41-861F-600F0FFCD052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D676F4E-E66D-4A41-861F-600F0FFCD052}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D676F4E-E66D-4A41-861F-600F0FFCD052}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D676F4E-E66D-4A41-861F-600F0FFCD052}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion HSDRaw/HSDRaw.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down
14 changes: 11 additions & 3 deletions HSDRaw/HSDRawFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ public static int BinarySearch(List<int> a, int item)
/// Saves dat data to filepath
/// </summary>
/// <param name="fileName"></param>
public void Save(string fileName, bool bufferAlign = true, bool optimize = true, bool trim = false)
public Stream Save(string fileName, bool bufferAlign = true, bool optimize = true, bool trim = false)
{
Save(new FileStream(fileName, FileMode.Create), bufferAlign, optimize, trim);
return Save(new FileStream(fileName, FileMode.Create), bufferAlign, optimize, trim);
}

/// <summary>
Expand Down Expand Up @@ -561,8 +561,10 @@ public void SetStructFlags()
/// </summary>
/// <param name="stream"></param>
/// <param name="bufferAlign"></param>
public void Save(Stream stream, bool bufferAlign = true, bool optimize = true, bool trim = false)
public Stream Save(Stream stream, bool bufferAlign = true, bool optimize = true, bool trim = false)
{
MemoryStream result = new MemoryStream();

if (Roots.Count > 0 && Roots[0].Data is MEX_Data)
bufferAlign = false;

Expand Down Expand Up @@ -611,6 +613,7 @@ public void Save(Stream stream, bool bufferAlign = true, bool optimize = true, b
if(optimize && Roots.Count > 0 && !(Roots[0].Data is SBM_FighterData) && !(Roots[0].Data is MEX_Data))
RemoveDuplicateBuffers();


// build file --------------------------------------------------------------------------
using (BinaryWriterExt writer = new BinaryWriterExt(stream))
{
Expand Down Expand Up @@ -711,7 +714,12 @@ public void Save(Stream stream, bool bufferAlign = true, bool optimize = true, b
writer.Write(Roots.Count);
writer.Write(References.Count);
writer.Write(VersionChars);

stream.Position = 0;
stream.CopyTo(result);

}
return result;
}


Expand Down
14 changes: 7 additions & 7 deletions HSDRawViewer/App.config
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;x86;x64" />
<probing privatePath="lib;x86;x64"/>
<dependentAssembly>
<assemblyIdentity name="OpenTK" publicKeyToken="bad199fe84eb3df4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
<assemblyIdentity name="OpenTK" publicKeyToken="bad199fe84eb3df4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
65 changes: 36 additions & 29 deletions HSDRawViewer/Converters/TOBJConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,43 +197,50 @@ public static HSD_TOBJ ImportTOBJFromFile(string filePath, GXTexFmt imgFmt, GXTl
/// <returns></returns>
public static HSD_TOBJ ImportTOBJFromFile()
{
var TOBJ = new HSD_TOBJ()
try
{
MagFilter = GXTexFilter.GX_LINEAR,
Flags = TOBJ_FLAGS.COORD_UV | TOBJ_FLAGS.LIGHTMAP_DIFFUSE | TOBJ_FLAGS.COLORMAP_MODULATE | TOBJ_FLAGS.ALPHAMAP_MODULATE,
HScale = 1,
WScale = 1,
WrapS = GXWrapMode.CLAMP,
WrapT = GXWrapMode.CLAMP,
SX = 1,
SY = 1,
SZ = 1,
GXTexGenSrc = 4,
Blending = 1
};

var f = Tools.FileIO.OpenFile(ApplicationSettings.ImageFileFilter);
if (f != null)
{
using (TextureImportDialog settings = new TextureImportDialog())
var TOBJ = new HSD_TOBJ()
{
if (FormatFromString(f, out GXTexFmt fmt, out GXTlutFmt pal))
MagFilter = GXTexFilter.GX_LINEAR,
Flags = TOBJ_FLAGS.COORD_UV | TOBJ_FLAGS.LIGHTMAP_DIFFUSE | TOBJ_FLAGS.COLORMAP_MODULATE | TOBJ_FLAGS.ALPHAMAP_MODULATE,
HScale = 1,
WScale = 1,
WrapS = GXWrapMode.CLAMP,
WrapT = GXWrapMode.CLAMP,
SX = 1,
SY = 1,
SZ = 1,
GXTexGenSrc = 4,
Blending = 1
};

var f = Tools.FileIO.OpenFile(ApplicationSettings.ImageFileFilter);
if (f != null)
{
using (TextureImportDialog settings = new TextureImportDialog())
{
settings.PaletteFormat = pal;
settings.TextureFormat = fmt;
}

if (settings.ShowDialog() == DialogResult.OK)
using (Bitmap bmp = new Bitmap(f))
if (FormatFromString(f, out GXTexFmt fmt, out GXTlutFmt pal))
{
settings.ApplySettings(bmp);
InjectBitmap(bmp, TOBJ, settings.TextureFormat, settings.PaletteFormat);
return TOBJ;
settings.PaletteFormat = pal;
settings.TextureFormat = fmt;
}

if (settings.ShowDialog() == DialogResult.OK)
using (Bitmap bmp = new Bitmap(f))
{
settings.ApplySettings(bmp);
InjectBitmap(bmp, TOBJ, settings.TextureFormat, settings.PaletteFormat);
return TOBJ;
}
}
}
}

return null;
return null;
} catch (Exception e)
{
return null;
}
}

/// <summary>
Expand Down
Loading