PinoyBigBusTed
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomePortalSearchLatest imagesRegisterLog inThx

Share | 
 

 [Source]SF Shader WH (not finish)

View previous topic View next topic Go down 
AuthorMessage
larongpating

larongpating

:[]:Warning Level:[]: : [Source]SF Shader WH (not finish) WarningBar-Gloss1

Posts : 2
Points : 6
Reputation : 0
Join date : 2010-01-30

[Source]SF Shader WH (not finish) Vide
PostSubject: [Source]SF Shader WH (not finish)   [Source]SF Shader WH (not finish) EmptySat Apr 24, 2010 7:36 am

Code:
#include <stdafx.h>
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#define _WIN32_WINDOWS 0x0410
#define _WIN32_IE 0x0600
#include <windows.h>
#include <detours.h>
#include <d3d8.h>
#include "d3dx8.h"
#include <process.h>
#pragma comment( lib, "d3d8" )
#pragma comment( lib, "d3dx8" )
#pragma warning( disable: 4312 )

#define ForceRecon (NumVertices == 83 && primCount == 137 || NumVertices == 79 && primCount == 105 || NumVertices == 142 && primCount == 174 || NumVertices == 278 && primCount == 462 || NumVertices == 263 && primCount == 290 || NumVertices == 316 && primCount == 556)
#define ForceReconAddons (NumVertices == 432 && primCount == 354 || NumVertices == 144 && primCount == 136 || NumVertices == 299 && primCount == 311 || NumVertices == 167 && primCount == 252 || NumVertices == 298 && primCount == 506 || NumVertices == 168 && primCount == 254 || NumVertices == 860 && primCount == 778 || NumVertices == 648 && primCount == 710 || NumVertices == 113 && primCount == 189 || NumVertices == 142 && primCount == 172 || NumVertices == 87 && primCount == 90 || NumVertices == 79 && primCount == 105 || NumVertices == 84 && primCount == 110 || NumVertices == 70 && primCount == 70 || NumVertices == 860 && primCount == 778 || NumVertices == 85 && primCount == 137)
#define Mulan (NumVertices == 118 && primCount == 126|| NumVertices == 121 && primCount == 180|| NumVertices == 124 && primCount == 126|| NumVertices == 295 && primCount == 482|| NumVertices == 299 && primCount == 452|| NumVertices == 474 && primCount == 728)
#define MulanAddons (NumVertices == 162 && primCount == 200|| NumVertices == 120 && primCount == 188|| NumVertices == 167 && primCount == 276|| NumVertices == 108 && primCount == 198|| NumVertices == 512 && primCount == 728|| NumVertices == 790 && primCount == 881|| NumVertices == 619 && primCount == 800|| NumVertices == 399 && primCount == 532|| NumVertices == 402 && primCount == 580|| NumVertices == 102 && primCount == 170|| NumVertices == 125 && primCount == 98|| NumVertices == 116 && primCount == 128|| NumVertices == 160 && primCount == 174)


IDirect3DDevice8** pGameDev = NULL;    //(IDirect3DDevice8**)0x00720BE4;
IDirect3DDevice8* pDev = NULL;
int texnum;
int NumVertices;
int primCount;
bool bInit = false;
bool bPlayers = false;
bool bItems = false;
const char InvD[]=    "ps.1.0\n\
def c0, 1.0f, 1.0f,1.0f, 1.0f\n\
tex t0\n\
sub r0,c0,t0";

DWORD InvPS = NULL;

void release_stuff()
{
    bInit = false;
    if( InvPS )
        pDev->DeletePixelShader( InvPS );
    InvPS = NULL;
}

void init_stuff()
{
   
    LPD3DXBUFFER pCode = NULL;
    LPD3DXBUFFER pErrorMsgs = NULL;

    D3DXAssembleShader( InvD,sizeof(InvD) -1, 0, NULL, &pCode, &pErrorMsgs );
    pDev->CreatePixelShader( (DWORD *)pCode->GetBufferPointer(), &InvPS );
    bInit = true;
 
}


HRESULT (__stdcall* or_DrawIndexedPrimitive)(IDirect3DDevice8* dev, D3DPRIMITIVETYPE type,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) = NULL;
HRESULT __stdcall my_DrawIndexedPrimitive(IDirect3DDevice8* dev, D3DPRIMITIVETYPE type,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
    if( !bInit ) return or_DrawIndexedPrimitive( dev, type, minIndex, NumVertices, startIndex, primCount );
    HRESULT hRet;
    IDirect3DVertexBuffer8* pStreamData;
    UINT Stride;
    dev->GetStreamSource( NULL, &pStreamData, &Stride );
    pStreamData->Release();
   texnum = (NumVertices*100000)+primCount;
    if( (Stride == 40 && bPlayers) ||
      (texnum==34900580)|| // Delta Force Head
      (texnum==36100604)|| // Spetsnaz Head
      (texnum==38000658)|| // Spetsnaz Legs
      (texnum==18300268)|| // Spetsnaz Body
      (texnum==36200604)|| // GIGN Head
      (texnum==21200306)|| // GIGN Body
      (texnum==35500568)|| // GSG9 Head
      (texnum==2200024)|| // GSG9 Bangs
      (texnum==8800105)|| // GSG9 Feet
      (texnum==36900650)|| // GSG9 Legs
      (texnum==19600314)|| // GSG9 Body
      (texnum==36700612)|| // SAS Head
      (texnum==8500105)|| // SAS Feet
      (texnum==37000650)|| // SAS Legs
      (texnum==18000274)|| // SAS Body
      (texnum==35300556)|| // KSF Head
      (texnum==7500121)|| // KSF Arms
      (texnum==9200115)|| // KSF Feet
      (texnum==12400168)|| // KSF Hands
      (texnum==30100522)|| // KSF Legs
      (texnum==18700288)|| // KSF Body
      (texnum==40900594)|| // ARTC Head
      (texnum==11700190)|| // ARTC Arms
      (texnum==9100118)|| // ARTC Feet
      (texnum==12500170)|| // ARTC Hands
      (texnum==37000634)|| // ARTC Legs
      (texnum==41700516)|| // ARTC Body
      (texnum==19400260)|| // ROKMC Body
      (texnum==37900592)|| // ROKMC Head
      (texnum==36500642)|| // ROKMC Legs
      (texnum==44800776)|| // SRG Head
      (texnum==15900200)|| // SRG Left Arm
      (texnum==10500168)|| // SRG Right Arm
      (texnum==80401016)|| // SRG Body
      (texnum==10000121)|| // SRG Feet
      (texnum==13200180)|| // SRG Hands
      (ForceRecon)|| // ForceRecon
      (Mulan)||
      (texnum==33800534)|| // SRG Leg
(texnum==13200212)|| // Delta Force Helmet
(texnum==13200212)|| // Delta Force Helmet 2
(texnum==34700538)|| // Delta Force Gas Mask
(texnum==19500352)|| // Delta Force Balaclava
(texnum==84900778)|| // Delta Force Clan BDU
(texnum==27500442)|| // Delta Force Body Armor
(texnum==42800576)|| // Delta Force Body Armor 2
(texnum==52100658)|| // Delta Force Tactical Vest
(texnum==12200196)|| // Spetsnaz Helmet
(texnum==27100464)|| // Spetsnaz Gas Mask
(texnum==33600552)|| // Spetsnaz Body Armor
(texnum==44100646)|| // Spetsnaz Tactical Vest
(texnum==17800292)|| // GIGN Red Bandana
(texnum==21300290)|| // GIGN Helmet
(texnum==2800036)|| // GIGN Helmet Lens
(texnum==35700558)|| // GIGN Gas Mask
(texnum==22100396)|| // GIGN Balaclava
(texnum==29700492)|| // GIGN Body Armor
(texnum==11200188)|| // ROKMC Beret
(texnum==12000194)|| // ROKMC Helmet
(texnum==29800450)|| // ROKMC Gas Mask
(texnum==27100394)|| // ROKMC Body Armor
(texnum==28700374)|| // ROKMC X Harness
(texnum==34700470)|| // ROKMC X Harness
(texnum==5100056)|| // ROKMC Pouch
(texnum==9900163)|| // ROKMC Left Arm
(texnum==18300163)|| // ROKMC Right Arm
(texnum==16400266)|| // GSG9 Red Bandana
(texnum==16200243)|| // GSG9 Helmet
(texnum==31900466)|| // GSG9 Gas Mask
(texnum==19300342)|| // GSG9 Balaclava
(texnum==83600752)|| // GSG9 Clan BDU
(texnum==33400477)|| // GSG9 Body Armor
(texnum==10500163)|| // GSG9 Rolled Up Sleeves
(texnum==38100666)|| // GSG9 Tactical Knee Pads
(texnum==9600172)|| // SAS Boonie Hat
(texnum==14200236)|| // SAS Helmet
(texnum==37800552)|| // SAS Gas Mask
(texnum==28100486)|| // SAS Balaclava
(texnum==62400752)|| // SAS Clan BDU
(texnum==27900456)|| // SAS Body Armor
(texnum==45700654)|| // SAS Tactical Vest
(texnum==39800532)|| // SAS Tactical Vest 2
(texnum==9200100)|| // SAS Holster
(texnum==4800040)|| // SAS Magazine Pouch
(texnum==4000044)|| // SAS Pouch
(texnum==6500110) || // KSF Boonie Hat
(texnum==12900208)|| // KSF Helmet
(texnum==29600448)|| // KSF Gas Mask
(texnum==31100398)|| // KSF Sunglasses
(texnum==84700776)|| // KSF Clan BDU
(texnum==600004)|| // KSF Clan BDU Logo
(texnum==36500606)|| // KSF Body Armor
(texnum==63100646)|| // KSF Tactical Vest
(texnum==19800163)|| // KSF Rolled Up Sleeves
(texnum==7000066)|| // KSF Holster
(texnum==10400190)|| // SRG Beret
(texnum==23800294)|| // SRG Deer Head
(texnum==11600180)|| // SRG NIJ IIIA Helmet
(texnum==17100278)|| // SRG Red Bandana
(texnum==14600198)|| // SRG Battle Cap
(texnum==18200266)|| // SRG Helmet
(texnum==19100106)|| // SRG Gas Mask
(texnum==54300350)|| // SRG Sunglasses
(texnum==30800380)|| // SRG Mid Class Sunglasses
(texnum==79300995)|| // SRG Clan BDU 1
(texnum==13300138)|| // SRG Clan BDU 2
(texnum==300001)|| // SRG Clan BDU 3
(texnum==1200012)|| // SRG Clan BDU Logo
(texnum==10900110)|| // SRG Bulletproof Vest
(texnum==6200064)|| // SRG Holster
(ForceReconAddons)||
(MulanAddons)||
(texnum==22700250)|| // SRG Pouch
(texnum==187200968)|| // GALIL
(texnum==187200968)|| // GALIL 2
(texnum==149701124)|| // UZI
(texnum==193701304)|| // M249
(texnum==232501431)|| // SIG551
(texnum==161500751)|| // FA-MAS
(texnum==107400724)|| // FR-F2
(texnum==141600900)|| // AN94
(texnum==145900805)|| // G36C
(texnum==42200339)|| // K1
(texnum==23400116)|| // K1 2
(texnum==17500073)|| // K1 3
(texnum==3200012)|| // K1 4
(texnum==2300012)|| // K1 5
(texnum==71900459)|| // MP5
(texnum==1800008)|| // MP5 2
(texnum==20300084)|| // MP5 3
(texnum==16700083)|| // MP5 4
(texnum==79100469)|| // M4A1
(texnum==12000044)|| // M4A1 2
(texnum==16800062)|| // M4A1 3
(texnum==2400008)|| // M4A1 4
(texnum==600002)|| // M4A1 5
(texnum==12800050)|| // M4A1 6
(texnum==2600010)|| // M4A1 7
(texnum==4200014)|| // M4A1 8
(texnum==1400008)|| // M4A1 9
(texnum==80600442)|| // M16A2
(texnum==13400052)|| // M16A2 2
(texnum==17600066)|| // M16A2 3
(texnum==5400018)|| // M16A2 4
(texnum==46200348)|| // STEYR_AUG
(texnum==27000133)|| // STEYR_AUG 2
(texnum==4100025)|| // STEYR_AUG 3
(texnum==1200006)|| // STEYR_AUG 4
(texnum==400002)|| // STEYR_AUG 5
(texnum==46800367)|| // PSG-1
(texnum==9600042)|| // PSG-1 2
(texnum==18800092)|| // PSG-1 3
(texnum==16900071)|| // PSG-1 4
(texnum==3400012)|| // PSG-1 5
(texnum==800004)|| // PSG-1 6
(texnum==40500383)|| // K2
(texnum==15800089)|| // K2 2
(texnum==2200012)|| // K2 3
(texnum==7000034)|| // K2 4
(texnum==60700349)|| // P90
(texnum==5500033)|| // P90 2
(texnum==47700227)|| // P90 3
(texnum==10300047)|| // P90 4
(texnum==3800014)|| // P90 5
(texnum==50300349)|| // AK-74
(texnum==14700071)|| // AK-74 2
(texnum==13100061)|| // AK-74 3
(texnum==194501145)|| // MG36
(texnum==116000670)|| // DESERT EAGLE
(texnum==182101089)|| // MR73
(texnum==62500454)|| // REMINGTON M870
(texnum==95200571)|| // BENELLI M1
(texnum==40700334)|| // GLOCK 23
(texnum==71500449)|| // BERETTA M92F
(texnum==11000044)|| // BERETTA M92F 2
(texnum==16500075)|| // BERETTA M92F 3
(texnum==4400020)|| // BERETTA M92F 4
(texnum==2800014)|| // BERETTA M92F 5
(texnum==92000543)|| // COLT 45
(texnum==239001276)) // DRAGONUV
   {
        dev->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
        dev->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
        dev->SetRenderState( D3DRS_FOGENABLE, D3DZB_FALSE );
        dev->SetPixelShader( InvPS );
    }
    hRet = or_DrawIndexedPrimitive( dev, type, minIndex, NumVertices, startIndex, primCount );
    if( (Stride == 40 && bPlayers)||
   (texnum==34900580)|| // Delta Force Head
      (texnum==36100604)|| // Spetsnaz Head
      (texnum==38000658)|| // Spetsnaz Legs
      (texnum==18300268)|| // Spetsnaz Body
      (texnum==36200604)|| // GIGN Head
      (texnum==21200306)|| // GIGN Body
      (texnum==35500568)|| // GSG9 Head
      (texnum==2200024)|| // GSG9 Bangs
      (texnum==8800105)|| // GSG9 Feet
      (texnum==36900650)|| // GSG9 Legs
      (texnum==19600314)|| // GSG9 Body
      (texnum==36700612)|| // SAS Head
      (texnum==8500105)|| // SAS Feet
      (texnum==37000650)|| // SAS Legs
      (texnum==18000274)|| // SAS Body
      (texnum==35300556)|| // KSF Head
      (texnum==7500121)|| // KSF Arms
      (texnum==9200115)|| // KSF Feet
      (texnum==12400168)|| // KSF Hands
      (texnum==30100522)|| // KSF Legs
      (texnum==18700288)|| // KSF Body
      (texnum==40900594)|| // ARTC Head
      (texnum==11700190)|| // ARTC Arms
      (texnum==9100118)|| // ARTC Feet
      (texnum==12500170)|| // ARTC Hands
      (texnum==37000634)|| // ARTC Legs
      (texnum==41700516)|| // ARTC Body
      (texnum==19400260)|| // ROKMC Body
      (texnum==37900592)|| // ROKMC Head
      (texnum==36500642)|| // ROKMC Legs
      (texnum==44800776)|| // SRG Head
      (texnum==15900200)|| // SRG Left Arm
      (texnum==10500168)|| // SRG Right Arm
      (texnum==80401016)|| // SRG Body
      (texnum==10000121)|| // SRG Feet
      (texnum==13200180)|| // SRG Hands
      (ForceRecon)|| // ForceRecon
      (Mulan)||
      (texnum==33800534)|| // SRG Leg
(texnum==13200212)|| // Delta Force Helmet
(texnum==13200212)|| // Delta Force Helmet 2
(texnum==34700538)|| // Delta Force Gas Mask
(texnum==19500352)|| // Delta Force Balaclava
(texnum==84900778)|| // Delta Force Clan BDU
(texnum==27500442)|| // Delta Force Body Armor
(texnum==42800576)|| // Delta Force Body Armor 2
(texnum==52100658)|| // Delta Force Tactical Vest
(texnum==12200196)|| // Spetsnaz Helmet
(texnum==27100464)|| // Spetsnaz Gas Mask
(texnum==33600552)|| // Spetsnaz Body Armor
(texnum==44100646)|| // Spetsnaz Tactical Vest
(texnum==17800292)|| // GIGN Red Bandana
(texnum==21300290)|| // GIGN Helmet
(texnum==2800036)|| // GIGN Helmet Lens
(texnum==35700558)|| // GIGN Gas Mask
(texnum==22100396)|| // GIGN Balaclava
(texnum==29700492)|| // GIGN Body Armor
(texnum==11200188)|| // ROKMC Beret
(texnum==12000194)|| // ROKMC Helmet
(texnum==29800450)|| // ROKMC Gas Mask
(texnum==27100394)|| // ROKMC Body Armor
(texnum==28700374)|| // ROKMC X Harness
(texnum==34700470)|| // ROKMC X Harness
(texnum==5100056)|| // ROKMC Pouch
(texnum==9900163)|| // ROKMC Left Arm
(texnum==18300163)|| // ROKMC Right Arm
(texnum==16400266)|| // GSG9 Red Bandana
(texnum==16200243)|| // GSG9 Helmet
(texnum==31900466)|| // GSG9 Gas Mask
(texnum==19300342)|| // GSG9 Balaclava
(texnum==83600752)|| // GSG9 Clan BDU
(texnum==33400477)|| // GSG9 Body Armor
(texnum==10500163)|| // GSG9 Rolled Up Sleeves
(texnum==38100666)|| // GSG9 Tactical Knee Pads
(texnum==9600172)|| // SAS Boonie Hat
(texnum==14200236)|| // SAS Helmet
(texnum==37800552)|| // SAS Gas Mask
(texnum==28100486)|| // SAS Balaclava
(texnum==62400752)|| // SAS Clan BDU
(texnum==27900456)|| // SAS Body Armor
(texnum==45700654)|| // SAS Tactical Vest
(texnum==39800532)|| // SAS Tactical Vest 2
(texnum==9200100)|| // SAS Holster
(texnum==4800040)|| // SAS Magazine Pouch
(texnum==4000044)|| // SAS Pouch
(texnum==6500110) || // KSF Boonie Hat
(texnum==12900208)|| // KSF Helmet
(texnum==29600448)|| // KSF Gas Mask
(texnum==31100398)|| // KSF Sunglasses
(texnum==84700776)|| // KSF Clan BDU
(texnum==600004)|| // KSF Clan BDU Logo
(texnum==36500606)|| // KSF Body Armor
(texnum==63100646)|| // KSF Tactical Vest
(texnum==19800163)|| // KSF Rolled Up Sleeves
(texnum==7000066)|| // KSF Holster
(texnum==10400190)|| // SRG Beret
(texnum==23800294)|| // SRG Deer Head
(texnum==11600180)|| // SRG NIJ IIIA Helmet
(texnum==17100278)|| // SRG Red Bandana
(texnum==14600198)|| // SRG Battle Cap
(texnum==18200266)|| // SRG Helmet
(texnum==19100106)|| // SRG Gas Mask
(texnum==54300350)|| // SRG Sunglasses
(texnum==30800380)|| // SRG Mid Class Sunglasses
(texnum==79300995)|| // SRG Clan BDU 1
(texnum==13300138)|| // SRG Clan BDU 2
(texnum==300001)|| // SRG Clan BDU 3
(texnum==1200012)|| // SRG Clan BDU Logo
(texnum==10900110)|| // SRG Bulletproof Vest
(texnum==6200064)|| // SRG Holster
(ForceReconAddons)||
(MulanAddons)||
(texnum==22700250)|| // SRG Pouch
(texnum==187200968)|| // GALIL
(texnum==187200968)|| // GALIL 2
(texnum==149701124)|| // UZI
(texnum==193701304)|| // M249
(texnum==232501431)|| // SIG551
(texnum==161500751)|| // FA-MAS
(texnum==107400724)|| // FR-F2
(texnum==141600900)|| // AN94
(texnum==145900805)|| // G36C
(texnum==42200339)|| // K1
(texnum==23400116)|| // K1 2
(texnum==17500073)|| // K1 3
(texnum==3200012)|| // K1 4
(texnum==2300012)|| // K1 5
(texnum==71900459)|| // MP5
(texnum==1800008)|| // MP5 2
(texnum==20300084)|| // MP5 3
(texnum==16700083)|| // MP5 4
(texnum==79100469)|| // M4A1
(texnum==12000044)|| // M4A1 2
(texnum==16800062)|| // M4A1 3
(texnum==2400008)|| // M4A1 4
(texnum==600002)|| // M4A1 5
(texnum==12800050)|| // M4A1 6
(texnum==2600010)|| // M4A1 7
(texnum==4200014)|| // M4A1 8
(texnum==1400008)|| // M4A1 9
(texnum==80600442)|| // M16A2
(texnum==13400052)|| // M16A2 2
(texnum==17600066)|| // M16A2 3
(texnum==5400018)|| // M16A2 4
(texnum==46200348)|| // STEYR_AUG
(texnum==27000133)|| // STEYR_AUG 2
(texnum==4100025)|| // STEYR_AUG 3
(texnum==1200006)|| // STEYR_AUG 4
(texnum==400002)|| // STEYR_AUG 5
(texnum==46800367)|| // PSG-1
(texnum==9600042)|| // PSG-1 2
(texnum==18800092)|| // PSG-1 3
(texnum==16900071)|| // PSG-1 4
(texnum==3400012)|| // PSG-1 5
(texnum==800004)|| // PSG-1 6
(texnum==40500383)|| // K2
(texnum==15800089)|| // K2 2
(texnum==2200012)|| // K2 3
(texnum==7000034)|| // K2 4
(texnum==60700349)|| // P90
(texnum==5500033)|| // P90 2
(texnum==47700227)|| // P90 3
(texnum==10300047)|| // P90 4
(texnum==3800014)|| // P90 5
(texnum==50300349)|| // AK-74
(texnum==14700071)|| // AK-74 2
(texnum==13100061)|| // AK-74 3
(texnum==194501145)|| // MG36
(texnum==116000670)|| // DESERT EAGLE
(texnum==182101089)|| // MR73
(texnum==62500454)|| // REMINGTON M870
(texnum==95200571)|| // BENELLI M1
(texnum==40700334)|| // GLOCK 23
(texnum==71500449)|| // BERETTA M92F
(texnum==11000044)|| // BERETTA M92F 2
(texnum==16500075)|| // BERETTA M92F 3
(texnum==4400020)|| // BERETTA M92F 4
(texnum==2800014)|| // BERETTA M92F 5
(texnum==92000543)|| // COLT 45
(texnum==239001276)) // DRAGONUV
   {
        dev->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
        dev->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
        dev->SetPixelShader( NULL );
        or_DrawIndexedPrimitive( dev, type, minIndex, NumVertices, startIndex, primCount );
        return hRet;
    }

    return hRet;
}

HRESULT (__stdcall* or_EndScene)( IDirect3DDevice8* dev );
HRESULT __stdcall my_EndScene( IDirect3DDevice8* dev )
{
    if( !bInit ) init_stuff();
   
    if( GetAsyncKeyState( VK_HOME ) &1 ) {
        bPlayers = !bPlayers;
    }
    return or_EndScene( dev );
}

HRESULT (__stdcall* or_Reset)( IDirect3DDevice8* dev, D3DPRESENT_PARAMETERS* pPresentationParameters );
HRESULT __stdcall my_Reset( IDirect3DDevice8* dev, D3DPRESENT_PARAMETERS* pPresentationParameters )
{
    release_stuff();
    HRESULT hRet = or_Reset( dev, pPresentationParameters );
    if( SUCCEEDED(hRet) )
        init_stuff();
    return hRet;
}



unsigned char findT[] = "\xA1\xA7\xA7\xA7\xA7\x8B\x08\x6A\x00\x50\xFF\x51\x18\xC3";


char *findText( const char *start, const char *dwEnd, unsigned char *patt, size_t iMax )
{
        char *finder = (char*)start;
    char *pbMaxAddr = (char*)dwEnd;
    size_t i = 0;
    for( ; i < iMax && finder < pbMaxAddr; )
    {
        if( ( (*finder & 0xff) == (patt[i] & 0xff)) || patt[i] == 0xA7 )
            i++;
        else if( i != 0 ) {
            finder -= i;
            i = 0;
        }
        finder++;
    }
    if( i == iMax ) {
        return (finder-i);
    }
        return 0;
}


bool bRun = true;

void wait_func( void* )
{
    char * find = findText( (const char*)0x401000, (const char *)0x401000 + 0x293000, findT, sizeof(findT)-1 );
    if( !find )
        return;
    DWORD * dwAdd = (DWORD*)*(DWORD*)(find+1);
    pGameDev = (IDirect3DDevice8 **)(dwAdd+1);
    MessageBeep( 0xFFFFFFFF );

    while( !*pGameDev )
        Sleep( 100 );
    while( bRun ) {
        if( pDev != *pGameDev ) {
            pDev = *pGameDev;
            UINT *vTable = (UINT*)pDev;
            vTable = (UINT*)*vTable;
            DWORD dwOld;
            VirtualProtect( vTable, 500, PAGE_EXECUTE_READWRITE, &dwOld );
            *(void**)&or_DrawIndexedPrimitive = (void*)vTable[71];
            *(void**)&vTable[71] = (void*)my_DrawIndexedPrimitive;

            *(void**)&or_EndScene = (void*)vTable[35];
            *(void**)&vTable[35] = (void*)my_EndScene;

            *(void**)&or_Reset = (void*)vTable[14];
            *(void**)&vTable[14] = (void*)my_Reset;
            bInit = false;
        }
        Sleep( 100 );
    }
    pDev = *pGameDev;
    UINT *vTable = (UINT*)pDev;
    vTable = (UINT*)*vTable;
    DWORD dwOld;
    VirtualProtect( vTable, 500, PAGE_EXECUTE_READWRITE, &dwOld );
    *(void**)&vTable[71] = (void*)or_DrawIndexedPrimitive;
    *(void**)&vTable[35] = (void*)or_EndScene;
    *(void**)&vTable[14] = (void*)or_Reset;
    release_stuff();
}

BOOL APIENTRY DllMain( HMODULE /*hModule*/, DWORD dwReason, LPVOID /*lpReserved*/ )
{
    if( dwReason == DLL_PROCESS_ATTACH ) {
        _beginthread( wait_func, NULL, NULL );
    } else if( dwReason == DLL_PROCESS_DETACH ) {
        bRun = false;
        Sleep( 500 );
    }
    return TRUE;
}

hello i just want to share my dll source code.. there's still some errors so you just have to fix it your self.. edit somethings.. like that hehe..

oh and by the way of your going to compile it dont forget to ignore a specific error like lilbl.lib etc... to do this go to menu bar click...

project>main.cpp properties>Configuration properties>Linker>Input

then in the ignore specific library.. just type ur lib error like lilbl.lib

thanks.. Smile

best regards,
larongpating chaingun chaingun chaingun bigshot bigshot
Back to top Go down
 

[Source]SF Shader WH (not finish)

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
PinoyBigBusTed :: [Programming] :: D3D-
Create a forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com