1 #ifndef _interface__romtype__hpp__included__
2 #define _interface__romtype__hpp__included__
8 #include "interface/controller.hpp"
9 #include "interface/setting.hpp"
13 struct core_sysregion
;
15 struct core_romimage_info
;
17 struct core_region_params
24 uint64_t framemagic
[4];
26 unsigned* compatible_runs
;
29 struct core_romimage_info_params
34 int pass_mode
; //0 => Content, 1 => File, 2 => Directory.
35 unsigned headersize
; //Header size to remove (0 if there is never header to remove).
38 struct core_type_params
43 unsigned reset_support
;
44 int (*load_rom
)(core_romimage
* images
, std::map
<std::string
, std::string
>& settings
, uint64_t rtc_sec
,
46 controller_set (*controllerconfig
)(std::map
<std::string
, std::string
>& settings
);
47 const char* extensions
; //Separate by ;
48 const char* bios
; //Name of BIOS. NULL if none.
49 core_region
** regions
; //Terminate with NULL.
50 core_romimage_info
** images
; //Terminate with NULL.
51 core_setting_group
* settings
;
52 bool (*set_region
)(core_region
& region
);
53 std::pair
<uint32_t, uint32_t> (*video_rate
)();
54 std::pair
<uint32_t, uint32_t> (*audio_rate
)();
60 core_region(const core_region_params
& params
);
61 const std::string
& get_iname();
62 const std::string
& get_hname();
63 unsigned get_priority();
64 unsigned get_handle();
66 void fill_framerate_magic(uint64_t* magic
); //4 elements filled.
67 double approx_framerate();
68 bool compatible_with(core_region
& run
);
70 core_region(const core_region
&);
71 core_region
& operator=(const core_region
&);
78 std::vector
<unsigned> compatible
;
81 struct core_romimage_info
83 core_romimage_info(const core_romimage_info_params
& params
);
89 size_t get_headnersize(size_t imagesize
);
95 const unsigned char* data
;
102 core_type(core_type_params
& params
);
103 static std::list
<core_type
*> get_core_types();
104 core_region
& get_preferred_region();
105 std::list
<core_region
*> get_regions();
106 core_sysregion
& combine_region(core_region
& reg
);
107 const std::string
& get_iname();
108 const std::string
& get_hname();
109 const std::list
<std::string
>& get_extensions();
110 bool is_known_extension(const std::string
& ext
);
111 std::string
get_biosname();
113 unsigned get_image_count();
114 core_romimage_info
get_image_info(unsigned index
);
115 bool load(core_romimage
* images
, std::map
<std::string
, std::string
>& settings
, uint64_t rtc_sec
,
116 uint64_t rtc_subsec
);
117 controller_set
controllerconfig(std::map
<std::string
, std::string
>& settings
);
118 unsigned get_reset_support();
119 core_setting_group
& get_settings();
120 bool set_region(core_region
& region
);
121 std::pair
<uint32_t, uint32_t> get_video_rate();
122 std::pair
<uint32_t, uint32_t> get_audio_rate();
124 core_type(const core_type
&);
125 core_type
& operator=(const core_type
&);
126 int (*loadimg
)(core_romimage
* images
, std::map
<std::string
, std::string
>& settings
, uint64_t rtc_sec
,
127 uint64_t rtc_subsec
);
128 controller_set (*_controllerconfig
)(std::map
<std::string
, std::string
>& settings
);
129 bool (*_set_region
)(core_region
& region
);
130 std::pair
<uint32_t, uint32_t> (*_video_rate
)();
131 std::pair
<uint32_t, uint32_t> (*_audio_rate
)();
133 unsigned reset_support
;
136 std::string biosname
;
137 std::list
<std::string
> extensions
;
138 std::list
<core_region
*> regions
;
139 std::vector
<core_romimage_info
*> imageinfo
;
140 core_setting_group
* settings
;
143 struct core_sysregion
146 core_sysregion(const std::string
& name
, core_type
& type
, core_region
& region
);
147 static core_sysregion
& lookup(const std::string
& name
);
148 const std::string
& get_name();
149 core_region
& get_region();
150 core_type
& get_type();
151 void fill_framerate_magic(uint64_t* magic
); //4 elements filled.
153 core_sysregion(const core_sysregion
&);
154 core_sysregion
& operator=(const core_sysregion
&);