Some dumping improvements

- Add commandline commands to print dumper listings.
- Add option for lsnes-dumpavi to load shared objects.
This commit is contained in:
Ilari Liusvaara 2012-02-13 09:57:26 +02:00
parent 2ff46964a0
commit c72078e42c
4 changed files with 71 additions and 5 deletions

View file

@ -774,6 +774,14 @@ Set number of frames to dump.
Run specified lua script (lsnes-dumpavi does not have initialization files).
\end_layout
\begin_layout Subsubsection
--load-library=<library>
\end_layout
\begin_layout Standard
Load the specified shared object / dynamic library / dynamic link library.
\end_layout
\begin_layout Section
Startup file lsnes.rc
\end_layout
@ -1079,11 +1087,13 @@ INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
\begin_deeper
\begin_layout Itemize
Does not take mode.
Mode: uncompressed/pcm: Uncompressed video, PCM audio.
Takes prefix.
\end_layout
\begin_layout Itemize
Takes a prefix.
Mode: cscd/pcm: CSCD video, PCM audio.
Takes prefix.
\end_layout
\end_deeper
@ -1152,6 +1162,14 @@ end-dump <dumper>
End dumping using <dumper>
\end_layout
\begin_layout Subsubsection
show-dumpers [<dumper>]
\end_layout
\begin_layout Standard
Show the list of dumpers or list of modes for <dumper>
\end_layout
\begin_layout Subsection
Memory manipulation
\end_layout

View file

@ -340,6 +340,11 @@ Set number of frames to dump. Mandatory.
Run specified lua script (lsnes-dumpavi does not have
initialization files).
4.4.7 --load-library=<library>
Load the specified shared object / dynamic library / dynamic link
library.
5 Startup file lsnes.rc
Upon startup, lsnes (lsnes/SDL only) executes file lsnes.rc as
@ -498,9 +503,10 @@ The following dumpers are available:
• INTERNAL-AVI-CSCD: Internal CSCD in .avi dumper.
Does not take mode.
Mode: uncompressed/pcm: Uncompressed video, PCM audio. Takes
prefix.
Takes a prefix.
Mode: cscd/pcm: CSCD video, PCM audio. Takes prefix.
• INTERNAL-JMD: Internal .jmd dumper.
@ -532,6 +538,10 @@ The following dumpers are available:
End dumping using <dumper>
6.5.3 show-dumpers [<dumper>]
Show the list of dumpers or list of modes for <dumper>
6.6 Memory manipulation
<address> may be decimal or hexadecimal (prefixed with '0x').

View file

@ -46,6 +46,37 @@ namespace
throw std::runtime_error("Command syntax error");
d.end();
});
function_ptr_command<const std::string&> dumpersc("show-dumpers", "Show dumpers",
"Syntax: show-dumpers\nSyntax: show-dumpers <dumper>\nShow dumpers or dumper modes for <dumper>\n",
[](const std::string& x) throw(std::bad_alloc, std::runtime_error) {
auto a = adv_dumper::get_dumper_set();
if(x == "") {
for(auto i : a)
messages << i->id() << "\t" << i->name() << std::endl;
} else {
for(auto i : a) {
if(i->id() == x) {
//This dumper.
auto b = i->list_submodes();
if(b.empty()) {
messages << "No submodes for '" << x << "'" << std::endl;
return;
}
for(auto j : b) {
if(i->wants_prefix(j))
messages << "P " << x << "\t" << j << "\t"
<< i->modename(j) << std::endl;
else
messages << "F " << x << "\t" << j << "\t"
<< i->modename(j) << std::endl;
}
return;
}
}
messages << "No such dumper '" << x << "'" << std::endl;
}
});
}
const std::string& adv_dumper::id() throw()

View file

@ -7,6 +7,7 @@
#include "core/dispatch.hpp"
#include "core/framerate.hpp"
#include "core/keymapper.hpp"
#include "core/loadlib.hpp"
#include "lua/lua.hpp"
#include "core/mainloop.hpp"
#include "core/misc.hpp"
@ -146,7 +147,13 @@ namespace
<< std::endl;
exit(1);
}
}
} else if(a.length() >= 12 && a.substr(0, 15) == "--load-library=")
try {
load_library(a.substr(15));
} catch(std::runtime_error& e) {
std::cerr << "Can't load '" << a.substr(15) << "': " << e.what() << std::endl;
exit(1);
}
}
if(dumper == "list") {
//Help on dumpers.