|
@@ -7,6 +7,34 @@
|
|
|
#include "syscall.h"
|
|
#include "syscall.h"
|
|
|
#include "states.h"
|
|
#include "states.h"
|
|
|
|
|
|
|
|
|
|
+void load_difficulty_names(char **str_list)
|
|
|
|
|
+{
|
|
|
|
|
+ char c_1[] = "Hard";
|
|
|
|
|
+ char c_2[] = "Harder";
|
|
|
|
|
+ char c_3[] = "Hardest";
|
|
|
|
|
+ char c_4[] = "Hardester";
|
|
|
|
|
+ char c_5[] = "Hardestest";
|
|
|
|
|
+ char c_6[] = "Hardestestest";
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+ int j = 0;
|
|
|
|
|
+ for(i = 0; i < 6; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ str_list[i] = NULL;
|
|
|
|
|
+ str_list[i] = malloc(sizeof(char) * 24);
|
|
|
|
|
+ if(str_list[i] == NULL)
|
|
|
|
|
+ return;
|
|
|
|
|
+ for(j = 0; j < 24; str_list[i][j] = 0, j++) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ memcpy(str_list[0], c_1, sizeof(char) * strlen(c_1));
|
|
|
|
|
+ memcpy(str_list[1], c_2, sizeof(char) * strlen(c_2));
|
|
|
|
|
+ memcpy(str_list[2], c_3, sizeof(char) * strlen(c_3));
|
|
|
|
|
+ memcpy(str_list[3], c_4, sizeof(char) * strlen(c_4));
|
|
|
|
|
+ memcpy(str_list[4], c_5, sizeof(char) * strlen(c_5));
|
|
|
|
|
+ memcpy(str_list[5], c_6, sizeof(char) * strlen(c_6));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
int AddIn_main(int isAppli, unsigned short OptionNum)
|
|
int AddIn_main(int isAppli, unsigned short OptionNum)
|
|
|
{
|
|
{
|
|
|
const FONTCHARACTER filename[] = {'\\', '\\', 'f', 'l', 's', '0', '\\', 'S', 'H', 'C', '.', 's', 'a', 'v', 0};
|
|
const FONTCHARACTER filename[] = {'\\', '\\', 'f', 'l', 's', '0', '\\', 'S', 'H', 'C', '.', 's', 'a', 'v', 0};
|
|
@@ -28,13 +56,12 @@ int AddIn_main(int isAppli, unsigned short OptionNum)
|
|
|
data.entry_highscores = NULL;
|
|
data.entry_highscores = NULL;
|
|
|
data.entry_highscores = malloc(sizeof(float) * 6);
|
|
data.entry_highscores = malloc(sizeof(float) * 6);
|
|
|
if(data.entry_highscores == NULL)
|
|
if(data.entry_highscores == NULL)
|
|
|
- return 1;
|
|
|
|
|
|
|
+ switch_to_state(OUT_OF_MEMORY, &data);
|
|
|
|
|
|
|
|
|
|
|
|
|
data.is_save_feature_enabled = 1;
|
|
data.is_save_feature_enabled = 1;
|
|
|
data.fileHandle = Bfile_OpenFile(filename, _OPENMODE_READ);
|
|
data.fileHandle = Bfile_OpenFile(filename, _OPENMODE_READ);
|
|
|
if(data.fileHandle == IML_FILEERR_ENTRYNOTFOUND) {
|
|
if(data.fileHandle == IML_FILEERR_ENTRYNOTFOUND) {
|
|
|
- void;
|
|
|
|
|
} else if(data.fileHandle>= 0) {
|
|
} else if(data.fileHandle>= 0) {
|
|
|
if(Bfile_ReadFile(data.fileHandle, (char*)data.entry_highscores, filesize, -1) < 0)
|
|
if(Bfile_ReadFile(data.fileHandle, (char*)data.entry_highscores, filesize, -1) < 0)
|
|
|
data.is_save_feature_enabled = 0;
|
|
data.is_save_feature_enabled = 0;
|
|
@@ -86,12 +113,7 @@ int AddIn_main(int isAppli, unsigned short OptionNum)
|
|
|
if(data.is_save_feature_enabled) {
|
|
if(data.is_save_feature_enabled) {
|
|
|
Bfile_CreateFile(filename, filesize);
|
|
Bfile_CreateFile(filename, filesize);
|
|
|
data.fileHandle = Bfile_OpenFile(filename, _OPENMODE_WRITE);
|
|
data.fileHandle = Bfile_OpenFile(filename, _OPENMODE_WRITE);
|
|
|
- if(Bfile_WriteFile(data.fileHandle, (char*)data.entry_highscores, filesize) < 0) {
|
|
|
|
|
- int why;
|
|
|
|
|
- locate(1,1);
|
|
|
|
|
- Print("POURQUOI");
|
|
|
|
|
- GetKey(&why);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Bfile_WriteFile(data.fileHandle, (char*)data.entry_highscores, filesize);
|
|
|
Bfile_CloseFile(data.fileHandle);
|
|
Bfile_CloseFile(data.fileHandle);
|
|
|
}
|
|
}
|
|
|
|
|
|