HGE 1.81 updated to DirectX 9
  • AkkernightAkkernight April 2009
    HGE DirectX 9
    Updated!

    Download links:

    7-zip version:
    [Dead link removed]

    zip version:
    [Dead link removed]


    Alternative download links:

    By arturooo3: http://arturooo.webd.pl/hge/hge181dx9.zip <- Not confirmed to be updated!

    Notes:
    There's now included another .dll file, this one if from the DirectX build used to build HGE DirectX 9.
    I can't promise eternal publishing of these files!

    Download the 7zip version if you can open .7z format files, this version is way smaller!

    Download the zip version if you can't open .7z format files.

    http://www.7-zip.org/ <- This application can open .7z format files! If you want a list of which applications can, use Google.

    Quoted from DaiShiva:

    That's why I made a patch file, for when people dont want to host their files anymore
    1. download hge 1.8.1: http://hge.relishgames.com/files/hge.zip
    2. download the patch file: http://www.daishiva.com/other/hge_dx9.patch
    3. run the patch command
    4. recompile hge


    Use this advice if download links are down!

    - Akker
  • ProfEclipseProfEclipse April 2009
    The file containing the power functions is included with the HGE source, but it appears that it was left out of the project file, so it doesn't get compiled. Just add power.cpp to your HGE project and it should work.
  • UnknownUnknown May 2009
    Can you list up the changes of the new version if you have applied anything to the old version ?

    thanks
  • merciormercior May 2009
    Bout time someone got round to posting the source to this, enough of us have done it! :)

    Good job Akker... Add me to the space & if I can find time this week I will post my pixel shaders addon to the SVN - I've even updated the HGE docs to cover all the new shader functions.
  • UnknownUnknown May 2009
    Mercior, i write a private message to you, but if you can apply your functions ( like shade, multilayering ) to the now "official" version, that would be awesome ;)

    greetz
  • lennonlennon May 2009
    i like the progress, guys!

    nice work, keep working, we love your job. and yes, i would ge really great if mercior added his shader work to the svn!

    lennon
  • xDimkaxDimka May 2009
    Its Great!
    If you need more people to make hge better, need also:

    - porting current hge documentation to mediawiki;
    - reorganize svn database - add trunk, branches, tags
    - whos managed this project ?

    Need making cumulative roadmap to next hge version, I think many people has many ideas about it.

    My first and grand vision - hge must be crossplatformed.
  • lennonlennon May 2009
    from my point of view, in this stage of development, crossplatformity is pointless. hge is coded in directx, which is windows-only development API. and till now, hge has many things to improve, for example shaders. first, i think, we should make hge the best as it could be on the windows platform, and than, somebody somehow could port it to opengl(and sdl).
  • xDimkaxDimka May 2009
    lennon said:

    from my point of view, in this stage of development, crossplatformity is pointless. hge is coded in directx, which is windows-only development API. and till now, hge has many things to improve, for example shaders. first, i think, we should make hge the best as it could be on the windows platform, and than, somebody somehow could port it to opengl(and sdl).



    Ogre3D support shaders and many others,
    HGE is simple platform wrapper - not game engine, and not need support shaders in first time, I think most embedded platfrom support for HGE is most priority task than ever else. For example most publishers like BigFish and some others, require DX8 support in casual games till now. Another reason, most embedded platforms cannot support shaders or its equivalent architcture is orthogonal DX, OGL shaders.
  • Wow!
    So people actually noticed this, awesome! And a sticky too ^^
    Anyways, Mercior I'll add you to the space, no probs ;)

    And I personally can't remember really what I changed... I just did a lot of searching on google for the errors I got when replacing the DX8 libraries with DX9, also got some help of these forums if I remember right...
    Oh yeah, I used some DX9 release for an older HGE, the only problem there was that I did have to get confused with differences from the old HGE code compared to the new one, took a little of head scratching ;)
  • parabolparabol June 2009
    I'm really looking forward to the shader stuff being added in. I plan on working on a few tools, quite similar to those that mercior has made, but for my own personal use/learning. I'll post some screens if I manage to get something actually going. :)
  • UnknownUnknown June 2009
    Noone want to add the shader stuff ? :(

    greetz
  • AkkernightAkkernight July 2009
    Updated the topic start with a kinda important note you should read, since it might be causing your games to not be playable on computers that havn't updated, and since people tend to be lazy I recommend that you always have the newest DirectX build with your releases or atleast linked somewhere.
  • DaiShivaDaiShiva July 2009
    IMO you shouldn't check in your Debug and Release folders
  • DaiShivaDaiShiva July 2009
    I have created this patch file if anyone is interested in the changes from 1.8.1 to this directx9 branch.

    http://www.daishiva.com/other/hge_dx9.patch
  • UnknownUnknown July 2009
    Hi,

    it includes shader support or a implemented shades class with documentation and examples (: ?

    greetz
  • No. It's a port of HGE from DX8 to DX9, not HGE + everything Unknown wants ;-)
  • UnknownUnknown July 2009
    mercior said:

    Bout time someone got round to posting the source to this, enough of us have done it! :)

    Good job Akker... Add me to the space & if I can find time this week I will post my pixel shaders addon to the SVN - I've even updated the HGE docs to cover all the new shader functions.



    :)
  • Well you can browse the SVN source yourself and see that there is, as yet, no support for shaders.
  • UnknownUnknown August 2009
    Hi,

    is it correct that your dxSDK is for version dx10 ?
    And is it correct to compile the file in the core folder ?

    (Sry, totaly noob in compile such big things :/)

    greetz
    unknown
  • DaiShivaDaiShiva August 2009
    Unknown said:

    Hi,

    is it correct that your dxSDK is for version dx10 ?
    And is it correct to compile the file in the core folder ?

    greetz
    unknown



    How have you come to those conclusions?
  • DaiShivaDaiShiva August 2009
    Unknown said:


    I am confused, I have no idea what your question is now, sorry.
  • UnknownUnknown August 2009
    Easy, u say thats an update to dx9, but post a link to the dx10 sdk in your first post.
  • DaiShivaDaiShiva August 2009
    Unknown said:

    Easy, u say thats an update to dx9, but post a link to the dx10 sdk in your first post.



    Ah, I understand now. The first post is not mine. I have not tried that download.
  • JasonPJasonP August 2009
    Unknown, the current DirectX SDK is the only one officially available. It also contains all the previous interfaces of DirectX (not sure about 6 or 5, but I assume they are in there somewhere). Linking to it would not imply any particular DirectX version.
  • UnknownUnknown August 2009
    Hi,

    when i compile hge in release mode, i get this error :

    Project : error PRJ0019: A tool returned an error code from "pack dll with UPX"


    Visualt Studio 2008

    greetz
    unknown
  • barneybarney August 2009
    @Unknown
    Google UPX and download the win32 version from sourceforge page, then copy the upx.exe to the C:\Program Files\Microsoft Visual Studio 9.0\VC\bin folder.

    Still no results DaiShiva :( Can't understand why.. Can you post your tutorial 5's source code and hlsl file to my email adress(look in your pm box) please?
  • DaiShivaDaiShiva August 2009
    yeah I'll be able to do that when I'm at my dev computer later today
  • UnknownUnknown August 2009
    @barney

    doesnt work, same error
  • barneybarney August 2009
    That shouldn't happen :? You don't execute the upx.exe by the way, just copy it to that folder and try recompiling again.
  • UnknownUnknown August 2009
    thats what i did.
    Sometimes, Visual Studio asks me what programm i want to use to debug ? What should i choose there ?

    greetz
    unknown
  • barneybarney August 2009
    That's not involved with this problem, i guess, but i would cancel the program selection. Just in case, C:\Program Files\Microsoft Visual Studio 9.0\VC\bin is my visual studio folder, if your's is diffferent, than you should copy upx.exe to your visual studio/bin folder.
  • UnknownUnknown August 2009
    Thats the whole error :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    1>pack dll with UPX
    1> Ultimate Packer for eXecutables
    1> Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
    1>UPX 1.24w Markus F.X.J. Oberhumer & Laszlo Molnar Nov 7th 2002
    1> File size Ratio Format Name
    1> -------------------- ------ ----------- -----------
    1>upx: ..\..\hge.dll: CantPackException: unexpected value in PE header (try --force)
    1>Packed 1 file: 0 ok, 1 error.
    1>Project : error PRJ0019: A tool returned an error code from "pack dll with UPX"


    Yeah i put it in my folder

    greetz
    unknown
  • DaiShivaDaiShiva August 2009
    I would try getting a newer version of UPX.
  • UnknownUnknown August 2009
    Ahh ok, works ^^

    But its normal that a get 29 warning(s) ?

    sth like :

    1>.\resource.cpp(170) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1> D:\Dateien\VC09\VC\include\stdio.h(366) : see declaration of 'sprintf'

    and

    1>.\system.cpp(495) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    1> D:\Dateien\VC09\VC\include\string.h(74) : see declaration of 'strcpy'

    and these 2 20 times.

    greetz
  • DaiShivaDaiShiva August 2009
    The newer visual studio compilers has deprecated some of the function calls that hge uses. You can either update your source or define the symbol like it says.
  • UnknownUnknown August 2009
    Hi again,

    I have a last question, how to compile the shader files ?

    greetz
    unknown
  • lennonlennon September 2009
    hi all, i compiled the dx9, linked hge.lib against the tutorial no.3 , everything was great. but than, i applied the shaders patch, built the hge.lib with shaders, linked it against the modified tut. no.5 and it crashes, logfile looks like this:

    Init done.

    Can't load resource: Р9щ` ·(

    anybody knows the solution?
    i am sure i link the right hge.lib and i have the right .dll :)

    bye, lennon.


    edit: maybe someone could post here the working .libs and .dll, so others can enjoy :)
  • arturooo3arturooo3 September 2009
    Akkernight!
    Where can I download it?
    Link from first post is not working.. :/
  • chookillchookill September 2009
    He's right the direct link is broken..

    The svn one is working but I don't know if you can donwload it from here..

    I used the .patch link (bottom of first page, by Daishiva) with TortoiseSVN and everything worked fine after a full HGE.dll recompilation though.
  • DaiShivaDaiShiva September 2009
    That's why I made a patch file, for when people dont want to host their files anymore
    1. download hge 1.8.1: http://hge.relishgames.com/files/hge.zip
    2. download the patch file: http://www.daishiva.com/other/hge_dx9.patch
    3. run the patch command
    4. recompile hge

    Here is how I run the patch command in cygwin:
    1
    2
    3
    4
    5
    6
    7
    daishiva@localhost ~/dev/hge181
    $ patch -p0 -i hge_dx9.patch
     
    patching file src/core/graphics.cpp
    patching file src/core/system.cpp
    patching file src/core/hge.vcproj
    patching file src/core/hge_impl.h


    If for whatever reason my hosting runs out, here are the contents of the patch file:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    Index: src/core/graphics.cpp
    ===================================================================
    --- src/core/graphics.cpp (revision 22)
    +++ src/core/graphics.cpp (revision 23)
    @@ -8,8 +8,8 @@
     
     
    #include "hge_impl.h"
    -#include <d3d8.h>
    -#include <d3dx8.h>
    +#include <d3d9.h>
    +#include <d3dx9.h>
     
     
    void CALL HGE_Impl::Gfx_Clear(DWORD color)
    @@ -32,7 +32,7 @@
     
    void CALL HGE_Impl::Gfx_SetClipping(int x, int y, int w, int h)
    {
    - D3DVIEWPORT8 vp;
    + D3DVIEWPORT9 vp;
    int scr_width, scr_height;
     
    if(!pCurTarget) {
    @@ -101,7 +101,7 @@
     
    bool CALL HGE_Impl::Gfx_BeginScene(HTARGET targ)
    {
    - LPDIRECT3DSURFACE8 pSurf=0, pDepth=0;
    + LPDIRECT3DSURFACE9 pSurf=0, pDepth=0;
    D3DDISPLAYMODE Mode;
    CRenderTargetList *target=(CRenderTargetList *)targ;
     
    @@ -143,7 +143,7 @@
    pSurf=pScreenSurf;
    pDepth=pScreenDepth;
    }
    - if(FAILED(pD3DDevice->SetRenderTarget(pSurf, pDepth)))
    + if(FAILED(pD3DDevice->SetRenderTarget(0, pSurf)))
    {
    if(target) pSurf->Release();
    _PostError("Gfx_BeginScene: Can't set render target");
    @@ -171,7 +171,7 @@
    }
     
    pD3DDevice->BeginScene();
    - pVB->Lock( 0, 0, (BYTE**)&VertArray, 0 );
    + pVB->Lock( 0, 0, (VOID**)&VertArray, 0 );
     
    return true;
    }
    @@ -219,7 +219,7 @@
    CurPrimType=HGEPRIM_TRIPLES;
    if(CurBlendMode != triple->blend) _SetBlendMode(triple->blend);
    if(triple->tex != CurTexture) {
    - pD3DDevice->SetTexture( 0, (LPDIRECT3DTEXTURE8)triple->tex );
    + pD3DDevice->SetTexture( 0, (LPDIRECT3DTEXTURE9)triple->tex );
    CurTexture = triple->tex;
    }
    }
    @@ -241,7 +241,7 @@
    if(CurBlendMode != quad->blend) _SetBlendMode(quad->blend);
    if(quad->tex != CurTexture)
    {
    - pD3DDevice->SetTexture( 0, (LPDIRECT3DTEXTURE8)quad->tex );
    + pD3DDevice->SetTexture( 0, (LPDIRECT3DTEXTURE9)quad->tex );
    CurTexture = quad->tex;
    }
    }
    @@ -261,7 +261,7 @@
    if(CurBlendMode != blend) _SetBlendMode(blend);
    if(tex != CurTexture)
    {
    - pD3DDevice->SetTexture( 0, (LPDIRECT3DTEXTURE8)tex );
    + pD3DDevice->SetTexture( 0, (LPDIRECT3DTEXTURE9)tex );
    CurTexture = tex;
    }
     
    @@ -299,8 +299,8 @@
     
    if(zbuffer)
    {
    - if(FAILED(pD3DDevice->CreateDepthStencilSurface(pTarget->width, pTarget->height,
    - D3DFMT_D16, D3DMULTISAMPLE_NONE, &pTarget->pDepth)))
    + if(FAILED(pD3DDevice->CreateDepthStencilSurface(width, height,
    + D3DFMT_D16, D3DMULTISAMPLE_NONE, 0, false, &pTarget->pDepth, NULL)))
    {
    pTarget->pTex->Release();
    _PostError("Can't create render target depth buffer");
    @@ -349,7 +349,7 @@
     
    HTEXTURE CALL HGE_Impl::Texture_Create(int width, int height)
    {
    - LPDIRECT3DTEXTURE8 pTex;
    + LPDIRECT3DTEXTURE9 pTex;
     
    if( FAILED( D3DXCreateTexture( pD3DDevice, width, height,
    1, // Mip levels
    @@ -370,7 +370,7 @@
    void *data;
    DWORD _size;
    D3DFORMAT fmt1, fmt2;
    - LPDIRECT3DTEXTURE8 pTex;
    + LPDIRECT3DTEXTURE9 pTex;
    D3DXIMAGE_INFO info;
    CTextureList *texItem;
     
    @@ -437,7 +437,7 @@
     
    void CALL HGE_Impl::Texture_Free(HTEXTURE tex)
    {
    - LPDIRECT3DTEXTURE8 pTex=(LPDIRECT3DTEXTURE8)tex;
    + LPDIRECT3DTEXTURE9 pTex=(LPDIRECT3DTEXTURE9)tex;
    CTextureList *texItem=textures, *texPrev=0;
     
    while(texItem)
    @@ -458,7 +458,7 @@
    int CALL HGE_Impl::Texture_GetWidth(HTEXTURE tex, bool bOriginal)
    {
    D3DSURFACE_DESC TDesc;
    - LPDIRECT3DTEXTURE8 pTex=(LPDIRECT3DTEXTURE8)tex;
    + LPDIRECT3DTEXTURE9 pTex=(LPDIRECT3DTEXTURE9)tex;
    CTextureList *texItem=textures;
     
    if(bOriginal)
    @@ -481,7 +481,7 @@
    int CALL HGE_Impl::Texture_GetHeight(HTEXTURE tex, bool bOriginal)
    {
    D3DSURFACE_DESC TDesc;
    - LPDIRECT3DTEXTURE8 pTex=(LPDIRECT3DTEXTURE8)tex;
    + LPDIRECT3DTEXTURE9 pTex=(LPDIRECT3DTEXTURE9)tex;
    CTextureList *texItem=textures;
     
    if(bOriginal)
    @@ -503,7 +503,7 @@
     
    DWORD * CALL HGE_Impl::Texture_Lock(HTEXTURE tex, bool bReadOnly, int left, int top, int width, int height)
    {
    - LPDIRECT3DTEXTURE8 pTex=(LPDIRECT3DTEXTURE8)tex;
    + LPDIRECT3DTEXTURE9 pTex=(LPDIRECT3DTEXTURE9)tex;
    D3DSURFACE_DESC TDesc;
    D3DLOCKED_RECT TRect;
    RECT region, *prec;
    @@ -537,7 +537,7 @@
     
    void CALL HGE_Impl::Texture_Unlock(HTEXTURE tex)
    {
    - LPDIRECT3DTEXTURE8 pTex=(LPDIRECT3DTEXTURE8)tex;
    + LPDIRECT3DTEXTURE9 pTex=(LPDIRECT3DTEXTURE9)tex;
    pTex->UnlockRect(0);
    }
     
    @@ -554,7 +554,7 @@
    switch(CurPrimType)
    {
    case HGEPRIM_QUADS:
    - pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, nPrim<<2, 0, nPrim<<1);
    + pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, nPrim<<2, 0, nPrim<<1);
    break;
     
    case HGEPRIM_TRIPLES:
    @@ -570,7 +570,7 @@
    }
     
    if(bEndScene) VertArray = 0;
    - else pVB->Lock( 0, 0, (BYTE**)&VertArray, 0 );
    + else pVB->Lock( 0, 0, (VOID**)&VertArray, 0 );
    }
    }
     
    @@ -610,14 +610,14 @@
    bool HGE_Impl::_GfxInit()
    {
    static const char *szFormats[]={"UNKNOWN", "R5G6B5", "X1R5G5B5", "A1R5G5B5", "X8R8G8B8", "A8R8G8B8"};
    - D3DADAPTER_IDENTIFIER8 AdID;
    + D3DADAPTER_IDENTIFIER9 AdID;
    D3DDISPLAYMODE Mode;
    D3DFORMAT Format=D3DFMT_UNKNOWN;
    UINT nModes, i;
     
    // Init D3D
     
    - pD3D=Direct3DCreate8(120); // D3D_SDK_VERSION
    + pD3D=Direct3DCreate9(D3D_SDK_VERSION); // D3D_SDK_VERSION
    if(pD3D==NULL)
    {
    _PostError("Can't create D3D interface");
    @@ -626,7 +626,7 @@
     
    // Get adapter info
     
    - pD3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, D3DENUM_NO_WHQL_LEVEL, &AdID);
    + pD3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &AdID);
    System_Log("D3D Driver: %s",AdID.Driver);
    System_Log("Description: %s",AdID.Description);
    System_Log("Version: %d.%d.%d.%d",
    @@ -653,7 +653,7 @@
    d3dppW.hDeviceWindow = hwnd;
    d3dppW.Windowed = TRUE;
     
    - if(nHGEFPS==HGEFPS_VSYNC) d3dppW.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
    + if(nHGEFPS==HGEFPS_VSYNC) { d3dppW.SwapEffect = D3DSWAPEFFECT_COPY; d3dppW.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; }
    else d3dppW.SwapEffect = D3DSWAPEFFECT_COPY;
     
    if(bZBuffer)
    @@ -664,11 +664,11 @@
     
    // Set up Full Screen presentation parameters
     
    - nModes=pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT);
    + nModes=pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT, Mode.Format);
     
    for(i=0; i<nModes; i++)
    {
    - pD3D->EnumAdapterModes(D3DADAPTER_DEFAULT, i, &Mode);
    + pD3D->EnumAdapterModes(D3DADAPTER_DEFAULT, Mode.Format, i, &Mode);
    if(Mode.Width != (UINT)nScreenWidth || Mode.Height != (UINT)nScreenHeight) continue;
    if(nScreenBPP==16 && (_format_id(Mode.Format) > _format_id(D3DFMT_A1R5G5B5))) continue;
    if(_format_id(Mode.Format) > _format_id(Format)) Format=Mode.Format;
    @@ -693,8 +693,8 @@
    d3dppFS.SwapEffect = D3DSWAPEFFECT_FLIP;
    d3dppFS.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
     
    - if(nHGEFPS==HGEFPS_VSYNC) d3dppFS.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
    - else d3dppFS.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
    + if(nHGEFPS==HGEFPS_VSYNC) d3dppFS.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
    + else d3dppFS.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
     
    if(bZBuffer)
    {
    @@ -811,14 +811,14 @@
     
    if(pIB)
    {
    - pD3DDevice->SetIndices(NULL,0);
    + pD3DDevice->SetIndices(NULL);
    pIB->Release();
    pIB=0;
    }
    if(pVB)
    {
    if(VertArray) { pVB->Unlock(); VertArray=0; }
    - pD3DDevice->SetStreamSource( 0, NULL, sizeof(hgeVertex) );
    + pD3DDevice->SetStreamSource( 0, NULL, 0, sizeof(hgeVertex) );
    pVB->Release();
    pVB=0;
    }
    @@ -846,12 +846,12 @@
     
    if(pIB)
    {
    - pD3DDevice->SetIndices(NULL,0);
    + pD3DDevice->SetIndices(NULL);
    pIB->Release();
    }
    if(pVB)
    {
    - pD3DDevice->SetStreamSource( 0, NULL, sizeof(hgeVertex) );
    + pD3DDevice->SetStreamSource( 0, NULL,0, sizeof(hgeVertex) );
    pVB->Release();
    }
     
    @@ -874,7 +874,7 @@
    pScreenSurf=0;
    pScreenDepth=0;
     
    - pD3DDevice->GetRenderTarget(&pScreenSurf);
    + pD3DDevice->GetRenderTarget(0, &pScreenSurf);
    pD3DDevice->GetDepthStencilSurface(&pScreenDepth);
     
    while(target)
    @@ -884,37 +884,42 @@
    d3dpp->BackBufferFormat, D3DPOOL_DEFAULT, &target->pTex);
    if(target->pDepth)
    pD3DDevice->CreateDepthStencilSurface(target->width, target->height,
    - D3DFMT_D16, D3DMULTISAMPLE_NONE, &target->pDepth);
    + D3DFMT_D16, D3DMULTISAMPLE_NONE, 0, false, &target->pDepth, NULL);
    target=target->next;
    }
     
    // Create Vertex buffer
     
    if( FAILED (pD3DDevice->CreateVertexBuffer(VERTEX_BUFFER_SIZE*sizeof(hgeVertex),
    - D3DUSAGE_WRITEONLY,
    - D3DFVF_HGEVERTEX,
    - D3DPOOL_DEFAULT, &pVB )))
    + D3DUSAGE_WRITEONLY,
    + D3DFVF_HGEVERTEX,
    + D3DPOOL_DEFAULT,
    + &pVB,
    + NULL)))
    {
    _PostError("Can't create D3D vertex buffer");
    return false;
    }
     
    - pD3DDevice->SetVertexShader( D3DFVF_HGEVERTEX );
    - pD3DDevice->SetStreamSource( 0, pVB, sizeof(hgeVertex) );
    + pD3DDevice->SetVertexShader( NULL );
    + pD3DDevice->SetFVF( D3DFVF_HGEVERTEX );
    + pD3DDevice->SetStreamSource( 0, pVB, 0, sizeof(hgeVertex) );
     
    // Create and setup Index buffer
     
    if( FAILED( pD3DDevice->CreateIndexBuffer(VERTEX_BUFFER_SIZE*6/4*sizeof(WORD),
    - D3DUSAGE_WRITEONLY,
    - D3DFMT_INDEX16,
    - D3DPOOL_DEFAULT, &pIB ) ) )
    + D3DUSAGE_WRITEONLY,
    + D3DFMT_INDEX16,
    + D3DPOOL_DEFAULT,
    + &pIB
    + , NULL) ) )
    {
    _PostError("Can't create D3D index buffer");
    return false;
    }
     
    WORD *pIndices, n=0;
    - if( FAILED( pIB->Lock( 0, 0, (BYTE**)&pIndices, 0 ) ) )
    + if( FAILED( pIB->Lock( 0, 0, (void**)&pIndices, 0 ) ) )
    {
    _PostError("Can't lock D3D index buffer");
    return false;
    @@ -931,7 +936,7 @@
    }
     
    pIB->Unlock();
    - pD3DDevice->SetIndices(pIB,0);
    + pD3DDevice->SetIndices(pIB);
     
    // Set common render states
     
    @@ -955,17 +960,17 @@
    pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
    pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
     
    - pD3DDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
     
    if(bTextureFilter)
    {
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_LINEAR);
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_LINEAR);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
    }
    else
    {
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_POINT);
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_POINT);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
    }
     
    nPrim=0;
    Index: src/core/system.cpp
    ===================================================================
    --- src/core/system.cpp (revision 22)
    +++ src/core/system.cpp (revision 23)
    @@ -379,13 +379,13 @@
    _render_batch();
    if(bTextureFilter)
    {
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_LINEAR);
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_LINEAR);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
    }
    else
    {
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_POINT);
    - pD3DDevice->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_POINT);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
    + pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
    }
    }
    break;
    @@ -462,13 +462,14 @@
    {
    if(value==HGEFPS_VSYNC)
    {
    - d3dppW.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
    - d3dppFS.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
    + d3dppW.SwapEffect = D3DSWAPEFFECT_COPY;
    + d3dppW.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
    + d3dppFS.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
    }
    else
    {
    d3dppW.SwapEffect = D3DSWAPEFFECT_COPY;
    - d3dppFS.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
    + d3dppFS.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
    }
    //if(procFocusLostFunc) procFocusLostFunc();
    _GfxRestore();
    @@ -616,7 +617,7 @@
     
    void CALL HGE_Impl::System_Snapshot(const char *filename)
    {
    - LPDIRECT3DSURFACE8 pSurf;
    + LPDIRECT3DSURFACE9 pSurf;
    char *shotname, tempname[_MAX_PATH];
    int i;
     
    @@ -635,7 +636,7 @@
     
    if(pD3DDevice)
    {
    - pD3DDevice->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pSurf);
    + pD3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurf);
    D3DXSaveSurfaceToFile(filename, D3DXIFF_BMP, pSurf, NULL, NULL);
    pSurf->Release();
    }
    Index: src/core/hge.vcproj
    ===================================================================
    --- src/core/hge.vcproj (revision 22)
    +++ src/core/hge.vcproj (revision 23)
    @@ -72,7 +72,7 @@
    />
    <Tool
    Name="VCLinkerTool"
    - AdditionalDependencies="winmm.lib d3d8.lib d3dx8.lib user32.lib gdi32.lib Advapi32.lib shell32.lib"
    + AdditionalDependencies="winmm.lib d3d9.lib d3dx9.lib user32.lib gdi32.lib Advapi32.lib shell32.lib"
    OutputFile="..\..\hge.dll"
    LinkIncremental="2"
    SuppressStartupBanner="true"
    @@ -169,7 +169,7 @@
    />
    <Tool
    Name="VCLinkerTool"
    - AdditionalDependencies="winmm.lib d3d8.lib d3dx8.lib user32.lib gdi32.lib Advapi32.lib shell32.lib"
    + AdditionalDependencies="winmm.lib d3d9.lib d3dx9.lib user32.lib gdi32.lib Advapi32.lib shell32.lib"
    OutputFile="..\..\hge.dll"
    Version="1.53"
    LinkIncremental="1"
    @@ -301,6 +301,10 @@
    </FileConfiguration>
    </File>
    <File
    + RelativePath=".\power.cpp"
    + >
    + </File>
    + <File
    RelativePath="random.cpp"
    >
    <FileConfiguration
    Index: src/core/hge_impl.h
    ===================================================================
    --- src/core/hge_impl.h (revision 22)
    +++ src/core/hge_impl.h (revision 23)
    @@ -12,8 +12,8 @@
     
    #include "..\..\include\hge.h"
    #include <stdio.h>
    -#include <d3d8.h>
    -#include <d3dx8.h>
    +#include <d3d9.h>
    +#include <d3dx9.h>
     
    #define DEMO
     
    @@ -28,8 +28,8 @@
    {
    int width;
    int height;
    - IDirect3DTexture8* pTex;
    - IDirect3DSurface8* pDepth;
    + IDirect3DTexture9* pTex;
    + IDirect3DSurface9* pDepth;
    CRenderTargetList* next;
    };
     
    @@ -259,13 +259,13 @@
    RECT rectFS;
    LONG styleFS;
     
    - IDirect3D8* pD3D;
    - IDirect3DDevice8* pD3DDevice;
    - IDirect3DVertexBuffer8* pVB;
    - IDirect3DIndexBuffer8* pIB;
    + IDirect3D9* pD3D;
    + IDirect3DDevice9* pD3DDevice;
    + IDirect3DVertexBuffer9* pVB;
    + IDirect3DIndexBuffer9* pIB;
     
    - IDirect3DSurface8* pScreenSurf;
    - IDirect3DSurface8* pScreenDepth;
    + IDirect3DSurface9* pScreenSurf;
    + IDirect3DSurface9* pScreenDepth;
    CRenderTargetList* pTargets;
    CRenderTargetList* pCurTarget;
  • arturooo3arturooo3 September 2009
    Ok thanks ;)
    I didn't have cygwin, so I've made it by hands :P
    However it works.

    For everyone, who want to just use compiled HGE version 1.81 DX 9.0c (sdk - Aug 2009), here it is:
    http://arturooo.webd.pl/hge/hge181dx9.zip

    Serv is good, so don't worry - it won't disappear.
    Pack contains hge.dll and libs for VC 2008.
  • AkkernightAkkernight October 2009
    wow, been awhile since I was in here :P

    Thanks DaiShiva for the patch file, my hoster warned me because I was lagging their system somehow, and everything on my server was just rubbish and confusing, so I asked them to 'nuke' it/format it, I actually didn't think people used my solution for DX9 :D

    Anyways, maybe I'll take the time to get the DX9 update again and upload it again, can't promise anything tho ;)
  • AkkernightAkkernight October 2009
    Updated this topic!

    The topic start is now updated with new links and better builds, check it out :D

    btw, thanks arturooo3 for providing an alternative download link!

    - Akker
  • RaP1DRaP1D December 2009
    Sorry, my english is very bad...

    Why:
    windowed mode - fps <= 60
    fullscreen mode - fps <= 1000

    in game settings FPS VALUE - UNLIMITED!!!!
  • Einh%D0%B4nderEinhдnder January 2010
    Gute Frage, das Problem hab ich auch.


    Good question, i got the same problem.

    Windowed apps run in stone-fixed 60fps.
    Vsync is off, in code and in my videocard settings.

    The fullscreenmode runs unlimited.

    How can we unlock the framerate for windowed apps?



    my regards
  • ProfEclipseProfEclipse January 2010
    In graphics.cpp, in HGE_Impl::_GfxInit(), change:
    1
    2
    	if(nHGEFPS==HGEFPS_VSYNC) { d3dppW.SwapEffect = D3DSWAPEFFECT_COPY; d3dppW.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; }
    else d3dppW.SwapEffect = D3DSWAPEFFECT_COPY;

    to:
    1
    2
    	if(nHGEFPS==HGEFPS_VSYNC) { d3dppW.SwapEffect = D3DSWAPEFFECT_COPY; d3dppW.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; }
    else { d3dppW.SwapEffect = D3DSWAPEFFECT_COPY; d3dppW.PresentationInterval = D3DPRSENT_INTERVAL_IMMEDIATE; }
  • coder_buzzcoder_buzz March 2010
    Please somebody re-upload release build from first post: [Dead link removed]

    Thank you mates!
  • ProfEclipseProfEclipse March 2010
    Just use DaiShiva's method.

    1. Download the HGE 1.8.1 distribution from http://hge.relishgames.com/files/hge.zip.
    2. Download the patch file from http://www.daishiva.com/other/hge_dx9.patch.
    3. Download the patch utility program from http://gnuwin32.sourceforge.net/packages/patch.htm.
    4. Extract the HGE distribution.
    5. Run the patch command in the top-level HGE distribution directory:
    1
    patch -p0 -i hge_dx9.patch


    6. Compile HGE using the provided project file(s).
  • veegunveegun June 2010
    now all we need is a dx11 version. :D

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion

Who's Online (2)