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

v0.4.2 #42

Merged
merged 4 commits into from
Jul 19, 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
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hoyo.gacha",
"version": "0.4.1",
"version": "0.4.2",
"description": "An unofficial tool for managing and analyzing your miHoYo gacha records",
"author": "lgou2w <[email protected]>",
"homepage": "https://github.com/lgou2w/HoYo.Gacha#readme",
Expand Down
8 changes: 7 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hoyo_gacha"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
authors = ["lgou2w"]
description = "An unofficial tool for managing and analyzing your miHoYo gacha records"
Expand Down Expand Up @@ -39,6 +39,12 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
url = "2.5.2"

[target."cfg(windows)".dependencies.windows]
version = "0.39.0"
features = [
"Win32_UI_WindowsAndMessaging"
]

[features]
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
49 changes: 45 additions & 4 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,55 @@ fn main() {
.plugin(storage::StoragePluginBuilder::new().build())
.plugin(gacha::GachaPluginBuilder::new().build())
.setup(|app| {
let open_devtools = cfg!(debug_assertions) || std::env::var("DEVTOOLS").is_ok();
if open_devtools {
use tauri::Manager;
app.get_window("main").unwrap().open_devtools();
use tauri::Manager;
let main_window = app.get_window("main").unwrap();

#[cfg(windows)]
fixed_hdpi_problem(&main_window);

if cfg!(debug_assertions) || std::env::var("DEVTOOLS").is_ok() {
main_window.open_devtools();
}
Ok(())
})
.invoke_handler(commands::get_handlers())
.run(tauri::generate_context!())
.expect("error while running tauri application")
}

// See: https://github.com/lgou2w/HoYo.Gacha/issues/40
// It's not a perfect fix.
#[cfg(windows)]
fn fixed_hdpi_problem(window: &tauri::Window) {
use windows::Win32::UI::WindowsAndMessaging::GetSystemMetrics;
use windows::Win32::UI::WindowsAndMessaging::{SM_CXSCREEN, SM_CYSCREEN};

let (_screen_width, screen_height) =
unsafe { (GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)) };

// If under 1080P, maximize the window
// and allow resize width and height.
if screen_height < 1080 {
window.maximize().unwrap();
return;
}

let scale_factor = window.scale_factor().unwrap();

const WIDTH: f64 = 1152.;
const HEIGHT: f64 = 864.;

// If the scaling factor is greater than 1.0,
// then adjust the window height.
if scale_factor > 1. {
let new_height = HEIGHT / scale_factor;
window
.set_size(tauri::LogicalSize::new(WIDTH, new_height))
.unwrap();
}

// Only the minimum height adjustment is allowed
window
.set_min_size(Some(tauri::LogicalSize::new(WIDTH, 0.)))
.unwrap();
}
6 changes: 2 additions & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "HoYo_Gacha",
"version": "0.4.1"
"version": "0.4.2"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -63,13 +63,11 @@
"windows": [
{
"fullscreen": false,
"height": 864,
"resizable": true,
"center": true,
"title": "HoYo.Gacha",
"width": 1152,
"minHeight": 864,
"minWidth": 1152
"height": 864
}
]
}
Expand Down
Binary file added src/assets/images/genshin/character/10000099.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/genshin/weapon/13513.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/starrail/character/1218.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/starrail/character/1221.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/starrail/weapon/23029.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/starrail/weapon/23030.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions src/components/gacha/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import GenshinCharacter10000094 from '@/assets/images/genshin/character/10000094
import GenshinCharacter10000095 from '@/assets/images/genshin/character/10000095.png'
import GenshinCharacter10000096 from '@/assets/images/genshin/character/10000096.png'
import GenshinCharacter10000098 from '@/assets/images/genshin/character/10000098.png'
import GenshinCharacter10000099 from '@/assets/images/genshin/character/10000099.png'
import GenshinWeapon11501 from '@/assets/images/genshin/weapon/11501.png'
import GenshinWeapon11502 from '@/assets/images/genshin/weapon/11502.png'
import GenshinWeapon11503 from '@/assets/images/genshin/weapon/11503.png'
Expand Down Expand Up @@ -67,6 +68,7 @@ import GenshinWeapon13507 from '@/assets/images/genshin/weapon/13507.png'
import GenshinWeapon13509 from '@/assets/images/genshin/weapon/13509.png'
import GenshinWeapon13511 from '@/assets/images/genshin/weapon/13511.png'
import GenshinWeapon13512 from '@/assets/images/genshin/weapon/13512.png'
import GenshinWeapon13513 from '@/assets/images/genshin/weapon/13513.png'
import GenshinWeapon14501 from '@/assets/images/genshin/weapon/14501.png'
import GenshinWeapon14502 from '@/assets/images/genshin/weapon/14502.png'
import GenshinWeapon14504 from '@/assets/images/genshin/weapon/14504.png'
Expand Down Expand Up @@ -105,6 +107,8 @@ import StarRailCharacter1211 from '@/assets/images/starrail/character/1211.png'
import StarRailCharacter1212 from '@/assets/images/starrail/character/1212.png'
import StarRailCharacter1213 from '@/assets/images/starrail/character/1213.png'
import StarRailCharacter1217 from '@/assets/images/starrail/character/1217.png'
import StarRailCharacter1218 from '@/assets/images/starrail/character/1218.png'
import StarRailCharacter1221 from '@/assets/images/starrail/character/1221.png'
import StarRailCharacter1302 from '@/assets/images/starrail/character/1302.png'
import StarRailCharacter1303 from '@/assets/images/starrail/character/1303.png'
import StarRailCharacter1304 from '@/assets/images/starrail/character/1304.png'
Expand Down Expand Up @@ -145,6 +149,8 @@ import StarRailWeapon23025 from '@/assets/images/starrail/weapon/23025.png'
import StarRailWeapon23026 from '@/assets/images/starrail/weapon/23026.png'
import StarRailWeapon23027 from '@/assets/images/starrail/weapon/23027.png'
import StarRailWeapon23028 from '@/assets/images/starrail/weapon/23028.png'
import StarRailWeapon23029 from '@/assets/images/starrail/weapon/23029.png'
import StarRailWeapon23030 from '@/assets/images/starrail/weapon/23030.png'
import ZenlessCharacter1021 from '@/assets/images/zzz/character/1021.png'
import ZenlessCharacter1041 from '@/assets/images/zzz/character/1041.png'
import ZenlessCharacter1091 from '@/assets/images/zzz/character/1091.png'
Expand Down Expand Up @@ -216,7 +222,8 @@ const Genshin = {
千织: [10000094, GenshinCharacter10000094],
希格雯: [10000095, GenshinCharacter10000095],
阿蕾奇诺: [10000096, GenshinCharacter10000096],
克洛琳德: [10000098, GenshinCharacter10000098]
克洛琳德: [10000098, GenshinCharacter10000098],
艾梅莉埃: [10000099, GenshinCharacter10000099]
},
weapon: {
风鹰剑: [11501, GenshinWeapon11501],
Expand Down Expand Up @@ -246,6 +253,7 @@ const Genshin = {
薙草之稻光: [13509, GenshinWeapon13509],
赤沙之杖: [13511, GenshinWeapon13511],
赤月之形: [13512, GenshinWeapon13512],
柔灯挽歌: [13513, GenshinWeapon13513],
天空之卷: [14501, GenshinWeapon14501],
四风原典: [14502, GenshinWeapon14502],
尘世之锁: [14504, GenshinWeapon14504],
Expand Down Expand Up @@ -289,6 +297,8 @@ const StarRail = {
1212: [1212, StarRailCharacter1212],
1213: [1213, StarRailCharacter1213],
1217: [1217, StarRailCharacter1217],
1218: [1218, StarRailCharacter1218],
1221: [1221, StarRailCharacter1221],
1302: [1302, StarRailCharacter1302],
1303: [1303, StarRailCharacter1303],
1304: [1304, StarRailCharacter1304],
Expand Down Expand Up @@ -330,7 +340,9 @@ const StarRail = {
23025: [23025, StarRailWeapon23025],
23026: [23026, StarRailWeapon23026],
23027: [23027, StarRailWeapon23027],
23028: [23028, StarRailWeapon23028]
23028: [23028, StarRailWeapon23028],
23029: [23029, StarRailWeapon23029],
23030: [23030, StarRailWeapon23030]
}
} as const

Expand Down
Loading