Skip to content

Commit

Permalink
Вернул и переделал конверт тхм в тч формат
Browse files Browse the repository at this point in the history
  • Loading branch information
VaIeroK committed Jun 8, 2022
1 parent bdaf6ae commit 2907ec9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Thm Editor/Program/THM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public enum EMIPFilters
// Для тч использование в рендере tp.fmt вместо tp.type, вероятнее всего, является опечаткой, и как следствие,
// неправильная загрузка THM файла. Вот такие вот приколы от ГСК.

// ValeroK: Чет не нашел в тч тхмок, а писать новый чанк под этот флаг дикая васянка, отключу пожалуй
public bool soc_repaired = false;

int THM_CHUNK_VERSION = 0x0810;
Expand Down Expand Up @@ -187,6 +186,14 @@ public void Load(string filename)
ResetValues();
using (IReader reader = new IReader(new BinaryReader(File.Open(filename, FileMode.Open))))
{
uint chunk_type = reader.find_chunk(THM_CHUNK_TYPE);
if (chunk_type != 0)
{
reader.r_u32();
if (chunk_type == 5)
soc_repaired = reader.r_bool();
}

if (reader.find_chunk(THM_CHUNK_TEXTUREPARAM) != 0)
{
if (soc_repaired)
Expand Down Expand Up @@ -257,6 +264,8 @@ public void Save(string filename)

writer.open_chunk(THM_CHUNK_TYPE);
writer.w_u32(1);
if (soc_repaired)
writer.w_bool(soc_repaired);
writer.close_chunk();

writer.open_chunk(THM_CHUNK_TEXTUREPARAM);
Expand Down
17 changes: 16 additions & 1 deletion Thm Editor/Program/ThmEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Thm Editor/Program/ThmEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void Form_Update()
textBox10.Text = thm.fade_delay.ToString();
textBox11.Text = thm.material_weight.ToString();
textBox12.Text = thm.bump_virtual_height.ToString();
chbxShocFormat.Checked = thm.soc_repaired;
}
public void Values_Update()
{
Expand Down Expand Up @@ -397,5 +398,11 @@ private void GenerateTHM(object sender, System.ComponentModel.CancelEventArgs e)
main_thm.Save(sMainTHM);
AutoClosingMessageBox.Show("Generated!", "", 500, MessageBoxIcon.Information);
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (thm != null)
thm.soc_repaired = chbxShocFormat.Checked;
}
}
}

0 comments on commit 2907ec9

Please sign in to comment.