Skip to content

Commit

Permalink
Support for Shadow Generations (#935)
Browse files Browse the repository at this point in the history
* Preparation for SONIC X SHADOW GENERATIONS [no ci]

* Add custom mod folder support

* Add remove game button

* Added more game info for SXSG

* Changed SXSG names and position

* Hide Sonic Generations (2024)

* Update HMM code URLs

* Updated HE2ML to 1.3.0

---------

Co-authored-by: Michael <[email protected]>
Co-authored-by: SuperSonic16 <[email protected]>
  • Loading branch information
3 people authored Oct 23, 2024
1 parent 9aa151e commit 1594340
Show file tree
Hide file tree
Showing 32 changed files with 227 additions and 109 deletions.
27 changes: 21 additions & 6 deletions HedgeModManager/Config/CPKREDIRConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class CPKREDIRConfig : INotifyPropertyChanged
public int ReadBlockSizeKB { get; set; } = 4096;

[IniField("CPKREDIR", true)]
public string ModsDbIni { get; set; } = "mods\\ModsDB.ini";
public string ModsDbIni { get; set; } = null;

[IniField("CPKREDIR", "EnableSaveFileRedirection", true)]
public bool EnableSaveFileRedirection { get; set; } = false;
Expand Down Expand Up @@ -61,20 +61,35 @@ public bool EnableDebugConsole

public CPKREDIRConfig(string path)
{
if (File.Exists(path))
Load(path);
else
Save(path);
}

public CPKREDIRConfig(GameInstall gameInstall)
{
string path = Path.Combine(gameInstall.GameDirectory, "cpkredir.ini");
if (File.Exists(path))
{
using (var stream = File.OpenRead(path))
{
var file = new IniFile(stream);
IniSerializer.Deserialize(this, file);
}
Load(path);
}
else
{
ModsDbIni = Path.Combine(gameInstall.Game.ModsDirectoryName, "ModsDB.ini");
Save(path);
}
}

public void Load(string path)
{
using (var stream = File.OpenRead(path))
{
var file = new IniFile(stream);
IniSerializer.Deserialize(this, file);
}
}

public void Save(string path)
{
using (var stream = File.Create(path))
Expand Down
42 changes: 41 additions & 1 deletion HedgeModManager/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static class Games
SaveName = "savedata",
SupportsCPKREDIR = false,
SupportsSaveRedirection = true,
Folders = new[] { "raw" },
Folders = ["raw"],
AppID = "1237320",
EGSID = "c5ca98fa240c4eb796835f97126df8e7",
GBProtocol = "hedgemmrangers",
Expand All @@ -153,16 +153,55 @@ public static class Games
GamePaths = [Path.Combine("SonicFrontiers", "SonicFrontiers.exe")]
};

// TODO: implement loader.
public static Game SonicGenerations2024 = new Game()
{
GameName = "SonicGenerations2024",
ModsDirectoryName = "mods_sonic",
SaveName = "savedata",
SupportsCPKREDIR = false,
SupportsSaveRedirection = true,
Folders = ["raw"],
AppID = "2513280",
EGSID = "a88805d3fbec4ca9bfc248105f6adb0a",
GBProtocol = "hedgemmmillersonic",
Is64Bit = true,
ModLoader = ModLoaders.HE2ModLoader, // TODO: use HE1ML?
CodesURL = Resources.URL_MILLER_SONIC_CODES,
GamePaths = [Path.Combine("SONIC_X_SHADOW_GENERATIONS", "SONIC_GENERATIONS.exe")],
Timestamps = [0x66F6109A]
};

public static Game SonicXShadowGenerations = new Game()
{
GameName = "SonicXShadowGenerations",
ModsDirectoryName = "mods_shadow",
SaveName = "savedata",
SupportsCPKREDIR = false,
SupportsSaveRedirection = true,
Folders = ["raw"],
AppID = "2513280",
EGSID = "a88805d3fbec4ca9bfc248105f6adb0a",
GBProtocol = "hedgemmmillershadow",
Is64Bit = true,
ModLoader = ModLoaders.HE2ModLoader,
CodesURL = Resources.URL_MILLER_SHADOW_CODES,
GamePaths = [Path.Combine("SONIC_X_SHADOW_GENERATIONS", "SONIC_X_SHADOW_GENERATIONS.exe")],
Timestamps = [0x66F609C2]
};

public static IEnumerable<Game> GetSupportedGames()
{
yield return SonicGenerations;
// yield return SonicGenerations2024;
yield return SonicLostWorld;
yield return SonicForces;
yield return PuyoPuyoTetris2;
yield return Tokyo2020;
yield return SonicColorsUltimate;
yield return SonicOrigins;
yield return SonicFrontiers;
yield return SonicXShadowGenerations;
}
}

Expand Down Expand Up @@ -199,6 +238,7 @@ public class Game
{
public string GameName = "NoGame";
public string SaveName = string.Empty;
public string ModsDirectoryName = "mods";
public ModLoader ModLoader = null;
public bool SupportsCPKREDIR = false;
public bool SupportsSaveRedirection = false;
Expand Down
7 changes: 5 additions & 2 deletions HedgeModManager/HedgeApp.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,14 @@ public static void SelectGameInstall(GameInstall gameinstall)
if (CurrentGameInstall.Game != Games.Unknown)
{
ConfigPath = Path.Combine(CurrentGameInstall.GameDirectory, "cpkredir.ini");
Config = new CPKREDIRConfig(ConfigPath);
Config = new CPKREDIRConfig(CurrentGameInstall);

ModsDbPath = Path.Combine(CurrentGameInstall.GameDirectory, Path.GetDirectoryName(Config.ModsDbIni) ?? "Mods");
if (!Directory.Exists(ModsDbPath))
ModsDbPath = Path.Combine(CurrentGameInstall.GameDirectory, "Mods");
{
// Reset mod directory path
ModsDbPath = Path.Combine(CurrentGameInstall.GameDirectory, CurrentGameInstall.Game.ModsDirectoryName);
}
}
}
catch (UnauthorizedAccessException)
Expand Down
4 changes: 4 additions & 0 deletions HedgeModManager/HedgeModManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
<Resource Include="Resources\Graphics\Games\SonicForces.png" />
<Resource Include="Resources\Graphics\Games\SonicFrontiers.png" />
<Resource Include="Resources\Graphics\Games\SonicGenerations.png" />
<Resource Include="Resources\Graphics\Games\SonicGenerations2024.png" />
<Resource Include="Resources\Graphics\Games\SonicLostWorld.png" />
<Resource Include="Resources\Graphics\Games\SonicOrigins.png" />
<Resource Include="Resources\Graphics\Games\SonicXShadowGenerations.png" />
<Resource Include="Resources\Graphics\Games\Tokyo2020.png" />
<Resource Include="Resources\Graphics\icon256.png" />
<Resource Include="Resources\Graphics\EasterEggs\splashBirthday.png" />
Expand Down Expand Up @@ -117,8 +119,10 @@
<None Remove="Resources\Graphics\Games\SonicForces.png" />
<None Remove="Resources\Graphics\Games\SonicFrontiers.png" />
<None Remove="Resources\Graphics\Games\SonicGenerations.png" />
<None Remove="Resources\Graphics\Games\SonicGenerations2024.png" />
<None Remove="Resources\Graphics\Games\SonicLostWorld.png" />
<None Remove="Resources\Graphics\Games\SonicOrigins.png" />
<None Remove="Resources\Graphics\Games\SonicXShadowGenerations.png" />
<None Remove="Resources\Graphics\Games\Tokyo2020.png" />
<None Remove="Resources\Graphics\splashBirthday.png" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/de-DE.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">Kein Spiel erkannt!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
5 changes: 4 additions & 1 deletion HedgeModManager/Languages/en-AU.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
<system:String x:Key="SettingsUIEnableDebug" >Enable debug console</system:String>
<system:String x:Key="SettingsUIEnableSRedir" >Redirect default save file</system:String>
<system:String x:Key="SettingsUIUseLauncher" >Use game launcher</system:String>
<system:String x:Key="SettingsUIRemoveGame" >Remove Game</system:String>
<system:String x:Key="SettingsUILabelLoaders" >Loaders:</system:String>
<system:String x:Key="SettingsUILabelGame" >Game:</system:String>
<system:String x:Key="SettingsUILabelProfile" >Profile:</system:String>
Expand Down Expand Up @@ -254,14 +255,16 @@
<system:String x:Key="ThemeLight" >Light</system:String>

<!-- Games -->
<system:String x:Key="GameSonicGenerations">Sonic Generations</system:String>
<system:String x:Key="GameSonicGenerations">Sonic Generations (2011)</system:String>
<system:String x:Key="GameSonicLostWorld">Sonic Lost World</system:String>
<system:String x:Key="GameSonicForces">Sonic Forces</system:String>
<system:String x:Key="GamePuyoPuyoTetris2">Puyo Puyo Tetris 2</system:String>
<system:String x:Key="GameTokyo2020">Olympic Games Tokyo 2020</system:String>
<system:String x:Key="GameSonicColorsUltimate">Sonic Colours: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicGenerations2024">Sonic Generations (2024)</system:String>
<system:String x:Key="GameSonicXShadowGenerations">Shadow Generations</system:String>
<system:String x:Key="GameNoGame">No Game Detected!</system:String>
<system:String x:Key="GameAddGame">Add Game</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
Expand Down
5 changes: 4 additions & 1 deletion HedgeModManager/Languages/en-US.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
<system:String x:Key="SettingsUIEnableDebug" >Enable debug console</system:String>
<system:String x:Key="SettingsUIEnableSRedir" >Redirect default save file</system:String>
<system:String x:Key="SettingsUIUseLauncher" >Use game launcher</system:String>
<system:String x:Key="SettingsUIRemoveGame" >Remove Game</system:String>
<system:String x:Key="SettingsUILabelLoaders" >Loaders:</system:String>
<system:String x:Key="SettingsUILabelGame" >Game:</system:String>
<system:String x:Key="SettingsUILabelProfile" >Profile:</system:String>
Expand Down Expand Up @@ -254,14 +255,16 @@
<system:String x:Key="ThemeLight" >Light</system:String>

<!-- Games -->
<system:String x:Key="GameSonicGenerations">Sonic Generations</system:String>
<system:String x:Key="GameSonicGenerations">Sonic Generations (2011)</system:String>
<system:String x:Key="GameSonicLostWorld">Sonic Lost World</system:String>
<system:String x:Key="GameSonicForces">Sonic Forces</system:String>
<system:String x:Key="GamePuyoPuyoTetris2">Puyo Puyo Tetris 2</system:String>
<system:String x:Key="GameTokyo2020">Olympic Games Tokyo 2020</system:String>
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicGenerations2024">Sonic Generations (2024)</system:String>
<system:String x:Key="GameSonicXShadowGenerations">Shadow Generations</system:String>
<system:String x:Key="GameNoGame">No Game Detected!</system:String>
<system:String x:Key="GameAddGame">Add Game</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
Expand Down
2 changes: 2 additions & 0 deletions HedgeModManager/Languages/es-MX.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
<system:String x:Key="GameTokyo2020">Olympic Games Tokyo 2020</system:String>
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">¡No se detectó el juego!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/hu-HU.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">Nem található játék.</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
3 changes: 3 additions & 0 deletions HedgeModManager/Languages/it-IT.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,5 +231,8 @@
<system:String x:Key="GamePuyoPuyoTetris2">Puyo Puyo Tetris 2</system:String>
<system:String x:Key="GameTokyo2020">Giochi Olimpici di Tokyo 2020</system:String>
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>

</ResourceDictionary>
1 change: 1 addition & 0 deletions HedgeModManager/Languages/ja-JP.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<system:String x:Key="GameSonicColorsUltimate">ソニックカラーズ アルティメット</system:String>
<system:String x:Key="GameSonicOrigins">ソニックオリジンズ</system:String>
<system:String x:Key="GameSonicFrontiers">ソニックフロンティア</system:String>
<system:String x:Key="GameSonicXShadowGenerations">ソニック × シャドウ ジェネレーションズ</system:String>
<system:String x:Key="GameNoGame">ゲームが見つかりません!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/ko-KR.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
<system:String x:Key="GameSonicColorsUltimate">소닉 컬러즈: 얼티밋</system:String>
<system:String x:Key="GameSonicOrigins">소닉 오리진스</system:String>
<system:String x:Key="GameSonicFrontiers">소닉 프론티어</system:String>
<system:String x:Key="GameSonicXShadowGenerations">소닉×섀도우 제너레이션즈</system:String>
<system:String x:Key="GameNoGame">감지된 게임 없음!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
3 changes: 3 additions & 0 deletions HedgeModManager/Languages/pt-BR.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,8 @@
<system:String x:Key="GamePuyoPuyoTetris2">Puyo Puyo Tetris 2</system:String>
<system:String x:Key="GameTokyo2020">Olympic Games Tokyo 2020</system:String>
<system:String x:Key="GameSonicColorsUltimate">Sonic Colours: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>

</ResourceDictionary>
1 change: 1 addition & 0 deletions HedgeModManager/Languages/pt-PT.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
<system:String x:Key="GameSonicColorsUltimate">Sonic Colours: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">Nenhum Jogo Detetado!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/ru-RU.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
<system:String x:Key="GameSonicColorsUltimate">Sonic Colours: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">Игры не обнаружены!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/uk-UA.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">Гру Не Виявлено!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/vi-VN.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
<system:String x:Key="GameSonicColorsUltimate">Sonic Colors: Ultimate</system:String>
<system:String x:Key="GameSonicOrigins">Sonic Origins</system:String>
<system:String x:Key="GameSonicFrontiers">Sonic Frontiers</system:String>
<system:String x:Key="GameSonicXShadowGenerations">SONIC X SHADOW GENERATIONS</system:String>
<system:String x:Key="GameNoGame">Không phát hiện được game!</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/zh-CN.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
<system:String x:Key="GameSonicColorsUltimate">索尼克 缤纷色彩 究极版</system:String>
<system:String x:Key="GameSonicOrigins">索尼克 起源</system:String>
<system:String x:Key="GameSonicFrontiers">索尼克 未知边境</system:String>
<system:String x:Key="GameSonicXShadowGenerations">索尼克×夏特 世代重启</system:String>
<system:String x:Key="GameNoGame">未能检测游戏</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
1 change: 1 addition & 0 deletions HedgeModManager/Languages/zh-TW.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<system:String x:Key="GameSonicColorsUltimate">索尼克 繽紛色彩 究極版</system:String>
<system:String x:Key="GameSonicOrigins">索尼克 起源</system:String>
<system:String x:Key="GameSonicFrontiers">索尼克 未知邊境</system:String>
<system:String x:Key="GameSonicXShadowGenerations">索尼克×夏特 世代重啟</system:String>
<system:String x:Key="GameNoGame">找不到遊戲</system:String>
<system:String x:Key="LauncherSteam">Steam</system:String>
<system:String x:Key="LauncherEpic">Epic Games</system:String>
Expand Down
Loading

0 comments on commit 1594340

Please sign in to comment.