Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 0 additions & 180 deletions .github/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ahk-lint-format-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ jobs:
if ($content -match '(?m)^#Requires\s+AutoHotkey\s+v2') {
$isV2 = $true
}
# Check for v2 directory paths
elseif ($rel -match '(Lib[\\/]v2[\\/]|AHK_v2[\\/])') {
# Check for v2 directory paths (Lib/v2, ahk/, Other/**/v2/)
elseif ($rel -match '(Lib[\\/]v2[\\/]|ahk[\\/]|Other.*[\\/]v2[\\/])') {
$isV2 = $true
}

Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ This repository has undergone a comprehensive migration from AutoHotkey v1.1 to
**Consolidated & Deleted** (24 files):

- ❌ 9 auto-start scripts → 1 data-driven AutoStartManager.ahk with AutoStartConfig.ini
- ❌ 3 fullscreen variants → 1 unified AHK_v2/Fullscreen.ahk
- ❌ 3 fullscreen variants → 1 unified ahk/Fullscreen.ahk
- ❌ 4 duplicate downloader drafts removed
- ❌ 7 deprecated auto-start v1 files (covered by AutoStartManager)
- ❌ 4 deprecated v1 utility files (Close*Window, Kill_Bluestacks, Lossless_Scaling*\*)
Expand Down Expand Up @@ -127,7 +127,7 @@ Lib/
The build system (`ahk-lint-format-compile.yml`) now **automatically detects** script version:

- Checks for `#Requires AutoHotkey v2` directive
- Checks for `Lib/v2/` or `AHK_v2/` in file path
- Checks for `Lib/v2/` or `ahk/` in file path
- Compiles with appropriate AHK version (v1.1.37.02 or v2.0.19)

### v1 to v2 Syntax Quick Reference
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This project follows a simple code of conduct: be respectful, constructive, and

```
Scripts/
├── AHK_v2/ # AutoHotkey v2 scripts
├── ahk/ # AutoHotkey v2 scripts
├── Lib/ # Shared libraries (v1 and v2)
├── Other/ # Specialized utilities
├── .github/ # CI/CD workflows and instructions
Expand Down
2 changes: 1 addition & 1 deletion EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This document provides practical examples and common usage patterns for the scri
**Use Case:** Make any game fullscreen without borders

```autohotkey
; AHK_v2/Fullscreen.ahk
; ahk/Fullscreen.ahk
#Requires AutoHotkey v2.0
#Include A_ScriptDir "\..\Lib\v2\WindowManager.ahk"

Expand Down
39 changes: 39 additions & 0 deletions Other/Citra_per_game_config/v2/CitraConfigBase.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
; ============================================================================
; CitraConfigBase.ahk - Shared initialization for Citra config scripts (v2)
; Version: 2.0.0
; Migrated from v1: 2025-12-26
; Changes: Eliminated tf.ahk dependency, modernized v2 syntax
; ============================================================================

#Requires AutoHotkey v2.0
#SingleInstance Force

; Performance optimizations
#KeyHistory 0
ListLines False
SetKeyDelay -1, -1
SetMouseDelay -1
SetDefaultMouseSpeed 0
SetWinDelay -1
SetControlDelay -1
SendMode "Input"
SetTitleMatchMode 3
SetWorkingDir A_ScriptDir
Comment on lines +13 to +21
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using #KeyHistory directive with value 0 in a v2 script. In AutoHotkey v2, the correct directive is #KeyHistory MaxEvents where MaxEvents should be a number. To disable key history, use #KeyHistory 0 (which is correct), but the directive should appear before any executable code. However, line 3 has ListLines False which should also be a directive (#NoTrayIcon, not a command). These should be directives at the top.

Suggested change
ListLines False
SetKeyDelay -1, -1
SetMouseDelay -1
SetDefaultMouseSpeed 0
SetWinDelay -1
SetControlDelay -1
SendMode "Input"
SetTitleMatchMode 3
SetWorkingDir A_ScriptDir
ListLines(0)
SetKeyDelay(-1, -1)
SetMouseDelay(-1)
SetDefaultMouseSpeed(0)
SetWinDelay(-1)
SetControlDelay(-1)
SendMode("Input")
SetTitleMatchMode(3)
SetWorkingDir(A_ScriptDir)

Copilot uses AI. Check for mistakes.

; Include v2 helper functions
#Include CitraConfigHelpers.ahk

; Global config file path
OneDriveDir := EnvGet("OneDrive")
if (OneDriveDir = "") {
MsgBox("OneDrive environment variable not set!`n`nPlease ensure OneDrive is installed and configured.", "Config Error", 16)
ExitApp 1
}

global CitraConfigFile := OneDriveDir . "\Backup\Game\Emul\Citra\nightly-mingw\user\config\qt-config.ini"

; Verify config file exists
if !FileExist(CitraConfigFile) {
MsgBox("Citra config file not found:`n" CitraConfigFile "`n`nPlease verify your Citra installation.", "Config Error", 16)
ExitApp 1
}
127 changes: 127 additions & 0 deletions Other/Citra_per_game_config/v2/CitraConfigHelpers.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
; ============================================================================
; CitraConfigHelpers.ahk - v2 Helper Functions for Citra Configuration
; Replaces tf.ahk dependency with native v2 functions
; Author: Migrated from v1 - 2025-12-26
; ============================================================================

#Requires AutoHotkey v2.0

; ============================================================================
; RegExEscape(str) - Escape regex special characters
;
; Escapes special regex characters to allow literal string matching
;
; Parameters:
; str - String to escape
;
; Returns:
; Escaped string safe for use in regex patterns
; ============================================================================
RegExEscape(str) {
static specials := "()[]{}?*+|^$.\"
out := ""
for char in StrSplit(str)
out .= InStr(specials, char) ? "\" char : char
return out
}

; ============================================================================
; SetKey(content, key, value) - Set or replace INI key value
;
; Modifies an INI-style configuration string by setting a key=value pair.
; If the key exists, replaces its value. If not, appends the key=value.
;
; Parameters:
; content - Configuration file content as string
; key - Key name (e.g., "resolution_factor")
; value - Value to set
;
; Returns:
; Modified configuration content
; ============================================================================
SetKey(content, key, value) {
pat := "m)^(" . RegExEscape(key) . ")\s*=.*$"
if RegExMatch(content, pat)
return RegExReplace(content, pat, "$1=" value, , 1)
else
return content "`n" key "=" value
}

; ============================================================================
; LoadConfig(configFile) - Load configuration file
;
; Reads configuration file into string for manipulation
;
; Parameters:
; configFile - Path to configuration file
;
; Returns:
; File content as string, or empty string if file doesn't exist
; ============================================================================
LoadConfig(configFile) {
cfg := ""
if FileExist(configFile)
cfg := FileRead(configFile)
return cfg
}

; ============================================================================
; SaveConfig(cfg, configFile) - Save configuration file
;
; Writes configuration string to file with backup
;
; Parameters:
; cfg - Configuration content to write
; configFile - Path to configuration file
;
; Returns:
; true on success, false on failure
; ============================================================================
SaveConfig(cfg, configFile) {
; Create backup before modifying
if FileExist(configFile) {
try {
FileCopy(configFile, configFile . ".bak", 1)
} catch {
; Backup failed, but continue anyway
}
}

; Write new config
try {
if FileExist(configFile)
FileDelete(configFile)
FileAppend(cfg, configFile)
return true
} catch as err {
MsgBox("Error saving config: " . err.Message, "Config Save Error", 16)
return false
}
Comment on lines +91 to +99

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation deletes the file and then appends to it. A more idiomatic and potentially safer approach in AutoHotkey v2 is to use FileOpen() with write mode ("w"), which truncates the file and prepares it for writing in a single, atomic step. This also helps ensure proper encoding is used.

    try {
        FileOpen(configFile, "w", "UTF-8").Write(cfg)
        return true
    } catch as err {
        MsgBox("Error saving config: " . err.Message, "Config Save Error", 16)
        return false
    }

}

; ============================================================================
; ReplaceInFile(filePath, searchText, replaceText) - Replace text in file
;
; Simplified replacement of TF_Replace functionality
; Replaces all occurrences of searchText with replaceText in a file
;
; Parameters:
; filePath - Path to file to modify
; searchText - Text to search for
; replaceText - Text to replace with
;
; Returns:
; true on success, false on failure
; ============================================================================
ReplaceInFile(filePath, searchText, replaceText) {
try {
cfg := LoadConfig(filePath)
if (cfg = "")
return false

cfg := StrReplace(cfg, searchText, replaceText)
return SaveConfig(cfg, filePath)
} catch {
return false
}
}
Loading
Loading