I think that the problem with the original code was that you were still returning the view_state bit even when the button was not pressed and the game was not expecting that (input_port reads the corresponding bit as 1 only when you press the button, then it reads 0... it's the internal game code that takes care of checking frequently enough if the bit is 0 or 1)
> You got the point > > unfortunately i don't know how to implement the feature the way you suggested ... > could you post some code to teach me something? It would be very appreciated
1. change the input port to get only a single bit (say 0x10) [i.e. remove the other button inputs]
2. assuming the input is 1 when button is pressed and 0 when is de-pressed (if not, you have to slightly modify the parts where you test the 0x10 bit...), use something along the lines of
Code:
static READ32_HANDLER( port1_r ) { static UINT8 cur_view = 0; UINT16 viewval = readinputport(1); //actual value stored in memory UINT8 button_pressed = viewval & 0x0010;
if (button_pressed) // check if button is pressed { cur_view++; if (cur_view == 4) cur_view = 0; } viewval = (viewval & ~0x10) | (button_pressed << cur_view); // remove the fake button bit and add the correct view bit to the input return (viewval << 16) | viewval; }
notice that in more recent versions cur_value would become an element of the driver class, but given you talk about very old MAME, a static variable should do the job
|