mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-07 16:18:49 +00:00
entrypoint.{h, c}
This commit is contained in:
+13
-61
@@ -1,14 +1,15 @@
|
|||||||
#ifdef INTELLISENSE_DIRECTIVES
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
# include "entry_point.h"
|
# include "entry_point.h"
|
||||||
|
# include "profiling.h"
|
||||||
# include "arena.h"
|
# include "arena.h"
|
||||||
# include "thread_context.h"
|
# include "thread_context.h"
|
||||||
|
# include "os/os.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Copyright (c) 2024 Epic Games Tools
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
internal void
|
void main_thread_base_entry_point(MainThread_EntryPointProc* entry_point, char** arguments, U64 arguments_count)
|
||||||
main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **arguments, U64 arguments_count)
|
|
||||||
{
|
{
|
||||||
#if PROFILE_TELEMETRY
|
#if PROFILE_TELEMETRY
|
||||||
local_persist U8 tm_data[MB(64)];
|
local_persist U8 tm_data[MB(64)];
|
||||||
@@ -17,79 +18,30 @@ main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **argum
|
|||||||
tmInitialize(sizeof(tm_data), (char *)tm_data);
|
tmInitialize(sizeof(tm_data), (char *)tm_data);
|
||||||
#endif
|
#endif
|
||||||
ThreadNameF("[main thread]");
|
ThreadNameF("[main thread]");
|
||||||
|
|
||||||
|
// TODO(Ed): Review
|
||||||
TempArena scratch = scratch_begin(0, 0);
|
TempArena scratch = scratch_begin(0, 0);
|
||||||
|
|
||||||
String8List command_line_argument_strings = os_string_list_from_argcv(scratch.arena, (int)arguments_count, arguments);
|
String8List command_line_argument_strings = os_string_list_from_argcv(scratch.arena, (int)arguments_count, arguments);
|
||||||
CmdLine cmdline = cmd_line_from_string_list(scratch.arena, command_line_argument_strings);
|
CmdLine cmdline = cmd_line_from_string_list(scratch.arena, command_line_argument_strings);
|
||||||
B32 capture = cmd_line_has_flag(&cmdline, str8_lit("capture"));
|
B32 capture = cmd_line_has_flag(&cmdline, str8_lit("capture"));
|
||||||
if(capture)
|
if(capture)
|
||||||
{
|
{
|
||||||
ProfBeginCapture(arguments[0]);
|
prof_begin_capture(arguments[0]);
|
||||||
}
|
}
|
||||||
#if defined(TASK_SYSTEM_H) && !defined(TS_INIT_MANUAL)
|
|
||||||
ts_init();
|
|
||||||
#endif
|
|
||||||
#if defined(HASH_STORE_H) && !defined(HS_INIT_MANUAL)
|
|
||||||
hs_init();
|
|
||||||
#endif
|
|
||||||
#if defined(FILE_STREAM_H) && !defined(FS_INIT_MANUAL)
|
|
||||||
fs_init();
|
|
||||||
#endif
|
|
||||||
#if defined(TEXT_CACHE_H) && !defined(TXT_INIT_MANUAL)
|
|
||||||
txt_init();
|
|
||||||
#endif
|
|
||||||
#if defined(MUTABLE_TEXT_H) && !defined(MTX_INIT_MANUAL)
|
|
||||||
mtx_init();
|
|
||||||
#endif
|
|
||||||
#if defined(DASM_CACHE_H) && !defined(DASM_INIT_MANUAL)
|
|
||||||
dasm_init();
|
|
||||||
#endif
|
|
||||||
#if defined(DI_H) && !defined(DI_INIT_MANUAL)
|
|
||||||
di_init();
|
|
||||||
#endif
|
|
||||||
#if defined(FUZZY_SEARCH_H) && !defined(FZY_INIT_MANUAL)
|
|
||||||
fzy_init();
|
|
||||||
#endif
|
|
||||||
#if defined(DEMON_CORE_H) && !defined(DMN_INIT_MANUAL)
|
|
||||||
dmn_init();
|
|
||||||
#endif
|
|
||||||
#if defined(CTRL_CORE_H) && !defined(CTRL_INIT_MANUAL)
|
|
||||||
ctrl_init();
|
|
||||||
#endif
|
|
||||||
#if defined(OS_GRAPHICAL_H) && !defined(OS_GFX_INIT_MANUAL)
|
|
||||||
os_gfx_init();
|
|
||||||
#endif
|
|
||||||
#if defined(FONT_PROVIDER_H) && !defined(FP_INIT_MANUAL)
|
|
||||||
fp_init();
|
|
||||||
#endif
|
|
||||||
#if defined(RENDER_CORE_H) && !defined(R_INIT_MANUAL)
|
|
||||||
r_init(&cmdline);
|
|
||||||
#endif
|
|
||||||
#if defined(TEXTURE_CACHE_H) && !defined(TEX_INIT_MANUAL)
|
|
||||||
tex_init();
|
|
||||||
#endif
|
|
||||||
#if defined(GEO_CACHE_H) && !defined(GEO_INIT_MANUAL)
|
|
||||||
geo_init();
|
|
||||||
#endif
|
|
||||||
#if defined(FONT_CACHE_H) && !defined(F_INIT_MANUAL)
|
|
||||||
f_init();
|
|
||||||
#endif
|
|
||||||
#if defined(DF_CORE_H) && !defined(DF_INIT_MANUAL)
|
|
||||||
DF_StateDeltaHistory *hist = df_state_delta_history_alloc();
|
|
||||||
df_core_init(&cmdline, hist);
|
|
||||||
#endif
|
|
||||||
#if defined(DF_GFX_H) && !defined(DF_GFX_INIT_MANUAL)
|
|
||||||
df_gfx_init(update_and_render, df_state_delta_history());
|
|
||||||
#endif
|
|
||||||
entry_point(&cmdline);
|
entry_point(&cmdline);
|
||||||
|
|
||||||
if(capture)
|
if(capture)
|
||||||
{
|
{
|
||||||
ProfEndCapture();
|
prof_end_capture();
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
void
|
||||||
supplement_thread_base_entry_point(void (*entry_point)(void *params), void *params)
|
supplement_thread_base_entry_point(SupplementThread_EntryPointProc* entry_point, void* params)
|
||||||
{
|
{
|
||||||
TCTX tctx;
|
TCTX tctx;
|
||||||
tctx_init_and_equip(&tctx);
|
tctx_init_and_equip(&tctx);
|
||||||
|
|||||||
@@ -8,5 +8,8 @@
|
|||||||
// Copyright (c) 2024 Epic Games Tools
|
// Copyright (c) 2024 Epic Games Tools
|
||||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
internal void main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **arguments, U64 arguments_count);
|
typedef void (MainThread_EntryPointProc) (CmdLine* cmd_line);
|
||||||
internal void supplement_thread_base_entry_point(void (*entry_point)(void *params), void *params);
|
typedef void (SupplementThread_EntryPointProc)(void* params);
|
||||||
|
|
||||||
|
MD_API void main_thread_base_entry_point (MainThread_EntryPointProc* entry_point, char** arguments, U64 arguments_count);
|
||||||
|
MD_API void supplement_thread_base_entry_point(SupplementThread_EntryPointProc* entry_point, void* params);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ MD_NS_BEGIN
|
|||||||
#include "base/thread_context.h"
|
#include "base/thread_context.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/markup.h"
|
#include "base/markup.h"
|
||||||
|
#include "base/logger.h"
|
||||||
|
#include "base/entry_point.h"
|
||||||
|
|
||||||
MD_NS_END
|
MD_NS_END
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user