Compare commits
6 Commits
android-23
...
android-22
Author | SHA1 | Date | |
---|---|---|---|
039a84338a | |||
f0eb935051 | |||
db727765f1 | |||
60dda4ed9a | |||
dde2c301f3 | |||
0bf2470bdf |
@ -2,10 +2,9 @@
|
|||||||
|----|----|----|----|----|
|
|----|----|----|----|----|
|
||||||
| [12461](https://github.com/yuzu-emu/yuzu-android//pull/12461) | [`4c08a0e6d`](https://github.com/yuzu-emu/yuzu-android//pull/12461/files) | Rework Nvdec and VIC to fix out-of-order videos, and speed up decoding. | [Kelebek1](https://github.com/Kelebek1/) | Yes |
|
| [12461](https://github.com/yuzu-emu/yuzu-android//pull/12461) | [`4c08a0e6d`](https://github.com/yuzu-emu/yuzu-android//pull/12461/files) | Rework Nvdec and VIC to fix out-of-order videos, and speed up decoding. | [Kelebek1](https://github.com/Kelebek1/) | Yes |
|
||||||
| [12749](https://github.com/yuzu-emu/yuzu-android//pull/12749) | [`aad4b0d6f`](https://github.com/yuzu-emu/yuzu-android//pull/12749/files) | general: workarounds for SMMU syncing issues | [liamwhite](https://github.com/liamwhite/) | Yes |
|
| [12749](https://github.com/yuzu-emu/yuzu-android//pull/12749) | [`aad4b0d6f`](https://github.com/yuzu-emu/yuzu-android//pull/12749/files) | general: workarounds for SMMU syncing issues | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||||
| [12756](https://github.com/yuzu-emu/yuzu-android//pull/12756) | [`cd3de0848`](https://github.com/yuzu-emu/yuzu-android//pull/12756/files) | general: applet multiprocess | [liamwhite](https://github.com/liamwhite/) | Yes |
|
| [12756](https://github.com/yuzu-emu/yuzu-android//pull/12756) | [`b19285d4f`](https://github.com/yuzu-emu/yuzu-android//pull/12756/files) | general: applet multiprocess | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||||
|
| [12892](https://github.com/yuzu-emu/yuzu-android//pull/12892) | [`78f72b3bf`](https://github.com/yuzu-emu/yuzu-android//pull/12892/files) | cmif_serialization: enforce const for references | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||||
| [12903](https://github.com/yuzu-emu/yuzu-android//pull/12903) | [`5be8121af`](https://github.com/yuzu-emu/yuzu-android//pull/12903/files) | shader_recompiler: use only ConstOffset for OpImageFetch | [liamwhite](https://github.com/liamwhite/) | Yes |
|
| [12903](https://github.com/yuzu-emu/yuzu-android//pull/12903) | [`5be8121af`](https://github.com/yuzu-emu/yuzu-android//pull/12903/files) | shader_recompiler: use only ConstOffset for OpImageFetch | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||||
| [12905](https://github.com/yuzu-emu/yuzu-android//pull/12905) | [`5eb5c9675`](https://github.com/yuzu-emu/yuzu-android//pull/12905/files) | nvnflinger: release buffers before presentation sleep | [liamwhite](https://github.com/liamwhite/) | Yes |
|
|
||||||
| [12915](https://github.com/yuzu-emu/yuzu-android//pull/12915) | [`504abbd6e`](https://github.com/yuzu-emu/yuzu-android//pull/12915/files) | dmnt: cheats: Update cheat vm to latest version | [german77](https://github.com/german77/) | Yes |
|
|
||||||
|
|
||||||
|
|
||||||
End of merge log. You can find the original README.md below the break.
|
End of merge log. You can find the original README.md below the break.
|
||||||
|
@ -118,17 +118,23 @@ std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system,
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case LibraryAppletMode::AllForeground:
|
case LibraryAppletMode::AllForeground:
|
||||||
case LibraryAppletMode::NoUi:
|
case LibraryAppletMode::NoUi:
|
||||||
case LibraryAppletMode::PartialForeground:
|
|
||||||
case LibraryAppletMode::PartialForegroundIndirectDisplay:
|
|
||||||
applet->hid_registration.EnableAppletToGetInput(true);
|
|
||||||
applet->focus_state = FocusState::InFocus;
|
applet->focus_state = FocusState::InFocus;
|
||||||
|
applet->hid_registration.EnableAppletToGetInput(true);
|
||||||
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
|
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
|
||||||
|
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
||||||
break;
|
break;
|
||||||
case LibraryAppletMode::AllForegroundInitiallyHidden:
|
case LibraryAppletMode::AllForegroundInitiallyHidden:
|
||||||
applet->hid_registration.EnableAppletToGetInput(false);
|
|
||||||
applet->focus_state = FocusState::NotInFocus;
|
|
||||||
applet->system_buffer_manager.SetWindowVisibility(false);
|
applet->system_buffer_manager.SetWindowVisibility(false);
|
||||||
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoBackground);
|
applet->focus_state = FocusState::NotInFocus;
|
||||||
|
applet->hid_registration.EnableAppletToGetInput(false);
|
||||||
|
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
||||||
|
break;
|
||||||
|
case LibraryAppletMode::PartialForeground:
|
||||||
|
case LibraryAppletMode::PartialForegroundIndirectDisplay:
|
||||||
|
default:
|
||||||
|
applet->focus_state = FocusState::Background;
|
||||||
|
applet->hid_registration.EnableAppletToGetInput(true);
|
||||||
|
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,7 @@ bool SystemBufferManager::Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Nvnflinger::LayerBlending blending = Nvnflinger::LayerBlending::None;
|
Nvnflinger::LayerBlending blending = Nvnflinger::LayerBlending::None;
|
||||||
if (mode == LibraryAppletMode::PartialForeground ||
|
if (mode == LibraryAppletMode::PartialForeground) {
|
||||||
mode == LibraryAppletMode::PartialForegroundIndirectDisplay) {
|
|
||||||
blending = Nvnflinger::LayerBlending::Coverage;
|
blending = Nvnflinger::LayerBlending::Coverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ void IWindowController::SetAppletWindowVisibility(HLERequestContext& ctx) {
|
|||||||
applet->hid_registration.EnableAppletToGetInput(visible);
|
applet->hid_registration.EnableAppletToGetInput(visible);
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
applet->focus_state = FocusState::InFocus;
|
|
||||||
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
|
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground);
|
||||||
|
applet->focus_state = FocusState::InFocus;
|
||||||
} else {
|
} else {
|
||||||
applet->focus_state = FocusState::NotInFocus;
|
applet->focus_state = FocusState::NotInFocus;
|
||||||
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoBackground);
|
|
||||||
}
|
}
|
||||||
|
applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
|
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
|
||||||
#include "core/hle/service/nvnflinger/buffer_item.h"
|
#include "core/hle/service/nvnflinger/buffer_item.h"
|
||||||
#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
|
#include "core/hle/service/nvnflinger/buffer_item_consumer.h"
|
||||||
|
#include "core/hle/service/nvnflinger/buffer_queue_producer.h"
|
||||||
#include "core/hle/service/nvnflinger/hardware_composer.h"
|
#include "core/hle/service/nvnflinger/hardware_composer.h"
|
||||||
#include "core/hle/service/nvnflinger/hwc_layer.h"
|
#include "core/hle/service/nvnflinger/hwc_layer.h"
|
||||||
#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
|
#include "core/hle/service/nvnflinger/ui/graphic_buffer.h"
|
||||||
@ -45,9 +46,31 @@ HardwareComposer::HardwareComposer() = default;
|
|||||||
HardwareComposer::~HardwareComposer() = default;
|
HardwareComposer::~HardwareComposer() = default;
|
||||||
|
|
||||||
u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, VI::Display& display,
|
u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, VI::Display& display,
|
||||||
Nvidia::Devices::nvdisp_disp0& nvdisp) {
|
Nvidia::Devices::nvdisp_disp0& nvdisp, u32 frame_advance) {
|
||||||
boost::container::small_vector<HwcLayer, 2> composition_stack;
|
boost::container::small_vector<HwcLayer, 2> composition_stack;
|
||||||
|
|
||||||
|
m_frame_number += frame_advance;
|
||||||
|
|
||||||
|
// Release any necessary framebuffers.
|
||||||
|
for (auto& [layer_id, framebuffer] : m_framebuffers) {
|
||||||
|
if (framebuffer.release_frame_number > m_frame_number) {
|
||||||
|
// Not yet ready to release this framebuffer.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!framebuffer.is_acquired) {
|
||||||
|
// Already released.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto* layer = display.FindLayer(layer_id); layer != nullptr) {
|
||||||
|
// TODO: support release fence
|
||||||
|
// This is needed to prevent screen tearing
|
||||||
|
layer->GetConsumer().ReleaseBuffer(framebuffer.item, android::Fence::NoFence());
|
||||||
|
framebuffer.is_acquired = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set default speed limit to 100%.
|
// Set default speed limit to 100%.
|
||||||
*out_speed_scale = 1.0f;
|
*out_speed_scale = 1.0f;
|
||||||
|
|
||||||
@ -120,30 +143,7 @@ u32 HardwareComposer::ComposeLocked(f32* out_speed_scale, VI::Display& display,
|
|||||||
MicroProfileFlip();
|
MicroProfileFlip();
|
||||||
|
|
||||||
// Advance by at least one frame.
|
// Advance by at least one frame.
|
||||||
const u32 frame_advance = swap_interval.value_or(1);
|
return swap_interval.value_or(1);
|
||||||
m_frame_number += frame_advance;
|
|
||||||
|
|
||||||
// Release any necessary framebuffers.
|
|
||||||
for (auto& [layer_id, framebuffer] : m_framebuffers) {
|
|
||||||
if (framebuffer.release_frame_number > m_frame_number) {
|
|
||||||
// Not yet ready to release this framebuffer.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!framebuffer.is_acquired) {
|
|
||||||
// Already released.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (auto* layer = display.FindLayer(layer_id); layer != nullptr) {
|
|
||||||
// TODO: support release fence
|
|
||||||
// This is needed to prevent screen tearing
|
|
||||||
layer->GetConsumer().ReleaseBuffer(framebuffer.item, android::Fence::NoFence());
|
|
||||||
framebuffer.is_acquired = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return frame_advance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardwareComposer::RemoveLayerLocked(VI::Display& display, LayerId layer_id) {
|
void HardwareComposer::RemoveLayerLocked(VI::Display& display, LayerId layer_id) {
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
~HardwareComposer();
|
~HardwareComposer();
|
||||||
|
|
||||||
u32 ComposeLocked(f32* out_speed_scale, VI::Display& display,
|
u32 ComposeLocked(f32* out_speed_scale, VI::Display& display,
|
||||||
Nvidia::Devices::nvdisp_disp0& nvdisp);
|
Nvidia::Devices::nvdisp_disp0& nvdisp, u32 frame_advance);
|
||||||
void RemoveLayerLocked(VI::Display& display, LayerId layer_id);
|
void RemoveLayerLocked(VI::Display& display, LayerId layer_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -292,7 +292,8 @@ void Nvnflinger::Compose() {
|
|||||||
auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>(disp_fd);
|
auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>(disp_fd);
|
||||||
ASSERT(nvdisp);
|
ASSERT(nvdisp);
|
||||||
|
|
||||||
swap_interval = display.GetComposer().ComposeLocked(&compose_speed_scale, display, *nvdisp);
|
swap_interval = display.GetComposer().ComposeLocked(&compose_speed_scale, display, *nvdisp,
|
||||||
|
swap_interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/k_page_table.h"
|
#include "core/hle/kernel/k_page_table.h"
|
||||||
#include "core/hle/kernel/k_process.h"
|
#include "core/hle/kernel/k_process.h"
|
||||||
#include "core/hle/kernel/k_process_page_table.h"
|
|
||||||
#include "core/hle/service/hid/hid_server.h"
|
#include "core/hle/service/hid/hid_server.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
@ -86,12 +85,8 @@ VAddr StandardVmCallbacks::SanitizeAddress(VAddr in) const {
|
|||||||
if ((in < metadata.main_nso_extents.base ||
|
if ((in < metadata.main_nso_extents.base ||
|
||||||
in >= metadata.main_nso_extents.base + metadata.main_nso_extents.size) &&
|
in >= metadata.main_nso_extents.base + metadata.main_nso_extents.size) &&
|
||||||
(in < metadata.heap_extents.base ||
|
(in < metadata.heap_extents.base ||
|
||||||
in >= metadata.heap_extents.base + metadata.heap_extents.size) &&
|
in >= metadata.heap_extents.base + metadata.heap_extents.size)) {
|
||||||
(in < metadata.alias_extents.base ||
|
LOG_ERROR(CheatEngine,
|
||||||
in >= metadata.heap_extents.base + metadata.alias_extents.size) &&
|
|
||||||
(in < metadata.aslr_extents.base ||
|
|
||||||
in >= metadata.heap_extents.base + metadata.aslr_extents.size)) {
|
|
||||||
LOG_DEBUG(CheatEngine,
|
|
||||||
"Cheat attempting to access memory at invalid address={:016X}, if this "
|
"Cheat attempting to access memory at invalid address={:016X}, if this "
|
||||||
"persists, "
|
"persists, "
|
||||||
"the cheat may be incorrect. However, this may be normal early in execution if "
|
"the cheat may be incorrect. However, this may be normal early in execution if "
|
||||||
@ -216,14 +211,16 @@ void CheatEngine::Initialize() {
|
|||||||
.base = GetInteger(page_table.GetHeapRegionStart()),
|
.base = GetInteger(page_table.GetHeapRegionStart()),
|
||||||
.size = page_table.GetHeapRegionSize(),
|
.size = page_table.GetHeapRegionSize(),
|
||||||
};
|
};
|
||||||
metadata.aslr_extents = {
|
|
||||||
|
metadata.address_space_extents = {
|
||||||
|
.base = GetInteger(page_table.GetAddressSpaceStart()),
|
||||||
|
.size = page_table.GetAddressSpaceSize(),
|
||||||
|
};
|
||||||
|
|
||||||
|
metadata.alias_extents = {
|
||||||
.base = GetInteger(page_table.GetAliasCodeRegionStart()),
|
.base = GetInteger(page_table.GetAliasCodeRegionStart()),
|
||||||
.size = page_table.GetAliasCodeRegionSize(),
|
.size = page_table.GetAliasCodeRegionSize(),
|
||||||
};
|
};
|
||||||
metadata.alias_extents = {
|
|
||||||
.base = GetInteger(page_table.GetAliasRegionStart()),
|
|
||||||
.size = page_table.GetAliasRegionSize(),
|
|
||||||
};
|
|
||||||
|
|
||||||
is_pending_reload.exchange(true);
|
is_pending_reload.exchange(true);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ private:
|
|||||||
VAddr SanitizeAddress(VAddr address) const;
|
VAddr SanitizeAddress(VAddr address) const;
|
||||||
|
|
||||||
const CheatProcessMetadata& metadata;
|
const CheatProcessMetadata& metadata;
|
||||||
Core::System& system;
|
System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Intermediary class that parses a text file or other disk format for storing cheats into a
|
// Intermediary class that parses a text file or other disk format for storing cheats into a
|
||||||
|
@ -18,7 +18,7 @@ struct CheatProcessMetadata {
|
|||||||
MemoryRegionExtents main_nso_extents{};
|
MemoryRegionExtents main_nso_extents{};
|
||||||
MemoryRegionExtents heap_extents{};
|
MemoryRegionExtents heap_extents{};
|
||||||
MemoryRegionExtents alias_extents{};
|
MemoryRegionExtents alias_extents{};
|
||||||
MemoryRegionExtents aslr_extents{};
|
MemoryRegionExtents address_space_extents{};
|
||||||
std::array<u8, 0x20> main_nso_build_id{};
|
std::array<u8, 0x20> main_nso_build_id{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -322,9 +322,8 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
|
|||||||
} break;
|
} break;
|
||||||
case CheatVmOpcodeType::EndConditionalBlock: {
|
case CheatVmOpcodeType::EndConditionalBlock: {
|
||||||
// 20000000
|
// 20000000
|
||||||
opcode.opcode = EndConditionalOpcode{
|
// There's actually nothing left to process here!
|
||||||
.is_else = ((first_dword >> 24) & 0xf) == 1,
|
opcode.opcode = EndConditionalOpcode{};
|
||||||
};
|
|
||||||
} break;
|
} break;
|
||||||
case CheatVmOpcodeType::ControlLoop: {
|
case CheatVmOpcodeType::ControlLoop: {
|
||||||
// 300R0000 VVVVVVVV
|
// 300R0000 VVVVVVVV
|
||||||
@ -556,18 +555,6 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
|
|||||||
.idx = first_dword & 0xF,
|
.idx = first_dword & 0xF,
|
||||||
};
|
};
|
||||||
} break;
|
} break;
|
||||||
case CheatVmOpcodeType::PauseProcess: {
|
|
||||||
/* FF0????? */
|
|
||||||
/* FF0 = opcode 0xFF0 */
|
|
||||||
/* Pauses the current process. */
|
|
||||||
opcode.opcode = PauseProcessOpcode{};
|
|
||||||
} break;
|
|
||||||
case CheatVmOpcodeType::ResumeProcess: {
|
|
||||||
/* FF0????? */
|
|
||||||
/* FF0 = opcode 0xFF0 */
|
|
||||||
/* Pauses the current process. */
|
|
||||||
opcode.opcode = ResumeProcessOpcode{};
|
|
||||||
} break;
|
|
||||||
case CheatVmOpcodeType::DebugLog: {
|
case CheatVmOpcodeType::DebugLog: {
|
||||||
// FFFTIX##
|
// FFFTIX##
|
||||||
// FFFTI0Ma aaaaaaaa
|
// FFFTI0Ma aaaaaaaa
|
||||||
@ -634,7 +621,7 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
|
|||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DmntCheatVm::SkipConditionalBlock(bool is_if) {
|
void DmntCheatVm::SkipConditionalBlock() {
|
||||||
if (condition_depth > 0) {
|
if (condition_depth > 0) {
|
||||||
// We want to continue until we're out of the current block.
|
// We want to continue until we're out of the current block.
|
||||||
const std::size_t desired_depth = condition_depth - 1;
|
const std::size_t desired_depth = condition_depth - 1;
|
||||||
@ -650,12 +637,8 @@ void DmntCheatVm::SkipConditionalBlock(bool is_if) {
|
|||||||
// We also support nesting of conditional blocks, and Gateway does not.
|
// We also support nesting of conditional blocks, and Gateway does not.
|
||||||
if (skip_opcode.begin_conditional_block) {
|
if (skip_opcode.begin_conditional_block) {
|
||||||
condition_depth++;
|
condition_depth++;
|
||||||
} else if (auto end_cond = std::get_if<EndConditionalOpcode>(&skip_opcode.opcode)) {
|
} else if (std::holds_alternative<EndConditionalOpcode>(skip_opcode.opcode)) {
|
||||||
if (!end_cond->is_else) {
|
condition_depth--;
|
||||||
condition_depth--;
|
|
||||||
} else if (is_if && condition_depth - 1 == desired_depth) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -692,10 +675,6 @@ u64 DmntCheatVm::GetCheatProcessAddress(const CheatProcessMetadata& metadata,
|
|||||||
return metadata.main_nso_extents.base + rel_address;
|
return metadata.main_nso_extents.base + rel_address;
|
||||||
case MemoryAccessType::Heap:
|
case MemoryAccessType::Heap:
|
||||||
return metadata.heap_extents.base + rel_address;
|
return metadata.heap_extents.base + rel_address;
|
||||||
case MemoryAccessType::Alias:
|
|
||||||
return metadata.alias_extents.base + rel_address;
|
|
||||||
case MemoryAccessType::Aslr:
|
|
||||||
return metadata.aslr_extents.base + rel_address;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,6 +682,7 @@ void DmntCheatVm::ResetState() {
|
|||||||
registers.fill(0);
|
registers.fill(0);
|
||||||
saved_values.fill(0);
|
saved_values.fill(0);
|
||||||
loop_tops.fill(0);
|
loop_tops.fill(0);
|
||||||
|
static_registers.fill(0);
|
||||||
instruction_ptr = 0;
|
instruction_ptr = 0;
|
||||||
condition_depth = 0;
|
condition_depth = 0;
|
||||||
decode_success = true;
|
decode_success = true;
|
||||||
@ -814,18 +794,13 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
|
|||||||
}
|
}
|
||||||
// Skip conditional block if condition not met.
|
// Skip conditional block if condition not met.
|
||||||
if (!cond_met) {
|
if (!cond_met) {
|
||||||
SkipConditionalBlock(true);
|
SkipConditionalBlock();
|
||||||
}
|
}
|
||||||
} else if (auto end_cond = std::get_if<EndConditionalOpcode>(&cur_opcode.opcode)) {
|
} else if (std::holds_alternative<EndConditionalOpcode>(cur_opcode.opcode)) {
|
||||||
if (end_cond->is_else) {
|
// Decrement the condition depth.
|
||||||
/* Skip to the end of the conditional block. */
|
// We will assume, graciously, that mismatched conditional block ends are a nop.
|
||||||
this->SkipConditionalBlock(false);
|
if (condition_depth > 0) {
|
||||||
} else {
|
condition_depth--;
|
||||||
/* Decrement the condition depth. */
|
|
||||||
/* We will assume, graciously, that mismatched conditional block ends are a nop. */
|
|
||||||
if (condition_depth > 0) {
|
|
||||||
condition_depth--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (auto ctrl_loop = std::get_if<ControlLoopOpcode>(&cur_opcode.opcode)) {
|
} else if (auto ctrl_loop = std::get_if<ControlLoopOpcode>(&cur_opcode.opcode)) {
|
||||||
if (ctrl_loop->start_loop) {
|
if (ctrl_loop->start_loop) {
|
||||||
@ -933,7 +908,7 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
|
|||||||
// Check for keypress.
|
// Check for keypress.
|
||||||
if ((begin_keypress_cond->key_mask & kDown) != begin_keypress_cond->key_mask) {
|
if ((begin_keypress_cond->key_mask & kDown) != begin_keypress_cond->key_mask) {
|
||||||
// Keys not pressed. Skip conditional block.
|
// Keys not pressed. Skip conditional block.
|
||||||
SkipConditionalBlock(true);
|
SkipConditionalBlock();
|
||||||
}
|
}
|
||||||
} else if (auto perform_math_reg =
|
} else if (auto perform_math_reg =
|
||||||
std::get_if<PerformArithmeticRegisterOpcode>(&cur_opcode.opcode)) {
|
std::get_if<PerformArithmeticRegisterOpcode>(&cur_opcode.opcode)) {
|
||||||
@ -1141,7 +1116,7 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
|
|||||||
|
|
||||||
// Skip conditional block if condition not met.
|
// Skip conditional block if condition not met.
|
||||||
if (!cond_met) {
|
if (!cond_met) {
|
||||||
SkipConditionalBlock(true);
|
SkipConditionalBlock();
|
||||||
}
|
}
|
||||||
} else if (auto save_restore_reg =
|
} else if (auto save_restore_reg =
|
||||||
std::get_if<SaveRestoreRegisterOpcode>(&cur_opcode.opcode)) {
|
std::get_if<SaveRestoreRegisterOpcode>(&cur_opcode.opcode)) {
|
||||||
@ -1203,10 +1178,6 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
|
|||||||
// Store a register to a static register.
|
// Store a register to a static register.
|
||||||
static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx];
|
static_registers[rw_static_reg->static_idx] = registers[rw_static_reg->idx];
|
||||||
}
|
}
|
||||||
} else if (std::holds_alternative<PauseProcessOpcode>(cur_opcode.opcode)) {
|
|
||||||
// TODO: Pause cheat process
|
|
||||||
} else if (std::holds_alternative<ResumeProcessOpcode>(cur_opcode.opcode)) {
|
|
||||||
// TODO: Resume cheat process
|
|
||||||
} else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) {
|
} else if (auto debug_log = std::get_if<DebugLogOpcode>(&cur_opcode.opcode)) {
|
||||||
// Read value from memory.
|
// Read value from memory.
|
||||||
u64 log_value = 0;
|
u64 log_value = 0;
|
||||||
|
@ -42,16 +42,12 @@ enum class CheatVmOpcodeType : u32 {
|
|||||||
DoubleExtendedWidth = 0xF0,
|
DoubleExtendedWidth = 0xF0,
|
||||||
|
|
||||||
// Double-extended width opcodes.
|
// Double-extended width opcodes.
|
||||||
PauseProcess = 0xFF0,
|
|
||||||
ResumeProcess = 0xFF1,
|
|
||||||
DebugLog = 0xFFF,
|
DebugLog = 0xFFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class MemoryAccessType : u32 {
|
enum class MemoryAccessType : u32 {
|
||||||
MainNso = 0,
|
MainNso = 0,
|
||||||
Heap = 1,
|
Heap = 1,
|
||||||
Alias = 2,
|
|
||||||
Aslr = 3,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ConditionalComparisonType : u32 {
|
enum class ConditionalComparisonType : u32 {
|
||||||
@ -135,9 +131,7 @@ struct BeginConditionalOpcode {
|
|||||||
VmInt value{};
|
VmInt value{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EndConditionalOpcode {
|
struct EndConditionalOpcode {};
|
||||||
bool is_else;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ControlLoopOpcode {
|
struct ControlLoopOpcode {
|
||||||
bool start_loop{};
|
bool start_loop{};
|
||||||
@ -228,10 +222,6 @@ struct ReadWriteStaticRegisterOpcode {
|
|||||||
u32 idx{};
|
u32 idx{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PauseProcessOpcode {};
|
|
||||||
|
|
||||||
struct ResumeProcessOpcode {};
|
|
||||||
|
|
||||||
struct DebugLogOpcode {
|
struct DebugLogOpcode {
|
||||||
u32 bit_width{};
|
u32 bit_width{};
|
||||||
u32 log_id{};
|
u32 log_id{};
|
||||||
@ -254,8 +244,8 @@ struct CheatVmOpcode {
|
|||||||
PerformArithmeticStaticOpcode, BeginKeypressConditionalOpcode,
|
PerformArithmeticStaticOpcode, BeginKeypressConditionalOpcode,
|
||||||
PerformArithmeticRegisterOpcode, StoreRegisterToAddressOpcode,
|
PerformArithmeticRegisterOpcode, StoreRegisterToAddressOpcode,
|
||||||
BeginRegisterConditionalOpcode, SaveRestoreRegisterOpcode,
|
BeginRegisterConditionalOpcode, SaveRestoreRegisterOpcode,
|
||||||
SaveRestoreRegisterMaskOpcode, ReadWriteStaticRegisterOpcode, PauseProcessOpcode,
|
SaveRestoreRegisterMaskOpcode, ReadWriteStaticRegisterOpcode, DebugLogOpcode,
|
||||||
ResumeProcessOpcode, DebugLogOpcode, UnrecognizedInstruction>
|
UnrecognizedInstruction>
|
||||||
opcode{};
|
opcode{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -306,7 +296,7 @@ private:
|
|||||||
std::array<std::size_t, NumRegisters> loop_tops{};
|
std::array<std::size_t, NumRegisters> loop_tops{};
|
||||||
|
|
||||||
bool DecodeNextOpcode(CheatVmOpcode& out);
|
bool DecodeNextOpcode(CheatVmOpcode& out);
|
||||||
void SkipConditionalBlock(bool is_if);
|
void SkipConditionalBlock();
|
||||||
void ResetState();
|
void ResetState();
|
||||||
|
|
||||||
// For implementing the DebugLog opcode.
|
// For implementing the DebugLog opcode.
|
||||||
|
Reference in New Issue
Block a user