Remove bgfx_avi_name and hlsl_write options

Now the filenames for movies recorded by HLSL and BGFX renderers are automatically generated just like the ones for movies and snapshots recorded by the video core. They are generated according to the "snapname" template (eg. by default <snap_folder>/<device_name>/<numeric_index.avi>, so you can revert to the old behavior (why?) just setting "snapname  bgfx.avi" or "snapname  hlsl.avi".

The main advantage is that now you can record as many movies as you want during a single gaming session without much hassle (previously you had to move or rename the old movie file by hand before recording a new one).
This commit is contained in:
Giuseppe Gorgoglione 2016-07-04 13:50:10 +02:00
parent 2b0682196d
commit 85740d73e6
8 changed files with 21 additions and 41 deletions

View File

@ -147,7 +147,6 @@ const options_entry osd_options::s_option_entries[] =
{ 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_SHADOW_MASK, "slot-mask.png", OPTION_STRING, "shadow mask texture name" },
{ OSDOPTION_BGFX_AVI_NAME, "bgfx.avi", OPTION_STRING, "filename for BGFX output logging" },
// End of list
{ nullptr }

View File

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

View File

@ -27,17 +27,14 @@ avi_write::~avi_write()
}
}
void avi_write::record(std::string name)
void avi_write::record()
{
if (m_recording)
{
end_avi_recording();
}
if (name != "")
{
begin_avi_recording(name);
}
begin_avi_recording();
}
void avi_write::stop()
@ -46,7 +43,7 @@ void avi_write::stop()
end_avi_recording();
}
void avi_write::begin_avi_recording(std::string name)
void avi_write::begin_avi_recording()
{
// stop any existing recording
end_avi_recording();
@ -73,25 +70,20 @@ void avi_write::begin_avi_recording(std::string name)
info.audio_samplebits = 16;
info.audio_samplerate = m_machine.sample_rate();
// compute the frame time
m_frame_period = attotime::from_seconds(1000) / info.video_timescale;
// create a new temporary movie file
osd_file::error filerr;
std::string fullpath;
{
emu_file tempfile(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
filerr = tempfile.open(name.c_str());
// compute the frame time
m_frame_period = attotime::from_seconds(1000) / info.video_timescale;
// if we succeeded, make a copy of the name and create the real file over top
if (filerr == osd_file::error::NONE)
{
fullpath = tempfile.fullpath();
}
}
emu_file tempfile(m_machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
osd_file::error filerr = m_machine.video().open_next(tempfile, "avi");
// if we succeeded, make a copy of the name and create the real file over top
if (filerr == osd_file::error::NONE)
{
std::string fullpath = tempfile.fullpath();
tempfile.close();
// create the file and free the string
avi_file::error avierr = avi_file::create(fullpath, info, m_output_file);
if (avierr != avi_file::error::NONE)

View File

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

View File

@ -88,12 +88,12 @@ public:
m_vid_surface->Release();
}
void record(std::string name)
void record()
{
if (!m_initialized)
return;
m_avi_writer->record(name);
m_avi_writer->record();
}
void save_frame()
@ -230,15 +230,9 @@ void shaders::record_movie()
return;
}
windows_options &options = downcast<windows_options &>(machine->options());
std::string filename(options.d3d_hlsl_write());
if (!filename.empty())
{
recorder = std::make_unique<movie_recorder>(*machine, d3d, snap_width, snap_height);
recorder->record(filename);
recording_movie = true;
}
recorder = std::make_unique<movie_recorder>(*machine, d3d, snap_width, snap_height);
recorder->record();
recording_movie = true;
}

View File

@ -270,7 +270,7 @@ void renderer_bgfx::record()
}
else
{
m_avi_writer->record(m_options.bgfx_avi_name());
m_avi_writer->record();
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);
}

View File

@ -160,7 +160,6 @@ const options_entry windows_options::s_option_entries[] =
{ WINOPTION_HLSLPATH, "hlsl", OPTION_STRING, "path to hlsl files" },
{ WINOPTION_HLSL_ENABLE";hlsl", "0", OPTION_BOOLEAN, "enables HLSL post-processing (PS3.0 required)" },
{ WINOPTION_HLSL_OVERSAMPLING, "0", OPTION_BOOLEAN, "enables HLSL oversampling" },
{ WINOPTION_HLSL_WRITE, "hlsl.avi", OPTION_STRING, "enables HLSL AVI writing (huge disk bandwidth suggested)" },
{ WINOPTION_HLSL_SNAP_WIDTH, "2048", OPTION_STRING, "HLSL upscaled-snapshot width" },
{ WINOPTION_HLSL_SNAP_HEIGHT, "1536", OPTION_STRING, "HLSL upscaled-snapshot height" },
{ WINOPTION_SHADOW_MASK_TILE_MODE, "0", OPTION_INTEGER, "shadow mask tile mode (0 for screen based, 1 for source based)" },

View File

@ -29,7 +29,6 @@
#define WINOPTION_HLSLPATH "hlslpath"
#define WINOPTION_HLSL_ENABLE "hlsl_enable"
#define WINOPTION_HLSL_OVERSAMPLING "hlsl_oversampling"
#define WINOPTION_HLSL_WRITE "hlsl_write"
#define WINOPTION_HLSL_SNAP_WIDTH "hlsl_snap_width"
#define WINOPTION_HLSL_SNAP_HEIGHT "hlsl_snap_height"
#define WINOPTION_SHADOW_MASK_TILE_MODE "shadow_mask_tile_mode"
@ -130,7 +129,6 @@ public:
const char *screen_post_fx_dir() const { return value(WINOPTION_HLSLPATH); }
bool d3d_hlsl_enable() const { return bool_value(WINOPTION_HLSL_ENABLE); }
bool d3d_hlsl_oversampling() const { return bool_value(WINOPTION_HLSL_OVERSAMPLING); }
const char *d3d_hlsl_write() const { return value(WINOPTION_HLSL_WRITE); }
int d3d_snap_width() const { return int_value(WINOPTION_HLSL_SNAP_WIDTH); }
int d3d_snap_height() const { return int_value(WINOPTION_HLSL_SNAP_HEIGHT); }
int screen_shadow_mask_tile_mode() const { return int_value(WINOPTION_SHADOW_MASK_TILE_MODE); }