Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b7e4570
Showing
15 changed files
with
1,007 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vs | ||
*/bin | ||
*/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30413.136 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LSWTextureManager", "LSWTextureManager\LSWTextureManager.csproj", "{E8CFF8B7-FA55-47E4-9BE4-C7B59DE8A22C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E8CFF8B7-FA55-47E4-9BE4-C7B59DE8A22C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E8CFF8B7-FA55-47E4-9BE4-C7B59DE8A22C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E8CFF8B7-FA55-47E4-9BE4-C7B59DE8A22C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E8CFF8B7-FA55-47E4-9BE4-C7B59DE8A22C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {E3F68FC4-78AC-4229-B086-9171838D3B5E} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="LSWTextureManager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
<userSettings> | ||
<LSWTextureManager.Properties.Settings> | ||
<setting name="ghgPath" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="ddsPath" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="exportPath" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</LSWTextureManager.Properties.Settings> | ||
</userSettings> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LSWTextureManager | ||
{ | ||
static class FileStreamExtensions | ||
{ | ||
public static int ReadInt32(this FileStream fs) { | ||
byte[] array = new byte[4]; | ||
fs.Read(array, 0, 4); | ||
return BitConverter.ToInt32(array, 0); | ||
} | ||
|
||
public static short ReadInt16(this FileStream fs) { | ||
byte[] array = new byte[2]; | ||
fs.Read(array, 0, 2); | ||
return BitConverter.ToInt16(array, 0); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace LSWTextureManager | ||
{ | ||
public partial class Form1 : Form | ||
{ | ||
private GHGParameters ghg; | ||
|
||
public Form1() { | ||
InitializeComponent(); | ||
textBox1.Text = "No file currently open."; | ||
} | ||
|
||
// Load GHG button | ||
private void button1_Click(object sender, EventArgs e) { | ||
openFileDialog1.InitialDirectory = Properties.Settings.Default.ghgPath; | ||
if (openFileDialog1.ShowDialog() == DialogResult.OK) { | ||
Program.LoadModel(openFileDialog1.FileName, out ghg); | ||
textBox1.Text = Path.GetFileName(openFileDialog1.FileName) + " Information:\r\n\r\n"; | ||
textBox1.Text += "Texture count: " + ghg.texCount + "\r\n"; | ||
for (int i = 0; i < ghg.texCount; i++) { | ||
textBox1.Text += "Image " + i + " - width: " + ghg.texWidths[i] + ", height: " + ghg.texHeights[i] + ", offset: " + ghg.texOffsets[i].ToString("X8") + "\r\n"; | ||
} | ||
|
||
Properties.Settings.Default.ghgPath = Path.GetDirectoryName(openFileDialog1.FileName); | ||
Properties.Settings.Default.Save(); | ||
} | ||
} | ||
|
||
private void numericUpDown1_ValueChanged(object sender, EventArgs e) { | ||
|
||
} | ||
|
||
// Load DDS button | ||
private void button2_Click(object sender, EventArgs e) { | ||
openFileDialog2.InitialDirectory = Properties.Settings.Default.ddsPath; | ||
if (openFileDialog2.ShowDialog() == DialogResult.OK) { | ||
Properties.Settings.Default.ddsPath = Path.GetDirectoryName(openFileDialog2.FileName); | ||
Properties.Settings.Default.Save(); | ||
} | ||
} | ||
|
||
// Replace button | ||
private void button3_Click(object sender, EventArgs e) { | ||
if (Path.GetExtension(openFileDialog1.FileName).ToLower() == ".ghg") { | ||
if (Path.GetExtension(openFileDialog2.FileName).ToLower() == ".dds") { | ||
bool result = Program.OverwriteTexture((int)numericUpDown1.Value, ghg, openFileDialog1.FileName, openFileDialog2.FileName); | ||
if (result) { | ||
MessageBox.Show("Successfully replaced texture!", "Success!", MessageBoxButtons.OK); | ||
} | ||
} else { | ||
MessageBox.Show("Please select a .DDS file", "Error", MessageBoxButtons.OK); | ||
} | ||
} else { | ||
MessageBox.Show("Please select a .GHG file", "Error", MessageBoxButtons.OK); | ||
} | ||
} | ||
|
||
private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { | ||
|
||
} | ||
|
||
// Export button | ||
private void button4_Click(object sender, EventArgs e) { | ||
if (Path.GetExtension(openFileDialog1.FileName).ToLower() == ".ghg") { | ||
saveFileDialog1.InitialDirectory = Properties.Settings.Default.exportPath; | ||
if (saveFileDialog1.ShowDialog() == DialogResult.OK) { | ||
File.WriteAllBytes(saveFileDialog1.FileName, ghg.texData[(int)numericUpDown1.Value]); | ||
Properties.Settings.Default.exportPath = Path.GetDirectoryName(saveFileDialog1.FileName); | ||
Properties.Settings.Default.Save(); | ||
MessageBox.Show("Successfully exported texture!", "Success!", MessageBoxButtons.OK); | ||
} | ||
} else { | ||
MessageBox.Show("Please select a .GHG file", "Error", MessageBoxButtons.OK); | ||
} | ||
} | ||
|
||
private void label4_Click(object sender, EventArgs e) { | ||
|
||
} | ||
|
||
private void Form1_Load(object sender, EventArgs e) { | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.