Restore ability to supply explicit name for bgfx AVI output file, auto causes it to generate ascending snap names

This commit is contained in:
Vas Crabb 2016-07-07 19:08:44 +10:00
parent b77af4ceb6
commit 717e90b357
5 changed files with 13 additions and 9 deletions

View File

@ -147,6 +147,7 @@ const options_entry osd_options::s_option_entries[] =
{ OSDOPTION_BGFX_DEBUG, "0", OPTION_BOOLEAN, "enable BGFX debugging statistics" }, { OSDOPTION_BGFX_DEBUG, "0", OPTION_BOOLEAN, "enable BGFX debugging statistics" },
{ OSDOPTION_BGFX_SCREEN_CHAINS, "default", OPTION_STRING, "comma-delimited list of screen chain JSON names, colon-delimited per-window" }, { OSDOPTION_BGFX_SCREEN_CHAINS, "default", OPTION_STRING, "comma-delimited list of screen chain JSON names, colon-delimited per-window" },
{ OSDOPTION_BGFX_SHADOW_MASK, "slot-mask.png", OPTION_STRING, "shadow mask texture name" }, { OSDOPTION_BGFX_SHADOW_MASK, "slot-mask.png", OPTION_STRING, "shadow mask texture name" },
{ OSDOPTION_BGFX_AVI_NAME, OSDOPTVAL_AUTO, OPTION_STRING, "filename for BGFX output logging" },
// End of list // End of list
{ nullptr } { nullptr }

View File

@ -83,6 +83,7 @@
#define OSDOPTION_BGFX_DEBUG "bgfx_debug" #define OSDOPTION_BGFX_DEBUG "bgfx_debug"
#define OSDOPTION_BGFX_SCREEN_CHAINS "bgfx_screen_chains" #define OSDOPTION_BGFX_SCREEN_CHAINS "bgfx_screen_chains"
#define OSDOPTION_BGFX_SHADOW_MASK "bgfx_shadow_mask" #define OSDOPTION_BGFX_SHADOW_MASK "bgfx_shadow_mask"
#define OSDOPTION_BGFX_AVI_NAME "bgfx_avi_name"
//============================================================ //============================================================
// TYPE DEFINITIONS // TYPE DEFINITIONS
@ -156,6 +157,7 @@ public:
bool bgfx_debug() const { return bool_value(OSDOPTION_BGFX_DEBUG); } bool bgfx_debug() const { return bool_value(OSDOPTION_BGFX_DEBUG); }
const char *bgfx_screen_chains() const { return value(OSDOPTION_BGFX_SCREEN_CHAINS); } const char *bgfx_screen_chains() const { return value(OSDOPTION_BGFX_SCREEN_CHAINS); }
const char *bgfx_shadow_mask() const { return value(OSDOPTION_BGFX_SHADOW_MASK); } const char *bgfx_shadow_mask() const { return value(OSDOPTION_BGFX_SHADOW_MASK); }
const char *bgfx_avi_name() const { return value(OSDOPTION_BGFX_AVI_NAME); }
private: private:
static const options_entry s_option_entries[]; static const options_entry s_option_entries[];

View File

@ -27,14 +27,14 @@ avi_write::~avi_write()
} }
} }
void avi_write::record() void avi_write::record(const char *name)
{ {
if (m_recording) if (m_recording)
{ {
end_avi_recording(); end_avi_recording();
} }
begin_avi_recording(); begin_avi_recording(name);
} }
void avi_write::stop() void avi_write::stop()
@ -43,7 +43,7 @@ void avi_write::stop()
end_avi_recording(); end_avi_recording();
} }
void avi_write::begin_avi_recording() void avi_write::begin_avi_recording(const char *name)
{ {
// stop any existing recording // stop any existing recording
end_avi_recording(); end_avi_recording();
@ -75,13 +75,14 @@ void avi_write::begin_avi_recording()
// create a new temporary movie file // create a new temporary movie file
emu_file tempfile(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); emu_file tempfile(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
const osd_file::error filerr = (!name || !std::strcmp(name, OSDOPTVAL_AUTO))
osd_file::error filerr = m_machine.video().open_next(tempfile, "avi"); ? m_machine.video().open_next(tempfile, "avi")
: tempfile.open(name);
// if we succeeded, make a copy of the name and create the real file over top // if we succeeded, make a copy of the name and create the real file over top
if (filerr == osd_file::error::NONE) if (filerr == osd_file::error::NONE)
{ {
std::string fullpath = tempfile.fullpath(); const std::string fullpath = tempfile.fullpath();
tempfile.close(); tempfile.close();
// create the file and free the string // create the file and free the string

View File

@ -22,7 +22,7 @@ public:
avi_write(running_machine& machine, uint32_t width, uint32_t height); avi_write(running_machine& machine, uint32_t width, uint32_t height);
~avi_write(); ~avi_write();
void record(); void record(const char *name);
void stop(); void stop();
void audio_frame(const INT16 *buffer, int samples_this_frame); void audio_frame(const INT16 *buffer, int samples_this_frame);
void video_frame(bitmap_rgb32& snap); void video_frame(bitmap_rgb32& snap);
@ -31,7 +31,7 @@ public:
bool recording() const { return m_recording; } bool recording() const { return m_recording; }
private: private:
void begin_avi_recording(); void begin_avi_recording(const char *name);
void end_avi_recording(); void end_avi_recording();
running_machine& m_machine; running_machine& m_machine;

View File

@ -270,7 +270,7 @@ void renderer_bgfx::record()
} }
else else
{ {
m_avi_writer->record(); m_avi_writer->record(m_options.bgfx_avi_name());
m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0); m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0);
m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK); m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK);
} }