Merge pull request #89 from MindL0ve/main
This commit is contained in:
@@ -32,11 +32,6 @@
|
||||
#include <shacal2.h>
|
||||
#include <skipjack.h>
|
||||
#include <tea.h>
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
#include <ThemidaSDK.h>
|
||||
#endif
|
||||
|
||||
#include "Debug.h"
|
||||
|
||||
|
||||
@@ -162,9 +157,6 @@ void Cipher::CleanUp() {
|
||||
}
|
||||
|
||||
size_t Cipher::Prepare(void* buffer, size_t* length) {
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
assert(key_agreement_ == NULL);
|
||||
key_agreement_ = new DH2KeyAgreement();
|
||||
@@ -174,18 +166,12 @@ size_t Cipher::Prepare(void* buffer, size_t* length) {
|
||||
delete key_agreement_;
|
||||
key_agreement_ = NULL;
|
||||
}
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return agreed_length;
|
||||
}
|
||||
|
||||
bool Cipher::Activate(bool polarity, size_t agreed_length,
|
||||
const void* buffer, size_t length) {
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
assert(activated_ == false);
|
||||
assert(key_agreement_ != NULL);
|
||||
@@ -195,18 +181,11 @@ bool Cipher::Activate(bool polarity, size_t agreed_length,
|
||||
}
|
||||
delete key_agreement_;
|
||||
key_agreement_ = NULL;
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Cipher::SetUp(bool polarity) {
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
assert(key_agreement_ != NULL);
|
||||
const SecByteBlock& shared = key_agreement_->shared();
|
||||
|
||||
@@ -268,9 +247,6 @@ bool Cipher::SetUp(bool polarity) {
|
||||
|
||||
assert(encoder_ != NULL);
|
||||
assert(decoder_ != NULL);
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -340,10 +316,6 @@ DH2KeyAgreement::~DH2KeyAgreement() {
|
||||
}
|
||||
|
||||
size_t DH2KeyAgreement::Prepare(void* buffer, size_t* length) {
|
||||
#ifdef __THEMIDA__
|
||||
VM_START
|
||||
#endif
|
||||
|
||||
// RFC 5114, 1024-bit MODP Group with 160-bit Prime Order Subgroup
|
||||
// http://tools.ietf.org/html/rfc5114#section-2.1
|
||||
Integer p("0xB10B8F96A080E01DDE92DE5EAE5D54EC52C99FBCFB06A3C6"
|
||||
@@ -418,10 +390,6 @@ size_t DH2KeyAgreement::Prepare(void* buffer, size_t* length) {
|
||||
memcpy(buf, spub_key.BytePtr(), spub_key_length);
|
||||
memcpy(buf + spub_key_length, epub_key.BytePtr(), epub_key_length);
|
||||
|
||||
#ifdef __THEMIDA__
|
||||
VM_END
|
||||
#endif
|
||||
|
||||
return dh2_.AgreedValueLength();
|
||||
}
|
||||
|
||||
@@ -431,14 +399,12 @@ bool DH2KeyAgreement::Agree(size_t agreed_length, const void* buffer, size_t len
|
||||
return false;
|
||||
}
|
||||
const size_t spub_key_length = dh2_.StaticPublicKeyLength();
|
||||
const size_t epub_key_length = dh2_.EphemeralPublicKeyLength();
|
||||
if (length != (spub_key_length + epub_key_length)) {
|
||||
if (const size_t epub_key_length = dh2_.EphemeralPublicKeyLength(); length != (spub_key_length + epub_key_length)) {
|
||||
// Wrong data length
|
||||
return false;
|
||||
}
|
||||
shared_.New(dh2_.AgreedValueLength());
|
||||
const CryptoPP::byte* buf = (const CryptoPP::byte*)buffer;
|
||||
if (!dh2_.Agree(shared_, spriv_key_, epriv_key_, buf, buf + spub_key_length)) {
|
||||
if (const CryptoPP::byte* buf = (const CryptoPP::byte*)buffer; !dh2_.Agree(shared_, spriv_key_, epriv_key_, buf, buf + spub_key_length)) {
|
||||
// Failed to reach shared secret
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// Forward declaration
|
||||
class KeyAgreement;
|
||||
|
||||
//THEMIDA
|
||||
// Communication channel encryption handler.
|
||||
class Cipher {
|
||||
public:
|
||||
|
||||
@@ -629,7 +629,7 @@ const char * GetRecvHeaderName(BYTE header)
|
||||
stringList[30] = "HEADER_GC_QUICKSLOT_SWAP";
|
||||
stringList[31] = "HEADER_GC_ITEM_OWNERSHIP";
|
||||
stringList[33] = "HEADER_GC_ITEM_UNBIND_TIME";
|
||||
stringList[34] = "HEADER_GC_WHISPER ";
|
||||
stringList[34] = "HEADER_GC_WHISPER";
|
||||
stringList[35] = "HEADER_GC_ALERT";
|
||||
stringList[36] = "HEADER_GC_MOTION";
|
||||
stringList[38] = "HEADER_GC_SHOP";
|
||||
|
||||
@@ -68,10 +68,8 @@ struct FGetPickingPoint
|
||||
|
||||
CMapOutdoor::CMapOutdoor()
|
||||
{
|
||||
CGraphicImage * pAlphaFogImage = (CGraphicImage *) CResourceManager::Instance().GetResourcePointer("D:/ymir work/special/fog.tga");
|
||||
CGraphicImage * pAttrImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer("d:/ymir work/special/white.dds");
|
||||
CGraphicImage * pBuildTransparentImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer("d:/ymir Work/special/PCBlockerAlpha.dds");
|
||||
m_AlphaFogImageInstance.SetImagePointer(pAlphaFogImage);
|
||||
m_attrImageInstance.SetImagePointer(pAttrImage);
|
||||
m_BuildingTransparentImageInstance.SetImagePointer(pBuildTransparentImage);
|
||||
|
||||
@@ -168,7 +166,6 @@ bool CMapOutdoor::Initialize()
|
||||
|
||||
D3DXMatrixIdentity(&m_matWorldForCommonUse);
|
||||
|
||||
InitializeFog();
|
||||
InitializeVisibleParts();
|
||||
|
||||
m_dwBaseX = 0;
|
||||
@@ -212,8 +209,6 @@ bool CMapOutdoor::Destroy()
|
||||
|
||||
m_rkList_kGuildArea.clear();
|
||||
m_kPool_kMonsterAreaInfo.Destroy();
|
||||
m_AlphaFogImageInstance.Destroy();
|
||||
|
||||
CSpeedTreeForestDirectX8::Instance().Clear();
|
||||
|
||||
return true;
|
||||
@@ -1045,39 +1040,6 @@ BOOL CMapOutdoor::GetTerrainPointer(const BYTE c_byTerrainNum, CTerrain ** ppTer
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CMapOutdoor::InitializeFog()
|
||||
{
|
||||
memset(&m_matAlphaFogTexture, 0, sizeof(D3DXMATRIX));
|
||||
m_matAlphaFogTexture._31 = -0.001f;
|
||||
m_matAlphaFogTexture._41 = -7.0f;
|
||||
m_matAlphaFogTexture._42 = 0.5f;
|
||||
}
|
||||
|
||||
void CMapOutdoor::SaveAlphaFogOperation()
|
||||
{
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_CURRENT);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION);
|
||||
STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
|
||||
STATEMANAGER.SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
|
||||
|
||||
STATEMANAGER.SetTransform(D3DTS_TEXTURE1, &m_matAlphaFogTexture);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
STATEMANAGER.SetTexture(1, m_AlphaFogImageInstance.GetTexturePointer()->GetD3DTexture());
|
||||
}
|
||||
|
||||
void CMapOutdoor::RestoreAlphaFogOperation()
|
||||
{
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_ALPHABLENDENABLE);
|
||||
}
|
||||
|
||||
|
||||
void CMapOutdoor::SetDrawShadow(bool bDrawShadow)
|
||||
{
|
||||
m_bDrawShadow = bDrawShadow;
|
||||
|
||||
@@ -71,7 +71,6 @@ class CMapOutdoor : public CMapBase
|
||||
|
||||
protected:
|
||||
bool Initialize();
|
||||
void InitializeFog();
|
||||
|
||||
virtual bool Destroy();
|
||||
virtual void OnSetEnvironmentDataPtr();
|
||||
@@ -163,9 +162,6 @@ class CMapOutdoor : public CMapBase
|
||||
|
||||
void AssignTerrainPtr(); // 현재 좌표에서 주위(ex. 3x3)에 있는 것들의 포인터를 연결한다. (업데이트 시 불려짐)
|
||||
|
||||
void SaveAlphaFogOperation();
|
||||
void RestoreAlphaFogOperation();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// New
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -413,13 +409,6 @@ class CMapOutdoor : public CMapBase
|
||||
//Water
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Alpha Fog
|
||||
CGraphicImageInstance m_AlphaFogImageInstance;
|
||||
D3DXMATRIX m_matAlphaFogTexture;
|
||||
// Alpha Fog
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Character Shadow
|
||||
LPDIRECT3DTEXTURE9 m_lpCharacterShadowMapTexture;
|
||||
|
||||
Reference in New Issue
Block a user