📄 px_ss_main.c
字号:
/* must been first include begin */
#include "..\ProjectX_Common\ProjectX_Copyright.h"
#include "..\ProjectX_Common\ProjectX_Common.h"
/* must been first include end */
/* std and common include */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
/* program specify include */
#include "..\ProjectX_Common\ProjectX_Utils.h"
#include "px_ss_config.h"
#include "px_ss_state.h"
#include "px_ss_ui.h"
#include "px_ss_time_service.h"
#include "px_ss_statistic.h"
#include "px_ss_module_work.h"
/* variant define */
char version[] = "1.00.0143";
char author[] = "MS:XSuns@hotmail.com";
char last_edit_time[] = "30/06/2005 23:45";
char base_path[FILENAME_MAX];
char ** pcfg_buf;
PX_SS_STATE * g_state = NULL;
PX_SS_TIME_SERVICE * g_time_service = NULL;
void init_ss_instance(void);
void uninit_ss_instance(void);
int main(int argc, char ** argv){
BOOL bln_run = TRUE;
char cmd_buf[FILENAME_MAX];
init_ss_instance();
x_ui_init();
if (_beginthread(ss_module_work_thread,0,NULL) == NULL) {
x_ui_display_error("Fault Error:_beginthread return fail");
getchar();
return 0;
}
while (bln_run) {
cmd_buf[FILENAME_MAX] = '\0';
gets(cmd_buf);
bln_run = ss_ui_handle_command(cmd_buf);
ss_ui_display_logo();
}
x_ui_display_info("Press any key for exit ...");
getchar();
uninit_ss_instance();
return 0;
}
void init_ss_instance(){
if (g_time_service == NULL) {
g_time_service = (LPPX_SS_TIME_SERVICE)ms_malloc(sizeof(PX_SS_TIME_SERVICE));
g_time_service->time_start = GetTime64();
g_time_service->time_persist = 0;
g_time_service->time_cycle = GetTime64();
g_time_service->time_current = GetTime64();
g_time_service->frame_theory = 0;
g_time_service->frame_fact = 0;
}
if (g_state == NULL) {
g_state = (LPPX_SS_STATE)ms_malloc(sizeof(PX_SS_STATE));
g_state->cts_state = (LPCRITICAL_SECTION)ms_malloc(sizeof(CRITICAL_SECTION));
memset(g_state->cts_state,0,sizeof(CRITICAL_SECTION));
InitializeCriticalSectionAndSpinCount(g_state->cts_state,0x4000);
g_state->prev_time = GetTime64();
g_state->curr_time = GetTime64();
g_state->frame_cl = 0;
g_state->frame_rs = 0;
g_state->prev_state = STATE_MAIN_NO_INIT;
g_state->curr_state = STATE_MAIN_NO_INIT;
g_state->cl_state = STATE_MODULE_NO_INIT;
g_state->rs_state = STATE_MODULE_NO_INIT;
}
return;
}
void uninit_ss_instance(){
if (g_state != NULL) {
DeleteCriticalSection(g_state->cts_state);
ms_free(g_state);
g_state = NULL;
}
if (g_time_service != NULL) {
ms_free(g_time_service);
g_time_service = NULL;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -