Ejemplo n.º 1
0
static nir_variable *
clone_variable(clone_state *state, const nir_variable *var)
{
    nir_variable *nvar = nir_variable_clone(var, state->ns);
    add_remap(state, nvar, var);

    return nvar;
}
Ejemplo n.º 2
0
  void parse_namestr(const char *name)
  {
    const char *ptr, *s;
    char buf[1024];
    bool hasName, hasFrame;

    hasName = hasFrame = false;

    for( s = ptr = name; *ptr; ptr++ ) {
      if( !hasName && *ptr == ':' ) {
        // model name
        hasName = true;
        strncpy( buf, s, ptr - s );
        buf[ptr - s] = '\0';
        m_name = buf;
        s = ptr + 1;
      } else if( *ptr == '?' ) {
        // model frame
        hasFrame = true;
        strncpy( buf, s, ptr - s );
        buf[ptr - s] = '\0';
        m_frame = atoi(buf);
        s = ptr + 1;
      } else if( *ptr == '&' ) {
        // a remap
        strncpy( buf, s, ptr - s );
        buf[ptr - s] = '\0';
        add_remap( buf );
        s = ptr + 1;
      }
    }

    if( !hasFrame ) {
      // model frame
      strncpy( buf, s, ptr - s );
      buf[ptr - s] = '\0';
      m_frame = atoi(buf);
    } else {
      // a remap
      strncpy( buf, s, ptr - s );
      buf[ptr - s] = '\0';
      add_remap( buf );
    }
  }
Ejemplo n.º 3
0
void PathRemap::load_remaps() {

	// default remaps first
	DVector<String> remaps = Globals::get_singleton()->get("remap/all");

	{
		int rlen = remaps.size();

		ERR_FAIL_COND( rlen%2 );
		DVector<String>::Read r = remaps.read();
		for(int i=0;i<rlen/2;i++) {

			String from = r[i*2+0];
			String to = r[i*2+1];
			add_remap(from,to);
		}
	}


	// platform remaps second, so override
	remaps = Globals::get_singleton()->get("remap/"+OS::get_singleton()->get_name());
//	remaps = Globals::get_singleton()->get("remap/PSP");
	{
		int rlen = remaps.size();

		ERR_FAIL_COND( rlen%2 );
		DVector<String>::Read r = remaps.read();
		for(int i=0;i<rlen/2;i++) {

			String from = r[i*2+0];
			String to = r[i*2+1];
//			print_line("add remap: "+from+" -> "+to);
			add_remap(from,to);
		}
	}


	//locale based remaps

	if (Globals::get_singleton()->has("locale/translation_remaps")) {

		Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
		List<Variant> rk;
		remaps.get_key_list(&rk);
		for(List<Variant>::Element *E=rk.front();E;E=E->next()) {

			String source = E->get();
			StringArray sa = remaps[E->get()];
			int sas = sa.size();
			StringArray::Read r = sa.read();

			for(int i=0;i<sas;i++) {

				String s = r[i];
				int qp = s.find_last(":");
				if (qp!=-1) {
					String path = s.substr(0,qp);
					String locale = s.substr(qp+1,s.length());
					add_remap(source,path,locale);
				}
			}
		}

	}

}