1
0
Fork 1
forked from suyu/suyu

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 435 additions and 482 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_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
else() else()
# Silence deprecation warnings # Silence "deprecation" warnings
add_definitions(/D_CRT_SECURE_NO_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 up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -34,8 +34,9 @@
#include <set> #include <set>
#include <type_traits> #include <type_traits>
#include "common/common.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
template <class T> template <class T>
struct LinkedListItem : public 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 "common_types.h"
#include <cstdlib> #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 b2(x) ( (x) | ( (x) >> 1) )
#define b4(x) ( b2(x) | ( b2(x) >> 2) ) #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_BYTES(num_bytes) u8 CONCAT2(pad, __LINE__)[(num_bytes)]
#define INSERT_PADDING_WORDS(num_words) u32 CONCAT2(pad, __LINE__)[(num_words)] #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 #ifndef _MSC_VER
#include <errno.h> #include <errno.h>
@ -73,61 +87,11 @@ inline u64 _rotr64(u64 x, unsigned int shift){
} }
#else // _MSC_VER #else // _MSC_VER
#include <locale.h> // Function Cross-Compatibility
// Function Cross-Compatibility
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define unlink _unlink
#define snprintf _snprintf #define snprintf _snprintf
#define vscprintf _vscprintf
// Locale Cross-Compatibility // Locale Cross-Compatibility
#define locale_t _locale_t #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" { extern "C" {
__declspec(dllimport) void __stdcall DebugBreak(void); __declspec(dllimport) void __stdcall DebugBreak(void);

View file

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

View file

@ -47,6 +47,11 @@ typedef std::int64_t s64; ///< 64-bit signed int
typedef float f32; ///< 32-bit floating point typedef float f32; ///< 32-bit floating point
typedef double f64; ///< 64-bit floating point typedef double f64; ///< 64-bit floating point
// TODO: It would be nice to eventually replace these with strong types that prevent accidental
// conversion between each other.
typedef u32 VAddr; ///< Represents a pointer in the userspace virtual address space.
typedef u32 PAddr; ///< Represents a pointer in the ARM11 physical address space.
/// Union for fast 16-bit type casting /// Union for fast 16-bit type casting
union t16 { union t16 {
u8 _u8[2]; ///< 8-bit unsigned char(s) u8 _u8[2]; ///< 8-bit unsigned char(s)
@ -73,6 +78,16 @@ union t64 {
u8 _u8[8]; ///< 8-bit unsigned char(s) u8 _u8[8]; ///< 8-bit unsigned char(s)
}; };
// An inheritable class to disallow the copy constructor and operator= functions
class NonCopyable {
protected:
NonCopyable() = default;
~NonCopyable() = default;
NonCopyable(NonCopyable&) = delete;
NonCopyable& operator=(NonCopyable&) = delete;
};
namespace Common { namespace Common {
/// Rectangle data structure /// Rectangle data structure
class Rect { class Rect {

View file

@ -10,7 +10,7 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include "common/common.h" // for NonCopyable #include "common/common_types.h" // for NonCopyable
namespace Common { namespace Common {

View file

@ -4,11 +4,11 @@
#pragma once #pragma once
#include "common/common.h" #include "common/common_types.h"
#include "common/scm_rev.h"
#include "common/string_util.h"
#include "common/key_map.h" #include "common/key_map.h"
#include "common/math_util.h" #include "common/math_util.h"
#include "common/scm_rev.h"
#include "common/string_util.h"
/** /**
* Abstraction class used to provide an interface between emulation code and the frontend * Abstraction class used to provide an interface between emulation code and the frontend

View file

@ -2,42 +2,52 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/assert.h"
#include "common/common.h" #include "common/common_funcs.h"
#include "common/common_paths.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <shlobj.h> // for SHGetFolderPath #include <shlobj.h> // for SHGetFolderPath
#include <shellapi.h> #include <shellapi.h>
#include <commdlg.h> // for GetSaveFileName #include <commdlg.h> // for GetSaveFileName
#include <io.h> #include <io.h>
#include <direct.h> // getcwd #include <direct.h> // getcwd
#include <tchar.h> #include <tchar.h>
// 64 bit offsets for windows
#define fseeko _fseeki64
#define ftello _ftelli64
#define atoll _atoi64
#define stat64 _stat64
#define fstat64 _fstat64
#define fileno _fileno
#else #else
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
#include <CoreFoundation/CFString.h> #include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFURL.h> #include <CoreFoundation/CFURL.h>
#include <CoreFoundation/CFBundle.h> #include <CoreFoundation/CFBundle.h>
#endif #endif
#include <algorithm> #include <algorithm>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef S_ISDIR #ifndef S_ISDIR
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#endif #endif
#ifdef BSD4_4 #ifdef BSD4_4
#define stat64 stat #define stat64 stat
#define fstat64 fstat #define fstat64 fstat
#endif #endif
// This namespace has various generic functions related to files and paths. // This namespace has various generic functions related to files and paths.
@ -589,7 +599,7 @@ std::string GetCurrentDir()
{ {
char *dir; char *dir;
// Get the current working directory (getcwd uses malloc) // Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(nullptr, 0))) { if (!(dir = getcwd(nullptr, 0))) {
LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s",
GetLastErrorMsg()); GetLastErrorMsg());
@ -603,7 +613,7 @@ std::string GetCurrentDir()
// Sets the current directory to the given directory // Sets the current directory to the given directory
bool SetCurrentDir(const std::string &directory) bool SetCurrentDir(const std::string &directory)
{ {
return __chdir(directory.c_str()) == 0; return chdir(directory.c_str()) == 0;
} }
#if defined(__APPLE__) #if defined(__APPLE__)

View file

@ -11,7 +11,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "common/common.h" #include "common/common_types.h"
#include "common/string_util.h" #include "common/string_util.h"
// User directory indices for GetUserPath // User directory indices for GetUserPath

View file

@ -4,7 +4,10 @@
#include <algorithm> #include <algorithm>
#include "common/common_funcs.h" // For rotl
#include "common/hash.h" #include "common/hash.h"
#include "common/platform.h"
#if _M_SSE >= 0x402 #if _M_SSE >= 0x402
#include "common/cpu_detect.h" #include "common/cpu_detect.h"
#include <nmmintrin.h> #include <nmmintrin.h>

View file

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "common/common.h" #include "common/common_types.h"
u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0. u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower

View file

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "common/common.h" #include "common/common_types.h"
#include <fstream> #include <fstream>
// defined in Version.cpp // defined in Version.cpp

View file

@ -14,6 +14,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/logging/text_formatter.h" #include "common/logging/text_formatter.h"
#include "common/common_funcs.h"
#include "common/string_util.h" #include "common/string_util.h"
namespace Log { namespace Log {

View file

@ -2,12 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cstring>
#include "common/common.h"
#include "common/math_util.h"
#include <numeric> // Necessary on OS X, but not Linux #include <numeric> // Necessary on OS X, but not Linux
#include "common/common_types.h"
#include "common/math_util.h"
namespace MathUtil namespace MathUtil
{ {

View file

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "common/common.h" #include "common/common_types.h"
#include <algorithm> #include <algorithm>
#include <type_traits> #include <type_traits>

View file

@ -17,12 +17,16 @@
#include <string> #include <string>
#include "common/memory_util.h" #include "common/logging/log.h"
#include "common/mem_arena.h" #include "common/mem_arena.h"
#include "common/memory_util.h"
#include "common/string_util.h" #include "common/string_util.h"
#ifndef _WIN32 #ifndef _WIN32
#include <fcntl.h> #include <fcntl.h>
#include <string.h>
#include <unistd.h>
#ifdef ANDROID #ifdef ANDROID
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/ashmem.h> #include <linux/ashmem.h>

View file

@ -21,7 +21,7 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include "common/common.h" #include "common/common_types.h"
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it. // This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
// Multiple views can mirror the same section of the block, which makes it very convient for emulating // Multiple views can mirror the same section of the block, which makes it very convient for emulating

View file

@ -3,7 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h" #include "common/common_funcs.h"
#include "common/logging/log.h"
#include "common/memory_util.h" #include "common/memory_util.h"
#include "common/string_util.h" #include "common/string_util.h"

View file

@ -2,10 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h" #include "common/common_funcs.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else
#include <string.h>
#endif #endif
// Neither Android nor OS X support TLS // Neither Android nor OS X support TLS

View file

@ -63,48 +63,27 @@
#define EMU_ARCHITECTURE_X86 #define EMU_ARCHITECTURE_X86
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// Feature detection
#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
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Compiler-Specific Definitions // Compiler-Specific Definitions
#if EMU_PLATFORM == PLATFORM_WINDOWS
#include <time.h>
#ifndef NOMINMAX
#define NOMINMAX
#endif
#define EMU_FASTCALL __fastcall
#ifdef _MSC_VER
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
if (localtime_s(result, clock) == 0)
return result;
return nullptr;
}
#endif
#else // EMU_PLATFORM != PLATFORM_WINDOWS
#define EMU_FASTCALL __attribute__((fastcall))
#define __stdcall
#define __cdecl
#define BOOL bool
#define DWORD u32
// TODO: Hacks..
#include <limits.h>
#include <strings.h>
#define stricmp(str1, str2) strcasecmp(str1, str2)
#define _stricmp(str1, str2) strcasecmp(str1, str2)
#define _snprintf snprintf
#define _getcwd getcwd
#define _tzset tzset
typedef void EXCEPTION_POINTERS;
#endif
#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ #define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \
(__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))

View file

@ -7,7 +7,6 @@
#include "common/assert.h" #include "common/assert.h"
#if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013. #if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013.
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> // For QueryPerformanceCounter/Frequency #include <Windows.h> // For QueryPerformanceCounter/Frequency
#endif #endif

View file

@ -4,7 +4,9 @@
#include <boost/range/algorithm.hpp> #include <boost/range/algorithm.hpp>
#include "common/common.h" #include "common/common_funcs.h"
#include "common/common_paths.h"
#include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#ifdef _MSC_VER #ifdef _MSC_VER

View file

@ -10,7 +10,7 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include "common/common.h" #include "common/common_types.h"
namespace Common { namespace Common {

View file

@ -5,8 +5,10 @@
#pragma once #pragma once
#include <map> #include <map>
#include <string>
#include <utility>
#include "common/common.h" #include "common/common_types.h"
struct TSymbol struct TSymbol
{ {

View file

@ -4,7 +4,6 @@
#pragma once #pragma once
// Don't include common.h here as it will break LogManager
#include "common/common_types.h" #include "common/common_types.h"
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>

View file

@ -9,8 +9,6 @@
#include <boost/range/algorithm_ext/erase.hpp> #include <boost/range/algorithm_ext/erase.hpp>
#include "common/common.h"
namespace Common { namespace Common {
template<class T, unsigned int N> template<class T, unsigned int N>

View file

@ -6,7 +6,7 @@
#include <map> #include <map>
#include "common/common.h" #include "common/common_types.h"
// This simple class creates a wrapper around a C/C++ function that saves all fp state // This simple class creates a wrapper around a C/C++ function that saves all fp state
// before entering it, and restores it upon exit. This is required to be able to selectively // before entering it, and restores it upon exit. This is required to be able to selectively

View file

@ -12,9 +12,9 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include "common/common.h" #include "common/common_types.h"
#include "common/timer.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/timer.h"
namespace Common namespace Common
{ {

View file

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "common/common.h" #include "common/common_types.h"
#include <string> #include <string>
namespace Common namespace Common

View file

@ -12,6 +12,7 @@ set(SRCS
arm/skyeye_common/vfp/vfpdouble.cpp arm/skyeye_common/vfp/vfpdouble.cpp
arm/skyeye_common/vfp/vfpinstr.cpp arm/skyeye_common/vfp/vfpinstr.cpp
arm/skyeye_common/vfp/vfpsingle.cpp arm/skyeye_common/vfp/vfpsingle.cpp
file_sys/archive_backend.cpp
file_sys/archive_extsavedata.cpp file_sys/archive_extsavedata.cpp
file_sys/archive_romfs.cpp file_sys/archive_romfs.cpp
file_sys/archive_savedata.cpp file_sys/archive_savedata.cpp

View file

@ -4,7 +4,6 @@
#pragma once #pragma once
#include "common/common.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/arm_regformat.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cstring>
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/arm/skyeye_common/armemu.h" #include "core/arm/skyeye_common/armemu.h"

View file

@ -15,6 +15,8 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "common/logging/log.h"
#include "core/mem_map.h" #include "core/mem_map.h"
#include "core/arm/skyeye_common/armdefs.h" #include "core/arm/skyeye_common/armdefs.h"
#include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/arm_regformat.h"

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "common/swap.h"
#include "core/mem_map.h" #include "core/mem_map.h"
#include "core/arm/skyeye_common/armdefs.h" #include "core/arm/skyeye_common/armdefs.h"

View file

@ -20,7 +20,6 @@
/* Note: this file handles interface with arm core and vfp registers */ /* Note: this file handles interface with arm core and vfp registers */
#include "common/common.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/arm/skyeye_common/armdefs.h" #include "core/arm/skyeye_common/armdefs.h"

View file

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"

View file

@ -21,7 +21,7 @@
#include <functional> #include <functional>
#include "common/common.h" #include "common/common_types.h"
extern int g_clock_rate_arm11; extern int g_clock_rate_arm11;

View file

@ -0,0 +1,127 @@
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <sstream>
#include "common/logging/log.h"
#include "common/string_util.h"
#include "core/file_sys/archive_backend.h"
#include "core/mem_map.h"
namespace FileSys {
Path::Path(LowPathType type, u32 size, u32 pointer) : type(type) {
switch (type) {
case Binary:
{
u8* data = Memory::GetPointer(pointer);
binary = std::vector<u8>(data, data + size);
break;
}
case Char:
{
const char* data = reinterpret_cast<const char*>(Memory::GetPointer(pointer));
string = std::string(data, size - 1); // Data is always null-terminated.
break;
}
case Wchar:
{
const char16_t* data = reinterpret_cast<const char16_t*>(Memory::GetPointer(pointer));
u16str = std::u16string(data, size/2 - 1); // Data is always null-terminated.
break;
}
default:
break;
}
}
const std::string Path::DebugStr() const {
switch (GetType()) {
case Invalid:
default:
return "[Invalid]";
case Empty:
return "[Empty]";
case Binary:
{
std::stringstream res;
res << "[Binary: ";
for (unsigned byte : binary)
res << std::hex << std::setw(2) << std::setfill('0') << byte;
res << ']';
return res.str();
}
case Char:
return "[Char: " + AsString() + ']';
case Wchar:
return "[Wchar: " + AsString() + ']';
}
}
const std::string Path::AsString() const {
switch (GetType()) {
case Char:
return string;
case Wchar:
return Common::UTF16ToUTF8(u16str);
case Empty:
return{};
case Invalid:
case Binary:
default:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
return{};
}
}
const std::u16string Path::AsU16Str() const {
switch (GetType()) {
case Char:
return Common::UTF8ToUTF16(string);
case Wchar:
return u16str;
case Empty:
return{};
case Invalid:
case Binary:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return{};
}
}
const std::vector<u8> Path::AsBinary() const {
switch (GetType()) {
case Binary:
return binary;
case Char:
return std::vector<u8>(string.begin(), string.end());
case Wchar:
{
// use two u8 for each character of u16str
std::vector<u8> to_return(u16str.size() * 2);
for (size_t i = 0; i < u16str.size(); ++i) {
u16 tmp_char = u16str.at(i);
to_return[i*2] = (tmp_char & 0xFF00) >> 8;
to_return[i*2 + 1] = (tmp_char & 0x00FF);
}
return to_return;
}
case Empty:
return{};
case Invalid:
default:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
return{};
}
}
}

View file

@ -5,22 +5,21 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <string>
#include <utility>
#include <vector>
#include "common/common_types.h"
#include "common/string_util.h"
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h"
#include "core/file_sys/file_backend.h" #include "core/hle/result.h"
#include "core/file_sys/directory_backend.h"
#include "core/mem_map.h"
#include "core/hle/kernel/kernel.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// FileSys namespace
namespace FileSys { namespace FileSys {
class FileBackend;
class DirectoryBackend;
// Path string type // Path string type
enum LowPathType : u32 { enum LowPathType : u32 {
Invalid = 0, Invalid = 0,
@ -39,134 +38,22 @@ union Mode {
class Path { class Path {
public: public:
Path() : type(Invalid) {}
Path(const char* path) : type(Char), string(path) {}
Path(std::vector<u8> binary_data) : type(Binary), binary(std::move(binary_data)) {}
Path(LowPathType type, u32 size, u32 pointer);
Path() : type(Invalid) { LowPathType GetType() const { return type; }
}
Path(const char* path) : type(Char), string(path) {
}
Path(std::vector<u8> binary_data) : type(Binary), binary(std::move(binary_data)) {
}
Path(LowPathType type, u32 size, u32 pointer) : type(type) {
switch (type) {
case Binary:
{
u8* data = Memory::GetPointer(pointer);
binary = std::vector<u8>(data, data + size);
break;
}
case Char:
{
const char* data = reinterpret_cast<const char*>(Memory::GetPointer(pointer));
string = std::string(data, size - 1); // Data is always null-terminated.
break;
}
case Wchar:
{
const char16_t* data = reinterpret_cast<const char16_t*>(Memory::GetPointer(pointer));
u16str = std::u16string(data, size/2 - 1); // Data is always null-terminated.
break;
}
default:
break;
}
}
LowPathType GetType() const {
return type;
}
/** /**
* Gets the string representation of the path for debugging * Gets the string representation of the path for debugging
* @return String representation of the path for debugging * @return String representation of the path for debugging
*/ */
const std::string DebugStr() const { const std::string DebugStr() const;
switch (GetType()) {
case Invalid:
default:
return "[Invalid]";
case Empty:
return "[Empty]";
case Binary:
{
std::stringstream res;
res << "[Binary: ";
for (unsigned byte : binary)
res << std::hex << std::setw(2) << std::setfill('0') << byte;
res << ']';
return res.str();
}
case Char:
return "[Char: " + AsString() + ']';
case Wchar:
return "[Wchar: " + AsString() + ']';
}
}
const std::string AsString() const { const std::string AsString() const;
switch (GetType()) { const std::u16string AsU16Str() const;
case Char: const std::vector<u8> AsBinary() const;
return string;
case Wchar:
return Common::UTF16ToUTF8(u16str);
case Empty:
return {};
case Invalid:
case Binary:
default:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
return {};
}
}
const std::u16string AsU16Str() const {
switch (GetType()) {
case Char:
return Common::UTF8ToUTF16(string);
case Wchar:
return u16str;
case Empty:
return {};
case Invalid:
case Binary:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
return {};
}
}
const std::vector<u8> AsBinary() const {
switch (GetType()) {
case Binary:
return binary;
case Char:
return std::vector<u8>(string.begin(), string.end());
case Wchar:
{
// use two u8 for each character of u16str
std::vector<u8> to_return(u16str.size() * 2);
for (size_t i = 0; i < u16str.size(); ++i) {
u16 tmp_char = u16str.at(i);
to_return[i*2] = (tmp_char & 0xFF00) >> 8;
to_return[i*2 + 1] = (tmp_char & 0x00FF);
}
return to_return;
}
case Empty:
return {};
case Invalid:
default:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
return {};
}
}
private: private:
LowPathType type; LowPathType type;

View file

@ -6,6 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/archive_extsavedata.h"

View file

@ -6,6 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/archive_romfs.h" #include "core/file_sys/archive_romfs.h"

View file

@ -6,6 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/archive_savedata.h" #include "core/file_sys/archive_savedata.h"

View file

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/archive_savedatacheck.h" #include "core/file_sys/archive_savedatacheck.h"

View file

@ -6,6 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/archive_sdmc.h" #include "core/file_sys/archive_sdmc.h"

View file

@ -4,12 +4,11 @@
#pragma once #pragma once
#include <array>
#include <cstddef> #include <cstddef>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/kernel.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// FileSys namespace // FileSys namespace

View file

@ -6,6 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/disk_archive.h" #include "core/file_sys/disk_archive.h"

View file

@ -8,6 +8,8 @@
#include "common/file_util.h" #include "common/file_util.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/file_sys/directory_backend.h"
#include "core/file_sys/file_backend.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -6,8 +6,6 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/kernel.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// FileSys namespace // FileSys namespace

View file

@ -6,6 +6,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "core/file_sys/ivfc_archive.h" #include "core/file_sys/ivfc_archive.h"

View file

@ -10,6 +10,8 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_backend.h"
#include "core/file_sys/directory_backend.h"
#include "core/file_sys/file_backend.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -2,6 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cstring>
#include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"
@ -61,7 +64,7 @@ template void Read<u16>(u16 &var, const u32 addr);
template void Read<u8>(u8 &var, const u32 addr); template void Read<u8>(u8 &var, const u32 addr);
void Init() { void Init() {
memset(&config_mem, 0, sizeof(config_mem)); std::memset(&config_mem, 0, sizeof(config_mem));
config_mem.update_flag = 0; // No update config_mem.update_flag = 0; // No update
config_mem.sys_core_ver = 0x2; config_mem.sys_core_ver = 0x2;

View file

@ -4,6 +4,13 @@
#pragma once #pragma once
#include "common/common_types.h"
typedef u32 Handle;
typedef s32 Result;
const Handle INVALID_HANDLE = 0;
namespace HLE { namespace HLE {
extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread

View file

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h"
#include "core/mem_map.h" #include "core/mem_map.h"

View file

@ -6,7 +6,7 @@
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include "common/common.h" #include "common/assert.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"

View file

@ -4,7 +4,8 @@
#include <algorithm> #include <algorithm>
#include "common/common.h" #include "common/assert.h"
#include "common/logging/log.h"
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/core.h" #include "core/core.h"

View file

@ -10,19 +10,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "common/common.h" #include "common/common_types.h"
#include "core/hle/hle.h"
#include "core/hle/result.h" #include "core/hle/result.h"
typedef u32 Handle;
typedef s32 Result;
// TODO: It would be nice to eventually replace these with strong types that prevent accidental
// conversion between each other.
typedef u32 VAddr; ///< Represents a pointer in the userspace virtual address space.
typedef u32 PAddr; ///< Represents a pointer in the ARM11 physical address space.
const Handle INVALID_HANDLE = 0;
namespace Kernel { namespace Kernel {
class Thread; class Thread;

View file

@ -7,7 +7,7 @@
#include <boost/range/algorithm_ext/erase.hpp> #include <boost/range/algorithm_ext/erase.hpp>
#include "common/common.h" #include "common/assert.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/mutex.h" #include "core/hle/kernel/mutex.h"

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h" #include "common/assert.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/semaphore.h" #include "core/hle/kernel/semaphore.h"

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h" #include "common/logging/log.h"
#include "core/mem_map.h" #include "core/mem_map.h"
#include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/shared_memory.h"

View file

@ -6,7 +6,9 @@
#include <list> #include <list>
#include <vector> #include <vector>
#include "common/common.h" #include "common/assert.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/math_util.h" #include "common/math_util.h"
#include "common/thread_queue_list.h" #include "common/thread_queue_list.h"

View file

@ -2,7 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h" #include "common/assert.h"
#include "common/logging/log.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"

View file

@ -8,6 +8,7 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include "common/assert.h"
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/am_sys.h" #include "core/hle/service/am_sys.h"

View file

@ -2,7 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common_paths.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"

View file

@ -3,9 +3,6 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h"
#include "common/file_util.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"
#include "core/hle/service/apt/apt_s.h" #include "core/hle/service/apt/apt_s.h"

View file

@ -3,7 +3,6 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt.h"

View file

@ -4,12 +4,16 @@
#include <algorithm> #include <algorithm>
#include "core/hle/service/fs/archive.h" #include "common/logging/log.h"
#include "core/hle/service/service.h" #include "common/string_util.h"
#include "core/file_sys/file_backend.h"
#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg.h"
#include "core/hle/service/cfg/cfg_i.h" #include "core/hle/service/cfg/cfg_i.h"
#include "core/hle/service/cfg/cfg_s.h" #include "core/hle/service/cfg/cfg_s.h"
#include "core/hle/service/cfg/cfg_u.h" #include "core/hle/service/cfg/cfg_u.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/service.h"
namespace Service { namespace Service {
namespace CFG { namespace CFG {

View file

@ -3,7 +3,9 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/file_sys/archive_systemsavedata.h" #include "core/file_sys/archive_systemsavedata.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/service/dsp_dsp.h" #include "core/hle/service/dsp_dsp.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/err_f.h" #include "core/hle/service/err_f.h"

View file

@ -9,6 +9,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/make_unique.h" #include "common/make_unique.h"
#include "common/math_util.h" #include "common/math_util.h"
@ -78,6 +79,11 @@ enum class DirectoryCommand : u32 {
Close = 0x08020000, Close = 0x08020000,
}; };
File::File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path & path)
: path(path), priority(0), backend(std::move(backend)) {}
File::~File() {}
ResultVal<bool> File::SyncRequest() { ResultVal<bool> File::SyncRequest() {
u32* cmd_buff = Kernel::GetCommandBuffer(); u32* cmd_buff = Kernel::GetCommandBuffer();
FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]); FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]);
@ -172,6 +178,11 @@ ResultVal<bool> File::SyncRequest() {
return MakeResult<bool>(false); return MakeResult<bool>(false);
} }
Directory::Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path & path)
: path(path), backend(std::move(backend)) {}
Directory::~Directory() {}
ResultVal<bool> Directory::SyncRequest() { ResultVal<bool> Directory::SyncRequest() {
u32* cmd_buff = Kernel::GetCommandBuffer(); u32* cmd_buff = Kernel::GetCommandBuffer();
DirectoryCommand cmd = static_cast<DirectoryCommand>(cmd_buff[0]); DirectoryCommand cmd = static_cast<DirectoryCommand>(cmd_buff[0]);

View file

@ -45,31 +45,27 @@ typedef u64 ArchiveHandle;
class File : public Kernel::Session { class File : public Kernel::Session {
public: public:
File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path) File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path);
: path(path), priority(0), backend(std::move(backend)) { ~File();
}
std::string GetName() const override { return "Path: " + path.DebugStr(); } std::string GetName() const override { return "Path: " + path.DebugStr(); }
ResultVal<bool> SyncRequest() override;
FileSys::Path path; ///< Path of the file FileSys::Path path; ///< Path of the file
u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means
std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface
ResultVal<bool> SyncRequest() override;
}; };
class Directory : public Kernel::Session { class Directory : public Kernel::Session {
public: public:
Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path& path) Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path& path);
: path(path), backend(std::move(backend)) { ~Directory();
}
std::string GetName() const override { return "Directory: " + path.DebugStr(); } std::string GetName() const override { return "Directory: " + path.DebugStr(); }
ResultVal<bool> SyncRequest() override;
FileSys::Path path; ///< Path of the directory FileSys::Path path; ///< Path of the directory
std::unique_ptr<FileSys::DirectoryBackend> backend; ///< File backend interface std::unique_ptr<FileSys::DirectoryBackend> backend; ///< File backend interface
ResultVal<bool> SyncRequest() override;
}; };
/** /**

View file

@ -2,10 +2,13 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h" #include "common/assert.h"
#include "common/common_types.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h"
#include "common/scope_exit.h" #include "common/scope_exit.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
#include "core/hle/service/fs/fs_user.h" #include "core/hle/service/fs/fs_user.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/hid/hid.h" #include "core/hle/service/hid/hid.h"
#include "core/hle/service/hid/hid_spvr.h" #include "core/hle/service/hid/hid_spvr.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/ldr_ro.h" #include "core/hle/service/ldr_ro.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/nim_u.h" #include "core/hle/service/nim_u.h"

View file

@ -3,8 +3,6 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/common.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/ns_s.h" #include "core/hle/service/ns_s.h"

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/service/nwm_uds.h" #include "core/hle/service/nwm_uds.h"

View file

@ -2,12 +2,13 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/hle/service/service.h" #include "core/file_sys/file_backend.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
#include "core/hle/service/ptm/ptm.h" #include "core/hle/service/ptm/ptm.h"
#include "core/hle/service/ptm/ptm_play.h" #include "core/hle/service/ptm/ptm_play.h"
#include "core/hle/service/ptm/ptm_sysm.h" #include "core/hle/service/ptm/ptm_sysm.h"
#include "core/hle/service/ptm/ptm_u.h" #include "core/hle/service/ptm/ptm_u.h"
#include "core/hle/service/service.h"
namespace Service { namespace Service {
namespace PTM { namespace PTM {

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/make_unique.h" #include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/ptm/ptm.h" #include "core/hle/service/ptm/ptm.h"

View file

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

View file

@ -9,7 +9,7 @@
#include <boost/container/flat_map.hpp> #include <boost/container/flat_map.hpp>
#include "common/common.h" #include "common/common_types.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/session.h" #include "core/hle/kernel/session.h"

View file

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

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/service/srv.h" #include "core/hle/service/srv.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"

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