diff --git a/SenLib/Sen1/Sen1ExecutablePatchEnglish.cs b/SenLib/Sen1/Sen1ExecutablePatchEnglish.cs index d9b54633..99600014 100644 --- a/SenLib/Sen1/Sen1ExecutablePatchEnglish.cs +++ b/SenLib/Sen1/Sen1ExecutablePatchEnglish.cs @@ -33,5 +33,9 @@ public long GetAddressJumpR2NotebookOpen() { public long GetAddressJumpR2NotebookSettings() { return 0x6dfaf0; } + + public long GetRomAddressThorMasterQuartzTextureIdTypo() { + return 0x73adba; + } } } diff --git a/SenLib/Sen1/Sen1ExecutablePatchInterface.cs b/SenLib/Sen1/Sen1ExecutablePatchInterface.cs index a5970b2b..423ce9e8 100644 --- a/SenLib/Sen1/Sen1ExecutablePatchInterface.cs +++ b/SenLib/Sen1/Sen1ExecutablePatchInterface.cs @@ -26,5 +26,8 @@ public interface Sen1ExecutablePatchInterface { // address of conditional jump statement for not displaying the R2 option in the settings when turbo is enabled long GetAddressJumpR2NotebookSettings(); + + // address of extra character in the middle of texture ID string of Thor MQ, for the HQ texture pack + long GetRomAddressThorMasterQuartzTextureIdTypo(); } } diff --git a/SenLib/Sen1/Sen1ExecutablePatchJapanese.cs b/SenLib/Sen1/Sen1ExecutablePatchJapanese.cs index 2af00ed2..fee05813 100644 --- a/SenLib/Sen1/Sen1ExecutablePatchJapanese.cs +++ b/SenLib/Sen1/Sen1ExecutablePatchJapanese.cs @@ -33,5 +33,9 @@ public long GetAddressJumpR2NotebookOpen() { public long GetAddressJumpR2NotebookSettings() { return 0x6de1a0; } + + public long GetRomAddressThorMasterQuartzTextureIdTypo() { + return 0x738f6a; + } } } diff --git a/SenLib/Sen1/Sen1ExecutablePatches.cs b/SenLib/Sen1/Sen1ExecutablePatches.cs index 679917bf..54f6663a 100644 --- a/SenLib/Sen1/Sen1ExecutablePatches.cs +++ b/SenLib/Sen1/Sen1ExecutablePatches.cs @@ -84,5 +84,12 @@ public static void PatchJumpR2NotebookSettings(Stream binary, Sen1ExecutablePatc } } + public static void PatchThorMasterQuartzString(Stream binary, Sen1ExecutablePatchInterface patchInfo) { + binary.Position = patchInfo.GetRomAddressThorMasterQuartzTextureIdTypo(); + long p = binary.Position; + byte[] tmp = binary.ReadUInt8Array(4); + binary.Position = p; + binary.Write(tmp, 1, 3); + } } } diff --git a/SenPatcherGui/Sen1Form.Designer.cs b/SenPatcherGui/Sen1Form.Designer.cs index accba6b1..f5215b1c 100644 --- a/SenPatcherGui/Sen1Form.Designer.cs +++ b/SenPatcherGui/Sen1Form.Designer.cs @@ -35,6 +35,7 @@ private void InitializeComponent() { this.comboBoxTurboModeKey = new System.Windows.Forms.ComboBox(); this.buttonPatch = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); + this.checkBoxFixHdTextureId = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // label1 @@ -97,7 +98,7 @@ private void InitializeComponent() { // checkBoxAllowR2InTurboMode // this.checkBoxAllowR2InTurboMode.AutoSize = true; - this.checkBoxAllowR2InTurboMode.Location = new System.Drawing.Point(97, 94); + this.checkBoxAllowR2InTurboMode.Location = new System.Drawing.Point(97, 117); this.checkBoxAllowR2InTurboMode.Name = "checkBoxAllowR2InTurboMode"; this.checkBoxAllowR2InTurboMode.Size = new System.Drawing.Size(280, 17); this.checkBoxAllowR2InTurboMode.TabIndex = 6; @@ -107,7 +108,7 @@ private void InitializeComponent() { // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(94, 120); + this.label4.Location = new System.Drawing.Point(94, 143); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(87, 13); this.label4.TabIndex = 7; @@ -117,7 +118,7 @@ private void InitializeComponent() { // this.comboBoxTurboModeKey.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxTurboModeKey.FormattingEnabled = true; - this.comboBoxTurboModeKey.Location = new System.Drawing.Point(187, 117); + this.comboBoxTurboModeKey.Location = new System.Drawing.Point(187, 140); this.comboBoxTurboModeKey.Name = "comboBoxTurboModeKey"; this.comboBoxTurboModeKey.Size = new System.Drawing.Size(126, 21); this.comboBoxTurboModeKey.TabIndex = 8; @@ -126,7 +127,7 @@ private void InitializeComponent() { // this.buttonPatch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.buttonPatch.Location = new System.Drawing.Point(12, 225); + this.buttonPatch.Location = new System.Drawing.Point(12, 233); this.buttonPatch.Name = "buttonPatch"; this.buttonPatch.Size = new System.Drawing.Size(440, 41); this.buttonPatch.TabIndex = 9; @@ -137,17 +138,30 @@ private void InitializeComponent() { // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(94, 147); + this.label5.Location = new System.Drawing.Point(94, 170); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(346, 52); this.label5.TabIndex = 10; this.label5.Text = resources.GetString("label5.Text"); // + // checkBoxFixHdTextureId + // + this.checkBoxFixHdTextureId.AutoSize = true; + this.checkBoxFixHdTextureId.Checked = true; + this.checkBoxFixHdTextureId.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxFixHdTextureId.Location = new System.Drawing.Point(97, 94); + this.checkBoxFixHdTextureId.Name = "checkBoxFixHdTextureId"; + this.checkBoxFixHdTextureId.Size = new System.Drawing.Size(198, 17); + this.checkBoxFixHdTextureId.TabIndex = 11; + this.checkBoxFixHdTextureId.Text = "Fix Thor master quartz HD texture ID"; + this.checkBoxFixHdTextureId.UseVisualStyleBackColor = true; + // // Sen1Form // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(465, 278); + this.ClientSize = new System.Drawing.Size(465, 286); + this.Controls.Add(this.checkBoxFixHdTextureId); this.Controls.Add(this.label5); this.Controls.Add(this.buttonPatch); this.Controls.Add(this.comboBoxTurboModeKey); @@ -179,5 +193,6 @@ private void InitializeComponent() { private System.Windows.Forms.ComboBox comboBoxTurboModeKey; private System.Windows.Forms.Button buttonPatch; private System.Windows.Forms.Label label5; + private System.Windows.Forms.CheckBox checkBoxFixHdTextureId; } } \ No newline at end of file diff --git a/SenPatcherGui/Sen1Form.cs b/SenPatcherGui/Sen1Form.cs index ee284450..fefc09a1 100644 --- a/SenPatcherGui/Sen1Form.cs +++ b/SenPatcherGui/Sen1Form.cs @@ -70,6 +70,7 @@ private void buttonPatch_Click(object sender, EventArgs e) { bool removeTurboSkip = checkBoxBattleAutoSkip.Checked; bool allowR2NotebookShortcut = checkBoxAllowR2InTurboMode.Checked; int turboKey = comboBoxTurboModeKey.SelectedIndex; + bool fixTextureIds = checkBoxFixHdTextureId.Checked; if (removeTurboSkip) { Sen1ExecutablePatches.PatchJumpBattleAnimationAutoSkip(ms, PatchInfo, true); @@ -84,6 +85,9 @@ private void buttonPatch_Click(object sender, EventArgs e) { Sen1ExecutablePatches.PatchButtonBattleResultsAutoSkip(ms, PatchInfo, (byte)turboKey); Sen1ExecutablePatches.PatchButtonTurboMode(ms, PatchInfo, (byte)turboKey); } + if (fixTextureIds) { + Sen1ExecutablePatches.PatchThorMasterQuartzString(ms, PatchInfo); + } // write patched file using (var fs = new FileStream(Path, FileMode.Create, FileAccess.Write)) {