Skip to content

Commit 5820845

Browse files
author
CarrotRub
committed
FINAL BUILD COMMIT
Fixed and added TODOs to the README.md . Fixed scraping function issue due to new sitemap by fitgirl repack. Fixed 2gb limit. Added better Gamehub functionality. Fixed searchbar issue. Fixed sidebar elements click issue. Fixed scrolling issue. Fixed some design.
1 parent b91d38e commit 5820845

File tree

11 files changed

+160
-83
lines changed

11 files changed

+160
-83
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@ To run the Fit Launcher, simply execute the setup and install it inside
2222
`C:/Program Files/` then run the executable 😃:
2323

2424
```bash
25-
./fit-launcher.exe
25+
./"Fit Launcher.exe"
2626
```
2727

2828
### Development Mode
2929

30-
If you want to run the launcher in development mode, use the following command:
30+
If you want to run the launcher in development mode, follow these steps:
31+
32+
1. Ensure you have any **C++ Compiler**, **Rust**, and **Cargo** installed on your system.
33+
2. Ensure you have these extensions on VSCode **C/C++ Microsoft** or **CodeLLDB** and **rust-analyzer**.
34+
3. Clone this repository.
35+
4. Run the build command:
3136

3237
```bash
3338
npm run tauri dev
@@ -50,7 +55,7 @@ npm run tauri build
5055

5156
Got questions or want to hang out with our users? Join us on Discord! Big thanks to **Kürst** for moderating our Discord server, to **Vintage_Soldier** for the amazing app design, and to **SimplyStoned** for maintaining the old launcher while I was developing this one.
5257

53-
[Join the Discord](https://discord.gg/cXaBWdcUSF) <!-- Replace with your Discord link -->
58+
[Join the Discord](https://discord.gg/cXaBWdcUSF)
5459

5560
## Credits
5661

@@ -68,3 +73,4 @@ Enjoy your games with Fit Launcher! 🎮🚀
6873
- 🖥️ **Better Cross-Platform Compatibility**: Improve compatibility across different operating systems.
6974
- 🌄 **Quicker Image Loading**: Optimize the speed at which images are retrieved and displayed.
7075
- 🎮 **Filtering by Genres and Sizes**: Implement filters to sort games by genres and file sizes.
76+
- 📟 **Control CPU Usage**: Allow the user to limit the CPU usage of the setup.

src-tauri/src/scrapingfunc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,8 @@ pub mod commands_scraping {
782782
},
783783
}
784784

785-
// Check for the first 4 files
786-
for page_number in 1..=4 {
785+
// Check for the first 5 files
786+
for page_number in 1..=5 {
787787
let relative_filename = format!("post-sitemap{}.xml", page_number);
788788
let concrete_path = &binding.join(relative_filename);
789789
println!("{:#?}", concrete_path);
@@ -794,11 +794,11 @@ pub mod commands_scraping {
794794
}
795795

796796

797-
// If all first 4 files exist, only download the 5th file
797+
// If all first 5 files exist, only download the 5th file
798798
let range = if all_files_exist {
799-
5..=5
799+
6..=6
800800
} else {
801-
1..=5
801+
1..=6
802802
};
803803

804804
// Download files as needed

src-tauri/src/torrentfunc.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ pub mod torrent_functions {
135135
checkboxes_list: Vec<String>,
136136
file_list_tx: oneshot::Sender<Vec<String>>,
137137
file_selection_rx: oneshot::Receiver<Vec<usize>>,
138+
two_gb_limit: bool,
138139
) -> Result<(), anyhow::Error> {
139140
let output_dir = download_path.clone();
140141
let mut session = SESSION.lock().await;
@@ -229,8 +230,6 @@ pub mod torrent_functions {
229230
let stats = handle_clone.stats();
230231
let mut torrent_stats = torrent_stats.lock().await;
231232

232-
233-
println!("Checking RESUME_FLAG...");
234233
if RESUME_FLAG.load(Ordering::Relaxed) {
235234
println!("RESUME FLAG IS TRUE");
236235
RESUME_FLAG.store(false, Ordering::Relaxed); // Reset the flag
@@ -239,6 +238,19 @@ pub mod torrent_functions {
239238
Err(e) => eprintln!("Error resuming torrent: {:#?}", e),
240239
}
241240
}
241+
242+
if STOP_FLAG_TORRENT.load(Ordering::Relaxed) {
243+
session_clone.stop().await;
244+
STOP_GET_STATS.store(true, Ordering::Relaxed);
245+
break;
246+
}
247+
248+
249+
if PAUSE_FLAG.load(Ordering::Relaxed) {
250+
let _ = handle_clone.pause();
251+
}
252+
253+
242254
torrent_stats.state = stats.state.clone();
243255
torrent_stats.file_progress = stats.file_progress.clone();
244256
torrent_stats.error = stats.error.clone();
@@ -268,19 +280,12 @@ pub mod torrent_functions {
268280
println!("waiting...");
269281
thread::sleep(time::Duration::from_millis(3000));
270282
println!("continue !");
271-
windows_ui_automation::automate_until_download(checkboxes_list, &necessary_game_path, true);
283+
windows_ui_automation::automate_until_download(checkboxes_list, &necessary_game_path, two_gb_limit);
272284
println!("done for real");
273285
break;
274286
}
275287

276-
if STOP_FLAG_TORRENT.load(Ordering::Relaxed) {
277-
session_clone.stop().await;
278-
break;
279-
}
280-
281-
if PAUSE_FLAG.load(Ordering::Relaxed) {
282-
handle_clone.pause();
283-
}
288+
284289

285290

286291
} else {
@@ -347,7 +352,8 @@ pub mod torrent_commands {
347352
magnet_link: String,
348353
download_path: String,
349354
torrent_state: State<'_, super::TorrentState>,
350-
list_checkbox: Vec<String>
355+
list_checkbox: Vec<String>,
356+
should_limit: bool
351357
) -> Result<Vec<String>, String> {
352358

353359
let torrent_stats: Arc<Mutex<super::TorrentStatsInformations>> = Arc::clone(&torrent_state.stats);
@@ -372,6 +378,7 @@ pub mod torrent_commands {
372378
list_checkbox,
373379
file_list_tx,
374380
file_selection_rx,
381+
should_limit
375382
)
376383
.await
377384
{

src/components/Gamedownloadvertical-01/Gamedownloadvertical.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ function Gameverticaldownloadslide({ isActive }) {
220220

221221
const handleStopTorrent = () => {
222222
invoke('stop_torrent_command');
223+
localStorage.removeItem('CDG');
224+
window.dispatchEvent(new Event('storage'));
225+
console.log("donea")
223226
}
224227

225228
return (

src/components/Gamehorizontal-01/Gamehorizontal.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const GameHorizontalSlide = ({ gameTitlePromise, filePathPromise, gameLinkPromis
169169
magnetLink: cdgGameMagnet,
170170
downloadPath: inputPath,
171171
listCheckbox: externalCheckboxes(),
172-
shouldTwoGbLimit: should_bool_limit,
172+
shouldLimit: should_bool_limit,
173173

174174
});
175175

@@ -360,6 +360,8 @@ const GameHorizontalSlide = ({ gameTitlePromise, filePathPromise, gameLinkPromis
360360
fetchGameInfo(gameTitle, filePath);
361361
try {
362362
fetchAdditionalImages();
363+
const body = document.body;
364+
body.style = 'overflow-y : hidden;'
363365
} catch (error) {
364366
throw new Error(error);
365367
}
@@ -429,6 +431,8 @@ const GameHorizontalSlide = ({ gameTitlePromise, filePathPromise, gameLinkPromis
429431
async function slideDown() {
430432
const horizontalSlide = document.querySelector('.horizontal-slide');
431433
horizontalSlide.style.transform = 'translateY(100%)';
434+
const body = document.body;
435+
body.style = '';
432436
invoke(`stop_get_games_images`);
433437
clearAllTimeoutsID();
434438
if(searchResultDisplay()) {

src/components/Searchbar-01/Searchbar.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Searchbar() {
4343
const appDir = await appConfigDir();
4444
const dirPath = appDir.replace(/\\/g, '/');
4545

46-
for (let i = 1; i <= 5; i++) {
46+
for (let i = 1; i <= 6; i++) {
4747
let sitemapURL = `${dirPath}sitemaps/post-sitemap${i}.xml`;
4848
let convertedSitemapURL = convertFileSrc(sitemapURL);
4949
requests.push(fetch(convertedSitemapURL));
@@ -111,10 +111,12 @@ function Searchbar() {
111111
const fileContent = fileContentObj.content;
112112
const gameData = JSON.parse(fileContent);
113113
gameData.forEach(game => {
114-
render(
115-
<GameHorizontalSlide gameTitlePromise={game.title} filePathPromise={configDir} gameLinkPromise={game.href} />,
116-
mainContentDiv
117-
);
114+
render(() => (
115+
<GameHorizontalSlide
116+
gameTitlePromise={game.title}
117+
filePathPromise={configDir}
118+
gameLinkPromise={game.href} />),
119+
mainContentDiv);
118120
});
119121
});
120122
setSelectedGameLink(result); // Set the selected game link

src/components/Sidebar-01/Downloadingpartsidebar-01/Downloadingpartsidebar.jsx

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,27 @@ function Downloadingpartsidebar() {
2626
onMount(() => {
2727
window.addEventListener('start-download', startDownloadListener)
2828
const cdg = localStorage.getItem('CDG') || '[]'
29+
window.addEventListener('storage', stopTorrent)
2930
setCdgObject(JSON.parse(cdg))
3031

3132
})
3233

34+
const stopTorrent = async () => {
35+
try {
36+
// Clear CDG and DownloadSidePart from localStorage
37+
localStorage.removeItem('CDG');
38+
localStorage.removeItem('CDG_Stats');
39+
40+
// Update state to reflect no active download
41+
setCdgObject([]);
42+
43+
window.location.reload();
44+
45+
} catch (error) {
46+
console.error('Error stopping torrent:', error);
47+
}
48+
};
49+
3350
let shouldStopFetching = false; // Flag to control the loop
3451

3552
const fetchTorrentStats = async () => {
@@ -251,24 +268,19 @@ function Downloadingpartsidebar() {
251268

252269
return (
253270
<>
254-
<Dynamic
255-
component="div"
256-
style={`--bg-length: ${
257-
isNaN(oldPercentage()) ? 0 : oldPercentage()
258-
}%`}
259-
className="currently-downloading-game"
260-
onClick={toggleSidebar}
261-
>
271+
<div
272+
style={`--bg-length: ${
273+
isNaN(oldPercentage()) ? 0 : oldPercentage()
274+
}%`}
275+
className="currently-downloading-game"
276+
onClick={toggleSidebar}>
262277
{ gameObjectProduced() ? (
263278
<>
264279
<div className="current-image-container">
265-
<Dynamic
266-
component="img"
267-
className="current-image"
268-
src={gameObjectProduced().gameImage}
269-
alt="Game Image"
270-
/>
271-
{/* My heart told me to write weird-circle but my brain force me to write action-circle :( */}
280+
281+
<img className="current-image" src={gameObjectProduced().gameImage} alt="Game Image"></img>
282+
283+
{/* My heart told me to write weird-circle but my brain force me to write action-circle :( */}
272284
<div className="action-circle">
273285
<div className="action-circle-logo">
274286
{ isInitializing() ? (
@@ -293,13 +305,9 @@ function Downloadingpartsidebar() {
293305
</div>
294306

295307
<div className="current-text-container">
296-
297-
<Dynamic
298-
component="p"
299-
className="currently-downloading-game-title"
300-
>
301-
{gameObjectProduced().gameTitle}
302-
</Dynamic>
308+
<p className="currently-downloading-game-title">
309+
{gameObjectProduced().gameTitle}
310+
</p>
303311

304312
<p className="currently-downloading-game-info">
305313
<span id="downloading-speed">
@@ -314,12 +322,8 @@ function Downloadingpartsidebar() {
314322
) : currentImage() || cdgObject().length > 0 ? (
315323
<>
316324
<div className="current-image-container">
317-
<Dynamic
318-
component="img"
319-
className="current-image"
320-
src={currentImage()}
321-
alt="Game Image"
322-
/>
325+
326+
<img className="current-image" src={currentImage()} alt="Game Image"></img>
323327

324328
{/* My heart told me to write weird-circle but my brain force me to write action-circle :( */}
325329
<div className="action-circle">
@@ -333,12 +337,11 @@ function Downloadingpartsidebar() {
333337

334338
</div>
335339
<div className="current-text-container">
336-
<Dynamic
337-
component="p"
338-
className="currently-downloading-game-title"
339-
>
340+
341+
<p className="currently-downloading-game-title">
340342
{currentTitle()}
341-
</Dynamic>
343+
</p>
344+
342345
<p className="currently-downloading-game-info">
343346
<span id="downloading-speed">
344347
{oldDownloadingSpeed()}
@@ -354,7 +357,7 @@ function Downloadingpartsidebar() {
354357
)
355358
}
356359

357-
</Dynamic>
360+
</div>
358361
{isSidebarActive() && (
359362
<Gameverticaldownloadslide isActive={isSidebarActive()} />
360363
)}

src/components/Sidebar-01/Recentlydownloaded/Recentlydownloaded.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
.sidebar-unique-game p {
2525
display: -webkit-box;
26-
-webkit-line-clamp: 2; /* Limit the number of lines to 2 */
26+
margin-right: 1em;
27+
-webkit-line-clamp: 2;
2728
line-clamp: 2;
2829
-webkit-box-orient: vertical;
2930
overflow: hidden;

0 commit comments

Comments
 (0)