@@ -315,6 +315,7 @@ struct rarch_state
315
315
char launch_arguments [4096 ];
316
316
char path_default_shader_preset [PATH_MAX_LENGTH ];
317
317
char path_content [PATH_MAX_LENGTH ];
318
+ char path_next_content [PATH_MAX_LENGTH ];
318
319
char path_libretro [PATH_MAX_LENGTH ];
319
320
char path_config_file [PATH_MAX_LENGTH ];
320
321
char path_config_append_file [PATH_MAX_LENGTH ];
@@ -2400,6 +2401,8 @@ char *path_get_ptr(enum rarch_path_type type)
2400
2401
{
2401
2402
case RARCH_PATH_CONTENT :
2402
2403
return p_rarch -> path_content ;
2404
+ case RARCH_PATH_NEXT_CONTENT :
2405
+ return p_rarch -> path_next_content ;
2403
2406
case RARCH_PATH_DEFAULT_SHADER_PRESET :
2404
2407
return p_rarch -> path_default_shader_preset ;
2405
2408
case RARCH_PATH_BASENAME :
@@ -2440,6 +2443,8 @@ const char *path_get(enum rarch_path_type type)
2440
2443
{
2441
2444
case RARCH_PATH_CONTENT :
2442
2445
return p_rarch -> path_content ;
2446
+ case RARCH_PATH_NEXT_CONTENT :
2447
+ return p_rarch -> path_next_content ;
2443
2448
case RARCH_PATH_DEFAULT_SHADER_PRESET :
2444
2449
return p_rarch -> path_default_shader_preset ;
2445
2450
case RARCH_PATH_CORE_OPTIONS :
@@ -2480,6 +2485,8 @@ size_t path_get_realsize(enum rarch_path_type type)
2480
2485
{
2481
2486
case RARCH_PATH_CONTENT :
2482
2487
return sizeof (p_rarch -> path_content );
2488
+ case RARCH_PATH_NEXT_CONTENT :
2489
+ return sizeof (p_rarch -> path_next_content );
2483
2490
case RARCH_PATH_DEFAULT_SHADER_PRESET :
2484
2491
return sizeof (p_rarch -> path_default_shader_preset );
2485
2492
case RARCH_PATH_CORE_OPTIONS :
@@ -2548,6 +2555,10 @@ bool path_set(enum rarch_path_type type, const char *path)
2548
2555
strlcpy (p_rarch -> path_content , path ,
2549
2556
sizeof (p_rarch -> path_content ));
2550
2557
break ;
2558
+ case RARCH_PATH_NEXT_CONTENT :
2559
+ strlcpy (p_rarch -> path_next_content , path ,
2560
+ sizeof (p_rarch -> path_next_content ));
2561
+ break ;
2551
2562
case RARCH_PATH_NONE :
2552
2563
break ;
2553
2564
case RARCH_PATH_BASENAME :
@@ -2595,6 +2606,10 @@ bool path_is_empty(enum rarch_path_type type)
2595
2606
if (string_is_empty (p_rarch -> path_content ))
2596
2607
return true;
2597
2608
break ;
2609
+ case RARCH_PATH_NEXT_CONTENT :
2610
+ if (string_is_empty (p_rarch -> path_next_content ))
2611
+ return true;
2612
+ break ;
2598
2613
case RARCH_PATH_CORE :
2599
2614
if (string_is_empty (p_rarch -> path_libretro ))
2600
2615
return true;
@@ -2631,6 +2646,9 @@ void path_clear(enum rarch_path_type type)
2631
2646
case RARCH_PATH_CONTENT :
2632
2647
* p_rarch -> path_content = '\0' ;
2633
2648
break ;
2649
+ case RARCH_PATH_NEXT_CONTENT :
2650
+ * p_rarch -> path_next_content = '\0' ;
2651
+ break ;
2634
2652
case RARCH_PATH_CORE_OPTIONS :
2635
2653
* p_rarch -> path_core_options_file = '\0' ;
2636
2654
break ;
@@ -2660,6 +2678,7 @@ void path_clear(enum rarch_path_type type)
2660
2678
static void path_clear_all (void )
2661
2679
{
2662
2680
path_clear (RARCH_PATH_CONTENT );
2681
+ path_clear (RARCH_PATH_NEXT_CONTENT );
2663
2682
path_clear (RARCH_PATH_CONFIG );
2664
2683
path_clear (RARCH_PATH_CONFIG_APPEND );
2665
2684
path_clear (RARCH_PATH_CONFIG_OVERRIDE );
@@ -5785,6 +5804,68 @@ void main_exit(void *args)
5785
5804
#endif
5786
5805
}
5787
5806
5807
+
5808
+ static bool load_next_content (const char * path )
5809
+ {
5810
+ core_info_list_t * core_info_list = NULL ;
5811
+ core_info_get_list (& core_info_list );
5812
+ if (core_info_list )
5813
+ {
5814
+ size_t list_size ;
5815
+ content_ctx_info_t content_info = { 0 };
5816
+ const core_info_t * core_info = NULL ;
5817
+ core_info_list_get_supported_cores (core_info_list ,
5818
+ (const char * )path , & core_info , & list_size );
5819
+ if (list_size )
5820
+ {
5821
+ path_set (RARCH_PATH_CONTENT , path );
5822
+
5823
+ if (!path_is_empty (RARCH_PATH_CONTENT ))
5824
+ {
5825
+ unsigned i ;
5826
+ core_info_t * current_core = NULL ;
5827
+ core_info_get_current_core (& current_core );
5828
+
5829
+ /*we already have path for libretro core */
5830
+ for (i = 0 ; i < list_size ; i ++ )
5831
+ {
5832
+ const core_info_t * info = (const core_info_t * )& core_info [i ];
5833
+
5834
+ if (string_is_equal (path_get (RARCH_PATH_CORE ), info -> path ))
5835
+ {
5836
+ /* Our previous core supports the current rom */
5837
+ task_push_load_content_with_current_core_from_companion_ui (
5838
+ NULL ,
5839
+ & content_info ,
5840
+ CORE_TYPE_PLAIN ,
5841
+ NULL , NULL );
5842
+ return true;
5843
+ }
5844
+ }
5845
+ }
5846
+ }
5847
+
5848
+ if (list_size >= 1 )
5849
+ {
5850
+ /*pick core that only exists and is bound to work. Ish. */
5851
+ const core_info_t * info = (const core_info_t * )& core_info [0 ];
5852
+
5853
+ if (info )
5854
+ {
5855
+ task_push_load_content_with_new_core_from_companion_ui (
5856
+ info -> path , NULL , NULL , NULL , NULL , & content_info , NULL , NULL );
5857
+ return true;
5858
+ }
5859
+ }
5860
+ else
5861
+ {
5862
+ RARCH_WARN ("There are no core to open %s\n" , path );
5863
+ }
5864
+ }
5865
+
5866
+ return false;
5867
+ }
5868
+
5788
5869
/**
5789
5870
* main_entry:
5790
5871
*
@@ -5888,6 +5969,11 @@ int rarch_main(int argc, char *argv[], void *data)
5888
5969
{
5889
5970
int ret ;
5890
5971
bool app_exit = false;
5972
+
5973
+ if (!path_is_empty (RARCH_PATH_NEXT_CONTENT ) && !string_is_equal (path_get (RARCH_PATH_CONTENT ), path_get (RARCH_PATH_NEXT_CONTENT ))) {
5974
+ load_next_content (path_get (RARCH_PATH_NEXT_CONTENT ));
5975
+ }
5976
+
5891
5977
#ifdef HAVE_QT
5892
5978
ui_companion_qt .application -> process_events ();
5893
5979
#endif
0 commit comments