diff options
author | ptitSeb | 2017-11-30 22:49:38 +0100 |
---|---|---|
committer | ptitSeb | 2017-11-30 22:49:38 +0100 |
commit | de29b11a88dbdd3af0824e59b51528b91ee73c54 (patch) | |
tree | e1aabf8752043998663279fae4359a18c4b4af07 /src/main.c | |
parent | d87f450f51372ddf013e6bac09f1ef588e6f8bea (diff) | |
download | hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.tar.gz hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.tar.bz2 hydracastlelabyrinth-de29b11a88dbdd3af0824e59b51528b91ee73c54.zip |
First commit. Version works on Linux (keyboard only, not configurable)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..54f61e2 --- /dev/null +++ b/src/main.c @@ -0,0 +1,57 @@ +#include "PHL.h" +#include "game.h" +#include <stdlib.h> +#include <time.h> +#include <sys/stat.h> + +void createSaveLocations() +{ + //Force create save data folders + #ifdef _3DS + //3DS builds + mkdir("sdmc:/3ds", 0777); + mkdir("sdmc:/3ds/appdata", 0777); + mkdir("sdmc:/3ds/appdata/HydraCastleLabyrinth", 0777); + mkdir("sdmc:/3ds/appdata/HydraCastleLabyrinth/data", 0777); + mkdir("sdmc:/3ds/appdata/HydraCastleLabyrinth/map", 0777); + #elif defined(_SDL) + char buff[4096]; + strcpy(buff, getenv("HOME")); + strcat(buff, "/.hydracastlelabyrinth"); + // if exist first? + struct stat sb; + if(!(stat(buff, &sb)==0 && S_ISDIR(sb.st_mode))) + mkdir(buff, 0777); + + #else + //psp, wii + mkdir("/data", 0777); + mkdir("/map", 0777); + #endif +} + + +int main(int argc, char **argv) +{ + //Setup + #ifdef _3DS + sdmcInit(); + osSetSpeedupEnable(false); + #endif + + srand(time(NULL)); + createSaveLocations(); + + game(); + + //System specific cleanup + #ifdef _PSP + sceKernelExitGame(); + #endif + + #ifdef _3DS + sdmcExit(); + #endif + + return 0; +}
\ No newline at end of file |