Fix ncurses wgetch() on OS X

Ref #731
develop
lethosor 2017-06-08 13:05:12 -04:00
parent 8d23660d55
commit ba68683964
4 changed files with 7 additions and 8 deletions

@ -358,6 +358,7 @@ IF(APPLE)
TARGET_LINK_LIBRARIES(dfhack ${SDL_LIBRARY})
TARGET_LINK_LIBRARIES(dfhack ${CXX_LIBRARY})
TARGET_LINK_LIBRARIES(dfhack ${ZIP_LIBRARY})
TARGET_LINK_LIBRARIES(dfhack ncurses)
SET_TARGET_PROPERTIES(dfhack PROPERTIES VERSION 1.0.0)
SET_TARGET_PROPERTIES(dfhack PROPERTIES SOVERSION 1.0.0)
ENDIF()

@ -68,6 +68,7 @@ DYLD_INTERPOSE(DFH_SDL_Init,SDL_Init);
DYLD_INTERPOSE(DFH_SDL_PollEvent,SDL_PollEvent);
DYLD_INTERPOSE(DFH_SDL_Quit,SDL_Quit);
DYLD_INTERPOSE(DFH_SDL_NumJoysticks,SDL_NumJoysticks);
DYLD_INTERPOSE(DFH_wgetch,wgetch);
/*******************************************************************************
* SDL part starts here *
@ -127,16 +128,11 @@ DFhackCExport int SDL_PushEvent(SDL::Event* event)
}
struct WINDOW;
DFhackCExport int wgetch(WINDOW *win)
DFhackCExport int DFH_wgetch(WINDOW *win)
{
static int (*_wgetch)(WINDOW * win) = (int (*)( WINDOW * )) dlsym(RTLD_NEXT, "wgetch");
if(!_wgetch)
{
exit(EXIT_FAILURE);
}
DFHack::Core & c = DFHack::Core::getInstance();
wgetch_again:
int in = _wgetch(win);
int in = wgetch(win);
int out;
if(c.ncurses_wgetch(in, out))
{

@ -109,13 +109,14 @@ namespace DFHack
friend void ::DFH_SDL_Quit(void);
friend int ::DFH_SDL_PollEvent(SDL::Event *);
friend int ::DFH_SDL_Init(uint32_t flags);
friend int ::DFH_wgetch(WINDOW * w);
#else
friend int ::SDL_NumJoysticks(void);
friend void ::SDL_Quit(void);
friend int ::SDL_PollEvent(SDL::Event *);
friend int ::SDL_Init(uint32_t flags);
#endif
friend int ::wgetch(WINDOW * w);
#endif
friend int ::egg_init(void);
friend int ::egg_shutdown(void);
friend int ::egg_tick(void);

@ -52,6 +52,7 @@ DFhackCExport int DFH_SDL_NumJoysticks(void);
DFhackCExport void DFH_SDL_Quit(void);
DFhackCExport int DFH_SDL_PollEvent(SDL::Event* event);
DFhackCExport int DFH_SDL_Init(uint32_t flags);
DFhackCExport int DFH_wgetch(WINDOW * win);
#endif
DFhackCExport int SDL_NumJoysticks(void);
DFhackCExport void SDL_Quit(void);