Work but not good

This commit is contained in:
sum2012 committed 2022-07-26 19:18:21 +08:00
1 parent e931176994
commit 64c2cf8082
2 files changed
+23 -3

No files matched your search

+20 -3
View File
@@ -44,6 +44,7 @@
#include "UI/MainScreen.h"
#include "UI/BackgroundAudio.h"
#include "Core/Reporting.h"
#include "UI/mmd5.h"
GameScreen::GameScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
g_BackgroundAudio.SetGame(gamePath);
@@ -77,6 +78,12 @@ void GameScreen::update() {
btnCalcCRC_->SetVisibility(UI::V_GONE);
}
}
if (MD5string == "...") {
tvCRC_->SetText(MD5string);
btnCalcMD5_->SetVisibility(UI::V_GONE);
}
}
void GameScreen::CreateViews() {
@@ -200,12 +207,13 @@ void GameScreen::CreateViews() {
if (fileTypeSupportCRC && !isHomebrew && !Reporting::HasCRC(gamePath_) ) {
btnCalcCRC_ = rightColumnItems->Add(new ChoiceWithValueDisplay(&CRC32string, ga->T("Calculate CRC"), (const char*)nullptr));
btnCalcCRC_->OnClick.Handle(this, &GameScreen::OnDoCRC32);
btnCalcMD5_ = rightColumnItems->Add(new ChoiceWithValueDisplay(&CRC32string, ga->T("Calculate MD5"), (const char*)nullptr));
btnCalcMD5_->OnClick.Handle(this, &GameScreen::OnDoCRC32);
} else {
btnCalcCRC_ = nullptr;
btnCalcMD5_ = nullptr;
//btnCalcMD5_ = nullptr;
}
btnCalcMD5_ = rightColumnItems->Add(new ChoiceWithValueDisplay(&MD5string, ga->T("Calculate MD5"), (const char*)nullptr));
btnCalcMD5_->OnClick.Handle(this, &GameScreen::OnDoMD5);
}
UI::Choice *GameScreen::AddOtherChoice(UI::Choice *choice) {
@@ -346,6 +354,15 @@ UI::EventReturn GameScreen::OnDoCRC32(UI::EventParams& e) {
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnDoMD5(UI::EventParams& e) {
MD5string = "...";
//Reporting::QueueCRC(gamePath_);
//MD5string = md5file(gamePath_);
auto chrs = gamePath_.c_str();
MD5string = md5file(chrs);
btnCalcMD5_->SetEnabled(false);
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnSwitchBack(UI::EventParams &e) {
TriggerFinish(DR_OK);
+3
View File
@@ -64,6 +64,7 @@ private:
UI::EventReturn OnCwCheat(UI::EventParams &e);
UI::EventReturn OnSetBackground(UI::EventParams &e);
UI::EventReturn OnDoCRC32(UI::EventParams& e);
UI::EventReturn OnDoMD5(UI::EventParams& e);
// As we load metadata in the background, we need to be able to update these after the fact.
UI::TextView *tvTitle_ = nullptr;
@@ -72,6 +73,7 @@ private:
UI::TextView *tvInstallDataSize_ = nullptr;
UI::TextView *tvRegion_ = nullptr;
UI::TextView *tvCRC_ = nullptr;
UI::TextView *tvmd5_ = nullptr;
UI::TextView *tvID_ = nullptr;
UI::Choice *btnGameSettings_ = nullptr;
@@ -86,4 +88,5 @@ private:
std::vector<UI::Choice *> otherChoices_;
std::vector<Path> saveDirs;
std::string CRC32string;
std::string MD5string;
};