Skip to content

Commit adc552b

Browse files
committed
Remove telemetry logic.
1 parent 0f5f097 commit adc552b

File tree

5 files changed

+19
-94
lines changed

5 files changed

+19
-94
lines changed

SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ GlobalSettings::GlobalSettings()
232232
)
233233
{
234234
PA_ADD_OPTION(CHECK_FOR_UPDATES);
235-
PA_ADD_OPTION(SEND_ERROR_REPORTS);
236235
PA_ADD_OPTION(STATS_FILE);
237236
PA_ADD_OPTION(ALL_STATS);
238237
PA_ADD_OPTION(WINDOW_SIZE);
@@ -272,6 +271,10 @@ GlobalSettings::GlobalSettings()
272271

273272
PA_ADD_OPTION(PROCESSOR_LEVEL0);
274273

274+
#ifdef PA_OFFICIAL
275+
PA_ADD_OPTION(SEND_ERROR_REPORTS);
276+
#endif
277+
275278
PA_ADD_OPTION(DEVELOPER_TOKEN);
276279

277280
GlobalSettings::value_changed(this);

SerialPrograms/Source/CommonFramework/Globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extern const bool IS_BETA_VERSION;
1717
extern const int PROGRAM_VERSION_MAJOR;
1818
extern const int PROGRAM_VERSION_MINOR;
1919
extern const int PROGRAM_VERSION_PATCH;
20+
extern const std::string PROGRAM_VERSION_BASE;
2021
extern const std::string PROGRAM_VERSION;
2122

2223
extern const std::string PROGRAM_NAME;

SerialPrograms/Source/CommonFramework/Notifications/ProgramNotifications.cpp

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#include "Integrations/SleepyDiscordRunner.h"
2020
#include "ProgramNotifications.h"
2121

22-
#ifdef PA_OFFICIAL
23-
#include "../Internal/SerialPrograms/TelemetryURLs.h"
24-
#endif
25-
2622
//#include <iostream>
2723
//using std::cout;
2824
//using std::endl;
@@ -405,99 +401,15 @@ void send_program_fatal_error_notification(
405401

406402

407403

404+
#ifndef PA_OFFICIAL
408405
void send_program_telemetry(
409406
Logger& logger, bool is_error, Color color,
410407
const ProgramInfo& info,
411408
const std::string& title,
412409
const std::vector<std::pair<std::string, std::string>>& messages,
413410
const std::string& file
414-
){
415-
#ifdef PA_OFFICIAL
416-
if (!GlobalSettings::instance().SEND_ERROR_REPORTS){
417-
return;
418-
}
419-
420-
// Rate limit the telemetry to 10/hour.
421-
static std::mutex lock;
422-
static std::set<WallClock> sends;
423-
{
424-
std::lock_guard<std::mutex> lg(lock);
425-
426-
WallClock now = current_time();
427-
WallClock threshold = now - std::chrono::minutes(1);
428-
while (!sends.empty()){
429-
auto iter = sends.begin();
430-
if (*iter > threshold){
431-
break;
432-
}
433-
sends.erase(iter);
434-
}
435-
if (sends.size() >= 10){
436-
logger.log("Error report suppressed due to rate limit.", COLOR_RED);
437-
return;
438-
}
439-
sends.insert(now);
440-
}
441-
442-
443-
bool hasFile = !file.empty();
444-
std::shared_ptr<PendingFileSend> pending = !hasFile
445-
? nullptr
446-
: std::shared_ptr<PendingFileSend>(new PendingFileSend(file, GlobalSettings::instance().SAVE_DEBUG_IMAGES));
447-
448-
JsonArray embeds;
449-
{
450-
JsonObject embed;
451-
embed["title"] = title;
452-
if (color){
453-
embed["color"] = (uint32_t)color & 0xffffff;
454-
}
455-
456-
JsonArray fields;
457-
{
458-
JsonObject field;
459-
field["name"] = PreloadSettings::instance().DEVELOPER_MODE
460-
? PROGRAM_NAME + " (" + PROGRAM_VERSION + "-dev)"
461-
: PROGRAM_NAME + " (" + PROGRAM_VERSION + ")";
462-
field["value"] = info.program_name.empty() ? "(unknown)" : info.program_name;
463-
fields.push_back(std::move(field));
464-
}
465-
for (const auto& item : messages){
466-
JsonObject field;
467-
field["name"] = item.first;
468-
field["value"] = item.second;
469-
if (!item.first.empty() && !item.second.empty()){
470-
fields.push_back(std::move(field));
471-
}
472-
}
473-
embed["fields"] = std::move(fields);
474-
475-
if (hasFile){
476-
JsonObject image;
477-
image["url"] = "attachment://" + pending->filename();
478-
embed["image"] = std::move(image);
479-
}
480-
embeds.push_back(std::move(embed));
481-
}
482-
483-
JsonObject jsonContent;
484-
// jsonContent["content"] = "asdf";
485-
jsonContent["embeds"] = std::move(embeds);
486-
487-
std::string url = is_error
488-
? flip(ERROR_REPORTING_URL, sizeof(ERROR_REPORTING_URL))
489-
: flip(TELEMETRY_URL, sizeof(TELEMETRY_URL));
490-
491-
using namespace Integration::DiscordWebhook;
492-
493-
DiscordWebhookSender& sender = DiscordWebhookSender::instance();
494-
if (hasFile){
495-
sender.send_json(logger, QString::fromStdString(url), std::chrono::milliseconds(0), jsonContent, pending);
496-
}else{
497-
sender.send_json(logger, QString::fromStdString(url), std::chrono::milliseconds(0), jsonContent, nullptr);
498-
}
411+
){}
499412
#endif
500-
}
501413

502414

503415

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
#endif
150150

151151
//#include <opencv2/core.hpp>
152+
#include <random>
152153

153154

154155
#include <iostream>
@@ -243,7 +244,14 @@ void TestProgramComputer::program(ProgramEnvironment& env, CancellableScope& sco
243244
using namespace NintendoSwitch::PokemonSwSh::MaxLairInternal;
244245

245246

247+
std::random_device rndsource;
248+
std::minstd_rand rndgen(rndsource());
249+
std::uniform_real_distribution<double> dist(0, 1.0);
246250

251+
cout << dist(rndgen) << endl;
252+
cout << dist(rndgen) << endl;
253+
cout << dist(rndgen) << endl;
254+
cout << dist(rndgen) << endl;
247255

248256
#if 0
249257
PokemonSV::DateSeed data = PokemonSV::ItemPrinter::calculate_seed_prizes(2346161588);

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,13 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
275275

276276
// SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
277277

278-
// VideoSnapshot image = feed.snapshot();
279-
ImageRGB32 image("screenshot-20241124-135028529403.png");
278+
VideoSnapshot image = feed.snapshot();
279+
// ImageRGB32 image("screenshot-20241124-135028529403.png");
280280

281281
DateReader date_reader;
282282
date_reader.make_overlays(overlays);
283-
auto date = date_reader.read_date(logger, std::make_shared<ImageRGB32>(std::move(image)));
283+
auto date = date_reader.read_date(logger, image);
284+
// auto date = date_reader.read_date(logger, std::make_shared<ImageRGB32>(std::move(image)));
284285
cout << "year = " << (int)date.second.year << endl;
285286
cout << "month = " << (int)date.second.month << endl;
286287
cout << "day = " << (int)date.second.day << endl;

0 commit comments

Comments
 (0)