Changeset View
Changeset View
Standalone View
Standalone View
source/ps/Util.cpp
/* Copyright (C) 2019 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | static std::string SplitExts(const char *exts) | ||||
return ret; | return ret; | ||||
} | } | ||||
void WriteSystemInfo() | void WriteSystemInfo() | ||||
{ | { | ||||
TIMER(L"write_sys_info"); | TIMER(L"write_sys_info"); | ||||
// get_cpu_info and gfx_detect already called during init - see call site | |||||
snd_detect(); | |||||
struct utsname un; | struct utsname un; | ||||
uname(&un); | uname(&un); | ||||
OsPath pathname = psLogDir()/"system_info.txt"; | OsPath pathname = psLogDir()/"system_info.txt"; | ||||
bb: Would this work with the HWDetect?
Also maybe group the sound code together in this function | |||||
FILE* f = sys_OpenFile(pathname, "w"); | FILE* f = sys_OpenFile(pathname, "w"); | ||||
if(!f) | if(!f) | ||||
return; | return; | ||||
// current timestamp (redundant WRT OS timestamp, but that is not | // current timestamp (redundant WRT OS timestamp, but that is not | ||||
// visible when people are posting this file's contents online) | // visible when people are posting this file's contents online) | ||||
{ | { | ||||
wchar_t timestampBuf[100] = {'\0'}; | wchar_t timestampBuf[100] = {'\0'}; | ||||
Show All 33 Lines | #endif | ||||
// graphics | // graphics | ||||
const std::wstring cardName = gfx::CardName(); | const std::wstring cardName = gfx::CardName(); | ||||
const std::wstring driverInfo = gfx::DriverInfo(); | const std::wstring driverInfo = gfx::DriverInfo(); | ||||
fprintf(f, "Graphics Card : %ls\n", cardName.c_str()); | fprintf(f, "Graphics Card : %ls\n", cardName.c_str()); | ||||
fprintf(f, "OpenGL Drivers : %s; %ls\n", glGetString(GL_VERSION), driverInfo.c_str()); | fprintf(f, "OpenGL Drivers : %s; %ls\n", glGetString(GL_VERSION), driverInfo.c_str()); | ||||
fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetXRes(), g_VideoMode.GetYRes(), g_VideoMode.GetBPP()); | fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetXRes(), g_VideoMode.GetYRes(), g_VideoMode.GetBPP()); | ||||
#if CONFIG2_AUDIO | |||||
// sound | // sound | ||||
Not Done Inline ActionsI am getting so surprised that these comments held it till here. relics from rP2624 which never have been that useful... bb: I am getting so surprised that these comments held it till here. relics from rP2624 which never… | |||||
bbUnsubmitted Done Inline Actionsshould be above the macro, since the else is also about sound. Can also decide to drop the comment, since well, the strings seem to give the same info bb: should be above the macro, since the else is also about sound. Can also decide to drop the… | |||||
StanAuthorUnsubmitted Done Inline ActionsI don't want to detect anything related to audio if there is no audio. What's the point. Ideally we shouldn't even link OpenAL in that case. Stan: I don't want to detect anything related to audio if there is no audio. What's the point. | |||||
// get_cpu_info and gfx_detect already called during init - see call site | |||||
snd_detect(); | |||||
fprintf(f, "Sound Card : %s\n", snd_card.c_str()); | fprintf(f, "Sound Card : %s\n", snd_card.c_str()); | ||||
fprintf(f, "Sound Drivers : %s\n", snd_drv_ver.c_str()); | fprintf(f, "Sound Drivers : %s\n", snd_drv_ver.c_str()); | ||||
#else | |||||
fprintf(f, "Sound : Game was compiled without audio\n"); | |||||
Done Inline ActionsMaybe compiled without instead of disabled? Because disabled sounds more like muted. vladislavbelov: Maybe `compiled without` instead of `disabled`? Because `disabled` sounds more like `muted`. | |||||
#endif | |||||
// OpenGL extensions (write them last, since it's a lot of text) | // OpenGL extensions (write them last, since it's a lot of text) | ||||
const char* exts = ogl_ExtensionString(); | const char* exts = ogl_ExtensionString(); | ||||
if (!exts) exts = "{unknown}"; | if (!exts) exts = "{unknown}"; | ||||
fprintf(f, "\nOpenGL Extensions: \n%s\n", SplitExts(exts).c_str()); | fprintf(f, "\nOpenGL Extensions: \n%s\n", SplitExts(exts).c_str()); | ||||
// System Management BIOS (even more text than OpenGL extensions) | // System Management BIOS (even more text than OpenGL extensions) | ||||
std::string smbios = SMBIOS::StringizeStructures(SMBIOS::GetStructures()); | std::string smbios = SMBIOS::StringizeStructures(SMBIOS::GetStructures()); | ||||
▲ Show 20 Lines • Show All 302 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Would this work with the HWDetect?
Also maybe group the sound code together in this function