mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
Added new options:
-[no]exit_after_playback (default=no) -[no]record_input (default=no) Added new UI shortcut to save current timecode (default F12) Translated variable names and comments to english language
This commit is contained in:
parent
34bc216ef9
commit
f736cd5abc
@ -60,6 +60,9 @@ const options_entry emu_options::s_option_entries[] =
|
||||
{ OPTION_AUTOSAVE, "0", OPTION_BOOLEAN, "enable automatic restore at startup, and automatic save at exit time" },
|
||||
{ OPTION_PLAYBACK ";pb", nullptr, OPTION_STRING, "playback an input file" },
|
||||
{ OPTION_RECORD ";rec", nullptr, OPTION_STRING, "record an input file" },
|
||||
{ OPTION_RECORD_TIMECODE, "0", OPTION_BOOLEAN, "record an input timecode file (requires -record option)" },
|
||||
{ OPTION_EXIT_AFTER_PLAYBACK, "0", OPTION_BOOLEAN, "close the program at the end of playback" },
|
||||
|
||||
{ OPTION_MNGWRITE, nullptr, OPTION_STRING, "optional filename to write a MNG movie of the current session" },
|
||||
{ OPTION_AVIWRITE, nullptr, OPTION_STRING, "optional filename to write an AVI movie of the current session" },
|
||||
#ifdef MAME_DEBUG
|
||||
|
@ -71,6 +71,8 @@ enum
|
||||
#define OPTION_AUTOSAVE "autosave"
|
||||
#define OPTION_PLAYBACK "playback"
|
||||
#define OPTION_RECORD "record"
|
||||
#define OPTION_RECORD_TIMECODE "record_timecode"
|
||||
#define OPTION_EXIT_AFTER_PLAYBACK "exit_after_playback"
|
||||
#define OPTION_MNGWRITE "mngwrite"
|
||||
#define OPTION_AVIWRITE "aviwrite"
|
||||
#ifdef MAME_DEBUG
|
||||
@ -244,6 +246,8 @@ public:
|
||||
bool autosave() const { return bool_value(OPTION_AUTOSAVE); }
|
||||
const char *playback() const { return value(OPTION_PLAYBACK); }
|
||||
const char *record() const { return value(OPTION_RECORD); }
|
||||
bool record_timecode() const { return bool_value(OPTION_RECORD_TIMECODE); }
|
||||
bool exit_after_playback() const { return bool_value(OPTION_EXIT_AFTER_PLAYBACK); }
|
||||
const char *mng_write() const { return value(OPTION_MNGWRITE); }
|
||||
const char *avi_write() const { return value(OPTION_AVIWRITE); }
|
||||
#ifdef MAME_DEBUG
|
||||
|
@ -727,6 +727,7 @@ void construct_core_types_UI(simple_list<input_type_entry> &typelist)
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAST_FORWARD, "Fast Forward", input_seq(KEYCODE_INSERT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SHOW_FPS, "Show FPS", input_seq(KEYCODE_F11, input_seq::not_code, KEYCODE_LSHIFT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SNAPSHOT, "Save Snapshot", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TIMECODE, "Write current timecode", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RECORD_MOVIE, "Record Movie", input_seq(KEYCODE_F12, KEYCODE_LSHIFT) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_CHEAT, "Toggle Cheat", input_seq(KEYCODE_F6) )
|
||||
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) )
|
||||
|
@ -3434,11 +3434,11 @@ void ioport_manager::playback_end(const char *message)
|
||||
osd_printf_info("Total playback frames: %d\n", UINT32(m_playback_accumulated_frames));
|
||||
osd_printf_info("Average recorded speed: %d%%\n", UINT32((m_playback_accumulated_speed * 200 + 1) >> 21));
|
||||
|
||||
// Close the Mame at the end of inp file playback
|
||||
//if (strcmp(message, "End of file")) {
|
||||
// close the program at the end of inp file playback
|
||||
if (machine().options().exit_after_playback()) {
|
||||
osd_printf_info("Exiting MAME now...\n");
|
||||
machine().schedule_exit();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3589,24 +3589,27 @@ void ioport_manager::record_init()
|
||||
|
||||
|
||||
void ioport_manager::timecode_init() {
|
||||
// check if option -record_timecode is enabled
|
||||
if (!machine().options().record_timecode()) {
|
||||
machine().video().set_timecode_enabled(false);
|
||||
return;
|
||||
}
|
||||
// if no file, nothing to do
|
||||
const char *record_filename = machine().options().record();
|
||||
if (record_filename[0] == 0) {
|
||||
machine().video().set_timecode_enabled(false);
|
||||
return;
|
||||
}
|
||||
//osd_printf_error("DEBUG FILENAME-1: %s\n", record_filename);
|
||||
|
||||
machine().video().set_timecode_enabled(true);
|
||||
|
||||
// open the record file
|
||||
std::string filename;
|
||||
filename.append(record_filename).append(".timecode");
|
||||
//sprintf(filename, "%s.timecode", record_filename);
|
||||
|
||||
//osd_printf_error("DEBUG FILENAME-2: %s\n", filename.c_str());
|
||||
osd_printf_info("Record input timecode file: %s\n", record_filename);
|
||||
|
||||
file_error filerr = m_timecode_file.open(filename.c_str());
|
||||
assert_always(filerr == FILERR_NONE, "Failed to open file for timecode recording");
|
||||
assert_always(filerr == FILERR_NONE, "Failed to open file for input timecode recording");
|
||||
|
||||
m_timecode_file.puts(std::string("# ==========================================\n").c_str());
|
||||
m_timecode_file.puts(std::string("# TIMECODE FILE FOR VIDEO PREVIEW GENERATION\n").c_str());
|
||||
@ -3666,8 +3669,8 @@ void ioport_manager::record_frame(const attotime &curtime)
|
||||
if (m_record_file.is_open())
|
||||
{
|
||||
// first the absolute time
|
||||
record_write(curtime.m_seconds);
|
||||
record_write(curtime.m_attoseconds);
|
||||
record_write(curtime.seconds());
|
||||
record_write(curtime.attoseconds());
|
||||
|
||||
// then the current speed
|
||||
record_write(UINT32(machine().video().speed_percent() * double(1 << 20)));
|
||||
@ -3678,28 +3681,28 @@ void ioport_manager::record_frame(const attotime &curtime)
|
||||
std::string current_time_str;
|
||||
m_timecode_count++;
|
||||
strcatprintf(current_time_str, "%02d:%02d:%02d.%03d",
|
||||
(int)curtime.m_seconds / (60 * 60),
|
||||
(curtime.m_seconds / 60) % 60,
|
||||
curtime.m_seconds % 60,
|
||||
(int)(curtime.m_attoseconds/ATTOSECONDS_PER_MILLISECOND));
|
||||
(int)curtime.seconds() / (60 * 60),
|
||||
(curtime.seconds() / 60) % 60,
|
||||
curtime.seconds() % 60,
|
||||
(int)(curtime.attoseconds()/ATTOSECONDS_PER_MILLISECOND));
|
||||
|
||||
// Elapsed from previous timecode
|
||||
attotime elapsed_time = curtime - m_timecode_last_time;
|
||||
m_timecode_last_time = curtime;
|
||||
std::string elapsed_time_str;
|
||||
strcatprintf(elapsed_time_str, "%02d:%02d:%02d.%03d",
|
||||
elapsed_time.m_seconds / (60 * 60),
|
||||
(elapsed_time.m_seconds / 60) % 60,
|
||||
elapsed_time.m_seconds % 60,
|
||||
int(elapsed_time.m_attoseconds/ATTOSECONDS_PER_MILLISECOND));
|
||||
elapsed_time.seconds() / (60 * 60),
|
||||
(elapsed_time.seconds() / 60) % 60,
|
||||
elapsed_time.seconds() % 60,
|
||||
int(elapsed_time.attoseconds()/ATTOSECONDS_PER_MILLISECOND));
|
||||
|
||||
// Number of ms from beginning of playback
|
||||
int mseconds_start = curtime.m_seconds*1000 + curtime.m_attoseconds/ATTOSECONDS_PER_MILLISECOND;
|
||||
int mseconds_start = curtime.seconds()*1000 + curtime.attoseconds()/ATTOSECONDS_PER_MILLISECOND;
|
||||
std::string mseconds_start_str;
|
||||
strcatprintf(mseconds_start_str, "%015d", mseconds_start);
|
||||
|
||||
// Number of ms from previous timecode
|
||||
int mseconds_elapsed = elapsed_time.m_seconds*1000 + elapsed_time.m_attoseconds/ATTOSECONDS_PER_MILLISECOND;
|
||||
int mseconds_elapsed = elapsed_time.seconds()*1000 + elapsed_time.attoseconds()/ATTOSECONDS_PER_MILLISECOND;
|
||||
std::string mseconds_elapsed_str;
|
||||
strcatprintf(mseconds_elapsed_str, "%015d", mseconds_elapsed);
|
||||
|
||||
@ -3713,30 +3716,30 @@ void ioport_manager::record_frame(const attotime &curtime)
|
||||
std::string frame_elapsed_str;
|
||||
strcatprintf(frame_elapsed_str, "%015d", frame_elapsed);
|
||||
|
||||
std::string messaggio;
|
||||
std::string message;
|
||||
std::string timecode_text;
|
||||
std::string timecode_key;
|
||||
bool show_timecode_counter = false;
|
||||
if (m_timecode_count==1) {
|
||||
messaggio += "INTRO STARTED AT " + current_time_str;
|
||||
message += "TIMECODE: Intro started at " + current_time_str;
|
||||
timecode_key = "INTRO_START";
|
||||
timecode_text = "INTRO";
|
||||
show_timecode_counter = true;
|
||||
}
|
||||
else if (m_timecode_count==2) {
|
||||
messaggio += "INTRO DURATION " + elapsed_time_str;
|
||||
message += "TIMECODE: Intro duration " + elapsed_time_str;
|
||||
timecode_key = "INTRO_STOP";
|
||||
machine().video().add_to_total_time(elapsed_time);
|
||||
//timecode_text += "INTRO";
|
||||
}
|
||||
else if (m_timecode_count==3) {
|
||||
messaggio += "GAMEPLAY STARTED AT " + current_time_str;
|
||||
message += "TIMECODE: Gameplay started at " + current_time_str;
|
||||
timecode_key = "GAMEPLAY_START";
|
||||
timecode_text += "GAMEPLAY";
|
||||
show_timecode_counter = true;
|
||||
}
|
||||
else if (m_timecode_count==4) {
|
||||
messaggio += "GAMEPLAY DURATION " + elapsed_time_str;
|
||||
message += "TIMECODE: Gameplay duration " + elapsed_time_str;
|
||||
timecode_key = "GAMEPLAY_STOP";
|
||||
machine().video().add_to_total_time(elapsed_time);
|
||||
//timecode_text += "GAMEPLAY";
|
||||
@ -3747,7 +3750,7 @@ void ioport_manager::record_frame(const attotime &curtime)
|
||||
timecode_key = "EXTRA_START_" + timecode_count_str;
|
||||
timecode_count_str.clear();
|
||||
strcatprintf(timecode_count_str, "%d", (m_timecode_count-3)/2);
|
||||
messaggio += "EXTRA " + timecode_count_str + " STARTED AT " + current_time_str;
|
||||
message += "TIMECODE: Extra " + timecode_count_str + " started at " + current_time_str;
|
||||
timecode_text += "EXTRA " + timecode_count_str;
|
||||
show_timecode_counter = true;
|
||||
}
|
||||
@ -3756,29 +3759,26 @@ void ioport_manager::record_frame(const attotime &curtime)
|
||||
|
||||
std::string timecode_count_str;
|
||||
strcatprintf(timecode_count_str, "%d", (m_timecode_count-4)/2);
|
||||
messaggio += "EXTRA " + timecode_count_str + " DURATION " + elapsed_time_str;
|
||||
message += "TIMECODE: Extra " + timecode_count_str + " duration " + elapsed_time_str;
|
||||
|
||||
//std::string timecode_count_str;
|
||||
timecode_count_str.clear();
|
||||
strcatprintf(timecode_count_str, "%03d", (m_timecode_count-4)/2);
|
||||
timecode_key = "EXTRA_STOP_" + timecode_count_str;
|
||||
}
|
||||
|
||||
osd_printf_info("%s \n", messaggio.c_str());
|
||||
machine().popmessage("%s \n", messaggio.c_str());
|
||||
osd_printf_info("%s \n", message.c_str());
|
||||
machine().popmessage("%s \n", message.c_str());
|
||||
|
||||
std::string riga_file;
|
||||
riga_file.append(timecode_key).append(19-timecode_key.length(), ' ');
|
||||
//riga_file += "INTRO_START " +
|
||||
riga_file +=
|
||||
std::string line_to_add;
|
||||
line_to_add.append(timecode_key).append(19-timecode_key.length(), ' ');
|
||||
line_to_add +=
|
||||
" " + current_time_str + " " + elapsed_time_str +
|
||||
" " + mseconds_start_str + " " + mseconds_elapsed_str +
|
||||
" " + frame_start_str + " " + frame_elapsed_str +
|
||||
"\n";
|
||||
m_timecode_file.puts(riga_file.c_str());
|
||||
m_timecode_file.puts(line_to_add.c_str());
|
||||
|
||||
machine().video().set_timecode_write(false);
|
||||
//machine().video().set_timecode_text(timecode_text);
|
||||
machine().video().set_timecode_text(timecode_text);
|
||||
machine().video().set_timecode_start(m_timecode_last_time);
|
||||
machine().ui().set_show_timecode_counter(show_timecode_counter);
|
||||
|
@ -343,6 +343,7 @@ enum ioport_type
|
||||
IPT_UI_FAST_FORWARD,
|
||||
IPT_UI_SHOW_FPS,
|
||||
IPT_UI_SNAPSHOT,
|
||||
IPT_UI_TIMECODE,
|
||||
IPT_UI_RECORD_MOVIE,
|
||||
IPT_UI_TOGGLE_CHEAT,
|
||||
IPT_UI_UP,
|
||||
|
@ -1648,6 +1648,10 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co
|
||||
|
||||
machine.ui().image_handler_ingame();
|
||||
|
||||
// handle a save input timecode request
|
||||
if (machine.ui_input().pressed(IPT_UI_TIMECODE))
|
||||
machine.video().save_input_timecode();
|
||||
|
||||
if (ui_disabled) return ui_disabled;
|
||||
|
||||
if (machine.ui_input().pressed(IPT_UI_CANCEL))
|
||||
|
@ -341,13 +341,6 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file)
|
||||
|
||||
void video_manager::save_active_screen_snapshots()
|
||||
{
|
||||
// If record inp is acrive, no snapshot will be created
|
||||
if (m_timecode_enabled) {
|
||||
// This flag will write the line on file inp.timecode (see function ioport_manager::record_frame)
|
||||
m_timecode_write = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// if we're native, then write one snapshot per visible screen
|
||||
if (m_snap_native)
|
||||
{
|
||||
@ -373,6 +366,21 @@ void video_manager::save_active_screen_snapshots()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// save_input_timecode - add a line of current
|
||||
// timestamp to inp.timecode file
|
||||
//-------------------------------------------------
|
||||
|
||||
void video_manager::save_input_timecode()
|
||||
{
|
||||
// if record timecode input is not active, do nothing
|
||||
if (!m_timecode_enabled) {
|
||||
return;
|
||||
}
|
||||
m_timecode_write = true;
|
||||
}
|
||||
|
||||
std::string &video_manager::timecode_text(std::string &str) {
|
||||
str.clear();
|
||||
str += " ";
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
// snapshots
|
||||
void save_snapshot(screen_device *screen, emu_file &file);
|
||||
void save_active_screen_snapshots();
|
||||
void save_input_timecode();
|
||||
|
||||
// movies
|
||||
void begin_recording(const char *name, movie_format format);
|
||||
|
@ -789,6 +789,11 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
|
||||
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT);
|
||||
break;
|
||||
|
||||
// add a NOT-lalt to write timecode file
|
||||
case IPT_UI_TIMECODE: // emu/input.c: input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT)
|
||||
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT);
|
||||
break;
|
||||
|
||||
// lctrl-lalt-F5 to toggle post-processing
|
||||
case IPT_OSD_4:
|
||||
entry->configure_osd("POST_PROCESS", "Toggle Post-Processing");
|
||||
|
Loading…
Reference in New Issue
Block a user