Example #1
0
bool Object::load_nodes(TiXmlNode *node)
{
    int result = true;

    if (node->Type() == TiXmlNode::TINYXML_ELEMENT) {
        if (strcmp(node->Value(), "object") == 0) {
            result = load_object_attributes(node->ToElement());
        }
        else if (strcmp(node->Value(), "string") == 0) {
            load_strings(node->ToElement());
        }
        else {
            load_attributes(node->ToElement());
        }
    }

    for (TiXmlNode *child = node->FirstChild();
             child != 0;
             child = child->NextSibling()) {
        if (!load_nodes(child)) {
            result = false;
        }
    }

    return result;
}
Example #2
0
int elf32_syms(FILE *in)
{
	struct elf32_info info;
	Elf32_Shdr *s;
	int ret = 0;

	if (read_all(&info, in) < 0)
		return -1;

	s = find_shdr(&info, SHT_SYMTAB);
	if (!s) {
		printc_err("elf32: no symbol table\n");
		return -1;
	}

	if (s->sh_link <= 0 || s->sh_link >= info.file_ehdr.e_shnum) {
		printc_err("elf32: no string table\n");
		return -1;
	}

	if (load_strings(&info, in, &info.file_shdrs[s->sh_link]) < 0 ||
	    syms_load_syms(&info, in, s) < 0)
		ret = -1;

	if (info.string_tab)
		free(info.string_tab);

	return ret;
}
Example #3
0
int elf32_extract(FILE *in, binfile_imgcb_t cb, void *user_data)
{
	struct elf32_info info;
	int i;
	int ret = 0;

	if (read_all(&info, in) < 0)
		return -1;

	if (load_strings(&info, in,
			 &info.file_shdrs[info.file_ehdr.e_shstrndx]) < 0) {
		printc_err("elf32: warning: can't load section string "
			   "table\n");
		info.string_tab = NULL;
	}

	for (i = 0; i < info.file_ehdr.e_shnum; i++) {
		Elf32_Shdr *s = &info.file_shdrs[i];

		if (s->sh_type == SHT_PROGBITS && s->sh_flags & SHF_ALLOC &&
		    feed_section(&info, in, s, cb, user_data) < 0) {
			ret = -1;
			break;
		}
	}

	if (info.string_tab)
		free(info.string_tab);

	return ret;
}
Example #4
0
void check_or_vs_and(int id)
{
	my_id = id;

	unconstant_macros = create_function_hashtable(100);
	load_strings("unconstant_macros", unconstant_macros);

	add_hook(&match_logic, LOGIC_HOOK);
	add_hook(&match_condition, CONDITION_HOOK);
	if (option_spammy)
		add_hook(&match_binop, BINOP_HOOK);
}
Example #5
0
int main() {
    load_strings();
    interface_init();
    game_over = false;
    start_start_scene();
    update_scene = &update_start_scene;
    while (game_over == false) {
	int key = getch();
	update_scene(key);
    }
    interface_uninit();
    printf("Thanks for playing!\n");
}
Example #6
0
bool cutscene::load(const std::string& data_dir, int cut_num) {
    base_dir = data_dir;
    this->cut_num = cut_num;
    std::string n00_file(data_dir+"/cuts/cs"+to_octal3(cut_num)+".n00");
    std::string n01_file(data_dir+"/cuts/cs"+to_octal3(cut_num)+".n01");
    std::string font_file(data_dir+"/data/fontbig.sys");
    std::string strings_file(data_dir+"/data/strings.pak");
    if(!load_font(font_file)) return false;
    if(!load_n00(n00_file)) return false;
    if(!load_strings(strings_file, cut_num)) return false;
    //File may or may not exist; things like the "dream" cutscenes use .n01's that don't match the .n00, but they load them immediately with a command in the n00.
    load_lpf(n01_file);
    return true;
}
Example #7
0
void set_language(const language_def& locale)
{
	strings_.clear();

	std::string locale_lc;
	locale_lc.resize(locale.localename.size());
	std::transform(locale.localename.begin(),locale.localename.end(),locale_lc.begin(),tolower);

	current_language = locale;
	wesnoth_setlocale(LC_COLLATE, locale.localename, &locale.alternates);
	wesnoth_setlocale(LC_TIME, locale.localename, &locale.alternates);
	wesnoth_setlocale(LC_MESSAGES, locale.localename, &locale.alternates);

	load_strings(false);
}
Example #8
0
bool Object::load_nodes(TiXmlNode *node)
{
    int result = true;

    if (node->Type() == TiXmlNode::TINYXML_ELEMENT) {
        if (strcmp(node->Value(), "object") == 0) {
            result = load_object_attributes(node->ToElement());
        }
        else if (strcmp(node->Value(), "string") == 0) {
            load_strings(node->ToElement());
        }
        else if (strcmp(node->Value(), "weak_parts") == 0) {
            m_weak_parts.push_back(new CollisionParts(node->ToElement()));
        }
        else if (strcmp(node->Value(), "weak_part") == 0) {
            if (m_weak_parts.size()) {
                CollisionParts *parts = m_weak_parts.back();
                parts->add_parts(node->ToElement());
             }
        }
        else if (strcmp(node->Value(), "shielded_parts") == 0) {
            m_shielded_parts.push_back(new CollisionParts(node->ToElement()));
        }
        else if (strcmp(node->Value(), "shielded_part") == 0) {
            if (m_shielded_parts.size()) {
                CollisionParts *parts = m_shielded_parts.back();
                parts->add_parts(node->ToElement());
             }
        }
        else {
            load_attributes(node->ToElement());
        }
    }

    for (TiXmlNode *child = node->FirstChild();
             child != 0;
             child = child->NextSibling()) {
        if (!load_nodes(child)) {
            result = false;
        }
    }

    return result;
}
Example #9
0
/***********************************************************************
 *              process_attach
 */
static BOOL process_attach(void)
{
    SessionAttributeBits attributes;
    OSStatus status;

    status = SessionGetInfo(callerSecuritySession, NULL, &attributes);
    if (status != noErr || !(attributes & sessionHasGraphicAccess))
        return FALSE;

    setup_options();
    load_strings(macdrv_module);

    if ((thread_data_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;

    macdrv_err_on = ERR_ON(macdrv);
    if (macdrv_start_cocoa_app(GetTickCount64()))
    {
        ERR("Failed to start Cocoa app main loop\n");
        return FALSE;
    }

    return TRUE;
}