From f65d860640b832e0a28121c68e0228090476b439 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 21 Aug 2014 22:27:33 -0700 Subject: [PATCH 1/4] Cleaning up some clang issues. --- src/alloy/arena.h | 1 + src/alloy/backend/x64/x64_code_cache_posix.cc | 1 + src/alloy/frontend/context_info.h | 1 + src/alloy/runtime/debug_info.cc | 2 +- src/alloy/runtime/debug_info.h | 1 + src/poly/logging.cc | 4 ++-- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/alloy/arena.h b/src/alloy/arena.h index d7b956001..764dd31bf 100644 --- a/src/alloy/arena.h +++ b/src/alloy/arena.h @@ -10,6 +10,7 @@ #ifndef ALLOY_ARENA_H_ #define ALLOY_ARENA_H_ +#include #include namespace alloy { diff --git a/src/alloy/backend/x64/x64_code_cache_posix.cc b/src/alloy/backend/x64/x64_code_cache_posix.cc index 0fa023ab5..c32990cd6 100644 --- a/src/alloy/backend/x64/x64_code_cache_posix.cc +++ b/src/alloy/backend/x64/x64_code_cache_posix.cc @@ -13,6 +13,7 @@ #include #include +#include namespace alloy { namespace backend { diff --git a/src/alloy/frontend/context_info.h b/src/alloy/frontend/context_info.h index 506b3572c..68cf52e18 100644 --- a/src/alloy/frontend/context_info.h +++ b/src/alloy/frontend/context_info.h @@ -10,6 +10,7 @@ #ifndef ALLOY_FRONTEND_CONTEXT_INFO_H_ #define ALLOY_FRONTEND_CONTEXT_INFO_H_ +#include #include namespace alloy { diff --git a/src/alloy/runtime/debug_info.cc b/src/alloy/runtime/debug_info.cc index 5abe39257..6a34e4238 100644 --- a/src/alloy/runtime/debug_info.cc +++ b/src/alloy/runtime/debug_info.cc @@ -9,7 +9,7 @@ #include -#include +#include namespace alloy { namespace runtime { diff --git a/src/alloy/runtime/debug_info.h b/src/alloy/runtime/debug_info.h index 6df923a69..4540deecf 100644 --- a/src/alloy/runtime/debug_info.h +++ b/src/alloy/runtime/debug_info.h @@ -10,6 +10,7 @@ #ifndef ALLOY_RUNTIME_DEBUG_INFO_H_ #define ALLOY_RUNTIME_DEBUG_INFO_H_ +#include #include namespace alloy { diff --git a/src/poly/logging.cc b/src/poly/logging.cc index dcd3aa32a..d7095d43c 100644 --- a/src/poly/logging.cc +++ b/src/poly/logging.cc @@ -79,7 +79,7 @@ void log_line(const char* file_path, const uint32_t line_number, #if 0 // defined(OutputDebugString) OutputDebugStringA(buffer); #else - fprintf(stdout, buffer); + fprintf(stdout, "%s", buffer); fflush(stdout); #endif // OutputDebugString if (!FLAGS_fast_stdout) { @@ -102,7 +102,7 @@ void handle_fatal(const char* file_path, const uint32_t line_number, #if defined(OutputDebugString) OutputDebugStringA(buffer); #else - fprintf(stderr, buffer); + fprintf(stderr, "%s", buffer); fflush(stderr); #endif // OutputDebugString if (!FLAGS_fast_stdout) { From 93285acf7b2cd25df284f2242d6f79447835cb0e Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 21 Aug 2014 22:30:02 -0700 Subject: [PATCH 2/4] Fixing link errors on clang (probably breaks mdvc...) --- src/alloy/backend/x64/x64_sequence.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/alloy/backend/x64/x64_sequence.inl b/src/alloy/backend/x64/x64_sequence.inl index d0f9e539d..c9451fdfe 100644 --- a/src/alloy/backend/x64/x64_sequence.inl +++ b/src/alloy/backend/x64/x64_sequence.inl @@ -528,7 +528,7 @@ template struct SingleSequence : public Sequence, T> { typedef Sequence, T> BASE; typedef T EmitArgType; - static const uint32_t head_key = T::key; + static constexpr uint32_t head_key() { return T::key; } static void Emit(X64Emitter& e, const typename BASE::EmitArgs& _) { SEQ::Emit(e, _.i1); } @@ -734,7 +734,7 @@ static const tag_t TAG7 = 7; template void Register() { - sequence_table.insert({ T::head_key, T::Select }); + sequence_table.insert({ T::head_key(), T::Select }); } template void Register() { From 7ae303dfa29d3d63b1ce7f7cf3a8beebfd5478a8 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 21 Aug 2014 22:46:12 -0700 Subject: [PATCH 3/4] alloy-sandbox running on osx (ivm only). --- docs/building.md | 11 +++++++++++ src/alloy/runtime/raw_module.cc | 12 +++++++----- src/alloy/runtime/raw_module.h | 2 +- tools/alloy-sandbox/alloy-sandbox.cc | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/building.md b/docs/building.md index 6e797a74e..eaeec0100 100644 --- a/docs/building.md +++ b/docs/building.md @@ -22,6 +22,17 @@ and set the 'Command' to `$(SolutionDir)$(TargetPath)` and the 'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and the file to run in the 'Command Arguments' field (or use `--flagfile=flags.txt`). +### OSX + +* Mac OSX 10.9+ +* Xcode 5.1+ + +#### Debugging + +Choose `Product > Scheme > Edit Scheme`. For xenia-run, alloy-sandbox, and the +other executables select the Run action on the left and set +`Options > Working Directory` to your root xenia/ git path. + ## xenia-build A simple build script is included to manage basic tasks such as building diff --git a/src/alloy/runtime/raw_module.cc b/src/alloy/runtime/raw_module.cc index 86eda6c2e..2750a724e 100644 --- a/src/alloy/runtime/raw_module.cc +++ b/src/alloy/runtime/raw_module.cc @@ -10,6 +10,7 @@ #include #include +#include namespace alloy { namespace runtime { @@ -19,8 +20,9 @@ RawModule::RawModule(Runtime* runtime) RawModule::~RawModule() {} -int RawModule::LoadFile(uint64_t base_address, const std::string& path) { - FILE* file = fopen(path.c_str(), "rb"); +int RawModule::LoadFile(uint64_t base_address, const std::wstring& path) { + auto fixed_path = poly::to_string(poly::fix_path_separators(path)); + FILE* file = fopen(fixed_path.c_str(), "rb"); fseek(file, 0, SEEK_END); size_t file_length = ftell(file); fseek(file, 0, SEEK_SET); @@ -37,11 +39,11 @@ int RawModule::LoadFile(uint64_t base_address, const std::string& path) { fclose(file); // Setup debug info. - auto last_slash = path.find_last_of(poly::path_separator); + auto last_slash = fixed_path.find_last_of(poly::path_separator); if (last_slash != std::string::npos) { - name_ = path.substr(last_slash + 1); + name_ = fixed_path.substr(last_slash + 1); } else { - name_ = path; + name_ = fixed_path; } // TODO(benvanik): debug info diff --git a/src/alloy/runtime/raw_module.h b/src/alloy/runtime/raw_module.h index 37723119b..c40359f1e 100644 --- a/src/alloy/runtime/raw_module.h +++ b/src/alloy/runtime/raw_module.h @@ -22,7 +22,7 @@ class RawModule : public Module { RawModule(Runtime* runtime); ~RawModule() override; - int LoadFile(uint64_t base_address, const std::string& path); + int LoadFile(uint64_t base_address, const std::wstring& path); const std::string& name() const override { return name_; } diff --git a/tools/alloy-sandbox/alloy-sandbox.cc b/tools/alloy-sandbox/alloy-sandbox.cc index e09030db1..69ffa4d0a 100644 --- a/tools/alloy-sandbox/alloy-sandbox.cc +++ b/tools/alloy-sandbox/alloy-sandbox.cc @@ -94,7 +94,7 @@ int main(std::vector& args) { runtime->Initialize(std::move(frontend), std::move(backend)); auto module = std::make_unique(runtime.get()); - module->LoadFile(0x00001000, "test\\codegen\\instr_add.bin"); + module->LoadFile(0x00001000, L"test\\codegen\\instr_add.bin"); runtime->AddModule(std::move(module)); { From 6f802c243242f1bc66585ae02cd25e48cc4da142 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Thu, 21 Aug 2014 23:10:08 -0700 Subject: [PATCH 4/4] Fixing many clang warnings. --- src/xenia/core/hash.cc | 138 +------ src/xenia/core/socket_posix.cc | 16 +- src/xenia/cpu/processor.cc | 62 ++-- src/xenia/cpu/processor.h | 1 - src/xenia/gpu/xenos/ucode.h | 342 +++++++++--------- .../kernel/fs/devices/disc_image_entry.cc | 18 +- .../kernel/fs/devices/disc_image_entry.h | 18 +- src/xenia/kernel/fs/devices/host_path_entry.h | 18 +- .../kernel/fs/devices/stfs_container_entry.cc | 8 +- .../kernel/fs/devices/stfs_container_entry.h | 12 +- .../kernel/fs/devices/stfs_container_file.cc | 2 +- src/xenia/kernel/objects/xthread.cc | 4 +- src/xenia/kernel/objects/xuser_module.cc | 4 +- src/xenia/ui/ui_event.h | 44 +-- 14 files changed, 260 insertions(+), 427 deletions(-) diff --git a/src/xenia/core/hash.cc b/src/xenia/core/hash.cc index d2b9afb06..ee6560e84 100644 --- a/src/xenia/core/hash.cc +++ b/src/xenia/core/hash.cc @@ -89,142 +89,6 @@ static const uint64_t k0 = 0xc3a5c85c97cb3127ULL; static const uint64_t k1 = 0xb492b66fbe98f273ULL; static const uint64_t k2 = 0x9ae16a3b2f90404fULL; -// Magic numbers for 32-bit hashing. Copied from Murmur3. -static const uint32_t c1 = 0xcc9e2d51; -static const uint32_t c2 = 0x1b873593; - -// A 32-bit to 32-bit integer hash copied from Murmur3. -static uint32_t fmix(uint32_t h) { - h ^= h >> 16; - h *= 0x85ebca6b; - h ^= h >> 13; - h *= 0xc2b2ae35; - h ^= h >> 16; - return h; -} - -static uint32_t Rotate32(uint32_t val, int shift) { - // Avoid shifting by 32: doing so yields an undefined result. - return shift == 0 ? val : ((val >> shift) | (val << (32 - shift))); -} - -#undef PERMUTE3 -#define PERMUTE3(a, b, c) \ - do { \ - std::swap(a, b); \ - std::swap(a, c); \ - } while (0) - -static uint32_t Mur(uint32_t a, uint32_t h) { - // Helper from Murmur3 for combining two 32-bit values. - a *= c1; - a = Rotate32(a, 17); - a *= c2; - h ^= a; - h = Rotate32(h, 19); - return h * 5 + 0xe6546b64; -} - -static uint32_t Hash32Len13to24(const char *s, size_t len) { - uint32_t a = Fetch32(s - 4 + (len >> 1)); - uint32_t b = Fetch32(s + 4); - uint32_t c = Fetch32(s + len - 8); - uint32_t d = Fetch32(s + (len >> 1)); - uint32_t e = Fetch32(s); - uint32_t f = Fetch32(s + len - 4); - uint32_t h = (uint32_t)len; - - return fmix(Mur(f, Mur(e, Mur(d, Mur(c, Mur(b, Mur(a, h))))))); -} - -static uint32_t Hash32Len0to4(const char *s, size_t len) { - uint32_t b = 0; - uint32_t c = 9; - for (size_t i = 0; i < len; i++) { - signed char v = s[i]; - b = b * c1 + v; - c ^= b; - } - return fmix(Mur(b, Mur((uint32_t)len, c))); -} - -static uint32_t Hash32Len5to12(const char *s, size_t len) { - uint32_t a = (uint32_t)len, b = (uint32_t)len * 5, c = 9, d = b; - a += Fetch32(s); - b += Fetch32(s + len - 4); - c += Fetch32(s + ((len >> 1) & 4)); - return fmix(Mur(c, Mur(b, Mur(a, d)))); -} - -uint32_t CityHash32(const char *s, size_t len) { - if (len <= 24) { - return len <= 12 - ? (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len)) - : Hash32Len13to24(s, len); - } - - // len > 24 - uint32_t h = (uint32_t)len, g = c1 * (uint32_t)len, f = g; - uint32_t a0 = Rotate32(Fetch32(s + len - 4) * c1, 17) * c2; - uint32_t a1 = Rotate32(Fetch32(s + len - 8) * c1, 17) * c2; - uint32_t a2 = Rotate32(Fetch32(s + len - 16) * c1, 17) * c2; - uint32_t a3 = Rotate32(Fetch32(s + len - 12) * c1, 17) * c2; - uint32_t a4 = Rotate32(Fetch32(s + len - 20) * c1, 17) * c2; - h ^= a0; - h = Rotate32(h, 19); - h = h * 5 + 0xe6546b64; - h ^= a2; - h = Rotate32(h, 19); - h = h * 5 + 0xe6546b64; - g ^= a1; - g = Rotate32(g, 19); - g = g * 5 + 0xe6546b64; - g ^= a3; - g = Rotate32(g, 19); - g = g * 5 + 0xe6546b64; - f += a4; - f = Rotate32(f, 19); - f = f * 5 + 0xe6546b64; - size_t iters = (len - 1) / 20; - do { - uint32_t a0 = Rotate32(Fetch32(s) * c1, 17) * c2; - uint32_t a1 = Fetch32(s + 4); - uint32_t a2 = Rotate32(Fetch32(s + 8) * c1, 17) * c2; - uint32_t a3 = Rotate32(Fetch32(s + 12) * c1, 17) * c2; - uint32_t a4 = Fetch32(s + 16); - h ^= a0; - h = Rotate32(h, 18); - h = h * 5 + 0xe6546b64; - f += a1; - f = Rotate32(f, 19); - f = f * c1; - g += a2; - g = Rotate32(g, 18); - g = g * 5 + 0xe6546b64; - h ^= a3 + a1; - h = Rotate32(h, 19); - h = h * 5 + 0xe6546b64; - g ^= a4; - g = poly::byte_swap(g) * 5; - h += a4 * 5; - h = poly::byte_swap(h); - f += a0; - PERMUTE3(f, h, g); - s += 20; - } while (--iters != 0); - g = Rotate32(g, 11) * c1; - g = Rotate32(g, 17) * c1; - f = Rotate32(f, 11) * c1; - f = Rotate32(f, 17) * c1; - h = Rotate32(h + g, 19); - h = h * 5 + 0xe6546b64; - h = Rotate32(h, 17) * c1; - h = Rotate32(h + f, 19); - h = h * 5 + 0xe6546b64; - h = Rotate32(h, 17) * c1; - return h; -} - // Bitwise right rotate. Normally this will compile to a single // instruction, especially if the shift is a manifest constant. static uint64_t Rotate(uint64_t val, int shift) { @@ -374,4 +238,4 @@ uint64_t hash64(const void *data, size_t length, uint64_t seed) { return HashLen16(CityHash64((const char *)data, length) - k2, seed); } -} // namespace xe \ No newline at end of file +} // namespace xe diff --git a/src/xenia/core/socket_posix.cc b/src/xenia/core/socket_posix.cc index 5b815e1c2..4672faaa7 100644 --- a/src/xenia/core/socket_posix.cc +++ b/src/xenia/core/socket_posix.cc @@ -9,11 +9,15 @@ #include -#include -#include #include +#include +#include #include +#include #include +#include + +#include void xe_socket_init() { // No-op. @@ -81,7 +85,7 @@ int xe_socket_bind_loopback(socket_t socket) { socket_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); socket_addr.sin_port = htons(0); int r = bind(socket, (struct sockaddr*)&socket_addr, sizeof(socket_addr)); - if (r == SOCKET_ERROR) { + if (r == -1) { return 1; } return 0; @@ -108,7 +112,7 @@ int xe_socket_accept(socket_t socket, xe_socket_connection_t* out_client_info) { int client_ip = client_addr.sin_addr.s_addr; inet_ntop(AF_INET, &client_ip, out_client_info->addr, - XECOUNT(out_client_info->addr)); + poly::countof(out_client_info->addr)); return 0; } @@ -177,7 +181,7 @@ int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read, // Poll. int r; - while ((r = poll(loop->events, XECOUNT(loop->events), -1)) == -1 && + while ((r = poll(loop->events, poly::countof(loop->events), -1)) == -1 && errno == EINTR) ; if (r == -1) { @@ -193,7 +197,7 @@ int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read, loop->pending_queued_write = loop->events[1].revents != 0; if (loop->pending_queued_write) { uint8_t dummy; - XEIGNORE(recv(loop->notify_rd_id, &dummy, 1, 0)); + recv(loop->notify_rd_id, &dummy, 1, 0); } loop->events[1].revents = 0; loop->events[1].events = POLLIN; diff --git a/src/xenia/cpu/processor.cc b/src/xenia/cpu/processor.cc index 92ac73572..f397b3916 100644 --- a/src/xenia/cpu/processor.cc +++ b/src/xenia/cpu/processor.cc @@ -15,7 +15,6 @@ #include #include - using namespace alloy; using namespace alloy::backend; using namespace alloy::frontend::ppc; @@ -23,37 +22,35 @@ using namespace alloy::runtime; using namespace xe; using namespace xe::cpu; - namespace { - void InitializeIfNeeded(); - void CleanupOnShutdown(); +void InitializeIfNeeded(); +void CleanupOnShutdown(); - void InitializeIfNeeded() { - static bool has_initialized = false; - if (has_initialized) { - return; - } - has_initialized = true; - - //ppc::RegisterDisasmCategoryAltivec(); - //ppc::RegisterDisasmCategoryALU(); - //ppc::RegisterDisasmCategoryControl(); - //ppc::RegisterDisasmCategoryFPU(); - //ppc::RegisterDisasmCategoryMemory(); - - atexit(CleanupOnShutdown); +void InitializeIfNeeded() { + static bool has_initialized = false; + if (has_initialized) { + return; } + has_initialized = true; - void CleanupOnShutdown() { - } + // ppc::RegisterDisasmCategoryAltivec(); + // ppc::RegisterDisasmCategoryALU(); + // ppc::RegisterDisasmCategoryControl(); + // ppc::RegisterDisasmCategoryFPU(); + // ppc::RegisterDisasmCategoryMemory(); + + atexit(CleanupOnShutdown); } +void CleanupOnShutdown() {} +} -Processor::Processor(Emulator* emulator) : - emulator_(emulator), export_resolver_(emulator->export_resolver()), - runtime_(0), memory_(emulator->memory()), - interrupt_thread_state_(NULL), - interrupt_thread_block_(0) { +Processor::Processor(Emulator* emulator) + : export_resolver_(emulator->export_resolver()), + runtime_(0), + memory_(emulator->memory()), + interrupt_thread_state_(NULL), + interrupt_thread_block_(0) { InitializeIfNeeded(); } @@ -101,11 +98,9 @@ int Processor::Setup() { return result; } - interrupt_thread_state_ = new XenonThreadState( - runtime_, 0, 16 * 1024, 0); + interrupt_thread_state_ = new XenonThreadState(runtime_, 0, 16 * 1024, 0); interrupt_thread_state_->set_name("Interrupt"); - interrupt_thread_block_ = memory_->HeapAlloc( - 0, 2048, MEMORY_FLAG_ZERO); + interrupt_thread_block_ = memory_->HeapAlloc(0, 2048, MEMORY_FLAG_ZERO); interrupt_thread_state_->context()->r[13] = interrupt_thread_block_; return 0; @@ -136,9 +131,8 @@ int Processor::Execute(XenonThreadState* thread_state, uint64_t address) { return 0; } -uint64_t Processor::Execute( - XenonThreadState* thread_state, uint64_t address, uint64_t args[], - size_t arg_count) { +uint64_t Processor::Execute(XenonThreadState* thread_state, uint64_t address, + uint64_t args[], size_t arg_count) { SCOPE_profile_cpu_f("cpu"); PPCContext* context = thread_state->context(); @@ -163,8 +157,8 @@ void Processor::LowerIrql(Irql old_value) { reinterpret_cast(&irql_)); } -uint64_t Processor::ExecuteInterrupt( - uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count) { +uint64_t Processor::ExecuteInterrupt(uint32_t cpu, uint64_t address, + uint64_t args[], size_t arg_count) { SCOPE_profile_cpu_f("cpu"); // Acquire lock on interrupt thread (we can only dispatch one at a time). diff --git a/src/xenia/cpu/processor.h b/src/xenia/cpu/processor.h index ffcd65c9b..bf38bbf4b 100644 --- a/src/xenia/cpu/processor.h +++ b/src/xenia/cpu/processor.h @@ -53,7 +53,6 @@ class Processor { size_t arg_count); private: - Emulator* emulator_; ExportResolver* export_resolver_; XenonRuntime* runtime_; diff --git a/src/xenia/gpu/xenos/ucode.h b/src/xenia/gpu/xenos/ucode.h index f6130bcd3..eee9d58d0 100644 --- a/src/xenia/gpu/xenos/ucode.h +++ b/src/xenia/gpu/xenos/ucode.h @@ -12,31 +12,25 @@ #include - namespace xe { namespace gpu { namespace xenos { - #if XE_COMPILER_MSVC -#define XEPACKEDSTRUCT(name, value) \ - __pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \ - typedef struct name##_s name; +#define XEPACKEDSTRUCT(name, value) \ + __pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \ + typedef struct name##_s name; #define XEPACKEDSTRUCTANONYMOUS(value) \ - __pragma(pack(push, 1)) struct value __pragma(pack(pop)); -#define XEPACKEDUNION(name, value) \ - __pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \ - typedef union name##_s name; -#elif XE_COMPILER_GNUC -#define XEPACKEDSTRUCT(name, value) \ - struct __attribute__((packed)) name -#define XEPACKEDSTRUCTANONYMOUS(value) \ - struct __attribute__((packed)) -#define XEPACKEDUNION(name, value) \ - union __attribute__((packed)) name + __pragma(pack(push, 1)) struct value __pragma(pack(pop)); +#define XEPACKEDUNION(name, value) \ + __pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \ + typedef union name##_s name; +#else +#define XEPACKEDSTRUCT(name, value) struct __attribute__((packed)) name +#define XEPACKEDSTRUCTANONYMOUS(value) struct __attribute__((packed)) +#define XEPACKEDUNION(name, value) union __attribute__((packed)) name #endif // MSVC - // This code comes from the freedreno project: // https://github.com/freedreno/freedreno/blob/master/includes/instr-a2xx.h /* @@ -62,7 +56,6 @@ namespace xenos { * SOFTWARE. */ - enum a2xx_sq_surfaceformat { FMT_1_REVERSE = 0, FMT_1 = 1, @@ -127,7 +120,6 @@ enum a2xx_sq_surfaceformat { FMT_DXT3A_AS_1_1_1_1 = 61, }; - /* * ALU instructions: */ @@ -221,51 +213,49 @@ typedef enum { XEPACKEDSTRUCT(instr_alu_t, { /* dword0: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t vector_dest : 6; - uint32_t vector_dest_rel : 1; - uint32_t low_precision_16b_fp : 1; - uint32_t scalar_dest : 6; - uint32_t scalar_dest_rel : 1; - uint32_t export_data : 1; - uint32_t vector_write_mask : 4; - uint32_t scalar_write_mask : 4; - uint32_t vector_clamp : 1; - uint32_t scalar_clamp : 1; - uint32_t scalar_opc : 6; // instr_scalar_opc_t + uint32_t vector_dest : 6; + uint32_t vector_dest_rel : 1; + uint32_t low_precision_16b_fp : 1; + uint32_t scalar_dest : 6; + uint32_t scalar_dest_rel : 1; + uint32_t export_data : 1; + uint32_t vector_write_mask : 4; + uint32_t scalar_write_mask : 4; + uint32_t vector_clamp : 1; + uint32_t scalar_clamp : 1; + uint32_t scalar_opc : 6; // instr_scalar_opc_t }); /* dword1: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t src3_swiz : 8; - uint32_t src2_swiz : 8; - uint32_t src1_swiz : 8; - uint32_t src3_reg_negate : 1; - uint32_t src2_reg_negate : 1; - uint32_t src1_reg_negate : 1; - uint32_t pred_select : 2; - uint32_t relative_addr : 1; - uint32_t const_1_rel_abs : 1; - uint32_t const_0_rel_abs : 1; + uint32_t src3_swiz : 8; + uint32_t src2_swiz : 8; + uint32_t src1_swiz : 8; + uint32_t src3_reg_negate : 1; + uint32_t src2_reg_negate : 1; + uint32_t src1_reg_negate : 1; + uint32_t pred_select : 2; + uint32_t relative_addr : 1; + uint32_t const_1_rel_abs : 1; + uint32_t const_0_rel_abs : 1; }); /* dword2: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t src3_reg : 6; - uint32_t src3_reg_select : 1; - uint32_t src3_reg_abs : 1; - uint32_t src2_reg : 6; - uint32_t src2_reg_select : 1; - uint32_t src2_reg_abs : 1; - uint32_t src1_reg : 6; - uint32_t src1_reg_select : 1; - uint32_t src1_reg_abs : 1; - uint32_t vector_opc : 5; // instr_vector_opc_t - uint32_t src3_sel : 1; - uint32_t src2_sel : 1; - uint32_t src1_sel : 1; + uint32_t src3_reg : 6; + uint32_t src3_reg_select : 1; + uint32_t src3_reg_abs : 1; + uint32_t src2_reg : 6; + uint32_t src2_reg_select : 1; + uint32_t src2_reg_abs : 1; + uint32_t src1_reg : 6; + uint32_t src1_reg_select : 1; + uint32_t src1_reg_abs : 1; + uint32_t vector_opc : 5; // instr_vector_opc_t + uint32_t src3_sel : 1; + uint32_t src2_sel : 1; + uint32_t src1_sel : 1; }); }); - - /* * CF instructions: */ @@ -303,24 +293,22 @@ typedef enum { XEPACKEDSTRUCT(instr_cf_exec_t, { XEPACKEDSTRUCTANONYMOUS({ - uint32_t address : 12; - uint32_t count : 3; - uint32_t yeild : 1; - uint32_t serialize : 12; - uint32_t vc_hi : 4; + uint32_t address : 12; + uint32_t count : 3; + uint32_t yeild : 1; + uint32_t serialize : 12; + uint32_t vc_hi : 4; }); XEPACKEDSTRUCTANONYMOUS({ - uint32_t vc_lo : 2; /* vertex cache? */ - uint32_t bool_addr : 8; - uint32_t condition : 1; - uint32_t address_mode : 1; // instr_addr_mode_t - uint32_t opc : 4; // instr_cf_opc_t + uint32_t vc_lo : 2; /* vertex cache? */ + uint32_t bool_addr : 8; + uint32_t condition : 1; + uint32_t address_mode : 1; // instr_addr_mode_t + uint32_t opc : 4; // instr_cf_opc_t }); bool is_cond_exec() const { - return (this->opc == COND_EXEC) || - (this->opc == COND_EXEC_END) || - (this->opc == COND_PRED_EXEC) || - (this->opc == COND_PRED_EXEC_END) || + return (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) || + (this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) || (this->opc == COND_EXEC_PRED_CLEAN) || (this->opc == COND_EXEC_PRED_CLEAN_END); } @@ -328,89 +316,84 @@ XEPACKEDSTRUCT(instr_cf_exec_t, { XEPACKEDSTRUCT(instr_cf_loop_t, { XEPACKEDSTRUCTANONYMOUS({ - uint32_t address : 13; - uint32_t repeat : 1; - uint32_t reserved0 : 2; - uint32_t loop_id : 5; - uint32_t pred_break : 1; - uint32_t reserved1_hi : 10; + uint32_t address : 13; + uint32_t repeat : 1; + uint32_t reserved0 : 2; + uint32_t loop_id : 5; + uint32_t pred_break : 1; + uint32_t reserved1_hi : 10; }); XEPACKEDSTRUCTANONYMOUS({ - uint32_t reserved1_lo : 10; - uint32_t condition : 1; - uint32_t address_mode : 1; // instr_addr_mode_t - uint32_t opc : 4; // instr_cf_opc_t + uint32_t reserved1_lo : 10; + uint32_t condition : 1; + uint32_t address_mode : 1; // instr_addr_mode_t + uint32_t opc : 4; // instr_cf_opc_t }); }); XEPACKEDSTRUCT(instr_cf_jmp_call_t, { XEPACKEDSTRUCTANONYMOUS({ - uint32_t address : 13; - uint32_t force_call : 1; - uint32_t predicated_jmp : 1; - uint32_t reserved1_hi : 17; + uint32_t address : 13; + uint32_t force_call : 1; + uint32_t predicated_jmp : 1; + uint32_t reserved1_hi : 17; }); XEPACKEDSTRUCTANONYMOUS({ - uint32_t reserved1_lo : 1; - uint32_t direction : 1; - uint32_t bool_addr : 8; - uint32_t condition : 1; - uint32_t address_mode : 1; // instr_addr_mode_t - uint32_t opc : 4; // instr_cf_opc_t + uint32_t reserved1_lo : 1; + uint32_t direction : 1; + uint32_t bool_addr : 8; + uint32_t condition : 1; + uint32_t address_mode : 1; // instr_addr_mode_t + uint32_t opc : 4; // instr_cf_opc_t }); }); XEPACKEDSTRUCT(instr_cf_alloc_t, { XEPACKEDSTRUCTANONYMOUS({ - uint32_t size : 3; - uint32_t reserved0_hi : 29; + uint32_t size : 3; + uint32_t reserved0_hi : 29; }); XEPACKEDSTRUCTANONYMOUS({ - uint32_t reserved0_lo : 8; - uint32_t no_serial : 1; - uint32_t buffer_select : 2; // instr_alloc_type_t - uint32_t alloc_mode : 1; - uint32_t opc : 4; // instr_cf_opc_t + uint32_t reserved0_lo : 8; + uint32_t no_serial : 1; + uint32_t buffer_select : 2; // instr_alloc_type_t + uint32_t alloc_mode : 1; + uint32_t opc : 4; // instr_cf_opc_t }); }); XEPACKEDUNION(instr_cf_t, { - instr_cf_exec_t exec; - instr_cf_loop_t loop; - instr_cf_jmp_call_t jmp_call; - instr_cf_alloc_t alloc; + instr_cf_exec_t exec; + instr_cf_loop_t loop; + instr_cf_jmp_call_t jmp_call; + instr_cf_alloc_t alloc; XEPACKEDSTRUCTANONYMOUS({ - uint32_t : 32; - uint32_t : 12; - uint32_t opc : 4; // instr_cf_opc_t + uint32_t: + 32; + uint32_t: + 12; + uint32_t opc : 4; // instr_cf_opc_t }); XEPACKEDSTRUCTANONYMOUS({ - uint32_t dword_0; - uint32_t dword_1; + uint32_t dword_0; + uint32_t dword_1; }); bool is_exec() const { - return (this->opc == EXEC) || - (this->opc == EXEC_END) || - (this->opc == COND_EXEC) || - (this->opc == COND_EXEC_END) || - (this->opc == COND_PRED_EXEC) || - (this->opc == COND_PRED_EXEC_END) || + return (this->opc == EXEC) || (this->opc == EXEC_END) || + (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) || + (this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) || (this->opc == COND_EXEC_PRED_CLEAN) || (this->opc == COND_EXEC_PRED_CLEAN_END); } bool is_cond_exec() const { - return (this->opc == COND_EXEC) || - (this->opc == COND_EXEC_END) || - (this->opc == COND_PRED_EXEC) || - (this->opc == COND_PRED_EXEC_END) || + return (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) || + (this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) || (this->opc == COND_EXEC_PRED_CLEAN) || (this->opc == COND_EXEC_PRED_CLEAN_END); } }); - - /* * FETCH instructions: */ @@ -431,7 +414,7 @@ typedef enum { typedef enum { TEX_FILTER_POINT = 0, TEX_FILTER_LINEAR = 1, - TEX_FILTER_BASEMAP = 2, /* only applicable for mip-filter */ + TEX_FILTER_BASEMAP = 2, /* only applicable for mip-filter */ TEX_FILTER_USE_FETCH_CONST = 3, } instr_tex_filter_t; @@ -472,104 +455,105 @@ typedef enum a2xx_sq_surfaceformat instr_surf_fmt_t; XEPACKEDSTRUCT(instr_fetch_tex_t, { /* dword0: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t opc : 5; // instr_fetch_opc_t - uint32_t src_reg : 6; - uint32_t src_reg_am : 1; - uint32_t dst_reg : 6; - uint32_t dst_reg_am : 1; - uint32_t fetch_valid_only : 1; - uint32_t const_idx : 5; - uint32_t tx_coord_denorm : 1; - uint32_t src_swiz : 6; // xyz + uint32_t opc : 5; // instr_fetch_opc_t + uint32_t src_reg : 6; + uint32_t src_reg_am : 1; + uint32_t dst_reg : 6; + uint32_t dst_reg_am : 1; + uint32_t fetch_valid_only : 1; + uint32_t const_idx : 5; + uint32_t tx_coord_denorm : 1; + uint32_t src_swiz : 6; // xyz }); /* dword1: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t dst_swiz : 12; // xyzw - uint32_t mag_filter : 2; // instr_tex_filter_t - uint32_t min_filter : 2; // instr_tex_filter_t - uint32_t mip_filter : 2; // instr_tex_filter_t - uint32_t aniso_filter : 3; // instr_aniso_filter_t - uint32_t arbitrary_filter : 3; // instr_arbitrary_filter_t - uint32_t vol_mag_filter : 2; // instr_tex_filter_t - uint32_t vol_min_filter : 2; // instr_tex_filter_t - uint32_t use_comp_lod : 1; - uint32_t use_reg_lod : 1; - uint32_t unk : 1; - uint32_t pred_select : 1; + uint32_t dst_swiz : 12; // xyzw + uint32_t mag_filter : 2; // instr_tex_filter_t + uint32_t min_filter : 2; // instr_tex_filter_t + uint32_t mip_filter : 2; // instr_tex_filter_t + uint32_t aniso_filter : 3; // instr_aniso_filter_t + uint32_t arbitrary_filter : 3; // instr_arbitrary_filter_t + uint32_t vol_mag_filter : 2; // instr_tex_filter_t + uint32_t vol_min_filter : 2; // instr_tex_filter_t + uint32_t use_comp_lod : 1; + uint32_t use_reg_lod : 1; + uint32_t unk : 1; + uint32_t pred_select : 1; }); /* dword2: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t use_reg_gradients : 1; - uint32_t sample_location : 1; // instr_sample_loc_t - uint32_t lod_bias : 7; - uint32_t unused : 5; - uint32_t dimension : 2; // instr_dimension_t - uint32_t offset_x : 5; - uint32_t offset_y : 5; - uint32_t offset_z : 5; - uint32_t pred_condition : 1; + uint32_t use_reg_gradients : 1; + uint32_t sample_location : 1; // instr_sample_loc_t + uint32_t lod_bias : 7; + uint32_t unused : 5; + uint32_t dimension : 2; // instr_dimension_t + uint32_t offset_x : 5; + uint32_t offset_y : 5; + uint32_t offset_z : 5; + uint32_t pred_condition : 1; }); }); XEPACKEDSTRUCT(instr_fetch_vtx_t, { /* dword0: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t opc : 5; // instr_fetch_opc_t - uint32_t src_reg : 6; - uint32_t src_reg_am : 1; - uint32_t dst_reg : 6; - uint32_t dst_reg_am : 1; - uint32_t must_be_one : 1; - uint32_t const_index : 5; - uint32_t const_index_sel : 2; - uint32_t reserved0 : 3; - uint32_t src_swiz : 2; + uint32_t opc : 5; // instr_fetch_opc_t + uint32_t src_reg : 6; + uint32_t src_reg_am : 1; + uint32_t dst_reg : 6; + uint32_t dst_reg_am : 1; + uint32_t must_be_one : 1; + uint32_t const_index : 5; + uint32_t const_index_sel : 2; + uint32_t reserved0 : 3; + uint32_t src_swiz : 2; }); /* dword1: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t dst_swiz : 12; - uint32_t format_comp_all : 1; /* '1' for signed, '0' for unsigned? */ - uint32_t num_format_all : 1; /* '0' for normalized, '1' for unnormalized */ - uint32_t signed_rf_mode_all : 1; - uint32_t reserved1 : 1; - uint32_t format : 6; // instr_surf_fmt_t - uint32_t reserved2 : 1; - uint32_t exp_adjust_all : 7; - uint32_t reserved3 : 1; - uint32_t pred_select : 1; + uint32_t dst_swiz : 12; + uint32_t format_comp_all : 1; /* '1' for signed, '0' for unsigned? */ + uint32_t num_format_all : 1; /* '0' for normalized, '1' for unnormalized */ + uint32_t signed_rf_mode_all : 1; + uint32_t reserved1 : 1; + uint32_t format : 6; // instr_surf_fmt_t + uint32_t reserved2 : 1; + uint32_t exp_adjust_all : 7; + uint32_t reserved3 : 1; + uint32_t pred_select : 1; }); /* dword2: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t stride : 8; - uint32_t offset : 23; - uint32_t pred_condition : 1; + uint32_t stride : 8; + uint32_t offset : 23; + uint32_t pred_condition : 1; }); }); XEPACKEDUNION(instr_fetch_t, { - instr_fetch_tex_t tex; - instr_fetch_vtx_t vtx; + instr_fetch_tex_t tex; + instr_fetch_vtx_t vtx; XEPACKEDSTRUCTANONYMOUS({ /* dword0: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t opc : 5; // instr_fetch_opc_t - uint32_t : 27; + uint32_t opc : 5; // instr_fetch_opc_t + uint32_t: + 27; }); /* dword1: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t : 32; + uint32_t: + 32; }); /* dword2: */ XEPACKEDSTRUCTANONYMOUS({ - uint32_t : 32; + uint32_t: + 32; }); }); }); - } // namespace xenos } // namespace gpu } // namespace xe - #endif // XENIA_GPU_XENOS_UCODE_H_ diff --git a/src/xenia/kernel/fs/devices/disc_image_entry.cc b/src/xenia/kernel/fs/devices/disc_image_entry.cc index cc1110355..141d4bf89 100644 --- a/src/xenia/kernel/fs/devices/disc_image_entry.cc +++ b/src/xenia/kernel/fs/devices/disc_image_entry.cc @@ -20,22 +20,18 @@ namespace fs { class DiscImageMemoryMapping : public MemoryMapping { public: - DiscImageMemoryMapping(uint8_t* address, size_t length, - poly::MappedMemory* mmap) - : MemoryMapping(address, length), mmap_(mmap) {} + DiscImageMemoryMapping(uint8_t* address, size_t length) + : MemoryMapping(address, length) {} - virtual ~DiscImageMemoryMapping() {} - - private: - poly::MappedMemory* mmap_; + ~DiscImageMemoryMapping() override = default; }; DiscImageEntry::DiscImageEntry(Type type, Device* device, const char* path, poly::MappedMemory* mmap, GDFXEntry* gdfx_entry) - : gdfx_entry_(gdfx_entry), - gdfx_entry_iterator_(gdfx_entry->children.end()), + : Entry(type, device, path), mmap_(mmap), - Entry(type, device, path) {} + gdfx_entry_(gdfx_entry), + gdfx_entry_iterator_(gdfx_entry->children.end()) {} DiscImageEntry::~DiscImageEntry() {} @@ -107,7 +103,7 @@ std::unique_ptr DiscImageEntry::CreateMemoryMapping( size_t real_length = length ? std::min(length, gdfx_entry_->size) : gdfx_entry_->size; return std::make_unique(mmap_->data() + real_offset, - real_length, mmap_); + real_length); } X_STATUS DiscImageEntry::Open(KernelState* kernel_state, Mode mode, bool async, diff --git a/src/xenia/kernel/fs/devices/disc_image_entry.h b/src/xenia/kernel/fs/devices/disc_image_entry.h index b1a076698..4ba6c79cc 100644 --- a/src/xenia/kernel/fs/devices/disc_image_entry.h +++ b/src/xenia/kernel/fs/devices/disc_image_entry.h @@ -27,21 +27,21 @@ class DiscImageEntry : public Entry { public: DiscImageEntry(Type type, Device* device, const char* path, poly::MappedMemory* mmap, GDFXEntry* gdfx_entry); - virtual ~DiscImageEntry(); + ~DiscImageEntry() override; poly::MappedMemory* mmap() const { return mmap_; } GDFXEntry* gdfx_entry() const { return gdfx_entry_; } - virtual X_STATUS QueryInfo(XFileInfo* out_info); - virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, - const char* file_name, bool restart); + X_STATUS QueryInfo(XFileInfo* out_info) override; + X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + const char* file_name, bool restart) override; - virtual bool can_map() { return true; } - virtual std::unique_ptr CreateMemoryMapping( - Mode map_mode, const size_t offset, const size_t length); + bool can_map() override { return true; } + std::unique_ptr CreateMemoryMapping( + Mode map_mode, const size_t offset, const size_t length) override; - virtual X_STATUS Open(KernelState* kernel_state, Mode mode, bool async, - XFile** out_file); + X_STATUS Open(KernelState* kernel_state, Mode mode, bool async, + XFile** out_file) override; private: poly::MappedMemory* mmap_; diff --git a/src/xenia/kernel/fs/devices/host_path_entry.h b/src/xenia/kernel/fs/devices/host_path_entry.h index 913ece216..b72b0460a 100644 --- a/src/xenia/kernel/fs/devices/host_path_entry.h +++ b/src/xenia/kernel/fs/devices/host_path_entry.h @@ -22,20 +22,20 @@ class HostPathEntry : public Entry { public: HostPathEntry(Type type, Device* device, const char* path, const std::wstring& local_path); - virtual ~HostPathEntry(); + ~HostPathEntry() override; const std::wstring& local_path() { return local_path_; } - virtual X_STATUS QueryInfo(XFileInfo* out_info); - virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, - const char* file_name, bool restart); + X_STATUS QueryInfo(XFileInfo* out_info) override; + X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + const char* file_name, bool restart) override; - virtual bool can_map() { return true; } - virtual std::unique_ptr CreateMemoryMapping( - Mode map_mode, const size_t offset, const size_t length); + bool can_map() override { return true; } + std::unique_ptr CreateMemoryMapping( + Mode map_mode, const size_t offset, const size_t length) override; - virtual X_STATUS Open(KernelState* kernel_state, Mode mode, bool async, - XFile** out_file); + X_STATUS Open(KernelState* kernel_state, Mode mode, bool async, + XFile** out_file) override; private: std::wstring local_path_; diff --git a/src/xenia/kernel/fs/devices/stfs_container_entry.cc b/src/xenia/kernel/fs/devices/stfs_container_entry.cc index 5012b7e3d..db6d5ff75 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_entry.cc +++ b/src/xenia/kernel/fs/devices/stfs_container_entry.cc @@ -20,12 +20,12 @@ STFSContainerEntry::STFSContainerEntry(Type type, Device* device, const char* path, poly::MappedMemory* mmap, STFSEntry* stfs_entry) - : stfs_entry_(stfs_entry), - stfs_entry_iterator_(stfs_entry->children.end()), + : Entry(type, device, path), mmap_(mmap), - Entry(type, device, path) {} + stfs_entry_(stfs_entry), + stfs_entry_iterator_(stfs_entry->children.end()) {} -STFSContainerEntry::~STFSContainerEntry() {} +STFSContainerEntry::~STFSContainerEntry() = default; X_STATUS STFSContainerEntry::QueryInfo(XFileInfo* out_info) { assert_not_null(out_info); diff --git a/src/xenia/kernel/fs/devices/stfs_container_entry.h b/src/xenia/kernel/fs/devices/stfs_container_entry.h index db91161e6..65e416c0e 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_entry.h +++ b/src/xenia/kernel/fs/devices/stfs_container_entry.h @@ -27,17 +27,17 @@ class STFSContainerEntry : public Entry { public: STFSContainerEntry(Type type, Device* device, const char* path, poly::MappedMemory* mmap, STFSEntry* stfs_entry); - virtual ~STFSContainerEntry(); + ~STFSContainerEntry() override; poly::MappedMemory* mmap() const { return mmap_; } STFSEntry* stfs_entry() const { return stfs_entry_; } - virtual X_STATUS QueryInfo(XFileInfo* out_info); - virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, - const char* file_name, bool restart); + X_STATUS QueryInfo(XFileInfo* out_info) override; + X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, + const char* file_name, bool restart) override; - virtual X_STATUS Open(KernelState* kernel_state, Mode desired_access, - bool async, XFile** out_file); + X_STATUS Open(KernelState* kernel_state, Mode desired_access, bool async, + XFile** out_file) override; private: poly::MappedMemory* mmap_; diff --git a/src/xenia/kernel/fs/devices/stfs_container_file.cc b/src/xenia/kernel/fs/devices/stfs_container_file.cc index b52c6e7ce..2baffba9c 100644 --- a/src/xenia/kernel/fs/devices/stfs_container_file.cc +++ b/src/xenia/kernel/fs/devices/stfs_container_file.cc @@ -21,7 +21,7 @@ namespace fs { STFSContainerFile::STFSContainerFile(KernelState* kernel_state, Mode mode, STFSContainerEntry* entry) - : entry_(entry), XFile(kernel_state, mode) {} + : XFile(kernel_state, mode), entry_(entry) {} STFSContainerFile::~STFSContainerFile() { delete entry_; } diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 60c6086e3..d1b31f3f7 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -283,7 +283,7 @@ X_STATUS XThread::PlatformExit(int exit_code) { static void* XThreadStartCallbackPthreads(void* param) { XThread* thread = reinterpret_cast(param); - xe::Profiler::ThreadEnter(thread->name()); + xe::Profiler::ThreadEnter(thread->name().c_str()); current_thread_tls = thread; thread->Execute(); current_thread_tls = nullptr; @@ -334,7 +334,7 @@ void XThread::PlatformDestroy() { X_STATUS XThread::PlatformExit(int exit_code) { // NOTE: does not return. - pthread_exit((void*)exit_code); + pthread_exit(reinterpret_cast(exit_code)); return X_STATUS_SUCCESS; } diff --git a/src/xenia/kernel/objects/xuser_module.cc b/src/xenia/kernel/objects/xuser_module.cc index 4f59c205d..ad6b9aa41 100644 --- a/src/xenia/kernel/objects/xuser_module.cc +++ b/src/xenia/kernel/objects/xuser_module.cc @@ -161,7 +161,7 @@ void XUserModule::Dump() { const xe_xex2_header_t* header = xe_xex2_get_header(xex_); // XEX info. - printf("Module %s:\n\n", path_); + printf("Module %s:\n\n", path_.c_str()); printf(" Module Flags: %.8X\n", header->module_flags); printf(" System Flags: %.8X\n", header->system_flags); printf("\n"); @@ -292,7 +292,7 @@ void XUserModule::Dump() { unimpl_count++; } } - printf(" Total: %4u\n", import_info_count); + printf(" Total: %4zu\n", import_info_count); printf(" Known: %3d%% (%d known, %d unknown)\n", (int)(known_count / (float)import_info_count * 100.0f), known_count, unknown_count); diff --git a/src/xenia/ui/ui_event.h b/src/xenia/ui/ui_event.h index 07fae340e..95c313d19 100644 --- a/src/xenia/ui/ui_event.h +++ b/src/xenia/ui/ui_event.h @@ -12,41 +12,37 @@ #include - namespace xe { namespace ui { class App; class Window; - class UIEvent { -public: - UIEvent(Window* window = NULL) : - window_(window) {} - virtual ~UIEvent() {} + public: + UIEvent(Window* window = NULL) : window_(window) {} + virtual ~UIEvent() = default; Window* window() const { return window_; } -private: - Window* window_; + private: + Window* window_; }; class KeyEvent : public UIEvent { -public: - KeyEvent(Window* window, int key_code) : - key_code_(key_code), - UIEvent(window) {} - virtual ~KeyEvent() {} + public: + KeyEvent(Window* window, int key_code) + : UIEvent(window), key_code_(key_code) {} + ~KeyEvent() override = default; int key_code() const { return key_code_; } -private: + private: int key_code_; }; class MouseEvent : public UIEvent { -public: + public: enum Button { MOUSE_BUTTON_NONE = 0, MOUSE_BUTTON_LEFT, @@ -56,13 +52,11 @@ public: MOUSE_BUTTON_X2, }; -public: - MouseEvent(Window* window, - Button button, int32_t x, int32_t y, - int32_t dx = 0, int32_t dy = 0) : - button_(button), x_(x), y_(y), dx_(dx), dy_(dy), - UIEvent(window) {} - virtual ~MouseEvent() {} + public: + MouseEvent(Window* window, Button button, int32_t x, int32_t y, + int32_t dx = 0, int32_t dy = 0) + : UIEvent(window), button_(button), x_(x), y_(y), dx_(dx), dy_(dy) {} + ~MouseEvent() override = default; Button button() const { return button_; } int32_t x() const { return x_; } @@ -70,17 +64,15 @@ public: int32_t dx() const { return dx_; } int32_t dy() const { return dy_; } -private: - Button button_; + private: + Button button_; int32_t x_; int32_t y_; int32_t dx_; int32_t dy_; }; - } // namespace ui } // namespace xe - #endif // XENIA_UI_UI_EVENT_H_