Remove the useless msg_handler compilation unit that was left over from Dolphin
This commit is contained in:
parent
ec8f2210e3
commit
5efd149ad5
|
@ -16,7 +16,6 @@ set(SRCS
|
|||
mem_arena.cpp
|
||||
memory_util.cpp
|
||||
misc.cpp
|
||||
msg_handler.cpp
|
||||
scm_rev.cpp
|
||||
string_util.cpp
|
||||
symbols.cpp
|
||||
|
@ -53,7 +52,6 @@ set(HEADERS
|
|||
math_util.h
|
||||
mem_arena.h
|
||||
memory_util.h
|
||||
msg_handler.h
|
||||
platform.h
|
||||
scm_rev.h
|
||||
scope_exit.h
|
||||
|
|
|
@ -637,7 +637,7 @@ public:
|
|||
Do(cookie);
|
||||
if(mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
|
||||
{
|
||||
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
|
||||
LOG_ERROR(Common, "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
|
||||
SetError(ERROR_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ private:
|
|||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/msg_handler.h"
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_paths.h"
|
||||
#include "common/platform.h"
|
||||
|
|
|
@ -218,7 +218,7 @@ u8* MemArena::Find4GBBase()
|
|||
void* base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_SHARED, -1, 0);
|
||||
if (base == MAP_FAILED) {
|
||||
PanicAlert("Failed to map 256 MB of memory space: %s", strerror(errno));
|
||||
LOG_ERROR(Common_Memory, "Failed to map 256 MB of memory space: %s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
munmap(base, 0x10000000);
|
||||
|
@ -338,7 +338,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
|
|||
// address space.
|
||||
if (!Memory_TryBase(base, views, num_views, flags, arena))
|
||||
{
|
||||
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
|
||||
LOG_ERROR(Common_Memory, "MemoryMap_Setup: Failed finding a memory base.");
|
||||
return 0;
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
|
@ -363,12 +363,11 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
|
|||
if (!Memory_TryBase(base, views, num_views, flags, arena))
|
||||
{
|
||||
LOG_ERROR(Common_Memory, "MemoryMap_Setup: Failed finding a memory base.");
|
||||
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (base_attempts)
|
||||
PanicAlert("No possible memory base pointer found!");
|
||||
LOG_ERROR(Common_Memory, "No possible memory base pointer found!");
|
||||
return base;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
|
|||
{
|
||||
ptr = nullptr;
|
||||
#endif
|
||||
PanicAlert("Failed to allocate executable memory");
|
||||
LOG_ERROR(Common_Memory, "Failed to allocate executable memory");
|
||||
}
|
||||
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
else
|
||||
|
@ -72,7 +72,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
|
|||
|
||||
#if defined(_M_X64)
|
||||
if ((u64)ptr >= 0x80000000 && low == true)
|
||||
PanicAlert("Executable memory ended up above 2GB!");
|
||||
LOG_ERROR(Common_Memory, "Executable memory ended up above 2GB!");
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
|
@ -94,7 +94,7 @@ void* AllocateMemoryPages(size_t size)
|
|||
// (unsigned long)size);
|
||||
|
||||
if (ptr == nullptr)
|
||||
PanicAlert("Failed to allocate raw memory");
|
||||
LOG_ERROR(Common_Memory, "Failed to allocate raw memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
|
|||
// (unsigned long)size);
|
||||
|
||||
if (ptr == nullptr)
|
||||
PanicAlert("Failed to allocate aligned memory");
|
||||
LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void FreeMemoryPages(void* ptr, size_t size)
|
|||
#ifdef _WIN32
|
||||
|
||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||
LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||
ptr = nullptr; // Is this our responsibility?
|
||||
|
||||
#else
|
||||
|
@ -155,7 +155,7 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
|||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
||||
PanicAlert("WriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
LOG_ERROR(Common_Memory, "WriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
#else
|
||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
||||
#endif
|
||||
|
@ -166,7 +166,7 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
|||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
|
||||
PanicAlert("UnWriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
#else
|
||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
||||
#endif
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "common/common.h" // Local
|
||||
#include "common/string_util.h"
|
||||
|
||||
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style);
|
||||
static MsgAlertHandler msg_handler = DefaultMsgHandler;
|
||||
static bool AlertEnabled = true;
|
||||
|
||||
std::string DefaultStringTranslator(const char* text);
|
||||
static StringTranslator str_translator = DefaultStringTranslator;
|
||||
|
||||
// Select which of these functions that are used for message boxes. If
|
||||
// wxWidgets is enabled we will use wxMsgAlert() that is defined in Main.cpp
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler)
|
||||
{
|
||||
msg_handler = handler;
|
||||
}
|
||||
|
||||
// Select translation function. For wxWidgets use wxStringTranslator in Main.cpp
|
||||
void RegisterStringTranslator(StringTranslator translator)
|
||||
{
|
||||
str_translator = translator;
|
||||
}
|
||||
|
||||
// enable/disable the alert handler
|
||||
void SetEnableAlert(bool enable)
|
||||
{
|
||||
AlertEnabled = enable;
|
||||
}
|
||||
|
||||
// This is the first stop for gui alerts where the log is updated and the
|
||||
// correct window is shown
|
||||
bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||
{
|
||||
// Read message and write it to the log
|
||||
std::string caption;
|
||||
char buffer[2048];
|
||||
|
||||
static std::string info_caption;
|
||||
static std::string warn_caption;
|
||||
static std::string ques_caption;
|
||||
static std::string crit_caption;
|
||||
|
||||
if (!info_caption.length())
|
||||
{
|
||||
info_caption = str_translator(_trans("Information"));
|
||||
ques_caption = str_translator(_trans("Question"));
|
||||
warn_caption = str_translator(_trans("Warning"));
|
||||
crit_caption = str_translator(_trans("Critical"));
|
||||
}
|
||||
|
||||
switch(Style)
|
||||
{
|
||||
case INFORMATION:
|
||||
caption = info_caption;
|
||||
break;
|
||||
case QUESTION:
|
||||
caption = ques_caption;
|
||||
break;
|
||||
case WARNING:
|
||||
caption = warn_caption;
|
||||
break;
|
||||
case CRITICAL:
|
||||
caption = crit_caption;
|
||||
break;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
LOG_INFO(Common, "%s: %s", caption.c_str(), buffer);
|
||||
|
||||
// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
|
||||
if (msg_handler && (AlertEnabled || Style == QUESTION || Style == CRITICAL))
|
||||
return msg_handler(caption.c_str(), buffer, yes_no, Style);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Default non library dependent panic alert
|
||||
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style)
|
||||
{
|
||||
//#ifdef _WIN32
|
||||
// int STYLE = MB_ICONINFORMATION;
|
||||
// if (Style == QUESTION) STYLE = MB_ICONQUESTION;
|
||||
// if (Style == WARNING) STYLE = MB_ICONWARNING;
|
||||
//
|
||||
// return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(), STYLE | (yes_no ? MB_YESNO : MB_OK));
|
||||
//#else
|
||||
printf("%s\n", text);
|
||||
return true;
|
||||
//#endif
|
||||
}
|
||||
|
||||
// Default (non) translator
|
||||
std::string DefaultStringTranslator(const char* text)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
// Message alerts
|
||||
enum MSG_TYPE
|
||||
{
|
||||
INFORMATION,
|
||||
QUESTION,
|
||||
WARNING,
|
||||
CRITICAL
|
||||
};
|
||||
|
||||
typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
|
||||
bool yes_no, int Style);
|
||||
typedef std::string (*StringTranslator)(const char* text);
|
||||
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler);
|
||||
void RegisterStringTranslator(StringTranslator translator);
|
||||
|
||||
extern bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
void SetEnableAlert(bool enable);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__)
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__)
|
||||
#else
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__)
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__)
|
||||
#endif
|
|
@ -147,7 +147,7 @@ void RestoreRegisterEvent(int event_type, const char* name, TimedCallback callba
|
|||
|
||||
void UnregisterAllEvents() {
|
||||
if (first)
|
||||
PanicAlert("Cannot unregister events with events pending");
|
||||
LOG_ERROR(Core_Timing, "Cannot unregister events with events pending");
|
||||
event_types.clear();
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ std::string GetScheduledEventsSummary() {
|
|||
while (event) {
|
||||
unsigned int t = event->type;
|
||||
if (t >= event_types.size())
|
||||
PanicAlert("Invalid event type"); // %i", t);
|
||||
LOG_ERROR(Core_Timing, "Invalid event type"); // %i", t);
|
||||
const char* name = event_types[event->type].name;
|
||||
if (!name)
|
||||
name = "[unknown]";
|
||||
|
|
Loading…
Reference in New Issue