CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/Log/ConsoleListener.h
Views: 1401
// Copyright (C) 2003 Dolphin Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official SVN repository and contact information can be found at15// http://code.google.com/p/dolphin-emu/1617#pragma once1819// Windows-only.2021#include "ppsspp_config.h"2223#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)2425#include <atomic>26#include <thread>2728#include "Common/Log/LogManager.h"29#include "Common/CommonWindows.h"3031class ConsoleListener : public LogListener {32public:33ConsoleListener();34~ConsoleListener();3536void Init(bool AutoOpen = true, int Width = 200, int Height = 100);37void Open();38void UpdateHandle();39void Close();40bool IsOpen();41void LetterSpace(int Width, int Height);42void BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst);43void PixelSpace(int Left, int Top, int Width, int Height, bool);44COORD GetCoordinates(int BytesRead, int BufferWidth);45void Log(const LogMessage &message) override;46void ClearScreen(bool Cursor = true);4748void Show(bool bShow);49bool Hidden() const { return hidden_; }5051private:52HWND hWnd = nullptr;53HANDLE hConsole = nullptr;5455void LogWriterThread();56void SendToThread(LogLevel Level, const char *Text);57void WriteToConsole(LogLevel Level, const char *Text, size_t Len);5859std::thread thread_;6061HANDLE hTriggerEvent = nullptr;62CRITICAL_SECTION criticalSection{};6364char *logPending_ = nullptr;65std::atomic<uint32_t> logPendingReadPos_;66std::atomic<uint32_t> logPendingWritePos_;6768int openWidth_ = 0;69int openHeight_ = 0;70bool hidden_ = false;71bool useColor_ = true;72bool useThread_ = true;73};7475#endif767778