Merge branch 'master' of gite://key-Ilari@localhost/pub/lsnes

This commit is contained in:
Ilari Liusvaara 2011-11-10 21:37:44 +02:00
commit 99059b2061
7 changed files with 25 additions and 2 deletions

View file

@ -70,6 +70,7 @@ void lua_callback_do_paint(struct lua_render_context* ctx) throw();
void lua_callback_do_video(struct lua_render_context* ctx) throw();
void lua_callback_do_input(controls_t& data, bool subframe) throw();
void lua_callback_do_reset() throw();
void lua_callback_do_frame() throw();
void lua_callback_do_readwrite() throw();
void lua_callback_startup() throw();
void lua_callback_pre_load(const std::string& name) throw();

View file

@ -2608,6 +2608,14 @@ Called when video dump frame is being painted.
Any gui.* calls requiring graphic context draw on the video.
\end_layout
\begin_layout Subsubsection
Callback: on_frame()
\end_layout
\begin_layout Standard
Called on each starting whole frame.
\end_layout
\begin_layout Subsubsection
Callback: on_startup()
\end_layout

View file

@ -8,6 +8,7 @@ void lua_callback_do_paint(struct lua_render_context* ctx) throw() {}
void lua_callback_do_video(struct lua_render_context* ctx) throw() {}
void lua_callback_do_input(controls_t& data, bool subframe) throw() {}
void lua_callback_do_reset() throw() {}
void lua_callback_do_frame() throw() {}
void lua_callback_do_readwrite() throw() {}
void lua_callback_startup() throw() {}
void lua_callback_pre_load(const std::string& name) throw() {}
@ -309,6 +310,13 @@ void lua_callback_do_reset() throw()
run_lua_cb(0);
}
void lua_callback_do_frame() throw()
{
if(!callback_exists("on_frame"))
return;
run_lua_cb(0);
}
void lua_callback_do_readwrite() throw()
{
if(!callback_exists("on_readwrite"))

View file

@ -883,6 +883,7 @@ void main_loop(struct loaded_rom& rom, struct moviefile& initial, bool load_has_
if(amode == ADVANCE_AUTO)
window::wait_usec(to_wait_frame(get_utime()));
first_round = false;
lua_callback_do_frame();
}
information_dispatch::do_dump_end();
SNES::interface = old_inteface;

View file

@ -654,7 +654,6 @@ std::map<std::string, std::vector<char>> load_sram_commandline(const std::vector
std::vector<char> save_core_state() throw(std::bad_alloc)
{
SNES::system.runtosave();
std::vector<char> ret;
serializer s = SNES::system.serialize();
ret.resize(s.size());

View file

@ -231,7 +231,7 @@ uint64_t rrdata::read(std::vector<char>& strm, bool dummy) throw(std::bad_alloc)
if(lengthbytes == 3)
repeat = 65794 + static_cast<unsigned>(buf2[0]) * 65536 + static_cast<unsigned>(buf2[1]) *
256 + buf2[2];
//std::cerr << "Decoding " << count << " symbols starting from " << decoding << std::endl;
//std::cerr << "Decoding " << repeat << " symbols starting from " << decoding << std::endl;
if(!dummy)
for(unsigned i = 0; i < repeat; i++)
rrdata::add(decoding++);

View file

@ -48,4 +48,10 @@ namespace
}
return 1;
});
function_ptr_luafun rrc("movie.read_rtc", [](lua_State* LS, const std::string& fname) -> int {
lua_pushnumber(LS, our_movie.rtc_second);
lua_pushnumber(LS, our_movie.rtc_subsecond);
return 2;
});
}