Rev 18 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | #ifndef HARNESS_HOOKS_H |
2 | #define HARNESS_HOOKS_H |
||
3 | |||
4 | #include "brender/br_types.h" |
||
5 | #include "harness/win95_polyfill_defs.h" |
||
6 | #include <stdio.h> |
||
7 | |||
8 | typedef enum { |
||
9 | eFlush_all, |
||
10 | eFlush_color_buffer |
||
11 | } tRenderer_flush_type; |
||
12 | |||
13 | // Platform implementation functions |
||
14 | typedef struct tHarness_platform { |
||
15 | // Initialize the renderer |
||
16 | void (*Renderer_Init)(int width, int height, int pRender_width, int pRender_height); |
||
17 | // Called when beginning a 3D scene |
||
18 | void (*Renderer_BeginScene)(br_actor* camera, br_pixelmap* colour_buffer, br_pixelmap* depth_buffer); |
||
19 | // Called at the end of a 3D scene |
||
20 | void (*Renderer_EndScene)(void); |
||
21 | // Render a fullscreen quad using the specified pixel data |
||
22 | void (*Renderer_FullScreenQuad)(uint8_t* src); |
||
23 | // Render a model |
||
24 | void (*Renderer_Model)(br_actor* actor, br_model* model, br_material* material, br_token render_type, br_matrix34 model_matrix); |
||
25 | // Clear frame and depth buffers |
||
26 | void (*Renderer_ClearBuffers)(void); |
||
27 | // Load pixelmap into video memory |
||
28 | void (*Renderer_BufferTexture)(br_pixelmap* pm); |
||
29 | // Load material |
||
30 | void (*Renderer_BufferMaterial)(br_material* mat); |
||
31 | // Load model into video memory |
||
32 | void (*Renderer_BufferModel)(br_model* model); |
||
33 | // Pull contents of frame and depth buffers from video into main memory for software effects |
||
34 | void (*Renderer_FlushBuffers)(void); |
||
35 | // Set the 256 color palette to use (BGRA format) |
||
36 | void (*Renderer_SetPalette)(PALETTEENTRY_* palette); |
||
37 | // Set the viewport for 3d rendering |
||
38 | void (*Renderer_SetViewport)(int x, int y, int width, int height); |
||
39 | // Create a window. Return a handle to the window |
||
40 | void* (*CreateWindowAndRenderer)(char* title, int x, int y, int nWidth, int nHeight); |
||
41 | // Get mouse button state |
||
42 | int (*GetMouseButtons)(int* button_1, int* button_2); |
||
43 | // Get mouse position |
||
44 | int (*GetMousePosition)(int* pX, int* pY); |
||
45 | // Close specified window |
||
46 | void (*DestroyWindow)(void* window); |
||
47 | // Process window messages, return any WM_QUIT message |
||
48 | int (*ProcessWindowMessages)(MSG_* msg); |
||
49 | // Set position of a window |
||
50 | int (*SetWindowPos)(void* hWnd, int x, int y, int nWidth, int nHeight); |
||
51 | // Show/hide the cursor |
||
52 | int (*ShowCursor)(int show); |
||
53 | // Get keyboard state. Expected to be in DirectInput key codes |
||
54 | void (*GetKeyboardState)(unsigned int count, uint8_t* buffer); |
||
55 | // Sleep |
||
56 | void (*Sleep)(uint32_t dwMilliseconds); |
||
57 | // Get ticks |
||
58 | uint32_t (*GetTicks)(void); |
||
59 | // Swap window |
||
60 | void (*SwapWindow)(void); |
||
61 | // Show error message |
||
62 | int (*ShowErrorMessage)(void* window, char* text, char* caption); |
||
63 | |||
64 | } tHarness_platform; |
||
65 | |||
66 | extern tHarness_platform gHarness_platform; |
||
67 | |||
68 | void Harness_Init(int* argc, char* argv[]); |
||
69 | |||
70 | // Hooks are called from original game code. |
||
71 | |||
72 | // BRender hooks |
||
73 | void Harness_Hook_BrPixelmapDoubleBuffer(br_pixelmap* dst, br_pixelmap* src); |
||
74 | void Harness_Hook_BrV1dbRendererBegin(br_v1db_state* v1db); |
||
75 | void Harness_Hook_renderActor(br_actor* actor, br_model* model, br_material* material, br_token type); |
||
76 | |||
77 | // Sound hooks |
||
78 | void Harness_Hook_S3Service(int unk1, int unk2); |
||
79 | void Harness_Hook_S3StopAllOutletSounds(void); |
||
80 | |||
81 | // Filesystem hooks |
||
82 | FILE* Harness_Hook_fopen(const char* pathname, const char* mode); |
||
83 | |||
84 | void Harness_RenderLastScreen(void); |
||
85 | |||
86 | #endif |