Skip to content

Commit b0c0cf8

Browse files
committed
Add tap time option
1 parent 4f218fa commit b0c0cf8

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

app/app.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ int main(int, char **) {
109109

110110
ImGui::Checkbox("Mirror Mod", &maniac::config.mirror_mod);
111111

112+
ImGui::InputInt("Tap time", &maniac::config.tap_time);
113+
ImGui::SameLine();
114+
help_marker("How long a key is held down for a single keypress, in milliseconds.");
115+
112116
horizontal_break();
113117
ImGui::Text("Drag or <Ctrl>+Click to change values.");
114118

lib/include/maniac/maniac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace maniac {
99
struct config {
10+
int tap_time = 20;
1011
bool mirror_mod = false;
1112
int compensation_offset = 0;
1213
int humanization_modifier = 0;

lib/maniac.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#include <maniac/maniac.h>
22

3+
static void reset_keys() {
4+
auto keys = osu::Osu::get_key_subset(9);
5+
for (auto key : keys) {
6+
Process::send_keypress(key, false);
7+
}
8+
}
9+
310
namespace maniac {
411
void block_until_playing() {
512
while (true) {
@@ -12,10 +19,7 @@ namespace maniac {
1219
}
1320

1421
void play(std::vector<osu::Action> &actions) {
15-
auto keys = osu::Osu::get_key_subset(9);
16-
for (auto key : keys) {
17-
Process::send_keypress(key, false);
18-
}
22+
reset_keys();
1923

2024
size_t cur_i = 0;
2125
auto cur_time = 0;
@@ -38,7 +42,7 @@ namespace maniac {
3842
}
3943

4044
std::vector<osu::Action> get_actions(int32_t min_time) {
41-
auto player = osu->get_map_player();
45+
const auto player = osu->get_map_player();
4246
auto hit_objects = player.manager.list.content;
4347

4448
if (hit_objects.empty()) {
@@ -47,7 +51,7 @@ namespace maniac {
4751
return {};
4852
}
4953

50-
auto columns = std::max_element(hit_objects.begin(),
54+
const auto columns = std::max_element(hit_objects.begin(),
5155
hit_objects.end(), [](auto a, auto b) {
5256
return a.column < b.column; })->column + 1;
5357
auto keys = osu::Osu::get_key_subset(columns);
@@ -62,9 +66,8 @@ namespace maniac {
6266
if (hit_object.start_time < min_time)
6367
continue;
6468

65-
// TODO: Make the tap time an option or something.
6669
if (hit_object.start_time == hit_object.end_time)
67-
hit_object.end_time += 20;
70+
hit_object.end_time += config.tap_time;
6871

6972
actions.emplace_back(keys[hit_object.column], true,
7073
hit_object.start_time + config.compensation_offset);

0 commit comments

Comments
 (0)