Improve the loader a bit

Clean up the loader to open the file only once and pass the IOFile around to functions requiring it, and add a real file detection function based on its magic.
It's already checked here: https://github.com/citra-emu/citra/pull/241/files#diff-3ed8a4c822bfc3621a4fdd79681ae52aR80