Exemple #1
0
bool Library::fileDump(QChar key, QList<QString> &keysList, QFlags<QIODevice::OpenModeFlag> openFlags) {
    QString path, val;
    QList<QString>::const_iterator cat_i = keysList.cbegin();
    QHash<QString, int> * res = catalogs -> value(key);

    path = libraryPath() + "cat_" + key;
    qDebug() << "SSave list "<< keysList;

    QFile f(path);
    if (f.open(openFlags)) {
        QTextStream out(&f);
        out.setCodec("UTF-8");

        while(cat_i != keysList.cend()) {
            val = *cat_i;
            qDebug() << "Curr val " << val;
            out << QString::number(res -> value(val)) << val.toUtf8() << "\n";
            cat_i++;
        }

        f.close();

        return true;
    }

    return false;
}
void WindowsInjector::attach(Q_PID processId) {
	wchar_t path[_MAX_PATH];
	const int pathLength = libraryPath().toWCharArray(path);
	path[pathLength] = 0;

    HMODULE library = ::LoadLibraryW(path);
    FARPROC hook = ::GetProcAddress(library, "hook_constructor");

	typedef void(*Installer)(HINSTANCE, DWORD);
	Installer installer = reinterpret_cast<Installer>(hook);
	(*installer)(library, processId->dwThreadId);
}
int LibraryPlugin::Start() {
    DB_functions_t* deadbeef = Deadbeef();
    deadbeef->conf_lock();
    string libraryPath(deadbeef->conf_get_str_fast("library.musicDirectory", ""));
    if (libraryPath == "")
    {
        libraryPath = string(getenv("HOME"));
    }
    deadbeef->conf_unlock();
    Library::Get(libraryPath);
    return 0;
}
Exemple #4
0
bool Phantom::injectJs(const QString &jsFilePath)
{
    QString pre = "";
    qDebug() << "Phantom - injectJs:" << jsFilePath;

    // If in Remote Webdriver Mode, we need to manipulate the PATH, to point it to a resource in `ghostdriver.qrc`
    if (webdriverMode()) {
        pre = ":/ghostdriver/";
        qDebug() << "Phantom - injectJs: prepending" << pre;
    }

    if (m_terminated)
        return false;

    return Utils::injectJsInFrame(pre + jsFilePath, libraryPath(), m_page->mainFrame());
}
Exemple #5
0
string Utility::importMedia(string pathname) {
  string container;
  
  if(file::exists(pathname) && file::size(pathname) <= 0x10000) {
    // Check if it's one of the system ROMs
    if(auto manifest = program->getUserResource("Nintendo DS.sys/manifest.bml")) {
      auto elem     = Markup::Document(vectorstream(manifest()).text());
      auto contents = file::read(pathname);
      auto hash     = sha256(contents.data(), contents.size());
      auto sysfolder = program->savePath("Nintendo DS.sys/");
      
      if(hash == elem["system/memory/arm9/sha256"].text()) {
        string dest = {sysfolder, elem["system/memory/arm9/data"].text()};
        file::write(dest, contents);
        return "<system>";
      }
      else if(hash == elem["system/memory/arm7/sha256"].text()) {
        string dest = {sysfolder, elem["system/memory/arm7/data"].text()};
        file::write(dest, contents);
        return "<system>";
      }
    }
  }
  
  if(!NintendoDS::validateHeader(filestream(pathname, file::mode::read))) {
    MessageWindow().setTitle("Import failed").setText(
      {"Couldn't import ",pathname,".\n"
       "\n"
       "This file doesn't look like a Nintendo DS title.\n"})
      .error();
    return "";
  }
  else if(!NintendoDS::importROMImage(container, libraryPath(), pathname)) {
    MessageWindow().setTitle("Import failed").setText(
      {"Couldn't import ",pathname,".\n"
       "\n"
       "Check to see if you've got sufficient permissions and disk space."})
      .error();
    return "";
  }
  return container;
}
Exemple #6
0
QHash<QString, int> * Library::load(const QChar letter) {
    QHash<QString, int> * res = new QHash<QString, int>();

    QString path = libraryPath() + "cat_" + letter;

    QFile f(path);
    if (f.open(QIODevice::ReadOnly)) {
        QByteArray ar;
        QString name;
        int state;

        while(!f.atEnd()) {
            ar = f.readLine();
            state = ar.mid(0, 1).toInt();
            name = QString::fromUtf8(ar.mid(1, ar.length() - 3));
            res -> insert(name, state);
        }

        f.close();
    }

    return res;
}
Exemple #7
0
bool Phantom::injectJs(const QString &jsFilePath) {
    return Utils::injectJsInFrame(jsFilePath, libraryPath(), m_page->mainFrame());
}