Skip to content
This repository
Browse code

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...
commit 31c3847ecf7b10908d13174dd1a17a87ea42a752 1 parent a996931
Chris Toshok authored
26 SCSharp/SCSharp.UI/Game.cs
@@ -140,6 +140,28 @@ public Game (string starcraftDir, string scCDDir, string bwCDDir)
140 140 e);
141 141 }
142 142 }
  143 + else if (Path.GetFileName (path).ToLower() == "starcraft.mpq") {
  144 + try {
  145 + scInstallExe = GetMpq (path);
  146 + Console.WriteLine ("found starcraft.mpq");
  147 + }
  148 + catch (Exception e) {
  149 + throw new Exception (String.Format ("could not read mpq archive {0}",
  150 + path),
  151 + e);
  152 + }
  153 + }
  154 + else if (Path.GetFileName (path).ToLower() == "broodwar.mpq") {
  155 + try {
  156 + bwInstallExe = GetMpq (path);
  157 + Console.WriteLine ("found broodwar.mpq");
  158 + }
  159 + catch (Exception e) {
  160 + throw new Exception (String.Format ("could not read mpq archive {0}",
  161 + path),
  162 + e);
  163 + }
  164 + }
143 165 }
144 166 }
145 167
@@ -147,7 +169,7 @@ public Game (string starcraftDir, string scCDDir, string bwCDDir)
147 169 throw new Exception ("unable to locate stardat.mpq, please check your StarcraftDirectory configuration setting");
148 170 }
149 171
150   - if (scCDDir != null) {
  172 + if (!string.IsNullOrEmpty (scCDDir)) {
151 173 foreach (string path in Directory.GetFileSystemEntries (scCDDir)) {
152 174 if (Path.GetFileName (path).ToLower() == "install.exe" || Path.GetFileName (path).Equals ("Starcraft Archive")) {
153 175 try {
@@ -163,7 +185,7 @@ public Game (string starcraftDir, string scCDDir, string bwCDDir)
163 185 }
164 186 }
165 187
166   - if (bwCDDir != null) {
  188 + if (!string.IsNullOrEmpty (bwCDDir)) {
167 189 foreach (string path in Directory.GetFileSystemEntries (bwCDDir)) {
168 190 if (Path.GetFileName (path).ToLower() == "install.exe" || Path.GetFileName (path).Equals ("Brood War Archive")) {
169 191 try {
8 scsharp.exe.config
@@ -3,10 +3,14 @@
3 3 <!-- directory containing the StarDat.mpq and BrooDat.mpq files -->
4 4 <add key="StarcraftDirectory" value="C:\Program Files\Starcraft"/>
5 5
6   - <!-- directory containing the install.exe file from the Starcraft CD -->
  6 + <!-- directory containing the install.exe file from the Starcraft CD,
  7 + empty to use Starcraft.mpq from StarcraftDirectory
  8 + -->
7 9 <add key="StarcraftCDDirectory" value="D:\"/>
8 10
9   - <!-- directory containing the install.exe file from the Brood Wars CD -->
  11 + <!-- directory containing the install.exe file from the Brood Wars CD,
  12 + empty to use BroodWar.mpq from StarcraftDirectory
  13 + -->
10 14 <add key="BroodwarCDDirectory" value="C:\BroodwarCD"/>
11 15
12 16 <!-- debugging/development options.
2  src/scsharp.cs
@@ -46,7 +46,7 @@ public static void Main (string[] args)
46 46 string bw_cd_dir = ConfigurationManager.AppSettings["BroodwarCDDirectory"];
47 47
48 48 /* catch this pathological condition where someone has set the cd directories to the same location. */
49   - if (sc_cd_dir != null && bw_cd_dir != null && bw_cd_dir == sc_cd_dir) {
  49 + if (!string.IsNullOrEmpty (sc_cd_dir) && !string.IsNullOrEmpty (bw_cd_dir) && bw_cd_dir == sc_cd_dir) {
50 50 Console.WriteLine ("The StarcraftCDDirectory and BroodwarCDDirectory configuration settings must have unique values.");
51 51 return;
52 52 }

0 comments on commit 31c3847

Please sign in to comment.
Something went wrong with that request. Please try again.