Skip to content

Commit

Permalink
Merge pull request #16 from TekkaGB/SMTV
Browse files Browse the repository at this point in the history
Add SMT V Support
  • Loading branch information
TekkaGB committed Nov 12, 2021
2 parents 8fb7648 + 6e483d0 commit 48ad8ef
Show file tree
Hide file tree
Showing 18 changed files with 472 additions and 131 deletions.
Binary file added Unverum/Assets/Icons/dbfz.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/ds.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/gbvs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/ggs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/im.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/jf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/kh3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/mhoj2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/smtv.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/sn.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Unverum/Assets/Icons/toa.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion Unverum/FeedGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public enum GameFilter
SN,
ToA,
DS,
IM
IM,
SMTV
}
public enum FeedFilter
{
Expand Down Expand Up @@ -143,6 +144,9 @@ private static string GenerateUrl(int page, GameFilter game, TypeFilter type, Fe
case GameFilter.IM:
url += "14247&";
break;
case GameFilter.SMTV:
url += "14768&";
break;
}
}
else if (category.ID != null)
Expand Down Expand Up @@ -182,6 +186,9 @@ private static string GenerateUrl(int page, GameFilter game, TypeFilter type, Fe
case GameFilter.IM:
url += "14247&";
break;
case GameFilter.SMTV:
url += "14768&";
break;
}
}
// Consistent args
Expand Down
131 changes: 71 additions & 60 deletions Unverum/ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public static bool Restart(string path, string movies, string splash, string sou
// Delete everything in mods folder
Directory.Delete(path, true);
Directory.CreateDirectory(path);
// Delete everything in patches folder for Switch games
if (!String.IsNullOrEmpty(Global.config.Configs[Global.config.CurrentGame].PatchesFolder))
{
if (Directory.Exists(Global.config.Configs[Global.config.CurrentGame].PatchesFolder))
Directory.Delete(Global.config.Configs[Global.config.CurrentGame].PatchesFolder, true);
Directory.CreateDirectory(Global.config.Configs[Global.config.CurrentGame].PatchesFolder);
}
// Reset movies and splash folder
if (!String.IsNullOrEmpty(movies) && Directory.Exists(movies))
RestoreDirectory(movies);
Expand Down Expand Up @@ -151,81 +158,85 @@ public static void Build(string path, List<string> mods, bool? patched, string m
}
}
// Copy over mp4s and bmps to the appropriate folders while storing backups
if (!String.IsNullOrEmpty(movies) || !String.IsNullOrEmpty(splash) || !String.IsNullOrEmpty(sound))
foreach (var file in Directory.GetFiles(mod, "*", SearchOption.AllDirectories))
{
var ext = Path.GetExtension(file).ToLowerInvariant();
switch (ext)
{
case ".txt":
if (Path.GetFileName(file).Equals("dblist.txt", StringComparison.InvariantCultureIgnoreCase) &&
Global.config.CurrentGame.Equals("My Hero One's Justice 2", StringComparison.InvariantCultureIgnoreCase))
if (Path.GetFileName(file).Equals("dblist.txt", StringComparison.InvariantCultureIgnoreCase) &&
Global.config.CurrentGame.Equals("My Hero One's Justice 2", StringComparison.InvariantCultureIgnoreCase))
{
var dblistFile = $"{Global.assemblyLocation}{Global.s}Resources{Global.s}My Hero One's Justice 2{Global.s}HeroGame{Global.s}Content{Global.s}DB{Global.s}dblist.txt";
if (missing)
continue;
if (db == null && TextPatcher.ExtractBaseFiles("HeroGame-WindowsNoEditor_0_P.pak", "*dblist.txt",
$"HeroGame{Global.s}Content{Global.s}DB{Global.s}dblist.txt"))
db = File.ReadAllLines(dblistFile).ToHashSet();
// Check if db is still null
if (db == null)
{
var dblistFile = $"{Global.assemblyLocation}{Global.s}Resources{Global.s}My Hero One's Justice 2{Global.s}HeroGame{Global.s}Content{Global.s}DB{Global.s}dblist.txt";
if (missing)
continue;
if (db == null && TextPatcher.ExtractBaseFiles("HeroGame-WindowsNoEditor_0_P.pak", "*dblist.txt",
$"HeroGame{Global.s}Content{Global.s}DB{Global.s}dblist.txt"))
db = File.ReadAllLines(dblistFile).ToHashSet();
// Check if db is still null
if (db == null)
{
missing = true;
continue;
}
Global.logger.WriteLine($"Appending dblist.txt from {mod}...", LoggerType.Info);
db.UnionWith(File.ReadAllLines(file));
missing = true;
continue;
}
break;
Global.logger.WriteLine($"Appending dblist.txt from {mod}...", LoggerType.Info);
db.UnionWith(File.ReadAllLines(file));
}
break;
case ".usm":
case ".uasset":
case ".mp4":
if (!String.IsNullOrEmpty(movies) && Directory.Exists(movies))
ReplaceAsset(file, movies);
break;
if (!String.IsNullOrEmpty(movies) && Directory.Exists(movies))
ReplaceAsset(file, movies);
break;
case ".bmp":
if (!String.IsNullOrEmpty(splash) && Directory.Exists(splash))
ReplaceAsset(file, splash);
break;
if (!String.IsNullOrEmpty(splash) && Directory.Exists(splash))
ReplaceAsset(file, splash);
break;
case ".awb":
if (!String.IsNullOrEmpty(sound) && Directory.Exists(sound))
ReplaceAsset(file, sound);
break;
if (!String.IsNullOrEmpty(sound) && Directory.Exists(sound))
ReplaceAsset(file, sound);
break;
case ".pchtxt":
case ".ips":
if (!String.IsNullOrEmpty(Global.config.Configs[Global.config.CurrentGame].PatchesFolder) && Directory.Exists(Global.config.Configs[Global.config.CurrentGame].PatchesFolder))
File.Copy(file, $"{Global.config.Configs[Global.config.CurrentGame].PatchesFolder}{Global.s}{Path.GetFileName(file)}", true);
break;
case ".json":
if (Path.GetFileName(file).Equals("text.json", StringComparison.InvariantCultureIgnoreCase) &&
(Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase)
|| Global.config.CurrentGame.Equals("Guilty Gear -Strive-", StringComparison.InvariantCultureIgnoreCase)
|| Global.config.CurrentGame.Equals("Granblue Fantasy Versus", StringComparison.InvariantCultureIgnoreCase)))
{
if (missing)
continue;
if (entries == null && TextPatcher.ExtractBaseFiles("pakchunk0-WindowsNoEditor.pak", "*INT/REDGame.*",
$"RED{Global.s}Content{Global.s}Localization{Global.s}INT{Global.s}REDGame.uexp"))
entries = TextPatcher.GetEntries();
// Check if entries are still null
if (entries == null)
{
missing = true;
continue;
}
if (Path.GetFileName(file).Equals("text.json", StringComparison.InvariantCultureIgnoreCase) &&
(Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase)
|| Global.config.CurrentGame.Equals("Guilty Gear -Strive-", StringComparison.InvariantCultureIgnoreCase)
|| Global.config.CurrentGame.Equals("Granblue Fantasy Versus", StringComparison.InvariantCultureIgnoreCase)))
{
if (missing)
continue;
if (entries == null && TextPatcher.ExtractBaseFiles("pakchunk0-WindowsNoEditor.pak", "*INT/REDGame.*",
$"RED{Global.s}Content{Global.s}Localization{Global.s}INT{Global.s}REDGame.uexp"))
entries = TextPatcher.GetEntries();
// Check if entries are still null
if (entries == null)
{
missing = true;
continue;
}

var text = File.ReadAllText(file);
TextEntries replacements;
try
{
replacements = JsonSerializer.Deserialize<TextEntries>(text);
}
catch (Exception e)
{
Global.logger.WriteLine(e.Message, LoggerType.Error);
continue;
}
foreach (var replacement in replacements.Entries)
{
entries = TextPatcher.ReplaceEntry(replacement, entries);
}
}
break;
var text = File.ReadAllText(file);
TextEntries replacements;
try
{
replacements = JsonSerializer.Deserialize<TextEntries>(text);
}
catch (Exception e)
{
Global.logger.WriteLine(e.Message, LoggerType.Error);
continue;
}
foreach (var replacement in replacements.Entries)
{
entries = TextPatcher.ReplaceEntry(replacement, entries);
}
}
break;
}
}
}
Expand Down
78 changes: 78 additions & 0 deletions Unverum/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Text;
using System.Threading.Tasks;
using xdelta3.net;
using Microsoft.WindowsAPICodePack.Dialogs;
using System.Windows;

namespace Unverum
{
Expand Down Expand Up @@ -302,5 +304,81 @@ public static bool DBFZ()
return true;

}

// TODO: disable Launch/Build if current launcher option setup isnt complete
public static bool SMTV(bool emu)
{
if (emu)
{
// Select emulator path
OpenFileDialog dialog = new OpenFileDialog();
dialog.DefaultExt = ".exe";
dialog.Filter = "Emulator Exe|yuzu.exe; Ryujinx.exe";
dialog.Title = "Select Exectuable for Emulator (yuzu.exe or Ryujinx.exe)";
dialog.Multiselect = false;
dialog.InitialDirectory = Global.assemblyLocation;
dialog.ShowDialog();
if (!String.IsNullOrEmpty(dialog.FileName)
&& (Path.GetFileName(dialog.FileName).Equals("yuzu.exe", StringComparison.InvariantCultureIgnoreCase)
|| Path.GetFileName(dialog.FileName).Equals("Ryujinx.exe", StringComparison.InvariantCultureIgnoreCase)))
Global.config.Configs[Global.config.CurrentGame].Launcher = dialog.FileName;
else if (!String.IsNullOrEmpty(dialog.FileName))
{
Global.logger.WriteLine($"Invalid .exe chosen", LoggerType.Error);
return false;
}
else
return false;

// Select game path
dialog.FileName = String.Empty;
dialog.DefaultExt = ".xci;.nsp";
dialog.Filter = "Switch Game|*.xci;*.nsp";
dialog.Title = "Select Switch Game for Emulator to Launch";
dialog.Multiselect = false;
dialog.InitialDirectory = Global.assemblyLocation;
dialog.ShowDialog();
if (String.IsNullOrEmpty(dialog.FileName))
return false;
Global.config.Configs[Global.config.CurrentGame].GamePath = dialog.FileName;
}

var openFolder = new CommonOpenFileDialog();
openFolder.AllowNonFileSystemItems = true;
openFolder.IsFolderPicker = true;
openFolder.EnsurePathExists = true;
openFolder.EnsureValidNames = true;
openFolder.Multiselect = false;
openFolder.Title = "Select Mod Folder (NA: 010063b012dc6000, EU: 0100B870126CE000, JP: 01006BD0095F4000, HK/TW: 010038D0133C2000, KR: 0100FB70133C0000)";
var selected = true;
Application.Current.Dispatcher.Invoke(() =>
{
if (openFolder.ShowDialog() == CommonFileDialogResult.Ok)
{
var hash = Path.GetFileName(openFolder.FileName).ToLowerInvariant();
switch (hash)
{
case "010063b012dc6000":
case "0100B870126CE000":
case "01006BD0095F4000":
case "010038D0133C2000":
case "0100FB70133C0000":
Global.config.Configs[Global.config.CurrentGame].ModsFolder = $"{openFolder.FileName}{Global.s}Unverum Mods{Global.s}romfs{Global.s}Project{Global.s}Content{Global.s}Paks{Global.s}~mods";
Global.config.Configs[Global.config.CurrentGame].PatchesFolder = $"{openFolder.FileName}{Global.s}Unverum Mods{Global.s}exefs";
break;
default:
Global.logger.WriteLine($"Invalid output path chosen", LoggerType.Error);
selected = false;
break;
}
}
else
selected = false;
});
Global.UpdateConfig();
if (selected)
Global.logger.WriteLine($"Setup completed!", LoggerType.Info);
return selected;
}
}
}
2 changes: 2 additions & 0 deletions Unverum/Structures/ModStructures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public class Config
public class GameConfig
{
public string Launcher { get; set; }
public string GamePath { get; set; }
public bool LauncherOption { get; set; }
public bool FirstOpen { get; set; }
public string ModsFolder { get; set; }
public string PatchesFolder { get; set; }
public long? PakLength { get; set; }
public ObservableCollection<Mod> ModList { get; set; }
}
Expand Down

0 comments on commit 48ad8ef

Please sign in to comment.