mirror of
https://github.com/holub/mame
synced 2025-04-26 02:07:14 +03:00
Define new macro ALLOW_SAVE_TYPE which can be used to declare enums as
valid save types on a case-by-case basis. Updated the cosmac CPU core to do this for its mode and state enums, which were previously failing.
This commit is contained in:
parent
dd574a314a
commit
c7ff741eb9
@ -22,6 +22,11 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// permit our enums to be saved
|
||||||
|
ALLOW_SAVE_TYPE(cosmac_device::cosmac_mode);
|
||||||
|
ALLOW_SAVE_TYPE(cosmac_device::cosmac_state);
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// DEVICE DEFINITIONS
|
// DEVICE DEFINITIONS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
@ -348,17 +348,16 @@ protected:
|
|||||||
devcb_resolved_write_line m_out_tpb_func;
|
devcb_resolved_write_line m_out_tpb_func;
|
||||||
|
|
||||||
// control modes
|
// control modes
|
||||||
enum _cosmac_mode
|
enum cosmac_mode
|
||||||
{
|
{
|
||||||
COSMAC_MODE_LOAD = 0,
|
COSMAC_MODE_LOAD = 0,
|
||||||
COSMAC_MODE_RESET,
|
COSMAC_MODE_RESET,
|
||||||
COSMAC_MODE_PAUSE,
|
COSMAC_MODE_PAUSE,
|
||||||
COSMAC_MODE_RUN
|
COSMAC_MODE_RUN
|
||||||
};
|
};
|
||||||
typedef enum _cosmac_mode cosmac_mode;
|
|
||||||
|
|
||||||
// execution states
|
// execution states
|
||||||
enum _cosmac_state
|
enum cosmac_state
|
||||||
{
|
{
|
||||||
COSMAC_STATE_0_FETCH = 0,
|
COSMAC_STATE_0_FETCH = 0,
|
||||||
COSMAC_STATE_1_RESET,
|
COSMAC_STATE_1_RESET,
|
||||||
@ -368,7 +367,6 @@ protected:
|
|||||||
COSMAC_STATE_2_DMA_OUT,
|
COSMAC_STATE_2_DMA_OUT,
|
||||||
COSMAC_STATE_3_INT
|
COSMAC_STATE_3_INT
|
||||||
};
|
};
|
||||||
typedef enum _cosmac_state cosmac_state;
|
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
UINT8 m_op; // current opcode
|
UINT8 m_op; // current opcode
|
||||||
@ -411,5 +409,4 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __COSMAC_H__ */
|
#endif /* __COSMAC_H__ */
|
||||||
|
@ -67,10 +67,12 @@ enum state_save_error
|
|||||||
// MACROS
|
// MACROS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
|
// macros to declare presave/postload functions with the appropriate parameters
|
||||||
#define STATE_PRESAVE(name) void name(running_machine *machine, void *param)
|
#define STATE_PRESAVE(name) void name(running_machine *machine, void *param)
|
||||||
#define STATE_POSTLOAD(name) void name(running_machine *machine, void *param)
|
#define STATE_POSTLOAD(name) void name(running_machine *machine, void *param)
|
||||||
|
|
||||||
|
|
||||||
|
// templates to assume the 'param' of a presave/postload function is a class pointer
|
||||||
template<class T, void (T::*func)()>
|
template<class T, void (T::*func)()>
|
||||||
void state_presave_stub(running_machine *machine, void *param)
|
void state_presave_stub(running_machine *machine, void *param)
|
||||||
{
|
{
|
||||||
@ -86,6 +88,13 @@ void state_postload_stub(running_machine *machine, void *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// use this to declare a given type is a simple, non-pointer type that can be
|
||||||
|
// saved; in general, this is intended only to be used for specific enum types
|
||||||
|
// defined by your device
|
||||||
|
#define ALLOW_SAVE_TYPE(TYPE) template<> struct state_manager::type_checker<TYPE> { static const bool is_atom = true; static const bool is_pointer = false; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// register items with explicit tags
|
// register items with explicit tags
|
||||||
#define state_save_register_item(_mach, _mod, _tag, _index, _val) \
|
#define state_save_register_item(_mach, _mod, _tag, _index, _val) \
|
||||||
(_mach)->state().save_item(_mod, _tag, _index, _val, #_val)
|
(_mach)->state().save_item(_mod, _tag, _index, _val, #_val)
|
||||||
@ -254,19 +263,20 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
// template specializations to enumerate the fundamental atomic types you are allowed to save
|
// template specializations to enumerate the fundamental atomic types you are allowed to save
|
||||||
template<> struct state_manager::type_checker<bool> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(bool);
|
||||||
template<> struct state_manager::type_checker<INT8> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(INT8);
|
||||||
template<> struct state_manager::type_checker<UINT8> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(UINT8);
|
||||||
template<> struct state_manager::type_checker<INT16> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(INT16);
|
||||||
template<> struct state_manager::type_checker<UINT16> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(UINT16);
|
||||||
template<> struct state_manager::type_checker<INT32> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(INT32);
|
||||||
template<> struct state_manager::type_checker<UINT32> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(UINT32);
|
||||||
template<> struct state_manager::type_checker<INT64> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(INT64);
|
||||||
template<> struct state_manager::type_checker<UINT64> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(UINT64);
|
||||||
template<> struct state_manager::type_checker<PAIR> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(PAIR);
|
||||||
template<> struct state_manager::type_checker<PAIR64> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(PAIR64);
|
||||||
template<> struct state_manager::type_checker<float> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(float);
|
||||||
template<> struct state_manager::type_checker<double> { static const bool is_atom = true; static const bool is_pointer = false; };
|
ALLOW_SAVE_TYPE(double);
|
||||||
|
ALLOW_SAVE_TYPE(endianness_t);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user