Index: /Daodan/src/Daodan.c
===================================================================
--- /Daodan/src/Daodan.c	(revision 465)
+++ /Daodan/src/Daodan.c	(revision 466)
@@ -40,4 +40,6 @@
 bool patch_argb8888 = true;
 bool patch_killvtune = true;
+bool patch_getcmdline = true;
+bool patch_disablecmdline = true;
 
 bool patch_safeprintf = true;
@@ -174,4 +176,12 @@
 		DDrPatch_Byte  (OniExe + 0x00026340, 0xC3);
 	
+	// Disable Oni's internal CLrGetCommandLine function (to eventually replace it with our own)
+	if (patch_getcmdline)
+		DDrPatch_NOOP  (OniExe + 0x000d3280, 51);
+	
+	// Disable Oni's command line parser so it doesn't interfere with ours
+	if (patch_disablecmdline)
+		DDrPatch_Int32 (OniExe + 0x000d3570, 0xc3c03366);
+	
 	return true;
 }
@@ -194,5 +204,5 @@
 		{
 			ini_section = s_unknown;
-			DDrStartupMessage("unrecognised ini section \"%s\"", section);
+			DDrStartupMessage("unrecognised section \"%s\"", section);
 		}
 	}
@@ -203,4 +213,18 @@
 			if (!stricmp(name, "usedaodanbsl"))
 				opt_usedaodanbsl = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "debug"))
+				AKgDebug_DebugMaps = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "debugfiles"))
+				BFgDebugFileEnable = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "findsounds"))
+				SSgSearchOnDisk = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "ignore_private_data"))
+				opt_ignore_private_data = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "sound"))
+				opt_sound = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "switch"))
+				M3gResolutionSwitch = !stricmp(inifile_cleanstr(value), "true");
+			else
+				DDrStartupMessage("unrecognised option \"%s\"", name);
 			break;
 		case s_patch:
@@ -237,4 +261,8 @@
 			else if (!stricmp(name, "killvtune"))
 				patch_killvtune = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "getcmdline"))
+				patch_getcmdline = !stricmp(inifile_cleanstr(value), "true");
+			else if (!stricmp(name, "disablecmdline"))
+				patch_disablecmdline = !stricmp(inifile_cleanstr(value), "true");
 			else if (!stricmp(name, "safeprintf"))
 				patch_safeprintf = !stricmp(inifile_cleanstr(value), "true");
@@ -402,5 +430,46 @@
 {
 	DDrStartupMessage("daodan attached!");
+	
+	opt_ignore_private_data = false;
+	opt_sound = true;
+	
 	DDrConfig();
+	DDrStartupMessage("parsing command line...");
+	int i;
+	char* section;
+	char* option;
+	bool falseoption;
+	for (i = 1; i < argc; i ++)
+	{
+		if (argv[i][0] == '-')
+		{
+			section = argv[i] + 1;
+			if ((option = strchr(argv[i], '.')))
+			{
+				*option = '\0';
+				falseoption = (option[1] == 'n' || option[1] == 'N') && (option[2] = 'o' || option[2] == 'O');
+				if (i < (argc - 1) && argv[i + 1][0] != '-')
+					DDrIniCallback(section, true, option + (falseoption ? 3 : 1), argv[++i]);
+				else
+					DDrIniCallback(section, true, option + (falseoption ? 3 : 1), (falseoption ? "false" : "true"));
+				*option = '.';
+			}
+			else
+			{
+				falseoption = (section[0] == 'n' || section[0] == 'N') && (section[1] = 'o' || section[1] == 'O');
+				ini_section = s_options;
+				if (i < (argc - 1) && argv[i + 1][0] != '-')
+					DDrIniCallback(NULL, false, section + (falseoption ? 2 : 0), argv[++i]);
+				else
+					DDrIniCallback(NULL, false, section + (falseoption ? 2 : 0), (falseoption ? "false" : "true"));
+			}
+		}
+		else
+		{
+			DDrStartupMessage("parse error \"%s\"", argv[i]);
+			break;
+		}
+	}
+	DDrStartupMessage("finished parsing");
 	DDrPatch_Init();
 	
Index: /Daodan/src/Oni.h
===================================================================
--- /Daodan/src/Oni.h	(revision 465)
+++ /Daodan/src/Oni.h	(revision 466)
@@ -25,3 +25,12 @@
 extern void* ONgGameState;
 
+extern char M3gResolutionSwitch;
+
+extern char opt_sound;
+extern uint32_t opt_ignore_private_data;
+
+extern char AKgDebug_DebugMaps;
+extern char BFgDebugFileEnable;
+extern char SSgSearchOnDisk;
+
 #endif
Index: /Daodan/src/Oni_Symbols.S
===================================================================
--- /Daodan/src/Oni_Symbols.S	(revision 465)
+++ /Daodan/src/Oni_Symbols.S	(revision 466)
@@ -20,4 +20,11 @@
 symbol ( _ONgGameState                             , 0x001ece7c )
 
+symbol ( _AKgDebug_DebugMaps                       , 0x002b2204 )
+symbol ( _BFgDebugFileEnable                       , 0x0015c8d0 )
+symbol ( _SSgSearchOnDisk                          , 0x001eb758 )
+
+symbol ( _opt_sound                                , 0x002370fc )
+symbol ( _opt_ignore_private_data                  , 0x002370f0 )
+
 // Oni Persistance
 symbol ( @ONrPersist_GetGamma@0                    , 0x0010f450 )
@@ -29,10 +36,9 @@
 symbol ( @UUrMachineTime_High_Frequency@0          , 0x000264b0 )
 symbol ( @UUrMachineTime_Sixtieths@0               , 0x000263e0 )
-symbol ( _ONgFileStartup                           , 0x001711b8 )
-
 symbol ( @UUrPlatform_Initialize@0                 , 0x00026010 )
 symbol ( @UUrPlatform_Terminate@0                  , 0x00026310 )
+symbol ( _AUrMessageBox                            , 0x000378c0 )
 
-symbol ( _AUrMessageBox                            , 0x000378c0 )
+symbol ( _ONgFileStartup                           , 0x001711b8 )
 
 // Motoko
Index: /Daodan/src/inifile_reader.c
===================================================================
--- /Daodan/src/inifile_reader.c	(revision 465)
+++ /Daodan/src/inifile_reader.c	(revision 466)
@@ -11,9 +11,8 @@
 	int i;
 	for (i = strlen(str) - 1; i >= 0; i --)
-		if (!isspace(str[i]))
-		{
-			str[i + 1] = '\0';
+		if (isspace(str[i]))
+			str[i] = '\0';
+		else
 			break;
-		}
 	
 	while (isspace(*str))
