Browse files

With the download edition of Starcraft, the original install.exe file…

…s are instead provided renamed as mpq files in the game install dir.

This patch makes SCSharp scan for these mpq files for preference. It also allows users to put everything in one dir, by renaming their install.exe files to starcraft.mpq and broodwar.mpq

pulled from directhex's master
commit af230ff
  • Loading branch information...
1 parent a996931 commit 31c3847ecf7b10908d13174dd1a17a87ea42a752 @toshok committed Sep 16, 2010
Showing with 31 additions and 5 deletions.
  1. +24 −2 SCSharp/SCSharp.UI/Game.cs
  2. +6 −2 scsharp.exe.config
  3. +1 −1 src/scsharp.cs
View
26 SCSharp/SCSharp.UI/Game.cs
@@ -140,14 +140,36 @@ public Game (string starcraftDir, string scCDDir, string bwCDDir)
e);
}
}
+ else if (Path.GetFileName (path).ToLower() == "starcraft.mpq") {
+ try {
+ scInstallExe = GetMpq (path);
+ Console.WriteLine ("found starcraft.mpq");
+ }
+ catch (Exception e) {
+ throw new Exception (String.Format ("could not read mpq archive {0}",
+ path),
+ e);
+ }
+ }
+ else if (Path.GetFileName (path).ToLower() == "broodwar.mpq") {
+ try {
+ bwInstallExe = GetMpq (path);
+ Console.WriteLine ("found broodwar.mpq");
+ }
+ catch (Exception e) {
+ throw new Exception (String.Format ("could not read mpq archive {0}",
+ path),
+ e);
+ }
+ }
}
}
if (scMpq == null) {
throw new Exception ("unable to locate stardat.mpq, please check your StarcraftDirectory configuration setting");
}
- if (scCDDir != null) {
+ if (!string.IsNullOrEmpty (scCDDir)) {
foreach (string path in Directory.GetFileSystemEntries (scCDDir)) {
if (Path.GetFileName (path).ToLower() == "install.exe" || Path.GetFileName (path).Equals ("Starcraft Archive")) {
try {
@@ -163,7 +185,7 @@ public Game (string starcraftDir, string scCDDir, string bwCDDir)
}
}
- if (bwCDDir != null) {
+ if (!string.IsNullOrEmpty (bwCDDir)) {
foreach (string path in Directory.GetFileSystemEntries (bwCDDir)) {
if (Path.GetFileName (path).ToLower() == "install.exe" || Path.GetFileName (path).Equals ("Brood War Archive")) {
try {
View
8 scsharp.exe.config
@@ -3,10 +3,14 @@
<!-- directory containing the StarDat.mpq and BrooDat.mpq files -->
<add key="StarcraftDirectory" value="C:\Program Files\Starcraft"/>
- <!-- directory containing the install.exe file from the Starcraft CD -->
+ <!-- directory containing the install.exe file from the Starcraft CD,
+ empty to use Starcraft.mpq from StarcraftDirectory
+ -->
<add key="StarcraftCDDirectory" value="D:\"/>
- <!-- directory containing the install.exe file from the Brood Wars CD -->
+ <!-- directory containing the install.exe file from the Brood Wars CD,
+ empty to use BroodWar.mpq from StarcraftDirectory
+ -->
<add key="BroodwarCDDirectory" value="C:\BroodwarCD"/>
<!-- debugging/development options.
View
2 src/scsharp.cs
@@ -46,7 +46,7 @@ public static void Main (string[] args)
string bw_cd_dir = ConfigurationManager.AppSettings["BroodwarCDDirectory"];
/* catch this pathological condition where someone has set the cd directories to the same location. */
- if (sc_cd_dir != null && bw_cd_dir != null && bw_cd_dir == sc_cd_dir) {
+ if (!string.IsNullOrEmpty (sc_cd_dir) && !string.IsNullOrEmpty (bw_cd_dir) && bw_cd_dir == sc_cd_dir) {
Console.WriteLine ("The StarcraftCDDirectory and BroodwarCDDirectory configuration settings must have unique values.");
return;
}

0 comments on commit 31c3847

Please sign in to comment.