Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.6.5 #674

Merged
merged 52 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ef2ce4b
Fix: naked NPCs bug
RobbeBryssinck Mar 29, 2024
c2e0be5
tweak: exclude dead NPCs
RobbeBryssinck Mar 29, 2024
6aa97ed
Extra checks for naked npc fix
RobbeBryssinck Mar 29, 2024
61488e6
Better humanoid npc detection
RobbeBryssinck Mar 29, 2024
5602e81
fix: FT build
RobbeBryssinck Mar 29, 2024
4a3cbf4
tweak: dont broadcast default outfit
RobbeBryssinck Mar 29, 2024
ca4476a
fix: handle NPCs with leveled items
RobbeBryssinck Mar 31, 2024
01c4075
tweak: remove redundant code
RobbeBryssinck Mar 31, 2024
129396f
Merge pull request #651 from tiltedphoques/fix/nakedNpcs
RobbeBryssinck Mar 31, 2024
32c8501
Fixes Vilkas companions trainer quest not stopping combat for passive…
absol89 Apr 13, 2024
c9b4ed4
Revert "Fixes Vilkas companions trainer quest not stopping combat for…
absol89 Apr 13, 2024
53b5823
Fixes tiltedphoques/TiltedEvolution#598
absol89 Apr 13, 2024
51e2196
Fix array out-of-bounds error in test suite.
rfortier Apr 16, 2024
f5fb5be
If you ever suffer from recursive or looping crashes, this is the (tr…
rfortier Feb 29, 2024
981de9a
Update xmake.lua
maximegmd Mar 14, 2024
715187b
Fix game exit crash when under ModOrganizer2, even when only Address …
rfortier Mar 13, 2024
395424f
Merge pull request #657 from rfortier/fix-tests-logic-error
RobbeBryssinck Apr 28, 2024
a940294
Revert "Update xmake.lua"
rfortier Apr 28, 2024
65ece40
Merge pull request #643 from rfortier/fix-ModOrganizer2-exit-crash
RobbeBryssinck Apr 29, 2024
5c68b91
Merge pull request #644 from rfortier/fix-recursive-crashdump
RobbeBryssinck Apr 29, 2024
c50ee46
fix: Support cyrillic text in the ImGui debug menu (#660)
miredirex May 4, 2024
9c7de5c
tweak: add TARGET_NAME to selectable-executable filter (#661)
ToeKneeRED May 4, 2024
a4930bc
Add Korean language (#646)
angrystar170 May 4, 2024
698fef4
Turkish Translation. (#653)
WeirdYunus May 4, 2024
e27bb37
fix: dont send queued (un)equip messages
RobbeBryssinck May 4, 2024
7392c96
Add all players to party upon party creation
May 4, 2024
9d2b62b
Add players to party upon connection
May 4, 2024
3b02f75
Now only functions on private servers
May 4, 2024
c13df92
Fix: Join party on connect now doesn't only work for the first party …
May 5, 2024
9882d93
Now uses its own config setting instead of server privacy
May 5, 2024
1f039df
Merge pull request #654 from absol89/dev
RobbeBryssinck May 5, 2024
4d9947e
tweak: warn about uGridsToLoad
RobbeBryssinck May 5, 2024
db92e6b
tweak: default enabled mod policy with vanilla list
RobbeBryssinck May 5, 2024
6ab6f3e
tweak: warn about mod usage
RobbeBryssinck May 5, 2024
4db43e9
tweak: warn about mod usage in core
RobbeBryssinck May 5, 2024
9b54fb7
Revert "tweak: default enabled mod policy with vanilla list"
RobbeBryssinck May 5, 2024
22b943d
Merge pull request #666 from tiltedphoques/tweak/modPolicyDefault
RobbeBryssinck May 5, 2024
31c9ac5
Merge branch 'dev' into fix/gridsToLoad
RobbeBryssinck May 5, 2024
cc488b9
fix: ft build
RobbeBryssinck May 5, 2024
335033b
Merge pull request #663 from Chaybugz/feature-autopartyjoin
RobbeBryssinck May 5, 2024
f2e85cb
Merge pull request #664 from tiltedphoques/fix/gridsToLoad
RobbeBryssinck May 5, 2024
bfdf26f
Merge pull request #667 from tiltedphoques/fix/equip
RobbeBryssinck May 5, 2024
f72839e
Add files via upload
Sidiusz May 6, 2024
da49672
Update Code/skyrim_ui/src/assets/i18n/ru.json
Sidiusz May 6, 2024
faa6f86
Merge pull request #668 from Sidiusz/Sidiusz-RUloc-2
RobbeBryssinck May 6, 2024
79883fb
add ja.json
Humankiin May 7, 2024
1dfa1a6
Update transloco-root.module.ts to include Japanese.
Humankiin May 7, 2024
47022ef
Update transloco-root.module.ts
Dragonisser May 8, 2024
ecbb0a5
Update es.json
Lemonadefox May 8, 2024
e99df40
Merge pull request #672 from tiltedphoques/tweak/update-translation
RobbeBryssinck May 9, 2024
119695e
Merge pull request #671 from Humankiin/dev
RobbeBryssinck May 9, 2024
df47981
Merge pull request #673 from Lemonadefox/dev
RobbeBryssinck May 9, 2024
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: 3 additions & 1 deletion Code/client/CrashHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ std::string SerializeTimePoint(const time_point& time, const std::string& format

LONG WINAPI VectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
{
if (pExceptionInfo->ExceptionRecord->ExceptionCode == 0xC0000005)
static int alreadycrashed = 0;

if (pExceptionInfo->ExceptionRecord->ExceptionCode == 0xC0000005 && alreadycrashed++ == 0)
{
spdlog::error("Crash occurred!");
MINIDUMP_EXCEPTION_INFORMATION M;
Expand Down
11 changes: 11 additions & 0 deletions Code/client/Games/Primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ template <class T> struct GameList
Entry entry;

inline bool Empty() const noexcept { return entry.data == nullptr; }
inline size_t Size() const noexcept
{
if (entry.data == nullptr)
return 0ULL;

size_t size = 0;
for (const Entry* current = &entry; current; current = current->next)
size++;

return size;
}

// Range for loop compatibility
struct Iterator
Expand Down
47 changes: 46 additions & 1 deletion Code/client/Games/Skyrim/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <Components/TESActorBaseData.h>
#include <ExtraData/ExtraFactionChanges.h>
#include <Games/Memory.h>
#include <Forms/TESLevItem.h>

#include <Events/HealthChangeEvent.h>
#include <Events/InventoryChangeEvent.h>
Expand Down Expand Up @@ -44,6 +45,8 @@
#include <Games/Skyrim/BSAnimationGraphManager.h>
#include <Havok/hkbStateMachine.h>
#include <Havok/hkbBehaviorGraph.h>
#include <Forms/BGSOutfit.h>
#include <Forms/TESObjectARMO.h>

#ifdef SAVE_STUFF

Expand Down Expand Up @@ -191,6 +194,48 @@ TESForm* Actor::GetEquippedAmmo() const noexcept
return nullptr;
}

bool Actor::IsWearingBodyPiece() const noexcept
{
return GetContainerChanges()->GetArmor(32) != nullptr;
}

bool Actor::ShouldWearBodyPiece() const noexcept
{
TESNPC* pBase = Cast<TESNPC>(baseForm);
if (!pBase)
return false;

BGSOutfit* pDefaultOutfit = pBase->outfits[0];
if (!pDefaultOutfit)
return false;

for (auto* pItem : pDefaultOutfit->outfitItems)
{
TESObjectARMO* pArmor = nullptr;

if (pItem->formType == FormType::Armor)
pArmor = Cast<TESObjectARMO>(pItem);
else if (pItem->formType == FormType::LeveledItem)
{
TESLevItem* pLevItem = Cast<TESLevItem>(pItem);
if (!pLevItem || !pLevItem->pLeveledListA || !pLevItem->pLeveledListA->pForm)
continue;

pArmor = Cast<TESObjectARMO>(pLevItem->pLeveledListA->pForm);
}
else
continue;

if (!pArmor)
continue;

if (pArmor->IsBodyPiece())
return true;
}

return false;
}

// Get owner of a summon or raised corpse
Actor* Actor::GetCommandingActor() const noexcept
{
Expand All @@ -207,7 +252,7 @@ Actor* Actor::GetCommandingActor() const noexcept
// Get owner of a summon or raised corpse
void Actor::SetCommandingActor(BSPointerHandle<TESObjectREFR> aCommandingActor) noexcept
{
if (currentProcess && currentProcess->middleProcess && currentProcess->middleProcess)
if (currentProcess && currentProcess->middleProcess)
{
currentProcess->middleProcess->commandingActor = aCommandingActor;
flags2 |= ActorFlags::IS_COMMANDED_ACTOR;
Expand Down
2 changes: 2 additions & 0 deletions Code/client/Games/Skyrim/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ struct Actor : TESObjectREFR
[[nodiscard]] Actor* GetCombatTarget() const noexcept;
[[nodiscard]] bool HasPerk(uint32_t aPerkFormId) const noexcept;
[[nodiscard]] uint8_t GetPerkRank(uint32_t aPerkFormId) const noexcept;
[[nodiscard]] bool IsWearingBodyPiece() const noexcept;
[[nodiscard]] bool ShouldWearBodyPiece() const noexcept;

// Setters
void SetSpeed(float aSpeed) noexcept;
Expand Down
10 changes: 6 additions & 4 deletions Code/client/Games/Skyrim/EquipManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void* TP_MAKE_THISCALL(EquipHook, EquipManager, Actor* apActor, TESForm* apItem,
// Consumables are "equipped" as well. We don't want this to sync, for several reasons.
// The right hand item on the server would be overridden by the consumable.
// Furthermore, the equip action on the other clients would doubly subtract the consumables.
if (pExtension->IsLocal() && !apItem->IsConsumable())
if (pExtension->IsLocal() && !apItem->IsConsumable() && !apData->bQueueEquip)
{
EquipmentChangeEvent evt{};
evt.ActorId = apActor->formID;
Expand Down Expand Up @@ -189,7 +189,7 @@ void* TP_MAKE_THISCALL(UnEquipHook, EquipManager, Actor* apActor, TESForm* apIte
return nullptr;
}

if (pExtension->IsLocal() && !ScopedUnequipOverride::IsOverriden())
if (pExtension->IsLocal() && !ScopedUnequipOverride::IsOverriden() && !apData->bQueueEquip)
{
EquipmentChangeEvent evt{};
evt.ActorId = apActor->formID;
Expand All @@ -216,7 +216,7 @@ void* TP_MAKE_THISCALL(EquipSpellHook, EquipManager, Actor* apActor, TESForm* ap
if (pExtension->IsRemote() && !ScopedEquipOverride::IsOverriden())
return nullptr;

if (pExtension->IsLocal())
if (pExtension->IsLocal() && !apData->bQueueEquip)
{
EquipmentChangeEvent evt{};
evt.ActorId = apActor->formID;
Expand All @@ -241,7 +241,7 @@ void* TP_MAKE_THISCALL(UnEquipSpellHook, EquipManager, Actor* apActor, TESForm*
if (pExtension->IsRemote() && !ScopedEquipOverride::IsOverriden())
return nullptr;

if (pExtension->IsLocal() && !ScopedUnequipOverride::IsOverriden())
if (pExtension->IsLocal() && !ScopedUnequipOverride::IsOverriden() && !apData->bQueueEquip)
{
EquipmentChangeEvent evt{};
evt.ActorId = apActor->formID;
Expand All @@ -265,6 +265,7 @@ void* TP_MAKE_THISCALL(EquipShoutHook, EquipManager, Actor* apActor, TESForm* ap
if (pExtension->IsRemote() && !ScopedEquipOverride::IsOverriden())
return nullptr;

// TODO: queue check?
if (pExtension->IsLocal())
{
EquipmentChangeEvent evt{};
Expand All @@ -289,6 +290,7 @@ void* TP_MAKE_THISCALL(UnEquipShoutHook, EquipManager, Actor* apActor, TESForm*
if (pExtension->IsRemote() && !ScopedEquipOverride::IsOverriden())
return nullptr;

// TODO: queue check?
if (pExtension->IsLocal() && !ScopedUnequipOverride::IsOverriden())
{
EquipmentChangeEvent evt{};
Expand Down
9 changes: 9 additions & 0 deletions Code/client/Games/Skyrim/ExtraData/ExtraContainerChanges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ bool ExtraContainerChanges::Entry::IsQuestObject() noexcept

return TiltedPhoques::ThisCall(s_isQuestObject, this);
}

TESObjectARMO* ExtraContainerChanges::Data::GetArmor(uint32_t aSlotId) noexcept
{
TP_THIS_FUNCTION(TGetArmor, TESObjectARMO*, ExtraContainerChanges::Data, uint32_t);

POINTER_SKYRIMSE(TGetArmor, s_getArmor, 16113);

return TiltedPhoques::ThisCall(s_getArmor, this, aSlotId);
}
2 changes: 2 additions & 0 deletions Code/client/Games/Skyrim/ExtraData/ExtraContainerChanges.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ struct BGSLoadFormBuffer;
struct BGSSaveFormBuffer;
struct TESObjectREFR;
struct TESForm;
struct TESObjectARMO;

struct ExtraContainerChanges : BSExtraData
{
Expand All @@ -25,6 +26,7 @@ struct ExtraContainerChanges : BSExtraData
{
void Save(BGSSaveFormBuffer* apBuffer);
void Load(BGSLoadFormBuffer* apBuffer);
TESObjectARMO* GetArmor(uint32_t aSlotId) noexcept;

GameList<Entry>* entries;
TESObjectREFR* parent;
Expand Down
1 change: 1 addition & 0 deletions Code/client/Games/Skyrim/Forms/BGSOutfit.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

struct BGSOutfit : TESForm
{
GameArray<TESForm*> outfitItems;
};
1 change: 1 addition & 0 deletions Code/client/Games/Skyrim/Forms/TESForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum class FormType : uint8_t
Npc = 43,
LeveledCharacter = 44,
Alchemy = 46,
LeveledItem = 53,
Character = 62,
QuestItem = 77,
Count = 0x87
Expand Down
9 changes: 9 additions & 0 deletions Code/client/Games/Skyrim/Forms/TESLevItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include "TESLeveledList.h"

struct TESLevItem : TESBoundObject, TESLeveledList
{
};

static_assert(sizeof(TESLevItem) == 0x58);
18 changes: 18 additions & 0 deletions Code/client/Games/Skyrim/Forms/TESLeveledList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

struct TESLeveledList : BaseFormComponent
{
struct LEVELED_OBJECT
{
TESForm* pForm;
uint16_t count;
uint16_t level;
uint32_t padC;
void* pItemExtra;
};

LEVELED_OBJECT* pLeveledListA; // this array has count at offset -8
uint8_t unk10[0x28 - 0x10];
};

static_assert(sizeof(TESLeveledList) == 0x28);
7 changes: 7 additions & 0 deletions Code/client/Games/Skyrim/Forms/TESObjectARMO.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@

struct TESObjectARMO : TESForm
{
[[nodiscard]] bool IsBodyPiece() const noexcept
{
return (slotType & 0x4) != 0; // 0x4 is flag for body piece
}

uint8_t unk20[0x1B8 - sizeof(TESForm)];
uint32_t slotType;
};
2 changes: 1 addition & 1 deletion Code/client/Games/Skyrim/TESObjectREFR.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct TESObjectREFR : TESForm
virtual void sub_87();
virtual void sub_88();
virtual void DisableImpl();
virtual void sub_8A();
virtual void ResetInventory(bool abLeveledOnly);
virtual void sub_8B();
virtual void sub_8C();
virtual void sub_8D();
Expand Down
1 change: 1 addition & 0 deletions Code/client/Games/TES.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ struct INISettingCollection
Entry* next;
};

// TODO(FT): Setting a setting should be followed by SettingHandlerMap::SettingUpdated() call
Setting* GetSetting(const char* acpName) noexcept;

uint8_t unk0[0x118];
Expand Down
43 changes: 43 additions & 0 deletions Code/client/Services/Generic/DiscoveryService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Events/CellChangeEvent.h>
#include <Events/LocationChangeEvent.h>
#include <Events/ConnectedEvent.h>
#include <Events/ConnectionErrorEvent.h>

#include <World.h>

Expand Down Expand Up @@ -250,12 +251,54 @@ void DiscoveryService::OnUpdate(const PreUpdateEvent& acUpdateEvent) noexcept

void DiscoveryService::OnConnected(const ConnectedEvent& acEvent) noexcept
{
// uGridsToLoad should always be 5, as this is what the server enforces
auto* pSetting = INISettingCollection::Get()->GetSetting("uGridsToLoad:General");
if (pSetting && pSetting->data != 5)
{
ConnectionErrorEvent errorEvent{};
errorEvent.ErrorDetail = "{\"error\": \"bad_uGridsToLoad\"}";

m_world.GetRunner().Trigger(errorEvent);
}

VisitCell(true);
}

BSTEventResult DiscoveryService::OnEvent(const TESLoadGameEvent*, const EventDispatcher<TESLoadGameEvent>*)
{
spdlog::info("Finished loading, triggering visit cell");

const TiltedPhoques::String defaultModlist[7] = {"Skyrim.esm", "Update.esm", "Dawnguard.esm",
"HearthFires.esm", "Dragonborn.esm", "_ResourcePack.esl",
"SkyrimTogether.esp"};

auto& currentModlist = ModManager::Get()->mods;

bool isModlistEqual = currentModlist.Size() == 7;

if (isModlistEqual)
{
int i = 0;
for (const auto& currentMod : currentModlist)
{
if (currentMod->filename != defaultModlist[i])
{
isModlistEqual = false;
break;
}

i++;
}
}

if (!isModlistEqual)
{
ConnectionErrorEvent errorEvent{};
errorEvent.ErrorDetail = "{\"error\": \"non_default_install\"}";

m_world.GetRunner().Trigger(errorEvent);
}

VisitCell(true);

return BSTEventResult::kOk;
Expand Down
Loading
Loading