Common: Clang format PS2Ext.h

This commit is contained in:
TheLastRar 2021-02-08 21:21:39 +00:00 committed by refractionpcsx2
parent a37e62337d
commit e883e93f52
1 changed files with 204 additions and 193 deletions

View File

@ -50,14 +50,15 @@
//#include "PS2Edefs.h"
#if !defined(_MSC_VER) || !defined(UNICODE)
static void SysMessage(const char *fmt, ...);
static void __forceinline PluginNullConfigure(std::string desc, s32 &log);
static void SysMessage(const char* fmt, ...);
static void __forceinline PluginNullConfigure(std::string desc, s32& log);
#else
static void SysMessage(const wchar_t *fmt, ...);
static void __forceinline PluginNullConfigure(std::wstring desc, s32 &log);
static void SysMessage(const wchar_t* fmt, ...);
static void __forceinline PluginNullConfigure(std::wstring desc, s32& log);
#endif
enum FileMode {
enum FileMode
{
READ_FILE = 0,
WRITE_FILE
};
@ -65,13 +66,14 @@ enum FileMode {
struct PluginLog
{
bool WriteToFile, WriteToConsole;
FILE *LogFile;
FILE* LogFile;
bool Open(std::string logname)
{
LogFile = px_fopen(logname, "w");
if (LogFile) {
if (LogFile)
{
setvbuf(LogFile, NULL, _IONBF, 0);
return true;
}
@ -80,43 +82,48 @@ struct PluginLog
void Close()
{
if (LogFile) {
if (LogFile)
{
fclose(LogFile);
LogFile = NULL;
}
}
void Write(const char *fmt, ...)
void Write(const char* fmt, ...)
{
if (LogFile == NULL)
return;
va_list list;
if (WriteToFile) {
if (WriteToFile)
{
va_start(list, fmt);
vfprintf(LogFile, fmt, list);
va_end(list);
}
if (WriteToConsole) {
if (WriteToConsole)
{
va_start(list, fmt);
vfprintf(stdout, fmt, list);
va_end(list);
}
}
void WriteLn(const char *fmt, ...)
void WriteLn(const char* fmt, ...)
{
if (LogFile == NULL)
return;
va_list list;
if (WriteToFile) {
if (WriteToFile)
{
va_start(list, fmt);
vfprintf(LogFile, fmt, list);
va_end(list);
fprintf(LogFile, "\n");
}
if (WriteToConsole) {
if (WriteToConsole)
{
va_start(list, fmt);
vfprintf(stdout, fmt, list);
va_end(list);
@ -125,7 +132,7 @@ struct PluginLog
}
#if !defined(_MSC_VER) || !defined(UNICODE)
void Message(const char *fmt, ...)
void Message(const char* fmt, ...)
{
va_list list;
char buf[256];
@ -140,7 +147,7 @@ struct PluginLog
SysMessage(buf);
}
#else
void Message(const wchar_t *fmt, ...)
void Message(const wchar_t* fmt, ...)
{
va_list list;
wchar_t buf[256];
@ -159,14 +166,17 @@ struct PluginLog
struct PluginConf
{
FILE *ConfFile;
char *PluginName;
FILE* ConfFile;
char* PluginName;
bool Open(std::string name, FileMode mode = READ_FILE)
{
if (mode == READ_FILE) {
if (mode == READ_FILE)
{
ConfFile = px_fopen(name, "r");
} else {
}
else
{
ConfFile = px_fopen(name, "w");
}
@ -178,13 +188,14 @@ struct PluginConf
void Close()
{
if (ConfFile) {
if (ConfFile)
{
fclose(ConfFile);
ConfFile = NULL;
}
}
int ReadInt(const std::string &item, int defval)
int ReadInt(const std::string& item, int defval)
{
int value = defval;
std::string buf = item + " = %d\n";
@ -206,7 +217,7 @@ struct PluginConf
};
#if defined(__unix__)
static void SysMessage(const char *fmt, ...)
static void SysMessage(const char* fmt, ...)
{
va_list list;
char msg[512];
@ -250,7 +261,7 @@ static void SysMessage(const char *fmt, ...)
#elif defined(__WXMAC__) || defined(__APPLE__)
static void SysMessage(const char *fmt, ...)
static void SysMessage(const char* fmt, ...)
{
va_list list;
char msg[512];
@ -265,7 +276,7 @@ static void SysMessage(const char *fmt, ...)
// TODO OSX can we use WX MessageBox here or should Cocoa MessageBox used?
}
static void SysMessage(const wchar_t *fmt, ...)
static void SysMessage(const wchar_t* fmt, ...)
{
va_list list;
wchar_t msg[512];
@ -277,7 +288,7 @@ static void SysMessage(const wchar_t *fmt, ...)
// TODO OSX can we use WX MessageBox here or should Cocoa MessageBox used?
}
static void __forceinline PluginNullConfigure(std::string desc, int &log)
static void __forceinline PluginNullConfigure(std::string desc, int& log)
{
SysMessage("This space is intentionally left blank.");
}
@ -291,7 +302,7 @@ static void __forceinline PluginNullConfigure(std::string desc, int &log)
#ifndef UNICODE
static void __forceinline SysMessage(const char *fmt, ...)
static void __forceinline SysMessage(const char* fmt, ...)
{
va_list list;
char tmp[512];
@ -301,7 +312,7 @@ static void __forceinline SysMessage(const char *fmt, ...)
MessageBox(GetActiveWindow(), tmp, "Message", MB_SETFOREGROUND | MB_OK);
}
static void __forceinline PluginNullConfigure(std::string desc, s32 &log)
static void __forceinline PluginNullConfigure(std::string desc, s32& log)
{
/* To do: Write a dialog box that displays a dialog box with the text in desc,
and a check box that says "Logging", checked if log !=0, and set log to
@ -311,7 +322,7 @@ static void __forceinline PluginNullConfigure(std::string desc, s32 &log)
#else
static void __forceinline SysMessage(const wchar_t *fmt, ...)
static void __forceinline SysMessage(const wchar_t* fmt, ...)
{
va_list list;
wchar_t tmp[512];
@ -321,7 +332,7 @@ static void __forceinline SysMessage(const wchar_t *fmt, ...)
MessageBox(GetActiveWindow(), tmp, L"Message", MB_SETFOREGROUND | MB_OK);
}
static void __forceinline PluginNullConfigure(std::string desc, s32 &log)
static void __forceinline PluginNullConfigure(std::string desc, s32& log)
{
/* To do: Write a dialog box that displays a dialog box with the text in desc,
and a check box that says "Logging", checked if log !=0, and set log to