Postmortem debug target now loads/scans the trace and inits the filesystem.

This commit is contained in:
Ben Vanik
2014-08-15 10:19:59 -07:00
parent 4768f2fc0b
commit 3de39aaf10
27 changed files with 541 additions and 255 deletions

View File

@@ -12,6 +12,7 @@
#include <string>
#include <poly/assert.h>
#include <poly/byte_order.h>
namespace poly {
@@ -60,6 +61,20 @@ template <>
inline double load<double>(const void* mem) {
return *reinterpret_cast<const double*>(mem);
}
template <typename T>
inline T load(const void* mem) {
if (sizeof(T) == 1) {
return static_cast<T>(load<uint8_t>(mem));
} else if (sizeof(T) == 2) {
return static_cast<T>(load<uint16_t>(mem));
} else if (sizeof(T) == 4) {
return static_cast<T>(load<uint32_t>(mem));
} else if (sizeof(T) == 8) {
return static_cast<T>(load<uint64_t>(mem));
} else {
assert_always("Invalid poly::load size");
}
}
template <typename T>
T load_and_swap(const void* mem);
@@ -172,6 +187,20 @@ template <>
inline void store<double>(void* mem, double value) {
*reinterpret_cast<double*>(mem) = value;
}
template <typename T>
inline void store(const void* mem, T value) {
if (sizeof(T) == 1) {
store<uint8_t>(mem, static_cast<uint8_t>(value));
} else if (sizeof(T) == 2) {
store<uint8_t>(mem, static_cast<uint16_t>(value));
} else if (sizeof(T) == 4) {
store<uint8_t>(mem, static_cast<uint32_t>(value));
} else if (sizeof(T) == 8) {
store<uint8_t>(mem, static_cast<uint64_t>(value));
} else {
assert_always("Invalid poly::store size");
}
}
template <typename T>
void store_and_swap(void* mem, T value);

View File

@@ -19,6 +19,7 @@
#include <poly/math.h>
#include <poly/memory.h>
#include <poly/platform.h>
#include <poly/string.h>
#include <poly/threading.h>
namespace poly {} // namespace poly

View File

@@ -15,6 +15,8 @@
'poly-private.h',
'poly.cc',
'poly.h',
'string.cc',
'string.h',
'threading.h',
],

26
src/poly/string.cc Normal file
View File

@@ -0,0 +1,26 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <poly/string.h>
#include <codecvt>
namespace poly {
std::string to_string(const std::wstring& source) {
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.to_bytes(source);
}
std::wstring to_wstring(const std::string& source) {
static std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(source);
}
} // namespace poly

24
src/poly/string.h Normal file
View File

@@ -0,0 +1,24 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef POLY_STRING_H_
#define POLY_STRING_H_
#include <string>
#include <poly/config.h>
namespace poly {
std::string to_string(const std::wstring& source);
std::wstring to_wstring(const std::string& source);
} // namespace poly
#endif // POLY_STRING_H_