Advertising (This ad goes away for registered users. You can Login or Register)

[Release] [Beta] uOFW Custom Module Installer w/ Source

Most of the homebrews discussed in this forum can be downloaded here
Felix-Dev
Developer
Posts: 13
Joined: Tue Mar 19, 2013 7:53 pm

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by Felix-Dev » Wed May 27, 2015 7:19 pm

I uploaded a commit which contains a bunch of fixes for obtaining input data via external input devices (i.e. a DualShock3 controller). Additionally, the documentation of sceCtrlExtendInternalCtrlBuffers() and the corresponding Read/Peek functions has been modified to reflect the changes. (I am thinking about changing the name sceCtrlExtendInternalCtrlBuffers() to something differently as it doesn't really fit well with the function's assumed purpose.)

I did run a test on obtaining external input data by simulating an external input source (hardcoded input values). This code snippet will also show how to work with the above mentioned functions. Please note that the snippet, as is, does not represent a runnable program, you'll need to build one around of it. ;)

Code: Select all

#include <systemctrl.h>

/**
* This structure is used to copy external input data into PSP internal controller buffers.
*/
typedef struct {
	/** Unknown. Is set to 0xC by Sony. */
	s32 unk1;
	/**
	* Pointer to a transfer function to copy input data into a PSP internal controller buffer.
	* <copyInputData> should return a value >= 0 on success, < 0 otherwise.
	*/
	s32(*copyInputData)(void *src, SceCtrlDataExt *dest);
} SceCtrlInputDataTransferHandler;

typedef struct {
	/**
	* The time stamp of the time during which sampling was performed. Time unit is microseconds.
	* Can be used to get the time period of a button pressing event.
	*/
	u32 timeStamp;
	/** The currently pressed button. Bitwise OR'ed values of ::SceCtrlPadButtons. */
	u32 buttons;
	/** Analog Stick X-axis offset (0 - 0xFF). Left = 0, Right = 0xFF. */
	unsigned char aX;
	/** Analog Stick Y-axis offset (0 - 0xFF). Up = 0, Down = 0xFF. */
	unsigned char aY;
	/** Reserved. Values are normally set to 0. */
	unsigned char rsrv[6];
	/** Unknown. */
	s32 unk1;
	/** Unknown. */
	s32 unk2;
	/** Unknown. */
	s32 unk3;
	/** Unknown. */
	s32 unk4;
	/** Unknown. */
	s32 unk5;
	/** Unknown. */
	s32 unk6;
	/** Unknown. */
	s32 unk7;
	/** Unknown. */
	s32 unk8;
} SceCtrlDataExt;

/* Source buffer containing input data to copy. */
SceCtrlDataExt src = {
          // Any structure members can be set.
	.buttons = 0x12345678,
	.aX = 255,
	.aY = 0,
	.unk1 = 0x10000000,
	.unk2 = 0x10000001,
	.unk3 = 0x10000002
};

s32 copyFunc(SceCtrlDataExt *src, SceCtrlDataExt *dest);

SceCtrlInputDataTransferHandler transferHandler = {
	.unk1 = 0xC,
	.copyInputData = copyFunc
};

s32(*sceCtrlExtendInternalCtrlBuffers)(unsigned char inputMode, SceCtrlInputDataTransferHandler *transferHandler, void *inputSource);
s32(*sceCtrlPeekBufferPositiveExtra)(u32 inputMode, SceCtrlDataExt *data, unsigned char nBufs);

s32 copyFunc(SceCtrlDataExt *src, SceCtrlDataExt *dest)
{
	dest->buttons = src->buttons;
	dest->aX = src->aX;
	dest->aY = src->aY;
	dest->unk1 = src->unk1;
	dest->unk2 = src->unk2;
	dest->unk3 = src->unk3;

	return 0;
}

void testFunc() 
{
// setup function calls (firmware 6.60)
sceCtrlExtendInternalCtrlBuffers = sctrlHENFindFunction("sceController_Service", "sceCtrl_driver", 0xE467BEC8);
sceCtrlExtendInternalCtrlBuffers(1, &transferHandler, &src);

sceCtrlPeekBufferPositiveExtra = sctrlHENFindFunction("sceController_Service", "sceCtrl_driver", 0xD4692E77);
        	
SceCtrlDataExt data;
memset(&data, 0, sizeof data);

// Obtain external input data
sceCtrlPeekBufferPositiveExtra(1, &data, 1);
// data now contains external input data, i.e. data.aX = 255, data.aY = 0, data.unk1 = 0x10000000,....
}
As for how the input buffer containing the DualShock3 input is set up, further research is needed. If you are interested, take a look at the padsvc module (around 0x000002D0 - sceCtrlExtendInternalCtrlBuffers() is called there).

Let me know if this commit fixes the problems with POPS.
Advertising

User avatar
reprep
Posts: 1074
Joined: Tue Dec 17, 2013 4:38 pm

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by reprep » Mon Jul 20, 2015 4:45 pm

ctrl.prx compiled from recent build still hangs the psp go even if it is unmodified. led.prx still works fine though. Hang happens at the stage where the uOFW is supposed to boot into the modified CFW. It never boots, just black screens and psp go shuts off after some time.
Advertising

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by Omega2058 » Tue Jul 21, 2015 12:08 am

The changes he made recently worked for me as I did some tests for him. I just tried the one I had and it still works, but after updating it again, it broke. It looks like things are going to have to be fixed again. Thanks for the confirmation.

User avatar
reprep
Posts: 1074
Joined: Tue Dec 17, 2013 4:38 pm

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by reprep » Tue Jul 21, 2015 6:06 am

@Omega2058: That is a relief, hope it will be fixed again. I am now ready to test stuff if you need, finally got pspsdk on my pc and fixed the broken psp go.

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by Omega2058 » Tue Jul 21, 2015 2:23 pm

Sounds good to me. I'll make sure to ask you for help should anything new come up. :)

Felix-Dev
Developer
Posts: 13
Joined: Tue Mar 19, 2013 7:53 pm

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by Felix-Dev » Mon Jul 27, 2015 6:07 pm

To narrow down the potential error cause, please compile the ctrl module from the following two repository logs:

https://github.com/uofw/uofw/tree/e018f ... 9/src/ctrl
https://github.com/uofw/uofw/tree/cb3ab ... e/src/ctrl

Please let me know if both versions are running.

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by Omega2058 » Mon Jul 27, 2015 10:46 pm

The second link compiles and runs as normal for me.

User avatar
reprep
Posts: 1074
Joined: Tue Dec 17, 2013 4:38 pm

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by reprep » Wed Jul 29, 2015 7:26 am

second link compiles but doesn't run normal, same blackscreen as before.

Can anyone PM me a working ctrl.prx for PSP Go to see if my compiling environment is defective?

First link doesn't compile:

[spoiler]C:\pspsdk\uofw\src\ctrl>make
psp-gcc -c ctrl.c -o ctrl.o -I../../include -O1 -fno-toplevel-reorder -G0 -Wall
-Wextra -Werror -fno-builtin-bcmp -fno-builtin-bcopy -fno-builtin-bzero -fno-bui
ltin-index -fno-builtin-memchr -fno-builtin-memcmp -fno-builtin-memcpy -fno-buil
tin-memmove -fno-builtin-memset -fno-builtin-printf -fno-builtin-putchar -fno-bu
iltin-puts -fno-builtin-rindex -fno-builtin-snprintf -fno-builtin-sprintf -fno-b
uiltin-strcat -fno-builtin-strchr -fno-builtin-strcmp -fno-builtin-strcpy -fno-b
uiltin-strlen -fno-builtin-strncmp -fno-builtin-strncpy -fno-builtin-strpbrk -fn
o-builtin-strrchr -fno-builtin-strstr -fno-builtin-tolower -fno-builtin-toupper
-nostdlib
ctrl.c: In function 'sceCtrlExtendInternalCtrlBuffers':
ctrl.c:863: error: 'SCE_CTRL_EXTERNAL_INPUT_DUALSHOCK_3' undeclared (first use i
n this function)
ctrl.c:863: error: (Each undeclared identifier is reported only once
ctrl.c:863: error: for each function it appears in.)
ctrl.c:863: error: 'SCE_CTRL_EXTERNAL_INPUT_UNKNOWN_2' undeclared (first use in
this function)
make: *** [ctrl.o] Error 1[/spoiler]

EDIT: Solved the compiling problem with adding the updated ctrl.h to include folder. It still blackscreens my psp go though. So i get black screens in both revisions.

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by Omega2058 » Wed Jul 29, 2015 5:09 pm

I sent you the link via PM.

User avatar
reprep
Posts: 1074
Joined: Tue Dec 17, 2013 4:38 pm

Re: [Release] [Beta] uOFW Custom Module Installer w/ Source

Post by reprep » Wed Jul 29, 2015 5:29 pm

Omega2058 wrote:I sent you the link via PM.
thanks. I can confirm this ctrl.prx works perfectly fine on my PSP GO with uOFW. It seems my compiling environment is the culprit.

Post Reply

Return to “Homebrews”