Merge branch 'rr1-maint'

This commit is contained in:
Ilari Liusvaara 2013-10-03 12:39:07 +03:00
commit 3373dcd53c
5 changed files with 31 additions and 0 deletions

View file

@ -677,9 +677,18 @@ public:
* Returns: True if load is possible, false otherwise.
*/
bool check(const std::vector<uint32_t>& mem) throw();
/**
* Set/Clear the frame parameters polled flag.
*/
void set_framepflag(bool value) throw();
/**
* Get the frame parameters polled flag.
*/
bool get_framepflag() const throw();
private:
uint32_t* ctrs;
const port_type_set* types;
bool framepflag;
};
/**

View file

@ -1129,7 +1129,9 @@ void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_
if(!first_round) {
controls.reset_framehold();
movb.get_movie().get_pollcounters().set_framepflag(false);
movb.new_frame_starting(amode == ADVANCE_SKIPLAG);
movb.get_movie().get_pollcounters().set_framepflag(true);
if(!macro_hold_1 && !macro_hold_2) {
controls.advance_macros();
}
@ -1141,6 +1143,7 @@ void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_
if(queued_saves.empty())
r = handle_load();
if(r > 0 || system_corrupt) {
movb.get_movie().get_pollcounters().set_framepflag(our_movie.is_savestate);
first_round = our_movie.is_savestate;
if(system_corrupt)
amode = ADVANCE_PAUSE;

View file

@ -302,6 +302,7 @@ pollcounter_vector::pollcounter_vector(const pollcounter_vector& p) throw(std::b
ctrs = new uint32_t[p.types->indices()];
types = p.types;
memcpy(ctrs, p.ctrs, sizeof(uint32_t) * p.types->indices());
framepflag = p.framepflag;
}
pollcounter_vector& pollcounter_vector::operator=(const pollcounter_vector& p) throw(std::bad_alloc)
@ -313,6 +314,7 @@ pollcounter_vector& pollcounter_vector::operator=(const pollcounter_vector& p) t
memcpy(n, p.ctrs, sizeof(uint32_t) * p.types->indices());
delete[] ctrs;
ctrs = n;
framepflag = p.framepflag;
return *this;
}
@ -324,6 +326,7 @@ pollcounter_vector::~pollcounter_vector() throw()
void pollcounter_vector::clear() throw()
{
memset(ctrs, 0, sizeof(uint32_t) * types->indices());
framepflag = false;
}
void pollcounter_vector::set_all_DRDY() throw()
@ -392,6 +395,16 @@ bool pollcounter_vector::check(const std::vector<uint32_t>& mem) throw()
}
void pollcounter_vector::set_framepflag(bool value) throw()
{
framepflag = value;
}
bool pollcounter_vector::get_framepflag() const throw()
{
return framepflag;
}
controller_frame::controller_frame(const port_type_set& p) throw(std::runtime_error)
{
memset(memory, 0, sizeof(memory));

View file

@ -1,5 +1,6 @@
#include "lua/internal.hpp"
#include "library/string.hpp"
#include "library/minmax.hpp"
#include "core/movie.hpp"
#include "core/moviedata.hpp"
#include "core/window.hpp"
@ -96,6 +97,8 @@ namespace
movie& m = movb.get_movie();
if(port == 0 && controller == 0 && button == 0)
return m.get_pollcounters().max_polls() + (extra0 ? 1 : 0);
if(port == 0 && controller == 0 && m.get_pollcounters().get_framepflag())
return max(m.get_pollcounters().get_polls(port, controller, button), (uint32_t)1);
return m.get_pollcounters().get_polls(port, controller, button);
}

View file

@ -230,6 +230,9 @@ uint32_t frame_controls::read_pollcount(pollcounter_vector& v, unsigned idx)
{
if(idx == 0)
return max(v.max_polls(), (uint32_t)1);
for(auto i : controlinfo)
if(idx == i.index && i.port == 0 && i.controller == 0)
return max(v.get_polls(idx), (uint32_t)(v.get_framepflag() ? 1 : 0));
return v.get_polls(idx);
}