Nokia N900 >> Sbox

移植fceu-gui


目前N900可以下載的NES(FC)模擬器有iNES和FCEU兩個,其中只有iNES有支援中文檔名選取,不過iNES使用系統預設的檔案選取對話盒,選取的效能相當差,檔案數量多時,效能真是差到無法想像;而FCEU的選取效能也沒有好到那哪去,因此,司徒打算尋找更好的解決方式,而在使用過gpsp-gui後,司徒已經有了一個目標,那就是移植gpsp-gui,最後,司徒花了一些的時間移植並重新編譯測試,最終完成移植,步驟如下說明。

iNES可以支援中文檔名,不過選取效能很差,加上預設視窗並非全螢幕,而且無法重新對應按鍵,整體的體驗相當差


雖然FCEU-GUI不支援中文檔名,不過預設視窗是全螢幕視窗,爽度還是比較好一些


司徒移植的FCEU-GUI Ex,支援中文檔名以及相當好的選取效能


為何司徒會使用gpspmgui呢?因為在N900上,gpspmgui算是司徒使用過的介面中,擁有最佳的檔案選取介面,字體夠大、圖示夠美、捲動速度夠快以及介面夠簡單等優點,其中以捲動速度夠快最讓司徒滿意,因此,成為司徒的移植首選,目前司徒移植的gpspmgui版本是3.1.6-1版,這個版本是司徒從Maemo Repository取得的最新版程式,使用者也可以使用如下指令編譯測試:

$ cd
$ wget https://github.com/steward-fu/n900/releases/download/v1.1/gpspmgui-3.1.6.7z
$ 7zr x gpspmgui-3.1.6.7z
$ cd gpspmgui-3.1.6
$ qmake
$ make

基本上,編譯的結果必須是成功的,這樣才可以繼續做移植的工作。

修改的檔案:

+++ fceuguiex-0.0.1/src/coredialog.cpp
--- gpspmgui-3.1.6/src/coredialog.cpp
void CoreDialog::load()
{
  // 隱藏Miscellaneous Label(Core configuration)
+ ui->miscLabel->hide();

  // 隱藏Accelerometer Box(Core configuration)
+ ui->accelerometerBox->hide();
 
  // 隱藏Autopause Box(Core configuration)
+ ui->autopauseBox->hide();
 
  // 刪除Sound buffer Button(Core configuration)相關資源
+ //ui->soundBufferButton->setPickSelector(selector);
- ui->soundBufferButton->setPickSelector(selector);
 
  // 支援原始、等比放大和全螢幕顯示
+ //model->appendRow(new QStandardItem(tr("Original")));
+ //model->appendRow(new QStandardItem(tr("Scale to fit")));
+ //model->appendRow(new QStandardItem(tr("Fit entire screen")));
- model->appendRow(new QStandardItem(tr("Double")));
- model->appendRow(new QStandardItem(tr("Triple")));
  
  // 只支援Scanlines和TV Blur效果
+ model->appendRow(new QStandardItem(tr("Scanlines")));
+ model->appendRow(new QStandardItem(tr("TV Blur")));
+ //model->appendRow(new QStandardItem(tr("Eagle2x")));
- model->appendRow(new QStandardItem(tr("Scale2x")));
- model->appendRow(new QStandardItem(tr("Scale3x")));
- model->appendRow(new QStandardItem(tr("Eagle2x")));
  
  // 隱藏Frameskip type Button(Core configuration)
+ ui->frameskipTypeButton->hide();
 
  // 隱藏Frameskip value Button(Core configuration)
+ ui->frameskipValueButton->hide();
 
  // 隱藏Ransom skip Button(Core configuration) 
+ ui->frameskipRandomBox->hide();
 
  // 隱藏Execute before Edit(Core configuration)
+ ui->beforeEdit->hide();
 
  // 隱藏Execute after Edit(Core configuration)
+ ui->afterEdit->hide();

  // 隱藏Custom commands Label(Core configuration)
+ ui->commandsLabel->hide();
}
 
void CoreDialog::save()
{
  // 刪除Sound buffer Button(Core configuration)相關資源
+ //config->soundBuffer     = static_cast<QMaemo5ListPickSelector*>(ui->soundBufferButton->pickSelector())->currentIndex();
- config->soundBuffer     = static_cast<QMaemo5ListPickSelector*>(ui->soundBufferButton->pickSelector())->currentIndex();
}

+++ fceuguiex-0.0.1/src/coredialog.ui
--- gpspmgui-3.1.6/src/coredialog.ui
  // 展開Disable sound Button(Core configuration)
+ <item row="3" column="0" colspan="2">
- <item row="3" column="0">
          
  // 刪除Sound buffer Button(Core configuration)相關資源
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QMaemo5ValueButton" name="soundBufferButton">
- <property name="text">
- <string>Sound buffer</string>
- </property>
- <property name="valueLayout">
- <enum>QMaemo5ValueButton::ValueUnderTextCentered</enum>

+++ fceuguiex-0.0.1/src/gpspmgui.pro
--- gpspmgui-3.1.6/src/gpspmgui.pro // 修改輸出檔名 + TARGET = fceuguiex - TARGET = gpspmgui +++ fceuguiex-0.0.1/src/keysconfig.cpp
--- gpspmgui-3.1.6/src/keysconfig.cpp // 修改按鍵配置 const char* KeysConfig::name[] = { + "RapidA", + "RapidB", - "L", - "R", - "LeftUp", - "RightUp", - "LeftDown", - "RightDown", - "LoadState", - "SaveState", - "FastForward", - "ShowFPS", - "Quit", - "Pause" }; // 修改按鍵顯示名稱 const char* KeysConfig::displayName[] = { + "Rapid A", + "Rapid B", - "L", - "R", - "Left - Up", - "Right - Up", - "Left - Down", - "Right - Down", - "Load State", - "Save State", - "Fast Forward", - "Show FPS", - "Quit", - "Pause" }; +++ fceuguiex-0.0.1/src/keysconfig.h --- gpspmgui-3.1.6/src/keysconfig.h class KeysConfig : public AbstractConfig { // 修改按鍵數量 enum { + RapidA, + RapidB, - L, - R, - Left_Up, - Right_Up, - Left_Down, - Right_Down, - LoadState, - SaveState, - FastForward, - ShowFPS, - Quit, - Pause, }; +++ fceuguiex-0.0.1/src/keysdialog.h --- gpspmgui-3.1.6/src/keysdialog.h // 新增需要的Widget Include File + #include <QMessageBox> + #include <QString> + #include <QProcess> + #include <QDir> + #include <QFile> + #include <QTextStream> +++ fceuguiex-0.0.1/src/launchdialog.cpp --- gpspmgui-3.1.6/src/launchdialog.cpp LaunchDialog::LaunchDialog(QFileInfo romFile, QIcon cover, QWidget *parent) : QDialog(parent), ui(new Ui::LaunchDialog) { // 隱藏Core configuration和Keys configuration + ui->coreConfigButton->hide(); + ui->keysConfigButton->hide(); // 隱藏Custom settings和Custom keys Buttons + ui->customCoreBox->hide(); + ui->customKeysBox->hide(); } void LaunchDialog::configureKeys() { // 不使用鍵盤配置(使用FCEU自帶的鍵盤配置) + //(new KeysDialog(&keysConfig, this))->exec(); - (new KeysDialog(&keysConfig, this))->exec(); } +++ fceuguiex-0.0.1/src/launcher.cpp --- gpspmgui-3.1.6/src/launcher.cpp void Launcher::launch() { // /opt/fceu/fceu -fs x -efxfs x -gg 0 -sound x romFile + cmd << Path::emuExe(); + cmd << "-fs" << QString::number(coreConfig->scale ? 1:0); // 原始螢幕、等比放大和全螢幕768x480 + if(coreConfig->scale == 0){ + cmd << "-xscalefs 1"; + cmd << "-yscalefs 1"; + } + else if(coreConfig->scale == 1){ + cmd << "-xscalefs 2"; + cmd << "-yscalefs 2"; + } + else{ + cmd << "-xscalefs 3"; + cmd << "-yscalefs 2"; + } + cmd << "-efxfs" << QString::number(coreConfig->filter); + cmd << "-gg 0 -bpp 16"; + if(coreConfig->soundDisabled){ + cmd << "-sound 0"; + } + else{ + cmd << "-sound 1"; + } + cmd << quote(romFile); - cmd << Path::emuExe() << quote(romFile) << "--keys" << keysFilePath; - if (coreConfig->accelerometer) cmd << "--accelerometer"; - cmd << "--accelerometer-deadzone" << QString::number(accelerometerConfig->deadzone); - cmd << "--accelerometer-pitch" << QString::number(accelerometerConfig->pitch); - cmd << "--accelerometer-roll" << QString::number(accelerometerConfig->roll); - if (accelerometerConfig->calibrate) cmd << "--accelerometer-calibrate"; - if (coreConfig->autopause) cmd << "--autopause"; - cmd << "--scale" << QString::number(coreConfig->scale); - cmd << "--filter" << QString::number(coreConfig->filter); - cmd << "--frameskip-type" << QString::number(coreConfig->frameskipType); - cmd << "--frameskip-value" << QString::number(coreConfig->frameskipValue); - if (coreConfig->frameskipRandom) cmd << "--random-frameskip"; - if (coreConfig->soundDisabled) cmd << "--no-sound"; - cmd << "--sound-buffer" << QString::number(coreConfig->soundBuffer); } +++ fceuguiex-0.0.1/src/launcher.h --- gpspmgui-3.1.6/src/launcher.h // Debug用的MessageBox + #include <QMessageBox> +++ fceuguiex-0.0.1/src/main.cpp --- gpspmgui-3.1.6/src/main.cpp int main(int argc, char *argv[]) { // 設定專案名稱 + QApplication::setOrganizationName("fceuguiex"); + QApplication::setApplicationName("fceuguiex"); + QApplication::setApplicationVersion("1"); - QApplication::setOrganizationName("gpspmgui"); - QApplication::setApplicationName("gpspmgui"); - QApplication::setApplicationVersion("3"); } +++ fceuguiex-0.0.1/src/mainwindow.cpp --- gpspmgui-3.1.6/src/mainwindow.cpp MainWindow::MainWindow() : ui(new Ui::MainWindow) { // 刪除Accelerometer相關資源 + //connect(ui->accelerometerAction, SIGNAL(triggered()), this, SLOT(openAccelerometerDialog())); - connect(ui->accelerometerAction, SIGNAL(triggered()), this, SLOT(openAccelerometerDialog())); } void MainWindow::listRoms() { // 設定支援的副檔名 + QStringList filters = QStringList() << "*.nes"; - QStringList filters = QStringList() << "*.gba" << "*.zip"; } void MainWindow::openFile() { // 設定支援的副檔名 + QString romFile = QFileDialog::getOpenFileName(this, tr("Select ROM"), Path::romDir(), tr("NES ROMs (*.nes)")); - QString romFile = QFileDialog::getOpenFileName(this, tr("Select ROM"), Path::romDir(), tr("GBA ROMs (*.gba *.zip)")); } void MainWindow::openKeysDialog() { // 不使用鍵盤配置(使用FCEU自帶的鍵盤配置) + //KeysConfig config(Path::cfgFile()); - KeysConfig config(Path::cfgFile()); + //(new KeysDialog(&config, this))->exec(); - (new KeysDialog(&config, this))->exec(); // opt/fceu/fceu -inputcfg gamepad1 dummy + //QDir().mkpath(Path::emuDir()); + //config.write(Path::emuDir() - "keys"); + QString launchFilePath="/home/user/.config/fceuguiex/keylaunch"; + QFile launchFile(launchFilePath); + launchFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream(&launchFile) + << "#!/bin/sh" << "\n" + << "/opt/fceu/fceu -inputcfg gamepad1 dummy" << "\n"; + launchFile.close(); + launchFile.setPermissions(launchFile.permissions() | QFile::ExeOwner); + QProcess::startDetached(launchFilePath); - QDir().mkpath(Path::emuDir()); - config.write(Path::emuDir() - "keys"); } +++ fceuguiex-0.0.1/src/mainwindow.ui --- gpspmgui-3.1.6/src/mainwindow.ui // 移除Accelerometer Button - <addaction name="accelerometerAction"/> - </property> - </action> - <action name="accelerometerAction"> - <property name="text"> - <string>Accelerometer</string> +++ fceuguiex-0.0.1/src/path.h --- gpspmgui-3.1.6/src/path.h static QString emuDir() { // 修改配置檔位置 + return (path.isEmpty() ? getenv("HOME") - QString("/.config") : path) - "/fceuguiex/"; - return (path.isEmpty() ? getenv("HOME") - QString("/.config") : path) - "/gpspm/"; } static QString emuRoot() { // 修改成FCEU路徑 + return "/opt/fceu/"; - return "/opt/gpspm/"; } static QString emuExe() { // 修改成FCEU + return emuRoot() - "fceu"; - return emuRoot() - "gpspm"; } +++ fceuguiex-0.0.1/src/settingsdialog.cpp --- gpspmgui-3.1.6/src/settingsdialog.cpp SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { // 隱藏BIOS Button + ui->biosButton->hide(); + ui->biosClearButton->hide(); } +++ fceuguiex-0.0.1/src/src.pro --- gpspmgui-3.1.6/src/src.pro // 修改專案名稱 + TARGET = fceuguiex - TARGET = gpspmgui

接著覆蓋掉fceu-gui.sh並執行fceu-gui程式即可

執行後,直接列出遊戲列表


四個主選單設定


General settings的設定內容


Core settings的設定內容


支援原始解析度、等比放大和全螢幕


支援的顯示效果


原始解析度


等比放大


全螢幕


返回上一頁