Skip to content

Commit

Permalink
Merge pull request #84 from VFansss/developer
Browse files Browse the repository at this point in the history
From Developer
  • Loading branch information
VFansss authored Mar 31, 2019
2 parents 438f1b1 + cafa83f commit 5a3e955
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 49 deletions.
2 changes: 1 addition & 1 deletion mgs2 v's fix/Form1.Designer.cs

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

2 changes: 1 addition & 1 deletion mgs2 v's fix/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private void btn_settings_Click(object sender, EventArgs e)
// Check if any compatibility flags are set on the mgs2_sse.exe, and warn the user
// that they aren't needed anymore

if (Ocelot.CheckForCompabilityFlags() == true)
if (Ocelot.CompatibilityFlagsExists())
{
// Warn the user
Ocelot.showMessage("compatibilityFlagsNotNeeded");
Expand Down
150 changes: 103 additions & 47 deletions mgs2 v's fix/Ocelot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Ocelot
{

// Internal version of the V's Fix - Format is YYMMDD
public const string VERSION = "190224";
public const string VERSION = "190331";

// Hide background images and more "appariscent" graphical things
public static bool NOSYMODE = false;
Expand Down Expand Up @@ -466,13 +466,13 @@ internal static void load_InternalConfig_SetTo_MGS()

}

// FIX FOR ATI/NVIDIA

PrintToDebugConsole("[ SET TO MGS METHOD ] Fixing exe based on VGA Model...");

PrintToDebugConsole("[ EXE OPENING ] Open the game EXE for writing operations...");

#region TANTAROBA
using (var stream = new FileStream(Application.StartupPath + "\\mgs2_sse.exe", FileMode.Open, FileAccess.ReadWrite))
{
// FIX FOR ATI/NVIDIA

// First things to do: sabotage certain API call

Expand Down Expand Up @@ -536,7 +536,7 @@ internal static void load_InternalConfig_SetTo_MGS()

}

if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("Radeon"))
else if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("Radeon"))
{
// RADEON Card. Apply RADEON FIX

Expand Down Expand Up @@ -568,7 +568,7 @@ internal static void load_InternalConfig_SetTo_MGS()

}

if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("Intel"))
else if (Ocelot.InternalConfiguration.Resolution["GraphicAdapterName"].Contains("Intel"))
{
// Intel Graphics. Apply Intel Fix

Expand Down Expand Up @@ -600,6 +600,34 @@ internal static void load_InternalConfig_SetTo_MGS()

}

// FixAfterPlaying

PrintToDebugConsole("[ FixAfterPlaying ] Starting...");

// If is set to FALSE it will sabotage automatical V's Fix opening after game quit

if (Ocelot.InternalConfiguration.Sound["FixAfterPlaying"].Equals("true"))
{

// I want to open the fix after playing. Restoring original .exe condition

// 2
stream.Position = 0x60213E;
stream.WriteByte(0x32);

}

else
{
// Broking game .exe calling when game exit

// X
stream.Position = 0x60213E;
stream.WriteByte(0x58);
}

PrintToDebugConsole("[ FixAfterPlaying ] Done");

// Laptop FIX

// Patching mgs2_sse.exe for dual graphics machine
Expand Down Expand Up @@ -998,36 +1026,6 @@ internal static void load_InternalConfig_SetTo_MGS()

}

// FixAfterPlaying

// If is set to FALSE it will sabotage automatical V's Fix opening after game quit

using (var stream = new FileStream(Application.StartupPath + "\\mgs2_sse.exe", FileMode.Open, FileAccess.ReadWrite))
{

if (Ocelot.InternalConfiguration.Sound["FixAfterPlaying"].Equals("true"))
{

// Fix must be opened. Restoring original .exe condition

// 2
stream.Position = 0x60213E;
stream.WriteByte(0x32);

}

else
{
// Broking game .exe

// X
stream.Position = 0x60213E;
stream.WriteByte(0x58);
}

}


#endregion

//////
Expand Down Expand Up @@ -1067,15 +1065,35 @@ internal static void load_InternalConfig_SetTo_MGS()

//SetCompatibilityFlags();

if (Ocelot.CheckForCompabilityFlags() == true)
if (Ocelot.CompatibilityFlagsExists())
{
Ocelot.RemoveCompatibilityFlags();
}

// Create a file to remember the user to check to new location

string savedataReminderFilePath = Directory.GetParent(Application.StartupPath).FullName + "\\SAVEDATA ARE INSIDE 'MY GAMES' FOLDER";

if (File.Exists(savedataReminderFilePath))
{

PrintToDebugConsole("[ SavedataReminder ] File already exist");

}
else
{

PrintToDebugConsole("[ SavedataReminder ] File created!");

File.Create(savedataReminderFilePath);

}

}

catch
catch(Exception ex)
{
PrintToDebugConsole("[ EXCEPTION ] Message:"+ex.Message+"\n\nStacktrace: "+ex.StackTrace);
Ocelot.showMessage("UAC_error");

}
Expand Down Expand Up @@ -1765,7 +1783,7 @@ private static void SetCompatibilityFlags()
}

// Check if any compatibility flag is set
public static bool CheckForCompabilityFlags()
public static bool CompatibilityFlagsExists()
{
// Set a default value
bool returnValue = false;
Expand Down Expand Up @@ -1861,7 +1879,7 @@ public static void MoveSavegamesToNewLocation()

Ocelot.PrintToDebugConsole("[MOVE SAVEGAME TO NEW LOCATION] old: " + oldSavedataPath+" | new: "+ newSavedataPath);

Directory.Move(oldSavedataPath, newSavedataPath);
Ocelot.MoveFolder(oldSavedataPath, newSavedataPath);

Ocelot.PrintToDebugConsole("[MOVE SAVEGAME TO NEW LOCATION] Folder moved :)");

Expand All @@ -1873,12 +1891,6 @@ public static void MoveSavegamesToNewLocation()

Ocelot.PrintToDebugConsole("[MOVE SAVEGAME TO NEW LOCATION] Permission inerithing just set!");

// Create a file to remember the user to check to new location

File.Create(Directory.GetParent(Application.StartupPath).FullName + "\\SAVEDATA ARE INSIDE 'MY GAMES' FOLDER");

Ocelot.PrintToDebugConsole("[MOVE SAVEGAME TO NEW LOCATION] Reminder file just created!");

}

catch(Exception ex)
Expand Down Expand Up @@ -2559,7 +2571,7 @@ public static bool IsThisDirectoryEmpty(string path)

}

// Check if savegames will be moved to 'My Games' directory
// Check if savegames must be moved to 'My Games' directory
public static SAVEGAMEMOVING SavegameMustBeMoved()
{

Expand Down Expand Up @@ -2623,6 +2635,50 @@ public static SAVEGAMEMOVING SavegameMustBeMoved()

}

// Move folder and files having directory paths...

public static void MoveFolder(string sourcePath, string targetPath)
{
try
{
DirectoryInfo diSource = new DirectoryInfo(sourcePath);
DirectoryInfo diTarget = new DirectoryInfo(targetPath);

CopyAll(diSource, diTarget);

Directory.Delete(sourcePath, true);

}
catch (Exception ex)
{

PrintToDebugConsole("[ EXCEPTION ] Message:" + ex.Message + "\n\nStacktrace: " + ex.StackTrace);
Ocelot.showMessage("UAC_error");

}

}

// Aiding method - Recursive method to move files and directory

private static void CopyAll(DirectoryInfo source, DirectoryInfo target)
{
Directory.CreateDirectory(target.FullName);

// Copy each file into the new directory.
foreach (FileInfo fi in source.GetFiles())
{
Console.WriteLine(@"Copying {0}\{1}", target.FullName, fi.Name);
fi.CopyTo(Path.Combine(target.FullName, fi.Name), true);
}

// Copy each subdirectory using recursion.
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
CopyAll(diSourceSubDir, nextTargetSubDir);
}
}

}// END CLASS

Expand Down
Binary file modified mgs2 v's fix/PAPERS/Regards.txt
Binary file not shown.

0 comments on commit 5a3e955

Please sign in to comment.