Skip to content

Commit

Permalink
Remove PKG Building, improve folders, P4G mod.cpk
Browse files Browse the repository at this point in the history
- Moves PC mode from PersonaPortableGameConfig to ModCpkGameConfig for P4G only (you no longer need to choose a CPK)
- P5R now also uses ModCpkGameConfig in favor of installing a separate one-time mod enabler PKG (thanks to lipsum's patches)
- Creating a New Mod will place it in the folder selected in the folder dropdown
- New Mods will immediately be shown in the folder without having to click Refresh
  • Loading branch information
ShrineFox committed Jun 28, 2021
1 parent 5fb80b1 commit 8d63486
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 567 deletions.
183 changes: 33 additions & 150 deletions Source/ModCompendium/GameConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,78 +136,54 @@ public GameConfigWindow(GameConfig config)
else if (config is ModCpkGameConfig)
{
var ppConfig = (ModCpkGameConfig)config;
}
else if (config is PKGGameConfig)
{
var pkgConfig = (PKGGameConfig)config;

// Add extra row
ConfigPropertyGrid.RowDefinitions.Add(new RowDefinition());

// Cpk root directory path label
// PC Mode checkbox label
var pcLabel = new Label()
{
var pkgPathLabel = new Label()
{
Content = "App PKG Path",
ToolTip = $"Path to the unencrypted {config.Game.ToString()} full game PKG",
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Height = 25,
Width = 120
};

Grid.SetRow(pkgPathLabel, 2);
Grid.SetColumn(pkgPathLabel, 0);
ConfigPropertyGrid.Children.Add(pkgPathLabel);
}
Content = "PC Mode",
ToolTip = "Outputs files for use with the P4G PC Mod Loader",
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Height = 35,
Width = 120,
Visibility = Visibility.Hidden
};
Grid.SetRow(pcLabel, 2);
Grid.SetColumn(pcLabel, 0);
ConfigPropertyGrid.Children.Add(pcLabel);

// PKG path text box
TextBox pkgPathTextBox;
// PC Mode Checkbox
CheckBox pc;
{
pkgPathTextBox = new TextBox()
pc = new CheckBox()
{
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Center,
Height = 20,
TextWrapping = TextWrapping.Wrap,
Width = 291,
Height = 35,
Visibility = Visibility.Hidden
};

pkgPathTextBox.SetBinding(TextBox.TextProperty, new Binding(nameof(Persona5RoyalGameConfig.PKGPath)));

Grid.SetRow(pkgPathTextBox, 2);
Grid.SetColumn(pkgPathTextBox, 1);
ConfigPropertyGrid.Children.Add(pkgPathTextBox);
Grid.SetRow(pc, 2);
Grid.SetColumn(pc, 1);
ConfigPropertyGrid.Children.Add(pc);
}

// PKG Path text box button
if (config.Game == Game.Persona4Golden)
{
var pkgPathTextBoxButton = new Button()
{
Content = "...",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Center,
Width = 20,
Height = 20
};

pkgPathTextBoxButton.Click += (s, e) =>
{
var file = SelectFile(new CommonFileDialogFilter("PKG file", ".pkg"));
if (file != null)
{
pkgConfig.PKGPath = file;
pkgPathTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
}
};

Grid.SetRow(pkgPathTextBoxButton, 2);
Grid.SetColumn(pkgPathTextBoxButton, 1);
ConfigPropertyGrid.Children.Add(pkgPathTextBoxButton);
pc.Visibility = Visibility.Visible;
pcLabel.Visibility = Visibility.Visible;
}
else
{
pc.IsChecked = false;
}

pc.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(ModCpkGameConfig.PC)));
}
else
{
Expand Down Expand Up @@ -320,53 +296,6 @@ public GameConfigWindow(GameConfig config)
Grid.SetColumn(cpkExtract, 1);
ConfigPropertyGrid.Children.Add(cpkExtract);
}

// Add extra row
ConfigPropertyGrid.RowDefinitions.Add(new RowDefinition());

// PC Mode checkbox label
var pcLabel = new Label()
{
Content = "PC Mode",
ToolTip = "Outputs files for use with the P4G PC Mod Loader",
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Height = 35,
Width = 120,
Visibility = Visibility.Hidden
};

Grid.SetRow(pcLabel, 5);
Grid.SetColumn(pcLabel, 0);
ConfigPropertyGrid.Children.Add(pcLabel);

// PC Mode Checkbox
CheckBox pc;
{
pc = new CheckBox()
{
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Center,
Height = 35,
Visibility = Visibility.Hidden
};

pc.SetBinding(CheckBox.IsCheckedProperty, new Binding(nameof(PersonaPortableGameConfig.PC)));

Grid.SetRow(pc, 5);
Grid.SetColumn(pc, 1);
ConfigPropertyGrid.Children.Add(pc);
}
if (config.Game == Game.Persona4Golden)
{
pc.Visibility = Visibility.Visible;
pcLabel.Visibility = Visibility.Visible;
}
else
pc.IsChecked = false;
}
if (config.Game != Game.Persona3 && config.Game != Game.Persona4)
{
Expand Down Expand Up @@ -410,52 +339,6 @@ public GameConfigWindow(GameConfig config)
ConfigPropertyGrid.Children.Add(cpkCompression);
}
}
if (config.Game == Game.Persona5Royal)
{
// Add extra row
ConfigPropertyGrid.RowDefinitions.Add(new RowDefinition());

// Region label
{
var regionLabel = new Label()
{
Content = "Region",
ToolTip = "ID must match your installed version of " + config.Game.ToString(),
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Height = 35,
Width = 120
};

Grid.SetRow(regionLabel, 4);
Grid.SetColumn(regionLabel, 0);
ConfigPropertyGrid.Children.Add(regionLabel);
}

// Region combobox
ComboBox region;
{
region = new ComboBox()
{
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Center,
Height = 35,
};
region.Items.Add("UP0177-CUSA17416");
region.Items.Add("EP0177-CUSA17419");
region.Items.Add("JP0005-CUSA08644");
//region.Items.Add("HP0177-CUSA17544");

region.SetBinding(ComboBox.SelectedValueProperty, new Binding(nameof(Persona5RoyalGameConfig.Region)));

Grid.SetRow(region, 4);
Grid.SetColumn(region, 1);
ConfigPropertyGrid.Children.Add(region);
}
}
}

private void ButtonOk_Click( object sender, RoutedEventArgs e )
Expand Down
9 changes: 8 additions & 1 deletion Source/ModCompendium/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,13 @@ private void NewButton_Click( object sender, RoutedEventArgs e )
return;

// Get unique directory
string modPath = Path.Combine( ModDatabase.ModDirectory, SelectedGame.ToString(), newMod.ModTitle );
string folderPath = Path.Combine( ModDatabase.ModDirectory, SelectedGame.ToString() );
string[] gamePath = Directory.GetDirectories( folderPath, "*", SearchOption.AllDirectories );
if ( FolderComboBox.SelectedItem.ToString() != "All Folders" )
foreach ( string folder in gamePath )
if ( Path.GetFileName(folder) == FolderComboBox.SelectedItem.ToString() )
folderPath = folder;
string modPath = Path.Combine( folderPath, newMod.ModTitle );
if ( Directory.Exists( modPath ) )
{
var newModPath = modPath;
Expand Down Expand Up @@ -488,6 +494,7 @@ private void NewButton_Click( object sender, RoutedEventArgs e )

// Reload
RefreshModDatabase();
RefreshMods();
}

private void DeleteButton_Click( object sender, RoutedEventArgs e )
Expand Down
4 changes: 2 additions & 2 deletions Source/ModCompendium/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.6.0.1" )]
[assembly: AssemblyFileVersion( "1.6.0.1" )]
[assembly: AssemblyVersion( "1.7.0.0" )]
[assembly: AssemblyFileVersion( "1.7.0.0" )]
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@ namespace ModCompendiumLibrary.Configuration
{
public abstract class ModCpkGameConfig : GameConfig
{
protected ModCpkGameConfig()
{
Compression = "True";
PC = "False";
}

public string Compression { get; set; }
public string PC { get; set; }

protected override void DeserializeCore(XElement element)
{
Compression = element.GetElementValueOrEmpty(nameof(Compression));
PC = element.GetElementValueOrEmpty(nameof(PC));
}

protected override void SerializeCore(XElement element)
{
element.AddNameValuePair(nameof(Compression), Compression);
element.AddNameValuePair(nameof(PC), PC);
}
}

Expand All @@ -36,4 +45,14 @@ public class Persona5GameConfig : ModCpkGameConfig
{
public override Game Game => Game.Persona5;
}

public class Persona5RoyalGameConfig : ModCpkGameConfig
{
public override Game Game => Game.Persona5Royal;
}

public class Persona4GoldenGameConfig : ModCpkGameConfig
{
public override Game Game => Game.Persona4Golden;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ protected PersonaPortableGameConfig()
CpkRootOrPath = string.Empty;
Compression = "True";
Extract = "True";
PC = "False";
}

/// <summary>
Expand All @@ -18,22 +17,19 @@ protected PersonaPortableGameConfig()
public string CpkRootOrPath { get; set; }
public string Compression { get; set; }
public string Extract { get; set; }
public string PC { get; set; }

protected override void DeserializeCore(XElement element)
{
CpkRootOrPath = element.GetElementValueOrEmpty(nameof(CpkRootOrPath));
Compression = element.GetElementValueOrEmpty(nameof(Compression));
Extract = element.GetElementValueOrEmpty(nameof(Extract));
PC = element.GetElementValueOrEmpty(nameof(PC));
}

protected override void SerializeCore( XElement element )
{
element.AddNameValuePair(nameof(CpkRootOrPath), CpkRootOrPath);
element.AddNameValuePair(nameof(Compression), Compression);
element.AddNameValuePair(nameof(Extract), Extract);
element.AddNameValuePair(nameof(PC), PC);
}
}
}
Loading

0 comments on commit 8d63486

Please sign in to comment.