From KTX official repo + patches