trunk/src/emu/ui/ui.cpp
| r253156 | r253157 | |
| 37 | 37 | LOADSAVE_SAVE |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | #define MAX_SAVED_STATE_JOYSTICK 4 |
| 40 | 41 | |
| 42 | |
| 41 | 43 | /*************************************************************************** |
| 42 | 44 | LOCAL VARIABLES |
| 43 | 45 | ***************************************************************************/ |
| r253156 | r253157 | |
| 1759 | 1761 | if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) |
| 1760 | 1762 | file = id - ITEM_ID_0_PAD + '0'; |
| 1761 | 1763 | if (file == 0) |
| 1762 | | return state; |
| 1764 | { |
| 1765 | bool found = false; |
| 1763 | 1766 | |
| 1767 | for (int joy_index = 0; joy_index <= MAX_SAVED_STATE_JOYSTICK; joy_index++) |
| 1768 | for (input_item_id id = ITEM_ID_BUTTON1; id <= ITEM_ID_BUTTON32; ++id) |
| 1769 | if (machine.input().code_pressed_once(input_code(DEVICE_CLASS_JOYSTICK, joy_index, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) |
| 1770 | { |
| 1771 | snprintf(filename, sizeof(filename), "joy%i-%i", joy_index, id - ITEM_ID_BUTTON1 + 1); |
| 1772 | found = true; |
| 1773 | break; |
| 1774 | } |
| 1775 | |
| 1776 | if (!found) |
| 1777 | return state; |
| 1778 | } |
| 1779 | else |
| 1780 | { |
| 1781 | sprintf(filename, "%c", file); |
| 1782 | } |
| 1783 | |
| 1764 | 1784 | // display a popup indicating that the save will proceed |
| 1765 | | sprintf(filename, "%c", file); |
| 1766 | 1785 | if (state == LOADSAVE_SAVE) |
| 1767 | 1786 | { |
| 1768 | | machine.popmessage("Save to position %c", file); |
| 1787 | machine.popmessage("Save to position %s", filename); |
| 1769 | 1788 | machine.schedule_save(filename); |
| 1770 | 1789 | } |
| 1771 | 1790 | else |
| 1772 | 1791 | { |
| 1773 | | machine.popmessage("Load from position %c", file); |
| 1792 | machine.popmessage("Load from position %s", filename); |
| 1774 | 1793 | machine.schedule_load(filename); |
| 1775 | 1794 | } |
| 1776 | 1795 | |