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/.
|
|
|
|
|
|
|
|
#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>
|
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.
|
|
|
|
void Enable(bool flag, std::string host);
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
void ReportCompatibility(const char *compat, int graphics, int speed, int gameplay);
|
|
|
|
|
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);
|
2013-03-01 16:58:05 +00:00
|
|
|
}
|