Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TSOClient/FSO.UI/GlobalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public GlobalSettings(string path) : base(path) { }

{ "TS1HybridPath", "D:/Games/The Sims/" },
{ "TS1HybridEnable", "false" },
{ "TS1IsSteamInstall", "false" },
{ "TS1InstallationConfigured", "false" },

{ "Shadows3D", "false" },
{ "CitySkybox", "true" },
Expand Down Expand Up @@ -162,6 +164,8 @@ public override Dictionary<string, string> DefaultValues

public string TS1HybridPath { get; set; }
public bool TS1HybridEnable { get; set; }
public bool TS1IsSteamInstall { get; set; }
public bool TS1InstallationConfigured { get; set; }

public bool Shadows3D { get; set; }
public bool CitySkybox { get; set; }
Expand Down
1 change: 1 addition & 0 deletions TSOClient/tso.content/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static bool TS1Hybrid
}
public static FSOEngineMode Target;
public static string TS1HybridBasePath = "D:/Games/The Sims/";
public static bool TS1SteamInstall = false;

/**
* Content Manager
Expand Down
60 changes: 48 additions & 12 deletions TSOClient/tso.content/TS1/TS1NeighbourProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FSO.Common;
using FSO.Common;
using FSO.Files.Formats.IFF;
using FSO.Files.Formats.IFF.Chunks;
using System;
Expand Down Expand Up @@ -53,25 +53,61 @@ public void InitSpecific(int id)
var udName = "UserData" + ((id == 0) ? "" : (id + 1).ToString());
//simitone shouldn't modify existing ts1 data, since our house saves are incompatible.
//therefore we should copy to the simitone user data.

var userPath = Path.Combine(FSOEnvironment.UserDir, udName + "/");

if (!Directory.Exists(userPath))
{
var source = Path.Combine(ContentManager.TS1BasePath, udName + "/");

string source;

// Check if user selected Steam install via Content.TS1SteamInstall flag
if (Content.TS1SteamInstall)
{
// Use Steam's "Saved Games" location (used by The Sims Legacy Collection)
source = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"Saved Games", "Electronic Arts", "The Sims 25", udName + "/"
);
}
else
{
// Use install directory saves (non-Steam installs)
source = Path.Combine(ContentManager.TS1BasePath, udName + "/");
}


var destination = userPath;

//quick and dirty copy.
// Normalize paths for comparison (remove trailing slashes, use consistent separators)
var normalizedSource = source.TrimEnd('/', '\\');
var normalizedDest = destination.TrimEnd('/', '\\');

foreach (string dirPath in Directory.GetDirectories(source, "*",
SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath.Replace('\\', '/').Replace(source, destination));
// Create directory structure
foreach (string dirPath in Directory.GetDirectories(source, "*", SearchOption.AllDirectories))
{
var relativePath = dirPath.Substring(normalizedSource.Length).TrimStart('\\', '/');
var destDir = Path.Combine(normalizedDest, relativePath);
Directory.CreateDirectory(destDir);
}

foreach (string newPath in Directory.GetFiles(source, "*.*",
SearchOption.AllDirectories))
File.Copy(newPath, newPath.Replace('\\', '/').Replace(source, destination), true);
// Copy files with error handling
foreach (string srcPath in Directory.GetFiles(source, "*.*", SearchOption.AllDirectories))
{
var relativePath = srcPath.Substring(normalizedSource.Length).TrimStart('\\', '/');
var destPath = Path.Combine(normalizedDest, relativePath);
try
{
File.Copy(srcPath, destPath, true);
}
catch (IOException ex)
{
throw; // Re-throw to show error dialog
}
}

}

UserPath = userPath;

MainResource = new IffFile(Path.Combine(UserPath, "Neighborhood.iff"));
Expand Down