1 #ifndef _ui_services__hpp__included__
2 #define _ui_services__hpp__included__
11 /*********************************************************************************************************************
14 - All functions here are safe to call from another thread.
15 - If function takes onerror parameter, that function is asynchronous.
16 - The onerror handler is called from arbitrary thread.
17 *********************************************************************************************************************/
19 class emulator_instance
;
20 class dumper_factory_base
;
21 namespace keyboard
{ class modifier_set
; }
22 namespace keyboard
{ class key_key
; }
24 struct project_author_info
26 //True if this is a project, false if not. Ignored when saving.
28 //Lua scripts. Ignored when saving if not in project context.
29 std::list
<std::string
> luascripts
;
30 //Autorun new lua scripts. Ignored when saving if not in project context, always loaded as false.
32 //Authors. First of each pair is full name, second is nickname.
33 std::list
<std::pair
<std::string
, std::string
>> authors
;
36 //Project Directory. Ignored if not in project context.
37 std::string directory
;
38 //Project name. Ignored if not in project context.
39 std::string projectname
;
44 struct dumper_information_1
46 //The factory for this dumper.
47 dumper_factory_base
* factory
;
48 //Name of this dumper.
50 //Is this dumper active?
52 //Modes available (first is internal name, second is human-readable one).
53 std::map
<std::string
, std::string
> modes
;
56 struct dumper_information
58 std::map
<std::string
, dumper_information_1
> dumpers
;
62 * Fill branch name map.
64 void UI_get_branch_map(emulator_instance
& instance
, uint64_t& cur
, std::map
<uint64_t, std::string
>& namemap
,
65 std::map
<uint64_t, std::set
<uint64_t>>& childmap
);
67 * Arrange current project to be flushed.
69 void UI_call_flush(emulator_instance
& instance
, std::function
<void(std::exception
&)> onerror
);
71 * Arrage branch to be created.
73 void UI_create_branch(emulator_instance
& instance
, uint64_t id
, const std::string
& name
,
74 std::function
<void(std::exception
&)> onerror
);
76 * Arrage branch to be renamed.
78 void UI_rename_branch(emulator_instance
& instance
, uint64_t id
, const std::string
& name
,
79 std::function
<void(std::exception
&)> onerror
);
81 * Arrage branch to be reparented.
83 void UI_reparent_branch(emulator_instance
& instance
, uint64_t id
, uint64_t pid
,
84 std::function
<void(std::exception
&)> onerror
);
86 * Arrage branch to be deleted.
88 void UI_delete_branch(emulator_instance
& instance
, uint64_t id
, std::function
<void(std::exception
&)> onerror
);
90 * Arrage branch to be switched.
92 void UI_switch_branch(emulator_instance
& instance
, uint64_t id
, std::function
<void(std::exception
&)> onerror
);
94 * Load project author info.
96 project_author_info
UI_load_author_info(emulator_instance
& instance
);
98 * Save project author info.
100 void UI_save_author_info(emulator_instance
& instance
, project_author_info
& info
);
102 * Get available dumpers.
104 dumper_information
UI_get_dumpers(emulator_instance
& instance
);
108 void UI_start_dump(emulator_instance
& inst
, dumper_factory_base
& factory
, const std::string
& mode
,
109 const std::string
& prefix
);
113 void UI_end_dump(emulator_instance
& inst
, dumper_factory_base
& factory
);
115 * Send a keypress event.
117 void UI_do_keypress(emulator_instance
& inst
, const keyboard::modifier_set
& mods
, keyboard::key_key
& key
,
120 * Is there a valid movie?
122 bool UI_has_movie(emulator_instance
& inst
);
124 * Save a movie into buffer.
126 void UI_save_movie(emulator_instance
& inst
, std::ostringstream
& buffer
);
128 * Look up (platform,game) pair.
130 std::pair
<std::string
, std::string
> UI_lookup_platform_and_game(emulator_instance
& inst
);