Thanks, this was the breakthrough I needed. I had already looked at ui.c, but was searching for the "save states are not officially supported..." message. This got me on track, then I found that message in machine.c. Also, I realized that the modifications have to be written differently in different versions, so there's not much advantage in a writing a .diff for each version over modifying each version manually. That is unless it becomes a popular feature and needs to be distributed easily, but I don't see that happening any time soon, considering how much of a niche application this is. Anyway, I'll post the solution here for anyone who finds this in the future:
- Solution -
See original post for the purpose of this modification. The solution is to modify some of the source files found in src/emu. These files are written in C, I was able to open them in MS Visual Studio and Notepad. Note that this solution is for version 143 (current at time of writing), and may need to be adapted slightly for different versions. machine.c does not exist before version 138u3, corresponding sections shown from machine.c can be found in mame.c in some earlier versions.
To remove saving or loading messages, the highlighted sections of code can all be deleted. You may want to choose which messages to keep and which to remove. Alternatively, the text between quotation marks (") can be rewritten for custom messages. When doing so, be sure to remove constants if you delete a reference to one (if you delete %c or %s, delete the text ', file' or ', opname' or ', opnamed' after the message).
From ui.c:
/*-------------------------------------------------
handler_load_save - leads the user through
specifying a game to save or load
-------------------------------------------------*/
static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state)
{
char filename[20];
input_code code;
char file = 0;
/* if we're not in the middle of anything, skip */
if (state == LOADSAVE_NONE)
return 0;
/* okay, we're waiting for a key to select a slot; display a message */
if (state == LOADSAVE_SAVE)
ui_draw_message_window(container, "Select position to save to");
else
ui_draw_message_window(container, "Select position to load from");
/* check for cancel key */
if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
/* display a popup indicating things were cancelled */
if (state == LOADSAVE_SAVE)
popmessage("Save cancelled");
else
popmessage("Load cancelled");
/* reset the state */
machine.resume();
return UI_HANDLER_CANCEL;
}
/* check for A-Z or 0-9 */
for (input_item_id id = ITEM_ID_A; id <= ITEM_ID_Z; id++)
if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH,
ITEM_MODIFIER_NONE, id)))
file = id - ITEM_ID_A + 'a';
if (file == 0)
for (input_item_id id = ITEM_ID_0; id <= ITEM_ID_9; id++)
if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH,
ITEM_MODIFIER_NONE, id)))
file = id - ITEM_ID_0 + '0';
if (file == 0)
for (input_item_id id = ITEM_ID_0_PAD; id <= ITEM_ID_9_PAD; id++)
if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH,
ITEM_MODIFIER_NONE, id)))
file = id - ITEM_ID_0_PAD + '0';
if (file == 0)
return state;
/* display a popup indicating that the save will proceed */
sprintf(filename, "%c", file);
if (state == LOADSAVE_SAVE)
{
popmessage("Save to position %c", file);
machine.schedule_save(filename);
}
else
{
popmessage("Load from position %c", file);
machine.schedule_load(filename);
}
/* remove the pause and reset the state */
machine.resume();
return UI_HANDLER_CANCEL;
}
From machine.c:
//-------------------------------------------------
// handle_saveload - attempt to perform a save
// or load
//-------------------------------------------------
void running_machine::handle_saveload()
{
UINT32 openflags = (m_saveload_schedule == SLS_LOAD) ? OPEN_FLAG_READ : (OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
const char *opnamed = (m_saveload_schedule == SLS_LOAD) ? "loaded" : "saved";
const char *opname = (m_saveload_schedule == SLS_LOAD) ? "load" : "save";
file_error filerr = FILERR_NONE;
// if no name, bail
emu_file file(m_saveload_searchpath, openflags);
if (!m_saveload_pending_file)
goto cancel;
// if there are anonymous timers, we can't save just yet, and we can't load yet either
// because the timers might overwrite data we have loaded
if (!m_scheduler.can_save())
{
// if more than a second has passed, we're probably screwed
if ((this->time() - m_saveload_schedule_time) > attotime::from_seconds(1))
{
popmessage("Unable to %s due to pending anonymous timers. See error.log for details.", opname);
goto cancel;
}
return;
}
// open the file
filerr = file.open(m_saveload_pending_file);
if (filerr == FILERR_NONE)
{
// read/write the save state
save_error saverr = (m_saveload_schedule == SLS_LOAD) ? m_save.read_file(file) : m_save.write_file(file);
// handle the result
switch (saverr)
{
case STATERR_ILLEGAL_REGISTRATIONS:
popmessage("Error: Unable to %s state due to illegal registrations. See error.log for details.", opname);
break;
case STATERR_INVALID_HEADER:
popmessage("Error: Unable to %s state due to an invalid header. Make sure the save state is correct for this
game.", opname);
break;
case STATERR_READ_ERROR:
popmessage("Error: Unable to %s state due to a read error (file is likely corrupt).", opname);
break;
case STATERR_WRITE_ERROR:
popmessage("Error: Unable to %s state due to a write error. Verify there is enough disk space.", opname);
break;
case STATERR_NONE:
if (!(m_system.flags & GAME_SUPPORTS_SAVE))
popmessage("State successfully %s.\nWarning: Save states are not officially supported for this game.",
opnamed);
else
popmessage("State successfully %s.", opnamed);
break;
default:
popmessage("Error: Unknown error during state %s.", opnamed);
break;
}
// close and perhaps delete the file
if (saverr != STATERR_NONE && m_saveload_schedule == SLS_SAVE)
file.remove_on_close();
}
else
popmessage("Error: Failed to open file for %s operation.", opname);
// unschedule the operation
cancel:
m_saveload_pending_file.reset();
m_saveload_searchpath = NULL;
m_saveload_schedule = SLS_NONE;
}