diff --git a/M64MM.Utils/CameraStyle.cs b/M64MM.Utils/CameraStyle.cs index e678692..d6e4f2d 100644 --- a/M64MM.Utils/CameraStyle.cs +++ b/M64MM.Utils/CameraStyle.cs @@ -9,7 +9,7 @@ namespace M64MM.Utils public struct CameraStyle { - public byte Value; - public string Name; + public byte Value { get; set; } + public string Name { get; set; } } } diff --git a/M64MM.Utils/Core.cs b/M64MM.Utils/Core.cs index 188c08e..63525c1 100644 --- a/M64MM.Utils/Core.cs +++ b/M64MM.Utils/Core.cs @@ -28,10 +28,20 @@ public static class Core public static List colorCodeGamesharks = new List(); public static Animation defaultAnimation; public static byte[] emptyWord = new byte[] { 0, 0, 0, 0 }; + public static readonly int[] levelsZ_O = new int[] { 5, 8, 9, 10, 11, 13, 15, 16, 17, 19, 21, 22, 24, 29, 30, 31, 33, 34, 36 }; public static SettingsGroup coreSettingsGroup; static bool _cameraFrozen = false; static bool _cameraSoftFrozen = false; + public enum PowerCameraStyleStage + { + UNSET, + CLEAN, + DIRTY + } + + public static PowerCameraStyleStage PowerCamStyleStage { get; set; } = PowerCameraStyleStage.UNSET; + public static bool PowerCamEnabled { get; set; } public static bool CameraFrozen @@ -63,6 +73,8 @@ private set { } // Settings related variables public static bool enableHotkeys; public static bool enableUpdates; + public static byte preferredCameraStyle = 0x01; + public static bool prePowercam = true; // Timers public static Timer programTimer = new Timer(); @@ -96,6 +108,15 @@ public static byte[] CameraState private set { } } + public static byte[] CameraStyle + { + get + { + return ReadBytes(BaseAddress + 0x33C6D6, 2); + } + private set { } + } + // Animation Index public static short AnimationIndex { @@ -228,6 +249,8 @@ public static async void InitSettings() coreSettingsGroup = GetSettingsGroup("core", true); coreSettingsGroup.SetSettingValue("enableHotkeys", true); coreSettingsGroup.SetSettingValue("enableUpdateCheck", true); + coreSettingsGroup.SetSettingValue("enableStartupPowercam", true); + coreSettingsGroup.SetSettingValue("preferredDefaultCamStyle", 0x01); UpdateLocalVariables(); using (StreamWriter rw = new StreamWriter($"{Application.StartupPath}/config.json")) { @@ -255,6 +278,8 @@ static void UpdateLocalVariables() { enableHotkeys = coreSettingsGroup.EnsureSettingValue("enableHotkeys"); enableUpdates = coreSettingsGroup.EnsureSettingValue("enableUpdateCheck"); + prePowercam = coreSettingsGroup.EnsureSettingValue("enableStartupPowercam"); + preferredCameraStyle = coreSettingsGroup.EnsureSettingValue("preferredDefaultCamStyle"); } #endregion @@ -381,6 +406,11 @@ public static void ToggleCameraSoftFreeze() } + public static bool WillLevelZoomOut(int id) + { + return levelsZ_O.Contains(id); + } + public static bool LoadCameraData() { try @@ -407,8 +437,23 @@ public static bool LoadCameraData() return true; } + public static void WriteCameraData(byte[] camByte) + { + WriteBytes(BaseAddress + 0x33C6D6, camByte); + WriteBytes(BaseAddress + 0x33C6D7, camByte); + } + public static void PowercamHack() { + // Override camera with preferred camera preset if camera state is CLEAN + if (PowerCamStyleStage == PowerCameraStyleStage.CLEAN) + { + // We've changed it, set Dirty + PowerCamStyleStage = PowerCameraStyleStage.DIRTY; + WriteCameraData(new byte[] { preferredCameraStyle }); + + } + // Animation index is -1 when the game is transitioning which is just about perfect // Only override camera reset (flag 0x08) when the game is transitioning // Works before entering Castle Grounds and literally any level transition @@ -418,15 +463,18 @@ public static void PowercamHack() WriteBytes(BaseAddress + 0x33C84B, new byte[] { (byte)(CameraState[0] & ~(0x8)) }); } - if (CameraState[0] == 0xA2) + if ((CameraState[0] & 0xA2) >= 0xA2 && (CameraState[2] & 0x0C) > 0) { - // EDGE CASE. Sometimes the bugged first person camera happens - // when using Powercam and the only workaround was to just - // knock down the single edge case when it happens. + // EDGE CASES + // Mario keeps stuck in first person mode when camera is frozen. + // Oh No! // This edge case happens only when the camera is hard-frozen - // and we're in first person with overrides enabled - WriteBytes(BaseAddress + 0x33C84B, new byte[] { 0x81 }); + // and we're in first person, so just knock down the following + + // NOTE: I *HATE* UNALIGNED WRITES/READS + // TODO: Find a way to perform better unaligned writes + WriteBytes(BaseAddress + 0x33C849, new byte[] { 0x00 }); } else if (CameraFrozen && ((CameraState[0] & 0x80) != 0x20)) { @@ -441,6 +489,8 @@ public static void PowercamHack() // Glitchy: Camera status is actually a flag, which means we just need to take away // the first person flag to restore, so it doesn't do a false alarm on newly // loaded emulator instances (freezing camera Wayyyyyyyy up in the sky) + + // Actually this has a different fix and I'll be implementing this into auto Powercam byte[] data = { (byte)(CameraState[0] & ~(0x20)) }; WriteBytes(BaseAddress + 0x33C84B, data); } @@ -629,6 +679,7 @@ public static void LoadAddonsFromFolder(string path = "") // AppDomains are incredibly messy // Let's just hope you don't download anything suspicious // HEAVILY considering moving back the Addon namespace back to .netFX + // ^ already did LOL AddonErrorsBuilder = new StringBuilder(); _ = new ToolStripMenuItem("Addons"); @@ -920,11 +971,5 @@ public async static void PerformUpdate() #endregion public static bool GetKey(Keys vKey) => GetAsyncKeyState(vKey) != 0; - public static bool GetKeyDown(Keys vKey) - { - short _keyState = GetAsyncKeyState(vKey); - Debug.WriteLine($"KeyState: {_keyState}"); - return ((_keyState & 0x80) != 0) && ((_keyState & 1) == 0); - } } } \ No newline at end of file diff --git a/M64MM2/MainForm.Designer.cs b/M64MM2/MainForm.Designer.cs index 877a711..a5e249b 100644 --- a/M64MM2/MainForm.Designer.cs +++ b/M64MM2/MainForm.Designer.cs @@ -62,6 +62,7 @@ private void InitializeComponent() this.btnChangeCamStyle = new System.Windows.Forms.Button(); this.cbCamStyles = new System.Windows.Forms.ComboBox(); this.ttAutoApplyInfo = new System.Windows.Forms.ToolTip(this.components); + this.lblCameraStyle = new System.Windows.Forms.ToolStripStatusLabel(); this.menuStrip.SuspendLayout(); this.grpCamera.SuspendLayout(); this.statusStrip.SuspendLayout(); @@ -182,7 +183,8 @@ private void InitializeComponent() this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lblProgramStatus, this.lblCameraStatus, - this.lblCameraCode}); + this.lblCameraCode, + this.lblCameraStyle}); resources.ApplyResources(this.statusStrip, "statusStrip"); this.statusStrip.Name = "statusStrip"; this.statusStrip.SizingGrip = false; @@ -296,6 +298,11 @@ private void InitializeComponent() // this.ttAutoApplyInfo.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; // + // lblCameraStyle + // + this.lblCameraStyle.Name = "lblCameraStyle"; + resources.ApplyResources(this.lblCameraStyle, "lblCameraStyle"); + // // MainForm // resources.ApplyResources(this, "$this"); @@ -358,6 +365,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem scanForEmulatorsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem issuesToolStripMenuItem; + private System.Windows.Forms.ToolStripStatusLabel lblCameraStyle; } } diff --git a/M64MM2/MainForm.cs b/M64MM2/MainForm.cs index eab8823..5bd38f8 100644 --- a/M64MM2/MainForm.cs +++ b/M64MM2/MainForm.cs @@ -19,7 +19,7 @@ public partial class MainForm : Form ExtraControlsForm extraControlsForm; SettingsForm settingsForm; LatestUpdateDialog ludForm; - + ToolTip hint = new ToolTip(); Keys _heldKeys = Keys.None; @@ -32,6 +32,7 @@ public partial class MainForm : Form public MainForm() { InitializeComponent(); + hint.IsBalloon = true; Core.EmulatorSelected += (a, b) => { EmulatorSelected(a, b); }; MoreThanOneEmuFound += (a, b) => { MoreThanOneEmu(a, b); }; ToolStripMenuItem addons = new ToolStripMenuItem("Addons"); @@ -99,9 +100,10 @@ public MainForm() { foreach (CameraStyle style in camStyles) { - cbCamStyles.Items.Add(style.Name); + cbCamStyles.Items.Add(style); } - cbCamStyles.SelectedIndex = 0; + cbCamStyles.SelectedIndex = camStyles.FindIndex(x => x.Value == preferredCameraStyle); + cbCamStyles.DisplayMember = "Name"; cbCamStyles.Refresh(); } else @@ -110,6 +112,8 @@ public MainForm() cbCamStyles.Enabled = false; } } + + cbPowercam.Checked = prePowercam; } void Update(object sender, EventArgs e) @@ -121,6 +125,7 @@ void Update(object sender, EventArgs e) Text = Resources.programName + " " + Application.ProductVersion + Resources.prereleaseString; lblProgramStatus.Text = Resources.programStatus1; FindEmuProcess(); + PowerCamStyleStage = PowerCameraStyleStage.UNSET; return; } @@ -140,6 +145,10 @@ void Update(object sender, EventArgs e) if (CurrentLevelID < 3) { lblProgramStatus.Text = Resources.programStatusAwaitingLevel + "0x" + BaseAddress.ToString("X8"); + if (Core.CameraStyle[0] == 0x00 && PowerCamStyleStage == PowerCameraStyleStage.UNSET) + { + PowerCamStyleStage = PowerCameraStyleStage.CLEAN; + } return; } @@ -160,8 +169,24 @@ void Update(object sender, EventArgs e) // in-game timer in that case UpdateCoreEntityAddress(); + if (CoreEntityAddress > 0 && + Core.CameraStyle[0] != 0x00 && + PowerCamStyleStage == PowerCameraStyleStage.UNSET) + { + PowerCamStyleStage = PowerCameraStyleStage.DIRTY; + if (CoreEntityAddress > 0 && + WillLevelZoomOut(CurrentLevelID) && + cbPowercam.Checked) + { + ShowPowercamTooltip(false); + cbPowercam.Checked = false; + } + + } + lblCameraCode.Text = "0x" + BitConverter.ToString(CameraState).Replace("-", ""); + lblCameraStyle.Text = "0x" + BitConverter.ToString(Core.CameraStyle).Replace("-", ""); // Execute camera fixes (bugged first person hack) and Powercam PowercamHack(); @@ -178,7 +203,6 @@ void Update(object sender, EventArgs e) { _heldKeys &= ~Keys.D2; } - Debug.WriteLine($"Check time for Held, HeldKey: {_heldKeys}"); if (GetKey(Keys.LControlKey) || GetKey(Keys.RControlKey)) { @@ -258,8 +282,7 @@ void ChangeCameraStyle(object sender, EventArgs e) byte[] data = { camStyles[cbCamStyles.SelectedIndex].Value }; - WriteBytes(BaseAddress + 0x33C6D6, data); - WriteBytes(BaseAddress + 0x33C6D7, data); + WriteCameraData(data); } @@ -332,6 +355,27 @@ void OpenAppearanceSettings(object sender, EventArgs e) } } + void ShowPowercamTooltip(bool inlevel) + { + hint.Hide(this); + BringToFront(); + if (inlevel) + { + hint.ToolTipTitle = Resources.powercamIngameDirtyTitle; + hint.ToolTipIcon = ToolTipIcon.Info; + hint.Show(string.Empty, cbPowercam, 8, 8); + hint.Show(Resources.powercamIngameDirtyMsg, cbPowercam, 8, 8, 10000); + } + else + { + hint.ToolTipTitle = Resources.powercamPregameDirtyTitle; + hint.ToolTipIcon = ToolTipIcon.Warning; + hint.Show(string.Empty, cbPowercam, 8, 8); + hint.Show(Resources.powercamPregameDirtyMsg, cbPowercam, 8, 8, 10000); + } + + } + void OpenAboutForm(object sender, EventArgs e) { AboutForm about = new AboutForm(); @@ -408,6 +452,15 @@ private async void checkForLatestUpdateToolStripMenuItem_Click(object sender, Ev private void cbPowercam_CheckedChanged(object sender, EventArgs e) { + if (CoreEntityAddress > 0 && + WillLevelZoomOut(CurrentLevelID) && + ((CheckBox)sender).Checked) + { + ShowPowercamTooltip(true); + ((CheckBox)sender).Checked = false; + return; + } + PowerCamEnabled = cbPowercam.Checked; } diff --git a/M64MM2/MainForm.resx b/M64MM2/MainForm.resx index bd5487e..30af957 100644 --- a/M64MM2/MainForm.resx +++ b/M64MM2/MainForm.resx @@ -121,6 +121,33 @@ 17, 17 + + 195, 22 + + + &Appearance Settings... + + + 195, 22 + + + &Extra Controls... + + + 195, 22 + + + Show Running Addons + + + 192, 6 + + + 195, 22 + + + Scan for PJ64 + 46, 20 @@ -176,96 +203,6 @@ 4 - - 195, 22 - - - &Appearance Settings... - - - 195, 22 - - - &Extra Controls... - - - 195, 22 - - - Show Running Addons - - - 192, 6 - - - 195, 22 - - - Scan for PJ64 - - - cbPowercam - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCamera - - - 0 - - - btnSoftFreeze - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCamera - - - 1 - - - btnFreeze - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCamera - - - 2 - - - 12, 27 - - - 278, 82 - - - 2 - - - Camera Controls - - - grpCamera - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - 355, 17 - True @@ -281,6 +218,9 @@ Enable Powercam (EXPERIMENTAL) + + 355, 17 + This enables the ability to override camera transition reinstatements by the game. Allows to hard-freeze the camera ANYWHERE without it zooming out. @@ -312,7 +252,7 @@ May break some transitions while enabled. Use with caution. 3 - Soft-Frozen: False + Soft-Frozen: No btnSoftFreeze @@ -336,7 +276,7 @@ May break some transitions while enabled. Use with caution. 0 - Frozen: False + Frozen: No btnFreeze @@ -350,41 +290,41 @@ May break some transitions while enabled. Use with caution. 2 - - 125, 17 - - - True - - - 0, 220 + + 12, 27 - - 528, 22 + + 278, 82 - - 9 + + 2 - - statusStrip + + Camera Controls - - statusStrip + + grpCamera - - System.Windows.Forms.StatusStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 2 + + 3 + + 125, 17 + + + True + False - 260, 17 + 230, 17 Status: Project64 isn't open. @@ -396,7 +336,7 @@ May break some transitions while enabled. Use with caution. False - 190, 17 + 150, 17 Camera State: Default @@ -410,125 +350,35 @@ May break some transitions while enabled. Use with caution. 0x00000000 - - chbAutoApply - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 0 - - - btnAnimResetAll - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 1 - - - btnAnimReset - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 2 - - - btnAnimSwap - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 3 - - - lblAnimNew - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 4 - - - lblAnimOld - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 5 - - - cbAnimNew - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap - - - 6 - - - cbAnimOld - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpAnimSwap + + 31, 17 - - 7 + + 0x00 - - 12, 115 + + 0, 220 - - 500, 102 + + 528, 22 - - 3 + + 9 - - Animation Swap Controls + + statusStrip - - grpAnimSwap + + statusStrip - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.StatusStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 1 + + 2 True @@ -741,53 +591,29 @@ Note: May glitch with some animations. 7 - - btnChangeCamStyle - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCamStyle - - - 0 - - - cbCamStyles - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpCamStyle - - - 1 - - - 296, 27 + + 12, 115 - - 216, 82 + + 500, 102 - - 10 + + 3 - - Change Camera Style + + Animation Swap Controls - - grpCamStyle + + grpAnimSwap - + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 0 + + 1 43, 51 @@ -834,9 +660,30 @@ Note: May glitch with some animations. 1 - - 355, 17 - + + 296, 27 + + + 216, 82 + + + 10 + + + Change Camera Style + + + grpCamStyle + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + True @@ -2824,6 +2671,12 @@ Note: May glitch with some animations. System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + lblCameraStyle + + + System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + MainForm diff --git a/M64MM2/Properties/Resources.Designer.cs b/M64MM2/Properties/Resources.Designer.cs index bf677b9..2e677aa 100644 --- a/M64MM2/Properties/Resources.Designer.cs +++ b/M64MM2/Properties/Resources.Designer.cs @@ -406,7 +406,45 @@ internal static string picturedInBannerPeople { } /// - /// Busca una cadena traducida similar a -alpha5. + /// Busca una cadena traducida similar a You started the game in a level that would cause problems with Powercam, so you can't enable it here. + ///Enter a level that doesn't zoom out when the game is paused and enable Powercam again.. + /// + internal static string powercamIngameDirtyMsg { + get { + return ResourceManager.GetString("powercamIngameDirtyMsg", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a There is a time and a place for everything, but not here!. + /// + internal static string powercamIngameDirtyTitle { + get { + return ResourceManager.GetString("powercamIngameDirtyTitle", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a You started the game in a level that would mess with your camera if Powercam is first enabled in it, so we've disabled it for you. + ///Enter a level that doesn't zoom out when the game is paused and enable Powercam again.. + /// + internal static string powercamPregameDirtyMsg { + get { + return ResourceManager.GetString("powercamPregameDirtyMsg", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a Wait, this is important.. + /// + internal static string powercamPregameDirtyTitle { + get { + return ResourceManager.GetString("powercamPregameDirtyTitle", resourceCulture); + } + } + + /// + /// Busca una cadena traducida similar a -alpha6. /// internal static string prereleaseString { get { diff --git a/M64MM2/Properties/Resources.es.resx b/M64MM2/Properties/Resources.es.resx index ea6bd28..e089823 100644 --- a/M64MM2/Properties/Resources.es.resx +++ b/M64MM2/Properties/Resources.es.resx @@ -245,4 +245,18 @@ No funcionará. Algo pasó. No se pudo conectar a la página de GitHub para las actualizaciones. Revisa tu conexión a Internet. + + Iniciaste el juego en un nivel que causa problemas con Powercam, así que aquí no se puede habilitar. +Entra a un nivel cuya cámara no haga zoom cuando pauses y activa Powercam. + + + Hay un tiempo y lugar para todo, ¡pero aquí no! + + + Iniciaste el juego en un nivel que causa problemas con Powercam si se activa dentro de sí, así que te lo deshabilitamos. +Entra a un nivel cuya cámara no haga zoom cuando pauses y activa Powercam. + + + Atento! + \ No newline at end of file diff --git a/M64MM2/Properties/Resources.resx b/M64MM2/Properties/Resources.resx index 2d54e79..d172104 100644 --- a/M64MM2/Properties/Resources.resx +++ b/M64MM2/Properties/Resources.resx @@ -179,7 +179,7 @@ long - -alpha5 + -alpha6 You have entered an invalid animation name into {0}. Please make sure to choose a valid option from the list. @@ -290,4 +290,18 @@ The color codes and shading only apply to vanilla models and mods that support i ..\Resources\version32.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + You started the game in a level that would cause problems with Powercam, so you can't enable it here. +Enter a level that doesn't zoom out when the game is paused and enable Powercam again. + + + There is a time and a place for everything, but not here! + + + You started the game in a level that would mess with your camera if Powercam is first enabled in it, so we've disabled it for you. +Enter a level that doesn't zoom out when the game is paused and enable Powercam again. + + + Wait, this is important. + \ No newline at end of file diff --git a/M64MM2/SettingsForm.Designer.cs b/M64MM2/SettingsForm.Designer.cs index 0323acb..b470da8 100644 --- a/M64MM2/SettingsForm.Designer.cs +++ b/M64MM2/SettingsForm.Designer.cs @@ -33,6 +33,9 @@ private void InitializeComponent() this.btnCancel = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button(); this.cbCheckUpdates = new System.Windows.Forms.CheckBox(); + this.cbEnablePowercamStartup = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.cbCamStyles = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // // cbEnableHotkeys @@ -61,10 +64,31 @@ private void InitializeComponent() this.cbCheckUpdates.Name = "cbCheckUpdates"; this.cbCheckUpdates.UseVisualStyleBackColor = true; // + // cbEnablePowercamStartup + // + resources.ApplyResources(this.cbEnablePowercamStartup, "cbEnablePowercamStartup"); + this.cbEnablePowercamStartup.Name = "cbEnablePowercamStartup"; + this.cbEnablePowercamStartup.UseVisualStyleBackColor = true; + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; + // + // cbCamStyles + // + this.cbCamStyles.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbCamStyles.FormattingEnabled = true; + resources.ApplyResources(this.cbCamStyles, "cbCamStyles"); + this.cbCamStyles.Name = "cbCamStyles"; + // // SettingsForm // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.cbCamStyles); + this.Controls.Add(this.label1); + this.Controls.Add(this.cbEnablePowercamStartup); this.Controls.Add(this.cbCheckUpdates); this.Controls.Add(this.btnOK); this.Controls.Add(this.btnCancel); @@ -86,5 +110,8 @@ private void InitializeComponent() private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.CheckBox cbCheckUpdates; + private System.Windows.Forms.CheckBox cbEnablePowercamStartup; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox cbCamStyles; } } \ No newline at end of file diff --git a/M64MM2/SettingsForm.cs b/M64MM2/SettingsForm.cs index 672405e..b2618f2 100644 --- a/M64MM2/SettingsForm.cs +++ b/M64MM2/SettingsForm.cs @@ -1,4 +1,5 @@ -using System; +using M64MM.Utils; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -15,7 +16,24 @@ public partial class SettingsForm : Form public SettingsForm() { InitializeComponent(); + if (camStyles.Count > 0) + { + foreach (CameraStyle style in camStyles) + { + cbCamStyles.Items.Add(style); + } + cbCamStyles.DisplayMember = "Name"; + cbCamStyles.Refresh(); + byte preferredVal = coreSettingsGroup.EnsureSettingValue("preferredDefaultCamStyle"); + cbCamStyles.SelectedIndex = camStyles.FindIndex(x => x.Value == preferredVal); + } + else + { + cbCamStyles.Items.Add(new CameraStyle { Name = "- X -", Value = 0x01 }); + cbCamStyles.Enabled = false; + } cbEnableHotkeys.Checked = coreSettingsGroup.EnsureSettingValue("enableHotkeys"); + cbEnablePowercamStartup.Checked = coreSettingsGroup.EnsureSettingValue("enableStartupPowercam"); cbCheckUpdates.Checked = coreSettingsGroup.EnsureSettingValue("enableUpdateCheck"); } @@ -28,6 +46,8 @@ private void btnOK_Click(object sender, EventArgs e) { coreSettingsGroup.SetSettingValue("enableHotkeys", cbEnableHotkeys.Checked); coreSettingsGroup.SetSettingValue("enableUpdateCheck", cbCheckUpdates.Checked); + coreSettingsGroup.SetSettingValue("enableStartupPowercam", cbEnablePowercamStartup.Checked); + coreSettingsGroup.SetSettingValue("preferredDefaultCamStyle", ((CameraStyle)cbCamStyles.SelectedItem).Value); SaveSettings(); Close(); } diff --git a/M64MM2/SettingsForm.es.resx b/M64MM2/SettingsForm.es.resx index b2a4af2..61c8239 100644 --- a/M64MM2/SettingsForm.es.resx +++ b/M64MM2/SettingsForm.es.resx @@ -136,6 +136,26 @@ Buscar actualizaciones al iniciar + + + True + + + + NoControl + + + 183, 17 + + + Habilitar Auto-Powercam al iniciar + + + 216, 13 + + + Estilo de cámara a usar con Auto-Powercam + AAABAAcAAAAAAAEAIABvKgAAdgAAAICAAAABACAAKAgBAOUqAABAQAAAAQAgAChCAAANMwEAMDAAAAEA diff --git a/M64MM2/SettingsForm.resx b/M64MM2/SettingsForm.resx index 5dd4b16..fc804e4 100644 --- a/M64MM2/SettingsForm.resx +++ b/M64MM2/SettingsForm.resx @@ -117,16 +117,191 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - btnOK + + + True + + + + 12, 12 + + + 205, 17 + + + 0 + + + Enable Hotkeys (CTRL+1, CTRL+2...) + + + cbEnableHotkeys + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + 317, 169 + + + 75, 23 + + + 1 + + + Cancel + + + btnCancel + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + 236, 169 + + + 75, 23 + + + 2 OK - + + btnOK + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + True + + + 12, 35 + + + 160, 17 + + + 3 + + + Check for updates at startup + + + cbCheckUpdates + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + 12, 58 + + + 205, 20 + + + 4 + + + Enable Auto-Powercam (on startup) + + + cbEnablePowercamStartup + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + 9, 90 + + + 207, 13 + + + 5 + + + Camera preset to use with Auto-Powercam + + + label1 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 12, 106 + + + 204, 21 + + + 6 + + + cbCamStyles + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + 6, 13 + + 404, 204 + AAABAAcAAAAAAAEAIABvKgAAdgAAAICAAAABACAAKAgBAOUqAABAQAAAAQAgAChCAAANMwEAMDAAAAEA @@ -2015,122 +2190,13 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA - - 317, 112 - - - 1 - - - 160, 17 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - 0 - - - System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - SettingsForm - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 2 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 75, 23 - - - 1 - - - 404, 147 - - - 75, 23 - - - True - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 2 - - - True - - - btnCancel - - - 12, 35 - - - $this - - - cbEnableHotkeys - - - 0 - - - Cancel - - - 3 - - - 12, 12 - - - $this - - - $this - - - 3 - - - Enable Hotkeys (CTRL+1, CTRL+2...) - - - 236, 112 - - - 205, 17 - Settings - - cbCheckUpdates - - - Check for updates at startup + + SettingsForm - - $this + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - es - - - True - \ No newline at end of file