##// END OF EJS Templates
Added bool loadfile(abstractBinFile* file)...
Added bool loadfile(abstractBinFile* file) and bool dumpMemory(unsigned int address, unsigned int count, QString file, const QString &format); to the genericPySysDriver, now all plugins can load an abstract binary file(bin/srec/elf) and they can dump any memory space to either an srec or a binary file. This function are able to deal with file and host endianness. Functions: -bool dumpMemory(unsigned int address,unsigned int count,QString file); -bool memSet(unsigned int address,int value, unsigned int count); -bool loadbin(unsigned int address,QString file); are moved to socexplorerplugin which makes them available from C++.

File last commit:

r71:c4b98d42ee59 default
r71:c4b98d42ee59 default
Show More
genericPySysdriver.cpp
75 lines | 1.8 KiB | text/x-c | CppLexer
#include <genericPySysdriver.h>
#include <socexplorerplugin.h>
#ifdef WIN32
#include <stdlib.h>
#define socexplorerBswap32(X) _byteswap_ulong(X)
#else
#ifdef UNIX
#include <byteswap.h>
#define socexplorerBswap32(X) bswap_32(X)
#endif
#endif
#include <socexplorerengine.h>
genericPySysdriver::genericPySysdriver(socexplorerplugin* plugin,QObject* parent):
QObject(parent)
{
Q_UNUSED(parent)
this->plugin = plugin;
}
QVariantList genericPySysdriver::Read(unsigned int address,unsigned int count)
{
unsigned int data[count];
QVariantList result;
this->plugin->Read(data,count,address);
for(unsigned int i = 0;i<count;i++)
{
result.append(QVariant((int)data[i]));
}
return result;
}
void genericPySysdriver::Write(unsigned int address,QList<QVariant> dataList)
{
unsigned int data[dataList.count()];
for(int i = 0;i<dataList.count();i++)
{
data[i] = (unsigned int)dataList.at(i).toUInt();
}
this->plugin->Write(data,dataList.count(),address);
}
bool genericPySysdriver::dumpMemory(unsigned int address,unsigned int count,QString file)
{
return this->plugin->dumpMemory(address,count,file);
}
bool genericPySysdriver::memSet(unsigned int address,int value, unsigned int count)
{
return this->plugin->memSet(address,value,count);
}
bool genericPySysdriver::loadbin(unsigned int address,QString file)
{
return this->plugin->loadbin(address,file);
}
bool genericPySysdriver::loadfile(abstractBinFile *file)
{
return this->plugin->loadfile(file);
}
bool genericPySysdriver::dumpMemory(unsigned int address, unsigned int count, QString file, const QString &format)
{
return this->plugin->dumpMemory(address,count,file,format);
}
QString genericPySysdriver::instance()
{
return plugin->instanceName();
}