First round Rumble stubs

This commit is contained in:
Phillip Stephens 2016-02-20 22:34:42 -08:00
parent 764d75f38e
commit 7ec23b50ba
10 changed files with 149 additions and 1 deletions

View File

@ -72,6 +72,8 @@ public:
const CKeyboardMouseControllerData& data,
const CFinalInput& prevInput);
CFinalInput& operator|=(const CFinalInput& other);
bool operator==(const CFinalInput& other)
{ return memcmp(this, &other, sizeof(CFinalInput)) == 0; }
bool PStart() const {return x2e_b31_PStart;}
bool PR() const {return x2e_b26_PR;}

View File

@ -7,6 +7,12 @@ namespace pshag
void CInputGenerator::Update(float dt, CArchitectureQueue& queue)
{
if (m_firstFrame)
{
m_firstFrame = false;
return;
}
/* Keyboard/Mouse first */
CFinalInput kbInput = getFinalInput(0, dt);
bool kbUsed = false;

View File

@ -32,6 +32,8 @@ class CInputGenerator : public boo::DeviceFinder
m_lastUpdate = CFinalInput(idx, dt, m_data, m_lastUpdate);
return m_lastUpdate;
}
bool m_firstFrame = true;
public:
CInputGenerator(float leftDiv, float rightDiv)
: boo::DeviceFinder({typeid(boo::DolphinSmashAdapter)}),

View File

@ -3,4 +3,7 @@ add_library(RuntimeCommonInput
CKeyboardMouseController.hpp
ControlMapper.hpp ControlMapper.cpp
CInputGenerator.hpp CInputGenerator.cpp
CFinalInput.hpp CFinalInput.cpp)
CFinalInput.hpp CFinalInput.cpp
CRumbleManager.hpp CRumbleManager.cpp
CRumbleGenerator.hpp CRumbleGenerator.cpp
CRumbleVoice.hpp CRumbleVoice.cpp)

View File

@ -0,0 +1,8 @@
#include "CRumbleGenerator.hpp"
namespace pshag
{
CRumbleGenerator::CRumbleGenerator()
{
}
}

View File

@ -0,0 +1,17 @@
#ifndef CRUMBLEGENERATOR_HPP
#define CRUMBLEGENERATOR_HPP
#include "CRumbleVoice.hpp"
namespace pshag
{
class CRumbleGenerator
{
public:
CRumbleGenerator();
void Update(float);
void HardStopAll();
};
}
#endif // CRUMBLEGENERATOR_HPP

View File

@ -0,0 +1,8 @@
#include "CRumbleManager.hpp"
namespace pshag
{
void CRumbleManager::Update(float dt) { x0_rumbleGenerator.Update(dt); }
}

View File

@ -0,0 +1,21 @@
#ifndef __PSHAG_CRUMBLEMANAGER_HPP__
#define __PSHAG_CRUMBLEMANAGER_HPP__
#include "CRumbleGenerator.hpp"
namespace pshag
{
class CStateManager;
class CRumbleManager
{
CRumbleGenerator x0_rumbleGenerator;
public:
CRumbleManager() = default;
void Update(float);
void StopRumble(u16) {}
void Rumble(ERumbleFxId, CStateManager&, ERumblePriority priority);
void Rumble(ERumbleFxId, float, CStateManager&, ERumblePriority priority);
};
}
#endif // __PSHAG_CRUMBLEMANAGER_HPP__

View File

@ -0,0 +1,5 @@
#include "CRumbleVoice.hpp"
namespace pshag
{
}

View File

@ -0,0 +1,76 @@
#ifndef CRUMBLEVOICE_HPP
#define CRUMBLEVOICE_HPP
#include "RetroTypes.hpp"
namespace pshag
{
enum class ERumbleFxId
{
};
enum class ERumblePriority
{
None
};
struct SAdsrData;
class CRumbleVoice
{
public:
CRumbleVoice() {}
CRumbleVoice(const SAdsrData& data);
};
struct SAdsrData
{
float x0 = 0.f;
float x4 = 0.f;
float x8 = 0.f;
float xc = 0.f;
float x10 = 0.f;
float x14 = 0.f;
union
{
struct { bool x18_24 : 1; bool x18_25 : 1; };
u8 dummy = 0;
};
SAdsrData() = default;
SAdsrData(float a, float b, float c, float d, float e, float f, bool g, bool h)
: x0(a), x4(b), x8(c), xc(d), x10(e), x14(f)
{
x18_24 = g;
x18_25 = h;
}
};
struct SAdsrDelta
{
enum class EPhase
{
Stop,
Start,
};
float x0 = 0.f;
float x4 = 0.f;
float x8 = 0.f;
float xc = 0.f;
float x10 = 0.f;
ERumblePriority x1c_priority;
EPhase x20_phase;
SAdsrDelta(EPhase phase, ERumblePriority priority)
: x1c_priority(priority), x20_phase(phase)
{}
SAdsrDelta(EPhase phase)
: x1c_priority(ERumblePriority::None), x20_phase(phase)
{}
static SAdsrDelta Stopped() { return SAdsrDelta(EPhase::Stop); }
static SAdsrDelta Start(ERumblePriority priority) { return SAdsrDelta(EPhase::Start, priority); }
};
}
#endif // CRUMBLEVOICE_HPP