mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 13:30:15 +00:00
more cleanup
This commit is contained in:
parent
3f497f0426
commit
e4237e0378
@ -17,8 +17,9 @@
|
|||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "core/system.h"
|
#include "core/system.h"
|
||||||
|
|
||||||
#include "input_core/input_core.h"
|
#include "input_core/input_core.h"
|
||||||
#include "input_core\devices\Keyboard.h"
|
#include "input_core/devices/Keyboard.h"
|
||||||
|
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
@ -110,6 +111,7 @@ private:
|
|||||||
|
|
||||||
GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
|
GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
|
||||||
QWidget(parent), keyboard_id(0), emu_thread(emu_thread) {
|
QWidget(parent), keyboard_id(0), emu_thread(emu_thread) {
|
||||||
|
|
||||||
std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
|
std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
|
||||||
setWindowTitle(QString::fromStdString(window_title));
|
setWindowTitle(QString::fromStdString(window_title));
|
||||||
|
|
||||||
@ -137,6 +139,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
|
|||||||
NotifyClientAreaSizeChanged(std::pair<unsigned, unsigned>(child->width(), child->height()));
|
NotifyClientAreaSizeChanged(std::pair<unsigned, unsigned>(child->width(), child->height()));
|
||||||
|
|
||||||
BackupGeometry();
|
BackupGeometry();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::moveContext() {
|
void GRenderWindow::moveContext() {
|
||||||
@ -257,10 +260,10 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::ReloadSetKeymaps() {
|
void GRenderWindow::ReloadSetKeymaps() {
|
||||||
//KeyMap::ClearKeyMapping();
|
/*KeyMap::ClearKeyMapping(keyboard_id);
|
||||||
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
|
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
|
||||||
//KeyMap::SetKeyMapping( Settings::values.input_mappings[Settings::NativeInput::All[i]], KeyMap::mapping_targets[i]);
|
KeyMap::SetKeyMapping({ Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id }, KeyMap::mapping_targets[i]);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
|
void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) {
|
||||||
@ -288,4 +291,4 @@ void GRenderWindow::showEvent(QShowEvent * event) {
|
|||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection);
|
connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ void EmuWindow::ButtonReleased(Service::HID::PadState pad) {
|
|||||||
void EmuWindow::CirclePadUpdated(float x, float y) {
|
void EmuWindow::CirclePadUpdated(float x, float y) {
|
||||||
constexpr int MAX_CIRCLEPAD_POS = 0x9C; // Max value for a circle pad position
|
constexpr int MAX_CIRCLEPAD_POS = 0x9C; // Max value for a circle pad position
|
||||||
|
|
||||||
// Make sure the coordinates are in the unit circle,
|
// Make sure the coordinates are in the unit circle,
|
||||||
// otherwise normalize it.
|
// otherwise normalize it.
|
||||||
float r = x * x + y * y;
|
float r = x * x + y * y;
|
||||||
if (r > 1) {
|
if (r > 1) {
|
||||||
r = std::sqrt(r);
|
r = std::sqrt(r);
|
||||||
@ -35,22 +35,21 @@ void EmuWindow::CirclePadUpdated(float x, float y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout
|
* Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout
|
||||||
* @param layout FramebufferLayout object describing the framebuffer size and screen positions
|
* @param layout FramebufferLayout object describing the framebuffer size and screen positions
|
||||||
* @param framebuffer_x Framebuffer x-coordinate to check
|
* @param framebuffer_x Framebuffer x-coordinate to check
|
||||||
* @param framebuffer_y Framebuffer y-coordinate to check
|
* @param framebuffer_y Framebuffer y-coordinate to check
|
||||||
* @return True if the coordinates are within the touchpad, otherwise false
|
* @return True if the coordinates are within the touchpad, otherwise false
|
||||||
*/
|
*/
|
||||||
static bool IsWithinTouchscreen(const EmuWindow::FramebufferLayout& layout, unsigned framebuffer_x,
|
static bool IsWithinTouchscreen(const EmuWindow::FramebufferLayout& layout, unsigned framebuffer_x,
|
||||||
unsigned framebuffer_y) {
|
unsigned framebuffer_y) {
|
||||||
return (framebuffer_y >= layout.bottom_screen.top &&
|
return (framebuffer_y >= layout.bottom_screen.top &&
|
||||||
framebuffer_y < layout.bottom_screen.bottom &&
|
framebuffer_y < layout.bottom_screen.bottom &&
|
||||||
framebuffer_x >= layout.bottom_screen.left &&
|
framebuffer_x >= layout.bottom_screen.left &&
|
||||||
framebuffer_x < layout.bottom_screen.right);
|
framebuffer_x < layout.bottom_screen.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<unsigned,unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) {
|
std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) {
|
||||||
|
|
||||||
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left);
|
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left);
|
||||||
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right - 1);
|
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right - 1);
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(u
|
|||||||
if (width == 0) width = 1;
|
if (width == 0) width = 1;
|
||||||
if (height == 0) height = 1;
|
if (height == 0) height = 1;
|
||||||
|
|
||||||
EmuWindow::FramebufferLayout res = { width, height, {}, {} };
|
EmuWindow::FramebufferLayout res = { width, height,{},{} };
|
||||||
|
|
||||||
float window_aspect_ratio = static_cast<float>(height) / width;
|
float window_aspect_ratio = static_cast<float>(height) / width;
|
||||||
float emulation_aspect_ratio = static_cast<float>(VideoCore::kScreenTopHeight * 2) /
|
float emulation_aspect_ratio = static_cast<float>(VideoCore::kScreenTopHeight * 2) /
|
||||||
@ -139,4 +138,4 @@ EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(u
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,17 @@
|
|||||||
#include "core/hle/service/hid/hid_spvr.h"
|
#include "core/hle/service/hid/hid_spvr.h"
|
||||||
#include "core/hle/service/hid/hid_user.h"
|
#include "core/hle/service/hid/hid_user.h"
|
||||||
|
|
||||||
|
#include "input_core\input_core.h"
|
||||||
|
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/event.h"
|
#include "core/hle/kernel/event.h"
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
#include "input_core\input_core.h"
|
|
||||||
|
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
namespace HID {
|
namespace HID {
|
||||||
|
|
||||||
// Handle to shared memory region designated to HID_User service
|
// Handle to shared memory region designated to HID_User service
|
||||||
static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
|
static Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
|
||||||
|
|
||||||
@ -67,10 +69,6 @@ namespace Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if (shared_mem == nullptr) {
|
|
||||||
LOG_DEBUG(Service_HID, "shared_mem is null!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
||||||
|
|
||||||
if (mem == nullptr) {
|
if (mem == nullptr) {
|
||||||
@ -194,7 +192,7 @@ namespace Service {
|
|||||||
|
|
||||||
cmd_buff[1] = 0; // No error
|
cmd_buff[1] = 0; // No error
|
||||||
cmd_buff[2] = 0x14000000; // IPC Command Structure translate-header
|
cmd_buff[2] = 0x14000000; // IPC Command Structure translate-header
|
||||||
// TODO(yuriks): Return error from SendSyncRequest is this fails (part of IPC marshalling)
|
// TODO(yuriks): Return error from SendSyncRequest is this fails (part of IPC marshalling)
|
||||||
cmd_buff[3] = Kernel::g_handle_table.Create(Service::HID::shared_mem).MoveFrom();
|
cmd_buff[3] = Kernel::g_handle_table.Create(Service::HID::shared_mem).MoveFrom();
|
||||||
cmd_buff[4] = Kernel::g_handle_table.Create(Service::HID::event_pad_or_touch_1).MoveFrom();
|
cmd_buff[4] = Kernel::g_handle_table.Create(Service::HID::event_pad_or_touch_1).MoveFrom();
|
||||||
cmd_buff[5] = Kernel::g_handle_table.Create(Service::HID::event_pad_or_touch_2).MoveFrom();
|
cmd_buff[5] = Kernel::g_handle_table.Create(Service::HID::event_pad_or_touch_2).MoveFrom();
|
||||||
@ -313,5 +311,7 @@ namespace Service {
|
|||||||
event_gyroscope = nullptr;
|
event_gyroscope = nullptr;
|
||||||
event_debug_pad = nullptr;
|
event_debug_pad = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace HID
|
} // namespace HID
|
||||||
} // namespace Service
|
|
||||||
|
} // namespace Service
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
|
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
|
||||||
Regs g_regs;
|
Regs g_regs;
|
||||||
|
|
||||||
/// True if the current frame was skipped
|
/// True if the current frame was skipped
|
||||||
@ -100,6 +102,7 @@ namespace GPU {
|
|||||||
g_regs[index] = static_cast<u32>(data);
|
g_regs[index] = static_cast<u32>(data);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
|
|
||||||
// Memory fills are triggered once the fill value is written.
|
// Memory fills are triggered once the fill value is written.
|
||||||
case GPU_REG_INDEX_WORKAROUND(memory_fill_config[0].trigger, 0x00004 + 0x3):
|
case GPU_REG_INDEX_WORKAROUND(memory_fill_config[0].trigger, 0x00004 + 0x3):
|
||||||
case GPU_REG_INDEX_WORKAROUND(memory_fill_config[1].trigger, 0x00008 + 0x3):
|
case GPU_REG_INDEX_WORKAROUND(memory_fill_config[1].trigger, 0x00008 + 0x3):
|
||||||
@ -173,6 +176,7 @@ namespace GPU {
|
|||||||
|
|
||||||
const auto& config = g_regs.display_transfer_config;
|
const auto& config = g_regs.display_transfer_config;
|
||||||
if (config.trigger & 1) {
|
if (config.trigger & 1) {
|
||||||
|
|
||||||
if (Pica::g_debug_context)
|
if (Pica::g_debug_context)
|
||||||
Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::IncomingDisplayTransfer, nullptr);
|
Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::IncomingDisplayTransfer, nullptr);
|
||||||
|
|
||||||
@ -480,4 +484,5 @@ namespace GPU {
|
|||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
LOG_DEBUG(HW_GPU, "shutdown OK");
|
LOG_DEBUG(HW_GPU, "shutdown OK");
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user