Esempio n. 1
0
Settings::Settings() {
  root.append(activePath, "ActivePath");
  root.append(libraryPath, "LibraryPath");
  root.append(createManifests, "CreateManifests");
  root.append(useDatabase, "UseDatabase");
  root.append(useHeuristics, "UseHeuristics");
  append(root, "Settings");

  directory::create({configpath(), "icarus/"});
  load({configpath(), "icarus/settings.bml"});
  save({configpath(), "icarus/settings.bml"});

  if(!activePath) activePath = userpath();
  if(!libraryPath) libraryPath = {userpath(), "Emulation/"};
}
Esempio n. 2
0
ConfigurationManager::ConfigurationManager() {
  config = this;

  userInterface.append(userInterface.showStatusBar, "ShowStatusBar");
  append(userInterface, "UserInterface");

  library.append(library.location, "Location");
  append(library, "Library");

  video.append(video.driver, "Driver");
  video.append(video.synchronize, "Synchronize");
  video.append(video.scale, "Scale");
  video.append(video.aspectCorrection, "AspectCorrection");
  video.append(video.filter, "Filter");
  video.append(video.colorEmulation, "ColorEmulation");
  video.append(video.saturation, "Saturation");
  video.append(video.gamma, "Gamma");
  video.append(video.luminance, "Luminance");
  video.overscan.append(video.overscan.mask, "Mask");
  video.overscan.append(video.overscan.horizontal, "Horizontal");
  video.overscan.append(video.overscan.vertical, "Vertical");
  video.append(video.overscan, "Overscan");
  append(video, "Video");

  audio.append(audio.driver, "Driver");
  audio.append(audio.device, "Device");
  audio.append(audio.synchronize, "Synchronize");
  audio.append(audio.mute, "Mute");
  audio.append(audio.volume, "Volume");
  audio.append(audio.frequency, "Frequency");
  audio.append(audio.latency, "Latency");
  audio.append(audio.resampler, "Resampler");
  append(audio, "Audio");

  input.append(input.driver, "Driver");
  append(input, "Input");

  timing.append(timing.video, "Video");
  timing.append(timing.audio, "Audio");
  append(timing, "Timing");

  load(locate({configpath(), "tomoko/"}, "settings.bml"));
  if(!library.location) library.location = {userpath(), "Emulation/"};
  if(!video.driver) video.driver = ruby::Video::safestDriver();
  if(!audio.driver) audio.driver = ruby::Audio::safestDriver();
  if(!input.driver) input.driver = ruby::Input::safestDriver();
  save(locate({configpath(), "tomoko/"}, "settings.bml"));
}
Esempio n. 3
0
void Signaltypes::save_types()
{
	char cfg_path[MAX_PATH_LENGTH];
	bool success;
	QDomDocument document;

	// Creating xml-document part
	QDomElement root = document.createElement("Signaltypes");
	root.setAttribute("version", "0.0.1");

	for(unsigned i=0; i<types.size(); i++)
	{
		QDomNode type = document.importNode( types[i]->toQDom(), true );	// true : Import the whole tree.
		root.appendChild(type);
	}


	// Writing-to-file part
	configpath(cfg_path, "Signaltypes.xml");
	QFile file(cfg_path);
	success = file.open( QIODevice::WriteOnly | QIODevice::Text ); 
	if(not success) { QMessageBox::warning(parent->mainwindow, tr("Signaltypes"), tr("Cannot write file %1:\n%2.").arg(cfg_path).arg(file.errorString())); default_types(); return; }

	QTextStream stream( &file );
	
	stream << document.toString();

	file.close();
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNRepos_create
(JNIEnv *env, jobject jthis, jobject jpath, jboolean jdisableFsyncCommit,
 jboolean jkeepLog, jobject jconfigpath, jstring jfstype)
{
  JNIEntry(SVNRepos, create);
  SVNRepos *cl = SVNRepos::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }

  File path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  File configpath(jconfigpath);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder fstype(jfstype);
  if (JNIUtil::isExceptionThrown())
    return;

  cl->create(path, jdisableFsyncCommit? true : false, jkeepLog? true : false,
             configpath, fstype);
}
Esempio n. 5
0
QDomElement* Signaltypes::getRootElement()
{
	char cfg_path[MAX_PATH_LENGTH];
	QString errorStr;
	int	errorLine,
		errorColumn;
	QDomDocument document;
	bool	success;

	configpath(cfg_path, "Signaltypes.xml");
	QFile file(cfg_path);
	success = file.open(QFile::ReadOnly | QFile::Text);
	if(not success)
	{
		QMessageBox::warning(parent->mainwindow, tr("Signaltypes"), tr("Cannot read file %1:\n%2.").arg(cfg_path).arg(file.errorString()));
		default_types();
		return NULL;
	}

	success = document.setContent(&file, true, &errorStr, &errorLine, &errorColumn);

	if(not success)
	{
		QMessageBox::information(parent->mainwindow,
					tr("Signaltypes"),
					tr("Parse error at line %1, column %2:\n%3").arg(errorLine).arg(errorColumn).arg(errorStr));
		default_types();
		file.close();
		return NULL;
	}
	file.close();

	QDomElement *root = new QDomElement(document.documentElement());
	if( root->tagName() != "Signaltypes" )
	{
		QMessageBox::information(parent->mainwindow, tr("Signaltypes"), tr("%1 is not a Signaltypes.xml file.").arg(cfg_path) );
		default_types();
		delete root;
		return NULL;
	}

	else if( root->hasAttribute("version") && root->attribute("version") != "0.0.1" )
	{
		QMessageBox::information(parent->mainwindow, tr("Signaltypes"), tr("%1 is not Signaltypes.xml version 0.0.1 file.").arg(cfg_path) );
		default_types();
		delete root;
		return NULL;
	}
	return root;
}
Esempio n. 6
0
Settings::Settings() {
  Markup::Node::operator=(BML::unserialize(string::read(locate({configpath(), "icarus/"}, "settings.bml"))));

  auto set = [&](const string& name, const string& value) {
    //create node and set to default value only if it does not already exist
    if(!operator[](name)) operator()(name).setValue(value);
  };

  set("Library/Location", {userpath(), "Emulation/"});

  set("icarus/Path", userpath());
  set("icarus/CreateManifests", false);
  set("icarus/UseDatabase", true);
  set("icarus/UseHeuristics", true);
}
Esempio n. 7
0
string Ananke::openSufamiTurbo(vector<uint8_t> &buffer) {
  string sha256 = nall::sha256(buffer.data(), buffer.size());

  string databaseText = string::read({configpath(), "ananke/database/Sufami Turbo.bml"}).strip();
  if(databaseText.empty()) databaseText = string{Database::SufamiTurbo}.strip();
  lstring databaseItem = databaseText.split("\n\n");

  for(auto &item : databaseItem) {
    item.append("\n");
    auto document = Markup::Document(item);

    if(document["release/information/sha256"].text() == sha256) {
      return createSufamiTurboDatabase(buffer, document, item);
    }
  }

  return createSufamiTurboHeuristic(buffer);
}
Esempio n. 8
0
	void PTrackManager::InitTrack()
	{
		// Retrieve the load state from the file manager
		PTrackLoadState loadState = PFileManager::Get()->GetTrackLoadState();

		// If no config is set, then set to the first config in the directory
		if (!loadState.ConfigName().compare(NO_CONFIG_SET))
		{
			PFileManager* fManager = PFileManager::Get();
			std::vector<std::string> configs = fManager->DirectoriesInDirectory(std::string(fManager->GetCurrentDir()) + "tracks\\procedural\\");
			loadState.SetConfiguration(configs[0], "tracks/procedural/" + configs[0] + "/");
		}

		pOut("Track manager obtaining pointer to segment factory...\n");
		segFactory = PSegFactory::GetInstance(); // Obtain pointer to segment factory

		pOut("Initializing segment factory...\n");
		segFactory->SetChances(45.f, 65.f);

		// Set neccesary paths
		std::string modeldir("tracks/procedural/" + loadState.ConfigName() + "/");
		std::string texturedir("data/textures");

		pOut("Setting Track 3D Description Loader Options...\n");
		ssgLoaderOptions* lopts = new ssgLoaderOptions();
		lopts->setModelDir(modeldir.c_str());
		lopts->setTextureDir(texturedir.c_str());

		if (loadState.LoadType() == PLoadType::CONFIG) // Default TORCS Adaptive track initialization - initializes a configuration for a procedural track
		{
			pOut("Initialize procedural track configuration...\n");

			pOut("Setting track file path and file names...\n");
			std::string acname(loadState.ConfigName() + ".ac");
			std::string acpath("tracks/procedural/" + loadState.ConfigName() + "/");
			std::string configpath(acpath);
			std::string configname(loadState.ConfigFileName());

			// Initialize the procedural track.
			pOut("Initializing procedural track structure...\n");
			track = new PTrack(loadState.Length(), configpath, acpath, configname, acname, lopts);

			// Point the racemanager to the procedural track
			pOut("Setting racemanager track to procedural track...\n");
			raceManager->track = track->trk;

			previousSegType = track->GetEnd()->type;

			// Set track type
			trackType = PTrackType::PROCEDURAL;
		}
		else if (loadState.LoadType() == PLoadType::TRACK) // Initialization if a pre-generated track is to be loaded
		{
			// Read in the segments
			std::vector<PSeg> segs = PFileManager::Get()->ReadTrackSegments(loadState.TrackPath() + loadState.TrackFileName());

			// Construct paths and names
			std::string acname(loadState.TrackName() + ".ac");
			std::string acpath("tracks/procedural/" + loadState.ConfigName() + "/previousTracks/" + loadState.TrackName() + "/");
			std::string configpath("tracks/procedural/" + loadState.ConfigName() + "/");
			std::string configname(loadState.ConfigFileName());

			// Obtain track length
			void* handle = GfParmReadFile((loadState.TrackPath() + loadState.TrackFileName()).c_str(), GFPARM_RMODE_STD);
			tdble trkLength = GfParmGetNum(handle, P_TRK_SECT_HDR, P_TRK_ATT_LENGTH, (char*)nullptr, 1000);

			// Initialize the procedural track object
			track = new PTrack(segs, trkLength, configpath, acpath, configname, acname, lopts);

			// Add a finish line
			track->AddFinishLine();

			// Point the racemanager to the procedural track
			raceManager->track = track->trk;

			// Set the track's name
			raceManager->track->name = new char[loadState.TrackName().length()];
			strcpy((char*)raceManager->track->name, loadState.TrackName().c_str());
			strcpy(raceManager->track->internalname, loadState.TrackName().c_str());

			// Set track type
			trackType = PTrackType::PREGENERATED;
		}

		// Create a random previous corner type to start with
		int c = segFactory->CreateRandomCnr(0).type;
		if (c == TR_LFT)
			previousCornerType = PCornerType::CTLeft;
		else
			previousCornerType = PCornerType::CTRight;
	}
Esempio n. 9
0
string Utility::libraryPath() {
  string path = string::read({configpath(), "higan/library.bml"}).strip().ltrim<1>("Path: ").transform("\\", "/");
  if(path.empty()) path = {userpath(), "Emulation/"};
  if(path.endsWith("/") == false) path.append("/");
  return path;
}
Esempio n. 10
0
/**
 * openconf: load configuration file.
 *
 *	@param[in]	rootdir	Project root directory
 *
 * Globals used (output):
 *	confline:	 specified entry
 */
void
openconf(const char *rootdir)
{
	STRBUF *sb;

	if (opened)
		return;
	opened = 1;
	/*
	 * if config file not found then return default value.
	 */
	if (!(config_path = configpath(rootdir)))
		confline = check_strdup("");
	/*
	 * if it is not an absolute path then assumed config value itself.
	 */
	else if (!isabspath(config_path)) {
		confline = check_strdup(config_path);
		if (!locatestring(confline, ":", MATCH_FIRST))
			die("GTAGSCONF must be absolute path name.");
	}
	/*
	 * else load value from config file.
	 */
	else {
		if (test("d", config_path))
			die("config file '%s' is a directory.", config_path);
		if (!test("f", config_path))
			die("config file '%s' not found.", config_path);
		if (!test("r", config_path))
			die("config file '%s' is not readable.", config_path);
		if ((config_label = getenv("GTAGSLABEL")) == NULL)
			config_label = "default";
	
		if (!(fp = fopen(config_path, "r")))
			die("cannot open '%s'.", config_path);
		ib = strbuf_open(MAXBUFLEN);
		sb = strbuf_open(0);
		includelabel(fp, sb, config_label, 0);
		confline = check_strdup(strbuf_value(sb));
		strbuf_close(ib);
		strbuf_close(sb);
		fclose(fp);
	}
	/*
	 * make up required variables.
	 */
	sb = strbuf_open(0);
	strbuf_puts(sb, confline);
	strbuf_unputc(sb, ':');

	if (!getconfs("langmap", NULL)) {
		strbuf_puts(sb, ":langmap=");
		strbuf_puts(sb, quote_chars(DEFAULTLANGMAP, ':'));
	}
	if (!getconfs("skip", NULL)) {
		strbuf_puts(sb, ":skip=");
		strbuf_puts(sb, DEFAULTSKIP);
	}
	strbuf_unputc(sb, ':');
	strbuf_putc(sb, ':');
	confline = check_strdup(strbuf_value(sb));
	strbuf_close(sb);
	trim(confline);
	return;
}
Esempio n. 11
0
Settings::~Settings() {
  save({configpath(), "icarus/settings.bml"});
}
Esempio n. 12
0
AdvancedSettings::AdvancedSettings() {
  driverTitle.setFont(program->titleFont);
  driverTitle.setText("Driver Selection");
  videoLabel.setText("Video:");
  audioLabel.setText("Audio:");
  inputLabel.setText("Input:");
  libraryTitle.setFont(program->titleFont);
  libraryTitle.setText("Game Library Path");
  libraryLabel.setText("Path:");
  libraryPath.setEditable(false);
  string path = string::read({configpath(), "higan/library.bml"}).strip().ltrim<1>("Path: ").transform("\\", "/");
  if(path.empty()) path = {userpath(), "Emulation/"};
  if(path.endswith("/") == false) path.append("/");
  libraryPath.setText(path);
  libraryBrowse.setText("Browse ...");
  infoLabel.setFont(program->boldFont);
  infoLabel.setText({
    Emulator::Name, " v", Emulator::Version, "\n",
    "  ", Emulator::Profile, " Profile\n",
    "  Author: ", Emulator::Author, "\n",
    "  License: ", Emulator::License, "\n",
    "  Website: ", Emulator::Website
  });

  lstring list;

  list.split(";", video.availableDrivers());
  for(unsigned n = 0; n < list.size(); n++) {
    videoDriver.append(list[n]);
    if(list[n] == config->video.driver) videoDriver.setSelection(n);
  }

  list.split(";", audio.availableDrivers());
  for(unsigned n = 0; n < list.size(); n++) {
    audioDriver.append(list[n]);
    if(list[n] == config->audio.driver) audioDriver.setSelection(n);
  }

  list.split(";", input.availableDrivers());
  for(unsigned n = 0; n < list.size(); n++) {
    inputDriver.append(list[n]);
    if(list[n] == config->input.driver) inputDriver.setSelection(n);
  }

  append(driverTitle, {~0, 0}, 5);
  append(driverLayout, {~0, 0}, 15);
    driverLayout.append(videoLabel, {0, 0}, 5);
    driverLayout.append(videoDriver, {~0, 0}, 5);
    driverLayout.append(audioLabel, {0, 0}, 5);
    driverLayout.append(audioDriver, {~0, 0}, 5);
    driverLayout.append(inputLabel, {0, 0}, 5);
    driverLayout.append(inputDriver, {~0, 0});
  append(libraryTitle, {~0, 0}, 5);
  append(libraryLayout, {~0, 0}, 15);
    libraryLayout.append(libraryLabel, {0, 0}, 5);
    libraryLayout.append(libraryPath, {~0, 0}, 5);
    libraryLayout.append(libraryBrowse, {80, 0});
  if(Intrinsics::platform() != Intrinsics::Platform::OSX) {
    append(spacer, {~0, ~0});
    append(infoLabel, {~0, 0});
  }

  videoDriver.onChange = [&] { config->video.driver = videoDriver.text(); };
  audioDriver.onChange = [&] { config->audio.driver = audioDriver.text(); };
  inputDriver.onChange = [&] { config->input.driver = inputDriver.text(); };

  libraryBrowse.onActivate = [&] {
    string path = BrowserWindow().setParent(*settings).setPath(userpath()).directory();
    if(path.empty()) return;
    file::write({configpath(), "higan/library.bml"}, {"Path: ", path, "\n"});
    libraryPath.setText(path);
  };
}
Esempio n. 13
0
string Utility::libraryPath() {
  string path = string::read({configpath(), "dasShiny/library.cfg"}).strip().transform("\\", "/");
  if(path.empty()) path = {userpath(), "Emulation/Nintendo DS/"};
  if(!path.endswith("/")) path.append("/");
  return path;
}
Esempio n. 14
0
Settings::~Settings() {
  directory::create({configpath(), "icarus/"});
  file::write(locate({configpath(), "icarus/"}, "settings.bml"), BML::serialize(*this));
}