Removing old run loop/ref/core/etc.
This commit is contained in:
parent
d70f585f5e
commit
a0eebf8898
|
@ -61,7 +61,7 @@ typedef enum {
|
|||
kXEPPCInstrFormatXDSS = 26,
|
||||
} xe_ppc_instr_format_e;
|
||||
|
||||
typedef enum {
|
||||
typedef enum : uint32_t {
|
||||
kXEPPCInstrMaskVXR = 0xFC0003FF,
|
||||
kXEPPCInstrMaskVXA = 0xFC00003F,
|
||||
kXEPPCInstrMaskVX128 = 0xFC0003D0,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef POLY_MEMORY_H_
|
||||
#define POLY_MEMORY_H_
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include <poly/assert.h>
|
||||
|
@ -17,6 +18,15 @@
|
|||
|
||||
namespace poly {
|
||||
|
||||
inline size_t hash_combine(size_t seed) { return seed; }
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
size_t hash_combine(size_t seed, const T& v, const Ts&... vs) {
|
||||
std::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9E3779B9 + (seed << 6) + (seed >> 2);
|
||||
return hash_combine(seed, vs...);
|
||||
}
|
||||
|
||||
size_t page_size();
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define XDB_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_APU_AUDIO_DRIVER_H_
|
||||
#define XENIA_APU_AUDIO_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <queue>
|
||||
#include <thread>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_APU_NOP_NOP_APU_PRIVATE_H_
|
||||
#define XENIA_APU_NOP_NOP_APU_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
#include <xenia/apu/nop/nop_apu.h>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_APU_NOP_NOP_AUDIO_SYSTEM_H_
|
||||
#define XENIA_APU_NOP_NOP_AUDIO_SYSTEM_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
#include <xenia/apu/audio_system.h>
|
||||
#include <xenia/apu/nop/nop_apu-private.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_APU_XAUDIO2_XAUDIO2_APU_PRIVATE_H_
|
||||
#define XENIA_APU_XAUDIO2_XAUDIO2_APU_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
#include <xenia/apu/xaudio2/xaudio2_apu.h>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
|
|
|
@ -10,19 +10,16 @@
|
|||
#ifndef XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_DRIVER_H_
|
||||
#define XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/apu/audio_driver.h>
|
||||
#include <xenia/apu/xaudio2/xaudio2_apu-private.h>
|
||||
|
||||
#include <xaudio2.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/apu/audio_driver.h>
|
||||
#include <xenia/apu/xaudio2/xaudio2_apu-private.h>
|
||||
|
||||
namespace xe {
|
||||
namespace apu {
|
||||
namespace xaudio2 {
|
||||
|
||||
|
||||
class XAudio2AudioDriver : public AudioDriver {
|
||||
public:
|
||||
XAudio2AudioDriver(Emulator* emulator, HANDLE wait);
|
||||
|
@ -45,10 +42,8 @@ private:
|
|||
VoiceCallback* voice_callback_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace xaudio2
|
||||
} // namespace apu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_DRIVER_H_
|
||||
|
|
|
@ -10,19 +10,16 @@
|
|||
#ifndef XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_SYSTEM_H_
|
||||
#define XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_SYSTEM_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/apu/audio_system.h>
|
||||
#include <xenia/apu/xaudio2/xaudio2_apu-private.h>
|
||||
|
||||
#include <xaudio2.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/apu/audio_system.h>
|
||||
#include <xenia/apu/xaudio2/xaudio2_apu-private.h>
|
||||
|
||||
namespace xe {
|
||||
namespace apu {
|
||||
namespace xaudio2 {
|
||||
|
||||
|
||||
class XAudio2AudioSystem : public AudioSystem {
|
||||
public:
|
||||
XAudio2AudioSystem(Emulator* emulator);
|
||||
|
@ -35,10 +32,8 @@ protected:
|
|||
virtual void Initialize();
|
||||
};
|
||||
|
||||
|
||||
} // namespace xaudio2
|
||||
} // namespace apu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_SYSTEM_H_
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_CORE_H_
|
||||
#define XENIA_CORE_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
|
||||
#include <xenia/core/ref.h>
|
||||
#include <xenia/core/run_loop.h>
|
||||
#include <xenia/core/socket.h>
|
||||
#include <xenia/memory.h>
|
||||
|
||||
// TODO(benvanik): remove.
|
||||
#define XEFAIL() goto XECLEANUP
|
||||
#define XEEXPECTZERO(expr) \
|
||||
if ((expr) != 0) { \
|
||||
goto XECLEANUP; \
|
||||
}
|
||||
#define XEEXPECTNOTNULL(expr) \
|
||||
if ((expr) == NULL) { \
|
||||
goto XECLEANUP; \
|
||||
}
|
||||
|
||||
#endif // XENIA_CORE_H_
|
|
@ -1,6 +0,0 @@
|
|||
TODO(benvanik): remove all of this code.
|
||||
|
||||
* hash can be moved to util/
|
||||
* ref can be removed when run_loop is rewritten
|
||||
* run_loop should be moved to ui/ (perhaps)
|
||||
* socket can be moved to poly
|
|
@ -1,241 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
// Copyright (c) 2011 Google, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
// CityHash, by Geoff Pike and Jyrki Alakuijala
|
||||
//
|
||||
// This file provides CityHash64() and related functions.
|
||||
//
|
||||
// It's probably possible to create even faster hash functions by
|
||||
// writing a program that systematically explores some of the space of
|
||||
// possible hash functions, by using SIMD instructions, or by
|
||||
// compromising on hash quality.
|
||||
|
||||
#include <xenia/core/hash.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace xe {
|
||||
|
||||
namespace {
|
||||
|
||||
typedef std::pair<uint64_t, uint64_t> uint128_t;
|
||||
|
||||
inline uint64_t Uint128Low64(const uint128_t &x) { return x.first; }
|
||||
inline uint64_t Uint128High64(const uint128_t &x) { return x.second; }
|
||||
|
||||
// Hash 128 input bits down to 64 bits of output.
|
||||
// This is intended to be a reasonably good hash function.
|
||||
inline uint64_t Hash128to64(const uint128_t &x) {
|
||||
// Murmur-inspired hashing.
|
||||
const uint64_t kMul = 0x9ddfea08eb382d69ULL;
|
||||
uint64_t a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul;
|
||||
a ^= (a >> 47);
|
||||
uint64_t b = (Uint128High64(x) ^ a) * kMul;
|
||||
b ^= (b >> 47);
|
||||
b *= kMul;
|
||||
return b;
|
||||
}
|
||||
|
||||
inline uint64_t UNALIGNED_LOAD64(const char *p) {
|
||||
const uint64_t *p64 = (const uint64_t *)p;
|
||||
return *p64;
|
||||
}
|
||||
inline uint32_t UNALIGNED_LOAD32(const char *p) {
|
||||
const uint32_t *p32 = (const uint32_t *)p;
|
||||
return *p32;
|
||||
}
|
||||
|
||||
#if !defined(LIKELY)
|
||||
#if HAVE_BUILTIN_EXPECT
|
||||
#define LIKELY(x) (__builtin_expect(!!(x), 1))
|
||||
#else
|
||||
#define LIKELY(x) (x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static uint64_t Fetch64(const char *p) { return UNALIGNED_LOAD64(p); }
|
||||
|
||||
static uint32_t Fetch32(const char *p) { return UNALIGNED_LOAD32(p); }
|
||||
|
||||
// Some primes between 2^63 and 2^64 for various uses.
|
||||
static const uint64_t k0 = 0xc3a5c85c97cb3127ULL;
|
||||
static const uint64_t k1 = 0xb492b66fbe98f273ULL;
|
||||
static const uint64_t k2 = 0x9ae16a3b2f90404fULL;
|
||||
|
||||
// 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) {
|
||||
// Avoid shifting by 64: doing so yields an undefined result.
|
||||
return shift == 0 ? val : ((val >> shift) | (val << (64 - shift)));
|
||||
}
|
||||
|
||||
static uint64_t ShiftMix(uint64_t val) { return val ^ (val >> 47); }
|
||||
|
||||
static uint64_t HashLen16(uint64_t u, uint64_t v) {
|
||||
return Hash128to64(uint128_t(u, v));
|
||||
}
|
||||
|
||||
static uint64_t HashLen16(uint64_t u, uint64_t v, uint64_t mul) {
|
||||
// Murmur-inspired hashing.
|
||||
uint64_t a = (u ^ v) * mul;
|
||||
a ^= (a >> 47);
|
||||
uint64_t b = (v ^ a) * mul;
|
||||
b ^= (b >> 47);
|
||||
b *= mul;
|
||||
return b;
|
||||
}
|
||||
|
||||
static uint64_t HashLen0to16(const char *s, size_t len) {
|
||||
if (len >= 8) {
|
||||
uint64_t mul = k2 + len * 2;
|
||||
uint64_t a = Fetch64(s) + k2;
|
||||
uint64_t b = Fetch64(s + len - 8);
|
||||
uint64_t c = Rotate(b, 37) * mul + a;
|
||||
uint64_t d = (Rotate(a, 25) + b) * mul;
|
||||
return HashLen16(c, d, mul);
|
||||
}
|
||||
if (len >= 4) {
|
||||
uint64_t mul = k2 + len * 2;
|
||||
uint64_t a = Fetch32(s);
|
||||
return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul);
|
||||
}
|
||||
if (len > 0) {
|
||||
uint8_t a = s[0];
|
||||
uint8_t b = s[len >> 1];
|
||||
uint8_t c = s[len - 1];
|
||||
uint32_t y = static_cast<uint32_t>(a) + (static_cast<uint32_t>(b) << 8);
|
||||
uint32_t z = (uint32_t)len + (static_cast<uint32_t>(c) << 2);
|
||||
return ShiftMix(y * k2 ^ z * k0) * k2;
|
||||
}
|
||||
return k2;
|
||||
}
|
||||
|
||||
// This probably works well for 16-byte strings as well, but it may be overkill
|
||||
// in that case.
|
||||
static uint64_t HashLen17to32(const char *s, size_t len) {
|
||||
uint64_t mul = k2 + len * 2;
|
||||
uint64_t a = Fetch64(s) * k1;
|
||||
uint64_t b = Fetch64(s + 8);
|
||||
uint64_t c = Fetch64(s + len - 8) * mul;
|
||||
uint64_t d = Fetch64(s + len - 16) * k2;
|
||||
return HashLen16(Rotate(a + b, 43) + Rotate(c, 30) + d,
|
||||
a + Rotate(b + k2, 18) + c, mul);
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for 48 bytes. Quick and dirty.
|
||||
// Callers do best to use "random-looking" values for a and b.
|
||||
static std::pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
|
||||
uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) {
|
||||
a += w;
|
||||
b = Rotate(b + a + z, 21);
|
||||
uint64_t c = a;
|
||||
a += x;
|
||||
a += y;
|
||||
b += Rotate(a, 44);
|
||||
return std::make_pair(a + z, b + c);
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
|
||||
static std::pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(const char *s,
|
||||
uint64_t a,
|
||||
uint64_t b) {
|
||||
return WeakHashLen32WithSeeds(Fetch64(s), Fetch64(s + 8), Fetch64(s + 16),
|
||||
Fetch64(s + 24), a, b);
|
||||
}
|
||||
|
||||
// Return an 8-byte hash for 33 to 64 bytes.
|
||||
static uint64_t HashLen33to64(const char *s, size_t len) {
|
||||
uint64_t mul = k2 + len * 2;
|
||||
uint64_t a = Fetch64(s) * k2;
|
||||
uint64_t b = Fetch64(s + 8);
|
||||
uint64_t c = Fetch64(s + len - 24);
|
||||
uint64_t d = Fetch64(s + len - 32);
|
||||
uint64_t e = Fetch64(s + 16) * k2;
|
||||
uint64_t f = Fetch64(s + 24) * 9;
|
||||
uint64_t g = Fetch64(s + len - 8);
|
||||
uint64_t h = Fetch64(s + len - 16) * mul;
|
||||
uint64_t u = Rotate(a + g, 43) + (Rotate(b, 30) + c) * 9;
|
||||
uint64_t v = ((a + g) ^ d) + f + 1;
|
||||
uint64_t w = poly::byte_swap((u + v) * mul) + h;
|
||||
uint64_t x = Rotate(e + f, 42) + c;
|
||||
uint64_t y = (poly::byte_swap((v + w) * mul) + g) * mul;
|
||||
uint64_t z = e + f + c;
|
||||
a = poly::byte_swap((x + z) * mul + y) + b;
|
||||
b = ShiftMix((z + a) * mul + d + h) * mul;
|
||||
return b + x;
|
||||
}
|
||||
|
||||
uint64_t CityHash64(const char *s, size_t len) {
|
||||
if (len <= 32) {
|
||||
if (len <= 16) {
|
||||
return HashLen0to16(s, len);
|
||||
} else {
|
||||
return HashLen17to32(s, len);
|
||||
}
|
||||
} else if (len <= 64) {
|
||||
return HashLen33to64(s, len);
|
||||
}
|
||||
|
||||
// For strings over 64 bytes we hash the end first, and then as we
|
||||
// loop we keep 56 bytes of state: v, w, x, y, and z.
|
||||
uint64_t x = Fetch64(s + len - 40);
|
||||
uint64_t y = Fetch64(s + len - 16) + Fetch64(s + len - 56);
|
||||
uint64_t z = HashLen16(Fetch64(s + len - 48) + len, Fetch64(s + len - 24));
|
||||
std::pair<uint64_t, uint64_t> v =
|
||||
WeakHashLen32WithSeeds(s + len - 64, len, z);
|
||||
std::pair<uint64_t, uint64_t> w =
|
||||
WeakHashLen32WithSeeds(s + len - 32, y + k1, x);
|
||||
x = x * k1 + Fetch64(s);
|
||||
|
||||
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
|
||||
len = (len - 1) & ~static_cast<size_t>(63);
|
||||
do {
|
||||
x = Rotate(x + y + v.first + Fetch64(s + 8), 37) * k1;
|
||||
y = Rotate(y + v.second + Fetch64(s + 48), 42) * k1;
|
||||
x ^= w.second;
|
||||
y += v.first + Fetch64(s + 40);
|
||||
z = Rotate(z + w.first, 33) * k1;
|
||||
v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
|
||||
w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch64(s + 16));
|
||||
std::swap(z, x);
|
||||
s += 64;
|
||||
len -= 64;
|
||||
} while (len != 0);
|
||||
return HashLen16(HashLen16(v.first, w.first) + ShiftMix(y) * k1 + z,
|
||||
HashLen16(v.second, w.second) + x);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
uint64_t hash64(const void *data, size_t length, uint64_t seed) {
|
||||
return HashLen16(CityHash64((const char *)data, length) - k2, seed);
|
||||
}
|
||||
|
||||
} // namespace xe
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_CORE_HASH_H_
|
||||
#define XENIA_CORE_HASH_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
|
||||
inline size_t hash_combine(size_t seed) { return seed; }
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
size_t hash_combine(size_t seed, const T& v, const Ts&... vs) {
|
||||
std::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9E3779B9 + (seed << 6) + (seed >> 2);
|
||||
return hash_combine(seed, vs...);
|
||||
}
|
||||
|
||||
uint64_t hash64(const void* data, size_t length, uint64_t seed = 0);
|
||||
|
||||
} // namespace xe
|
||||
|
||||
#endif // XENIA_CORE_HASH_H_
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <xenia/core/ref.h>
|
||||
|
||||
void xe_ref_init(xe_ref_t* ref) { ref->count = 1; }
|
||||
|
||||
void xe_ref_retain(xe_ref_t* ref) { poly::atomic_inc(&ref->count); }
|
||||
|
||||
void xe_ref_release(xe_ref_t* ref, xe_ref_dealloc_t dealloc) {
|
||||
if (!ref) {
|
||||
return;
|
||||
}
|
||||
if (!poly::atomic_dec(&ref->count)) {
|
||||
if (dealloc) {
|
||||
dealloc(ref);
|
||||
}
|
||||
free(ref);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_CORE_RUN_LOOP_H_
|
||||
#define XENIA_CORE_RUN_LOOP_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core/ref.h>
|
||||
|
||||
|
||||
struct xe_run_loop;
|
||||
typedef struct xe_run_loop* xe_run_loop_ref;
|
||||
|
||||
|
||||
xe_run_loop_ref xe_run_loop_create();
|
||||
xe_run_loop_ref xe_run_loop_retain(xe_run_loop_ref run_loop);
|
||||
void xe_run_loop_release(xe_run_loop_ref run_loop);
|
||||
|
||||
int xe_run_loop_pump(xe_run_loop_ref run_loop);
|
||||
void xe_run_loop_quit(xe_run_loop_ref run_loop);
|
||||
|
||||
typedef void (*xe_run_loop_callback)(void* data);
|
||||
void xe_run_loop_call(xe_run_loop_ref run_loop,
|
||||
xe_run_loop_callback callback, void* data);
|
||||
|
||||
|
||||
#endif // XENIA_CORE_RUN_LOOP_H_
|
|
@ -1,74 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <xenia/core/run_loop.h>
|
||||
|
||||
typedef struct xe_run_loop { xe_ref_t ref; } xe_run_loop_t;
|
||||
|
||||
#define WM_XE_RUN_LOOP_QUIT (WM_APP + 0x100)
|
||||
#define WM_XE_RUN_LOOP_CALL (WM_APP + 0x101)
|
||||
|
||||
typedef struct xe_run_loop_call {
|
||||
xe_run_loop_callback callback;
|
||||
void* data;
|
||||
} xe_run_loop_call_t;
|
||||
|
||||
xe_run_loop_ref xe_run_loop_create() {
|
||||
xe_run_loop_ref run_loop = (xe_run_loop_ref)calloc(1, sizeof(xe_run_loop_t));
|
||||
xe_ref_init((xe_ref)run_loop);
|
||||
return run_loop;
|
||||
}
|
||||
|
||||
void xe_run_loop_dealloc(xe_run_loop_ref run_loop) {}
|
||||
|
||||
xe_run_loop_ref xe_run_loop_retain(xe_run_loop_ref run_loop) {
|
||||
xe_ref_retain((xe_ref)run_loop);
|
||||
return run_loop;
|
||||
}
|
||||
|
||||
void xe_run_loop_release(xe_run_loop_ref run_loop) {
|
||||
xe_ref_release((xe_ref)run_loop, (xe_ref_dealloc_t)xe_run_loop_dealloc);
|
||||
}
|
||||
|
||||
int xe_run_loop_pump(xe_run_loop_ref run_loop) {
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
switch (msg.message) {
|
||||
case WM_XE_RUN_LOOP_CALL:
|
||||
if (msg.wParam == (WPARAM)run_loop) {
|
||||
xe_run_loop_call_t* call = (xe_run_loop_call_t*)msg.lParam;
|
||||
call->callback(call->data);
|
||||
free(call);
|
||||
}
|
||||
break;
|
||||
case WM_XE_RUN_LOOP_QUIT:
|
||||
if (msg.wParam == (WPARAM)run_loop) {
|
||||
// Done!
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void xe_run_loop_quit(xe_run_loop_ref run_loop) {
|
||||
PostMessage(NULL, WM_XE_RUN_LOOP_QUIT, (WPARAM)run_loop, 0);
|
||||
}
|
||||
|
||||
void xe_run_loop_call(xe_run_loop_ref run_loop, xe_run_loop_callback callback,
|
||||
void* data) {
|
||||
xe_run_loop_call_t* call =
|
||||
(xe_run_loop_call_t*)calloc(1, sizeof(xe_run_loop_call_t));
|
||||
call->callback = callback;
|
||||
call->data = data;
|
||||
PostMessage(NULL, WM_XE_RUN_LOOP_CALL, (WPARAM)run_loop, (LPARAM)call);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_CORE_SOCKET_H_
|
||||
#define XENIA_CORE_SOCKET_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
|
||||
typedef intptr_t socket_t;
|
||||
#define XE_INVALID_SOCKET -1
|
||||
|
||||
|
||||
void xe_socket_init();
|
||||
|
||||
socket_t xe_socket_create_tcp();
|
||||
void xe_socket_close(socket_t socket);
|
||||
|
||||
void xe_socket_set_keepalive(socket_t socket, bool value);
|
||||
void xe_socket_set_reuseaddr(socket_t socket, bool value);
|
||||
void xe_socket_set_nodelay(socket_t socket, bool value);
|
||||
void xe_socket_set_nonblock(socket_t socket, bool value);
|
||||
|
||||
int xe_socket_bind(socket_t socket, uint32_t port);
|
||||
int xe_socket_bind_loopback(socket_t socket);
|
||||
int xe_socket_listen(socket_t socket);
|
||||
|
||||
typedef struct {
|
||||
socket_t socket;
|
||||
char addr[16];
|
||||
} xe_socket_connection_t;
|
||||
int xe_socket_accept(socket_t socket, xe_socket_connection_t* out_client_info);
|
||||
|
||||
int64_t xe_socket_send(socket_t socket, const uint8_t* data, size_t length,
|
||||
int flags, int* out_error_code);
|
||||
int64_t xe_socket_recv(socket_t socket, uint8_t* data, size_t length, int flags,
|
||||
int* out_error_code);
|
||||
|
||||
typedef struct xe_socket_loop xe_socket_loop_t;
|
||||
xe_socket_loop_t* xe_socket_loop_create(socket_t socket);
|
||||
void xe_socket_loop_destroy(xe_socket_loop_t* loop);
|
||||
int xe_socket_loop_poll(xe_socket_loop_t* loop,
|
||||
bool check_read, bool check_write);
|
||||
void xe_socket_loop_set_queued_write(xe_socket_loop_t* loop);
|
||||
bool xe_socket_loop_check_queued_write(xe_socket_loop_t* loop);
|
||||
bool xe_socket_loop_check_socket_recv(xe_socket_loop_t* loop);
|
||||
bool xe_socket_loop_check_socket_send(xe_socket_loop_t* loop);
|
||||
|
||||
|
||||
#endif // XENIA_CORE_SOCKET_H_
|
|
@ -1,229 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <xenia/core/socket.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
|
||||
void xe_socket_init() {
|
||||
// No-op.
|
||||
}
|
||||
|
||||
socket_t xe_socket_create_tcp() {
|
||||
socket_t socket_result = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (socket_result < 1) {
|
||||
return XE_INVALID_SOCKET;
|
||||
}
|
||||
return socket_result;
|
||||
}
|
||||
|
||||
void xe_socket_close(socket_t socket) {
|
||||
shutdown(socket, SHUT_WR);
|
||||
close(socket);
|
||||
}
|
||||
|
||||
void xe_socket_set_keepalive(socket_t socket, bool value) {
|
||||
int opt_value = value ? 1 : 0;
|
||||
setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, &opt_value, sizeof(opt_value));
|
||||
}
|
||||
|
||||
void xe_socket_set_reuseaddr(socket_t socket, bool value) {
|
||||
int opt_value = value ? 1 : 0;
|
||||
setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, &opt_value, sizeof(opt_value));
|
||||
}
|
||||
|
||||
void xe_socket_set_nodelay(socket_t socket, bool value) {
|
||||
int opt_value = value ? 1 : 0;
|
||||
setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &opt_value, sizeof(opt_value));
|
||||
}
|
||||
|
||||
void xe_socket_set_nonblock(socket_t socket, bool value) {
|
||||
int flags;
|
||||
while ((flags = fcntl(socket, F_GETFL, 0)) == -1 && errno == EINTR)
|
||||
;
|
||||
if (flags == -1) {
|
||||
return;
|
||||
}
|
||||
int r;
|
||||
while ((r = fcntl(socket, F_SETFL, flags | O_NONBLOCK)) == -1 &&
|
||||
errno == EINTR)
|
||||
;
|
||||
if (r == -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int xe_socket_bind(socket_t socket, uint32_t port) {
|
||||
struct sockaddr_in socket_addr;
|
||||
socket_addr.sin_family = AF_INET;
|
||||
socket_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
socket_addr.sin_port = htons(port);
|
||||
int r = bind(socket, (struct sockaddr*)&socket_addr, sizeof(socket_addr));
|
||||
if (r < 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xe_socket_bind_loopback(socket_t socket) {
|
||||
struct sockaddr_in socket_addr;
|
||||
socket_addr.sin_family = AF_INET;
|
||||
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 == -1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xe_socket_listen(socket_t socket) {
|
||||
int r = listen(socket, 5);
|
||||
if (r < 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xe_socket_accept(socket_t socket, xe_socket_connection_t* out_client_info) {
|
||||
struct sockaddr_in client_addr;
|
||||
socklen_t client_count = sizeof(client_addr);
|
||||
socket_t client_socket_id =
|
||||
accept(socket, (struct sockaddr*)&client_addr, &client_count);
|
||||
if (client_socket_id < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
out_client_info->socket = client_socket_id;
|
||||
|
||||
int client_ip = client_addr.sin_addr.s_addr;
|
||||
inet_ntop(AF_INET, &client_ip, out_client_info->addr,
|
||||
poly::countof(out_client_info->addr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t xe_socket_send(socket_t socket, const uint8_t* data, size_t length,
|
||||
int flags, int* out_error_code) {
|
||||
ssize_t result = send(socket, data, length, flags);
|
||||
*out_error_code = errno;
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t xe_socket_recv(socket_t socket, uint8_t* data, size_t length, int flags,
|
||||
int* out_error_code) {
|
||||
ssize_t result = recv(socket, data, length, flags);
|
||||
*out_error_code = errno;
|
||||
return result;
|
||||
}
|
||||
|
||||
struct xe_socket_loop {
|
||||
socket_t socket;
|
||||
|
||||
int notify_rd_id;
|
||||
int notify_wr_id;
|
||||
|
||||
struct pollfd events[2];
|
||||
|
||||
bool pending_queued_write;
|
||||
bool pending_recv;
|
||||
bool pending_send;
|
||||
};
|
||||
|
||||
xe_socket_loop_t* xe_socket_loop_create(socket_t socket) {
|
||||
xe_socket_loop_t* loop =
|
||||
(xe_socket_loop_t*)calloc(1, sizeof(xe_socket_loop_t));
|
||||
|
||||
loop->socket = socket;
|
||||
|
||||
int notify_ids[2];
|
||||
socketpair(PF_LOCAL, SOCK_STREAM, 0, notify_ids);
|
||||
loop->notify_rd_id = notify_ids[0];
|
||||
loop->notify_wr_id = notify_ids[1];
|
||||
|
||||
loop->events[0].fd = socket;
|
||||
loop->events[0].events = POLLIN;
|
||||
loop->events[1].fd = loop->notify_rd_id;
|
||||
loop->events[1].events = POLLIN;
|
||||
|
||||
return loop;
|
||||
}
|
||||
|
||||
void xe_socket_loop_destroy(xe_socket_loop_t* loop) {
|
||||
close(loop->notify_rd_id);
|
||||
close(loop->notify_wr_id);
|
||||
free(loop);
|
||||
}
|
||||
|
||||
int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read,
|
||||
bool check_write) {
|
||||
// Prep events object.
|
||||
if (check_read) {
|
||||
loop->events[0].events |= POLLIN;
|
||||
}
|
||||
if (check_write) {
|
||||
loop->events[0].events |= POLLOUT;
|
||||
}
|
||||
|
||||
// Poll.
|
||||
int r;
|
||||
while ((r = poll(loop->events, poly::countof(loop->events), -1)) == -1 &&
|
||||
errno == EINTR)
|
||||
;
|
||||
if (r == -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// If we failed, die.
|
||||
if (loop->events[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Check queued write.
|
||||
loop->pending_queued_write = loop->events[1].revents != 0;
|
||||
if (loop->pending_queued_write) {
|
||||
uint8_t dummy;
|
||||
recv(loop->notify_rd_id, &dummy, 1, 0);
|
||||
}
|
||||
loop->events[1].revents = 0;
|
||||
loop->events[1].events = POLLIN;
|
||||
|
||||
// Check send/recv.
|
||||
loop->pending_recv = (loop->events[0].revents & POLLIN) != 0;
|
||||
loop->pending_send = (loop->events[0].revents & POLLOUT) != 0;
|
||||
loop->events[0].revents = 0;
|
||||
loop->events[0].events = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void xe_socket_loop_set_queued_write(xe_socket_loop_t* loop) {
|
||||
uint8_t b = 0xFF;
|
||||
write(loop->notify_wr_id, &b, 1);
|
||||
}
|
||||
|
||||
bool xe_socket_loop_check_queued_write(xe_socket_loop_t* loop) {
|
||||
return loop->pending_queued_write;
|
||||
}
|
||||
|
||||
bool xe_socket_loop_check_socket_recv(xe_socket_loop_t* loop) {
|
||||
return loop->pending_recv;
|
||||
}
|
||||
|
||||
bool xe_socket_loop_check_socket_send(xe_socket_loop_t* loop) {
|
||||
return loop->pending_send;
|
||||
}
|
|
@ -1,293 +0,0 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <xenia/core/socket.h>
|
||||
|
||||
#include <poly/math.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <mstcpip.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
// TODO(benvanik): win32 calls
|
||||
|
||||
void xe_socket_init() {
|
||||
WSADATA wsa_data;
|
||||
int result = WSAStartup(MAKEWORD(2, 2), &wsa_data);
|
||||
if (result) {
|
||||
XELOGE("Winsock failed to initialize: %d", result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
socket_t xe_socket_create_tcp() {
|
||||
socket_t socket_result = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (socket_result < 1) {
|
||||
return XE_INVALID_SOCKET;
|
||||
}
|
||||
return socket_result;
|
||||
}
|
||||
|
||||
void xe_socket_close(socket_t socket) {
|
||||
struct linger so_linger;
|
||||
so_linger.l_onoff = TRUE;
|
||||
so_linger.l_linger = 30;
|
||||
setsockopt(socket, SOL_SOCKET, SO_LINGER, (const char*)&so_linger,
|
||||
sizeof so_linger);
|
||||
shutdown(socket, SD_SEND);
|
||||
closesocket(socket);
|
||||
}
|
||||
|
||||
void xe_socket_set_keepalive(socket_t socket, bool value) {
|
||||
struct tcp_keepalive alive;
|
||||
alive.onoff = TRUE;
|
||||
alive.keepalivetime = 7200000;
|
||||
alive.keepaliveinterval = 6000;
|
||||
DWORD bytes_returned;
|
||||
WSAIoctl(socket, SIO_KEEPALIVE_VALS, &alive, sizeof(alive), NULL, 0,
|
||||
&bytes_returned, NULL, NULL);
|
||||
}
|
||||
|
||||
void xe_socket_set_reuseaddr(socket_t socket, bool value) {
|
||||
int opt_value = value ? 1 : 0;
|
||||
setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt_value,
|
||||
sizeof(opt_value));
|
||||
}
|
||||
|
||||
void xe_socket_set_nodelay(socket_t socket, bool value) {
|
||||
int opt_value = value ? 1 : 0;
|
||||
setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (const char*)&opt_value,
|
||||
sizeof(opt_value));
|
||||
}
|
||||
|
||||
void xe_socket_set_nonblock(socket_t socket, bool value) {
|
||||
u_long mode = value ? 1 : 0;
|
||||
ioctlsocket(socket, FIONBIO, &mode);
|
||||
}
|
||||
|
||||
int xe_socket_bind(socket_t socket, uint32_t port) {
|
||||
struct sockaddr_in socket_addr;
|
||||
socket_addr.sin_family = AF_INET;
|
||||
socket_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
socket_addr.sin_port = htons(port);
|
||||
int r = bind(socket, (struct sockaddr*)&socket_addr, sizeof(socket_addr));
|
||||
if (r == SOCKET_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xe_socket_bind_loopback(socket_t socket) {
|
||||
struct sockaddr_in socket_addr;
|
||||
socket_addr.sin_family = AF_INET;
|
||||
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) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xe_socket_listen(socket_t socket) {
|
||||
int r = listen(socket, 5);
|
||||
if (r == SOCKET_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xe_socket_accept(socket_t socket, xe_socket_connection_t* out_client_info) {
|
||||
struct sockaddr_in client_addr;
|
||||
int client_count = sizeof(client_addr);
|
||||
socket_t client_socket_id =
|
||||
accept(socket, (struct sockaddr*)&client_addr, &client_count);
|
||||
if (client_socket_id == INVALID_SOCKET) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
out_client_info->socket = client_socket_id;
|
||||
|
||||
int client_ip = client_addr.sin_addr.s_addr;
|
||||
inet_ntop(AF_INET, &client_ip, out_client_info->addr,
|
||||
poly::countof(out_client_info->addr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t xe_socket_send(socket_t socket, const uint8_t* data, size_t length,
|
||||
int flags, int* out_error_code) {
|
||||
int result = send(socket, (const char*)data, (int)length, flags);
|
||||
int error_code = WSAGetLastError();
|
||||
if (error_code == WSAEWOULDBLOCK) {
|
||||
*out_error_code = EWOULDBLOCK;
|
||||
} else {
|
||||
*out_error_code = error_code;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t xe_socket_recv(socket_t socket, uint8_t* data, size_t length, int flags,
|
||||
int* out_error_code) {
|
||||
int result = recv(socket, (char*)data, (int)length, flags);
|
||||
int error_code = WSAGetLastError();
|
||||
if (error_code == WSAEWOULDBLOCK) {
|
||||
*out_error_code = EWOULDBLOCK;
|
||||
} else {
|
||||
*out_error_code = error_code;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
struct xe_socket_loop {
|
||||
socket_t socket;
|
||||
|
||||
socket_t notify_rd_id;
|
||||
socket_t notify_wr_id;
|
||||
|
||||
WSAPOLLFD events[2];
|
||||
|
||||
bool pending_queued_write;
|
||||
bool pending_recv;
|
||||
bool pending_send;
|
||||
};
|
||||
|
||||
namespace {
|
||||
int Win32SocketPair(socket_t sockets[2]) {
|
||||
sockets[0] = sockets[1] = INVALID_SOCKET;
|
||||
|
||||
int r;
|
||||
|
||||
socket_t listener = xe_socket_create_tcp();
|
||||
xe_socket_set_reuseaddr(listener, true);
|
||||
r = xe_socket_bind_loopback(listener);
|
||||
r = xe_socket_listen(listener);
|
||||
|
||||
sockaddr listener_name;
|
||||
int listener_name_len = sizeof(listener_name);
|
||||
r = getsockname(listener, &listener_name, &listener_name_len);
|
||||
|
||||
socket_t client = xe_socket_create_tcp();
|
||||
r = connect(client, &listener_name, listener_name_len);
|
||||
|
||||
socket_t server = accept(listener, &listener_name, &listener_name_len);
|
||||
|
||||
sockaddr client_name;
|
||||
int client_name_len = sizeof(client_name);
|
||||
r = getsockname(client, &client_name, &client_name_len);
|
||||
const char* pc = (const char*)&client_name;
|
||||
const char* pn = (const char*)&listener_name;
|
||||
for (size_t n = 0; n < sizeof(client_name); n++) {
|
||||
if (pc[n] != pn[n]) {
|
||||
closesocket(listener);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
xe_socket_set_nonblock(client, true);
|
||||
|
||||
sockets[0] = client;
|
||||
sockets[1] = server;
|
||||
|
||||
closesocket(listener);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
xe_socket_loop_t* xe_socket_loop_create(socket_t socket) {
|
||||
xe_socket_loop_t* loop =
|
||||
(xe_socket_loop_t*)calloc(1, sizeof(xe_socket_loop_t));
|
||||
|
||||
loop->socket = socket;
|
||||
|
||||
socket_t notify_ids[2] = {0, 0};
|
||||
for (int retry = 0; retry < 5; retry++) {
|
||||
if (!Win32SocketPair(notify_ids)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!notify_ids[0]) {
|
||||
free(loop);
|
||||
return NULL;
|
||||
}
|
||||
loop->notify_rd_id = notify_ids[0];
|
||||
loop->notify_wr_id = notify_ids[1];
|
||||
|
||||
loop->events[0].fd = socket;
|
||||
loop->events[0].events = POLLIN;
|
||||
loop->events[1].fd = loop->notify_rd_id;
|
||||
loop->events[1].events = POLLIN;
|
||||
|
||||
return loop;
|
||||
}
|
||||
|
||||
void xe_socket_loop_destroy(xe_socket_loop_t* loop) {
|
||||
closesocket(loop->notify_rd_id);
|
||||
closesocket(loop->notify_wr_id);
|
||||
free(loop);
|
||||
}
|
||||
|
||||
int xe_socket_loop_poll(xe_socket_loop_t* loop, bool check_read,
|
||||
bool check_write) {
|
||||
// Prep events object.
|
||||
loop->events[0].events = 0;
|
||||
if (check_read) {
|
||||
loop->events[0].events |= POLLIN;
|
||||
}
|
||||
if (check_write) {
|
||||
loop->events[0].events |= POLLOUT;
|
||||
}
|
||||
|
||||
// Poll.
|
||||
int r = WSAPoll(loop->events, static_cast<ULONG>(poly::countof(loop->events)),
|
||||
-1);
|
||||
if (r == -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// If we failed, die.
|
||||
if (loop->events[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Check queued write.
|
||||
loop->pending_queued_write = loop->events[1].revents != 0;
|
||||
if (loop->pending_queued_write) {
|
||||
char dummy;
|
||||
recv(loop->notify_rd_id, &dummy, 1, 0);
|
||||
}
|
||||
loop->events[1].revents = 0;
|
||||
loop->events[1].events = POLLIN;
|
||||
|
||||
// Check send/recv.
|
||||
loop->pending_recv = (loop->events[0].revents & POLLIN) != 0;
|
||||
loop->pending_send = (loop->events[0].revents & POLLOUT) != 0;
|
||||
loop->events[0].revents = 0;
|
||||
loop->events[0].events = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void xe_socket_loop_set_queued_write(xe_socket_loop_t* loop) {
|
||||
char b = (char)0xFF;
|
||||
send(loop->notify_wr_id, &b, 1, 0);
|
||||
}
|
||||
|
||||
bool xe_socket_loop_check_queued_write(xe_socket_loop_t* loop) {
|
||||
return loop->pending_queued_write;
|
||||
}
|
||||
|
||||
bool xe_socket_loop_check_socket_recv(xe_socket_loop_t* loop) {
|
||||
return loop->pending_recv;
|
||||
}
|
||||
|
||||
bool xe_socket_loop_check_socket_send(xe_socket_loop_t* loop) {
|
||||
return loop->pending_send;
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
# Copyright 2013 Ben Vanik. All Rights Reserved.
|
||||
{
|
||||
'sources': [
|
||||
'hash.cc',
|
||||
'hash.h',
|
||||
'ref.cc',
|
||||
'ref.h',
|
||||
'run_loop.h',
|
||||
'socket.h',
|
||||
],
|
||||
|
||||
'conditions': [
|
||||
['OS == "mac" or OS == "linux"', {
|
||||
'sources': [
|
||||
'socket_posix.cc',
|
||||
],
|
||||
}],
|
||||
['OS == "linux"', {
|
||||
'sources': [
|
||||
],
|
||||
}],
|
||||
['OS == "mac"', {
|
||||
'sources': [
|
||||
],
|
||||
}],
|
||||
['OS == "win"', {
|
||||
'sources': [
|
||||
'run_loop_win.cc',
|
||||
'socket_win.cc',
|
||||
],
|
||||
}],
|
||||
],
|
||||
}
|
|
@ -13,8 +13,9 @@
|
|||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
#include <xenia/memory.h>
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
#define XENIA_CPU_XENON_RUNTIME_H_
|
||||
|
||||
#include <alloy/runtime/runtime.h>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/cpu/xenon_thread_state.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
#include <xenia/memory.h>
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
#include <alloy/frontend/ppc/ppc_context.h>
|
||||
#include <alloy/runtime/thread_state.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/memory.h>
|
||||
|
||||
namespace xdb {
|
||||
namespace protocol {
|
||||
|
|
|
@ -27,23 +27,22 @@ void UndefinedImport(PPCContext* ppc_state, void* arg0, void* arg1) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
XexModule::XexModule(
|
||||
XenonRuntime* runtime) :
|
||||
runtime_(runtime),
|
||||
xex_(0),
|
||||
base_address_(0), low_address_(0), high_address_(0),
|
||||
Module(runtime) {
|
||||
}
|
||||
XexModule::XexModule(XenonRuntime* runtime)
|
||||
: Module(runtime),
|
||||
runtime_(runtime),
|
||||
xex_(nullptr),
|
||||
base_address_(0),
|
||||
low_address_(0),
|
||||
high_address_(0) {}
|
||||
|
||||
XexModule::~XexModule() {
|
||||
xe_xex2_release(xex_);
|
||||
xe_xex2_dealloc(xex_);
|
||||
}
|
||||
|
||||
int XexModule::Load(const std::string& name, const std::string& path, xe_xex2_ref xex) {
|
||||
int result;
|
||||
|
||||
xex_ = xe_xex2_retain(xex);
|
||||
xex_ = xex;
|
||||
const xe_xex2_header_t* header = xe_xex2_get_header(xex);
|
||||
|
||||
// Scan and find the low/high addresses.
|
||||
|
|
|
@ -13,16 +13,14 @@
|
|||
#include <string>
|
||||
|
||||
#include <alloy/runtime/module.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/kernel/util/xex2.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
||||
class XenonRuntime;
|
||||
|
||||
|
||||
class XexModule : public alloy::runtime::Module {
|
||||
public:
|
||||
XexModule(XenonRuntime* runtime);
|
||||
|
@ -52,9 +50,7 @@ private:
|
|||
uint64_t high_address_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_CPU_XEX_MODULE_H_
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include <string>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/debug_agent.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/memory.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_EXPORT_RESOLVER_H_
|
||||
#define XENIA_EXPORT_RESOLVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -10,19 +10,17 @@
|
|||
#ifndef XENIA_GPU_COMMAND_PROCESSOR_H_
|
||||
#define XENIA_GPU_COMMAND_PROCESSOR_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/draw_command.h>
|
||||
#include <xenia/gpu/register_file.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
class GraphicsDriver;
|
||||
class GraphicsSystem;
|
||||
|
||||
|
||||
class CommandProcessor {
|
||||
public:
|
||||
CommandProcessor(GraphicsSystem* graphics_system, Memory* memory);
|
||||
|
@ -77,9 +75,7 @@ private:
|
|||
DrawCommand draw_command_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_COMMAND_PROCESSOR_H_
|
||||
|
|
|
@ -10,19 +10,16 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_GEOMETRY_SHADER_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_GEOMETRY_SHADER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <alloy/string_buffer.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
||||
class D3D11VertexShaderResource;
|
||||
|
||||
|
||||
class D3D11GeometryShader {
|
||||
public:
|
||||
virtual ~D3D11GeometryShader();
|
||||
|
@ -77,10 +74,8 @@ protected:
|
|||
alloy::StringBuffer* output) override;
|
||||
};
|
||||
|
||||
|
||||
} // namespace d3d11
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_D3D11_D3D11_SHADER_H_
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_GPU_PRIVATE_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_GPU_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
|
|
|
@ -10,19 +10,17 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_GRAPHICS_DRIVER_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_GRAPHICS_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
#include <xenia/gpu/graphics_driver.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_resource_cache.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
||||
|
||||
class D3D11GraphicsDriver : public GraphicsDriver {
|
||||
public:
|
||||
D3D11GraphicsDriver(
|
||||
|
@ -89,10 +87,8 @@ private:
|
|||
} state_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace d3d11
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_D3D11_D3D11_GRAPHICS_DRIVER_H_
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_GRAPHICS_SYSTEM_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_GRAPHICS_SYSTEM_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/gpu/graphics_system.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
|
||||
#include <xenia/gpu/graphics_system.h>
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -10,17 +10,15 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_PROFILER_DISPLAY_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_PROFILER_DISPLAY_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
||||
class D3D11Window;
|
||||
|
||||
|
||||
class D3D11ProfilerDisplay : public ProfilerDisplay {
|
||||
public:
|
||||
D3D11ProfilerDisplay(D3D11Window* window);
|
||||
|
@ -75,11 +73,8 @@ private:
|
|||
} font_description_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace d3d11
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_D3D11_D3D11_PROFILER_DISPLAY_H_
|
||||
|
|
|
@ -10,23 +10,20 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_RESOURCE_CACHE_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_RESOURCE_CACHE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/gpu/resource_cache.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
||||
|
||||
class D3D11ResourceCache : public ResourceCache {
|
||||
public:
|
||||
D3D11ResourceCache(Memory* memory,
|
||||
ID3D11Device* device, ID3D11DeviceContext* context);
|
||||
virtual ~D3D11ResourceCache();
|
||||
|
||||
|
||||
ID3D11Device* device() const { return device_; }
|
||||
ID3D11DeviceContext* context() const { return context_; }
|
||||
|
||||
|
@ -54,10 +51,8 @@ private:
|
|||
ID3D11DeviceContext* context_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace d3d11
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_D3D11_D3D11_RESOURCE_CACHE_H_
|
||||
|
|
|
@ -10,17 +10,14 @@
|
|||
#ifndef XENIA_GPU_D3D11_D3D11_WINDOW_H_
|
||||
#define XENIA_GPU_D3D11_D3D11_WINDOW_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/d3d11/d3d11_gpu-private.h>
|
||||
#include <xenia/ui/win32/win32_window.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace d3d11 {
|
||||
|
||||
|
||||
class D3D11Window : public xe::ui::win32::Win32Window {
|
||||
public:
|
||||
D3D11Window(
|
||||
|
@ -48,10 +45,8 @@ private:
|
|||
ID3D11RenderTargetView* render_target_view_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace d3d11
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_D3D11_D3D11_WINDOW_H_
|
||||
|
|
|
@ -10,18 +10,16 @@
|
|||
#ifndef XENIA_GPU_DRAW_COMMAND_H_
|
||||
#define XENIA_GPU_DRAW_COMMAND_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/buffer_resource.h>
|
||||
#include <xenia/gpu/sampler_state_resource.h>
|
||||
#include <xenia/gpu/shader_resource.h>
|
||||
#include <xenia/gpu/texture_resource.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
|
||||
// TODO(benvanik): move more of the enums in here?
|
||||
struct DrawCommand {
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type;
|
||||
|
@ -70,9 +68,7 @@ struct DrawCommand {
|
|||
size_t pixel_shader_sampler_count;
|
||||
};
|
||||
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_DRAW_COMMAND_H_
|
||||
|
|
|
@ -10,17 +10,15 @@
|
|||
#ifndef XENIA_GPU_GRAPHICS_DRIVER_H_
|
||||
#define XENIA_GPU_GRAPHICS_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/draw_command.h>
|
||||
#include <xenia/gpu/register_file.h>
|
||||
#include <xenia/gpu/resource_cache.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
|
||||
class GraphicsDriver {
|
||||
public:
|
||||
virtual ~GraphicsDriver();
|
||||
|
@ -32,7 +30,7 @@ public:
|
|||
virtual int Initialize() = 0;
|
||||
|
||||
int LoadShader(xenos::XE_GPU_SHADER_TYPE type,
|
||||
uint32_t address, uint32_t length,
|
||||
uint32_t address, uint32_t length,
|
||||
uint32_t start);
|
||||
|
||||
int PrepareDraw(DrawCommand& command);
|
||||
|
@ -63,9 +61,7 @@ protected:
|
|||
PixelShaderResource* pixel_shader_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_GRAPHICS_DRIVER_H_
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
#ifndef XENIA_GPU_NOP_NOP_GPU_PRIVATE_H_
|
||||
#define XENIA_GPU_NOP_NOP_GPU_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/nop/nop_gpu.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace nop {
|
||||
|
@ -27,5 +25,4 @@ namespace nop {
|
|||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_NOP_NOP_PRIVATE_H_
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
|
|
|
@ -10,18 +10,15 @@
|
|||
#ifndef XENIA_GPU_NOP_NOP_GRAPHICS_DRIVER_H_
|
||||
#define XENIA_GPU_NOP_NOP_GRAPHICS_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/graphics_driver.h>
|
||||
#include <xenia/gpu/nop/nop_gpu-private.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace nop {
|
||||
|
||||
|
||||
class NopGraphicsDriver : public GraphicsDriver {
|
||||
public:
|
||||
NopGraphicsDriver(Memory* memory);
|
||||
|
@ -39,10 +36,8 @@ protected:
|
|||
ResourceCache* resource_cache_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace nop
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_NOP_NOP_GRAPHICS_DRIVER_H_
|
||||
|
|
|
@ -10,17 +10,14 @@
|
|||
#ifndef XENIA_GPU_NOP_NOP_GRAPHICS_SYSTEM_H_
|
||||
#define XENIA_GPU_NOP_NOP_GRAPHICS_SYSTEM_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/graphics_system.h>
|
||||
#include <xenia/gpu/nop/nop_gpu-private.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace nop {
|
||||
|
||||
|
||||
class NopGraphicsSystem : public GraphicsSystem {
|
||||
public:
|
||||
NopGraphicsSystem(Emulator* emulator);
|
||||
|
@ -39,10 +36,8 @@ private:
|
|||
HANDLE vsync_timer_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace nop
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_NOP_NOP_GRAPHICS_SYSTEM_H_
|
||||
|
|
|
@ -10,13 +10,11 @@
|
|||
#ifndef XENIA_GPU_REGISTER_FILE_H_
|
||||
#define XENIA_GPU_REGISTER_FILE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
|
||||
enum Register {
|
||||
#define XE_GPU_REGISTER(index, type, name) \
|
||||
XE_GPU_REG_##name = index,
|
||||
|
@ -24,7 +22,6 @@ enum Register {
|
|||
#undef XE_GPU_REGISTER
|
||||
};
|
||||
|
||||
|
||||
class RegisterFile {
|
||||
public:
|
||||
RegisterFile();
|
||||
|
@ -43,9 +40,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_REGISTER_FILE_H_
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
#ifndef XENIA_GPU_RESOURCE_H_
|
||||
#define XENIA_GPU_RESOURCE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
|
||||
struct MemoryRange {
|
||||
uint8_t* host_base;
|
||||
uint32_t guest_base;
|
||||
|
@ -96,9 +94,7 @@ protected:
|
|||
StaticResource();
|
||||
};
|
||||
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_RESOURCE_H_
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/buffer_resource.h>
|
||||
#include <xenia/gpu/resource.h>
|
||||
#include <xenia/gpu/sampler_state_resource.h>
|
||||
|
@ -21,11 +21,9 @@
|
|||
#include <xenia/gpu/texture_resource.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
||||
|
||||
class ResourceCache {
|
||||
public:
|
||||
virtual ~ResourceCache();
|
||||
|
@ -36,7 +34,7 @@ public:
|
|||
PixelShaderResource* FetchPixelShader(
|
||||
const MemoryRange& memory_range,
|
||||
const PixelShaderResource::Info& info);
|
||||
|
||||
|
||||
TextureResource* FetchTexture(
|
||||
const MemoryRange& memory_range,
|
||||
const TextureResource::Info& info);
|
||||
|
@ -92,7 +90,7 @@ protected:
|
|||
resources_.push_back(resource);
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
virtual VertexShaderResource* CreateVertexShader(
|
||||
const MemoryRange& memory_range,
|
||||
const VertexShaderResource::Info& info) = 0;
|
||||
|
@ -120,9 +118,7 @@ private:
|
|||
std::multimap<uint64_t, PagedResource*> paged_resources_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_RESOURCE_CACHE_H_
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
#ifndef XENIA_GPU_XENOS_PACKETS_H_
|
||||
#define XENIA_GPU_XENOS_PACKETS_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
namespace xenos {
|
||||
|
||||
|
||||
// Opcodes (IT_OPCODE) for Type-3 commands in the ringbuffer.
|
||||
// https://github.com/freedreno/amd-gpu/blob/master/include/api/gsl_pm4types.h
|
||||
// Not sure if all of these are used.
|
||||
|
@ -82,10 +80,8 @@ enum Type3Opcode {
|
|||
PM4_SET_BIN_SELECT_HI = 0x63,
|
||||
};
|
||||
|
||||
|
||||
} // namespace xenos
|
||||
} // namespace gpu
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_GPU_XENOS_PACKETS_H_
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_GPU_XENOS_UCODE_H_
|
||||
#define XENIA_GPU_XENOS_UCODE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#ifndef XENIA_GPU_XENOS_UCODE_DISASSEMBLER_H_
|
||||
#define XENIA_GPU_XENOS_UCODE_DISASSEMBLER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/xenos/ucode.h>
|
||||
#include <xenia/gpu/xenos/xenos.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_GPU_XENOS_XENOS_H_
|
||||
#define XENIA_GPU_XENOS_XENOS_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/gpu/xenos/ucode.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_INPUT_DRIVER_H_
|
||||
#define XENIA_HID_INPUT_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_NOP_NOP_HID_PRIVATE_H_
|
||||
#define XENIA_HID_NOP_NOP_HID_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/hid/nop/nop_hid.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_NOP_NOP_INPUT_DRIVER_H_
|
||||
#define XENIA_HID_NOP_NOP_INPUT_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/hid/input_driver.h>
|
||||
#include <xenia/hid/nop/nop_hid-private.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_WINKEY_WINKEY_HID_PRIVATE_H_
|
||||
#define XENIA_HID_WINKEY_WINKEY_HID_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/hid/winkey/winkey_hid.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_WINKEY_WINKEY_DRIVER_H_
|
||||
#define XENIA_HID_WINKEY_WINKEY_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/hid/input_driver.h>
|
||||
#include <xenia/hid/nop/nop_hid-private.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_XINPUT_XINPUT_HID_PRIVATE_H_
|
||||
#define XENIA_HID_XINPUT_XINPUT_HID_PRIVATE_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/hid/xinput/xinput_hid.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
|
||||
namespace xe {
|
||||
namespace hid {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef XENIA_HID_XINPUT_XINPUT_DRIVER_H_
|
||||
#define XENIA_HID_XINPUT_XINPUT_DRIVER_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/hid/input_driver.h>
|
||||
#include <xenia/hid/nop/nop_hid-private.h>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/memory.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#define XENIA_KERNEL_XBOXKRNL_APPS_APPS_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/kernel/app.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#define XENIA_KERNEL_XBOXKRNL_APPS_XMP_APP_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/kernel/app.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#include <mutex>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include <poly/mapped_memory.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <poly/mapped_memory.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define XENIA_KERNEL_FS_DEVICES_DISC_IMAGE_FILE_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/objects/xfile.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <string>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define XENIA_KERNEL_FS_DEVICES_HOST_PATH_ENTRY_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <string>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/objects/xfile.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#include <poly/mapped_memory.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <poly/mapped_memory.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#define XENIA_KERNEL_FS_DEVICES_STFS_CONTAINER_FILE_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/kernel/objects/xfile.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include <poly/mapped_memory.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include <poly/mapped_memory.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
|
|
|
@ -14,14 +14,13 @@
|
|||
#include <mutex>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/export_resolver.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/app.h>
|
||||
#include <xenia/kernel/fs/filesystem.h>
|
||||
#include <xenia/kernel/object_table.h>
|
||||
#include <xenia/kernel/user_profile.h>
|
||||
#include <xenia/kernel/fs/filesystem.h>
|
||||
#include <xenia/memory.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
class Emulator;
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
#define XENIA_KERNEL_XBOXKRNL_NATIVE_LIST_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/memory.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#include <mutex>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace kernel {
|
|||
using namespace xe::cpu;
|
||||
|
||||
XUserModule::XUserModule(KernelState* kernel_state, const char* path)
|
||||
: XModule(kernel_state, path), xex_(NULL) {}
|
||||
: XModule(kernel_state, path), xex_(nullptr) {}
|
||||
|
||||
XUserModule::~XUserModule() { xe_xex2_release(xex_); }
|
||||
XUserModule::~XUserModule() { xe_xex2_dealloc(xex_); }
|
||||
|
||||
xe_xex2_ref XUserModule::xex() { return xe_xex2_retain(xex_); }
|
||||
xe_xex2_ref XUserModule::xex() { return xex_; }
|
||||
|
||||
const xe_xex2_header_t* XUserModule::xex_header() {
|
||||
return xe_xex2_get_header(xex_);
|
||||
|
@ -50,33 +50,52 @@ X_STATUS XUserModule::LoadFromFile(const char* path) {
|
|||
if (fs_entry->can_map()) {
|
||||
// Map.
|
||||
auto mmap = fs_entry->CreateMemoryMapping(fs::Mode::READ, 0, 0);
|
||||
XEEXPECTNOTNULL(mmap);
|
||||
if (!mmap) {
|
||||
if (file) {
|
||||
file->Release();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Load the module.
|
||||
result = LoadFromMemory(mmap->address(), mmap->length());
|
||||
} else {
|
||||
XFileInfo file_info;
|
||||
result = fs_entry->QueryInfo(&file_info);
|
||||
XEEXPECTZERO(result);
|
||||
if (result) {
|
||||
if (file) {
|
||||
file->Release();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> buffer(file_info.file_length);
|
||||
|
||||
// Open file for reading.
|
||||
result = kernel_state()->file_system()->Open(
|
||||
std::move(fs_entry), kernel_state(), fs::Mode::READ, false, &file);
|
||||
XEEXPECTZERO(result);
|
||||
if (result) {
|
||||
if (file) {
|
||||
file->Release();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Read entire file into memory.
|
||||
// Ugh.
|
||||
size_t bytes_read = 0;
|
||||
result = file->Read(buffer.data(), buffer.size(), 0, &bytes_read);
|
||||
XEEXPECTZERO(result);
|
||||
if (result) {
|
||||
if (file) {
|
||||
file->Release();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Load the module.
|
||||
result = LoadFromMemory(buffer.data(), bytes_read);
|
||||
}
|
||||
|
||||
XECLEANUP:
|
||||
if (file) {
|
||||
file->Release();
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
#ifndef XENIA_KERNEL_UTIL_SHIM_UTILS_H_
|
||||
#define XENIA_KERNEL_UTIL_SHIM_UTILS_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <alloy/frontend/ppc/ppc_context.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
|
||||
|
||||
|
|
|
@ -23,11 +23,19 @@
|
|||
|
||||
// using namespace alloy;
|
||||
|
||||
// TODO(benvanik): remove.
|
||||
#define XEEXPECTZERO(expr) \
|
||||
if ((expr) != 0) { \
|
||||
goto XECLEANUP; \
|
||||
}
|
||||
#define XEEXPECTNOTNULL(expr) \
|
||||
if ((expr) == NULL) { \
|
||||
goto XECLEANUP; \
|
||||
}
|
||||
|
||||
DEFINE_bool(xex_dev_key, false, "Use the devkit key.");
|
||||
|
||||
typedef struct xe_xex2 {
|
||||
xe_ref_t ref;
|
||||
|
||||
xe::Memory *memory;
|
||||
|
||||
xe_xex2_header_t header;
|
||||
|
@ -52,7 +60,6 @@ int xe_xex2_find_import_infos(xe_xex2_ref xex,
|
|||
xe_xex2_ref xe_xex2_load(xe::Memory *memory, const void *addr,
|
||||
const size_t length, xe_xex2_options_t options) {
|
||||
xe_xex2_ref xex = (xe_xex2_ref)calloc(1, sizeof(xe_xex2));
|
||||
xe_ref_init((xe_ref)xex);
|
||||
|
||||
xex->memory = memory;
|
||||
xex->sections = new std::vector<PESection *>();
|
||||
|
@ -74,11 +81,15 @@ xe_xex2_ref xe_xex2_load(xe::Memory *memory, const void *addr,
|
|||
return xex;
|
||||
|
||||
XECLEANUP:
|
||||
xe_xex2_release(xex);
|
||||
return NULL;
|
||||
xe_xex2_dealloc(xex);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void xe_xex2_dealloc(xe_xex2_ref xex) {
|
||||
if (!xex) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (std::vector<PESection *>::iterator it = xex->sections->begin();
|
||||
it != xex->sections->end(); ++it) {
|
||||
delete *it;
|
||||
|
@ -98,15 +109,6 @@ void xe_xex2_dealloc(xe_xex2_ref xex) {
|
|||
xex->memory = NULL;
|
||||
}
|
||||
|
||||
xe_xex2_ref xe_xex2_retain(xe_xex2_ref xex) {
|
||||
xe_ref_retain((xe_ref)xex);
|
||||
return xex;
|
||||
}
|
||||
|
||||
void xe_xex2_release(xe_xex2_ref xex) {
|
||||
xe_ref_release((xe_ref)xex, (xe_ref_dealloc_t)xe_xex2_dealloc);
|
||||
}
|
||||
|
||||
const xe_xex2_header_t *xe_xex2_get_header(xe_xex2_ref xex) {
|
||||
return &xex->header;
|
||||
}
|
||||
|
@ -720,7 +722,7 @@ int xe_xex2_read_image_compressed(const xe_xex2_header_t *header,
|
|||
XELOGE("Unable to allocate XEX memory at %.8X-%.8X.", header->exe_address,
|
||||
uncompressed_size);
|
||||
result_code = 2;
|
||||
XEFAIL();
|
||||
goto XECLEANUP;
|
||||
}
|
||||
uint8_t *buffer = memory->Translate(header->exe_address);
|
||||
|
||||
|
|
|
@ -10,8 +10,9 @@
|
|||
#ifndef XENIA_KERNEL_UTIL_XEX2_H_
|
||||
#define XENIA_KERNEL_UTIL_XEX2_H_
|
||||
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/kernel/util/xex2_info.h>
|
||||
#include <xenia/memory.h>
|
||||
|
||||
typedef struct { int reserved; } xe_xex2_options_t;
|
||||
|
||||
|
@ -45,8 +46,7 @@ class PESection {
|
|||
|
||||
xe_xex2_ref xe_xex2_load(xe::Memory* memory, const void* addr,
|
||||
const size_t length, xe_xex2_options_t options);
|
||||
xe_xex2_ref xe_xex2_retain(xe_xex2_ref xex);
|
||||
void xe_xex2_release(xe_xex2_ref xex);
|
||||
void xe_xex2_dealloc(xe_xex2_ref xex);
|
||||
|
||||
const xe_xex2_header_t* xe_xex2_get_header(xe_xex2_ref xex);
|
||||
const PESection* xe_xex2_get_pe_section(xe_xex2_ref xex, const char* name);
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
*/
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -8,13 +8,12 @@
|
|||
*/
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/objects/xenumerator.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/util/xex2.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -8,13 +8,12 @@
|
|||
*/
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/emulator.h>
|
||||
#include <xenia/hid/hid.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
#define XENIA_KERNEL_XAM_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
#include <xenia/kernel/xam_ordinals.h>
|
||||
#include <xenia/kernel/objects/xkernel_module.h>
|
||||
#include <xenia/kernel/xam_ordinals.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
*/
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/objects/xevent.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -10,11 +10,10 @@
|
|||
#include <winsock2.h>
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
*/
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/xbox.h>
|
||||
#include <xenia/kernel/kernel_state.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/kernel/objects/xnotify_listener.h>
|
||||
#include <xenia/kernel/util/shim_utils.h>
|
||||
#include <xenia/kernel/xam_private.h>
|
||||
#include <xenia/xbox.h>
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define XENIA_KERNEL_XAM_ORDINALS_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
#include <xenia/export_resolver.h>
|
||||
|
||||
// Build an ordinal enum to make it easy to lookup ordinals.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue