2013-03-01 16:58:05 +00:00
|
|
|
// Copyright (c) 2012- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
2016-06-28 05:59:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
2013-03-01 16:58:05 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-03-15 17:38:46 +00:00
|
|
|
#include "Common/Log.h"
|
2013-09-01 19:57:39 +00:00
|
|
|
#include <string>
|
2018-06-03 21:47:49 +00:00
|
|
|
#include <vector>
|
2013-03-01 16:58:05 +00:00
|
|
|
|
2014-06-30 02:03:35 +00:00
|
|
|
#define DEBUG_LOG_REPORT(t,...) do { DEBUG_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } while (false)
|
|
|
|
#define ERROR_LOG_REPORT(t,...) do { ERROR_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } while (false)
|
|
|
|
#define WARN_LOG_REPORT(t,...) do { WARN_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } while (false)
|
|
|
|
#define NOTICE_LOG_REPORT(t,...) do { NOTICE_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } while (false)
|
|
|
|
#define INFO_LOG_REPORT(t,...) do { INFO_LOG(t, __VA_ARGS__); Reporting::ReportMessage(__VA_ARGS__); } while (false)
|
|
|
|
|
|
|
|
#define DEBUG_LOG_REPORT_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { DEBUG_LOG_REPORT(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define ERROR_LOG_REPORT_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { ERROR_LOG_REPORT(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define WARN_LOG_REPORT_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { WARN_LOG_REPORT(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define NOTICE_LOG_REPORT_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { NOTICE_LOG_REPORT(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define INFO_LOG_REPORT_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { INFO_LOG_REPORT(t, __VA_ARGS__); } } while (false)
|
|
|
|
|
|
|
|
#define ERROR_LOG_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { ERROR_LOG(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define WARN_LOG_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { WARN_LOG(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define NOTICE_LOG_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { NOTICE_LOG(t, __VA_ARGS__); } } while (false)
|
|
|
|
#define INFO_LOG_ONCE(n,t,...) do { if (Reporting::ShouldLogOnce(#n)) { INFO_LOG(t, __VA_ARGS__); } } while (false)
|
2013-07-30 16:15:48 +00:00
|
|
|
|
2014-02-17 18:43:23 +00:00
|
|
|
class PointerWrap;
|
2014-02-17 17:43:12 +00:00
|
|
|
|
2013-03-01 16:58:05 +00:00
|
|
|
namespace Reporting
|
|
|
|
{
|
2014-02-16 04:34:03 +00:00
|
|
|
// Should be called whenever a new game is loaded/shutdown to forget things.
|
2014-02-09 21:56:08 +00:00
|
|
|
void Init();
|
2014-02-16 04:34:03 +00:00
|
|
|
void Shutdown();
|
2014-02-09 21:56:08 +00:00
|
|
|
|
2014-02-17 17:43:12 +00:00
|
|
|
// Check savestate compatibility, mostly needed on load.
|
|
|
|
void DoState(PointerWrap &p);
|
|
|
|
|
2014-02-09 22:04:16 +00:00
|
|
|
// Should be called whenever the game configuration changes.
|
|
|
|
void UpdateConfig();
|
|
|
|
|
2013-09-01 19:57:39 +00:00
|
|
|
// Returns whether or not the reporting system is currently enabled.
|
2013-03-24 16:53:41 +00:00
|
|
|
bool IsEnabled();
|
2013-09-01 19:57:39 +00:00
|
|
|
|
|
|
|
// Returns whether the reporting system can be enabled (based on system or settings.)
|
|
|
|
bool IsSupported();
|
|
|
|
|
|
|
|
// Set the current enabled state of the reporting system and desired reporting server host.
|
2016-06-12 17:33:33 +00:00
|
|
|
// Returns if anything was changed.
|
|
|
|
bool Enable(bool flag, std::string host);
|
2013-09-01 19:57:39 +00:00
|
|
|
|
|
|
|
// Use the default reporting setting (per compiled settings) of host and enabled state.
|
|
|
|
void EnableDefault();
|
|
|
|
|
|
|
|
// Report a message string, using the format string as a key.
|
2013-03-01 16:58:05 +00:00
|
|
|
void ReportMessage(const char *message, ...);
|
2014-02-09 21:56:08 +00:00
|
|
|
|
2015-03-22 07:12:08 +00:00
|
|
|
// The same, but with a preformatted version (message is still the key.)
|
|
|
|
void ReportMessageFormatted(const char *message, const char *formatted);
|
|
|
|
|
2014-09-27 22:37:53 +00:00
|
|
|
// Report the compatibility of the current game / configuration.
|
2016-06-27 07:01:09 +00:00
|
|
|
void ReportCompatibility(const char *compat, int graphics, int speed, int gameplay, const std::string &screenshotFilename);
|
2014-09-27 22:37:53 +00:00
|
|
|
|
2018-06-03 21:47:49 +00:00
|
|
|
// Get the latest compatibility result. Only valid when GetStatus() is not BUSY.
|
|
|
|
std::vector<std::string> CompatibilitySuggestions();
|
|
|
|
|
2014-02-09 22:04:16 +00:00
|
|
|
// Returns true if that identifier has not been logged yet.
|
2014-02-09 21:56:08 +00:00
|
|
|
bool ShouldLogOnce(const char *identifier);
|
2016-06-26 06:11:07 +00:00
|
|
|
|
2017-12-13 22:11:40 +00:00
|
|
|
enum class ReportStatus {
|
2016-06-28 05:59:09 +00:00
|
|
|
WORKING,
|
|
|
|
BUSY,
|
|
|
|
FAILING,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Whether server requests appear to be working.
|
2017-12-13 22:11:40 +00:00
|
|
|
ReportStatus GetStatus();
|
2016-06-28 05:59:09 +00:00
|
|
|
|
2016-06-26 06:11:07 +00:00
|
|
|
// Return the currently active host (or blank if not active.)
|
|
|
|
std::string ServerHost();
|
|
|
|
|
|
|
|
// Return the current game id.
|
|
|
|
std::string CurrentGameID();
|
2017-12-13 22:11:40 +00:00
|
|
|
}
|