@@ -20,6 +20,9 @@ class Backend
2020 internal delegate UserInput BisectEventDelegate ( int build , bool final_trigger = false ) ;
2121 internal event BisectEventDelegate BisectEvent ;
2222
23+ internal delegate void BisectErrorDelegate ( string e ) ;
24+ internal event BisectErrorDelegate BisectError ;
25+
2326 internal delegate void UpdateProgressDelegate ( int progress_percentage , string ui_text , ProgressBarStyle progress_type ) ;
2427 internal event UpdateProgressDelegate UpdateProgress ;
2528
@@ -38,14 +41,32 @@ public void Bisect(string boot_title = "")
3841 {
3942 string base_url = "https://dl.dolphin-emu.org/builds/dolphin-master-" ;
4043 int test_index = 0 ;
44+ int test_direction = 0 ;
4145 RunBuild run_build = new RunBuild ( ) ;
4246
4347 while ( ! ( m_first_index == m_second_index - 1 ) )
4448 {
4549
4650 test_index = m_first_index == - 1 ? ( 0 + m_second_index ) / 2 : ( m_first_index + m_second_index ) / 2 ;
4751
48- Download ( base_url + m_build_list [ test_index ] + "-x64.7z" , m_build_list [ test_index ] ) ;
52+ // dumb thing to make sure we keep trying to download a build until we get a valid build
53+ do
54+ {
55+ try
56+ {
57+ Download ( base_url + m_build_list [ test_index ] + "-x64.7z" , m_build_list [ test_index ] ) ;
58+ break ;
59+ }
60+ catch ( Exception e )
61+ {
62+ BisectError ( e . Message ) ;
63+ if ( test_direction == 0 )
64+ -- test_index ;
65+ else
66+ ++ test_index ;
67+ }
68+ }
69+ while ( true ) ;
4970
5071 if ( ! string . IsNullOrEmpty ( boot_title ) )
5172 run_build . Run ( boot_title ) ;
@@ -55,9 +76,15 @@ public void Bisect(string boot_title = "")
5576 UserInput return_val = BisectEvent ( test_index ) ;
5677
5778 if ( return_val == UserInput . Yes )
79+ {
5880 m_first_index = test_index ;
81+ test_direction = 1 ;
82+ }
5983 else if ( return_val == UserInput . No )
84+ {
6085 m_second_index = test_index ;
86+ test_direction = 0 ;
87+ }
6188 else
6289 return ;
6390 }
@@ -103,7 +130,15 @@ public void Download(string url, string version)
103130 {
104131 UpdateProgress ( eventArgs . PercentDone , "Extracting and launching" , ProgressBarStyle . Continuous ) ;
105132 } ;
106- dolphin_zip . ExtractArchive ( "dolphin" ) ;
133+
134+ try
135+ {
136+ dolphin_zip . ExtractArchive ( "dolphin" ) ;
137+ }
138+ catch ( Exception e )
139+ {
140+ throw new Exception ( "Error extracting. Probably a missing build. Skipping this build." , e ) ;
141+ }
107142 }
108143 }
109144 }
0 commit comments