From 95c3c6e954ed94a5c6b110cccfda4196e1c449bb Mon Sep 17 00:00:00 2001 From: Slyvtt Date: Thu, 2 Feb 2023 21:47:57 +0100 Subject: [PATCH] try to make it run with gint 2.9.0 --- CMakeLists.txt | 8 +++---- send | 2 +- src/include/segment.h | 2 -- src/include/utils.h | 2 +- src/main.cc | 55 ++++++++++++++++++++++++++++++++++++------- src/parameters.h | 4 +--- src/src/circuit.cc | 2 +- src/src/menus.cc | 2 +- src/src/saves.cc | 2 +- 9 files changed, 56 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94420ca..0c5f8d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(MyAddin) include(GenerateG3A) include(Fxconv) -find_package(Gint 2.7.0 REQUIRED) +find_package(Gint 2.9.0 REQUIRED) find_package(LibProf 2.4 REQUIRED) set(SOURCES @@ -118,11 +118,11 @@ 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++11 -c -fno-rtti -fno-use-cxa-atexit -fpermissive) -target_link_libraries(myaddin LibProf::LibProf Gint::Gint -lustl -lc) +target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -std=c++20 -c -fno-rtti -fpermissive) +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.000.0000 + generate_g3a(TARGET myaddin OUTPUT "OutRun.g3a" VERSION 01.090.0000 NAME "OutRun" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) endif() diff --git a/send b/send index 273aa57..b01e9b6 100755 --- a/send +++ b/send @@ -1 +1 @@ -fxlink -sw *.g3a +fxlink -sw *.g3a -u diff --git a/src/include/segment.h b/src/include/segment.h index a174920..ccfa459 100644 --- a/src/include/segment.h +++ b/src/include/segment.h @@ -7,8 +7,6 @@ #include -#define std ustl - enum BiomeType { PLAINS = 0, diff --git a/src/include/utils.h b/src/include/utils.h index 30f9a65..c36002b 100644 --- a/src/include/utils.h +++ b/src/include/utils.h @@ -3,7 +3,7 @@ #include -#include +#include #include diff --git a/src/main.cc b/src/main.cc index fce7e02..d8d5938 100644 --- a/src/main.cc +++ b/src/main.cc @@ -29,7 +29,8 @@ #include #include - +#include +#include #include @@ -78,6 +79,7 @@ struct DataPerf }; extern bool saveexist; +extern bool paraexist; BestRanking HallOfFame[10][5]; // Table of score : 10 levels * 5 best scores uint32_t FinalTime=0; bool skipranking=false; @@ -414,34 +416,63 @@ static void get_inputs_finish_fail( void ) } +#define DBGCRSH 1 +int a=0; +void debug_crash( int value ) +{ + dprint( 1, 1+a*10, C_BLACK, "point = %d : REACHED", value ); + a++; + dupdate(); + getkey(); +} + + + int main(void) { __printf_enable_fp(); __printf_enable_fixed(); + #if IS_FXLIB==1 usb_interface_t const *interfaces[] = { &usb_ff_bulk, NULL }; usb_open(interfaces, GINT_CALL_NULL); #endif - - gint_world_switch( GINT_CALL( is_save_existing )); if (!saveexist) // if we do not have saves gint_world_switch( GINT_CALL( saveprogress ) ); // we create a progress file which is empty + #if(DBGCRSH) + debug_crash( 4 ); + #endif + gint_world_switch( GINT_CALL( loadprogress )); // then we load it - + #if(DBGCRSH) + debug_crash( 5 ); + #endif gint_world_switch( GINT_CALL( is_param_existing )); - if (!saveexist) // if we do not have saves + #if(DBGCRSH) + debug_crash( 6 ); + #endif + + if (!paraexist) // if we do not have saves gint_world_switch( GINT_CALL( saveparameters ) ); // we create a progress file which is empty + #if(DBGCRSH) + debug_crash( 7 ); + #endif + gint_world_switch( GINT_CALL( loadparameters )); // then we load it + #if(DBGCRSH) + debug_crash( 8 ); + #endif + DiffLevel=PlayerPara[0].DiffLevel; CarsNumb=PlayerPara[0].CarsNumb; @@ -471,12 +502,12 @@ int main(void) isOCPossible = false; #endif - if((!strncmp(osv, "03.", 3) && osv[3] <= '6') && gint[HWCALC] == HWCALC_FXCG50) // CG-50 + if((!strncmp(osv, "03.", 3) && osv[3] <= '7') && gint[HWCALC] == HWCALC_FXCG50) // CG-50 { extended_ram.name = "extram"; extended_ram.is_default = true; extended_ram.start = (void *)0x8c200000; - extended_ram.end = (void *)0x8c500000 ; + extended_ram.end = (void *)0x8c4dffff ; kmalloc_init_arena(&extended_ram, true); kmalloc_add_arena(&extended_ram ); @@ -506,7 +537,7 @@ int main(void) extended_ram.name = "extram"; extended_ram.is_default = true; extended_ram.start = (void *)0x88200000; - extended_ram.end = (void *)0x88500000 ; + extended_ram.end = (void *)0x884dffff ; kmalloc_init_arena(&extended_ram, true); kmalloc_add_arena(&extended_ram ); @@ -516,6 +547,11 @@ int main(void) else abort(); + #if(DBGCRSH) + debug_crash( 2 ); + #endif + + srand( rtc_ticks() ); prof_init(); @@ -788,7 +824,8 @@ int main(void) if (traffic[indexCar]->wX>(roadpart-0.22f) && traffic[indexCar]->wX<(roadpart+0.22f) && traffic[indexCar]->SpeedSpeed - 0.5; - score = max(0, score-250); + if (score>250) score-=250; + else score=0; } } diff --git a/src/parameters.h b/src/parameters.h index 15f7634..4a510de 100644 --- a/src/parameters.h +++ b/src/parameters.h @@ -26,9 +26,7 @@ #define MAX_SUBIMAGES_CARS 12 #define NB_CARS_TYPES 8 -#define std ustl - -#define IS_FXLIB 1 +#define IS_FXLIB 0 #endif // PARAMETERS_H diff --git a/src/src/circuit.cc b/src/src/circuit.cc index 07c166f..7aaecd5 100644 --- a/src/src/circuit.cc +++ b/src/src/circuit.cc @@ -7,7 +7,7 @@ #include "../parameters.h" #include -#include +#include #include #include "../include/drawstuff.h" diff --git a/src/src/menus.cc b/src/src/menus.cc index 453e70a..be4119f 100644 --- a/src/src/menus.cc +++ b/src/src/menus.cc @@ -6,7 +6,7 @@ #include #include -#include +#include #include "../include/utils.h" #include "../include/saves.h" diff --git a/src/src/saves.cc b/src/src/saves.cc index 4a6dfab..2207f46 100644 --- a/src/src/saves.cc +++ b/src/src/saves.cc @@ -1,5 +1,5 @@ #include "../include/saves.h" -#include +#include #include