Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;----------------------------------------------------------------------------
- ; Key Mapping Software
- ; JoyToKey v5.1 and Xpadder 2012.01.19
- ; by brolly
- ; 1.0
- ;
- ; Notes:
- ; This will not work with JoyToKey v3 since it won't allow you to load profiles from directories other than the default one
- ; Make sure you activate the following preferences on JoyToKey:
- ; Start JoyToKey in a minimized mode
- ; Hide icon from taskbar when minimized
- ;
- ; The following entries should be added to the main Settings.ini file under the Hyperlaunch section:
- ; keymapper_enabled=true or false, defines if you want to use a keymapper by default (defaults to false)
- ; keymapper=joytokey or xpadder (defaults to empty)
- ; keymapper_path=path to the folder & file containing your mapping software exe, example C:\Hyperspin\Xpadder\Xpadder.exe
- ; keymapper_profiles_path=path where the profiles are stored (defaults to A_ScriptDir\Controller Profiles\)
- ; lastkeymapperprofile=this key is updated with the path for the last profile file used (Not used anymore)
- ;
- ; The following entries should be added to the main Settings.ini file under the Hyperlaunch section:
- ; keymapper_enabled=true or false, defines if you want to use a keymapper on this system (defaults to the setting defined on the main Settings.ini file)
- ;
- ; Profiles are loaded by the following order:
- ; 1. Game specific profile
- ; 2. System specific profile
- ; 3. Default profile
- ;
- ; The default profile (if exists) should be on keymapper_profiles_path and should be called Default.cfg or Default.xpadderprofile
- ; The system default profile (if exists) should be on keymapper_profiles_path\SystemName and should be called SystemName.cfg or SystemName.xpadderprofile
- ; Game Specific profiles (if exists) should be on keymapper_profiles_path\SystemName and should be called romName.cfg or romName.xpadderprofile
- ;----------------------------------------------------------------------------
- ; DO NOT INCLUDE THESE IN HYPERLAUNCH:
- settingsFile=%A_ScriptDir%\Settings\Settings.ini
- iniFile := CheckFile(A_ScriptDir . "\Settings\" . systemName . ".ini")
- ; Read keymapper settings from Settings.ini
- ; PUT WITH INIREADS AND RETSTR VAR IN HYPERLAUNCH
- ; IniRead, keymapperEnabled, %settingsFile%, HyperLaunch, keymapper_enabled, false ; NOT NEEDED, KEEP THIS PER SYSTEM ONLY FOR NOW, LESS CONFUSION AND NO ACCIDENTAL ENABLES
- IniRead, keymapperEnabled, %iniFile%, exe info, keymapper_enabled, false
- IniRead, keymapper, %settingsFile%, HyperLaunch, keymapper, %A_Space%
- IniRead, keymapperFullPath, %settingsFile%, HyperLaunch, keymapper_path, %A_Space%
- IniRead, keymapperProfilePath, %settingsFile%, HyperLaunch, keymapper_profiles_path, %A_ScriptDir%\Keymapper Profiles\ ; MIGHT HARDCODE THIS, WILL DISCUSS WITH BBB
- ;IniRead, lastkeymapperprofile, %settingsFile%, HyperLaunch, lastkeymapperprofile, %A_Space%
- ; CHANGING HOW ITS CALLED FOR HYPERLAUNCH IMPLEMENTATION
- If (keymapperEnabled = "true"){
- ;Add Global RunKeyMapper function to module if used
- ; retStr .= "`n`nLoadKeyMapper(){`n}"
- ; retStr .= "`n`nUnloadKeyMapper(){`n}"
- RunKeyMapper()
- }Else{
- ;Still have to add a blank function so no error occurs.
- retStr .= "`n`nLoadKeyMapper(){`n}"
- retStr .= "`n`nUnloadKeyMapper(){`n}"
- }
- ExitApp
- RunKeyMapper() {
- Global
- SplitPath, keymapperFullPath, keymapperExe, keymapperPath, keymapperExt ; splitting pathname into variables
- CheckFile(keymapperFullPath) ; WANT TO CHECK THIS FIRST, NO NEED TO CONTINUE IF USER HAS IT CONFIGURED WRONG
- ; If (keymapperEnabled = "true") {
- ; Build profile
- If (keymapper="xpadder") {
- defaultProfile = %keymapperProfilePath%%systemName%\default.xpadderprofile
- profile = %keymapperProfilePath%%systemName%\%romName%.xpadderprofile
- } Else If (keymapper="joytokey") {
- defaultProfile = %keymapperProfilePath%%systemName%\default.cfg
- profile = %keymapperProfilePath%%systemName%\%romName%.cfg
- }
- If (FileExist(profile))
- profileToUse=%profile%
- Else If (FileExist(defaultProfile))
- profileToUse=%defaultProfile%
- Else
- ScriptError("Keymapper support is enabled`, but could not find a default profile or one for this rom in " . keymapperProfilePath)
- ;If (lastkeymapperprofile != "%profilePath%%profileToUse%")
- ; Launch keymapper
- If (keymapper="joytokey") {
- Process, Close, %keymapperExe%
- Process, WaitClose, %keymapperExe% ; Make sure it's actually closed before continuing
- Run, %keymapperExe% "%profileToUse%", %keymapperPath% ;Run joytokey
- } Else If (keymapper="xpadder")
- Run, %keymapperExe% "%profileToUse%" /M, %keymapperPath% ;Run xpadder
- ;IniWrite, %profilePath%%profileToUse%, %settingsFile%, HyperLaunch, lastkeymapperprofile
- }
- UnloadKeymapper() {
- ;Unload keymapper software
- If (keymapper="joytokey")
- Process, Close, %keymapperExe%
- Else If (keymapper="xpadder")
- Run, "%keymapperExe%" /C, %keymapperPath%
- ;IniWrite, %A_Space%, %settingsFile%, HyperLaunch, lastkeymapperprofile
- }
- CloseProcess:
- Return
Add Comment
Please, Sign In to add comment