JD2022-TU1/main/extern/bloomberg/inc/bloomberg_interface.h

90 lines
4.3 KiB
C++

#pragma once
#ifndef _BLOOMBERG_INTERFACE_H_
#define _BLOOMBERG_INTERFACE_H_
#include "crash/crashhandler.h"
#include "crash/threadscallstack.h"
#include "components/settings.h"
// These are not mandatory for the behavior of the interface. They are only there to provide easy access
// to the possible class a client want to interfere with. We could add more (dialog.h), but these include
// represent the common Bloomberg usage.
#include "report/reportcrash.h"
#include "report/reportflag.h"
#include "report/reportstats.h"
#include "report/gamestats.h"
#include "report/gamestate.h"
#include "report/filedata.h"
#include "report/data.h"
#include "components/tools.h"
namespace Bloomberg
{
class SoftwareDialogBuilder;
// Configuring Bloomberg
// Mandatory:
// 1. Configure Bloomberg (configuration.h)
// 2. Set the memory interface (memory.h)
// 3. Implement a BasicInterface (bloomberg_interface.h)
// Optional:
// 4. Redefine or Add your default Bloomberg Report
// 5. Define some Data for additional and custom extra report information (reportcontextinformation.h)
// 6. Set a new ShowDialog method (handle by your engine) (dialog.h)
class BloombergInterface
{
public:
virtual ~BloombergInterface() {}
// Mandatory:
// Return information for Bloomberg to display in his reports.
// See the class definition for information about the field.
virtual void GetGameSettings(Settings::GameSettings& settings) = 0;
virtual void GetBloombergSettings(Settings::BloombergSettings& settings) = 0;
// Optional, Used to detect deadlock. Only used if you use RuntimeVar::m_enableDeadLockDetection
virtual U64 GetFrameId();
// The default method use the RuntimeVar::m_bloombergThreadSleepTimeMs (see runtimevar.cpp) (must be > 0)
virtual U32 GetSleepTimeMs();
// Optional:
// Configure report just before processing it (show dialog + send over network). This will be call
// before we construct the xml file and show dialog that require you to take action. This a good place
// if you want to modify any parameter of the report. Typically this is used to ignore
// some specific assert or error by putting a silent mode to on for this report.
// Return value: True = send the report. False = don't send it.
virtual Bool PreProcess(ReportInterface& /*report*/) { return True; }
// Call after a report has been sent.
// !This is the only place where another manual triggering of a report is permitted within a report.
// See reporter.h Trigger doc for details.
virtual void PostProcess(ReportInterface& /*report*/) { }
// Called after the connection to use was selected (reporter, launcher, proxy and server).
// If connection is null, it means none of the connection was successfuly established. Bloomberg will
// ignore the report, but you can take action and show an error message. If log/trace are enable
// this issue will be logged. This method is called at Bloomberg initialization and before
// sending a report.
virtual Bool ConnectionVerification(const ConnectionManager::Connection* /*connection*/, ReportInterface* /*report*/ = 0) { return True; }
// Called whenever Bloomberg detect a deadlock.
// Return True if you want Bloomberg to consider this event and analyze it.
virtual Bool DeadLockDetected();
// X360 only if you need the thread ownership when using the in game dialog provided by Bloomberg
virtual Bool AcquireThreadOwnership() { return True; }
virtual void ReleaseThreadOwnership() {}
// Return a new SoftwareDialogBuidler to construct the software dialog
virtual SoftwareDialogBuilder* GetSoftwareDialogBuilder();
virtual void ReleaseSoftwareDialogBuilder(SoftwareDialogBuilder* softwareDialogBuilder);
virtual DialogDefinitions::GraphicInfo GetGraphicInfo() { return DialogDefinitions::GraphicInfo(); }
virtual int GetInputHandle() { return 0; }
// Called when the Bloomberg thread initialize/shutdown (used when adding statistic for thread, TLS, etc).
virtual void ThreadInit() {}
virtual void ThreadShutdown() {}
};
}
#endif // _BLOOMBERG_INTERFACE_H_