Update to bsnes v037a release.

[No changelog available]
This commit is contained in:
byuu 2008-10-27 15:02:10 +00:00
parent a9bff19b5b
commit 9b03874f32
7 changed files with 54 additions and 39 deletions

View File

@ -1,5 +1,5 @@
bsnes
Version: 0.037
Version: 0.037a
Author: byuu
========

View File

@ -1,4 +1,4 @@
#define BSNES_VERSION "0.037"
#define BSNES_VERSION "0.037a"
#define BSNES_TITLE "bsnes v" BSNES_VERSION
#define BUSCORE sBus

View File

@ -1,19 +1,27 @@
void hiro_plistbox_change(pListbox *p) {
static void hiro_plistbox_change(pListbox *p) {
//only send message when active item changes
if(p->listbox_selection == p->get_selection()) return;
if(p->self.on_change) p->self.on_change(event_t(event_t::Change, p->listbox_selection = p->get_selection(), &p->self));
p->listbox_selection = p->get_selection();
if(p->self.on_change) {
p->self.on_change(event_t(event_t::Change, p->listbox_selection, &p->self));
}
}
void hiro_plistbox_activate(pListbox *p) {
if(p->self.on_activate) p->self.on_activate(event_t(event_t::Activate, p->listbox_selection = p->get_selection(), &p->self));
static void hiro_plistbox_activate(pListbox *p) {
p->listbox_selection = p->get_selection();
if(p->self.on_activate) {
p->self.on_activate(event_t(event_t::Activate, p->listbox_selection, &p->self));
}
}
void pListbox::create(unsigned style, unsigned width, unsigned height, const char *columns, const char *text) {
bool header = style & Listbox::Header;
GtkPolicyType hscroll = (style & Listbox::HorizontalScrollAlways) ? GTK_POLICY_ALWAYS :
(style & Listbox::HorizontalScrollNever) ? GTK_POLICY_NEVER :
(style & Listbox::HorizontalScrollNever ) ? GTK_POLICY_NEVER :
GTK_POLICY_AUTOMATIC;
GtkPolicyType vscroll = (style & Listbox::VerticalScrollAlways) ? GTK_POLICY_ALWAYS :
(style & Listbox::VerticalScrollNever) ? GTK_POLICY_NEVER :
(style & Listbox::VerticalScrollNever ) ? GTK_POLICY_NEVER :
GTK_POLICY_AUTOMATIC;
scrollbox = gtk_scrolled_window_new(0, 0);
@ -35,7 +43,7 @@ void pListbox::create(unsigned style, unsigned width, unsigned height, const cha
gtk_widget_show(listbox);
gtk_widget_show(scrollbox);
//alternate colors for each listbox entry if there are multiple columns ...
//alternate colors for each listbox entry if there are multiple columns
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(listbox), count(list) >= 2 ? true : false);
for(unsigned i = 0; i < count(list); i++) {
renderer = gtk_cell_renderer_text_new();
@ -68,58 +76,65 @@ void pListbox::set_column_width(unsigned column, unsigned width) {
}
void pListbox::add_item(const char *text) {
lstring list;
lstring list;
split(list, "\t", text);
gtk_list_store_append(store, &iter);
for(unsigned i = 0; i < count(list); i++) {
gtk_list_store_set(store, &iter, i, list[i](), -1);
gtk_list_store_set(store, &iter, i, (const char*)list[i], -1);
}
}
void pListbox::set_item(unsigned index, const char *text) {
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox));
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox));
for(unsigned i = 0; i <= index; i++) {
i == 0 ?
gtk_tree_model_get_iter_first(model, &iter) :
gtk_tree_model_iter_next(model, &iter);
}
lstring list;
lstring list;
split(list, "\t", text);
for(unsigned i = 0; i < count(list); i++) {
gtk_list_store_set(store, &iter, i, list[i](), -1);
gtk_list_store_set(store, &iter, i, (const char*)list[i], -1);
}
}
int pListbox::get_selection() {
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox));
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox));
if(gtk_tree_model_get_iter_first(model, &iter) == false) { return -1; }
if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) { return 0; }
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox));
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox));
if(gtk_tree_model_get_iter_first(model, &iter) == false) return -1;
if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) return 0;
for(unsigned i = 1; i < 100000; i++) {
if(gtk_tree_model_iter_next(model, &iter) == false) { return -1; }
if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) { return i; }
if(gtk_tree_model_iter_next(model, &iter) == false) return -1;
if(gtk_tree_selection_iter_is_selected(selection, &iter) == true) return i;
}
return -1;
}
void pListbox::set_selection(int index) {
int current = get_selection();
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox));
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox));
int current = get_selection();
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listbox));
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(listbox));
gtk_tree_selection_unselect_all(selection);
if(index < 0) { goto end; }
if(gtk_tree_model_get_iter_first(model, &iter) == false) { goto end; }
if(index == 0) { gtk_tree_selection_select_iter(selection, &iter); goto end; }
for(unsigned i = 1; i < 100000; i++) {
if(gtk_tree_model_iter_next(model, &iter) == false) { goto end; }
if(index == i) { gtk_tree_selection_select_iter(selection, &iter); goto end; }
if(index < 0) return; //nothing to select?
if(gtk_tree_model_get_iter_first(model, &iter)) {
if(index == 0) {
gtk_tree_selection_select_iter(selection, &iter);
} else {
for(unsigned i = 1; i < 100000; i++) {
if(gtk_tree_model_iter_next(model, &iter) == false) break;
if(index == i) {
gtk_tree_selection_select_iter(selection, &iter);
break;
}
}
}
}
end:
if(current != index); //{ owner->message(Message::Changed, (uintptr_t)this); }
}
void pListbox::reset() {
listbox_selection = -1;
gtk_list_store_clear(GTK_LIST_STORE(store));
gtk_tree_view_set_model(GTK_TREE_VIEW(listbox), GTK_TREE_MODEL(store));
}

View File

@ -1,6 +1,6 @@
/*
hiro
version: 0.007b (2008-10-26)
version: 0.008 (2008-10-27)
author: byuu
license: public domain
*/

View File

@ -126,7 +126,7 @@ void update_emulation_speed(int speed) {
unsigned outfreq = config::audio.output_frequency;
unsigned infreq = config::audio.input_frequency * scale[speed] + 0.5;
audio.set(Audio::Resample, outfreq != infreq); //only resample when necessary
audio.set(Audio::Resample, outfreq != infreq); //only resample when necessary
audio.set(Audio::ResampleOutputFrequency, outfreq);
audio.set(Audio::ResampleInputFrequency, infreq);

View File

@ -22,9 +22,9 @@ uintptr_t DriverSelectWindow::input_change(event_t) {
void DriverSelectWindow::setup() {
create(0, 475, 355);
//this is only displayed if app.crashed_on_last_run == true
//this is only displayed if application crashed on last run
crash_message.create(0, 475, 36, string()
<< translate["WARNING: bsnes crashed on last startup due to incompatible driver settings."] << "\n"
<< translate["Warning: bsnes crashed on last startup due to incompatible driver settings."] << "\n"
<< translate["Please select a different driver configuration below."]
);
@ -35,7 +35,7 @@ void DriverSelectWindow::setup() {
split(part, ";", video.driver_list());
for(unsigned i = 0; i < count(part); i++) {
cvideo.add_item(part[i]);
cvideo.add_item(translate[string() << "{{videodriver}}" << part[i]]);
if(part[i] == config::system.video) cvideo.set_selection(i);
}
@ -44,7 +44,7 @@ void DriverSelectWindow::setup() {
split(part, ";", audio.driver_list());
for(unsigned i = 0; i < count(part); i++) {
caudio.add_item(part[i]);
caudio.add_item(translate[string() << "{{audiodriver}}" << part[i]]);
if(part[i] == config::system.audio) caudio.set_selection(i);
}
@ -53,7 +53,7 @@ void DriverSelectWindow::setup() {
split(part, ";", input.driver_list());
for(unsigned i = 0; i < count(part); i++) {
cinput.add_item(part[i]);
cinput.add_item(translate[string() << "{{inputdriver}}" << part[i]]);
if(part[i] == config::system.input) cinput.set_selection(i);
}

View File

@ -184,7 +184,7 @@ uintptr_t InputConfigWindow::set_tick(event_t) {
message = translate["Move mouse or analog joypad axis to assign to $ ..."];
}
replace(message, "$", group->list[pos]->name);
replace(message, "$", translate[group->list[pos]->name]);
window_input_capture.label.set_text(message);
bool show_controller_graphic = false;