2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
Update to v075r12 release.
byuu says:
phoenix has been completely rewritten from scratch, and bsnes/ui + bsnes/ui-gameboy have been updated to use the new API. Debugger works too. Currently, only phoenix/Qt is completed, and there are two known issues:
1: font sizes of menu items are wrong, I can fix this easily enough
2: there's some sort of multi-second lag when loading games, not sure
what's happening there yet
The new phoenix isn't exactly complete yet, still making some key
changes, and then I'll start on phoenix/Windows and phoenix/GTK+.
The most noticeable difference is that you don't have to give all of the
header paths and PHOENIX_PLATFORM defines when compiling individual GUI
object files. It's only needed for phoenix.cpp itself. The overall
structure of the phoenix source folder is much saner as well for
sync.sh.
I'm really surprised things are working as well as they are for
a two-day power rewrite of an entire phoenix target. The other targets
won't be as bad insofar as the core stuff is completed this time. And
thank god for that, I was about ready to kill myself after writing
dozens of lines like this:
HorizontalSlider::HorizontalSlider() : state(*new State),
base_from_member<pHorizontalSlider&>(*new pHorizontalSlider(*this)),
Widget(base_from_member<pHorizontalSlider&>::value),
p(base_from_member<pHorizontalSlider&>::value) {}
But each platform does have some new, unique problems. phoenix/GTK+ was
acting screwy prior to the rewrite, and will most likely still have
issues. Even more important, one of the major points of this rewrite was
having the new phoenix/core cache widget settings/data, so that I can
destroy and recreate widgets rather than relying on SetParent. This
means that simple copying of the old phoenix/Windows won't work, and
this new method is significantly more involved.
2011-02-15 12:22:37 +00:00
|
|
|
void pHexEdit::setColumns(unsigned columns) {
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setLength(unsigned length) {
|
|
|
|
//add one if last row is not equal to column length (eg only part of the row is present)
|
|
|
|
bool indivisible = hexEdit.state.columns == 0 || (hexEdit.state.length % hexEdit.state.columns) != 0;
|
|
|
|
qtScroll->setRange(0, hexEdit.state.length / hexEdit.state.columns + indivisible - hexEdit.state.rows);
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setOffset(unsigned offset) {
|
|
|
|
locked = true;
|
|
|
|
qtScroll->setSliderPosition(hexEdit.state.offset / hexEdit.state.columns);
|
|
|
|
locked = false;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setRows(unsigned rows) {
|
|
|
|
qtScroll->setPageStep(hexEdit.state.rows);
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::update() {
|
|
|
|
if(!hexEdit.onRead) {
|
|
|
|
qtHexEdit->setPlainText("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned cursorPosition = qtHexEdit->textCursor().position();
|
|
|
|
|
|
|
|
string output;
|
|
|
|
unsigned offset = hexEdit.state.offset;
|
|
|
|
for(unsigned row = 0; row < hexEdit.state.rows; row++) {
|
|
|
|
output.append(hex<8>(offset));
|
|
|
|
output.append(" ");
|
|
|
|
|
|
|
|
string hexdata;
|
|
|
|
string ansidata = " ";
|
|
|
|
|
|
|
|
for(unsigned column = 0; column < hexEdit.state.columns; column++) {
|
|
|
|
if(offset < hexEdit.state.length) {
|
|
|
|
uint8_t data = hexEdit.onRead(offset++);
|
|
|
|
hexdata.append(hex<2>(data));
|
|
|
|
hexdata.append(" ");
|
|
|
|
char buffer[2] = { data >= 0x20 && data <= 0x7e ? (char)data : '.', 0 };
|
|
|
|
ansidata.append(buffer);
|
|
|
|
} else {
|
|
|
|
hexdata.append(" ");
|
|
|
|
ansidata.append(" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
output.append(hexdata);
|
|
|
|
output.append(ansidata);
|
|
|
|
if(offset >= hexEdit.state.length) break;
|
|
|
|
if(row != hexEdit.state.rows - 1) output.append("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
qtHexEdit->setPlainText(QString::fromUtf8(output));
|
|
|
|
QTextCursor cursor = qtHexEdit->textCursor();
|
|
|
|
cursor.setPosition(cursorPosition);
|
|
|
|
qtHexEdit->setTextCursor(cursor);
|
|
|
|
}
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
void pHexEdit::constructor() {
|
Update to v075r12 release.
byuu says:
phoenix has been completely rewritten from scratch, and bsnes/ui + bsnes/ui-gameboy have been updated to use the new API. Debugger works too. Currently, only phoenix/Qt is completed, and there are two known issues:
1: font sizes of menu items are wrong, I can fix this easily enough
2: there's some sort of multi-second lag when loading games, not sure
what's happening there yet
The new phoenix isn't exactly complete yet, still making some key
changes, and then I'll start on phoenix/Windows and phoenix/GTK+.
The most noticeable difference is that you don't have to give all of the
header paths and PHOENIX_PLATFORM defines when compiling individual GUI
object files. It's only needed for phoenix.cpp itself. The overall
structure of the phoenix source folder is much saner as well for
sync.sh.
I'm really surprised things are working as well as they are for
a two-day power rewrite of an entire phoenix target. The other targets
won't be as bad insofar as the core stuff is completed this time. And
thank god for that, I was about ready to kill myself after writing
dozens of lines like this:
HorizontalSlider::HorizontalSlider() : state(*new State),
base_from_member<pHorizontalSlider&>(*new pHorizontalSlider(*this)),
Widget(base_from_member<pHorizontalSlider&>::value),
p(base_from_member<pHorizontalSlider&>::value) {}
But each platform does have some new, unique problems. phoenix/GTK+ was
acting screwy prior to the rewrite, and will most likely still have
issues. Even more important, one of the major points of this rewrite was
having the new phoenix/core cache widget settings/data, so that I can
destroy and recreate widgets rather than relying on SetParent. This
means that simple copying of the old phoenix/Windows won't work, and
this new method is significantly more involved.
2011-02-15 12:22:37 +00:00
|
|
|
qtWidget = qtHexEdit = new QtHexEdit(*this);
|
|
|
|
|
|
|
|
qtHexEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
qtHexEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
|
|
|
|
qtLayout = new QHBoxLayout;
|
|
|
|
qtLayout->setAlignment(Qt::AlignRight);
|
|
|
|
qtLayout->setMargin(0);
|
|
|
|
qtLayout->setSpacing(0);
|
|
|
|
qtHexEdit->setLayout(qtLayout);
|
|
|
|
|
|
|
|
qtScroll = new QScrollBar(Qt::Vertical);
|
|
|
|
qtScroll->setSingleStep(1);
|
|
|
|
qtLayout->addWidget(qtScroll);
|
|
|
|
|
|
|
|
connect(qtScroll, SIGNAL(actionTriggered(int)), SLOT(onScroll()));
|
2011-09-05 03:48:23 +00:00
|
|
|
|
Update to v082r18 release.
byuu says:
There we go, the GUI is nearly feature-complete once again.
All cores now output their native video format (NES={emphasis}{palette},
SNES=BGR555, GameBoy={ bright, normal, darker, darkest }), and are
transformed to RGB555 data that is passed to the video renderer.
The video renderer then uses its internal palette to apply
brightness/contrast/gamma/ramp adjustments and outputs in RGB888 color
space.
This does add in another rendering pass, unfortunately, but it's
a necessary one for universal support.
The plan is to adapt all filters to take RGB555 input, and output RGB555
data as well. By doing this, it will be possible to stack filters.
However, it's a bit complicated: I need to plan how the stacking should
occur (eg we never want to apply scanlines before HQ2x, etc.)
Added input frequency adjustments for all three systems. I can easily
get perfect video/audio sync on all three now, hooray.
Long-term, it seems like we only really need one, and we can do
a video/audio delta to get an adjusted value. But for now, this gets the
job done.
Added audio volume adjust. I left out the balance for now, since it's
obviously impossible to balance the NES' single channel audio (I can
duplicate the channel, and do twice the filtering work, but ... why?)
I replaced NTSC/PAL TV mode selection with an "Enable Overscan"
checkbox. On, you get 240 lines on NES+SNES. Off, you get 224 lines on
NES+SNES.
Also added aspect correction box back. I don't do that gross PAL
distortion shit anymore, sorry PAL people. I just scale up the
54/47*(240/224) aspect correction for overscan off mode.
All memory is loaded and saved now, for all three systems (hooray, now
you can actually play Zelda 1&2.)
Added all of the old bsnes hotkeys, with the exception of capture
screenshot. May add again later. May come up with something a bit
different for extra features.
Re-added the NSS DIP switch setting window. Since geometry is saved,
I didn't want to auto-hide rows, so now you'll see all eight possible
DIPs, and the ones not used are grayed out.
Ultimately, nobody will notice since we only have DIPs for ActRaiser
NSS, and nobody's probably even using the XML file for that anyway.
Whatever, it's nice to have anyway.
Took FitzRoy's advice and single-item combo boxes on the input selection
are disabled, so the user doesn't waste time checking them.
I wanted to leave text so that you know there's not a problem. Qt
disabled radio box items look almost exactly like enabled ones.
Fixed lots of issues in phoenix and extended it a bit. But I was still
having trouble with radio box grouping, so I said fuck it and made the
panels show/hide based instead of append/remove based.
That's all for stuff off the checklist, I did a bunch of other things
I don't recall.
So yeah, I'd say the GUI is 100% usable now. This is my opinion on how
multi-platform GUIs should be done =)
Oh, I figure I should mention, but the NES core is GPLv3, and all future
SNES+GB releases will be as well. It's a move against Microsoft's Metro
store.
2011-09-20 14:04:43 +00:00
|
|
|
pWidget::synchronizeState();
|
2011-09-05 03:48:23 +00:00
|
|
|
setColumns(hexEdit.state.columns);
|
|
|
|
setRows(hexEdit.state.rows);
|
|
|
|
setLength(hexEdit.state.length);
|
|
|
|
setOffset(hexEdit.state.offset);
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::destructor() {
|
|
|
|
delete qtScroll;
|
|
|
|
delete qtLayout;
|
|
|
|
delete qtHexEdit;
|
2013-05-02 11:25:45 +00:00
|
|
|
qtWidget = qtHexEdit = nullptr;
|
|
|
|
qtLayout = nullptr;
|
|
|
|
qtScroll = nullptr;
|
2011-09-05 03:48:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::orphan() {
|
|
|
|
destructor();
|
|
|
|
constructor();
|
Update to v075r12 release.
byuu says:
phoenix has been completely rewritten from scratch, and bsnes/ui + bsnes/ui-gameboy have been updated to use the new API. Debugger works too. Currently, only phoenix/Qt is completed, and there are two known issues:
1: font sizes of menu items are wrong, I can fix this easily enough
2: there's some sort of multi-second lag when loading games, not sure
what's happening there yet
The new phoenix isn't exactly complete yet, still making some key
changes, and then I'll start on phoenix/Windows and phoenix/GTK+.
The most noticeable difference is that you don't have to give all of the
header paths and PHOENIX_PLATFORM defines when compiling individual GUI
object files. It's only needed for phoenix.cpp itself. The overall
structure of the phoenix source folder is much saner as well for
sync.sh.
I'm really surprised things are working as well as they are for
a two-day power rewrite of an entire phoenix target. The other targets
won't be as bad insofar as the core stuff is completed this time. And
thank god for that, I was about ready to kill myself after writing
dozens of lines like this:
HorizontalSlider::HorizontalSlider() : state(*new State),
base_from_member<pHorizontalSlider&>(*new pHorizontalSlider(*this)),
Widget(base_from_member<pHorizontalSlider&>::value),
p(base_from_member<pHorizontalSlider&>::value) {}
But each platform does have some new, unique problems. phoenix/GTK+ was
acting screwy prior to the rewrite, and will most likely still have
issues. Even more important, one of the major points of this rewrite was
having the new phoenix/core cache widget settings/data, so that I can
destroy and recreate widgets rather than relying on SetParent. This
means that simple copying of the old phoenix/Windows won't work, and
this new method is significantly more involved.
2011-02-15 12:22:37 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pHexEdit::keyPressEvent(QKeyEvent* event) {
|
Update to v075r12 release.
byuu says:
phoenix has been completely rewritten from scratch, and bsnes/ui + bsnes/ui-gameboy have been updated to use the new API. Debugger works too. Currently, only phoenix/Qt is completed, and there are two known issues:
1: font sizes of menu items are wrong, I can fix this easily enough
2: there's some sort of multi-second lag when loading games, not sure
what's happening there yet
The new phoenix isn't exactly complete yet, still making some key
changes, and then I'll start on phoenix/Windows and phoenix/GTK+.
The most noticeable difference is that you don't have to give all of the
header paths and PHOENIX_PLATFORM defines when compiling individual GUI
object files. It's only needed for phoenix.cpp itself. The overall
structure of the phoenix source folder is much saner as well for
sync.sh.
I'm really surprised things are working as well as they are for
a two-day power rewrite of an entire phoenix target. The other targets
won't be as bad insofar as the core stuff is completed this time. And
thank god for that, I was about ready to kill myself after writing
dozens of lines like this:
HorizontalSlider::HorizontalSlider() : state(*new State),
base_from_member<pHorizontalSlider&>(*new pHorizontalSlider(*this)),
Widget(base_from_member<pHorizontalSlider&>::value),
p(base_from_member<pHorizontalSlider&>::value) {}
But each platform does have some new, unique problems. phoenix/GTK+ was
acting screwy prior to the rewrite, and will most likely still have
issues. Even more important, one of the major points of this rewrite was
having the new phoenix/core cache widget settings/data, so that I can
destroy and recreate widgets rather than relying on SetParent. This
means that simple copying of the old phoenix/Windows won't work, and
this new method is significantly more involved.
2011-02-15 12:22:37 +00:00
|
|
|
if(!hexEdit.onRead) return;
|
|
|
|
|
|
|
|
QTextCursor cursor = qtHexEdit->textCursor();
|
|
|
|
unsigned lineWidth = 10 + (hexEdit.state.columns * 3) + 1 + hexEdit.state.columns + 1;
|
|
|
|
unsigned cursorY = cursor.position() / lineWidth;
|
|
|
|
unsigned cursorX = cursor.position() % lineWidth;
|
|
|
|
|
|
|
|
unsigned nibble;
|
|
|
|
switch(event->key()) {
|
|
|
|
case Qt::Key_0: nibble = 0; break;
|
|
|
|
case Qt::Key_1: nibble = 1; break;
|
|
|
|
case Qt::Key_2: nibble = 2; break;
|
|
|
|
case Qt::Key_3: nibble = 3; break;
|
|
|
|
case Qt::Key_4: nibble = 4; break;
|
|
|
|
case Qt::Key_5: nibble = 5; break;
|
|
|
|
case Qt::Key_6: nibble = 6; break;
|
|
|
|
case Qt::Key_7: nibble = 7; break;
|
|
|
|
case Qt::Key_8: nibble = 8; break;
|
|
|
|
case Qt::Key_9: nibble = 9; break;
|
|
|
|
case Qt::Key_A: nibble = 10; break;
|
|
|
|
case Qt::Key_B: nibble = 11; break;
|
|
|
|
case Qt::Key_C: nibble = 12; break;
|
|
|
|
case Qt::Key_D: nibble = 13; break;
|
|
|
|
case Qt::Key_E: nibble = 14; break;
|
|
|
|
case Qt::Key_F: nibble = 15; break;
|
|
|
|
default: {
|
|
|
|
//allow navigation keys to move cursor, but block text input
|
|
|
|
qtHexEdit->setTextInteractionFlags(Qt::TextInteractionFlags(
|
|
|
|
Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse
|
|
|
|
));
|
|
|
|
qtHexEdit->keyPressEventAcknowledge(event);
|
|
|
|
qtHexEdit->setTextInteractionFlags(Qt::TextEditorInteraction);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cursorX >= 10) {
|
|
|
|
//not on an offset
|
|
|
|
cursorX -= 10;
|
|
|
|
if((cursorX % 3) != 2) {
|
|
|
|
//not on a space
|
|
|
|
bool cursorNibble = (cursorX % 3) == 1; //0 = high, 1 = low
|
|
|
|
cursorX /= 3;
|
|
|
|
if(cursorX < hexEdit.state.columns) {
|
|
|
|
//not in ANSI region
|
|
|
|
unsigned offset = hexEdit.state.offset + (cursorY * hexEdit.state.columns + cursorX);
|
|
|
|
|
|
|
|
if(offset >= hexEdit.state.length) return; //do not edit past end of file
|
|
|
|
uint8_t data = hexEdit.onRead(offset);
|
|
|
|
|
|
|
|
//write modified value
|
|
|
|
if(cursorNibble == 1) {
|
|
|
|
data = (data & 0xf0) | (nibble << 0);
|
|
|
|
} else {
|
|
|
|
data = (data & 0x0f) | (nibble << 4);
|
|
|
|
}
|
|
|
|
if(hexEdit.onWrite) hexEdit.onWrite(offset, data);
|
|
|
|
|
|
|
|
//auto-advance cursor to next nibble/byte
|
|
|
|
unsigned step = 1;
|
|
|
|
if(cursorNibble && cursorX != hexEdit.state.columns - 1) step = 2;
|
|
|
|
cursor.setPosition(cursor.position() + step);
|
|
|
|
qtHexEdit->setTextCursor(cursor);
|
|
|
|
|
|
|
|
//refresh output to reflect modified data
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-24 09:25:20 +00:00
|
|
|
void pHexEdit::onScroll() {
|
|
|
|
if(locked) return;
|
|
|
|
unsigned offset = qtScroll->sliderPosition();
|
|
|
|
hexEdit.state.offset = offset * hexEdit.state.columns;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pHexEdit::QtHexEdit::keyPressEvent(QKeyEvent* event) {
|
Update to v075r12 release.
byuu says:
phoenix has been completely rewritten from scratch, and bsnes/ui + bsnes/ui-gameboy have been updated to use the new API. Debugger works too. Currently, only phoenix/Qt is completed, and there are two known issues:
1: font sizes of menu items are wrong, I can fix this easily enough
2: there's some sort of multi-second lag when loading games, not sure
what's happening there yet
The new phoenix isn't exactly complete yet, still making some key
changes, and then I'll start on phoenix/Windows and phoenix/GTK+.
The most noticeable difference is that you don't have to give all of the
header paths and PHOENIX_PLATFORM defines when compiling individual GUI
object files. It's only needed for phoenix.cpp itself. The overall
structure of the phoenix source folder is much saner as well for
sync.sh.
I'm really surprised things are working as well as they are for
a two-day power rewrite of an entire phoenix target. The other targets
won't be as bad insofar as the core stuff is completed this time. And
thank god for that, I was about ready to kill myself after writing
dozens of lines like this:
HorizontalSlider::HorizontalSlider() : state(*new State),
base_from_member<pHorizontalSlider&>(*new pHorizontalSlider(*this)),
Widget(base_from_member<pHorizontalSlider&>::value),
p(base_from_member<pHorizontalSlider&>::value) {}
But each platform does have some new, unique problems. phoenix/GTK+ was
acting screwy prior to the rewrite, and will most likely still have
issues. Even more important, one of the major points of this rewrite was
having the new phoenix/core cache widget settings/data, so that I can
destroy and recreate widgets rather than relying on SetParent. This
means that simple copying of the old phoenix/Windows won't work, and
this new method is significantly more involved.
2011-02-15 12:22:37 +00:00
|
|
|
self.keyPressEvent(event);
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pHexEdit::QtHexEdit::keyPressEventAcknowledge(QKeyEvent* event) {
|
Update to v075r12 release.
byuu says:
phoenix has been completely rewritten from scratch, and bsnes/ui + bsnes/ui-gameboy have been updated to use the new API. Debugger works too. Currently, only phoenix/Qt is completed, and there are two known issues:
1: font sizes of menu items are wrong, I can fix this easily enough
2: there's some sort of multi-second lag when loading games, not sure
what's happening there yet
The new phoenix isn't exactly complete yet, still making some key
changes, and then I'll start on phoenix/Windows and phoenix/GTK+.
The most noticeable difference is that you don't have to give all of the
header paths and PHOENIX_PLATFORM defines when compiling individual GUI
object files. It's only needed for phoenix.cpp itself. The overall
structure of the phoenix source folder is much saner as well for
sync.sh.
I'm really surprised things are working as well as they are for
a two-day power rewrite of an entire phoenix target. The other targets
won't be as bad insofar as the core stuff is completed this time. And
thank god for that, I was about ready to kill myself after writing
dozens of lines like this:
HorizontalSlider::HorizontalSlider() : state(*new State),
base_from_member<pHorizontalSlider&>(*new pHorizontalSlider(*this)),
Widget(base_from_member<pHorizontalSlider&>::value),
p(base_from_member<pHorizontalSlider&>::value) {}
But each platform does have some new, unique problems. phoenix/GTK+ was
acting screwy prior to the rewrite, and will most likely still have
issues. Even more important, one of the major points of this rewrite was
having the new phoenix/core cache widget settings/data, so that I can
destroy and recreate widgets rather than relying on SetParent. This
means that simple copying of the old phoenix/Windows won't work, and
this new method is significantly more involved.
2011-02-15 12:22:37 +00:00
|
|
|
QTextEdit::keyPressEvent(event);
|
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
}
|