mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix build of ZimTool/AtlasTool. Had to break the ugly backwards dependency from LogManager to g_Config.
This commit is contained in:
parent
80e0f85332
commit
3c412ea21e
10 changed files with 29 additions and 31 deletions
|
@ -21,16 +21,18 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "util/text/utf8.h"
|
||||
#include "LogManager.h"
|
||||
#include "ConsoleListener.h"
|
||||
#include "Timer.h"
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/ConsoleListener.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
// Don't need to savestate this.
|
||||
const char *hleCurrentThreadName = nullptr;
|
||||
|
||||
bool *g_bLogEnabledSetting = nullptr;
|
||||
|
||||
static const char level_to_char[8] = "-NEWIDV";
|
||||
|
||||
#if PPSSPP_PLATFORM(UWP) && defined(_DEBUG)
|
||||
|
@ -40,7 +42,7 @@ static const char level_to_char[8] = "-NEWIDV";
|
|||
#endif
|
||||
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *file, int line, const char* fmt, ...) {
|
||||
if (!g_Config.bEnableLogging)
|
||||
if (g_bLogEnabledSetting && !(*g_bLogEnabledSetting))
|
||||
return;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
@ -56,7 +58,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char
|
|||
|
||||
bool GenericLogEnabled(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type) {
|
||||
if (LogManager::GetInstance())
|
||||
return g_Config.bEnableLogging && LogManager::GetInstance()->IsEnabled(level, type);
|
||||
return (*g_bLogEnabledSetting) && LogManager::GetInstance()->IsEnabled(level, type);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -116,7 +118,9 @@ static const LogNameTableEntry logTable[] = {
|
|||
{LogTypes::SCEMISC, "SCEMISC"},
|
||||
};
|
||||
|
||||
LogManager::LogManager() {
|
||||
LogManager::LogManager(bool *enabledSetting) {
|
||||
g_bLogEnabledSetting = enabledSetting;
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(logTable); i++) {
|
||||
_assert_msg_(i == logTable[i].logType, "Bad logtable at %i", (int)i);
|
||||
truncate_cpy(log_[logTable[i].logType].m_shortName, logTable[i].name);
|
||||
|
@ -271,8 +275,8 @@ bool LogManager::IsEnabled(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type)
|
|||
return true;
|
||||
}
|
||||
|
||||
void LogManager::Init() {
|
||||
logManager_ = new LogManager();
|
||||
void LogManager::Init(bool *enabledSetting) {
|
||||
logManager_ = new LogManager(enabledSetting);
|
||||
}
|
||||
|
||||
void LogManager::Shutdown() {
|
||||
|
|
|
@ -105,7 +105,7 @@ class ConsoleListener;
|
|||
|
||||
class LogManager {
|
||||
private:
|
||||
LogManager();
|
||||
LogManager(bool *enabledSetting);
|
||||
~LogManager();
|
||||
|
||||
// Prevent copies.
|
||||
|
@ -122,6 +122,7 @@ private:
|
|||
std::mutex log_lock_;
|
||||
std::mutex listeners_lock_;
|
||||
std::vector<LogListener*> listeners_;
|
||||
|
||||
public:
|
||||
void AddListener(LogListener *listener);
|
||||
void RemoveListener(LogListener *listener);
|
||||
|
@ -175,7 +176,7 @@ public:
|
|||
logManager_ = logManager;
|
||||
}
|
||||
|
||||
static void Init();
|
||||
static void Init(bool *enabledSetting);
|
||||
static void Shutdown();
|
||||
|
||||
void ChangeFileLog(const char *filename);
|
||||
|
|
|
@ -531,7 +531,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
|||
}
|
||||
|
||||
if (!LogManager::GetInstance())
|
||||
LogManager::Init();
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
#ifndef _WIN32
|
||||
g_Config.AddSearchPath(user_data_path);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Common/LogManager.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "Core/Config.h"
|
||||
#include "base/NativeApp.h"
|
||||
#include "base/timeutil.h"
|
||||
#include "input/input_state.h"
|
||||
|
@ -100,7 +101,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResourc
|
|||
// because the next place it was called was in the EmuThread, and it's too late by then.
|
||||
InitSysDirectories();
|
||||
|
||||
LogManager::Init();
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
// Load config up here, because those changes below would be overwritten
|
||||
// if it's not loaded here first.
|
||||
|
|
|
@ -509,7 +509,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
|||
}
|
||||
}
|
||||
|
||||
LogManager::Init();
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
// On Win32 it makes more sense to initialize the system directories here
|
||||
// because the next place it was called was in the EmuThread, and it's too late by then.
|
||||
|
|
|
@ -122,14 +122,3 @@ inline const char *removePath(const char *str) {
|
|||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef CHECK
|
||||
|
||||
#define CHECK(a) {if (!(a)) {FLOG("%i: CHECK failed on this line", __LINE__);}}
|
||||
#define CHECK_P(a, ...) {if (!(a)) {FLOG("CHECK failed: " __VA_ARGS__);}}
|
||||
#define CHECK_EQ(a, b) CHECK((a) == (b));
|
||||
#define CHECK_NE(a, b) CHECK((a) != (b));
|
||||
#define CHECK_GT(a, b) CHECK((a) > (b));
|
||||
#define CHECK_GE(a, b) CHECK((a) >= (b));
|
||||
#define CHECK_LT(a, b) CHECK((a) < (b));
|
||||
#define CHECK_LE(a, b) CHECK((a) <= (b));
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>../prebuilt/win64</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>winmm.lib;freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -97,6 +97,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>../../../../;../../ext;../../;../../../../ext;../prebuilt</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -104,7 +105,7 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>../prebuilt/win64</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>winmm.lib;freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -101,6 +102,7 @@
|
|||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -335,7 +335,7 @@ int main(int argc, const char* argv[])
|
|||
GraphicsContext *graphicsContext = nullptr;
|
||||
bool glWorking = host->InitGraphics(&error_string, &graphicsContext);
|
||||
|
||||
LogManager::Init();
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
LogManager *logman = LogManager::GetInstance();
|
||||
|
||||
PrintfLogger *printfLogger = new PrintfLogger();
|
||||
|
|
|
@ -358,7 +358,7 @@ void retro_init(void)
|
|||
g_Config.iFirmwareVersion = PSP_DEFAULT_FIRMWARE;
|
||||
g_Config.iPSPModel = PSP_MODEL_SLIM;
|
||||
|
||||
LogManager::Init();
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
host = new LibretroHost;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue