コード例 #1
0
ファイル: GraphicsSystem.cpp プロジェクト: weimingtom/rlvm
boost::shared_ptr<const Surface> GraphicsSystem::GetEmojiSurface() {
  GameexeFilteringIterator it = system().gameexe().filtering_begin("E_MOJI.");
  GameexeFilteringIterator end = system().gameexe().filtering_end();
  for (; it != end; ++it) {
    // Try to interpret each key as a filename.
    std::string file_name = it->to_string("");
    boost::shared_ptr<const Surface> surface = getSurfaceNamed(file_name);
    if (surface)
      return surface;
  }

  return boost::shared_ptr<const Surface>();
}
コード例 #2
0
ファイル: RLMachine.cpp プロジェクト: Morlok8k/rlvm
RLMachine::RLMachine(System& in_system, Archive& in_archive)
    : memory_(new Memory(*this, in_system.gameexe())),
      halted_(false),
      print_undefined_opcodes_(false),
      halt_on_exception_(true),
      archive_(in_archive),
      line_(0),
      system_(in_system),
      mark_savepoints_(true),
      delay_stack_modifications_(false),
      replaying_graphics_stack_(false) {
  // Search in the Gameexe for #SEEN_START and place us there
  Gameexe& gameexe = in_system.gameexe();
  libReallive::Scenario* scenario = NULL;
  if (gameexe.exists("SEEN_START")) {
    int first_seen = gameexe("SEEN_START").to_int();
    scenario = in_archive.scenario(first_seen);

    if (scenario == NULL)
      cerr << "WARNING: Invalid #SEEN_START in Gameexe" << endl;
  }

  if (scenario == NULL) {
    // if SEEN_START is undefined, then just grab the first SEEN.
    scenario = in_archive.scenario(archive_.begin()->first);
  }

  if (scenario == 0)
    throw rlvm::Exception("Invalid scenario file");
  pushStackFrame(StackFrame(scenario, scenario->begin(),
                            StackFrame::TYPE_ROOT));

  // Initial value of the savepoint
  markSavepoint();

  // Load the "DLLs" required
  GameexeFilteringIterator it = gameexe.filtering_begin("DLL.");
  GameexeFilteringIterator end = gameexe.filtering_end();
  for (; it != end; ++it) {
    string index_str = it->key().substr(it->key().find_first_of(".") + 1);
    int index = lexical_cast<int>(index_str);
    const string& name = it->to_string("");
    try {
      loadDLL(index, name);
    } catch(rlvm::Exception& e) {
      cerr << "WARNING: Don't know what to do with DLL '" << name << "'"
           << endl;
    }
  }
}
コード例 #3
0
ファイル: Memory.cpp プロジェクト: KitsuneFox89/rlvm
void Memory::initializeDefaultValues(Gameexe& gameexe) {
  // Note: We ignore the \#NAME_MAXLEN variable because manual allocation is
  // error prone and for losers.
  GameexeFilteringIterator end = gameexe.filtering_end();
  for (GameexeFilteringIterator it = gameexe.filtering_begin("NAME.");
      it != end; ++it) {
    try {
      setName(ConvertLetterIndexToInt(it->key_parts().at(1)),
              removeQuotes(it->to_string()));
    } catch(...) {
      cerr << "WARNING: Invalid format for key " << it->key() << endl;
    }
  }

  for (GameexeFilteringIterator it = gameexe.filtering_begin("LOCALNAME.");
      it != end; ++it) {
    try {
      setLocalName(ConvertLetterIndexToInt(it->key_parts().at(1)),
                   removeQuotes(it->to_string()));
    } catch(...) {
      cerr << "WARNING: Invalid format for key " << it->key() << endl;
    }
  }
}