Merge pull request #5823 from SachinVin/dyn

Android: Backport easy stuff
This commit is contained in:
SachinVin 2021-10-03 18:58:20 +05:30 committed by GitHub
commit 6183b5d76c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 1052 additions and 365 deletions

View file

@ -108,8 +108,8 @@ add_library(core STATIC
frontend/framebuffer_layout.h
frontend/image_interface.h
frontend/input.h
frontend/mic.h
frontend/mic.cpp
frontend/mic.h
frontend/scope_acquire_context.cpp
frontend/scope_acquire_context.h
gdbstub/gdbstub.cpp

View file

@ -953,6 +953,9 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
#define INC_PC(l) ptr += sizeof(arm_inst) + l
#define INC_PC_STUB ptr += sizeof(arm_inst)
#ifdef ANDROID
#define GDB_BP_CHECK
#else
#define GDB_BP_CHECK \
cpu->Cpsr &= ~(1 << 5); \
cpu->Cpsr |= cpu->TFlag << 5; \
@ -965,6 +968,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
goto END; \
} \
}
#endif
// GCC and Clang have a C++ extension to support a lookup table of labels. Otherwise, fallback to a
// clunky switch statement.
@ -1652,11 +1656,13 @@ DISPATCH : {
goto END;
}
#ifndef ANDROID
// Find breakpoint if one exists within the block
if (GDBStub::IsConnected()) {
breakpoint_data =
GDBStub::GetNextBreakpointFromAddress(cpu->Reg[15], GDBStub::BreakpointType::Execute);
}
#endif
inst_base = (arm_inst*)&trans_cache_buf[ptr];
GOTO_NEXT_INST;

View file

@ -182,13 +182,16 @@ void ARMul_State::ResetMPCoreCP15Registers() {
CP15[CP15_MAIN_TLB_LOCKDOWN_ATTRIBUTE] = 0x00000000;
CP15[CP15_TLB_DEBUG_CONTROL] = 0x00000000;
}
#ifdef ANDROID
static void CheckMemoryBreakpoint(u32 address, GDBStub::BreakpointType type) {}
#else
static void CheckMemoryBreakpoint(u32 address, GDBStub::BreakpointType type) {
if (GDBStub::IsServerEnabled() && GDBStub::CheckBreakpoint(address, type)) {
LOG_DEBUG(Debug, "Found memory breakpoint @ {:08x}", address);
GDBStub::Break(true);
}
}
#endif
u8 ARMul_State::ReadMemory8(u32 address) const {
CheckMemoryBreakpoint(address, GDBStub::BreakpointType::Read);

View file

@ -2,7 +2,12 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/file_util.h"
#include "common/string_util.h"
#include "core/file_sys/archive_extsavedata.h"
#include "core/file_sys/file_backend.h"
#include "core/frontend/applets/mii_selector.h"
#include "core/hle/service/ptm/ptm.h"
namespace Frontend {
@ -10,6 +15,42 @@ void MiiSelector::Finalize(u32 return_code, HLE::Applets::MiiData mii) {
data = {return_code, mii};
}
std::vector<HLE::Applets::MiiData> LoadMiis() {
std::vector<HLE::Applets::MiiData> miis;
std::string nand_directory{FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)};
FileSys::ArchiveFactory_ExtSaveData extdata_archive_factory(nand_directory, true);
auto archive_result = extdata_archive_factory.Open(Service::PTM::ptm_shared_extdata_id, 0);
if (archive_result.Succeeded()) {
auto archive = std::move(archive_result).Unwrap();
FileSys::Path file_path = "/CFL_DB.dat";
FileSys::Mode mode{};
mode.read_flag.Assign(1);
auto file_result = archive->OpenFile(file_path, mode);
if (file_result.Succeeded()) {
auto file = std::move(file_result).Unwrap();
u32 saved_miis_offset = 0x8;
// The Mii Maker has a 100 Mii limit on the 3ds
for (int i = 0; i < 100; ++i) {
HLE::Applets::MiiData mii;
std::array<u8, sizeof(mii)> mii_raw;
file->Read(saved_miis_offset, sizeof(mii), mii_raw.data());
std::memcpy(&mii, mii_raw.data(), sizeof(mii));
if (mii.mii_id != 0) {
miis.push_back(mii);
}
saved_miis_offset += sizeof(mii);
}
}
}
return miis;
}
void DefaultMiiSelector::Setup(const Frontend::MiiSelectorConfig& config) {
MiiSelector::Setup(config);
Finalize(0, HLE::Applets::MiiSelector::GetStandardMiiResult().selected_mii_data);

View file

@ -50,6 +50,8 @@ protected:
MiiSelectorData data;
};
std::vector<HLE::Applets::MiiData> LoadMiis();
class DefaultMiiSelector final : public MiiSelector {
public:
void Setup(const MiiSelectorConfig& config) override;