Skip to content

Commit

Permalink
Added the whole project.
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperfm committed Feb 17, 2022
1 parent f360aec commit 130394d
Show file tree
Hide file tree
Showing 9 changed files with 371 additions and 0 deletions.
25 changes: 25 additions & 0 deletions SC2KFix.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32210.238
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SC2KFix", "SC2KFix\SC2KFix.csproj", "{C4FF46D6-D7FC-47F4-AD4E-0ABC4181BA06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C4FF46D6-D7FC-47F4-AD4E-0ABC4181BA06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4FF46D6-D7FC-47F4-AD4E-0ABC4181BA06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4FF46D6-D7FC-47F4-AD4E-0ABC4181BA06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4FF46D6-D7FC-47F4-AD4E-0ABC4181BA06}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22E8A388-B867-4903-BB9D-2FCC01166F88}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions SC2KFix/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
120 changes: 120 additions & 0 deletions SC2KFix/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;

namespace SC2KFix
{
internal class Program
{
static private void RegisterGame(string name = "Mayor Cool", string company = "Cool Company")
{
Console.WriteLine("Registering the game in registry...");
const string userRoot = "HKEY_CURRENT_USER";
const string subkey = "\\Software\\Maxis\\SimCity 2000\\";
string gamePath = Directory.GetCurrentDirectory();

Registry.SetValue(userRoot + subkey + "REGISTRATION", "Mayor Name", name);
Registry.SetValue(userRoot + subkey + "REGISTRATION", "Company Name", company);
Registry.SetValue(userRoot + subkey + "Localize", "Language", "USA");
Registry.SetValue(userRoot + subkey + "Options", "Speed", "00000001", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Options", "Sound", "00000001", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Options", "Music", "00000001", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Options", "AutoGoto", "00000001", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Options", "AutoBudget", "00000000", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Options", "Disasters", "00000000", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Options", "AutoSave", "00000001", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Paths", "Home", gamePath);
Registry.SetValue(userRoot + subkey + "Paths", "Graphics", gamePath + "\\Bitmaps");
Registry.SetValue(userRoot + subkey + "Paths", "Music", gamePath + "\\Sounds");
Registry.SetValue(userRoot + subkey + "Paths", "Data", gamePath + "\\Data");
Registry.SetValue(userRoot + subkey + "Paths", "Goodies", gamePath + "\\Goodies");
Registry.SetValue(userRoot + subkey + "Paths", "SaveGame", gamePath + "\\Cities");
Registry.SetValue(userRoot + subkey + "Paths", "Scenarios", gamePath + "\\Scenario");
Registry.SetValue(userRoot + subkey + "Version", "SimCity 2000", "00000100", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Windows", "Display", "8 1");
Registry.SetValue(userRoot + subkey + "Windows", "Color Check", "00000000", Microsoft.Win32.RegistryValueKind.DWord);
Registry.SetValue(userRoot + subkey + "Windows", "Last Color Depth", "00000020", Microsoft.Win32.RegistryValueKind.DWord);

Console.WriteLine("Registered successfully :-)");
}

static private bool Patch()
{
Console.WriteLine("Running patcher...");

if (!File.Exists(Directory.GetCurrentDirectory() + "\\bspatch.exe"))
{
Console.WriteLine("The bspatch.exe file is missing! Unable to patch.");
return false;
}

if (!File.Exists(Directory.GetCurrentDirectory() + "\\SIMCITY.patch"))
{
Console.WriteLine("The SIMCITY.patch file is missing! Unable to patch.");
return false;
}

if (!File.Exists(Directory.GetCurrentDirectory() + "\\SIMCITY.exe"))
{
Console.WriteLine("SIMCITY.exe file is missing! Make sure to run this tool from the game directory.");
return false;
}

var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = Directory.GetCurrentDirectory() + "\\bspatch.exe",
Arguments = "SIMCITY.exe SIMCITY_PATCHED.exe SIMCITY.patch",
UseShellExecute = false,
RedirectStandardOutput = false,
CreateNoWindow = true,
WorkingDirectory = Directory.GetCurrentDirectory()
}
};

proc.Start();

Console.WriteLine("Game patched and saved as SIMCITY_PATCHED.exe");

return true;
}

static void Main(string[] args)
{
bool isPatchOk = true;

Console.WriteLine("Neo\'s SimCity 2000 Special Edition fix tool");
Console.WriteLine("https://github.com/kasperfm\n\n");

if (args.Length > 0)
{
switch (args[1])
{
case "register":
RegisterGame(args[2] ?? "Mayor Cool", args[3] ?? "Cool Company");
break;

case "patch":
isPatchOk = Patch();
break;
}
} else {
RegisterGame();
isPatchOk = Patch();
}

if (isPatchOk)
{
Console.WriteLine("Build your city and have fun!");
}

Console.ReadKey();
}
}
}
36 changes: 36 additions & 0 deletions SC2KFix/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SC2KFix")]
[assembly: AssemblyDescription("https://github.com/kasperfm")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("KasperFM")]
[assembly: AssemblyProduct("SC2KFix")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c4ff46d6-d7fc-47f4-ad4e-0abc4181ba06")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
73 changes: 73 additions & 0 deletions SC2KFix/Properties/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
98 changes: 98 additions & 0 deletions SC2KFix/SC2KFix.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C4FF46D6-D7FC-47F4-AD4E-0ABC4181BA06}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SC2KFix</RootNamespace>
<AssemblyName>SC2KFix</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\app.manifest" />
<Content Include="SIMCITY.patch">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="bspatch.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
13 changes: 13 additions & 0 deletions SC2KFix/SC2KFix.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
Binary file added SC2KFix/SIMCITY.patch
Binary file not shown.
Binary file added SC2KFix/bspatch.exe
Binary file not shown.

0 comments on commit 130394d

Please sign in to comment.