Skip to content

Commit e9b0a99

Browse files
committed
implement Options
1 parent dcdbc2c commit e9b0a99

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

src/sdk/common/client/game/ClientInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ SDK::GuiData* SDK::ClientInstance::getGuiData() {
8282
}
8383

8484
SDK::Options* SDK::ClientInstance::getOptions() {
85-
return memory::callVirtual<Options*>(this, 0xC7);
85+
return memory::callVirtual<Options*>(this, 0xC3);
8686
}
8787

8888
void SDK::ClientInstance::grabCursor() {

src/sdk/common/client/game/Option.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
namespace SDK {
3+
enum class OptionID {
4+
Vsync = 54,
5+
};
6+
7+
class Option {
8+
public:
9+
10+
class Impl {
11+
private:
12+
char pad[0x124];
13+
public:
14+
OptionID id;
15+
};
16+
17+
18+
std::unique_ptr<Impl> impl;
19+
private:
20+
virtual ~Option() = 0;
21+
};
22+
23+
class BoolOption : public Option {
24+
public:
25+
bool value;
26+
bool defaultValue;
27+
std::function<bool(bool)> coerceValueCallback;
28+
};
29+
}

src/sdk/common/client/game/Options.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
#pragma once
2+
#include "Option.h"
3+
24
namespace SDK {
3-
class Options {
5+
6+
7+
class Options : std::enable_shared_from_this<Options> {
48
public:
5-
void setPlayerViewPerspective(int) {
6-
// TODO: lol
9+
void setPlayerViewPerspective(int perspective) {
10+
memory::callVirtual<void>(this, 136, perspective);
711
}
812

913
int getPlayerViewPerspective() {
10-
// TODO: lol
11-
return 0;
14+
return memory::callVirtual<int>(this, 137);
15+
}
16+
17+
bool getVsync() {
18+
for (auto& option : options) {
19+
if (option->impl->id == OptionID::Vsync) {
20+
return static_cast<SDK::BoolOption*>(option.get())->value;
21+
}
22+
}
1223
}
1324

25+
private:
26+
void* unknown;
27+
std::array<std::unique_ptr<class Option>, 788> options;
1428

29+
virtual ~Options() = 0;
1530
};
1631
}

0 commit comments

Comments
 (0)