--- Daodan/src/Daodan_Config.c 2014/05/04 18:17:11 1000 +++ Daodan/src/Daodan_Config.c 2021/10/24 02:50:48 1163 @@ -2,6 +2,7 @@ #include #include +#include "Daodan.h" #include "Daodan_Config.h" #include "Daodan_Patch.h" #include "Patches/Utility.h" @@ -11,15 +12,13 @@ #include "Inifile_Reader.h" -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) - static const char* iniName = "daodan.ini"; static const char* helpFile = "daodan_help.txt"; static const char* defaultSection = "options"; -static char invalidCurParamaters[1000] = ""; -static char invalidTotalParamaters[3000] = ""; +static char invalidCurParamaters[2000] = ""; +static char invalidTotalParamaters[4000] = ""; void DDrConfig_PrintHelp(); @@ -47,6 +46,16 @@ ConfigSection_t config[] = { { 0, 0, 0, {0}, {0} } } }, { "gameplay", "Gameplay", { + { "bindablecheats", + "Allows cheats to be bound to keys. Requires 'customactions' and 'cheattable' to be true.", + C_BOOL, + {.intBoolVal = true}, + {.intBoolVal = true} }, + { "characterawareness", + "Makes AI remember the player.", + C_BOOL, + {.intBoolVal = true}, + {.intBoolVal = true} }, { "cheatsenabled", "Enables cheats without having to beat the game first.", C_BOOL, @@ -62,6 +71,11 @@ ConfigSection_t config[] = { C_BOOL, {.intBoolVal = true}, {.intBoolVal = true} }, + { "customactions", + "Allows more actions to be bound through Daodan.", + C_BOOL, + {.intBoolVal = true}, + {.intBoolVal = true} }, { "kickguns", "EXPERIMENTAL! Unfinished, do not use.", C_BOOL, @@ -237,11 +251,21 @@ ConfigSection_t config[] = { C_BOOL, {.intBoolVal = true}, {.intBoolVal = true} }, + { "daodaninput", + "New input system that reports input on every frame, supports Raw Input for mice.", + C_BOOL, + {.intBoolVal = true}, + {.intBoolVal = true} }, { "directinput", "Enforces the usage of DirectInput on every system. Should be off for Linux/Wine.", C_BOOL, {.intBoolVal = true}, {.intBoolVal = true} }, + { "mousesensitivity", + "Multiplier for Oni's mouse sensitivity. 1.0 is Oni's default.", + C_FLOAT, + {.floatVal = 1.0f}, + {.floatVal = 1.0f} }, { "disablecmdline", "Disables Oni's existing command line parser as Daodan has its own.", C_BOOL, @@ -285,6 +309,9 @@ void DDrConfig_Print() break; case C_CMD: break; + case C_FLOAT: + STARTUPMESSAGE("Option %s.%s = %f (def %f)", config[s].name, co->name, co->value.floatVal, co->defaultValue.floatVal); + break; default: STARTUPMESSAGE("Option %s.%s = %d (def %d)", config[s].name, co->name, co->value.intBoolVal, co->defaultValue.intBoolVal); } @@ -346,6 +373,8 @@ const char* DDrConfig_GetOptionTypeName( switch (type) { case C_INT: return "Int"; + case C_FLOAT: + return "Float"; case C_BOOL: return "Bool"; case C_STRING: @@ -376,6 +405,10 @@ const char* DDrConfig_GetOptionValueStri return (boolV ? "true" : "false"); case C_CMD: return 0; + case C_FLOAT: + val = malloc(50); + sprintf(val, "%f", optVal->floatVal); + return val; default: val = malloc(20); sprintf(val, "%d", boolV); @@ -396,6 +429,8 @@ char DDrConfig_NonDefaultOptionValue(Con return 0; case C_INT: return opt->defaultValue.intBoolVal != opt->value.intBoolVal; + case C_FLOAT: + return opt->defaultValue.floatVal != opt->value.floatVal; } return 0; } @@ -512,6 +547,9 @@ void DDrIniCallback(const char* section, case C_INT: co->value.intBoolVal = strtol(value, NULL, 0); break; + case C_FLOAT: + co->value.floatVal = strtof(value, NULL); + break; case C_BOOL: co->value.intBoolVal = !_stricmp(value, "true"); break; @@ -530,11 +568,11 @@ void DDrIniCallback(const char* section, STARTUPMESSAGE("Config value type unknown: %d", co->type); } } else { - char buf[50]; + char buf[100]; if (!_stricmp(section, "*")) - sprintf_s(buf, sizeof(buf), " %s\n", name); + sprintf(buf, " %s\n", name); else - sprintf_s(buf, sizeof(buf), " %s.%s\n", section, name); + sprintf(buf, " %s.%s\n", section, name); if (strlen(buf) + strlen(invalidCurParamaters) < sizeof(invalidCurParamaters) - 1) { strcpy(invalidCurParamaters + strlen(invalidCurParamaters), buf); } @@ -592,7 +630,7 @@ void DDrConfig(int argc, char* argv[]) if (strlen(invalidCurParamaters) > 0) { - sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "In %s:\n%s\n", iniName, invalidCurParamaters); + sprintf(invalidTotalParamaters, "In %s:\n%s\n", iniName, invalidCurParamaters); invalidCurParamaters[0] = 0; } @@ -602,13 +640,13 @@ void DDrConfig(int argc, char* argv[]) if (strlen(invalidCurParamaters) > 0) { - sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "%sOn command line:\n%s\n", invalidTotalParamaters, invalidCurParamaters); + sprintf(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); + char msg[4096]; + sprintf(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);