Jump to content
LaunchBox Community Forums

Recommended Posts

Posted

I am struggling exiting emulators in Big Box.  I am using an xbox one controller.  I set exit to button 7 and 8 but it does absolutely nothing.  I also tried setting the close active window to that and it still does nothing in any of my emulators.  If I hit the Xbox main button then the emulator pauses and I can't get out of that to save my life.  I have to use my keyboard to force exit of Big Box.  I can only exit an emulator with my keyboard by pressing exit twice.  But if I hit the xbox button and it pauses then that doesn't even work.  Any help would be greatly appreciated.

Posted
12 minutes ago, fleegerc said:

I am struggling exiting emulators in Big Box.  I am using an xbox one controller.  I set exit to button 7 and 8 but it does absolutely nothing.  I also tried setting the close active window to that and it still does nothing in any of my emulators.  If I hit the Xbox main button then the emulator pauses and I can't get out of that to save my life.  I have to use my keyboard to force exit of Big Box.  I can only exit an emulator with my keyboard by pressing exit twice.  But if I hit the xbox button and it pauses then that doesn't even work.  Any help would be greatly appreciated.

In BB the binding you need to use is the "Close Active" window one. Which you said you tried. 

Best recommendation if pick one emulator you are having issue with and let us know which one. share pics of the following:

In BB share a pic of the bindings you mapped to close the game

In LB >Tools >Manage >Emulators and edit that emulator. Share a pic of the Details tab and the Running AHK tab. 

Posted

Ok so I went and set the Xbox button to do the pause screen to exit the game which I really love.  I couldn't get the other method to work anyways.  But now when I hit the Xbox button the context menu comes up as well in the background.  I think I have the context menu set to nothing in both LB and BB.  I am so lost right now.  I hate that it does that.  I tried to set the context menu to come up when I hit the start and select buttons at the same time but that wouldn't work.  Now they are set to nothing and it still comes up in the background.  Any help?!  I attached a video and pictures of it.  Sorry I took them on my phone the screenshot wasn't working on my computer for some reason.  

IMG_8216.HEIC IMG_8218.HEIC IMG_8219.HEIC

Posted

you have the same button assigned to multiple different actions. "context menu" sounds like you're referring to Retroarch's menu. it is by default opened by the Xbox guide button on one of those controllers and F1 on a keyboard.

 

 

1 hour ago, fleegerc said:

I am so lost right now

with that said, you really should watch a noober youtube video on Retroarch. something that will get you up to speed on stuff as basic as knowing where the controls options are and other settings you should be familiar with like hotkeys to open the menu. what you need to do is to change the hotkey to open Retroarch's menu or reassign a different button (or button combo) in LB/BB to bring up the frontend's pause menu if you don't want what is currently happening to continue.

 

  • 1 year later...
Posted

For anyone looking to exit any emulator using their xbox controller, I've written a AHK script that does two important things. the Back + LB combo presses alt f4 on the keyboard, exiting just about any emulator out there. The Back + RB combo brings BigBox back into focus using a class definition - which it monitors every few seconds. I've found this to be a VERY reliable way to get the focus back when sometimes it looses focus. 

Hope this helps others:

; ======================================================
; Xbox One Controller (XInput) — BigBox Simple Focus
; - Back + LB  → Alt+F4 (with safety hold)
; - Back + RB  → Activate BigBox (auto-detects changing window class)
; AHK v1.1 compatible
; ======================================================

#NoEnv
#SingleInstance, Force
#Persistent
SetBatchLines, -1
Process, Priority,, High
SendMode, Event
SetKeyDelay, 50, 50

; -------- Config --------
userIndex := 0                 ; 0 = first controller (try 1/2/3 if needed)
pollMs := 20                   ; controller poll interval (ms)

closeHoldMs := 350             ; hold time for Back+LB before Alt+F4 fires (safety)
classRefreshMs := 1000         ; how often to update BigBox's class (ms)

bigBoxExe := "BigBox.exe"      ; the process name to look for

; XInput button bitmasks
XINPUT_GAMEPAD_BACK           := 0x0020
XINPUT_GAMEPAD_LEFT_SHOULDER  := 0x0100  ; LB
XINPUT_GAMEPAD_RIGHT_SHOULDER := 0x0200  ; RB

; -------- State --------
comboCloseArmed := true
comboActivateArmed := true
closeHoldStart := 0

bigBoxClass := ""              ; auto-detected class (changes each launch)
lastClassUpdate := 0

; Start timers
SetTimer, PollPad, %pollMs%
SetTimer, UpdateBigBoxClass, %classRefreshMs%
return

; -------- Controller polling --------
PollPad:
    buttons := XInput_GetButtons(userIndex)
    if (buttons = -1)
        return

    lbDown   := (buttons & XINPUT_GAMEPAD_LEFT_SHOULDER)  ? 1 : 0
    rbDown   := (buttons & XINPUT_GAMEPAD_RIGHT_SHOULDER) ? 1 : 0
    backDown := (buttons & XINPUT_GAMEPAD_BACK)           ? 1 : 0

    ; --- Back + LB → Alt+F4 (with safety hold) ---
    if (backDown && lbDown) {
        if (!closeHoldStart)
            closeHoldStart := A_TickCount
        if (comboCloseArmed && (A_TickCount - closeHoldStart >= closeHoldMs)) {
            SendEvent, {Alt down}
            Sleep, 60
            SendEvent, {F4}
            Sleep, 100
            SendEvent, {Alt up}
            comboCloseArmed := false
        }
    } else {
        closeHoldStart := 0
        if (!backDown && !lbDown)
            comboCloseArmed := true
    }

    ; --- Back + RB → Activate BigBox (uses auto-detected class) ---
    if (backDown && rbDown && comboActivateArmed) {
        ActivateBigBox()
        comboActivateArmed := false
    }
    if (!backDown && !rbDown)
        comboActivateArmed := true
return

; -------- BigBox class updater (runs periodically) --------
UpdateBigBoxClass:
    DetectHiddenWindows, Off
    SetTitleMatchMode, 2

    crit := "ahk_exe " . bigBoxExe
    WinGet, cnt, List, %crit%
    if (cnt >= 1) {
        ; Find a visible, non-tool window for BigBox and grab its class
        Loop, %cnt% {
            h := cnt%A_Index%
            WinGet, style, Style, ahk_id %h%
            WinGet, ex, ExStyle, ahk_id %h%
            if !(style & 0x10000000)        ; WS_VISIBLE
                continue
            if (ex & 0x00000080)            ; WS_EX_TOOLWINDOW
                continue
            WinGetClass, cls, ahk_id %h%
            if (cls != "") {
                if (cls != bigBoxClass) {
                    bigBoxClass := cls
                    lastClassUpdate := A_TickCount
                    ; Optional: uncomment for debug
                    ; TrayTip, BigBox, Class updated: %bigBoxClass%, 1000, 1
                }
                break
            }
        }
    } else {
        ; Not running: clear class so we don’t target a stale one
        bigBoxClass := ""
    }
return

; -------- Activate BigBox using the freshest class (or exe as fallback) --------
ActivateBigBox() {
    global bigBoxClass, bigBoxExe
    DetectHiddenWindows, Off
    SetTitleMatchMode, 2

    crit := (bigBoxClass != "") ? ("ahk_class " . bigBoxClass) : ("ahk_exe " . bigBoxExe)
    if !WinExist(crit)
        return

    WinGet, h, ID, %crit%
    WinActivate, ahk_id %h%
    WinWaitActive, ahk_id %h%,, 1
}

; ---- Debug: show current class (Ctrl+Alt+I) ----
^!i::
    msg := "BigBox class: " . (bigBoxClass != "" ? bigBoxClass : "<not detected>") . "`n"
    msg .= "Last update: " . (lastClassUpdate ? (A_TickCount - lastClassUpdate) . " ms ago" : "n/a")
    MsgBox, 64, BigBox Info, %msg%
return

; ---- Quit (Ctrl+Alt+Q) ----
^!q::ExitApp

; ======================================================
; XInput helper (v1.1-safe)
; ======================================================
XInput_GetButtons(userIdx) {
    static dll := ""
    if (dll = "") {
        if (DllCall("LoadLibrary", "Str", "xinput1_4.dll", "Ptr"))
            dll := "xinput1_4.dll"
        else if (DllCall("LoadLibrary", "Str", "xinput1_3.dll", "Ptr"))
            dll := "xinput1_3.dll"
        else if (DllCall("LoadLibrary", "Str", "xinput9_1_0.dll", "Ptr"))
            dll := "xinput9_1_0.dll"
        else if (DllCall("LoadLibrary", "Str", "xinput1_2.dll", "Ptr"))
            dll := "xinput1_2.dll"
        else if (DllCall("LoadLibrary", "Str", "xinput1_1.dll", "Ptr"))
            dll := "xinput1_1.dll"
        else
            return -1
    }
    VarSetCapacity(state, 16, 0)
    r := DllCall(dll . "\XInputGetState", "UInt", userIdx, "Ptr", &state, "UInt")
    if (r != 0)
        return -1
    return NumGet(state, 4, "UShort")  ; wButtons
}

 

Xbox_Controller_Launchbox_v2.ahk

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...