diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c5f8d8..8f6e778 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,9 +118,9 @@ set(ASSETS_cg fxconv_declare_assets(${ASSETS_cg} WITH_METADATA) add_executable(myaddin ${SOURCES} ${ASSETS_${FXSDK_PLATFORM}}) -target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -std=c++20 -c -fno-rtti -fpermissive) +target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -std=c++20 -fpermissive) +target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage) target_link_libraries(myaddin LibProf::LibProf Gint::Gint -lstdc++) -target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map) if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) generate_g3a(TARGET myaddin OUTPUT "OutRun.g3a" VERSION 01.090.0000 diff --git a/src/main.cc b/src/main.cc index d8d5938..c8623b0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -37,7 +37,7 @@ #define DEBUGXXX 0 #define OVERCLCK_ACTIVABLE 1 -char version[5] = {'V','1','.','0','8'}; +char version[5] = {'V','1','.','0','9'}; extern bopti_image_t player, smoke1, smoke2, smoke3; @@ -426,6 +426,13 @@ void debug_crash( int value ) getkey(); } +void debug_crash_msg( char *chain ) +{ + dprint( 1, 1+a*10, C_BLACK, "point = %s : REACHED", chain ); + a++; + dupdate(); + getkey(); +} int main(void) @@ -439,8 +446,22 @@ int main(void) usb_open(interfaces, GINT_CALL_NULL); #endif + #if(DBGCRSH) + debug_crash( 1 ); + #endif + gint_world_switch( GINT_CALL( is_save_existing )); + #if(DBGCRSH) + debug_crash( 2 ); + if(saveexist) debug_crash_msg( "SAVE : OK FILE EXIST" ); + else debug_crash_msg( "SAVE : FILE DO NOT EXIST" ); + #endif + + #if(DBGCRSH) + debug_crash( 3 ); + #endif + if (!saveexist) // if we do not have saves gint_world_switch( GINT_CALL( saveprogress ) ); // we create a progress file which is empty @@ -458,10 +479,12 @@ int main(void) #if(DBGCRSH) debug_crash( 6 ); + if(paraexist) debug_crash_msg( "PARA : OK FILE EXIST" ); + else debug_crash_msg( "PARA : FILE DO NOT EXIST" ); #endif if (!paraexist) // 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( saveparameters ) ); // we create a parameters file which is empty #if(DBGCRSH) debug_crash( 7 ); diff --git a/src/src/saves.cc b/src/src/saves.cc index 2207f46..3a55e15 100644 --- a/src/src/saves.cc +++ b/src/src/saves.cc @@ -1,12 +1,12 @@ #include "../include/saves.h" -#include +#include #include static const char *filepath= "OutRun.sav"; static const char *filepara= "OutRun.prm"; -bool saveexist; -bool paraexist; +bool saveexist = false; +bool paraexist = false; unsigned int sizeoffile; @@ -33,7 +33,7 @@ void saveprogress( void ) { sizeoffile = sizeof( HallOfFame ); - FILE *file = fopen( filepath, "w" ); + FILE *file = fopen( filepath, "wb" ); fwrite( HallOfFame, sizeoffile, 1, file ); fclose( file ); @@ -44,7 +44,7 @@ void loadprogress( void ) { sizeoffile = sizeof( HallOfFame ); - FILE *file = fopen( filepath, "r" ); + FILE *file = fopen( filepath, "rb" ); fread( HallOfFame, sizeoffile, 1, file ); fclose( file ); @@ -70,7 +70,7 @@ void saveparameters( void ) { sizeoffile = sizeof( PlayerPara ); - FILE *file = fopen( filepara, "w" ); + FILE *file = fopen( filepara, "wb" ); fwrite( PlayerPara, sizeoffile, 1, file ); fclose( file ); @@ -81,7 +81,7 @@ void loadparameters( void ) { sizeoffile = sizeof( PlayerPara ); - FILE *file = fopen( filepara, "r" ); + FILE *file = fopen( filepara, "rb" ); fread( PlayerPara, sizeoffile, 1, file ); fclose( file );