Index: Daodan/src/Daodan_Config.c
===================================================================
--- Daodan/src/Daodan_Config.c	(revision 994)
+++ Daodan/src/Daodan_Config.c	(revision 995)
@@ -19,4 +19,7 @@
 static const char* defaultSection = "options";
 
+static char invalidCurParamaters[1000] = "";
+static char invalidTotalParamaters[3000] = "";
+
 void DDrConfig_PrintHelp();
 
@@ -25,10 +28,10 @@
 	{ "patches", "Patches", {
 		{ "alttab",
-			"Allows user to switch applications while in Oni (Alt-Tab) and use Windows key, however it may enable the screensaver as well.",
+			"Allows to Alt-Tab out of Oni and use Windows key. May enable the screensaver as well.",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "argb8888",
-			"Textures using ARGB8888 can be used.",
+			"Allows using textures with ARGB8888.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -39,14 +42,4 @@
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
-		{ "bsl",
-			"Enables d_regen (unfinished) and prevents fly-in portraits from being stretched when playing in widescreen resolutions.",
-			C_BOOL,
-			{.intBoolVal = true},
-			{.intBoolVal = true} },
-		{ "cheater",
-			"Adds new cheat codes (see section below).",
-			C_BOOL,
-			{.intBoolVal = true},
-			{.intBoolVal = true} },
 		{ "cheatsenabled",
 			"Enables cheats without having to beat the game first.",
@@ -55,10 +48,10 @@
 			{.intBoolVal = true} },
 		{ "cheattable",
-			"Replaces Oni's cheat table with table that includes new cheats (see section below).",
+			"Replaces Oni's cheat table with table that includes new cheats including devmode.",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "chinese",
-			"Allow for chinese fonts to be shown.",
+			"Allow for chinese fonts to be shown if the required DLL is available.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -74,16 +67,21 @@
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
+		{ "d_regen",
+			"Enables script command d_regen (query/set regeneration for any character).",
+			C_BOOL,
+			{.intBoolVal = true},
+			{.intBoolVal = true} },
 		{ "daodandisplayenum",
-			"Offers more display modes in the Options menu.",
+			"Offers a more accurate list of available display modes in the Options menu.",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "directinput",
-			"Forces on DirectInput.",
+			"Enforces the usage of DirectInput on every system. Should be off for Linux/Wine.",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "disablecmdline",
-			"Replaces existing command line parser with Daodan's in order to add new commands. Meant to be used with getcmdline.",
+			"Disables Oni's existing command line parser as Daodan has its own.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -94,11 +92,6 @@
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
-		{ "getcmdline",
-			"Replaces existing command line parser with Daodan's in order to add new commands. Meant to be used with disablecmdline.",
-			C_BOOL,
-			{.intBoolVal = true},
-			{.intBoolVal = true} },
 		{ "hdscreens_lowres",
-			"Allow HD screens with resolution < 1024*768.",
+			"Allow HD intro/ending screens on game resolutions smaller than 1024x768.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -110,5 +103,10 @@
 			{.intBoolVal = true} },
 		{ "kickguns",
-			"Unfinished, do not use.",
+			"EXPERIMENTAL! Unfinished, do not use.",
+			C_BOOL,
+			{.intBoolVal = false},
+			{.intBoolVal = false} },
+		{ "killvtune",
+			"Prevent loading of vtuneapi.dll.",
 			C_BOOL,
 			{.intBoolVal = false},
@@ -120,10 +118,10 @@
 			{.intBoolVal = true} },
 		{ "levelplugins",
-			"Allows level files to be loaded from the GDF which do not end in \"_Final\".",
+			"Allows level files to be loaded which do not end in \"_Final\".",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "newweap",
-			"Picking up a weapon displays a message containing the weapon name and amount of ammo.",
+			"Standing above a weapon displays a message containing the weapon name and amount of ammo.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -139,11 +137,6 @@
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
-		{ "particledisablebit",
-			"Unlocks particle action disabling/enabling bits for all events so that a particle event can occur multiple times.",
-			C_BOOL,
-			{.intBoolVal = false},
-			{.intBoolVal = false} },
 		{ "pathfinding",
-			"Multiplies size of pathfinding grid cache by eight in order to prevent crashes in large levels.",
+			"Size of pathfinding grid cache increased by eight times in order to prevent crashes in large levels.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -165,15 +158,20 @@
 			{.intBoolVal = false} },
 		{ "showtriggervolumes",
-			"Allows BSL variable \"show_triggervolumes\" to work when set to 1.",
+			"Allows BSL variable \"show_triggervolumes\" and Ctrl+Shift+X (in devmode) to work.",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "throwtest",
-			"Not recommended for use; experiment with allowing enemies to be thrown over railings.",
+			"EXPERIMENTAL! Experiment with allowing enemies to be thrown over railings.",
 			C_BOOL,
 			{.intBoolVal = false},
 			{.intBoolVal = false} },
+		{ "usedaodanbsl",
+			"Adds new BSL commands.",
+			C_BOOL,
+			{.intBoolVal = true},
+			{.intBoolVal = true} },
 		{ "usedaodangl",
-			"Provides an improved windowed mode (-noswitch); this patch is known to break the hiding of the Windows taskbar in fullscreen mode.",
+			"Provides an improved windowed mode (-noswitch).",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -181,4 +179,9 @@
 		{ "usegettickcount",
 			"Replaces Oni's timing functions with more accurate ones.",
+			C_BOOL,
+			{.intBoolVal = true},
+			{.intBoolVal = true} },
+		{ "widescreenportraits",
+			"Prevents fly-in portraits from being stretched when playing in widescreen resolutions.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -193,25 +196,25 @@
 	{ "options", "Options", {
 		{ "border",
-			"If \"windowhack\" patch is active, make sure game window has border in windowed mode.",
+			"Add a border if in windowed mode and \"usedaodangl\" patch is active.",
 			C_BOOL,
 			{.intBoolVal = true},
 			{.intBoolVal = true} },
 		{ "debug",
-			"???",
+			"Not useful, probably does nothing.",
 			EXT_BOOL,
 			{.intBoolVal = false },
 			{.extBoolVal = &AKgDebug_DebugMaps } },
 		{ "debugfiles",
-			"???",
+			"Not useful, probably does nothing.",
 			EXT_BOOL,
 			{.intBoolVal = false },
 			{.extBoolVal = &BFgDebugFileEnable } },
 		{ "findsounds",
-			"???",
+			"Not useful, extends output of sound_list_broken_links.",
 			EXT_BOOL,
 			{.intBoolVal = false },
 			{.extBoolVal = &SSgSearchOnDisk } },
 		{ "gamma",
-			"Enable gamma slider in fullscreen.",
+			"Enable gamma slider in fullscreen, disable in windowed mode.",
 			C_BOOL,
 			{.intBoolVal = true},
@@ -223,15 +226,15 @@
 			{.callback = DDrConfig_PrintHelp} },
 		{ "ignore_private_data",
-			"? No effect ?",
+			"Not useful, probably does nothing.",
 			EXT_BOOL,
 			{.intBoolVal = false },
 			{.extBoolVal = &opt_ignore_private_data } },
 		{ "sound",
-			"???",
+			"Enable sound.",
 			EXT_BOOL,
 			{.intBoolVal = true },
 			{.extBoolVal = &opt_sound } },
 		{ "switch",
-			"Always switch screen to resolution on Oni's Options screen, making the game fullscreen; opposite of Oni's built-in argument \"noswitch\".",
+			"Switch to fullscreen instead of staying in a window.",
 			EXT_BOOL,
 			{.intBoolVal = true},
@@ -242,9 +245,4 @@
 			{.intBoolVal = false},
 			{.intBoolVal = false} },
-		{ "usedaodanbsl",
-			"Adds new BSL commands (see below).",
-			C_BOOL,
-			{.intBoolVal = true},
-			{.intBoolVal = true} },
 		{ "language",
 			"Localization for hardcoded strings (e.g. \"Savepoints\").",
@@ -480,4 +478,10 @@
 				STARTUPMESSAGE("Config value type unknown: %d", co->type);
 		}
+	} else {
+		char buf[50];
+		sprintf_s(buf, sizeof(buf), "  %s.%s\n", section, name);
+		if (strlen(buf) + strlen(invalidCurParamaters) < sizeof(invalidCurParamaters) - 1) {
+			strcpy(invalidCurParamaters + strlen(invalidCurParamaters), buf);
+		}
 	}
 }
@@ -549,5 +553,9 @@
 	STARTUPMESSAGE("Finished parsing", 0);
 
-
+	if (strlen(invalidCurParamaters) > 0)
+	{
+		sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "In %s:\n%s\n", iniName, invalidCurParamaters);
+		invalidCurParamaters[0] = 0;
+	}
 
 	STARTUPMESSAGE("Parsing command line...", 0);
@@ -555,4 +563,19 @@
 	STARTUPMESSAGE("Finished parsing", 0);
 
+	if (strlen(invalidCurParamaters) > 0)
+	{
+		sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "%sOn command line:\n%s\n", invalidTotalParamaters, invalidCurParamaters);
+	}
+
+	if (strlen(invalidTotalParamaters) > 0)
+	{
+		char msg[3200];
+		sprintf_s(msg, sizeof(msg), "Invalid parameters given:\n%sContinue launching Oni?", invalidTotalParamaters);
+		int res = MessageBox(NULL, msg, "Parameters invalid", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1);
+		if (res == IDNO) {
+			exit(0);
+		}
+	}
+
 //	DDrConfig_Print();
 }
Index: Daodan/src/Daodan_Patch.c
===================================================================
--- Daodan/src/Daodan_Patch.c	(revision 994)
+++ Daodan/src/Daodan_Patch.c	(revision 995)
@@ -42,26 +42,9 @@
 {
 	int len = 0;
+
 /*
-    DISASM MyDisasm;
-    int i = 0;
-    STARTUPMESSAGE("", 0);
-    STARTUPMESSAGE("", 0);
-
-    memset (&MyDisasm, 0, sizeof(DISASM));
-    MyDisasm.EIP = (UIntPtr) from;
-    i = 0;
-    STARTUPMESSAGE("Orig before @ 0x%06x", from);
-    while (i<10){
-        len = Disasm(&MyDisasm);
-        if (len != UNKNOWN_OPCODE) {
-			STARTUPMESSAGE("%s, Opcode: 0x%x, len: %d, branch: %d, to: 0x%06x", MyDisasm.CompleteInstr, MyDisasm.Instruction.Opcode, len, MyDisasm.Instruction.BranchType, MyDisasm.Instruction.AddrValue);
-			STARTUPMESSAGE("    Cat: 0x%04x, prefix count: %d", MyDisasm.Instruction.Category & 0xffff, MyDisasm.Prefix.Number );
-            MyDisasm.EIP += (UIntPtr)len;
-            i++;
-        }
-    };
-    STARTUPMESSAGE("", 0);
+	STARTUPMESSAGE("Orig before", 0);
+	DDrPatch_PrintDisasm(from, 10, 0);
 */
-
 	DISASM disasm;
 	memset(&disasm, 0, sizeof(DISASM));
@@ -175,50 +158,15 @@
 	}
 	DDrPatch_MakeJump(from, to);
+
 /*
-    memset (&MyDisasm, 0, sizeof(DISASM));
-    MyDisasm.EIP = (UIntPtr) trampoline;
-    i = 0;
-    STARTUPMESSAGE("Trampoline @ 0x%06x", trampoline);
-    while (i<10){
-        len = Disasm(&MyDisasm);
-        if (len != UNKNOWN_OPCODE) {
-            STARTUPMESSAGE("%s", MyDisasm.CompleteInstr);
-            MyDisasm.EIP += (UIntPtr)len;
-            i++;
-        }
-    };
-    STARTUPMESSAGE("", 0);
-     
-    memset (&MyDisasm, 0, sizeof(DISASM));
-    MyDisasm.EIP = disasm.EIP;
-    i = 0;
-    STARTUPMESSAGE("Orig after @ 0x%06x", disasm.EIP);
-    while (i<7){
-        len = Disasm(&MyDisasm);
-        if (len != UNKNOWN_OPCODE) {
-            STARTUPMESSAGE("%s", MyDisasm.CompleteInstr);
-            MyDisasm.EIP += (UIntPtr)len;
-            i++;
-        }
-    };
-    STARTUPMESSAGE("", 0);
-
-    memset (&MyDisasm, 0, sizeof(DISASM));
-    MyDisasm.EIP = (UIntPtr) from;
-    i = 0;
-    STARTUPMESSAGE("Orig start after @ 0x%06x", from);
-    while (i<3){
-        len = Disasm(&MyDisasm);
-        if (len != UNKNOWN_OPCODE) {
-            STARTUPMESSAGE("%s", MyDisasm.CompleteInstr);
-            MyDisasm.EIP += (UIntPtr)len;
-            i++;
-        }
-    };
-    STARTUPMESSAGE("", 0);
-    STARTUPMESSAGE("", 0);
-    STARTUPMESSAGE("", 0);
+	STARTUPMESSAGE("Trampoline", 0);
+	DDrPatch_PrintDisasm(trampoline, 10, 6);
+
+	STARTUPMESSAGE("Orig after", 0);
+	DDrPatch_PrintDisasm(disasm.EIP, 7, 0);
+
+	STARTUPMESSAGE("Orig start after", 0);
+	DDrPatch_PrintDisasm(from, 3, 6);
 */
-
 	return trampoline;
 }
Index: Daodan/src/Oni/Symbols_Func.h
===================================================================
--- Daodan/src/Oni/Symbols_Func.h	(revision 994)
+++ Daodan/src/Oni/Symbols_Func.h	(revision 995)
@@ -10,11 +10,11 @@
 
 // Orig timing functions, replaced by DDrMachineTime_* if option "usegettickcount" is enabled
-DefFunc(int64_t, UUrMachineTime_High, ONICALL, (), 0x04026480);
-DefFunc(double, UUrMachineTime_High_Frequency, ONICALL, (), 0x040264b0);
-DefFunc(int64_t, UUrMachineTime_Sixtieths, ONICALL, (), 0x040263e0);
+DefFunc(int64_t, UUrMachineTime_High, ONICALL, (), 0x00426480);
+DefFunc(double, UUrMachineTime_High_Frequency, ONICALL, (), 0x004264b0);
+DefFunc(int64_t, UUrMachineTime_Sixtieths, ONICALL, (), 0x004263e0);
 
 // Code to initialize platform stuff (like disabling system key combination Alt+Tab)
-DefFunc(void, UUrPlatform_Initialize, ONICALL, (), 0x04026010);
-DefFunc(void, UUrPlatform_Terminate, ONICALL, (), 0x04026310);
+DefFunc(void, UUrPlatform_Initialize, ONICALL, (), 0x00426010);
+DefFunc(void, UUrPlatform_Terminate, ONICALL, (), 0x00426310);
 
 // Oni's file access methods
@@ -39,5 +39,5 @@
 // DD_GLrPlatform_Initialize/DD_GLrPlatform_Dispoose instead if daodangl is used.
 DefFunc(UUtBool, gl_platform_initialize, ONICALL, (void), 0x00407da0);
-DefFunc(void, gl_platform_dispose, ONICALL, (void), 0x408210);
+DefFunc(void, gl_platform_dispose, ONICALL, (void), 0x00408210);
 
 // Retrieve gamma value from settings
@@ -128,9 +128,6 @@
 DefFunc(uint16_t, AI2iScript_Spawn, ONICALL, (sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret), 0x004B4780);
 DefFunc(void, AI2rSmite, ONICALL, (Character *inCharacter, UUtBool inSpareCharacter), 0x0048BDA0);
-//NOT USED: DefFunc(void*, OBJrObjectType_GetObject_ByNumber, ONICALL, (int inObjectType, int inIndex), );
-//NOT USED: DefFunc(int, OBJiObjectGroup_GetNumObjects, ONICALL, (void *inObjectGroup), );
 
 DefFunc(int, OBJrObjectType_EnumerateObjects, ONICALL, (int inObjectType, OBJtEnumCallback_Object inEnumCallback, int inUserData), 0x004D0080);
-//DefFunc(void, OBJrTriggerVolume_IntersectsCharacter, ONICALL, (), 0x004cc680);
 
 DefFunc(void, OBJrDoor_Open, ONICALL, (DoorObject *inObject, Character *inCharacter), 0x004C26C0);
@@ -147,18 +144,4 @@
 
 DefFunc(void, M3rGeom_Line_Light, ONICALL, (const M3tPoint3D *point1, const M3tPoint3D *point2, uint32_t shade), 0x0041f440);
-/*
-DefFunc(void, M3rGeom_Line_Light, ONICALL, (), 0x0041f440);
-DefFunc(void, M3rMatrixStack_Push, ONICALL, (), 0x0041baa0);
-DefFunc(void, M3rMatrixStack_Get, ONICALL, (), 0x0041bb20);
-DefFunc(void, M3rMatrixStack_Pop, ONICALL, (), 0x0041bb30);
-DefFunc(void, M3rMatrixStack_Identity, ONICALL, (), 0x0041bba0);
-DefFunc(void, M3rMatrixStack_Rotate, ONICALL, (), 0x0041bbe0);
-DefFunc(void, M3rMatrixStack_UniformScale, ONICALL, (), 0x0041bc20);
-DefFunc(void, M3rMatrixStack_Translate, ONICALL, (), 0x0041bc40);
-DefFunc(void, M3rMatrixStack_Multiply, ONICALL, (), 0x0041bc70);
-DefFunc(void, M3rGeom_State_Commit, ONICALL, (), 0x0041e870);
-
-DefFunc(void, MUrPoint_Distance, ONICALL, (), 0x00433270);
-*/
 
 // Make a dialog element (in)visible and change its position
Index: Daodan/src/Patches/BSL.c
===================================================================
--- Daodan/src/Patches/BSL.c	(revision 994)
+++ Daodan/src/Patches/BSL.c	(revision 995)
@@ -13,4 +13,9 @@
 #include "Character.h"
 
+bool ONICALL argumentEmpty(sl_arg* arg) {
+	if ((arg->type == sl_str32) && (strlen(arg->val.value_str32) == 0))
+		return true;
+	return false;
+}
 
 uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
@@ -93,5 +98,5 @@
 {
 	int index;
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
@@ -106,5 +111,5 @@
 {
 	int index;
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
@@ -186,5 +191,5 @@
 	Character* Chr;
 	int* health;
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
@@ -207,9 +212,8 @@
 	int index;
 	Character* Chr;
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
 	Chr = ONgGameState->CharacterStorage ;
-	
 	
 	/*
@@ -311,5 +315,5 @@
 {
 	int index;
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
@@ -336,5 +340,5 @@
 	
 	int index;
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else	if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
@@ -356,5 +360,5 @@
 	char* name;
 
-	if (numargs == 0) index = 0;
+	if (argumentEmpty(&args[0])) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].val.value_str32);
 	else index = args[0].val.value_int32;
@@ -395,5 +399,5 @@
 		numargs++;
 	}
-	if(numargs == 0) return 0;
+	if(argumentEmpty(&args[0])) return 0;
 	if(numargs > 1 ) color.R = (char)args[1].val.value_int32;
 	else color.R = 255;
@@ -693,4 +697,5 @@
 {
 	args[1].val.value_int32 = (double)args[1].val.value_int32 / (double)(gl->DisplayMode.Width) * (4.0 / 3.0 * (double)(gl->DisplayMode.Height));
+	// Call orig OCiCinematic_ScriptStart
 	return ((sl_func)(OniExe + 0x000f3830))(callinfo, numargs, args, dontuse1, dontuse2, ret);
 }
@@ -769,4 +774,5 @@
 void SLrDaodan_Patch()
 {
+	// PUSH OCiCinematic_ScriptStart -> PUSH cinematic_start_patch
 	DDrPatch_Int32((int*)(OniExe + 0x000f3755), (int)cinematic_start_patch);
 }
Index: Daodan/src/Patches/Cheater.c
===================================================================
--- Daodan/src/Patches/Cheater.c	(revision 994)
+++ Daodan/src/Patches/Cheater.c	(revision 995)
@@ -253,6 +253,5 @@
 		case cheat_elderrune:
 		{
-			ConfigOption_t* co = DDrConfig_GetOptOfType("patch.bsl", C_BOOL);
-			if (co->value.intBoolVal)
+			if (DDrConfig_GetOptOfType("patches.d_regen", C_BOOL)->value.intBoolVal)
 			{
 				int* Regeneration = &ONgGameState->PlayerCharacter->RegenHax;
Index: Daodan/src/Patches/Patches.c
===================================================================
--- Daodan/src/Patches/Patches.c	(revision 994)
+++ Daodan/src/Patches/Patches.c	(revision 995)
@@ -85,6 +85,5 @@
 void ONICALL DDrGame_Init()
 {
-	ConfigOption_t* co = DDrConfig_GetOptOfType("options.usedaodanbsl", C_BOOL);
-	if (co->value.intBoolVal)
+	if (DDrConfig_GetOptOfType("patches.usedaodanbsl", C_BOOL)->value.intBoolVal)
 		SLrDaodan_Initialize();
 }
@@ -193,96 +192,22 @@
 
 
-int DD_Patch_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output)
-{
-	//flags = (1 << 10);
-	type = 1;
-	//DDrPatch_Byte( 0x005EB83C + 3, 0xff );
-	DDrPatch_Int32((int*)(OniExe + 0x001EB83C), 0xFF000000 );
-	return M3rTextureMap_New(width, height, type, allocated, flags, name, output);
-}
-
-short DD_Patch_DebugNameShadeHack( Character* Char )
-{
-	return TSrContext_SetShade(*(void**)(OniExe + 0x001EB844), ONrCharacter_GetHealthShade( Char->Health, Char->MaxHealth ));
-	//return TSrContext_SetShade(*(void**)0x005EB844, 0xFFFFFFFF);
-}
-
-
-// Disable UUrPlatform_Initalize/Terminate, this enables the Alt-Tab and the
-// Windows key but has the possible side effect of allowing the screensaver
-// to enable itself in-game.
-void DD_Patch_AltTab()
-{
-	// 0xC3 = ret, so makes those functions just have a "ret" instruction at their start
-	DDrPatch_Byte  ((char*)UUrPlatform_Initialize, 0xC3);
-	DDrPatch_Byte  ((char*)UUrPlatform_Terminate, 0xC3);
-}
-
-// Textures using ARGB8888 can be used
-void DD_Patch_ARGB8888()
-{
-	DDrPatch_Byte  ((char*)(OniExe + 0x00135af0), 0x07);
-	DDrPatch_Byte  ((char*)(OniExe + 0x00135af4), 0x0B);
-}
-
-// Fix BinkBufferInit() call in BKrMovie_Play() to use GDI (DIB) blitting
-// instead of DirectDraw; patch ONiRunGame to use the same method to play
-// outro (ie., BKrMovie_Play() instead of ONrMovie_Play_Hardware() as the
-// latter has problems on WINE).
-void DD_Patch_BinkPlay()
-{
-	// push BINKBUFFERAUTO -> push BINKBUFFERDIBSECTION.
-	DDrPatch_Byte((void*)(OniExe + 0x0008829b + 1), 0x02);
-	// call ONrMovie_Play_Hardware -> call ONrMovie_Play
-	DDrPatch_MakeCall((void*)(OniExe + 0x000d496f), ONrMovie_Play);
-}
-
-// Enables d_regen (unfinished) and prevents fly-in portraits from being
-// stretched when playing in widescreen resolutions. 
-void DD_Patch_BSL()
-{
-	//Calculating the value of the needed offset is much more reliable when the compiler does it for you.
-
-	//TODO: fix moonshadow.
+// Enables d_regen script command. Instead of one global flag to only regenerate player each char has a flag to enable local regeneration
+void DD_Patch_Regeneration()
+{
+	// In: WPrInventory_Update
 	Character * Chr = 0;
 	int NoPath = (int)&(Chr[0].RegenHax) & 0x000000FF;
 	const unsigned char regen_patch[] =
 	{0x90, 0x90, 0x90, 0x90, 0x90,				// mov    al, _WPgRegenerationCheat	-> NOOP
-	0x90, 0x90,									// test   al, al					-> NOOP
-	0x90, 0x90,									// jz	  short loc_51BB98			-> NOOP
+	0x90, 0x90,						// test   al, al			-> NOOP
+	0x90, 0x90,						// jz	  short loc_51BB98			-> NOOP
 	0x8B, 0x86, (char)NoPath, 0x01, 0x00, 0x00, // mov     eax, [esi+Character.field_1E8]
-												//	-> mov     eax, [esi+Character.RegenHax]
-	0x85, 0xC0,									// test eax, eax
-	0x74, 0x21									// jnz 0x21 -> jz 0x21
-	};	
+							//	-> mov     eax, [esi+Character.RegenHax]
+	0x85, 0xC0,						// test eax, eax
+	0x74, 0x21						// jnz 0x21 -> jz 0x21
+	};
 	DDrPatch_Const((char*)(OniExe + 0x0011BB64), regen_patch);
-
-	// Patches for existing BSL functions
-	SLrDaodan_Patch();
-}
-
-// Adds new cheat codes if cheattable is also enabled
-void DD_Patch_Cheater()
-{
-	DDrPatch_MakeCall((void*)(OniExe + 0x000f618f), (void*)DDrCheater);
-	DDrPatch_Int16((short*)(OniExe + 0x000deb45), 0x5590);
-#if 1
-	DDrPatch_MakeCall((void*)(OniExe + 0x000deb47), (void*)FallingFrames);
-#endif
-	DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
-}
-
-// Cheats always enabled
-void DD_Patch_CheatsEnabled()
-{
-	DDrPatch_MakeJump((void*)ONrPersist_GetWonGame, (void*)DDrPersist_GetWonGame);
-}
-
-// Use Daodan's own cheattable
-void DD_Patch_CheatTable()
-{
-	DDrPatch_Int32 ((int*)(OniExe + 0x000f616b), (int)&DDr_CheatTable[0].name);
-	DDrPatch_Int32 ((int*)(OniExe + 0x000f617a), (int)&DDr_CheatTable[0].message_on);
-}
+}
+
 
 // Load chinese font DLL if available
@@ -312,265 +237,18 @@
 }
 
-// Limit cursor to Oni's window
-void DD_Patch_ClipCursor()
-{
-	// LIrMode_Set: replace LIrPlatform_Mode_Set call with our hook.
-	DDrPatch_MakeCall((void*)(OniExe + 0x00003f9f), (void*) DD_LIrPlatform_Mode_Set);
-
-	// LIrMode_Set_Internal: replace LIrPlatform_Mode_Set call with our hook.
-	DDrPatch_MakeCall((void*)(OniExe + 0x00003fff), (void*) DD_LIrPlatform_Mode_Set);
-	
-	// LIrTermiante: replace LIrPlatform_Terminate call with our hook.
-	DDrPatch_MakeCall((void*)(OniExe + 0x000004cb8), (void*) DD_LIrPlatform_Terminate);
-}
-
-// Disables weapon cooldown exploit
-void DD_Patch_CooldownTimer()
-{
-	const unsigned char cooldown_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
-	DDrPatch_Const ((char*)(OniExe + 0x0011a825), cooldown_patch);
-}
-
-// Daodan device mode enumeration function
-void DD_Patch_DaodanDisplayEnum()
-{
-	DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)DD_GLrEnumerateDisplayModes);
-}
-
-// Adds new BSL functions
-void DD_Patch_DaodanInit()
-{
-	DDrPatch_MakeCall((void*)(OniExe + 0x000d345a), (void*)DDrGame_Init);
-}
-
-// Forced DirectInput (for Windows NT)
-void DD_Patch_DirectInput()
-{
-	DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb);
-}
-
-// Disable Oni's command line parser so it doesn't interfere with ours
-void DD_Patch_DisableCmdLine()
-{
-	// Replace start of OniParseCommandLine with XOR ax,ax; RET
-//	DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0xc3c03366);
-	// Replace start of OniParseCommandLine with XOR eax,eax; RET
-	DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0x00c3c033);
-}
-
-// Font texture cache doubled
-void DD_Patch_FontTextureCache()
-{
-	DDrPatch_Byte((char*)(OniExe + 0x00020ea7), 0x20);
-	DDrPatch_Byte((char*)(OniExe + 0x00020f4a), 0x40);
-}
-
-// Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own)
-void DD_Patch_GetCmdLine()
-{
-	DDrPatch_NOOP  ((char*)(OniExe + 0x000d3280), 51);
-}
-
-// Allow HD screens with resolution < 1024*768
-void DD_Patch_HDScreens_LowRes()
-{
-	DDrPatch_MakeJump((void*)M3rDraw_BigBitmap, (void*)DD_M3rDraw_BigBitmap);
-}
-
-void DD_Patch_HighresConsole() {
-	Oni_COrTextArea_Resize = DDrPatch_MakeDetour((void*)COrTextArea_Resize, (void*)DD_COrTextArea_Resize);
-}
-
-// Hackish fix for Konoko not kicking guns
-// Don't use this, it breaks stairs.
-void DD_Patch_KickGuns()
-{
-	const unsigned char kickgun_patch[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0xC7, 0x05, 0x1C, 0xC9, 0x5E, 0x00, 0x70, 0xB8, 0x43, 0x00, 0xC7, 0x05, 0x20, 0xC9, 0x5E, 0x00, 0x20, 0xBE, 0x43 };
-	DDrPatch_Const ((char*)(OniExe + 0x000dc420), kickgun_patch);
-}
-
-// Disable loading the vtuneapi.dll
-void DD_Patch_KillVTune()
-{
-	DDrPatch_Byte  ((char*)(OniExe + 0x00026340), 0xC3);
-}
-
-// Now supports textures up to 512x512
-void DD_Patch_LargeTextures()
-{
-	DDrPatch_Byte  ((char*)(OniExe + 0x00005251), 0x10);
-}
-
-// Non-"_Final" levels are now valid
-void DD_Patch_LevelPlugins()
-{
-	DDrPatch_Byte  ((char*)(OniExe + 0x000206a8), 0x01);
-}
-
-// Weapon on ground shown with name and magazine contents
-void DD_Patch_NewWeap()
-{
-	//Makes it always say "Received weapon_name."
-	//Needs check for loc_4DFC66
-	//DDrPatch_NOOP((char*)(OniExe + 0x000E4DF8),2);
-
-	//Adds Weapon name and ammo meter to pickup autoprompt
-	DDrPatch_NOOP((char*)(OniExe + 0x000FAC73), 9);
-	DDrPatch_NOOP((char*)(OniExe + 0x000FAC80), 5);
-	DDrPatch_MakeCall((void*)(OniExe + 0xFAC85), (void*)DDrWeapon2Message);
-	
-	//Moves location of colors
-	//DDrPatch_Int32((int*)(OniExe + 0x0002E3D5), (int)&DDrDSayColors );
-	//DDrPatch_Int32((int*)(OniExe + 0x0002E3DA), (int)&DDrDSayColors );
-}
-
-// Disable Multi-byte character awareness patch (multiple language support)
-void DD_Patch_NoMultiByte()
-{
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002d8f8), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002d9ad), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002dbe2), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002dec3), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e2ab), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e2c4), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e379), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e48c), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e4d0), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e4f4), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e646), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e695), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e944), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e95d), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e98e), 0xeb);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0002e9dc), 0xeb);
-}
-
-// Fix options not visible in main menu when a game was started
-void DD_Patch_OptionsVisible()
-{
-	DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton);
-	DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton);
-}
-
-// Unlocks particle action disabling/enabling bits for all events. (Will be
-// controlled by a command line switch when I figure out how to do that without
-// Win32 hacks.)
-void DD_Patch_ParticleDisableBit()
-{
-	DDrPatch_Int16 ((short*)(OniExe + 0x001b184), 0x9090);
-}
-
-// Pathfinding grid cache size x8
-void DD_Patch_PathFinding()
-{
-	const unsigned char pathfinding[2] = {0x90 , 0xE9 };
-	DDrPatch_Byte  ((char*)(OniExe + 0x0010b03b), 0x20);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0010b04c), 0x20);
-
-	//other stuff
-	DDrPatch_Const((char*)(OniExe + 0x00040789), pathfinding);
-}
-
-// Projectile awareness fixed
-void DD_Patch_ProjAware()
-{
-	DDrPatch_Byte  ((char*)(OniExe + 0x0009c07c), 0x6c);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0009c080), 0x70);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0009c084), 0x74);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0009c110), 0x6c);
-}
-
-// Safe startup message printer
-void DD_Patch_SafePrintf()
-{
-	DDrPatch_MakeJump((void*)UUrStartupMessage, (void*)DDrStartupMessage);
-}
-
-// Show all (also enemies') lasersights
-void DD_Patch_ShowAllLasersights()
-{
-	DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 );
-}
-
-void DD_Patch_ShowTriggerVolumes()
-{
-	Oni_ONrMechanics_Register = DDrPatch_MakeDetour((void*)ONrMechanics_Register, (void*)DD_ONrMechanics_Register);
-	Oni_ONrGameState_HandleUtilityInput = DDrPatch_MakeDetour((void*)ONrGameState_HandleUtilityInput, (void*)DD_ONrGameState_HandleUtilityInput);
-}
-
-// Experiment with allowing enemies to be thrown over railings
-void DD_Patch_Throwtest()
-{
-	const unsigned char throwtest_patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
-	DDrPatch_Const((char*)(OniExe + 0x000dc190), throwtest_patch);
-}
-
-// DaodanGL with windowed mode support
-void DD_Patch_UseDaodanGL()
-{
-	// LIrPlatform_Mode_Set: GetWindowRect -> GetClientRect.
-	DDrPatch_NOOP((char*) OniExe + 0x00002dd6, 6);
-	DDrPatch_MakeCall((char*) OniExe + 0x00002dd6, (void*) GetClientRect);
-
-	// UUrWindow_GetSize: GetWindowRect -> GetClientRect.
-	DDrPatch_NOOP((char*) OniExe + 0x0002651c, 6);
-	DDrPatch_MakeCall((char*) OniExe + 0x0002651c, (void*) GetClientRect);
-
-	// LIrPlatform_PollInputForAction: fix GetCursorPos call to return client coordinates.
-	DDrPatch_NOOP((char*) OniExe + 0x000032cc, 6);
-	DDrPatch_MakeCall((char*) OniExe + 0x000032cc, (void*) DD_GetCursorPos);
-
-	// LIrPlatform_InputEvent_GetMouse: fix GetCursorPos call to return client coordinates.
-	DDrPatch_NOOP((char*) OniExe + 0x00002cc2, 6);
-	DDrPatch_MakeCall((char*) OniExe + 0x00002cc2, (void*) DD_GetCursorPos);
-
-	// LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates.
-	DDrPatch_NOOP((char*) OniExe + 0x000032b7, 6);
-	DDrPatch_MakeCall((char*) OniExe + 0x000032b7, (void*) DD_SetCursorPos);
-
-	// LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates.
-	DDrPatch_NOOP((char*) OniExe + 0x00003349, 6);
-	DDrPatch_MakeCall((char*) OniExe + 0x00003349, (void*) DD_SetCursorPos);
-
-	// Replace ONrPlatformInitialize.
-	DDrPatch_MakeJump((void*) ONrPlatform_Initialize, (void*) DD_ONrPlatform_Initialize);
-
-	// Replace gl_platform_initialize.
-	DDrPatch_MakeJump((void*) gl_platform_initialize, (void*) DD_GLrPlatform_Initialize);
-
-	// Replace gl_platform_dispose.
-	DDrPatch_MakeJump((void *) gl_platform_dispose, (void*) DD_GLrPlatform_Dispose);
-}
-
-// Performance patch
-void DD_Patch_UseGetTickCount()
-{
-	DDrPatch_MakeJump((void*)UUrMachineTime_High, (void*)DDrMachineTime_High);
-	DDrPatch_MakeJump((void*)UUrMachineTime_High_Frequency, (void*)DDrMachineTime_High_Frequency);
-	DDrPatch_MakeJump((void*)UUrMachineTime_Sixtieths, (void*)DDrMachineTime_Sixtieths);
-}
-
-// Adds working function for existing BSL command wp_fadetime, sets fade time to 4800
-void DD_Patch_WpFadetime()
-{
-	// Makes wp_fadetime actually have a function
-	const unsigned char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 };
-	DDrPatch_Const ((char*)(OniExe + 0x0011a889), fadetime_patch);
-	DDrPatch_Byte  ((char*)(OniExe + 0x0011a560), 0x31);
-	
-	// Sets the fadetime to 4800 by default
-	DDrPatch_Int16 ((short*)(OniExe + 0x0011ab0e), 0x12c0);
-}
-
-// Disable gamma slider in options in windowed mode
-void DD_Patch_GammaSlider()
-{
-	DDrPatch_MakeCall((void*)(OniExe + 0x000d262c), (void*)DD_ONiOGU_GammaSlider_SetRange);
-}
-
-// Fix the warning print method
-void DD_Patch_PrintWarning()
-{
-	DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning);
+
+
+int DD_Patch_DebugNameTextureInit(short width, short height, int type, int allocated, int flags, char* name, void** output)
+{
+	//flags = (1 << 10);
+	type = 1;
+	//DDrPatch_Byte( 0x005EB83C + 3, 0xff );
+	DDrPatch_Int32((int*)(OniExe + 0x001EB83C), 0xFF000000 );
+	return M3rTextureMap_New(width, height, type, allocated, flags, name, output);
+}
+
+short DD_Patch_DebugNameShadeHack( Character* Char )
+{
+	return TSrContext_SetShade(*(void**)(OniExe + 0x001EB844), ONrCharacter_GetHealthShade( Char->Health, Char->MaxHealth ));
 }
 
@@ -599,15 +277,11 @@
 }
 
-/*
-void DD_Patch_ShowTriggerVolumes()
-{
-	DDrPatch_Int32((int*)(OniExe + 0x000cc9bb+4), (uint32_t)DD_OBJiTriggerVolume_Draw);
-}
-
-void DD_Patch_ShowFlags()
-{
-	DDrPatch_Int32((int*)(OniExe + 0x000c4ed4+4), (uint32_t)DD_OBJiFlag_Draw);
-}
-*/
+
+
+
+
+
+
+
 
 bool DD_Patch_Init()
@@ -615,112 +289,335 @@
 	STARTUPMESSAGE("Patching engine", 0);
 	
+	// Disable UUrPlatform_Initalize/Terminate, this enables the Alt-Tab and the
+	// Windows key but has the possible side effect of allowing the screensaver
+	// to enable itself in-game.
 	if (DDrConfig_GetOptOfType("patches.alttab", C_BOOL)->value.intBoolVal)
-		DD_Patch_AltTab();
-	
+	{
+		// 0xC3 = ret, so makes those functions just have a "ret" instruction at their start
+		DDrPatch_Byte((char*)UUrPlatform_Initialize, 0xC3);
+		DDrPatch_Byte((char*)UUrPlatform_Terminate, 0xC3);
+	}
+	
+	// Textures using ARGB8888 can be used
 	if (DDrConfig_GetOptOfType("patches.argb8888", C_BOOL)->value.intBoolVal)
-		DD_Patch_ARGB8888();
-
+	{
+		// Update conversion lookups in IMgConvertPixelType_List
+		DDrPatch_Byte((char*)(OniExe + 0x00135af0), 0x07);
+		DDrPatch_Byte((char*)(OniExe + 0x00135af4), 0x0B);
+	}
+
+	// Fix BinkBufferInit() call in BKrMovie_Play() to use GDI (DIB) blitting
+	// instead of DirectDraw; patch ONiRunGame to use the same method to play
+	// outro (ie., BKrMovie_Play() instead of ONrMovie_Play_Hardware() as the
+	// latter has problems on WINE).
 	if (DDrConfig_GetOptOfType("patches.binkplay", C_BOOL)->value.intBoolVal)
-		DD_Patch_BinkPlay();
-
-	if (DDrConfig_GetOptOfType("patches.bsl", C_BOOL)->value.intBoolVal)
-		DD_Patch_BSL();
-
-	if (DDrConfig_GetOptOfType("patches.cheater", C_BOOL)->value.intBoolVal)
-		DD_Patch_Cheater();
-
+	{
+		// push BINKBUFFERAUTO -> push BINKBUFFERDIBSECTION.
+		DDrPatch_Byte((void*)(OniExe + 0x0008829b + 1), 0x02);
+		// call ONrMovie_Play_Hardware -> call ONrMovie_Play
+		DDrPatch_MakeCall((void*)(OniExe + 0x000d496f), ONrMovie_Play);
+	}
+
+	if (DDrConfig_GetOptOfType("patches.d_regen", C_BOOL)->value.intBoolVal)
+		DD_Patch_Regeneration();
+
+	// Cheats always enabled
 	if (DDrConfig_GetOptOfType("patches.cheatsenabled", C_BOOL)->value.intBoolVal)
-		DD_Patch_CheatsEnabled();
-
+	{
+		DDrPatch_MakeJump((void*)ONrPersist_GetWonGame, (void*)DDrPersist_GetWonGame);
+	}
+
+	// Use Daodan's own cheattable
 	if (DDrConfig_GetOptOfType("patches.cheattable", C_BOOL)->value.intBoolVal)
-		DD_Patch_CheatTable();
+	{
+		// In ONrGameState_HandleCheats: Replace pointers to orig cheattable
+		DDrPatch_Int32 ((int*)(OniExe + 0x000f616b), (int)&DDr_CheatTable[0].name);
+		DDrPatch_Int32 ((int*)(OniExe + 0x000f617a), (int)&DDr_CheatTable[0].message_on);
+
+		// ONrGameState_HandleCheats: Replace call to ONrCheater
+		DDrPatch_MakeCall((void*)(OniExe + 0x000f618f), (void*)DDrCheater);
+
+		// In: ONrGameState_DoCharacterFrame
+		//  -> NOP; PUSH ebp; CALL FallingFrames
+		// Replace fall height frame counter (actually in-air frame counter) increase by a
+		//  conditional one (only counted when inc_fallingframes)
+		DDrPatch_Int16((short*)(OniExe + 0x000deb45), 0x5590);
+		DDrPatch_MakeCall((void*)(OniExe + 0x000deb47), (void*)FallingFrames);
+
+		// At end of ONrUnlockLevel to init values on level loading
+		DDrPatch_MakeJump((void*)(OniExe + 0x0010f021), (void*)DDrCheater_LevelLoad);
+	}
 	
 	if (DDrConfig_GetOptOfType("patches.chinese", C_BOOL)->value.intBoolVal)
 		DD_Patch_Chinese();
 
+	// Limit cursor to Oni's window
 	if (DDrConfig_GetOptOfType("patches.clipcursor", C_BOOL)->value.intBoolVal)
-		DD_Patch_ClipCursor();
-
+	{
+		// LIrMode_Set: replace LIrPlatform_Mode_Set call with our hook.
+		DDrPatch_MakeCall((void*)(OniExe + 0x00003f9f), (void*) DD_LIrPlatform_Mode_Set);
+
+		// LIrMode_Set_Internal: replace LIrPlatform_Mode_Set call with our hook.
+		DDrPatch_MakeCall((void*)(OniExe + 0x00003fff), (void*) DD_LIrPlatform_Mode_Set);
+	
+		// LIrTerminate: replace LIrPlatform_Terminate call with our hook.
+		DDrPatch_MakeCall((void*)(OniExe + 0x000004cb8), (void*) DD_LIrPlatform_Terminate);
+	}
+
+	// Disables weapon cooldown exploit
 	if (DDrConfig_GetOptOfType("patches.cooldowntimer", C_BOOL)->value.intBoolVal)
-		DD_Patch_CooldownTimer();
-
+	{
+		// In WPrRelease: NoOp 4 MOVs
+		DDrPatch_NOOP((char*)(OniExe + 0x0011a825), 22);
+	}
+
+	// Daodan device mode enumeration function
 	if (DDrConfig_GetOptOfType("patches.daodandisplayenum", C_BOOL)->value.intBoolVal)
-		DD_Patch_DaodanDisplayEnum();
-	
+	{
+		DDrPatch_MakeJump((void*)gl_enumerate_valid_display_modes, (void*)DD_GLrEnumerateDisplayModes);
+	}
+	
+	// Forced DirectInput (for Windows NT)
 	if (DDrConfig_GetOptOfType("patches.directinput", C_BOOL)->value.intBoolVal)
-		DD_Patch_DirectInput();
-
+	{
+		// LIrPlatform_Initialize: replace conditional jump by unconditional
+		DDrPatch_Byte((char*)(OniExe + 0x00002e6d), 0xeb);
+	}
+
+	// Disable Oni's command line parser so it doesn't interfere with ours
 	if (DDrConfig_GetOptOfType("patches.disablecmdline", C_BOOL)->value.intBoolVal)
-		DD_Patch_DisableCmdLine();
-
+	{
+		// Replace start of OniParseCommandLine with XOR eax,eax; RET
+		DDrPatch_Int32 ((int*)(OniExe + 0x000d3570), 0x00c3c033);
+		// NoOp first 51 byte in ONiMain, including tests and conditional exec of CLrGetCommandLine
+		DDrPatch_NOOP((char*)(OniExe + 0x000d3280), 51);
+	}
+
+	// Font texture cache doubled
 	if (DDrConfig_GetOptOfType("patches.fonttexturecache", C_BOOL)->value.intBoolVal)
-		DD_Patch_FontTextureCache();
-
-	if (DDrConfig_GetOptOfType("patches.getcmdline", C_BOOL)->value.intBoolVal)
-		DD_Patch_GetCmdLine();
-
+	{
+		// Double two values in TMrGame_Initialize
+		DDrPatch_Byte((char*)(OniExe + 0x00020ea7), 0x20);
+		DDrPatch_Byte((char*)(OniExe + 0x00020f4a), 0x40);
+	}
+
+	// Allow HD screens on resolutions < 1024*768
 	if (DDrConfig_GetOptOfType("patches.hdscreens_lowres", C_BOOL)->value.intBoolVal)
-		DD_Patch_HDScreens_LowRes();
-
+	{
+		DDrPatch_MakeJump((void*)M3rDraw_BigBitmap, (void*)DD_M3rDraw_BigBitmap);
+	}
+
+	// Allow for console to show on higher resolutions
 	if (DDrConfig_GetOptOfType("patches.highres_console", C_BOOL)->value.intBoolVal)
-		DD_Patch_HighresConsole();
-	
+	{
+		Oni_COrTextArea_Resize = DDrPatch_MakeDetour((void*)COrTextArea_Resize, (void*)DD_COrTextArea_Resize);
+	}
+	
+	// Hackish fix for Konoko not kicking guns
+	// Don't use this, it breaks stairs.
 	if (DDrConfig_GetOptOfType("patches.kickguns", C_BOOL)->value.intBoolVal)
-		DD_Patch_KickGuns();
-	
-	//if (patch_killvtune)
-	//	DD_Patch_KillVTune();
-
+	{
+		// In ONrCharacter_EnablePhysics: Load different values to same addresses as before
+		const unsigned char kickgun_patch[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0xC7, 0x05, 0x1C, 0xC9, 0x5E, 0x00, 0x70, 0xB8, 0x43, 0x00, 0xC7, 0x05, 0x20, 0xC9, 0x5E, 0x00, 0x20, 0xBE, 0x43 };
+		DDrPatch_Const ((char*)(OniExe + 0x000dc420), kickgun_patch);
+	}
+	
+	// Disable loading the vtuneapi.dll
+	if (DDrConfig_GetOptOfType("patches.killvtune", C_BOOL)->value.intBoolVal)
+	{
+		// Instantly return from UUrLoadVtuneAPI
+		DDrPatch_Byte((char*)(OniExe + 0x00026340), 0xC3);
+	}
+
+	// Now supports textures up to 512x512
 	if (DDrConfig_GetOptOfType("patches.largetextures", C_BOOL)->value.intBoolVal)
-		DD_Patch_LargeTextures();
-	
+	{
+		DDrPatch_Byte((char*)(OniExe + 0x00005251), 0x10);
+	}
+	
+	// Non-"_Final" levels are now valid
 	if (DDrConfig_GetOptOfType("patches.levelplugins", C_BOOL)->value.intBoolVal)
-		DD_Patch_LevelPlugins();
-
+	{
+		// Patch in TMrUtility_LevelInfo_Get: 
+		DDrPatch_Byte((char*)(OniExe + 0x000206a8), 0x01);
+	}
+
+	// Weapon on ground shown with name and magazine contents
 	if (DDrConfig_GetOptOfType("patches.newweap", C_BOOL)->value.intBoolVal)
-		DD_Patch_NewWeap();
-
+	{
+		//Makes it always say "Received weapon_name."
+		//Needs check for loc_4DFC66
+		//DDrPatch_NOOP((char*)(OniExe + 0x000E4DF8),2);
+
+		//Adds Weapon name and ammo meter to pickup autoprompt (patches to ONrGameState_ProcessHeartbeat)
+		// Do not call WPrHasAmmo and ignore conditional jump:
+		DDrPatch_NOOP((char*)(OniExe + 0x000FAC73), 9);
+		// Do not load ecx with some magic value?
+		DDrPatch_NOOP((char*)(OniExe + 0x000FAC80), 5);
+		// Replace call to ONiGameState_FindAutoPromptMessage
+		DDrPatch_MakeCall((void*)(OniExe + 0xFAC85), (void*)DDrWeapon2Message);
+	
+		//Moves location of colors
+		//DDrPatch_Int32((int*)(OniExe + 0x0002E3D5), (int)&DDrDSayColors );
+		//DDrPatch_Int32((int*)(OniExe + 0x0002E3DA), (int)&DDrDSayColors );
+	}
+
+	// Disable Multi-byte character awareness patch (multiple language support)
 	if (DDrConfig_GetOptOfType("patches.nomultibyte", C_BOOL)->value.intBoolVal)
-		DD_Patch_NoMultiByte();
-
+	{
+		// TSiContext_DrawLine: Replace conditional jumps by unconditional ones
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002d8f8), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002d9ad), 0xeb);
+		// TSiContext_DrawTextLine: same
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002dbe2), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002dec3), 0xeb);
+		// TSrContext_FormatString: same
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e2ab), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e2c4), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e379), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e48c), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e4d0), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e4f4), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e646), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e695), 0xeb);
+		// TSrContext_GetStringRect: same
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e944), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e95d), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e98e), 0xeb);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0002e9dc), 0xeb);
+	}
+
+	// Fix options not visible in main menu when a game was started
 	if (DDrConfig_GetOptOfType("patches.optionsvisible", C_BOOL)->value.intBoolVal)
-		DD_Patch_OptionsVisible();
-
-	if (DDrConfig_GetOptOfType("patches.particledisablebit", C_BOOL)->value.intBoolVal)
-		DD_Patch_ParticleDisableBit();
-	
+	{
+		// replace WMrWindow_SetVisible calls
+		DDrPatch_MakeCall((void*)(OniExe + 0x000d2d2d), DDrShowOptionsButton);
+		DDrPatch_MakeCall((void*)(OniExe + 0x000d2d43), DDrShowResumeButton);
+	}
+
+	// Pathfinding grid cache size x8
 	if (DDrConfig_GetOptOfType("patches.pathfinding", C_BOOL)->value.intBoolVal)
-		DD_Patch_PathFinding();
-
+	{
+		// Replaces conditional jump (je) with unconditional jump
+		const unsigned char pathfinding[2] = {0x90 , 0xE9 };
+		DDrPatch_Byte  ((char*)(OniExe + 0x0010b03b), 0x20);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0010b04c), 0x20);
+
+		//other stuff
+		DDrPatch_Const((char*)(OniExe + 0x00040789), pathfinding);
+	}
+
+	// Projectile awareness fixed
 	if (DDrConfig_GetOptOfType("patches.projaware", C_BOOL)->value.intBoolVal)
-		DD_Patch_ProjAware();
-
+	{
+		DDrPatch_Byte  ((char*)(OniExe + 0x0009c07c), 0x6c);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0009c080), 0x70);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0009c084), 0x74);
+		DDrPatch_Byte  ((char*)(OniExe + 0x0009c110), 0x6c);
+	}
+
+	// Safe startup message printer
 	if (DDrConfig_GetOptOfType("patches.safeprintf", C_BOOL)->value.intBoolVal)
-		DD_Patch_SafePrintf();
-
+	{
+		DDrPatch_MakeJump((void*)UUrStartupMessage, (void*)DDrStartupMessage);
+	}
+
+	// Show all (also enemies') lasersights
 	if (DDrConfig_GetOptOfType("patches.showalllasersights", C_BOOL)->value.intBoolVal)
-		DD_Patch_ShowAllLasersights();
-
+	{
+		DDrPatch_NOOP((char*)(OniExe + 0x000E1957), 6 );
+	}
+
+	// Allow bsl-var show_triggervolumes or ctrl+shift+x (devmode) to work
 	if (DDrConfig_GetOptOfType("patches.showtriggervolumes", C_BOOL)->value.intBoolVal)
-		DD_Patch_ShowTriggerVolumes();
-	
+	{
+		Oni_ONrMechanics_Register = DDrPatch_MakeDetour((void*)ONrMechanics_Register, (void*)DD_ONrMechanics_Register);
+		Oni_ONrGameState_HandleUtilityInput = DDrPatch_MakeDetour((void*)ONrGameState_HandleUtilityInput, (void*)DD_ONrGameState_HandleUtilityInput);
+	}
+	
+	// Experiment with allowing enemies to be thrown over railings
 	if (DDrConfig_GetOptOfType("patches.throwtest", C_BOOL)->value.intBoolVal)
-		DD_Patch_Throwtest();
-
+	{
+		DDrPatch_NOOP((char*)(OniExe + 0x000dc190), 10);
+	}
+
+	// DaodanGL with windowed mode support
 	if (DDrConfig_GetOptOfType("patches.usedaodangl", C_BOOL)->value.intBoolVal)
-		DD_Patch_UseDaodanGL();
-
+	{
+		// LIrPlatform_Mode_Set: GetWindowRect -> GetClientRect.
+		DDrPatch_NOOP((char*) OniExe + 0x00002dd6, 6);
+		DDrPatch_MakeCall((char*) OniExe + 0x00002dd6, (void*) GetClientRect);
+
+		// UUrWindow_GetSize: GetWindowRect -> GetClientRect.
+		DDrPatch_NOOP((char*) OniExe + 0x0002651c, 6);
+		DDrPatch_MakeCall((char*) OniExe + 0x0002651c, (void*) GetClientRect);
+
+		// LIrPlatform_PollInputForAction: fix GetCursorPos call to return client coordinates.
+		DDrPatch_NOOP((char*) OniExe + 0x000032cc, 6);
+		DDrPatch_MakeCall((char*) OniExe + 0x000032cc, (void*) DD_GetCursorPos);
+
+		// LIrPlatform_InputEvent_GetMouse: fix GetCursorPos call to return client coordinates.
+		DDrPatch_NOOP((char*) OniExe + 0x00002cc2, 6);
+		DDrPatch_MakeCall((char*) OniExe + 0x00002cc2, (void*) DD_GetCursorPos);
+
+		// LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates.
+		DDrPatch_NOOP((char*) OniExe + 0x000032b7, 6);
+		DDrPatch_MakeCall((char*) OniExe + 0x000032b7, (void*) DD_SetCursorPos);
+
+		// LIrPlatform_PollInputForAction: translate SetCursorPos position to screen coordinates.
+		DDrPatch_NOOP((char*) OniExe + 0x00003349, 6);
+		DDrPatch_MakeCall((char*) OniExe + 0x00003349, (void*) DD_SetCursorPos);
+
+		// Replace ONrPlatformInitialize.
+		DDrPatch_MakeJump((void*) ONrPlatform_Initialize, (void*) DD_ONrPlatform_Initialize);
+
+		// Replace gl_platform_initialize.
+		DDrPatch_MakeJump((void*) gl_platform_initialize, (void*) DD_GLrPlatform_Initialize);
+
+		// Replace gl_platform_dispose.
+		DDrPatch_MakeJump((void *) gl_platform_dispose, (void*) DD_GLrPlatform_Dispose);
+	}
+
+	// Performance patch
 	if (DDrConfig_GetOptOfType("patches.usegettickcount", C_BOOL)->value.intBoolVal)
-		DD_Patch_UseGetTickCount();
-	
+	{
+		DDrPatch_MakeJump((void*)UUrMachineTime_High, (void*)DDrMachineTime_High);
+		DDrPatch_MakeJump((void*)UUrMachineTime_High_Frequency, (void*)DDrMachineTime_High_Frequency);
+		DDrPatch_MakeJump((void*)UUrMachineTime_Sixtieths, (void*)DDrMachineTime_Sixtieths);
+	}
+
+	// Fix displaying the talking portraits in widescreen modes
+	if (DDrConfig_GetOptOfType("patches.widescreenportraits", C_BOOL)->value.intBoolVal)
+	{
+		SLrDaodan_Patch();
+	}
+	
+	// Adds working function for existing BSL command wp_fadetime, sets fade time to 4800
 	if (DDrConfig_GetOptOfType("patches.wpfadetime", C_BOOL)->value.intBoolVal)
-		DD_Patch_WpFadetime();
-
-
-	DD_Patch_DaodanInit();
-	
-	DD_Patch_GammaSlider();
-
-	DD_Patch_PrintWarning();
+	{
+		// Makes wp_fadetime actually have a function (changes within WPrRelease)
+		// Patches end of function to instead of use a constant value for fadetime (12c0 = 4800) actually use value of wp_fadetime:
+		// orig: MOV [esi+0x46], 0x12c0 ; POP ebx ; POP esi ; ADD esp, 0x14 ; RET
+		// new:  MOV bx, [0x627dc4] ; MOV [esi+0x46], bx ; POP ebx ; POP esi ; ADD esp, 0x14 ; RET
+		const unsigned char fadetime_patch[] = { 0x66, 0x8B, 0x1D, 0xC4, 0x7D, 0x62, 0x00, 0x66, 0x89, 0x5E, 0x46, 0x5B, 0x5E, 0x83, 0xC4, 0x14, 0xC3 };
+		DDrPatch_Const ((char*)(OniExe + 0x0011a889), fadetime_patch);
+		// Fixes jump because of new length of code in patch
+		DDrPatch_Byte  ((char*)(OniExe + 0x0011a560), 0x31);
+	
+		// Sets the fadetime to 4800 by default (in WPrInitialize)
+		DDrPatch_Int16 ((short*)(OniExe + 0x0011ab0e), 4800);
+	}
+
+	// Adds new BSL functions
+	// Replaces an early unused call (OBJrLevel_Unload_Unknown_2) in ONiMain
+	DDrPatch_MakeCall((void*)(OniExe + 0x000d345a), (void*)DDrGame_Init);
+	
+	// Disable gamma slider in options in windowed mode
+	// In ONiOGU_Options_Callback: Replace WMrSlider_SetRange
+	DDrPatch_MakeCall((void*)(OniExe + 0x000d262c), (void*)DD_ONiOGU_GammaSlider_SetRange);
+
+	// Fix the warning print method
+	// Replace UUrError_Report_Internal
+	DDrPatch_MakeJump((void*)(OniExe + 0x000245A0), (void*)DDrPrintWarning);
 
 	DD_Patch_ShowNames();
