diff --git a/CppOutRun.layout b/CppOutRun.layout index aa081e1..048f191 100644 --- a/CppOutRun.layout +++ b/CppOutRun.layout @@ -2,78 +2,17 @@ - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - @@ -88,18 +27,22 @@ - - + - + - + - + + + + + + @@ -107,32 +50,39 @@ - + - + - + - + - + - + - - - - - - - - - + - + + + + + + + + + + + + + + + + @@ -157,19 +107,67 @@ - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets-cg/fxconv-metadata.txt b/assets-cg/fxconv-metadata.txt deleted file mode 100644 index fc1422a..0000000 --- a/assets-cg/fxconv-metadata.txt +++ /dev/null @@ -1,5 +0,0 @@ -#*.png: -# type: bopti-image -# profile: p4 -# name_regex: (.*)\.png \1 - diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..6ce595d Binary files /dev/null and b/icon.png differ diff --git a/src/include/saves.h b/src/include/saves.h index 0effce4..04439f4 100644 --- a/src/include/saves.h +++ b/src/include/saves.h @@ -9,8 +9,21 @@ struct BestRanking uint32_t bestTime = 0x0FFFFFFF; }; +struct Parameters +{ + uint8_t DiffLevel = 1; + uint8_t CarsNumb = 1; + char PlayerName[3] = { 'S', 'L', 'Y' }; +}; + void is_save_existing( void ); void saveprogress( void ); void loadprogress( void ); + +void is_param_existing( void ); +void saveparameters( void ); +void loadparameters( void ); + + diff --git a/src/main.cc b/src/main.cc index 176abba..6226633 100644 --- a/src/main.cc +++ b/src/main.cc @@ -61,6 +61,8 @@ uint8_t DiffLevel = 1; uint8_t CarsNumb = 1; char PlayerName[3] = { 'S', 'L', 'Y' }; +Parameters PlayerPara[1]; + struct DataPerf { uint8_t update=0; @@ -369,11 +371,24 @@ int main(void) if (!saveexist) // if we do not have saves gint_world_switch( GINT_CALL( saveprogress ) ); // we create a progress file which is empty - gint_world_switch( GINT_CALL( loadprogress )); // then we load it + gint_world_switch( GINT_CALL( is_param_existing )); + + if (!saveexist) // if we do not have saves + gint_world_switch( GINT_CALL( saveparameters ) ); // we create a progress file which is empty + + gint_world_switch( GINT_CALL( loadparameters )); // then we load it + + + DiffLevel=PlayerPara[0].DiffLevel; + CarsNumb=PlayerPara[0].CarsNumb; + PlayerName[0]=PlayerPara[0].PlayerName[0]; + PlayerName[1]=PlayerPara[0].PlayerName[1]; + PlayerName[2]=PlayerPara[0].PlayerName[2]; + kmalloc_arena_t *_uram = kmalloc_get_arena("_uram"); kmalloc_gint_stats_t *_uram_stats; @@ -487,6 +502,14 @@ int main(void) else if (mode==2) { drawGameOptions(); + + PlayerPara[0].DiffLevel = DiffLevel; + PlayerPara[0].CarsNumb = CarsNumb; + PlayerPara[0].PlayerName[0]=PlayerName[0]; + PlayerPara[0].PlayerName[1]=PlayerName[1]; + PlayerPara[0].PlayerName[2]=PlayerName[2]; + + gint_world_switch( GINT_CALL( saveparameters ) ); } else if (mode==3) { diff --git a/src/src/saves.cc b/src/src/saves.cc index e4ee539..4a6dfab 100644 --- a/src/src/saves.cc +++ b/src/src/saves.cc @@ -4,12 +4,14 @@ static const char *filepath= "OutRun.sav"; +static const char *filepara= "OutRun.prm"; bool saveexist; +bool paraexist; unsigned int sizeoffile; extern BestRanking HallOfFame[10][5]; - +extern Parameters PlayerPara[1]; void is_save_existing( void ) { @@ -48,3 +50,40 @@ void loadprogress( void ) fclose( file ); } +void is_param_existing( void ) +{ + FILE *file = fopen( filepara, "r" ); + + if (file==NULL) + { + paraexist = false; + } + else + { + fclose( file ); + paraexist = true; + } +} + + +void saveparameters( void ) +{ + sizeoffile = sizeof( PlayerPara ); + + FILE *file = fopen( filepara, "w" ); + fwrite( PlayerPara, sizeoffile, 1, file ); + + fclose( file ); +} + + +void loadparameters( void ) +{ + sizeoffile = sizeof( PlayerPara ); + + FILE *file = fopen( filepara, "r" ); + fread( PlayerPara, sizeoffile, 1, file ); + + fclose( file ); +} +