Remove Hooks-egg.cpp and related code and configuration options

develop
lethosor 2022-06-29 00:03:49 -04:00
parent 1147add520
commit 739871bc0f
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
7 changed files with 10 additions and 159 deletions

@ -206,11 +206,9 @@ set(DFHACK_BUILD_ID "" CACHE STRING "Build ID (should be specified on command li
if(UNIX)
# put the lib into DF/hack
set(DFHACK_LIBRARY_DESTINATION hack)
set(DFHACK_EGGY_DESTINATION libs)
else()
# windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile...
set(DFHACK_LIBRARY_DESTINATION .)
set(DFHACK_EGGY_DESTINATION .)
endif()
# external tools will be installed here:

@ -47,6 +47,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Documentation
## API
- Removed "egg" ("eggy") hook support (Linux only). The only remaining method of hooking into DF is by interposing SDL calls, which has been the method used by all binary releases of DFHack.
- Removed ``Engravings`` module (C++-only). Access ``world.engravings`` directly instead.
- Removed ``Notes`` module (C++-only). Access ``ui.waypoints.points`` directly instead.
- Removed ``Windows`` module (C++-only) - unused.

@ -114,13 +114,6 @@ set(MAIN_SOURCES_DARWIN
Process-darwin.cpp
)
set(MAIN_SOURCES_LINUX_EGGY
${CONSOLE_SOURCES}
Hooks-egg.cpp
PlugLoad-linux.cpp
Process-linux.cpp
)
set(MODULE_HEADERS
include/modules/Buildings.h
include/modules/Burrows.h
@ -206,10 +199,7 @@ list(APPEND PROJECT_SOURCES ${MAIN_SOURCES})
list(APPEND PROJECT_SOURCES ${MODULE_SOURCES})
if(UNIX)
option(BUILD_EGGY "Make DFHack strangely egg-shaped." OFF)
if(BUILD_EGGY)
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX_EGGY})
elseif(APPLE)
if(APPLE)
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_DARWIN})
else()
list(APPEND PROJECT_SOURCES ${MAIN_SOURCES_LINUX})
@ -371,15 +361,9 @@ add_executable(dfhack-run dfhack-run.cpp)
add_executable(binpatch binpatch.cpp)
target_link_libraries(binpatch dfhack-md5)
if(BUILD_EGGY)
set_target_properties(dfhack PROPERTIES OUTPUT_NAME "egg" )
else()
if(WIN32)
set_target_properties(dfhack PROPERTIES OUTPUT_NAME "SDL" )
endif()
endif()
if(WIN32)
# name the resulting library SDL.dll on Windows
set_target_properties(dfhack PROPERTIES OUTPUT_NAME "SDL" )
set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )
set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" )
else()
@ -434,23 +418,15 @@ if(UNIX)
DESTINATION .)
endif()
else()
if(NOT BUILD_EGGY)
# On windows, copy the renamed SDL so DF can still run.
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH}/SDLreal.dll
DESTINATION ${DFHACK_LIBRARY_DESTINATION})
endif()
# On windows, copy the renamed SDL so DF can still run.
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/win${DFHACK_BUILD_ARCH}/SDLreal.dll
DESTINATION ${DFHACK_LIBRARY_DESTINATION})
endif()
# install the main lib
if(NOT BUILD_EGGY)
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
else()
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_EGGY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_EGGY_DESTINATION})
endif()
install(TARGETS dfhack
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
# install the offset file
install(FILES xml/symbols.xml

@ -1975,13 +1975,6 @@ bool Core::isSuspended(void)
return ownerThread.load() == std::this_thread::get_id();
}
int Core::TileUpdate()
{
if(!started)
return false;
return true;
}
void Core::doUpdate(color_ostream &out, bool first_update)
{
Lua::Core::Reset(out, "DF code execution");

@ -1,92 +0,0 @@
/*
https://github.com/peterix/dfhack
Copyright (c) 2009-2012 Petr Mrázek (peterix@gmail.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <string>
#include <map>
#include "Core.h"
#include "Hooks.h"
#include <iostream>
// hook - called before rendering
DFhackCExport int egg_init(void)
{
// reroute stderr
freopen("stderr.log", "w", stderr);
// we don't reroute stdout until we figure out if this should be done at all
// See: Console-linux.cpp
fprintf(stderr,"dfhack: hooking successful\n");
return true;
}
// hook - called before rendering
DFhackCExport int egg_shutdown(void)
{
DFHack::Core & c = DFHack::Core::getInstance();
return c.Shutdown();
}
// hook - called for each game tick (or more often)
DFhackCExport int egg_tick(void)
{
DFHack::Core & c = DFHack::Core::getInstance();
return c.Update();
}
// hook - called before rendering
DFhackCExport int egg_prerender(void)
{
DFHack::Core & c = DFHack::Core::getInstance();
return c.TileUpdate();
}
// hook - called for each SDL event, returns 0 when the event has been consumed. 1 otherwise
DFhackCExport int egg_sdl_event(SDL::Event* event)
{
// if the event is valid, intercept
if( event != 0 )
{
DFHack::Core & c = DFHack::Core::getInstance();
return c.DFH_SDL_Event(event);
}
return true;
}
// return this if you want to kill the event.
const int curses_error = -1;
// hook - ncurses event, -1 signifies error.
DFhackCExport int egg_curses_event(int orig_return)
{
/*
if(orig_return != -1)
{
DFHack::Core & c = DFHack::Core::getInstance();
int out;
return c.ncurses_wgetch(orig_return,);
}*/
return orig_return;
}

@ -121,12 +121,6 @@ namespace DFHack
friend int ::SDL_Init(uint32_t flags);
friend int ::wgetch(WINDOW * w);
#endif
friend int ::egg_init(void);
friend int ::egg_shutdown(void);
friend int ::egg_tick(void);
friend int ::egg_prerender(void);
friend int ::egg_sdl_event(SDL::Event* event);
friend int ::egg_curses_event(int orig_return);
public:
/// Get the single Core instance or make one.
static Core& getInstance()
@ -205,7 +199,6 @@ namespace DFHack
bool Init();
int Update (void);
int TileUpdate (void);
int Shutdown (void);
int DFH_SDL_Event(SDL::Event* event);
bool ncurses_wgetch(int in, int & out);

@ -74,21 +74,3 @@ DFhackCExport void * SDL_GetVideoSurface(void);
DFhackCExport int SDL_SemWait(vPtr sem);
DFhackCExport int SDL_SemPost(vPtr sem);
// hook - called early from DF's main()
DFhackCExport int egg_init(void);
// hook - called before rendering
DFhackCExport int egg_shutdown(void);
// hook - called for each game tick (or more often)
DFhackCExport int egg_tick(void);
// hook - called before rendering
DFhackCExport int egg_prerender(void);
// hook - called for each SDL event, can filter both the event and the return value
DFhackCExport int egg_sdl_event(SDL::Event* event);
// hook - ncurses event. return -1 to consume
DFhackCExport int egg_curses_event(int orig_return);