early-access version 1456
This commit is contained in:
parent
0ea8f5d070
commit
b6510b3d37
@ -1,7 +1,7 @@
|
|||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1452.
|
This is the source code for early-access 1456.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
@ -399,6 +399,7 @@ add_library(core STATIC
|
|||||||
hle/service/hid/controllers/xpad.h
|
hle/service/hid/controllers/xpad.h
|
||||||
hle/service/lbl/lbl.cpp
|
hle/service/lbl/lbl.cpp
|
||||||
hle/service/lbl/lbl.h
|
hle/service/lbl/lbl.h
|
||||||
|
hle/service/ldn/errors.h
|
||||||
hle/service/ldn/ldn.cpp
|
hle/service/ldn/ldn.cpp
|
||||||
hle/service/ldn/ldn.h
|
hle/service/ldn/ldn.h
|
||||||
hle/service/ldr/ldr.cpp
|
hle/service/ldr/ldr.cpp
|
||||||
|
@ -1047,20 +1047,21 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
const u64 offset{rp.Pop<u64>()};
|
const u64 offset{rp.Pop<u64>()};
|
||||||
const std::vector<u8> data{ctx.ReadBuffer()};
|
const std::vector<u8> data{ctx.ReadBuffer()};
|
||||||
|
const std::size_t size{std::min(data.size(), backing.GetSize() - offset)};
|
||||||
|
|
||||||
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, data.size());
|
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
|
||||||
|
|
||||||
if (data.size() > backing.GetSize() - offset) {
|
if (offset > backing.GetSize()) {
|
||||||
LOG_ERROR(Service_AM,
|
LOG_ERROR(Service_AM,
|
||||||
"offset is out of bounds, backing_buffer_sz={}, data_size={}, offset={}",
|
"offset is out of bounds, backing_buffer_sz={}, data_size={}, offset={}",
|
||||||
backing.GetSize(), data.size(), offset);
|
backing.GetSize(), size, offset);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ERR_SIZE_OUT_OF_BOUNDS);
|
rb.Push(ERR_SIZE_OUT_OF_BOUNDS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::memcpy(backing.GetData().data() + offset, data.data(), data.size());
|
std::memcpy(backing.GetData().data() + offset, data.data(), size);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
@ -1070,11 +1071,11 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const u64 offset{rp.Pop<u64>()};
|
const u64 offset{rp.Pop<u64>()};
|
||||||
const std::size_t size{ctx.GetWriteBufferSize()};
|
const std::size_t size{std::min(ctx.GetWriteBufferSize(), backing.GetSize() - offset)};
|
||||||
|
|
||||||
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
|
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
|
||||||
|
|
||||||
if (size > backing.GetSize() - offset) {
|
if (offset > backing.GetSize()) {
|
||||||
LOG_ERROR(Service_AM, "offset is out of bounds, backing_buffer_sz={}, size={}, offset={}",
|
LOG_ERROR(Service_AM, "offset is out of bounds, backing_buffer_sz={}, size={}, offset={}",
|
||||||
backing.GetSize(), size, offset);
|
backing.GetSize(), size, offset);
|
||||||
|
|
||||||
|
13
src/core/hle/service/ldn/errors.h
Executable file
13
src/core/hle/service/ldn/errors.h
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2021 yuzu emulator team
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
|
namespace Service::LDN {
|
||||||
|
|
||||||
|
constexpr ResultCode ERROR_DISABLED{ErrorModule::LDN, 22};
|
||||||
|
|
||||||
|
} // namespace Service::LDN
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
#include "core/hle/service/ldn/errors.h"
|
||||||
#include "core/hle/service/ldn/ldn.h"
|
#include "core/hle/service/ldn/ldn.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
@ -140,10 +141,11 @@ public:
|
|||||||
|
|
||||||
void Initialize2(Kernel::HLERequestContext& ctx) {
|
void Initialize2(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_LDN, "(STUBBED) called");
|
LOG_WARNING(Service_LDN, "(STUBBED) called");
|
||||||
// Result success seem make this services start network and continue.
|
|
||||||
// If we just pass result error then it will stop and maybe try again and again.
|
// Return the disabled error to indicate that LDN is currently unavailable, otherwise games
|
||||||
|
// will continue to try to make a connection.
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_UNKNOWN);
|
rb.Push(ERROR_DISABLED);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ std::pair<std::span<u8>, size_t> StreamBuffer::Request(size_t size) noexcept {
|
|||||||
glClientWaitSync(fences[region].handle, 0, GL_TIMEOUT_IGNORED);
|
glClientWaitSync(fences[region].handle, 0, GL_TIMEOUT_IGNORED);
|
||||||
fences[region].Release();
|
fences[region].Release();
|
||||||
}
|
}
|
||||||
if (iterator + size > free_iterator) {
|
if (iterator + size >= free_iterator) {
|
||||||
free_iterator = iterator + size;
|
free_iterator = iterator + size;
|
||||||
}
|
}
|
||||||
if (iterator + size > STREAM_BUFFER_SIZE) {
|
if (iterator + size > STREAM_BUFFER_SIZE) {
|
||||||
|
@ -824,6 +824,7 @@ GLuint Image::StorageHandle() noexcept {
|
|||||||
return texture.handle;
|
return texture.handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset) {
|
void Image::CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset) {
|
||||||
// Compressed formats don't have a pixel format or type
|
// Compressed formats don't have a pixel format or type
|
||||||
const bool is_compressed = gl_format == GL_NONE;
|
const bool is_compressed = gl_format == GL_NONE;
|
||||||
|
@ -21,7 +21,12 @@ public:
|
|||||||
|
|
||||||
/// Returns the current logical tick.
|
/// Returns the current logical tick.
|
||||||
[[nodiscard]] u64 CurrentTick() const noexcept {
|
[[nodiscard]] u64 CurrentTick() const noexcept {
|
||||||
return current_tick;
|
return current_tick.load(std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the last known GPU tick.
|
||||||
|
[[nodiscard]] u64 KnownGpuTick() const noexcept {
|
||||||
|
return gpu_tick.load(std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the timeline semaphore handle.
|
/// Returns the timeline semaphore handle.
|
||||||
@ -31,7 +36,7 @@ public:
|
|||||||
|
|
||||||
/// Returns true when a tick has been hit by the GPU.
|
/// Returns true when a tick has been hit by the GPU.
|
||||||
[[nodiscard]] bool IsFree(u64 tick) {
|
[[nodiscard]] bool IsFree(u64 tick) {
|
||||||
return gpu_tick >= tick;
|
return gpu_tick.load(std::memory_order_relaxed) >= tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Advance to the logical tick.
|
/// Advance to the logical tick.
|
||||||
@ -41,7 +46,7 @@ public:
|
|||||||
|
|
||||||
/// Refresh the known GPU tick
|
/// Refresh the known GPU tick
|
||||||
void Refresh() {
|
void Refresh() {
|
||||||
gpu_tick = semaphore.GetCounter();
|
gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Waits for a tick to be hit on the GPU
|
/// Waits for a tick to be hit on the GPU
|
||||||
|
@ -153,7 +153,7 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
|||||||
used_iterator = iterator;
|
used_iterator = iterator;
|
||||||
free_iterator = std::max(free_iterator, iterator + size);
|
free_iterator = std::max(free_iterator, iterator + size);
|
||||||
|
|
||||||
if (iterator + size > STREAM_BUFFER_SIZE) {
|
if (iterator + size >= STREAM_BUFFER_SIZE) {
|
||||||
std::fill(sync_ticks.begin() + Region(used_iterator), sync_ticks.begin() + NUM_SYNCS,
|
std::fill(sync_ticks.begin() + Region(used_iterator), sync_ticks.begin() + NUM_SYNCS,
|
||||||
current_tick);
|
current_tick);
|
||||||
used_iterator = 0;
|
used_iterator = 0;
|
||||||
@ -175,8 +175,9 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool StagingBufferPool::AreRegionsActive(size_t region_begin, size_t region_end) const {
|
bool StagingBufferPool::AreRegionsActive(size_t region_begin, size_t region_end) const {
|
||||||
|
const u64 gpu_tick = scheduler.GetMasterSemaphore().KnownGpuTick();
|
||||||
return std::any_of(sync_ticks.begin() + region_begin, sync_ticks.begin() + region_end,
|
return std::any_of(sync_ticks.begin() + region_begin, sync_ticks.begin() + region_end,
|
||||||
[this](u64 sync_tick) { return !scheduler.IsFree(sync_tick); });
|
[gpu_tick](u64 sync_tick) { return gpu_tick < sync_tick; });
|
||||||
};
|
};
|
||||||
|
|
||||||
StagingBufferRef StagingBufferPool::GetStagingBuffer(size_t size, MemoryUsage usage) {
|
StagingBufferRef StagingBufferPool::GetStagingBuffer(size_t size, MemoryUsage usage) {
|
||||||
|
Loading…
Reference in New Issue
Block a user