Mostly implemented auto-hold input display, only controller 1 works completely.

This commit is contained in:
adelikat 2010-05-16 03:18:17 +00:00
parent 0aa8d22ca5
commit a56ad34cea
2 changed files with 87 additions and 26 deletions

View File

@ -295,14 +295,15 @@ void UpdateGamepad()
} }
} }
char inputstr [32]; char inputstr [64];
{ {
uint32 c = JSAutoHeld; uint32 c = JSAutoHeld;
sprintf(inputstr, "%c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c", sprintf(inputstr, "%c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c",
(c&0x40)?'<':' ', (c&0x10)?'^':' ', (c&0x80)?'>':' ', (c&0x20)?'v':' ', (c&0x40)?'<':' ', (c&0x10)?'^':' ', (c&0x80)?'>':' ', (c&0x20)?'v':' ',
(c&0x01)?'A':' ', (c&0x02)?'B':' ', (c&0x08)?'S':' ', (c&0x04)?'s':' ', (c&0x01)?'A':' ', (c&0x02)?'B':' ', (c&0x08)?'S':' ', (c&0x04)?'s':' ',
(c&0x4000)?'<':' ', (c&0x1000)?'^':' ', (c&0x8000)?'>':' ', (c&0x2000)?'v':' ', (c&0x4000)?'<':' ', (c&0x1000)?'^':' ', (c&0x8000)?'>':' ', (c&0x2000)?'v':' ',
(c&0x0100)?'A':' ', (c&0x0200)?'B':' ', (c&0x0800)?'S':' ', (c&0x0400)?'s':' '); (c&0x0100)?'A':' ', (c&0x0200)?'B':' ', (c&0x0800)?'S':' ', (c&0x0400)?'s':' ',
(c&0x40000)?'A':' ');
if(!(c&0xff00)) if(!(c&0xff00))
inputstr[8] = '\0'; inputstr[8] = '\0';
} }

View File

@ -257,11 +257,11 @@ void FCEU_PutImage(void)
int controller, c, ci, color; int controller, c, ci, color;
int i, j; int i, j;
static uint32 on = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0x90:0xA7; //Standard, or Gray depending on movie mode uint32 on = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0x90:0xA7; //Standard, or Gray depending on movie mode
static uint32 oni = 0xA0; //Color for immediate keyboard buttons uint32 oni = 0xA0; //Color for immediate keyboard buttons
static uint32 blend = 0xB6; //Blend of immiate and last held buttons uint32 blend = 0xB6; //Blend of immiate and last held buttons
static uint32 ahold = 0x87; //Auto hold uint32 ahold = 0x87; //Auto hold
static uint32 off = 0xCF; uint32 off = 0xCF;
uint8 *t = XBuf+(FSettings.LastSLine-9)*256 + 20; //mbg merge 7/17/06 changed t to uint8* uint8 *t = XBuf+(FSettings.LastSLine-9)*256 + 20; //mbg merge 7/17/06 changed t to uint8*
if(input_display > 4) input_display = 4; if(input_display > 4) input_display = 4;
@ -280,19 +280,30 @@ void FCEU_PutImage(void)
#ifdef WIN32 #ifdef WIN32
if (!oldInputDisplay) ci = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0:GetGamepadPressedImmediate() >> (controller * 8); if (!oldInputDisplay) ci = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0:GetGamepadPressedImmediate() >> (controller * 8);
else ci = 0; else ci = 0;
if (!oldInputDisplay && !FCEUMOV_Mode(MOVIEMODE_PLAY)) held >>= (controller * 8);
else held = 0;
#else #else
// Put other port info here // Put other port info here
ci = 0; ci = 0;
held = 0;
#endif #endif
c &= 255; c &= 255;
ci &= 255; ci &= 255;
held &= 255; held &= 255;
//adelikat: I apologize to anyone who ever sifts through this color assignment
//A //A
if (held&1) if (held&1) { //If auto-hold
color = ahold; if (!(ci&1) ) color = ahold;
else if (c&1) color = (ci&1) ? blend : on; else
color = (c&1) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&1) color = (ci&1) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&1) ? oni : off; else color = (ci&1) ? oni : off;
}
for(i=0; i < 4; i++) for(i=0; i < 4; i++)
{ {
for(j = 0; j < 4; j++) for(j = 0; j < 4; j++)
@ -303,8 +314,15 @@ void FCEU_PutImage(void)
} }
} }
//B //B
if (c&2) color = (ci&2) ? blend : on; if (held&2) { //If auto-hold
if (!(ci&2) ) color = ahold;
else
color = (c&2) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&2) color = (ci&2) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&2) ? oni : off; else color = (ci&2) ? oni : off;
}
for(i=0; i < 4; i++) for(i=0; i < 4; i++)
{ {
for(j = 0; j < 4; j++) for(j = 0; j < 4; j++)
@ -315,24 +333,45 @@ void FCEU_PutImage(void)
} }
} }
//Select //Select
if (c&4) color = (ci&4) ? blend : on; if (held&4) { //If auto-hold
if (!(ci&4) ) color = ahold;
else
color = (c&4) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&4) color = (ci&4) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&4) ? oni : off; else color = (ci&4) ? oni : off;
}
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
t[11+5*256+i] = color; t[11+5*256+i] = color;
t[11+6*256+i] = color; t[11+6*256+i] = color;
} }
//Start //Start
if (c&8) color = (ci&8) ? blend : on; if (held&8) { //If auto-hold
if (!(ci&8) ) color = ahold;
else
color = (c&8) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&8) color = (ci&8) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&8) ? oni : off; else color = (ci&8) ? oni : off;
}
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
t[17+5*256+i] = color; t[17+5*256+i] = color;
t[17+6*256+i] = color; t[17+6*256+i] = color;
} }
//Up //Up
if (c&16) color = (ci&16) ? blend : on; if (held&16) { //If auto-hold
if (!(ci&16) ) color = ahold;
else
color = (c&16) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&16) color = (ci&16) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&16) ? oni : off; else color = (ci&16) ? oni : off;
}
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
{ {
for(j = 0; j < 3; j++) for(j = 0; j < 3; j++)
@ -341,8 +380,15 @@ void FCEU_PutImage(void)
} }
} }
//Down //Down
if (c&32) color = (ci&32) ? blend : on; if (held&32) { //If auto-hold
if (!(ci&32) ) color = ahold;
else
color = (c&32) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&32) color = (ci&32) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&32) ? oni : off; else color = (ci&32) ? oni : off;
}
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
{ {
for(j = 0; j < 3; j++) for(j = 0; j < 3; j++)
@ -351,8 +397,15 @@ void FCEU_PutImage(void)
} }
} }
//Left //Left
if (c&64) color = (ci&64) ? blend : on; if (held&64) { //If auto-hold
if (!(ci&64) ) color = ahold;
else
color = (c&64) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&64) color = (ci&64) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&64) ? oni : off; else color = (ci&64) ? oni : off;
}
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
{ {
for(j = 0; j < 3; j++) for(j = 0; j < 3; j++)
@ -361,8 +414,15 @@ void FCEU_PutImage(void)
} }
} }
//Right //Right
if (c&128) color = (ci&128) ? blend : on; if (held&128) { //If auto-hold
if (!(ci&128) ) color = ahold;
else
color = (c&128) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
}
else {
if (c&128) color = (ci&128) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
else color = (ci&128) ? oni : off; else color = (ci&128) ? oni : off;
}
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
{ {
for(j = 0; j < 3; j++) for(j = 0; j < 3; j++)