Skip to content

Commit 34da173

Browse files
dhthwySuper User
authored andcommitted
add symbol lookup functions for dfsdl and dfimg
1 parent 5b5a1ac commit 34da173

File tree

2 files changed

+330
-22
lines changed

2 files changed

+330
-22
lines changed

library/include/modules/DFSDL.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55

66
#include <vector>
77

8+
#include <SDL_blendmode.h>
9+
#include <SDL_keycode.h>
10+
811
struct SDL_Surface;
912
struct SDL_Rect;
13+
struct SDL_Renderer;
1014
struct SDL_PixelFormat;
1115
struct SDL_Window;
16+
struct SDL_Texture;
17+
struct SDL_Point;
18+
1219
union SDL_Event;
20+
typedef int (*SDL_EventFilter)(void* userdata, SDL_Event* event);
1321

1422
namespace DFHack
1523
{
@@ -41,6 +49,8 @@ bool init(DFHack::color_ostream &out);
4149
*/
4250
void cleanup();
4351

52+
DFHACK_EXPORT void * lookup_DFSDL_Symbol(const char *name);
53+
DFHACK_EXPORT void * lookup_DFIMG_Symbol(const char *name);
4454
DFHACK_EXPORT SDL_Surface * DFIMG_Load(const char *file);
4555
DFHACK_EXPORT SDL_Surface * DFSDL_CreateRGBSurface(uint32_t flags, int width, int height, int depth, uint32_t Rmask, uint32_t Gmask, uint32_t Bmask, uint32_t Amask);
4656
DFHACK_EXPORT SDL_Surface * DFSDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, uint32_t Rmask, uint32_t Gmask, uint32_t Bmask, uint32_t Amask);
@@ -55,6 +65,52 @@ DFHACK_EXPORT SDL_PixelFormat* DFSDL_AllocFormat(uint32_t pixel_format);
5565
DFHACK_EXPORT SDL_Surface* DFSDL_CreateRGBSurfaceWithFormat(uint32_t flags, int width, int height, int depth, uint32_t format);
5666
DFHACK_EXPORT int DFSDL_ShowSimpleMessageBox(uint32_t flags, const char *title, const char *message, SDL_Window *window);
5767

68+
DFHACK_EXPORT SDL_Surface* DFSDL_ConvertSurfaceFormat(SDL_Surface* surface, uint32_t format, uint32_t flags);
69+
DFHACK_EXPORT SDL_Renderer* DFSDL_CreateRenderer(SDL_Window* window, int index, uint32_t flags);
70+
DFHACK_EXPORT SDL_Surface* DFSDL_CreateRGBSurface(uint32_t flags, int width, int height, int depth, uint32_t Rmask, uint32_t Gmask, uint32_t Bmask, uint32_t Amask);
71+
DFHACK_EXPORT SDL_Texture* DFSDL_CreateTexture(SDL_Renderer* renderer, uint32_t format, int access, int w, int h);
72+
DFHACK_EXPORT SDL_Texture* DFSDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface);
73+
DFHACK_EXPORT SDL_Window* DFSDL_CreateWindow(const char* title, int x, int y, int w, int h, uint32_t flags);
74+
DFHACK_EXPORT void DFSDL_DestroyRenderer(SDL_Renderer* renderer);
75+
DFHACK_EXPORT void DFSDL_DestroyTexture(SDL_Texture* texture);
76+
DFHACK_EXPORT void DFSDL_DestroyWindow(SDL_Window* window);
77+
DFHACK_EXPORT void DFSDL_free(void* mem);
78+
DFHACK_EXPORT void DFSDL_FreeSurface(SDL_Surface* surface);
79+
DFHACK_EXPORT char* DFSDL_GetClipboardText(void);
80+
DFHACK_EXPORT const char* DFSDL_GetError(void);
81+
DFHACK_EXPORT SDL_bool DFSDL_GetEventFilter(SDL_EventFilter* filter, void** userdata);
82+
DFHACK_EXPORT SDL_Keymod DFSDL_GetModState(void);
83+
DFHACK_EXPORT int DFSDL_GetRendererOutputSize(SDL_Renderer* renderer, int* w, int* h);
84+
DFHACK_EXPORT uint32_t DFSDL_GetWindowFlags(SDL_Window* window);
85+
DFHACK_EXPORT uint32_t DFSDL_GetWindowID(SDL_Window* window);
86+
DFHACK_EXPORT void DFSDL_HideWindow(SDL_Window* window);
87+
DFHACK_EXPORT char* DFSDL_iconv_string(const char* tocode, const char* fromcode, const char* inbuf, size_t inbytesleft);
88+
DFHACK_EXPORT int DFSDL_InitSubSystem(uint32_t flags);
89+
DFHACK_EXPORT uint32_t DFSDL_MapRGB(const SDL_PixelFormat* format, uint8_t r, uint8_t g, uint8_t b);
90+
DFHACK_EXPORT void* DFSDL_memset(void* dst, int c, size_t len);
91+
DFHACK_EXPORT int DFSDL_RenderClear(SDL_Renderer* renderer);
92+
DFHACK_EXPORT int DFSDL_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect);
93+
DFHACK_EXPORT int DFSDL_RenderDrawRect(SDL_Renderer* renderer, const SDL_Rect* rect);
94+
DFHACK_EXPORT int DFSDL_RenderFillRect(SDL_Renderer* renderer, const SDL_Rect* rect);
95+
DFHACK_EXPORT void DFSDL_RenderPresent(SDL_Renderer* renderer);
96+
DFHACK_EXPORT int DFSDL_RenderSetIntegerScale(SDL_Renderer* renderer, SDL_bool enable);
97+
DFHACK_EXPORT int DFSDL_RenderSetViewport(SDL_Renderer* renderer, const SDL_Rect* rect);
98+
DFHACK_EXPORT SDL_bool DFSDL_PointInRect(const SDL_Point* p, const SDL_Rect* r);
99+
DFHACK_EXPORT int DFSDL_SetClipboardText(const char* text);
100+
DFHACK_EXPORT int DFSDL_SetColorKey(SDL_Surface* surface, int flag, uint32_t key);
101+
DFHACK_EXPORT void DFSDL_SetEventFilter(SDL_EventFilter filter, void* userdata);
102+
DFHACK_EXPORT SDL_bool DFSDL_SetHint(const char* name, const char* value);
103+
DFHACK_EXPORT int DFSDL_SetRenderDrawColor(SDL_Renderer* renderer, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
104+
DFHACK_EXPORT int DFSDL_SetTextureBlendMode(SDL_Texture* texture, SDL_BlendMode blendMode);
105+
DFHACK_EXPORT int DFSDL_SetTextureColorMod(SDL_Texture* texture, uint8_t r, uint8_t g, uint8_t b);
106+
DFHACK_EXPORT void DFSDL_SetWindowMinimumSize(SDL_Window* window, int min_w, int min_h);
107+
DFHACK_EXPORT void DFSDL_ShowWindow(SDL_Window* window);
108+
DFHACK_EXPORT void DFSDL_StartTextInput(void);
109+
DFHACK_EXPORT void DFSDL_StopTextInput(void);
110+
DFHACK_EXPORT int DFSDL_UpperBlit(SDL_Surface* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect);
111+
DFHACK_EXPORT int DFSDL_UpdateTexture(SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
112+
DFHACK_EXPORT void DFSDL_QuitSubSystem(uint32_t flags);
113+
58114
// submitted and returned text is UTF-8
59115
// see wrapper functions below for cp-437 variants
60116
DFHACK_EXPORT char * DFSDL_GetClipboardText();

0 commit comments

Comments
 (0)