mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
eol-style native update, small warning fix in EXI_Channel.h
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2591 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,116 +1,116 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef COMMONFUNCS_H
|
||||
#define COMMONFUNCS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SLEEP(x) Sleep(x)
|
||||
#else
|
||||
#define SLEEP(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#if defined __APPLE__
|
||||
char* strndup (char const *s, size_t n);
|
||||
size_t strnlen(const char *s, size_t n);
|
||||
#else
|
||||
#include <byteswap.h>
|
||||
#endif // APPLE
|
||||
#include <errno.h>
|
||||
// go to debugger mode
|
||||
#define Crash() {asm ("int $3");}
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
|
||||
inline u32 _rotr(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
}
|
||||
#define SLEEP(x) usleep(x*1000)
|
||||
#else // WIN32
|
||||
// Function Cross-Compatibility
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define unlink _unlink
|
||||
#define snprintf _snprintf
|
||||
char* strndup (char const *s, size_t n);
|
||||
|
||||
// 64 bit offsets for windows
|
||||
#define fseek _fseeki64
|
||||
#define ftell _ftelli64
|
||||
#define atoll _atoi64
|
||||
#define stat64 _stat64
|
||||
#define SLEEP(x) Sleep(x)
|
||||
|
||||
#if _M_IX86
|
||||
#define Crash() {__asm int 3}
|
||||
#else
|
||||
extern "C" {
|
||||
__declspec(dllimport) void __stdcall DebugBreak(void);
|
||||
}
|
||||
#define Crash() {DebugBreak();}
|
||||
#endif // M_IX86
|
||||
#endif // WIN32 ndef
|
||||
|
||||
// Dolphin's min and max functions
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
template<class T>
|
||||
inline T min(const T& a, const T& b) {return a > b ? b : a;}
|
||||
template<class T>
|
||||
inline T max(const T& a, const T& b) {return a > b ? a : b;}
|
||||
|
||||
// Generic function to get last error message.
|
||||
// Call directly after the command or use the error num.
|
||||
// This function might change the error code.
|
||||
// Defined in Misc.cpp.
|
||||
const char* GetLastErrorMsg();
|
||||
|
||||
namespace Common
|
||||
{
|
||||
inline u8 swap8(u8 _data) {return _data;}
|
||||
|
||||
#ifdef _WIN32
|
||||
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
|
||||
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
|
||||
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
|
||||
#elif __linux__
|
||||
inline u16 swap16(u16 _data) {return bswap_16(_data);}
|
||||
inline u32 swap32(u32 _data) {return bswap_32(_data);}
|
||||
inline u64 swap64(u64 _data) {return bswap_64(_data);}
|
||||
#else
|
||||
// Slow generic implementation.
|
||||
inline u16 swap16(u16 data) {return (data >> 8) | (data << 8);}
|
||||
inline u32 swap32(u32 data) {return (swap16(data) << 16) | swap16(data >> 16);}
|
||||
inline u64 swap64(u64 data) {return ((u64)swap32(data) << 32) | swap32(data >> 32);}
|
||||
#endif
|
||||
|
||||
inline u16 swap16(const u8* _pData) {return swap16(*(const u16*)_pData);}
|
||||
inline u32 swap32(const u8* _pData) {return swap32(*(const u32*)_pData);}
|
||||
inline u64 swap64(const u8* _pData) {return swap64(*(const u64*)_pData);}
|
||||
|
||||
} // namespace Common
|
||||
|
||||
#endif // COMMONFUNCS
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef COMMONFUNCS_H
|
||||
#define COMMONFUNCS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SLEEP(x) Sleep(x)
|
||||
#else
|
||||
#define SLEEP(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#if defined __APPLE__
|
||||
char* strndup (char const *s, size_t n);
|
||||
size_t strnlen(const char *s, size_t n);
|
||||
#else
|
||||
#include <byteswap.h>
|
||||
#endif // APPLE
|
||||
#include <errno.h>
|
||||
// go to debugger mode
|
||||
#define Crash() {asm ("int $3");}
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
|
||||
inline u32 _rotr(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
}
|
||||
#define SLEEP(x) usleep(x*1000)
|
||||
#else // WIN32
|
||||
// Function Cross-Compatibility
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define unlink _unlink
|
||||
#define snprintf _snprintf
|
||||
char* strndup (char const *s, size_t n);
|
||||
|
||||
// 64 bit offsets for windows
|
||||
#define fseek _fseeki64
|
||||
#define ftell _ftelli64
|
||||
#define atoll _atoi64
|
||||
#define stat64 _stat64
|
||||
#define SLEEP(x) Sleep(x)
|
||||
|
||||
#if _M_IX86
|
||||
#define Crash() {__asm int 3}
|
||||
#else
|
||||
extern "C" {
|
||||
__declspec(dllimport) void __stdcall DebugBreak(void);
|
||||
}
|
||||
#define Crash() {DebugBreak();}
|
||||
#endif // M_IX86
|
||||
#endif // WIN32 ndef
|
||||
|
||||
// Dolphin's min and max functions
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
template<class T>
|
||||
inline T min(const T& a, const T& b) {return a > b ? b : a;}
|
||||
template<class T>
|
||||
inline T max(const T& a, const T& b) {return a > b ? a : b;}
|
||||
|
||||
// Generic function to get last error message.
|
||||
// Call directly after the command or use the error num.
|
||||
// This function might change the error code.
|
||||
// Defined in Misc.cpp.
|
||||
const char* GetLastErrorMsg();
|
||||
|
||||
namespace Common
|
||||
{
|
||||
inline u8 swap8(u8 _data) {return _data;}
|
||||
|
||||
#ifdef _WIN32
|
||||
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
|
||||
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
|
||||
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
|
||||
#elif __linux__
|
||||
inline u16 swap16(u16 _data) {return bswap_16(_data);}
|
||||
inline u32 swap32(u32 _data) {return bswap_32(_data);}
|
||||
inline u64 swap64(u64 _data) {return bswap_64(_data);}
|
||||
#else
|
||||
// Slow generic implementation.
|
||||
inline u16 swap16(u16 data) {return (data >> 8) | (data << 8);}
|
||||
inline u32 swap32(u32 data) {return (swap16(data) << 16) | swap16(data >> 16);}
|
||||
inline u64 swap64(u64 data) {return ((u64)swap32(data) << 32) | swap32(data >> 32);}
|
||||
#endif
|
||||
|
||||
inline u16 swap16(const u8* _pData) {return swap16(*(const u16*)_pData);}
|
||||
inline u32 swap32(const u8* _pData) {return swap32(*(const u32*)_pData);}
|
||||
inline u64 swap64(const u8* _pData) {return swap64(*(const u64*)_pData);}
|
||||
|
||||
} // namespace Common
|
||||
|
||||
#endif // COMMONFUNCS
|
||||
|
@ -1,163 +1,163 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef COMMON_PATHS_H
|
||||
#define COMMON_PATHS_H
|
||||
|
||||
// Library suffix/prefix
|
||||
#ifdef _WIN32
|
||||
#define PLUGIN_PREFIX ""
|
||||
#define PLUGIN_SUFFIX ".dll"
|
||||
#elif defined __APPLE__
|
||||
#define PLUGIN_PREFIX "lib"
|
||||
#define PLUGIN_SUFFIX ".dylib"
|
||||
#else
|
||||
#define PLUGIN_PREFIX "lib"
|
||||
#define PLUGIN_SUFFIX ".so"
|
||||
#endif
|
||||
|
||||
// Directory seperators, do we need this?
|
||||
#define DIR_SEP "/"
|
||||
#define DIR_SEP_CHR '/'
|
||||
|
||||
#if defined __APPLE__
|
||||
#define PLUGINS_DIR "Contents/PlugIns"
|
||||
#else
|
||||
#define PLUGINS_DIR "Plugins"
|
||||
#endif
|
||||
#define ROOT_DIR "."
|
||||
#define USERDATA_DIR "User"
|
||||
#define SYSDATA_DIR "Sys"
|
||||
|
||||
// Where data directory is
|
||||
#ifdef _WIN32
|
||||
#define DOLPHIN_DATA_DIR "Dolphin"
|
||||
#elif defined __APPLE__
|
||||
#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin"
|
||||
#else
|
||||
#define DOLPHIN_DATA_DIR ".dolphin"
|
||||
#endif
|
||||
|
||||
// Dirs in both User and Sys
|
||||
#define EUR_DIR "EUR"
|
||||
#define USA_DIR "USA"
|
||||
#define JAP_DIR "JAP"
|
||||
|
||||
// Dirs in User
|
||||
#define GC_USER_DIR "GC"
|
||||
#define WII_USER_DIR "Wii"
|
||||
#define WII_SYSCONF_DIR "shared2/sys"
|
||||
#define CONFIG_DIR "Config"
|
||||
#define GAMECONFIG_DIR "GameConfig"
|
||||
#define MAPS_DIR "Maps"
|
||||
#define CACHE_DIR "Cache"
|
||||
#define STATESAVES_DIR "StateSaves"
|
||||
#define SCREENSHOTS_DIR "ScreenShots"
|
||||
#define DUMP_DIR "Dump"
|
||||
#define LOGS_DIR "Logs"
|
||||
#define MAIL_LOGS_DIR "Mail"
|
||||
|
||||
// Dirs in Sys
|
||||
#define GC_SYS_DIR "GC"
|
||||
#define WII_SYS_DIR "Wii"
|
||||
|
||||
// Filenames
|
||||
#define DOLPHIN_CONFIG "Dolphin.ini"
|
||||
#define DEBUGGER_CONFIG "Debugger.ini"
|
||||
#define LOGGER_CONFIG "Logger.ini"
|
||||
#define TOTALDB "totaldb.dsy"
|
||||
|
||||
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
|
||||
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
|
||||
#define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_PadSimple" PLUGIN_SUFFIX
|
||||
#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX
|
||||
|
||||
#define FONT_ANSI "font_ansi.bin"
|
||||
#define FONT_SJIS "font_sjis.bin"
|
||||
|
||||
#define DSP_ROM "dsp_rom.bin"
|
||||
#define DSP_COEF "dsp_coef.bin"
|
||||
|
||||
#define GC_IPL "IPL.bin"
|
||||
#define GC_SRAM "SRAM.raw"
|
||||
#define GC_MEMCARDA "MemoryCardA"
|
||||
#define GC_MEMCARDB "MemoryCardB"
|
||||
|
||||
#define WII_EUR_SETTING "setting-eur.txt"
|
||||
#define WII_USA_SETTING "setting-usa.txt"
|
||||
#define WII_JAP_SETTING "setting-jpn.txt"
|
||||
#define WII_SYSCONF "SYSCONF"
|
||||
|
||||
#define MEMORY_DUMP_FILE "mainram.dump"
|
||||
|
||||
// Shorts - dirs
|
||||
// User dirs
|
||||
#define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
|
||||
|
||||
#define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP
|
||||
//#define GC_USER_EUR_DIR FULL_GC_USER_DIR EUR_DIR
|
||||
//#define GC_USER_USA_DIR FULL_GC_USER_DIR USA_DIR
|
||||
//#define GC_USER_JAP_DIR FULL_GC_USER_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
|
||||
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
|
||||
|
||||
#define FULL_GAMECONFIG_DIR FULL_USERDATA_DIR GAMECONFIG_DIR DIR_SEP
|
||||
#define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
|
||||
#define FULL_CACHE_DIR FULL_USERDATA_DIR CACHE_DIR DIR_SEP
|
||||
#define FULL_STATESAVES_DIR FULL_USERDATA_DIR STATESAVES_DIR DIR_SEP
|
||||
#define FULL_SCREENSHOTS_DIR FULL_USERDATA_DIR SCREENSHOTS_DIR DIR_SEP
|
||||
#define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP
|
||||
#define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP
|
||||
#define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP
|
||||
#define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP
|
||||
|
||||
// Sys dirs
|
||||
#define FULL_SYSDATA_DIR ROOT_DIR DIR_SEP SYSDATA_DIR DIR_SEP
|
||||
|
||||
#define FULL_GC_SYS_DIR FULL_SYSDATA_DIR GC_SYS_DIR DIR_SEP
|
||||
//#define GC_SYS_EUR_DIR FULL_GC_SYS_DIR EUR_DIR
|
||||
//#define GC_SYS_USA_DIR FULL_GC_SYS_DIR USA_DIR
|
||||
//#define GC_SYS_JAP_DIR FULL_GC_SYS_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_SYS_DIR FULL_SYSDATA_DIR WII_SYS_DIR DIR_SEP
|
||||
|
||||
// Shorts - files
|
||||
// User files
|
||||
#define CONFIG_FILE FULL_CONFIG_DIR DOLPHIN_CONFIG
|
||||
#define DEBUGGER_CONFIG_FILE FULL_CONFIG_DIR DEBUGGER_CONFIG
|
||||
#define LOGGER_CONFIG_FILE FULL_CONFIG_DIR LOGGER_CONFIG
|
||||
|
||||
#define TOTALDB_FILE FULL_SYSDATA_DIR TOTALDB
|
||||
#define MAINRAM_DUMP_FILE FULL_DUMP_DIR MEMORY_DUMP_FILE
|
||||
#define GC_SRAM_FILE FULL_USERDATA_DIR GC_USER_DIR DIR_SEP GC_SRAM
|
||||
|
||||
// Sys files
|
||||
#define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI
|
||||
#define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS
|
||||
|
||||
#define DSP_ROM_FILE FULL_GC_SYS_DIR DSP_ROM
|
||||
#define DSP_COEF_FILE FULL_GC_SYS_DIR DSP_COEF
|
||||
|
||||
#define WII_EUR_SETTING_FILE FULL_WII_SYS_DIR WII_EUR_SETTING
|
||||
#define WII_USA_SETTING_FILE FULL_WII_SYS_DIR WII_USA_SETTING
|
||||
#define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING
|
||||
#define WII_SYSCONF_FILE FULL_WII_USER_DIR WII_SYSCONF_DIR DIR_SEP WII_SYSCONF
|
||||
|
||||
#define FULL_WII_MENU_DIR FULL_WII_USER_DIR "title" DIR_SEP "00000001" DIR_SEP "00000002" DIR_SEP "content"
|
||||
|
||||
#endif // COMMON_PATHS_H
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef COMMON_PATHS_H
|
||||
#define COMMON_PATHS_H
|
||||
|
||||
// Library suffix/prefix
|
||||
#ifdef _WIN32
|
||||
#define PLUGIN_PREFIX ""
|
||||
#define PLUGIN_SUFFIX ".dll"
|
||||
#elif defined __APPLE__
|
||||
#define PLUGIN_PREFIX "lib"
|
||||
#define PLUGIN_SUFFIX ".dylib"
|
||||
#else
|
||||
#define PLUGIN_PREFIX "lib"
|
||||
#define PLUGIN_SUFFIX ".so"
|
||||
#endif
|
||||
|
||||
// Directory seperators, do we need this?
|
||||
#define DIR_SEP "/"
|
||||
#define DIR_SEP_CHR '/'
|
||||
|
||||
#if defined __APPLE__
|
||||
#define PLUGINS_DIR "Contents/PlugIns"
|
||||
#else
|
||||
#define PLUGINS_DIR "Plugins"
|
||||
#endif
|
||||
#define ROOT_DIR "."
|
||||
#define USERDATA_DIR "User"
|
||||
#define SYSDATA_DIR "Sys"
|
||||
|
||||
// Where data directory is
|
||||
#ifdef _WIN32
|
||||
#define DOLPHIN_DATA_DIR "Dolphin"
|
||||
#elif defined __APPLE__
|
||||
#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin"
|
||||
#else
|
||||
#define DOLPHIN_DATA_DIR ".dolphin"
|
||||
#endif
|
||||
|
||||
// Dirs in both User and Sys
|
||||
#define EUR_DIR "EUR"
|
||||
#define USA_DIR "USA"
|
||||
#define JAP_DIR "JAP"
|
||||
|
||||
// Dirs in User
|
||||
#define GC_USER_DIR "GC"
|
||||
#define WII_USER_DIR "Wii"
|
||||
#define WII_SYSCONF_DIR "shared2/sys"
|
||||
#define CONFIG_DIR "Config"
|
||||
#define GAMECONFIG_DIR "GameConfig"
|
||||
#define MAPS_DIR "Maps"
|
||||
#define CACHE_DIR "Cache"
|
||||
#define STATESAVES_DIR "StateSaves"
|
||||
#define SCREENSHOTS_DIR "ScreenShots"
|
||||
#define DUMP_DIR "Dump"
|
||||
#define LOGS_DIR "Logs"
|
||||
#define MAIL_LOGS_DIR "Mail"
|
||||
|
||||
// Dirs in Sys
|
||||
#define GC_SYS_DIR "GC"
|
||||
#define WII_SYS_DIR "Wii"
|
||||
|
||||
// Filenames
|
||||
#define DOLPHIN_CONFIG "Dolphin.ini"
|
||||
#define DEBUGGER_CONFIG "Debugger.ini"
|
||||
#define LOGGER_CONFIG "Logger.ini"
|
||||
#define TOTALDB "totaldb.dsy"
|
||||
|
||||
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
|
||||
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
|
||||
#define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_PadSimple" PLUGIN_SUFFIX
|
||||
#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX
|
||||
|
||||
#define FONT_ANSI "font_ansi.bin"
|
||||
#define FONT_SJIS "font_sjis.bin"
|
||||
|
||||
#define DSP_ROM "dsp_rom.bin"
|
||||
#define DSP_COEF "dsp_coef.bin"
|
||||
|
||||
#define GC_IPL "IPL.bin"
|
||||
#define GC_SRAM "SRAM.raw"
|
||||
#define GC_MEMCARDA "MemoryCardA"
|
||||
#define GC_MEMCARDB "MemoryCardB"
|
||||
|
||||
#define WII_EUR_SETTING "setting-eur.txt"
|
||||
#define WII_USA_SETTING "setting-usa.txt"
|
||||
#define WII_JAP_SETTING "setting-jpn.txt"
|
||||
#define WII_SYSCONF "SYSCONF"
|
||||
|
||||
#define MEMORY_DUMP_FILE "mainram.dump"
|
||||
|
||||
// Shorts - dirs
|
||||
// User dirs
|
||||
#define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
|
||||
|
||||
#define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP
|
||||
//#define GC_USER_EUR_DIR FULL_GC_USER_DIR EUR_DIR
|
||||
//#define GC_USER_USA_DIR FULL_GC_USER_DIR USA_DIR
|
||||
//#define GC_USER_JAP_DIR FULL_GC_USER_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
|
||||
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
|
||||
|
||||
#define FULL_GAMECONFIG_DIR FULL_USERDATA_DIR GAMECONFIG_DIR DIR_SEP
|
||||
#define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
|
||||
#define FULL_CACHE_DIR FULL_USERDATA_DIR CACHE_DIR DIR_SEP
|
||||
#define FULL_STATESAVES_DIR FULL_USERDATA_DIR STATESAVES_DIR DIR_SEP
|
||||
#define FULL_SCREENSHOTS_DIR FULL_USERDATA_DIR SCREENSHOTS_DIR DIR_SEP
|
||||
#define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP
|
||||
#define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP
|
||||
#define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP
|
||||
#define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP
|
||||
|
||||
// Sys dirs
|
||||
#define FULL_SYSDATA_DIR ROOT_DIR DIR_SEP SYSDATA_DIR DIR_SEP
|
||||
|
||||
#define FULL_GC_SYS_DIR FULL_SYSDATA_DIR GC_SYS_DIR DIR_SEP
|
||||
//#define GC_SYS_EUR_DIR FULL_GC_SYS_DIR EUR_DIR
|
||||
//#define GC_SYS_USA_DIR FULL_GC_SYS_DIR USA_DIR
|
||||
//#define GC_SYS_JAP_DIR FULL_GC_SYS_DIR JAP_DIR
|
||||
|
||||
#define FULL_WII_SYS_DIR FULL_SYSDATA_DIR WII_SYS_DIR DIR_SEP
|
||||
|
||||
// Shorts - files
|
||||
// User files
|
||||
#define CONFIG_FILE FULL_CONFIG_DIR DOLPHIN_CONFIG
|
||||
#define DEBUGGER_CONFIG_FILE FULL_CONFIG_DIR DEBUGGER_CONFIG
|
||||
#define LOGGER_CONFIG_FILE FULL_CONFIG_DIR LOGGER_CONFIG
|
||||
|
||||
#define TOTALDB_FILE FULL_SYSDATA_DIR TOTALDB
|
||||
#define MAINRAM_DUMP_FILE FULL_DUMP_DIR MEMORY_DUMP_FILE
|
||||
#define GC_SRAM_FILE FULL_USERDATA_DIR GC_USER_DIR DIR_SEP GC_SRAM
|
||||
|
||||
// Sys files
|
||||
#define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI
|
||||
#define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS
|
||||
|
||||
#define DSP_ROM_FILE FULL_GC_SYS_DIR DSP_ROM
|
||||
#define DSP_COEF_FILE FULL_GC_SYS_DIR DSP_COEF
|
||||
|
||||
#define WII_EUR_SETTING_FILE FULL_WII_SYS_DIR WII_EUR_SETTING
|
||||
#define WII_USA_SETTING_FILE FULL_WII_SYS_DIR WII_USA_SETTING
|
||||
#define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING
|
||||
#define WII_SYSCONF_FILE FULL_WII_USER_DIR WII_SYSCONF_DIR DIR_SEP WII_SYSCONF
|
||||
|
||||
#define FULL_WII_MENU_DIR FULL_WII_USER_DIR "title" DIR_SEP "00000001" DIR_SEP "00000002" DIR_SEP "content"
|
||||
|
||||
#endif // COMMON_PATHS_H
|
||||
|
@ -1,58 +1,58 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
// This header contains type definitions that are shared between the Dolphin
|
||||
// core and the plugin specs. Any definitions that are only used by the core
|
||||
// should be placed in "Common.h" instead.
|
||||
|
||||
#ifndef _COMMONTYPES_H
|
||||
#define _COMMONTYPES_H
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
typedef unsigned __int8 u8;
|
||||
typedef unsigned __int16 u16;
|
||||
typedef unsigned __int32 u32;
|
||||
typedef unsigned __int64 u64;
|
||||
|
||||
typedef signed __int8 s8;
|
||||
typedef signed __int16 s16;
|
||||
typedef signed __int32 s32;
|
||||
typedef signed __int64 s64;
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
typedef char s8;
|
||||
typedef short s16;
|
||||
typedef int s32;
|
||||
typedef long long s64;
|
||||
|
||||
// For using windows lock code
|
||||
#define TCHAR char
|
||||
#define LONG int
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // _COMMONTYPES_H
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
// This header contains type definitions that are shared between the Dolphin
|
||||
// core and the plugin specs. Any definitions that are only used by the core
|
||||
// should be placed in "Common.h" instead.
|
||||
|
||||
#ifndef _COMMONTYPES_H
|
||||
#define _COMMONTYPES_H
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
typedef unsigned __int8 u8;
|
||||
typedef unsigned __int16 u16;
|
||||
typedef unsigned __int32 u32;
|
||||
typedef unsigned __int64 u64;
|
||||
|
||||
typedef signed __int8 s8;
|
||||
typedef signed __int16 s16;
|
||||
typedef signed __int32 s32;
|
||||
typedef signed __int64 s64;
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
typedef char s8;
|
||||
typedef short s16;
|
||||
typedef int s32;
|
||||
typedef long long s64;
|
||||
|
||||
// For using windows lock code
|
||||
#define TCHAR char
|
||||
#define LONG int
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // _COMMONTYPES_H
|
||||
|
@ -1,153 +1,153 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _LOG_H
|
||||
#define _LOG_H
|
||||
|
||||
namespace LogTypes
|
||||
{
|
||||
|
||||
enum LOG_TYPE {
|
||||
ACTIONREPLAY,
|
||||
AUDIO,
|
||||
AUDIO_INTERFACE,
|
||||
BOOT,
|
||||
COMMANDPROCESSOR,
|
||||
COMMON,
|
||||
CONSOLE,
|
||||
DISCIO,
|
||||
DSPHLE,
|
||||
DSPINTERFACE,
|
||||
DVDINTERFACE,
|
||||
DYNA_REC,
|
||||
EXPANSIONINTERFACE,
|
||||
GEKKO,
|
||||
GPFIFO,
|
||||
HLE,
|
||||
MASTER_LOG,
|
||||
MEMMAP,
|
||||
OSREPORT,
|
||||
PERIPHERALINTERFACE,
|
||||
PIXELENGINE,
|
||||
SERIALINTERFACE,
|
||||
STREAMINGINTERFACE,
|
||||
VIDEO,
|
||||
VIDEOINTERFACE,
|
||||
WII_IOB,
|
||||
WII_IPC,
|
||||
WII_IPC_DVD,
|
||||
WII_IPC_ES,
|
||||
WII_IPC_FILEIO,
|
||||
WII_IPC_HLE,
|
||||
WII_IPC_NET,
|
||||
WII_IPC_SD,
|
||||
WII_IPC_WIIMOTE,
|
||||
|
||||
NUMBER_OF_LOGS // Must be last
|
||||
};
|
||||
|
||||
enum LOG_LEVELS {
|
||||
LERROR = 1, // Bad errors - that still don't deserve a PanicAlert.
|
||||
LWARNING, // Something is suspicious.
|
||||
LINFO, // General information.
|
||||
LDEBUG, // Strictly for detailed debugging - might make things slow.
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
/*
|
||||
FIXME:
|
||||
- Debug_run() - run only in debug time
|
||||
- Compile the log functions according to LOGLEVEL
|
||||
*/
|
||||
#ifdef LOGGING
|
||||
#define LOGLEVEL 4 //LogTypes::LDEBUG
|
||||
#else
|
||||
#ifndef LOGLEVEL
|
||||
#define LOGLEVEL 2 //LogTypes::LWARNING
|
||||
#endif // loglevel
|
||||
#endif // logging
|
||||
|
||||
#define ERROR_LOG(...) {}
|
||||
#define WARN_LOG(...) {}
|
||||
#define INFO_LOG(...) {}
|
||||
#define DEBUG_LOG(...) {}
|
||||
|
||||
extern void __Log(int logNumber, const char* text, ...);
|
||||
|
||||
// Let the compiler optimize this out
|
||||
#define GENERIC_LOG(t,v, ...) {if (v <= LOGLEVEL) __Log(t + (v)*100, __VA_ARGS__);}
|
||||
|
||||
#if LOGLEVEL >= 1 //LogTypes::LERROR
|
||||
#undef ERROR_LOG
|
||||
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)}
|
||||
#endif // loglevel LERROR+
|
||||
|
||||
#if LOGLEVEL >= 2 //LogTypes::LWARNING
|
||||
#undef WARN_LOG
|
||||
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)}
|
||||
#endif // loglevel LWARNING+
|
||||
|
||||
#if LOGLEVEL >= 3 //LogTypes::LINFO
|
||||
#undef INFO_LOG
|
||||
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)}
|
||||
#endif // loglevel LINFO+
|
||||
|
||||
#if LOGLEVEL >= 4 //LogTypes::LDEBUG
|
||||
#undef DEBUG_LOG
|
||||
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)}
|
||||
#endif // loglevel LDEBUG+
|
||||
|
||||
#if LOGLEVEL >= 4 //LogTypes::LDEBUG
|
||||
#define _dbg_assert_(_t_, _a_) \
|
||||
if (!(_a_)) {\
|
||||
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
|
||||
__LINE__, __FILE__, __TIME__); \
|
||||
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
|
||||
}
|
||||
#define _dbg_assert_msg_(_t_, _a_, ...)\
|
||||
if (!(_a_)) {\
|
||||
ERROR_LOG(_t_, __VA_ARGS__); \
|
||||
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#define _dbg_update_() Host_UpdateLogDisplay();
|
||||
|
||||
#else // not debug
|
||||
#define _dbg_clear_()
|
||||
#define _dbg_update_() ;
|
||||
|
||||
#ifndef _dbg_assert_
|
||||
#define _dbg_assert_(_t_, _a_) ;
|
||||
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
|
||||
#endif // dbg_assert
|
||||
#endif // LOGLEVEL LDEBUG
|
||||
|
||||
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
||||
#ifdef _WIN32
|
||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||
if (!(_a_)) {\
|
||||
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#else // not win32
|
||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||
if (!(_a_)) {\
|
||||
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
#endif // LOG_H
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _LOG_H
|
||||
#define _LOG_H
|
||||
|
||||
namespace LogTypes
|
||||
{
|
||||
|
||||
enum LOG_TYPE {
|
||||
ACTIONREPLAY,
|
||||
AUDIO,
|
||||
AUDIO_INTERFACE,
|
||||
BOOT,
|
||||
COMMANDPROCESSOR,
|
||||
COMMON,
|
||||
CONSOLE,
|
||||
DISCIO,
|
||||
DSPHLE,
|
||||
DSPINTERFACE,
|
||||
DVDINTERFACE,
|
||||
DYNA_REC,
|
||||
EXPANSIONINTERFACE,
|
||||
GEKKO,
|
||||
GPFIFO,
|
||||
HLE,
|
||||
MASTER_LOG,
|
||||
MEMMAP,
|
||||
OSREPORT,
|
||||
PERIPHERALINTERFACE,
|
||||
PIXELENGINE,
|
||||
SERIALINTERFACE,
|
||||
STREAMINGINTERFACE,
|
||||
VIDEO,
|
||||
VIDEOINTERFACE,
|
||||
WII_IOB,
|
||||
WII_IPC,
|
||||
WII_IPC_DVD,
|
||||
WII_IPC_ES,
|
||||
WII_IPC_FILEIO,
|
||||
WII_IPC_HLE,
|
||||
WII_IPC_NET,
|
||||
WII_IPC_SD,
|
||||
WII_IPC_WIIMOTE,
|
||||
|
||||
NUMBER_OF_LOGS // Must be last
|
||||
};
|
||||
|
||||
enum LOG_LEVELS {
|
||||
LERROR = 1, // Bad errors - that still don't deserve a PanicAlert.
|
||||
LWARNING, // Something is suspicious.
|
||||
LINFO, // General information.
|
||||
LDEBUG, // Strictly for detailed debugging - might make things slow.
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
/*
|
||||
FIXME:
|
||||
- Debug_run() - run only in debug time
|
||||
- Compile the log functions according to LOGLEVEL
|
||||
*/
|
||||
#ifdef LOGGING
|
||||
#define LOGLEVEL 4 //LogTypes::LDEBUG
|
||||
#else
|
||||
#ifndef LOGLEVEL
|
||||
#define LOGLEVEL 2 //LogTypes::LWARNING
|
||||
#endif // loglevel
|
||||
#endif // logging
|
||||
|
||||
#define ERROR_LOG(...) {}
|
||||
#define WARN_LOG(...) {}
|
||||
#define INFO_LOG(...) {}
|
||||
#define DEBUG_LOG(...) {}
|
||||
|
||||
extern void __Log(int logNumber, const char* text, ...);
|
||||
|
||||
// Let the compiler optimize this out
|
||||
#define GENERIC_LOG(t,v, ...) {if (v <= LOGLEVEL) __Log(t + (v)*100, __VA_ARGS__);}
|
||||
|
||||
#if LOGLEVEL >= 1 //LogTypes::LERROR
|
||||
#undef ERROR_LOG
|
||||
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)}
|
||||
#endif // loglevel LERROR+
|
||||
|
||||
#if LOGLEVEL >= 2 //LogTypes::LWARNING
|
||||
#undef WARN_LOG
|
||||
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)}
|
||||
#endif // loglevel LWARNING+
|
||||
|
||||
#if LOGLEVEL >= 3 //LogTypes::LINFO
|
||||
#undef INFO_LOG
|
||||
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)}
|
||||
#endif // loglevel LINFO+
|
||||
|
||||
#if LOGLEVEL >= 4 //LogTypes::LDEBUG
|
||||
#undef DEBUG_LOG
|
||||
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)}
|
||||
#endif // loglevel LDEBUG+
|
||||
|
||||
#if LOGLEVEL >= 4 //LogTypes::LDEBUG
|
||||
#define _dbg_assert_(_t_, _a_) \
|
||||
if (!(_a_)) {\
|
||||
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
|
||||
__LINE__, __FILE__, __TIME__); \
|
||||
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
|
||||
}
|
||||
#define _dbg_assert_msg_(_t_, _a_, ...)\
|
||||
if (!(_a_)) {\
|
||||
ERROR_LOG(_t_, __VA_ARGS__); \
|
||||
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#define _dbg_update_() Host_UpdateLogDisplay();
|
||||
|
||||
#else // not debug
|
||||
#define _dbg_clear_()
|
||||
#define _dbg_update_() ;
|
||||
|
||||
#ifndef _dbg_assert_
|
||||
#define _dbg_assert_(_t_, _a_) ;
|
||||
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
|
||||
#endif // dbg_assert
|
||||
#endif // LOGLEVEL LDEBUG
|
||||
|
||||
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
|
||||
#ifdef _WIN32
|
||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||
if (!(_a_)) {\
|
||||
if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#else // not win32
|
||||
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
|
||||
if (!(_a_)) {\
|
||||
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
#endif // LOG_H
|
||||
|
@ -1,60 +1,60 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// Generic function to get last error message.
|
||||
// Call directly after the command or use the error num.
|
||||
// This function might change the error code.
|
||||
const char *GetLastErrorMsg()
|
||||
{
|
||||
// FIXME : not thread safe.
|
||||
// Caused by sloppy use in logging in FileUtil.cpp, primarily. What to do, what to do ...
|
||||
static char errStr[255] = {0};
|
||||
#ifdef _WIN32
|
||||
DWORD dw = GetLastError();
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) errStr, 254, NULL );
|
||||
#else
|
||||
// Thread safe (XSI-compliant)
|
||||
strerror_r(errno, errStr, 255);
|
||||
#endif
|
||||
return errStr;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// strlen with cropping after size n
|
||||
size_t strnlen(const char *s, size_t n)
|
||||
{
|
||||
const char *p = (const char *)memchr(s, 0, n);
|
||||
return(p ? p-s : n);
|
||||
}
|
||||
#endif
|
||||
|
||||
// strdup with cropping after size n
|
||||
char* strndup(char const *s, size_t n)
|
||||
{
|
||||
size_t len = strnlen(s, n);
|
||||
char *dup = (char *)malloc(len + 1);
|
||||
|
||||
if (dup == NULL)
|
||||
return NULL;
|
||||
|
||||
dup[len] = '\0';
|
||||
return (char *)memcpy(dup, s, len);
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// Generic function to get last error message.
|
||||
// Call directly after the command or use the error num.
|
||||
// This function might change the error code.
|
||||
const char *GetLastErrorMsg()
|
||||
{
|
||||
// FIXME : not thread safe.
|
||||
// Caused by sloppy use in logging in FileUtil.cpp, primarily. What to do, what to do ...
|
||||
static char errStr[255] = {0};
|
||||
#ifdef _WIN32
|
||||
DWORD dw = GetLastError();
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) errStr, 254, NULL );
|
||||
#else
|
||||
// Thread safe (XSI-compliant)
|
||||
strerror_r(errno, errStr, 255);
|
||||
#endif
|
||||
return errStr;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// strlen with cropping after size n
|
||||
size_t strnlen(const char *s, size_t n)
|
||||
{
|
||||
const char *p = (const char *)memchr(s, 0, n);
|
||||
return(p ? p-s : n);
|
||||
}
|
||||
#endif
|
||||
|
||||
// strdup with cropping after size n
|
||||
char* strndup(char const *s, size_t n)
|
||||
{
|
||||
size_t len = strnlen(s, n);
|
||||
char *dup = (char *)malloc(len + 1);
|
||||
|
||||
if (dup == NULL)
|
||||
return NULL;
|
||||
|
||||
dup[len] = '\0';
|
||||
return (char *)memcpy(dup, s, len);
|
||||
}
|
||||
|
@ -1,45 +1,45 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef MSGHANDLER_H
|
||||
#define MSGHANDLER_H
|
||||
// Message alerts
|
||||
enum MSG_TYPE
|
||||
{
|
||||
INFORMATION,
|
||||
QUESTION,
|
||||
WARNING,
|
||||
};
|
||||
|
||||
typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
|
||||
bool yes_no, int Style);
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler);
|
||||
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...);
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("Warning", false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, __VA_ARGS__)
|
||||
#else
|
||||
#define SuccessAlert(format, ...) MsgAlert("SUCCESS", false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("PANIC", false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("PANIC", true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("ASK", true, QUESTION, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif //MSGHANDLER
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef MSGHANDLER_H
|
||||
#define MSGHANDLER_H
|
||||
// Message alerts
|
||||
enum MSG_TYPE
|
||||
{
|
||||
INFORMATION,
|
||||
QUESTION,
|
||||
WARNING,
|
||||
};
|
||||
|
||||
typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
|
||||
bool yes_no, int Style);
|
||||
void RegisterMsgAlertHandler(MsgAlertHandler handler);
|
||||
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...);
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("Warning", false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, __VA_ARGS__)
|
||||
#else
|
||||
#define SuccessAlert(format, ...) MsgAlert("SUCCESS", false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert("PANIC", false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert("PANIC", true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert("ASK", true, QUESTION, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif //MSGHANDLER
|
||||
|
Reference in New Issue
Block a user