Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Formatting #148

Merged
merged 7 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tauri-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest]
platform: [windows-latest, macos-13, macos-latest]

runs-on: ${{ matrix.platform }}
steps:
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ winget install LazapDevelopment.Lazap
- Arch Linux users can directly install from the maintained `lazap-bin` [AUR](https://aur.archlinux.org/packages/lazap-bin).

▸ **MacOS**:
- Download and install the latest `.dmg` file in the [releases](https://github.com/Lazap-Development/lazap/releases) section.
> [!NOTE]
> Most modern MacOS systems are of `aarch64` (also known as ARM) instead of `x64` architecture. <br>
> Execute the `arch` command in a new terminal to confirm your MacOS architecture.
- Download and install the latest `[x64/aarch64].dmg` file in the [releases](https://github.com/Lazap-Development/lazap/releases) section.


## 👾 Development

Expand Down
2 changes: 1 addition & 1 deletion src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build()
}
1 change: 1 addition & 0 deletions src-tauri/src/addons/ytm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion src-tauri/src/launchers/custom_games.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
},
CONFIG_DIR,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
struct GameData {
Expand Down
53 changes: 30 additions & 23 deletions src-tauri/src/launchers/gog.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use crate::{
launchers::{
GameObject,
LINE_ENDING,
},
operations::custom_fs::d_f_exists,
launchers::{GameObject, LINE_ENDING},
modules::banners,
operations::custom_fs::d_f_exists,
};
use serde::{Deserialize, Serialize};
use std::{os::windows::process::CommandExt, process::Command, str};
Expand All @@ -21,11 +18,13 @@ struct ImageData {

pub async fn get_installed_games() -> Vec<GameObject> {
let mut gameobjects = vec![];
if !d_f_exists("C:\\ProgramData\\GOG.com\\Galaxy\\storage").await.expect("Something went wrong")
if !d_f_exists("C:\\ProgramData\\GOG.com\\Galaxy\\storage")
.await
.expect("Something went wrong")
{
return vec![];
}

struct InstalledGame {
product_id: i32,
installation_path: String,
Expand Down Expand Up @@ -55,15 +54,15 @@ pub async fn get_installed_games() -> Vec<GameObject> {
})
.await
.unwrap();

let games_data = conn
.call(|conn| {
let mut stmt = conn.prepare("SELECT * FROM LimitedDetails")?;
let data = stmt
.query_map([], |row| {
Ok(GameData {
product_id: row.get(1).unwrap_or_default(),
title: row.get(5).unwrap_or_default(),
.call(|conn| {
let mut stmt = conn.prepare("SELECT * FROM LimitedDetails")?;
let data = stmt
.query_map([], |row| {
Ok(GameData {
product_id: row.get(1).unwrap_or_default(),
title: row.get(5).unwrap_or_default(),
banner: row.get(7).unwrap_or_default(),
})
})
Expand Down Expand Up @@ -94,14 +93,13 @@ pub async fn get_installed_games() -> Vec<GameObject> {
.to_string()
.split(LINE_ENDING)
.filter(|x| x.contains("REG_SZ") && x.contains("client"))
.map(
|x| x.split("REG_SZ").collect::<Vec<_>>()[1].trim()
)
.map(|x| x.split("REG_SZ").collect::<Vec<_>>()[1].trim())
.collect::<Vec<_>>()
.into_iter()
.rev()
.collect::<Vec<_>>().join("\\");

.collect::<Vec<_>>()
.join("\\");

for game in games.unwrap() {
let product_id = game.product_id;
let game_data = games_data
Expand All @@ -110,12 +108,21 @@ pub async fn get_installed_games() -> Vec<GameObject> {
.unwrap();
let img_data: ImageData = serde_json::from_str(&game_data.banner).unwrap();
gameobjects.push(GameObject::new(
banners::get_banner(&game_data.title, &(product_id.to_string()), "GOG", &img_data.icon).await,
banners::get_banner(
&game_data.title,
&(product_id.to_string()),
"GOG",
&img_data.icon,
)
.await,
String::new(),
game.installation_path.to_string(),
game_data.title.to_string(),
product_id.to_string(),
format!("\"{}\"", launcher_location) + " /command=runGame" + &format!(" /gameId={}", game.product_id) + &format!(" /path=\"{}\"", game.installation_path),
format!("\"{}\"", launcher_location)
+ " /command=runGame"
+ &format!(" /gameId={}", game.product_id)
+ &format!(" /path=\"{}\"", game.installation_path),
0,
String::new(),
"GOG".to_string(),
Expand All @@ -126,4 +133,4 @@ pub async fn get_installed_games() -> Vec<GameObject> {
return gameobjects;
}

// "C:\Program Files (x86)\GOG Galaxy\GalaxyClient.exe" /command=runGame /gameId=1810005965 /path="C:\Program Files (x86)\GOG Galaxy\Games\Roboplant Demo"
// "C:\Program Files (x86)\GOG Galaxy\GalaxyClient.exe" /command=runGame /gameId=1810005965 /path="C:\Program Files (x86)\GOG Galaxy\Games\Roboplant Demo"
2 changes: 1 addition & 1 deletion src-tauri/src/launchers/minecraft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn get_minecraft_launcher() -> Option<GameObject> {
// TO-DO: FINISH MACOS
#[cfg(target_os = "macos")]
{
return None
return None;
}

#[cfg(target_os = "windows")]
Expand Down
10 changes: 3 additions & 7 deletions src-tauri/src/launchers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod custom_games;
#[cfg(target_os = "windows")]
mod epic_games;
#[cfg(target_os = "windows")]
Expand All @@ -12,7 +13,6 @@ mod steam;
mod uplay;
#[cfg(target_os = "linux")]
mod wine_managers;
pub mod custom_games;

use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -71,9 +71,7 @@ fn is_installed(native_name: &str, flatpak_name: &str) -> bool {
String::default()
}
}
Err(_e) => {
String::default()
}
Err(_e) => String::default(),
};

let native = match std::process::Command::new("which")
Expand All @@ -87,9 +85,7 @@ fn is_installed(native_name: &str, flatpak_name: &str) -> bool {
String::default()
}
}
Err(_e) => {
String::default()
}
Err(_e) => String::default(),
};

if native.starts_with("/") {
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/launchers/rockstar_games.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ async fn parse_game_object(path: &str, name: &str) -> Option<GameObject> {
}

return Some(GameObject::new(
banners::get_banner(&game.friendly_name, &game.banner_id, "RockstarGames", "").await,
banners::get_banner(&game.friendly_name, &game.banner_id, "RockstarGames", "")
.await,
executable.to_string(),
path.to_string(),
game.friendly_name.clone(),
Expand Down
9 changes: 6 additions & 3 deletions src-tauri/src/launchers/steam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ pub async fn get_installed_games() -> Vec<GameObject> {

#[cfg(target_os = "macos")]
temp_all_games.push(GameObject::new(
banners::get_banner(&game_file_parsed.name, &game_file_parsed.appid, "Steam", "").await,
banners::get_banner(&game_file_parsed.name, &game_file_parsed.appid, "Steam", "")
.await,
String::new(),
game_file_parsed.installdir.to_string(),
game_file_parsed.name,
Expand All @@ -144,7 +145,8 @@ pub async fn get_installed_games() -> Vec<GameObject> {

#[cfg(target_os = "windows")]
temp_all_games.push(GameObject::new(
banners::get_banner(&game_file_parsed.name, &game_file_parsed.appid, "Steam", "").await,
banners::get_banner(&game_file_parsed.name, &game_file_parsed.appid, "Steam", "")
.await,
String::new(),
game_file_parsed.launcherpath.to_string(),
game_file_parsed.name,
Expand All @@ -158,7 +160,8 @@ pub async fn get_installed_games() -> Vec<GameObject> {

#[cfg(target_os = "linux")]
temp_all_games.push(GameObject::new(
banners::get_banner(&game_file_parsed.name, &game_file_parsed.appid, "Steam", "").await,
banners::get_banner(&game_file_parsed.name, &game_file_parsed.appid, "Steam", "")
.await,
String::new(),
String::new(),
game_file_parsed.name,
Expand Down
6 changes: 5 additions & 1 deletion src-tauri/src/launchers/wine_managers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use tauri::api::path;
use tokio_rusqlite::Connection;

use crate::{launchers::{is_installed, GameObject}, modules::banners, operations::custom_fs::d_f_exists};
use crate::{
launchers::{is_installed, GameObject},
modules::banners,
operations::custom_fs::d_f_exists,
};

pub async fn get_installed_games() -> Vec<GameObject> {
let mut all_games: Vec<GameObject> = Vec::new();
Expand Down
Loading
Loading