Merge branch 'master' into add_menu_key

This commit is contained in:
Megamouse 2025-04-14 06:56:01 +02:00 committed by GitHub
commit 0d900d3e2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 59 additions and 33 deletions

View file

@ -390,14 +390,22 @@ namespace rsx
}
bool ret = false;
for (auto ptr = _data, last = _data + _size - 1; ptr < last; ptr++)
for (auto ptr = _data, last = _data + _size - 1; ptr <= last; ptr++)
{
if (predicate(*ptr))
{
ret = true;
if (ptr == last)
{
// Popping the last entry from list. Just set the new size and exit
_size--;
break;
}
// Move item to the end of the list and shrink by 1
std::memcpy(ptr, last, sizeof(Ty));
last = _data + (--_size);
ret = true;
}
}

View file

@ -4,7 +4,6 @@
#include "Emu/RSX/Common/BufferUtils.h"
#include "Emu/RSX/Common/buffer_stream.hpp"
#include "Emu/RSX/Common/io_buffer.h"
#include "Emu/RSX/Common/simple_array.hpp"
#include "Emu/RSX/NV47/HW/context_accessors.define.h"
#include "Emu/RSX/Program/GLSLCommon.h"
#include "Emu/RSX/rsx_methods.h"
@ -759,7 +758,8 @@ namespace rsx
ensure(draw_call.is_trivial_instanced_draw);
// Temp indirection table. Used to track "running" updates.
rsx::simple_array<u32> instancing_indirection_table;
auto& instancing_indirection_table = m_scratch_buffers.u32buf;
// indirection table size
const auto full_reupload = !prog || prog->has_indexed_constants;
const auto reloc_table = full_reupload ? decltype(prog->constant_ids){} : prog->constant_ids;
@ -767,7 +767,8 @@ namespace rsx
instancing_indirection_table.resize(redirection_table_size);
// Temp constants data
rsx::simple_array<u128> constants_data;
auto& constants_data = m_scratch_buffers.u128buf;
constants_data.clear();
constants_data.reserve(redirection_table_size * draw_call.pass_count());
// Allocate indirection buffer on GPU stream

View file

@ -2,6 +2,7 @@
#include <util/types.hpp>
#include "Emu/RSX/Common/simple_array.hpp"
#include "Emu/RSX/Core/RSXVertexTypes.h"
#include "Emu/RSX/NV47/FW/draw_call.hpp"
#include "Emu/RSX/Program/ProgramStateCache.h"
@ -28,6 +29,12 @@ namespace rsx
std::array<push_buffer_vertex_info, 16> m_vertex_push_buffers;
rsx::simple_array<u32> m_element_push_buffer;
struct
{
rsx::simple_array<u32> u32buf;
rsx::simple_array<u128> u128buf;
} mutable m_scratch_buffers;
public:
draw_command_processor() = default;

View file

@ -18,6 +18,33 @@
LOG_CHANNEL(evdev_log, "evdev");
bool positive_axis::load()
{
if (fs::file cfg_file{ cfg_name, fs::read })
{
return from_string(cfg_file.to_string());
}
from_default();
return false;
}
void positive_axis::save() const
{
fs::pending_file file(cfg_name);
if (file.file)
{
file.file.write(to_string());
file.commit();
}
}
bool positive_axis::exist() const
{
return fs::is_file(cfg_name);
}
evdev_joystick_handler::evdev_joystick_handler()
: PadHandlerBase(pad_handler::evdev)
{
@ -110,7 +137,12 @@ bool evdev_joystick_handler::Init()
if (m_is_init)
return true;
m_pos_axis_config.load();
if (!m_pos_axis_config.load())
{
evdev_log.notice("positive_axis config missing. Using defaults");
}
evdev_log.notice("positive_axis config=\n%s", m_pos_axis_config.to_string());
if (!m_pos_axis_config.exist())
m_pos_axis_config.save();
@ -783,7 +815,7 @@ std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::add
// Let's log axis information while we are in the settings in order to identify problems more easily.
for (const auto& [code, axis_name] : axis_list)
{
if (const input_absinfo *info = libevdev_get_abs_info(dev, code))
if (const input_absinfo* info = libevdev_get_abs_info(dev, code))
{
const char* code_name = libevdev_event_code_get_name(EV_ABS, code);
evdev_log.notice("Axis info for %s: %s (%s) => minimum=%d, maximum=%d, fuzz=%d, flat=%d, resolution=%d",
@ -857,7 +889,7 @@ std::shared_ptr<evdev_joystick_handler::EvdevDevice> evdev_joystick_handler::add
// A device must not mix regular directional axes and accelerometer axes on the same event node.
for (const auto& [code, axis_name] : axis_list)
{
if (const input_absinfo *info = libevdev_get_abs_info(dev, code))
if (const input_absinfo* info = libevdev_get_abs_info(dev, code))
{
const bool is_accel = code == ABS_X || code == ABS_Y || code == ABS_Z;
const char* code_name = libevdev_event_code_get_name(EV_ABS, code);

View file

@ -57,31 +57,9 @@ struct positive_axis : cfg::node
cfg::_bool abs_mt_tool_x{ this, "ABS_MT_TOOL_X", false };
cfg::_bool abs_mt_tool_y{ this, "ABS_MT_TOOL_Y", false };
bool load()
{
if (fs::file cfg_file{ cfg_name, fs::read })
{
return from_string(cfg_file.to_string());
}
return false;
}
void save()
{
fs::pending_file file(cfg_name);
if (file.file)
{
file.file.write(to_string());
file.commit();
}
}
bool exist()
{
return fs::is_file(cfg_name);
}
bool load();
void save() const;
bool exist() const;
};
class evdev_joystick_handler final : public PadHandlerBase