11static VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
22
33mod utils;
4- mod screenshooter;
54
65use std:: sync:: atomic:: Ordering ;
76use std:: sync:: { Arc , Mutex } ;
87use std:: thread;
98use eframe:: egui;
109use utils:: { create_desktop_file, my_exe_path, get_fancy_name, reg_uri_scheme, launch_game, notify} ;
11- use screenshooter:: capture;
1210
1311fn main ( )
1412{
@@ -80,38 +78,6 @@ fn main()
8078 wineprefix = backupprefix;
8179 }
8280
83- let assist_moss = utils:: load_setting ( "assist_moss" ) . unwrap_or_default ( ) ;
84- if & assist_moss == "yes" {
85- println ! ( "yes" ) ;
86- screenshooter:: ASSIST_MOSS . store ( true , Ordering :: Relaxed ) ;
87- }
88-
89- let capture_thread = Arc :: new ( Mutex :: new ( None :: < thread:: JoinHandle < ( ) > > ) ) ;
90- let capture_result = capture ( ) ;
91- match capture_result {
92- Ok ( Some ( handle) ) => {
93- * capture_thread. lock ( ) . unwrap ( ) = Some ( handle) ;
94- }
95- Ok ( None ) => {
96- println ! ( "ASSIST_MOSS is disabled, skipping screenshot capture." ) ;
97- }
98- Err ( e) => {
99- eprintln ! ( "Failed to start capture: {}" , e) ;
100- }
101- }
102-
103- let keyboard_handle = thread:: spawn ( move || {
104- if let Err ( e) = rdev:: listen ( |event| {
105- if event. event_type == rdev:: EventType :: KeyPress ( rdev:: Key :: KpMinus ) {
106- let current = screenshooter:: CAPTURE . load ( Ordering :: Relaxed ) ;
107- screenshooter:: CAPTURE . store ( !current, Ordering :: Relaxed ) ;
108- println ! ( "Capture toggled to: {}" , !current) ;
109- }
110- } ) {
111- eprintln ! ( "Failed to listen for keyboard events: {:?}" , e) ;
112- }
113- } ) ;
114-
11581 let mut args: Vec < String > = std:: env:: args ( ) . skip ( 1 ) . collect :: < Vec < _ > > ( ) ;
11682 if let Some ( first_arg) = args. get ( 0 ) {
11783 if first_arg. starts_with ( "iw1x://" ) || first_arg. starts_with ( "t1x://" ) {
@@ -159,7 +125,7 @@ fn main()
159125 let args_str = args. join ( " " ) ;
160126 let options = eframe:: NativeOptions {
161127 viewport : egui:: ViewportBuilder :: default ( )
162- . with_inner_size ( [ 400.0 , 145 .0 + 115.0 * executables. len ( ) as f32 ] ) ,
128+ . with_inner_size ( [ 400.0 , 140 .0 + 115.0 * executables. len ( ) as f32 ] ) ,
163129 centered : true ,
164130 ..Default :: default ( )
165131 } ;
@@ -168,7 +134,7 @@ fn main()
168134 let game_thread = Arc :: new ( Mutex :: new ( None :: < thread:: JoinHandle < ( ) > > ) ) ;
169135 let dl_thread = Arc :: new ( Mutex :: new ( None :: < thread:: JoinHandle < ( ) > > ) ) ;
170136 let dl_size = utils:: get_download_size ( ) ;
171- let app = CoDLinuxApp :: new ( executables. clone ( ) , args_str. clone ( ) , uo, game_thread. clone ( ) , dl_thread. clone ( ) , wineprefix. clone ( ) , dl_size, screenshooter :: ASSIST_MOSS . load ( Ordering :: Relaxed ) ) ;
137+ let app = CoDLinuxApp :: new ( executables. clone ( ) , args_str. clone ( ) , uo, game_thread. clone ( ) , dl_thread. clone ( ) , wineprefix. clone ( ) , dl_size) ;
172138
173139 eframe:: run_native (
174140 "CoDLinux" ,
@@ -185,11 +151,6 @@ fn main()
185151 }
186152 println ! ( "CoDLinux: GUI closed." ) ;
187153 }
188-
189- if let Some ( handle) = capture_thread. lock ( ) . unwrap ( ) . take ( ) {
190- handle. join ( ) . unwrap ( ) ;
191- }
192- keyboard_handle. join ( ) . unwrap ( ) ;
193154}
194155
195156pub struct CoDLinuxApp
@@ -204,12 +165,11 @@ pub struct CoDLinuxApp
204165 show_update_popup : bool ,
205166 downloading : bool ,
206167 dl_size : String ,
207- assist_moss : bool ,
208168}
209169
210170impl CoDLinuxApp
211171{
212- fn new ( executables : Vec < String > , args : String , uo : bool , game_thread : Arc < Mutex < Option < thread:: JoinHandle < ( ) > > > > , dl_thread : Arc < Mutex < Option < thread:: JoinHandle < ( ) > > > > , wine_prefix : String , dl_size : String , assist_moss : bool ) -> Self {
172+ fn new ( executables : Vec < String > , args : String , uo : bool , game_thread : Arc < Mutex < Option < thread:: JoinHandle < ( ) > > > > , dl_thread : Arc < Mutex < Option < thread:: JoinHandle < ( ) > > > > , wine_prefix : String , dl_size : String ) -> Self {
213173 println ! ( "CoDLinux: Creating app..." ) ;
214174 println ! ( "CoDLinux: Prefix: {:?}" , wine_prefix) ;
215175 CoDLinuxApp {
@@ -223,7 +183,6 @@ impl CoDLinuxApp
223183 show_update_popup : false ,
224184 downloading : false ,
225185 dl_size,
226- assist_moss,
227186 }
228187 }
229188}
@@ -283,13 +242,6 @@ impl eframe::App for CoDLinuxApp
283242 //let _ = utils::remember_game(&executable);
284243 let _ = utils:: save_setting ( "remembered_game" , & executable) ;
285244 }
286- if self . assist_moss {
287- screenshooter:: ASSIST_MOSS . store ( true , Ordering :: Relaxed ) ;
288- let _ = utils:: save_setting ( "assist_moss" , "yes" ) ;
289- }
290- else {
291- let _ = utils:: save_setting ( "assist_moss" , "no" ) ;
292- }
293245 let exe = executable. clone ( ) ;
294246 let args = self . args . clone ( ) ;
295247
@@ -310,7 +262,6 @@ impl eframe::App for CoDLinuxApp
310262 ui. heading ( "Options" ) ;
311263
312264 ui. checkbox ( & mut self . remember , "Remember my choice" ) ;
313- ui. checkbox ( & mut self . assist_moss , "Assist Moss" ) ;
314265 let text_edit = ui. add ( egui:: TextEdit :: singleline ( & mut self . wine_prefix )
315266 . hint_text ( "Wine Prefix" )
316267 . desired_width ( 200.0 ) ) ;
0 commit comments