o switch to v46

This commit is contained in:
David Voswinkel
2009-05-12 22:17:42 +02:00
parent 7a878eab39
commit 8e877d38d4
217 changed files with 1440 additions and 31284 deletions

View File

@@ -147,12 +147,12 @@ void AdvancedSettingsWindow::initializeUi() {
if(part[i] == config.system.input) inputDriver->setCurrentIndex(i);
}
regionAuto->setChecked(snes.config.region == SNES::Autodetect);
regionNTSC->setChecked(snes.config.region == SNES::NTSC);
regionPAL->setChecked (snes.config.region == SNES::PAL);
regionAuto->setChecked(SNES::config.region == SNES::System::Autodetect);
regionNTSC->setChecked(SNES::config.region == SNES::System::NTSC);
regionPAL->setChecked (SNES::config.region == SNES::System::PAL);
portSatellaview->setChecked(snes.config.expansion_port == SNES::ExpansionBSX);
portNone->setChecked (snes.config.expansion_port == SNES::ExpansionNone);
portSatellaview->setChecked(SNES::config.expansion_port == SNES::System::ExpansionBSX);
portNone->setChecked (SNES::config.expansion_port == SNES::System::ExpansionNone);
focusPause->setChecked (config.input.focusPolicy == Configuration::Input::FocusPolicyPauseEmulation);
focusIgnore->setChecked(config.input.focusPolicy == Configuration::Input::FocusPolicyIgnoreInput);
@@ -171,12 +171,12 @@ void AdvancedSettingsWindow::inputDriverChange(int index) {
if(index >= 0) config.system.input = inputDriver->itemText(index).toUtf8().data();
}
void AdvancedSettingsWindow::setRegionAuto() { snes.config.region = SNES::Autodetect; }
void AdvancedSettingsWindow::setRegionNTSC() { snes.config.region = SNES::NTSC; }
void AdvancedSettingsWindow::setRegionPAL() { snes.config.region = SNES::PAL; }
void AdvancedSettingsWindow::setRegionAuto() { SNES::config.region = SNES::System::Autodetect; }
void AdvancedSettingsWindow::setRegionNTSC() { SNES::config.region = SNES::System::NTSC; }
void AdvancedSettingsWindow::setRegionPAL() { SNES::config.region = SNES::System::PAL; }
void AdvancedSettingsWindow::setPortSatellaview() { snes.config.expansion_port = SNES::ExpansionBSX; }
void AdvancedSettingsWindow::setPortNone() { snes.config.expansion_port = SNES::ExpansionNone; }
void AdvancedSettingsWindow::setPortSatellaview() { SNES::config.expansion_port = SNES::System::ExpansionBSX; }
void AdvancedSettingsWindow::setPortNone() { SNES::config.expansion_port = SNES::System::ExpansionNone; }
void AdvancedSettingsWindow::pauseWithoutFocus() { config.input.focusPolicy = Configuration::Input::FocusPolicyPauseEmulation; }
void AdvancedSettingsWindow::ignoreInputWithoutFocus() { config.input.focusPolicy = Configuration::Input::FocusPolicyIgnoreInput; }

View File

@@ -1,54 +0,0 @@
class AdvancedSettingsWindow : public QObject {
Q_OBJECT
public:
QWidget *panel;
QVBoxLayout *layout;
QLabel *title;
QGridLayout *driverLayout;
QLabel *videoLabel;
QLabel *audioLabel;
QLabel *inputLabel;
QComboBox *videoDriver;
QComboBox *audioDriver;
QComboBox *inputDriver;
QLabel *driverInfo;
QLabel *regionTitle;
QHBoxLayout *regionLayout;
QButtonGroup *regionGroup;
QRadioButton *regionAuto;
QRadioButton *regionNTSC;
QRadioButton *regionPAL;
QLabel *portTitle;
QHBoxLayout *portLayout;
QButtonGroup *portGroup;
QRadioButton *portSatellaview;
QRadioButton *portNone;
QWidget *portSpacer;
QLabel *focusTitle;
QHBoxLayout *focusLayout;
QButtonGroup *focusButtonGroup;
QRadioButton *focusPause;
QRadioButton *focusIgnore;
QRadioButton *focusAllow;
QWidget *spacer;
void setup();
void initializeUi();
public slots:
void videoDriverChange(int index);
void audioDriverChange(int index);
void inputDriverChange(int index);
void setRegionAuto();
void setRegionNTSC();
void setRegionPAL();
void setPortSatellaview();
void setPortNone();
void pauseWithoutFocus();
void ignoreInputWithoutFocus();
void allowInputWithoutFocus();
} *winAdvancedSettings;

View File

@@ -1,28 +0,0 @@
class AudioSettingsWindow : public QObject {
Q_OBJECT
public:
QWidget *panel;
QVBoxLayout *layout;
QLabel *title;
QHBoxLayout *boxes;
QLabel *frequencyLabel;
QComboBox *frequency;
QLabel *latencyLabel;
QComboBox *latency;
QGridLayout *sliders;
QLabel *volumeLabel;
QSlider *volume;
QLabel *frequencySkewLabel;
QSlider *frequencySkew;
QWidget *spacer;
void setup();
void syncUi();
public slots:
void frequencyChange(int value);
void latencyChange(int value);
void volumeAdjust(int value);
void frequencySkewAdjust(int value);
} *winAudioSettings;

View File

@@ -42,10 +42,10 @@ void CheatEditorWindow::setup() {
}
void CheatEditorWindow::syncUi() {
addCode->setEnabled(cartridge.loaded());
addCode->setEnabled(SNES::cartridge.loaded());
QList<QTreeWidgetItem*> itemList = list->selectedItems();
editCode->setEnabled(cartridge.loaded() && itemList.count() == 1);
deleteCode->setEnabled(cartridge.loaded() && itemList.count() == 1);
editCode->setEnabled(SNES::cartridge.loaded() && itemList.count() == 1);
deleteCode->setEnabled(SNES::cartridge.loaded() && itemList.count() == 1);
}
//called when loading a new game, or after adding / deleting a code:
@@ -57,10 +57,10 @@ void CheatEditorWindow::reloadList() {
list->setSortingEnabled(false);
listItem.reset();
if(cartridge.loaded()) {
for(unsigned i = 0; i < cheat.count(); i++) {
Cheat::cheat_t code;
cheat.get(i, code);
if(SNES::cartridge.loaded()) {
for(unsigned i = 0; i < SNES::cheat.count(); i++) {
SNES::Cheat::cheat_t code;
SNES::cheat.get(i, code);
//only want to show one code / description line in list
lstring lcode, ldesc;
@@ -91,8 +91,8 @@ void CheatEditorWindow::updateList() {
disconnect(list, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*)));
for(unsigned i = 0; i < listItem.size(); i++) {
Cheat::cheat_t code;
cheat.get(i, code);
SNES::Cheat::cheat_t code;
SNES::cheat.get(i, code);
//only want to show one code / description line in list
lstring lcode, ldesc;
@@ -116,7 +116,7 @@ void CheatEditorWindow::updateList() {
//called when item enabled checkbox was clicked (eg cheat code enable state was toggled on or off)
void CheatEditorWindow::itemChanged(QTreeWidgetItem *item) {
signed i = listItem.find(item);
if(i >= 0) item->checkState(1) == Qt::Checked ? cheat.enable(i) : cheat.disable(i);
if(i >= 0) item->checkState(1) == Qt::Checked ? SNES::cheat.enable(i) : SNES::cheat.disable(i);
}
void CheatEditorWindow::listChanged() {
@@ -124,11 +124,11 @@ void CheatEditorWindow::listChanged() {
}
void CheatEditorWindow::addNewCode() {
if(cartridge.loaded()) winCodeEditor->addCode();
if(SNES::cartridge.loaded()) winCodeEditor->addCode();
}
void CheatEditorWindow::editSelectedCode() {
if(cartridge.loaded()) {
if(SNES::cartridge.loaded()) {
QTreeWidgetItem *item = list->currentItem();
if(item && item->isSelected()) {
signed i = listItem.find(item);
@@ -138,7 +138,7 @@ void CheatEditorWindow::editSelectedCode() {
}
void CheatEditorWindow::deleteSelectedCode() {
if(cartridge.loaded()) {
if(SNES::cartridge.loaded()) {
QTreeWidgetItem *item = list->currentItem();
if(item && item->isSelected()) {
signed i = listItem.find(item);
@@ -148,7 +148,7 @@ void CheatEditorWindow::deleteSelectedCode() {
if(winCodeEditor->activeCode >= 0) winCodeEditor->dismiss();
//remove code, and resync listItem with cheat list
cheat.remove(i);
SNES::cheat.remove(i);
reloadList();
}
}

View File

@@ -1,28 +0,0 @@
class CheatEditorWindow : public QObject {
Q_OBJECT
public:
QWidget *panel;
QVBoxLayout *layout;
QLabel *title;
QTreeWidget *list;
QHBoxLayout *controls;
QPushButton *addCode;
QPushButton *editCode;
QPushButton *deleteCode;
void setup();
void syncUi();
void reloadList();
void updateList();
public slots:
void itemChanged(QTreeWidgetItem *item);
void listChanged();
void addNewCode();
void editSelectedCode();
void deleteSelectedCode();
private:
array<QTreeWidgetItem*> listItem;
} *winCheatEditor;

View File

@@ -1,32 +0,0 @@
class InputSettingsWindow : public QObject {
Q_OBJECT
public:
QWidget *panel;
QVBoxLayout *layout;
QLabel *title;
QHBoxLayout *selection;
QComboBox *port;
QComboBox *device;
QTreeWidget *list;
QHBoxLayout *controls;
QPushButton *assign;
QPushButton *assignAll;
QPushButton *unassign;
void setup();
void syncUi();
public slots:
void portChanged();
void reloadList();
void listChanged();
void updateList();
void assignKey();
void assignAllKeys();
void unassignKey();
private:
array<InputGroup*> deviceItem;
array<QTreeWidgetItem*> listItem;
} *winInputSettings;

View File

@@ -127,74 +127,74 @@ void PathSettingsWindow::setup() {
}
void PathSettingsWindow::syncUi() {
gamePath->setText (snes.config.path.rom == "" ? "<startup path>" : (const char*)snes.config.path.rom);
savePath->setText (snes.config.path.save == "" ? "<same folder as loaded game>" : (const char*)snes.config.path.save);
patchPath->setText(snes.config.path.patch == "" ? "<same folder as loaded game>" : (const char*)snes.config.path.patch);
cheatPath->setText(snes.config.path.cheat == "" ? "<same folder as loaded game>" : (const char*)snes.config.path.cheat);
dataPath->setText (snes.config.path.data == "" ? "<same folder as loaded game>" : (const char*)snes.config.path.data);
gamePath->setText (config.path.rom == "" ? "<startup path>" : (const char*)config.path.rom);
savePath->setText (config.path.save == "" ? "<same folder as loaded game>" : (const char*)config.path.save);
patchPath->setText(config.path.patch == "" ? "<same folder as loaded game>" : (const char*)config.path.patch);
cheatPath->setText(config.path.cheat == "" ? "<same folder as loaded game>" : (const char*)config.path.cheat);
dataPath->setText (config.path.data == "" ? "<same folder as loaded game>" : (const char*)config.path.data);
}
void PathSettingsWindow::selectGamePath() {
string path = utility.selectFolder("Default Game Path");
if(path.length() > 0) {
snes.config.path.rom = path;
config.path.rom = path;
syncUi();
}
}
void PathSettingsWindow::defaultGamePath() {
snes.config.path.rom = "";
config.path.rom = "";
syncUi();
}
void PathSettingsWindow::selectSavePath() {
string path = utility.selectFolder("Default Save RAM Path");
if(path.length() > 0) {
snes.config.path.save = path;
config.path.save = path;
syncUi();
}
}
void PathSettingsWindow::defaultSavePath() {
snes.config.path.save = "";
config.path.save = "";
syncUi();
}
void PathSettingsWindow::selectPatchPath() {
string path = utility.selectFolder("Default UPS Patch Path");
if(path.length() > 0) {
snes.config.path.patch = path;
config.path.patch = path;
syncUi();
}
}
void PathSettingsWindow::defaultPatchPath() {
snes.config.path.patch = "";
config.path.patch = "";
syncUi();
}
void PathSettingsWindow::selectCheatPath() {
string path = utility.selectFolder("Default Cheat File Path");
if(path.length() > 0) {
snes.config.path.cheat = path;
config.path.cheat = path;
syncUi();
}
}
void PathSettingsWindow::defaultCheatPath() {
snes.config.path.cheat = "";
config.path.cheat = "";
syncUi();
}
void PathSettingsWindow::selectDataPath() {
string path = utility.selectFolder("Default Export Data Path");
if(path.length() > 0) {
snes.config.path.data = path;
config.path.data = path;
syncUi();
}
}
void PathSettingsWindow::defaultDataPath() {
snes.config.path.data = "";
config.path.data = "";
syncUi();
}

View File

@@ -1,49 +0,0 @@
class PathSettingsWindow : public QObject {
Q_OBJECT
public:
QWidget *panel;
QVBoxLayout *layout;
QLabel *title;
QLabel *gameLabel;
QHBoxLayout *games;
QLineEdit *gamePath;
QPushButton *gameSelect;
QPushButton *gameDefault;
QLabel *saveLabel;
QHBoxLayout *saves;
QLineEdit *savePath;
QPushButton *saveSelect;
QPushButton *saveDefault;
QLabel *patchLabel;
QHBoxLayout *patches;
QLineEdit *patchPath;
QPushButton *patchSelect;
QPushButton *patchDefault;
QLabel *cheatLabel;
QHBoxLayout *cheats;
QLineEdit *cheatPath;
QPushButton *cheatSelect;
QPushButton *cheatDefault;
QLabel *dataLabel;
QHBoxLayout *data;
QLineEdit *dataPath;
QPushButton *dataSelect;
QPushButton *dataDefault;
QWidget *spacer;
void setup();
void syncUi();
public slots:
void selectGamePath();
void defaultGamePath();
void selectSavePath();
void defaultSavePath();
void selectPatchPath();
void defaultPatchPath();
void selectCheatPath();
void defaultCheatPath();
void selectDataPath();
void defaultDataPath();
} *winPathSettings;

View File

@@ -1,31 +0,0 @@
#include "video.moc"
#include "audio.moc"
#include "input.moc"
#include "paths.moc"
#include "cheateditor.moc"
#include "advanced.moc"
#include "utility/inputcapture.moc"
#include "utility/codeeditor.moc"
class SettingsWindow : public QObject {
Q_OBJECT
public:
QWidget *window;
QHBoxLayout *layout;
QListWidget *list;
QListWidgetItem *video;
QListWidgetItem *audio;
QListWidgetItem *input;
QListWidgetItem *paths;
QListWidgetItem *cheatcodes;
QListWidgetItem *advanced;
QWidget *panel;
QStackedLayout *panelLayout;
void setup();
public slots:
void listChanged();
} *winSettings;

View File

@@ -75,8 +75,8 @@ void CodeEditorWindow::setup() {
void CodeEditorWindow::syncUi() {
//only activate add button when code is valid
string code = codeValue->text().toUtf8().data();
Cheat::cheat_t temp;
bool valid = cheat.decode(code, temp);
SNES::Cheat::cheat_t temp;
bool valid = SNES::cheat.decode(code, temp);
codeAdd->setEnabled(valid);
//only activate delete button when a code is selected
@@ -93,8 +93,8 @@ void CodeEditorWindow::codeChanged() { syncUi(); }
void CodeEditorWindow::addCodeToList() {
string code = codeValue->text().toUtf8().data();
Cheat::cheat_t temp;
if(cheat.decode(code, temp) == true) codeList->addItem(utf8() << code);
SNES::Cheat::cheat_t temp;
if(SNES::cheat.decode(code, temp) == true) codeList->addItem(utf8() << code);
syncUi();
}
@@ -122,15 +122,15 @@ void CodeEditorWindow::accept() {
if(activeCode == -1) {
//adding a new code
cheat.add(enabled->isChecked(), code, desc);
SNES::cheat.add(enabled->isChecked(), code, desc);
winCheatEditor->reloadList();
} else if(codeList->count() > 0) {
//editing an existing code
cheat.edit(activeCode, enabled->isChecked(), code, desc);
SNES::cheat.edit(activeCode, enabled->isChecked(), code, desc);
winCheatEditor->updateList();
} else {
//deleting an existing code
cheat.remove(activeCode);
SNES::cheat.remove(activeCode);
winCheatEditor->reloadList();
}
@@ -156,8 +156,8 @@ void CodeEditorWindow::editCode(unsigned code) {
codeList->clear();
codeValue->setText("");
Cheat::cheat_t item;
cheat.get(activeCode, item);
SNES::Cheat::cheat_t item;
SNES::cheat.get(activeCode, item);
description->setPlainText(utf8() << item.desc);

View File

@@ -1,43 +0,0 @@
class CodeEditorWindow : public QObject {
Q_OBJECT
public:
QWidget *window;
QVBoxLayout *layout;
QLabel *descLabel;
QTextEdit *description;
QLabel *codeLabel;
QHBoxLayout *codeLayout;
QListWidget *codeList;
QVBoxLayout *controls;
QLineEdit *codeValue;
QPushButton *codeAdd;
QPushButton *codeDelete;
QPushButton *codeDeleteAll;
QWidget *spacer;
QCheckBox *enabled;
QHBoxLayout *finishControls;
QPushButton *okButton;
QPushButton *cancelButton;
void setup();
void syncUi();
void addCode();
void editCode(unsigned code);
CodeEditorWindow();
public slots:
void listChanged();
void codeChanged();
void addCodeToList();
void deleteCodeFromList();
void deleteAllCodesFromList();
void accept();
void dismiss();
private:
signed activeCode;
void showWindow(const char *title);
friend class CheatEditorWindow;
} *winCodeEditor;

View File

@@ -37,8 +37,8 @@ void InputCaptureWindow::setup() {
connect(mouseAxes, SIGNAL(released()), this, SLOT(assignMouseAxis()));
connect(mouseButtons, SIGNAL(released()), this, SLOT(assignMouseButton()));
winInputMouseCaptureWindow = new InputMouseCaptureWindow;
winInputMouseCaptureWindow->setup();
winInputMouseCapture = new InputMouseCaptureWindow;
winInputMouseCapture->setup();
winInputCalibration = new InputCalibrationWindow;
winInputCalibration->setup();
@@ -96,8 +96,8 @@ void InputCaptureWindow::inputEvent(uint16_t code, bool forceAssign /* = false *
//input polling is global, need to block mouse actions that may be UI interactions.
//custom controls on window allow mouse assignment instead.
if(forceAssign == false) {
if(winInputMouseCaptureWindow->window->isActiveWindow()) {
winInputMouseCaptureWindow->inputEvent(code);
if(winInputMouseCapture->window->isActiveWindow()) {
winInputMouseCapture->inputEvent(code);
return;
}
if(!window->isActiveWindow()) return;
@@ -205,7 +205,7 @@ void InputCaptureWindow::inputEvent(uint16_t code, bool forceAssign /* = false *
if(!activeGroup) {
window->hide();
winInputMouseCaptureWindow->window->hide();
winInputMouseCapture->window->hide();
} else {
//try and map the next code in this input group
groupIndex++;
@@ -214,7 +214,7 @@ void InputCaptureWindow::inputEvent(uint16_t code, bool forceAssign /* = false *
} else {
//all group codes mapped
window->hide();
winInputMouseCaptureWindow->window->hide();
winInputMouseCapture->window->hide();
activeGroup = 0;
}
}
@@ -224,12 +224,12 @@ void InputCaptureWindow::assignMouseAxis() {
//refresh input state so that mouse release event (from SIGNAL(released())
//is not sent immediately after window is visible.
inputManager.refresh();
winInputMouseCaptureWindow->activate(InputMouseCaptureWindow::AxisMode);
winInputMouseCapture->activate(InputMouseCaptureWindow::AxisMode);
}
void InputCaptureWindow::assignMouseButton() {
inputManager.refresh();
winInputMouseCaptureWindow->activate(InputMouseCaptureWindow::ButtonMode);
winInputMouseCapture->activate(InputMouseCaptureWindow::ButtonMode);
}
InputCaptureWindow::InputCaptureWindow() {
@@ -243,6 +243,9 @@ void InputCaptureWindow::Window::closeEvent(QCloseEvent*) {
//window closed by user, cancel key assignment
winInputCapture->activeObject = 0;
winInputCapture->activeGroup = 0;
winInputMouseCapture->window->hide();
winInputCalibration->dismiss();
}
void InputCaptureWindow::ImageWidget::paintEvent(QPaintEvent*) {
@@ -452,3 +455,7 @@ void InputCalibrationWindow::dismiss() {
void InputCalibrationWindow::Window::closeEvent(QCloseEvent*) {
winInputCalibration->dismiss();
}
InputCalibrationWindow::InputCalibrationWindow() {
activeJoypad = -1;
}

View File

@@ -1,88 +0,0 @@
class InputCaptureWindow : public QObject {
Q_OBJECT
public:
struct Window : public QWidget {
void closeEvent(QCloseEvent*);
} *window;
QVBoxLayout *layout;
QHBoxLayout *hlayout;
QLabel *title;
QPushButton *mouseAxes;
QPushButton *mouseButtons;
QWidget *imageSpacer;
struct ImageWidget : public QWidget {
void paintEvent(QPaintEvent*);
} *imageWidget;
QWidget *spacer;
void setup();
void activate(InputObject *object);
void activate(InputGroup *group);
void inputEvent(uint16_t code, bool forceAssign = false);
InputCaptureWindow();
public slots:
void assignMouseAxis();
void assignMouseButton();
private:
InputObject *activeObject;
InputGroup *activeGroup;
unsigned groupIndex;
bool inputLock;
friend class InputCaptureWindow::Window;
} *winInputCapture;
class InputMouseCaptureWindow : public QObject {
Q_OBJECT
public:
enum Mode { AxisMode, ButtonMode };
QWidget *window;
QVBoxLayout *layout;
QLabel *info;
QLabel *captureBox;
QHBoxLayout *buttonLayout;
QPushButton *xAxis;
QPushButton *yAxis;
QWidget *spacer;
void setup();
void activate(Mode);
void inputEvent(uint16_t code);
public slots:
void assignAxisX();
void assignAxisY();
private:
Mode activeMode;
signed activeMouse;
} *winInputMouseCaptureWindow;
class InputCalibrationWindow : public QObject {
Q_OBJECT
public:
struct Window : public QWidget {
void closeEvent(QCloseEvent*);
} *window;
QVBoxLayout *layout;
QLabel *info;
QPushButton *ok;
QWidget *spacer;
void setup();
void activate(unsigned joy);
public slots:
void dismiss();
private:
int activeJoypad;
friend class InputCalibrationWindow::Window;
} *winInputCalibration;

View File

@@ -1,29 +0,0 @@
class VideoSettingsWindow : public QObject {
Q_OBJECT
public:
QWidget *panel;
QVBoxLayout *layout;
QLabel *title;
QGridLayout *sliders;
QLabel *lcontrast;
QSlider *contrast;
QLabel *lbrightness;
QSlider *brightness;
QLabel *lgamma;
QSlider *gamma;
QHBoxLayout *options;
QCheckBox *enableGammaRamp;
QCheckBox *enableNtscMergeFields;
QWidget *spacer;
void setup();
void syncUi();
public slots:
void gammaRampToggle(int);
void ntscFieldsToggle(int);
void contrastAdjust(int);
void brightnessAdjust(int);
void gammaAdjust(int);
} *winVideoSettings;