chore: add .clang_format for consistent code formatting
This commit is contained in:
1 parent
67332bbc79
commit
6e6440f0f3
25 files changed
+3956
-3996
No files matched your search
@@ -0,0 +1,13 @@
|
|||||||
|
# Format Style Options - Created with Clang Power Tools
|
||||||
|
---
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignConsecutiveMacros: true
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
ColumnLimit: 150
|
||||||
|
EmptyLineBeforeAccessModifier: Never
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentWidth: 4
|
||||||
|
NamespaceIndentation: All
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
@@ -1,153 +1,153 @@
|
|||||||
#include "4J_Input.h"
|
#include "4J_Input.h"
|
||||||
#include "INP_Main.h"
|
|
||||||
#include "INP_Keyboard.h"
|
#include "INP_Keyboard.h"
|
||||||
|
#include "INP_Main.h"
|
||||||
|
|
||||||
C_4JInput InputManager;
|
C_4JInput InputManager;
|
||||||
CKeyboard InternalKeyboard;
|
CKeyboard InternalKeyboard;
|
||||||
|
|
||||||
void C_4JInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
|
void C_4JInput::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
|
||||||
{
|
{
|
||||||
InternalInputManager.Initialise(iInputStateC, ucMapC, ucActionC, ucMenuActionC);
|
InternalInputManager.Initialise(iInputStateC, ucMapC, ucActionC, ucMenuActionC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::Tick(void)
|
void C_4JInput::Tick(void)
|
||||||
{
|
{
|
||||||
InternalInputManager.Tick();
|
InternalInputManager.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax)
|
void C_4JInput::SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetDeadzoneAndMovementRange(uiDeadzone, uiMovementRangeMax);
|
InternalInputManager.SetDeadzoneAndMovementRange(uiDeadzone, uiMovementRangeMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal)
|
void C_4JInput::SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetGameJoypadMaps(ucMap, ucAction, uiActionVal);
|
InternalInputManager.SetGameJoypadMaps(ucMap, ucAction, uiActionVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int C_4JInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction)
|
unsigned int C_4JInput::GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetGameJoypadMaps(ucMap, ucAction);
|
return InternalInputManager.GetGameJoypadMaps(ucMap, ucAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
|
void C_4JInput::SetJoypadMapVal(int iPad, unsigned char ucMap)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetJoypadMapVal(iPad, ucMap);
|
InternalInputManager.SetJoypadMapVal(iPad, ucMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char C_4JInput::GetJoypadMapVal(int iPad)
|
unsigned char C_4JInput::GetJoypadMapVal(int iPad)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadMapVal(iPad);
|
return InternalInputManager.GetJoypadMapVal(iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetJoypadSensitivity(int iPad, float fSensitivity)
|
void C_4JInput::SetJoypadSensitivity(int iPad, float fSensitivity)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetJoypadSensitivity(iPad, fSensitivity);
|
InternalInputManager.SetJoypadSensitivity(iPad, fSensitivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int C_4JInput::GetValue(int iPad, unsigned char ucAction, bool bRepeat)
|
unsigned int C_4JInput::GetValue(int iPad, unsigned char ucAction, bool bRepeat)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetValue(iPad, ucAction, bRepeat);
|
return InternalInputManager.GetValue(iPad, ucAction, bRepeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_4JInput::ButtonPressed(int iPad, unsigned char ucAction)
|
bool C_4JInput::ButtonPressed(int iPad, unsigned char ucAction)
|
||||||
{
|
{
|
||||||
return InternalInputManager.ButtonPressed(iPad, ucAction);
|
return InternalInputManager.ButtonPressed(iPad, ucAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_4JInput::ButtonReleased(int iPad, unsigned char ucAction)
|
bool C_4JInput::ButtonReleased(int iPad, unsigned char ucAction)
|
||||||
{
|
{
|
||||||
return InternalInputManager.ButtonReleased(iPad, ucAction);
|
return InternalInputManager.ButtonReleased(iPad, ucAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_4JInput::ButtonDown(int iPad, unsigned char ucAction)
|
bool C_4JInput::ButtonDown(int iPad, unsigned char ucAction)
|
||||||
{
|
{
|
||||||
return InternalInputManager.ButtonDown(iPad, ucAction);
|
return InternalInputManager.ButtonDown(iPad, ucAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
|
void C_4JInput::SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetJoypadStickAxisMap(iPad, uiFrom, uiTo);
|
InternalInputManager.SetJoypadStickAxisMap(iPad, uiFrom, uiTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
|
void C_4JInput::SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetJoypadStickTriggerMap(iPad, uiFrom, uiTo);
|
InternalInputManager.SetJoypadStickTriggerMap(iPad, uiFrom, uiTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs)
|
void C_4JInput::SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetKeyRepeatRate(fRepeatDelaySecs, fRepeatRateSecs);
|
InternalInputManager.SetKeyRepeatRate(fRepeatDelaySecs, fRepeatRateSecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetDebugSequence(const char* chSequenceA, int(*Func)(LPVOID), LPVOID lpParam)
|
void C_4JInput::SetDebugSequence(const char *chSequenceA, int (*Func)(LPVOID), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetDebugSequence(chSequenceA, Func, lpParam);
|
InternalInputManager.SetDebugSequence(chSequenceA, Func, lpParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
FLOAT C_4JInput::GetIdleSeconds(int iPad)
|
FLOAT C_4JInput::GetIdleSeconds(int iPad)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetIdleSeconds(iPad);
|
return InternalInputManager.GetIdleSeconds(iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_4JInput::IsPadConnected(int iPad)
|
bool C_4JInput::IsPadConnected(int iPad)
|
||||||
{
|
{
|
||||||
return InternalInputManager.IsPadConnected(iPad);
|
return InternalInputManager.IsPadConnected(iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
float C_4JInput::GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay)
|
float C_4JInput::GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadStick_LX(iPad, bCheckMenuDisplay);
|
return InternalInputManager.GetJoypadStick_LX(iPad, bCheckMenuDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
float C_4JInput::GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay)
|
float C_4JInput::GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadStick_LY(iPad, bCheckMenuDisplay);
|
return InternalInputManager.GetJoypadStick_LY(iPad, bCheckMenuDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
float C_4JInput::GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay)
|
float C_4JInput::GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadStick_RX(iPad, bCheckMenuDisplay);
|
return InternalInputManager.GetJoypadStick_RX(iPad, bCheckMenuDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
float C_4JInput::GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay)
|
float C_4JInput::GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadStick_RY(iPad, bCheckMenuDisplay);
|
return InternalInputManager.GetJoypadStick_RY(iPad, bCheckMenuDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char C_4JInput::GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay)
|
unsigned char C_4JInput::GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadLTrigger(iPad, bCheckMenuDisplay);
|
return InternalInputManager.GetJoypadLTrigger(iPad, bCheckMenuDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char C_4JInput::GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay)
|
unsigned char C_4JInput::GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay)
|
||||||
{
|
{
|
||||||
return InternalInputManager.GetJoypadRTrigger(iPad, bCheckMenuDisplay);
|
return InternalInputManager.GetJoypadRTrigger(iPad, bCheckMenuDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::SetMenuDisplayed(int iPad, bool bVal)
|
void C_4JInput::SetMenuDisplayed(int iPad, bool bVal)
|
||||||
{
|
{
|
||||||
InternalInputManager.SetMenuDisplayed(iPad, bVal);
|
InternalInputManager.SetMenuDisplayed(iPad, bVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode)
|
EKeyboardResult C_4JInput::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||||
|
C_4JInput::EKeyboardMode eMode)
|
||||||
{
|
{
|
||||||
return InternalKeyboard.RequestKeyboard(Title, Text, dwPad, uiMaxChars, Func, lpParam, eMode);
|
return InternalKeyboard.RequestKeyboard(Title, Text, dwPad, uiMaxChars, Func, lpParam, eMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::GetText(uint16_t* UTF16String)
|
void C_4JInput::GetText(uint16_t *UTF16String)
|
||||||
{
|
{
|
||||||
InternalKeyboard.GetText(UTF16String);
|
InternalKeyboard.GetText(UTF16String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool C_4JInput::VerifyStrings(WCHAR **pwStringA, int iStringC, int (*Func)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID lpParam)
|
||||||
bool C_4JInput::VerifyStrings(WCHAR** pwStringA, int iStringC, int(*Func)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID lpParam)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_4JInput::CancelQueuedVerifyStrings(int(*Func)(LPVOID, STRING_VERIFY_RESPONSE*), LPVOID lpParam) {}
|
void C_4JInput::CancelQueuedVerifyStrings(int (*Func)(LPVOID, STRING_VERIFY_RESPONSE *), LPVOID lpParam) {}
|
||||||
|
|
||||||
void C_4JInput::CancelAllVerifyInProgress(void) {}
|
void C_4JInput::CancelAllVerifyInProgress(void) {}
|
||||||
|
|
||||||
//bool C_4JInput::InputDetected(DWORD dwUserIndex,WCHAR *pwchInput) {}
|
// bool C_4JInput::InputDetected(DWORD dwUserIndex,WCHAR *pwchInput) {}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
void CForceFeedback::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
|
void CForceFeedback::Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC)
|
||||||
{
|
{
|
||||||
m_Effects = new FF_EFFECT[MAX_EFFECTS];
|
m_Effects = new FF_EFFECT[MAX_EFFECTS];
|
||||||
m_EffectC = 0;
|
m_EffectC = 0;
|
||||||
|
|
||||||
LARGE_INTEGER qwTicksPerSec;
|
LARGE_INTEGER qwTicksPerSec;
|
||||||
@@ -12,16 +12,13 @@ void CForceFeedback::Initialise(int iInputStateC, unsigned char ucMapC, unsigned
|
|||||||
m_unkBool = 0;
|
m_unkBool = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForceFeedback::RumbleEnable(int iQuadrant, bool bRumbleEnabled)
|
void CForceFeedback::RumbleEnable(int iQuadrant, bool bRumbleEnabled) {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CForceFeedback::CreateEffect(void)
|
void CForceFeedback::CreateEffect(void)
|
||||||
{
|
{
|
||||||
assert(m_EffectC<MAX_EFFECTS);
|
assert(m_EffectC < MAX_EFFECTS);
|
||||||
|
|
||||||
FF_EFFECT* pEffect = &m_Effects[m_EffectC];
|
FF_EFFECT *pEffect = &m_Effects[m_EffectC];
|
||||||
pEffect->m_uiDurationMs = 5;
|
pEffect->m_uiDurationMs = 5;
|
||||||
pEffect->m_uiMagnitude = 500;
|
pEffect->m_uiMagnitude = 500;
|
||||||
pEffect->m_uiEffectType = 0;
|
pEffect->m_uiEffectType = 0;
|
||||||
@@ -33,18 +30,18 @@ void CForceFeedback::CreateEffect(void)
|
|||||||
|
|
||||||
void CForceFeedback::AddEffectInstance(unsigned int uiEffect)
|
void CForceFeedback::AddEffectInstance(unsigned int uiEffect)
|
||||||
{
|
{
|
||||||
FF_EFFECT_INSTANCE* pEffectInst = new FF_EFFECT_INSTANCE();
|
FF_EFFECT_INSTANCE *pEffectInst = new FF_EFFECT_INSTANCE();
|
||||||
pEffectInst->m_Effect = &m_Effects[uiEffect];
|
pEffectInst->m_Effect = &m_Effects[uiEffect];
|
||||||
pEffectInst->m_uiInst = 0;
|
pEffectInst->m_uiInst = 0;
|
||||||
|
|
||||||
m_EffectList.AddToTail(pEffectInst);
|
m_EffectList.AddToTail(pEffectInst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForceFeedback::SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState)
|
void CForceFeedback::SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState)
|
||||||
{
|
{
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
LinkedList::_LL_NODE* pNode;
|
LinkedList::_LL_NODE *pNode;
|
||||||
for (pNode = m_EffectList.m_Head; ; pNode = pNode->m_Next)
|
for (pNode = m_EffectList.m_Head;; pNode = pNode->m_Next)
|
||||||
{
|
{
|
||||||
if ((iCount++) == uiEffectInstance)
|
if ((iCount++) == uiEffectInstance)
|
||||||
break;
|
break;
|
||||||
@@ -52,34 +49,28 @@ void CForceFeedback::SetEffectInstanceState(unsigned int uiEffectInstance, unsig
|
|||||||
pNode->GetDataAs<FF_EFFECT_INSTANCE>()->m_bIsActive = true;
|
pNode->GetDataAs<FF_EFFECT_INSTANCE>()->m_bIsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForceFeedback::ProcessEventInstance(FF_EFFECT_INSTANCE* pEffectInst)
|
void CForceFeedback::ProcessEventInstance(FF_EFFECT_INSTANCE *pEffectInst) {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
void CForceFeedback::PauseEventInstance(FF_EFFECT_INSTANCE *pEffectInst) {}
|
||||||
|
|
||||||
void CForceFeedback::PauseEventInstance(FF_EFFECT_INSTANCE* pEffectInst)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CForceFeedback::AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds)
|
void CForceFeedback::AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds)
|
||||||
{
|
{
|
||||||
RUMBLE_EFFECT* pRumble = new RUMBLE_EFFECT();
|
RUMBLE_EFFECT *pRumble = new RUMBLE_EFFECT();
|
||||||
|
|
||||||
LARGE_INTEGER qwCurrentTime;
|
LARGE_INTEGER qwCurrentTime;
|
||||||
QueryPerformanceCounter(&qwCurrentTime);
|
QueryPerformanceCounter(&qwCurrentTime);
|
||||||
|
|
||||||
pRumble->m_TimeLeft = (m_TicksPerSecond * fSeconds) + qwCurrentTime.QuadPart;
|
pRumble->m_TimeLeft = (m_TicksPerSecond * fSeconds) + qwCurrentTime.QuadPart;
|
||||||
pRumble->m_RumbleData.wLeftMotorSpeed = leftMotorSpeed;
|
pRumble->m_RumbleData.wLeftMotorSpeed = leftMotorSpeed;
|
||||||
pRumble->m_RumbleData.wRightMotorSpeed = rightMotorSpeed;
|
pRumble->m_RumbleData.wRightMotorSpeed = rightMotorSpeed;
|
||||||
pRumble->m_Pad = uiPad;
|
pRumble->m_Pad = uiPad;
|
||||||
|
|
||||||
m_RumbleList.AddToTail(pRumble);
|
m_RumbleList.AddToTail(pRumble);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForceFeedback::Tick(void)
|
void CForceFeedback::Tick(void)
|
||||||
{
|
{
|
||||||
for (LinkedList::_LL_NODE* pEffectNode = m_EffectList.m_Head; pEffectNode; pEffectNode = pEffectNode->m_Next)
|
for (LinkedList::_LL_NODE *pEffectNode = m_EffectList.m_Head; pEffectNode; pEffectNode = pEffectNode->m_Next)
|
||||||
{
|
{
|
||||||
if (pEffectNode->GetDataAs<FF_EFFECT_INSTANCE>()->m_bIsActive)
|
if (pEffectNode->GetDataAs<FF_EFFECT_INSTANCE>()->m_bIsActive)
|
||||||
{
|
{
|
||||||
@@ -90,21 +81,21 @@ void CForceFeedback::Tick(void)
|
|||||||
LARGE_INTEGER qwCurrentTime;
|
LARGE_INTEGER qwCurrentTime;
|
||||||
QueryPerformanceCounter(&qwCurrentTime);
|
QueryPerformanceCounter(&qwCurrentTime);
|
||||||
|
|
||||||
LinkedList::_LL_NODE* pRumbleNode = m_RumbleList.m_Head;
|
LinkedList::_LL_NODE *pRumbleNode = m_RumbleList.m_Head;
|
||||||
while (pRumbleNode)
|
while (pRumbleNode)
|
||||||
{
|
{
|
||||||
if (pRumbleNode->GetDataAs<RUMBLE_EFFECT>()->m_TimeLeft <= qwCurrentTime.QuadPart)
|
if (pRumbleNode->GetDataAs<RUMBLE_EFFECT>()->m_TimeLeft <= qwCurrentTime.QuadPart)
|
||||||
{
|
{
|
||||||
RUMBLE_EFFECT* pRumble = pRumbleNode->GetDataAs<RUMBLE_EFFECT>();
|
RUMBLE_EFFECT *pRumble = pRumbleNode->GetDataAs<RUMBLE_EFFECT>();
|
||||||
|
|
||||||
pRumble->m_RumbleData.wLeftMotorSpeed = 0;
|
pRumble->m_RumbleData.wLeftMotorSpeed = 0;
|
||||||
pRumble->m_RumbleData.wRightMotorSpeed = 0;
|
pRumble->m_RumbleData.wRightMotorSpeed = 0;
|
||||||
|
|
||||||
XInputSetState(pRumble->m_Pad, &pRumble->m_RumbleData);
|
XInputSetState(pRumble->m_Pad, &pRumble->m_RumbleData);
|
||||||
|
|
||||||
m_RumbleList.RemoveNode(pRumbleNode);
|
m_RumbleList.RemoveNode(pRumbleNode);
|
||||||
|
|
||||||
LinkedList::_LL_NODE* pTemp = pRumbleNode;
|
LinkedList::_LL_NODE *pTemp = pRumbleNode;
|
||||||
pRumbleNode = pRumbleNode->m_Next;
|
pRumbleNode = pRumbleNode->m_Next;
|
||||||
|
|
||||||
delete pTemp->m_pvData;
|
delete pTemp->m_pvData;
|
||||||
|
|||||||
@@ -6,56 +6,55 @@
|
|||||||
class CForceFeedback
|
class CForceFeedback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum FF_PARAMS
|
||||||
|
{
|
||||||
|
FF_PARAMS_RAMP,
|
||||||
|
FF_PARAMS_PERIODIC
|
||||||
|
};
|
||||||
|
|
||||||
enum FF_PARAMS
|
struct RUMBLE_EFFECT
|
||||||
{
|
{
|
||||||
FF_PARAMS_RAMP,
|
DWORD m_Pad;
|
||||||
FF_PARAMS_PERIODIC
|
uint64_t m_TimeLeft;
|
||||||
};
|
XINPUT_VIBRATION m_RumbleData;
|
||||||
|
WORD unk;
|
||||||
|
};
|
||||||
|
|
||||||
struct RUMBLE_EFFECT
|
struct FF_EFFECT
|
||||||
{
|
{
|
||||||
DWORD m_Pad;
|
unsigned int m_uiEffectType;
|
||||||
uint64_t m_TimeLeft;
|
unsigned int m_uiDurationMs;
|
||||||
XINPUT_VIBRATION m_RumbleData;
|
BYTE gap8[4];
|
||||||
WORD unk;
|
unsigned int m_uiMagnitude;
|
||||||
};
|
BYTE gap10[8];
|
||||||
|
DWORD dword18;
|
||||||
|
DWORD dword1C;
|
||||||
|
};
|
||||||
|
|
||||||
struct FF_EFFECT
|
struct FF_EFFECT_INSTANCE
|
||||||
{
|
{
|
||||||
unsigned int m_uiEffectType;
|
bool m_bIsActive;
|
||||||
unsigned int m_uiDurationMs;
|
unsigned int m_uiInst;
|
||||||
BYTE gap8[4];
|
CForceFeedback::FF_EFFECT *m_Effect;
|
||||||
unsigned int m_uiMagnitude;
|
};
|
||||||
BYTE gap10[8];
|
|
||||||
DWORD dword18;
|
|
||||||
DWORD dword1C;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FF_EFFECT_INSTANCE
|
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
|
||||||
{
|
void RumbleEnable(int iQuadrant, bool bRumbleEnabled);
|
||||||
bool m_bIsActive;
|
void CreateEffect(void);
|
||||||
unsigned int m_uiInst;
|
void AddEffectInstance(unsigned int uiEffect);
|
||||||
CForceFeedback::FF_EFFECT* m_Effect;
|
void SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState);
|
||||||
};
|
|
||||||
|
|
||||||
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
|
void ProcessEventInstance(FF_EFFECT_INSTANCE *pEffectInst);
|
||||||
void RumbleEnable(int iQuadrant, bool bRumbleEnabled);
|
void PauseEventInstance(FF_EFFECT_INSTANCE *pEffectInst);
|
||||||
void CreateEffect(void);
|
|
||||||
void AddEffectInstance(unsigned int uiEffect);
|
|
||||||
void SetEffectInstanceState(unsigned int uiEffectInstance, unsigned int uiState);
|
|
||||||
|
|
||||||
void ProcessEventInstance(FF_EFFECT_INSTANCE* pEffectInst);
|
void AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds);
|
||||||
void PauseEventInstance(FF_EFFECT_INSTANCE* pEffectInst);
|
|
||||||
|
|
||||||
void AddRumble(unsigned int uiPad, WORD leftMotorSpeed, WORD rightMotorSpeed, float fSeconds);
|
void Tick(void);
|
||||||
|
|
||||||
void Tick(void);
|
LinkedList m_EffectList;
|
||||||
|
FF_EFFECT *m_Effects;
|
||||||
LinkedList m_EffectList;
|
int m_EffectC;
|
||||||
FF_EFFECT* m_Effects;
|
LinkedList m_RumbleList;
|
||||||
int m_EffectC;
|
float m_TicksPerSecond;
|
||||||
LinkedList m_RumbleList;
|
bool m_unkBool;
|
||||||
float m_TicksPerSecond;
|
|
||||||
bool m_unkBool;
|
|
||||||
};
|
};
|
||||||
@@ -1,24 +1,22 @@
|
|||||||
#include "INP_Keyboard.h"
|
#include "INP_Keyboard.h"
|
||||||
|
|
||||||
void CKeyboard::Tick(void)
|
void CKeyboard::Tick(void) {}
|
||||||
{
|
|
||||||
|
|
||||||
|
EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||||
|
C_4JInput::EKeyboardMode eMode)
|
||||||
|
{
|
||||||
|
ClearGlobalText();
|
||||||
|
SeedEditBox();
|
||||||
|
Func(lpParam, C_4JInput::EKeyboardMode_Numeric);
|
||||||
|
|
||||||
|
return EKeyboard_ResultAccept;
|
||||||
}
|
}
|
||||||
|
|
||||||
EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode)
|
void CKeyboard::GetText(uint16_t *UTF16String)
|
||||||
{
|
|
||||||
ClearGlobalText();
|
|
||||||
SeedEditBox();
|
|
||||||
Func(lpParam, C_4JInput::EKeyboardMode_Numeric);
|
|
||||||
|
|
||||||
return EKeyboard_ResultAccept;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CKeyboard::GetText(uint16_t* UTF16String)
|
|
||||||
{
|
{
|
||||||
uint16_t* keyString = GetGlobalText();
|
uint16_t *keyString = GetGlobalText();
|
||||||
for (unsigned int index = 0; keyString[index] && index < 0x200; index++)
|
for (unsigned int index = 0; keyString[index] && index < 0x200; index++)
|
||||||
{
|
{
|
||||||
UTF16String[index] = keyString[index];
|
UTF16String[index] = keyString[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,28 +2,25 @@
|
|||||||
#include "4J_Input.h"
|
#include "4J_Input.h"
|
||||||
|
|
||||||
void ClearGlobalText();
|
void ClearGlobalText();
|
||||||
uint16_t* GetGlobalText();
|
uint16_t *GetGlobalText();
|
||||||
void SeedEditBox();
|
void SeedEditBox();
|
||||||
|
|
||||||
class CKeyboard
|
class CKeyboard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum EKeyboardProcessState
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
enum EKeyboardProcessState
|
struct SKeyboardInfo
|
||||||
{
|
{
|
||||||
|
};
|
||||||
|
|
||||||
};
|
void Tick(void);
|
||||||
|
|
||||||
struct SKeyboardInfo
|
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam,
|
||||||
{
|
C_4JInput::EKeyboardMode eMode);
|
||||||
|
void GetText(uint16_t *UTF16String);
|
||||||
|
|
||||||
};
|
BYTE gap0[0x68];
|
||||||
|
|
||||||
void Tick(void);
|
|
||||||
|
|
||||||
EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode);
|
|
||||||
void GetText(uint16_t* UTF16String);
|
|
||||||
|
|
||||||
|
|
||||||
BYTE gap0[0x68];
|
|
||||||
};
|
};
|
||||||
+511
-509
File diff suppressed because it is too large.
Load diff
+112
-115
@@ -7,155 +7,152 @@
|
|||||||
class CInput
|
class CInput
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct JOYPAD
|
||||||
|
{
|
||||||
|
bool m_bIsDisabled;
|
||||||
|
bool m_bIsConnected;
|
||||||
|
bool m_bWasConnected;
|
||||||
|
bool m_bHasConnected;
|
||||||
|
|
||||||
|
unsigned int m_uiButtons;
|
||||||
|
unsigned int m_uiOldButtons;
|
||||||
|
int m_uiButtonsPressed;
|
||||||
|
int m_uiButtonsReleased;
|
||||||
|
|
||||||
struct JOYPAD
|
int m_iRightThumbX;
|
||||||
{
|
int m_iRightThumbY;
|
||||||
bool m_bIsDisabled;
|
int m_iLeftThumbX;
|
||||||
bool m_bIsConnected;
|
int m_iLeftThumbY;
|
||||||
bool m_bWasConnected;
|
|
||||||
bool m_bHasConnected;
|
|
||||||
|
|
||||||
unsigned int m_uiButtons;
|
DWORD m_iNormalizedRightThumbX;
|
||||||
unsigned int m_uiOldButtons;
|
DWORD m_iNormalizedRightThumbY;
|
||||||
int m_uiButtonsPressed;
|
DWORD m_iNormalizedLeftThumbX;
|
||||||
int m_uiButtonsReleased;
|
DWORD m_iNormalizedLeftThumbY;
|
||||||
|
|
||||||
int m_iRightThumbX;
|
float m_fNormalizedRightThumbX;
|
||||||
int m_iRightThumbY;
|
float m_fNormalizedRightThumbY;
|
||||||
int m_iLeftThumbX;
|
float m_fNormalizedLeftThumbX;
|
||||||
int m_iLeftThumbY;
|
float m_fNormalizedLeftThumbY;
|
||||||
|
|
||||||
DWORD m_iNormalizedRightThumbX;
|
unsigned char m_ucLeftTriggerState;
|
||||||
DWORD m_iNormalizedRightThumbY;
|
unsigned char m_ucRightTriggerState;
|
||||||
DWORD m_iNormalizedLeftThumbX;
|
|
||||||
DWORD m_iNormalizedLeftThumbY;
|
|
||||||
|
|
||||||
float m_fNormalizedRightThumbX;
|
float *m_pfLeftThumbXAxisMap;
|
||||||
float m_fNormalizedRightThumbY;
|
float *m_pfLeftThumbYAxisMap;
|
||||||
float m_fNormalizedLeftThumbX;
|
float *m_pfRightThumbXAxisMap;
|
||||||
float m_fNormalizedLeftThumbY;
|
float *m_pfRightThumbYAxisMap;
|
||||||
|
|
||||||
unsigned char m_ucLeftTriggerState;
|
float m_fSensitivity;
|
||||||
unsigned char m_ucRightTriggerState;
|
|
||||||
|
|
||||||
float* m_pfLeftThumbXAxisMap;
|
BYTE *m_pucLeftTriggerAxisMap;
|
||||||
float* m_pfLeftThumbYAxisMap;
|
BYTE *m_pucRightTriggerAxisMap;
|
||||||
float* m_pfRightThumbXAxisMap;
|
|
||||||
float* m_pfRightThumbYAxisMap;
|
|
||||||
|
|
||||||
float m_fSensitivity;
|
unsigned char m_ucMappingValue;
|
||||||
|
unsigned char m_ucInputStateIndex;
|
||||||
|
XINPUT_STATE *m_pInputStates;
|
||||||
|
};
|
||||||
|
|
||||||
BYTE* m_pucLeftTriggerAxisMap;
|
struct JOYPADS
|
||||||
BYTE* m_pucRightTriggerAxisMap;
|
{
|
||||||
|
};
|
||||||
|
|
||||||
unsigned char m_ucMappingValue;
|
struct TimeInfo
|
||||||
unsigned char m_ucInputStateIndex;
|
{
|
||||||
XINPUT_STATE* m_pInputStates;
|
LARGE_INTEGER m_qwStartTime;
|
||||||
};
|
LARGE_INTEGER m_qwTotalHoldTicks;
|
||||||
|
float m_fTotalHoldTime;
|
||||||
|
float m_fLastRepeatTime;
|
||||||
|
bool m_bInitialPressHandled;
|
||||||
|
};
|
||||||
|
|
||||||
struct JOYPADS
|
CInput();
|
||||||
{
|
|
||||||
|
|
||||||
};
|
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
|
||||||
|
void Tick(void);
|
||||||
|
|
||||||
struct TimeInfo
|
void SetJoypadValues(JOYPAD *pThisPad);
|
||||||
{
|
void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax);
|
||||||
LARGE_INTEGER m_qwStartTime;
|
void SetJoypadSensitivity(int iPad, float fSensitivity);
|
||||||
LARGE_INTEGER m_qwTotalHoldTicks;
|
|
||||||
float m_fTotalHoldTime;
|
|
||||||
float m_fLastRepeatTime;
|
|
||||||
bool m_bInitialPressHandled;
|
|
||||||
};
|
|
||||||
|
|
||||||
CInput();
|
void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
|
||||||
|
unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
|
||||||
|
void SetJoypadMapVal(int iPad, unsigned char ucMap);
|
||||||
|
unsigned char GetJoypadMapVal(int iPad);
|
||||||
|
|
||||||
void Initialise(int iInputStateC, unsigned char ucMapC, unsigned char ucActionC, unsigned char ucMenuActionC);
|
void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
|
||||||
void Tick(void);
|
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
|
||||||
|
|
||||||
void SetJoypadValues(JOYPAD* pThisPad);
|
bool IsPadConnected(int iPad);
|
||||||
void SetDeadzoneAndMovementRange(unsigned int uiDeadzone, unsigned int uiMovementRangeMax);
|
void SetSigninJoypadMask(unsigned int mask);
|
||||||
void SetJoypadSensitivity(int iPad, float fSensitivity);
|
unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false);
|
||||||
|
bool IsSet(int iPad, unsigned char ucAction);
|
||||||
|
|
||||||
void SetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction, unsigned int uiActionVal);
|
bool ButtonPressed(int iPad, unsigned char ucAction = 255); // toggled
|
||||||
unsigned int GetGameJoypadMaps(unsigned char ucMap, unsigned char ucAction);
|
bool ButtonReleased(int iPad, unsigned char ucAction); // toggled
|
||||||
void SetJoypadMapVal(int iPad, unsigned char ucMap);
|
bool ButtonDown(int iPad, unsigned char ucAction = 255); // button held down
|
||||||
unsigned char GetJoypadMapVal(int iPad);
|
|
||||||
|
|
||||||
void SetJoypadStickAxisMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
|
float GetJoypadStick_Menu_LX(unsigned char ucPad);
|
||||||
void SetJoypadStickTriggerMap(int iPad, unsigned int uiFrom, unsigned int uiTo);
|
float GetJoypadStick_Menu_LY(unsigned char ucPad);
|
||||||
|
float GetJoypadStick_Menu_RX(unsigned char ucPad);
|
||||||
|
float GetJoypadStick_Menu_RY(unsigned char ucPad);
|
||||||
|
unsigned char GetJoypadLTrigger_Menu(unsigned char ucPad);
|
||||||
|
unsigned char GetJoypadRTrigger_Menu(unsigned char ucPad);
|
||||||
|
|
||||||
bool IsPadConnected(int iPad);
|
float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay = true);
|
||||||
void SetSigninJoypadMask(unsigned int mask);
|
float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay = true);
|
||||||
unsigned int GetValue(int iPad, unsigned char ucAction, bool bRepeat = false);
|
float GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay = true);
|
||||||
bool IsSet(int iPad, unsigned char ucAction);
|
float GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay = true);
|
||||||
|
unsigned char GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay = true);
|
||||||
|
unsigned char GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay = true);
|
||||||
|
|
||||||
bool ButtonPressed(int iPad, unsigned char ucAction = 255); // toggled
|
void SetMenuDisplayed(int iPad, bool bVal);
|
||||||
bool ButtonReleased(int iPad, unsigned char ucAction); //toggled
|
|
||||||
bool ButtonDown(int iPad, unsigned char ucAction = 255); // button held down
|
|
||||||
|
|
||||||
float GetJoypadStick_Menu_LX(unsigned char ucPad);
|
void SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs);
|
||||||
float GetJoypadStick_Menu_LY(unsigned char ucPad);
|
void SetDebugSequence(const char *chSequenceA, int (*Func)(LPVOID), LPVOID lpParam);
|
||||||
float GetJoypadStick_Menu_RX(unsigned char ucPad);
|
FLOAT GetIdleSeconds(int iPad);
|
||||||
float GetJoypadStick_Menu_RY(unsigned char ucPad);
|
|
||||||
unsigned char GetJoypadLTrigger_Menu(unsigned char ucPad);
|
|
||||||
unsigned char GetJoypadRTrigger_Menu(unsigned char ucPad);
|
|
||||||
|
|
||||||
float GetJoypadStick_LX(int iPad, bool bCheckMenuDisplay = true);
|
bool UpdateJoypads(void);
|
||||||
float GetJoypadStick_LY(int iPad, bool bCheckMenuDisplay = true);
|
void ClearJoypadValues(JOYPAD *pThisPad);
|
||||||
float GetJoypadStick_RX(int iPad, bool bCheckMenuDisplay = true);
|
|
||||||
float GetJoypadStick_RY(int iPad, bool bCheckMenuDisplay = true);
|
|
||||||
unsigned char GetJoypadLTrigger(int iPad, bool bCheckMenuDisplay = true);
|
|
||||||
unsigned char GetJoypadRTrigger(int iPad, bool bCheckMenuDisplay = true);
|
|
||||||
|
|
||||||
void SetMenuDisplayed(int iPad, bool bVal);
|
void InitTime(void);
|
||||||
|
void GetStartTime(int iPad, int iKey);
|
||||||
|
void UpdateTime(int iPad, int iKey);
|
||||||
|
|
||||||
void SetKeyRepeatRate(float fRepeatDelaySecs, float fRepeatRateSecs);
|
BYTE gap0[16];
|
||||||
void SetDebugSequence(const char* chSequenceA, int(*Func)(LPVOID), LPVOID lpParam);
|
|
||||||
FLOAT GetIdleSeconds(int iPad);
|
|
||||||
|
|
||||||
bool UpdateJoypads(void);
|
JOYPAD m_Joypads[MAX_JOYPADS];
|
||||||
void ClearJoypadValues(JOYPAD* pThisPad);
|
|
||||||
|
|
||||||
void InitTime(void);
|
int m_iDeadzone;
|
||||||
void GetStartTime(int iPad, int iKey);
|
int m_iMovementRangeMax;
|
||||||
void UpdateTime(int iPad, int iKey);
|
int m_iEffectiveRange;
|
||||||
|
int m_iHalfRange;
|
||||||
|
float m_fEffectiveRange;
|
||||||
|
|
||||||
BYTE gap0[16];
|
unsigned char m_ucInputStateC;
|
||||||
|
unsigned char m_ucJoypadMapC;
|
||||||
|
unsigned char m_ucJoypadMapActionC;
|
||||||
|
unsigned char m_ucMenuActionC;
|
||||||
|
|
||||||
JOYPAD m_Joypads[MAX_JOYPADS];
|
unsigned int **m_JoypadMap;
|
||||||
|
|
||||||
int m_iDeadzone;
|
bool m_bJoypadMapArrayIsSetup;
|
||||||
int m_iMovementRangeMax;
|
unsigned int m_uiSigninJoypadMask;
|
||||||
int m_iEffectiveRange;
|
bool m_bIsMenuDisplayed[MAX_JOYPADS];
|
||||||
int m_iHalfRange;
|
|
||||||
float m_fEffectiveRange;
|
|
||||||
|
|
||||||
unsigned char m_ucInputStateC;
|
CForceFeedback m_ForceFeedback;
|
||||||
unsigned char m_ucJoypadMapC;
|
CKeyboard m_Keyboard;
|
||||||
unsigned char m_ucJoypadMapActionC;
|
|
||||||
unsigned char m_ucMenuActionC;
|
|
||||||
|
|
||||||
unsigned int** m_JoypadMap;
|
float m_fTickToSeconds;
|
||||||
|
float m_fRepeatDelaySecs;
|
||||||
|
float m_fRepeatRateSecs;
|
||||||
|
|
||||||
bool m_bJoypadMapArrayIsSetup;
|
TimeInfo m_Timers[MAX_JOYPADS][24];
|
||||||
unsigned int m_uiSigninJoypadMask;
|
LARGE_INTEGER m_LastActivityTime[MAX_JOYPADS];
|
||||||
bool m_bIsMenuDisplayed[MAX_JOYPADS];
|
|
||||||
|
|
||||||
CForceFeedback m_ForceFeedback;
|
char *m_sDebugSequenceName;
|
||||||
CKeyboard m_Keyboard;
|
unsigned int m_uiDebugSequenceIndex;
|
||||||
|
int (*m_pDebugSequenceFn)(void *);
|
||||||
float m_fTickToSeconds;
|
LPVOID m_pDebugSequenceParam;
|
||||||
float m_fRepeatDelaySecs;
|
|
||||||
float m_fRepeatRateSecs;
|
|
||||||
|
|
||||||
TimeInfo m_Timers[MAX_JOYPADS][24];
|
|
||||||
LARGE_INTEGER m_LastActivityTime[MAX_JOYPADS];
|
|
||||||
|
|
||||||
char* m_sDebugSequenceName;
|
|
||||||
unsigned int m_uiDebugSequenceIndex;
|
|
||||||
int (*m_pDebugSequenceFn)(void*);
|
|
||||||
LPVOID m_pDebugSequenceParam;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Singleton
|
// Singleton
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ LinkedList::LinkedList()
|
|||||||
this->m_Tail = nullptr;
|
this->m_Tail = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkedList::AddToHead(void* pvData)
|
void LinkedList::AddToHead(void *pvData)
|
||||||
{
|
{
|
||||||
_LL_NODE* pNode = new _LL_NODE();
|
_LL_NODE *pNode = new _LL_NODE();
|
||||||
pNode->m_pvData = pvData;
|
pNode->m_pvData = pvData;
|
||||||
|
|
||||||
if (!m_Tail)
|
if (!m_Tail)
|
||||||
@@ -27,9 +27,9 @@ void LinkedList::AddToHead(void* pvData)
|
|||||||
m_NodeC++;
|
m_NodeC++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkedList::AddToTail(void* pvData)
|
void LinkedList::AddToTail(void *pvData)
|
||||||
{
|
{
|
||||||
_LL_NODE* pNode = new _LL_NODE();
|
_LL_NODE *pNode = new _LL_NODE();
|
||||||
pNode->m_pvData = pvData;
|
pNode->m_pvData = pvData;
|
||||||
|
|
||||||
if (!m_Head)
|
if (!m_Head)
|
||||||
@@ -37,7 +37,8 @@ void LinkedList::AddToTail(void* pvData)
|
|||||||
m_Head = pNode;
|
m_Head = pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Tail) {
|
if (m_Tail)
|
||||||
|
{
|
||||||
m_Tail->m_Next = pNode;
|
m_Tail->m_Next = pNode;
|
||||||
pNode->m_Prev = m_Tail;
|
pNode->m_Prev = m_Tail;
|
||||||
}
|
}
|
||||||
@@ -49,9 +50,9 @@ void LinkedList::AddToTail(void* pvData)
|
|||||||
m_NodeC++;
|
m_NodeC++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkedList::RemoveNode(_LL_NODE* pNodeToRemove)
|
void LinkedList::RemoveNode(_LL_NODE *pNodeToRemove)
|
||||||
{
|
{
|
||||||
_LL_NODE* pCurrentNode;
|
_LL_NODE *pCurrentNode;
|
||||||
for (pCurrentNode = m_Head; pCurrentNode != pNodeToRemove; pCurrentNode = pCurrentNode->m_Next)
|
for (pCurrentNode = m_Head; pCurrentNode != pNodeToRemove; pCurrentNode = pCurrentNode->m_Next)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
@@ -61,7 +62,7 @@ void LinkedList::RemoveNode(_LL_NODE* pNodeToRemove)
|
|||||||
{
|
{
|
||||||
m_Head = m_Head->m_Next;
|
m_Head = m_Head->m_Next;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pCurrentNode->m_Prev->m_Next = pCurrentNode->m_Next;
|
pCurrentNode->m_Prev->m_Next = pCurrentNode->m_Next;
|
||||||
|
|
||||||
@@ -74,9 +75,9 @@ void LinkedList::RemoveNode(_LL_NODE* pNodeToRemove)
|
|||||||
m_NodeC--;
|
m_NodeC--;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList::_LL_NODE* LinkedList::RemoveHeadNode()
|
LinkedList::_LL_NODE *LinkedList::RemoveHeadNode()
|
||||||
{
|
{
|
||||||
_LL_NODE* pHeadNode = m_Head;
|
_LL_NODE *pHeadNode = m_Head;
|
||||||
|
|
||||||
if (m_NodeC > 0)
|
if (m_NodeC > 0)
|
||||||
{
|
{
|
||||||
@@ -87,11 +88,11 @@ LinkedList::_LL_NODE* LinkedList::RemoveHeadNode()
|
|||||||
return pHeadNode;
|
return pHeadNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinkedList::ClearList()
|
void LinkedList::ClearList()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
_LL_NODE* pHeadNode = RemoveHeadNode();
|
_LL_NODE *pHeadNode = RemoveHeadNode();
|
||||||
if (!pHeadNode)
|
if (!pHeadNode)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3,29 +3,27 @@
|
|||||||
class LinkedList
|
class LinkedList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct _LL_NODE
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
T *GetDataAs()
|
||||||
|
{
|
||||||
|
return (T *)m_pvData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *m_pvData;
|
||||||
|
_LL_NODE *m_Next;
|
||||||
|
_LL_NODE *m_Prev;
|
||||||
|
};
|
||||||
|
|
||||||
struct _LL_NODE
|
int m_NodeC;
|
||||||
{
|
_LL_NODE *m_Head;
|
||||||
template<typename T>
|
_LL_NODE *m_Tail;
|
||||||
T* GetDataAs()
|
|
||||||
{
|
|
||||||
return (T*)m_pvData;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* m_pvData;
|
LinkedList();
|
||||||
_LL_NODE* m_Next;
|
void AddToHead(void *pvData);
|
||||||
_LL_NODE* m_Prev;
|
void AddToTail(void *pvData);
|
||||||
};
|
void RemoveNode(_LL_NODE *pNodeToRemove);
|
||||||
|
_LL_NODE *RemoveHeadNode();
|
||||||
int m_NodeC;
|
void ClearList();
|
||||||
_LL_NODE* m_Head;
|
|
||||||
_LL_NODE* m_Tail;
|
|
||||||
|
|
||||||
LinkedList();
|
|
||||||
void AddToHead(void* pvData);
|
|
||||||
void AddToTail(void* pvData);
|
|
||||||
void RemoveNode(_LL_NODE* pNodeToRemove);
|
|
||||||
_LL_NODE* RemoveHeadNode();
|
|
||||||
void ClearList();
|
|
||||||
};
|
};
|
||||||
@@ -2,8 +2,11 @@
|
|||||||
#include "4J_Render.h"
|
#include "4J_Render.h"
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
|
|
||||||
|
C4JRender RenderManager;
|
||||||
|
|
||||||
void C4JRender::Tick()
|
void C4JRender::Tick()
|
||||||
{
|
{
|
||||||
|
InternalRenderManager.CBuffTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JRender::UpdateGamma(unsigned short usGamma)
|
void C4JRender::UpdateGamma(unsigned short usGamma)
|
||||||
@@ -474,5 +477,3 @@ void C4JRender::Resume()
|
|||||||
{
|
{
|
||||||
InternalRenderManager.Resume();
|
InternalRenderManager.Resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JRender RenderManager;
|
|
||||||
+405
-407
@@ -9,441 +9,439 @@
|
|||||||
class Renderer
|
class Renderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Context;
|
struct Context;
|
||||||
struct CommandBuffer;
|
struct CommandBuffer;
|
||||||
|
|
||||||
void Tick();
|
|
||||||
void UpdateGamma(unsigned short usGamma);
|
|
||||||
void MatrixMode(int type);
|
|
||||||
void MatrixSetIdentity();
|
|
||||||
void MatrixTranslate(float x, float y, float z);
|
|
||||||
void MatrixRotate(float angle, float x, float y, float z);
|
|
||||||
void MatrixScale(float x, float y, float z);
|
|
||||||
void MatrixPerspective(float fovy, float aspect, float zNear, float zFar);
|
|
||||||
void MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar);
|
|
||||||
void MatrixPop();
|
|
||||||
void MatrixPush();
|
|
||||||
void MatrixMult(float* mat);
|
|
||||||
const float* MatrixGet(int type);
|
|
||||||
void Set_matrixDirty();
|
|
||||||
void Initialise(ID3D11Device* pDevice, IDXGISwapChain* pSwapChain);
|
|
||||||
ID3D11DeviceContext* InitialiseContext(bool fromPresent);
|
|
||||||
void StartFrame();
|
|
||||||
void DoScreenGrabOnNextPresent();
|
|
||||||
void Present();
|
|
||||||
void Clear(int flags, D3D11_RECT* pRect);
|
|
||||||
void SetClearColour(const float colourRGBA[4]);
|
|
||||||
bool IsWidescreen();
|
|
||||||
bool IsHiDef();
|
|
||||||
void CaptureThumbnail(ImageFileBuffer* pngOut);
|
|
||||||
void CaptureScreen(ImageFileBuffer* jpgOut, XSOCIAL_PREVIEWIMAGE* previewOut);
|
|
||||||
void BeginConditionalSurvey(int identifier);
|
|
||||||
void EndConditionalSurvey();
|
|
||||||
void BeginConditionalRendering(int identifier);
|
|
||||||
void EndConditionalRendering();
|
|
||||||
void DrawVertices(C4JRender::ePrimitiveType PrimitiveType, int count, void* dataIn, C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType);
|
|
||||||
void DrawVertexBuffer(C4JRender::ePrimitiveType PrimitiveType, int count, ID3D11Buffer* buffer, C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType);
|
|
||||||
void CBuffLockStaticCreations();
|
|
||||||
int CBuffCreate(int count);
|
|
||||||
void CBuffDelete(int first, int count);
|
|
||||||
void CBuffStart(int index, bool full);
|
|
||||||
void CBuffClear(int index);
|
|
||||||
int CBuffSize(int index);
|
|
||||||
void CBuffEnd();
|
|
||||||
bool CBuffCall(int index, bool full);
|
|
||||||
void CBuffTick();
|
|
||||||
void CBuffDeferredModeStart();
|
|
||||||
void CBuffDeferredModeEnd();
|
|
||||||
int TextureCreate();
|
|
||||||
void TextureFree(int idx);
|
|
||||||
void TextureBind(int idx);
|
|
||||||
void TextureBindVertex(int idx);
|
|
||||||
void TextureSetTextureLevels(int levels);
|
|
||||||
int TextureGetTextureLevels();
|
|
||||||
void TextureSetParam(int param, int value);
|
|
||||||
void TextureDynamicUpdateStart();
|
|
||||||
void TextureDynamicUpdateEnd();
|
|
||||||
void TextureData(int width, int height, void* data, int level, C4JRender::eTextureFormat format);
|
|
||||||
void TextureDataUpdate(int xoffset, int yoffset, int width, int height, void* data, int level);
|
|
||||||
HRESULT LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut);
|
|
||||||
HRESULT LoadTextureData(BYTE* pbData, DWORD dwBytes, D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut);
|
|
||||||
HRESULT SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo, int* ppDataOut);
|
|
||||||
HRESULT SaveTextureDataToMemory(void* pOutput, int outputCapacity, int* outputLength, int width, int height, int* ppDataIn);
|
|
||||||
void TextureGetStats();
|
|
||||||
ID3D11ShaderResourceView* TextureGetTexture(int idx);
|
|
||||||
void StateSetColour(float r, float g, float b, float a);
|
|
||||||
void StateSetDepthMask(bool enable);
|
|
||||||
void StateSetBlendEnable(bool enable);
|
|
||||||
void StateSetBlendFunc(int src, int dst);
|
|
||||||
void StateSetBlendFactor(unsigned int colour);
|
|
||||||
void StateSetAlphaFunc(int func, float param);
|
|
||||||
void StateSetDepthFunc(int func);
|
|
||||||
void StateSetFaceCull(bool enable);
|
|
||||||
void StateSetFaceCullCW(bool enable);
|
|
||||||
void StateSetLineWidth(float width);
|
|
||||||
void StateSetWriteEnable(bool red, bool green, bool blue, bool alpha);
|
|
||||||
void StateSetDepthTestEnable(bool enable);
|
|
||||||
void StateSetAlphaTestEnable(bool enable);
|
|
||||||
void StateSetDepthSlopeAndBias(float slope, float bias);
|
|
||||||
void StateSetFogEnable(bool enable);
|
|
||||||
void StateSetFogMode(int mode);
|
|
||||||
void StateSetFogNearDistance(float dist);
|
|
||||||
void StateSetFogFarDistance(float dist);
|
|
||||||
void StateSetFogDensity(float density);
|
|
||||||
void StateSetFogColour(float red, float green, float blue);
|
|
||||||
void StateSetLightingEnable(bool enable);
|
|
||||||
void StateSetVertexTextureUV(float u, float v);
|
|
||||||
void StateSetLightColour(int light, float red, float green, float blue);
|
|
||||||
void StateSetLightAmbientColour(float red, float green, float blue);
|
|
||||||
void StateSetLightDirection(int light, float x, float y, float z);
|
|
||||||
void StateSetLightEnable(int light, bool enable);
|
|
||||||
void StateSetViewport(C4JRender::eViewportType viewportType);
|
|
||||||
void StateSetEnableViewportClipPlanes(bool enable);
|
|
||||||
void StateSetTexGenCol(int col, float x, float y, float z, float w, bool eyeSpace);
|
|
||||||
void StateSetStencil(D3D11_COMPARISON_FUNC function, uint8_t stencil_ref, uint8_t stencil_func_mask, uint8_t stencil_write_mask);
|
|
||||||
void StateSetForceLOD(int LOD);
|
|
||||||
void BeginEvent(LPCWSTR eventName);
|
|
||||||
void EndEvent();
|
|
||||||
void Suspend();
|
|
||||||
bool Suspended();
|
|
||||||
void Resume();
|
|
||||||
void StateUpdate();
|
|
||||||
|
|
||||||
|
void Tick();
|
||||||
|
void UpdateGamma(unsigned short usGamma);
|
||||||
|
void MatrixMode(int type);
|
||||||
|
void MatrixSetIdentity();
|
||||||
|
void MatrixTranslate(float x, float y, float z);
|
||||||
|
void MatrixRotate(float angle, float x, float y, float z);
|
||||||
|
void MatrixScale(float x, float y, float z);
|
||||||
|
void MatrixPerspective(float fovy, float aspect, float zNear, float zFar);
|
||||||
|
void MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar);
|
||||||
|
void MatrixPop();
|
||||||
|
void MatrixPush();
|
||||||
|
void MatrixMult(float *mat);
|
||||||
|
const float *MatrixGet(int type);
|
||||||
|
void Set_matrixDirty();
|
||||||
|
void Initialise(ID3D11Device *pDevice, IDXGISwapChain *pSwapChain);
|
||||||
|
ID3D11DeviceContext *InitialiseContext(bool fromPresent);
|
||||||
|
void StartFrame();
|
||||||
|
void DoScreenGrabOnNextPresent();
|
||||||
|
void Present();
|
||||||
|
void Clear(int flags, D3D11_RECT *pRect);
|
||||||
|
void SetClearColour(const float colourRGBA[4]);
|
||||||
|
bool IsWidescreen();
|
||||||
|
bool IsHiDef();
|
||||||
|
void CaptureThumbnail(ImageFileBuffer *pngOut);
|
||||||
|
void CaptureScreen(ImageFileBuffer *jpgOut, XSOCIAL_PREVIEWIMAGE *previewOut);
|
||||||
|
void BeginConditionalSurvey(int identifier);
|
||||||
|
void EndConditionalSurvey();
|
||||||
|
void BeginConditionalRendering(int identifier);
|
||||||
|
void EndConditionalRendering();
|
||||||
|
void DrawVertices(C4JRender::ePrimitiveType PrimitiveType, int count, void *dataIn, C4JRender::eVertexType vType,
|
||||||
|
C4JRender::ePixelShaderType psType);
|
||||||
|
void DrawVertexBuffer(C4JRender::ePrimitiveType PrimitiveType, int count, ID3D11Buffer *buffer, C4JRender::eVertexType vType,
|
||||||
|
C4JRender::ePixelShaderType psType);
|
||||||
|
void CBuffLockStaticCreations();
|
||||||
|
int CBuffCreate(int count);
|
||||||
|
void CBuffDelete(int first, int count);
|
||||||
|
void CBuffStart(int index, bool full);
|
||||||
|
void CBuffClear(int index);
|
||||||
|
int CBuffSize(int index);
|
||||||
|
void CBuffEnd();
|
||||||
|
bool CBuffCall(int index, bool full);
|
||||||
|
void CBuffTick();
|
||||||
|
void CBuffDeferredModeStart();
|
||||||
|
void CBuffDeferredModeEnd();
|
||||||
|
int TextureCreate();
|
||||||
|
void TextureFree(int idx);
|
||||||
|
void TextureBind(int idx);
|
||||||
|
void TextureBindVertex(int idx);
|
||||||
|
void TextureSetTextureLevels(int levels);
|
||||||
|
int TextureGetTextureLevels();
|
||||||
|
void TextureSetParam(int param, int value);
|
||||||
|
void TextureDynamicUpdateStart();
|
||||||
|
void TextureDynamicUpdateEnd();
|
||||||
|
void TextureData(int width, int height, void *data, int level, C4JRender::eTextureFormat format);
|
||||||
|
void TextureDataUpdate(int xoffset, int yoffset, int width, int height, void *data, int level);
|
||||||
|
HRESULT LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut);
|
||||||
|
HRESULT LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut);
|
||||||
|
HRESULT SaveTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut);
|
||||||
|
HRESULT SaveTextureDataToMemory(void *pOutput, int outputCapacity, int *outputLength, int width, int height, int *ppDataIn);
|
||||||
|
void TextureGetStats();
|
||||||
|
ID3D11ShaderResourceView *TextureGetTexture(int idx);
|
||||||
|
void StateSetColour(float r, float g, float b, float a);
|
||||||
|
void StateSetDepthMask(bool enable);
|
||||||
|
void StateSetBlendEnable(bool enable);
|
||||||
|
void StateSetBlendFunc(int src, int dst);
|
||||||
|
void StateSetBlendFactor(unsigned int colour);
|
||||||
|
void StateSetAlphaFunc(int func, float param);
|
||||||
|
void StateSetDepthFunc(int func);
|
||||||
|
void StateSetFaceCull(bool enable);
|
||||||
|
void StateSetFaceCullCW(bool enable);
|
||||||
|
void StateSetLineWidth(float width);
|
||||||
|
void StateSetWriteEnable(bool red, bool green, bool blue, bool alpha);
|
||||||
|
void StateSetDepthTestEnable(bool enable);
|
||||||
|
void StateSetAlphaTestEnable(bool enable);
|
||||||
|
void StateSetDepthSlopeAndBias(float slope, float bias);
|
||||||
|
void StateSetFogEnable(bool enable);
|
||||||
|
void StateSetFogMode(int mode);
|
||||||
|
void StateSetFogNearDistance(float dist);
|
||||||
|
void StateSetFogFarDistance(float dist);
|
||||||
|
void StateSetFogDensity(float density);
|
||||||
|
void StateSetFogColour(float red, float green, float blue);
|
||||||
|
void StateSetLightingEnable(bool enable);
|
||||||
|
void StateSetVertexTextureUV(float u, float v);
|
||||||
|
void StateSetLightColour(int light, float red, float green, float blue);
|
||||||
|
void StateSetLightAmbientColour(float red, float green, float blue);
|
||||||
|
void StateSetLightDirection(int light, float x, float y, float z);
|
||||||
|
void StateSetLightEnable(int light, bool enable);
|
||||||
|
void StateSetViewport(C4JRender::eViewportType viewportType);
|
||||||
|
void StateSetEnableViewportClipPlanes(bool enable);
|
||||||
|
void StateSetTexGenCol(int col, float x, float y, float z, float w, bool eyeSpace);
|
||||||
|
void StateSetStencil(D3D11_COMPARISON_FUNC function, uint8_t stencil_ref, uint8_t stencil_func_mask, uint8_t stencil_write_mask);
|
||||||
|
void StateSetForceLOD(int LOD);
|
||||||
|
void BeginEvent(LPCWSTR eventName);
|
||||||
|
void EndEvent();
|
||||||
|
void Suspend();
|
||||||
|
bool Suspended();
|
||||||
|
void Resume();
|
||||||
|
void StateUpdate();
|
||||||
private:
|
private:
|
||||||
void SetupShaders();
|
void SetupShaders();
|
||||||
void ConvertLinearToPng(ImageFileBuffer* pngOut, unsigned char* linearData, unsigned int width, unsigned int height);
|
void ConvertLinearToPng(ImageFileBuffer *pngOut, unsigned char *linearData, unsigned int width, unsigned int height);
|
||||||
void DrawVertexSetup(C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType, C4JRender::ePrimitiveType primitiveType, int* count, bool* drawIndexed);
|
void DrawVertexSetup(C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType, C4JRender::ePrimitiveType primitiveType, int *count,
|
||||||
void UpdateTexGenState();
|
bool *drawIndexed);
|
||||||
void UpdateLightingState();
|
void UpdateTexGenState();
|
||||||
void UpdateViewportState();
|
void UpdateLightingState();
|
||||||
void UpdateFogState();
|
void UpdateViewportState();
|
||||||
void UpdateTextureState(bool vertexSampler);
|
void UpdateFogState();
|
||||||
void MultWithStack(DirectX::XMMATRIX matrix);
|
void UpdateTextureState(bool vertexSampler);
|
||||||
ID3D11DepthStencilState* GetManagedDepthStencilState();
|
void MultWithStack(DirectX::XMMATRIX matrix);
|
||||||
ID3D11BlendState* GetManagedBlendState();
|
ID3D11DepthStencilState *GetManagedDepthStencilState();
|
||||||
ID3D11RasterizerState* GetManagedRasterizerState();
|
ID3D11BlendState *GetManagedBlendState();
|
||||||
ID3D11SamplerState* GetManagedSamplerState();
|
ID3D11RasterizerState *GetManagedRasterizerState();
|
||||||
void DeleteInternalBuffer(int index);
|
ID3D11SamplerState *GetManagedSamplerState();
|
||||||
Renderer::Context& getContext();
|
void DeleteInternalBuffer(int index);
|
||||||
static D3D11_PRIMITIVE_TOPOLOGY* m_Topologies;
|
Renderer::Context &getContext();
|
||||||
static DXGI_FORMAT textureFormats[C4JRender::MAX_TEXTURE_FORMATS];
|
static D3D11_PRIMITIVE_TOPOLOGY *m_Topologies;
|
||||||
|
static DXGI_FORMAT textureFormats[C4JRender::MAX_TEXTURE_FORMATS];
|
||||||
public:
|
public:
|
||||||
|
struct Texture
|
||||||
|
{
|
||||||
|
bool allocated;
|
||||||
|
ID3D11Texture2D *texture;
|
||||||
|
ID3D11ShaderResourceView *view;
|
||||||
|
DWORD textureFlags;
|
||||||
|
DWORD mipLevels;
|
||||||
|
DWORD textureFormat;
|
||||||
|
DWORD samplerParams;
|
||||||
|
};
|
||||||
|
|
||||||
struct Texture
|
struct TexgenCBuffer
|
||||||
{
|
{
|
||||||
bool allocated;
|
DirectX::XMMATRIX unk0;
|
||||||
ID3D11Texture2D* texture;
|
DirectX::XMMATRIX unk1;
|
||||||
ID3D11ShaderResourceView* view;
|
};
|
||||||
DWORD textureFlags;
|
|
||||||
DWORD mipLevels;
|
|
||||||
DWORD textureFormat;
|
|
||||||
DWORD samplerParams;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TexgenCBuffer
|
enum eCommandType
|
||||||
{
|
{
|
||||||
DirectX::XMMATRIX unk0;
|
COMMAND_ADD_MATRIX,
|
||||||
DirectX::XMMATRIX unk1;
|
COMMAND_ADD_VERTICES,
|
||||||
};
|
COMMAND_BIND_TEXTURE,
|
||||||
|
COMMAND_SET_COLOR,
|
||||||
|
COMMAND_SET_DEPTH_FUNC,
|
||||||
|
COMMAND_SET_DEPTH_MASK,
|
||||||
|
COMMAND_SET_DEPTH_TEST,
|
||||||
|
COMMAND_SET_LIGHTING_ENABLE,
|
||||||
|
COMMAND_SET_LIGHT_ENABLE,
|
||||||
|
COMMAND_SET_LIGHT_DIRECTION,
|
||||||
|
COMMAND_SET_LIGHT_COLOUR,
|
||||||
|
COMMAND_SET_LIGHT_AMBIENT_COLOUR,
|
||||||
|
COMMAND_SET_BLEND_ENABLE,
|
||||||
|
COMMAND_SET_BLEND_FUNC,
|
||||||
|
COMMAND_SET_BLEND_FACTOR,
|
||||||
|
COMMAND_SET_FACE_CULL,
|
||||||
|
};
|
||||||
|
|
||||||
enum eCommandType
|
struct CommandBuffer
|
||||||
{
|
{
|
||||||
COMMAND_ADD_MATRIX,
|
CommandBuffer(bool full);
|
||||||
COMMAND_ADD_VERTICES,
|
~CommandBuffer();
|
||||||
COMMAND_BIND_TEXTURE,
|
void StartRecording();
|
||||||
COMMAND_SET_COLOR,
|
void EndRecording(ID3D11Device *device);
|
||||||
COMMAND_SET_DEPTH_FUNC,
|
std::uint64_t GetAllocated();
|
||||||
COMMAND_SET_DEPTH_MASK,
|
bool IsBusy();
|
||||||
COMMAND_SET_DEPTH_TEST,
|
void AddMatrix(const float *matrix);
|
||||||
COMMAND_SET_LIGHTING_ENABLE,
|
void AddVertices(unsigned int stride, unsigned int count, void *dataIn, Renderer::Context &context);
|
||||||
COMMAND_SET_LIGHT_ENABLE,
|
void BindTexture(int idx);
|
||||||
COMMAND_SET_LIGHT_DIRECTION,
|
void SetColor(float r, float g, float b, float a);
|
||||||
COMMAND_SET_LIGHT_COLOUR,
|
void SetDepthFunc(int func);
|
||||||
COMMAND_SET_LIGHT_AMBIENT_COLOUR,
|
void SetDepthMask(bool enable);
|
||||||
COMMAND_SET_BLEND_ENABLE,
|
void SetDepthTestEnable(bool enable);
|
||||||
COMMAND_SET_BLEND_FUNC,
|
void SetLightingEnable(bool enable);
|
||||||
COMMAND_SET_BLEND_FACTOR,
|
void SetLightEnable(int light, bool enable);
|
||||||
COMMAND_SET_FACE_CULL,
|
void SetLightDirection(int light, float x, float y, float z);
|
||||||
};
|
void SetLightColour(int light, float r, float g, float b);
|
||||||
|
void SetLightAmbientColour(float r, float g, float b);
|
||||||
|
void SetBlendEnable(bool enable);
|
||||||
|
void SetBlendFunc(int src, int dst);
|
||||||
|
void SetBlendFactor(unsigned int factor);
|
||||||
|
void SetFaceCull(bool enable);
|
||||||
|
void Render(C4JRender::eVertexType vertexType, Renderer::Context &context, int primitiveType);
|
||||||
|
|
||||||
struct CommandBuffer
|
struct Command
|
||||||
{
|
{
|
||||||
CommandBuffer(bool full);
|
Renderer::eCommandType m_command_type;
|
||||||
~CommandBuffer();
|
BYTE commandPadding[12];
|
||||||
void StartRecording();
|
|
||||||
void EndRecording(ID3D11Device* device);
|
|
||||||
std::uint64_t GetAllocated();
|
|
||||||
bool IsBusy();
|
|
||||||
void AddMatrix(const float* matrix);
|
|
||||||
void AddVertices(unsigned int stride, unsigned int count, void* dataIn, Renderer::Context& context);
|
|
||||||
void BindTexture(int idx);
|
|
||||||
void SetColor(float r, float g, float b, float a);
|
|
||||||
void SetDepthFunc(int func);
|
|
||||||
void SetDepthMask(bool enable);
|
|
||||||
void SetDepthTestEnable(bool enable);
|
|
||||||
void SetLightingEnable(bool enable);
|
|
||||||
void SetLightEnable(int light, bool enable);
|
|
||||||
void SetLightDirection(int light, float x, float y, float z);
|
|
||||||
void SetLightColour(int light, float r, float g, float b);
|
|
||||||
void SetLightAmbientColour(float r, float g, float b);
|
|
||||||
void SetBlendEnable(bool enable);
|
|
||||||
void SetBlendFunc(int src, int dst);
|
|
||||||
void SetBlendFactor(unsigned int factor);
|
|
||||||
void SetFaceCull(bool enable);
|
|
||||||
void Render(C4JRender::eVertexType vertexType, Renderer::Context& context, int primitiveType);
|
|
||||||
|
|
||||||
struct Command
|
union
|
||||||
{
|
{
|
||||||
Renderer::eCommandType m_command_type;
|
BYTE data[64];
|
||||||
BYTE commandPadding[12];
|
|
||||||
|
|
||||||
union
|
struct
|
||||||
{
|
{
|
||||||
BYTE data[64];
|
float m_matrix[16];
|
||||||
|
// DirectX::XMMATRIX m_matrix;
|
||||||
|
} add_matrix;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
float m_matrix[16];
|
unsigned int m_vertex_index_start;
|
||||||
//DirectX::XMMATRIX m_matrix;
|
unsigned int m_vertex_count;
|
||||||
} add_matrix;
|
} add_vertices;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int m_vertex_index_start;
|
unsigned int m_texture_index;
|
||||||
unsigned int m_vertex_count;
|
} bind_texture;
|
||||||
} add_vertices;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int m_texture_index;
|
float m_color[4];
|
||||||
} bind_texture;
|
} set_color;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
float m_color[4];
|
int m_depth_func;
|
||||||
} set_color;
|
} set_depth_func;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int m_depth_func;
|
bool m_enable;
|
||||||
} set_depth_func;
|
} set_depth_mask;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool m_enable;
|
bool m_enable;
|
||||||
} set_depth_mask;
|
} set_depth_test;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool m_enable;
|
bool m_enable;
|
||||||
} set_depth_test;
|
} set_lighting_enable;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool m_enable;
|
int m_light_index;
|
||||||
} set_lighting_enable;
|
bool m_enable;
|
||||||
|
} set_light_enable;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int m_light_index;
|
int m_light_index;
|
||||||
bool m_enable;
|
float padding[3];
|
||||||
} set_light_enable;
|
float m_direction[4];
|
||||||
|
} set_light_direction;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int m_light_index;
|
int m_light_index;
|
||||||
float padding[3];
|
float m_color[3];
|
||||||
float m_direction[4];
|
} set_light_colour;
|
||||||
} set_light_direction;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int m_light_index;
|
BYTE padding;
|
||||||
float m_color[3];
|
float m_color[3];
|
||||||
} set_light_colour;
|
} set_light_ambient_colour;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
BYTE padding;
|
bool m_enable;
|
||||||
float m_color[3];
|
} set_blend_enable;
|
||||||
} set_light_ambient_colour;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool m_enable;
|
int m_src;
|
||||||
} set_blend_enable;
|
int m_dst;
|
||||||
|
} set_blend_func;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int m_src;
|
unsigned int m_blend_factor;
|
||||||
int m_dst;
|
} set_blend_factor;
|
||||||
} set_blend_func;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int m_blend_factor;
|
bool m_enable;
|
||||||
} set_blend_factor;
|
} set_face_cull;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
ID3D11Buffer *m_vertexBuffer;
|
||||||
|
void *m_vertexData;
|
||||||
|
std::uint64_t m_vertexDataLength;
|
||||||
|
std::vector<Command> m_commands;
|
||||||
|
std::uint64_t m_allocated;
|
||||||
|
BYTE isActive;
|
||||||
|
BYTE paddingAfterActive[7];
|
||||||
|
};
|
||||||
|
|
||||||
struct
|
struct DeferredCBuff
|
||||||
{
|
{
|
||||||
bool m_enable;
|
Renderer::CommandBuffer *m_command_buf;
|
||||||
} set_face_cull;
|
int m_vertex_index;
|
||||||
};
|
int m_vertex_type;
|
||||||
};
|
int m_primitive_type;
|
||||||
ID3D11Buffer* m_vertexBuffer;
|
DirectX::XMMATRIX m_matrix;
|
||||||
void* m_vertexData;
|
};
|
||||||
std::uint64_t m_vertexDataLength;
|
|
||||||
std::vector<Command> m_commands;
|
|
||||||
std::uint64_t m_allocated;
|
|
||||||
BYTE isActive;
|
|
||||||
BYTE paddingAfterActive[7];
|
|
||||||
|
|
||||||
|
struct Context
|
||||||
|
{
|
||||||
|
Context(ID3D11Device *device, ID3D11DeviceContext *deviceContext);
|
||||||
|
ID3D11DeviceContext *m_pDeviceContext;
|
||||||
|
ID3DUserDefinedAnnotation *userAnnotation;
|
||||||
|
DWORD contextStateFlags;
|
||||||
|
BYTE paddingAfterFlags[12];
|
||||||
|
DirectX::XMMATRIX matrixStacks[4][16];
|
||||||
|
bool matrixDirty[4];
|
||||||
|
DWORD matrixStackDepth[4];
|
||||||
|
DWORD matrixModeType;
|
||||||
|
DWORD boundTextureIndex;
|
||||||
|
BYTE faceCullEnabled;
|
||||||
|
BYTE depthTestEnabled;
|
||||||
|
BYTE alphaTestEnabled;
|
||||||
|
float alphaReference;
|
||||||
|
BYTE depthWriteEnabled;
|
||||||
|
BYTE fogEnabled;
|
||||||
|
BYTE paddingAfterFogFlags[2];
|
||||||
|
float fogNearDistance;
|
||||||
|
float fogFarDistance;
|
||||||
|
float fogDensity;
|
||||||
|
float fogColourRed;
|
||||||
|
float fogColourBlue;
|
||||||
|
float fogColourGreen;
|
||||||
|
DWORD fogMode;
|
||||||
|
BYTE lightingEnabled;
|
||||||
|
BYTE lightEnabled[2];
|
||||||
|
BYTE lightingDirty;
|
||||||
|
DWORD forcedLOD;
|
||||||
|
BYTE paddingAfterForceLOD[4];
|
||||||
|
DirectX::XMFLOAT4 lightDirection[2];
|
||||||
|
DirectX::XMFLOAT4 lightColour[2];
|
||||||
|
DirectX::XMFLOAT4 lightAmbientColour;
|
||||||
|
ID3D11Buffer *cbMatrix0;
|
||||||
|
ID3D11Buffer *cbMatrix1;
|
||||||
|
ID3D11Buffer *cbMatrix2;
|
||||||
|
ID3D11Buffer *cbMatrix3;
|
||||||
|
ID3D11Buffer *cbVertexTexcoord;
|
||||||
|
ID3D11Buffer *cbFogParams;
|
||||||
|
ID3D11Buffer *cbLighting;
|
||||||
|
ID3D11Buffer *cbTexGen;
|
||||||
|
ID3D11Buffer *cbAux0;
|
||||||
|
ID3D11Buffer *cbAux1;
|
||||||
|
ID3D11Buffer *cbColour;
|
||||||
|
ID3D11Buffer *cbFogColour;
|
||||||
|
ID3D11Buffer *cbAux2;
|
||||||
|
ID3D11Buffer *cbAlphaTest;
|
||||||
|
ID3D11Buffer *cbAux3;
|
||||||
|
ID3D11Buffer *cbAux4;
|
||||||
|
uint64_t dynamicVertexBase;
|
||||||
|
DWORD dynamicVertexOffset;
|
||||||
|
BYTE paddingAfterDynamicOffset[4];
|
||||||
|
ID3D11Buffer *dynamicVertexBuffer;
|
||||||
|
BYTE paddingBeforeTexGen[8];
|
||||||
|
DirectX::XMMATRIX texGenMatrices[2];
|
||||||
|
Renderer::CommandBuffer *commandBuffer;
|
||||||
|
DWORD recordingBufferIndex;
|
||||||
|
DWORD recordingVertexType;
|
||||||
|
DWORD recordingPrimitiveType;
|
||||||
|
BYTE deferredModeEnabled;
|
||||||
|
BYTE paddingAfterDeferredModeEnabled[3];
|
||||||
|
std::vector<DeferredCBuff> deferredBuffers;
|
||||||
|
D3D11_BLEND_DESC blendDesc;
|
||||||
|
D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
|
||||||
|
D3D11_RASTERIZER_DESC rasterizerDesc;
|
||||||
|
float blendFactor[4];
|
||||||
|
DWORD reservedContext0;
|
||||||
|
DWORD reservedContext1;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
static DWORD tlsIdx;
|
||||||
|
static unsigned int s_auiWidths[MAX_MIP_LEVELS + 1];
|
||||||
|
static unsigned int s_auiHeights[MAX_MIP_LEVELS + 1];
|
||||||
|
static D3D11_INPUT_ELEMENT_DESC g_vertex_PTN_Elements_PF3_TF2_CB4_NB4_XW1[5];
|
||||||
|
static D3D11_INPUT_ELEMENT_DESC g_vertex_PTN_Elements_Compressed[2];
|
||||||
|
static D3D11_PRIMITIVE_TOPOLOGY g_topologies[C4JRender::PRIMITIVE_TYPE_COUNT];
|
||||||
|
static int totalAlloc;
|
||||||
|
static _RTL_CRITICAL_SECTION totalAllocCS;
|
||||||
|
|
||||||
struct DeferredCBuff
|
float m_fClearColor[4];
|
||||||
{
|
ID3D11Device *m_pDevice;
|
||||||
Renderer::CommandBuffer* m_command_buf;
|
ID3D11DeviceContext *m_pDeviceContext;
|
||||||
int m_vertex_index;
|
IDXGISwapChain *m_pSwapChain;
|
||||||
int m_vertex_type;
|
ID3D11RenderTargetView *renderTargetView;
|
||||||
int m_primitive_type;
|
ID3D11RenderTargetView *renderTargetViews[4];
|
||||||
DirectX::XMMATRIX m_matrix;
|
ID3D11ShaderResourceView *renderTargetShaderResourceView;
|
||||||
};
|
ID3D11ShaderResourceView *renderTargetShaderResourceViews[4];
|
||||||
|
ID3D11Texture2D *renderTargetTextures[4];
|
||||||
struct Context
|
ID3D11DepthStencilView *depthStencilView;
|
||||||
{
|
ID3D11VertexShader **vertexShaderTable;
|
||||||
Context(ID3D11Device* device, ID3D11DeviceContext* deviceContext);
|
ID3D11VertexShader *screenSpaceVertexShader;
|
||||||
ID3D11DeviceContext* m_pDeviceContext;
|
ID3D11VertexShader *screenClearVertexShader;
|
||||||
ID3DUserDefinedAnnotation* userAnnotation;
|
ID3D11PixelShader **pixelShaderTable;
|
||||||
DWORD contextStateFlags;
|
ID3D11PixelShader *screenSpacePixelShader;
|
||||||
BYTE paddingAfterFlags[12];
|
ID3D11PixelShader *screenClearPixelShader;
|
||||||
DirectX::XMMATRIX matrixStacks[4][16];
|
unsigned int *vertexStrideTable;
|
||||||
bool matrixDirty[4];
|
ID3D11InputLayout **inputLayoutTable;
|
||||||
DWORD matrixStackDepth[4];
|
ID3D11Buffer *quadIndexBuffer;
|
||||||
DWORD matrixModeType;
|
ID3D11Buffer *fanIndexBuffer;
|
||||||
DWORD boundTextureIndex;
|
DWORD defaultTextureIndex;
|
||||||
BYTE faceCullEnabled;
|
WORD reservedRendererWord0;
|
||||||
BYTE depthTestEnabled;
|
BYTE paddingAfterRendererWord0[2];
|
||||||
BYTE alphaTestEnabled;
|
DWORD presentCount;
|
||||||
float alphaReference;
|
BYTE rendererFlag0;
|
||||||
BYTE depthWriteEnabled;
|
BYTE paddingAfterRendererFlag0[3];
|
||||||
BYTE fogEnabled;
|
_RTL_CRITICAL_SECTION rtl_critical_section100;
|
||||||
BYTE paddingAfterFogFlags[2];
|
DWORD activeVertexType;
|
||||||
float fogNearDistance;
|
DWORD activePixelType;
|
||||||
float fogFarDistance;
|
C4JRender::eViewportType m_ViewportType;
|
||||||
float fogDensity;
|
BYTE reservedRendererByte0;
|
||||||
float fogColourRed;
|
BYTE paddingAfterViewportType[3];
|
||||||
float fogColourBlue;
|
Renderer::Texture m_textures[512];
|
||||||
float fogColourGreen;
|
DWORD backBufferWidth;
|
||||||
DWORD fogMode;
|
DWORD backBufferHeight;
|
||||||
BYTE lightingEnabled;
|
BYTE reservedRendererByte1;
|
||||||
BYTE lightEnabled[2];
|
BYTE paddingAfterRendererByte1[3];
|
||||||
BYTE lightingDirty;
|
DWORD reservedRendererDword1;
|
||||||
DWORD forcedLOD;
|
void *reservedRendererPtr2;
|
||||||
BYTE paddingAfterForceLOD[4];
|
void *reservedRendererPtr3;
|
||||||
DirectX::XMFLOAT4 lightDirection[2];
|
uint64_t reservedRendererPtr1;
|
||||||
DirectX::XMFLOAT4 lightColour[2];
|
void *reservedRendererPtr4;
|
||||||
DirectX::XMFLOAT4 lightAmbientColour;
|
void *reservedRendererPtr5;
|
||||||
ID3D11Buffer* cbMatrix0;
|
void *reservedRendererPtr6;
|
||||||
ID3D11Buffer* cbMatrix1;
|
DWORD reservedRendererDword2;
|
||||||
ID3D11Buffer* cbMatrix2;
|
DWORD reservedRendererDword3;
|
||||||
ID3D11Buffer* cbMatrix3;
|
std::unordered_map<int, ID3D11BlendState *> managedBlendStates;
|
||||||
ID3D11Buffer* cbVertexTexcoord;
|
std::unordered_map<int, ID3D11DepthStencilState *> managedDepthStencilStates;
|
||||||
ID3D11Buffer* cbFogParams;
|
std::unordered_map<int, ID3D11SamplerState *> managedSamplerStates;
|
||||||
ID3D11Buffer* cbLighting;
|
std::unordered_map<int, ID3D11RasterizerState *> managedRasterizerStates;
|
||||||
ID3D11Buffer* cbTexGen;
|
BYTE shouldScreenGrabNextFrame;
|
||||||
ID3D11Buffer* cbAux0;
|
BYTE suspended;
|
||||||
ID3D11Buffer* cbAux1;
|
BYTE paddingAfterSuspendState[2];
|
||||||
ID3D11Buffer* cbColour;
|
|
||||||
ID3D11Buffer* cbFogColour;
|
|
||||||
ID3D11Buffer* cbAux2;
|
|
||||||
ID3D11Buffer* cbAlphaTest;
|
|
||||||
ID3D11Buffer* cbAux3;
|
|
||||||
ID3D11Buffer* cbAux4;
|
|
||||||
uint64_t dynamicVertexBase;
|
|
||||||
DWORD dynamicVertexOffset;
|
|
||||||
BYTE paddingAfterDynamicOffset[4];
|
|
||||||
ID3D11Buffer* dynamicVertexBuffer;
|
|
||||||
BYTE paddingBeforeTexGen[8];
|
|
||||||
DirectX::XMMATRIX texGenMatrices[2];
|
|
||||||
Renderer::CommandBuffer* commandBuffer;
|
|
||||||
DWORD recordingBufferIndex;
|
|
||||||
DWORD recordingVertexType;
|
|
||||||
DWORD recordingPrimitiveType;
|
|
||||||
BYTE deferredModeEnabled;
|
|
||||||
BYTE paddingAfterDeferredModeEnabled[3];
|
|
||||||
std::vector<DeferredCBuff> deferredBuffers;
|
|
||||||
D3D11_BLEND_DESC blendDesc;
|
|
||||||
D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
|
|
||||||
D3D11_RASTERIZER_DESC rasterizerDesc;
|
|
||||||
float blendFactor[4];
|
|
||||||
DWORD reservedContext0;
|
|
||||||
DWORD reservedContext1;
|
|
||||||
};
|
|
||||||
|
|
||||||
static DWORD tlsIdx;
|
|
||||||
static unsigned int s_auiWidths[MAX_MIP_LEVELS + 1];
|
|
||||||
static unsigned int s_auiHeights[MAX_MIP_LEVELS + 1];
|
|
||||||
static D3D11_INPUT_ELEMENT_DESC g_vertex_PTN_Elements_PF3_TF2_CB4_NB4_XW1[5];
|
|
||||||
static D3D11_INPUT_ELEMENT_DESC g_vertex_PTN_Elements_Compressed[2];
|
|
||||||
static D3D11_PRIMITIVE_TOPOLOGY g_topologies[C4JRender::PRIMITIVE_TYPE_COUNT];
|
|
||||||
static int totalAlloc;
|
|
||||||
static _RTL_CRITICAL_SECTION totalAllocCS;
|
|
||||||
|
|
||||||
float m_fClearColor[4];
|
|
||||||
ID3D11Device* m_pDevice;
|
|
||||||
ID3D11DeviceContext* m_pDeviceContext;
|
|
||||||
IDXGISwapChain* m_pSwapChain;
|
|
||||||
ID3D11RenderTargetView* renderTargetView;
|
|
||||||
ID3D11RenderTargetView* renderTargetViews[4];
|
|
||||||
ID3D11ShaderResourceView* renderTargetShaderResourceView;
|
|
||||||
ID3D11ShaderResourceView* renderTargetShaderResourceViews[4];
|
|
||||||
ID3D11Texture2D* renderTargetTextures[4];
|
|
||||||
ID3D11DepthStencilView* depthStencilView;
|
|
||||||
ID3D11VertexShader** vertexShaderTable;
|
|
||||||
ID3D11VertexShader* screenSpaceVertexShader;
|
|
||||||
ID3D11VertexShader* screenClearVertexShader;
|
|
||||||
ID3D11PixelShader** pixelShaderTable;
|
|
||||||
ID3D11PixelShader* screenSpacePixelShader;
|
|
||||||
ID3D11PixelShader* screenClearPixelShader;
|
|
||||||
unsigned int* vertexStrideTable;
|
|
||||||
ID3D11InputLayout** inputLayoutTable;
|
|
||||||
ID3D11Buffer* quadIndexBuffer;
|
|
||||||
ID3D11Buffer* fanIndexBuffer;
|
|
||||||
DWORD defaultTextureIndex;
|
|
||||||
WORD reservedRendererWord0;
|
|
||||||
BYTE paddingAfterRendererWord0[2];
|
|
||||||
DWORD presentCount;
|
|
||||||
BYTE rendererFlag0;
|
|
||||||
BYTE paddingAfterRendererFlag0[3];
|
|
||||||
_RTL_CRITICAL_SECTION rtl_critical_section100;
|
|
||||||
DWORD activeVertexType;
|
|
||||||
DWORD activePixelType;
|
|
||||||
C4JRender::eViewportType m_ViewportType;
|
|
||||||
BYTE reservedRendererByte0;
|
|
||||||
BYTE paddingAfterViewportType[3];
|
|
||||||
Renderer::Texture m_textures[512];
|
|
||||||
DWORD backBufferWidth;
|
|
||||||
DWORD backBufferHeight;
|
|
||||||
BYTE reservedRendererByte1;
|
|
||||||
BYTE paddingAfterRendererByte1[3];
|
|
||||||
DWORD reservedRendererDword1;
|
|
||||||
void* reservedRendererPtr2;
|
|
||||||
void* reservedRendererPtr3;
|
|
||||||
uint64_t reservedRendererPtr1;
|
|
||||||
void* reservedRendererPtr4;
|
|
||||||
void* reservedRendererPtr5;
|
|
||||||
void* reservedRendererPtr6;
|
|
||||||
DWORD reservedRendererDword2;
|
|
||||||
DWORD reservedRendererDword3;
|
|
||||||
std::unordered_map<int, ID3D11BlendState*> managedBlendStates;
|
|
||||||
std::unordered_map<int, ID3D11DepthStencilState*> managedDepthStencilStates;
|
|
||||||
std::unordered_map<int, ID3D11SamplerState*> managedSamplerStates;
|
|
||||||
std::unordered_map<int, ID3D11RasterizerState*> managedRasterizerStates;
|
|
||||||
BYTE shouldScreenGrabNextFrame;
|
|
||||||
BYTE suspended;
|
|
||||||
BYTE paddingAfterSuspendState[2];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Singleton
|
// Singleton
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -3,109 +3,109 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
const float* Renderer::MatrixGet(int type)
|
const float *Renderer::MatrixGet(int type)
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
const int depth = context.matrixStackDepth[type];
|
const int depth = context.matrixStackDepth[type];
|
||||||
return reinterpret_cast<const float*>(&context.matrixStacks[type][depth]);
|
return reinterpret_cast<const float *>(&context.matrixStacks[type][depth]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixMode(int type)
|
void Renderer::MatrixMode(int type)
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
context.matrixModeType = type;
|
context.matrixModeType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixMult(float* mat)
|
void Renderer::MatrixMult(float *mat)
|
||||||
{
|
{
|
||||||
DirectX::XMMATRIX matrix;
|
DirectX::XMMATRIX matrix;
|
||||||
std::memcpy(&matrix, mat, sizeof(matrix));
|
std::memcpy(&matrix, mat, sizeof(matrix));
|
||||||
this->MultWithStack(matrix);
|
this->MultWithStack(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar)
|
void Renderer::MatrixOrthogonal(float left, float right, float bottom, float top, float zNear, float zFar)
|
||||||
{
|
{
|
||||||
const DirectX::XMMATRIX matrix = DirectX::XMMatrixOrthographicOffCenterRH(left, right, bottom, top, zNear, zFar);
|
const DirectX::XMMATRIX matrix = DirectX::XMMatrixOrthographicOffCenterRH(left, right, bottom, top, zNear, zFar);
|
||||||
this->MultWithStack(matrix);
|
this->MultWithStack(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixPerspective(float fovy, float aspect, float zNear, float zFar)
|
void Renderer::MatrixPerspective(float fovy, float aspect, float zNear, float zFar)
|
||||||
{
|
{
|
||||||
const float fovRadians = fovy * (3.14159274f / 180.0f);
|
const float fovRadians = fovy * (3.14159274f / 180.0f);
|
||||||
const DirectX::XMMATRIX matrix = DirectX::XMMatrixPerspectiveFovRH(fovRadians, aspect, zNear, zFar);
|
const DirectX::XMMATRIX matrix = DirectX::XMMatrixPerspectiveFovRH(fovRadians, aspect, zNear, zFar);
|
||||||
this->MultWithStack(matrix);
|
this->MultWithStack(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixPop()
|
void Renderer::MatrixPop()
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
const int mode = context.matrixModeType;
|
const int mode = context.matrixModeType;
|
||||||
--context.matrixStackDepth[mode];
|
--context.matrixStackDepth[mode];
|
||||||
context.matrixDirty[mode] = true;
|
context.matrixDirty[mode] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixPush()
|
void Renderer::MatrixPush()
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
const int mode = context.matrixModeType;
|
const int mode = context.matrixModeType;
|
||||||
const int depth = context.matrixStackDepth[mode];
|
const int depth = context.matrixStackDepth[mode];
|
||||||
context.matrixStacks[mode][depth + 1] = context.matrixStacks[mode][depth];
|
context.matrixStacks[mode][depth + 1] = context.matrixStacks[mode][depth];
|
||||||
++context.matrixStackDepth[mode];
|
++context.matrixStackDepth[mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixRotate(float angle, float x, float y, float z)
|
void Renderer::MatrixRotate(float angle, float x, float y, float z)
|
||||||
{
|
{
|
||||||
const DirectX::XMVECTOR axis = DirectX::XMVectorSet(x, y, z, 0.0f);
|
const DirectX::XMVECTOR axis = DirectX::XMVectorSet(x, y, z, 0.0f);
|
||||||
const DirectX::XMMATRIX matrix = DirectX::XMMatrixRotationAxis(axis, angle);
|
const DirectX::XMMATRIX matrix = DirectX::XMMatrixRotationAxis(axis, angle);
|
||||||
this->MultWithStack(matrix);
|
this->MultWithStack(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixScale(float x, float y, float z)
|
void Renderer::MatrixScale(float x, float y, float z)
|
||||||
{
|
{
|
||||||
const DirectX::XMMATRIX matrix = DirectX::XMMatrixScaling(x, y, z);
|
const DirectX::XMMATRIX matrix = DirectX::XMMatrixScaling(x, y, z);
|
||||||
this->MultWithStack(matrix);
|
this->MultWithStack(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixSetIdentity()
|
void Renderer::MatrixSetIdentity()
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
const int mode = context.matrixModeType;
|
const int mode = context.matrixModeType;
|
||||||
const int depth = context.matrixStackDepth[mode];
|
const int depth = context.matrixStackDepth[mode];
|
||||||
context.matrixStacks[mode][depth] = DirectX::XMMatrixIdentity();
|
context.matrixStacks[mode][depth] = DirectX::XMMatrixIdentity();
|
||||||
context.matrixDirty[mode] = true;
|
context.matrixDirty[mode] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MatrixTranslate(float x, float y, float z)
|
void Renderer::MatrixTranslate(float x, float y, float z)
|
||||||
{
|
{
|
||||||
const DirectX::XMMATRIX matrix = DirectX::XMMatrixTranslation(x, y, z);
|
const DirectX::XMMATRIX matrix = DirectX::XMMatrixTranslation(x, y, z);
|
||||||
this->MultWithStack(matrix);
|
this->MultWithStack(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::MultWithStack(DirectX::XMMATRIX matrix)
|
void Renderer::MultWithStack(DirectX::XMMATRIX matrix)
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
const int mode = context.matrixModeType;
|
const int mode = context.matrixModeType;
|
||||||
const int depth = context.matrixStackDepth[mode];
|
const int depth = context.matrixStackDepth[mode];
|
||||||
DirectX::XMMATRIX& current = context.matrixStacks[mode][depth];
|
DirectX::XMMATRIX ¤t = context.matrixStacks[mode][depth];
|
||||||
current = DirectX::XMMatrixMultiply(matrix, current);
|
current = DirectX::XMMatrixMultiply(matrix, current);
|
||||||
context.matrixDirty[mode] = true;
|
context.matrixDirty[mode] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Set_matrixDirty()
|
void Renderer::Set_matrixDirty()
|
||||||
{
|
{
|
||||||
Context& context = this->getContext();
|
Context &context = this->getContext();
|
||||||
const DirectX::XMMATRIX identity = DirectX::XMMatrixIdentity();
|
const DirectX::XMMATRIX identity = DirectX::XMMatrixIdentity();
|
||||||
|
|
||||||
context.matrixStacks[0][0] = identity;
|
context.matrixStacks[0][0] = identity;
|
||||||
context.matrixStacks[1][0] = identity;
|
context.matrixStacks[1][0] = identity;
|
||||||
context.matrixStacks[2][0] = identity;
|
context.matrixStacks[2][0] = identity;
|
||||||
context.matrixStacks[3][0] = identity;
|
context.matrixStacks[3][0] = identity;
|
||||||
|
|
||||||
context.matrixDirty[0] = true;
|
context.matrixDirty[0] = true;
|
||||||
context.matrixDirty[1] = true;
|
context.matrixDirty[1] = true;
|
||||||
context.matrixDirty[2] = true;
|
context.matrixDirty[2] = true;
|
||||||
context.matrixDirty[3] = true;
|
context.matrixDirty[3] = true;
|
||||||
|
|
||||||
activeVertexType = 0xFFFFFFFFu;
|
activeVertexType = 0xFFFFFFFFu;
|
||||||
activePixelType = 0xFFFFFFFFu;
|
activePixelType = 0xFFFFFFFFu;
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -11,319 +11,348 @@ DXGI_FORMAT Renderer::textureFormats[C4JRender::MAX_TEXTURE_FORMATS] = {
|
|||||||
DXGI_FORMAT_B8G8R8A8_UNORM,
|
DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||||
};
|
};
|
||||||
|
|
||||||
int Renderer::TextureCreate() {
|
int Renderer::TextureCreate()
|
||||||
for (int i = 0; i < 512; ++i) {
|
{
|
||||||
Texture &texture = m_textures[i];
|
for (int i = 0; i < 512; ++i)
|
||||||
if (!texture.allocated) {
|
{
|
||||||
texture.texture = nullptr;
|
Texture &texture = m_textures[i];
|
||||||
texture.allocated = true;
|
if (!texture.allocated)
|
||||||
texture.mipLevels = 1;
|
{
|
||||||
texture.samplerParams = 0;
|
texture.texture = nullptr;
|
||||||
return i;
|
texture.allocated = true;
|
||||||
|
texture.mipLevels = 1;
|
||||||
|
texture.samplerParams = 0;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureSetTextureLevels(int levels) {
|
void Renderer::TextureSetTextureLevels(int levels)
|
||||||
const int boundTextureIndex = this->getContext().boundTextureIndex;
|
{
|
||||||
m_textures[boundTextureIndex].mipLevels = levels;
|
const int boundTextureIndex = this->getContext().boundTextureIndex;
|
||||||
|
m_textures[boundTextureIndex].mipLevels = levels;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Renderer::TextureGetTextureLevels() {
|
int Renderer::TextureGetTextureLevels()
|
||||||
const int boundTextureIndex = this->getContext().boundTextureIndex;
|
{
|
||||||
return m_textures[boundTextureIndex].mipLevels;
|
const int boundTextureIndex = this->getContext().boundTextureIndex;
|
||||||
|
return m_textures[boundTextureIndex].mipLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureSetParam(int param, int value) {
|
void Renderer::TextureSetParam(int param, int value)
|
||||||
Texture &texture = m_textures[this->getContext().boundTextureIndex];
|
{
|
||||||
|
Texture &texture = m_textures[this->getContext().boundTextureIndex];
|
||||||
|
|
||||||
switch (param) {
|
switch (param)
|
||||||
case GL_TEXTURE_MIN_FILTER:
|
{
|
||||||
texture.samplerParams &= ~4u;
|
case GL_TEXTURE_MIN_FILTER:
|
||||||
if (value == 1) {
|
texture.samplerParams &= ~4u;
|
||||||
texture.samplerParams |= 4u;
|
if (value == 1)
|
||||||
|
{
|
||||||
|
texture.samplerParams |= 4u;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_MAG_FILTER:
|
||||||
|
texture.samplerParams &= ~8u;
|
||||||
|
if (value == 1)
|
||||||
|
{
|
||||||
|
texture.samplerParams |= 8u;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_WRAP_S:
|
||||||
|
texture.samplerParams &= ~1u;
|
||||||
|
if (value == 0)
|
||||||
|
{
|
||||||
|
texture.samplerParams |= 1u;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_WRAP_T:
|
||||||
|
case 5:
|
||||||
|
texture.samplerParams &= ~2u;
|
||||||
|
if (value == 0)
|
||||||
|
{
|
||||||
|
texture.samplerParams |= 2u;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case GL_TEXTURE_MAG_FILTER:
|
|
||||||
texture.samplerParams &= ~8u;
|
|
||||||
if (value == 1) {
|
|
||||||
texture.samplerParams |= 8u;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_TEXTURE_WRAP_S:
|
|
||||||
texture.samplerParams &= ~1u;
|
|
||||||
if (value == 0) {
|
|
||||||
texture.samplerParams |= 1u;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_TEXTURE_WRAP_T:
|
|
||||||
case 5:
|
|
||||||
texture.samplerParams &= ~2u;
|
|
||||||
if (value == 0) {
|
|
||||||
texture.samplerParams |= 2u;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureDynamicUpdateStart() {}
|
void Renderer::TextureDynamicUpdateStart() {}
|
||||||
|
|
||||||
void Renderer::TextureDynamicUpdateEnd() {}
|
void Renderer::TextureDynamicUpdateEnd() {}
|
||||||
|
|
||||||
void Renderer::TextureData(int width, int height, void *data, int level,
|
void Renderer::TextureData(int width, int height, void *data, int level, C4JRender::eTextureFormat format)
|
||||||
C4JRender::eTextureFormat format) {
|
{
|
||||||
Renderer::Context &context = this->getContext();
|
Renderer::Context &context = this->getContext();
|
||||||
Texture &texture = m_textures[context.boundTextureIndex];
|
Texture &texture = m_textures[context.boundTextureIndex];
|
||||||
texture.textureFormat = format;
|
texture.textureFormat = format;
|
||||||
|
|
||||||
|
if (level == 0)
|
||||||
|
{
|
||||||
|
D3D11_TEXTURE2D_DESC desc = {};
|
||||||
|
desc.Width = width;
|
||||||
|
desc.Height = height;
|
||||||
|
desc.MipLevels = texture.mipLevels;
|
||||||
|
desc.ArraySize = 1;
|
||||||
|
desc.Format = textureFormats[format];
|
||||||
|
desc.SampleDesc.Count = 1;
|
||||||
|
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||||
|
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||||
|
m_pDevice->CreateTexture2D(&desc, nullptr, &texture.texture);
|
||||||
|
m_pDevice->CreateShaderResourceView(texture.texture, nullptr, &texture.view);
|
||||||
|
}
|
||||||
|
|
||||||
|
const UINT rowPitch = width * 4u;
|
||||||
|
const UINT depthPitch = width * height * 4u;
|
||||||
|
context.m_pDeviceContext->UpdateSubresource(texture.texture, level, nullptr, data, rowPitch, depthPitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::TextureDataUpdate(int xoffset, int yoffset, int width, int height, void *data, int level)
|
||||||
|
{
|
||||||
|
Renderer::Context &context = this->getContext();
|
||||||
|
Texture &texture = m_textures[context.boundTextureIndex];
|
||||||
|
|
||||||
|
D3D11_BOX box = {};
|
||||||
|
box.left = xoffset;
|
||||||
|
box.right = xoffset + width;
|
||||||
|
box.top = yoffset;
|
||||||
|
box.bottom = yoffset + height;
|
||||||
|
box.front = 0;
|
||||||
|
box.back = 1;
|
||||||
|
|
||||||
if (level == 0) {
|
|
||||||
D3D11_TEXTURE2D_DESC desc = {};
|
D3D11_TEXTURE2D_DESC desc = {};
|
||||||
desc.Width = width;
|
texture.texture->GetDesc(&desc);
|
||||||
desc.Height = height;
|
|
||||||
desc.MipLevels = texture.mipLevels;
|
|
||||||
desc.ArraySize = 1;
|
|
||||||
desc.Format = textureFormats[format];
|
|
||||||
desc.SampleDesc.Count = 1;
|
|
||||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
|
||||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
|
||||||
m_pDevice->CreateTexture2D(&desc, nullptr, &texture.texture);
|
|
||||||
m_pDevice->CreateShaderResourceView(texture.texture, nullptr,
|
|
||||||
&texture.view);
|
|
||||||
}
|
|
||||||
|
|
||||||
const UINT rowPitch = width * 4u;
|
const UINT rowPitch = width * 4u;
|
||||||
const UINT depthPitch = width * height * 4u;
|
const UINT depthPitch = width * height * 4u;
|
||||||
context.m_pDeviceContext->UpdateSubresource(texture.texture, level, nullptr,
|
context.m_pDeviceContext->UpdateSubresource(texture.texture, level, &box, data, rowPitch, depthPitch);
|
||||||
data, rowPitch, depthPitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureDataUpdate(int xoffset, int yoffset, int width,
|
void Renderer::TextureFree(int idx)
|
||||||
int height, void *data, int level) {
|
{
|
||||||
Renderer::Context &context = this->getContext();
|
Texture &texture = m_textures[idx];
|
||||||
Texture &texture = m_textures[context.boundTextureIndex];
|
texture.texture->Release();
|
||||||
|
texture.view->Release();
|
||||||
D3D11_BOX box = {};
|
texture.view = nullptr;
|
||||||
box.left = xoffset;
|
texture.allocated = false;
|
||||||
box.right = xoffset + width;
|
texture.texture = nullptr;
|
||||||
box.top = yoffset;
|
|
||||||
box.bottom = yoffset + height;
|
|
||||||
box.front = 0;
|
|
||||||
box.back = 1;
|
|
||||||
|
|
||||||
D3D11_TEXTURE2D_DESC desc = {};
|
|
||||||
texture.texture->GetDesc(&desc);
|
|
||||||
|
|
||||||
const UINT rowPitch = width * 4u;
|
|
||||||
const UINT depthPitch = width * height * 4u;
|
|
||||||
context.m_pDeviceContext->UpdateSubresource(texture.texture, level, &box,
|
|
||||||
data, rowPitch, depthPitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Renderer::TextureFree(int idx) {
|
|
||||||
Texture &texture = m_textures[idx];
|
|
||||||
texture.texture->Release();
|
|
||||||
texture.view->Release();
|
|
||||||
texture.view = nullptr;
|
|
||||||
texture.allocated = false;
|
|
||||||
texture.texture = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureGetStats() {}
|
void Renderer::TextureGetStats() {}
|
||||||
|
|
||||||
ID3D11ShaderResourceView *Renderer::TextureGetTexture(int idx) {
|
ID3D11ShaderResourceView *Renderer::TextureGetTexture(int idx)
|
||||||
if (idx < 0 || idx > 0x1FF) {
|
{
|
||||||
return nullptr;
|
if (idx < 0 || idx > 0x1FF)
|
||||||
}
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const Texture &texture = m_textures[idx];
|
const Texture &texture = m_textures[idx];
|
||||||
if (!texture.allocated) {
|
if (!texture.allocated)
|
||||||
return nullptr;
|
{
|
||||||
}
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return texture.view;
|
return texture.view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureBind(int idx) {
|
void Renderer::TextureBind(int idx)
|
||||||
int textureIndex = idx;
|
{
|
||||||
if (textureIndex == -1) {
|
int textureIndex = idx;
|
||||||
textureIndex = defaultTextureIndex;
|
if (textureIndex == -1)
|
||||||
}
|
{
|
||||||
|
textureIndex = defaultTextureIndex;
|
||||||
|
}
|
||||||
|
|
||||||
Renderer::Context &context = this->getContext();
|
Renderer::Context &context = this->getContext();
|
||||||
|
|
||||||
if (context.commandBuffer && context.commandBuffer->isActive) {
|
if (context.commandBuffer && context.commandBuffer->isActive)
|
||||||
context.commandBuffer->BindTexture(textureIndex);
|
{
|
||||||
}
|
context.commandBuffer->BindTexture(textureIndex);
|
||||||
|
}
|
||||||
|
|
||||||
context.boundTextureIndex = textureIndex;
|
context.boundTextureIndex = textureIndex;
|
||||||
ID3D11ShaderResourceView *const view = m_textures[textureIndex].view;
|
ID3D11ShaderResourceView *const view = m_textures[textureIndex].view;
|
||||||
context.m_pDeviceContext->PSSetShaderResources(0, 1, &view);
|
context.m_pDeviceContext->PSSetShaderResources(0, 1, &view);
|
||||||
this->UpdateTextureState(false);
|
this->UpdateTextureState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::TextureBindVertex(int idx) {
|
void Renderer::TextureBindVertex(int idx)
|
||||||
int textureIndex = idx;
|
{
|
||||||
if (textureIndex == -1) {
|
int textureIndex = idx;
|
||||||
textureIndex = defaultTextureIndex;
|
if (textureIndex == -1)
|
||||||
}
|
{
|
||||||
|
textureIndex = defaultTextureIndex;
|
||||||
|
}
|
||||||
|
|
||||||
Renderer::Context &context = this->getContext();
|
Renderer::Context &context = this->getContext();
|
||||||
context.boundTextureIndex = textureIndex;
|
context.boundTextureIndex = textureIndex;
|
||||||
|
|
||||||
ID3D11ShaderResourceView *const view = m_textures[textureIndex].view;
|
ID3D11ShaderResourceView *const view = m_textures[textureIndex].view;
|
||||||
context.m_pDeviceContext->VSSetShaderResources(0, 1, &view);
|
context.m_pDeviceContext->VSSetShaderResources(0, 1, &view);
|
||||||
this->UpdateTextureState(true);
|
this->UpdateTextureState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::UpdateTextureState(bool vertexSampler) {
|
void Renderer::UpdateTextureState(bool vertexSampler)
|
||||||
Renderer::Context &context = this->getContext();
|
{
|
||||||
ID3D11SamplerState *sampler = this->GetManagedSamplerState();
|
Renderer::Context &context = this->getContext();
|
||||||
|
ID3D11SamplerState *sampler = this->GetManagedSamplerState();
|
||||||
|
|
||||||
if (vertexSampler) {
|
if (vertexSampler)
|
||||||
context.m_pDeviceContext->VSSetSamplers(0, 1, &sampler);
|
{
|
||||||
} else {
|
context.m_pDeviceContext->VSSetSamplers(0, 1, &sampler);
|
||||||
context.m_pDeviceContext->PSSetSamplers(0, 1, &sampler);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
context.m_pDeviceContext->PSSetSamplers(0, 1, &sampler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Renderer::LoadTextureData(const char *szFilename,
|
HRESULT Renderer::LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut)
|
||||||
D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) {
|
{
|
||||||
if (!szFilename || !pSrcInfo || !ppDataOut) {
|
if (!szFilename || !pSrcInfo || !ppDataOut)
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
*ppDataOut = nullptr;
|
*ppDataOut = nullptr;
|
||||||
|
|
||||||
png_image image;
|
png_image image;
|
||||||
std::memset(&image, 0, sizeof(image));
|
std::memset(&image, 0, sizeof(image));
|
||||||
image.version = PNG_IMAGE_VERSION;
|
image.version = PNG_IMAGE_VERSION;
|
||||||
if (!png_image_begin_read_from_file(&image, szFilename)) {
|
if (!png_image_begin_read_from_file(&image, szFilename))
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (image.width == 0 || image.height == 0) {
|
if (image.width == 0 || image.height == 0)
|
||||||
|
{
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
image.format = PNG_FORMAT_RGBA;
|
||||||
|
const png_alloc_size_t pixelCount = png_alloc_size_t(image.width) * png_alloc_size_t(image.height);
|
||||||
|
if (pixelCount == 0 || pixelCount > (std::numeric_limits<size_t>::max)() / sizeof(int))
|
||||||
|
{
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int *output = new (std::nothrow) int[size_t(pixelCount)];
|
||||||
|
|
||||||
|
if (!output)
|
||||||
|
{
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!png_image_finish_read(&image, nullptr, output, 0, nullptr))
|
||||||
|
{
|
||||||
|
delete[] output;
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppDataOut = output;
|
||||||
|
pSrcInfo->Width = image.width;
|
||||||
|
pSrcInfo->Height = image.height;
|
||||||
png_image_free(&image);
|
png_image_free(&image);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
image.format = PNG_FORMAT_RGBA;
|
|
||||||
const png_alloc_size_t pixelCount =
|
|
||||||
png_alloc_size_t(image.width) * png_alloc_size_t(image.height);
|
|
||||||
if (pixelCount == 0 ||
|
|
||||||
pixelCount > (std::numeric_limits<size_t>::max)() / sizeof(int)) {
|
|
||||||
png_image_free(&image);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int *output = new (std::nothrow) int[size_t(pixelCount)];
|
|
||||||
|
|
||||||
if (!output) {
|
|
||||||
png_image_free(&image);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!png_image_finish_read(&image, nullptr, output, 0, nullptr)) {
|
|
||||||
delete[] output;
|
|
||||||
png_image_free(&image);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ppDataOut = output;
|
|
||||||
pSrcInfo->Width = image.width;
|
|
||||||
pSrcInfo->Height = image.height;
|
|
||||||
png_image_free(&image);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Renderer::LoadTextureData(BYTE *pbData, DWORD dwBytes,
|
HRESULT Renderer::LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut)
|
||||||
D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) {
|
{
|
||||||
if (!pbData || dwBytes == 0 || !pSrcInfo || !ppDataOut) {
|
if (!pbData || dwBytes == 0 || !pSrcInfo || !ppDataOut)
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
*ppDataOut = nullptr;
|
*ppDataOut = nullptr;
|
||||||
|
|
||||||
png_image image;
|
png_image image;
|
||||||
std::memset(&image, 0, sizeof(image));
|
std::memset(&image, 0, sizeof(image));
|
||||||
image.version = PNG_IMAGE_VERSION;
|
image.version = PNG_IMAGE_VERSION;
|
||||||
if (!png_image_begin_read_from_memory(&image, pbData, dwBytes)) {
|
if (!png_image_begin_read_from_memory(&image, pbData, dwBytes))
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (image.width == 0 || image.height == 0) {
|
if (image.width == 0 || image.height == 0)
|
||||||
|
{
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
image.format = PNG_FORMAT_RGBA;
|
||||||
|
const png_alloc_size_t pixelCount = png_alloc_size_t(image.width) * png_alloc_size_t(image.height);
|
||||||
|
if (pixelCount == 0 || pixelCount > (std::numeric_limits<size_t>::max)() / sizeof(int))
|
||||||
|
{
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int *output = new (std::nothrow) int[size_t(pixelCount)];
|
||||||
|
|
||||||
|
if (!output)
|
||||||
|
{
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!png_image_finish_read(&image, nullptr, output, 0, nullptr))
|
||||||
|
{
|
||||||
|
delete[] output;
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppDataOut = output;
|
||||||
|
pSrcInfo->Width = image.width;
|
||||||
|
pSrcInfo->Height = image.height;
|
||||||
png_image_free(&image);
|
png_image_free(&image);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
image.format = PNG_FORMAT_RGBA;
|
|
||||||
const png_alloc_size_t pixelCount =
|
|
||||||
png_alloc_size_t(image.width) * png_alloc_size_t(image.height);
|
|
||||||
if (pixelCount == 0 ||
|
|
||||||
pixelCount > (std::numeric_limits<size_t>::max)() / sizeof(int)) {
|
|
||||||
png_image_free(&image);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int *output = new (std::nothrow) int[size_t(pixelCount)];
|
|
||||||
|
|
||||||
if (!output) {
|
|
||||||
png_image_free(&image);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!png_image_finish_read(&image, nullptr, output, 0, nullptr)) {
|
|
||||||
delete[] output;
|
|
||||||
png_image_free(&image);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ppDataOut = output;
|
|
||||||
pSrcInfo->Width = image.width;
|
|
||||||
pSrcInfo->Height = image.height;
|
|
||||||
png_image_free(&image);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Renderer::SaveTextureData(const char *szFilename,
|
HRESULT Renderer::SaveTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut)
|
||||||
D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut) {
|
{
|
||||||
png_image image = {};
|
png_image image = {};
|
||||||
image.version = PNG_IMAGE_VERSION;
|
image.version = PNG_IMAGE_VERSION;
|
||||||
image.width = pSrcInfo->Width;
|
image.width = pSrcInfo->Width;
|
||||||
image.height = pSrcInfo->Height;
|
image.height = pSrcInfo->Height;
|
||||||
image.format = PNG_FORMAT_RGBA;
|
image.format = PNG_FORMAT_RGBA;
|
||||||
|
|
||||||
png_image_write_to_file(&image, szFilename, 0, ppDataOut, 0, nullptr);
|
png_image_write_to_file(&image, szFilename, 0, ppDataOut, 0, nullptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Renderer::SaveTextureDataToMemory(void *pOutput, int outputCapacity,
|
HRESULT Renderer::SaveTextureDataToMemory(void *pOutput, int outputCapacity, int *outputLength, int width, int height, int *ppDataIn)
|
||||||
int *outputLength, int width,
|
{
|
||||||
int height, int *ppDataIn) {
|
if (!pOutput || outputCapacity <= 0 || !outputLength || width <= 0 || height <= 0 || !ppDataIn)
|
||||||
if (!pOutput || outputCapacity <= 0 || !outputLength || width <= 0 ||
|
{
|
||||||
height <= 0 || !ppDataIn) {
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
png_image image;
|
png_image image;
|
||||||
std::memset(&image, 0, sizeof(image));
|
std::memset(&image, 0, sizeof(image));
|
||||||
image.version = PNG_IMAGE_VERSION;
|
image.version = PNG_IMAGE_VERSION;
|
||||||
image.width = width;
|
image.width = width;
|
||||||
image.height = height;
|
image.height = height;
|
||||||
image.format = PNG_FORMAT_RGBA;
|
image.format = PNG_FORMAT_RGBA;
|
||||||
|
|
||||||
png_alloc_size_t memoryBytes = static_cast<png_alloc_size_t>(outputCapacity);
|
png_alloc_size_t memoryBytes = static_cast<png_alloc_size_t>(outputCapacity);
|
||||||
if (!png_image_write_to_memory(&image, pOutput, &memoryBytes, 0, ppDataIn, 0,
|
if (!png_image_write_to_memory(&image, pOutput, &memoryBytes, 0, ppDataIn, 0, nullptr))
|
||||||
nullptr)) {
|
{
|
||||||
*outputLength = 0;
|
*outputLength = 0;
|
||||||
|
png_image_free(&image);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*outputLength = static_cast<int>(memoryBytes);
|
||||||
png_image_free(&image);
|
png_image_free(&image);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
*outputLength = static_cast<int>(memoryBytes);
|
|
||||||
png_image_free(&image);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
@@ -5,181 +5,169 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY* Renderer::m_Topologies = nullptr;
|
D3D11_PRIMITIVE_TOPOLOGY *Renderer::m_Topologies = nullptr;
|
||||||
|
|
||||||
void Renderer::DrawVertexBuffer(
|
void Renderer::DrawVertexBuffer(C4JRender::ePrimitiveType PrimitiveType, int count, ID3D11Buffer *buffer, C4JRender::eVertexType vType,
|
||||||
C4JRender::ePrimitiveType PrimitiveType,
|
C4JRender::ePixelShaderType psType)
|
||||||
int count,
|
|
||||||
ID3D11Buffer* buffer,
|
|
||||||
C4JRender::eVertexType vType,
|
|
||||||
C4JRender::ePixelShaderType psType)
|
|
||||||
{
|
{
|
||||||
Renderer::Context& context = this->getContext();
|
Renderer::Context &context = this->getContext();
|
||||||
ID3D11DeviceContext* d3d11 = context.m_pDeviceContext;
|
ID3D11DeviceContext *d3d11 = context.m_pDeviceContext;
|
||||||
|
|
||||||
int drawCount = count;
|
int drawCount = count;
|
||||||
bool indexed = false;
|
bool indexed = false;
|
||||||
this->DrawVertexSetup(vType, psType, PrimitiveType, &drawCount, &indexed);
|
this->DrawVertexSetup(vType, psType, PrimitiveType, &drawCount, &indexed);
|
||||||
this->StateUpdate();
|
this->StateUpdate();
|
||||||
|
|
||||||
const UINT stride = vertexStrideTable[vType];
|
const UINT stride = vertexStrideTable[vType];
|
||||||
const UINT offset = 0;
|
const UINT offset = 0;
|
||||||
d3d11->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
|
d3d11->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
|
||||||
|
|
||||||
if (indexed)
|
if (indexed)
|
||||||
{
|
{
|
||||||
d3d11->DrawIndexed(drawCount, 0, 0);
|
d3d11->DrawIndexed(drawCount, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d3d11->Draw(count, 0);
|
d3d11->Draw(count, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DrawVertexSetup(
|
void Renderer::DrawVertexSetup(C4JRender::eVertexType vType, C4JRender::ePixelShaderType psType, C4JRender::ePrimitiveType PrimitiveType, int *count,
|
||||||
C4JRender::eVertexType vType,
|
bool *indexed)
|
||||||
C4JRender::ePixelShaderType psType,
|
|
||||||
C4JRender::ePrimitiveType PrimitiveType,
|
|
||||||
int* count,
|
|
||||||
bool* indexed)
|
|
||||||
{
|
{
|
||||||
Renderer::Context& context = this->getContext();
|
Renderer::Context &context = this->getContext();
|
||||||
ID3D11DeviceContext* d3d11 = context.m_pDeviceContext;
|
ID3D11DeviceContext *d3d11 = context.m_pDeviceContext;
|
||||||
|
|
||||||
C4JRender::eVertexType effectiveVertexType = vType;
|
C4JRender::eVertexType effectiveVertexType = vType;
|
||||||
if (effectiveVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 && context.lightingEnabled)
|
if (effectiveVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 && context.lightingEnabled)
|
||||||
{
|
{
|
||||||
effectiveVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
|
effectiveVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effectiveVertexType != activeVertexType)
|
if (effectiveVertexType != activeVertexType)
|
||||||
{
|
{
|
||||||
d3d11->VSSetShader(vertexShaderTable[effectiveVertexType], nullptr, 0);
|
d3d11->VSSetShader(vertexShaderTable[effectiveVertexType], nullptr, 0);
|
||||||
d3d11->IASetInputLayout(inputLayoutTable[effectiveVertexType]);
|
d3d11->IASetInputLayout(inputLayoutTable[effectiveVertexType]);
|
||||||
activeVertexType = effectiveVertexType;
|
activeVertexType = effectiveVertexType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psType != activePixelType)
|
if (psType != activePixelType)
|
||||||
{
|
{
|
||||||
d3d11->PSSetShader(pixelShaderTable[psType], nullptr, 0);
|
d3d11->PSSetShader(pixelShaderTable[psType], nullptr, 0);
|
||||||
activePixelType = psType;
|
activePixelType = psType;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_MAPPED_SUBRESOURCE mapped = {};
|
D3D11_MAPPED_SUBRESOURCE mapped = {};
|
||||||
|
|
||||||
if (context.matrixDirty[0])
|
if (context.matrixDirty[0])
|
||||||
{
|
{
|
||||||
d3d11->Map(context.cbMatrix0, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
|
d3d11->Map(context.cbMatrix0, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
|
||||||
std::memcpy(mapped.pData, this->MatrixGet(0), sizeof(DirectX::XMMATRIX));
|
std::memcpy(mapped.pData, this->MatrixGet(0), sizeof(DirectX::XMMATRIX));
|
||||||
d3d11->Unmap(context.cbMatrix0, 0);
|
d3d11->Unmap(context.cbMatrix0, 0);
|
||||||
context.matrixDirty[0] = false;
|
context.matrixDirty[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.matrixDirty[1])
|
if (context.matrixDirty[1])
|
||||||
{
|
{
|
||||||
d3d11->Map(context.cbMatrix2, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
|
d3d11->Map(context.cbMatrix2, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
|
||||||
std::memcpy(mapped.pData, this->MatrixGet(1), sizeof(DirectX::XMMATRIX));
|
std::memcpy(mapped.pData, this->MatrixGet(1), sizeof(DirectX::XMMATRIX));
|
||||||
d3d11->Unmap(context.cbMatrix2, 0);
|
d3d11->Unmap(context.cbMatrix2, 0);
|
||||||
context.matrixDirty[1] = false;
|
context.matrixDirty[1] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.matrixDirty[2])
|
if (context.matrixDirty[2])
|
||||||
{
|
{
|
||||||
d3d11->Map(context.cbMatrix3, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
|
d3d11->Map(context.cbMatrix3, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped);
|
||||||
std::memcpy(mapped.pData, this->MatrixGet(2), sizeof(DirectX::XMMATRIX));
|
std::memcpy(mapped.pData, this->MatrixGet(2), sizeof(DirectX::XMMATRIX));
|
||||||
d3d11->Unmap(context.cbMatrix3, 0);
|
d3d11->Unmap(context.cbMatrix3, 0);
|
||||||
context.matrixDirty[2] = false;
|
context.matrixDirty[2] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->UpdateFogState();
|
this->UpdateFogState();
|
||||||
this->UpdateViewportState();
|
this->UpdateViewportState();
|
||||||
this->UpdateLightingState();
|
this->UpdateLightingState();
|
||||||
this->UpdateTexGenState();
|
this->UpdateTexGenState();
|
||||||
|
|
||||||
d3d11->IASetPrimitiveTopology(m_Topologies[PrimitiveType]);
|
d3d11->IASetPrimitiveTopology(m_Topologies[PrimitiveType]);
|
||||||
|
|
||||||
if (PrimitiveType == C4JRender::PRIMITIVE_TYPE_QUAD_LIST)
|
if (PrimitiveType == C4JRender::PRIMITIVE_TYPE_QUAD_LIST)
|
||||||
{
|
{
|
||||||
d3d11->IASetIndexBuffer(quadIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
|
d3d11->IASetIndexBuffer(quadIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
|
||||||
*count = (*count * 6) / 4;
|
*count = (*count * 6) / 4;
|
||||||
*indexed = true;
|
*indexed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrimitiveType == C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN)
|
if (PrimitiveType == C4JRender::PRIMITIVE_TYPE_TRIANGLE_FAN)
|
||||||
{
|
{
|
||||||
d3d11->IASetIndexBuffer(fanIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
|
d3d11->IASetIndexBuffer(fanIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
|
||||||
*count = (*count - 2) * 3;
|
*count = (*count - 2) * 3;
|
||||||
*indexed = true;
|
*indexed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
d3d11->IASetIndexBuffer(nullptr, DXGI_FORMAT_R16_UINT, 0);
|
d3d11->IASetIndexBuffer(nullptr, DXGI_FORMAT_R16_UINT, 0);
|
||||||
*indexed = false;
|
*indexed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DrawVertices(
|
void Renderer::DrawVertices(C4JRender::ePrimitiveType PrimitiveType, int count, void *vertices, C4JRender::eVertexType vType,
|
||||||
C4JRender::ePrimitiveType PrimitiveType,
|
C4JRender::ePixelShaderType psType)
|
||||||
int count,
|
|
||||||
void* vertices,
|
|
||||||
C4JRender::eVertexType vType,
|
|
||||||
C4JRender::ePixelShaderType psType)
|
|
||||||
{
|
{
|
||||||
Renderer::Context& context = this->getContext();
|
Renderer::Context &context = this->getContext();
|
||||||
ID3D11DeviceContext* d3d11 = context.m_pDeviceContext;
|
ID3D11DeviceContext *d3d11 = context.m_pDeviceContext;
|
||||||
Renderer::CommandBuffer* commandBuffer = context.commandBuffer;
|
Renderer::CommandBuffer *commandBuffer = context.commandBuffer;
|
||||||
|
|
||||||
if (commandBuffer != nullptr)
|
if (commandBuffer != nullptr)
|
||||||
{
|
{
|
||||||
C4JRender::eVertexType effectiveVertexType = vType;
|
C4JRender::eVertexType effectiveVertexType = vType;
|
||||||
if (effectiveVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 && context.lightingEnabled)
|
if (effectiveVertexType == C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1 && context.lightingEnabled)
|
||||||
{
|
{
|
||||||
effectiveVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
|
effectiveVertexType = C4JRender::VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1_LIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.recordingPrimitiveType = PrimitiveType;
|
context.recordingPrimitiveType = PrimitiveType;
|
||||||
context.recordingVertexType = effectiveVertexType;
|
context.recordingVertexType = effectiveVertexType;
|
||||||
const UINT stride = vertexStrideTable[effectiveVertexType];
|
const UINT stride = vertexStrideTable[effectiveVertexType];
|
||||||
commandBuffer->AddVertices(stride, static_cast<UINT>(count), vertices, context);
|
commandBuffer->AddVertices(stride, static_cast<UINT>(count), vertices, context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drawCount = count;
|
int drawCount = count;
|
||||||
bool indexed = false;
|
bool indexed = false;
|
||||||
this->DrawVertexSetup(vType, psType, PrimitiveType, &drawCount, &indexed);
|
this->DrawVertexSetup(vType, psType, PrimitiveType, &drawCount, &indexed);
|
||||||
|
|
||||||
const UINT stride = vertexStrideTable[vType];
|
const UINT stride = vertexStrideTable[vType];
|
||||||
const UINT copySize = stride * static_cast<UINT>(count);
|
const UINT copySize = stride * static_cast<UINT>(count);
|
||||||
if (context.dynamicVertexOffset + copySize > 0x100000u)
|
if (context.dynamicVertexOffset + copySize > 0x100000u)
|
||||||
{
|
{
|
||||||
context.dynamicVertexOffset = 0;
|
context.dynamicVertexOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_MAPPED_SUBRESOURCE mapped = {};
|
D3D11_MAPPED_SUBRESOURCE mapped = {};
|
||||||
const D3D11_MAP mapType = context.dynamicVertexOffset == 0 ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE;
|
const D3D11_MAP mapType = context.dynamicVertexOffset == 0 ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE;
|
||||||
const HRESULT hr = d3d11->Map(context.dynamicVertexBuffer, 0, mapType, 0, &mapped);
|
const HRESULT hr = d3d11->Map(context.dynamicVertexBuffer, 0, mapType, 0, &mapped);
|
||||||
if (hr != 0)
|
if (hr != 0)
|
||||||
{
|
{
|
||||||
std::printf("ERROR: 0x%x\n", static_cast<unsigned int>(hr));
|
std::printf("ERROR: 0x%x\n", static_cast<unsigned int>(hr));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memcpy(static_cast<std::uint8_t*>(mapped.pData) + context.dynamicVertexOffset, vertices, copySize);
|
std::memcpy(static_cast<std::uint8_t *>(mapped.pData) + context.dynamicVertexOffset, vertices, copySize);
|
||||||
d3d11->Unmap(context.dynamicVertexBuffer, 0);
|
d3d11->Unmap(context.dynamicVertexBuffer, 0);
|
||||||
|
|
||||||
this->StateUpdate();
|
this->StateUpdate();
|
||||||
|
|
||||||
ID3D11Buffer* dynamicBuffer = context.dynamicVertexBuffer;
|
ID3D11Buffer *dynamicBuffer = context.dynamicVertexBuffer;
|
||||||
const UINT vertexOffset = context.dynamicVertexOffset;
|
const UINT vertexOffset = context.dynamicVertexOffset;
|
||||||
d3d11->IASetVertexBuffers(0, 1, &dynamicBuffer, &stride, &vertexOffset);
|
d3d11->IASetVertexBuffers(0, 1, &dynamicBuffer, &stride, &vertexOffset);
|
||||||
|
|
||||||
if (indexed)
|
if (indexed)
|
||||||
{
|
{
|
||||||
d3d11->DrawIndexed(drawCount, 0, 0);
|
d3d11->DrawIndexed(drawCount, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d3d11->Draw(count, 0);
|
d3d11->Draw(count, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.dynamicVertexOffset += copySize;
|
context.dynamicVertexOffset += copySize;
|
||||||
}
|
}
|
||||||
@@ -5,280 +5,284 @@
|
|||||||
C4JStorage StorageManager;
|
C4JStorage StorageManager;
|
||||||
XMARKETPLACE_CONTENTOFFER_INFO InternalContentOfferInfo;
|
XMARKETPLACE_CONTENTOFFER_INFO InternalContentOfferInfo;
|
||||||
|
|
||||||
C4JStorage::C4JStorage()
|
C4JStorage::C4JStorage() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void C4JStorage::Tick(void)
|
void C4JStorage::Tick(void)
|
||||||
{
|
{
|
||||||
InternalStorageManager.Tick();
|
InternalStorageManager.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT* uiOptionA, UINT uiOptionC, DWORD dwPad,
|
C4JStorage::EMessageResult C4JStorage::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA, UINT uiOptionC, DWORD dwPad,
|
||||||
int(*Func)(LPVOID, int, const C4JStorage::EMessageResult), LPVOID lpParam, C4JStringTable* pStringTable, WCHAR* pwchFormatString, DWORD dwFocusButton)
|
int (*Func)(LPVOID, int, const C4JStorage::EMessageResult), LPVOID lpParam,
|
||||||
|
C4JStringTable *pStringTable, WCHAR *pwchFormatString, DWORD dwFocusButton)
|
||||||
{
|
{
|
||||||
return EMessage_Undefined;
|
return EMessage_Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult()
|
C4JStorage::EMessageResult C4JStorage::GetMessageBoxResult()
|
||||||
{
|
{
|
||||||
return EMessage_Undefined;
|
return EMessage_Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::SetSaveDevice(int(*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice)
|
bool C4JStorage::SetSaveDevice(int (*Func)(LPVOID, const bool), LPVOID lpParam, bool bForceResetOfSaveDevice)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char* pszSavePackName, int iMinimumSaveSize, int(*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID)
|
void C4JStorage::Init(unsigned int uiSaveVersion, LPCWSTR pwchDefaultSaveName, char *pszSavePackName, int iMinimumSaveSize,
|
||||||
|
int (*Func)(LPVOID, const ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID)
|
||||||
{
|
{
|
||||||
InternalStorageManager.Init(Func, lpParam, szGroupID);
|
InternalStorageManager.Init(Func, lpParam, szGroupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::ResetSaveData()
|
void C4JStorage::ResetSaveData()
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.ResetSaveData();
|
InternalStorageManager.m_SaveGame.ResetSaveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName)
|
void C4JStorage::SetDefaultSaveNameForKeyboardDisplay(LPCWSTR pwchDefaultSaveName)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName)
|
void C4JStorage::SetSaveTitle(LPCWSTR pwchDefaultSaveName)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.SetSaveTitle(pwchDefaultSaveName);
|
InternalStorageManager.m_SaveGame.SetSaveTitle(pwchDefaultSaveName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::GetSaveUniqueNumber(INT* piVal)
|
bool C4JStorage::GetSaveUniqueNumber(INT *piVal)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.GetSaveUniqueNumber(piVal);
|
return InternalStorageManager.m_SaveGame.GetSaveUniqueNumber(piVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::GetSaveUniqueFilename(char* pszName)
|
bool C4JStorage::GetSaveUniqueFilename(char *pszName)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.GetSaveUniqueFilename(pszName);
|
return InternalStorageManager.m_SaveGame.GetSaveUniqueFilename(pszName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetSaveUniqueFilename(char* szFilename)
|
void C4JStorage::SetSaveUniqueFilename(char *szFilename)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.SetSaveUniqueFilename(szFilename);
|
InternalStorageManager.m_SaveGame.SetSaveUniqueFilename(szFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetState(ESaveGameControlState eControlState, int(*Func)(LPVOID, const bool), LPVOID lpParam)
|
void C4JStorage::SetState(ESaveGameControlState eControlState, int (*Func)(LPVOID, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetSaveDisabled(bool bDisable)
|
void C4JStorage::SetSaveDisabled(bool bDisable)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.SetSaveDisabled(bDisable);
|
InternalStorageManager.m_SaveGame.SetSaveDisabled(bDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::GetSaveDisabled(void)
|
bool C4JStorage::GetSaveDisabled(void)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.GetSaveDisabled();
|
return InternalStorageManager.m_SaveGame.GetSaveDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int C4JStorage::GetSaveSize()
|
unsigned int C4JStorage::GetSaveSize()
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.GetSaveSize();
|
return InternalStorageManager.m_SaveGame.GetSaveSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::GetSaveData(void* pvData, unsigned int* puiBytes)
|
void C4JStorage::GetSaveData(void *pvData, unsigned int *puiBytes)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.GetSaveData(pvData, puiBytes);
|
InternalStorageManager.m_SaveGame.GetSaveData(pvData, puiBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes)
|
PVOID C4JStorage::AllocateSaveData(unsigned int uiBytes)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.AllocateSaveData(uiBytes);
|
return InternalStorageManager.m_SaveGame.AllocateSaveData(uiBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes)
|
void C4JStorage::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.SetSaveImages(pbThumbnail, dwThumbnailBytes, pbImage, dwImageBytes, pbTextData, dwTextDataBytes);
|
InternalStorageManager.m_SaveGame.SetSaveImages(pbThumbnail, dwThumbnailBytes, pbImage, dwImageBytes, pbTextData, dwTextDataBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int(*Func)(LPVOID, const bool), LPVOID lpParam)
|
C4JStorage::ESaveGameState C4JStorage::SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.SaveSaveData(Func, lpParam);
|
return InternalStorageManager.m_SaveGame.SaveSaveData(Func, lpParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR* wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam)
|
void C4JStorage::CopySaveDataToNewSave(PBYTE pbThumbnail, DWORD cbThumbnail, WCHAR *wchNewName, int (*Func)(LPVOID lpParam, bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected)
|
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad, bool bSelected)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad)
|
bool C4JStorage::GetSaveDeviceSelected(unsigned int iPad)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool* pbExists)
|
C4JStorage::ESaveGameState C4JStorage::DoesSaveExist(bool *pbExists)
|
||||||
{
|
{
|
||||||
*pbExists = true;
|
*pbExists = true;
|
||||||
return ESaveGame_Idle;
|
return ESaveGame_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::EnoughSpaceForAMinSaveGame()
|
bool C4JStorage::EnoughSpaceForAMinSaveGame()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetSaveMessageVPosition(float fY)
|
void C4JStorage::SetSaveMessageVPosition(float fY)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS* pSaveDetails, const bool), LPVOID lpParam, char* pszSavePackName)
|
C4JStorage::ESaveGameState C4JStorage::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
|
||||||
|
char *pszSavePackName)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.GetSavesInfo(iPad, Func, lpParam, pszSavePackName);
|
return InternalStorageManager.m_SaveGame.GetSavesInfo(iPad, Func, lpParam, pszSavePackName);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSAVE_DETAILS C4JStorage::ReturnSavesInfo()
|
PSAVE_DETAILS C4JStorage::ReturnSavesInfo()
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.ReturnSavesInfo();
|
return InternalStorageManager.m_SaveGame.ReturnSavesInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::ClearSavesInfo()
|
void C4JStorage::ClearSavesInfo()
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_SaveGame.ClearSavesInfo();
|
InternalStorageManager.m_SaveGame.ClearSavesInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
|
C4JStorage::ESaveGameState C4JStorage::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,
|
||||||
|
int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.LoadSaveDataThumbnail(pSaveInfo, Func, lpParam);
|
return InternalStorageManager.m_SaveGame.LoadSaveDataThumbnail(pSaveInfo, Func, lpParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA& xContentData)
|
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA &xContentData)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE* ppbImageData, DWORD* pdwImageBytes)
|
void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE *ppbImageData, DWORD *pdwImageBytes)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
|
C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.LoadSaveData(pSaveInfo, Func, lpParam);
|
return InternalStorageManager.m_SaveGame.LoadSaveData(pSaveInfo, Func, lpParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
|
C4JStorage::ESaveGameState C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_SaveGame.DeleteSaveData(pSaveInfo, Func, lpParam);
|
return InternalStorageManager.m_SaveGame.DeleteSaveData(pSaveInfo, Func, lpParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS*, int), LPVOID lpParam)
|
void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS *, int), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot)
|
void C4JStorage::SetDLCPackageRoot(char *pszDLCRoot)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_DLC.SetPackageRoot(pszDLCRoot);
|
InternalStorageManager.m_DLC.SetPackageRoot(pszDLCRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
|
C4JStorage::EDLCStatus C4JStorage::GetDLCOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
|
||||||
{
|
{
|
||||||
return EDLC_Idle;
|
return EDLC_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD C4JStorage::CancelGetDLCOffers()
|
DWORD C4JStorage::CancelGetDLCOffers()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::ClearDLCOffers()
|
void C4JStorage::ClearDLCOffers()
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMARKETPLACE_CONTENTOFFER_INFO& C4JStorage::GetOffer(DWORD dw)
|
XMARKETPLACE_CONTENTOFFER_INFO &C4JStorage::GetOffer(DWORD dw)
|
||||||
{
|
{
|
||||||
return InternalContentOfferInfo;
|
return InternalContentOfferInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
int C4JStorage::GetOfferCount()
|
int C4JStorage::GetOfferCount()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64* ullOfferIDA, int(*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial)
|
DWORD C4JStorage::InstallOffer(int iOfferIDC, __uint64 *ullOfferIDA, int (*Func)(LPVOID, int, int), LPVOID lpParam, bool bTrial)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD C4JStorage::GetAvailableDLCCount(int iPad)
|
DWORD C4JStorage::GetAvailableDLCCount(int iPad)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_DLC.GetAvailableDLCCount(iPad);
|
return InternalStorageManager.m_DLC.GetAvailableDLCCount(iPad);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam)
|
C4JStorage::EDLCStatus C4JStorage::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_DLC.GetInstalledDLC(iPad, Func, lpParam);
|
return InternalStorageManager.m_DLC.GetInstalledDLC(iPad, Func, lpParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
XCONTENT_DATA& C4JStorage::GetDLC(DWORD dw)
|
XCONTENT_DATA &C4JStorage::GetDLC(DWORD dw)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_DLC.GetDLC(dw);
|
return InternalStorageManager.m_DLC.GetDLC(dw);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
|
DWORD C4JStorage::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_DLC.MountInstalledDLC(iPad, dwDLC, Func, lpParam, szMountDrive);
|
return InternalStorageManager.m_DLC.MountInstalledDLC(iPad, dwDLC, Func, lpParam, szMountDrive);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive)
|
DWORD C4JStorage::UnmountInstalledDLC(LPCSTR szMountDrive)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_DLC.UnmountInstalledDLC(szMountDrive);
|
return InternalStorageManager.m_DLC.UnmountInstalledDLC(szMountDrive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList)
|
void C4JStorage::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
|
||||||
{
|
{
|
||||||
InternalStorageManager.m_DLC.GetMountedDLCFileList(szMountDrive, fileList);
|
InternalStorageManager.m_DLC.GetMountedDLCFileList(szMountDrive, fileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string C4JStorage::GetMountedPath(std::string szMount)
|
std::string C4JStorage::GetMountedPath(std::string szMount)
|
||||||
{
|
{
|
||||||
return InternalStorageManager.m_DLC.GetMountedPath(szMount);
|
return InternalStorageManager.m_DLC.GetMountedPath(szMount);
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType,
|
C4JStorage::ETMSStatus C4JStorage::ReadTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, C4JStorage::eTMS_FileType eFileType,
|
||||||
WCHAR* pwchFilename, BYTE** ppBuffer, DWORD* pdwBufferSize, int(*Func)(LPVOID, WCHAR*, int, bool, int), LPVOID lpParam, int iAction)
|
WCHAR *pwchFilename, BYTE **ppBuffer, DWORD *pdwBufferSize,
|
||||||
|
int (*Func)(LPVOID, WCHAR *, int, bool, int), LPVOID lpParam, int iAction)
|
||||||
{
|
{
|
||||||
return ETMSStatus_Idle;
|
return ETMSStatus_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR* pwchFilename, BYTE* pBuffer, DWORD dwBufferSize)
|
bool C4JStorage::WriteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename, BYTE *pBuffer, DWORD dwBufferSize)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR* pwchFilename)
|
bool C4JStorage::DeleteTMSFile(int iQuadrant, eGlobalStorage eStorageFacility, WCHAR *pwchFilename)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4JStorage::StoreTMSPathName(WCHAR* pwchName)
|
void C4JStorage::StoreTMSPathName(WCHAR *pwchName)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR), LPVOID lpParam, int iUserData)
|
C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,
|
||||||
|
LPCSTR szFilename, int (*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR), LPVOID lpParam,
|
||||||
|
int iUserData)
|
||||||
{
|
{
|
||||||
return ETMSStatus_Idle;
|
return ETMSStatus_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int C4JStorage::CRC(unsigned char* buf, int len)
|
unsigned int C4JStorage::CRC(unsigned char *buf, int len)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2,33 +2,33 @@
|
|||||||
#include "STO_DLC.h"
|
#include "STO_DLC.h"
|
||||||
#include "STO_Main.h"
|
#include "STO_Main.h"
|
||||||
|
|
||||||
XCONTENT_DATA& CDLC::GetDLC(DWORD dw)
|
XCONTENT_DATA &CDLC::GetDLC(DWORD dw)
|
||||||
{
|
{
|
||||||
return m_vInstalledDLCs[dw];
|
return m_vInstalledDLCs[dw];
|
||||||
}
|
}
|
||||||
|
|
||||||
CDLC::CDLC(void) : m_vInstalledDLCs(), m_szMountPath(), m_vDLCDriveMappings()
|
CDLC::CDLC(void) : m_vInstalledDLCs(), m_szMountPath(), m_vDLCDriveMappings()
|
||||||
{
|
{
|
||||||
m_iHasNewInstalledDLCs = false;
|
m_iHasNewInstalledDLCs = false;
|
||||||
dword0 = 0;
|
dword0 = 0;
|
||||||
dwordC0 = 0;
|
dwordC0 = 0;
|
||||||
m_iHasNewMountedDLCs = false; // @Patoke fix
|
m_iHasNewMountedDLCs = false; // @Patoke fix
|
||||||
|
|
||||||
ZeroMemory(m_szDLCProductCode, sizeof(m_szDLCProductCode));
|
ZeroMemory(m_szDLCProductCode, sizeof(m_szDLCProductCode));
|
||||||
ZeroMemory(m_szProductUpgradeKey, sizeof(m_szProductUpgradeKey));
|
ZeroMemory(m_szProductUpgradeKey, sizeof(m_szProductUpgradeKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::EDLCStatus CDLC::GetOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
|
C4JStorage::EDLCStatus CDLC::GetOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask)
|
||||||
{
|
{
|
||||||
return C4JStorage::EDLC_NoOffers;
|
return C4JStorage::EDLC_NoOffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDLC::ClearOffers()
|
void CDLC::ClearOffers()
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam)
|
C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
if (m_iHasNewInstalledDLCs)
|
if (m_iHasNewInstalledDLCs)
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@ C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, i
|
|||||||
|
|
||||||
m_pInstalledDLCFunc = Func;
|
m_pInstalledDLCFunc = Func;
|
||||||
m_pInstalledDLCParam = lpParam;
|
m_pInstalledDLCParam = lpParam;
|
||||||
m_iHasNewInstalledDLCs = true;
|
m_iHasNewInstalledDLCs = true;
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
DWORD atts = GetFileAttributesA("Windows64Media/DLC");
|
DWORD atts = GetFileAttributesA("Windows64Media/DLC");
|
||||||
@@ -54,196 +54,195 @@ C4JStorage::EDLCStatus CDLC::GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, i
|
|||||||
return C4JStorage::EDLC_Error;
|
return C4JStorage::EDLC_Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
_WIN32_FIND_DATAA hFind;
|
_WIN32_FIND_DATAA hFind;
|
||||||
HANDLE hFindFile;
|
HANDLE hFindFile;
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
hFindFile = FindFirstFileA("Windows64/DLC/*", &hFind);
|
hFindFile = FindFirstFileA("Windows64/DLC/*", &hFind);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hFindFile = FindFirstFileA("Windows64Media/DLC/*", &hFind);
|
hFindFile = FindFirstFileA("Windows64Media/DLC/*", &hFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hFindFile != (HANDLE)-1LL)
|
if (hFindFile != (HANDLE)-1LL)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
atts = hFind.dwFileAttributes;
|
atts = hFind.dwFileAttributes;
|
||||||
|
|
||||||
bool isArt = hFind.dwFileAttributes != -1 && (hFind.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
|
bool isArt = hFind.dwFileAttributes != -1 && (hFind.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
|
||||||
if (isArt && hFind.cFileName[0] != '.')
|
if (isArt && hFind.cFileName[0] != '.')
|
||||||
{
|
{
|
||||||
XCONTENT_DATA data;
|
XCONTENT_DATA data;
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
sprintf(data.szFileName, "Windows64/DLC/%s", hFind.cFileName);
|
sprintf(data.szFileName, "Windows64/DLC/%s", hFind.cFileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(data.szFileName, "Windows64Media/DLC/%s", hFind.cFileName);
|
sprintf(data.szFileName, "Windows64Media/DLC/%s", hFind.cFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
swprintf(data.szDisplayName, 256, L"%s", hFind.cFileName);
|
swprintf(data.szDisplayName, 256, L"%s", hFind.cFileName);
|
||||||
int displayNameLen = wcslen(data.szDisplayName);
|
int displayNameLen = wcslen(data.szDisplayName);
|
||||||
|
|
||||||
data.DeviceID = 0;
|
data.DeviceID = 0;
|
||||||
data.dwContentType = 0;
|
data.dwContentType = 0;
|
||||||
|
|
||||||
AddInstalled(&data);
|
AddInstalled(&data);
|
||||||
}
|
}
|
||||||
} while (FindNextFileA(hFindFile, &hFind));
|
} while (FindNextFileA(hFindFile, &hFind));
|
||||||
FindClose(hFindFile);
|
FindClose(hFindFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return C4JStorage::EDLC_Idle;
|
return C4JStorage::EDLC_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
|
DWORD CDLC::MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive)
|
||||||
{
|
{
|
||||||
this->m_pMountedDLCFunc = Func;
|
this->m_pMountedDLCFunc = Func;
|
||||||
this->m_pMountedDLCParam = lpParam;
|
this->m_pMountedDLCParam = lpParam;
|
||||||
|
|
||||||
if (szMountDrive)
|
if (szMountDrive)
|
||||||
{
|
{
|
||||||
m_szMountPath = szMountDrive;
|
m_szMountPath = szMountDrive;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_szMountPath = this->m_szPackageRoot;
|
m_szMountPath = this->m_szPackageRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_uiCurrentMappedDLC = dwDLC;
|
this->m_uiCurrentMappedDLC = dwDLC;
|
||||||
|
|
||||||
char* dlcdirPath = m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName;
|
char *dlcdirPath = m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName;
|
||||||
m_vDLCDriveMappings.push_back(DriveMapping(dlcdirPath, m_szMountPath));
|
m_vDLCDriveMappings.push_back(DriveMapping(dlcdirPath, m_szMountPath));
|
||||||
|
|
||||||
m_iHasNewMountedDLCs = true;
|
m_iHasNewMountedDLCs = true;
|
||||||
|
|
||||||
return 997;
|
return 997;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CDLC::UnmountInstalledDLC(LPCSTR szMountDrive)
|
DWORD CDLC::UnmountInstalledDLC(LPCSTR szMountDrive)
|
||||||
{
|
{
|
||||||
LPCSTR szDrive = nullptr;
|
LPCSTR szDrive = nullptr;
|
||||||
|
|
||||||
if (szMountDrive)
|
if (szMountDrive)
|
||||||
{
|
{
|
||||||
szDrive = szMountDrive;
|
szDrive = szMountDrive;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
szDrive = this->m_szPackageRoot;
|
szDrive = this->m_szPackageRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this->m_vDLCDriveMappings.size(); i++)
|
for (int i = 0; i < this->m_vDLCDriveMappings.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_vDLCDriveMappings[i].m_szDirectoryPath == szDrive)
|
if (m_vDLCDriveMappings[i].m_szDirectoryPath == szDrive)
|
||||||
{
|
{
|
||||||
m_vDLCDriveMappings.erase(m_vDLCDriveMappings.begin() + i);
|
m_vDLCDriveMappings.erase(m_vDLCDriveMappings.begin() + i);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDLC::GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList)
|
void CDLC::GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList)
|
||||||
{
|
{
|
||||||
char* dlcdirPath = new char[256];
|
char *dlcdirPath = new char[256];
|
||||||
sprintf(dlcdirPath, "%s/*", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName);
|
sprintf(dlcdirPath, "%s/*", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName);
|
||||||
|
|
||||||
_WIN32_FIND_DATAA atts;
|
_WIN32_FIND_DATAA atts;
|
||||||
HANDLE hFind = FindFirstFileA(dlcdirPath, &atts);
|
HANDLE hFind = FindFirstFileA(dlcdirPath, &atts);
|
||||||
if (hFind != (HANDLE)-1LL)
|
if (hFind != (HANDLE)-1LL)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (atts.dwFileAttributes == -1 || (atts.dwFileAttributes & 0x10) != 0x10)
|
if (atts.dwFileAttributes == -1 || (atts.dwFileAttributes & 0x10) != 0x10)
|
||||||
{
|
{
|
||||||
char dir[256];
|
char dir[256];
|
||||||
sprintf(dir, "%s/%s", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName, atts.cFileName);
|
sprintf(dir, "%s/%s", m_vInstalledDLCs[m_uiCurrentMappedDLC].szFileName, atts.cFileName);
|
||||||
|
|
||||||
fileList.push_back(dir);
|
fileList.push_back(dir);
|
||||||
}
|
}
|
||||||
} while (FindNextFileA(hFind, &atts));
|
} while (FindNextFileA(hFind, &atts));
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
delete[] dlcdirPath;
|
delete[] dlcdirPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CDLC::GetMountedPath(std::string szMount)
|
std::string CDLC::GetMountedPath(std::string szMount)
|
||||||
{
|
{
|
||||||
for (int ch = 0; ch < szMount.size(); ++ch)
|
for (int ch = 0; ch < szMount.size(); ++ch)
|
||||||
{
|
{
|
||||||
if (szMount[ch] == '/' || szMount[ch] == '\\')
|
if (szMount[ch] == '/' || szMount[ch] == '\\')
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (szMount[ch] == ':')
|
if (szMount[ch] == ':')
|
||||||
{
|
{
|
||||||
std::string driveName = szMount.substr(0, ch);
|
std::string driveName = szMount.substr(0, ch);
|
||||||
for (int i = 0; i < m_vDLCDriveMappings.size(); ++i)
|
for (int i = 0; i < m_vDLCDriveMappings.size(); ++i)
|
||||||
{
|
{
|
||||||
if (m_vDLCDriveMappings[i].m_szDirectoryPath == driveName)
|
if (m_vDLCDriveMappings[i].m_szDirectoryPath == driveName)
|
||||||
{
|
{
|
||||||
std::string newPath = m_vDLCDriveMappings[i].m_szMountPath;
|
std::string newPath = m_vDLCDriveMappings[i].m_szMountPath;
|
||||||
|
|
||||||
newPath.append(szMount.substr(ch + 1, -1));
|
newPath.append(szMount.substr(ch + 1, -1));
|
||||||
|
|
||||||
return newPath;
|
return newPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDLC::SetDLCProductCode(const char *szProductCode)
|
||||||
void CDLC::SetDLCProductCode(const char* szProductCode)
|
|
||||||
{
|
{
|
||||||
strcpy(m_szDLCProductCode, szProductCode);
|
strcpy(m_szDLCProductCode, szProductCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDLC::SetProductUpgradeKey(const char* szProductCode)
|
void CDLC::SetProductUpgradeKey(const char *szProductCode)
|
||||||
{
|
{
|
||||||
strcpy(m_szProductUpgradeKey, szProductCode);
|
strcpy(m_szProductUpgradeKey, szProductCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CDLC::GetAvailableDLCCount(int iPad)
|
int CDLC::GetAvailableDLCCount(int iPad)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDLC::SetPackageRoot(char* pszDLCRoot)
|
void CDLC::SetPackageRoot(char *pszDLCRoot)
|
||||||
{
|
{
|
||||||
strcpy(this->m_szPackageRoot, pszDLCRoot);
|
strcpy(this->m_szPackageRoot, pszDLCRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDLC::Tick(void)
|
void CDLC::Tick(void)
|
||||||
{
|
{
|
||||||
if (m_iHasNewInstalledDLCs)
|
if (m_iHasNewInstalledDLCs)
|
||||||
{
|
{
|
||||||
m_iHasNewInstalledDLCs = false;
|
m_iHasNewInstalledDLCs = false;
|
||||||
m_pInstalledDLCFunc(m_pInstalledDLCParam, m_vInstalledDLCs.size(), 0);
|
m_pInstalledDLCFunc(m_pInstalledDLCParam, m_vInstalledDLCs.size(), 0);
|
||||||
}
|
}
|
||||||
if (m_iHasNewMountedDLCs)
|
if (m_iHasNewMountedDLCs)
|
||||||
{
|
{
|
||||||
m_iHasNewMountedDLCs = false;
|
m_iHasNewMountedDLCs = false;
|
||||||
m_pMountedDLCFunc(m_pMountedDLCParam, 0, 0, dword94);
|
m_pMountedDLCFunc(m_pMountedDLCParam, 0, 0, dword94);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDLC::AddInstalled(XCONTENT_DATA* data)
|
void CDLC::AddInstalled(XCONTENT_DATA *data)
|
||||||
{
|
{
|
||||||
m_vInstalledDLCs.push_back(*data);
|
m_vInstalledDLCs.push_back(*data);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CDLC::CancelOffers(void)
|
DWORD CDLC::CancelOffers(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -4,54 +4,54 @@
|
|||||||
class CDLC
|
class CDLC
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
struct DriveMapping
|
||||||
|
{
|
||||||
|
DriveMapping(std::string szDirectoryPath, std::string szMountPath) : m_szDirectoryPath(szDirectoryPath), m_szMountPath(szMountPath)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
struct DriveMapping
|
std::string m_szDirectoryPath;
|
||||||
{
|
std::string m_szMountPath;
|
||||||
DriveMapping(std::string szDirectoryPath, std::string szMountPath) : m_szDirectoryPath(szDirectoryPath), m_szMountPath(szMountPath)
|
};
|
||||||
{
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string m_szDirectoryPath;
|
XCONTENT_DATA &GetDLC(DWORD dw);
|
||||||
std::string m_szMountPath;
|
CDLC(void);
|
||||||
};
|
|
||||||
|
|
||||||
XCONTENT_DATA& GetDLC(DWORD dw);
|
C4JStorage::EDLCStatus GetOffers(int iPad, int (*Func)(LPVOID, int, DWORD, int), LPVOID lpParam,
|
||||||
CDLC(void);
|
DWORD dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT);
|
||||||
|
void ClearOffers();
|
||||||
|
C4JStorage::EDLCStatus GetInstalledDLC(int iPad, int (*Func)(LPVOID, int, int), LPVOID lpParam);
|
||||||
|
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int (*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive = NULL);
|
||||||
|
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
|
||||||
|
void GetMountedDLCFileList(const char *szMountDrive, std::vector<std::string> &fileList);
|
||||||
|
std::string GetMountedPath(std::string szMount);
|
||||||
|
|
||||||
C4JStorage::EDLCStatus GetOffers(int iPad, int(*Func)(LPVOID, int, DWORD, int), LPVOID lpParam, DWORD dwOfferTypesBitmask = XMARKETPLACE_OFFERING_TYPE_CONTENT);
|
void SetDLCProductCode(const char *szProductCode);
|
||||||
void ClearOffers();
|
void SetProductUpgradeKey(const char *szProductCode);
|
||||||
C4JStorage::EDLCStatus GetInstalledDLC(int iPad, int(*Func)(LPVOID, int, int), LPVOID lpParam);
|
int GetAvailableDLCCount(int iPad);
|
||||||
DWORD MountInstalledDLC(int iPad, DWORD dwDLC, int(*Func)(LPVOID, int, DWORD, DWORD), LPVOID lpParam, LPCSTR szMountDrive = NULL);
|
void SetPackageRoot(char *pszDLCRoot);
|
||||||
DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL);
|
|
||||||
void GetMountedDLCFileList(const char* szMountDrive, std::vector<std::string>& fileList);
|
|
||||||
std::string GetMountedPath(std::string szMount);
|
|
||||||
|
|
||||||
void SetDLCProductCode(const char* szProductCode);
|
void Tick(void);
|
||||||
void SetProductUpgradeKey(const char* szProductCode);
|
void AddInstalled(XCONTENT_DATA *data);
|
||||||
int GetAvailableDLCCount(int iPad);
|
DWORD CancelOffers(void);
|
||||||
void SetPackageRoot(char* pszDLCRoot);
|
|
||||||
|
|
||||||
void Tick(void);
|
DWORD dword0;
|
||||||
void AddInstalled(XCONTENT_DATA* data);
|
int (*m_pInstalledDLCFunc)(LPVOID, int, int);
|
||||||
DWORD CancelOffers(void);
|
LPVOID m_pInstalledDLCParam;
|
||||||
|
BYTE gap18[16];
|
||||||
DWORD dword0;
|
int m_iHasNewInstalledDLCs;
|
||||||
int (*m_pInstalledDLCFunc)(LPVOID, int, int);
|
std::vector<XCONTENT_DATA> m_vInstalledDLCs;
|
||||||
LPVOID m_pInstalledDLCParam;
|
BYTE gap48[4];
|
||||||
BYTE gap18[16];
|
DWORD m_iHasNewMountedDLCs;
|
||||||
int m_iHasNewInstalledDLCs;
|
int (*m_pMountedDLCFunc)(LPVOID, int, DWORD, DWORD);
|
||||||
std::vector<XCONTENT_DATA> m_vInstalledDLCs;
|
LPVOID m_pMountedDLCParam;
|
||||||
BYTE gap48[4];
|
std::string m_szMountPath;
|
||||||
DWORD m_iHasNewMountedDLCs;
|
DWORD m_uiCurrentMappedDLC;
|
||||||
int (*m_pMountedDLCFunc)(LPVOID, int, DWORD, DWORD);
|
DWORD dword94;
|
||||||
LPVOID m_pMountedDLCParam;
|
char m_szPackageRoot[40];
|
||||||
std::string m_szMountPath;
|
DWORD dwordC0;
|
||||||
DWORD m_uiCurrentMappedDLC;
|
std::vector<DriveMapping> m_vDLCDriveMappings;
|
||||||
DWORD dword94;
|
char m_szDLCProductCode[16];
|
||||||
char m_szPackageRoot[40];
|
char m_szProductUpgradeKey[60];
|
||||||
DWORD dwordC0;
|
|
||||||
std::vector<DriveMapping> m_vDLCDriveMappings;
|
|
||||||
char m_szDLCProductCode[16];
|
|
||||||
char m_szProductUpgradeKey[60];
|
|
||||||
};
|
};
|
||||||
@@ -10,17 +10,14 @@ CStorage::CStorage(void)
|
|||||||
m_DLC = CDLC();
|
m_DLC = CDLC();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStorage::Init(int(*Func)(LPVOID, const C4JStorage::ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID)
|
void CStorage::Init(int (*Func)(LPVOID, const C4JStorage::ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID) {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
void CStorage::Tick(void)
|
||||||
|
|
||||||
void CStorage::Tick(void)
|
|
||||||
{
|
{
|
||||||
m_DLC.Tick();
|
m_DLC.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CStorage::CRC(unsigned char* buf, int len)
|
unsigned int CStorage::CRC(unsigned char *buf, int len)
|
||||||
{
|
{
|
||||||
return ~UpdateCRC(0xFFFFFFFF, buf, len);
|
return ~UpdateCRC(0xFFFFFFFF, buf, len);
|
||||||
}
|
}
|
||||||
@@ -46,7 +43,7 @@ void CStorage::MakeCRCTable(void)
|
|||||||
m_bHasCRCTable = true;
|
m_bHasCRCTable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CStorage::UpdateCRC(unsigned int crc, unsigned __int8* buf, int len)
|
unsigned int CStorage::UpdateCRC(unsigned int crc, unsigned __int8 *buf, int len)
|
||||||
{
|
{
|
||||||
if (!m_bHasCRCTable)
|
if (!m_bHasCRCTable)
|
||||||
{
|
{
|
||||||
@@ -55,13 +52,13 @@ unsigned int CStorage::UpdateCRC(unsigned int crc, unsigned __int8* buf, int len
|
|||||||
|
|
||||||
for (int c = 0; c < len; ++c)
|
for (int c = 0; c < len; ++c)
|
||||||
{
|
{
|
||||||
crc = (crc >> 8) ^ m_CRCTable[(unsigned __int8)(buf[c] ^ crc)];
|
crc = (crc >> 8) ^ m_CRCTable[(unsigned __int8)(buf[c] ^ crc)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStorage::DebugPrintf(const char* szFormat, ...)
|
void CStorage::DebugPrintf(const char *szFormat, ...)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "STO_SaveGame.h"
|
|
||||||
#include "STO_DLC.h"
|
#include "STO_DLC.h"
|
||||||
|
#include "STO_SaveGame.h"
|
||||||
|
|
||||||
class CStorage
|
class CStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CStorage(void);
|
||||||
|
|
||||||
CStorage(void);
|
void Init(int (*Func)(LPVOID, const C4JStorage::ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID);
|
||||||
|
void Tick(void);
|
||||||
|
unsigned int CRC(unsigned char *buf, int len);
|
||||||
|
void MakeCRCTable(void);
|
||||||
|
unsigned int UpdateCRC(unsigned int crc, unsigned __int8 *buf, int len);
|
||||||
|
void DebugPrintf(const char *szFormat, ...);
|
||||||
|
|
||||||
void Init(int(*Func)(LPVOID, const C4JStorage::ESavingMessage, int), LPVOID lpParam, LPCSTR szGroupID);
|
BYTE gap0[8];
|
||||||
void Tick(void);
|
CSaveGame m_SaveGame;
|
||||||
unsigned int CRC(unsigned char* buf, int len);
|
CDLC m_DLC;
|
||||||
void MakeCRCTable(void);
|
BYTE gap278[0x10];
|
||||||
unsigned int UpdateCRC(unsigned int crc, unsigned __int8* buf, int len);
|
DWORD m_CRCTable[256];
|
||||||
void DebugPrintf(const char* szFormat, ...);
|
bool m_bHasCRCTable;
|
||||||
|
|
||||||
BYTE gap0[8];
|
|
||||||
CSaveGame m_SaveGame;
|
|
||||||
CDLC m_DLC;
|
|
||||||
BYTE gap278[0x10];
|
|
||||||
DWORD m_CRCTable[256];
|
|
||||||
bool m_bHasCRCTable;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Singleton
|
// Singleton
|
||||||
|
|||||||
@@ -3,43 +3,44 @@
|
|||||||
|
|
||||||
CSaveGame::CSaveGame()
|
CSaveGame::CSaveGame()
|
||||||
{
|
{
|
||||||
m_pSaveData = nullptr;
|
m_pSaveData = nullptr;
|
||||||
m_uiSaveSize = 0;
|
m_uiSaveSize = 0;
|
||||||
m_bIsSafeDisabled = false;
|
m_bIsSafeDisabled = false;
|
||||||
|
|
||||||
ZeroMemory(m_szSaveUniqueName, sizeof(m_szSaveUniqueName));
|
ZeroMemory(m_szSaveUniqueName, sizeof(m_szSaveUniqueName));
|
||||||
ZeroMemory(m_szSaveTitle, sizeof(m_szSaveTitle));
|
ZeroMemory(m_szSaveTitle, sizeof(m_szSaveTitle));
|
||||||
|
|
||||||
m_pSaveDetails = nullptr;
|
m_pSaveDetails = nullptr;
|
||||||
m_bHasSaveDetails = false;
|
m_bHasSaveDetails = false;
|
||||||
|
|
||||||
GetCurrentDirectoryA(sizeof(m_szSaveUniqueName), m_szSaveUniqueName);
|
GetCurrentDirectoryA(sizeof(m_szSaveUniqueName), m_szSaveUniqueName);
|
||||||
|
|
||||||
char dirName[256];
|
char dirName[256];
|
||||||
char curDir[256];
|
char curDir[256];
|
||||||
GetCurrentDirectoryA(sizeof(dirName), dirName);
|
GetCurrentDirectoryA(sizeof(dirName), dirName);
|
||||||
sprintf(curDir, "%s/Windows64/GameHDD/", dirName);
|
sprintf(curDir, "%s/Windows64/GameHDD/", dirName);
|
||||||
CreateDirectoryA(curDir, 0);
|
CreateDirectoryA(curDir, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSaveGame::SetSaveDisabled(bool bDisable)
|
void CSaveGame::SetSaveDisabled(bool bDisable)
|
||||||
{
|
{
|
||||||
m_bIsSafeDisabled = bDisable;
|
m_bIsSafeDisabled = bDisable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSaveGame::GetSaveDisabled(void)
|
bool CSaveGame::GetSaveDisabled(void)
|
||||||
{
|
{
|
||||||
return m_bIsSafeDisabled;
|
return m_bIsSafeDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSaveGame::ResetSaveData()
|
void CSaveGame::ResetSaveData()
|
||||||
{
|
{
|
||||||
free(m_pSaveData);
|
free(m_pSaveData);
|
||||||
m_pSaveData = nullptr;
|
m_pSaveData = nullptr;
|
||||||
m_uiSaveSize = 0;
|
m_uiSaveSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState CSaveGame::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS* pSaveDetails, const bool), LPVOID lpParam, char* pszSavePackName)
|
C4JStorage::ESaveGameState CSaveGame::GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
|
||||||
|
char *pszSavePackName)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATAA findFileData;
|
WIN32_FIND_DATAA findFileData;
|
||||||
WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer;
|
WIN32_FILE_ATTRIBUTE_DATA fileInfoBuffer;
|
||||||
@@ -90,16 +91,15 @@ C4JStorage::ESaveGameState CSaveGame::GetSavesInfo(int iPad, int (*Func)(LPVOID
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0
|
if ((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 && strcmp(findFileData.cFileName, ".") &&
|
||||||
&& strcmp(findFileData.cFileName, ".")
|
strcmp(findFileData.cFileName, ".."))
|
||||||
&& strcmp(findFileData.cFileName, ".."))
|
|
||||||
{
|
{
|
||||||
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, findFileData.cFileName);
|
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, findFileData.cFileName);
|
||||||
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, findFileData.cFileName);
|
strcpy_s(m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, findFileData.cFileName);
|
||||||
|
|
||||||
char fileName[280];
|
char fileName[280];
|
||||||
sprintf(fileName, "%s\\Windows64\\GameHDD\\%s\\saveData.ms", dirName, findFileData.cFileName);
|
sprintf(fileName, "%s\\Windows64\\GameHDD\\%s\\saveData.ms", dirName, findFileData.cFileName);
|
||||||
|
|
||||||
GetFileAttributesExA(fileName, GetFileExInfoStandard, &fileInfoBuffer);
|
GetFileAttributesExA(fileName, GetFileExInfoStandard, &fileInfoBuffer);
|
||||||
m_pSaveDetails->SaveInfoA[i++].metaData.dataSize = fileInfoBuffer.nFileSizeLow;
|
m_pSaveDetails->SaveInfoA[i++].metaData.dataSize = fileInfoBuffer.nFileSizeLow;
|
||||||
m_pSaveDetails->iSaveC++;
|
m_pSaveDetails->iSaveC++;
|
||||||
@@ -142,24 +142,25 @@ void CSaveGame::ClearSavesInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState CSaveGame::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
|
C4JStorage::ESaveGameState CSaveGame::LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,
|
||||||
|
int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
Func(lpParam, pSaveInfo->thumbnailData, pSaveInfo->metaData.thumbnailSize);
|
Func(lpParam, pSaveInfo->thumbnailData, pSaveInfo->metaData.thumbnailSize);
|
||||||
return C4JStorage::ESaveGame_GetSaveThumbnail;
|
return C4JStorage::ESaveGame_GetSaveThumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState CSaveGame::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
|
C4JStorage::ESaveGameState CSaveGame::LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
SetSaveUniqueFilename(pSaveInfo->UTF8SaveFilename);
|
SetSaveUniqueFilename(pSaveInfo->UTF8SaveFilename);
|
||||||
|
|
||||||
if (m_pSaveData)
|
if (m_pSaveData)
|
||||||
{
|
{
|
||||||
free(m_pSaveData);
|
free(m_pSaveData);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pSaveData = malloc(pSaveInfo->metaData.dataSize);
|
m_pSaveData = malloc(pSaveInfo->metaData.dataSize);
|
||||||
m_uiSaveSize = pSaveInfo->metaData.dataSize;
|
m_uiSaveSize = pSaveInfo->metaData.dataSize;
|
||||||
|
|
||||||
char dirName[256];
|
char dirName[256];
|
||||||
char curDir[256];
|
char curDir[256];
|
||||||
char fileName[280];
|
char fileName[280];
|
||||||
@@ -167,7 +168,7 @@ C4JStorage::ESaveGameState CSaveGame::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Fu
|
|||||||
sprintf(dirName, "%s/Windows64/GameHDD/%s", curDir, m_szSaveUniqueName);
|
sprintf(dirName, "%s/Windows64/GameHDD/%s", curDir, m_szSaveUniqueName);
|
||||||
CreateDirectoryA(dirName, 0);
|
CreateDirectoryA(dirName, 0);
|
||||||
sprintf(fileName, "%s/saveData.ms", dirName);
|
sprintf(fileName, "%s/saveData.ms", dirName);
|
||||||
|
|
||||||
HANDLE h = CreateFileA(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
HANDLE h = CreateFileA(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
@@ -193,7 +194,7 @@ unsigned int CSaveGame::GetSaveSize()
|
|||||||
return m_uiSaveSize;
|
return m_uiSaveSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSaveGame::GetSaveData(void* pvData, unsigned int* puiBytes)
|
void CSaveGame::GetSaveData(void *pvData, unsigned int *puiBytes)
|
||||||
{
|
{
|
||||||
if (pvData)
|
if (pvData)
|
||||||
{
|
{
|
||||||
@@ -206,12 +207,12 @@ void CSaveGame::GetSaveData(void* pvData, unsigned int* puiBytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSaveGame::GetSaveUniqueNumber(INT* piVal)
|
bool CSaveGame::GetSaveUniqueNumber(INT *piVal)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSaveGame::GetSaveUniqueFilename(char* pszName)
|
bool CSaveGame::GetSaveUniqueFilename(char *pszName)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -225,7 +226,7 @@ void CSaveGame::SetSaveTitle(LPCWSTR pwchDefaultSaveName)
|
|||||||
PVOID CSaveGame::AllocateSaveData(unsigned int uiBytes)
|
PVOID CSaveGame::AllocateSaveData(unsigned int uiBytes)
|
||||||
{
|
{
|
||||||
free(m_pSaveData);
|
free(m_pSaveData);
|
||||||
|
|
||||||
m_pSaveData = malloc(uiBytes);
|
m_pSaveData = malloc(uiBytes);
|
||||||
if (m_pSaveData)
|
if (m_pSaveData)
|
||||||
{
|
{
|
||||||
@@ -240,7 +241,7 @@ void CSaveGame::SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE p
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState CSaveGame::SaveSaveData(int(*Func)(LPVOID, const bool), LPVOID lpParam)
|
C4JStorage::ESaveGameState CSaveGame::SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
char dirName[256];
|
char dirName[256];
|
||||||
char curDir[256];
|
char curDir[256];
|
||||||
@@ -255,7 +256,7 @@ C4JStorage::ESaveGameState CSaveGame::SaveSaveData(int(*Func)(LPVOID, const bool
|
|||||||
DWORD bytesWritten = 0;
|
DWORD bytesWritten = 0;
|
||||||
BOOL res = WriteFile(h, m_pSaveData, m_uiSaveSize, &bytesWritten, 0);
|
BOOL res = WriteFile(h, m_pSaveData, m_uiSaveSize, &bytesWritten, 0);
|
||||||
_ASSERT(res && bytesWritten == m_uiSaveSize);
|
_ASSERT(res && bytesWritten == m_uiSaveSize);
|
||||||
|
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
|
|
||||||
Func(lpParam, true);
|
Func(lpParam, true);
|
||||||
@@ -263,28 +264,21 @@ C4JStorage::ESaveGameState CSaveGame::SaveSaveData(int(*Func)(LPVOID, const bool
|
|||||||
return C4JStorage::ESaveGame_Idle;
|
return C4JStorage::ESaveGame_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
C4JStorage::ESaveGameState CSaveGame::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
|
C4JStorage::ESaveGameState CSaveGame::DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam)
|
||||||
{
|
{
|
||||||
return C4JStorage::ESaveGame_Idle;
|
return C4JStorage::ESaveGame_Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSaveGame::SetSaveUniqueFilename(char* szFilename)
|
void CSaveGame::SetSaveUniqueFilename(char *szFilename)
|
||||||
{
|
{
|
||||||
strcpy_s(m_szSaveUniqueName, szFilename);
|
strcpy_s(m_szSaveUniqueName, szFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CSaveGame::CreateSaveUniqueName(void)
|
void CSaveGame::CreateSaveUniqueName(void)
|
||||||
{
|
{
|
||||||
_SYSTEMTIME UTCSysTime;
|
_SYSTEMTIME UTCSysTime;
|
||||||
GetSystemTime(&UTCSysTime);
|
GetSystemTime(&UTCSysTime);
|
||||||
|
|
||||||
sprintf_s(m_szSaveUniqueName, sizeof(m_szSaveUniqueName),
|
sprintf_s(m_szSaveUniqueName, sizeof(m_szSaveUniqueName), "%4d%02d%02d%02d%02d%02d", UTCSysTime.wYear, UTCSysTime.wMonth, UTCSysTime.wDay,
|
||||||
"%4d%02d%02d%02d%02d%02d",
|
UTCSysTime.wHour, UTCSysTime.wMinute, UTCSysTime.wSecond);
|
||||||
UTCSysTime.wYear,
|
|
||||||
UTCSysTime.wMonth,
|
|
||||||
UTCSysTime.wDay,
|
|
||||||
UTCSysTime.wHour,
|
|
||||||
UTCSysTime.wMinute,
|
|
||||||
UTCSysTime.wSecond);
|
|
||||||
}
|
}
|
||||||
@@ -4,35 +4,36 @@
|
|||||||
class CSaveGame
|
class CSaveGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CSaveGame();
|
||||||
|
void SetSaveDisabled(bool bDisable);
|
||||||
|
bool GetSaveDisabled(void);
|
||||||
|
|
||||||
CSaveGame();
|
void ResetSaveData();
|
||||||
void SetSaveDisabled(bool bDisable);
|
C4JStorage::ESaveGameState GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, const bool), LPVOID lpParam,
|
||||||
bool GetSaveDisabled(void);
|
char *pszSavePackName);
|
||||||
|
PSAVE_DETAILS ReturnSavesInfo();
|
||||||
|
void ClearSavesInfo();
|
||||||
|
C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes),
|
||||||
|
LPVOID lpParam);
|
||||||
|
C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam);
|
||||||
|
unsigned int GetSaveSize();
|
||||||
|
void GetSaveData(void *pvData, unsigned int *puiBytes);
|
||||||
|
bool GetSaveUniqueNumber(INT *piVal);
|
||||||
|
bool GetSaveUniqueFilename(char *pszName);
|
||||||
|
void SetSaveTitle(LPCWSTR pwchDefaultSaveName);
|
||||||
|
PVOID AllocateSaveData(unsigned int uiBytes);
|
||||||
|
void SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes);
|
||||||
|
C4JStorage::ESaveGameState SaveSaveData(int (*Func)(LPVOID, const bool), LPVOID lpParam);
|
||||||
|
C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo, int (*Func)(LPVOID lpParam, const bool), LPVOID lpParam);
|
||||||
|
void SetSaveUniqueFilename(char *szFilename);
|
||||||
|
|
||||||
void ResetSaveData();
|
void CreateSaveUniqueName(void);
|
||||||
C4JStorage::ESaveGameState GetSavesInfo(int iPad, int (*Func)(LPVOID lpParam, SAVE_DETAILS* pSaveDetails, const bool), LPVOID lpParam, char* pszSavePackName);
|
|
||||||
PSAVE_DETAILS ReturnSavesInfo();
|
|
||||||
void ClearSavesInfo();
|
|
||||||
C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes), LPVOID lpParam);
|
|
||||||
C4JStorage::ESaveGameState LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam);
|
|
||||||
unsigned int GetSaveSize();
|
|
||||||
void GetSaveData(void* pvData, unsigned int* puiBytes);
|
|
||||||
bool GetSaveUniqueNumber(INT* piVal);
|
|
||||||
bool GetSaveUniqueFilename(char* pszName);
|
|
||||||
void SetSaveTitle(LPCWSTR pwchDefaultSaveName);
|
|
||||||
PVOID AllocateSaveData(unsigned int uiBytes);
|
|
||||||
void SetSaveImages(PBYTE pbThumbnail, DWORD dwThumbnailBytes, PBYTE pbImage, DWORD dwImageBytes, PBYTE pbTextData, DWORD dwTextDataBytes);
|
|
||||||
C4JStorage::ESaveGameState SaveSaveData(int(*Func)(LPVOID, const bool), LPVOID lpParam);
|
|
||||||
C4JStorage::ESaveGameState DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam);
|
|
||||||
void SetSaveUniqueFilename(char* szFilename);
|
|
||||||
|
|
||||||
void CreateSaveUniqueName(void);
|
void *m_pSaveData;
|
||||||
|
unsigned int m_uiSaveSize;
|
||||||
void* m_pSaveData;
|
char m_szSaveUniqueName[32];
|
||||||
unsigned int m_uiSaveSize;
|
char m_szSaveTitle[256];
|
||||||
char m_szSaveUniqueName[32];
|
bool m_bIsSafeDisabled;
|
||||||
char m_szSaveTitle[256];
|
bool m_bHasSaveDetails;
|
||||||
bool m_bIsSafeDisabled;
|
SAVE_DETAILS *m_pSaveDetails;
|
||||||
bool m_bHasSaveDetails;
|
|
||||||
SAVE_DETAILS* m_pSaveDetails;
|
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user