From 189650c74a61c220297d2de87132d5a540b01dac Mon Sep 17 00:00:00 2001 From: Ven0m0 <82972344+Ven0m0@users.noreply.github.com> Date: Wed, 4 Feb 2026 13:14:55 +0000 Subject: [PATCH 1/7] Optimize AutoStartManager.ahk IniRead operations Replaced multiple sequential IniRead calls with a single section read to reduce disk I/O. Implemented manual parsing of the section into a Map, ensuring case-insensitivity to match INI standards. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- Other/AutoStartManager.ahk | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Other/AutoStartManager.ahk b/Other/AutoStartManager.ahk index e2145ec..58d198b 100644 --- a/Other/AutoStartManager.ahk +++ b/Other/AutoStartManager.ahk @@ -35,12 +35,28 @@ if (!FileExist(configFile)) { ; Read configuration try { - exeName := IniRead(configFile, emulatorName, "exe") - key := IniRead(configFile, emulatorName, "key", "F11") - maximize := IniRead(configFile, emulatorName, "maximize", "true") = "true" - delay := Integer(IniRead(configFile, emulatorName, "delay", "0")) - activate := IniRead(configFile, emulatorName, "activate", "false") = "true" - special := IniRead(configFile, emulatorName, "special", "none") + ; Optimization: Read the entire section once to reduce disk I/O + sectionContent := IniRead(configFile, emulatorName) + config := Map() + config.CaseSense := "Off" ; Ensure case-insensitive lookups (INI standard) + Loop Parse, sectionContent, "`n", "`r" { + if (p := InStr(A_LoopField, "=")) { + k := Trim(SubStr(A_LoopField, 1, p-1)) + v := Trim(SubStr(A_LoopField, p+1)) + config[k] := v + } + } + + if !config.Has("exe") + throw Error("Key 'exe' not found in section '" . emulatorName . "'") + + exeName := config["exe"] + key := config.Has("key") ? config["key"] : "F11" + maximize := (config.Has("maximize") ? config["maximize"] : "true") = "true" + delay := Integer(config.Has("delay") ? config["delay"] : "0") + activate := (config.Has("activate") ? config["activate"] : "false") = "true" + special := config.Has("special") ? config["special"] : "none" + } catch Error as err { MsgBox("Error reading config for " . emulatorName . ":`n" . err.Message) ExitApp() From f22a2814fb2cad70b133131a49e625714aa7612d Mon Sep 17 00:00:00 2001 From: Ven0m0 <82972344+Ven0m0@users.noreply.github.com> Date: Wed, 4 Feb 2026 13:21:24 +0000 Subject: [PATCH 2/7] Fix CI: Remove pinned AutoHotkey versions in workflow The 'autohotkey.portable' version 1.1.37.02 was not found in Chocolatey, causing CI failure. Removed version pins for both v1 and v2 to use latest available versions. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- .github/workflows/ahk-lint-format-compile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ahk-lint-format-compile.yml b/.github/workflows/ahk-lint-format-compile.yml index 95e17c5..b9b354c 100644 --- a/.github/workflows/ahk-lint-format-compile.yml +++ b/.github/workflows/ahk-lint-format-compile.yml @@ -19,11 +19,11 @@ jobs: - uses: actions/checkout@v6 - name: Install AutoHotkey v1.1 (Portable) - run: choco install autohotkey.portable --version=1.1.37.02 -y + run: choco install autohotkey.portable -y shell: pwsh - name: Install AutoHotkey v2 - run: choco install autohotkey --version=2.0.19 -y + run: choco install autohotkey -y shell: pwsh - name: Verify Installations From f87fca4223f7d745ae17b9a6d7526f8188284f57 Mon Sep 17 00:00:00 2001 From: Ven0m0 <82972344+Ven0m0@users.noreply.github.com> Date: Wed, 4 Feb 2026 13:56:01 +0000 Subject: [PATCH 3/7] Fix CI: Add compiler path fallback for AHK v2 The Chocolatey 'autohotkey' package (v2) does not place Ahk2Exe in the expected path, causing syntax checks to fail. Added logic to use the Ahk2Exe from the 'autohotkey.portable' (v1) package as a fallback, as it is compatible with v2 scripts. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- .github/workflows/ahk-lint-format-compile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ahk-lint-format-compile.yml b/.github/workflows/ahk-lint-format-compile.yml index b9b354c..79b6a5b 100644 --- a/.github/workflows/ahk-lint-format-compile.yml +++ b/.github/workflows/ahk-lint-format-compile.yml @@ -42,6 +42,12 @@ jobs: run: | $compilerV1 = "C:\ProgramData\chocolatey\lib\autohotkey.portable\tools\Compiler\Ahk2Exe.exe" $compilerV2 = "$env:ProgramFiles\AutoHotkey\Compiler\Ahk2Exe.exe" + + # Fallback: If v2 compiler is missing, use the one from v1 package (Ahk2Exe is universal) + if (!(Test-Path $compilerV2)) { + Write-Host "⚠️ Compiler not found at $compilerV2. Using fallback from v1 package." -ForegroundColor Yellow + $compilerV2 = $compilerV1 + } $tempDir = New-Item -Type Directory -Force "$env:TEMP\ahk-$(Get-Random)" $syntaxErrors = @() $formatIssues = @() From 71814d6fe44d64848ae6f1925ab8a1663cadf742 Mon Sep 17 00:00:00 2001 From: Ven0m0 <82972344+Ven0m0@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:09:23 +0000 Subject: [PATCH 4/7] Fix CI: Explicitly install Ahk2Exe and fix workflow structure The previous attempt to fallback to v1 compiler failed because standard v2 packages do not include it. This commit adds a step to download Ahk2Exe directly from GitHub and updates the syntax check to use it. Also fixed a workflow syntax error where 'Verify Installations' step name was missing. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- .github/workflows/ahk-lint-format-compile.yml | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ahk-lint-format-compile.yml b/.github/workflows/ahk-lint-format-compile.yml index 79b6a5b..548abeb 100644 --- a/.github/workflows/ahk-lint-format-compile.yml +++ b/.github/workflows/ahk-lint-format-compile.yml @@ -21,10 +21,19 @@ jobs: - name: Install AutoHotkey v1.1 (Portable) run: choco install autohotkey.portable -y shell: pwsh - - name: Install AutoHotkey v2 run: choco install autohotkey -y shell: pwsh + - name: Install Ahk2Exe + run: | + $url = "https://github.com/AutoHotkey/Ahk2Exe/releases/latest/download/Ahk2Exe1.zip" + $dest = "C:\Ahk2Exe" + New-Item -ItemType Directory -Force -Path $dest | Out-Null + Invoke-WebRequest -Uri $url -OutFile "$dest\Ahk2Exe.zip" + Expand-Archive "$dest\Ahk2Exe.zip" -DestinationPath $dest -Force + Remove-Item "$dest\Ahk2Exe.zip" + Write-Host "Ahk2Exe installed to $dest" + shell: pwsh - name: Verify Installations run: | @@ -37,17 +46,10 @@ jobs: Write-Host "Installed AHK v1: $((Get-Item $ahkV1).VersionInfo.FileVersion)" Write-Host "Installed AHK v2: $(& $ahkV2 --version)" shell: pwsh - - name: Syntax Check & Format Validation run: | - $compilerV1 = "C:\ProgramData\chocolatey\lib\autohotkey.portable\tools\Compiler\Ahk2Exe.exe" - $compilerV2 = "$env:ProgramFiles\AutoHotkey\Compiler\Ahk2Exe.exe" + $compilerExe = "C:\Ahk2Exe\Ahk2Exe.exe" - # Fallback: If v2 compiler is missing, use the one from v1 package (Ahk2Exe is universal) - if (!(Test-Path $compilerV2)) { - Write-Host "⚠️ Compiler not found at $compilerV2. Using fallback from v1 package." -ForegroundColor Yellow - $compilerV2 = $compilerV1 - } $tempDir = New-Item -Type Directory -Force "$env:TEMP\ahk-$(Get-Random)" $syntaxErrors = @() $formatIssues = @() @@ -72,7 +74,8 @@ jobs: $isV2 = $true } - $compiler = if ($isV2) { $compilerV2; $v2Count++ } else { $compilerV1; $v1Count++ } + if ($isV2) { $v2Count++ } else { $v1Count++ } + $compiler = $compilerExe $version = if ($isV2) { "v2" } else { "v1" } # Syntax check From 61ea11015b7b3bd2a2098dc228b0c00aaa87508f Mon Sep 17 00:00:00 2001 From: Ven0m0 Date: Fri, 6 Feb 2026 08:30:23 +0100 Subject: [PATCH 5/7] Update Other/AutoStartManager.ahk Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Other/AutoStartManager.ahk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Other/AutoStartManager.ahk b/Other/AutoStartManager.ahk index 58d198b..8ef81de 100644 --- a/Other/AutoStartManager.ahk +++ b/Other/AutoStartManager.ahk @@ -53,7 +53,16 @@ try { exeName := config["exe"] key := config.Has("key") ? config["key"] : "F11" maximize := (config.Has("maximize") ? config["maximize"] : "true") = "true" - delay := Integer(config.Has("delay") ? config["delay"] : "0") + if config.Has("delay") { + delayRaw := config["delay"] + if RegExMatch(delayRaw, "^[+-]?\d+$") { + delay := Integer(delayRaw) + } else { + throw Error("Invalid delay value '" . delayRaw . "' in section '" . emulatorName . "': must be an integer number of milliseconds") + } + } else { + delay := 0 + } activate := (config.Has("activate") ? config["activate"] : "false") = "true" special := config.Has("special") ? config["special"] : "none" From e3c996d8bba1b63709cf82acb782211b646e21b0 Mon Sep 17 00:00:00 2001 From: Ven0m0 Date: Fri, 6 Feb 2026 08:31:13 +0100 Subject: [PATCH 6/7] Update Other/AutoStartManager.ahk Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Other/AutoStartManager.ahk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Other/AutoStartManager.ahk b/Other/AutoStartManager.ahk index 8ef81de..4d72ebb 100644 --- a/Other/AutoStartManager.ahk +++ b/Other/AutoStartManager.ahk @@ -47,8 +47,12 @@ try { } } - if !config.Has("exe") - throw Error("Key 'exe' not found in section '" . emulatorName . "'") + if !config.Has("exe") { + if (config.Count = 0) + throw Error("Section '" . emulatorName . "' is empty or missing required key 'exe'") + else + throw Error("Key 'exe' not found in section '" . emulatorName . "'") + } exeName := config["exe"] key := config.Has("key") ? config["key"] : "F11" From b063822f9750032282880d2b873c6b919a20d92f Mon Sep 17 00:00:00 2001 From: Ven0m0 Date: Fri, 6 Feb 2026 08:32:19 +0100 Subject: [PATCH 7/7] Update Other/AutoStartManager.ahk Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Other/AutoStartManager.ahk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Other/AutoStartManager.ahk b/Other/AutoStartManager.ahk index 4d72ebb..56e77a8 100644 --- a/Other/AutoStartManager.ahk +++ b/Other/AutoStartManager.ahk @@ -37,6 +37,9 @@ if (!FileExist(configFile)) { try { ; Optimization: Read the entire section once to reduce disk I/O sectionContent := IniRead(configFile, emulatorName) + if (sectionContent = "") { + throw Error("Section '" . emulatorName . "' not found in config file or is empty") + } config := Map() config.CaseSense := "Off" ; Ensure case-insensitive lookups (INI standard) Loop Parse, sectionContent, "`n", "`r" {