void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) const { cheatfile.printf("\t\t\t\t<argument"); if (m_count != 1) cheatfile.printf(" count=\"%d\"", (int)m_count); cheatfile.printf(">%s</argument>\n", cheat_manager::quote_expression(m_expression).c_str()); }
void cheat_parameter::save(emu_file &cheatfile) const { // output the parameter tag cheatfile.printf("\t\t<parameter"); // if no items, just output min/max/step if (!has_itemlist()) { if (m_minval != 0) cheatfile.printf(" min=\"%s\"", m_minval.format().c_str()); if (m_maxval != 0) cheatfile.printf(" max=\"%s\"", m_maxval.format().c_str()); if (m_stepval != 1) cheatfile.printf(" step=\"%s\"", m_stepval.format().c_str()); cheatfile.printf("/>\n"); } // iterate over items else { cheatfile.printf(">\n"); for (auto &curitem : m_itemlist) cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem->value().format().c_str(), curitem->text()); cheatfile.printf("\t\t</parameter>\n"); } }
void cheat_parameter::save(emu_file &cheatfile) const { // output the parameter tag cheatfile.printf("\t\t<parameter"); // if no items, just output min/max/step astring string; if (!has_itemlist()) { if (m_minval != 0) cheatfile.printf(" min=\"%s\"", m_minval.format(string)); if (m_maxval != 0) cheatfile.printf(" max=\"%s\"", m_maxval.format(string)); if (m_stepval != 1) cheatfile.printf(" step=\"%s\"", m_stepval.format(string)); cheatfile.printf("/>\n"); } // iterate over items else { for (const item *curitem = m_itemlist.first(); curitem != NULL; curitem = curitem->next()) cheatfile.printf("\t\t\t<item value=\"%s\">%s</item>\n", curitem->value().format(string), curitem->text()); cheatfile.printf("\t\t</parameter>\n"); } }
void cheat_script::save(emu_file &cheatfile) const { // output the script tag cheatfile.printf("\t\t<script"); switch (m_state) { case SCRIPT_STATE_OFF: cheatfile.printf(" state=\"off\""); break; case SCRIPT_STATE_ON: cheatfile.printf(" state=\"on\""); break; default: case SCRIPT_STATE_RUN: cheatfile.printf(" state=\"run\""); break; case SCRIPT_STATE_CHANGE: cheatfile.printf(" state=\"change\""); break; } cheatfile.printf(">\n"); // output entries for (const script_entry *entry = m_entrylist.first(); entry != NULL; entry = entry->next()) entry->save(cheatfile); // close the tag cheatfile.printf("\t\t</script>\n"); }
void cheat_entry::save(emu_file &cheatfile) const { // determine if we have scripts bool has_scripts = (m_off_script != NULL || m_on_script != NULL || m_run_script != NULL || m_change_script != NULL); // output the cheat tag cheatfile.printf("\t<cheat desc=\"%s\"", m_description.cstr()); if (m_numtemp != DEFAULT_TEMP_VARIABLES) cheatfile.printf(" tempvariables=\"%d\"", m_numtemp); if (!m_comment && m_parameter == NULL && !has_scripts) cheatfile.printf(" />\n"); else { cheatfile.printf(">\n"); // save the comment if (m_comment) cheatfile.printf("\t\t<comment><![CDATA[\n%s\n\t\t]]></comment>\n", m_comment.cstr()); // output the parameter, if present if (m_parameter != NULL) m_parameter->save(cheatfile); // output the script nodes if (m_on_script != NULL) m_on_script->save(cheatfile); if (m_off_script != NULL) m_off_script->save(cheatfile); if (m_change_script != NULL) m_change_script->save(cheatfile); if (m_run_script != NULL) m_run_script->save(cheatfile); // close the cheat tag cheatfile.printf("\t</cheat>\n"); } }
void cheat_script::script_entry::save(emu_file &cheatfile) const { astring tempstring; // output an action if (!m_format) { cheatfile.printf("\t\t\t<action"); if (!m_condition.is_empty()) cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition)); cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(tempstring, m_expression)); } // output an output else { cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.cstr()); if (!m_condition.is_empty()) cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(tempstring, m_condition)); if (m_line != 0) cheatfile.printf(" line=\"%d\"", m_line); if (m_justify == JUSTIFY_CENTER) cheatfile.printf(" align=\"center\""); else if (m_justify == JUSTIFY_RIGHT) cheatfile.printf(" align=\"right\""); if (m_arglist.count() == 0) cheatfile.printf(" />\n"); // output arguments else { cheatfile.printf(">\n"); for (const output_argument *curarg = m_arglist.first(); curarg != NULL; curarg = curarg->next()) curarg->save(cheatfile); cheatfile.printf("\t\t\t</output>\n"); } } }
void cheat_script::script_entry::save(emu_file &cheatfile) const { // output an action if (m_format.empty()) { cheatfile.printf("\t\t\t<action"); if (!m_condition.is_empty()) cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str()); cheatfile.printf(">%s</action>\n", cheat_manager::quote_expression(m_expression).c_str()); } // output an output else { cheatfile.printf("\t\t\t<output format=\"%s\"", m_format.c_str()); if (!m_condition.is_empty()) cheatfile.printf(" condition=\"%s\"", cheat_manager::quote_expression(m_condition).c_str()); if (m_line != 0) cheatfile.printf(" line=\"%d\"", m_line); if (m_justify == ui::text_layout::CENTER) cheatfile.printf(" align=\"center\""); else if (m_justify == ui::text_layout::RIGHT) cheatfile.printf(" align=\"right\""); if (m_arglist.size() == 0) cheatfile.printf(" />\n"); // output arguments else { cheatfile.printf(">\n"); for (auto &curarg : m_arglist) curarg->save(cheatfile); cheatfile.printf("\t\t\t</output>\n"); } } }