mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
吸出しスレッドのResultをチェックするように HeapManagerの挙動変更。コンストラクタでAllocateしてデストラクタでFreeするように。 PlayHistoryManagerの削除 git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@358 385bec56-5757-e545-9c3a-d8741f4650f1
146 lines
5.5 KiB
C++
146 lines
5.5 KiB
C++
/*---------------------------------------------------------------------------*
|
|
Project: Horizon
|
|
File: CommonLogger.h
|
|
|
|
Copyright 2009 Nintendo. All rights reserved.
|
|
|
|
These coded instructions, statements, and computer programs contain
|
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
|
Company Ltd., and are protected by Federal copyright law. They may
|
|
not be disclosed to third parties or copied or duplicated in any form,
|
|
in whole or in part, without the prior written consent of Nintendo.
|
|
|
|
$Rev$
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
#ifndef COMMONLOGGER_H_
|
|
#define COMMONLOGGER_H_
|
|
|
|
#include <nn.h>
|
|
#include "demo.h"
|
|
|
|
#include "SdLogger.h"
|
|
|
|
#define COMMON_LOGGER( ... ) (void)common::Logger::GetLoggerInstance()->Print(__VA_ARGS__)
|
|
#define COMMON_LOGGER_RESULT(result, func) \
|
|
NN_DBG_PRINT_RESULT(result); \
|
|
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Func = %s\n", func); \
|
|
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Result = %X\n", result.GetPrintableBits()); \
|
|
|
|
#ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
#define COMMON_LOGGER_DEBUG( ... ) COMMON_LOGGER(__VA_ARGS__)
|
|
#else // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
#define COMMON_LOGGER_DEBUG( ... ) ((void)0)
|
|
#endif // ifndef NN_SWITCH_DISABLE_DEBUG_PRINT else
|
|
|
|
#ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
#ifdef COMMON_LOGGER_DETAIL_ENABLE
|
|
#define COMMON_LOGGER_DETAIL(...) COMMON_LOGGER(__VA_ARGS__)
|
|
#else
|
|
#define COMMON_LOGGER_DETAIL( ... ) ((void)0)
|
|
#endif
|
|
#else
|
|
#define COMMON_LOGGER_DETAIL( ... ) ((void)0)
|
|
#endif
|
|
|
|
|
|
#define COMMON_LOGGER_RESULT_WITH_LINE(result, line, func) \
|
|
NN_LOG("%s\n", func); \
|
|
NN_LOG("%d\n", line); \
|
|
NN_DBG_PRINT_RESULT(result); \
|
|
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Func = %s\n", func); \
|
|
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("line = %d\n", line); \
|
|
(void)common::Logger::GetLoggerInstance()->PrintResultSdLog("Result = %X\n", result.GetPrintableBits()); \
|
|
|
|
#define COMMON_LOGGER_RESULT_IF_FAILED(result) \
|
|
if(result.IsFailure()) \
|
|
{ \
|
|
COMMON_LOGGER_RESULT(result, __func__); \
|
|
} \
|
|
|
|
#define COMMON_LOGGER_RESULT_IF_FAILED_WITH_LINE(result) \
|
|
if(result.IsFailure()) \
|
|
{ \
|
|
COMMON_LOGGER_RESULT_WITH_LINE(result, __LINE__, __func__); \
|
|
} \
|
|
|
|
#define COMMON_LOGGER_RETURN_RESULT_IF_FAILED(result) \
|
|
if(result.IsFailure()) \
|
|
{ \
|
|
COMMON_LOGGER_RESULT_WITH_LINE(result, __LINE__, __func__); \
|
|
return result; \
|
|
} \
|
|
|
|
#define COMMON_LOGGER_RETURN_FALSE_IF_FAILED(result) \
|
|
if(result.IsFailure()) \
|
|
{ \
|
|
COMMON_LOGGER_RESULT_WITH_LINE(result, __LINE__, __func__); \
|
|
return false; \
|
|
} \
|
|
|
|
#define COMMON_LOGGER_RETURN_VOID_IF_FAILED(result) \
|
|
if(result.IsFailure()) \
|
|
{ \
|
|
COMMON_LOGGER_RESULT_WITH_LINE(result, __LINE__, __func__); \
|
|
return; \
|
|
} \
|
|
|
|
#define COMMON_LOGGER_RETURN_VOID_SET_BOOL_IF_FAILED(result, setbool) \
|
|
if(result.IsFailure()) \
|
|
{ \
|
|
COMMON_LOGGER_RESULT_WITH_LINE(result, __LINE__, __func__); \
|
|
setbool = false; \
|
|
return; \
|
|
} \
|
|
|
|
namespace common
|
|
{
|
|
|
|
namespace Logger
|
|
{
|
|
|
|
// SDカードのログと下画面ログを同時に扱うためのクラス
|
|
class CommonLogger
|
|
{
|
|
public:
|
|
CommonLogger();
|
|
~CommonLogger();
|
|
|
|
void Initialize(u32 width, u32 height, u32 maxLine, demo::RenderSystemDrawing* renderSystem);
|
|
void Finalize();
|
|
|
|
// SDログに書き込み、下画面ログ出力のためのバッファに溜め込む
|
|
void Print(const char* fmt, ...);
|
|
|
|
// SDログのみにResult値を出力する
|
|
void PrintResultSdLog(const char* fmt, ...);
|
|
|
|
// SDカードのログファイルを消去する
|
|
void ClearSdLog();
|
|
|
|
// 下画面ログを上スクロールする
|
|
void ScrollUp();
|
|
|
|
// 下画面ログを下スクロールする
|
|
void ScrollDown();
|
|
|
|
// 下画面ログの先頭にスクロールする
|
|
void ScrollToBegin();
|
|
|
|
// 下画面ログの末尾にスクロールする
|
|
void ScrollToEnd();
|
|
|
|
// バッファに溜め込まれた文字列を下画面ログに書き込む
|
|
void DrawConsole();
|
|
private:
|
|
nn::os::CriticalSection m_CriticalSection;
|
|
};
|
|
|
|
CommonLogger* GetLoggerInstance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* COMMONLOGGER_H_ */
|