Merge pull request #721 from yuriks/more-cleanups

More cleanups
This commit is contained in:
Yuri Kunde Schlesner 2015-05-07 11:45:45 -07:00
commit 4f4d230dac
122 changed files with 433 additions and 480 deletions

View file

@ -8,8 +8,11 @@ if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
else()
# Silence deprecation warnings
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
# Silence "deprecation" warnings
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE)
# Avoid windows.h junk
add_definitions(/DNOMINMAX)
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

View file

@ -4,7 +4,7 @@
#include <thread>
#include "common/common.h"
#include "common/logging/log.h"
#include "common/logging/text_formatter.h"
#include "common/logging/backend.h"
#include "common/logging/filter.h"
@ -19,7 +19,7 @@
#include "citra/emu_window/emu_window_glfw.h"
/// Application entry point
int __cdecl main(int argc, char **argv) {
int main(int argc, char **argv) {
std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
Log::Filter log_filter(Log::Level::Debug);
Log::SetFilter(&log_filter);

View file

@ -5,7 +5,10 @@
#include <GLFW/glfw3.h>
#include "citra/default_ini.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "core/settings.h"
#include "core/core.h"

View file

@ -4,7 +4,7 @@
#include <GLFW/glfw3.h>
#include "common/common.h"
#include "common/logging/log.h"
#include "video_core/video_core.h"

View file

@ -8,7 +8,6 @@
#include <QWindow>
#endif
#include "common/common.h"
#include "bootmanager.h"
#include "main.h"

View file

@ -7,7 +7,6 @@
#include <QThread>
#include <QGLWidget>
#include "common/common.h"
#include "common/emu_window.h"
#include "common/thread.h"

View file

@ -7,7 +7,6 @@
#include "../bootmanager.h"
#include "../hotkeys.h"
#include "common/common.h"
#include "core/mem_map.h"
#include "core/core.h"

View file

@ -9,8 +9,8 @@
#include "ui_disassembler.h"
#include "common/common.h"
#include "common/break_points.h"
#include "common/common_types.h"
class QAction;
class EmuThread;

View file

@ -8,6 +8,8 @@
#include <QVBoxLayout>
#include <QLabel>
#include "common/assert.h"
#include "graphics_breakpoints.h"
#include "graphics_breakpoints_p.h"

View file

@ -4,8 +4,9 @@
#include "ramview.h"
#include "common/common.h"
#include "core/mem_map.h"
GRamView::GRamView(QWidget* parent) : QHexEdit(parent)
{
}

View file

@ -10,7 +10,6 @@
#include "qhexedit.h"
#include "main.h"
#include "common/common.h"
#include "common/logging/text_formatter.h"
#include "common/logging/log.h"
#include "common/logging/backend.h"
@ -349,7 +348,7 @@ void GMainWindow::closeEvent(QCloseEvent* event)
#undef main
#endif
int __cdecl main(int argc, char* argv[])
int main(int argc, char* argv[])
{
std::shared_ptr<Log::Logger> logger = Log::InitGlobalLogger();
Log::Filter log_filter(Log::Level::Info);

View file

@ -27,7 +27,6 @@ set(HEADERS
bit_field.h
break_points.h
chunk_file.h
common.h
common_funcs.h
common_paths.h
common_types.h

View file

@ -4,6 +4,7 @@
#pragma once
#include <cstdio>
#include <cstdlib>
#include "common/common_funcs.h"

View file

@ -35,7 +35,7 @@
#include <limits>
#include <type_traits>
#include "common/common.h"
#include "common/common_funcs.h"
/*
* Abstract bitfield class

View file

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/common.h"
#include "common/debug_interface.h"
#include "common/break_points.h"
#include "common/logging/log.h"

View file

@ -7,7 +7,7 @@
#include <vector>
#include <string>
#include "common/common.h"
#include "common/common_types.h"
class DebugInterface;

View file

@ -34,8 +34,9 @@
#include <set>
#include <type_traits>
#include "common/common.h"
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
template <class T>
struct LinkedListItem : public T

View file

@ -1,120 +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
// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
// since it slows down the build a lot.
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define STACKALIGN
// An inheritable class to disallow the copy constructor and operator= functions
class NonCopyable
{
protected:
NonCopyable() {}
NonCopyable(const NonCopyable&&) {}
void operator=(const NonCopyable&&) {}
private:
NonCopyable(NonCopyable&);
NonCopyable& operator=(NonCopyable& other);
};
#include "common/assert.h"
#include "common/logging/log.h"
#include "common/common_types.h"
#include "common/common_funcs.h"
#include "common/common_paths.h"
#include "common/platform.h"
#ifdef __APPLE__
// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries.
// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes.
#if defined __i386__ && defined __GNUC__
#undef STACKALIGN
#define STACKALIGN __attribute__((__force_align_arg_pointer__))
#endif
#elif defined _WIN32
// Check MSC ver
#if defined _MSC_VER && _MSC_VER <= 1000
#error needs at least version 1000 of MSC
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
// Alignment
#define MEMORY_ALIGNED16(x) __declspec(align(16)) x
#define MEMORY_ALIGNED32(x) __declspec(align(32)) x
#define MEMORY_ALIGNED64(x) __declspec(align(64)) x
#define MEMORY_ALIGNED128(x) __declspec(align(128)) x
#define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x
#define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x
#endif
// Windows compatibility
#ifndef _WIN32
#ifdef _LP64
#define _M_X64 1
#else
#define _M_IX86 1
#endif
#define __forceinline inline __attribute__((always_inline))
#define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
#define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
#define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
#define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
#define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x
#define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x
#endif
#ifdef _MSC_VER
#define __strdup _strdup
#define __getcwd _getcwd
#define __chdir _chdir
#else
#define __strdup strdup
#define __getcwd getcwd
#define __chdir chdir
#endif
#if defined _M_GENERIC
# define _M_SSE 0x0
#elif defined __GNUC__
# if defined __SSE4_2__
# define _M_SSE 0x402
# elif defined __SSE4_1__
# define _M_SSE 0x401
# elif defined __SSSE3__
# define _M_SSE 0x301
# elif defined __SSE3__
# define _M_SSE 0x300
# endif
#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
# define _M_SSE 0x402
#endif
// Host communication.
enum HOST_COMM
{
// Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on
WM_USER_STOP = 10,
WM_USER_CREATE,
WM_USER_SETCURSOR,
};
// Used for notification on emulation state
enum EMUSTATE_CHANGE
{
EMUSTATE_CHANGE_PLAY = 1,
EMUSTATE_CHANGE_PAUSE,
EMUSTATE_CHANGE_STOP
};
#include "swap.h"

View file

@ -7,13 +7,6 @@
#include "common_types.h"
#include <cstdlib>
#ifdef _WIN32
#define SLEEP(x) Sleep(x)
#else
#include <unistd.h>
#define SLEEP(x) usleep(x*1000)
#endif
#define b2(x) ( (x) | ( (x) >> 1) )
#define b4(x) ( b2(x) | ( b2(x) >> 2) )
@ -34,6 +27,27 @@
#define INSERT_PADDING_BYTES(num_bytes) u8 CONCAT2(pad, __LINE__)[(num_bytes)]
#define INSERT_PADDING_WORDS(num_words) u32 CONCAT2(pad, __LINE__)[(num_words)]
#ifdef _WIN32
// Alignment
#define MEMORY_ALIGNED16(x) __declspec(align(16)) x
#define MEMORY_ALIGNED32(x) __declspec(align(32)) x
#define MEMORY_ALIGNED64(x) __declspec(align(64)) x
#define MEMORY_ALIGNED128(x) __declspec(align(128)) x
#else
// Windows compatibility
#ifdef _LP64
#define _M_X64 1
#else
#define _M_IX86 1
#endif
#define __forceinline inline __attribute__((always_inline))
#define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
#define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
#define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
#define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
#endif
#ifndef _MSC_VER
#include <errno.h>
@ -73,61 +87,11 @@ inline u64 _rotr64(u64 x, unsigned int shift){
}
#else // _MSC_VER
#include <locale.h>
// Function Cross-Compatibility
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define unlink _unlink
// Function Cross-Compatibility
#define snprintf _snprintf
#define vscprintf _vscprintf
// Locale Cross-Compatibility
// Locale Cross-Compatibility
#define locale_t _locale_t
#define freelocale _free_locale
#define newlocale(mask, locale, base) _create_locale(mask, locale)
#define LC_GLOBAL_LOCALE ((locale_t)-1)
#define LC_ALL_MASK LC_ALL
#define LC_COLLATE_MASK LC_COLLATE
#define LC_CTYPE_MASK LC_CTYPE
#define LC_MONETARY_MASK LC_MONETARY
#define LC_NUMERIC_MASK LC_NUMERIC
#define LC_TIME_MASK LC_TIME
inline locale_t uselocale(locale_t new_locale)
{
// Retrieve the current per thread locale setting
bool bIsPerThread = (_configthreadlocale(0) == _ENABLE_PER_THREAD_LOCALE);
// Retrieve the current thread-specific locale
locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE;
if(new_locale == LC_GLOBAL_LOCALE)
{
// Restore the global locale
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
}
else if(new_locale != nullptr)
{
// Configure the thread to set the locale only for this thread
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
// Set all locale categories
for(int i = LC_MIN; i <= LC_MAX; i++)
setlocale(i, new_locale->locinfo->lc_category[i].locale);
}
return old_locale;
}
// 64 bit offsets for windows
#define fseeko _fseeki64
#define ftello _ftelli64
#define atoll _atoi64
#define stat64 _stat64
#define fstat64 _fstat64
#define fileno _fileno
extern "C" {
__declspec(dllimport) void __stdcall DebugBreak(void);

View file

@ -4,9 +4,6 @@
#pragma once
// Make sure we pick up USER_DIR if set in config.h
#include "common/common.h"
// Directory separators, do we need this?
#define DIR_SEP "/"
#define DIR_SEP_CHR '/'

Some files were not shown because too many files have changed in this diff Show more