Giter Club home page Giter Club logo

Comments (9)

isXander avatar isXander commented on September 21, 2024

Even when calling SDL_GetGamepadInstanceID after the controller is opened would for example output 1, but when consuming the remove event I get 0x8BCBD361 from which

from sdl.

slouken avatar slouken commented on September 21, 2024

For SDL 2.0 this was intentional design. For SDL 3.0 we've rethought that, and it's an instanceID everywhere.

from sdl.

isXander avatar isXander commented on September 21, 2024

For SDL 2.0 this was intentional design. For SDL 3.0 we've rethought that, and it's an instanceID everywhere.

Well this doesn't appear to be the case.

SDL_EVENT_JOYSTICK_ADDED gives me 0x01, whilst removed gives me 0x8BCBD361

from sdl.

isXander avatar isXander commented on September 21, 2024

For SDL 2.0 this was intentional design. For SDL 3.0 we've rethought that, and it's an instanceID everywhere.

Could you let me know what I'm doing wrong here? Instance id appears to still be index on added

from sdl.

isXander avatar isXander commented on September 21, 2024

From debugging my application, this is what it currently looks like:

SDL_JoystickID[] joysticks = SDL_GetJoysticks();
for (SDL_JoystickID jid : joysticks) {
	LOGGER.info("Controller discovered: {}", jid.intValue()); // Controller discovered: 1
}
SDL_Event event = new SDL_Event();
while (SDL_PollEvent(event)) {
	switch (event.type) {
		case SDL_EVENT_JOYSTICK_REMOVED -> {
			SDL_JoystickID jid = event.jdevice.which;
			LOGGER.info("Controller removed: {}", jid.intValue()); // Controller removed: -1818745232
		}
	}
}

This very clearly shows the problem here

from sdl.

slouken avatar slouken commented on September 21, 2024

The ID I'm seeing is 3, which is correct. What operating system and controller are you using?

from sdl.

isXander avatar isXander commented on September 21, 2024

Windows 11 with a Dualsense Controller. No additional software

from sdl.

slouken avatar slouken commented on September 21, 2024

Yeah, the ID is still 3 here when using a DualSense controller, both over USB and Bluetooth. I'm not sure what's happening here, other than maybe the memory layout doesn't match between C and whatever language you're using?

from sdl.

isXander avatar isXander commented on September 21, 2024

It was indeed a misaligned struct, sorry for bothering you with this.

from sdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.