Merge branch 'master' of github.com:benvanik/xenia
This commit is contained in:
commit
eebe68b77a
|
@ -22,6 +22,17 @@ and set the 'Command' to `$(SolutionDir)$(TargetPath)` and the
|
||||||
'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and
|
'Working Directory' to `$(SolutionDir)..\..`. You can specify flags and
|
||||||
the file to run in the 'Command Arguments' field (or use `--flagfile=flags.txt`).
|
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
|
## xenia-build
|
||||||
|
|
||||||
A simple build script is included to manage basic tasks such as building
|
A simple build script is included to manage basic tasks such as building
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef ALLOY_ARENA_H_
|
#ifndef ALLOY_ARENA_H_
|
||||||
#define ALLOY_ARENA_H_
|
#define ALLOY_ARENA_H_
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace alloy {
|
namespace alloy {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <poly/assert.h>
|
#include <poly/assert.h>
|
||||||
#include <poly/math.h>
|
#include <poly/math.h>
|
||||||
|
#include <xenia/profiling.h>
|
||||||
|
|
||||||
namespace alloy {
|
namespace alloy {
|
||||||
namespace backend {
|
namespace backend {
|
||||||
|
|
|
@ -528,7 +528,7 @@ template <typename SEQ, typename T>
|
||||||
struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
|
struct SingleSequence : public Sequence<SingleSequence<SEQ, T>, T> {
|
||||||
typedef Sequence<SingleSequence<SEQ, T>, T> BASE;
|
typedef Sequence<SingleSequence<SEQ, T>, T> BASE;
|
||||||
typedef T EmitArgType;
|
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& _) {
|
static void Emit(X64Emitter& e, const typename BASE::EmitArgs& _) {
|
||||||
SEQ::Emit(e, _.i1);
|
SEQ::Emit(e, _.i1);
|
||||||
}
|
}
|
||||||
|
@ -734,7 +734,7 @@ static const tag_t TAG7 = 7;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Register() {
|
void Register() {
|
||||||
sequence_table.insert({ T::head_key, T::Select });
|
sequence_table.insert({ T::head_key(), T::Select });
|
||||||
}
|
}
|
||||||
template <typename T, typename Tn, typename... Ts>
|
template <typename T, typename Tn, typename... Ts>
|
||||||
void Register() {
|
void Register() {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef ALLOY_FRONTEND_CONTEXT_INFO_H_
|
#ifndef ALLOY_FRONTEND_CONTEXT_INFO_H_
|
||||||
#define ALLOY_FRONTEND_CONTEXT_INFO_H_
|
#define ALLOY_FRONTEND_CONTEXT_INFO_H_
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace alloy {
|
namespace alloy {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <alloy/runtime/debug_info.h>
|
#include <alloy/runtime/debug_info.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace alloy {
|
namespace alloy {
|
||||||
namespace runtime {
|
namespace runtime {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef ALLOY_RUNTIME_DEBUG_INFO_H_
|
#ifndef ALLOY_RUNTIME_DEBUG_INFO_H_
|
||||||
#define ALLOY_RUNTIME_DEBUG_INFO_H_
|
#define ALLOY_RUNTIME_DEBUG_INFO_H_
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace alloy {
|
namespace alloy {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <alloy/runtime/raw_module.h>
|
#include <alloy/runtime/raw_module.h>
|
||||||
|
|
||||||
#include <poly/platform.h>
|
#include <poly/platform.h>
|
||||||
|
#include <poly/string.h>
|
||||||
|
|
||||||
namespace alloy {
|
namespace alloy {
|
||||||
namespace runtime {
|
namespace runtime {
|
||||||
|
@ -19,8 +20,9 @@ RawModule::RawModule(Runtime* runtime)
|
||||||
|
|
||||||
RawModule::~RawModule() {}
|
RawModule::~RawModule() {}
|
||||||
|
|
||||||
int RawModule::LoadFile(uint64_t base_address, const std::string& path) {
|
int RawModule::LoadFile(uint64_t base_address, const std::wstring& path) {
|
||||||
FILE* file = fopen(path.c_str(), "rb");
|
auto fixed_path = poly::to_string(poly::fix_path_separators(path));
|
||||||
|
FILE* file = fopen(fixed_path.c_str(), "rb");
|
||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
size_t file_length = ftell(file);
|
size_t file_length = ftell(file);
|
||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
|
@ -37,11 +39,11 @@ int RawModule::LoadFile(uint64_t base_address, const std::string& path) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
// Setup debug info.
|
// 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) {
|
if (last_slash != std::string::npos) {
|
||||||
name_ = path.substr(last_slash + 1);
|
name_ = fixed_path.substr(last_slash + 1);
|
||||||
} else {
|
} else {
|
||||||
name_ = path;
|
name_ = fixed_path;
|
||||||
}
|
}
|
||||||
// TODO(benvanik): debug info
|
// TODO(benvanik): debug info
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class RawModule : public Module {
|
||||||
RawModule(Runtime* runtime);
|
RawModule(Runtime* runtime);
|
||||||
~RawModule() override;
|
~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_; }
|
const std::string& name() const override { return name_; }
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void log_line(const char* file_path, const uint32_t line_number,
|
||||||
#if 0 // defined(OutputDebugString)
|
#if 0 // defined(OutputDebugString)
|
||||||
OutputDebugStringA(buffer);
|
OutputDebugStringA(buffer);
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, buffer);
|
fprintf(stdout, "%s", buffer);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif // OutputDebugString
|
#endif // OutputDebugString
|
||||||
if (!FLAGS_fast_stdout) {
|
if (!FLAGS_fast_stdout) {
|
||||||
|
@ -102,7 +102,7 @@ void handle_fatal(const char* file_path, const uint32_t line_number,
|
||||||
#if defined(OutputDebugString)
|
#if defined(OutputDebugString)
|
||||||
OutputDebugStringA(buffer);
|
OutputDebugStringA(buffer);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, buffer);
|
fprintf(stderr, "%s", buffer);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
#endif // OutputDebugString
|
#endif // OutputDebugString
|
||||||
if (!FLAGS_fast_stdout) {
|
if (!FLAGS_fast_stdout) {
|
||||||
|
|
|
@ -89,142 +89,6 @@ static const uint64_t k0 = 0xc3a5c85c97cb3127ULL;
|
||||||
static const uint64_t k1 = 0xb492b66fbe98f273ULL;
|
static const uint64_t k1 = 0xb492b66fbe98f273ULL;
|
||||||
static const uint64_t k2 = 0x9ae16a3b2f90404fULL;
|
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
|
// Bitwise right rotate. Normally this will compile to a single
|
||||||
// instruction, especially if the shift is a manifest constant.
|
// instruction, especially if the shift is a manifest constant.
|
||||||
static uint64_t Rotate(uint64_t val, int shift) {
|
static uint64_t Rotate(uint64_t val, int shift) {
|
||||||
|
|
|
@ -9,11 +9,15 @@
|
||||||
|
|
||||||
#include <xenia/core/socket.h>
|
#include <xenia/core/socket.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
#include <poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <poly/math.h>
|
||||||
|
|
||||||
void xe_socket_init() {
|
void xe_socket_init() {
|
||||||
// No-op.
|
// 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_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
socket_addr.sin_port = htons(0);
|
socket_addr.sin_port = htons(0);
|
||||||
int r = bind(socket, (struct sockaddr*)&socket_addr, sizeof(socket_addr));
|
int r = bind(socket, (struct sockaddr*)&socket_addr, sizeof(socket_addr));
|
||||||
if (r == SOCKET_ERROR) {
|
if (r == -1) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
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;
|
int client_ip = client_addr.sin_addr.s_addr;
|
||||||
inet_ntop(AF_INET, &client_ip, out_client_info->addr,
|
inet_ntop(AF_INET, &client_ip, out_client_info->addr,
|
||||||
XECOUNT(out_client_info->addr));
|
poly::countof(out_client_info->addr));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +181,7 @@ int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read,
|
||||||
|
|
||||||
// Poll.
|
// Poll.
|
||||||
int r;
|
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)
|
errno == EINTR)
|
||||||
;
|
;
|
||||||
if (r == -1) {
|
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;
|
loop->pending_queued_write = loop->events[1].revents != 0;
|
||||||
if (loop->pending_queued_write) {
|
if (loop->pending_queued_write) {
|
||||||
uint8_t dummy;
|
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].revents = 0;
|
||||||
loop->events[1].events = POLLIN;
|
loop->events[1].events = POLLIN;
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <xenia/cpu/xenon_runtime.h>
|
#include <xenia/cpu/xenon_runtime.h>
|
||||||
#include <xenia/cpu/xex_module.h>
|
#include <xenia/cpu/xex_module.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace alloy;
|
using namespace alloy;
|
||||||
using namespace alloy::backend;
|
using namespace alloy::backend;
|
||||||
using namespace alloy::frontend::ppc;
|
using namespace alloy::frontend::ppc;
|
||||||
|
@ -23,7 +22,6 @@ using namespace alloy::runtime;
|
||||||
using namespace xe;
|
using namespace xe;
|
||||||
using namespace xe::cpu;
|
using namespace xe::cpu;
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void InitializeIfNeeded();
|
void InitializeIfNeeded();
|
||||||
void CleanupOnShutdown();
|
void CleanupOnShutdown();
|
||||||
|
@ -44,14 +42,13 @@ namespace {
|
||||||
atexit(CleanupOnShutdown);
|
atexit(CleanupOnShutdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CleanupOnShutdown() {
|
void CleanupOnShutdown() {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Processor::Processor(Emulator* emulator)
|
||||||
Processor::Processor(Emulator* emulator) :
|
: export_resolver_(emulator->export_resolver()),
|
||||||
emulator_(emulator), export_resolver_(emulator->export_resolver()),
|
runtime_(0),
|
||||||
runtime_(0), memory_(emulator->memory()),
|
memory_(emulator->memory()),
|
||||||
interrupt_thread_state_(NULL),
|
interrupt_thread_state_(NULL),
|
||||||
interrupt_thread_block_(0) {
|
interrupt_thread_block_(0) {
|
||||||
InitializeIfNeeded();
|
InitializeIfNeeded();
|
||||||
|
@ -101,11 +98,9 @@ int Processor::Setup() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupt_thread_state_ = new XenonThreadState(
|
interrupt_thread_state_ = new XenonThreadState(runtime_, 0, 16 * 1024, 0);
|
||||||
runtime_, 0, 16 * 1024, 0);
|
|
||||||
interrupt_thread_state_->set_name("Interrupt");
|
interrupt_thread_state_->set_name("Interrupt");
|
||||||
interrupt_thread_block_ = memory_->HeapAlloc(
|
interrupt_thread_block_ = memory_->HeapAlloc(0, 2048, MEMORY_FLAG_ZERO);
|
||||||
0, 2048, MEMORY_FLAG_ZERO);
|
|
||||||
interrupt_thread_state_->context()->r[13] = interrupt_thread_block_;
|
interrupt_thread_state_->context()->r[13] = interrupt_thread_block_;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -136,9 +131,8 @@ int Processor::Execute(XenonThreadState* thread_state, uint64_t address) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Processor::Execute(
|
uint64_t Processor::Execute(XenonThreadState* thread_state, uint64_t address,
|
||||||
XenonThreadState* thread_state, uint64_t address, uint64_t args[],
|
uint64_t args[], size_t arg_count) {
|
||||||
size_t arg_count) {
|
|
||||||
SCOPE_profile_cpu_f("cpu");
|
SCOPE_profile_cpu_f("cpu");
|
||||||
|
|
||||||
PPCContext* context = thread_state->context();
|
PPCContext* context = thread_state->context();
|
||||||
|
@ -163,8 +157,8 @@ void Processor::LowerIrql(Irql old_value) {
|
||||||
reinterpret_cast<volatile uint32_t*>(&irql_));
|
reinterpret_cast<volatile uint32_t*>(&irql_));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Processor::ExecuteInterrupt(
|
uint64_t Processor::ExecuteInterrupt(uint32_t cpu, uint64_t address,
|
||||||
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count) {
|
uint64_t args[], size_t arg_count) {
|
||||||
SCOPE_profile_cpu_f("cpu");
|
SCOPE_profile_cpu_f("cpu");
|
||||||
|
|
||||||
// Acquire lock on interrupt thread (we can only dispatch one at a time).
|
// Acquire lock on interrupt thread (we can only dispatch one at a time).
|
||||||
|
|
|
@ -53,7 +53,6 @@ class Processor {
|
||||||
size_t arg_count);
|
size_t arg_count);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Emulator* emulator_;
|
|
||||||
ExportResolver* export_resolver_;
|
ExportResolver* export_resolver_;
|
||||||
|
|
||||||
XenonRuntime* runtime_;
|
XenonRuntime* runtime_;
|
||||||
|
|
|
@ -12,12 +12,10 @@
|
||||||
|
|
||||||
#include <xenia/core.h>
|
#include <xenia/core.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
namespace xenos {
|
namespace xenos {
|
||||||
|
|
||||||
|
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
#define XEPACKEDSTRUCT(name, value) \
|
#define XEPACKEDSTRUCT(name, value) \
|
||||||
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
__pragma(pack(push, 1)) struct name##_s value __pragma(pack(pop)); \
|
||||||
|
@ -27,16 +25,12 @@ namespace xenos {
|
||||||
#define XEPACKEDUNION(name, value) \
|
#define XEPACKEDUNION(name, value) \
|
||||||
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
__pragma(pack(push, 1)) union name##_s value __pragma(pack(pop)); \
|
||||||
typedef union name##_s name;
|
typedef union name##_s name;
|
||||||
#elif XE_COMPILER_GNUC
|
#else
|
||||||
#define XEPACKEDSTRUCT(name, value) \
|
#define XEPACKEDSTRUCT(name, value) struct __attribute__((packed)) name
|
||||||
struct __attribute__((packed)) name
|
#define XEPACKEDSTRUCTANONYMOUS(value) struct __attribute__((packed))
|
||||||
#define XEPACKEDSTRUCTANONYMOUS(value) \
|
#define XEPACKEDUNION(name, value) union __attribute__((packed)) name
|
||||||
struct __attribute__((packed))
|
|
||||||
#define XEPACKEDUNION(name, value) \
|
|
||||||
union __attribute__((packed)) name
|
|
||||||
#endif // MSVC
|
#endif // MSVC
|
||||||
|
|
||||||
|
|
||||||
// This code comes from the freedreno project:
|
// This code comes from the freedreno project:
|
||||||
// https://github.com/freedreno/freedreno/blob/master/includes/instr-a2xx.h
|
// https://github.com/freedreno/freedreno/blob/master/includes/instr-a2xx.h
|
||||||
/*
|
/*
|
||||||
|
@ -62,7 +56,6 @@ namespace xenos {
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
enum a2xx_sq_surfaceformat {
|
enum a2xx_sq_surfaceformat {
|
||||||
FMT_1_REVERSE = 0,
|
FMT_1_REVERSE = 0,
|
||||||
FMT_1 = 1,
|
FMT_1 = 1,
|
||||||
|
@ -127,7 +120,6 @@ enum a2xx_sq_surfaceformat {
|
||||||
FMT_DXT3A_AS_1_1_1_1 = 61,
|
FMT_DXT3A_AS_1_1_1_1 = 61,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ALU instructions:
|
* ALU instructions:
|
||||||
*/
|
*/
|
||||||
|
@ -264,8 +256,6 @@ XEPACKEDSTRUCT(instr_alu_t, {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CF instructions:
|
* CF instructions:
|
||||||
*/
|
*/
|
||||||
|
@ -317,10 +307,8 @@ XEPACKEDSTRUCT(instr_cf_exec_t, {
|
||||||
uint32_t opc : 4; // instr_cf_opc_t
|
uint32_t opc : 4; // instr_cf_opc_t
|
||||||
});
|
});
|
||||||
bool is_cond_exec() const {
|
bool is_cond_exec() const {
|
||||||
return (this->opc == COND_EXEC) ||
|
return (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) ||
|
||||||
(this->opc == COND_EXEC_END) ||
|
(this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_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) ||
|
||||||
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
||||||
}
|
}
|
||||||
|
@ -380,8 +368,10 @@ XEPACKEDUNION(instr_cf_t, {
|
||||||
instr_cf_jmp_call_t jmp_call;
|
instr_cf_jmp_call_t jmp_call;
|
||||||
instr_cf_alloc_t alloc;
|
instr_cf_alloc_t alloc;
|
||||||
XEPACKEDSTRUCTANONYMOUS({
|
XEPACKEDSTRUCTANONYMOUS({
|
||||||
uint32_t : 32;
|
uint32_t:
|
||||||
uint32_t : 12;
|
32;
|
||||||
|
uint32_t:
|
||||||
|
12;
|
||||||
uint32_t opc : 4; // instr_cf_opc_t
|
uint32_t opc : 4; // instr_cf_opc_t
|
||||||
});
|
});
|
||||||
XEPACKEDSTRUCTANONYMOUS({
|
XEPACKEDSTRUCTANONYMOUS({
|
||||||
|
@ -390,27 +380,20 @@ XEPACKEDUNION(instr_cf_t, {
|
||||||
});
|
});
|
||||||
|
|
||||||
bool is_exec() const {
|
bool is_exec() const {
|
||||||
return (this->opc == EXEC) ||
|
return (this->opc == EXEC) || (this->opc == EXEC_END) ||
|
||||||
(this->opc == EXEC_END) ||
|
(this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) ||
|
||||||
(this->opc == COND_EXEC) ||
|
(this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_EXEC_END) ||
|
||||||
(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) ||
|
||||||
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
||||||
}
|
}
|
||||||
bool is_cond_exec() const {
|
bool is_cond_exec() const {
|
||||||
return (this->opc == COND_EXEC) ||
|
return (this->opc == COND_EXEC) || (this->opc == COND_EXEC_END) ||
|
||||||
(this->opc == COND_EXEC_END) ||
|
(this->opc == COND_PRED_EXEC) || (this->opc == COND_PRED_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) ||
|
||||||
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
(this->opc == COND_EXEC_PRED_CLEAN_END);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FETCH instructions:
|
* FETCH instructions:
|
||||||
*/
|
*/
|
||||||
|
@ -553,23 +536,24 @@ XEPACKEDUNION(instr_fetch_t, {
|
||||||
/* dword0: */
|
/* dword0: */
|
||||||
XEPACKEDSTRUCTANONYMOUS({
|
XEPACKEDSTRUCTANONYMOUS({
|
||||||
uint32_t opc : 5; // instr_fetch_opc_t
|
uint32_t opc : 5; // instr_fetch_opc_t
|
||||||
uint32_t : 27;
|
uint32_t:
|
||||||
|
27;
|
||||||
});
|
});
|
||||||
/* dword1: */
|
/* dword1: */
|
||||||
XEPACKEDSTRUCTANONYMOUS({
|
XEPACKEDSTRUCTANONYMOUS({
|
||||||
uint32_t : 32;
|
uint32_t:
|
||||||
|
32;
|
||||||
});
|
});
|
||||||
/* dword2: */
|
/* dword2: */
|
||||||
XEPACKEDSTRUCTANONYMOUS({
|
XEPACKEDSTRUCTANONYMOUS({
|
||||||
uint32_t : 32;
|
uint32_t:
|
||||||
|
32;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} // namespace xenos
|
} // namespace xenos
|
||||||
} // namespace gpu
|
} // namespace gpu
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
|
|
||||||
#endif // XENIA_GPU_XENOS_UCODE_H_
|
#endif // XENIA_GPU_XENOS_UCODE_H_
|
||||||
|
|
|
@ -20,22 +20,18 @@ namespace fs {
|
||||||
|
|
||||||
class DiscImageMemoryMapping : public MemoryMapping {
|
class DiscImageMemoryMapping : public MemoryMapping {
|
||||||
public:
|
public:
|
||||||
DiscImageMemoryMapping(uint8_t* address, size_t length,
|
DiscImageMemoryMapping(uint8_t* address, size_t length)
|
||||||
poly::MappedMemory* mmap)
|
: MemoryMapping(address, length) {}
|
||||||
: MemoryMapping(address, length), mmap_(mmap) {}
|
|
||||||
|
|
||||||
virtual ~DiscImageMemoryMapping() {}
|
~DiscImageMemoryMapping() override = default;
|
||||||
|
|
||||||
private:
|
|
||||||
poly::MappedMemory* mmap_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DiscImageEntry::DiscImageEntry(Type type, Device* device, const char* path,
|
DiscImageEntry::DiscImageEntry(Type type, Device* device, const char* path,
|
||||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry)
|
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry)
|
||||||
: gdfx_entry_(gdfx_entry),
|
: Entry(type, device, path),
|
||||||
gdfx_entry_iterator_(gdfx_entry->children.end()),
|
|
||||||
mmap_(mmap),
|
mmap_(mmap),
|
||||||
Entry(type, device, path) {}
|
gdfx_entry_(gdfx_entry),
|
||||||
|
gdfx_entry_iterator_(gdfx_entry->children.end()) {}
|
||||||
|
|
||||||
DiscImageEntry::~DiscImageEntry() {}
|
DiscImageEntry::~DiscImageEntry() {}
|
||||||
|
|
||||||
|
@ -107,7 +103,7 @@ std::unique_ptr<MemoryMapping> DiscImageEntry::CreateMemoryMapping(
|
||||||
size_t real_length =
|
size_t real_length =
|
||||||
length ? std::min(length, gdfx_entry_->size) : gdfx_entry_->size;
|
length ? std::min(length, gdfx_entry_->size) : gdfx_entry_->size;
|
||||||
return std::make_unique<DiscImageMemoryMapping>(mmap_->data() + real_offset,
|
return std::make_unique<DiscImageMemoryMapping>(mmap_->data() + real_offset,
|
||||||
real_length, mmap_);
|
real_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
X_STATUS DiscImageEntry::Open(KernelState* kernel_state, Mode mode, bool async,
|
X_STATUS DiscImageEntry::Open(KernelState* kernel_state, Mode mode, bool async,
|
||||||
|
|
|
@ -27,21 +27,21 @@ class DiscImageEntry : public Entry {
|
||||||
public:
|
public:
|
||||||
DiscImageEntry(Type type, Device* device, const char* path,
|
DiscImageEntry(Type type, Device* device, const char* path,
|
||||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry);
|
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry);
|
||||||
virtual ~DiscImageEntry();
|
~DiscImageEntry() override;
|
||||||
|
|
||||||
poly::MappedMemory* mmap() const { return mmap_; }
|
poly::MappedMemory* mmap() const { return mmap_; }
|
||||||
GDFXEntry* gdfx_entry() const { return gdfx_entry_; }
|
GDFXEntry* gdfx_entry() const { return gdfx_entry_; }
|
||||||
|
|
||||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||||
const char* file_name, bool restart);
|
const char* file_name, bool restart) override;
|
||||||
|
|
||||||
virtual bool can_map() { return true; }
|
bool can_map() override { return true; }
|
||||||
virtual std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
||||||
Mode map_mode, const size_t offset, const size_t length);
|
Mode map_mode, const size_t offset, const size_t length) override;
|
||||||
|
|
||||||
virtual X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
||||||
XFile** out_file);
|
XFile** out_file) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
poly::MappedMemory* mmap_;
|
poly::MappedMemory* mmap_;
|
||||||
|
|
|
@ -22,20 +22,20 @@ class HostPathEntry : public Entry {
|
||||||
public:
|
public:
|
||||||
HostPathEntry(Type type, Device* device, const char* path,
|
HostPathEntry(Type type, Device* device, const char* path,
|
||||||
const std::wstring& local_path);
|
const std::wstring& local_path);
|
||||||
virtual ~HostPathEntry();
|
~HostPathEntry() override;
|
||||||
|
|
||||||
const std::wstring& local_path() { return local_path_; }
|
const std::wstring& local_path() { return local_path_; }
|
||||||
|
|
||||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||||
const char* file_name, bool restart);
|
const char* file_name, bool restart) override;
|
||||||
|
|
||||||
virtual bool can_map() { return true; }
|
bool can_map() override { return true; }
|
||||||
virtual std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
std::unique_ptr<MemoryMapping> CreateMemoryMapping(
|
||||||
Mode map_mode, const size_t offset, const size_t length);
|
Mode map_mode, const size_t offset, const size_t length) override;
|
||||||
|
|
||||||
virtual X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
X_STATUS Open(KernelState* kernel_state, Mode mode, bool async,
|
||||||
XFile** out_file);
|
XFile** out_file) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::wstring local_path_;
|
std::wstring local_path_;
|
||||||
|
|
|
@ -20,12 +20,12 @@ STFSContainerEntry::STFSContainerEntry(Type type, Device* device,
|
||||||
const char* path,
|
const char* path,
|
||||||
poly::MappedMemory* mmap,
|
poly::MappedMemory* mmap,
|
||||||
STFSEntry* stfs_entry)
|
STFSEntry* stfs_entry)
|
||||||
: stfs_entry_(stfs_entry),
|
: Entry(type, device, path),
|
||||||
stfs_entry_iterator_(stfs_entry->children.end()),
|
|
||||||
mmap_(mmap),
|
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) {
|
X_STATUS STFSContainerEntry::QueryInfo(XFileInfo* out_info) {
|
||||||
assert_not_null(out_info);
|
assert_not_null(out_info);
|
||||||
|
|
|
@ -27,17 +27,17 @@ class STFSContainerEntry : public Entry {
|
||||||
public:
|
public:
|
||||||
STFSContainerEntry(Type type, Device* device, const char* path,
|
STFSContainerEntry(Type type, Device* device, const char* path,
|
||||||
poly::MappedMemory* mmap, STFSEntry* stfs_entry);
|
poly::MappedMemory* mmap, STFSEntry* stfs_entry);
|
||||||
virtual ~STFSContainerEntry();
|
~STFSContainerEntry() override;
|
||||||
|
|
||||||
poly::MappedMemory* mmap() const { return mmap_; }
|
poly::MappedMemory* mmap() const { return mmap_; }
|
||||||
STFSEntry* stfs_entry() const { return stfs_entry_; }
|
STFSEntry* stfs_entry() const { return stfs_entry_; }
|
||||||
|
|
||||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
X_STATUS QueryInfo(XFileInfo* out_info) override;
|
||||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||||
const char* file_name, bool restart);
|
const char* file_name, bool restart) override;
|
||||||
|
|
||||||
virtual X_STATUS Open(KernelState* kernel_state, Mode desired_access,
|
X_STATUS Open(KernelState* kernel_state, Mode desired_access, bool async,
|
||||||
bool async, XFile** out_file);
|
XFile** out_file) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
poly::MappedMemory* mmap_;
|
poly::MappedMemory* mmap_;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace fs {
|
||||||
|
|
||||||
STFSContainerFile::STFSContainerFile(KernelState* kernel_state, Mode mode,
|
STFSContainerFile::STFSContainerFile(KernelState* kernel_state, Mode mode,
|
||||||
STFSContainerEntry* entry)
|
STFSContainerEntry* entry)
|
||||||
: entry_(entry), XFile(kernel_state, mode) {}
|
: XFile(kernel_state, mode), entry_(entry) {}
|
||||||
|
|
||||||
STFSContainerFile::~STFSContainerFile() { delete entry_; }
|
STFSContainerFile::~STFSContainerFile() { delete entry_; }
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ X_STATUS XThread::PlatformExit(int exit_code) {
|
||||||
|
|
||||||
static void* XThreadStartCallbackPthreads(void* param) {
|
static void* XThreadStartCallbackPthreads(void* param) {
|
||||||
XThread* thread = reinterpret_cast<XThread*>(param);
|
XThread* thread = reinterpret_cast<XThread*>(param);
|
||||||
xe::Profiler::ThreadEnter(thread->name());
|
xe::Profiler::ThreadEnter(thread->name().c_str());
|
||||||
current_thread_tls = thread;
|
current_thread_tls = thread;
|
||||||
thread->Execute();
|
thread->Execute();
|
||||||
current_thread_tls = nullptr;
|
current_thread_tls = nullptr;
|
||||||
|
@ -334,7 +334,7 @@ void XThread::PlatformDestroy() {
|
||||||
|
|
||||||
X_STATUS XThread::PlatformExit(int exit_code) {
|
X_STATUS XThread::PlatformExit(int exit_code) {
|
||||||
// NOTE: does not return.
|
// NOTE: does not return.
|
||||||
pthread_exit((void*)exit_code);
|
pthread_exit(reinterpret_cast<void*>(exit_code));
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ void XUserModule::Dump() {
|
||||||
const xe_xex2_header_t* header = xe_xex2_get_header(xex_);
|
const xe_xex2_header_t* header = xe_xex2_get_header(xex_);
|
||||||
|
|
||||||
// XEX info.
|
// 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(" Module Flags: %.8X\n", header->module_flags);
|
||||||
printf(" System Flags: %.8X\n", header->system_flags);
|
printf(" System Flags: %.8X\n", header->system_flags);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -292,7 +292,7 @@ void XUserModule::Dump() {
|
||||||
unimpl_count++;
|
unimpl_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(" Total: %4u\n", import_info_count);
|
printf(" Total: %4zu\n", import_info_count);
|
||||||
printf(" Known: %3d%% (%d known, %d unknown)\n",
|
printf(" Known: %3d%% (%d known, %d unknown)\n",
|
||||||
(int)(known_count / (float)import_info_count * 100.0f),
|
(int)(known_count / (float)import_info_count * 100.0f),
|
||||||
known_count, unknown_count);
|
known_count, unknown_count);
|
||||||
|
|
|
@ -12,19 +12,16 @@
|
||||||
|
|
||||||
#include <xenia/core.h>
|
#include <xenia/core.h>
|
||||||
|
|
||||||
|
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class App;
|
class App;
|
||||||
class Window;
|
class Window;
|
||||||
|
|
||||||
|
|
||||||
class UIEvent {
|
class UIEvent {
|
||||||
public:
|
public:
|
||||||
UIEvent(Window* window = NULL) :
|
UIEvent(Window* window = NULL) : window_(window) {}
|
||||||
window_(window) {}
|
virtual ~UIEvent() = default;
|
||||||
virtual ~UIEvent() {}
|
|
||||||
|
|
||||||
Window* window() const { return window_; }
|
Window* window() const { return window_; }
|
||||||
|
|
||||||
|
@ -34,10 +31,9 @@ private:
|
||||||
|
|
||||||
class KeyEvent : public UIEvent {
|
class KeyEvent : public UIEvent {
|
||||||
public:
|
public:
|
||||||
KeyEvent(Window* window, int key_code) :
|
KeyEvent(Window* window, int key_code)
|
||||||
key_code_(key_code),
|
: UIEvent(window), key_code_(key_code) {}
|
||||||
UIEvent(window) {}
|
~KeyEvent() override = default;
|
||||||
virtual ~KeyEvent() {}
|
|
||||||
|
|
||||||
int key_code() const { return key_code_; }
|
int key_code() const { return key_code_; }
|
||||||
|
|
||||||
|
@ -57,12 +53,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MouseEvent(Window* window,
|
MouseEvent(Window* window, Button button, int32_t x, int32_t y,
|
||||||
Button button, int32_t x, int32_t y,
|
int32_t dx = 0, int32_t dy = 0)
|
||||||
int32_t dx = 0, int32_t dy = 0) :
|
: UIEvent(window), button_(button), x_(x), y_(y), dx_(dx), dy_(dy) {}
|
||||||
button_(button), x_(x), y_(y), dx_(dx), dy_(dy),
|
~MouseEvent() override = default;
|
||||||
UIEvent(window) {}
|
|
||||||
virtual ~MouseEvent() {}
|
|
||||||
|
|
||||||
Button button() const { return button_; }
|
Button button() const { return button_; }
|
||||||
int32_t x() const { return x_; }
|
int32_t x() const { return x_; }
|
||||||
|
@ -78,9 +72,7 @@ private:
|
||||||
int32_t dy_;
|
int32_t dy_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
||||||
|
|
||||||
#endif // XENIA_UI_UI_EVENT_H_
|
#endif // XENIA_UI_UI_EVENT_H_
|
||||||
|
|
|
@ -94,7 +94,7 @@ int main(std::vector<std::wstring>& args) {
|
||||||
runtime->Initialize(std::move(frontend), std::move(backend));
|
runtime->Initialize(std::move(frontend), std::move(backend));
|
||||||
|
|
||||||
auto module = std::make_unique<alloy::runtime::RawModule>(runtime.get());
|
auto module = std::make_unique<alloy::runtime::RawModule>(runtime.get());
|
||||||
module->LoadFile(0x00001000, "test\\codegen\\instr_add.bin");
|
module->LoadFile(0x00001000, L"test\\codegen\\instr_add.bin");
|
||||||
runtime->AddModule(std::move(module));
|
runtime->AddModule(std::move(module));
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue