Skip to content

Commit

Permalink
add symbol lookup functions for dfsdl and dfimg
Browse files Browse the repository at this point in the history
  • Loading branch information
dhthwy committed Jun 27, 2024
1 parent 0ca0f4d commit 1138f51
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/include/modules/DFSDL.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ bool init(DFHack::color_ostream &out);
*/
void cleanup();

DFHACK_EXPORT void * lookup_DFSDL_Symbol(const char *name);
DFHACK_EXPORT void * lookup_DFIMG_Symbol(const char *name);
DFHACK_EXPORT SDL_Surface * DFIMG_Load(const char *file);
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);
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);
Expand Down
12 changes: 12 additions & 0 deletions library/modules/DFSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ void DFSDL::cleanup() {
}
}

void * DFSDL::lookup_DFSDL_Symbol(const char *name) {
if (!g_sdl_handle)
return nullptr;
return LookupPlugin(g_sdl_handle, name);
}

void * DFSDL::lookup_DFIMG_Symbol(const char *name) {
if (!g_sdl_image_handle)
return nullptr;
return LookupPlugin(g_sdl_image_handle, name);
}

SDL_Surface * DFSDL::DFIMG_Load(const char *file) {
return g_IMG_Load(file);
}
Expand Down

0 comments on commit 1138f51

Please sign in to comment.