mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Merge pull request #19645 from hrydgard/more-buffer-opt
Some checks failed
Build / build-windows (ARM64) (push) Has been cancelled
Build / build-windows (x64) (push) Has been cancelled
Build / build-uwp (push) Has been cancelled
Build / build (./b.sh --headless --unittest --fat --no-png --no-sdl2, clang, clang++, test, macos, macos-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, clang, clang++, test, clang-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, gcc, g++, gcc-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --ios, clang, clang++, ios, ios, macos-latest) (push) Has been cancelled
Build / build (./b.sh --libretro_android ppsspp_libretro, clang, clang++, android, android-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --qt, gcc, g++, qt, qt, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a OPENXR=1, clang, clang++, android, android-vr, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm64, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm32, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1, clang, clang++, android, android-x86_64, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, clang, clang++, libretro, clang-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, gcc, g++, libretro, gcc-libretro, ubuntu-latest) (push) Has been cancelled
Build / build_test_headless_alpine (push) Has been cancelled
Generate Docker Layer / build (push) Has been cancelled
Build / test-windows (push) Has been cancelled
Build / test (macos-latest) (push) Has been cancelled
Build / test (ubuntu-latest) (push) Has been cancelled
Some checks failed
Build / build-windows (ARM64) (push) Has been cancelled
Build / build-windows (x64) (push) Has been cancelled
Build / build-uwp (push) Has been cancelled
Build / build (./b.sh --headless --unittest --fat --no-png --no-sdl2, clang, clang++, test, macos, macos-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, clang, clang++, test, clang-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, gcc, g++, gcc-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --ios, clang, clang++, ios, ios, macos-latest) (push) Has been cancelled
Build / build (./b.sh --libretro_android ppsspp_libretro, clang, clang++, android, android-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --qt, gcc, g++, qt, qt, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a OPENXR=1, clang, clang++, android, android-vr, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm64, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm32, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1, clang, clang++, android, android-x86_64, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, clang, clang++, libretro, clang-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, gcc, g++, libretro, gcc-libretro, ubuntu-latest) (push) Has been cancelled
Build / build_test_headless_alpine (push) Has been cancelled
Generate Docker Layer / build (push) Has been cancelled
Build / test-windows (push) Has been cancelled
Build / test (macos-latest) (push) Has been cancelled
Build / test (ubuntu-latest) (push) Has been cancelled
Optimize Buffer slightly more, fix using touchscreen controls using the mouse
This commit is contained in:
commit
21ffc37ebd
@ -95,13 +95,13 @@ int Buffer::SkipLineCRLF() {
|
|||||||
|
|
||||||
// This relies on having buffered data!
|
// This relies on having buffered data!
|
||||||
int Buffer::OffsetToAfterNextCRLF() {
|
int Buffer::OffsetToAfterNextCRLF() {
|
||||||
for (int i = 0; i < (int)data_.size() - 1; i++) {
|
int offset = data_.next_crlf_offset();
|
||||||
if (data_.peek(i) == '\r' && data_.peek(i + 1) == '\n') {
|
if (offset >= 0) {
|
||||||
return i + 2;
|
return offset + 2;
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Buffer::Printf(const char *fmt, ...) {
|
void Buffer::Printf(const char *fmt, ...) {
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
|
@ -186,6 +186,27 @@ public:
|
|||||||
head_ = b;
|
head_ = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If return value is negative, one wasn't found.
|
||||||
|
int next_crlf_offset() {
|
||||||
|
int offset = 0;
|
||||||
|
Block *b = head_;
|
||||||
|
do {
|
||||||
|
int remain = b->tail - b->head;
|
||||||
|
for (int i = 0; i < remain; i++) {
|
||||||
|
if (b->data[b->head + i] == '\r') {
|
||||||
|
// Use peek to avoid handling edge cases.
|
||||||
|
if (peek(offset + i + 1) == '\n') {
|
||||||
|
return offset + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
offset += remain;
|
||||||
|
b = b->next;
|
||||||
|
} while (b);
|
||||||
|
// Ran out of data.
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Block {
|
struct Block {
|
||||||
~Block() {
|
~Block() {
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
#define MSG_NOSIGNAL 0x00
|
#define MSG_NOSIGNAL 0x00
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _MSC_VER
|
||||||
|
#pragma warning(disable:4267)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "Common/File/FileDescriptor.h"
|
#include "Common/File/FileDescriptor.h"
|
||||||
#include "Common/Log.h"
|
#include "Common/Log.h"
|
||||||
#include "Common/Net/NetBuffer.h"
|
#include "Common/Net/NetBuffer.h"
|
||||||
@ -118,7 +122,7 @@ bool Buffer::ReadAllWithProgress(int fd, int knownSize, RequestProgress *progres
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Buffer::Read(int fd, size_t sz) {
|
int Buffer::Read(int fd, size_t sz) {
|
||||||
char buf[1024];
|
char buf[4096];
|
||||||
int retval;
|
int retval;
|
||||||
size_t received = 0;
|
size_t received = 0;
|
||||||
while ((retval = recv(fd, buf, std::min(sz, sizeof(buf)), MSG_NOSIGNAL)) > 0) {
|
while ((retval = recv(fd, buf, std::min(sz, sizeof(buf)), MSG_NOSIGNAL)) > 0) {
|
||||||
|
@ -107,11 +107,13 @@ bool MultiTouchButton::Touch(const TouchInput &input) {
|
|||||||
usedPointerMask |= 1 << input.id;
|
usedPointerMask |= 1 << input.id;
|
||||||
}
|
}
|
||||||
if (input.flags & TOUCH_MOVE) {
|
if (input.flags & TOUCH_MOVE) {
|
||||||
|
if (!(input.flags & TOUCH_MOUSE) || input.buttons) {
|
||||||
if (bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id)))
|
if (bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id)))
|
||||||
pointerDownMask_ |= 1 << input.id;
|
pointerDownMask_ |= 1 << input.id;
|
||||||
else
|
else
|
||||||
pointerDownMask_ &= ~(1 << input.id);
|
pointerDownMask_ &= ~(1 << input.id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (input.flags & TOUCH_UP) {
|
if (input.flags & TOUCH_UP) {
|
||||||
pointerDownMask_ &= ~(1 << input.id);
|
pointerDownMask_ &= ~(1 << input.id);
|
||||||
usedPointerMask &= ~(1 << input.id);
|
usedPointerMask &= ~(1 << input.id);
|
||||||
@ -291,6 +293,7 @@ bool PSPDpad::Touch(const TouchInput &input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input.flags & TOUCH_MOVE) {
|
if (input.flags & TOUCH_MOVE) {
|
||||||
|
if (!(input.flags & TOUCH_MOUSE) || input.buttons) {
|
||||||
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id))) {
|
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id))) {
|
||||||
dragPointerId_ = input.id;
|
dragPointerId_ = input.id;
|
||||||
}
|
}
|
||||||
@ -298,6 +301,7 @@ bool PSPDpad::Touch(const TouchInput &input) {
|
|||||||
ProcessTouch(input.x, input.y, true);
|
ProcessTouch(input.x, input.y, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (input.flags & TOUCH_UP) {
|
if (input.flags & TOUCH_UP) {
|
||||||
if (input.id == dragPointerId_) {
|
if (input.id == dragPointerId_) {
|
||||||
dragPointerId_ = -1;
|
dragPointerId_ = -1;
|
||||||
|
@ -1076,6 +1076,10 @@ bool TestCharQueue() {
|
|||||||
queue.pop_front_bulk(dest, 4);
|
queue.pop_front_bulk(dest, 4);
|
||||||
EXPECT_EQ_MEM(dest, "opqr", 4);
|
EXPECT_EQ_MEM(dest, "opqr", 4);
|
||||||
EXPECT_TRUE(queue.empty());
|
EXPECT_TRUE(queue.empty());
|
||||||
|
queue.push_back("asdf");
|
||||||
|
EXPECT_EQ_INT(queue.next_crlf_offset(), -1);
|
||||||
|
queue.push_back("\r\r\n");
|
||||||
|
EXPECT_EQ_INT(queue.next_crlf_offset(), 5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user