Exemplo n.º 1
0
static void client_read_trooper(const remote_process_client *client, struct ct_trooper *trooper) {
    if (!READ_BOOL()) {
        exit(10006);
    }
    memset(trooper, 0xCC, sizeof(*trooper));

    trooper->id = READ_INT64();
    trooper->position.x = READ_INT32();
    trooper->position.y = READ_INT32();
    trooper->player_id = READ_INT64();
    trooper->teammate_index = READ_INT32();
    trooper->is_teammate = READ_BOOL();
    trooper->type = READ_ENUM(ct_trooper_type);
    trooper->stance = READ_ENUM(ct_trooper_stance);
    trooper->hitpoints = READ_INT32();
    trooper->max_hitpoints = READ_INT32();
    trooper->action_points = READ_INT32();
    trooper->initial_action_points = READ_INT32();
    trooper->vision_range = READ_DOUBLE();
    trooper->shooting_range = READ_DOUBLE();
    trooper->shoot_cost = READ_INT32();
    trooper->standing_damage = READ_INT32();
    trooper->kneeling_damage = READ_INT32();
    trooper->prone_damage = READ_INT32();
    trooper->damage = READ_INT32();
    trooper->is_holding_grenade = READ_BOOL();
    trooper->is_holding_medkit = READ_BOOL();
    trooper->is_holding_field_ration = READ_BOOL();
}
Exemplo n.º 2
0
        skeleton::skeleton(std::istream & stream_, const uint32_t lod_count) : size(0) {
            READ_STRING(name);
            if (name.length() > 1) {
                READ_BOOL(inherited);
                stream_.read((char *)&size, sizeof(uint32_t));
                
                for (int x = 0; x < size; x++) {
                    std::string _name, _parent;

                    READ_STRING(_name);
                    READ_STRING(_parent);

                    all_bones.push_back(std::make_shared<bone>(_name, _parent));
                }

                for (auto& tbone : all_bones) {
                    for (auto& child : all_bones) {
                        if (child->parent == tbone->name) {
                            tbone->children.push_back(child->name);
                        }
                    }

                    if (tbone->parent.length() < 1) {
                        root_bones[tbone->name] = tbone;
                    }
                }

                // Skip a byte because!
                //stream_.seekg(1, stream_.cur);
                LOG(DEBUG) << "Skeleton loaded: " << name;
                char junk;
                stream_.read((char *)&junk, sizeof(uint8_t));
            }

        }
Exemplo n.º 3
0
static void client_read_world(remote_process_client *client, struct ct_mutable_world *world) {
    if (!READ_BOOL()) {
        exit(10002);
    }

    memset(world, 0xCC, sizeof(*world));

    world->move_index = READ_INT32();
    world->width = READ_INT32();
    world->height = READ_INT32();

    /* Will return error if the map sizes are bigger than we expect */
    if (world->width > MAP_WIDTH_ALIGNED) {
        exit(10007);
    }
    if (world->height > MAP_HEIGHT) {
        exit(10008);
    }

    client_read_players(client, world);
    client_read_troopers(client, world);
    client_read_bonuses(client, world);

    client_read_cells(client, world);
    client_read_cell_visibilities(client, world);
}
Exemplo n.º 4
0
bool CSetItemTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sSET_ITEM_TBLDAT* pSetItem = (sSET_ITEM_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			pSetItem->tblidx = READ_DWORD( bstrData );
		}
		else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") )
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
			pSetItem->bValidity_Able = READ_BOOL( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Semi_Set_Option"))
		{
			pSetItem->semiSetOption = READ_DWORD( bstrData );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Full_Set_Option"))
		{
			pSetItem->fullSetOption = READ_DWORD( bstrData );
		}
		else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Item_Tblidx_", wcslen(L"Item_Tblidx_") ) )
		{
			bool bFound = false;

			WCHAR szBuffer[1024] = { 0x00, };
			for( int i = 0; i < NTL_MAX_SET_ITEM_COUNT; i++ )
			{
				swprintf( szBuffer, 1024, L"Item_Tblidx_%d", i + 1 );

				if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) )
				{
					pSetItem->aItemTblidx[ i ] = READ_DWORD( bstrData );

					bFound = true;
					break;
				}
			}

			if( false == bFound )
			{
				CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
				return false;
			}
		}
		else
		{
			CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		return false;
	}

	return true;
}
Exemplo n.º 5
0
 stage_texture::stage_texture(std::istream &stream_, uint32_t type_) {
     stream_.read((char *)&filter, sizeof(uint32_t));
     READ_STRING(file);
     stream_.read((char *)&transform_id, sizeof(uint32_t));
     if (type_ == 11) {
         READ_BOOL(wtf);
     }
 }
Exemplo n.º 6
0
static void options_load_color_profiles(GQParserData *parser_data, GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error)
{
	while (*attribute_names)
		{
		const gchar *option = *attribute_names++;
		const gchar *value = *attribute_values++;

		if (READ_BOOL(options->color_profile, enabled)) continue;
		if (READ_BOOL(options->color_profile, use_image)) continue;
		if (READ_INT(options->color_profile, input_type)) continue;
		if (READ_CHAR(options->color_profile, screen_file)) continue;
		if (READ_BOOL(options->color_profile, use_x11_screen_profile)) continue;

		log_printf("unknown attribute %s = %s\n", option, value);
		}

}
Exemplo n.º 7
0
bool CChatCommandTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sCHAT_COMMAND_TBLDAT* pChatCommand = (sCHAT_COMMAND_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
			pChatCommand->tblidx = READ_DWORD(bstrData);
		}
		else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") )
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
			pChatCommand->bValidity_Able = READ_BOOL(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Animation_Index"))
		{
			pChatCommand->wAction_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str());
		}
		else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Chat_Command_", wcslen(L"Chat_Command_") ) )
		{
			bool bFound = false;
			WCHAR szBuffer[1024] = { 0x00, };
			for( int i = 0; i < NTL_MAX_CHAT_COMMAND; i++ )
			{
				swprintf( szBuffer, 1024, L"Chat_Command_%d", i + 1 );

				if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) )
				{
					if ( 0 == i )
						CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
					pChatCommand->aChat_Command[ i ] = READ_DWORD( bstrData);

					bFound = true;
					break;
				}
			}
			if( false == bFound )
			{
				CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
				return false;
			}
		}
		else
		{
			CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		_ASSERT(0);
		return false;
	}

	return true;
}
Exemplo n.º 8
0
bool CGuideHintTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sGUIDE_HINT_TBLDAT* pGuide = (sGUIDE_HINT_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			pGuide->tblidx = READ_DWORD( bstrData );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Type"))
		{
			pGuide->byType = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"WidthPosition"))
		{
			pGuide->byWidthPosition = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"HeightPosition"))
		{
			pGuide->byHeightPosition = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"WidthSize"))
		{
			pGuide->wWidthSize = READ_WORD( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"HeightSize"))
		{
			pGuide->wHeightSize = READ_WORD( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Resource"))
		{
			READ_STRING(bstrData, pGuide->szResource, _countof(pGuide->szResource));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Note"))
		{
			READ_STRING(bstrData, pGuide->szNote, _countof(pGuide->szNote));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Auto_Show"))
		{
			pGuide->bAutoShow = READ_BOOL( bstrData, pstrDataName->c_str() );
		}
		else
		{
			CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		return false;
	}

	return true;
}
Exemplo n.º 9
0
int client_read_player_context(remote_process_client *client, struct ct_player_context *context) {
    enum ct_message_type message_type = READ_ENUM(ct_message_type);
    if (MSG_GAME_OVER == message_type) {
        return -1;
    }
    VERIFY(message_type, MSG_PLAYER_CONTEXT);
    if (!READ_BOOL()) {
        return -1;
    }
    client_read_trooper(client, &context->trooper);
    client_read_world(client, &context->world);
    return 0;
}
Exemplo n.º 10
0
static AnimNode::Pointer loadPoleVectorConstraintNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) {
    READ_VEC3(referenceVector, jsonObj, id, jsonUrl, nullptr);
    READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(midJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(poleVectorVar, jsonObj, id, jsonUrl, nullptr);

    auto node = std::make_shared<AnimPoleVectorConstraint>(id, enabled, referenceVector,
                                                           baseJointName, midJointName, tipJointName,
                                                           enabledVar, poleVectorVar);
    return node;
}
Exemplo n.º 11
0
static void client_read_players(const remote_process_client *client, struct ct_mutable_world *world) {
    int players_count = READ_INT32();
    int i;
    world->players_count = players_count;
    if (players_count < 0) {
        exit(10003);
    }

    world->players = (struct ct_player*)malloc(players_count * sizeof(struct ct_player));
    memset(world->players, 0xCC, players_count * sizeof(struct ct_player));

    for (i = 0; i < players_count; ++i) {
        struct ct_player *player = &world->players[i];
        if (!READ_BOOL()) {
            exit(10004);
        }
        player->id = READ_INT64();
        player->name = READ_STRING();
        player->score = READ_INT32();
        player->strategy_crashed = READ_BOOL();
        player->approximate_position.x = READ_INT32();
        player->approximate_position.y = READ_INT32();
    }
}
Exemplo n.º 12
0
        named_selection::named_selection(std::istream &stream_, uint32_t version = 68) {
            uint32_t count;
            uint32_t junk;

            READ_STRING(name);

            faces = compressed<uint16_t>(stream_, true, false, version);

            //face_weights = compressed<uint32_t>(stream_, true, false, version); // Face weights
            face_weights = compressed<uint32_t>(stream_, true, false, version);
            READ_BOOL(is_sectional);

            sections = compressed<uint32_t>(stream_, true, false, version);
            vertex_table = compressed<uint16_t>(stream_, true, false, version);
            texture_weights = compressed<uint8_t>(stream_, true, false, version);

            //stream_.read((char *)&junk, 4);
        }
Exemplo n.º 13
0
static AnimNode::Pointer loadTwoBoneIKNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) {
    READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr);
    READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr);
    READ_FLOAT(interpDuration, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(midJointName, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr);
    READ_VEC3(midHingeAxis, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(alphaVar, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr);
    READ_STRING(endEffectorPositionVarVar, jsonObj, id, jsonUrl, nullptr);

    auto node = std::make_shared<AnimTwoBoneIK>(id, alpha, enabled, interpDuration,
                                                baseJointName, midJointName, tipJointName, midHingeAxis,
                                                alphaVar, enabledVar,
                                                endEffectorRotationVarVar, endEffectorPositionVarVar);
    return node;
}
Exemplo n.º 14
0
void client_read_game_context(const remote_process_client *client, struct ct_game *game) {
    VERIFY(READ_ENUM(ct_message_type), MSG_GAME_CONTEXT);
    if (!READ_BOOL()) {
        exit(10017);
    }

    memset(game, 0xCC, sizeof(struct ct_game));
    game->move_count = READ_INT32();
    game->last_player_elimination_score = READ_INT32();
    game->player_elimination_score = READ_INT32();
    game->trooper_elimination_score = READ_INT32();
    game->trooper_damage_score_factor = READ_DOUBLE();
    game->stance_change_cost = READ_INT32();
    game->standing_move_cost = READ_INT32();
    game->kneeling_move_cost = READ_INT32();
    game->prone_move_cost = READ_INT32();
    game->commander_aura_bonus_action_points = READ_INT32();
    game->commander_aura_range = READ_DOUBLE();
    game->commander_request_enemy_disposition_cost = READ_INT32();
    game->commander_request_enemy_disposition_max_offset = READ_INT32();
    game->field_medic_heal_cost = READ_INT32();
    game->field_medic_heal_bonus_hitpoints = READ_INT32();
    game->field_medic_heal_self_bonus_hitpoints = READ_INT32();
    game->sniper_standing_stealth_bonus = READ_DOUBLE();
    game->sniper_kneeling_stealth_bonus = READ_DOUBLE();
    game->sniper_prone_stealth_bonus = READ_DOUBLE();
    game->sniper_standing_shooting_range_bonus = READ_DOUBLE();
    game->sniper_kneeling_shooting_range_bonus = READ_DOUBLE();
    game->sniper_prone_shooting_range_bonus = READ_DOUBLE();
    game->scout_stealth_bonus_negation = READ_DOUBLE();
    game->grenade_throw_cost = READ_INT32();
    game->grenade_throw_range = READ_DOUBLE();
    game->grenade_direct_damage = READ_INT32();
    game->grenade_collateral_damage = READ_INT32();
    game->medikit_use_cost = READ_INT32();
    game->medikit_bonus_hitpoints = READ_INT32();
    game->medikit_heal_self_bonus_hitpoints = READ_INT32();
    game->field_ration_eat_cost = READ_INT32();
    game->field_ration_bonus_action_points = READ_INT32();
}
Exemplo n.º 15
0
static AnimNode::Pointer loadClipNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) {

    READ_STRING(url, jsonObj, id, jsonUrl, nullptr);
    READ_FLOAT(startFrame, jsonObj, id, jsonUrl, nullptr);
    READ_FLOAT(endFrame, jsonObj, id, jsonUrl, nullptr);
    READ_FLOAT(timeScale, jsonObj, id, jsonUrl, nullptr);
    READ_BOOL(loopFlag, jsonObj, id, jsonUrl, nullptr);
    READ_OPTIONAL_BOOL(mirrorFlag, jsonObj, false);

    READ_OPTIONAL_STRING(startFrameVar, jsonObj);
    READ_OPTIONAL_STRING(endFrameVar, jsonObj);
    READ_OPTIONAL_STRING(timeScaleVar, jsonObj);
    READ_OPTIONAL_STRING(loopFlagVar, jsonObj);
    READ_OPTIONAL_STRING(mirrorFlagVar, jsonObj);

    // animation urls can be relative to the containing url document.
    auto tempUrl = QUrl(url);
    tempUrl = jsonUrl.resolved(tempUrl);

    auto node = std::make_shared<AnimClip>(id, tempUrl.toString(), startFrame, endFrame, timeScale, loopFlag, mirrorFlag);

    if (!startFrameVar.isEmpty()) {
        node->setStartFrameVar(startFrameVar);
    }
    if (!endFrameVar.isEmpty()) {
        node->setEndFrameVar(endFrameVar);
    }
    if (!timeScaleVar.isEmpty()) {
        node->setTimeScaleVar(timeScaleVar);
    }
    if (!loopFlagVar.isEmpty()) {
        node->setLoopFlagVar(loopFlagVar);
    }
    if (!mirrorFlagVar.isEmpty()) {
        node->setMirrorFlagVar(mirrorFlagVar);
    }

    return node;
}
Exemplo n.º 16
0
static void client_read_bonuses(const remote_process_client *client, struct ct_mutable_world *world) {
    int i;
    int bonuses_count = READ_INT32();
    world->bonuses_count = bonuses_count;

    if (bonuses_count < 0) {
        exit(10009);
    }

    world->bonuses = (struct ct_bonus*)malloc(bonuses_count * sizeof(struct ct_bonus));
    memset(world->bonuses, 0xCC, bonuses_count * sizeof(struct ct_bonus));

    for (i = 0; i < bonuses_count; ++i) {
        struct ct_bonus *bonus = &world->bonuses[i];
        if (!READ_BOOL()) {
            exit(10010);
        }
        bonus->id = READ_INT64();
        bonus->position.x = READ_INT32();
        bonus->position.y = READ_INT32();
        bonus->type = READ_ENUM(ct_bonus_type);
    }
}
Exemplo n.º 17
0
bool ReadPPS(BitArray &ba, Variant &v) {
	//7.3.2.2 Picture parameter set RBSP syntax
	//14496-10.pdf 44/280
	READ_EG("pic_parameter_set_id", uint64_t);
	READ_EG("seq_parameter_set_id", uint64_t);
	READ_BOOL("entropy_coding_mode_flag");
	READ_BOOL("pic_order_present_flag");
	READ_EG("num_slice_groups_minus1", int64_t);
	if ((int64_t) v["num_slice_groups_minus1"] > 0) {
		READ_EG("slice_group_map_type", uint64_t);
		if ((int64_t) v["slice_group_map_type"] == 0) {
			for (int64_t i = 0; i < (int64_t) v["num_slice_groups_minus1"]; i++) {
				uint64_t val = 0;
				if (!ba.ReadExpGolomb(val)) {
					FATAL("Unable to read run_length_minus1 value");
					return false;
				}
				v["run_length_minus1"].PushToArray(val);
			}
		} else if ((int64_t) v["slice_group_map_type"] == 2) {
			for (int64_t i = 0; i < (int64_t) v["num_slice_groups_minus1"]; i++) {
				uint64_t val = 0;
				if (!ba.ReadExpGolomb(val)) {
					FATAL("Unable to read top_left value");
					return false;
				}
				v["top_left"].PushToArray(val);

				if (!ba.ReadExpGolomb(val)) {
					FATAL("Unable to read bottom_right value");
					return false;
				}
				v["bottom_right"].PushToArray(val);
			}
		} else if (((int64_t) v["slice_group_map_type"] == 3)
				|| ((int64_t) v["slice_group_map_type"] == 4)
				|| ((int64_t) v["slice_group_map_type"] == 5)) {
			READ_BOOL("slice_group_change_direction_flag");
			READ_EG("slice_group_change_rate_minus1", uint64_t);
		} else if ((int64_t) v["slice_group_map_type"] == 6) {
			READ_EG("pic_size_in_map_units_minus1", uint64_t);
			for (uint64_t i = 0; i <= (uint64_t) v["pic_size_in_map_units_minus1"]; i++) {
				uint64_t val = 0;
				if (!ba.ReadExpGolomb(val)) {
					FATAL("Unable to read slice_group_id value");
					return false;
				}
				v["slice_group_id"].PushToArray((int64_t) val);
			}
		}
	}
	READ_EG("num_ref_idx_l0_active_minus1", uint64_t);
	READ_EG("num_ref_idx_l1_active_minus1", uint64_t);
	READ_BOOL("weighted_pred_flag");
	READ_INT("weighted_bipred_idc", uint8_t, 2);
	READ_EG("pic_init_qp_minus26", int64_t);
	READ_EG("pic_init_qs_minus26", int64_t);
	READ_EG("chroma_qp_index_offset", int64_t);
	READ_BOOL("deblocking_filter_control_present_flag");
	READ_BOOL("constrained_intra_pred_flag");
	READ_BOOL("redundant_pic_cnt_present_flag");
	return true;
}
Exemplo n.º 18
0
bool ReadSPS(BitArray &ba, Variant &v) {
	//7.3.2.1 Sequence parameter set RBSP syntax
	//14496-10.pdf 43/280
	READ_INT("profile_idc", uint8_t, 8);
	READ_BOOL("constraint_set0_flag");
	READ_BOOL("constraint_set1_flag");
	READ_BOOL("constraint_set2_flag");
	READ_INT("reserved_zero_5bits", uint8_t, 5);
	READ_INT("level_idc", uint8_t, 8);
	READ_EG("seq_parameter_set_id", uint64_t);
	if ((uint64_t) v["profile_idc"] >= 100) {
		READ_EG("chroma_format_idc", uint64_t);
		if ((uint64_t) v["chroma_format_idc"] == 3)
			READ_BOOL("residual_colour_transform_flag");
		READ_EG("bit_depth_luma_minus8", uint64_t);
		READ_EG("bit_depth_chroma_minus8", uint64_t);
		READ_BOOL("qpprime_y_zero_transform_bypass_flag");
		READ_BOOL("seq_scaling_matrix_present_flag");
		if ((bool)v["seq_scaling_matrix_present_flag"]) {
			for (uint8_t i = 0; i < 8; i++) {
				uint8_t flag = 0;
				CHECK_BA_LIMITS("seq_scaling_list_present_flag", 1);
				flag = ba.ReadBits<uint8_t > (1);
				if (flag) {
					if (i < 6) {
						if (!scaling_list(ba, 16)) {
							FATAL("scaling_list failed");
							return false;
						}
					} else {
						if (!scaling_list(ba, 64)) {
							FATAL("scaling_list failed");
							return false;
						}
					}
				}
			}
		}
	}
	READ_EG("log2_max_frame_num_minus4", uint64_t);
	READ_EG("pic_order_cnt_type", uint64_t);
	if ((uint64_t) v["pic_order_cnt_type"] == 0) {
		READ_EG("log2_max_pic_order_cnt_lsb_minus4", uint64_t);
	} else if ((uint64_t) v["pic_order_cnt_type"] == 1) {
		READ_BOOL("delta_pic_order_always_zero_flag");
		READ_EG("offset_for_non_ref_pic", int64_t);
		READ_EG("offset_for_top_to_bottom_field", int64_t);
		READ_EG("num_ref_frames_in_pic_order_cnt_cycle", uint64_t);
		for (uint64_t i = 0; i < (uint64_t) v["num_ref_frames_in_pic_order_cnt_cycle"]; i++) {
			uint64_t val = 0;
			if (!ba.ReadExpGolomb(val)) {
				FATAL("Unable to read offset_for_ref_frame value");
				return false;
			}
			v["offset_for_ref_frame"].PushToArray((int64_t) val);
		}
	}
	READ_EG("num_ref_frames", uint64_t);
	READ_BOOL("gaps_in_frame_num_value_allowed_flag");
	READ_EG("pic_width_in_mbs_minus1", uint64_t);
	READ_EG("pic_height_in_map_units_minus1", uint64_t);
	READ_BOOL("frame_mbs_only_flag");
	if (!((bool)v["frame_mbs_only_flag"]))
		READ_BOOL("mb_adaptive_frame_field_flag");
	READ_BOOL("direct_8x8_inference_flag");
	READ_BOOL("frame_cropping_flag");
	if ((bool)v["frame_cropping_flag"]) {
		READ_EG("frame_crop_left_offset", uint64_t);
		READ_EG("frame_crop_right_offset", uint64_t);
		READ_EG("frame_crop_top_offset", uint64_t);
		READ_EG("frame_crop_bottom_offset", uint64_t);
	}
	READ_BOOL("vui_parameters_present_flag");
	if ((bool)v["vui_parameters_present_flag"]) {
		if (!ReadSPSVUI(ba, v["vui_parameters"])) {
			FATAL("Unable to read VUI");
			return false;
		}
	}
	return true;
}
Exemplo n.º 19
0
bool ReadSPSVUI(BitArray &ba, Variant &v) {
	//E.1.1 VUI parameters syntax
	//14496-10.pdf 267/280
	READ_BOOL("aspect_ratio_info_present_flag");
	if ((bool)v["aspect_ratio_info_present_flag"]) {
		READ_INT("aspect_ratio_idc", uint8_t, 8);
		if ((uint8_t) v["aspect_ratio_idc"] == 255) {
			READ_INT("sar_width", uint16_t, 16);
			READ_INT("sar_height", uint16_t, 16);
		}
	}
	READ_BOOL("overscan_info_present_flag");
	if ((bool)v["overscan_info_present_flag"])
		READ_BOOL("overscan_appropriate_flag");
	READ_BOOL("video_signal_type_present_flag");
	if ((bool)v["video_signal_type_present_flag"]) {
		READ_INT("video_format", uint8_t, 3);
		READ_BOOL("video_full_range_flag");
		READ_BOOL("colour_description_present_flag");
		if ((bool)v["colour_description_present_flag"]) {
			READ_INT("colour_primaries", uint8_t, 8);
			READ_INT("transfer_characteristics", uint8_t, 8);
			READ_INT("matrix_coefficients", uint8_t, 8);
		}
	}
	READ_BOOL("chroma_loc_info_present_flag");
	if ((bool)v["chroma_loc_info_present_flag"]) {
		READ_EG("chroma_sample_loc_type_top_field", uint64_t);
		READ_EG("chroma_sample_loc_type_bottom_field", uint64_t);
	}
	READ_BOOL("timing_info_present_flag");
	if ((bool)v["timing_info_present_flag"]) {
		READ_INT("num_units_in_tick", uint32_t, 32);
		READ_INT("time_scale", uint32_t, 32);
		READ_BOOL("fixed_frame_rate_flag");
	}
	READ_BOOL("nal_hrd_parameters_present_flag");
	if ((bool)v["nal_hrd_parameters_present_flag"]) {
		if (!ReadSPSVUIHRD(ba, v["nal_hrd"])) {
			FATAL("Unable to read VUIHRD");
			return false;
		}
	}
	READ_BOOL("vcl_hrd_parameters_present_flag");
	if ((bool)v["vcl_hrd_parameters_present_flag"]) {
		if (!ReadSPSVUIHRD(ba, v["vcl_hrd"])) {
			FATAL("Unable to read VUIHRD");
			return false;
		}
	}
	if (((bool)v["nal_hrd_parameters_present_flag"])
			|| ((bool)v["vcl_hrd_parameters_present_flag"]))
		READ_BOOL("low_delay_hrd_flag");
	READ_BOOL("pic_struct_present_flag");
	READ_BOOL("bitstream_restriction_flag");
	if ((bool)v["bitstream_restriction_flag"]) {
		READ_BOOL("motion_vectors_over_pic_boundaries_flag");
		READ_EG("max_bytes_per_pic_denom", uint64_t);
		READ_EG("max_bits_per_mb_denom", uint64_t);
		READ_EG("log2_max_mv_length_horizontal", uint64_t);
		READ_EG("log2_max_mv_length_vertical", uint64_t);
		READ_EG("num_reorder_frames", uint64_t);
		READ_EG("max_dec_frame_buffering", uint64_t);
	}
	return true;
}
Exemplo n.º 20
0
static gboolean load_global_params(const gchar **attribute_names, const gchar **attribute_values)
{
	while (*attribute_names)
		{
		const gchar *option = *attribute_names++;
		const gchar *value = *attribute_values++;

		/* General options */
		if (READ_BOOL(*options, show_icon_names)) continue;

		if (READ_BOOL(*options, tree_descend_subdirs)) continue;
		if (READ_BOOL(*options, view_dir_list_single_click_enter)) continue;
		if (READ_BOOL(*options, lazy_image_sync)) continue;
		if (READ_BOOL(*options, update_on_time_change)) continue;

		if (READ_UINT_CLAMP(*options, duplicates_similarity_threshold, 0, 100)) continue;
		if (READ_UINT_CLAMP(*options, duplicates_match, 0, DUPE_MATCH_NAME_CI)) continue;
		if (READ_UINT_CLAMP(*options, duplicates_select_type, 0, DUPE_SELECT_GROUP2)) continue;
		if (READ_BOOL(*options, duplicates_thumbnails)) continue;
		if (READ_BOOL(*options, rot_invariant_sim)) continue;

		if (READ_BOOL(*options, progressive_key_scrolling)) continue;
		if (READ_UINT_CLAMP(*options, keyboard_scroll_step, 1, 32)) continue;

		if (READ_BOOL(*options, mousewheel_scrolls)) continue;
		if (READ_BOOL(*options, image_lm_click_nav)) continue;

		if (READ_INT(*options, open_recent_list_maxsize)) continue;
		if (READ_INT(*options, dnd_icon_size)) continue;
		if (READ_BOOL(*options, place_dialogs_under_mouse)) continue;

		if (READ_BOOL(*options, save_window_positions)) continue;
		if (READ_BOOL(*options, use_saved_window_positions_for_new_windows)) continue;
		if (READ_BOOL(*options, tools_restore_state)) continue;

		/* Properties dialog options */
		if (READ_CHAR(*options, properties.tabs_order)) continue;

		/* Image options */
		if (READ_UINT_CLAMP(*options, image.zoom_mode, 0, ZOOM_RESET_NONE)) continue;
		if (READ_BOOL(*options, image.zoom_2pass)) continue;
		if (READ_BOOL(*options, image.zoom_to_fit_allow_expand)) continue;
		if (READ_BOOL(*options, image.fit_window_to_image)) continue;
		if (READ_BOOL(*options, image.limit_window_size)) continue;
		if (READ_INT(*options, image.max_window_size)) continue;
		if (READ_BOOL(*options, image.limit_autofit_size)) continue;
		if (READ_INT(*options, image.max_autofit_size)) continue;
		if (READ_UINT_CLAMP(*options, image.scroll_reset_method, 0, PR_SCROLL_RESET_COUNT - 1)) continue;
		if (READ_INT(*options, image.tile_cache_max)) continue;
		if (READ_INT(*options, image.image_cache_max)) continue;
		if (READ_UINT_CLAMP(*options, image.zoom_quality, GDK_INTERP_NEAREST, GDK_INTERP_HYPER)) continue;
		if (READ_INT(*options, image.zoom_increment)) continue;
		if (READ_BOOL(*options, image.enable_read_ahead)) continue;
		if (READ_BOOL(*options, image.exif_rotate_enable)) continue;
		if (READ_BOOL(*options, image.use_custom_border_color)) continue;
		if (READ_BOOL(*options, image.use_custom_border_color_in_fullscreen)) continue;
		if (READ_COLOR(*options, image.border_color)) continue;
		if (READ_BOOL(*options, image.use_clutter_renderer)) continue;

		/* Thumbnails options */
		if (READ_INT_CLAMP(*options, thumbnails.max_width, 16, 512)) continue;
		if (READ_INT_CLAMP(*options, thumbnails.max_height, 16, 512)) continue;

		if (READ_BOOL(*options, thumbnails.enable_caching)) continue;
		if (READ_BOOL(*options, thumbnails.cache_into_dirs)) continue;
		if (READ_BOOL(*options, thumbnails.use_xvpics)) continue;
		if (READ_BOOL(*options, thumbnails.spec_standard)) continue;
		if (READ_UINT_CLAMP(*options, thumbnails.quality, GDK_INTERP_NEAREST, GDK_INTERP_HYPER)) continue;
		if (READ_BOOL(*options, thumbnails.use_exif)) continue;

		/* File sorting options */
		if (READ_UINT(*options, file_sort.method)) continue;
		if (READ_BOOL(*options, file_sort.ascending)) continue;
		if (READ_BOOL(*options, file_sort.case_sensitive)) continue;
		if (READ_BOOL(*options, file_sort.natural)) continue;

		/* File operations *options */
		if (READ_BOOL(*options, file_ops.enable_in_place_rename)) continue;
		if (READ_BOOL(*options, file_ops.confirm_delete)) continue;
		if (READ_BOOL(*options, file_ops.enable_delete_key)) continue;
		if (READ_BOOL(*options, file_ops.safe_delete_enable)) continue;
		if (READ_CHAR(*options, file_ops.safe_delete_path)) continue;
		if (READ_INT(*options, file_ops.safe_delete_folder_maxsize)) continue;

		/* Fullscreen options */
		if (READ_INT(*options, fullscreen.screen)) continue;
		if (READ_BOOL(*options, fullscreen.clean_flip)) continue;
		if (READ_BOOL(*options, fullscreen.disable_saver)) continue;
		if (READ_BOOL(*options, fullscreen.above)) continue;

		/* Image overlay */
		if (READ_CHAR(*options, image_overlay.template_string)) continue;
		if (READ_INT(*options, image_overlay.x)) continue;
		if (READ_INT(*options, image_overlay.y)) continue;
		if (READ_USHORT(*options, image_overlay.text_red)) continue;
		if (READ_USHORT(*options, image_overlay.text_green)) continue;
		if (READ_USHORT(*options, image_overlay.text_blue)) continue;
		if (READ_USHORT(*options, image_overlay.text_alpha)) continue;
		if (READ_USHORT(*options, image_overlay.background_red)) continue;
		if (READ_USHORT(*options, image_overlay.background_green)) continue;
		if (READ_USHORT(*options, image_overlay.background_blue)) continue;
		if (READ_USHORT(*options, image_overlay.background_alpha)) continue;
		if (READ_CHAR(*options, image_overlay.font)) continue;

		/* Slideshow options */
		if (READ_INT_UNIT(*options, slideshow.delay, SLIDESHOW_SUBSECOND_PRECISION)) continue;
		if (READ_BOOL(*options, slideshow.random)) continue;
		if (READ_BOOL(*options, slideshow.repeat)) continue;

		/* Collection options */
		if (READ_BOOL(*options, collections.rectangular_selection)) continue;

		/* Filtering options */
		if (READ_BOOL(*options, file_filter.show_hidden_files)) continue;
		if (READ_BOOL(*options, file_filter.show_parent_directory)) continue;
		if (READ_BOOL(*options, file_filter.show_dot_directory)) continue;
		if (READ_BOOL(*options, file_filter.disable_file_extension_checks)) continue;
		if (READ_BOOL(*options, file_filter.disable)) continue;
		if (READ_CHAR(*options, sidecar.ext)) continue;

		/* Color Profiles */

		/* Shell command */
		if (READ_CHAR(*options, shell.path)) continue;
		if (READ_CHAR(*options, shell.options)) continue;

		/* Helpers */
		if (READ_CHAR(*options, helpers.html_browser.command_name)) continue;
		if (READ_CHAR(*options, helpers.html_browser.command_line)) continue;

		/* Metadata */
		if (READ_BOOL(*options, metadata.enable_metadata_dirs)) continue;
		if (READ_BOOL(*options, metadata.save_in_image_file)) continue;
		if (READ_BOOL(*options, metadata.save_legacy_IPTC)) continue;
		if (READ_BOOL(*options, metadata.warn_on_write_problems)) continue;
		if (READ_BOOL(*options, metadata.save_legacy_format)) continue;
		if (READ_BOOL(*options, metadata.sync_grouped_files)) continue;
		if (READ_BOOL(*options, metadata.confirm_write)) continue;
		if (READ_BOOL(*options, metadata.confirm_after_timeout)) continue;
		if (READ_INT(*options, metadata.confirm_timeout)) continue;
		if (READ_BOOL(*options, metadata.confirm_on_image_change)) continue;
		if (READ_BOOL(*options, metadata.confirm_on_dir_change)) continue;
		if (READ_BOOL(*options, metadata.keywords_case_sensitive)) continue;
		if (READ_BOOL(*options, metadata.write_orientation)) continue;

		if (READ_INT(*options, stereo.mode)) continue;
		if (READ_INT(*options, stereo.fsmode)) continue;
		if (READ_BOOL(*options, stereo.enable_fsmode)) continue;
		if (READ_INT(*options, stereo.fixed_w)) continue;
		if (READ_INT(*options, stereo.fixed_h)) continue;
		if (READ_INT(*options, stereo.fixed_x1)) continue;
		if (READ_INT(*options, stereo.fixed_y1)) continue;
		if (READ_INT(*options, stereo.fixed_x2)) continue;
		if (READ_INT(*options, stereo.fixed_y2)) continue;

		/* Dummy options */
		if (READ_DUMMY(*options, image.dither_quality, "deprecated since 2012-08-13")) continue;

		/* Unknown options */
		log_printf("unknown attribute %s = %s\n", option, value);
		}

	return TRUE;
}
Exemplo n.º 21
0
bool ItemMixMachineTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{

	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sITEM_MIX_MACHINE_TBLDAT* pItem = (sITEM_MIX_MACHINE_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->tblidx = READ_DWORD(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Validity_Able"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->bValidityAble = READ_BOOL(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Name"))
		{
			pItem->name = READ_DWORD(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Machine_Type"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->byMachineType = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Function_Bit_Flag"))
		{
			pItem->wFunctionBitFlag = (WORD)READ_BITFLAG(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Mix_Zenny_Discount_Rate"))
		{
			pItem->byMixZennyDiscountRate = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Dynamic_Object_Tblidx"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->dynamicObjectTblidx = READ_DWORD(bstrData);
		}
		else if (0 == wcsncmp(pstrDataName->c_str(), L"Built_In_Recipe_Tblidx_", wcslen(L"Built_In_Recipe_Tblidx_")))
		{
			bool bFound = false;

			WCHAR szBuffer[1024] = { 0x00, };
			for (int i = 0; i < DBO_MAX_COUNT_RECIPE_MATERIAL_ITEM; i++)
			{
				swprintf(szBuffer, 1024, L"Built_In_Recipe_Tblidx_%d", i + 1);

				if (0 == wcscmp(pstrDataName->c_str(), szBuffer))
				{
					pItem->aBuiltInRecipeTblidx[i] = READ_DWORD(bstrData);
					bFound = true;
					break;
				}
			}

			if (false == bFound)
			{
				Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
				return false;
			}
		}
		else
		{
			Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		return false;
	}

	return true;
}
Exemplo n.º 22
0
bool CItemOptionTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sITEM_OPTION_TBLDAT* pItem = (sITEM_OPTION_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
			pItem->tblidx = READ_DWORD( bstrData );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Option_Name"))
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );

			READ_STRINGW(bstrData, pItem->wszOption_Name, _countof(pItem->wszOption_Name));
		}
		else if ( 0 == wcscmp(pstrDataName->c_str(), L"Validity_Able") )
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
			pItem->bValidity_Able = READ_BOOL( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Option_Rank"))
		{
			CheckNegativeInvalid( pstrDataName->c_str(), bstrData );
			pItem->byOption_Rank = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Item_Group"))
		{
			pItem->byItem_Group = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Max_Quality"))
		{
			pItem->byMaxQuality = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Quality"))
		{
			pItem->byQuality = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Quality_Index"))
		{
			pItem->byQualityIndex = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Cost"))
		{
			pItem->dwCost = READ_DWORD( bstrData, 0 );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Level"))
		{
			pItem->byLevel = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else if ( 0 == wcsncmp(pstrDataName->c_str(), L"System_Effect_", wcslen(L"System_Effect_") ) )
		{
			bool bFound = false;

			WCHAR szBuffer[1024] = { 0x00, };
			for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ )
			{
				swprintf( szBuffer, 1024, L"System_Effect_%d", i + 1 );

				if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) )
				{
					pItem->system_Effect[ i ] = READ_DWORD( bstrData );

					bFound = true;
					break;
				}
			}

			if( false == bFound )
			{
				CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
				return false;
			}
		}
		else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Type_", wcslen(L"Type_") ) )
		{
			bool bFound = false;

			WCHAR szBuffer[1024] = { 0x00, };
			for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ )
			{
				swprintf( szBuffer, 1024, L"Type_%d", i + 1 );

				if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) )
				{
					pItem->bAppliedInPercent[ i ] = READ_BOOL( bstrData, pstrDataName->c_str() );

					bFound = true;
					break;
				}
			}

			if( false == bFound )
			{
				CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
				return false;
			}
		}
		else if ( 0 == wcsncmp(pstrDataName->c_str(), L"Value_", wcslen(L"Value_") ) )
		{
			bool bFound = false;

			WCHAR szBuffer[1024] = { 0x00, };
			for( int i = 0; i < NTL_MAX_SYSTEM_EFFECT_COUNT; i++ )
			{
				swprintf( szBuffer, 1024, L"Value_%d", i + 1 );

				if( 0 == wcscmp(pstrDataName->c_str(), szBuffer) )
				{
					pItem->nValue[ i ] = READ_DWORD( bstrData );

					bFound = true;
					break;
				}
			}

			if( false == bFound )
			{
				CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
				return false;
			}
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Active_Effect"))
		{
			pItem->activeEffect = READ_DWORD( bstrData );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Active_Rate"))
		{
			pItem->fActiveRate = READ_FLOAT( bstrData, pstrDataName->c_str() );
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Note"))
		{
			READ_STRING(bstrData, pItem->szNote, _countof(pItem->szNote));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Scouter_Info"))
		{
			pItem->byScouterInfo = READ_BYTE( bstrData, pstrDataName->c_str() );
		}
		else
		{
			CTable::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		return false;
	}

	return true;
}
Exemplo n.º 23
0
        model_info::model_info(std::istream & stream_, const uint32_t lod_count, uint32_t version)
            : raw_resolutions(nullptr), u_floats_1(nullptr), default_indicators(nullptr) {
            
            raw_resolutions = new float[lod_count];
            stream_.read((char *)raw_resolutions, sizeof(float) * lod_count);
            // Get them to parsable int values
            for (int x = 0; x < lod_count; x++) {
                resolutions.push_back(*(int *)&raw_resolutions[x]);
            }

            stream_.read((char *)&index, sizeof(uint32_t));
            stream_.read((char *)&lod_sphere_mem, sizeof(float));
            stream_.read((char *)&lod_sphere_geo, sizeof(float));
            stream_.read((char *)&point_flags, sizeof(uint32_t) * 3);

            offset_1 = ace::vector3<float>(stream_);

            stream_.read((char *)&map_icon_color, sizeof(uint32_t));
            stream_.read((char *)&map_selected_color, sizeof(uint32_t));
            stream_.read((char *)&view_density, sizeof(float));

            bbox_min_pos = ace::vector3<float>(stream_);
            bbox_max_pos = ace::vector3<float>(stream_);

            center_of_gravity = ace::vector3<float>(stream_);
            offset_2 = ace::vector3<float>(stream_);
            cog_offset = ace::vector3<float>(stream_);

            mass_vectors[0] = ace::vector3<float>(stream_);
            mass_vectors[1] = ace::vector3<float>(stream_);
            mass_vectors[2] = ace::vector3<float>(stream_);

            stream_.read((char *)&thermal_profile_2, sizeof(uint8_t) * 24);

            READ_BOOL(autocenter);
            READ_BOOL(lock_autocenter);
            READ_BOOL(allow_occlude);
            READ_BOOL(allow_occluded);
            READ_BOOL(allow_animation);

            stream_.read((char *)&u_bytes_1, sizeof(uint8_t) * 6);
            stream_.read((char *)&thermal_profile, sizeof(uint8_t) * 24);
            stream_.read((char *)&u_long_1, sizeof(uint32_t));

            // Parse the full skeletal structure
            skeleton = std::make_shared<ace::p3d::skeleton>(stream_, lod_count);

            stream_.read((char *)&u_byte_1, sizeof(uint8_t));

            compressed<float> u_floats_1(stream_, true, false, version);

            stream_.read((char *)&mass, sizeof(float));
            stream_.read((char *)&mass_reciprocal, sizeof(float));
            stream_.read((char *)&mass_alt, sizeof(float));
            stream_.read((char *)&mass_alt_reciprocoal, sizeof(float));

            stream_.read((char *)&u_bytes_1, sizeof(uint8_t) * 14);

            //
            stream_.read((char *)&u_long_1, sizeof(uint32_t));
            READ_BOOL(u_bool_1);
            //if (u_bool_1) {

            READ_STRING(class_type);
            READ_STRING(destruct_type);
            READ_BOOL(u_bool_2);
            stream_.read((char *)&u_long_2, sizeof(uint32_t));

            stream_.seekg(sizeof(uint8_t) * 12 * lod_count, stream_.cur);
        }
Exemplo n.º 24
0
bool UseItemTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
	if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
	{
		sUSE_ITEM_TBLDAT* pItem = (sUSE_ITEM_TBLDAT*)pvTable;

		if (0 == wcscmp(pstrDataName->c_str(), L"Tblidx"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->tblidx = READ_DWORD(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Item_Active_Type"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->byUse_Item_Active_Type = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Buff_Group"))
		{
			pItem->byBuff_Group = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time_Bit_Flag"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->dwCool_Time_Bit_Flag = HexToDec(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Function_Bit_Flag"))
		{
			pItem->wFunction_Bit_Flag = (WORD)READ_BITFLAG(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Appoint_Target"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->byAppoint_Target = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Target"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->byApply_Target = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Target_Max"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->byApply_Target_Max = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Apply_Range"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->byApply_Range = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Need_State_Bit_Flag"))
		{
			WORD wDummy = 0;
			pItem->wNeed_State_Bit_Flag = ~wDummy;
			pItem->wNeed_State_Bit_Flag = (WORD)READ_BITFLAG(bstrData, ~wDummy);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_1"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->aSystem_Effect[0] = READ_DWORD(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Type_1"))
		{
			pItem->abySystem_Effect_Type[0] = READ_BYTE(bstrData, pstrDataName->c_str());

			//  [12/1/2006 zeroera] : 설명 : 테이블 체크로 옮길 것
			//if (SYSTEM_EFFECT_APPLY_TYPE_FIRST > pItem->abySystem_Effect_Type[0] ||
			//	SYSTEM_EFFECT_APPLY_TYPE_LAST < pItem->abySystem_Effect_Type[0])
			//{
			//	_ASSERT(0);
			//	return false;
			//}
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Value_1"))
		{
			pItem->afSystem_Effect_Value[0] = READ_FLOAT(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_2"))
		{
			pItem->aSystem_Effect[1] = READ_DWORD(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Type_2"))
		{
			pItem->abySystem_Effect_Type[1] = READ_BYTE(bstrData, pstrDataName->c_str());

			//  [12/1/2006 zeroera] : 설명 : 테이블 체크로 옮길 것
			//if (SYSTEM_EFFECT_APPLY_TYPE_FIRST > pItem->abySystem_Effect_Type[1] ||
			//	SYSTEM_EFFECT_APPLY_TYPE_LAST < pItem->abySystem_Effect_Type[1])
			//{
			//	_ASSERT(0);
			//	return false;
			//}
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"System_Effect_Value_2"))
		{
			pItem->afSystem_Effect_Value[1] = READ_FLOAT(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Require_LP"))
		{
			pItem->wRequire_LP = READ_WORD(bstrData, pstrDataName->c_str(), 0);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Require_EP"))
		{
			pItem->wRequire_EP = READ_WORD(bstrData, pstrDataName->c_str(), 0);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Require_RP_Ball"))
		{
			pItem->byRequire_RP_Ball = READ_BYTE(bstrData, pstrDataName->c_str(), 0);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Time"))
		{
			pItem->fCasting_Time = READ_FLOAT(bstrData, pstrDataName->c_str(), 0.0f);
			pItem->dwCastingTimeInMilliSecs = (DWORD)(pItem->fCasting_Time * 1000.0f);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Cool_Time"))
		{
			pItem->wCool_Time = READ_WORD(bstrData, pstrDataName->c_str(), 0);
			pItem->dwCoolTimeInMilliSecs = pItem->wCool_Time * 1000;
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Time"))
		{
			pItem->wKeep_Time = READ_WORD(bstrData, pstrDataName->c_str(), 0);
			pItem->dwKeepTimeInMilliSecs = pItem->wKeep_Time * 1000;
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Keep_Effect"))
		{
			CheckNegativeInvalid(pstrDataName->c_str(), bstrData);
			pItem->bKeep_Effect = READ_BOOL(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Range_Min"))
		{
			pItem->byUse_Range_Min = READ_BYTE(bstrData, pstrDataName->c_str(), 0);
			pItem->fUse_Range_Min = (float)(pItem->byUse_Range_Min);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Range_Max"))
		{
			pItem->byUse_Range_Max = READ_BYTE(bstrData, pstrDataName->c_str(), 0);
			pItem->fUse_Range_Max = (float)(pItem->byUse_Range_Max);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Use_Info_Text"))
		{
			pItem->Use_Info_Text = READ_DWORD(bstrData);
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Effect"))
		{
			READ_STRING(bstrData, pItem->szCasting_Effect, _countof(pItem->szCasting_Effect));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Effect"))
		{
			READ_STRING(bstrData, pItem->szAction_Effect, _countof(pItem->szAction_Effect));
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Animation_Start"))
		{
			pItem->wCasting_Animation_Start = READ_WORD(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Animation_Loop"))
		{
			pItem->wCasting_Animation_Loop = READ_WORD(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Animation_Index"))
		{
			pItem->wAction_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Loop_Animation_Index"))
		{
			pItem->wAction_Loop_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Action_End_Animation_Index"))
		{
			pItem->wAction_End_Animation_Index = READ_WORD(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Casting_Effect_Position"))
		{
			pItem->byCastingEffectPosition = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"Action_Effect_Position"))
		{
			pItem->byActionEffectPosition = READ_BYTE(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_X"))
		{
			pItem->fUseLoc_X = READ_FLOAT(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_Z"))
		{
			pItem->fUseLoc_Z = READ_FLOAT(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"UseLoc_Radius"))
		{
			pItem->fUseLoc_Radius = READ_FLOAT(bstrData, pstrDataName->c_str());
		}
		else if (0 == wcscmp(pstrDataName->c_str(), L"RequiredQuestID"))
		{
			pItem->RequiredQuestID = (QUESTID)(READ_WORD(bstrData, pstrDataName->c_str()));
		}
		else
		{
			Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
			return false;
		}
	}
	else
	{
		return false;
	}

	return true;
}
Exemplo n.º 25
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Scheme::fetch() {
	READ_BOOL(showMenu);
	READ_BOOL(showStatusBar);

	std::string tabPosition = "";
	READ_STRING(tabPosition);

	if ( tabPosition == "off" )
		this->tabPosition = 0;
	else if ( tabPosition == "north" )
		this->tabPosition = 1;
	else if ( tabPosition == "south" )
		this->tabPosition = 2;
	else if ( tabPosition == "west" )
		this->tabPosition = 3;
	else if ( tabPosition == "east" )
		this->tabPosition = 4;

	READ_COLOR(colors.background);

	READ_COLOR(colors.splash.version);
	READ_COLOR(colors.splash.message);

	READ_COLOR(colors.records.alignment);
	READ_COLOR(colors.records.background);
	READ_COLOR(colors.records.alternateBackground);
	READ_COLOR(colors.records.foreground);
	READ_COLOR(colors.records.alternateForeground);
	READ_COLOR(colors.records.spectrogram);
	READ_COLOR(colors.records.gaps);
	READ_COLOR(colors.records.overlaps);
	READ_COLOR(colors.records.states.unrequested);
	READ_COLOR(colors.records.states.requested);
	READ_COLOR(colors.records.states.inProgress);
	READ_COLOR(colors.records.states.notAvailable);

	READ_COLOR(colors.picks.manual);
	READ_COLOR(colors.picks.automatic);
	READ_COLOR(colors.picks.undefined);
	READ_COLOR(colors.picks.disabled);

	READ_COLOR(colors.arrivals.manual);
	READ_COLOR(colors.arrivals.automatic);
	READ_COLOR(colors.arrivals.theoretical);
	READ_COLOR(colors.arrivals.undefined);
	READ_COLOR(colors.arrivals.disabled);
	READ_COLOR_GRADIENT(colors.arrivals.residuals);

	READ_COLOR(colors.magnitudes.set);
	READ_COLOR(colors.magnitudes.unset);
	READ_COLOR(colors.magnitudes.disabled);
	READ_COLOR_GRADIENT(colors.magnitudes.residuals);

	READ_COLOR(colors.stations.text);
	READ_COLOR(colors.stations.associated);
	READ_COLOR(colors.stations.triggering);
	READ_COLOR(colors.stations.triggered0);
	READ_COLOR(colors.stations.triggered1);
	READ_COLOR(colors.stations.triggered2);
	READ_COLOR(colors.stations.disabled);
	READ_COLOR(colors.stations.idle);

	READ_COLOR(colors.qc.delay0);
	READ_COLOR(colors.qc.delay1);
	READ_COLOR(colors.qc.delay2);
	READ_COLOR(colors.qc.delay3);
	READ_COLOR(colors.qc.delay4);
	READ_COLOR(colors.qc.delay5);
	READ_COLOR(colors.qc.delay6);
	READ_COLOR(colors.qc.delay7);
	READ_COLOR(colors.qc.qcWarning);
	READ_COLOR(colors.qc.qcError);
	READ_COLOR(colors.qc.qcOk);
	READ_COLOR(colors.qc.qcNotSet);

	READ_COLOR(colors.gm.gm0);
	READ_COLOR(colors.gm.gm1);
	READ_COLOR(colors.gm.gm2);
	READ_COLOR(colors.gm.gm3);
	READ_COLOR(colors.gm.gm4);
	READ_COLOR(colors.gm.gm5);
	READ_COLOR(colors.gm.gm6);
	READ_COLOR(colors.gm.gm7);
	READ_COLOR(colors.gm.gm8);
	READ_COLOR(colors.gm.gm9);
	READ_COLOR(colors.gm.gmNotSet);

	READ_COLOR(colors.recordView.selectedTraceZoom);

	READ_COLOR(colors.map.lines);
	READ_COLOR(colors.map.outlines);
	READ_COLOR(colors.map.grid);
	READ_COLOR(colors.map.stationAnnotations);
	READ_COLOR(colors.map.cityLabels);
	READ_COLOR(colors.map.cityOutlines);
	READ_COLOR(colors.map.cityCapital);
	READ_COLOR(colors.map.cityNormal);

	READ_COLOR(colors.legend.background);
	READ_COLOR(colors.legend.border);
	READ_COLOR(colors.legend.text);
	READ_COLOR(colors.legend.headerText);

	READ_BOOL(colors.originSymbol.classic);
	READ_COLOR_GRADIENT(colors.originSymbol.depth.gradient);
	READ_BOOL(colors.originSymbol.depth.discrete);

	READ_COLOR(colors.originStatus.automatic);
	READ_COLOR(colors.originStatus.manual);

	READ_INT(marker.lineWidth);
	READ_INT(records.lineWidth);
	READ_BOOL(records.antiAliasing);
	READ_BOOL(records.optimize);

	READ_FONT(fonts.base);
	fonts.setBase(fonts.base);
	READ_FONT_BY_NAME(fonts.smaller, fonts.small);
	READ_FONT(fonts.normal);
	READ_FONT(fonts.large);
	READ_FONT(fonts.highlight);
	READ_FONT(fonts.heading1);
	READ_FONT(fonts.heading2);
	READ_FONT(fonts.heading3);
	READ_FONT(fonts.cityLabels);
	READ_FONT(fonts.splashVersion);
	READ_FONT(fonts.splashMessage);
	SCApp->setFont(fonts.base);

	READ_INT(splash.version.align);
	READ_POINT(splash.version.pos);
	READ_INT(splash.message.align);
	READ_POINT(splash.message.pos);

	READ_INT(map.stationSize);
	READ_INT(map.originSymbolMinSize);
	READ_BOOL(map.vectorLayerAntiAlias);
	READ_BOOL(map.bilinearFilter);
	READ_BOOL(map.showGrid);
	READ_BOOL(map.showLayers);
	READ_BOOL(map.showCities);
	READ_BOOL(map.showLegends);
	READ_INT(map.cityPopulationWeight);
	READ_BOOL(map.toBGR);
	READ_STRING(map.projection);

	READ_INT(precision.depth);
	READ_INT(precision.distance);
	READ_INT(precision.location);
	READ_INT(precision.pickTime);
	READ_INT(precision.traceValues);
	READ_INT(precision.rms);
	READ_INT(precision.uncertainties);

	READ_BOOL(unit.distanceInKM);
	READ_BOOL(dateTime.useLocalTime);
}