PC-6001VX for IS11T その4

動作確認のため、表参道アドベンチャーでもやってみる。

f:id:tanam:20130428010704p:image:w360

f:id:tanam:20130428010703p:image:w360

ついでに南青山アドベンチャーもやってみる。

f:id:tanam:20130428130712p:image:w360

必要最低限のキーの入力だけを実装して、設定ファイルは「/sdcard」配下に変更して手で書き換えます。

P6Widget.cpp

#include "P6Widget.h"

extern unsigned char *gBuffer;
extern unsigned char *gMatrix;
bool gAlt = false;

P6Widget::P6Widget(QWidget *)
{
    memset(gMatrix, 0xff, 16*2);
}

void P6Widget::keyPressEvent(QKeyEvent *event)
{
    qDebug("%d",event->key());
    if (event->key() == 16777301) gMatrix[3]=0xbf; // MENU
    if (event->key() == 16777248) gMatrix[0]=0xfb; // SHIFT
    if (event->key() == 16777251) { // ALT
        gAlt=!gAlt;
        qDebug("%d",gAlt);
    }
    if (event->key() == Qt::Key_Q) {
        if (gAlt) gMatrix[1]=0xfe; // 1
        else gMatrix[1]=0xfd; // Q
    }
    if (event->key() == Qt::Key_A) {
        if (gAlt) gMatrix[4]=0x7f; // _
        else gMatrix[1]=0xfb; // A
    }
    if (event->key() == Qt::Key_Z) {
          if (gAlt) gMatrix[6]=0xef; // ;
          else gMatrix[1]=0xf7; // Z
    }
    if (event->key() == Qt::Key_K) gMatrix[1]=0xef;
    if (event->key() == Qt::Key_I) {
        if (gAlt) gMatrix[1]=0xbf; // 8
        else gMatrix[1]=0xdf; // I
    }
    if (event->key() == Qt::Key_Comma) gMatrix[1]=0x7f;
    if (event->key() == Qt::Key_W) {
        if (gAlt) gMatrix[2]=0xfe; // 2
        else gMatrix[2]=0xfd; // W
    }
    if (event->key() == Qt::Key_S) {
        if (gAlt) gMatrix[4]=0xdf; // @
        else gMatrix[2]=0xfb; // S
    }
    if (event->key() == Qt::Key_X) {
        if (gAlt) gMatrix[4]=0xef; // :
        else gMatrix[2]=0xf7; // X
    }
    if (event->key() == Qt::Key_L) gMatrix[2]=0xef;
    if (event->key() == Qt::Key_O) {
        if (gAlt) gMatrix[2]=0xbf; // 9
        else gMatrix[2]=0xdf; // O
    }
    if (event->key() == Qt::Key_Period) gMatrix[2]=0x7f;
    if (event->key() == Qt::Key_E) {
        if (gAlt) gMatrix[3]=0xfe; // 3
        else gMatrix[3]=0xfd; // E
    }
    if (event->key() == Qt::Key_D) {
        if (gAlt) gMatrix[7]=0xdf; // YEN
        else gMatrix[3]=0xfb; // D
    }
    if (event->key() == Qt::Key_C) gMatrix[3]=0xf7;
    if (event->key() == Qt::Key_P) {
        if (gAlt) gMatrix[6]=0x7f; // 0
        else gMatrix[3]=0xdf; // P
    }
    if (event->key() == Qt::Key_R) {
        if (gAlt) gMatrix[4]=0xfe; // 4
        else gMatrix[4]=0xfd; // R
    }
    if (event->key() == Qt::Key_F) gMatrix[4]=0xfb;
    if (event->key() == Qt::Key_V) {
        if (gAlt) gMatrix[6]=0xef; // -
        else gMatrix[4]=0xf7; // V
    }
    if (event->key() == Qt::Key_T) {
        if (gAlt) gMatrix[5]=0xfe; // 5
        else gMatrix[5]=0xfd; // T
    }
    if (event->key() == Qt::Key_G) gMatrix[5]=0xfb;
    if (event->key() == Qt::Key_B) gMatrix[5]=0xf7;
    if (event->key() == Qt::Key_Space) gMatrix[5]=0x7f;
    if (event->key() == Qt::Key_Y) {
        if (gAlt) gMatrix[6]=0xfe; // 6
        else gMatrix[6]=0xfd; // Y
    }
    if (event->key() == Qt::Key_H) gMatrix[6]=0xfb;
    if (event->key() == Qt::Key_N) gMatrix[6]=0xf7;
    if (event->key() == Qt::Key_U) {
        if (gAlt) gMatrix[7]=0xfe; // 7
        else gMatrix[7]=0xfd; // U
    }
    if (event->key() == Qt::Key_J) gMatrix[7]=0xfb;
    if (event->key() == Qt::Key_M) gMatrix[7]=0xf7;
    if (event->key() == 16777220) gMatrix[8]=0xfe; // RETURN
    if (event->key() == 0)        gMatrix[8]=0xfd; // STOP
    if (event->key() == 16777235) gMatrix[8]=0xfb; // ↑
    if (event->key() == 16777237) gMatrix[8]=0xf7; // ↓
    if (event->key() == 16777236) gMatrix[8]=0xef; // →
    if (event->key() == 16777234) gMatrix[8]=0xdf; // ←
    if (event->key() == 16777362) gMatrix[8]=0xbf; // TAB
}

void P6Widget::keyReleaseEvent(QKeyEvent *event)
{
      memset(gMatrix, 0xff, 16*2);
}

void P6Widget::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QImage img(static_cast<uchar*>(gBuffer), 720, 540, QImage::Format_RGB16);
    painter.drawPixmap(70,-30, QPixmap::fromImage(img));
    update();
}

osdQt.cpp

const char *OSD_GetConfigPath( void )
{
    PRINTD( OSD_LOG, "[OSD][OSD_GetModulePath]\n" );
    static char mpath[PATH_MAX] = "";	// モジュールパス取得用

    //Windowsの場合はexe本体と同じ場所。
    //それ以外(UNIX系を想定)は ~/.pc6001vx を返す
#ifdef WIN32
    QString confPath = qApp->applicationDirPath() + QDir::separator();
#else
///    QString confPath = QDir::homePath() + QDir::separator() + QString(".pc6001vx");
    QString confPath = QString("/sdcard");
#endif