When showing input in readwrite mode, show last sent input

Most rerecording emulators work this way, not by showing input pressed
right now.
This commit is contained in:
Ilari Liusvaara 2012-01-13 06:51:47 +02:00
parent 5480b3f4aa
commit d903f6c83b
3 changed files with 42 additions and 2 deletions

View file

@ -1049,8 +1049,28 @@ public:
* Get status of current controls (with autohold/autofire factored in).
*
* Parameter framenum: Number of current frame (for evaluating autofire).
* Returns: The current controls.
*/
controller_frame get(uint64_t framenum) throw();
/**
* Commit given controls (autohold/autofire is factored in).
*
* Parameter framenum: Number of current frame (for evaluating autofire).
* Returns: The committed controls.
*/
controller_frame commit(uint64_t framenum) throw();
/**
* Commit given controls (autohold/autofire is ignored).
*
* Parameter controls: The controls to commit
* Returns: The committed controls.
*/
controller_frame commit(controller_frame controls) throw();
/**
* Get status of committed controls.
* Returns: The committed controls.
*/
controller_frame get_committed() throw();
/**
* Get blank frame.
*/
@ -1123,6 +1143,7 @@ private:
bool analog_mouse[MAX_ANALOG];
controller_frame _input;
controller_frame _autohold;
controller_frame _committed;
std::vector<controller_frame> _autofire;
};

View file

@ -610,6 +610,7 @@ void controller_state::set_port(unsigned port, porttype_t ptype, bool set_core)
if(oldtype != ptype) {
_input.set_port_type(port, ptype);
_autohold.set_port_type(port, ptype);
_committed.set_port_type(port, ptype);
//The old autofire pattern no longer applies.
_autofire.clear();
}
@ -662,3 +663,21 @@ std::string controller_state::lcid_to_typestring(unsigned lcid) throw(std::bad_a
default: return "unknown";
};
}
controller_frame controller_state::commit(uint64_t framenum) throw()
{
controller_frame f = get(framenum);
_committed = f;
return _committed;
}
controller_frame controller_state::get_committed() throw()
{
return _committed;
}
controller_frame controller_state::commit(controller_frame controls) throw()
{
_committed = controls;
return _committed;
}

View file

@ -175,7 +175,7 @@ controller_frame movie_logic::update_controls(bool subframe) throw(std::bad_allo
controls.reset(pending_reset_cycles);
else if(!subframe)
controls.reset(-1);
controller_frame tmp = controls.get(movb.get_movie().get_current_frame());
controller_frame tmp = controls.commit(movb.get_movie().get_current_frame());
lua_callback_do_input(tmp, subframe);
return tmp;
}
@ -283,7 +283,7 @@ void update_movie_state()
if(movb.get_movie().readonly_mode())
c = movb.get_movie().get_controls();
else
c = controls.get(movb.get_movie().get_current_frame());
c = controls.get_committed();
for(unsigned i = 0; i < 8; i++) {
unsigned pindex = controls.lcid_to_pcid(i);
devicetype_t dtype = controls.pcid_to_type(pindex);