Skip to content

Commit

Permalink
[feature] Add switch to configure whether to read memory
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyD666 committed Sep 17, 2024
1 parent cfc9e6a commit f54c511
Show file tree
Hide file tree
Showing 21 changed files with 278 additions and 280 deletions.
3 changes: 2 additions & 1 deletion EliteSpeedrunTool/AcknowledgementDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class AcknowledgementDialog : public QDialog {
"colourpen907",
"-oll006-",
"___Ady-sxr___",
"老司机",
};

QList<QString> sponsors = {
Expand All @@ -63,5 +62,7 @@ class AcknowledgementDialog : public QDialog {
"12",
"xiakeyi",
"超级无敌大王",
"老司机",
"Roffzei",
};
};
2 changes: 1 addition & 1 deletion EliteSpeedrunTool/AutoCapture.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"
#include <QObject>

// #define AutoCapture (AutoCapture::instance());
Expand Down
3 changes: 2 additions & 1 deletion EliteSpeedrunTool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ set(PROJECT_SOURCES
AcknowledgementDialog.h AcknowledgementDialog.cpp AcknowledgementDialog.ui
LogUtil.h LogUtil.cpp
LanguageUtil.h LanguageUtil.cpp
MemoryUtil.h MemoryUtil.cpp
memoryutil/MemoryUtil.h memoryutil/MemoryUtil.cpp
memoryutil/FakeMemoryUtil.h memoryutil/FakeMemoryUtil.cpp
HttpServerUtil.h HttpServerUtil.cpp
DisplayInfoSubFunction.h DisplayInfoSubFunction.cpp
DiscordUtil.h DiscordUtil.cpp
Expand Down
15 changes: 14 additions & 1 deletion EliteSpeedrunTool/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include "HttpServerUtil.h"
#include "LogUtil.h"
#include "LottieUtil.h"
#include "MemoryUtil.h"
#include "SettingDialog.h"
#include "UpdateDialog.h"
#include "dataobserver/AutoTimerUtil.h"
#include "dataobserver/DataObserver.h"
#include "memoryutil/MemoryUtil.h"
#include <MMSystem.h>
#include <QBoxLayout>
#include <QClipboard>
Expand Down Expand Up @@ -64,6 +64,8 @@ MainWindow::MainWindow(QWidget* parent)
labState->setPalette(palette);
ui.statusbar->addPermanentWidget(labState);

initTabEnabled();

initFirewall();

initTimerStateMachine();
Expand Down Expand Up @@ -103,6 +105,17 @@ void MainWindow::closeEvent(QCloseEvent* event)
}
}

void MainWindow::initTabEnabled()
{
ui.tabAutoTimer->setEnabled(MemoryUtil::enableReadMemory);
ui.tabMissionData->setEnabled(MemoryUtil::enableReadMemory);
ui.tabBadSport->setEnabled(MemoryUtil::enableReadMemory);
ui.tabWidget->setTabEnabled(ui.tabWidget->indexOf(ui.tabAutoTimer), MemoryUtil::enableReadMemory);
ui.tabWidget->setTabEnabled(ui.tabWidget->indexOf(ui.tabMissionData), MemoryUtil::enableReadMemory);
ui.tabWidget->setTabEnabled(ui.tabWidget->indexOf(ui.tabBadSport), MemoryUtil::enableReadMemory);
ui.tabWidget->setStyleSheet("QTabBar::tab::disabled {width: 0; height: 0; margin: 0; padding: 0; border: none;} ");
}

void MainWindow::initGlobalDataConnects()
{
connect(globalData, &GlobalData::minimizeToTrayChanged, this, [this]() {
Expand Down
2 changes: 2 additions & 0 deletions EliteSpeedrunTool/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class MainWindow : public QMainWindow {
protected:
void closeEvent(QCloseEvent* event) override;

void initTabEnabled();

void initGlobalDataConnects();

void checkUpdate();
Expand Down
21 changes: 18 additions & 3 deletions EliteSpeedrunTool/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
Expand All @@ -14,8 +17,11 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<property name="documentMode">
<bool>true</bool>
Expand Down Expand Up @@ -361,6 +367,9 @@
</layout>
</widget>
<widget class="QWidget" name="tabAutoTimer">
<property name="enabled">
<bool>false</bool>
</property>
<attribute name="title">
<string>自动计时</string>
</attribute>
Expand Down Expand Up @@ -457,7 +466,10 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tabMissionData">
<property name="enabled">
<bool>false</bool>
</property>
<attribute name="title">
<string>数据</string>
</attribute>
Expand Down Expand Up @@ -576,7 +588,10 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="tabBadSport">
<property name="enabled">
<bool>false</bool>
</property>
<attribute name="title">
<string>恶意值</string>
</attribute>
Expand Down
7 changes: 7 additions & 0 deletions EliteSpeedrunTool/SettingDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SettingDialog::SettingDialog(QWidget* parent)
}
connect(ui.lwPage, &QListWidget::currentRowChanged, ui.stackedWidget, &QStackedWidget::setCurrentIndex);

initTabEnabled();
initGeneralSettings();
initFirewallSettings();
initMissionDataSettings();
Expand Down Expand Up @@ -73,6 +74,12 @@ void SettingDialog::initGeneralSettings()
});
}

void SettingDialog::initTabEnabled()
{
ui.tabMissionData->setEnabled(MemoryUtil::enableReadMemory);
ui.groupBoxAutoTimer->setEnabled(MemoryUtil::enableReadMemory);
}

QString SettingDialog::getSoundFile(QString dir)
{
return QFileDialog::getOpenFileName(this, tr("选择文件"), dir, tr("WAV 文件 (*.wav)"));
Expand Down
2 changes: 2 additions & 0 deletions EliteSpeedrunTool/SettingDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class SettingDialog : public QDialog {
protected:
void initGeneralSettings();

void initTabEnabled();

QString getSoundFile(QString dir = QString());

int currentSubFunctionIndex = 0;
Expand Down
40 changes: 20 additions & 20 deletions EliteSpeedrunTool/SettingDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<enum>QFrame::Sunken</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>3</number>
</property>
<widget class="QWidget" name="pageGeneral">
<layout class="QVBoxLayout" name="verticalLayout_21">
Expand All @@ -72,8 +72,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>151</width>
<height>210</height>
<width>447</width>
<height>488</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
Expand Down Expand Up @@ -178,7 +178,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>270</width>
<width>429</width>
<height>478</height>
</rect>
</property>
Expand Down Expand Up @@ -519,8 +519,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>251</width>
<height>255</height>
<width>443</width>
<height>459</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
Expand Down Expand Up @@ -712,8 +712,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>204</width>
<height>723</height>
<width>433</width>
<height>588</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
Expand Down Expand Up @@ -986,7 +986,7 @@ C:\Program Files (x86)\nn\nn.exe</string>
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget_3">
<widget class="QTabWidget" name="tabMissionData">
<property name="currentIndex">
<number>1</number>
</property>
Expand Down Expand Up @@ -1017,8 +1017,8 @@ C:\Program Files (x86)\nn\nn.exe</string>
<rect>
<x>0</x>
<y>0</y>
<width>186</width>
<height>236</height>
<width>443</width>
<height>459</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
Expand Down Expand Up @@ -1413,7 +1413,7 @@ C:\Program Files (x86)\nn\nn.exe</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
<item>
<widget class="QGroupBox" name="groupBox_16">
<widget class="QGroupBox" name="groupBoxAutoTimer">
<property name="title">
<string>自动计时</string>
</property>
Expand Down Expand Up @@ -1660,8 +1660,8 @@ C:\Program Files (x86)\nn\nn.exe</string>
<rect>
<x>0</x>
<y>0</y>
<width>125</width>
<height>89</height>
<width>447</width>
<height>488</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
Expand Down Expand Up @@ -1735,8 +1735,8 @@ C:\Program Files (x86)\nn\nn.exe</string>
<rect>
<x>0</x>
<y>0</y>
<width>207</width>
<height>143</height>
<width>447</width>
<height>488</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down Expand Up @@ -1824,8 +1824,8 @@ C:\Program Files (x86)\nn\nn.exe</string>
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>84</height>
<width>447</width>
<height>488</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_19">
Expand Down Expand Up @@ -1885,8 +1885,8 @@ C:\Program Files (x86)\nn\nn.exe</string>
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>45</height>
<width>447</width>
<height>488</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_34">
Expand Down
2 changes: 1 addition & 1 deletion EliteSpeedrunTool/dataobserver/AutoTimerUtil.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "dataobserver/AutoTimerUtil.h"
#include "GlobalData.h"
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"
#include <QDateTime>

Q_GLOBAL_STATIC(AutoTimerUtil, autoTimerUtilInstance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "DisplayInfoSubFunction.h"
#include "GlobalData.h"
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"
#include <QDebug>
#include <QGraphicsDropShadowEffect>
#include <QLabel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "CasinoHeistEndStageStrategy.h"
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"

CasinoHeistEndStageStrategy::CasinoHeistEndStageStrategy(QObject* parent)
: BaseMissionStrategy { parent }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "CasinoHeistSilentSneakyStrategy.h"
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"

CasinoHeistSilentSneakyStrategy::CasinoHeistSilentSneakyStrategy(QObject* parent)
: BaseMissionStrategy { parent }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "CasinoHeistTheBigConStrategy.h"
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"

CasinoHeistTheBigConStrategy::CasinoHeistTheBigConStrategy(QObject* parent)
: BaseMissionStrategy { parent }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "ThePacificStandardStrategy.h"
#include "MemoryUtil.h"
#include "memoryutil/MemoryUtil.h"

ThePacificStandardStrategy::ThePacificStandardStrategy(QObject* parent)
: BaseMissionStrategy { parent }
Expand Down
Loading

0 comments on commit f54c511

Please sign in to comment.