mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Merge pull request #587 from winterheart/module-fixes
Update module, add logger module
This commit is contained in:
commit
b33cc21dce
@ -15,9 +15,9 @@ set(CPPS
|
|||||||
add_library(2dlib STATIC ${HEADERS} ${CPPS})
|
add_library(2dlib STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(2dlib PRIVATE
|
target_link_libraries(2dlib PRIVATE
|
||||||
cfile
|
cfile
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(2dlib PUBLIC
|
target_include_directories(2dlib PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -11,7 +11,7 @@ set(CPPS
|
|||||||
add_library(AudioEncode STATIC ${HEADERS} ${CPPS})
|
add_library(AudioEncode STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(AudioEncode PRIVATE
|
target_link_libraries(AudioEncode PRIVATE
|
||||||
libacm
|
libacm
|
||||||
plog::plog
|
logger
|
||||||
)
|
)
|
||||||
target_include_directories(AudioEncode PUBLIC
|
target_include_directories(AudioEncode PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -234,6 +234,7 @@ add_subdirectory(linux)
|
|||||||
add_subdirectory(ddio)
|
add_subdirectory(ddio)
|
||||||
add_subdirectory(dd_video)
|
add_subdirectory(dd_video)
|
||||||
add_subdirectory(fix)
|
add_subdirectory(fix)
|
||||||
|
add_subdirectory(logger)
|
||||||
add_subdirectory(manage)
|
add_subdirectory(manage)
|
||||||
add_subdirectory(grtext)
|
add_subdirectory(grtext)
|
||||||
add_subdirectory(mem)
|
add_subdirectory(mem)
|
||||||
|
@ -314,9 +314,36 @@ file(GLOB_RECURSE INCS "../lib/*.h")
|
|||||||
|
|
||||||
add_executable(Descent3 WIN32 MACOSX_BUNDLE ${D3Icon} ${HEADERS} ${CPPS} ${INCS} ${MANIFEST} ${RC_FILE})
|
add_executable(Descent3 WIN32 MACOSX_BUNDLE ${D3Icon} ${HEADERS} ${CPPS} ${INCS} ${MANIFEST} ${RC_FILE})
|
||||||
target_link_libraries(Descent3 PRIVATE
|
target_link_libraries(Descent3 PRIVATE
|
||||||
2dlib AudioEncode bitmap cfile dd_video ddebug ddio libmve libacm
|
SDL2::SDL2
|
||||||
fix grtext manage mem misc model module stream_audio linux SDL2::SDL2 plog::plog
|
2dlib
|
||||||
music networking physics renderer rtperformance sndlib ui unzip vecmat md5
|
AudioEncode
|
||||||
|
bitmap
|
||||||
|
cfile
|
||||||
|
dd_video
|
||||||
|
ddebug
|
||||||
|
ddio
|
||||||
|
fix
|
||||||
|
grtext
|
||||||
|
libmve
|
||||||
|
libacm
|
||||||
|
linux
|
||||||
|
logger
|
||||||
|
manage
|
||||||
|
mem
|
||||||
|
md5
|
||||||
|
misc
|
||||||
|
model
|
||||||
|
module
|
||||||
|
music
|
||||||
|
networking
|
||||||
|
physics
|
||||||
|
renderer
|
||||||
|
rtperformance
|
||||||
|
sndlib
|
||||||
|
stream_audio
|
||||||
|
ui
|
||||||
|
unzip
|
||||||
|
vecmat
|
||||||
${PLATFORM_LIBS})
|
${PLATFORM_LIBS})
|
||||||
target_include_directories(Descent3 PRIVATE ${PROJECT_BINARY_DIR}/lib)
|
target_include_directories(Descent3 PRIVATE ${PROJECT_BINARY_DIR}/lib)
|
||||||
target_link_options(Descent3 PRIVATE $<$<PLATFORM_ID:Windows>:/DEBUG:FULL>)
|
target_link_options(Descent3 PRIVATE $<$<PLATFORM_ID:Windows>:/DEBUG:FULL>)
|
||||||
|
@ -112,11 +112,10 @@
|
|||||||
#ifndef __OSIRIS_H_
|
#ifndef __OSIRIS_H_
|
||||||
#define __OSIRIS_H_
|
#define __OSIRIS_H_
|
||||||
|
|
||||||
#include "pstypes.h"
|
#include "cfile.h"
|
||||||
|
#include "module.h"
|
||||||
#include "object_external_struct.h"
|
#include "object_external_struct.h"
|
||||||
#include "osiris_share.h"
|
#include "osiris_share.h"
|
||||||
#include "module.h"
|
|
||||||
#include "cfile.h"
|
|
||||||
|
|
||||||
extern uint32_t Osiris_game_checksum;
|
extern uint32_t Osiris_game_checksum;
|
||||||
extern tOSIRISModuleInit Osiris_module_init;
|
extern tOSIRISModuleInit Osiris_module_init;
|
||||||
|
@ -33,20 +33,9 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <cstdio>
|
|
||||||
#include <windows.h>
|
|
||||||
#include "debug.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
// We use direct plog includes instead of log.h for logger instance initialization
|
|
||||||
#include <plog/Log.h>
|
|
||||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
|
||||||
#include <plog/Initializers/RollingFileInitializer.h>
|
|
||||||
|
|
||||||
#include "appdatabase.h"
|
#include "appdatabase.h"
|
||||||
#include "ddio.h"
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "d3_version.h"
|
#include "d3_version.h"
|
||||||
@ -54,6 +43,11 @@
|
|||||||
#include "descent.h"
|
#include "descent.h"
|
||||||
#include "dedicated_server.h"
|
#include "dedicated_server.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include "debug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
std::filesystem::path orig_pwd;
|
std::filesystem::path orig_pwd;
|
||||||
|
|
||||||
@ -212,38 +206,6 @@ int SDLCALL d3SDLEventFilter(void *userdata, SDL_Event *event) {
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize logger facility.
|
|
||||||
* @param log_level desired log level (for example, plog::debug)
|
|
||||||
* @param enable_filelog enable logging into Descent.log
|
|
||||||
* @param enable_win_console enable console windows for WIN32 (no-op for POSIX systems)
|
|
||||||
*/
|
|
||||||
void InitLog(plog::Severity log_level, bool enable_filelog, bool enable_win_console) {
|
|
||||||
std::filesystem::path log_file = "Descent3.log";
|
|
||||||
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
|
||||||
static plog::RollingFileAppender<plog::TxtFormatter> fileAppender(log_file.u8string().c_str());
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
if (enable_win_console) {
|
|
||||||
// Open console window
|
|
||||||
AllocConsole();
|
|
||||||
freopen("CONIN$", "r", stdin);
|
|
||||||
freopen("CONOUT$", "w", stdout);
|
|
||||||
freopen("CONOUT$", "w", stderr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
plog::init(log_level, &consoleAppender);
|
|
||||||
if (enable_filelog) {
|
|
||||||
if (std::filesystem::is_regular_file(log_file)) {
|
|
||||||
// Delete old log
|
|
||||||
std::error_code ec;
|
|
||||||
std::filesystem::remove(log_file, ec);
|
|
||||||
plog::get()->addAppender(&fileAppender);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Main
|
// Main
|
||||||
// creates all the OS objects and then runs Descent 3.
|
// creates all the OS objects and then runs Descent 3.
|
||||||
|
@ -7,6 +7,7 @@ add_executable(
|
|||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
porting-tests
|
porting-tests
|
||||||
|
module
|
||||||
GTest::gtest_main
|
GTest::gtest_main
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ target_link_libraries(bitmap PRIVATE
|
|||||||
cfile
|
cfile
|
||||||
ddebug
|
ddebug
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
stb
|
stb
|
||||||
)
|
)
|
||||||
target_include_directories(bitmap PUBLIC
|
target_include_directories(bitmap PUBLIC
|
||||||
|
@ -11,9 +11,9 @@ set(CPPS
|
|||||||
add_library(cfile STATIC ${HEADERS} ${CPPS})
|
add_library(cfile STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(cfile PRIVATE
|
target_link_libraries(cfile PRIVATE
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(cfile PUBLIC
|
target_include_directories(cfile PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -11,8 +11,8 @@ set(CPPS
|
|||||||
add_library(dd_grwin32 STATIC ${HEADERS} ${CPPS})
|
add_library(dd_grwin32 STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(dd_grwin32 PRIVATE
|
target_link_libraries(dd_grwin32 PRIVATE
|
||||||
2dlib
|
2dlib
|
||||||
|
logger
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_compile_definitions(dd_grwin32 PRIVATE DX_APP)
|
target_compile_definitions(dd_grwin32 PRIVATE DX_APP)
|
||||||
target_link_libraries(dd_grwin32 PRIVATE ${DDRAW_LIBRARY})
|
target_link_libraries(dd_grwin32 PRIVATE ${DDRAW_LIBRARY})
|
||||||
|
@ -29,8 +29,8 @@ set(CPPS
|
|||||||
add_library(ddio STATIC ${HEADERS} ${CPPS})
|
add_library(ddio STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(ddio PRIVATE
|
target_link_libraries(ddio PRIVATE
|
||||||
SDL2::SDL2
|
SDL2::SDL2
|
||||||
plog::plog
|
|
||||||
ddebug
|
ddebug
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
)
|
)
|
||||||
|
@ -10,9 +10,9 @@ set(CPPS
|
|||||||
add_library(grtext STATIC ${HEADERS} ${CPPS})
|
add_library(grtext STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(grtext PRIVATE
|
target_link_libraries(grtext PRIVATE
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(grtext PUBLIC
|
target_include_directories(grtext PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -44,8 +44,11 @@
|
|||||||
#ifndef _OUTRAGE_DIRECTPLAY_HEADER
|
#ifndef _OUTRAGE_DIRECTPLAY_HEADER
|
||||||
#define _OUTRAGE_DIRECTPLAY_HEADER
|
#define _OUTRAGE_DIRECTPLAY_HEADER
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "dplay.h"
|
#include "dplay.h"
|
||||||
#include "dplobby.h"
|
#include "dplobby.h"
|
||||||
|
#include "networking.h"
|
||||||
|
|
||||||
struct modem_list {
|
struct modem_list {
|
||||||
char name[200];
|
char name[200];
|
||||||
@ -80,7 +83,7 @@ int dp_DirectPlaySend(network_address *who_to, uint8_t *data, int len, bool reli
|
|||||||
void dp_DirectPlayDispatch();
|
void dp_DirectPlayDispatch();
|
||||||
|
|
||||||
// Initialize stuff
|
// Initialize stuff
|
||||||
int dp_InitDirectPlay(char *conn_name, void *parms = NULL, int num_elements = 0);
|
int dp_InitDirectPlay(char *conn_name, void *parms = nullptr, int num_elements = 0);
|
||||||
|
|
||||||
// Shutdown things
|
// Shutdown things
|
||||||
void dp_ShutdownDirectPlay();
|
void dp_ShutdownDirectPlay();
|
||||||
|
@ -13,7 +13,7 @@ set(CPPS
|
|||||||
add_library(linux STATIC ${HEADERS} ${CPPS})
|
add_library(linux STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(linux PRIVATE
|
target_link_libraries(linux PRIVATE
|
||||||
cfile
|
cfile
|
||||||
plog::plog
|
logger
|
||||||
)
|
)
|
||||||
target_include_directories(linux PUBLIC
|
target_include_directories(linux PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
16
logger/CMakeLists.txt
Normal file
16
logger/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
set(HEADERS
|
||||||
|
log.h
|
||||||
|
)
|
||||||
|
set(CPPS
|
||||||
|
log.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(logger STATIC ${HEADERS} ${CPPS})
|
||||||
|
target_link_libraries(logger PUBLIC
|
||||||
|
plog::plog
|
||||||
|
)
|
||||||
|
target_include_directories(logger PUBLIC
|
||||||
|
$<BUILD_INTERFACE:
|
||||||
|
${PROJECT_SOURCE_DIR}/logger
|
||||||
|
>
|
||||||
|
)
|
56
logger/log.cpp
Normal file
56
logger/log.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Descent 3
|
||||||
|
* Copyright (C) 2024 Descent Developers
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <plog/Log.h>
|
||||||
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||||
|
#include <plog/Initializers/RollingFileInitializer.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <cstdio>
|
||||||
|
#include <windows.h>
|
||||||
|
#include "debug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
void InitLog(plog::Severity log_level, bool enable_filelog, bool enable_win_console) {
|
||||||
|
std::filesystem::path log_file = "Descent3.log";
|
||||||
|
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
||||||
|
static plog::RollingFileAppender<plog::TxtFormatter> fileAppender(log_file.u8string().c_str());
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
if (enable_win_console) {
|
||||||
|
// Open console window
|
||||||
|
AllocConsole();
|
||||||
|
freopen("CONIN$", "r", stdin);
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
freopen("CONOUT$", "w", stderr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
plog::init(log_level, &consoleAppender);
|
||||||
|
if (enable_filelog) {
|
||||||
|
if (std::filesystem::is_regular_file(log_file)) {
|
||||||
|
// Delete old log
|
||||||
|
std::error_code ec;
|
||||||
|
std::filesystem::remove(log_file, ec);
|
||||||
|
}
|
||||||
|
plog::get()->addAppender(&fileAppender);
|
||||||
|
}
|
||||||
|
}
|
@ -32,3 +32,11 @@ In case of swapping to another solution here should be redefined following macro
|
|||||||
#define LOG_FATAL PLOG(plog::fatal)
|
#define LOG_FATAL PLOG(plog::fatal)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize logger facility.
|
||||||
|
* @param log_level desired log level (for example, plog::debug)
|
||||||
|
* @param enable_filelog enable logging into Descent.log
|
||||||
|
* @param enable_win_console enable console windows for WIN32 (no-op for POSIX systems)
|
||||||
|
*/
|
||||||
|
void InitLog(plog::Severity log_level, bool enable_filelog, bool enable_win_console);
|
@ -25,10 +25,10 @@ add_library(manage STATIC ${HEADERS} ${CPPS})
|
|||||||
target_link_libraries(manage PRIVATE
|
target_link_libraries(manage PRIVATE
|
||||||
cfile
|
cfile
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
model
|
model
|
||||||
sndlib
|
sndlib
|
||||||
stream_audio
|
stream_audio
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
|
@ -6,8 +6,8 @@ target_compile_definitions(mem PUBLIC
|
|||||||
$<$<BOOL:${ENABLE_MEM_RTL}>:MEM_USE_RTL>
|
$<$<BOOL:${ENABLE_MEM_RTL}>:MEM_USE_RTL>
|
||||||
)
|
)
|
||||||
target_link_libraries(mem PRIVATE
|
target_link_libraries(mem PRIVATE
|
||||||
|
logger
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(mem PUBLIC
|
target_include_directories(mem PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -8,10 +8,10 @@ set(CPPS
|
|||||||
add_library(model STATIC ${HEADERS} ${CPPS})
|
add_library(model STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(model PRIVATE
|
target_link_libraries(model PRIVATE
|
||||||
cfile
|
cfile
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
physics
|
physics
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(model PUBLIC
|
target_include_directories(model PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
set(HEADERS)
|
set(HEADERS
|
||||||
|
module.h
|
||||||
|
)
|
||||||
set(CPPS
|
set(CPPS
|
||||||
module.cpp)
|
module.cpp
|
||||||
|
)
|
||||||
|
|
||||||
add_library(module STATIC ${HEADERS} ${CPPS})
|
add_library(module STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(module PRIVATE
|
target_link_libraries(module PRIVATE
|
||||||
|
cfile
|
||||||
ddebug
|
ddebug
|
||||||
|
logger
|
||||||
)
|
)
|
||||||
|
target_include_directories(module PUBLIC
|
||||||
|
$<BUILD_INTERFACE:
|
||||||
|
${PROJECT_SOURCE_DIR}/module
|
||||||
|
>
|
||||||
|
)
|
@ -101,54 +101,10 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "cfile.h"
|
||||||
#include "crossplat.h"
|
#include "crossplat.h"
|
||||||
|
#include "log.h"
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "mono.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns fixed case file name to actual case on disk for case-sensitive filesystems (Linux).
|
|
||||||
* This is actually copy of cf_FindRealFileNameCaseInsensitive() from CFILE.
|
|
||||||
* @param fname the fixed case name to map to reality
|
|
||||||
* @param directory optional directory to search within (default - current path)
|
|
||||||
* @return filename with actual case name or empty path if there no mapping in filesystem
|
|
||||||
* @note This function returns only filename without directory part, i.e.
|
|
||||||
* mod_FindRealFileNameCaseInsensitive("test/test.txt") will return only "test.txt" on success.
|
|
||||||
*/
|
|
||||||
std::filesystem::path mod_FindRealFileNameCaseInsensitive(const std::filesystem::path &fname,
|
|
||||||
const std::filesystem::path &directory = ".") {
|
|
||||||
// Dumb check, maybe there already all ok?
|
|
||||||
if (std::filesystem::exists((directory / fname))) {
|
|
||||||
return fname.filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::filesystem::path result, search_path, search_file;
|
|
||||||
|
|
||||||
search_path = directory / fname.parent_path();
|
|
||||||
search_file = fname.filename();
|
|
||||||
|
|
||||||
// If directory does not exist, nothing to search.
|
|
||||||
if (!std::filesystem::is_directory(search_path) || search_file.empty()) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search component in search_path
|
|
||||||
auto const &it = std::filesystem::directory_iterator(search_path);
|
|
||||||
|
|
||||||
auto found = std::find_if(it, end(it), [&search_file, &search_path, &result](const auto &dir_entry) {
|
|
||||||
return stricmp(dir_entry.path().filename().u8string().c_str(), search_file.u8string().c_str()) == 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (found != end(it)) {
|
|
||||||
// Match, append to result
|
|
||||||
result = found->path();
|
|
||||||
search_path = result;
|
|
||||||
} else {
|
|
||||||
// Component not found, mission failed
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ModLastError = MODERR_NOERROR;
|
int ModLastError = MODERR_NOERROR;
|
||||||
|
|
||||||
@ -228,21 +184,21 @@ bool mod_LoadModule(module *handle, const std::filesystem::path &imodfilename, i
|
|||||||
if (!handle->handle) {
|
if (!handle->handle) {
|
||||||
// ok we couldn't find the given name...try other ways
|
// ok we couldn't find the given name...try other ways
|
||||||
std::filesystem::path parent_path = modfilename.parent_path();
|
std::filesystem::path parent_path = modfilename.parent_path();
|
||||||
std::filesystem::path new_filename = mod_FindRealFileNameCaseInsensitive(parent_path, modfilename.filename());
|
std::filesystem::path new_filename = cf_FindRealFileNameCaseInsensitive(modfilename.filename(), parent_path);
|
||||||
|
|
||||||
if (new_filename.empty()) {
|
if (new_filename.empty()) {
|
||||||
mprintf(0, "Module Load Err: %s\n", dlerror());
|
LOG_ERROR.printf("Module Load Err: %s", dlerror());
|
||||||
ModLastError = MODERR_MODNOTFOUND;
|
ModLastError = MODERR_MODNOTFOUND;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok we have a different filename
|
// ok we have a different filename
|
||||||
mprintf(0, "MOD: Attempting to open %s instead of %s\n", new_filename.u8string().c_str(),
|
LOG_DEBUG.printf("MOD: Attempting to open %s instead of %s", new_filename.u8string().c_str(),
|
||||||
modfilename.u8string().c_str());
|
modfilename.u8string().c_str());
|
||||||
modfilename = parent_path / new_filename;
|
modfilename = parent_path / new_filename;
|
||||||
handle->handle = dlopen(modfilename.u8string().c_str(), f);
|
handle->handle = dlopen(modfilename.u8string().c_str(), f);
|
||||||
if (!handle->handle) {
|
if (!handle->handle) {
|
||||||
mprintf(0, "Module Load Err: %s\n", dlerror());
|
LOG_ERROR.printf("Module Load Err: %s", dlerror());
|
||||||
ModLastError = MODERR_MODNOTFOUND;
|
ModLastError = MODERR_MODNOTFOUND;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,11 @@ target_link_libraries(music
|
|||||||
AudioEncode
|
AudioEncode
|
||||||
cfile
|
cfile
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
sndlib
|
sndlib
|
||||||
stream_audio
|
stream_audio
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(music PUBLIC
|
target_include_directories(music PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -18,6 +18,7 @@ target_link_libraries(Descent3_Online_TCP_IP PRIVATE
|
|||||||
ddio
|
ddio
|
||||||
inetfile
|
inetfile
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
ui
|
ui
|
||||||
$<$<PLATFORM_ID:Windows>:ws2_32>
|
$<$<PLATFORM_ID:Windows>:ws2_32>
|
||||||
)
|
)
|
||||||
|
@ -11,6 +11,7 @@ target_link_libraries(Direct_TCP_IP PRIVATE
|
|||||||
ddio
|
ddio
|
||||||
inetfile
|
inetfile
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
ui
|
ui
|
||||||
$<$<PLATFORM_ID:Windows>:ws2_32>
|
$<$<PLATFORM_ID:Windows>:ws2_32>
|
||||||
)
|
)
|
||||||
|
@ -21,6 +21,7 @@ target_link_libraries(Parallax_Online PRIVATE
|
|||||||
ddio
|
ddio
|
||||||
inetfile
|
inetfile
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
ui
|
ui
|
||||||
$<$<PLATFORM_ID:Windows>:ws2_32>
|
$<$<PLATFORM_ID:Windows>:ws2_32>
|
||||||
)
|
)
|
||||||
|
@ -30,6 +30,7 @@ add_library(dmfc STATIC ${HEADERS} ${CPPS})
|
|||||||
target_link_libraries(dmfc PUBLIC
|
target_link_libraries(dmfc PUBLIC
|
||||||
grtext
|
grtext
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
physics
|
physics
|
||||||
ddio
|
ddio
|
||||||
)
|
)
|
||||||
|
@ -13,8 +13,9 @@ endif()
|
|||||||
add_library(networking STATIC ${HEADERS} ${CPPS})
|
add_library(networking STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(networking PRIVATE
|
target_link_libraries(networking PRIVATE
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
${PLATFORM_LIBS}
|
${PLATFORM_LIBS}
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
|
@ -290,6 +290,11 @@
|
|||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <wsipx.h>
|
#include <wsipx.h>
|
||||||
#include <ras.h>
|
#include <ras.h>
|
||||||
|
|
||||||
|
#include "directplay.h"
|
||||||
|
#include "dplay.h"
|
||||||
|
#include "dplobby.h"
|
||||||
|
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -311,36 +316,23 @@ typedef int socklen_t;
|
|||||||
#define LPSTR char *
|
#define LPSTR char *
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "dplay.h"
|
|
||||||
#include "dplobby.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "descent.h"
|
#include "descent.h"
|
||||||
#include "appdatabase.h"
|
#include "appdatabase.h"
|
||||||
|
|
||||||
#include "pstypes.h"
|
|
||||||
#include "pserror.h"
|
#include "pserror.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "networking.h"
|
#include "networking.h"
|
||||||
#include "ddio.h"
|
#include "ddio.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
#include "module.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "byteswap.h"
|
#include "byteswap.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "directplay.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "pstring.h"
|
#include "pstring.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
bool Use_DirectPlay = false;
|
bool Use_DirectPlay = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "module.h" //for some nice defines to use below
|
|
||||||
|
|
||||||
#define MAX_CONNECT_TRIES 50
|
#define MAX_CONNECT_TRIES 50
|
||||||
#define MAX_RECEIVE_BUFSIZE 32768
|
#define MAX_RECEIVE_BUFSIZE 32768
|
||||||
//(1<<16) // 16 K, eh?
|
//(1<<16) // 16 K, eh?
|
||||||
|
@ -12,12 +12,13 @@ set(CPPS
|
|||||||
add_library(physics STATIC ${HEADERS} ${CPPS})
|
add_library(physics STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(physics PRIVATE
|
target_link_libraries(physics PRIVATE
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
model
|
model
|
||||||
|
module
|
||||||
rtperformance
|
rtperformance
|
||||||
sndlib
|
sndlib
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(physics PUBLIC
|
target_include_directories(physics PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -35,10 +35,11 @@ target_include_directories(renderer PRIVATE ${GENERATED_HEADERS})
|
|||||||
target_link_libraries(renderer PRIVATE
|
target_link_libraries(renderer PRIVATE
|
||||||
glm::glm
|
glm::glm
|
||||||
SDL2::SDL2
|
SDL2::SDL2
|
||||||
plog::plog
|
|
||||||
bitmap
|
bitmap
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
rtperformance
|
rtperformance
|
||||||
)
|
)
|
||||||
|
@ -6,7 +6,7 @@ set(CPPS
|
|||||||
add_library(rtperformance STATIC ${HEADERS} ${CPPS})
|
add_library(rtperformance STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(rtperformance PRIVATE
|
target_link_libraries(rtperformance PRIVATE
|
||||||
ddio
|
ddio
|
||||||
plog::plog
|
logger
|
||||||
)
|
)
|
||||||
target_include_directories(rtperformance PUBLIC
|
target_include_directories(rtperformance PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -85,6 +85,7 @@ foreach(SCRIPT ${SCRIPTS})
|
|||||||
dallas
|
dallas
|
||||||
fix
|
fix
|
||||||
misc
|
misc
|
||||||
|
module
|
||||||
)
|
)
|
||||||
set_target_properties(${SCRIPT} PROPERTIES PREFIX "")
|
set_target_properties(${SCRIPT} PROPERTIES PREFIX "")
|
||||||
set_target_properties(${SCRIPT} PROPERTIES CXX_VISIBILITY_PRESET "hidden")
|
set_target_properties(${SCRIPT} PROPERTIES CXX_VISIBILITY_PRESET "hidden")
|
||||||
|
@ -21,12 +21,12 @@ add_library(sndlib STATIC ${HEADERS} ${CPPS})
|
|||||||
target_link_libraries(sndlib PRIVATE
|
target_link_libraries(sndlib PRIVATE
|
||||||
cfile
|
cfile
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
stream_audio
|
stream_audio
|
||||||
physics
|
physics
|
||||||
SDL2::SDL2
|
SDL2::SDL2
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(sndlib PUBLIC
|
target_include_directories(sndlib PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -8,10 +8,10 @@ set(CPPS
|
|||||||
add_library(stream_audio STATIC ${HEADERS} ${CPPS})
|
add_library(stream_audio STATIC ${HEADERS} ${CPPS})
|
||||||
target_link_libraries(stream_audio PRIVATE
|
target_link_libraries(stream_audio PRIVATE
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
sndlib
|
sndlib
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_link_libraries(stream_audio PUBLIC
|
target_link_libraries(stream_audio PUBLIC
|
||||||
AudioEncode
|
AudioEncode
|
||||||
|
@ -26,9 +26,9 @@ add_library(ui STATIC ${HEADERS} ${CPPS})
|
|||||||
target_link_libraries(ui PRIVATE
|
target_link_libraries(ui PRIVATE
|
||||||
ddio
|
ddio
|
||||||
grtext
|
grtext
|
||||||
|
logger
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
target_include_directories(ui PUBLIC
|
target_include_directories(ui PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -11,6 +11,6 @@ target_compile_definitions(win32 PRIVATE DX_APP)
|
|||||||
target_link_libraries(win32 PRIVATE
|
target_link_libraries(win32 PRIVATE
|
||||||
ddebug
|
ddebug
|
||||||
ddio
|
ddio
|
||||||
|
logger
|
||||||
misc
|
misc
|
||||||
plog::plog
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user