-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bf2f4a2
Showing
32 changed files
with
2,804 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dmtest/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
if (WIN32) | ||
# Needed for MSVC_RUNTIME_LIBRARY | ||
cmake_minimum_required(VERSION 3.15.0) | ||
else() | ||
cmake_minimum_required(VERSION 3.10.0) | ||
endif() | ||
|
||
project(demo-writer) | ||
if (WIN32) | ||
enable_language(ASM) | ||
endif() | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(SRC_DIR ${CMAKE_SOURCE_DIR}/src) | ||
if (WIN32) | ||
file(GLOB_RECURSE SRC_FILES | ||
"${SRC_DIR}/*.cpp" | ||
"${SRC_DIR}/*.h" | ||
"${SRC_DIR}/*.hpp" | ||
"${SRC_DIR}/*.s" | ||
) | ||
else() | ||
file(GLOB_RECURSE SRC_FILES | ||
"${SRC_DIR}/*.cpp" | ||
"${SRC_DIR}/*.h" | ||
"${SRC_DIR}/*.hpp" | ||
) | ||
endif() | ||
set(SRC_FILES ${SRC_FILES} "${SRC_DIR}/core/subhook/subhook.c") | ||
|
||
add_library(demo-writer SHARED ${SRC_FILES}) | ||
source_group(TREE ${SRC_DIR} FILES ${SRC_FILES}) | ||
if (WIN32) | ||
set_property(TARGET demo-writer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
if (MSVC) | ||
target_compile_options(demo-writer PRIVATE "/MP") | ||
else() | ||
target_link_libraries(demo-writer PRIVATE "ws2_32" "psapi" "-static-libgcc" "-static-libstdc++" "-static") | ||
endif() | ||
target_compile_definitions(demo-writer PRIVATE WIN32_LEAN_AND_MEAN SUBHOOK_IMPLEMENTATION) | ||
else() | ||
set_target_properties(demo-writer PROPERTIES COMPILE_OPTIONS "-m32" LINK_FLAGS "-m32") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
set(GNU_HOST i686-w64-mingw32) | ||
set(CMAKE_SYSTEM_PROCESSOR "i686") | ||
|
||
set(COMPILER_PREFIX "${GNU_HOST}-") | ||
set(COMPILER_SUFFIX "-posix") | ||
|
||
set(CMAKE_SYSTEM_NAME "Windows") | ||
set(CMAKE_CROSSCOMPILING TRUE) | ||
set(WIN32 TRUE) | ||
set(MINGW TRUE) | ||
|
||
set(CMAKE_C_COMPILER ${COMPILER_PREFIX}gcc${COMPILER_SUFFIX}) | ||
set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}g++${COMPILER_SUFFIX}) | ||
set(CMAKE_RC_COMPILER ${COMPILER_PREFIX}windres) | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#pragma once | ||
|
||
enum DataType : unsigned char | ||
{ | ||
NULL_D = 0x00, | ||
TURF = 0x01, | ||
OBJ = 0x02, | ||
MOB = 0x03, | ||
AREA = 0x04, | ||
CLIENT = 0x05, | ||
STRING = 0x06, | ||
MOB_TYPEPATH = 0x08, | ||
OBJ_TYPEPATH = 0x09, | ||
TURF_TYPEPATH = 0x0A, | ||
AREA_TYPEPATH = 0x0B, | ||
RESOURCE = 0x0C, | ||
IMAGE = 0x0D, | ||
WORLD_D = 0x0E, | ||
LIST = 0x0F, | ||
LIST_ARGS = 0x10, | ||
LIST_MOB_VERBS = 0x11, | ||
LIST_VERBS = 0x12, | ||
LIST_TURF_VERBS = 0x13, | ||
LIST_AREA_VERBS = 0x14, | ||
LIST_CLIENT_VERBS = 0x15, | ||
LIST_SAVEFILE_DIR = 0x16, | ||
LIST_MOB_CONTENTS = 0x17, | ||
LIST_TURF_CONTENTS = 0x18, | ||
LIST_AREA_CONTENTS = 0x19, | ||
LIST_WORLD_CONTENTS = 0x1A, | ||
LIST_GROUP = 0x1B, | ||
LIST_CONTENTS = 0x1C, | ||
DATUM_TYPEPATH = 0x20, | ||
DATUM = 0x21, | ||
SAVEFILE = 0x23, | ||
SAVEFILE_TYPEPATH = 0x24, | ||
PROCPATH = 0x26, | ||
FILE_ = 0x27, | ||
LIST_TYPEPATH = 0x28, | ||
PREFAB = 0x29, | ||
NUMBER = 0x2A, | ||
LIST_MOB_VARS = 0x2C, | ||
LIST_OBJ_VARS = 0x2D, | ||
LIST_TURF_VARS = 0x2E, | ||
LIST_AREA_VARS = 0x2F, | ||
LIST_CLIENT_VARS = 0x30, | ||
LIST_VARS = 0x31, //maybe? | ||
LIST_MOB_OVERLAYS = 0x32, | ||
LIST_MOB_UNDERLAYS = 0x33, | ||
LIST_OVERLAYS = 0x34, | ||
LIST_UNDERLAYS = 0x35, | ||
LIST_TURF_OVERLAYS = 0x36, | ||
LIST_TURF_UNDERLAYS = 0x37, | ||
LIST_AREA_OVERLAYS = 0x38, | ||
LIST_AREA_UNDERLAYS = 0x39, | ||
APPEARANCE = 0x3A, | ||
CLIENT_TYPEPATH = 0x3B, | ||
IMAGE_TYPEPATH = 0x3F, | ||
LIST_IMAGE_OVERLAYS = 0x40, | ||
LIST_IMAGE_UNDERLAYS = 0x41, | ||
LIST_IMAGE_VARS = 0x42, | ||
LIST_IMAGE_VERBS = 0x43, | ||
LIST_IMAGE_CONTENTS = 0x44, // wait wtf | ||
LIST_CLIENT_IMAGES = 0x46, | ||
LIST_CLIENT_SCREEN = 0x47, | ||
LIST_TURF_VIS_CONTENTS = 0x4B, | ||
LIST_VIS_CONTENTS = 0x4C, | ||
LIST_MOB_VIS_CONTENTS = 0x4D, | ||
LIST_TURF_VIS_LOCS = 0x4E, | ||
LIST_VIS_LOCS = 0x4F, | ||
LIST_MOB_VIS_LOCS = 0x50, | ||
LIST_WORLD_VARS = 0x51, | ||
LIST_GLOBAL_VARS = 0x52, | ||
FILTERS = 0x53, | ||
LIST_IMAGE_VIS_CONTENTS = 0x54, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "byond_functions.h" | ||
|
||
GetStringTableEntryPtr GetStringTableEntry; | ||
SetTurfAppearancePtr SetTurfAppearance; | ||
SetAppearancePtr SetAppearance; | ||
SpliceAppearancePtr SpliceAppearance; | ||
SpliceStringPtr SpliceString; | ||
SetPixelXPtr SetPixelX; | ||
SetPixelYPtr SetPixelY; | ||
SetPixelWPtr SetPixelW; | ||
SetPixelZPtr SetPixelZ; | ||
SetMovableDirPtr SetMovableDir; | ||
SetLocPtr SetLoc; | ||
ToStringPtr ToString; | ||
GetMobAppearancePtr GetMobAppearance; | ||
GetObjAppearancePtr GetObjAppearance; | ||
GetVariablePtr GetVariable; | ||
AllocObjIdPtr AllocObjId; | ||
AllocMobIdPtr AllocMobId; | ||
ChangeTurfPtr ChangeTurf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "byond_structures.h" | ||
|
||
typedef String* (*GetStringTableEntryPtr)(int stringId); | ||
typedef void(*SetTurfAppearancePtr)(int appearance, int turf); | ||
typedef void(*SetAppearancePtr)(Value atom, int appearance); | ||
typedef void(__fastcall *SpliceAppearancePtr)(void* this_, int edx, int appearance); // it's actually __thiscall but c++ compilers are stupid | ||
typedef void(*SpliceStringPtr)(unsigned int id); | ||
typedef void(*SetPixelXPtr)(Value atom, short pixel_x); | ||
typedef SetPixelXPtr SetPixelYPtr; | ||
typedef SetPixelXPtr SetPixelZPtr; | ||
typedef SetPixelXPtr SetPixelWPtr; | ||
typedef void(*SetMovableDirPtr)(Value atom, unsigned char dir); | ||
typedef void(*SetLocPtr)(Value atom, Value loc); | ||
typedef unsigned int(*ToStringPtr)(int type, int value); | ||
typedef unsigned int(*GetObjAppearancePtr)(unsigned int id); | ||
typedef unsigned int(*GetMobAppearancePtr)(unsigned int id); | ||
typedef Value(*GetVariablePtr)(Value datum, unsigned int varNameId); | ||
typedef int(*AllocObjIdPtr)(); | ||
typedef int(*AllocMobIdPtr)(); | ||
typedef void(*ChangeTurfPtr)(int a, int b, int type, Value turf); | ||
|
||
extern GetStringTableEntryPtr GetStringTableEntry; | ||
extern SetTurfAppearancePtr SetTurfAppearance; | ||
extern SetAppearancePtr SetAppearance; | ||
extern SpliceAppearancePtr SpliceAppearance; | ||
extern SpliceStringPtr SpliceString; | ||
extern SetPixelXPtr SetPixelX; | ||
extern SetPixelYPtr SetPixelY; | ||
extern SetPixelWPtr SetPixelW; | ||
extern SetPixelZPtr SetPixelZ; | ||
extern SetMovableDirPtr SetMovableDir; | ||
extern SetLocPtr SetLoc; | ||
extern ToStringPtr ToString; | ||
extern GetMobAppearancePtr GetMobAppearance; | ||
extern GetObjAppearancePtr GetObjAppearance; | ||
extern GetVariablePtr GetVariable; | ||
extern AllocObjIdPtr AllocObjId; | ||
extern AllocMobIdPtr AllocMobId; | ||
extern ChangeTurfPtr ChangeTurf; |
Oops, something went wrong.