Compare commits
9 Commits
47fa5f36c5
...
9dff007cd6
Author | SHA1 | Date |
---|---|---|
![]() |
9dff007cd6 | |
![]() |
7d8c8d3bf1 | |
![]() |
b694820c90 | |
![]() |
1ff3dc4d10 | |
![]() |
3e55d0048c | |
![]() |
1a4746f261 | |
![]() |
529d453986 | |
![]() |
93b5886e22 | |
![]() |
288900ff7e |
|
@ -1,6 +1,6 @@
|
|||
[submodule "third_party/xbyak"]
|
||||
path = third_party/xbyak
|
||||
url = https://github.com/xenia-project/xbyak.git
|
||||
url = https://github.com/herumi/xbyak.git
|
||||
[submodule "third_party/imgui"]
|
||||
path = third_party/imgui
|
||||
url = https://github.com/ocornut/imgui.git
|
||||
|
@ -30,7 +30,7 @@
|
|||
url = https://github.com/openluopworld/aes_128.git
|
||||
[submodule "third_party/capstone"]
|
||||
path = third_party/capstone
|
||||
url = https://github.com/xenia-project/capstone.git
|
||||
url = https://github.com/capstone-engine/capstone.git
|
||||
[submodule "third_party/cpptoml"]
|
||||
path = third_party/cpptoml
|
||||
url = https://github.com/skystrife/cpptoml.git
|
||||
|
|
|
@ -35,6 +35,20 @@ extern "C" {
|
|||
namespace xe {
|
||||
namespace apu {
|
||||
|
||||
static void dump_raw(AVFrame* frame, int id) {
|
||||
FILE* outfile = fopen(fmt::format("out{}.raw", id).c_str(), "ab");
|
||||
if (!outfile) {
|
||||
return;
|
||||
}
|
||||
size_t data_size = sizeof(float);
|
||||
for (int i = 0; i < frame->nb_samples; i++) {
|
||||
for (int ch = 0; ch < frame->channels; ch++) {
|
||||
fwrite(frame->data[ch] + data_size * i, 1, data_size, outfile);
|
||||
}
|
||||
}
|
||||
fclose(outfile);
|
||||
}
|
||||
|
||||
XmaContext::XmaContext() = default;
|
||||
|
||||
XmaContext::~XmaContext() {
|
||||
|
@ -47,9 +61,6 @@ XmaContext::~XmaContext() {
|
|||
if (av_frame_) {
|
||||
av_frame_free(&av_frame_);
|
||||
}
|
||||
// if (current_frame_) {
|
||||
// delete[] current_frame_;
|
||||
// }
|
||||
}
|
||||
|
||||
int XmaContext::Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) {
|
||||
|
@ -250,7 +261,7 @@ void XmaContext::Release() {
|
|||
}
|
||||
|
||||
int XmaContext::GetSampleRate(int id) {
|
||||
return kIdToSampleRate[id > 3 ? 3 : id];
|
||||
return kIdToSampleRate[std::min(id, 3)];
|
||||
}
|
||||
|
||||
void XmaContext::SwapInputBuffer(XMA_CONTEXT_DATA* data) {
|
||||
|
@ -264,20 +275,6 @@ void XmaContext::SwapInputBuffer(XMA_CONTEXT_DATA* data) {
|
|||
data->input_buffer_read_offset = kBitsPerPacketHeader;
|
||||
}
|
||||
|
||||
static void dump_raw(AVFrame* frame, int id) {
|
||||
FILE* outfile = fopen(fmt::format("out{}.raw", id).c_str(), "ab");
|
||||
if (!outfile) {
|
||||
return;
|
||||
}
|
||||
size_t data_size = sizeof(float);
|
||||
for (int i = 0; i < frame->nb_samples; i++) {
|
||||
for (int ch = 0; ch < frame->channels; ch++) {
|
||||
fwrite(frame->data[ch] + data_size * i, 1, data_size, outfile);
|
||||
}
|
||||
}
|
||||
fclose(outfile);
|
||||
}
|
||||
|
||||
void XmaContext::Consume(RingBuffer* output_rb, XMA_CONTEXT_DATA* data) {
|
||||
if (!current_frame_remaining_subframes_) {
|
||||
return;
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
} \
|
||||
template <typename TRet = void, typename... TArgs> \
|
||||
inline TRet invoke(TArgs... args) { \
|
||||
return reinterpret_cast<NTSYSAPI TRet(NTAPI*)(TArgs...)>(fn)(args...); \
|
||||
return reinterpret_cast<TRet(NTAPI*)(TArgs...)>(fn)(args...); \
|
||||
} \
|
||||
inline operator bool() const { return fn != nullptr; } \
|
||||
} clsvar
|
||||
|
|
|
@ -2940,7 +2940,7 @@ void DxbcShaderTranslator::CompletePixelShader() {
|
|||
SystemConstants::Index::kAlphaTestReference,
|
||||
offsetof(SystemConstants, alpha_test_reference), dxbc::Src::kXXXX));
|
||||
// Epsilon for alpha checks
|
||||
dxbc::Src fuzzy_epsilon = dxbc::Src::LF(0.01f);
|
||||
dxbc::Src fuzzy_epsilon = dxbc::Src::LF(1e-3f);
|
||||
// Handle "not equal" specially (specifically as "not equal" so it's true
|
||||
// for NaN, not "less or greater" which is false for NaN).
|
||||
a_.OpIEq(alpha_test_op_dest, alpha_test_mask_src,
|
||||
|
|
|
@ -40,7 +40,6 @@ SDLInputDriver::SDLInputDriver(xe::ui::Window* window, size_t window_z_order)
|
|||
sdl_events_unflushed_(0),
|
||||
sdl_pumpevents_queued_(false),
|
||||
controllers_(),
|
||||
controllers_mutex_(),
|
||||
keystroke_states_() {}
|
||||
|
||||
SDLInputDriver::~SDLInputDriver() {
|
||||
|
@ -151,8 +150,6 @@ X_RESULT SDLInputDriver::GetCapabilities(uint32_t user_index, uint32_t flags,
|
|||
|
||||
QueueControllerUpdate();
|
||||
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
auto controller = GetControllerState(user_index);
|
||||
if (!controller) {
|
||||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
|
@ -180,8 +177,6 @@ X_RESULT SDLInputDriver::GetState(uint32_t user_index,
|
|||
QueueControllerUpdate();
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
auto controller = GetControllerState(user_index);
|
||||
if (!controller) {
|
||||
return X_ERROR_DEVICE_NOT_CONNECTED;
|
||||
|
@ -295,8 +290,6 @@ X_RESULT SDLInputDriver::GetKeystroke(uint32_t users, uint32_t flags,
|
|||
QueueControllerUpdate();
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
for (uint32_t user_index = (user_any ? 0 : users);
|
||||
user_index < (user_any ? HID_SDL_USER_COUNT : users + 1); user_index++) {
|
||||
auto controller = GetControllerState(user_index);
|
||||
|
@ -420,8 +413,6 @@ void SDLInputDriver::HandleEvent(const SDL_Event& event) {
|
|||
}
|
||||
|
||||
void SDLInputDriver::OnControllerDeviceAdded(const SDL_Event& event) {
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
// Open the controller.
|
||||
const auto controller = SDL_GameControllerOpen(event.cdevice.which);
|
||||
if (!controller) {
|
||||
|
@ -485,8 +476,6 @@ void SDLInputDriver::OnControllerDeviceAdded(const SDL_Event& event) {
|
|||
}
|
||||
|
||||
void SDLInputDriver::OnControllerDeviceRemoved(const SDL_Event& event) {
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
// Find the disconnected gamecontroller and close it.
|
||||
auto idx = GetControllerIndexFromInstanceID(event.cdevice.which);
|
||||
if (idx) {
|
||||
|
@ -501,8 +490,6 @@ void SDLInputDriver::OnControllerDeviceRemoved(const SDL_Event& event) {
|
|||
}
|
||||
|
||||
void SDLInputDriver::OnControllerDeviceAxisMotion(const SDL_Event& event) {
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
auto idx = GetControllerIndexFromInstanceID(event.caxis.which);
|
||||
assert(idx);
|
||||
auto& pad = controllers_.at(*idx).state.gamepad;
|
||||
|
@ -533,8 +520,6 @@ void SDLInputDriver::OnControllerDeviceAxisMotion(const SDL_Event& event) {
|
|||
}
|
||||
|
||||
void SDLInputDriver::OnControllerDeviceButtonChanged(const SDL_Event& event) {
|
||||
std::unique_lock<std::mutex> guard(controllers_mutex_);
|
||||
|
||||
// Define a lookup table to map between SDL and XInput button codes.
|
||||
// These need to be in the order of the SDL_GameControllerButton enum.
|
||||
static constexpr std::array<
|
||||
|
|
|
@ -84,7 +84,6 @@ class SDLInputDriver final : public InputDriver {
|
|||
int sdl_events_unflushed_;
|
||||
std::atomic<bool> sdl_pumpevents_queued_;
|
||||
std::array<ControllerState, HID_SDL_USER_COUNT> controllers_;
|
||||
std::mutex controllers_mutex_;
|
||||
std::array<KeystrokeState, HID_SDL_USER_COUNT> keystroke_states_;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@ DEFINE_uint32(max_signed_profiles, 4,
|
|||
"Limits how many profiles can be assigned. Possible values: 1-4",
|
||||
"Kernel");
|
||||
|
||||
DEFINE_uint32(kernel_build_version, 1888, "Define current kernel version",
|
||||
"Kernel");
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
|
||||
|
@ -66,6 +69,7 @@ KernelState::KernelState(Emulator* emulator)
|
|||
user_profiles_.emplace(0, std::make_unique<xam::UserProfile>(0));
|
||||
|
||||
InitializeKernelGuestGlobals();
|
||||
kernel_version_ = KernelVersion(cvars::kernel_build_version);
|
||||
|
||||
auto content_root = emulator_->content_root();
|
||||
if (!content_root.empty()) {
|
||||
|
|
|
@ -48,6 +48,8 @@ namespace kernel {
|
|||
|
||||
constexpr fourcc_t kKernelSaveSignature = make_fourcc("KRNL");
|
||||
|
||||
static constexpr const uint16_t kBaseKernelBuildVersion = 1888;
|
||||
|
||||
// (?), used by KeGetCurrentProcessType
|
||||
constexpr uint32_t X_PROCTYPE_IDLE = 0;
|
||||
constexpr uint32_t X_PROCTYPE_TITLE = 1;
|
||||
|
@ -145,6 +147,27 @@ struct KernelGuestGlobals {
|
|||
struct DPCImpersonationScope {
|
||||
uint8_t previous_irql_;
|
||||
};
|
||||
|
||||
struct KernelVersion {
|
||||
union {
|
||||
xe::be<uint64_t> value;
|
||||
|
||||
struct {
|
||||
xe::be<uint16_t> major;
|
||||
xe::be<uint16_t> minor;
|
||||
xe::be<uint16_t> build;
|
||||
xe::be<uint16_t> qfe;
|
||||
};
|
||||
};
|
||||
|
||||
KernelVersion(uint16_t build_ver = kBaseKernelBuildVersion) {
|
||||
major = 2;
|
||||
minor = 0;
|
||||
build = std::max(kBaseKernelBuildVersion, build_ver);
|
||||
qfe = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class KernelState {
|
||||
public:
|
||||
explicit KernelState(Emulator* emulator);
|
||||
|
@ -200,6 +223,8 @@ class KernelState {
|
|||
// Access must be guarded by the global critical region.
|
||||
util::ObjectTable* object_table() { return &object_table_; }
|
||||
|
||||
const KernelVersion* GetKernelVersion() const { return &kernel_version_; }
|
||||
|
||||
uint32_t GetSystemProcess() const {
|
||||
return kernel_guest_globals_ + offsetof(KernelGuestGlobals, system_process);
|
||||
}
|
||||
|
@ -332,6 +357,8 @@ class KernelState {
|
|||
std::map<uint8_t, std::unique_ptr<xam::UserProfile>> user_profiles_;
|
||||
std::unique_ptr<AchievementManager> achievement_manager_;
|
||||
|
||||
KernelVersion kernel_version_;
|
||||
|
||||
xe::global_critical_region global_critical_region_;
|
||||
|
||||
// Must be guarded by the global critical region.
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
#include "xenia/kernel/xbdm/xbdm_private.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
// chrispy: no idea what a real valid value is for this
|
||||
static constexpr const char DmXboxName[] = "Xbox360Name";
|
||||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace xbdm {
|
||||
|
@ -142,8 +144,8 @@ dword_result_t DmGetSystemInfo_entry(pointer_t<XBDM_SYSTEM_INFO> info) {
|
|||
info->base_kernel_version.minor = info->kernel_version.minor = 0;
|
||||
info->base_kernel_version.qfe = info->kernel_version.qfe = 0;
|
||||
|
||||
info->base_kernel_version.build = 1888;
|
||||
info->kernel_version.build = 13139;
|
||||
info->base_kernel_version.build = kBaseKernelBuildVersion;
|
||||
info->kernel_version.build = kernel_state()->GetKernelVersion()->build;
|
||||
|
||||
return XBDM_SUCCESSFUL;
|
||||
}
|
||||
|
|
|
@ -205,15 +205,12 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
|
|||
// XboxKrnlVersion (8b)
|
||||
// Kernel version, looks like 2b.2b.2b.2b.
|
||||
// I've only seen games check >=, so we just fake something here.
|
||||
uint32_t pXboxKrnlVersion = memory_->SystemHeapAlloc(8);
|
||||
uint32_t pXboxKrnlVersion = memory_->SystemHeapAlloc(sizeof(KernelVersion));
|
||||
auto lpXboxKrnlVersion = memory_->TranslateVirtual(pXboxKrnlVersion);
|
||||
export_resolver_->SetVariableMapping(
|
||||
"xboxkrnl.exe", ordinals::XboxKrnlVersion, pXboxKrnlVersion);
|
||||
xe::store_and_swap<uint16_t>(lpXboxKrnlVersion + 0, 2);
|
||||
xe::store_and_swap<uint16_t>(lpXboxKrnlVersion + 2, 0xFFFF);
|
||||
xe::store_and_swap<uint16_t>(lpXboxKrnlVersion + 4, 0xFFFF);
|
||||
xe::store_and_swap<uint8_t>(lpXboxKrnlVersion + 6, 0x80);
|
||||
xe::store_and_swap<uint8_t>(lpXboxKrnlVersion + 7, 0x00);
|
||||
std::memcpy(lpXboxKrnlVersion, kernel_state_->GetKernelVersion(),
|
||||
sizeof(KernelVersion));
|
||||
|
||||
export_resolver_->SetVariableMapping("xboxkrnl.exe",
|
||||
ordinals::KeTimeStampBundle,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6b6f40200bea5ed99367513f53f6a28e52fd3d0e
|
||||
Subproject commit 69e54e29086b7035acffb304cec57a350225f8b0
|
|
@ -1 +1 @@
|
|||
Subproject commit dd534e877e725c9bb6f751c427442456a05384e4
|
||||
Subproject commit 44d72a9b36702f093dd20815561a56778b2d181e
|
|
@ -1 +1 @@
|
|||
Subproject commit b32da5329b50e3cb96229aaecba9ded032fe29cc
|
||||
Subproject commit 46dc0f6e514f5730784bb2cac2a7c731636839e8
|
|
@ -1 +1 @@
|
|||
Subproject commit 51c8b56011303e94840370089f816b19dbe7edf0
|
||||
Subproject commit 19b940e864bd3a5afb3c79e3c6788869d01a19eb
|
|
@ -1 +1 @@
|
|||
Subproject commit f9c6a90489be7b3637ff1c7298e45efafe7cf1b9
|
||||
Subproject commit 097c04d9413c59a58b00d4d1c8d5dc0ac158ffaa
|
|
@ -39,6 +39,8 @@ project("capstone")
|
|||
"capstone/SStream.h",
|
||||
"capstone/utils.c",
|
||||
"capstone/utils.h",
|
||||
"capstone/Mapping.c",
|
||||
"capstone/Mapping.h",
|
||||
|
||||
"capstone/arch/X86/*.c",
|
||||
"capstone/arch/X86/*.h",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b2b8cf2f50a449720874f43445e23d75b77dcc43
|
||||
Subproject commit 3bf268481da8208d171d8908e6491459de3651d7
|
|
@ -1 +1 @@
|
|||
Subproject commit 27e3c0fe9b5dc99f339637ec2ea7efae5b945ab8
|
||||
Subproject commit 7bdf0628b1276379886c7f6dda2cef2b3b374f0b
|
|
@ -1 +1 @@
|
|||
Subproject commit bc70e7e11ad37f207ece73330c5b72a55fef1ceb
|
||||
Subproject commit 63e6ee92cc906a3dbf6b333b2fd51ac1ca95f891
|
|
@ -1 +1 @@
|
|||
Subproject commit 4c881f796d6af27ef7d9c48f87817da0d3d75dc1
|
||||
Subproject commit bbb27a5efb85b92a0486cf361a8635715a53f6ba
|
Loading…
Reference in New Issue