@ -15,8 +15,6 @@ public partial class ModPacker : Form
private ModCreationInfo modinfo = new ModCreationInfo ( ) ;
private ModCreationInfo modinfo = new ModCreationInfo ( ) ;
private readonly ModProfileXML profile ;
private readonly FileFilter zipFileFilter = new FileFilter ( "zip archives (*.zip)" , ".zip" ) ;
private readonly FileFilter zipFileFilter = new FileFilter ( "zip archives (*.zip)" , ".zip" ) ;
private readonly FileFilter apkFileFilter = new FileFilter ( "Android application packages (*.apk)" , ".apk" ) ;
private readonly FileFilter apkFileFilter = new FileFilter ( "Android application packages (*.apk)" , ".apk" ) ;
@ -78,16 +76,16 @@ public partial class ModPacker : Form
if ( saveFilePath . Contains ( vanillaPrefix ) )
if ( saveFilePath . Contains ( vanillaPrefix ) )
saveFilePath = vanillaPrefix + saveFilePath . Substring ( vanillaPrefix . Length ) . ToLower ( ) ;
saveFilePath = vanillaPrefix + saveFilePath . Substring ( vanillaPrefix . Length ) . ToLower ( ) ;
modinfo . saveFile Path = saveFilePath ;
modinfo . SaveFolder Path = saveFilePath ;
}
}
}
}
else
else
{
{
wasSuccessful = true ;
wasSuccessful = true ;
modinfo . saveFile Path = null ;
modinfo . SaveFolder Path = null ;
}
}
}
}
customSaveTextBox . Text = modinfo . saveFile Path;
customSaveTextBox . Text = modinfo . SaveFolder Path;
}
}
private void YYCCheckBox_CheckedChanged ( object sender , EventArgs e )
private void YYCCheckBox_CheckedChanged ( object sender , EventArgs e )
@ -95,10 +93,11 @@ public partial class ModPacker : Form
// Don't do anything if it's been disabled
// Don't do anything if it's been disabled
if ( ! yycCheckBox . Checked . Value )
if ( ! yycCheckBox . Checked . Value )
return ;
return ;
// Disable mac stuff, as its incompatible with yyc
macCheckBox . Checked = false ;
macCheckBox . Checked = false ;
macLabel . Visible = false ;
macLabel . Visible = false ;
macButton . Enabled = false ;
macButton . Enabled = false ;
modinfo . macPath = "" ;
modinfo . MacModPath = null ;
}
}
private void WindowsCheckBox_CheckedChanged ( object sender , EventArgs e )
private void WindowsCheckBox_CheckedChanged ( object sender , EventArgs e )
@ -108,7 +107,7 @@ public partial class ModPacker : Form
if ( ! windowsCheckBox . Checked . Value )
if ( ! windowsCheckBox . Checked . Value )
{
{
windowsLabel . Visible = false ;
windowsLabel . Visible = false ;
modinfo . windowsPath = "" ;
modinfo . WindowsModPath = null ;
}
}
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -116,7 +115,7 @@ public partial class ModPacker : Form
private void WindowsButton_Click ( object sender , EventArgs e )
private void WindowsButton_Click ( object sender , EventArgs e )
{
{
// Open window to select modded Linux .zip
// Open window to select modded Linux .zip
( _ , modinfo . windowsPath ) = SelectFile ( "Please select your custom Windows AM2R .zip" , zipFileFilter ) ;
modinfo . WindowsModPath = SelectFile ( "Please select your custom Windows AM2R .zip" , zipFileFilter ) ;
windowsLabel . Visible = modinfo . IsWindowsModLoaded ;
windowsLabel . Visible = modinfo . IsWindowsModLoaded ;
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -128,7 +127,7 @@ public partial class ModPacker : Form
if ( ! apkCheckBox . Checked . Value )
if ( ! apkCheckBox . Checked . Value )
{
{
apkLabel . Visible = false ;
apkLabel . Visible = false ;
modinfo . apkPath = "" ;
modinfo . ApkModPath = null ;
}
}
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -136,7 +135,7 @@ public partial class ModPacker : Form
private void ApkButton_Click ( object sender , EventArgs e )
private void ApkButton_Click ( object sender , EventArgs e )
{
{
// Open window to select modded AM2R APK
// Open window to select modded AM2R APK
( _ , modinfo . apkPath ) = SelectFile ( "Please select your custom AM2R .apk" , apkFileFilter ) ;
modinfo . ApkModPath = SelectFile ( "Please select your custom AM2R .apk" , apkFileFilter ) ;
apkLabel . Visible = modinfo . IsApkModLoaded ;
apkLabel . Visible = modinfo . IsApkModLoaded ;
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -148,7 +147,7 @@ public partial class ModPacker : Form
if ( ! linuxCheckBox . Checked . Value )
if ( ! linuxCheckBox . Checked . Value )
{
{
linuxLabel . Visible = false ;
linuxLabel . Visible = false ;
modinfo . linuxPath = "" ;
modinfo . LinuxModPath = null ;
}
}
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -156,7 +155,7 @@ public partial class ModPacker : Form
private void LinuxButton_Click ( object sender , EventArgs e )
private void LinuxButton_Click ( object sender , EventArgs e )
{
{
// Open window to select modded Linux .zip
// Open window to select modded Linux .zip
( _ , modinfo . linuxPath ) = SelectFile ( "Please select your custom Linux AM2R .zip" , zipFileFilter ) ;
modinfo . LinuxModPath = SelectFile ( "Please select your custom Linux AM2R .zip" , zipFileFilter ) ;
linuxLabel . Visible = modinfo . IsLinuxModLoaded ;
linuxLabel . Visible = modinfo . IsLinuxModLoaded ;
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -170,7 +169,7 @@ public partial class ModPacker : Form
if ( ! macCheckBox . Checked . Value )
if ( ! macCheckBox . Checked . Value )
{
{
macLabel . Visible = false ;
macLabel . Visible = false ;
modinfo . macPath = "" ;
modinfo . MacModPath = null ;
}
}
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -184,7 +183,7 @@ public partial class ModPacker : Form
private void macButton_Click ( object sender , EventArgs e )
private void macButton_Click ( object sender , EventArgs e )
{
{
// Open window to select modded Mac .zip
// Open window to select modded Mac .zip
( _ , modinfo . macPath ) = SelectFile ( "Please select your custom Mac AM2R .zip" , zipFileFilter ) ;
modinfo . MacModPath = SelectFile ( "Please select your custom Mac AM2R .zip" , zipFileFilter ) ;
macLabel . Visible = modinfo . IsMacModLoaded ;
macLabel . Visible = modinfo . IsMacModLoaded ;
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -192,7 +191,7 @@ public partial class ModPacker : Form
private void OriginalZipButton_Click ( object sender , EventArgs e )
private void OriginalZipButton_Click ( object sender , EventArgs e )
{
{
// Open window to select AM2R 1.1
// Open window to select AM2R 1.1
( _ , modinfo . originalPath ) = SelectFile ( "Please select AM2R_11.zip" , zipFileFilter ) ;
modinfo . AM2R11Path = SelectFile ( "Please select AM2R_11.zip" , zipFileFilter ) ;
originalZipLabel . Visible = modinfo . IsAM2R11Loaded ;
originalZipLabel . Visible = modinfo . IsAM2R11Loaded ;
UpdateCreateButton ( ) ;
UpdateCreateButton ( ) ;
}
}
@ -212,7 +211,7 @@ public partial class ModPacker : Form
}
}
// Verify 1.1
// Verify 1.1
var result11 = Core . CheckIfZipIsAM2R11 ( modinfo . original Path) ;
var result11 = Core . CheckIfZipIsAM2R11 ( modinfo . AM2R11 Path) ;
if ( result11 ! = IsZipAM2R11ReturnCodes . Successful )
if ( result11 ! = IsZipAM2R11ReturnCodes . Successful )
{
{
MessageBox . Show ( "AM2R 1.1 zip is invalid! Error code: " + result11 ) ;
MessageBox . Show ( "AM2R 1.1 zip is invalid! Error code: " + result11 ) ;
@ -227,9 +226,9 @@ public partial class ModPacker : Form
{
{
string modZipPath = os switch
string modZipPath = os switch
{
{
ProfileOperatingSystems . Windows = > modinfo . windows Path,
ProfileOperatingSystems . Windows = > modinfo . WindowsMod Path,
ProfileOperatingSystems . Linux = > modinfo . linux Path,
ProfileOperatingSystems . Linux = > modinfo . LinuxMod Path,
ProfileOperatingSystems . Mac = > modinfo . mac Path,
ProfileOperatingSystems . Mac = > modinfo . MacMod Path,
_ = > null
_ = > null
} ;
} ;
string output ;
string output ;
@ -250,7 +249,7 @@ public partial class ModPacker : Form
LoadProfileParameters ( os ) ;
LoadProfileParameters ( os ) ;
try
try
{
{
Core . CreateModPack ( profile, modinfo . originalPath , modZipPath , modinfo . apk Path, output ) ;
Core . CreateModPack ( modinfo. Profile , modinfo . AM2R11Path , modZipPath , modinfo . ApkMod Path, output ) ;
}
}
catch ( Exception exception )
catch ( Exception exception )
{
{
@ -274,7 +273,7 @@ public partial class ModPacker : Form
if ( windowsCheckBox . Checked . Value )
if ( windowsCheckBox . Checked . Value )
{
{
var windowsZip = ZipFile . Open ( modinfo . windows Path, ZipArchiveMode . Read ) ;
var windowsZip = ZipFile . Open ( modinfo . WindowsMod Path, ZipArchiveMode . Read ) ;
if ( windowsZip . Entries . All ( f = > f . FullName ! = "AM2R.exe" ) )
if ( windowsZip . Entries . All ( f = > f . FullName ! = "AM2R.exe" ) )
{
{
var result = MessageBox . Show ( "Modded game not found, make sure it's not placed in any subfolders.\nCreated profile will likely not be installable, are you sure you want to continue?" , "WARNING" , MessageBoxButtons . YesNo , MessageBoxType . Warning ) ;
var result = MessageBox . Show ( "Modded game not found, make sure it's not placed in any subfolders.\nCreated profile will likely not be installable, are you sure you want to continue?" , "WARNING" , MessageBoxButtons . YesNo , MessageBoxType . Warning ) ;
@ -294,7 +293,7 @@ public partial class ModPacker : Form
if ( linuxCheckBox . Checked . Value )
if ( linuxCheckBox . Checked . Value )
{
{
var linuxZip = ZipFile . Open ( modinfo . linux Path, ZipArchiveMode . Read ) ;
var linuxZip = ZipFile . Open ( modinfo . LinuxMod Path, ZipArchiveMode . Read ) ;
if ( linuxZip . Entries . All ( f = > f . FullName ! = "AM2R" ) & & linuxZip . Entries . All ( f = > f . FullName ! = "runner" ) )
if ( linuxZip . Entries . All ( f = > f . FullName ! = "AM2R" ) & & linuxZip . Entries . All ( f = > f . FullName ! = "runner" ) )
{
{
var result = MessageBox . Show ( "Modded Linux game not found, make sure it's not placed in any subfolders.\nCreated profile will likely not be installable, are you sure you want to continue?" , "WARNING" , MessageBoxButtons . YesNo , MessageBoxType . Warning ) ;
var result = MessageBox . Show ( "Modded Linux game not found, make sure it's not placed in any subfolders.\nCreated profile will likely not be installable, are you sure you want to continue?" , "WARNING" , MessageBoxButtons . YesNo , MessageBoxType . Warning ) ;
@ -313,7 +312,7 @@ public partial class ModPacker : Form
}
}
if ( macCheckBox . Checked . Value )
if ( macCheckBox . Checked . Value )
{
{
var macZip = ZipFile . Open ( modinfo . mac Path, ZipArchiveMode . Read ) ;
var macZip = ZipFile . Open ( modinfo . MacMod Path, ZipArchiveMode . Read ) ;
if ( macZip . Entries . All ( f = > f . Name ! = "AM2R.app/Contents/MacOS/Mac_Runner" ) )
if ( macZip . Entries . All ( f = > f . Name ! = "AM2R.app/Contents/MacOS/Mac_Runner" ) )
{
{
var result = MessageBox . Show ( "Modded Mac game not found, make sure it's not placed in any subfolders.\nCreated profile will likely not be installable, are you sure you want to continue?" , "WARNING" , MessageBoxButtons . YesNo , MessageBoxType . Warning ) ;
var result = MessageBox . Show ( "Modded Mac game not found, make sure it's not placed in any subfolders.\nCreated profile will likely not be installable, are you sure you want to continue?" , "WARNING" , MessageBoxButtons . YesNo , MessageBoxType . Warning ) ;
@ -333,26 +332,26 @@ public partial class ModPacker : Form
private void LoadProfileParameters ( ProfileOperatingSystems operatingSystem )
private void LoadProfileParameters ( ProfileOperatingSystems operatingSystem )
{
{
p rofile. Name = nameTextBox . Text ;
modinfo. P rofile. Name = nameTextBox . Text ;
p rofile. Author = authorTextBox . Text ;
modinfo. P rofile. Author = authorTextBox . Text ;
p rofile. Version = versionTextBox . Text ;
modinfo. P rofile. Version = versionTextBox . Text ;
p rofile. UsesCustomMusic = musicCheckBox . Checked . Value ;
modinfo. P rofile. UsesCustomMusic = musicCheckBox . Checked . Value ;
p rofile. UsesYYC = yycCheckBox . Checked . Value ;
modinfo. P rofile. UsesYYC = yycCheckBox . Checked . Value ;
p rofile. SupportsAndroid = apkCheckBox . Checked . Value ;
modinfo. P rofile. SupportsAndroid = apkCheckBox . Checked . Value ;
p rofile. ProfileNotes = modNotesTextBox . Text ;
modinfo. P rofile. ProfileNotes = modNotesTextBox . Text ;
p rofile. OperatingSystem = operatingSystem . ToString ( ) ;
modinfo. P rofile. OperatingSystem = operatingSystem . ToString ( ) ;
if ( customSaveCheckBox . Checked . Value & & customSaveTextBox . Text ! = "" )
if ( customSaveCheckBox . Checked . Value & & customSaveTextBox . Text ! = "" )
p rofile. SaveLocation = customSaveTextBox . Text ;
modinfo. P rofile. SaveLocation = customSaveTextBox . Text ;
else
else
p rofile. SaveLocation = "%localappdata%/AM2R" ;
modinfo. P rofile. SaveLocation = "%localappdata%/AM2R" ;
if ( operatingSystem = = ProfileOperatingSystems . Linux )
if ( operatingSystem = = ProfileOperatingSystems . Linux )
profile. SaveLocation = p rofile. SaveLocation . Replace ( "%localappdata%" , "~/.config" ) ;
modinfo. Profile . SaveLocation = modinfo . P rofile. SaveLocation . Replace ( "%localappdata%" , "~/.config" ) ;
else if ( operatingSystem = = ProfileOperatingSystems . Mac )
else if ( operatingSystem = = ProfileOperatingSystems . Mac )
{
{
if ( p rofile. SaveLocation . Contains ( "%localappdata%/AM2R" ) )
if ( modinfo. P rofile. SaveLocation . Contains ( "%localappdata%/AM2R" ) )
profile. SaveLocation = p rofile. SaveLocation . Replace ( "%localappdata%/AM2R" , "~/Library/Application Support/com.yoyogames.am2r" ) ;
modinfo. Profile . SaveLocation = modinfo . P rofile. SaveLocation . Replace ( "%localappdata%/AM2R" , "~/Library/Application Support/com.yoyogames.am2r" ) ;
else
else
p rofile. SaveLocation = "~/Library/Application Support/com.yoyogames." + new DirectoryInfo ( p rofile. SaveLocation ) . Name . ToLower ( ) ;
modinfo. P rofile. SaveLocation = "~/Library/Application Support/com.yoyogames." + new DirectoryInfo ( modinfo. P rofile. SaveLocation ) . Name . ToLower ( ) ;
}
}
}
}
@ -380,7 +379,7 @@ public partial class ModPacker : Form
createButton . Enabled = false ;
createButton . Enabled = false ;
}
}
private ( bool , string ) SelectFile ( string title , FileFilter filter )
private string SelectFile ( string title , FileFilter filter )
{
{
using var fileFinder = new OpenFileDialog { Filters = { filter } } ;
using var fileFinder = new OpenFileDialog { Filters = { filter } } ;
fileFinder . Title = title ;
fileFinder . Title = title ;
@ -388,9 +387,9 @@ public partial class ModPacker : Form
fileFinder . CheckFileExists = true ;
fileFinder . CheckFileExists = true ;
if ( fileFinder . ShowDialog ( this ) ! = DialogResult . Ok )
if ( fileFinder . ShowDialog ( this ) ! = DialogResult . Ok )
return ( false , "" ) ;
return null ;
string location = fileFinder . FileName ;
string location = fileFinder . FileName ;
return ( true , location ) ;
return location ;
}
}
}
}