Skip to content

Commit 7fdf0c7

Browse files
committed
fix(startup): disable sounds component while investigating boot crash
1 parent e120374 commit 7fdf0c7

38 files changed

Lines changed: 89 additions & 495 deletions

generate.bat

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
11
@echo off
2+
REM -----------------------------
3+
REM generate.bat
4+
REM Generates the VS solution
5+
REM Uses local tools\premake5.exe and preserves extra arguments
6+
REM -----------------------------
7+
28
git submodule update --init --recursive
3-
tools\premake5 %* vs2022
9+
10+
if not exist "tools\premake5.exe" (
11+
echo ERROR: premake5.exe not found in tools\
12+
exit /b 1
13+
)
14+
15+
tools\premake5.exe %* vs2022
16+
17+
if not exist "build" (
18+
mkdir build
19+
)
20+
21+
echo consolation-client.sln should now be in build\

premake5.lua

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ workspace "consolation-client"
263263
startproject "consolation-client"
264264
location "./build"
265265
objdir "%{wks.location}/obj/%{cfg.buildcfg}"
266-
targetdir "%{wks.location}/bin/%{cfg.buildcfg}"
266+
targetdir "C:/Program Files (x86)/Activision/Quantum of Solace(TM)/"
267267

268268
-- i guess ill keep this for anyone wanting it lol
269269
buildlog "%{wks.location}/obj/%{cfg.architecture}/%{cfg.buildcfg}/%{prj.name}/%{prj.name}.log"
@@ -324,26 +324,6 @@ workspace "consolation-client"
324324
"./src/**.rc"
325325
}
326326

327-
vpaths
328-
{
329-
["component/gamepad"] = { "./src/component/gamepad/*.cpp", "./src/component/gamepad/*.hpp", "./src/component/gamepad/*.h" },
330-
["component/engine"] = { "./src/component/engine/*.cpp", "./src/component/engine/*.hpp", "./src/component/engine/*.h" },
331-
["component/engine/console"] = { "./src/component/engine/console/*.cpp", "./src/component/engine/console/*.hpp", "./src/component/engine/console/*.h" },
332-
["component/engine/mouse_input"] = { "./src/component/engine/mouse_input/*.cpp", "./src/component/engine/mouse_input/*.hpp", "./src/component/engine/mouse_input/*.h" },
333-
["component/engine/patches"] = { "./src/component/engine/patches/*.cpp", "./src/component/engine/patches/*.hpp", "./src/component/engine/patches/*.h" },
334-
["component/engine/renderer"] = { "./src/component/engine/renderer/*.cpp", "./src/component/engine/renderer/*.hpp", "./src/component/engine/renderer/*.h" },
335-
["component/engine/scripting"] = { "./src/component/engine/scripting/*.cpp", "./src/component/engine/scripting/*.hpp", "./src/component/engine/scripting/*.h" },
336-
["component/engine/ux"] = { "./src/component/engine/ux/*.cpp", "./src/component/engine/ux/*.hpp", "./src/component/engine/ux/*.h" },
337-
["component/engine/zones"] = { "./src/component/engine/zones/*.cpp", "./src/component/engine/zones/*.hpp", "./src/component/engine/zones/*.h" },
338-
["component/utils"] = { "./src/component/utils/*.cpp", "./src/component/utils/*.hpp", "./src/component/utils/*.h" },
339-
["component"] = { "./src/component/*.cpp", "./src/component/*.hpp", "./src/component/*.h" },
340-
["exception"] = { "./src/exception/**.cpp", "./src/exception/**.hpp", "./src/exception/**.h" },
341-
["game"] = { "./src/game/**.cpp", "./src/game/**.hpp", "./src/game/**.h" },
342-
["loader"] = { "./src/loader/**.cpp", "./src/loader/**.hpp", "./src/loader/**.h" },
343-
["utils"] = { "./src/utils/**.cpp", "./src/utils/**.hpp", "./src/utils/**.h" },
344-
[""] = { "./src/main.cpp", "./src/sdllp.cpp", "./src/std_include.cpp", "./src/resource.rc", "./src/resource.hpp" },
345-
}
346-
347327
includedirs
348328
{
349329
"%{prj.location}/src",

src/component/bots.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <std_include.hpp>
22
#include "loader/component_loader.hpp"
33

4-
#include "component/engine/console/console.hpp"
5-
#include "component/utils/scheduler.hpp"
4+
#include "console.hpp"
5+
#include "scheduler.hpp"
66

77
#include "game/game.hpp"
88
#include "game/dvars.hpp"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#include <std_include.hpp>
22
#include "loader/component_loader.hpp"
33

4-
#include "component/engine/console/command.hpp"
5-
#include "component/engine/console/console.hpp"
6-
#include "component/utils/scheduler.hpp"
4+
#include "command.hpp"
5+
#include "console.hpp"
6+
#include "scheduler.hpp"
77

88
#include <utils/memory.hpp>
99
#include <utils/string.hpp>
1010
#include <utils/io.hpp>
11-
#include "component/engine/zones/fastfiles.hpp"
11+
#include "fastfiles.hpp"
1212
#include <game/dvars.hpp>
1313

1414
namespace command
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <std_include.hpp>
22
#include "loader/component_loader.hpp"
33

4-
#include "component/engine/console/console.hpp"
5-
#include "component/engine/console/game_console.hpp"
6-
#include "component/utils/scheduler.hpp"
4+
#include "console.hpp"
5+
#include "game_console.hpp"
6+
#include "scheduler.hpp"
77

88
#include "game/game.hpp"
99

src/component/engine/renderer/draw_version.cpp renamed to src/component/draw_version.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "loader/component_loader.hpp"
44

5-
#include "component/utils/scheduler.hpp"
5+
#include "scheduler.hpp"
66

77
#include "game/game.hpp"
88
#include "game/dvars.hpp"

src/component/entities.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <std_include.hpp>
22

3-
#include <component/engine/console/console.hpp>
3+
#include <component/console.hpp>
44
#include <game/game.hpp>
55
#include <game/structs.hpp>
66
#include <utils/string.hpp>
@@ -220,4 +220,4 @@ void Entities::parse(std::string buffer)
220220
}
221221
}
222222
}
223-
}
223+
}
Lines changed: 4 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,19 @@
22
#include "loader/component_loader.hpp"
33
#include "game/game.hpp"
44

5-
#include "component/utils/scheduler.hpp"
5+
#include "scheduler.hpp"
66

77
#include <utils/hook.hpp>
88
#include <utils/io.hpp>
99
#include <utils/string.hpp>
1010
#include <utils/thread.hpp>
11-
#include <atomic>
12-
#include <thread>
1311

1412
#include <exception/minidump.hpp>
1513

1614
namespace exception
1715
{
1816
namespace
1917
{
20-
using namespace std::chrono_literals;
21-
22-
std::atomic<unsigned long long> last_heartbeat_ms{0};
23-
std::atomic<bool> watchdog_running{false};
24-
2518
thread_local struct
2619
{
2720
DWORD code = 0;
@@ -94,21 +87,12 @@ namespace exception
9487

9588
void write_minidump(const LPEXCEPTION_POINTERS exceptioninfo)
9689
{
97-
utils::io::create_directory("minidumps");
9890
const std::string crash_name = utils::string::va("minidumps/consolation-crash-%s.dmp",
9991
utils::string::get_timestamp().data());
10092
create_minidump(exceptioninfo);
10193
utils::io::write_file(crash_name, create_minidump(exceptioninfo), false);
10294
}
10395

104-
void write_hang_dump()
105-
{
106-
utils::io::create_directory("minidumps");
107-
const std::string crash_name = utils::string::va("minidumps/consolation-hang-%s.dmp",
108-
utils::string::get_timestamp().data());
109-
utils::io::write_file(crash_name, create_minidump(), false);
110-
}
111-
11296
bool is_harmless_error(const LPEXCEPTION_POINTERS exceptioninfo)
11397
{
11498
const auto code = exceptioninfo->ExceptionRecord->ExceptionCode;
@@ -136,77 +120,17 @@ namespace exception
136120
// Don't register anything here...
137121
return &exception_filter;
138122
}
139-
140-
bool command_line_has(const char* token)
141-
{
142-
const auto* const cmd = GetCommandLineA();
143-
return cmd && token && std::strstr(cmd, token) != nullptr;
144-
}
145-
146-
void start_watchdog()
147-
{
148-
if (watchdog_running.exchange(true))
149-
{
150-
return;
151-
}
152-
153-
last_heartbeat_ms = GetTickCount64();
154-
155-
std::thread([]()
156-
{
157-
constexpr auto timeout_ms = 10000ULL;
158-
159-
while (true)
160-
{
161-
std::this_thread::sleep_for(1s);
162-
const auto now = GetTickCount64();
163-
const auto last = last_heartbeat_ms.load();
164-
if (now - last >= timeout_ms)
165-
{
166-
write_hang_dump();
167-
TerminateProcess(GetCurrentProcess(), 0xDEAD);
168-
}
169-
}
170-
}).detach();
171-
172-
scheduler::loop([]()
173-
{
174-
last_heartbeat_ms = GetTickCount64();
175-
}, scheduler::main, 250ms);
176-
}
177123
}
178124

179125
class component final : public component_interface
180126
{
181127
public:
182128
void post_load() override
183129
{
184-
if (command_line_has("-no_crashdump"))
185-
{
186-
return;
187-
}
188-
189-
if (!command_line_has("-no_watchdog"))
190-
{
191-
start_watchdog();
192-
}
193-
194-
const auto enable_handler = []()
195-
{
196-
SetUnhandledExceptionFilter(exception_filter);
197-
utils::hook::jump(reinterpret_cast<uintptr_t>(&SetUnhandledExceptionFilter), set_unhandled_exception_filter_stub);
198-
};
199-
200-
if (command_line_has("-crashdump"))
201-
{
202-
enable_handler();
203-
return;
204-
}
205-
206-
// Delay hook to avoid interfering with early boot while still capturing later crashes.
207-
scheduler::once(enable_handler, scheduler::main, 15s);
130+
SetUnhandledExceptionFilter(exception_filter);
131+
utils::hook::jump(reinterpret_cast<uintptr_t>(&SetUnhandledExceptionFilter), set_unhandled_exception_filter_stub);
208132
}
209133
};
210134
}
211135

212-
REGISTER_COMPONENT(exception::component)
136+
//REGISTER_COMPONENT(exception::component)

0 commit comments

Comments
 (0)