Add large-video option to force hires dumping
This commit is contained in:
parent
5932ff1384
commit
35979abcd3
4 changed files with 70 additions and 3 deletions
|
@ -1013,6 +1013,14 @@ Set the frame advance timeout in milliseconds.
|
|||
Default is 500.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
large-video
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Always dump at 512x448 or 512x478 regardless of what the console outputs.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Section
|
||||
Lua functions
|
||||
\end_layout
|
||||
|
|
39
settings.cpp
39
settings.cpp
|
@ -92,7 +92,7 @@ namespace
|
|||
std::string get_short_help() throw(std::bad_alloc) { return "Show value of all settings"; }
|
||||
std::string get_long_help() throw(std::bad_alloc)
|
||||
{
|
||||
return "Syntax: show-settigns\n"
|
||||
return "Syntax: show-settings\n"
|
||||
"Show value of all settings\n";
|
||||
}
|
||||
} sh_setting;
|
||||
|
@ -205,3 +205,40 @@ numeric_setting::operator int32_t() throw()
|
|||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
boolean_setting::boolean_setting(const std::string& sname, bool dflt) throw(std::bad_alloc)
|
||||
: setting(sname)
|
||||
{
|
||||
value = dflt;
|
||||
}
|
||||
void boolean_setting::blank() throw(std::bad_alloc, std::runtime_error)
|
||||
{
|
||||
throw std::runtime_error("This setting can't be unset");
|
||||
}
|
||||
|
||||
bool boolean_setting::is_set() throw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void boolean_setting::set(const std::string& v) throw(std::bad_alloc, std::runtime_error)
|
||||
{
|
||||
if(v == "true" || v == "yes" || v == "on" || v == "1" || v == "enable" || v == "enabled")
|
||||
value = true;
|
||||
else if(v == "false" || v == "no" || v == "off" || v == "0" || v == "disable" || v == "disabled")
|
||||
value = false;
|
||||
else
|
||||
throw std::runtime_error("Invalid value for boolean setting");
|
||||
}
|
||||
std::string boolean_setting::get() throw(std::bad_alloc)
|
||||
{
|
||||
if(value)
|
||||
return "true";
|
||||
else
|
||||
return "false";
|
||||
}
|
||||
|
||||
boolean_setting::operator bool() throw()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
|
13
settings.hpp
13
settings.hpp
|
@ -120,4 +120,17 @@ private:
|
|||
int32_t maximum;
|
||||
};
|
||||
|
||||
class boolean_setting : public setting
|
||||
{
|
||||
public:
|
||||
boolean_setting(const std::string& sname, bool dflt) throw(std::bad_alloc);
|
||||
void blank() throw(std::bad_alloc, std::runtime_error);
|
||||
bool is_set() throw();
|
||||
void set(const std::string& value) throw(std::bad_alloc, std::runtime_error);
|
||||
std::string get() throw(std::bad_alloc);
|
||||
operator bool() throw();
|
||||
private:
|
||||
bool value;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "videodumper.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "videodumper2.hpp"
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
@ -16,6 +17,7 @@ void update_movie_state();
|
|||
namespace
|
||||
{
|
||||
screen dscr;
|
||||
boolean_setting dump_large("large-video", false);
|
||||
|
||||
class dump_video_command : public command
|
||||
{
|
||||
|
@ -118,11 +120,18 @@ void dump_frame(lcscreen& ls, render_queue* rq, uint32_t left, uint32_t right, u
|
|||
if(vid_dumper)
|
||||
try {
|
||||
vid_dumper->wait_idle();
|
||||
uint32_t hscl = 1;
|
||||
uint32_t vscl = 1;
|
||||
if(dump_large && ls.width < 400)
|
||||
hscl = 2;
|
||||
if(dump_large && ls.height < 400)
|
||||
vscl = 2;
|
||||
uint32_t _magic = 403703808;
|
||||
uint8_t* magic = reinterpret_cast<uint8_t*>(&_magic);
|
||||
dscr.reallocate(left + ls.width + right, top + ls.height + bottom, left, top, true);
|
||||
dscr.reallocate(left + hscl * ls.width + right, top + vscl * ls.height + bottom, left, top,
|
||||
true);
|
||||
dscr.set_palette(magic[2], magic[1], magic[0]);
|
||||
dscr.copy_from(ls, 1, 1);
|
||||
dscr.copy_from(ls, hscl, vscl);
|
||||
if(rq)
|
||||
rq->run(dscr);
|
||||
assert(dscr.memory);
|
||||
|
|
Loading…
Add table
Reference in a new issue