下雪了

【Retroarch略缩图手动匹配的办法】

*此方法对街机、PS1游戏似乎不起作用,有待探索

对于汉化版的游戏而言,在数据库中没有对应CRC、MD5的文件(能扫描到的必须是原版文件),但是可以将文件命名为对应的版本。

例如:Rockman Zero.gba -> Rockman Zero (Japan).gba

然后,选择菜单中的手动扫描,然后指定文件夹和对应核心:

所有文件无论是否匹配上,都会被加载到游戏列表中,然后手动下载略缩图后,就可以看到对应的图片了:

非常好用~

【Flash】关于在Windows10上重新启用Flash的方法

1.方法汇总①创建 mms.cfg 文件(Flash配置文件,默认情况下安装完Flash是没有这个文件的,需要自己创建来强制配置Flash)

该文件用文本编辑器打开,里面内容如下,意思是配置 允许本机使用Flash打开的站点

EnableAllowList=1AllowListUrlPattern=http://192.168.1.1/

AllowListUrlPattern=https://www.xxx.com/cn

②将编辑好的 mms.cfg 文件,放到以下Flash插件目录下:

C:\Windows\System32\Macromed\Flash\ (32位)

C:\Windows\SysWOW64\Macromed\Flash\ (64位)

③重新打开需要使用Flash插件的站点或者地址,Flash变为可用。

转自:http://www.360doc.com/content/21/0401/05/13253171_970025362.shtml

【Linux】一个简单的makefile模板

CXX = g++
CXXFLAGS = -std=c++17 -Wall -g

HEADERS = -I./include
SRC = ./src
LIBS = -lSDL -lSDL_draw -lSDL_image -lSDL_gfx
OBJS = $(wildcard $(SRC)/*.cpp )


TARGER = main

all:$(TARGER)

main: $(OBJS)
$(CXX) $(CXXFLAGS) $(HEADERS) $(OBJS) -o $(TARGER) $(LIBS)

clean:
rm -rf $(TARGER)

配合一下文件目录结构使用

-projectName

–include

—xxx.h

–src

—xxx.cpp

–makefile

【Qt】窗口拖动代码

来自网上的博客,是通过鼠标相关的事件来实现的,封装起来很方便。

//Widget.h 
#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

class QMouseEvent;
class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = 0);
    ~Widget();

protected:
    //拖拽窗口
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

private:
    bool        m_bDrag;
    QPoint      mouseStartPoint;
    QPoint      windowTopLeftPoint;
};

#endif // WIDGET_H
//Widget.cpp
#include <QMouseEvent>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , m_bDrag(false)
{
    setWindowTitle("窗口拖拽移动");
    setFixedSize(640, 480);
}

Widget::~Widget()
{

}

/* QPoint QMouseEvent::pos() const
    Returns the position of the mouse cursor, relative to the widget that received the event.
    If you move the widget as a result of the mouse event, use the global position returned by globalPos() to avoid a shaking motion.
 */

//拖拽操作
void Widget::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        m_bDrag = true;
        //获得鼠标的初始位置
        mouseStartPoint = event->globalPos();
        //mouseStartPoint = event->pos();
        //获得窗口的初始位置
        windowTopLeftPoint = this->frameGeometry().topLeft();
    }
}

void Widget::mouseMoveEvent(QMouseEvent *event)
{
    if(m_bDrag)
    {
        //获得鼠标移动的距离
        QPoint distance = event->globalPos() - mouseStartPoint;
        //QPoint distance = event->pos() - mouseStartPoint;
        //改变窗口的位置
        this->move(windowTopLeftPoint + distance);
    }
}

void Widget::mouseReleaseEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        m_bDrag = false;
    }
}

 

【Boost】发送/接收HTML请求(Get/Post)

头文件:

#include <boost/asio.hpp>
#include <boost/beast.hpp>
#include <boost/locale.hpp>

具体步骤:

void conn()
{

    try
    {
        //三个基础参数
        string host="zofz.cf";
        string port="80";
        string target="/123/";

        //http版本
        int version = 11;

        //建立基础IO接口,并初始化resolver和socket
        boost::asio::io_service io_se;
        boost::asio::ip::tcp::resolver resolver{ io_se };
        boost::asio::ip::tcp::socket socket{ io_se };

        //设定GET/POST请求
        boost::asio::streambuf request;
        std::ostream request_stream(&request);

        //创建http头,注意格式
        request_stream << "GET " << target << " HTTP/1.1 \r\n";
        request_stream << "Host: " << host << "\r\n";
        request_stream << "Accept: application/json \r\n";
        request_stream << "Accept-Encoding: gzip, deflate, br \r\n";
        request_stream << "Conection: keep-alive \r\n";
        request_stream << "Content-Type: application/x-www-form-urlencoded \r\n";
        request_stream << "User-Agent: " << ua << " \r\n";

        // 发送request
        write(socket, request);

        //声明一个容器来保存响应
        boost::beast::flat_buffer buf;
        response<string_body> resp;
        stringstream ss;

        //接收容器
        read(socket, buf, resp);
        
        //遍历Header
        for(auto &i:resp)
        {
            cout<<i.name()<<i.value()<<endl;
        }
        
        //输出body
        cout<<resp.body()<<endl;
    }
    catch (std::exception const& e)
    {
        //输出错误
        cout<< e.what()<<);
    }
}