#Custom Frontend (C++/GLFW): input_state_cb is never called by FBNeo Core

6 messages · Page 1 of 1 (latest)

junior crow
#

I'm building a custom Libretro frontend using C++ and GLFW. While video and audio callbacks are working as expected, I'm unable to get any input response. My input_state_cb is never triggered by the core (FBNeo), even when I force it to return 1 for testing.

What I've tried:

Verified that GLFW key events are being captured correctly.

Ensured RETRO_CALLCONV (__cdecl) is used for all callback signatures.

Registered callbacks both before and after retro_load_game.

Checked that retro_run() is being called in the main loop.

Hardcoded input_state_cb to return 1 (still no activity).

// Registered both before and after retro_load_game just in case
retro_set_input_poll_(input_poll_cb);
retro_set_input_state_(input_state_cb);
#include "InputSystem.h"

static InputSystem* g_input = nullptr;

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (g_input)
        g_input->onKey(key, action);
}

// Implementação do construtor que agora está declarado no .h
InputSystem::InputSystem()


}

void InputSystem::setWindow(GLFWwindow* window)
{
    window_ = window;
    g_input = this;
    glfwSetKeyCallback(window, key_callback);
}


int16_t InputSystem::state(unsigned id)
{
    auto it = binds_.find(id);
    if (it == binds_.end()) return 0;

    return key_state_[it->second] ? 1 : 0;
}
void InputSystem::onKey(int key, int action)
{
    // Registra se a tecla está pressionada (true) ou solta (false)
    key_state_[key] = (action != GLFW_RELEASE);

    // DEBUG: Se você apertar qualquer tecla, isso deve aparecer no console
    if (action == GLFW_PRESS) {
        printf("GLFW detectou tecla: %d\n", key);
    }
}
stray frost
#

are other cores working for you?

junior crow
austere grail
#

also you could use some Libretro cores from Libretro-samples for input testing purpose