2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
static bool HexEdit_keyPress(GtkWidget* widget, GdkEventKey* event, HexEdit* self) {
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
return self->p.keyPress(event->keyval, event->state);
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
|
|
|
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
static bool HexEdit_mouseScroll(GtkWidget* widget, GdkEventScroll* event, HexEdit* self) {
|
|
|
|
double position = gtk_range_get_value(GTK_RANGE(self->p.scrollBar));
|
|
|
|
|
|
|
|
if(event->direction == GDK_SCROLL_UP) {
|
|
|
|
self->p.scroll(position - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(event->direction == GDK_SCROLL_DOWN) {
|
|
|
|
self->p.scroll(position + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true; //do not propagate event further
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool HexEdit_scroll(GtkRange* range, GtkScrollType scroll, double value, HexEdit* self) {
|
|
|
|
self->p.scroll((signed)value);
|
|
|
|
return true; //do not propagate event further
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
|
|
|
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
bool pHexEdit::focused() {
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
return GTK_WIDGET_HAS_FOCUS(subWidget) || GTK_WIDGET_HAS_FOCUS(scrollBar);
|
Update to higan v091r14 and ananke v00r03 releases.
byuu says:
higan changelog:
- generates title displayed in emulator window by asking the core
- core builds title solely from "information/title" ... if it's not
there, you don't get a title at all
- sub-system load menu is gone ... since there are multiple revisions of
the SGB, this never really worked well anyway
- to load an SGB, BS-X or ST cartridge, load the base cartridge first
- "File->Load Game" moved to "Load->Import Game" ... may cause a bit of
confusion to new users, but I don't like having a single-item menu,
we'll just have to explain it to new users
- browser window redone to look like ananke
- home button here goes to ~/Emulation rather than just ~ like ananke,
since this is the home of game folders
- game folder icon is now the executable icon for the Tango theme
(orange diamond), meant to represent a complete game rather than
a game file or archive
ananke changelog:
- outputs GBC games to "Game Boy Color/" instead of "Game Boy/"
- adds the file basename to "information/title"
Known issues:
- using ananke to load a GB game trips the Super Famicom SGB mode and
fails (need to make the full-path auto-detection ignore non-bootable
systems)
- need to dump and test some BS-X media before releasing
- ananke lacks BS-X Satellaview cartridge support
- v092 isn't going to let you retarget the ananke/higan game folder path
of ~/Emulation, you will have to wait for a future version if that
bothers you so greatly
[Later, after the v092 release, byuu posted this additional changelog:
- kill laevateinn
- add title()
- add bootable, remove load
- combine file, library
- combine [][][] paths
- fix SFC subtype handling XML->BML
- update file browser to use buttons
- update file browser keyboard handling
- update system XML->BML
- fix sufami turbo hashing
- remove Cartridge::manifest
]
2012-12-25 05:31:55 +00:00
|
|
|
}
|
|
|
|
|
2011-02-24 09:27:21 +00:00
|
|
|
void pHexEdit::setColumns(unsigned columns) {
|
|
|
|
setScroll();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setLength(unsigned length) {
|
|
|
|
setScroll();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setOffset(unsigned offset) {
|
|
|
|
setScroll();
|
|
|
|
updateScroll();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setRows(unsigned rows) {
|
|
|
|
setScroll();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::update() {
|
|
|
|
if(!hexEdit.onRead) {
|
|
|
|
gtk_text_buffer_set_text(textBuffer, "", -1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned position = cursorPosition();
|
|
|
|
|
|
|
|
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(" ");
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
ansidata.append(data >= 0x20 && data <= 0x7e ? (char)data : '.');
|
2011-02-24 09:27:21 +00:00
|
|
|
} 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");
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_text_buffer_set_text(textBuffer, output, -1);
|
|
|
|
if(position == 0) position = 10; //start at first position where hex values can be entered
|
|
|
|
setCursorPosition(position);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::constructor() {
|
|
|
|
gtkWidget = gtk_hbox_new(false, 0);
|
|
|
|
|
|
|
|
container = gtk_scrolled_window_new(0, 0);
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(container), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
2011-02-24 09:27:21 +00:00
|
|
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(container), GTK_SHADOW_ETCHED_IN);
|
|
|
|
|
|
|
|
subWidget = gtk_text_view_new();
|
|
|
|
gtk_text_view_set_editable(GTK_TEXT_VIEW(subWidget), false);
|
|
|
|
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(subWidget), GTK_WRAP_NONE);
|
|
|
|
gtk_container_add(GTK_CONTAINER(container), subWidget);
|
|
|
|
g_signal_connect(G_OBJECT(subWidget), "key-press-event", G_CALLBACK(HexEdit_keyPress), (gpointer)&hexEdit);
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
g_signal_connect(G_OBJECT(subWidget), "scroll-event", G_CALLBACK(HexEdit_mouseScroll), (gpointer)&hexEdit);
|
2011-02-24 09:27:21 +00:00
|
|
|
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
scrollBar = gtk_vscrollbar_new((GtkAdjustment*)nullptr);
|
2011-02-24 09:27:21 +00:00
|
|
|
gtk_range_set_range(GTK_RANGE(scrollBar), 0, 255);
|
|
|
|
gtk_range_set_increments(GTK_RANGE(scrollBar), 1, 16);
|
|
|
|
gtk_widget_set_sensitive(scrollBar, false);
|
|
|
|
g_signal_connect(G_OBJECT(scrollBar), "change-value", G_CALLBACK(HexEdit_scroll), (gpointer)&hexEdit);
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
g_signal_connect(G_OBJECT(scrollBar), "scroll-event", G_CALLBACK(HexEdit_mouseScroll), (gpointer)&hexEdit);
|
2011-02-24 09:27:21 +00:00
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(gtkWidget), container, true, true, 0);
|
|
|
|
gtk_box_pack_start(GTK_BOX(gtkWidget), scrollBar, false, false, 1);
|
|
|
|
|
|
|
|
textBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(subWidget));
|
|
|
|
textCursor = gtk_text_buffer_get_mark(textBuffer, "insert");
|
|
|
|
|
|
|
|
gtk_widget_show(scrollBar);
|
|
|
|
gtk_widget_show(subWidget);
|
|
|
|
gtk_widget_show(container);
|
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() {
|
|
|
|
gtk_widget_destroy(scrollBar);
|
|
|
|
gtk_widget_destroy(subWidget);
|
|
|
|
gtk_widget_destroy(container);
|
|
|
|
gtk_widget_destroy(gtkWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::orphan() {
|
|
|
|
destructor();
|
|
|
|
constructor();
|
2011-02-24 09:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned pHexEdit::cursorPosition() {
|
|
|
|
GtkTextIter iter;
|
|
|
|
gtk_text_buffer_get_iter_at_mark(textBuffer, &iter, textCursor);
|
|
|
|
return gtk_text_iter_get_offset(&iter);
|
|
|
|
}
|
|
|
|
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
bool pHexEdit::keyPress(unsigned scancode, unsigned mask) {
|
2011-02-24 09:27:21 +00:00
|
|
|
if(!hexEdit.onRead) return false;
|
|
|
|
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
if(mask & (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SUPER_MASK)) return false; //allow actions such as Ctrl+C (copy)
|
|
|
|
|
|
|
|
signed position = cursorPosition();
|
|
|
|
signed lineWidth = 10 + (hexEdit.state.columns * 3) + 1 + hexEdit.state.columns + 1;
|
|
|
|
signed cursorY = position / lineWidth;
|
|
|
|
signed cursorX = position % lineWidth;
|
2011-02-24 09:27:21 +00:00
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
if(scancode == GDK_Home) {
|
2011-02-24 09:27:21 +00:00
|
|
|
setCursorPosition(cursorY * lineWidth + 10);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
if(scancode == GDK_End) {
|
2011-02-24 09:27:21 +00:00
|
|
|
setCursorPosition(cursorY * lineWidth + 10 + (hexEdit.state.columns * 3 - 1));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
if(scancode == GDK_Up) {
|
2011-02-24 09:27:21 +00:00
|
|
|
if(cursorY != 0) return false;
|
|
|
|
|
|
|
|
signed newOffset = hexEdit.state.offset - hexEdit.state.columns;
|
|
|
|
if(newOffset >= 0) {
|
|
|
|
hexEdit.setOffset(newOffset);
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
if(scancode == GDK_Down) {
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
if(cursorY >= rows() - 1) return true;
|
2011-02-24 09:27:21 +00:00
|
|
|
if(cursorY != hexEdit.state.rows - 1) return false;
|
|
|
|
|
|
|
|
signed newOffset = hexEdit.state.offset + hexEdit.state.columns;
|
|
|
|
if(newOffset + hexEdit.state.columns * hexEdit.state.rows - (hexEdit.state.columns - 1) <= hexEdit.state.length) {
|
|
|
|
hexEdit.setOffset(newOffset);
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
if(scancode == GDK_Page_Up) {
|
2011-02-24 09:27:21 +00:00
|
|
|
signed newOffset = hexEdit.state.offset - hexEdit.state.columns * hexEdit.state.rows;
|
|
|
|
if(newOffset >= 0) {
|
|
|
|
hexEdit.setOffset(newOffset);
|
|
|
|
} else {
|
|
|
|
hexEdit.setOffset(0);
|
|
|
|
}
|
|
|
|
update();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
if(scancode == GDK_Page_Down) {
|
2011-02-24 09:27:21 +00:00
|
|
|
signed newOffset = hexEdit.state.offset + hexEdit.state.columns * hexEdit.state.rows;
|
|
|
|
for(unsigned n = 0; n < hexEdit.state.rows; n++) {
|
|
|
|
if(newOffset + hexEdit.state.columns * hexEdit.state.rows - (hexEdit.state.columns - 1) <= hexEdit.state.length) {
|
|
|
|
hexEdit.setOffset(newOffset);
|
|
|
|
update();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
newOffset -= hexEdit.state.columns;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//convert scancode to hex nibble
|
|
|
|
if(scancode >= '0' && scancode <= '9') scancode = scancode - '0';
|
|
|
|
else if(scancode >= 'A' && scancode <= 'F') scancode = scancode - 'A' + 10;
|
|
|
|
else if(scancode >= 'a' && scancode <= 'f') scancode = scancode - 'a' + 10;
|
|
|
|
else return false; //not a valid hex value
|
|
|
|
|
|
|
|
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 false; //do not edit past end of data
|
|
|
|
uint8_t data = hexEdit.onRead(offset);
|
|
|
|
|
|
|
|
//write modified value
|
|
|
|
if(cursorNibble == 1) {
|
|
|
|
data = (data & 0xf0) | (scancode << 0);
|
|
|
|
} else {
|
|
|
|
data = (data & 0x0f) | (scancode << 4);
|
|
|
|
}
|
|
|
|
if(hexEdit.onWrite) hexEdit.onWrite(offset, data);
|
|
|
|
|
|
|
|
//auto-advance cursor to next nibble/byte
|
|
|
|
position++;
|
|
|
|
if(cursorNibble && cursorX != hexEdit.state.columns - 1) position++;
|
|
|
|
setCursorPosition(position);
|
|
|
|
|
|
|
|
//refresh output to reflect modified data
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
//number of actual rows
|
|
|
|
signed pHexEdit::rows() {
|
|
|
|
return (max(1u, hexEdit.state.length) + hexEdit.state.columns - 1) / hexEdit.state.columns;
|
|
|
|
}
|
|
|
|
|
|
|
|
//number of scrollable row positions
|
|
|
|
signed pHexEdit::rowsScrollable() {
|
|
|
|
return max(0u, rows() - hexEdit.state.rows);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::scroll(signed position) {
|
|
|
|
if(position > rowsScrollable()) position = rowsScrollable();
|
|
|
|
if(position < 0) position = 0;
|
2011-02-24 09:27:21 +00:00
|
|
|
hexEdit.setOffset(position * hexEdit.state.columns);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setCursorPosition(unsigned position) {
|
|
|
|
GtkTextIter iter;
|
|
|
|
gtk_text_buffer_get_iter_at_mark(textBuffer, &iter, textCursor);
|
|
|
|
|
|
|
|
//GTK+ will throw many errors to the terminal if you set iterator past end of buffer
|
|
|
|
GtkTextIter endIter;
|
|
|
|
gtk_text_buffer_get_end_iter(textBuffer, &iter);
|
|
|
|
unsigned endPosition = gtk_text_iter_get_offset(&iter);
|
|
|
|
|
|
|
|
gtk_text_iter_set_offset(&iter, min(position, endPosition));
|
|
|
|
gtk_text_buffer_place_cursor(textBuffer, &iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::setScroll() {
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
if(rowsScrollable() > 0) {
|
|
|
|
gtk_range_set_range(GTK_RANGE(scrollBar), 0, rowsScrollable());
|
2011-02-24 09:27:21 +00:00
|
|
|
gtk_widget_set_sensitive(scrollBar, true);
|
|
|
|
} else {
|
|
|
|
gtk_widget_set_sensitive(scrollBar, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void pHexEdit::updateScroll() {
|
|
|
|
unsigned row = hexEdit.state.offset / hexEdit.state.columns;
|
|
|
|
gtk_range_set_value(GTK_RANGE(scrollBar), row);
|
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
}
|