Skip to content

Commit 5f23435

Browse files
committed
Remove debug.txt support
1 parent 1370563 commit 5f23435

File tree

5 files changed

+4
-77
lines changed

5 files changed

+4
-77
lines changed

ModApi.UpdateManager/DllsUpdater.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
using System.Reflection;
99
using System.Security.AccessControl;
1010
using System.Security.Principal;
11-
using System.Text;
12-
using System.Threading;
13-
using System.Threading.Tasks;
1411

1512
namespace ModApi.UpdateManager
1613
{

Spore ModAPI Easy Installer/EasyInstaller.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,12 @@ private static ResultType ExtractSporemodZip(string inputFile, ModConfiguration
473473
{
474474
mod.AddFile(entry.Name, GetGameFromFileType(type));
475475
string configOutPath = Path.Combine(modPath, entry.Name);
476-
DebugShowMessageBox(configOutPath, "configOutPath");
476+
477477
entry.ExtractToFile(configOutPath, true);
478478
if (outputPath != null)
479479
{
480480
string fileOutPath = Path.Combine(outputPath, entry.Name);
481-
DebugShowMessageBox(fileOutPath, "fileOutPath");
481+
482482
File.Copy(configOutPath, fileOutPath);
483483
}
484484
}
@@ -898,12 +898,5 @@ static void ShowExitMessageBox()
898898
thread.Start();
899899
thread.Join();
900900
}
901-
902-
private static bool ErrorTesting = File.Exists(Path.Combine(Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString(), "debug.txt"));
903-
static void DebugShowMessageBox(string text, string caption)
904-
{
905-
if (ErrorTesting)
906-
MessageBox.Show(text, caption);
907-
}
908901
}
909902
}

Spore ModAPI Easy Installer/XmlInstallerWindow.xaml.cs

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,7 @@ public partial class XmlInstallerWindow : DecoratableWindow
3131
{
3232
public static string GameSporeString = "Spore";
3333
public static string GameGaString = "GalacticAdventures";
34-
//public bool cancelled = false;
35-
/*bool _cancelled = false;
36-
public bool cancelled
37-
{
38-
get => _cancelled;
39-
set
40-
{
41-
_cancelled = value;
42-
if (!_cancelled)
43-
InstallCancelled?.Invoke(this, null);
44-
}
45-
}*/
46-
public static bool ERROR_TESTING = File.Exists(Path.Combine(Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString(), "debug.txt"));
34+
4735
public static List<XmlInstallerWindow> installerWindows = new List<XmlInstallerWindow>();
4836
string ModSettingsStoragePath = string.Empty;
4937
string ModConfigPath = string.Empty;
@@ -68,7 +56,6 @@ public bool cancelled
6856
Version ModInfoVersion = null;// new Version(1, 0, 0, 0);
6957
int _installerState = 0; //0 = waiting, 1 = installing
7058
int _installerMode = 0; //0 = show components list, 1 = don't show components list
71-
bool _isModUnique = true;
7259
bool _isModMatched = false;
7360
bool _dontUseLegacyPackagePlacement = false;
7461
public static string GaDataPath = SporePath.MoveToData(SporePath.Game.GalacticAdventures, SporePath.GetRealParent(PathDialogs.ProcessGalacticAdventures()));
@@ -80,8 +67,6 @@ public XmlInstallerWindow(string modName, bool configure)
8067
InitializeComponent();
8168
//LauncherSettings.Load();
8269
installerWindows.Add(this);
83-
if (ERROR_TESTING)
84-
MessageBox.Show("Core Spore Data: " + SporeDataPath + "\nGA Data: " + GaDataPath, "Data paths");
8570

8671
if ((LauncherSettings.ForcedCoreSporeDataPath == null) && (!Directory.Exists(SporeDataPath)))
8772
PathDialogs.ProcessSpore();
@@ -235,10 +220,8 @@ private void PrepareInstaller()
235220
{
236221
if (mod.Unique == ModUnique)
237222
{
238-
_isModUnique = false;
239223
if (mod.Name == ModName)
240224
{
241-
//MessageBox.Show(mod.Name + "\n\n" + ModName, "mod.Name and ModName");
242225
_isModMatched = true;
243226
break;
244227
}
@@ -1026,9 +1009,6 @@ await Task.Run(() =>
10261009
else if (p.ComponentGames[i] == GameSporeString)
10271010
targetPath = Path.Combine(SporeDataPath, p.ComponentFileNames[i]);
10281011

1029-
if (ERROR_TESTING)
1030-
MessageBox.Show(targetPath, "UNINSTALLING");
1031-
10321012
if (File.Exists(targetPath))
10331013
File.Delete(targetPath);
10341014
}
@@ -1178,7 +1158,6 @@ private void HandleModFile(ComponentInfo p, int index, bool copy)
11781158
targetFolderPath = SporeDataPath; //Path.Combine(SporeDataPath, p.ComponentFileNames[index]);
11791159
else
11801160
{
1181-
ShowMessageBox(p.ComponentGames[index] + "\n\n" + p.ComponentFileNames[index]);
11821161
isDll = true;
11831162
if (_dontUseLegacyPackagePlacement)
11841163
{
@@ -1187,8 +1166,6 @@ private void HandleModFile(ComponentInfo p, int index, bool copy)
11871166
Directory.CreateDirectory(dllFolderPath);
11881167
string outputPath = Path.Combine(dllFolderPath, p.ComponentFileNames[index]);
11891168

1190-
ShowMessageBox(outputPath);
1191-
11921169
if (File.Exists(outputPath))
11931170
File.Delete(outputPath);
11941171

@@ -1208,7 +1185,6 @@ private void HandleModFile(ComponentInfo p, int index, bool copy)
12081185
Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString()
12091186
, p.ComponentFileNames[index]);
12101187

1211-
ShowMessageBox(outputPath);
12121188

12131189
if (File.Exists(outputPath))
12141190
{
@@ -1224,8 +1200,6 @@ private void HandleModFile(ComponentInfo p, int index, bool copy)
12241200
Directory.GetParent(System.Reflection.Assembly.GetEntryAssembly().Location).ToString()
12251201
, p.ComponentFileNames[index].Replace(".dll", "-disk.dll"));
12261202

1227-
ShowMessageBox(outputPath);
1228-
12291203
if (File.Exists(outputPath))
12301204
{
12311205
File.Delete(outputPath);
@@ -1275,8 +1249,6 @@ private void HandleModFile(ComponentInfo p, int index, bool copy)
12751249
{
12761250
targetPath = Path.Combine(targetFolderPath, p.ComponentFileNames[index]);
12771251

1278-
ShowMessageBox("targetPath: " + targetPath);
1279-
12801252
if (File.Exists(targetPath))
12811253
File.Delete(targetPath);
12821254

@@ -1486,11 +1458,7 @@ private void SplashBorder_PreviewMouseLeftButtonDown(object sender, MouseButtonE
14861458
{
14871459
DragMove();
14881460
}
1489-
public static void ShowMessageBox(string text)
1490-
{
1491-
if (ERROR_TESTING)
1492-
MessageBox.Show(text, "Debug Info");
1493-
}
1461+
14941462
private void FinishButton_Click(object sender, RoutedEventArgs e)
14951463
{
14961464
Close();

Spore ModAPI Launcher/Injector.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,12 @@ public static IntPtr InjectDLL(PROCESS_INFORMATION pi, string dllPath)
7373
bytes[dllPath.Length] = 0;
7474

7575
UIntPtr numBytesWritten;
76-
Program.ERROR_TESTING_MSG("Beginning WriteProcessMemory");
7776
bool writeProcessMemoryOutput = WriteProcessMemory(hProc, objPtr, bytes, (uint)bytes.Length, out numBytesWritten);
7877
if (!writeProcessMemoryOutput || numBytesWritten.ToUInt32() != bytes.Length)
7978
{
8079
/*throw new InjectException("Write process memory failed.");*/
8180
Program.ThrowWin32Exception("Write process memory failed.");
8281
}
83-
Program.ERROR_TESTING_MSG("WriteProcessMemory output: " + writeProcessMemoryOutput.ToString());
8482

8583
// Create a remote thread that begins at the LoadLibrary function and is passed as memory pointer
8684
IntPtr hRemoteThread = CreateRemoteThread(hProc, IntPtr.Zero, 0, retLib, objPtr, 0, out var lpThreadId);
@@ -167,13 +165,11 @@ public static void SetInjectionData(PROCESS_INFORMATION pi, IntPtr hDLLInjectorH
167165
}
168166

169167

170-
Program.ERROR_TESTING_MSG("Beginning WriteProcessMemory");
171168
bool writeProcessMemoryOutput = WriteProcessMemory(hProc, objPtr, bytes, (uint)bytes.Length, out var numBytesWritten);
172169
if (!writeProcessMemoryOutput || numBytesWritten.ToUInt32() != bytes.Length)
173170
{
174171
Program.ThrowWin32Exception("Write process memory failed.");
175172
}
176-
Program.ERROR_TESTING_MSG("WriteProcessMemory output: " + writeProcessMemoryOutput.ToString());
177173

178174
// Create a remote thread that begins at the LoadLibrary function and is passed as memory pointer
179175
IntPtr hRemoteThread = CreateRemoteThread(hProc, IntPtr.Zero, 0, SetInjectDataPtr, objPtr, 0, out var lpThreadId);

Spore ModAPI Launcher/Program.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ namespace SporeModAPI_Launcher
2121
class Program
2222
{
2323
public static IntPtr processHandle = IntPtr.Zero;
24-
private static readonly bool ERROR_TESTING = File.Exists(Path.Combine(Directory.GetParent(Assembly.GetEntryAssembly().Location).ToString(), "debug.txt"));
2524

2625
private const string ModAPIFixDownloadURL = "http://davoonline.com/sporemodder/emd4600/SporeApp_ModAPIFix.zip";
2726
private const string ModApiHelpThreadURL = "https://launcherkit.sporecommunity.com/support";
@@ -61,14 +60,6 @@ static void Main()
6160
}
6261
}
6362

64-
public static void ERROR_TESTING_MSG(string message)
65-
{
66-
if (ERROR_TESTING)
67-
{
68-
MessageBox.Show(message, "Error testing");
69-
}
70-
}
71-
7263
void Execute()
7364
{
7465
try
@@ -84,24 +75,19 @@ void Execute()
8475
if (LauncherSettings.ForcedSporebinEP1Path == null)
8576
{
8677
this.ProcessSporebinPath();
87-
ERROR_TESTING_MSG("1. SporebinEP1 path: " + this.SporebinPath);
8878
}
8979
else
9080
{
9181
SporebinPath = LauncherSettings.ForcedSporebinEP1Path;
92-
ERROR_TESTING_MSG("1. SporebinEP1 path is overridden");
9382
}
9483

9584
// use the default path for now (we might have to use a different one for Origin)
9685
if (LauncherSettings.ForcedGalacticAdventuresSporeAppPath == null)
9786
{
9887
this.ExecutablePath = this.SporebinPath + "SporeApp.exe";
9988

100-
ERROR_TESTING_MSG("2.0. Executable type: " + this.ExecutablePath);
101-
10289
this.ProcessExecutableType();
10390

104-
ERROR_TESTING_MSG("2. Executable type: " + this._executableType);
10591

10692
if (this._executableType == GameVersionType.None)
10793
{
@@ -111,7 +97,6 @@ void Execute()
11197
}
11298
else
11399
{
114-
ERROR_TESTING_MSG("2. Executable type is overridden.");
115100
this._executableType = LauncherSettings.GameVersion;
116101
}
117102

@@ -136,8 +121,6 @@ void Execute()
136121
}
137122
}
138123

139-
ERROR_TESTING_MSG("3. Real executable path: " + this.ExecutablePath);
140-
141124
// we must also check if the steam_api.dll doesn't exist (it's required for Origin users)
142125
if (GameVersion.RequiresModAPIFix(this._executableType) && !File.Exists(this.SporebinPath + "steam_api.dll"))
143126
{
@@ -149,7 +132,6 @@ void Execute()
149132

150133
if (SporePath.SporeIsInstalledOnSteam())
151134
{
152-
ERROR_TESTING_MSG("3.5: Applying steam fix");
153135
string steamAppIdPath = Path.Combine(this.SporebinPath, "steam_appid.txt");
154136
//we have to use Spore GAs appid now, due to steam DRM :(
155137
if (!File.Exists(steamAppIdPath) || File.ReadAllText(steamAppIdPath) != "24720")
@@ -166,9 +148,6 @@ void Execute()
166148
}
167149

168150
string dllEnding = GameVersion.VersionNames[(int)this._executableType];
169-
170-
ERROR_TESTING_MSG("4. DLL suffix: " + dllEnding);
171-
172151
if (dllEnding == null)
173152
{
174153
MessageBox.Show(Strings.VersionNotDetected, CommonStrings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -244,14 +223,11 @@ List<string> GetDLLsToInject(string dllEnding, List<string> dllExceptions)
244223
foreach (var file in baseFolder.EnumerateFiles("*" + dllEnding + ".dll")
245224
.Where(x => x.Name != MODAPI_DLL && !dllExceptions.Contains(x.Name)))
246225
{
247-
ERROR_TESTING_MSG("5.* Preparing " + file.Name);
248226
// the ModAPI dll should already be loaded
249227
if (file.Name != MODAPI_DLL)
250228
{
251229
dlls.Add(file.FullName);
252230
}
253-
else
254-
ERROR_TESTING_MSG("5.* " + file.Name + " was already injected!");
255231
}
256232

257233

@@ -318,8 +294,6 @@ void CreateSporeProcess()
318294
else
319295
currentSporebinPath = this.SporebinPath;
320296

321-
ERROR_TESTING_MSG("currentSporebinPath: " + currentSporebinPath + "\nExecutablePath: " + ExecutablePath);
322-
323297
if (!NativeMethods.CreateProcess(null, "\"" + this.ExecutablePath + "\" " + sb,
324298
IntPtr.Zero, IntPtr.Zero, false, ProcessCreationFlags.CREATE_SUSPENDED, IntPtr.Zero, currentSporebinPath, ref this.StartupInfo, out this.ProcessInfo))
325299
{
@@ -357,7 +331,6 @@ string ProcessSporebinPath()
357331
GameVersionType ProcessExecutableType()
358332
{
359333
GameVersionType executableType = GameVersion.DetectVersion(this.ExecutablePath);
360-
ERROR_TESTING_MSG("2.1. File length: " + new System.IO.FileInfo(this.ExecutablePath).Length);
361334

362335
// for debugging purposes
363336
//executableType = GameVersionType.None;

0 commit comments

Comments
 (0)