| 4055 | } |
| 4056 | |
| 4057 | void LoadConfigFile() |
| 4058 | { |
| 4059 | wchar_t iniFile[MAX_PATH], logFilename[MAX_PATH]; |
| 4060 | wchar_t setting[MAX_PATH]; |
| 4061 | |
| 4062 | G->gInitialized = true; |
| 4063 | |
| 4064 | if (!GetModuleFileName(migoto_handle, iniFile, MAX_PATH)) |
| 4065 | DoubleBeepExit(); |
| 4066 | wcsrchr(iniFile, L'\\')[1] = 0; |
| 4067 | wcscpy(logFilename, iniFile); |
| 4068 | wcscat(iniFile, INI_FILENAME); |
| 4069 | wcscat(logFilename, L"d3d11_log.txt"); |
| 4070 | warn_of_conflicting_d3dx(iniFile); |
| 4071 | |
| 4072 | // Log all settings that are _enabled_, in order, |
| 4073 | // so that there is no question what settings we are using. |
| 4074 | |
| 4075 | // [Logging] |
| 4076 | // Not using the helper function for this one since logging isn't enabled yet |
| 4077 | if (GetPrivateProfileInt(L"Logging", L"calls", 1, iniFile)) |
| 4078 | { |
| 4079 | if (!LogFile) |
| 4080 | LogFile = _wfsopen(logFilename, L"w", _SH_DENYNO); |
| 4081 | LogInfo("\nD3D11 DLL starting init - v %s - %s\n", VER_FILE_VERSION_STR, LogTime().c_str()); |
| 4082 | |
| 4083 | wchar_t our_path[MAX_PATH], exe_path[MAX_PATH]; |
| 4084 | GetModuleFileName(migoto_handle, our_path, MAX_PATH); |
| 4085 | GetModuleFileName(NULL, exe_path, MAX_PATH); |
| 4086 | LogInfo("Game path: %S\n" |
| 4087 | "3DMigoto path: %S\n\n", |
| 4088 | exe_path, our_path); |
| 4089 | |
| 4090 | LogInfoW(L"----------- " INI_FILENAME L" settings -----------\n"); |
| 4091 | } |
| 4092 | LogInfo("[Logging]\n"); |
| 4093 | LogInfo(" calls=1\n"); |
| 4094 | |
| 4095 | ParseIniFile(iniFile); |
| 4096 | InsertBuiltInIniSections(); |
| 4097 | |
| 4098 | G->gLogInput = GetIniBool(L"Logging", L"input", false, NULL); |
| 4099 | gLogDebug = GetIniBool(L"Logging", L"debug", false, NULL); |
| 4100 | |
| 4101 | // Unbuffered logging to remove need for fflush calls, and r/w access to make it easy |
| 4102 | // to open active files. |
| 4103 | if (LogFile && GetIniBool(L"Logging", L"unbuffered", false, NULL)) |
| 4104 | { |
| 4105 | int unbuffered = setvbuf(LogFile, NULL, _IONBF, 0); |
| 4106 | LogInfo(" unbuffered return: %d\n", unbuffered); |
| 4107 | } |
| 4108 | |
| 4109 | // Set the CPU affinity based upon d3dx.ini setting. Useful for debugging and shader hunting in AC3. |
| 4110 | if (GetIniBool(L"Logging", L"force_cpu_affinity", false, NULL)) |
| 4111 | { |
| 4112 | DWORD one = 0x01; |
| 4113 | BOOL affinity = SetProcessAffinityMask(GetCurrentProcess(), one); |
| 4114 | LogInfo(" force_cpu_affinity return: %s\n", affinity ? "true" : "false"); |
no test coverage detected