chore: CRLF to LF

This commit is contained in:
smpn2
2022-12-16 23:18:35 +09:00
parent b7a60638a4
commit 6c914266d9
725 changed files with 131020 additions and 131020 deletions
+21 -21
View File
@@ -1,21 +1,21 @@
#pragma once
#include <string>
namespace avs::automap {
extern bool ENABLED;
extern bool DUMP;
extern bool PATCH;
extern bool JSON;
extern bool RESTRICT_NETWORK;
extern std::string DUMP_FILENAME;
void enable();
void disable();
// log hooks
typedef void (*AutomapHook_t)(void *user, const char *data);
void hook_add(AutomapHook_t hook, void *user);
void hook_remove(AutomapHook_t hook, void *user);
}
#pragma once
#include <string>
namespace avs::automap {
extern bool ENABLED;
extern bool DUMP;
extern bool PATCH;
extern bool JSON;
extern bool RESTRICT_NETWORK;
extern std::string DUMP_FILENAME;
void enable();
void disable();
// log hooks
typedef void (*AutomapHook_t)(void *user, const char *data);
void hook_add(AutomapHook_t hook, void *user);
void hook_remove(AutomapHook_t hook, void *user);
}
+650 -650
View File
File diff suppressed because it is too large Load Diff
+54 -54
View File
@@ -1,54 +1,54 @@
#pragma once
#include <string>
#include <windows.h>
namespace avs {
/*
* helpers
*/
namespace ea3 {
// import mapping
struct avs_ea3_import {
const char *version;
const char *boot;
const char *shutdown;
};
// settings
extern std::string CFG_PATH;
extern std::string APP_PATH;
extern std::string BOOTSTRAP_PATH;
extern std::string PCBID_CUSTOM;
extern std::string SOFTID_CUSTOM;
extern std::string URL_CUSTOM;
extern int HTTP11;
extern int URL_SLASH;
extern int PCB_TYPE;
// handle
extern std::string VERSION_STR;
extern HINSTANCE DLL_INSTANCE;
extern std::string DLL_NAME;
extern std::string EA3_BOOT_URL;
extern std::string EA3_BOOT_PCBID;
// functions
void load_dll();
void boot(unsigned short easrv_port, bool easrv_maint, bool easrv_smart);
void shutdown();
}
/*
* library functions
*/
typedef int (*AVS_EA3_BOOT_STARTUP_T)(void *);
extern AVS_EA3_BOOT_STARTUP_T avs_ea3_boot_startup;
typedef void (*AVS_EA3_SHUTDOWN_T)(void);
extern AVS_EA3_SHUTDOWN_T avs_ea3_shutdown;
}
#pragma once
#include <string>
#include <windows.h>
namespace avs {
/*
* helpers
*/
namespace ea3 {
// import mapping
struct avs_ea3_import {
const char *version;
const char *boot;
const char *shutdown;
};
// settings
extern std::string CFG_PATH;
extern std::string APP_PATH;
extern std::string BOOTSTRAP_PATH;
extern std::string PCBID_CUSTOM;
extern std::string SOFTID_CUSTOM;
extern std::string URL_CUSTOM;
extern int HTTP11;
extern int URL_SLASH;
extern int PCB_TYPE;
// handle
extern std::string VERSION_STR;
extern HINSTANCE DLL_INSTANCE;
extern std::string DLL_NAME;
extern std::string EA3_BOOT_URL;
extern std::string EA3_BOOT_PCBID;
// functions
void load_dll();
void boot(unsigned short easrv_port, bool easrv_maint, bool easrv_smart);
void shutdown();
}
/*
* library functions
*/
typedef int (*AVS_EA3_BOOT_STARTUP_T)(void *);
extern AVS_EA3_BOOT_STARTUP_T avs_ea3_boot_startup;
typedef void (*AVS_EA3_SHUTDOWN_T)(void);
extern AVS_EA3_SHUTDOWN_T avs_ea3_shutdown;
}
+109 -109
View File
@@ -1,109 +1,109 @@
#include "game.h"
#include "launcher/launcher.h"
#include "util/fileutils.h"
#include "util/libutils.h"
#include "util/logging.h"
namespace avs {
namespace game {
// function names
const char ENTRY_INIT_NAME[] = "dll_entry_init";
const char ENTRY_MAIN_NAME[] = "dll_entry_main";
// functions
typedef bool (*ENTRY_INIT_T)(char *, void *);
typedef void (*ENTRY_MAIN_T)(void);
ENTRY_INIT_T dll_entry_init;
ENTRY_MAIN_T dll_entry_main;
// properties
char MODEL[4] = {'0', '0', '0', '\x00'};
char DEST[2] = {'0', '\x00'};
char SPEC[2] = {'0', '\x00'};
char REV[2] = {'0', '\x00'};
char EXT[11] = {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '\x00'};
// handle
HINSTANCE DLL_INSTANCE;
std::string DLL_NAME;
bool is_model(const char *model) {
return _stricmp(MODEL, model) == 0;
}
bool is_model(const char *model, const char *ext) {
return is_model(model) && is_ext(ext);
}
bool is_model(const std::initializer_list<const char *> model_list) {
for (auto &model : model_list) {
if (is_model(model)) {
return true;
}
}
return false;
}
bool is_ext(const char *ext) {
return _stricmp(EXT, ext) == 0;
}
bool is_ext(int datecode_min, int datecode_max) {
// range check
long datecode = strtol(EXT, NULL, 10);
return datecode_min <= datecode && datecode <= datecode_max;
}
std::string get_identifier() {
return fmt::format("{}:{}:{}:{}:{}",
avs::game::MODEL,
avs::game::DEST,
avs::game::SPEC,
avs::game::REV,
avs::game::EXT);
}
void load_dll() {
log_info("avs-game", "loading DLL '{}'", DLL_NAME);
// load game instance
if (fileutils::verify_header_pe(MODULE_PATH / DLL_NAME)) {
DLL_INSTANCE = libutils::load_library(MODULE_PATH / DLL_NAME);
}
// load entry points
dll_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
dll_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
log_info("avs-game", "loaded successfully ({})", fmt::ptr(DLL_INSTANCE));
}
bool entry_init(char *sid_code, void *app_param) {
auto current_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
if (dll_entry_init != current_entry_init) {
log_info("avs-game", "dll_entry_init is hooked");
dll_entry_init = current_entry_init;
}
return dll_entry_init(sid_code, app_param);
}
void entry_main() {
auto current_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
if (dll_entry_main != current_entry_main) {
log_info("avs-game", "dll_entry_main is hooked");
dll_entry_main = current_entry_main;
}
dll_entry_main();
}
}
}
#include "game.h"
#include "launcher/launcher.h"
#include "util/fileutils.h"
#include "util/libutils.h"
#include "util/logging.h"
namespace avs {
namespace game {
// function names
const char ENTRY_INIT_NAME[] = "dll_entry_init";
const char ENTRY_MAIN_NAME[] = "dll_entry_main";
// functions
typedef bool (*ENTRY_INIT_T)(char *, void *);
typedef void (*ENTRY_MAIN_T)(void);
ENTRY_INIT_T dll_entry_init;
ENTRY_MAIN_T dll_entry_main;
// properties
char MODEL[4] = {'0', '0', '0', '\x00'};
char DEST[2] = {'0', '\x00'};
char SPEC[2] = {'0', '\x00'};
char REV[2] = {'0', '\x00'};
char EXT[11] = {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '\x00'};
// handle
HINSTANCE DLL_INSTANCE;
std::string DLL_NAME;
bool is_model(const char *model) {
return _stricmp(MODEL, model) == 0;
}
bool is_model(const char *model, const char *ext) {
return is_model(model) && is_ext(ext);
}
bool is_model(const std::initializer_list<const char *> model_list) {
for (auto &model : model_list) {
if (is_model(model)) {
return true;
}
}
return false;
}
bool is_ext(const char *ext) {
return _stricmp(EXT, ext) == 0;
}
bool is_ext(int datecode_min, int datecode_max) {
// range check
long datecode = strtol(EXT, NULL, 10);
return datecode_min <= datecode && datecode <= datecode_max;
}
std::string get_identifier() {
return fmt::format("{}:{}:{}:{}:{}",
avs::game::MODEL,
avs::game::DEST,
avs::game::SPEC,
avs::game::REV,
avs::game::EXT);
}
void load_dll() {
log_info("avs-game", "loading DLL '{}'", DLL_NAME);
// load game instance
if (fileutils::verify_header_pe(MODULE_PATH / DLL_NAME)) {
DLL_INSTANCE = libutils::load_library(MODULE_PATH / DLL_NAME);
}
// load entry points
dll_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
dll_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
log_info("avs-game", "loaded successfully ({})", fmt::ptr(DLL_INSTANCE));
}
bool entry_init(char *sid_code, void *app_param) {
auto current_entry_init = (ENTRY_INIT_T) libutils::get_proc(DLL_INSTANCE, ENTRY_INIT_NAME);
if (dll_entry_init != current_entry_init) {
log_info("avs-game", "dll_entry_init is hooked");
dll_entry_init = current_entry_init;
}
return dll_entry_init(sid_code, app_param);
}
void entry_main() {
auto current_entry_main = (ENTRY_MAIN_T) libutils::get_proc(DLL_INSTANCE, ENTRY_MAIN_NAME);
if (dll_entry_main != current_entry_main) {
log_info("avs-game", "dll_entry_main is hooked");
dll_entry_main = current_entry_main;
}
dll_entry_main();
}
}
}
+44 -44
View File
@@ -1,44 +1,44 @@
#pragma once
#include <initializer_list>
#include <string>
#include <windows.h>
namespace avs {
/*
* helpers
*/
namespace game {
// properties
extern char MODEL[4];
extern char DEST[2];
extern char SPEC[2];
extern char REV[2];
extern char EXT[11];
// handle
extern HINSTANCE DLL_INSTANCE;
extern std::string DLL_NAME;
// helpers
bool is_model(const char *model);
bool is_model(const char *model, const char *ext);
bool is_model(const std::initializer_list<const char *> model_list);
bool is_ext(const char *ext);
bool is_ext(int datecode_min, int datecode_max);
std::string get_identifier();
// functions
void load_dll();
/*
* library functions
*/
bool entry_init(char *sid_code, void *app_param);
void entry_main();
}
}
#pragma once
#include <initializer_list>
#include <string>
#include <windows.h>
namespace avs {
/*
* helpers
*/
namespace game {
// properties
extern char MODEL[4];
extern char DEST[2];
extern char SPEC[2];
extern char REV[2];
extern char EXT[11];
// handle
extern HINSTANCE DLL_INSTANCE;
extern std::string DLL_NAME;
// helpers
bool is_model(const char *model);
bool is_model(const char *model, const char *ext);
bool is_model(const std::initializer_list<const char *> model_list);
bool is_ext(const char *ext);
bool is_ext(int datecode_min, int datecode_max);
std::string get_identifier();
// functions
void load_dll();
/*
* library functions
*/
bool entry_init(char *sid_code, void *app_param);
void entry_main();
}
}