diff options
| author | Fuwn <[email protected]> | 2022-02-03 13:18:25 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-02-03 13:18:25 -0800 |
| commit | 949d8501dcfb2b0f6902c2191b5d126daba2df7c (patch) | |
| tree | b4d62965bc2a44df3d6804268b328fd0bc921490 | |
| parent | fix(#1): delete_handle generating junk data when lunar is closed after first ... (diff) | |
| download | soyuz-949d8501dcfb2b0f6902c2191b5d126daba2df7c.tar.xz soyuz-949d8501dcfb2b0f6902c2191b5d126daba2df7c.zip | |
doc: some documentation :smile:
| -rw-r--r-- | include/soyuz/library.hh | 6 | ||||
| -rw-r--r-- | include/soyuz/resource.hh | 6 | ||||
| -rw-r--r-- | include/soyuz/soyuz.hh | 6 | ||||
| -rw-r--r-- | include/soyuz/tray.hh | 6 | ||||
| -rw-r--r-- | include/soyuz/windows.hh | 6 | ||||
| -rw-r--r-- | soyuz/library.cc | 6 | ||||
| -rw-r--r-- | soyuz/soyuz.cc | 21 | ||||
| -rw-r--r-- | soyuz/tray.cc | 6 | ||||
| -rw-r--r-- | soyuz/windows.cc | 6 |
9 files changed, 67 insertions, 2 deletions
diff --git a/include/soyuz/library.hh b/include/soyuz/library.hh index ca3b094..9346f2a 100644 --- a/include/soyuz/library.hh +++ b/include/soyuz/library.hh @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file library.hh + * @author Fuwn + * @date 2021. August. 18. + */ + #ifndef SOYUZ_LIBRARY_HH #define SOYUZ_LIBRARY_HH #pragma once diff --git a/include/soyuz/resource.hh b/include/soyuz/resource.hh index fbb57e1..462b537 100644 --- a/include/soyuz/resource.hh +++ b/include/soyuz/resource.hh @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file resource.hh + * @author Fuwn + * @date 2021. August. 18. + */ + #ifndef SOYUZ_RESOURCE_HH #define SOYUZ_RESOURCE_HH #pragma once diff --git a/include/soyuz/soyuz.hh b/include/soyuz/soyuz.hh index 3f30323..2fd0157 100644 --- a/include/soyuz/soyuz.hh +++ b/include/soyuz/soyuz.hh @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file soyuz.hh + * @author Fuwn + * @date 2021. August. 18. + */ + #ifndef SOYUZ_SOYUZ_HH #define SOYUZ_SOYUZ_HH #pragma once diff --git a/include/soyuz/tray.hh b/include/soyuz/tray.hh index 9d6af22..6722bab 100644 --- a/include/soyuz/tray.hh +++ b/include/soyuz/tray.hh @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file tray.hh + * @author Fuwn + * @date 2021. August. 18. + */ + #ifndef SOYUZ_TRAY_HH #define SOYUZ_TRAY_HH #pragma once diff --git a/include/soyuz/windows.hh b/include/soyuz/windows.hh index 7f07de7..153cf11 100644 --- a/include/soyuz/windows.hh +++ b/include/soyuz/windows.hh @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file windows.hh + * @author Fuwn + * @date 2021. August. 18. + */ + #ifndef SOYUZ_WINDOWS_HH #define SOYUZ_WINDOWS_HH #pragma once diff --git a/soyuz/library.cc b/soyuz/library.cc index fdf9483..86260e6 100644 --- a/soyuz/library.cc +++ b/soyuz/library.cc @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file library.cc + * @author Fuwn + * @date 2021. August. 18. + */ + #include <soyuz/library.hh> #include <cstdio> diff --git a/soyuz/soyuz.cc b/soyuz/soyuz.cc index 871d093..02085a0 100644 --- a/soyuz/soyuz.cc +++ b/soyuz/soyuz.cc @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file soyuz.cc + * @author Fuwn + * @date 2021. August. 18. + */ + #include <soyuz/soyuz.hh> #pragma comment(lib, "ntdll.lib") @@ -60,8 +66,13 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int show) { InitNotifyIconData(); ShowWindow(window, show); - // https://medium.com/@vgasparyan1995/a-new-thread-in-c-20-jthread-ebd121ae8906 + /** + * Launch a new thread to take care of everything important + * + * https://medium.com/@vgasparyan1995/a-new-thread-in-c-20-jthread-ebd121ae8906 + */ std::jthread soyuz {[](const std::stop_token &stop) -> void { + // Check if Lunar Client is open, if not; close Soyuz DWORD pid = soyuz::find_lunar(); if (pid == 0 || pid == 3435973836) { soyuz::log("could not locate lunar client"); @@ -72,13 +83,19 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int show) { soyuz::log("hooked lunar client"); soyuz::log("you may now close this window"); while (!stop.stop_requested()) { - pid = soyuz::find_lunar(); + /** + * Check if Lunar Client is open before every `delete_handle` run, if not; timeout + * + * Thanks, @LorenzoHanssens (#1) + */ + pid = soyuz::find_lunar(); if (pid == 0 || pid == 3435973836) { soyuz::log("could not locate lunar client, waiting 10 seconds"); std::this_thread::sleep_for(std::chrono::seconds(10)); } + // If Lunar Client **is** open, close it's Discord IPC Named Pipe if (soyuz::delete_handle(pid) == 1) { soyuz::log("unable to close lunar client's discord ipc named pipe"); } diff --git a/soyuz/tray.cc b/soyuz/tray.cc index a0ad4c5..137e0f0 100644 --- a/soyuz/tray.cc +++ b/soyuz/tray.cc @@ -1,6 +1,12 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file tray.cc + * @author Fuwn + * @date 2021. August. 18. + */ + #include <soyuz/tray.hh> #include <fmt/format.h> diff --git a/soyuz/windows.cc b/soyuz/windows.cc index 3576675..922c775 100644 --- a/soyuz/windows.cc +++ b/soyuz/windows.cc @@ -1,4 +1,10 @@ // Copyright (C) 2021-2021 Fuwn // SPDX-License-Identifier: GPL-3.0-only +/** + * @file windows.cc + * @author Fuwn + * @date 2021. August. 18. + */ + #include <soyuz/windows.hh> |