diff options
Diffstat (limited to 'src/common/src')
-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 1ca34e46..3b71d9b3 100644 --- a/src/common/src/common.h +++ b/src/common/src/common.h @@ -163,4 +163,9 @@ enum EMUSTATE_CHANGE EMUSTATE_CHANGE_STOP }; +// This should be used in the private: declarations for a class +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) + #endif // _COMMON_H_ diff --git a/src/common/src/common_types.h b/src/common/src/common_types.h index cbe556c7..af1cd0e2 100644 --- a/src/common/src/common_types.h +++ b/src/common/src/common_types.h @@ -1,50 +1,125 @@ -// Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. +/** + * Copyright (C) 2005-2012 Gekko Emulator + * + * @file common_types.h + * @author ShizZy <shizzy247@gmail.com> + * @date 2012-02-11 + * @brief Common types used throughout the project + * + * @section LICENSE + * 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; either version 2 of + * the License, or (at your option) any later version. + * + * 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 for more details at + * http://www.gnu.org/copyleft/gpl.html + * + * Official project repository can be found at: + * http://code.google.com/p/gekko-gc-emu/ + */ +#pragma once -// This header contains type definitions that are shared between the Dolphin core and -// other parts of the code. Any definitions that are only used by the core should be -// placed in "common.h" instead. - -#ifndef _COMMONTYPES_H_ -#define _COMMONTYPES_H_ +#include <math.h> +#include <xmmintrin.h> // data_types__m128.cpp #ifdef _WIN32 #include <tchar.h> -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; +typedef unsigned __int8 u8; ///< 8-bit unsigned byte +typedef unsigned __int16 u16; ///< 16-bit unsigned short +typedef unsigned __int32 u32; ///< 32-bit unsigned word +typedef unsigned __int64 u64; ///< 64-bit unsigned int -typedef signed __int8 s8; -typedef signed __int16 s16; -typedef signed __int32 s32; -typedef signed __int64 s64; +typedef signed __int8 s8; ///< 8-bit signed byte +typedef signed __int16 s16; ///< 16-bit signed short +typedef signed __int32 s32; ///< 32-bit signed word +typedef signed __int64 s64; ///< 64-bit signed int #else -#ifndef GEKKO - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; +typedef unsigned char u8; ///< 8-bit unsigned byte +typedef unsigned short u16; ///< 16-bit unsigned short +typedef unsigned int u32; ///< 32-bit unsigned word +typedef unsigned long long u64; ///< 64-bit unsigned int -typedef signed char s8; -typedef signed short s16; -typedef signed int s32; -typedef signed long long s64; +typedef signed char s8; ///< 8-bit signed byte +typedef signed short s16; ///< 16-bit signed short +typedef signed int s32; ///< 32-bit signed word +typedef signed long long s64; ///< 64-bit signed int -#endif // For using windows lock code #define TCHAR char #define LONG int #endif // _WIN32 +typedef float f32; ///< 32-bit floating point +typedef double f64; ///< 64-bit floating point + #include "swap.h" -#endif // _COMMONTYPES_H_ +/// Union for fast 16-bit type casting +union t16 { + u8 _u8[2]; ///< 8-bit unsigned char(s) + u16 _u16; ///< 16-bit unsigned shorts(s) +}; + +/// Union for fast 32-bit type casting +union t32 { + f32 _f32; ///< 32-bit floating point(s) + u32 _u32; ///< 32-bit unsigned int(s) + s32 _s32; ///< 32-bit signed int(s) + u16 _u16[2]; ///< 16-bit unsigned shorts(s) + u8 _u8[4]; ///< 8-bit unsigned char(s) +}; + +/// Union for fast 64-bit type casting +union t64 { + f64 _f64; ///< 64-bit floating point + u64 _u64; ///< 64-bit unsigned long + f32 _f32[2]; ///< 32-bit floating point(s) + u32 _u32[2]; ///< 32-bit unsigned int(s) + s32 _s32[2]; ///< 32-bit signed int(s) + u16 _u16[4]; ///< 16-bit unsigned shorts(s) + u8 _u8[8]; ///< 8-bit unsigned char(s) +}; + +/// Union for fast 128-bit type casting +union t128 { + struct + { + t64 ps0; ///< 64-bit paired single 0 + t64 ps1; ///< 64-bit paired single 1 + }; + __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) +}; + +/// Rectangle data structure +class Rect { +public: + Rect(int x0=0, int y0=0, int x1=0, int y1=0) { + x0_ = x0; + y0_ = y0; + x1_ = x1; + y1_ = y1; + } + ~Rect() { } + + int x0_; ///< Rect top left X-coordinate + int y0_; ///< Rect top left Y-coordinate + int x1_; ///< Rect bottom left X-coordinate + int y1_; ///< Rect bottom right Y-coordinate + + inline u32 width() const { return abs(x1_ - x0_); } + inline u32 height() const { return abs(y1_ - y0_); } + + inline bool operator == (const Rect& val) const { + return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); + } +}; diff --git a/src/common/src/emu_window.h b/src/common/src/emu_window.h index 66de7557..f4936705 100644 --- a/src/common/src/emu_window.h +++ b/src/common/src/emu_window.h @@ -81,7 +81,7 @@ public: protected: EmuWindow() : client_area_width_(640), client_area_height_(480) { char window_title[255]; - sprintf(window_title, "emu [%s|%s] - %s", + sprintf(window_title, "citra [%s|%s] - %s", "null-cpu", "null-renderer", __DATE__); diff --git a/src/common/src/log.h b/src/common/src/log.h index 9b2da501..432a307f 100644 --- a/src/common/src/log.h +++ b/src/common/src/log.h @@ -57,9 +57,9 @@ enum LOG_TYPE { WII_IPC_NET, WII_IPC_WC24, WII_IPC_SSL, - WII_IPC_SD, - WII_IPC_STM, - WII_IPC_WIIMOTE, + RENDER, + LCD, + HW, TIME, NETPLAY, diff --git a/src/common/src/log_manager.cpp b/src/common/src/log_manager.cpp index 8c8828e8..b5b03484 100644 --- a/src/common/src/log_manager.cpp +++ b/src/common/src/log_manager.cpp @@ -29,53 +29,53 @@ LogManager *LogManager::m_logManager = NULL; LogManager::LogManager() { // create log files - m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); - m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); - m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); - m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); - m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); - m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); - m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine"); - m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc"); - m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt"); - m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt"); - m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt"); - m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap"); - m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1"); - m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt"); - m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface"); - m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface"); - m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo"); - m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt"); - m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub"); - m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt"); - m_Log[LogTypes::ARM11] = new LogContainer("ARM11", "ARM11"); - m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE"); - m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE"); - m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE"); - m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails"); - m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend"); - m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator"); - m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler"); - m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console"); - m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport"); - m_Log[LogTypes::TIME] = new LogContainer("Time", "Core Timing"); - m_Log[LogTypes::LOADER] = new LogContainer("Loader", "Loader"); - m_Log[LogTypes::FILESYS] = new LogContainer("FileSys", "File System"); - m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID"); - m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE"); - m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD"); - m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES"); - m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO","WII IPC FILEIO"); - m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD"); - m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM"); - m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET"); - m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24"); - m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL"); - m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE"); - m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay"); - m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager"); - m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); + m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); + m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); + m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); + m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); + m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); + m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); + m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine"); + m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc"); + m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt"); + m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt"); + m_Log[LogTypes::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt"); + m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap"); + m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1"); + m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt"); + m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface"); + m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface"); + m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo"); + m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt"); + m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub"); + m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt"); + m_Log[LogTypes::ARM11] = new LogContainer("ARM11", "ARM11"); + m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE"); + m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE"); + m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE"); + m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails"); + m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend"); + m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator"); + m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "JIT"); + m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console"); + m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport"); + m_Log[LogTypes::TIME] = new LogContainer("Time", "Core Timing"); + m_Log[LogTypes::LOADER] = new LogContainer("Loader", "Loader"); + m_Log[LogTypes::FILESYS] = new LogContainer("FileSys", "File System"); + m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID"); + m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE"); + m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD"); + m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES"); + m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO"); + m_Log[LogTypes::RENDER] = new LogContainer("RENDER", "RENDER"); + m_Log[LogTypes::LCD] = new LogContainer("LCD", "LCD"); + m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET"); + m_Log[LogTypes::WII_IPC_WC24] = new LogContainer("WII_IPC_WC24", "WII IPC WC24"); + m_Log[LogTypes::WII_IPC_SSL] = new LogContainer("WII_IPC_SSL", "WII IPC SSL"); + m_Log[LogTypes::HW] = new LogContainer("HARDWARE", "HARDWARE"); + m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay"); + m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager"); + m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str()); m_consoleLog = new ConsoleListener(); |