Skip to content

Commit

Permalink
feat: Added ZZZ support (Jorixon#205) Thanks @Pyrageis
Browse files Browse the repository at this point in the history
chore: Changed validation check for model import loader exe name

fix: Mod update notification would always be shown for first update check for new mod

---------

Co-authored-by: Pyrageis <[email protected]>
  • Loading branch information
Jorixon and Pyrageis authored Jul 11, 2024
1 parent b84a685 commit 41b2497
Show file tree
Hide file tree
Showing 59 changed files with 737 additions and 82 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -664,5 +664,6 @@ Testing/
.Publish/
Testing_honkai/
Testing_wuwa/
Testing_ZZZ/

# End of https://www.toptal.com/developers/gitignore/api/visualstudio,csharp,rider
3 changes: 2 additions & 1 deletion src/GIMI-ModManager.Core/GamesService/FileNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public enum SupportedGames
{
Genshin,
Honkai,
WuWa
WuWa,
ZZZ
}
10 changes: 5 additions & 5 deletions src/GIMI-ModManager.Core/GamesService/GameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ public async Task InitializeAsync(InitializationOptions options)
Initialized?.Invoke(this, EventArgs.Empty);
}

public async Task<GameInfo?> GetGameInfoAsync(SupportedGames game)
public static async Task<GameInfo?> GetGameInfoAsync(SupportedGames game)
{
var gameFilePath = Path.Combine(_assetsDirectory.Parent!.FullName, game.ToString(),
FileNames.GameSettingsFileName);
var gameAssetDir = Path.Combine(AppContext.BaseDirectory, "Assets", "Games", game.ToString());

var gameFilePath = Path.Combine(gameAssetDir, "game.json");

if (!File.Exists(gameFilePath))
return null;
Expand All @@ -126,8 +127,7 @@ public async Task InitializeAsync(InitializationOptions options)
if (jsonGameInfo is null)
throw new InvalidOperationException($"{gameFilePath} file is empty");

return new GameInfo(jsonGameInfo,
new DirectoryInfo(Path.Combine(_assetsDirectory.Parent!.FullName, game.ToString())));
return new GameInfo(jsonGameInfo, new DirectoryInfo(gameAssetDir));
}

public async Task<ICollection<InternalName>> PreInitializedReadModObjectsAsync(string assetsDirectory)
Expand Down
2 changes: 0 additions & 2 deletions src/GIMI-ModManager.Core/GamesService/IGameService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ public interface IGameService

public event EventHandler? Initialized;

public Task<GameInfo?> GetGameInfoAsync(SupportedGames game);

public Task<ICollection<InternalName>> PreInitializedReadModObjectsAsync(string assetsDirectory);

public Task InitializeAsync(string assetsDirectory, string localSettingsDirectory);
Expand Down
5 changes: 5 additions & 0 deletions src/GIMI-ModManager.Core/GamesService/JsonModels/JsonGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ internal class JsonGame
public string RarityName { get; set; } = string.Empty;
public string GameBananaUrl { get; set; } = string.Empty;
public string GameModelImporterUrl { get; set; } = string.Empty;
public string GameModelImporterName { get; set; } = string.Empty;

public string GameModelImporterShortName { get; set; } = string.Empty;

public string[] GameModelImporterExeName { get; set; } = [];
}
12 changes: 10 additions & 2 deletions src/GIMI-ModManager.Core/GamesService/Models/GameInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@ internal GameInfo(JsonGame jsonGame, DirectoryInfo assetsDirectoryInfo)
GameName = jsonGame.GameName?.Trim() ?? "";
GameShortName = jsonGame.GameShortName?.Trim() ?? "";
GameIcon = Path.Combine(assetsDirectoryInfo.FullName, "Images", jsonGame.GameIcon?.Trim() ?? "Start_Game.png");
GameBananaUrl = Uri.TryCreate(jsonGame?.GameBananaUrl, UriKind.Absolute, out var gameBananaUrl)
GameBananaUrl = Uri.TryCreate(jsonGame.GameBananaUrl, UriKind.Absolute, out var gameBananaUrl)
? gameBananaUrl
: new Uri("https://gamebanana.com/");
GameModelImporterUrl =
Uri.TryCreate(jsonGame?.GameModelImporterUrl, UriKind.Absolute, out var gameModelImporterUrl)
Uri.TryCreate(jsonGame.GameModelImporterUrl, UriKind.Absolute, out var gameModelImporterUrl)
? gameModelImporterUrl
: new Uri("https://github.com/SilentNightSound");

GameModelImporterName = jsonGame.GameModelImporterName ?? "";
GameModelImporterShortName = jsonGame.GameModelImporterShortName ?? "";
GameModelImporterExeNames = jsonGame.GameModelImporterExeName.ToList() ?? [];
}

public string GameName { get; }
public string GameShortName { get; }
public string GameIcon { get; }
public Uri GameBananaUrl { get; }
public Uri GameModelImporterUrl { get; }
public string GameModelImporterName { get; }
public string GameModelImporterShortName { get; }

public IReadOnlyList<string> GameModelImporterExeNames { get; }
}
6 changes: 5 additions & 1 deletion src/GIMI-ModManager.WinUI/Assets/Games/Genshin/game.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"GameShortName": "Genshin",
"RarityName": "Quality",
"GameIcon": "Start_Game.png",
"GameBananaUrl": "https://gamebanana.com/games/8552"
"GameBananaUrl": "https://gamebanana.com/games/8552",
"GameModelImporterUrl": "https://github.com/SilentNightSound/GI-Model-Importer",
"GameModelImporterName": "Genshin-Impact-Model-Importer",
"GameModelImporterShortName": "GIMI",
"GameModelImporterExeName": ["3DMigoto Loader.exe"]
}
6 changes: 5 additions & 1 deletion src/GIMI-ModManager.WinUI/Assets/Games/Honkai/game.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"GameShortName": "Honkai",
"RarityName": "Rarity",
"GameIcon": "Start_Game.webp",
"GameBananaUrl": "https://gamebanana.com/games/18366"
"GameBananaUrl": "https://gamebanana.com/games/18366",
"GameModelImporterUrl": "https://github.com/SilentNightSound/SR-Model-Importer",
"GameModelImporterName": "Star-Rail-Model-Importer",
"GameModelImporterShortName": "SRMI",
"GameModelImporterExeName": [ "3DMigotoLoader.exe" ]
}
6 changes: 5 additions & 1 deletion src/GIMI-ModManager.WinUI/Assets/Games/WuWa/game.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"GameShortName": "WuWa",
"RarityName": "Rarity",
"GameIcon": "Start_Game.png",
"GameBananaUrl": "https://gamebanana.com/games/20357"
"GameBananaUrl": "https://gamebanana.com/games/20357",
"GameModelImporterUrl": "https://gamebanana.com/tools/17252",
"GameModelImporterName": "Wuthering Waves Model Importer",
"GameModelImporterShortName": "WWMI",
"GameModelImporterExeName": ["WWMI Loader.exe"]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 41b2497

Please sign in to comment.