Use libctru template and makefile, as well as some other fixes

Also changed `mainLoop()` to use `aptMainLoop()`, and stopped discarding the opened `sdmcArchive` by overwriting it.