[UIFeeder] Don't replace game feeders

This commit is contained in:
momo5502 2017-02-06 21:23:15 +01:00
parent d524092944
commit a0b21f43a0
4 changed files with 41 additions and 9 deletions

View File

@ -52,7 +52,7 @@ namespace Components
Changelog::Changelog() Changelog::Changelog()
{ {
// Changelog // Changelog
UIFeeder::Add(39.0f, Changelog::GetChangelogCount, Changelog::GetChangelogText, Changelog::SelectChangelog); UIFeeder::Add(62.0f, Changelog::GetChangelogCount, Changelog::GetChangelogText, Changelog::SelectChangelog);
} }
Changelog::~Changelog() Changelog::~Changelog()

View File

@ -476,7 +476,7 @@ namespace Components
} }
}); });
UIFeeder::Add(6.0f, Friends::GetFriendCount, Friends::GetFriendText, Friends::SelectFriend); UIFeeder::Add(61.0f, Friends::GetFriendCount, Friends::GetFriendText, Friends::SelectFriend);
QuickPatch::OnShutdown([]() QuickPatch::OnShutdown([]()
{ {

View File

@ -32,11 +32,7 @@ namespace Components
bool UIFeeder::SetItemSelection() bool UIFeeder::SetItemSelection()
{ {
if(UIFeeder::Current.feeder == 4.0f) if (UIFeeder::Feeders.find(UIFeeder::Current.feeder) != UIFeeder::Feeders.end())
{
return true;
}
else if (UIFeeder::Feeders.find(UIFeeder::Current.feeder) != UIFeeder::Feeders.end())
{ {
UIFeeder::Feeders[UIFeeder::Current.feeder].select(UIFeeder::Current.index); UIFeeder::Feeders[UIFeeder::Current.feeder].select(UIFeeder::Current.index);
return true; return true;
@ -339,7 +335,7 @@ namespace Components
if (reinterpret_cast<unsigned int*>(0x633E934)[j] == i) if (reinterpret_cast<unsigned int*>(0x633E934)[j] == i)
{ {
UIFeeder::SelectMap(j); UIFeeder::SelectMap(j);
UIFeeder::Select(5.0f, j); UIFeeder::Select(60.0f, j);
break; break;
} }
} }
@ -349,6 +345,37 @@ namespace Components
} }
} }
int UIFeeder::CheckSelection(int feeder)
{
if (feeder == 62) return 0;
return 1;
}
__declspec(naked) void UIFeeder::CheckSelectionStub()
{
__asm
{
mov ecx, 6B5240h
call ecx // __ftol2_sse
push eax
call UIFeeder::CheckSelection
test al, al
jz returnSafe
pop eax
push 635A9Dh
retn
returnSafe:
pop eax
xor eax, eax
pop ecx
retn
}
}
UIFeeder::UIFeeder() UIFeeder::UIFeeder()
{ {
Dvar::OnInit([]() Dvar::OnInit([]()
@ -379,11 +406,14 @@ namespace Components
// Play mouse over sound check // Play mouse over sound check
Utils::Hook(0x639D66, UIFeeder::PlaySoundStub, HOOK_CALL).install()->quick(); Utils::Hook(0x639D66, UIFeeder::PlaySoundStub, HOOK_CALL).install()->quick();
// Disable blinking
Utils::Hook(0x635A98, UIFeeder::CheckSelectionStub, HOOK_JUMP).install()->quick();
// some thing overwriting feeder 2's data // some thing overwriting feeder 2's data
Utils::Hook::Set<BYTE>(0x4A06A9, 0xEB); Utils::Hook::Set<BYTE>(0x4A06A9, 0xEB);
// Use feeder 5 for maps, as feeder 4 selects on mouse over // Use feeder 5 for maps, as feeder 4 selects on mouse over
UIFeeder::Add(5.0f, UIFeeder::GetMapCount, UIFeeder::GetMapText, UIFeeder::SelectMap); UIFeeder::Add(60.0f, UIFeeder::GetMapCount, UIFeeder::GetMapText, UIFeeder::SelectMap);
UIScript::Add("ApplyMap", UIFeeder::ApplyMap); UIScript::Add("ApplyMap", UIFeeder::ApplyMap);
UIScript::Add("ApplyInitialMap", UIFeeder::ApplyInitialMap); UIScript::Add("ApplyInitialMap", UIFeeder::ApplyInitialMap);

View File

@ -45,6 +45,8 @@ namespace Components
static bool SetItemSelection(); static bool SetItemSelection();
static bool CheckFeeder(); static bool CheckFeeder();
static int CheckSelection(int feeder);
static void CheckSelectionStub();
static void MouseEnterStub(); static void MouseEnterStub();
static void MouseSelectStub(); static void MouseSelectStub();