loader.cpp: improved file extension checking, made Upper/LowerStr useful

Instead of forcibly taking the last 4 characters, it now finds the last extension separator (the period) and takes a substr of its location.
I suggest calling this "ToLower" or even "ToLowerCase" instead.