summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/disk_archive.cpp6
-rw-r--r--src/core/hle/kernel/memory.cpp5
-rw-r--r--src/core/hle/kernel/process.cpp2
-rw-r--r--src/core/hle/result.h8
-rw-r--r--src/core/hle/service/cfg/cfg.cpp26
-rw-r--r--src/core/hle/service/dsp_dsp.cpp135
-rw-r--r--src/core/hle/service/dsp_dsp.h12
-rw-r--r--src/core/hle/service/gsp_gpu.cpp6
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/ir/ir.cpp72
-rw-r--r--src/core/hle/service/ir/ir.h47
-rw-r--r--src/core/hle/service/ir/ir_user.cpp41
-rw-r--r--src/core/hle/service/ptm/ptm.cpp4
-rw-r--r--src/core/hle/service/soc_u.cpp12
-rw-r--r--src/core/hle/svc.cpp1
-rw-r--r--src/core/hw/gpu.cpp22
-rw-r--r--src/core/system.cpp7
17 files changed, 291 insertions, 117 deletions
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 0ba502200..a51416774 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -139,7 +139,7 @@ bool DiskFile::Close() const {
////////////////////////////////////////////////////////////////////////////////////////////////////
-DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) {
+DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) : directory() {
// TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
// the root directory we set while opening the archive.
// For example, opening /../../usr/bin can give the emulated program your installed programs.
@@ -149,7 +149,9 @@ DiskDirectory::DiskDirectory(const DiskArchive& archive, const Path& path) {
bool DiskDirectory::Open() {
if (!FileUtil::IsDirectory(path))
return false;
- FileUtil::ScanDirectoryTree(path, directory);
+ unsigned size = FileUtil::ScanDirectoryTree(path, directory);
+ directory.size = size;
+ directory.isDirectory = true;
children_iterator = directory.children.begin();
return true;
}
diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp
index 0cfb43fc7..862643448 100644
--- a/src/core/hle/kernel/memory.cpp
+++ b/src/core/hle/kernel/memory.cpp
@@ -7,6 +7,8 @@
#include <utility>
#include <vector>
+#include "audio_core/audio_core.h"
+
#include "common/common_types.h"
#include "common/logging/log.h"
@@ -107,7 +109,6 @@ struct MemoryArea {
static MemoryArea memory_areas[] = {
{SHARED_MEMORY_VADDR, SHARED_MEMORY_SIZE, "Shared Memory"}, // Shared memory
{VRAM_VADDR, VRAM_SIZE, "VRAM"}, // Video memory (VRAM)
- {DSP_RAM_VADDR, DSP_RAM_SIZE, "DSP RAM"}, // DSP memory
{TLS_AREA_VADDR, TLS_AREA_SIZE, "TLS Area"}, // TLS memory
};
@@ -133,6 +134,8 @@ void InitLegacyAddressSpace(Kernel::VMManager& address_space) {
auto shared_page_vma = address_space.MapBackingMemory(SHARED_PAGE_VADDR,
(u8*)&SharedPage::shared_page, SHARED_PAGE_SIZE, MemoryState::Shared).MoveFrom();
address_space.Reprotect(shared_page_vma, VMAPermission::Read);
+
+ AudioCore::AddAddressSpace(address_space);
}
} // namespace
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp
index d148efde2..16eb972fb 100644
--- a/src/core/hle/kernel/process.cpp
+++ b/src/core/hle/kernel/process.cpp
@@ -35,7 +35,7 @@ SharedPtr<Process> Process::Create(SharedPtr<CodeSet> code_set) {
process->codeset = std::move(code_set);
process->flags.raw = 0;
- process->flags.memory_region = MemoryRegion::APPLICATION;
+ process->flags.memory_region.Assign(MemoryRegion::APPLICATION);
Memory::InitLegacyAddressSpace(process->vm_manager);
return process;
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index ea3abb5f6..0fce5988b 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -193,10 +193,10 @@ union ResultCode {
explicit ResultCode(u32 raw) : raw(raw) {}
ResultCode(ErrorDescription description_, ErrorModule module_,
ErrorSummary summary_, ErrorLevel level_) : raw(0) {
- description = description_;
- module = module_;
- summary = summary_;
- level = level_;
+ description.Assign(description_);
+ module.Assign(module_);
+ summary.Assign(summary_);
+ level.Assign(level_);
}
ResultCode& operator=(const ResultCode& o) { raw = o.raw; return *this; }
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 633fe19eb..4c82a58e4 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -4,9 +4,10 @@
#include <algorithm>
+#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
-#include "common/file_util.h"
+#include "common/swap.h"
#include "core/file_sys/archive_systemsavedata.h"
#include "core/file_sys/file_backend.h"
@@ -293,8 +294,8 @@ ResultCode DeleteConfigNANDSaveFile() {
ResultCode UpdateConfigNANDSavegame() {
FileSys::Mode mode = {};
- mode.write_flag = 1;
- mode.create_flag = 1;
+ mode.write_flag.Assign(1);
+ mode.create_flag.Assign(1);
FileSys::Path path("config");
@@ -334,6 +335,18 @@ ResultCode FormatConfig() {
res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK);
if (!res.IsSuccess()) return res;
+ // 0x000A0000 - Profile username
+ struct {
+ u16_le username[10];
+ u8 unused[4];
+ u32_le wordfilter_version; // Unused by Citra
+ } profile_username = {};
+
+ std::u16string username_string = Common::UTF8ToUTF16("Citra");
+ std::copy(username_string.cbegin(), username_string.cend(), profile_username.username);
+ res = CreateConfigInfoBlk(0x000A0000, sizeof(profile_username), 0xE, &profile_username);
+ if (!res.IsSuccess()) return res;
+
// 0x000A0001 - Profile birthday
const u8 profile_birthday[2] = {3, 25}; // March 25th, 2014
res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday);
@@ -344,9 +357,10 @@ ResultCode FormatConfig() {
res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO);
if (!res.IsSuccess()) return res;
- char16_t country_name_buffer[16][0x40] = {};
+ u16_le country_name_buffer[16][0x40] = {};
+ std::u16string region_name = Common::UTF8ToUTF16("Gensokyo");
for (size_t i = 0; i < 16; ++i) {
- Common::UTF8ToUTF16("Gensokyo").copy(country_name_buffer[i], 0x40);
+ std::copy(region_name.cbegin(), region_name.cend(), country_name_buffer[i]);
}
// 0x000B0001 - Localized names for the profile Country
res = CreateConfigInfoBlk(0x000B0001, sizeof(country_name_buffer), 0xE, country_name_buffer);
@@ -405,7 +419,7 @@ void Init() {
FileSys::Path config_path("config");
FileSys::Mode open_mode = {};
- open_mode.read_flag = 1;
+ open_mode.read_flag.Assign(1);
auto config_result = Service::FS::OpenFileFromArchive(*archive_result, config_path, open_mode);
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index f9f931f6d..15d3274ec 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "audio_core/hle/pipe.h"
+
#include "common/logging/log.h"
#include "core/hle/kernel/event.h"
@@ -14,17 +16,30 @@ namespace DSP_DSP {
static u32 read_pipe_count;
static Kernel::SharedPtr<Kernel::Event> semaphore_event;
-static Kernel::SharedPtr<Kernel::Event> interrupt_event;
-void SignalInterrupt() {
- // TODO(bunnei): This is just a stub, it does not do anything other than signal to the emulated
- // application that a DSP interrupt occurred, without specifying which one. Since we do not
- // emulate the DSP yet (and how it works is largely unknown), this is a work around to get games
- // that check the DSP interrupt signal event to run. We should figure out the different types of
- // DSP interrupts, and trigger them at the appropriate times.
+struct PairHash {
+ template <typename T, typename U>
+ std::size_t operator()(const std::pair<T, U> &x) const {
+ // TODO(yuriks): Replace with better hash combining function.
+ return std::hash<T>()(x.first) ^ std::hash<U>()(x.second);
+ }
+};
+
+/// Map of (audio interrupt number, channel number) to Kernel::Events. See: RegisterInterruptEvents
+static std::unordered_map<std::pair<u32, u32>, Kernel::SharedPtr<Kernel::Event>, PairHash> interrupt_events;
+
+// DSP Interrupts:
+// Interrupt #2 occurs every frame tick. Userland programs normally have a thread that's waiting
+// for an interrupt event. Immediately after this interrupt event, userland normally updates the
+// state in the next region and increments the relevant frame counter by two.
+void SignalAllInterrupts() {
+ // HACK: The other interrupts have currently unknown purpose, we trigger them each tick in any case.
+ for (auto& interrupt_event : interrupt_events)
+ interrupt_event.second->Signal();
+}
- if (interrupt_event != 0)
- interrupt_event->Signal();
+void SignalInterrupt(u32 interrupt, u32 channel) {
+ interrupt_events[std::make_pair(interrupt, channel)]->Signal();
}
/**
@@ -43,7 +58,7 @@ static void ConvertProcessAddressFromDspDram(Service::Interface* self) {
cmd_buff[1] = 0; // No error
cmd_buff[2] = (addr << 1) + (Memory::DSP_RAM_VADDR + 0x40000);
- LOG_WARNING(Service_DSP, "(STUBBED) called with address 0x%08X", addr);
+ LOG_TRACE(Service_DSP, "addr=0x%08X", addr);
}
/**
@@ -121,8 +136,8 @@ static void FlushDataCache(Service::Interface* self) {
/**
* DSP_DSP::RegisterInterruptEvents service function
* Inputs:
- * 1 : Parameter 0 (purpose unknown)
- * 2 : Parameter 1 (purpose unknown)
+ * 1 : Interrupt Number
+ * 2 : Channel Number
* 4 : Interrupt event handle
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
@@ -130,22 +145,24 @@ static void FlushDataCache(Service::Interface* self) {
static void RegisterInterruptEvents(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 param0 = cmd_buff[1];
- u32 param1 = cmd_buff[2];
+ u32 interrupt = cmd_buff[1];
+ u32 channel = cmd_buff[2];
u32 event_handle = cmd_buff[4];
- auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
- if (evt != nullptr) {
- interrupt_event = evt;
- cmd_buff[1] = 0; // No error
+ if (event_handle) {
+ auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
+ if (evt) {
+ interrupt_events[std::make_pair(interrupt, channel)] = evt;
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ LOG_WARNING(Service_DSP, "Registered interrupt=%u, channel=%u, event_handle=0x%08X", interrupt, channel, event_handle);
+ } else {
+ cmd_buff[1] = -1;
+ LOG_ERROR(Service_DSP, "Invalid event handle! interrupt=%u, channel=%u, event_handle=0x%08X", interrupt, channel, event_handle);
+ }
} else {
- LOG_ERROR(Service_DSP, "called with invalid handle=%08X", cmd_buff[4]);
-
- // TODO(yuriks): An error should be returned from SendSyncRequest, not in the cmdbuf
- cmd_buff[1] = -1;
+ interrupt_events.erase(std::make_pair(interrupt, channel));
+ LOG_WARNING(Service_DSP, "Unregistered interrupt=%u, channel=%u, event_handle=0x%08X", interrupt, channel, event_handle);
}
-
- LOG_WARNING(Service_DSP, "(STUBBED) called param0=%u, param1=%u, event_handle=0x%08X", param0, param1, event_handle);
}
/**
@@ -158,8 +175,6 @@ static void RegisterInterruptEvents(Service::Interface* self) {
static void SetSemaphore(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
- SignalInterrupt();
-
cmd_buff[1] = 0; // No error
LOG_WARNING(Service_DSP, "(STUBBED) called");
@@ -168,9 +183,9 @@ static void SetSemaphore(Service::Interface* self) {
/**
* DSP_DSP::WriteProcessPipe service function
* Inputs:
- * 1 : Number
+ * 1 : Channel
* 2 : Size
- * 3 : (size <<14) | 0x402
+ * 3 : (size << 14) | 0x402
* 4 : Buffer
* Outputs:
* 0 : Return header
@@ -179,21 +194,42 @@ static void SetSemaphore(Service::Interface* self) {
static void WriteProcessPipe(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 number = cmd_buff[1];
+ u32 channel = cmd_buff[1];
u32 size = cmd_buff[2];
- u32 new_size = cmd_buff[3];
u32 buffer = cmd_buff[4];
+ if (IPC::StaticBufferDesc(size, 1) != cmd_buff[3]) {
+ LOG_ERROR(Service_DSP, "IPC static buffer descriptor failed validation (0x%X). channel=%u, size=0x%X, buffer=0x%08X", cmd_buff[3], channel, size, buffer);
+ cmd_buff[1] = -1; // TODO
+ return;
+ }
+
+ if (!Memory::GetPointer(buffer)) {
+ LOG_ERROR(Service_DSP, "Invalid Buffer: channel=%u, size=0x%X, buffer=0x%08X", channel, size, buffer);
+ cmd_buff[1] = -1; // TODO
+ return;
+ }
+
+ std::vector<u8> message(size);
+
+ for (size_t i = 0; i < size; i++) {
+ message[i] = Memory::Read8(buffer + i);
+ }
+
+ DSP::HLE::PipeWrite(channel, message);
+
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
- LOG_WARNING(Service_DSP, "(STUBBED) called number=%u, size=0x%X, new_size=0x%X, buffer=0x%08X",
- number, size, new_size, buffer);
+ LOG_TRACE(Service_DSP, "channel=%u, size=0x%X, buffer=0x%08X", channel, size, buffer);
}
/**
* DSP_DSP::ReadPipeIfPossible service function
+ * A pipe is a means of communication between the ARM11 and DSP that occurs on
+ * hardware by writing to/reading from the DSP registers at 0x10203000.
+ * Pipes are used for initialisation. See also DSP::HLE::PipeRead.
* Inputs:
- * 1 : Unknown
+ * 1 : Pipe Number
* 2 : Unknown
* 3 : Size in bytes of read (observed only lower half word used)
* 0x41 : Virtual address to read from DSP pipe to in memory
@@ -204,35 +240,25 @@ static void WriteProcessPipe(Service::Interface* self) {
static void ReadPipeIfPossible(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
- u32 unk1 = cmd_buff[1];
+ u32 pipe = cmd_buff[1];
u32 unk2 = cmd_buff[2];
u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size
VAddr addr = cmd_buff[0x41];
- // Canned DSP responses that games expect. These were taken from HW by 3dmoo team.
- // TODO: Remove this hack :)
- static const std::array<u16, 16> canned_read_pipe = {{
- 0x000F, 0xBFFF, 0x9E8E, 0x8680, 0xA78E, 0x9430, 0x8400, 0x8540,
- 0x948E, 0x8710, 0x8410, 0xA90E, 0xAA0E, 0xAACE, 0xAC4E, 0xAC58
- }};
+ if (!Memory::GetPointer(addr)) {
+ LOG_ERROR(Service_DSP, "Invalid addr: pipe=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X", pipe, unk2, size, addr);
+ cmd_buff[1] = -1; // TODO
+ return;
+ }
- u32 initial_size = read_pipe_count;
+ std::vector<u8> response = DSP::HLE::PipeRead(pipe, size);
- for (unsigned offset = 0; offset < size; offset += sizeof(u16)) {
- if (read_pipe_count < canned_read_pipe.size()) {
- Memory::Write16(addr + offset, canned_read_pipe[read_pipe_count]);
- read_pipe_count++;
- } else {
- LOG_ERROR(Service_DSP, "canned read pipe log exceeded!");
- break;
- }
- }
+ Memory::WriteBlock(addr, response.data(), response.size());
cmd_buff[1] = 0; // No error
- cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16);
+ cmd_buff[2] = (u32)response.size();
- LOG_WARNING(Service_DSP, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X",
- unk1, unk2, size, addr);
+ LOG_TRACE(Service_DSP, "pipe=0x%08X, unk2=0x%08X, size=0x%X, buffer=0x%08X", pipe, unk2, size, addr);
}
/**
@@ -311,7 +337,6 @@ const Interface::FunctionInfo FunctionTable[] = {
Interface::Interface() {
semaphore_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "DSP_DSP::semaphore_event");
- interrupt_event = nullptr;
read_pipe_count = 0;
Register(FunctionTable);
@@ -319,7 +344,7 @@ Interface::Interface() {
Interface::~Interface() {
semaphore_event = nullptr;
- interrupt_event = nullptr;
+ interrupt_events.clear();
}
} // namespace
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h
index b6f611db5..32b89e9bb 100644
--- a/src/core/hle/service/dsp_dsp.h
+++ b/src/core/hle/service/dsp_dsp.h
@@ -23,7 +23,15 @@ public:
}
};
-/// Signals that a DSP interrupt has occurred to userland code
-void SignalInterrupt();
+/// Signal all audio related interrupts.
+void SignalAllInterrupts();
+
+/**
+ * Signal a specific audio related interrupt based on interrupt id and channel id.
+ * @param interrupt_id The interrupt id
+ * @param channel_id The channel id
+ * The significance of various values of interrupt_id and channel_id is not yet known.
+ */
+void SignalInterrupt(u32 interrupt_id, u32 channel_id);
} // namespace
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 98b11c798..5838b6d71 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -347,7 +347,7 @@ void SignalInterrupt(InterruptId interrupt_id) {
FrameBufferUpdate* info = GetFrameBufferInfo(thread_id, screen_id);
if (info->is_dirty) {
SetBufferSwap(screen_id, info->framebuffer_info[info->index]);
- info->is_dirty = false;
+ info->is_dirty.Assign(false);
}
}
}
@@ -499,7 +499,7 @@ static void SetLcdForceBlack(Service::Interface* self) {
// Since data is already zeroed, there is no need to explicitly set
// the color to black (all zero).
- data.is_enabled = enable_black;
+ data.is_enabled.Assign(enable_black);
LCD::Write(HW::VADDR_LCD + 4 * LCD_REG_INDEX(color_fill_top), data.raw); // Top LCD
LCD::Write(HW::VADDR_LCD + 4 * LCD_REG_INDEX(color_fill_bottom), data.raw); // Bottom LCD
@@ -521,7 +521,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) {
ExecuteCommand(command_buffer->commands[i], thread_id);
// Indicates that command has completed
- command_buffer->number_commands = command_buffer->number_commands - 1;
+ command_buffer->number_commands.Assign(command_buffer->number_commands - 1);
}
}
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 0bed0ce36..11d7e69a1 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -105,7 +105,7 @@ void Update() {
bool pressed = false;
std::tie(touch_entry->x, touch_entry->y, pressed) = VideoCore::g_emu_window->GetTouchState();
- touch_entry->valid = pressed ? 1 : 0;
+ touch_entry->valid.Assign(pressed ? 1 : 0);
// TODO(bunnei): We're not doing anything with offset 0xA8 + 0x18 of HID SharedMemory, which
// supposedly is "Touch-screen entry, which contains the raw coordinate data prior to being
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp
index 0f8eed33a..c2121cb2e 100644
--- a/src/core/hle/service/ir/ir.cpp
+++ b/src/core/hle/service/ir/ir.cpp
@@ -2,20 +2,22 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "core/hle/kernel/event.h"
+#include "core/hle/kernel/shared_memory.h"
+
#include "core/hle/service/service.h"
#include "core/hle/service/ir/ir.h"
#include "core/hle/service/ir/ir_rst.h"
#include "core/hle/service/ir/ir_u.h"
#include "core/hle/service/ir/ir_user.h"
-#include "core/hle/kernel/event.h"
-#include "core/hle/kernel/shared_memory.h"
-
namespace Service {
namespace IR {
static Kernel::SharedPtr<Kernel::Event> handle_event;
+static Kernel::SharedPtr<Kernel::Event> conn_status_event;
static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory;
+static Kernel::SharedPtr<Kernel::SharedMemory> transfer_shared_memory;
void GetHandles(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
@@ -26,6 +28,64 @@ void GetHandles(Service::Interface* self) {
cmd_buff[4] = Kernel::g_handle_table.Create(Service::IR::handle_event).MoveFrom();
}
+void InitializeIrNopShared(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ u32 transfer_buff_size = cmd_buff[1];
+ u32 recv_buff_size = cmd_buff[2];
+ u32 unk1 = cmd_buff[3];
+ u32 send_buff_size = cmd_buff[4];
+ u32 unk2 = cmd_buff[5];
+ u8 baud_rate = cmd_buff[6] & 0xFF;
+ Handle handle = cmd_buff[8];
+
+ if(Kernel::g_handle_table.IsValid(handle)) {
+ transfer_shared_memory = Kernel::g_handle_table.Get<Kernel::SharedMemory>(handle);
+ transfer_shared_memory->name = "IR:TransferSharedMemory";
+ }
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+
+ LOG_WARNING(Service_IR, "(STUBBED) called, transfer_buff_size=%d, recv_buff_size=%d, "
+ "unk1=%d, send_buff_size=%d, unk2=%d, baud_rate=%u, handle=0x%08X",
+ transfer_buff_size, recv_buff_size, unk1, send_buff_size, unk2, baud_rate, handle);
+}
+
+void RequireConnection(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ conn_status_event->Signal();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+
+ LOG_WARNING(Service_IR, "(STUBBED) called");
+}
+
+void Disconnect(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+
+ LOG_WARNING(Service_IR, "(STUBBED) called");
+}
+
+void GetConnectionStatusEvent(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[3] = Kernel::g_handle_table.Create(Service::IR::conn_status_event).MoveFrom();
+
+ LOG_WARNING(Service_IR, "(STUBBED) called");
+}
+
+void FinalizeIrNop(Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+
+ LOG_WARNING(Service_IR, "(STUBBED) called");
+}
+
void Init() {
using namespace Kernel;
@@ -35,15 +95,19 @@ void Init() {
using Kernel::MemoryPermission;
shared_memory = SharedMemory::Create(0x1000, Kernel::MemoryPermission::ReadWrite,
- Kernel::MemoryPermission::ReadWrite, "IR:SharedMemory");
+ Kernel::MemoryPermission::ReadWrite, "IR:SharedMemory");
+ transfer_shared_memory = nullptr;
// Create event handle(s)
handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent");
+ conn_status_event = Event::Create(RESETTYPE_ONESHOT, "IR:ConnectionStatusEvent");
}
void Shutdown() {
+ transfer_shared_memory = nullptr;
shared_memory = nullptr;
handle_event = nullptr;
+ conn_status_event = nullptr;
}
} // namespace IR
diff --git a/src/core/hle/service/ir/ir.h b/src/core/hle/service/ir/ir.h
index 3e107a8fe..72d44ce60 100644
--- a/src/core/hle/service/ir/ir.h
+++ b/src/core/hle/service/ir/ir.h
@@ -20,6 +20,53 @@ namespace IR {
*/
void GetHandles(Interface* self);
+/**
+ * IR::InitializeIrNopShared service function
+ * Inputs:
+ * 1 : Size of transfer buffer
+ * 2 : Recv buffer size
+ * 3 : unknown
+ * 4 : Send buffer size
+ * 5 : unknown
+ * 6 : BaudRate (u8)
+ * 7 : 0
+ * 8 : Handle of transfer shared memory
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void InitializeIrNopShared(Interface* self);
+
+/**
+ * IR::FinalizeIrNop service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void FinalizeIrNop(Interface* self);
+
+/**
+ * IR::GetConnectionStatusEvent service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Connection Status Event handle
+ */
+void GetConnectionStatusEvent(Interface* self);
+
+/**
+ * IR::Disconnect service function
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void Disconnect(Interface* self);
+
+/**
+ * IR::RequireConnection service function
+ * Inputs:
+ * 1 : unknown (u8), looks like always 1
+ * Outputs:
+ * 1 : Result of function, 0 on success, otherwise error code
+ */
+void RequireConnection(Interface* self);
+
/// Initialize IR service
void Init();
diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp
index 0a98e5801..06a601029 100644
--- a/src/core/hle/service/ir/ir_user.cpp
+++ b/src/core/hle/service/ir/ir_user.cpp
@@ -2,26 +2,39 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "core/hle/service/ir/ir.h"
#include "core/hle/service/ir/ir_user.h"
namespace Service {
namespace IR {
const Interface::FunctionInfo FunctionTable[] = {
- {0x00010182, nullptr, "InitializeIrNop"},
- {0x00020000, nullptr, "FinalizeIrNop"},
- {0x00030000, nullptr, "ClearReceiveBuffer"},
- {0x00040000, nullptr, "ClearSendBuffer"},
- {0x00060040, nullptr, "RequireConnection"},
- {0x00090000, nullptr, "Disconnect"},
- {0x000A0000, nullptr, "GetReceiveEvent"},
- {0x000B0000, nullptr, "GetSendEvent"},
- {0x000C0000, nullptr, "GetConnectionStatusEvent"},
- {0x000D0042, nullptr, "SendIrNop"},
- {0x000E0042, nullptr, "SendIrNopLarge"},
- {0x00180182, nullptr, "InitializeIrNopShared"},
- {0x00190040, nullptr, "ReleaseReceivedData"},
- {0x001A0040, nullptr, "SetOwnMachineId"},
+ {0x00010182, nullptr, "InitializeIrNop"},
+ {0x00020000, FinalizeIrNop, "FinalizeIrNop"},
+ {0x00030000, nullptr, "ClearReceiveBuffer"},
+ {0x00040000, nullptr, "ClearSendBuffer"},
+ {0x000500C0, nullptr, "WaitConnection"},
+ {0x00060040, RequireConnection, "RequireConnection"},
+ {0x000702C0, nullptr, "AutoConnection"},
+ {0x00080000, nullptr, "AnyConnection"},
+ {0x00090000, Disconnect, "Disconnect"},
+ {0x000A0000, nullptr, "GetReceiveEvent"},
+ {0x000B0000, nullptr, "GetSendEvent"},
+ {0x000C0000, GetConnectionStatusEvent, "GetConnectionStatusEvent"},
+ {0x000D0042, nullptr, "SendIrNop"},
+ {0x000E0042, nullptr, "SendIrNopLarge"},
+ {0x000F0040, nullptr, "ReceiveIrnop"},
+ {0x00100042, nullptr, "ReceiveIrnopLarge"},
+ {0x00110040, nullptr, "GetLatestReceiveErrorResult"},
+ {0x00120040, nullptr, "GetLatestSendErrorResult"},
+ {0x00130000, nullptr, "GetConnectionStatus"},
+ {0x00140000, nullptr, "GetTryingToConnectStatus"},
+ {0x00150000, nullptr, "GetReceiveSizeFreeAndUsed"},
+ {0x00160000, nullptr, "GetSendSizeFreeAndUsed"},
+ {0x00170000, nullptr, "GetConnectionRole"},
+ {0x00180182, InitializeIrNopShared, "InitializeIrNopShared"},
+ {0x00190040, nullptr, "ReleaseReceivedData"},
+ {0x001A0040, nullptr, "SetOwnMachineId"},
};
IR_User_Interface::IR_User_Interface() {
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp
index 22c1093ff..6bdee4d9e 100644
--- a/src/core/hle/service/ptm/ptm.cpp
+++ b/src/core/hle/service/ptm/ptm.cpp
@@ -110,8 +110,8 @@ void Init() {
FileSys::Path gamecoin_path("gamecoin.dat");
FileSys::Mode open_mode = {};
- open_mode.write_flag = 1;
- open_mode.create_flag = 1;
+ open_mode.write_flag.Assign(1);
+ open_mode.create_flag.Assign(1);
// Open the file and write the default gamecoin information
auto gamecoin_result = Service::FS::OpenFileFromArchive(*archive_result, gamecoin_path, open_mode);
if (gamecoin_result.Succeeded()) {
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index 822b093f4..e603bf794 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -178,17 +178,17 @@ struct CTRPollFD {
static Events TranslateTo3DS(u32 input_event) {
Events ev = {};
if (input_event & POLLIN)
- ev.pollin = 1;
+ ev.pollin.Assign(1);
if (input_event & POLLPRI)
- ev.pollpri = 1;
+ ev.pollpri.Assign(1);
if (input_event & POLLHUP)
- ev.pollhup = 1;
+ ev.pollhup.Assign(1);
if (input_event & POLLERR)
- ev.pollerr = 1;
+ ev.pollerr.Assign(1);
if (input_event & POLLOUT)
- ev.pollout = 1;
+ ev.pollout.Assign(1);
if (input_event & POLLNVAL)
- ev.pollnval = 1;
+ ev.pollnval.Assign(1);
return ev;
}
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index ba21e06d5..7a39b101d 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -486,6 +486,7 @@ static ResultCode CreateThread(Handle* out_handle, s32 priority, u32 entry_point
}
switch (processor_id) {
+ case THREADPROCESSORID_ALL:
case THREADPROCESSORID_DEFAULT:
case THREADPROCESSORID_0:
case THREADPROCESSORID_1:
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index 4bd3a632d..5312baa83 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -17,7 +17,6 @@
#include "core/core_timing.h"
#include "core/hle/service/gsp_gpu.h"
-#include "core/hle/service/dsp_dsp.h"
#include "core/hle/service/hid/hid.h"
#include "core/hw/hw.h"
@@ -146,8 +145,8 @@ inline void Write(u32 addr, const T data) {
// Reset "trigger" flag and set the "finish" flag
// NOTE: This was confirmed to happen on hardware even if "address_start" is zero.
- config.trigger = 0;
- config.finished = 1;
+ config.trigger.Assign(0);
+ config.finished.Assign(1);
}
break;
}
@@ -414,11 +413,6 @@ static void VBlankCallback(u64 userdata, int cycles_late) {
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC0);
GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1);
- // TODO(bunnei): Fake a DSP interrupt on each frame. This does not belong here, but
- // until we can emulate DSP interrupts, this is probably the only reasonable place to do
- // this. Certain games expect this to be periodically signaled.
- DSP_DSP::SignalInterrupt();
-
// Check for user input updates
Service::HID::Update();
@@ -444,16 +438,16 @@ void Init() {
framebuffer_sub.address_left1 = 0x1848F000;
framebuffer_sub.address_left2 = 0x184C7800;
- framebuffer_top.width = 240;
- framebuffer_top.height = 400;
+ framebuffer_top.width.Assign(240);
+ framebuffer_top.height.Assign(400);
framebuffer_top.stride = 3 * 240;
- framebuffer_top.color_format = Regs::PixelFormat::RGB8;
+ framebuffer_top.color_format.Assign(Regs::PixelFormat::RGB8);
framebuffer_top.active_fb = 0;
- framebuffer_sub.width = 240;
- framebuffer_sub.height = 320;
+ framebuffer_sub.width.Assign(240);
+ framebuffer_sub.height.Assign(320);
framebuffer_sub.stride = 3 * 240;
- framebuffer_sub.color_format = Regs::PixelFormat::RGB8;
+ framebuffer_sub.color_format.Assign(Regs::PixelFormat::RGB8);
framebuffer_sub.active_fb = 0;
last_skip_frame = false;
diff --git a/src/core/system.cpp b/src/core/system.cpp
index 7e9c56538..b62ebf69e 100644
--- a/src/core/system.cpp
+++ b/src/core/system.cpp
@@ -2,9 +2,12 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "audio_core/audio_core.h"
+
#include "core/core.h"
#include "core/core_timing.h"
#include "core/system.h"
+#include "core/gdbstub/gdbstub.h"
#include "core/hw/hw.h"
#include "core/hle/hle.h"
#include "core/hle/kernel/kernel.h"
@@ -12,8 +15,6 @@
#include "video_core/video_core.h"
-#include "core/gdbstub/gdbstub.h"
-
namespace System {
void Init(EmuWindow* emu_window) {
@@ -24,11 +25,13 @@ void Init(EmuWindow* emu_window) {
Kernel::Init();
HLE::Init();
VideoCore::Init(emu_window);
+ AudioCore::Init();
GDBStub::Init();
}
void Shutdown() {
GDBStub::Shutdown();
+ AudioCore::Shutdown();
VideoCore::Shutdown();
HLE::Shutdown();
Kernel::Shutdown();