diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/src/common.h | 5 | ||||
| -rw-r--r-- | src/common/src/common_types.h | 133 | ||||
| -rw-r--r-- | src/common/src/emu_window.h | 2 | ||||
| -rw-r--r-- | src/common/src/log.h | 6 | ||||
| -rw-r--r-- | src/common/src/log_manager.cpp | 94 |
5 files changed, 160 insertions, 80 deletions
diff --git a/src/common/src/common.h b/src/common/src/common.h index 1ca34e467..3b71d9b3d 100644 --- a/src/common/src/common.h +++ b/src/common/src/common.h | |||
| @@ -163,4 +163,9 @@ enum EMUSTATE_CHANGE | |||
| 163 | EMUSTATE_CHANGE_STOP | 163 | EMUSTATE_CHANGE_STOP |
| 164 | }; | 164 | }; |
| 165 | 165 | ||
| 166 | // This should be used in the private: declarations for a class | ||
| 167 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | ||
| 168 | TypeName(const TypeName&); \ | ||
| 169 | void operator=(const TypeName&) | ||
| 170 | |||
| 166 | #endif // _COMMON_H_ | 171 | #endif // _COMMON_H_ |
diff --git a/src/common/src/common_types.h b/src/common/src/common_types.h index cbe556c7e..af1cd0e21 100644 --- a/src/common/src/common_types.h +++ b/src/common/src/common_types.h | |||
| @@ -1,50 +1,125 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | /** |
| 2 | // Licensed under GPLv2 | 2 | * Copyright (C) 2005-2012 Gekko Emulator |
| 3 | // Refer to the license.txt file included. | 3 | * |
| 4 | * @file common_types.h | ||
| 5 | * @author ShizZy <shizzy247@gmail.com> | ||
| 6 | * @date 2012-02-11 | ||
| 7 | * @brief Common types used throughout the project | ||
| 8 | * | ||
| 9 | * @section LICENSE | ||
| 10 | * This program is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU General Public License as | ||
| 12 | * published by the Free Software Foundation; either version 2 of | ||
| 13 | * the License, or (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, but | ||
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 18 | * General Public License for more details at | ||
| 19 | * http://www.gnu.org/copyleft/gpl.html | ||
| 20 | * | ||
| 21 | * Official project repository can be found at: | ||
| 22 | * http://code.google.com/p/gekko-gc-emu/ | ||
| 23 | */ | ||
| 4 | 24 | ||
| 25 | #pragma once | ||
| 5 | 26 | ||
| 6 | // This header contains type definitions that are shared between the Dolphin core and | 27 | #include <math.h> |
| 7 | // other parts of the code. Any definitions that are only used by the core should be | 28 | #include <xmmintrin.h> // data_types__m128.cpp |
| 8 | // placed in "common.h" instead. | ||
| 9 | |||
| 10 | #ifndef _COMMONTYPES_H_ | ||
| 11 | #define _COMMONTYPES_H_ | ||
| 12 | 29 | ||
| 13 | #ifdef _WIN32 | 30 | #ifdef _WIN32 |
| 14 | 31 | ||
| 15 | #include <tchar.h> | 32 | #include <tchar.h> |
| 16 | 33 | ||
| 17 | typedef unsigned __int8 u8; | 34 | typedef unsigned __int8 u8; ///< 8-bit unsigned byte |
| 18 | typedef unsigned __int16 u16; | 35 | typedef unsigned __int16 u16; ///< 16-bit unsigned short |
| 19 | typedef unsigned __int32 u32; | 36 | typedef unsigned __int32 u32; ///< 32-bit unsigned word |
| 20 | typedef unsigned __int64 u64; | 37 | typedef unsigned __int64 u64; ///< 64-bit unsigned int |
| 21 | 38 | ||
| 22 | typedef signed __int8 s8; | 39 | typedef signed __int8 s8; ///< 8-bit signed byte |
| 23 | typedef signed __int16 s16; | 40 | typedef signed __int16 s16; ///< 16-bit signed short |
| 24 | typedef signed __int32 s32; | 41 | typedef signed __int32 s32; ///< 32-bit signed word |
| 25 | typedef signed __int64 s64; | 42 | typedef signed __int64 s64; ///< 64-bit signed int |
| 26 | 43 | ||
| 27 | #else | 44 | #else |
| 28 | 45 | ||
| 29 | #ifndef GEKKO | 46 | typedef unsigned char u8; ///< 8-bit unsigned byte |
| 30 | 47 | typedef unsigned short u16; ///< 16-bit unsigned short | |
| 31 | typedef unsigned char u8; | 48 | typedef unsigned int u32; ///< 32-bit unsigned word |
| 32 | typedef unsigned short u16; | 49 | typedef unsigned long long u64; ///< 64-bit unsigned int |
| 33 | typedef unsigned int u32; | ||
| 34 | typedef unsigned long long u64; | ||
| 35 | 50 | ||
| 36 | typedef signed char s8; | 51 | typedef signed char s8; ///< 8-bit signed byte |
| 37 | typedef signed short s16; | 52 | typedef signed short s16; ///< 16-bit signed short |
| 38 | typedef signed int s32; | 53 | typedef signed int s32; ///< 32-bit signed word |
| 39 | typedef signed long long s64; | 54 | typedef signed long long s64; ///< 64-bit signed int |
| 40 | 55 | ||
| 41 | #endif | ||
| 42 | // For using windows lock code | 56 | // For using windows lock code |
| 43 | #define TCHAR char | 57 | #define TCHAR char |
| 44 | #define LONG int | 58 | #define LONG int |
| 45 | 59 | ||
| 46 | #endif // _WIN32 | 60 | #endif // _WIN32 |
| 47 | 61 | ||
| 62 | typedef float f32; ///< 32-bit floating point | ||
| 63 | typedef double f64; ///< 64-bit floating point | ||
| 64 | |||
| 48 | #include "swap.h" | 65 | #include "swap.h" |
| 49 | 66 | ||
| 50 | #endif // _COMMONTYPES_H_ | 67 | /// Union for fast 16-bit type casting |
| 68 | union t16 { | ||
| 69 | u8 _u8[2]; ///< 8-bit unsigned char(s) | ||
| 70 | u16 _u16; ///< 16-bit unsigned shorts(s) | ||
| 71 | }; | ||
| 72 | |||
| 73 | /// Union for fast 32-bit type casting | ||
| 74 | union t32 { | ||
| 75 | f32 _f32; ///< 32-bit floating point(s) | ||
| 76 | u32 _u32; ///< 32-bit unsigned int(s) | ||
| 77 | s32 _s32; ///< 32-bit signed int(s) | ||
| 78 | u16 _u16[2]; ///< 16-bit unsigned shorts(s) | ||
| 79 | u8 _u8[4]; ///< 8-bit unsigned char(s) | ||
| 80 | }; | ||
| 81 | |||
| 82 | /// Union for fast 64-bit type casting | ||
| 83 | union t64 { | ||
| 84 | f64 _f64; ///< 64-bit floating point | ||
| 85 | u64 _u64; ///< 64-bit unsigned long | ||
| 86 | f32 _f32[2]; ///< 32-bit floating point(s) | ||
| 87 | u32 _u32[2]; ///< 32-bit unsigned int(s) | ||
| 88 | s32 _s32[2]; ///< 32-bit signed int(s) | ||
| 89 | u16 _u16[4]; ///< 16-bit unsigned shorts(s) | ||
| 90 | u8 _u8[8]; ///< 8-bit unsigned char(s) | ||
| 91 | }; | ||
| 92 | |||
| 93 | /// Union for fast 128-bit type casting | ||
| 94 | union t128 { | ||
| 95 | struct | ||
| 96 | { | ||
| 97 | t64 ps0; ///< 64-bit paired single 0 | ||
| 98 | t64 ps1; ///< 64-bit paired single 1 | ||
| 99 | }; | ||
| 100 | __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) | ||
| 101 | }; | ||
| 102 | |||
| 103 | /// Rectangle data structure | ||
| 104 | class Rect { | ||
| 105 | public: | ||
| 106 | Rect(int x0=0, int y0=0, int x1=0, int y1=0) { | ||
| 107 | x0_ = x0; | ||
| 108 | y0_ = y0; | ||
| 109 | x1_ = x1; | ||
| 110 | y1_ = y1; | ||
| 111 | } | ||
| 112 | ~Rect() { } | ||
| 113 | |||
| 114 | int x0_; ///< Rect top left X-coordinate | ||
| 115 | int y0_; ///< Rect top left Y-coordinate | ||
| 116 | int x1_; ///< Rect bottom left X-coordinate | ||
| 117 | int y1_; ///< Rect bottom right Y-coordinate | ||
| 118 | |||
| 119 | inline u32 width() const { return abs(x1_ - x0_); } | ||
| 120 | inline u32 height() const { return abs(y1_ - y0_); } | ||
| 121 | |||
| 122 | inline bool operator == (const Rect& val) const { | ||
| 123 | return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); | ||
| 124 | } | ||
| 125 | }; | ||
diff --git a/src/common/src/emu_window.h b/src/common/src/emu_window.h index 66de75574..f49367057 100644 --- a/src/common/src/emu_window.h +++ b/src/common/src/emu_window.h | |||
| @@ -81,7 +81,7 @@ public: | |||
| 81 | protected: | 81 | protected: |
| 82 | EmuWindow() : client_area_width_(640), client_area_height_(480) { | 82 | EmuWindow() : client_area_width_(640), client_area_height_(480) { |
| 83 | char window_title[255]; | 83 | char window_title[255]; |
| 84 | sprintf(window_title, "emu [%s|%s] - %s", | 84 | sprintf(window_title, "citra [%s|%s] - %s", |
| 85 | "null-cpu", | 85 | "null-cpu", |
| 86 | "null-renderer", | 86 | "null-renderer", |
| 87 | __DATE__); | 87 | __DATE__); |
diff --git a/src/common/src/log.h b/src/common/src/log.h index 9b2da5016..432a307f0 100644 --- a/src/common/src/log.h +++ b/src/common/src/log.h | |||
| @@ -57,9 +57,9 @@ enum LOG_TYPE { | |||
| 57 | WII_IPC_NET, | 57 | WII_IPC_NET, |
| 58 | WII_IPC_WC24, | 58 | WII_IPC_WC24, |
| 59 | WII_IPC_SSL, | 59 | WII_IPC_SSL, |
| 60 | WII_IPC_SD, | 60 | RENDER, |
| 61 | WII_IPC_STM, | 61 | LCD, |
| 62 | WII_IPC_WIIMOTE, | 62 | HW, |
| 63 | TIME, | 63 | TIME, |
| 64 | NETPLAY, | 64 | NETPLAY, |
| 65 | 65 | ||
diff --git a/src/common/src/log_manager.cpp b/src/common/src/log_manager.cpp index 8c8828e8c..b5b034846 100644 --- a/src/common/src/log_manager.cpp +++ b/src/common/src/log_manager.cpp | |||
| @@ -29,53 +29,53 @@ LogManager *LogManager::m_logManager = NULL; | |||
| 29 | LogManager::LogManager() | 29 | LogManager::LogManager() |
| 30 | { | 30 | { |
| 31 | // create log files | 31 | // create log files |
| 32 | m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); | 32 | m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); |
| 33 | m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); | 33 | m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); |
| 34 | m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); | 34 | m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); |
| 35 | m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); | 35 | m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); |
| 36 | m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); | 36 | m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); |
| 37 | m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); | 37 | m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); |
| 38 | m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine"); | 38 | m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine"); |
| 39 | m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc"); | 39 | m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc"); |
| 40 | m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt"); | 40 | m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt"); |
| 41 | m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt"); | 41 | m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt"); |
| 42 | m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt"); | 42 | m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt"); |
| 43 | m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap"); | 43 | m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap"); |
| 44 | m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1"); | 44 | m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1"); |
| 45 | m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt"); | 45 | m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt"); |
| 46 | m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface"); | 46 | m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface"); |
| 47 | m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface"); | 47 | m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface"); |
| 48 | m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo"); | 48 | m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo"); |
| 49 | m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt"); | 49 | m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt"); |
| 50 | m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub"); | 50 | m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub"); |
| 51 | m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt"); | 51 | m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt"); |
| 52 | m_Log[LogTypes::ARM11] = new LogContainer("ARM11", "ARM11"); | 52 | m_Log[LogTypes::ARM11] = new LogContainer("ARM11", "ARM11"); |
| 53 | m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE"); | 53 | m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE"); |
| 54 | m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE"); | 54 | m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE"); |
| 55 | m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE"); | 55 | m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE"); |
| 56 | m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails"); | 56 | m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails"); |
| 57 | m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend"); | 57 | m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend"); |
| 58 | m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator"); | 58 | m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator"); |
| 59 | m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler"); | 59 | m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "JIT"); |
| 60 | m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console"); | 60 | m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console"); |
| 61 | m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport"); | 61 | m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport"); |
| 62 | m_Log[LogTypes::TIME] = new LogContainer("Time", "Core Timing"); | 62 | m_Log[LogTypes::TIME] = new LogContainer("Time", "Core Timing"); |
| 63 | m_Log[LogTypes::LOADER] = new LogContainer("Loader", "Loader"); | 63 | m_Log[LogTypes::LOADER] = new LogContainer("Loader", "Loader"); |
| 64 | m_Log[LogTypes::FILESYS] = new LogContainer("FileSys", "File System"); | 64 | m_Log[LogTypes::FILESYS] = new LogContainer("FileSys", "File System"); |
| 65 | m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID"); | 65 | m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID"); |
| 66 | m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE"); | 66 | m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE"); |
| 67 | m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD"); | 67 | m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD"); |
| 68 | m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES"); | 68 | m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES"); |
| 69 | m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO","WII IPC FILEIO"); | 69 | m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO"); |
| 70 | m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD"); | 70 | m_Log[LogTypes::RENDER] = new LogContainer("RENDER", "RENDER"); |
| 71 | m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM"); | 71 | m_Log[LogTypes::LCD] = new LogContainer("LCD", "LCD"); |
| 72 | m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET"); | 72 | m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET"); |
| 73 | m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24"); | 73 | m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24"); |
| 74 | m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL"); | 74 | m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL"); |
| 75 | m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE"); | 75 | m_Log[LogTypes::HW] = new LogContainer("HARDWARE", "HARDWARE"); |
| 76 | m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay"); | 76 | m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay"); |
| 77 | m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager"); | 77 | m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager"); |
| 78 | m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); | 78 | m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); |
| 79 | 79 | ||
| 80 | m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); | 80 | m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); |
| 81 | m_consoleLog = new ConsoleListener(); | 81 | m_consoleLog = new ConsoleListener(); |