u32 SIndexHeader::read(FILE* f) { if (!f) return XP3_INVALIDARGUMENT; READ_VALUE(f,compressed); READ_VALUE(f,sizeCompressed); READ_VALUE(f,sizeUncompressed); return XP3_OK; }
//read header from file u32 SFileHeader::read(FILE* f) { if (!f) return XP3_INVALIDARGUMENT; READ_ARRAY(f,magic); if (magic[0] != 'X' || magic[1] != 'P' || magic[2] != '3') { return XP3_INVALIDARCHIVE; } READ_ARRAY(f,mark1); READ_ARRAY(f,mark2); READ_VALUE(f,structureVersion); READ_VALUE(f,padding1); READ_VALUE(f,headerVersion); READ_VALUE(f,padding2); READ_VALUE(f,indexSize); READ_VALUE(f,indexHeaderPos); if (indexHeaderPos == 0) return XP3_INVALIDARCHIVE; return XP3_OK; }
CError CInterfaceDefinitionLoader::handle_element_value( const string &element_value ) { assert( m_interface_definition && !m_element_path.empty() ); /* interface info */ READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.Name", m_interface_definition->m_interface_info->m_name ); READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.Label", m_interface_definition->m_interface_info->m_label ); READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.Description", m_interface_definition->m_interface_info->m_description ); READ_SET_CONTENT( "InterfaceDeclaration.InterfaceInfo.Tags.Tag", m_interface_definition->m_interface_info->m_tags ); READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.ImplementedInLibIntegra", m_interface_definition->m_interface_info->m_implemented_in_libintegra ); READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.Author", m_interface_definition->m_interface_info->m_author ); READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.CreatedDate", m_interface_definition->m_interface_info->m_created_date ); READ_MEMBER( "InterfaceDeclaration.InterfaceInfo.ModifiedDate", m_interface_definition->m_interface_info->m_modified_date ); /* endpoint info */ READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.Name", current_endpoint().m_name ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.Label", current_endpoint().m_label ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.Description", current_endpoint().m_description ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.Type", current_endpoint().m_type ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.ControlType", current_endpoint().m_control_info->m_type ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.StateType", current_endpoint().m_control_info->m_state_info->m_type ); READ_VALUE( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.Constraint.Range.Minimum", current_endpoint().m_control_info->m_state_info->m_constraint->m_value_range->m_minimum, get_range_type() ); READ_VALUE( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.Constraint.Range.Maximum", current_endpoint().m_control_info->m_state_info->m_constraint->m_value_range->m_maximum, get_range_type() ); READ_VALUE_SET_CONTENT( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.Constraint.AllowedStates.State", current_endpoint().m_control_info->m_state_info->m_constraint->m_allowed_states, get_state_type() ); READ_VALUE( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.Default", current_endpoint().m_control_info->m_state_info->m_default_value, get_state_type() ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.Scale.ScaleType", current_endpoint().m_control_info->m_state_info->m_value_scale->m_type ); READ_VALUE( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.StateLabels.Label.State", m_last_state_label_value, get_state_type() ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.StateLabels.Label.Text", m_last_state_label_key ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.IsInputFile", current_endpoint().m_control_info->m_state_info->m_is_input_file ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.StateInfo.IsSavedToFile", current_endpoint().m_control_info->m_state_info->m_is_saved_to_file ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.CanBeSource", current_endpoint().m_control_info->m_can_be_source ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.CanBeTarget", current_endpoint().m_control_info->m_can_be_target ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.ControlInfo.IsSentToHost", current_endpoint().m_control_info->m_is_sent_to_host ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.StreamInfo.StreamType", current_endpoint().m_stream_info->m_type ); READ_MEMBER( "InterfaceDeclaration.EndpointInfo.Endpoint.StreamInfo.StreamDirection", current_endpoint().m_stream_info->m_direction ); /* widget info */ READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.WidgetType", current_widget().m_type ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.Label", current_widget().m_label ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.Position.X", current_widget().m_position->m_x ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.Position.Y", current_widget().m_position->m_y ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.Position.Width", current_widget().m_position->m_width ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.Position.Height", current_widget().m_position->m_height ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.AttributeMappings.AttributeMapping.WidgetAttribute", m_last_widget_key ); READ_MEMBER( "InterfaceDeclaration.WidgetInfo.Widget.AttributeMappings.AttributeMapping.Endpoint", m_last_widget_value ); /* implementation info */ READ_MEMBER( "InterfaceDeclaration.ImplementationInfo.PatchName", m_interface_definition->m_implementation_info->m_patch_name ); INTEGRA_TRACE_ERROR << "unhandled element: " << m_element_path << " for module: " << m_interface_definition->m_interface_info->m_name; return CError::SUCCESS; }