Make APT::GetLockHandle fail to skip aptInit

This commit is contained in:
wheremyfoodat 2022-09-18 02:18:40 +03:00
parent 6154a360c6
commit 5bc8c9d671
6 changed files with 33 additions and 4 deletions

View file

@ -48,13 +48,13 @@ set(SOURCE_FILES src/main.cpp src/emulator.cpp src/core/CPU/cpu_dynarmic.cpp src
set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limits.cpp
src/core/kernel/memory_management.cpp src/core/kernel/ports.cpp
)
set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services/apt.cpp)
set(SERVICE_SOURCE_FILES src/core/services/service_manager.cpp src/core/services/apt.cpp src/core/services/hid.cpp)
set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp include/termcolor.hpp
include/cpu.hpp include/cpu_dynarmic.hpp include/memory.hpp include/kernel/kernel.hpp
include/dynarmic_cp15.hpp include/kernel/resource_limits.hpp include/kernel/kernel_types.hpp
include/kernel/config_mem.hpp include/services/service_manager.hpp include/services/apt.hpp
include/kernel/handles.hpp
include/kernel/handles.hpp include/services/hid.hpp
)
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp

View file

@ -1,11 +1,17 @@
#pragma once
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "memory.hpp"
class APTService {
Handle handle = KernelHandles::APT;
Memory& mem;
// Service commands
void getLockHandle(u32 messagePointer);
public:
APTService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};

0
include/services/hid.hpp Normal file
View file

View file

@ -1,7 +1,30 @@
#include "services/apt.hpp"
namespace APTCommands {
enum : u32 {
GetLockHandle = 0x00010040
};
}
namespace Result {
enum : u32 {
Success = 0,
Failure = 0xFFFFFFFF
};
}
void APTService::reset() {}
void APTService::handleSyncRequest(u32 messagePointer) {
Helpers::panic("APT service requested");
const u32 command = mem.read32(messagePointer);
switch (command) {
case APTCommands::GetLockHandle: getLockHandle(messagePointer); break;
default: Helpers::panic("APT service requested. Command: %08X\n", command);
}
}
void APTService::getLockHandle(u32 messagePointer) {
printf("APT: getLockHandle (Failure)\n");
mem.write32(messagePointer + 4, Result::Failure); // Result code
mem.write32(messagePointer + 16, 0); // Translation descriptor
}

View file

View file

@ -1,6 +1,6 @@
#include "services/service_manager.hpp"
ServiceManager::ServiceManager(std::array<u32, 16>& regs, Memory& mem) : regs(regs), mem(mem) {}
ServiceManager::ServiceManager(std::array<u32, 16>& regs, Memory& mem) : regs(regs), mem(mem), apt(mem) {}
void ServiceManager::reset() {
apt.reset();