Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
091f6f5
Reconcile_Players
TaranDahl Feb 4, 2025
83fbb1d
maybe incorrect
TaranDahl Feb 4, 2025
41af393
StartScenario
TaranDahl Feb 8, 2025
fdc173e
AutoSave
TaranDahl Feb 13, 2025
d4b3168
fix
TaranDahl Feb 13, 2025
1438d78
Update src/Spawner/Spawner.cpp
TaranDahl Feb 13, 2025
95c23ad
fix
TaranDahl Feb 14, 2025
9a16163
update
TaranDahl Feb 14, 2025
61d2db4
Update Spawner.cpp
TaranDahl Feb 14, 2025
e4e4e20
Update Spawner.cpp
TaranDahl Feb 16, 2025
cf4ca39
need help
TaranDahl Feb 22, 2025
7cf1ebe
Fix wrong include
Metadorius Feb 24, 2025
e874224
move to UI dir
TaranDahl Feb 25, 2025
7420601
I should read more carefully
Metadorius Feb 25, 2025
393bda0
Remove empty caption that was screwing up the dialog
Metadorius Feb 25, 2025
f6e8d9f
A temp hook for testing
TaranDahl Feb 25, 2025
6d93a12
dialog works
TaranDahl Feb 25, 2025
3f8e37b
Update src/UI/Hooks.cpp
TaranDahl Feb 25, 2025
b2740a7
Merge branch 'main' into MP_S&L
Metadorius Mar 19, 2025
b2ee697
Post-merge fix
Metadorius Mar 19, 2025
9322a38
Fix beacon crash, add credits
Metadorius Mar 19, 2025
94088b1
Merge branch 'main' into MP_S&L
Metadorius Mar 21, 2025
df44a11
Merge branch 'main' into MP_S&L
Metadorius Apr 2, 2025
5edc7b2
Merge branch 'main' into MP_S&L
Metadorius Apr 5, 2025
7ed42c7
Merge branch 'main' into MP_S&L
Metadorius Apr 6, 2025
4fde997
Merge branch 'main' into MP_S&L
Metadorius Apr 6, 2025
852c30d
Merge branch 'main' into MP_S&L
Metadorius Apr 6, 2025
539e8f3
Merge branch 'main' into MP_S&L
Metadorius Apr 11, 2025
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ Credits
- **[Kerbiter (Metadorius)](https://github.com/Metadorius)**
- Further maintenance
- Event verification checks
- Save button for multiplayer pause menu
- Beacon crash fix for multiplayer save/load
- **[TaranDahl](https://github.com/TaranDahl)**
- Porting of multiplayer save/load
- Porting of autosaves
- **[Rampastring](https://github.com/Rampastring)**
- Original event verification checks
- **[Vinifera](https://github.com/Vinifera-Developers/Vinifera) Contributors and [TS Patches](https://github.com/CnCNet/ts-patches) Contributors**
- Original TS implementation of multiplayer save/load
- Original TS implementation of autosaves
- **[CnCNet](https://github.com/CnCNet) Contributors** - the [original spawner](https://github.com/CnCNet/yr-patches)
- **[Ares](https://github.com/Ares-Developers/Ares) and [Phobos](https://github.com/Phobos-developers/Phobos) Contributors** - [YRpp](https://github.com/Phobos-developers/yrpp) and [Syringe](https://github.com/Ares-Developers/Syringe) which are used and some code snippets

Expand Down
5 changes: 5 additions & 0 deletions Spawner.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<!-- Compiled files -->
<ItemGroup>
<!-- Root -->
<ClCompile Include="src\UI\Dialogs.cpp" />
<ClCompile Include="src\UI\Hooks.cpp" />
<ResourceCompile Include="$(ThisDir)\src\version.rc" />
<ClCompile Include="$(ThisDir)\src\Main.cpp" />
<ClCompile Include="$(ThisDir)\src\Main.Config.cpp" />
Expand Down Expand Up @@ -63,6 +65,8 @@
<!-- Utilities -->
<ClCompile Include="$(ThisDir)\src\Utilities\Debug.cpp" />
<ClCompile Include="$(ThisDir)\src\Utilities\Patch.cpp" />
<!-- Dialogs -->
<ResourceCompile Include="$(ThisDir)\src\UI\MultiplayerGameOptionsDialog.rc" />
</ItemGroup>
<!-- Header files -->
<ItemGroup>
Expand All @@ -76,6 +80,7 @@
<!-- CnCNetYR -->
<ClInclude Include="$(ThisDir)\src\CnCNetYR\Ra2Mode.h" />
<!-- Misc -->
<ClInclude Include="$(ThisDir)\src\UI\Dialogs.h" />
<!-- Spawner -->
<ClInclude Include="$(ThisDir)\src\Spawner\NetHack.h" />
<ClInclude Include="$(ThisDir)\src\Spawner\ProtocolZero.h" />
Expand Down
1 change: 1 addition & 0 deletions src/Ext/Event/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "Body.h"
#include <Spawner/ProtocolZero.h>
#include <Spawner/Spawner.h>

#include <Helpers/Macro.h>
#include <EventClass.h>
Expand Down
12 changes: 8 additions & 4 deletions src/Spawner/Spawner.Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ void SpawnerConfig::LoadFromINIFile(CCINIClass* pINI)
MultiByteToWideChar(CP_UTF8, 0, Main::readBuffer, strlen(Main::readBuffer), UIGameMode, std::size(UIGameMode));
}

// SaveGame Options
LoadSaveGame = pINI->ReadBool(pSettingsSection, "LoadSaveGame", LoadSaveGame);
/* SavedGameDir */ pINI->ReadString(pSettingsSection, "SavedGameDir", SavedGameDir, SavedGameDir, sizeof(SavedGameDir));
/* SaveGameName */ pINI->ReadString(pSettingsSection, "SaveGameName", SaveGameName, SaveGameName, sizeof(SaveGameName));
{// SaveGame Options
LoadSaveGame = pINI->ReadBool(pSettingsSection, "LoadSaveGame", LoadSaveGame);
/* SavedGameDir */ pINI->ReadString(pSettingsSection, "SavedGameDir", SavedGameDir, SavedGameDir, sizeof(SavedGameDir));
/* SaveGameName */ pINI->ReadString(pSettingsSection, "SaveGameName", SaveGameName, SaveGameName, sizeof(SaveGameName));
AutoSaveCount = pINI->ReadInteger(pSettingsSection, "AutoSaveCount", AutoSaveCount);
AutoSaveInterval = pINI->ReadInteger(pSettingsSection, "AutoSaveInterval", AutoSaveInterval);
NextAutoSaveNumber = pINI->ReadInteger(pSettingsSection, "NextAutoSaveNumber", NextAutoSaveNumber);
}

{ // Scenario Options
Seed = pINI->ReadInteger(pSettingsSection, "Seed", Seed);
Expand Down
6 changes: 6 additions & 0 deletions src/Spawner/Spawner.Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class SpawnerConfig
bool LoadSaveGame;
char SavedGameDir[MAX_PATH]; // Nested paths are also supported, e.g. "Saved Games\\Yuri's Revenge"
char SaveGameName[60];
int AutoSaveCount;
int AutoSaveInterval;
int NextAutoSaveNumber;

// Scenario Options
int Seed;
Expand Down Expand Up @@ -161,6 +164,9 @@ class SpawnerConfig
, LoadSaveGame { false }
, SavedGameDir { "Saved Games" }
, SaveGameName { "" }
, AutoSaveCount { 5 }
, AutoSaveInterval { 7200 }
, NextAutoSaveNumber { 0 }

// Scenario Options
, Seed { 0 }
Expand Down
56 changes: 56 additions & 0 deletions src/Spawner/Spawner.Hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@

#include <HouseClass.h>
#include <SessionClass.h>
#include <BeaconManagerClass.h>
#include <Utilities/Debug.h>
#include <Utilities/Macro.h>
#include <Unsorted.h>

DEFINE_HOOK(0x6BD7C5, WinMain_SpawnerInit, 0x6)
{
Expand Down Expand Up @@ -179,3 +181,57 @@ DEFINE_HOOK(0x4FC57C, HouseClass__MPlayerDefeated_CheckAliveAndHumans, 0x7)
}

#pragma endregion MPlayerDefeated

#pragma region Save&Load

DEFINE_HOOK_AGAIN(0x624271, SomeFunc_InterceptMainLoop, 0x5);
DEFINE_HOOK_AGAIN(0x623D72, SomeFunc_InterceptMainLoop, 0x5);
DEFINE_HOOK_AGAIN(0x62314E, SomeFunc_InterceptMainLoop, 0x5);
DEFINE_HOOK_AGAIN(0x60D407, SomeFunc_InterceptMainLoop, 0x5);
DEFINE_HOOK_AGAIN(0x608206, SomeFunc_InterceptMainLoop, 0x5);
DEFINE_HOOK(0x48CE8A, SomeFunc_InterceptMainLoop, 0x5)
{
/**
* Main loop.
*/
Game::MainLoop();

/**
* After loop.
*/
Spawner::After_Main_Loop();
return R->Origin() + 0x5;
}

DEFINE_HOOK(0x52DAED, Game_Start_ResetGlobal, 0x7)
{
Spawner::DoSave = false;
Spawner::NextAutoSaveFrame = -1;
Spawner::NextAutoSaveNumber = 0;
return 0;
}

DEFINE_HOOK(0x686B20, INIClass_ReadScenario_AutoSave, 0x6)
{
/**
* Schedule the next autosave.
*/
Spawner::NextAutoSaveFrame = Unsorted::CurrentFrame;
Spawner::NextAutoSaveFrame += Spawner::GetConfig()->AutoSaveInterval;
return 0;
}

DEFINE_HOOK(0x4C7A14, EventClass_RespondToEvent_SaveGame, 0x5)
{
Spawner::DoSave = true;
return 0x4C7B42;
}

// for some reason beacons are only inited on scenario init, which doesn't happen on load
DEFINE_HOOK(0x67E6DA, LoadGame_AfterInit, 0x6)
{
BeaconManagerClass::Instance.LoadArt();
return 0;
}

#pragma endregion
Loading
Loading