Clean up use of project->moviepath/otherpath
This commit is contained in:
parent
b13e9ef12c
commit
a2f4ba6dfd
13 changed files with 76 additions and 38 deletions
|
@ -128,5 +128,13 @@ void UI_save_movie(emulator_instance& inst, std::ostringstream& buffer);
|
||||||
* Look up (platform,game) pair.
|
* Look up (platform,game) pair.
|
||||||
*/
|
*/
|
||||||
std::pair<std::string, std::string> UI_lookup_platform_and_game(emulator_instance& inst);
|
std::pair<std::string, std::string> UI_lookup_platform_and_game(emulator_instance& inst);
|
||||||
|
/**
|
||||||
|
* Get otherpath of current project.
|
||||||
|
*/
|
||||||
|
std::string UI_get_project_otherpath(emulator_instance& inst);
|
||||||
|
/**
|
||||||
|
* Get moviepath of current project.
|
||||||
|
*/
|
||||||
|
std::string UI_get_project_moviepath(emulator_instance& inst);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -252,3 +252,21 @@ std::pair<std::string, std::string> UI_lookup_platform_and_game(emulator_instanc
|
||||||
});
|
});
|
||||||
return std::make_pair(plat, game);
|
return std::make_pair(plat, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string UI_get_project_otherpath(emulator_instance& inst)
|
||||||
|
{
|
||||||
|
std::string path;
|
||||||
|
lsnes_instance.iqueue->run([&inst, &path]() {
|
||||||
|
path = inst.project->otherpath();
|
||||||
|
});
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string UI_get_project_moviepath(emulator_instance& inst)
|
||||||
|
{
|
||||||
|
std::string path;
|
||||||
|
lsnes_instance.iqueue->run([&inst, &path]() {
|
||||||
|
path = inst.project->moviepath();
|
||||||
|
});
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ void dumper_menu::on_select(wxCommandEvent& e)
|
||||||
std::string prefix;
|
std::string prefix;
|
||||||
if((d & dumper_factory_base::target_type_mask) == dumper_factory_base::target_type_file) {
|
if((d & dumper_factory_base::target_type_mask) == dumper_factory_base::target_type_file) {
|
||||||
wxFileDialog* d = new wxFileDialog(pwin, wxT("Choose file"),
|
wxFileDialog* d = new wxFileDialog(pwin, wxT("Choose file"),
|
||||||
towxstring(inst.project->otherpath()), wxT(""), wxT("*.*"),
|
towxstring(UI_get_project_otherpath(inst)), wxT(""), wxT("*.*"),
|
||||||
wxFD_SAVE);
|
wxFD_SAVE);
|
||||||
std::string modext = t->mode_extension(mode);
|
std::string modext = t->mode_extension(mode);
|
||||||
d->SetWildcard(towxstring(modext + " files|*." + modext));
|
d->SetWildcard(towxstring(modext + " files|*." + modext));
|
||||||
|
@ -105,7 +105,7 @@ void dumper_menu::on_select(wxCommandEvent& e)
|
||||||
} else if((d & dumper_factory_base::target_type_mask) ==
|
} else if((d & dumper_factory_base::target_type_mask) ==
|
||||||
dumper_factory_base::target_type_prefix) {
|
dumper_factory_base::target_type_prefix) {
|
||||||
wxFileDialog* d = new wxFileDialog(pwin, wxT("Choose prefix"),
|
wxFileDialog* d = new wxFileDialog(pwin, wxT("Choose prefix"),
|
||||||
towxstring(inst.project->otherpath()), wxT(""), wxT("*.*"),
|
towxstring(UI_get_project_otherpath(inst)), wxT(""), wxT("*.*"),
|
||||||
wxFD_SAVE);
|
wxFD_SAVE);
|
||||||
auto p = inst.project->get();
|
auto p = inst.project->get();
|
||||||
if(p)
|
if(p)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "core/instance-map.hpp"
|
#include "core/instance-map.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
#include "core/memorymanip.hpp"
|
#include "core/memorymanip.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "library/memorysearch.hpp"
|
#include "library/memorysearch.hpp"
|
||||||
#include "library/hex.hpp"
|
#include "library/hex.hpp"
|
||||||
|
|
||||||
|
@ -368,7 +369,7 @@ public:
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_load(this, "Load bookmarks from file",
|
std::string filename = choose_file_load(this, "Load bookmarks from file",
|
||||||
inst.project->otherpath(), filetype_hexbookmarks);
|
UI_get_project_otherpath(inst), filetype_hexbookmarks);
|
||||||
auto _in = zip::readrel(filename, "");
|
auto _in = zip::readrel(filename, "");
|
||||||
std::string in(_in.begin(), _in.end());
|
std::string in(_in.begin(), _in.end());
|
||||||
JSON::node root(in);
|
JSON::node root(in);
|
||||||
|
@ -415,7 +416,7 @@ public:
|
||||||
std::string doc = root.serialize();
|
std::string doc = root.serialize();
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save bookmarks to file",
|
std::string filename = choose_file_save(this, "Save bookmarks to file",
|
||||||
inst.project->otherpath(), filetype_hexbookmarks);
|
UI_get_project_otherpath(inst), filetype_hexbookmarks);
|
||||||
std::ofstream out(filename.c_str());
|
std::ofstream out(filename.c_str());
|
||||||
out << doc << std::endl;
|
out << doc << std::endl;
|
||||||
out.close();
|
out.close();
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "core/mainloop.hpp"
|
#include "core/mainloop.hpp"
|
||||||
#include "core/moviedata.hpp"
|
#include "core/moviedata.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "library/zip.hpp"
|
#include "library/zip.hpp"
|
||||||
#include "library/minmax.hpp"
|
#include "library/minmax.hpp"
|
||||||
#include "library/json.hpp"
|
#include "library/json.hpp"
|
||||||
|
@ -384,7 +385,7 @@ void wxeditor_macro::on_load(wxCommandEvent& e)
|
||||||
std::string mname = pick_text(this, "Name new macro", "Enter name for the new macro:", "");
|
std::string mname = pick_text(this, "Name new macro", "Enter name for the new macro:", "");
|
||||||
if(mname == "")
|
if(mname == "")
|
||||||
return;
|
return;
|
||||||
std::string file = choose_file_load(this, "Load macro from", inst.project->otherpath(),
|
std::string file = choose_file_load(this, "Load macro from", UI_get_project_otherpath(inst),
|
||||||
filetype_macro);
|
filetype_macro);
|
||||||
std::vector<char> contents = zip::readrel(file, "");
|
std::vector<char> contents = zip::readrel(file, "");
|
||||||
controller_macro m(JSON::node(std::string(contents.begin(), contents.end())));
|
controller_macro m(JSON::node(std::string(contents.begin(), contents.end())));
|
||||||
|
@ -411,7 +412,7 @@ void wxeditor_macro::on_save(wxCommandEvent& e)
|
||||||
std::string mdata = _macro->serialize().serialize();
|
std::string mdata = _macro->serialize().serialize();
|
||||||
//Okay, have the macro data, now prompt for file and save.
|
//Okay, have the macro data, now prompt for file and save.
|
||||||
try {
|
try {
|
||||||
std::string tfile = choose_file_save(this, "Save macro to", inst.project->otherpath(),
|
std::string tfile = choose_file_save(this, "Save macro to", UI_get_project_otherpath(inst),
|
||||||
filetype_macro);
|
filetype_macro);
|
||||||
std::ofstream f(tfile);
|
std::ofstream f(tfile);
|
||||||
f << mdata;
|
f << mdata;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "core/moviedata.hpp"
|
#include "core/moviedata.hpp"
|
||||||
#include "core/memorywatch.hpp"
|
#include "core/memorywatch.hpp"
|
||||||
#include "core/memorymanip.hpp"
|
#include "core/memorymanip.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "library/memoryspace.hpp"
|
#include "library/memoryspace.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
|
|
||||||
|
@ -444,7 +445,7 @@ void wxeditor_memorywatch::on_position_change(wxCommandEvent& e)
|
||||||
void wxeditor_memorywatch::on_fontsel(wxCommandEvent& e)
|
void wxeditor_memorywatch::on_fontsel(wxCommandEvent& e)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_load(this, "Choose font file", inst.project->otherpath(),
|
std::string filename = choose_file_load(this, "Choose font file", UI_get_project_otherpath(inst),
|
||||||
filetype_font);
|
filetype_font);
|
||||||
font->SetValue(towxstring(filename));
|
font->SetValue(towxstring(filename));
|
||||||
} catch(canceled_exception& e) {
|
} catch(canceled_exception& e) {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "core/moviedata.hpp"
|
#include "core/moviedata.hpp"
|
||||||
#include "core/dispatch.hpp"
|
#include "core/dispatch.hpp"
|
||||||
#include "core/window.hpp"
|
#include "core/window.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
|
|
||||||
#include "interface/controller.hpp"
|
#include "interface/controller.hpp"
|
||||||
#include "core/mainloop.hpp"
|
#include "core/mainloop.hpp"
|
||||||
|
@ -1674,7 +1675,7 @@ void wxeditor_movie::_moviepanel::on_popup_menu(wxCommandEvent& e)
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string branch;
|
std::string branch;
|
||||||
std::string dbranch;
|
std::string dbranch;
|
||||||
auto g = choose_file_load(this, "Choose file to import", inst.project->moviepath(),
|
auto g = choose_file_load(this, "Choose file to import", UI_get_project_moviepath(inst),
|
||||||
exp_imp_type());
|
exp_imp_type());
|
||||||
filename = g.first;
|
filename = g.first;
|
||||||
mode = g.second;
|
mode = g.second;
|
||||||
|
@ -1715,7 +1716,7 @@ void wxeditor_movie::_moviepanel::on_popup_menu(wxCommandEvent& e)
|
||||||
try {
|
try {
|
||||||
int mode;
|
int mode;
|
||||||
std::string file;
|
std::string file;
|
||||||
auto g = choose_file_save(this, "Choose file to export", inst.project->moviepath(),
|
auto g = choose_file_save(this, "Choose file to export", UI_get_project_moviepath(inst),
|
||||||
exp_imp_type());
|
exp_imp_type());
|
||||||
file = g.first;
|
file = g.first;
|
||||||
mode = g.second;
|
mode = g.second;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "core/instance.hpp"
|
#include "core/instance.hpp"
|
||||||
#include "core/inthread.hpp"
|
#include "core/inthread.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "library/string.hpp"
|
#include "library/string.hpp"
|
||||||
|
|
||||||
#include "platform/wxwidgets/platform.hpp"
|
#include "platform/wxwidgets/platform.hpp"
|
||||||
|
@ -139,10 +140,12 @@ wxeditor_voicesub::wxeditor_voicesub(wxWindow* parent, emulator_instance& _inst)
|
||||||
|
|
||||||
top_s->SetSizeHints(this);
|
top_s->SetSizeHints(this);
|
||||||
Fit();
|
Fit();
|
||||||
vstreamchange.set(inst.dispatch->voice_stream_change, [this]() { runuifun([this]() -> void {
|
vstreamchange.set(inst.dispatch->voice_stream_change, [this]() {
|
||||||
this->refresh(); }); });
|
runuifun([this]() -> void { this->refresh(); });
|
||||||
corechange.set(inst.dispatch->core_change, [this]() { runuifun([this]() -> void {
|
});
|
||||||
this->refresh(); }); });
|
corechange.set(inst.dispatch->core_change, [this]() {
|
||||||
|
runuifun([this]() -> void { this->refresh(); });
|
||||||
|
});
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +220,7 @@ void wxeditor_voicesub::on_export(wxCommandEvent& e)
|
||||||
if(id == NOTHING)
|
if(id == NOTHING)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
auto filename = choose_file_save(this, "Select file to epxort", inst.project->otherpath(),
|
auto filename = choose_file_save(this, "Select file to epxort", UI_get_project_otherpath(inst),
|
||||||
filetype_opus_sox);
|
filetype_opus_sox);
|
||||||
inst.commentary->export_stream(id, filename.first, filename.second);
|
inst.commentary->export_stream(id, filename.first, filename.second);
|
||||||
} catch(canceled_exception& e) {
|
} catch(canceled_exception& e) {
|
||||||
|
@ -231,7 +234,7 @@ void wxeditor_voicesub::on_export_s(wxCommandEvent& e)
|
||||||
try {
|
try {
|
||||||
std::string filename;
|
std::string filename;
|
||||||
filename = choose_file_save(this, "Select file to export superstream",
|
filename = choose_file_save(this, "Select file to export superstream",
|
||||||
inst.project->otherpath(), filetype_sox);
|
UI_get_project_otherpath(inst), filetype_sox);
|
||||||
inst.commentary->export_superstream(filename);
|
inst.commentary->export_superstream(filename);
|
||||||
} catch(canceled_exception& e) {
|
} catch(canceled_exception& e) {
|
||||||
} catch(std::exception& e) {
|
} catch(std::exception& e) {
|
||||||
|
@ -245,7 +248,7 @@ void wxeditor_voicesub::on_import(wxCommandEvent& e)
|
||||||
uint64_t ts;
|
uint64_t ts;
|
||||||
ts = inst.commentary->parse_timebase(pick_text(this, "Enter timebase",
|
ts = inst.commentary->parse_timebase(pick_text(this, "Enter timebase",
|
||||||
"Enter position for newly imported stream"));
|
"Enter position for newly imported stream"));
|
||||||
auto filename = choose_file_save(this, "Select file to import", inst.project->otherpath(),
|
auto filename = choose_file_save(this, "Select file to import", UI_get_project_otherpath(inst),
|
||||||
filetype_opus_sox);
|
filetype_opus_sox);
|
||||||
inst.commentary->import_stream(ts, filename.first, filename.second);
|
inst.commentary->import_stream(ts, filename.first, filename.second);
|
||||||
} catch(canceled_exception& e) {
|
} catch(canceled_exception& e) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "core/framerate.hpp"
|
#include "core/framerate.hpp"
|
||||||
#include "core/instance.hpp"
|
#include "core/instance.hpp"
|
||||||
#include "core/keymapper.hpp"
|
#include "core/keymapper.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "interface/romtype.hpp"
|
#include "interface/romtype.hpp"
|
||||||
#include "core/loadlib.hpp"
|
#include "core/loadlib.hpp"
|
||||||
#include "lua/lua.hpp"
|
#include "lua/lua.hpp"
|
||||||
|
@ -1474,13 +1475,13 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
||||||
inst.iqueue->queue("cancel-saves");
|
inst.iqueue->queue("cancel-saves");
|
||||||
return;
|
return;
|
||||||
case wxID_LOAD_MOVIE:
|
case wxID_LOAD_MOVIE:
|
||||||
filename = choose_file_load(this, "Load Movie", inst.project->moviepath(),
|
filename = choose_file_load(this, "Load Movie", UI_get_project_moviepath(inst),
|
||||||
filetype_movie).second;
|
filetype_movie).second;
|
||||||
recent_movies->add(filename);
|
recent_movies->add(filename);
|
||||||
inst.iqueue->queue("load-movie " + filename);
|
inst.iqueue->queue("load-movie " + filename);
|
||||||
return;
|
return;
|
||||||
case wxID_LOAD_STATE:
|
case wxID_LOAD_STATE:
|
||||||
filename2 = choose_file_load(this, "Load State", inst.project->moviepath(),
|
filename2 = choose_file_load(this, "Load State", UI_get_project_moviepath(inst),
|
||||||
filetype_savestate);
|
filetype_savestate);
|
||||||
recent_movies->add(filename2.second);
|
recent_movies->add(filename2.second);
|
||||||
inst.iqueue->queue("load" + filename2.first + " " + filename2.second);
|
inst.iqueue->queue("load" + filename2.first + " " + filename2.second);
|
||||||
|
@ -1489,31 +1490,31 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
||||||
inst.iqueue->queue("rewind-movie");
|
inst.iqueue->queue("rewind-movie");
|
||||||
return;
|
return;
|
||||||
case wxID_SAVE_MOVIE:
|
case wxID_SAVE_MOVIE:
|
||||||
filename2 = choose_file_save(this, "Save Movie", inst.project->moviepath(), filetype_movie,
|
filename2 = choose_file_save(this, "Save Movie", UI_get_project_moviepath(inst), filetype_movie,
|
||||||
project_prefixname(inst, "lsmv"));
|
project_prefixname(inst, "lsmv"));
|
||||||
recent_movies->add(filename2.second);
|
recent_movies->add(filename2.second);
|
||||||
inst.iqueue->queue("save-movie" + filename2.first + " " + filename2.second);
|
inst.iqueue->queue("save-movie" + filename2.first + " " + filename2.second);
|
||||||
return;
|
return;
|
||||||
case wxID_SAVE_SUBTITLES:
|
case wxID_SAVE_SUBTITLES:
|
||||||
inst.iqueue->queue("save-subtitle " + choose_file_save(this, "Save subtitles",
|
inst.iqueue->queue("save-subtitle " + choose_file_save(this, "Save subtitles",
|
||||||
inst.project->moviepath(), filetype_sub, project_prefixname(inst, "sub")));
|
UI_get_project_moviepath(inst), filetype_sub, project_prefixname(inst, "sub")));
|
||||||
return;
|
return;
|
||||||
case wxID_SAVE_STATE:
|
case wxID_SAVE_STATE:
|
||||||
filename2 = choose_file_save(this, "Save State", inst.project->moviepath(),
|
filename2 = choose_file_save(this, "Save State", UI_get_project_moviepath(inst),
|
||||||
filetype_savestate);
|
filetype_savestate);
|
||||||
recent_movies->add(filename2.second);
|
recent_movies->add(filename2.second);
|
||||||
inst.iqueue->queue("save-state" + filename2.first + " " + filename2.second);
|
inst.iqueue->queue("save-state" + filename2.first + " " + filename2.second);
|
||||||
return;
|
return;
|
||||||
case wxID_SAVE_SCREENSHOT:
|
case wxID_SAVE_SCREENSHOT:
|
||||||
inst.iqueue->queue("take-screenshot " + choose_file_save(this, "Save Screenshot",
|
inst.iqueue->queue("take-screenshot " + choose_file_save(this, "Save Screenshot",
|
||||||
inst.project->moviepath(), filetype_png, get_default_screenshot_name(inst)));
|
UI_get_project_moviepath(inst), filetype_png, get_default_screenshot_name(inst)));
|
||||||
return;
|
return;
|
||||||
case wxID_RUN_SCRIPT:
|
case wxID_RUN_SCRIPT:
|
||||||
inst.iqueue->queue("run-script " + pick_file_member(this, "Select Script",
|
inst.iqueue->queue("run-script " + pick_file_member(this, "Select Script",
|
||||||
inst.project->otherpath()));
|
UI_get_project_otherpath(inst)));
|
||||||
return;
|
return;
|
||||||
case wxID_RUN_LUA: {
|
case wxID_RUN_LUA: {
|
||||||
std::string f = choose_file_load(this, "Select Lua Script", inst.project->otherpath(),
|
std::string f = choose_file_load(this, "Select Lua Script", UI_get_project_otherpath(inst),
|
||||||
filetype_lua_script);
|
filetype_lua_script);
|
||||||
inst.iqueue->queue("run-lua " + f);
|
inst.iqueue->queue("run-lua " + f);
|
||||||
recent_scripts->add(f);
|
recent_scripts->add(f);
|
||||||
|
@ -1563,7 +1564,7 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
||||||
std::set<std::string> old_watches;
|
std::set<std::string> old_watches;
|
||||||
inst.iqueue->run([&old_watches]() { old_watches = CORE().mwatch->enumerate(); });
|
inst.iqueue->run([&old_watches]() { old_watches = CORE().mwatch->enumerate(); });
|
||||||
std::string filename = choose_file_save(this, "Save watches to file",
|
std::string filename = choose_file_save(this, "Save watches to file",
|
||||||
inst.project->otherpath(), filetype_watch);
|
UI_get_project_otherpath(inst), filetype_watch);
|
||||||
std::ofstream out(filename.c_str());
|
std::ofstream out(filename.c_str());
|
||||||
for(auto i : old_watches) {
|
for(auto i : old_watches) {
|
||||||
std::string val;
|
std::string val;
|
||||||
|
@ -1586,7 +1587,7 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
||||||
inst.iqueue->run([&old_watches]() { old_watches = CORE().mwatch->enumerate(); });
|
inst.iqueue->run([&old_watches]() { old_watches = CORE().mwatch->enumerate(); });
|
||||||
std::map<std::string, std::string> new_watches;
|
std::map<std::string, std::string> new_watches;
|
||||||
std::string filename = choose_file_load(this, "Choose memory watch file",
|
std::string filename = choose_file_load(this, "Choose memory watch file",
|
||||||
inst.project->otherpath(), filetype_watch);
|
UI_get_project_otherpath(inst), filetype_watch);
|
||||||
try {
|
try {
|
||||||
std::istream& in = zip::openrel(filename, "");
|
std::istream& in = zip::openrel(filename, "");
|
||||||
while(in) {
|
while(in) {
|
||||||
|
@ -1719,7 +1720,7 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
||||||
case wxID_LOAD_LIBRARY: {
|
case wxID_LOAD_LIBRARY: {
|
||||||
std::string name = std::string("load ") + loadlib::library::name();
|
std::string name = std::string("load ") + loadlib::library::name();
|
||||||
with_loaded_library(*new loadlib::module(loadlib::library(choose_file_load(this, name,
|
with_loaded_library(*new loadlib::module(loadlib::library(choose_file_load(this, name,
|
||||||
inst.project->otherpath(), single_type(loadlib::library::extension(),
|
UI_get_project_otherpath(inst), single_type(loadlib::library::extension(),
|
||||||
loadlib::library::name())))));
|
loadlib::library::name())))));
|
||||||
handle_post_loadlibrary();
|
handle_post_loadlibrary();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "core/memorymanip.hpp"
|
#include "core/memorymanip.hpp"
|
||||||
#include "core/memorywatch.hpp"
|
#include "core/memorywatch.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "library/hex.hpp"
|
#include "library/hex.hpp"
|
||||||
#include "library/string.hpp"
|
#include "library/string.hpp"
|
||||||
#include "library/memorysearch.hpp"
|
#include "library/memorysearch.hpp"
|
||||||
|
@ -824,7 +825,7 @@ void wxwindow_memorysearch::dump_candidates_text()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Dump memory search",
|
std::string filename = choose_file_save(this, "Dump memory search",
|
||||||
inst.project->otherpath(), filetype_textfile);
|
UI_get_project_otherpath(inst), filetype_textfile);
|
||||||
std::ofstream out(filename);
|
std::ofstream out(filename);
|
||||||
auto ms = msearch;
|
auto ms = msearch;
|
||||||
inst.iqueue->run([ms, this, &out]() {
|
inst.iqueue->run([ms, this, &out]() {
|
||||||
|
@ -853,7 +854,7 @@ void wxwindow_memorysearch::handle_save(memory_search::savestate_type type)
|
||||||
std::vector<char> state;
|
std::vector<char> state;
|
||||||
msearch->savestate(state, type);
|
msearch->savestate(state, type);
|
||||||
std::string filename = choose_file_save(this, "Save memory search",
|
std::string filename = choose_file_save(this, "Save memory search",
|
||||||
inst.project->otherpath(), filetype_memorysearch);
|
UI_get_project_otherpath(inst), filetype_memorysearch);
|
||||||
std::ofstream out(filename, std::ios::binary);
|
std::ofstream out(filename, std::ios::binary);
|
||||||
out.write(&state[0], state.size());
|
out.write(&state[0], state.size());
|
||||||
if(!out)
|
if(!out)
|
||||||
|
@ -869,7 +870,7 @@ void wxwindow_memorysearch::handle_load()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_load(this, "Load memory search",
|
std::string filename = choose_file_load(this, "Load memory search",
|
||||||
inst.project->otherpath(), filetype_memorysearch);
|
UI_get_project_otherpath(inst), filetype_memorysearch);
|
||||||
std::vector<char> state = zip::readrel(filename, "");
|
std::vector<char> state = zip::readrel(filename, "");
|
||||||
push_undo();
|
push_undo();
|
||||||
msearch->loadstate(state);
|
msearch->loadstate(state);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "core/instance.hpp"
|
#include "core/instance.hpp"
|
||||||
#include "core/window.hpp"
|
#include "core/window.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
|
|
||||||
#define MAXMESSAGES 20
|
#define MAXMESSAGES 20
|
||||||
#define PANELWIDTH 48
|
#define PANELWIDTH 48
|
||||||
|
@ -104,7 +105,7 @@ void wxwin_messages::panel::on_menu(wxCommandEvent& e)
|
||||||
case wxID_SAVE:
|
case wxID_SAVE:
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save messages to",
|
std::string filename = choose_file_save(this, "Save messages to",
|
||||||
inst.project->otherpath(), filetype_textfile);
|
UI_get_project_otherpath(inst), filetype_textfile);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
if(lines == 1) str += "\n";
|
if(lines == 1) str += "\n";
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "core/mainloop.hpp"
|
#include "core/mainloop.hpp"
|
||||||
#include "core/memorymanip.hpp"
|
#include "core/memorymanip.hpp"
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
#include "interface/disassembler.hpp"
|
#include "interface/disassembler.hpp"
|
||||||
#include "library/minmax.hpp"
|
#include "library/minmax.hpp"
|
||||||
#include "library/hex.hpp"
|
#include "library/hex.hpp"
|
||||||
|
@ -882,7 +883,7 @@ namespace
|
||||||
} else if(e.GetId() == wxID_SAVE) {
|
} else if(e.GetId() == wxID_SAVE) {
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save tracelog to",
|
std::string filename = choose_file_save(this, "Save tracelog to",
|
||||||
inst.project->otherpath(), filetype_trace);
|
UI_get_project_otherpath(inst), filetype_trace);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
for(auto& i : panel->rows)
|
for(auto& i : panel->rows)
|
||||||
|
@ -1006,7 +1007,7 @@ namespace
|
||||||
case wxID_SAVE:
|
case wxID_SAVE:
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save tracelog fragment to",
|
std::string filename = choose_file_save(this, "Save tracelog fragment to",
|
||||||
inst.project->otherpath(), filetype_trace);
|
UI_get_project_otherpath(inst), filetype_trace);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
if(lines == 1) str += "\n";
|
if(lines == 1) str += "\n";
|
||||||
|
@ -1045,7 +1046,7 @@ namespace
|
||||||
back:
|
back:
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save tracelog to",
|
std::string filename = choose_file_save(this, "Save tracelog to",
|
||||||
inst.project->otherpath(), filetype_trace);
|
UI_get_project_otherpath(inst), filetype_trace);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
for(auto& i : panel->rows)
|
for(auto& i : panel->rows)
|
||||||
|
@ -1306,7 +1307,7 @@ back:
|
||||||
} else if(e.GetId() == wxID_SAVE) {
|
} else if(e.GetId() == wxID_SAVE) {
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save disassembly to",
|
std::string filename = choose_file_save(this, "Save disassembly to",
|
||||||
inst.project->otherpath(), filetype_disassembly);
|
UI_get_project_otherpath(inst), filetype_disassembly);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
for(auto& i : panel->rows)
|
for(auto& i : panel->rows)
|
||||||
|
@ -1472,7 +1473,7 @@ back:
|
||||||
case wxID_SAVE:
|
case wxID_SAVE:
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save disassembly fragment to",
|
std::string filename = choose_file_save(this, "Save disassembly fragment to",
|
||||||
inst.project->otherpath(), filetype_disassembly);
|
UI_get_project_otherpath(inst), filetype_disassembly);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
if(lines == 1) str += "\n";
|
if(lines == 1) str += "\n";
|
||||||
|
@ -1704,7 +1705,7 @@ back:
|
||||||
back:
|
back:
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(this, "Save disassembly to",
|
std::string filename = choose_file_save(this, "Save disassembly to",
|
||||||
inst.project->otherpath(), filetype_disassembly);
|
UI_get_project_otherpath(inst), filetype_disassembly);
|
||||||
std::ofstream s(filename, std::ios::app);
|
std::ofstream s(filename, std::ios::app);
|
||||||
if(!s) throw std::runtime_error("Error opening output file");
|
if(!s) throw std::runtime_error("Error opening output file");
|
||||||
for(auto& i : panel->rows)
|
for(auto& i : panel->rows)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "core/project.hpp"
|
#include "core/project.hpp"
|
||||||
#include "core/moviedata.hpp"
|
#include "core/moviedata.hpp"
|
||||||
#include "core/rom.hpp"
|
#include "core/rom.hpp"
|
||||||
|
#include "core/ui-services.hpp"
|
||||||
|
|
||||||
|
|
||||||
tracelog_menu::tracelog_menu(wxWindow* win, emulator_instance& _inst, int wxid_low, int wxid_high)
|
tracelog_menu::tracelog_menu(wxWindow* win, emulator_instance& _inst, int wxid_low, int wxid_high)
|
||||||
|
@ -39,7 +40,7 @@ void tracelog_menu::on_select(wxCommandEvent& e)
|
||||||
if(ch) {
|
if(ch) {
|
||||||
try {
|
try {
|
||||||
std::string filename = choose_file_save(pwin, "Save " + cpunames[rid] + " Trace",
|
std::string filename = choose_file_save(pwin, "Save " + cpunames[rid] + " Trace",
|
||||||
inst.project->moviepath(), filetype_trace, "");
|
UI_get_project_moviepath(inst), filetype_trace, "");
|
||||||
inst.dbg->tracelog(rid, filename);
|
inst.dbg->tracelog(rid, filename);
|
||||||
} catch(canceled_exception& e) {
|
} catch(canceled_exception& e) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue