Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dallongo committed May 9, 2016
1 parent 8fd9fde commit a50e274
Show file tree
Hide file tree
Showing 9 changed files with 1,510 additions and 0 deletions.
370 changes: 370 additions & 0 deletions Include/InternalsPlugin.hpp

Large diffs are not rendered by default.

133 changes: 133 additions & 0 deletions Include/RFPluginObjects.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
//Ý Þ
//Ý Module: Header file for plugin object types Þ
//Ý Þ
//Ý Description: interface declarations for plugin objects Þ
//Ý Þ
//Ý This source code module, and all information, data, and algorithms Þ
//Ý associated with it, are part of isiMotor Technology (tm). Þ
//Ý PROPRIETARY AND CONFIDENTIAL Þ
//Ý Copyright (c) 1996-2007 Image Space Incorporated. All rights reserved. Þ
//Ý Þ
//Ý Change history: Þ
//Ý kc.2004.0?.??: created Þ
//Ý mm.2004.05.25: added this description header Þ
//Ý mm.2004.05.20: splitting this file up so that each type of plugin Þ
//Ý gets its own header file. Þ
//Ý Þ
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
#ifndef _PLUGINOBJECT
#define _PLUGINOBJECT

#include <windows.h>


// forward referencing stuff
class PluginObjectInfo;


//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ typedefs for dll functions - easier to use a typedef than to type
//³ out the crazy syntax for declaring and casting function pointers
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
typedef const char* (__cdecl *GETPLUGINNAME)();
typedef unsigned (__cdecl *GETPLUGINVERSION)();
typedef unsigned (__cdecl *GETPLUGINOBJECTCOUNT)();
typedef PluginObjectInfo* (__cdecl *GETPLUGINOBJECTINFO)(const unsigned uIndex);
typedef PluginObjectInfo* (__cdecl *GETPLUGINOBJECTINFO)(const unsigned uIndex);
typedef float (__cdecl *GETPLUGINSYSTEMVERSION) ();


//plugin object types
enum PluginObjectType
{
PO_VIDEO_EXPORT = 0x00000001,
PO_RFMODIFIER = 0x00000002,
PO_HWPLUGIN = 0x00000003,
PO_GAMESTATS = 0x00000004,
PO_NCPLUGIN = 0x00000005,
PO_MOTION = 0x00000006,
PO_IRCPLUGIN = 0x00000007,
PO_IVIBE = 0x00000008,
PO_INTERNALS = 0x00000009,
};


//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ Plugin Object Property
//³ - can be used to expose pluginobject settings to rFactor.
//³ In practice this feature has gone almost entirely unused
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
enum POPType
{
POPTYPE_INT,
POPTYPE_FLOAT,
POPTYPE_STRING,
};

static char POPTypeNames[3][64] =
{
"POPTYPE_INT",
"POPTYPE_FLOAT",
"POPTYPE_STRING",
};

const unsigned POP_MAXNAME = 32;
const unsigned POP_MAXDESC = 256;

struct PluginObjectProperty
{
union
{
int iValue;
float fValue;
char* szValue;
};

POPType uPropertyType;
char szName[POP_MAXNAME];
char szDesc[POP_MAXDESC];
};

//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ PluginObject
//³ - interface used by plugin classes.
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
class PluginObject
{
public:
PluginObject() {}
virtual ~PluginObject(){};
virtual void Destroy()=0;
virtual class PluginObjectInfo* GetInfo()=0;

virtual unsigned GetPropertyCount() const =0;
virtual PluginObjectProperty* GetProperty(const unsigned uIndex) =0;
virtual PluginObjectProperty* GetProperty(const char* szName) =0;
};

//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ PluginObjectInfo
//³ - interface used by plugin info classes.
//³ the purpose of the plugin info classes is to allow the game to get
//³ information about and instantiate the plugin objects contained in
//³ a dll without needing to know anything about the PO in advance
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
class PluginObjectInfo
{
public:
virtual ~PluginObjectInfo() {};
virtual const char* GetName() const = 0;
virtual const char* GetFullName() const = 0;
virtual const char* GetDesc() const = 0;
virtual const unsigned GetType() const = 0;
virtual const char* GetSubType() const = 0;
virtual const unsigned GetVersion() const = 0;
virtual void* Create() const = 0;
};





#endif
113 changes: 113 additions & 0 deletions Include/rFactorSharedMemoryMap.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
rfSharedMemoryMap.hpp
by Dan Allongo (daniel.s.allongo@gmail.com)
This remains largely unchanged from Example.hpp, except for a few additional
private variables to track the current state of the memory map handle and buffer.
*/

#pragma once

#include "InternalsPlugin.hpp"
#include "rfSharedStruct.hpp"
#include <Windows.h>

#define PLUGIN_NAME "rFactorSharedMemoryMap"

// This is used for app to find out information about the plugin
class InternalsPluginInfo : public PluginObjectInfo
{
public:

// Constructor/destructor
InternalsPluginInfo();
~InternalsPluginInfo() {}

// Derived from base class PluginObjectInfo
virtual const char* GetName() const;
virtual const char* GetFullName() const;
virtual const char* GetDesc() const;
virtual const unsigned GetType() const;
virtual const char* GetSubType() const;
virtual const unsigned GetVersion() const;
virtual void* Create() const;

private:

char m_szFullName[128];
};


// This is used for the app to use the plugin for its intended purpose
class SharedMemoryMapPlugin : public InternalsPluginV3
{
protected:

const static char m_szName[];
const static char m_szSubType[];
const static unsigned m_uID;
const static unsigned m_uVersion;

public:

// Constructor/destructor
SharedMemoryMapPlugin() {}
~SharedMemoryMapPlugin() {}

// Called from class InternalsPluginInfo to return specific information about plugin
static const char * GetName() { return m_szName; }
static const unsigned GetType() { return PO_INTERNALS; }
static const char * GetSubType() { return m_szSubType; }
static const unsigned GetVersion() { return m_uVersion; }

// Derived from base class PluginObject
void Destroy() { Shutdown(); } // poorly named ... doesn't destroy anything
PluginObjectInfo * GetInfo();
unsigned GetPropertyCount() const { return 0; }
PluginObjectProperty *GetProperty( const char * ) { return 0; }
PluginObjectProperty *GetProperty( const unsigned ) { return 0; }

// These are the functions derived from base class InternalsPlugin
// that can be implemented.
void Startup(); // game startup
void Shutdown(); // game shutdown

void EnterRealtime() {} // entering realtime
void ExitRealtime() {} // exiting realtime

void StartSession() {} // session has started
void EndSession() {} // session has ended

// GAME OUTPUT
bool WantsTelemetryUpdates() { return( true ); } // CHANGE TO TRUE TO ENABLE TELEMETRY EXAMPLE!
void UpdateTelemetry( const TelemInfoV2 &info );

bool WantsGraphicsUpdates() { return( false ); } // CHANGE TO TRUE TO ENABLE GRAPHICS EXAMPLE!
void UpdateGraphics( const GraphicsInfoV2 &info ) {}

// GAME INPUT
bool HasHardwareInputs() { return( false ); } // CHANGE TO TRUE TO ENABLE HARDWARE EXAMPLE!
void UpdateHardware( const float fDT ) {} // update the hardware with the time between frames
void EnableHardware() {} // message from game to enable hardware
void DisableHardware() {} // message from game to disable hardware

// See if the plugin wants to take over a hardware control. If the plugin takes over the
// control, this method returns true and sets the value of the float pointed to by the
// second arg. Otherwise, it returns false and leaves the float unmodified.
bool CheckHWControl( const char * const controlName, float &fRetVal ) { return( false ); }

bool ForceFeedback( float &forceValue ) { return( false ); } // SEE FUNCTION BODY TO ENABLE FORCE EXAMPLE

// SCORING OUTPUT
bool WantsScoringUpdates() { return( true ); } // CHANGE TO TRUE TO ENABLE SCORING EXAMPLE!
void UpdateScoring( const ScoringInfoV2 &info );

// COMMENTARY INPUT
bool RequestCommentary( CommentaryRequestInfo &info ) { return( false ); } // SEE FUNCTION BODY TO ENABLE COMMENTARY EXAMPLE

private:

HANDLE hMap;
rfShared* pBuf;
bool mapped;
};
Loading

0 comments on commit a50e274

Please sign in to comment.