Some progress with emulator and player instances
This commit is contained in:
parent
8196f8221b
commit
8644d25ee0
|
@ -77,6 +77,23 @@ const char *Mem_Writer::write( const void* p, long s )
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Dry_Writer for determining size
|
||||
|
||||
Dry_Writer::Dry_Writer()
|
||||
{
|
||||
size_ = 0;
|
||||
}
|
||||
|
||||
Dry_Writer::~Dry_Writer()
|
||||
{
|
||||
}
|
||||
|
||||
const char *Dry_Writer::write( const void* p, long s )
|
||||
{
|
||||
size_ += s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Auto_File_Reader
|
||||
|
||||
const char* Auto_File_Reader::open()
|
||||
|
|
|
@ -48,6 +48,25 @@ public:
|
|||
~Mem_Writer();
|
||||
};
|
||||
|
||||
// Dry writer to get the state size
|
||||
class Dry_Writer : public Data_Writer {
|
||||
long size_;
|
||||
public:
|
||||
// Keep all written data in expanding block of memory
|
||||
Dry_Writer();
|
||||
|
||||
const char *write( const void*, long );
|
||||
|
||||
// Pointer to beginning of written data
|
||||
char* data() { return NULL; }
|
||||
|
||||
// Number of bytes written
|
||||
long size() const { return size_; }
|
||||
|
||||
~Dry_Writer();
|
||||
};
|
||||
|
||||
|
||||
// Auto_File to use in place of Data_Reader&/Data_Writer&, allowing a normal
|
||||
// file path to be used in addition to a Data_Reader/Data_Writer.
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <cstdlib>
|
||||
#include "argparse.hpp"
|
||||
#include "utils.hpp"
|
||||
#include "core/emuInstance.hpp"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -8,11 +9,11 @@ int main(int argc, char *argv[])
|
|||
argparse::ArgumentParser program("player", "1.0");
|
||||
|
||||
program.add_argument("romFile")
|
||||
.help("path to the rom file to run.")
|
||||
.help("Path to the rom file to run.")
|
||||
.required();
|
||||
|
||||
program.add_argument("solutionFile")
|
||||
.help("path to the solution sequence file (.sol) to reproduce.")
|
||||
program.add_argument("sequenceFile")
|
||||
.help("Path to the input sequence file (.sol) to reproduce.")
|
||||
.required();
|
||||
|
||||
program.add_argument("stateFile")
|
||||
|
@ -32,5 +33,20 @@ int main(int argc, char *argv[])
|
|||
// Try to parse arguments
|
||||
try { program.parse_args(argc, argv); }
|
||||
catch (const std::runtime_error &err) { EXIT_WITH_ERROR("%s\n%s", err.what(), program.help().str().c_str()); }
|
||||
|
||||
// Getting ROM file path
|
||||
std::string romFilePath = program.get<std::string>("romFile");
|
||||
|
||||
// Getting sequence file path
|
||||
std::string sequenceFile = program.get<std::string>("sequenceFile");
|
||||
|
||||
// If initial state file is specified, load it
|
||||
std::string sequenceFile = program.get<std::string>("stateFile");
|
||||
|
||||
// Getting reproduce flag
|
||||
bool isReproduce = program.get<bool>("--reproduce");
|
||||
|
||||
// Getting reproduce flag
|
||||
bool disableRender = program.get<bool>("--disableRender");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue