Some xb style cleanup.
This commit is contained in:
parent
eaa1a8ee3a
commit
e6461f326c
|
@ -83,8 +83,8 @@ size_t Arena::CalculateSize() {
|
|||
|
||||
void* Arena::CloneContents() {
|
||||
size_t total_length = CalculateSize();
|
||||
void* result = malloc(total_length);
|
||||
uint8_t* p = (uint8_t*)result;
|
||||
auto result = reinterpret_cast<uint8_t*>(malloc(total_length));
|
||||
auto p = result;
|
||||
Chunk* chunk = head_chunk_;
|
||||
while (chunk) {
|
||||
std::memcpy(p, chunk->buffer, chunk->offset);
|
||||
|
@ -98,7 +98,7 @@ void* Arena::CloneContents() {
|
|||
}
|
||||
|
||||
void Arena::CloneContents(void* buffer, size_t buffer_length) {
|
||||
uint8_t* p = (uint8_t*)buffer;
|
||||
uint8_t* p = reinterpret_cast<uint8_t*>(buffer);
|
||||
Chunk* chunk = head_chunk_;
|
||||
while (chunk) {
|
||||
std::memcpy(p, chunk->buffer, chunk->offset);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace xe {
|
|||
|
||||
class Arena {
|
||||
public:
|
||||
Arena(size_t chunk_size = 4 * 1024 * 1024);
|
||||
explicit Arena(size_t chunk_size = 4 * 1024 * 1024);
|
||||
~Arena();
|
||||
|
||||
void Reset();
|
||||
|
@ -33,15 +33,15 @@ class Arena {
|
|||
|
||||
void* CloneContents();
|
||||
template <typename T>
|
||||
void CloneContents(std::vector<T>& buffer) {
|
||||
buffer.resize(CalculateSize() / sizeof(T));
|
||||
CloneContents(buffer.data(), buffer.size() * sizeof(T));
|
||||
void CloneContents(std::vector<T>* buffer) {
|
||||
buffer->resize(CalculateSize() / sizeof(T));
|
||||
CloneContents(buffer->data(), buffer->size() * sizeof(T));
|
||||
}
|
||||
|
||||
private:
|
||||
class Chunk {
|
||||
public:
|
||||
Chunk(size_t chunk_size);
|
||||
explicit Chunk(size_t chunk_size);
|
||||
~Chunk();
|
||||
|
||||
Chunk* next;
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/platform.h"
|
||||
|
||||
#if XE_PLATFORM_MAC
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#endif // XE_PLATFORM_MAC
|
||||
|
||||
namespace xe {
|
||||
|
||||
#if XE_PLATFORM_WIN32
|
||||
|
|
|
@ -33,7 +33,7 @@ thread_local uint64_t last_host_tick_count_ = Clock::QueryHostTickCount();
|
|||
|
||||
void RecomputeGuestTickScalar() {
|
||||
guest_tick_scalar_ = (guest_tick_frequency_ * guest_time_scalar_) /
|
||||
double(Clock::host_tick_frequency());
|
||||
static_cast<double>(Clock::host_tick_frequency());
|
||||
}
|
||||
|
||||
void UpdateGuestClock() {
|
||||
|
@ -108,7 +108,7 @@ int64_t Clock::ScaleGuestDurationFileTime(int64_t guest_file_time) {
|
|||
return scaled_file_time;
|
||||
}
|
||||
|
||||
void Clock::ScaleGuestDurationTimeval(long* tv_sec, long* tv_usec) {
|
||||
void Clock::ScaleGuestDurationTimeval(int32_t* tv_sec, int32_t* tv_usec) {
|
||||
uint64_t scaled_sec = uint64_t(uint64_t(*tv_sec) * guest_tick_scalar_);
|
||||
uint64_t scaled_usec = uint64_t(uint64_t(*tv_usec) * guest_time_scalar_);
|
||||
if (scaled_usec > UINT_MAX) {
|
||||
|
@ -116,8 +116,8 @@ void Clock::ScaleGuestDurationTimeval(long* tv_sec, long* tv_usec) {
|
|||
scaled_usec -= overflow_sec * 1000000;
|
||||
scaled_sec += overflow_sec;
|
||||
}
|
||||
*tv_sec = long(scaled_sec);
|
||||
*tv_usec = long(scaled_usec);
|
||||
*tv_sec = int32_t(scaled_sec);
|
||||
*tv_usec = int32_t(scaled_usec);
|
||||
}
|
||||
|
||||
} // namespace xe
|
||||
|
|
|
@ -52,7 +52,7 @@ class Clock {
|
|||
// Scales a time duration in 100ns ticks like FILETIME, from guest time.
|
||||
static int64_t ScaleGuestDurationFileTime(int64_t guest_file_time);
|
||||
// Scales a time duration represented as a timeval, from guest time.
|
||||
static void ScaleGuestDurationTimeval(long* tv_sec, long* tv_usec);
|
||||
static void ScaleGuestDurationTimeval(int32_t* tv_sec, int32_t* tv_usec);
|
||||
};
|
||||
|
||||
} // namespace xe
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace xe {
|
|||
namespace filesystem {
|
||||
|
||||
std::string CanonicalizePath(const std::string& original_path) {
|
||||
char path_sep(xe::path_separator);
|
||||
char path_sep(xe::kPathSeparator);
|
||||
std::string path(xe::fix_path_separators(original_path, path_sep));
|
||||
|
||||
std::vector<std::string::size_type> path_breaks;
|
||||
|
@ -111,19 +111,19 @@ WildcardRule::WildcardRule(const std::string& str_match,
|
|||
}
|
||||
|
||||
bool WildcardRule::Check(const std::string& str_lower,
|
||||
std::string::size_type& offset) const {
|
||||
std::string::size_type* offset) const {
|
||||
if (match.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((str_lower.size() - offset) < match.size()) {
|
||||
if ((str_lower.size() - *offset) < match.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string::size_type result(str_lower.find(match, offset));
|
||||
std::string::size_type result(str_lower.find(match, *offset));
|
||||
|
||||
if (result != std::string::npos) {
|
||||
if (rules.FromStart && result != offset) {
|
||||
if (rules.FromStart && result != *offset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ bool WildcardRule::Check(const std::string& str_lower,
|
|||
return false;
|
||||
}
|
||||
|
||||
offset = (result + match.size());
|
||||
*offset = (result + match.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ bool WildcardEngine::Match(const std::string& str) const {
|
|||
|
||||
std::string::size_type offset(0);
|
||||
for (const auto& rule : rules) {
|
||||
if (!(rule.Check(str_lc, offset))) {
|
||||
if (!(rule.Check(str_lc, &offset))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class FileHandle {
|
|||
virtual void Flush() = 0;
|
||||
|
||||
protected:
|
||||
FileHandle(std::wstring path) : path_(std::move(path)) {}
|
||||
explicit FileHandle(std::wstring path) : path_(std::move(path)) {}
|
||||
|
||||
std::wstring path_;
|
||||
};
|
||||
|
@ -105,7 +105,7 @@ class WildcardRule {
|
|||
public:
|
||||
WildcardRule(const std::string& str_match, const WildcardFlags& flags);
|
||||
bool Check(const std::string& str_lower,
|
||||
std::string::size_type& offset) const;
|
||||
std::string::size_type* offset) const;
|
||||
|
||||
private:
|
||||
std::string match;
|
||||
|
|
|
@ -22,12 +22,12 @@ bool PathExists(const std::wstring& path) {
|
|||
}
|
||||
|
||||
bool CreateFolder(const std::wstring& path) {
|
||||
wchar_t folder[MAX_PATH] = {0};
|
||||
auto end = std::wcschr(path.c_str(), xe::wpath_separator);
|
||||
wchar_t folder[kMaxPath] = {0};
|
||||
auto end = std::wcschr(path.c_str(), xe::kWPathSeparator);
|
||||
while (end) {
|
||||
wcsncpy(folder, path.c_str(), end - path.c_str() + 1);
|
||||
CreateDirectory(folder, NULL);
|
||||
end = wcschr(++end, xe::wpath_separator);
|
||||
end = wcschr(++end, xe::kWPathSeparator);
|
||||
}
|
||||
return PathExists(path);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <cstdarg>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/main.h"
|
||||
#include "xenia/base/math.h"
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_LOGGING_H_
|
||||
#define XENIA_LOGGING_H_
|
||||
#ifndef XENIA_BASE_LOGGING_H_
|
||||
#define XENIA_BASE_LOGGING_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -102,4 +102,4 @@ void handle_fatal(const char* fmt, ...);
|
|||
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_LOGGING_H_
|
||||
#endif // XENIA_BASE_LOGGING_H_
|
||||
|
|
|
@ -29,9 +29,9 @@ void copy_and_swap_16_unaligned(uint16_t* dest, const uint16_t* src,
|
|||
__m128i input, output;
|
||||
|
||||
for (i = 0; i + 8 <= count; i += 8) {
|
||||
input = _mm_loadu_si128((__m128i*)&src[i]);
|
||||
input = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&src[i]));
|
||||
output = _mm_or_si128(_mm_slli_epi16(input, 8), _mm_srli_epi16(input, 8));
|
||||
_mm_storeu_si128((__m128i*)&dest[i], output);
|
||||
_mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output);
|
||||
}
|
||||
|
||||
for (; i < count; ++i) { // handle residual elements
|
||||
|
@ -52,7 +52,7 @@ void copy_and_swap_32_unaligned(uint32_t* dest, const uint32_t* src,
|
|||
__m128i byte3mask = _mm_set1_epi32(0x0000FF00);
|
||||
|
||||
for (i = 0; i + 4 <= count; i += 4) {
|
||||
input = _mm_loadu_si128((__m128i*)&src[i]);
|
||||
input = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&src[i]));
|
||||
|
||||
// Do the four shifts
|
||||
byte1 = _mm_slli_epi32(input, 24);
|
||||
|
@ -67,7 +67,7 @@ void copy_and_swap_32_unaligned(uint32_t* dest, const uint32_t* src,
|
|||
byte3 = _mm_and_si128(byte3, byte3mask);
|
||||
output = _mm_or_si128(output, byte3);
|
||||
|
||||
_mm_storeu_si128((__m128i*)&dest[i], output);
|
||||
_mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output);
|
||||
}
|
||||
|
||||
for (; i < count; ++i) { // handle residual elements
|
||||
|
@ -88,7 +88,7 @@ void copy_and_swap_64_unaligned(uint64_t* dest, const uint64_t* src,
|
|||
__m128i byte3mask = _mm_set1_epi32(0x0000FF00);
|
||||
|
||||
for (i = 0; i + 2 <= count; i += 2) {
|
||||
input = _mm_loadu_si128((__m128i*)&src[i]);
|
||||
input = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&src[i]));
|
||||
|
||||
// Do the four shifts
|
||||
byte1 = _mm_slli_epi32(input, 24);
|
||||
|
@ -106,7 +106,7 @@ void copy_and_swap_64_unaligned(uint64_t* dest, const uint64_t* src,
|
|||
// Reorder the two words
|
||||
output = _mm_shuffle_epi32(output, _MM_SHUFFLE(2, 3, 0, 1));
|
||||
|
||||
_mm_storeu_si128((__m128i*)&dest[i], output);
|
||||
_mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output);
|
||||
}
|
||||
|
||||
for (; i < count; ++i) { // handle residual elements
|
||||
|
@ -119,9 +119,9 @@ void copy_and_swap_16_in_32_aligned(uint32_t* dest, const uint32_t* src,
|
|||
size_t i;
|
||||
__m128i input, output;
|
||||
for (i = 0; i + 4 <= count; i += 4) {
|
||||
input = _mm_loadu_si128((__m128i*)&src[i]);
|
||||
input = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&src[i]));
|
||||
output = _mm_or_si128(_mm_slli_epi32(input, 16), _mm_srli_epi32(input, 16));
|
||||
_mm_storeu_si128((__m128i*)&dest[i], output);
|
||||
_mm_storeu_si128(reinterpret_cast<__m128i*>(&dest[i]), output);
|
||||
}
|
||||
for (; i < count; ++i) { // handle residual elements
|
||||
dest[i] = (src[i] >> 16) | (src[i] << 16);
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#include "third_party/catch/include/catch.hpp"
|
||||
#include "xenia/base/memory.h"
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::memory;
|
||||
|
||||
TEST_CASE("copy_and_swap_16_aligned", "Copy and Swap") {
|
||||
// TODO(benvanik): tests.
|
||||
REQUIRE(true == true);
|
||||
|
|
|
@ -61,16 +61,20 @@
|
|||
#include <x86intrin.h>
|
||||
#endif // XE_PLATFORM_WIN32
|
||||
|
||||
#if XE_PLATFORM_MAC
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#endif // XE_PLATFORM_MAC
|
||||
|
||||
namespace xe {
|
||||
|
||||
#if XE_PLATFORM_WIN32
|
||||
const char path_separator = '\\';
|
||||
const wchar_t wpath_separator = L'\\';
|
||||
const size_t max_path = 260; // _MAX_PATH
|
||||
const char kPathSeparator = '\\';
|
||||
const wchar_t kWPathSeparator = L'\\';
|
||||
const size_t kMaxPath = 260; // _MAX_PATH
|
||||
#else
|
||||
const char path_separator = '/';
|
||||
const wchar_t wpath_separator = L'/';
|
||||
const size_t max_path = 1024; // PATH_MAX
|
||||
const char kPathSeparator = '/';
|
||||
const wchar_t kWPathSeparator = L'/';
|
||||
const size_t kMaxPath = 1024; // PATH_MAX
|
||||
#endif // XE_PLATFORM_WIN32
|
||||
|
||||
// Launches a web browser to the given URL.
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace xe {
|
|||
template <typename T>
|
||||
class ResetScope {
|
||||
public:
|
||||
ResetScope(T* value) : value_(value) {}
|
||||
explicit ResetScope(T* value) : value_(value) {}
|
||||
~ResetScope() {
|
||||
if (value_) {
|
||||
value_->Reset();
|
||||
|
|
|
@ -61,4 +61,4 @@ class RingBuffer {
|
|||
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_BASE_RING_BUFFER_H_
|
||||
#endif // XENIA_BASE_RING_BUFFER_H_
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/base/threading.h"
|
||||
|
||||
|
@ -112,4 +115,4 @@ class SocketServer {
|
|||
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_BASE_SOCKET_H_
|
||||
#endif // XENIA_BASE_SOCKET_H_
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
|
||||
#include "xenia/base/logging.h"
|
||||
|
||||
// platform_win.h must come first to include Windows headers.
|
||||
#include "xenia/base/platform_win.h"
|
||||
#include <mstcpip.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <mstcpip.h> // NOLINT(must follow platform_win.h)
|
||||
#include <winsock2.h> // NOLINT(must follow platform_win.h)
|
||||
#include <ws2tcpip.h> // NOLINT(must follow platform_win.h)
|
||||
|
||||
namespace xe {
|
||||
|
||||
|
@ -63,7 +62,8 @@ class Win32Socket : public Socket {
|
|||
return false;
|
||||
}
|
||||
// Connect to server.
|
||||
ret = connect(try_socket, ptr->ai_addr, (int)ptr->ai_addrlen);
|
||||
ret =
|
||||
connect(try_socket, ptr->ai_addr, static_cast<int>(ptr->ai_addrlen));
|
||||
if (ret == SOCKET_ERROR) {
|
||||
closesocket(try_socket);
|
||||
try_socket = INVALID_SOCKET;
|
||||
|
@ -133,8 +133,8 @@ class Win32Socket : public Socket {
|
|||
if (socket_ == INVALID_SOCKET) {
|
||||
return -1;
|
||||
}
|
||||
int ret =
|
||||
recv(socket_, reinterpret_cast<char*>(buffer), int(buffer_capacity), 0);
|
||||
int ret = recv(socket_, reinterpret_cast<char*>(buffer),
|
||||
static_cast<int>(buffer_capacity), 0);
|
||||
if (ret == SOCKET_ERROR) {
|
||||
int e = WSAGetLastError();
|
||||
if (e == WSAEWOULDBLOCK) {
|
||||
|
|
|
@ -43,11 +43,11 @@ std::string::size_type find_first_of_case(const std::string& target,
|
|||
|
||||
std::wstring to_absolute_path(const std::wstring& path) {
|
||||
#if XE_PLATFORM_WIN32
|
||||
wchar_t buffer[xe::max_path];
|
||||
wchar_t buffer[kMaxPath];
|
||||
_wfullpath(buffer, path.c_str(), sizeof(buffer) / sizeof(wchar_t));
|
||||
return buffer;
|
||||
#else
|
||||
char buffer[xe::max_path];
|
||||
char buffer[kMaxPath];
|
||||
realpath(xe::to_string(path).c_str(), buffer);
|
||||
return xe::to_wstring(buffer);
|
||||
#endif // XE_PLATFORM_WIN32
|
||||
|
|
|
@ -33,16 +33,16 @@ std::vector<std::string> split_path(const std::string& path);
|
|||
|
||||
// Joins two path segments with the given separator.
|
||||
std::string join_paths(const std::string& left, const std::string& right,
|
||||
char sep = xe::path_separator);
|
||||
char sep = xe::kPathSeparator);
|
||||
std::wstring join_paths(const std::wstring& left, const std::wstring& right,
|
||||
wchar_t sep = xe::path_separator);
|
||||
wchar_t sep = xe::kPathSeparator);
|
||||
|
||||
// Replaces all path separators with the given value and removes redundant
|
||||
// separators.
|
||||
std::wstring fix_path_separators(const std::wstring& source,
|
||||
wchar_t new_sep = xe::path_separator);
|
||||
wchar_t new_sep = xe::kPathSeparator);
|
||||
std::string fix_path_separators(const std::string& source,
|
||||
char new_sep = xe::path_separator);
|
||||
char new_sep = xe::kPathSeparator);
|
||||
|
||||
// Find the top directory name or filename from a path.
|
||||
std::string find_name_from_path(const std::string& path);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace xe {
|
|||
|
||||
class StringBuffer {
|
||||
public:
|
||||
StringBuffer(size_t initial_capacity = 0);
|
||||
explicit StringBuffer(size_t initial_capacity = 0);
|
||||
~StringBuffer();
|
||||
|
||||
size_t length() const { return buffer_offset_; }
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -61,7 +61,7 @@ void set_name(DWORD thread_id, const std::string& name) {
|
|||
__try {
|
||||
RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR),
|
||||
reinterpret_cast<ULONG_PTR*>(&info));
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ std::unique_ptr<HighResolutionTimer> HighResolutionTimer::CreateRepeating(
|
|||
template <typename T>
|
||||
class Win32Handle : public T {
|
||||
public:
|
||||
Win32Handle(HANDLE handle) : handle_(handle) {}
|
||||
explicit Win32Handle(HANDLE handle) : handle_(handle) {}
|
||||
~Win32Handle() override {
|
||||
CloseHandle(handle_);
|
||||
handle_ = nullptr;
|
||||
|
@ -236,7 +236,7 @@ std::pair<WaitResult, size_t> WaitMultiple(WaitHandle* wait_handles[],
|
|||
|
||||
class Win32Event : public Win32Handle<Event> {
|
||||
public:
|
||||
Win32Event(HANDLE handle) : Win32Handle(handle) {}
|
||||
explicit Win32Event(HANDLE handle) : Win32Handle(handle) {}
|
||||
~Win32Event() override = default;
|
||||
void Set() override { SetEvent(handle_); }
|
||||
void Reset() override { ResetEvent(handle_); }
|
||||
|
@ -255,7 +255,7 @@ std::unique_ptr<Event> Event::CreateAutoResetEvent(bool initial_state) {
|
|||
|
||||
class Win32Semaphore : public Win32Handle<Semaphore> {
|
||||
public:
|
||||
Win32Semaphore(HANDLE handle) : Win32Handle(handle) {}
|
||||
explicit Win32Semaphore(HANDLE handle) : Win32Handle(handle) {}
|
||||
~Win32Semaphore() override = default;
|
||||
bool Release(int release_count, int* out_previous_count) override {
|
||||
return ReleaseSemaphore(handle_, release_count,
|
||||
|
@ -273,7 +273,7 @@ std::unique_ptr<Semaphore> Semaphore::Create(int initial_count,
|
|||
|
||||
class Win32Mutant : public Win32Handle<Mutant> {
|
||||
public:
|
||||
Win32Mutant(HANDLE handle) : Win32Handle(handle) {}
|
||||
explicit Win32Mutant(HANDLE handle) : Win32Handle(handle) {}
|
||||
~Win32Mutant() = default;
|
||||
bool Release() override { return ReleaseMutex(handle_) ? true : false; }
|
||||
};
|
||||
|
@ -285,7 +285,7 @@ std::unique_ptr<Mutant> Mutant::Create(bool initial_owner) {
|
|||
|
||||
class Win32Timer : public Win32Handle<Timer> {
|
||||
public:
|
||||
Win32Timer(HANDLE handle) : Win32Handle(handle) {}
|
||||
explicit Win32Timer(HANDLE handle) : Win32Handle(handle) {}
|
||||
~Win32Timer() = default;
|
||||
bool SetOnce(std::chrono::nanoseconds due_time,
|
||||
std::function<void()> opt_callback) override {
|
||||
|
@ -349,7 +349,7 @@ std::unique_ptr<Timer> Timer::CreateSynchronizationTimer() {
|
|||
|
||||
class Win32Thread : public Win32Handle<Thread> {
|
||||
public:
|
||||
Win32Thread(HANDLE handle) : Win32Handle(handle) {}
|
||||
explicit Win32Thread(HANDLE handle) : Win32Handle(handle) {}
|
||||
~Win32Thread() = default;
|
||||
|
||||
void set_name(std::string name) override {
|
||||
|
|
|
@ -111,7 +111,7 @@ bool X64Emitter::Emit(GuestFunction* function, HIRBuilder* builder,
|
|||
out_code_address = Emplace(stack_size, function);
|
||||
|
||||
// Stash source map.
|
||||
source_map_arena_.CloneContents(out_source_map);
|
||||
source_map_arena_.CloneContents(&out_source_map);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ struct TestCase {
|
|||
class TestSuite {
|
||||
public:
|
||||
TestSuite(const std::wstring& src_file_path) : src_file_path(src_file_path) {
|
||||
name = src_file_path.substr(src_file_path.find_last_of(xe::path_separator) +
|
||||
name = src_file_path.substr(src_file_path.find_last_of(xe::kPathSeparator) +
|
||||
1);
|
||||
name = ReplaceExtension(name, L"");
|
||||
map_file_path = xe::to_wstring(FLAGS_test_bin_path) + name + L".map";
|
||||
|
|
|
@ -45,7 +45,7 @@ bool RawModule::LoadFile(uint32_t base_address, const std::wstring& path) {
|
|||
fclose(file);
|
||||
|
||||
// Setup debug info.
|
||||
auto last_slash = fixed_path.find_last_of(xe::path_separator);
|
||||
auto last_slash = fixed_path.find_last_of(xe::kPathSeparator);
|
||||
if (last_slash != std::string::npos) {
|
||||
name_ = xe::to_string(fixed_path.substr(last_slash + 1));
|
||||
} else {
|
||||
|
|
|
@ -186,7 +186,7 @@ X_STATUS Emulator::Setup(ui::Window* display_window) {
|
|||
X_STATUS Emulator::LaunchPath(std::wstring path) {
|
||||
// Launch based on file type.
|
||||
// This is a silly guess based on file extension.
|
||||
auto last_slash = path.find_last_of(xe::path_separator);
|
||||
auto last_slash = path.find_last_of(xe::kPathSeparator);
|
||||
auto last_dot = path.find_last_of('.');
|
||||
if (last_dot < last_slash) {
|
||||
last_dot = std::wstring::npos;
|
||||
|
|
|
@ -331,7 +331,7 @@ bool GL4Shader::CompileProgram(std::string source) {
|
|||
|
||||
// Save to disk, if we asked for it.
|
||||
auto base_path = FLAGS_dump_shaders.c_str();
|
||||
char file_name[xe::max_path];
|
||||
char file_name[kMaxPath];
|
||||
snprintf(file_name, xe::countof(file_name), "%s/gl4_gen_%.16llX.%s",
|
||||
base_path, data_hash_,
|
||||
shader_type_ == ShaderType::kVertex ? "vert" : "frag");
|
||||
|
|
|
@ -81,7 +81,7 @@ std::wstring ContentManager::ResolvePackageRoot(uint32_t content_type) {
|
|||
// content_root/title_id/type_name/
|
||||
auto package_root =
|
||||
xe::join_paths(root_path_, xe::join_paths(title_id, type_name));
|
||||
return package_root + xe::wpath_separator;
|
||||
return package_root + xe::kWPathSeparator;
|
||||
}
|
||||
|
||||
std::wstring ContentManager::ResolvePackagePath(const XCONTENT_DATA& data) {
|
||||
|
@ -90,7 +90,7 @@ std::wstring ContentManager::ResolvePackagePath(const XCONTENT_DATA& data) {
|
|||
auto package_root = ResolvePackageRoot(data.content_type);
|
||||
auto package_path =
|
||||
xe::join_paths(package_root, xe::to_wstring(data.file_name));
|
||||
package_path += xe::path_separator;
|
||||
package_path += xe::kPathSeparator;
|
||||
return package_path;
|
||||
}
|
||||
|
||||
|
|
|
@ -593,9 +593,11 @@ SHIM_CALL NetDll_select_shim(PPCContext* ppc_context,
|
|||
timeval* timeout_in = nullptr;
|
||||
timeval timeout;
|
||||
if (timeout_ptr) {
|
||||
timeout = {static_cast<long>(SHIM_MEM_32(timeout_ptr + 0)),
|
||||
static_cast<long>(SHIM_MEM_32(timeout_ptr + 4))};
|
||||
Clock::ScaleGuestDurationTimeval(&timeout.tv_sec, &timeout.tv_usec);
|
||||
timeout = {static_cast<int32_t>(SHIM_MEM_32(timeout_ptr + 0)),
|
||||
static_cast<int32_t>(SHIM_MEM_32(timeout_ptr + 4))};
|
||||
Clock::ScaleGuestDurationTimeval(
|
||||
reinterpret_cast<int32_t*>(&timeout.tv_sec),
|
||||
reinterpret_cast<int32_t*>(&timeout.tv_usec));
|
||||
timeout_in = &timeout;
|
||||
}
|
||||
int ret = select(nfds, readfds_ptr ? &readfds : nullptr,
|
||||
|
|
Loading…
Reference in New Issue