WPAD_Init() has change his behavior?

Post Reply
nebiun
Posts: 42
Joined: Sat Dec 28, 2013 2:42 pm

WPAD_Init() has change his behavior?

Post by nebiun » Mon Dec 31, 2018 4:34 pm

I test some code in Dolphin (both 4 and 5).

I do not know when, but WPAD_Init() has change his behavior.
With last version of libogc, buttons are not detected without calling of WPAD_SetDataFormat().
You can try with "template.c" from examples/wii: it does not work.
To test it I add a line in the main loop. Press A have no effects.

Code: Select all

	
        while(1) {

		// Call WPAD_ScanPads each loop, this reads the latest controller states
		WPAD_ScanPads();

		// WPAD_ButtonsDown tells us which buttons were pressed in this loop
		// this is a "one shot" state which will not fire again until the button has been released
		u32 pressed = WPAD_ButtonsDown(0);
		
		if ( pressed & WPAD_BUTTON_A ) printf("Hello again, World!\n"); // added

		// We return to the launcher application via exit
		if ( pressed & WPAD_BUTTON_HOME ) exit(0);

		// Wait for the next frame
		VIDEO_WaitVSync();
	}
Adding WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR); after WPAD_Init() do it works.

Code: Select all

	// This function initialises the attached controllers
	WPAD_Init();
        WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR);
Tutorials around the WEB and examples does not use WPAD_SetDataFormat() if only check of buttons is required, but if the new behavior is correct I think that some examples (and the template) must be fixed.

WinterMute
Site Admin
Posts: 1338
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: WPAD_Init() has change his behavior?

Post by WinterMute » Fri Jan 04, 2019 11:41 am

I don't usually test with Dolphin much so I can't say if the behaviour has changed. The code works fine as is on hardware though.

It may be a matter of timing somewhere that we can mitigate but it's not really a bug if it doesn't happen on hardware.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests