Subversion Repositories Games.Carmageddon

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "ssdx.h"
  2. #include "errors.h"
  3. #include "harness/hooks.h"
  4.  
  5. int gSSDX_windowed;
  6. void* gSSDX_hwnd;
  7.  
  8. int SSDXStart(void* hWnd, int windowed, int flags) {
  9.     int res = 0;
  10.     dr_dprintf("SSDXStart(): START...");
  11.     if (windowed) {
  12.         gSSDX_windowed = 1;
  13.     }
  14.     gSSDX_hwnd = hWnd;
  15.  
  16.     // Not required
  17.  
  18.     // if ((flags & 1) != 0) {
  19.     //     dr_dprintf("Calling DirectDrawCreate()...");
  20.     //     res = DirectDrawCreate(0, &gDirect_draw, 0);
  21.     //     if (!res) {
  22.     //         dr_dprintf("Calling SetCooperativeLevel()...");
  23.     //         if (gSSDX_windowed) {
  24.     //             res = gDirect_draw->lpVtbl->SetCooperativeLevel(gDirect_draw, gSSDX_hwnd, 8);
  25.     //         } else {
  26.     //             res = gDirect_draw->lpVtbl->SetCooperativeLevel(gDirect_draw, gSSDX_hwnd, 83);
  27.     //         }
  28.     //     }
  29.     // }
  30.     // if (!res && (flags & 2) != 0) {
  31.     //     dr_dprintf("Calling DirectSoundCreate()...");
  32.     //     res = DirectSoundCreate(0, &gDirect_sound, 0);
  33.     // }
  34.     // if (res) {
  35.     //     SSDXHandleError(res);
  36.     // }
  37.     dr_dprintf("SSDXStart(): END.");
  38.     return res;
  39. }
  40.  
  41. int SSDXInitDirectDraw(int width, int height, int* row_bytes) {
  42.     DirectDraw_CreateSurface(width, height);
  43.     *row_bytes = width;
  44.     return 0;
  45. }
  46.  
  47. void SSDXRelease(void) {}
  48.  
  49. void SSDXGetWindowRect(void* hWnd) {
  50.     // none of this is required
  51.  
  52.     // GetClientRect(hWnd, &gSSDX_rect);
  53.     // ClientToScreen(hWnd, (LPPOINT)&gSSDX_rect);
  54.     // ClientToScreen(hWnd, (LPPOINT)&gSSDX_rect.right);
  55.     // dr_dprintf("New window rect: (%d,%d)(%d,%d)", gSSDX_rect.left, gSSDX_rect.top, gSSDX_rect.right, gSSDX_rect.bottom);
  56. }
  57.  
  58. void SSDXHandleError(int error) {
  59.     // no-op
  60. }
  61.  
  62. void SSDXSetPaleeteEntries(PALETTEENTRY_* palette, int pFirst_color, int pCount) {
  63.     DirectDrawDevice_SetPaletteEntries(palette, pFirst_color, pCount);
  64. }
  65.