aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcbransden2016-05-13 17:50:34 +0100
committercbransden2016-05-13 18:30:03 +0100
commit3b1a5e21b399fcb38c5d8ead3c16603f566d7ffa (patch)
tree93dfb321a3aae5421fdb3aef533987e271211d06
parentbebaef4be9a87d92b11bc29a002a531a9d1fa5d7 (diff)
downloadpcsx_rearmed-3b1a5e21b399fcb38c5d8ead3c16603f566d7ffa.tar.gz
pcsx_rearmed-3b1a5e21b399fcb38c5d8ead3c16603f566d7ffa.tar.bz2
pcsx_rearmed-3b1a5e21b399fcb38c5d8ead3c16603f566d7ffa.zip
Style nits
-rw-r--r--frontend/libretro.c14
-rw-r--r--frontend/plugin.c26
-rw-r--r--include/psemu_plugin_defs.h4
-rw-r--r--libpcsxcore/plugins.c117
-rw-r--r--maemo/hildon.c26
-rw-r--r--plugins/dfinput/main.c2
6 files changed, 90 insertions, 99 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 6e859c7..bdce90e 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -1312,8 +1312,7 @@ static void update_variables(bool in_flight)
void retro_run(void)
{
-
- int i;
+ int i;
input_poll_cb();
@@ -1321,17 +1320,14 @@ void retro_run(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
update_variables(true);
- // reset all keystate, query from libretro for keystate
+ // reset all keystate, query libretro for keystate
int j;
- for(i=0;i<8;i++){
+ for(i = 0; i < 8; i++) {
in_keystate[i] = 0;
- // query from libretro for keystate
- for (j = 0; j < RETRO_PSX_MAP_LEN; j++){
+ // query libretro for keystate
+ for (j = 0; j < RETRO_PSX_MAP_LEN; j++)
if (input_state_cb(i, RETRO_DEVICE_JOYPAD, 0, j))
in_keystate[i] |= retro_psx_map[j];
- }
-
- //printf("%i : %i\n",i , input_state_cb(i, RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X));
if (in_type[i] == PSE_PAD_TYPE_ANALOGPAD)
{
diff --git a/frontend/plugin.c b/frontend/plugin.c
index 53ecac9..5663e6d 100644
--- a/frontend/plugin.c
+++ b/frontend/plugin.c
@@ -52,12 +52,13 @@ extern int CALLBACK SPUplayCDDAchannel(short *, int);
static long PADreadPort1(PadDataS *pad, int pad_index) {
pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
- if(multitap1==1){
- pad->portMultitap=1;
- }else{
- pad->portMultitap=0;
- }
- if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON) {
+ if (multitap1 == 1)
+ pad->portMultitap = 1;
+ else
+ pad->portMultitap = 0;
+
+ if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON)
+ {
pad->leftJoyX = in_analog_left[pad_index][0];
pad->leftJoyY = in_analog_left[pad_index][1];
pad->rightJoyX = in_analog_right[pad_index][0];
@@ -74,12 +75,13 @@ static long PADreadPort2(PadDataS *pad, int pad_index) {
pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
- if(multitap2==1){
- pad->portMultitap=2;
- }else{
- pad->portMultitap=0;
- }
- if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON) {
+ if (multitap2 ==1 )
+ pad->portMultitap = 2;
+ else
+ pad->portMultitap = 0;
+
+ if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON)
+ {
pad->leftJoyX = in_analog_left[pad_index][0];
pad->leftJoyY = in_analog_left[pad_index][1];
pad->rightJoyX = in_analog_right[pad_index][0];
diff --git a/include/psemu_plugin_defs.h b/include/psemu_plugin_defs.h
index 7232d03..034f21b 100644
--- a/include/psemu_plugin_defs.h
+++ b/include/psemu_plugin_defs.h
@@ -191,10 +191,10 @@ typedef struct
typedef struct
{
- // controler type - fill it withe predefined values above
+ // controller type - fill it withe predefined values above
unsigned char controllerType;
- //0 : No multitap between psx and pad
+ //0 : no multitap between psx and pad
//1 : multitap between psx and pad on port 1
//2 : multitap between psx and pad on port 2
int portMultitap;
diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c
index 1369b1c..8d3a00e 100644
--- a/libpcsxcore/plugins.c
+++ b/libpcsxcore/plugins.c
@@ -384,62 +384,62 @@ static int bufcount, bufc;
//PadDataS padd1, padd2;
unsigned char _PADstartPollMultitap(PadDataS padd[4]) {
- int i=0;
- int decallage=2;
+ int i = 0;
+ int offset = 2;
bufc = 0;
PadDataS pad;
- for(i=0;i<4;i++){
- decallage = 2 + (i*8);
+ for(i = 0; i < 4; i++) {
+ offset = 2 + (i * 8);
pad = padd[i];
switch (pad.controllerType) {
case PSE_PAD_TYPE_MOUSE:
- multitappar[decallage+1] = 0x12;
- multitappar[decallage+2] = 0x5a;
- multitappar[decallage+3] = pad.buttonStatus & 0xff;
- multitappar[decallage+4] = pad.buttonStatus >> 8;
- multitappar[decallage+5] = pad.moveX;
- multitappar[decallage+6] = pad.moveY;
+ multitappar[offset + 1] = 0x12;
+ multitappar[offset + 2] = 0x5a;
+ multitappar[offset + 3] = pad.buttonStatus & 0xff;
+ multitappar[offset + 4] = pad.buttonStatus >> 8;
+ multitappar[offset + 5] = pad.moveX;
+ multitappar[offset + 6] = pad.moveY;
break;
case PSE_PAD_TYPE_NEGCON: // npc101/npc104(slph00001/slph00069)
- multitappar[decallage+1] = 0x23;
- multitappar[decallage+2] = 0x5a;
- multitappar[decallage+3] = pad.buttonStatus & 0xff;
- multitappar[decallage+4] = pad.buttonStatus >> 8;
- multitappar[decallage+5] = pad.rightJoyX;
- multitappar[decallage+6] = pad.rightJoyY;
- multitappar[decallage+7] = pad.leftJoyX;
- multitappar[decallage+8] = pad.leftJoyY;
+ multitappar[offset + 1] = 0x23;
+ multitappar[offset + 2] = 0x5a;
+ multitappar[offset + 3] = pad.buttonStatus & 0xff;
+ multitappar[offset + 4] = pad.buttonStatus >> 8;
+ multitappar[offset + 5] = pad.rightJoyX;
+ multitappar[offset + 6] = pad.rightJoyY;
+ multitappar[offset + 7] = pad.leftJoyX;
+ multitappar[offset + 8] = pad.leftJoyY;
break;
case PSE_PAD_TYPE_ANALOGPAD: // scph1150
- multitappar[decallage+1] = 0x73;
- multitappar[decallage+2] = 0x5a;
- multitappar[decallage+3] = pad.buttonStatus & 0xff;
- multitappar[decallage+4] = pad.buttonStatus >> 8;
- multitappar[decallage+5] = pad.rightJoyX;
- multitappar[decallage+6] = pad.rightJoyY;
- multitappar[decallage+7] = pad.leftJoyX;
- multitappar[decallage+8] = pad.leftJoyY;
+ multitappar[offset + 1] = 0x73;
+ multitappar[offset + 2] = 0x5a;
+ multitappar[offset + 3] = pad.buttonStatus & 0xff;
+ multitappar[offset + 4] = pad.buttonStatus >> 8;
+ multitappar[offset + 5] = pad.rightJoyX;
+ multitappar[offset + 6] = pad.rightJoyY;
+ multitappar[offset + 7] = pad.leftJoyX;
+ multitappar[offset + 8] = pad.leftJoyY;
break;
case PSE_PAD_TYPE_ANALOGJOY: // scph1110
- multitappar[decallage+1] = 0x53;
- multitappar[decallage+2] = 0x5a;
- multitappar[decallage+3] = pad.buttonStatus & 0xff;
- multitappar[decallage+4] = pad.buttonStatus >> 8;
- multitappar[decallage+5] = pad.rightJoyX;
- multitappar[decallage+6] = pad.rightJoyY;
- multitappar[decallage+7] = pad.leftJoyX;
- multitappar[decallage+8] = pad.leftJoyY;
+ multitappar[offset + 1] = 0x53;
+ multitappar[offset + 2] = 0x5a;
+ multitappar[offset + 3] = pad.buttonStatus & 0xff;
+ multitappar[offset + 4] = pad.buttonStatus >> 8;
+ multitappar[offset + 5] = pad.rightJoyX;
+ multitappar[offset + 6] = pad.rightJoyY;
+ multitappar[offset + 7] = pad.leftJoyX;
+ multitappar[offset + 8] = pad.leftJoyY;
break;
case PSE_PAD_TYPE_STANDARD:
default:
- multitappar[decallage+1] = 0x41;
- multitappar[decallage+2] = 0x5a;
- multitappar[decallage+3] = pad.buttonStatus & 0xff;
- multitappar[decallage+4] = pad.buttonStatus >> 8;
+ multitappar[offset + 1] = 0x41;
+ multitappar[offset + 2] = 0x5a;
+ multitappar[offset + 3] = pad.buttonStatus & 0xff;
+ multitappar[offset + 4] = pad.buttonStatus >> 8;
}
}
@@ -515,49 +515,44 @@ unsigned char _PADpoll(unsigned char value) {
return buf[bufc++];
}
-// rafraichissement de l'état des boutons sur port 1,
-// int pad dans le code d'origine ne sert a rien...
+// refresh the button state on port 1.
+// int pad is not needed.
unsigned char CALLBACK PAD1__startPoll(int pad) {
- //first call the pad provide if a multitap is connected between the psx and himself
- if(multitap1 == -1){
+ // first call the pad provide if a multitap is connected between the psx and himself
+ if(multitap1 == -1)
+ {
PadDataS padd;
- PAD1_readPort1(&padd,0);
+ PAD1_readPort1(&padd, 0);
multitap1 = padd.portMultitap;
}
// just one pad is on port 1 : NO MULTITAP
- if (multitap1 == 0){
+ if (multitap1 == 0)
+ {
PadDataS padd;
- PAD1_readPort1(&padd,0);
+ PAD1_readPort1(&padd, 0);
return _PADstartPoll(&padd);
- }else{
- //a multitap is plugged : refresh all pad.
+ } else {
+ // a multitap is plugged : refresh all pad.
int i=0;
PadDataS padd[4];
- for(i=0;i<4;i++){
- PAD1_readPort1(&padd[i],i);
+ for(i = 0; i < 4; i++) {
+ PAD1_readPort1(&padd[i], i);
}
return _PADstartPollMultitap(padd);
}
}
unsigned char CALLBACK PAD1__poll(unsigned char value) {
-// if(value !=0){
-// int i;
-// printf("%2x %c\n", value, value);
-// for (i = 0; i < 35; i++) {
-// printf("%2x", buf[i]);
-// }
-// printf("\n");
-// }
- if(multitap1==0){
+ if (multitap1 == 0)
+ {
return _PADpoll(value);
- }else{
- if(value==42){
+ } else {
+ if(value == 42) {
unsigned char bufmultitap[256];
memcpy(bufmultitap, multitappar, 3);
bufcount = 2;
return bufmultitap[bufc++];
- }else{
+ } else {
return _PADpoll(value);
}
}
diff --git a/maemo/hildon.c b/maemo/hildon.c
index 6fbdcf5..7e9cd9f 100644
--- a/maemo/hildon.c
+++ b/maemo/hildon.c
@@ -484,31 +484,31 @@ inline void key_press_event(int key2,int type)
switch (psxkey1){
case DKEY_CROSS:
in_state_gun |= SACTION_GUN_A;
- break;
+ break;
case DKEY_CIRCLE:
in_state_gun |= SACTION_GUN_B;
- break;
+ break;
case DKEY_TRIANGLE:
in_state_gun |= SACTION_GUN_TRIGGER2;
- break;
+ break;
case DKEY_SQUARE:
in_state_gun |= SACTION_GUN_TRIGGER;
- break;
+ break;
}
}else if (type == 2) {
switch (psxkey1){
case DKEY_CROSS:
in_state_gun &= ~SACTION_GUN_A;
- break;
+ break;
case DKEY_CIRCLE:
in_state_gun &= ~SACTION_GUN_B;
- break;
+ break;
case DKEY_TRIANGLE:
in_state_gun &= ~SACTION_GUN_TRIGGER2;
- break;
+ break;
case DKEY_SQUARE:
in_state_gun &= ~SACTION_GUN_TRIGGER;
- break;
+ break;
}
}
}else{
@@ -533,7 +533,7 @@ inline void key_press_event(int key2,int type)
in_a1[1] = 255;
break;
}
- }
+ }
}
else if (type == 2) {
if (psxkey1 >= 0)
@@ -554,7 +554,7 @@ inline void key_press_event(int key2,int type)
}
}
emu_set_action(SACTION_NONE);
- }
+ }
}
}
@@ -599,7 +599,7 @@ int maemo_init(int *argc, char ***argv)
}
fclose(pFile);
}
-
+
switch (in_type1){
case PSE_PAD_TYPE_GUNCON:
memset(cornerActions, 0, sizeof(cornerActions));
@@ -610,7 +610,7 @@ int maemo_init(int *argc, char ***argv)
break;
case PSE_PAD_TYPE_ANALOGPAD:
printf("Controller set to analog (SCPH-1150)\n");
- break;
+ break;
}
if (in_enable_vibration)
@@ -664,7 +664,7 @@ int maemo_init(int *argc, char ***argv)
if (bKeepDisplayOn){
if (pthread_create(&display_thread, NULL, displayThread, NULL))
- printf("Failed to create display thread.\n");
+ printf("Failed to create display thread.\n");
}
pl_rearmed_cbs.only_16bpp = 1;
diff --git a/plugins/dfinput/main.c b/plugins/dfinput/main.c
index 15ea07c..c3adedd 100644
--- a/plugins/dfinput/main.c
+++ b/plugins/dfinput/main.c
@@ -58,8 +58,6 @@ void dfinput_activate(void)
{
PadDataS pad;
-
-
PAD1_readPort1(&pad);
select_pad(1);