scripts/xbox: eliminate code duplication