diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7672655fef1ea037c44a134f6fb858bc1cc135b0..2ba9611b2426f313951ae9dd6b25323a7a81039f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,10 +69,19 @@ endif()
 set(SRB2_SDL2_EXE_NAME srb2)
 set(SRB2_WIN_EXE_NAME srb2dd)
 
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
+
 add_subdirectory(src)
 add_subdirectory(assets)
 
 
+## config.h generation
+set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
+include(GitUtilities)
+git_describe(SRB2_COMP_REVISION "${CMAKE_CURRENT_SOURCE_DIR}")
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
+
+
 
 ##### PACKAGE CONFIGURATION #####
 
diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt
index cbcb6ba1cfb2b0b3af5a86c0497893a3d84fa171..8d149bf3f95829fbc7acbbd892f977611b7609d7 100644
--- a/assets/CMakeLists.txt
+++ b/assets/CMakeLists.txt
@@ -11,15 +11,16 @@ set(SRB2_ASSET_ALL
 )
 
 set(SRB2_ASSET_HASHED
-	${CMAKE_CURRENT_SOURCE_DIR}/srb2.srb
-	${CMAKE_CURRENT_SOURCE_DIR}/player.dta
-	${CMAKE_CURRENT_SOURCE_DIR}/rings.dta
-	${CMAKE_CURRENT_SOURCE_DIR}/zones.dta
-	${CMAKE_CURRENT_SOURCE_DIR}/patch.dta
+	srb2.srb
+	player.dta
+	rings.dta
+	zones.dta
+	patch.dta
 )
 
 foreach(SRB2_ASSET ${SRB2_ASSET_HASHED})
-	file(MD5 ${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH")
+	file(MD5 ${CMAKE_CURRENT_SOURCE_DIR}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH")
+	set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE)
 endforeach()
 
 # Installation
diff --git a/cmake/Modules/GitUtilities.cmake b/cmake/Modules/GitUtilities.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..de4015b0d1e45be3afd1c858c373db4b3d36277c
--- /dev/null
+++ b/cmake/Modules/GitUtilities.cmake
@@ -0,0 +1,22 @@
+# Git utilities
+
+if(__GitUtilities)
+	return()
+endif()
+
+set(__GitUtilities ON)
+
+function(git_describe variable path)
+	execute_process(COMMAND "${GIT_EXECUTABLE}" "describe"
+		WORKING_DIRECTORY "${path}"
+		RESULT_VARIABLE result
+		OUTPUT_VARIABLE output
+		ERROR_QUIET
+		OUTPUT_STRIP_TRAILING_WHITESPACE
+	)
+	#if(NOT result EQUAL 0)
+	#	set(${variable} "GITERROR-${result}-NOTFOUND" CACHE STRING "revision" FORCE)
+	#endif()
+
+	set(${variable} "${output}" PARENT_SCOPE)
+endfunction()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6915071e523c7d5eb952cd1b617d7017aad58bc8..b3e01ccef8904e3f54d0975c26ce518c2cea3cf5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -160,6 +160,8 @@ set(SRB2_CORE_HEADERS
 prepend_sources(SRB2_CORE_SOURCES)
 prepend_sources(SRB2_CORE_HEADERS)
 
+set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
 set(SRB2_HWRENDER_SOURCES
 	hardware/hw_bsp.c
 	hardware/hw_cache.c
@@ -358,4 +360,6 @@ if(NOT CLANG AND NOT MSVC)
 	add_compile_options(-mno-ms-bitfields)
 endif()
 
+add_definitions(-DCMAKECONFIG)
+
 add_subdirectory(sdl)
diff --git a/src/comptime.c b/src/comptime.c
index cd6bfd9bb24d6cbbbd1e3f60258e82de35344037..a4dc5b0f9637e60d761819792ee1f5dd4058656e 100644
--- a/src/comptime.c
+++ b/src/comptime.c
@@ -7,10 +7,16 @@
  *
  */
 
-#ifdef COMPVERSION
+#if (defined(CMAKECONFIG))
+#include "config.h"
+const char *comprevision = SRB2_COMP_REVISION;
+
+#elif (defined(COMPVERSION))
 #include "comptime.h"
+
 #else
 const char *comprevision = "illegal";
+
 #endif
 
 const char *compdate = __DATE__;
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644
index 0000000000000000000000000000000000000000..9c98d36e7a2559ea7c7b833b1a757ad200067a4d
--- /dev/null
+++ b/src/config.h.in
@@ -0,0 +1,25 @@
+/** SRB2 CMake Configuration */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#ifdef CMAKECONFIG
+
+#define ASSET_HASH_SRB2_SRB   "${SRB2_ASSET_srb2.srb_HASH}"
+#define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}"
+#define ASSET_HASH_RINGS_DTA  "${SRB2_ASSET_rings.dta_HASH}"
+#define ASSET_HASH_ZONES_DTA  "${SRB2_ASSET_zones.dta_HASH}"
+#define ASSET_HASH_PATCH_DTA  "${SRB2_ASSET_patch.dta_HASH}"
+
+#define SRB2_COMP_REVISION    "${SRB2_COMP_REVISION}"
+
+#else
+
+#define ASSET_HASH_SRB2_SRB   "c1b9577687f8a795104aef4600720ea7"
+#define ASSET_HASH_ZONES_DTA  "303838c6c534d9540288360fa49cca60"
+#define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799"
+#define ASSET_HASH_RINGS_DTA  "85901ad4bf94637e5753d2ac2c03ea26"
+
+#define 
+#endif
+#endif
diff --git a/src/d_main.c b/src/d_main.c
index 95808b274ff111cb9146870f8530e5fe48686114..a959a86328e09d4a501c3c9b2eea52e197ed478d 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -74,6 +74,12 @@ int	snprintf(char *str, size_t n, const char *fmt, ...);
 #include "m_cond.h" // condition initialization
 #include "fastcmp.h"
 
+#ifdef CMAKECONFIG
+#include "config.h"
+#else
+#include "config.h.in"
+#endif
+
 #ifdef _XBOX
 #include "sdl/SRB2XBOX/xboxhelp.h"
 #endif
@@ -1115,10 +1121,10 @@ void D_SRB2Main(void)
 #if 1 // md5s last updated 12/14/14
 
 	// Check MD5s of autoloaded files
-	W_VerifyFileMD5(0, "c1b9577687f8a795104aef4600720ea7"); // srb2.srb/srb2.wad
-	W_VerifyFileMD5(1, "303838c6c534d9540288360fa49cca60"); // zones.dta
-	W_VerifyFileMD5(2, "cfca0f1c73023cbbd8f844f45480f799"); // player.dta
-	W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta
+	W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad
+	W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta
+	W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
+	W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta
 	//W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta
 	// don't check music.dta because people like to modify it, and it doesn't matter if they do
 	// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
diff --git a/src/f_wipe.c b/src/f_wipe.c
index 69c9808804fcda7d61c2405a71e114356ffea6ab..8e7c622c43a393276c6c9dffd9b515a36b3114b6 100644
--- a/src/f_wipe.c
+++ b/src/f_wipe.c
@@ -210,8 +210,8 @@ static void F_DoWipe(fademask_t *fademask)
 		UINT32 draw_linestogo, draw_rowstogo;
 
 		// rectangle coordinates, etc.
-		UINT16* scrxpos = (UINT16*)malloc(fademask->width + 1); //[fademask->width  + 1];
-		UINT16* scrypos = (UINT16*)malloc(fademask->height + 1);// [fademask->height + 1];
+		UINT16* scrxpos = (UINT16*)malloc((fademask->width + 1)  * sizeof(UINT16));
+		UINT16* scrypos = (UINT16*)malloc((fademask->height + 1) * sizeof(UINT16));
 		UINT16 maskx, masky;
 		UINT32 relativepos;