Skip to content

Commit

Permalink
Merge pull request #5 from OwlHowlinMornSky/settings
Browse files Browse the repository at this point in the history
Add Settings
  • Loading branch information
OwlHowlinMornSky authored Dec 23, 2023
2 parents a5ac8ff + 9aad339 commit 7b965f1
Show file tree
Hide file tree
Showing 35 changed files with 1,048 additions and 114 deletions.
22 changes: 21 additions & 1 deletion CoreDll/API.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#pragma once
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#pragma once

// 下列 ifdef 块是创建使从 DLL 导出更简单的
// 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 WRAPPER_EXPORTS
Expand Down
22 changes: 21 additions & 1 deletion CoreDll/Clock.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#include "Clock.h"
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#include "Clock.h"
#include "framework.h"

namespace {
Expand Down
22 changes: 21 additions & 1 deletion CoreDll/Clock.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#pragma once
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#pragma once

#include "API.h"
#include "Time.h"
Expand Down
1 change: 1 addition & 0 deletions CoreDll/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<ClInclude Include="Helper.h" />
<ClInclude Include="IHelper.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ReturnMessages.h" />
<ClInclude Include="Time.h" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions CoreDll/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<ClInclude Include="resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ReturnMessages.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CoreDll.rc">
Expand Down
Binary file modified CoreDll/CoreDll.rc
Binary file not shown.
60 changes: 54 additions & 6 deletions CoreDll/Helper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#include "Helper.h"
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#include "Helper.h"

#include <iostream>
#include <thread>
Expand All @@ -21,7 +41,10 @@ Helper::Helper() :
r_capture(nullptr), // 初始无索引

task_ChaGame_ForNew(false), // 默认上一次比赛
task_Mouse_ForMouse(false) // 默认发窗口消息
task_Mouse_ForMouse(false), // 默认发窗口消息

task_PreventFromSleep(true), // 默认阻止睡眠
task_KeepDisplay(false) // 默认不保持显示

{
if (!wgc::ICapture::setup(true)) {
Expand Down Expand Up @@ -53,12 +76,32 @@ Helper::Helper() :

Helper::~Helper() {}

void Helper::regForNew(bool forNew) {
long Helper::regForNew(bool forNew) {
if (m_running)
return 1l;
task_ChaGame_ForNew = forNew;
return 0l;
}

void Helper::regForMouse(bool forMouse) {
long Helper::regForMouse(bool forMouse) {
if (m_running)
return 1l;
task_Mouse_ForMouse = forMouse;
return 0l;
}

long Helper::regPrevent(bool prevent) {
if (m_running)
return 1l;
task_PreventFromSleep = prevent;
return 0l;
}

long Helper::regPreventKeepDisplay(bool keep) {
if (m_running)
return 1l;
task_KeepDisplay = keep;
return 0l;
}

bool Helper::start() {
Expand Down Expand Up @@ -105,8 +148,13 @@ void Helper::mainwork() {
m_running = true; // 设置标记(return前要清除)
msgPush(HelperReturnMessage::BtnToStop); // 让主按钮变为stop

// 防止关闭屏幕和睡眠
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
// 按设置防止关闭屏幕和睡眠
if (task_PreventFromSleep) {
SetThreadExecutionState(
ES_CONTINUOUS | ES_SYSTEM_REQUIRED |
(task_KeepDisplay ? ES_DISPLAY_REQUIRED : 0)
);
}

try {
m_doaxvv = FindWindowW(g_findCls, g_findWnd); // 查找doaxvv窗口
Expand Down
33 changes: 29 additions & 4 deletions CoreDll/Helper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#pragma once
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#pragma once

#include <queue>
#include <mutex>
Expand All @@ -25,11 +45,14 @@ class Helper final :
* @brief 设置挑战赛打新比赛
* @param forNew true则打新比赛,否则打上一次比赛
*/
virtual void regForNew(bool forNew) override;
virtual long regForNew(bool forNew) override;

virtual long regForMouse(bool forMouse) override;

virtual void regForMouse(bool forMouse) override;
virtual long regShowCV(bool show) override;

virtual void regShowCV(bool show) override;
virtual long regPrevent(bool prevent) override;
virtual long regPreventKeepDisplay(bool keep) override;

public:
/**
Expand Down Expand Up @@ -143,6 +166,8 @@ class Helper final :
cv::Rect rect_ChaGame;
bool task_ChaGame_ForNew; // 选择新比赛。
bool task_Mouse_ForMouse; // 选择控制鼠标。
bool task_PreventFromSleep; // 阻止睡眠。
bool task_KeepDisplay; // 阻止睡眠时保持显示。

// 编队页面右下角的 挑战按钮。
cv::Mat mat_StartGame;
Expand Down
25 changes: 23 additions & 2 deletions CoreDll/Helper.steps.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#include "Helper.h"
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#include "Helper.h"

#include "Clock.h"

Expand Down Expand Up @@ -133,9 +153,10 @@ inline bool find(const cv::Mat& matSample, const cv::Mat& matTemplate, cv::Rect&

namespace ohms {

void Helper::regShowCV(bool show) {
long Helper::regShowCV(bool show) {
std::lock_guard lg(g_showcvMutex);
g_showcv = show;
return 0l;
}

bool Helper::step_copyMat(cv::Mat& target) {
Expand Down
22 changes: 21 additions & 1 deletion CoreDll/Helper.subworks.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#include "Helper.h"
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#include "Helper.h"

namespace ohms {

Expand Down
22 changes: 21 additions & 1 deletion CoreDll/IHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#include "IHelper.h"
/*
* DDOA-DOAXVV-OPEN-ASSISTANT
*
* Copyright 2023-2024 Tyler Parret True
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @Authors
* Tyler Parret True <mysteryworldgod@outlook.com><https://github.com/OwlHowlinMornSky>
*/
#include "IHelper.h"
#include "Helper.h"

namespace {
Expand Down
Loading

0 comments on commit 7b965f1

Please sign in to comment.