AmyGrrl wrote:
Thank you so much! This works amazing now. No more glitching. I really hope DS3Remapper does gets fixed/updated. Its the most useful program for the PSPGo.
glad it works. also thanks for recommendation for choosing alternate controls. it makes aiming so smooth. i disabled easy aiming. with DS3, it now plays great as a dual stick shooter. much better than some dual stick vita shooters (i am looking at you Unit 13).
I mainly did this to be sure of the trigger bug in DS3Remapper 0.3. When you assign R2 or L2 to R1 or L1 or to a combination including them, sometimes there are extra button presses which register as R1 or L1 where it should be R2 or L2. it probably originates from combining PSP inputs to DS3 inputs.
So use DS3Remapper 0.3 for your games, if you have some unwanted shoulder button presses, just tell me the combination you want and i can make one for spesific to that configuration. or you can do yours, here is the main.c, get the other files from the first post.
[spoiler]/*
DS3Remapper
Copyright (C) 2014, Total_Noob
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <
http://www.gnu.org/licenses/>.
*/
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>
PSP_MODULE_INFO("DS3Remapper", 0x1007, 1, 0);
#define MAKE_JUMP(a, f) _sw(0x08000000 | (((u32)(f) & 0x0FFFFFFC) >> 2), a);
#define HIJACK_FUNCTION(a, f, ptr) \
{ \
u32 func = a; \
static u32 patch_buffer[3]; \
_sw(_lw(func), (u32)patch_buffer); \
_sw(_lw(func + 4), (u32)patch_buffer + 8);\
MAKE_JUMP((u32)patch_buffer + 4, func + 8); \
_sw(0x08000000 | (((u32)(f) >> 2) & 0x03FFFFFF), func); \
_sw(0, func + 4); \
ptr = (void *)patch_buffer; \
}
int (* sceCtrlReadBuf)(SceCtrlData *pad, int nBufs, int a2, int mode);
int sceCtrlReadBufPatched(SceCtrlData *pad, int nBufs, int a2, int mode)
{
/* If it is not an extended SceCtrlData structure */
if(!(mode & 4))
{
/* A static buffer */
static char buffer[64 * 48];
/* Set k1 to zero to allow all buttons */
int k1 = pspSdkSetK1(0);
/* Call function with new arguments */
int res = sceCtrlReadBuf((SceCtrlData *)buffer, nBufs, 1, mode | 4);
/* Copy buffer to pad */
int i;
for(i = 0; i < nBufs; i++)
{
memcpy(&pad
, buffer + (i * 48), sizeof(SceCtrlData));
if(pad.Buttons & 0x000002)
{
pad.Buttons |= 0x000040;
pad.Buttons &= ~0x000002;
}
if(pad.Buttons & 0x000004)
{
pad.Buttons |= 0x000010;
pad.Buttons &= ~0x000004;
}
if(pad.Buttons & 0x000400)
{
pad.Buttons |= 0x000020;
pad.Buttons &= ~0x000400;
}
if(pad[i].Buttons & 0x000800)
{
pad[i].Buttons |= 0x000080;
pad[i].Buttons &= ~0x000800;
}
if(pad[i].Lx >= 148)
{
pad[i].Buttons |= 0x002000;
}
if(pad[i].Lx < 108)
{
pad[i].Buttons |= 0x008000;
}
pad[i].Lx = 127;
if(pad[i].Ly >= 148)
{
pad[i].Buttons |= 0x004000;
}
if(pad[i].Ly < 108)
{
pad[i].Buttons |= 0x001000;
}
pad[i].Ly = 127;
pad[i].Lx = pad[i].Rsrv[0];
pad[i].Ly = pad[i].Rsrv[1];
}
/* Restore k1 */
pspSdkSetK1(k1);
/* Return result */
return res;
}
/* Call function with original arguments */
return sceCtrlReadBuf(pad, nBufs, a2, mode);
}
int module_start(SceSize args, void *argp)
{
/* Find ctrl.prx */
SceModule2 *mod = sceKernelFindModuleByName("sceController_Service");
/* Find function and hook it */
int i;
for(i = 0; i < mod->text_size; i += 4)
{
u32 addr = mod->text_addr + i;
if(_lw(addr) == 0x35030104)
{
HIJACK_FUNCTION(addr - 0x1C, sceCtrlReadBufPatched, sceCtrlReadBuf);
break;
}
}
/* Clear caches */
sceKernelDcacheWritebackAll();
sceKernelIcacheClearAll();
return 0;
}[/spoiler]
if you need hex values for button mappings, they are here: viewtopic.php?p=359545#p359545 look at the spoiler tag.
all credits to Total_Noob and suloku.