I am fairly new to Wii development and have been stuck for quite a while now on how to make a save system for my game. So far, I have thought about using the fat.h library to save all my game data directly to the SD card but then I thought about if I should be using actual save slots. I don't know how to even go about using fat.h to save data to files so if anyone knows how to or can point me in a good direction, I would be very grateful. Again, I'm a very new developer to Wii development so if there are any easier solutions, I'm open.
So far my includes for the project are:
At the start of the script where I initialize all the libraries, the following lines don't even do anything:
Any help appreciated
So far my includes for the project are:
C:
#include <stdio.h>
#include <stdlib.h>
#include <gccore.h>
#include <wiiuse/wpad.h>
#include <string.h>
#include <ogc/isfs.h>
#include <ogcsys.h>
#include <math.h>
#include <asndlib.h>
#include <mp3player.h>
#include <fat.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include "achievement_mp3.h"
#include "error_mp3.h"
#include "upgrade_mp3.h"
At the start of the script where I initialize all the libraries, the following lines don't even do anything:
C:
// Initialize Filesystem
fatInitDefault();
if (mkdir("SD:/CookwiiClickerData", 0777) == -1) {
isSaveFileInitialized = false; // Tell the game that it failed to create the enterance directory
}
FILE *savefile = fopen("SD:/CookwiiClickerData/savedata.sav", "rb");
if (savefile == NULL && errno != EEXIST) {
savefile = fopen("SD:/CookwiiClickerData/savedata.sav", "wb");
if (savefile == NULL) {
exit(0);
}
else {
for (int i = 0; i < line_number; i++) {
char temp_string[20];
sprintf(temp_string, "%i", '0');
fputs (temp_string, savefile);
}
fclose(savefile);
}
}
else { // Otherwise if it was fine, we can continue.
char file_line[20];
while (fgets(file_line, 20, savefile)) {
printf("Line %i: %s\n",line_number, file_line);
atoi(file_line);
line_number++;
}
fclose(savefile);
}
Any help appreciated






