For nearly four years, South Africa’s offshore hydrocarbon exploration projects have been mired in legal battles, delaying the government’s plans to bolster the country’s struggling energy sector.