/* ZeroGS * Copyright (C) 2002-2004 GSsoft Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include /* extern "C" { #include "interface.h" #include "support.h" #include "callbacks.h" }*/ #include "Common.h" #define CALLBACK #include #include "Linux.h" static int prevbilinearfilter; //static map mapConfOpts; struct confOptsStruct{ int value; char *desc; }confOpts; static std::map mapConfOpts; /* extern void OnKeyboardF5(int); extern void OnKeyboardF6(int); extern void OnKeyboardF7(int); extern void OnKeyboardF9(int); void CALLBACK GSkeyEvent(keyEvent *ev) { static bool bShift = false; static bool bAlt = false; switch(ev->event) { case KEYPRESS: switch(ev->key) { case XK_F5: OnKeyboardF5(bShift); break; case XK_F6: OnKeyboardF6(bShift); break; case XK_F7: OnKeyboardF7(bShift); break; case XK_F9: OnKeyboardF9(bShift); break; case XK_Escape: break; case XK_Shift_L: case XK_Shift_R: bShift = true; break; case XK_Alt_L: case XK_Alt_R: bAlt = true; break; } break; case KEYRELEASE: switch(ev->key) { case XK_Shift_L: case XK_Shift_R: bShift = false; break; case XK_Alt_L: case XK_Alt_R: bAlt = false; break; } } } */ class OGLConfigDialog : public wxDialog { private: protected: wxNotebook* m_notebook1; wxPanel* VideoPanel; wxCheckBox* FullscreenCheck; wxCheckBox* RenderMainCheck; wxStaticText* m_staticText1; wxChoice* FullResoChoice; wxStaticText* m_staticText2; wxChoice* WindowResoChoice; wxStaticText* m_staticText3; wxChoice* AliasChoice; wxPanel* EnhancePanel; wxCheckBox* BilinChoice; wxCheckBox* m_checkBox4; wxCheckBox* m_checkBox6; wxChoice* m_choice6; wxPanel* AdvancedPanel; wxCheckBox* Wireframecheck; wxCheckBox* Statscheck; wxCheckBox* ShaderissuesCheck; wxCheckBox* TextureDumpChoice; wxDirPickerCtrl* m_dirPicker2; wxButton* m_button1; // event handlers void OkayClick( wxMouseEvent& event ); public: OGLConfigDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 256,277 ), long style = wxDEFAULT_DIALOG_STYLE ); ~OGLConfigDialog(); }; OGLConfigDialog::OGLConfigDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* bSizer2; bSizer2 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizer1; bSizer1 = new wxBoxSizer( wxVERTICAL ); m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0|wxALWAYS_SHOW_SB, wxT("Video Settings\nEnhancements\nAdvanced") ); VideoPanel = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxGridSizer* gSizer1; gSizer1 = new wxGridSizer( 2, 2, 0, 0 ); FullscreenCheck = new wxCheckBox( VideoPanel, wxID_ANY, wxT("Fullscreen"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( FullscreenCheck, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); RenderMainCheck = new wxCheckBox( VideoPanel, wxID_ANY, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer1->Add( RenderMainCheck, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); m_staticText1 = new wxStaticText( VideoPanel, wxID_ANY, wxT("FullScreen Video Mode"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); gSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); wxString FullResoChoiceChoices[] = { wxT("640x480") }; int FullResoChoiceNChoices = sizeof( FullResoChoiceChoices ) / sizeof( wxString ); FullResoChoice = new wxChoice( VideoPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, FullResoChoiceNChoices, FullResoChoiceChoices, 0 ); FullResoChoice->SetSelection( 0 ); gSizer1->Add( FullResoChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText2 = new wxStaticText( VideoPanel, wxID_ANY, wxT("Windowed Resolution"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); gSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); wxString WindowResoChoiceChoices[] = { wxT("640x480") }; int WindowResoChoiceNChoices = sizeof( WindowResoChoiceChoices ) / sizeof( wxString ); WindowResoChoice = new wxChoice( VideoPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, WindowResoChoiceNChoices, WindowResoChoiceChoices, 0 ); WindowResoChoice->SetSelection( 0 ); gSizer1->Add( WindowResoChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText3 = new wxStaticText( VideoPanel, wxID_ANY, wxT("Alias Mode"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText3->Wrap( -1 ); gSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); wxString AliasChoiceChoices[] = { wxT("1x"), wxT("2x"), wxT("4x"), wxT("8x"), wxT("16x") }; int AliasChoiceNChoices = sizeof( AliasChoiceChoices ) / sizeof( wxString ); AliasChoice = new wxChoice( VideoPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, AliasChoiceNChoices, AliasChoiceChoices, 0 ); AliasChoice->SetSelection( 0 ); gSizer1->Add( AliasChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); VideoPanel->SetSizer( gSizer1 ); VideoPanel->Layout(); gSizer1->Fit( VideoPanel ); m_notebook1->AddPage( VideoPanel, wxT("Video"), true ); EnhancePanel = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxGridSizer* gSizer3; gSizer3 = new wxGridSizer( 3, 1, 0, 0 ); BilinChoice = new wxCheckBox( EnhancePanel, wxID_ANY, wxT("Force bi/trilinear (May cause very small glitches)"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer3->Add( BilinChoice, 0, wxALL, 5 ); m_checkBox4 = new wxCheckBox( EnhancePanel, wxID_ANY, wxT("Force maximum anisotropy filtering"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer3->Add( m_checkBox4, 0, wxALL, 5 ); wxGridSizer* gSizer4; gSizer4 = new wxGridSizer( 1, 2, 0, 0 ); m_checkBox6 = new wxCheckBox( EnhancePanel, wxID_ANY, wxT("Pre-Upscale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBox6->Enable( false ); gSizer4->Add( m_checkBox6, 0, wxALL, 5 ); wxArrayString m_choice6Choices; m_choice6 = new wxChoice( EnhancePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice6Choices, 0 ); m_choice6->SetSelection( 0 ); m_choice6->Enable( false ); gSizer4->Add( m_choice6, 0, wxALL, 5 ); gSizer3->Add( gSizer4, 1, wxEXPAND, 5 ); EnhancePanel->SetSizer( gSizer3 ); EnhancePanel->Layout(); gSizer3->Fit( EnhancePanel ); m_notebook1->AddPage( EnhancePanel, wxT("Enhancements"), false ); AdvancedPanel = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxGridSizer* gSizer5; gSizer5 = new wxGridSizer( 6, 0, 0, 0 ); Wireframecheck = new wxCheckBox( AdvancedPanel, wxID_ANY, wxT("Wireframe"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer5->Add( Wireframecheck, 0, wxALL, 5 ); Statscheck = new wxCheckBox( AdvancedPanel, wxID_ANY, wxT("Overlay some statistics"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer5->Add( Statscheck, 0, wxALL, 5 ); ShaderissuesCheck = new wxCheckBox( AdvancedPanel, wxID_ANY, wxT("Show shader compilation issues"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer5->Add( ShaderissuesCheck, 0, wxALL, 5 ); TextureDumpChoice = new wxCheckBox( AdvancedPanel, wxID_ANY, wxT("Dump Textures To:"), wxDefaultPosition, wxDefaultSize, 0 ); gSizer5->Add( TextureDumpChoice, 0, wxALL, 5 ); m_dirPicker2 = new wxDirPickerCtrl( AdvancedPanel, wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE ); gSizer5->Add( m_dirPicker2, 0, wxALIGN_CENTER|wxALL, 5 ); AdvancedPanel->SetSizer( gSizer5 ); AdvancedPanel->Layout(); gSizer5->Fit( AdvancedPanel ); m_notebook1->AddPage( AdvancedPanel, wxT("Advanced"), false ); bSizer1->Add( m_notebook1, 1, wxALL|wxEXPAND, 5 ); m_button1 = new wxButton( this, wxID_ANY, wxT("Okay"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_button1, 0, wxALL, 5 ); bSizer2->Add( bSizer1, 1, wxEXPAND, 5 ); this->SetSizer( bSizer2 ); this->Layout(); // Connect Events m_button1->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( OGLConfigDialog::OkayClick ), NULL, this ); } OGLConfigDialog::~OGLConfigDialog() { // Disconnect Events m_button1->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( OGLConfigDialog::OkayClick ), NULL, this ); } void OGLConfigDialog::OkayClick(wxMouseEvent& event) { Close(true); } void Show_OGLSettings() { OGLConfigDialog frame(NULL); frame.ShowModal(); } GtkWidget *Conf; GtkWidget *Logging; GList *fresl; GList *wresl; GList *cachesizel; GList *codecl; GList *filtersl; void OnConf_Ok(GtkButton *button, gpointer user_data) { GtkWidget *Btn; GtkWidget *treeview; GtkTreeModel *treemodel; GtkTreeIter treeiter; gboolean treeoptval; gchar *gbuf; char *str; int i; /* u32 newinterlace = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkInterlace"))); if( !conf.interlace ) conf.interlace = newinterlace; else if( !newinterlace ) conf.interlace = 2; // off conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkBilinear"))); // restore if( conf.bilinear && prevbilinearfilter ) conf.bilinear = prevbilinearfilter; //conf.mrtdepth = 1;//IsDlgButtonChecked(hW, IDC_CONFIG_DEPTHWRITE); if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAANone"))) ) { conf.aa = 0; } else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAA2X"))) ) { conf.aa = 1; } else conf.aa = 2; conf.options = 0; conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkAVI"))) ? GSOPTION_CAPTUREAVI : 0; conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkWireframe"))) ? GSOPTION_WIREFRAME : 0; conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton6"))) ? GSOPTION_FULLSCREEN : 0; conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkTGA"))) ? GSOPTION_TGASNAP : 0; //------- get advanced options from the treeview model -------// treeview = lookup_widget(Conf,"treeview1"); treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)); gtk_tree_model_get_iter_first(treemodel, &treeiter); conf.gamesettings = 0; for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) { treeoptval = FALSE; gtk_tree_model_get(treemodel, &treeiter, 0, &treeoptval, -1); if(treeoptval){ conf.gamesettings |= it->second.value; } gtk_tree_model_iter_next(treemodel,&treeiter); } GSsetGameCRC(0, conf.gamesettings); //---------- done getting advanced options ---------// if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize640"))) ) conf.options |= GSOPTION_WIN640; else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize800"))) ) conf.options |= GSOPTION_WIN800; else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1024"))) ) conf.options |= GSOPTION_WIN1024; else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1280"))) ) conf.options |= GSOPTION_WIN1280; SaveConfig(); gtk_widget_destroy(Conf); gtk_main_quit(); */ } void OnConf_Cancel(GtkButton *button, gpointer user_data) { gtk_widget_destroy(Conf); gtk_main_quit(); } void CALLBACK GSconfigure() { char name[32]; char descbuf[255]; int nmodes, i; bool itval; GtkWidget *treeview; GtkCellRenderer *treerend; GtkListStore *treestore;//Gets typecast as GtkTreeModel as needed. GtkTreeIter treeiter; GtkTreeViewColumn *treecol; /* if( !(conf.options & GSOPTION_LOADED) ) LoadConfig(); Conf = create_Config(); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkBilinear")), !!conf.bilinear); //gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton6")), conf.mrtdepth); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAANone")), conf.aa==0); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAA2X")), conf.aa==1); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAA4X")), conf.aa==2); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkWireframe")), (conf.options&GSOPTION_WIREFRAME)?1:0); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkAVI")), (conf.options&GSOPTION_CAPTUREAVI)?1:0); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton6")), (conf.options&GSOPTION_FULLSCREEN)?1:0); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkTGA")), (conf.options&GSOPTION_TGASNAP)?1:0); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize640")), ((conf.options&GSOPTION_WINDIMS)>>4)==0); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize800")), ((conf.options&GSOPTION_WINDIMS)>>4)==1); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1024")), ((conf.options&GSOPTION_WINDIMS)>>4)==2); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1280")), ((conf.options&GSOPTION_WINDIMS)>>4)==3); prevbilinearfilter = conf.bilinear; //--------- Let's build a treeview for our advanced options! --------// treeview = lookup_widget(Conf,"treeview1"); treestore = gtk_list_store_new(2,G_TYPE_BOOLEAN, G_TYPE_STRING); //setup columns in treeview //COLUMN 0 is the checkboxes treecol = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(treecol, "Select"); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), treecol); treerend = gtk_cell_renderer_toggle_new(); gtk_tree_view_column_pack_start(treecol, treerend, TRUE); gtk_tree_view_column_add_attribute(treecol, treerend, "active", 0);//link 'active' attrib to first column of model g_object_set(treerend, "activatable", TRUE, NULL);//set 'activatable' attrib true by default for all rows regardless of model. g_signal_connect(treerend, "toggled", (GCallback) OnToggle_advopts, treestore);//set a global callback, we also pass a reference to our treestore. //COLUMN 1 is the text descriptions treecol = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(treecol, "Description"); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), treecol); treerend = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(treecol, treerend, TRUE); gtk_tree_view_column_add_attribute(treecol, treerend, "text", 1);//link 'text' attrib to second column of model //setup the model with all our rows of option data mapConfOpts.clear(); confOpts.value = 0x00000001; confOpts.desc = "Tex Target checking - 00000001\nLego Racers"; mapConfOpts["00000001"] = confOpts; confOpts.value = 0x00000002; confOpts.desc = "Auto reset targs - 00000002\nShadow Hearts, Samurai Warriors. Use when game is slow and toggling AA fixes it."; mapConfOpts["00000002"] = confOpts; confOpts.value = 0x00000004; confOpts.desc = "Interlace 2X - 00000004\nFixes 2x bigger screen (Gradius 3)."; mapConfOpts["00000004"] = confOpts; confOpts.value = 0x00000008; confOpts.desc = "Text Alpha hack - 00000008\nNightmare Before Christmas."; mapConfOpts["00000008"] = confOpts; confOpts.value = 0x00000010; confOpts.desc = "No target resolves - 00000010\nStops all resolving of targets. Try this first for really slow games."; mapConfOpts["00000010"] = confOpts; confOpts.value = 0x00000020; confOpts.desc = "Exact color testing - 00000020\nFixes overbright or shadow/black artifacts (Crash 'n Burn)."; mapConfOpts["00000020"] = confOpts; confOpts.value = 0x00000040; confOpts.desc = "No color clamping - 00000040\nSpeeds up games, but might be too bright or too dim."; mapConfOpts["00000040"] = confOpts; confOpts.value = 0x00000080; confOpts.desc = "FFX hack - 00000080\nShows missing geometry."; mapConfOpts["00000080"] = confOpts; confOpts.value = 0x00000200; confOpts.desc = "Disable depth updates - 00000200"; mapConfOpts["00000200"] = confOpts; confOpts.value = 0x00000400; confOpts.desc = "Resolve Hack #1 - 00000400\nKingdom Hearts. Speeds some games."; mapConfOpts["00000400"] = confOpts; confOpts.value = 0x00000800; confOpts.desc = "Resolve Hack #2 - 00000800\nShadow Hearts, Urbz."; mapConfOpts["00000800"] = confOpts; confOpts.value = 0x00001000; confOpts.desc = "No target CLUT - 00001000\nResident Evil 4, or foggy scenes."; mapConfOpts["00001000"] = confOpts; confOpts.value = 0x00002000; confOpts.desc = "Disable stencil buffer - 00002000\nUsually safe to do for simple scenes."; mapConfOpts["00002000"] = confOpts; confOpts.value = 0x00004000; confOpts.desc = "No vertical stripes - 00004000\nTry when there's a lot of garbage on screen."; mapConfOpts["00004000"] = confOpts; confOpts.value = 0x00008000; confOpts.desc = "No depth resolve - 00008000\nMight give z buffer artifacts."; mapConfOpts["00008000"] = confOpts; confOpts.value = 0x00010000; confOpts.desc = "Full 16 bit resolution - 00010000\nUse when half the screen is missing."; mapConfOpts["00010000"] = confOpts; confOpts.value = 0x00020000; confOpts.desc = "Resolve Hack #3 - 00020000\nNeopets"; mapConfOpts["00020000"] = confOpts; confOpts.value = 0x00040000; confOpts.desc = "Fast Update - 00040000\nOkami. Speeds some games."; mapConfOpts["00040000"] = confOpts; confOpts.value = 0x00080000; confOpts.desc = "Disable alpha testing - 00080000"; mapConfOpts["00080000"] = confOpts; confOpts.value = 0x00100000; confOpts.desc = "Disable Multiple RTs - 00100000"; mapConfOpts["00100000"] = confOpts; confOpts.value = 0x00200000; confOpts.desc = "32 bit render targets - 00200000"; mapConfOpts["00200000"] = confOpts; for(map::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) { gtk_list_store_append(treestore, &treeiter);//new row itval = (conf.gamesettings&it->second.value)?TRUE:FALSE; snprintf(descbuf, 254, "%s", it->second.desc); gtk_list_store_set(treestore, &treeiter, 0, itval, 1, descbuf, -1); } gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(treestore));//NB: store is cast as tree model. g_object_unref(treestore);//allow model to be destroyed when the tree is destroyed. //don't select/highlight rows gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), GTK_SELECTION_NONE); //------treeview done -------// */ //Let's do it! gtk_widget_show_all(Conf); gtk_main(); } void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_data){ GtkTreeIter treeiter; gboolean val; gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(user_data), &treeiter, path); gtk_tree_model_get(GTK_TREE_MODEL(user_data), &treeiter, 0, &val, -1); val = !val; gtk_list_store_set(GTK_LIST_STORE(user_data), &treeiter, 0, val, -1); } GtkWidget *About; void OnAbout_Ok(GtkButton *button, gpointer user_data) { gtk_widget_destroy(About); gtk_main_quit(); } void CALLBACK GSabout() { //About = create_About(); //gtk_widget_show_all(About); //gtk_main(); } s32 CALLBACK GStest() { return 0; } GtkWidget *MsgDlg; void OnMsg_Ok() { gtk_widget_destroy(MsgDlg); gtk_main_quit(); } void SysMessage(const char *fmt, ...) { GtkWidget *Ok,*Txt; GtkWidget *Box,*Box1; va_list list; char msg[512]; va_start(list, fmt); vsprintf(msg, fmt, list); va_end(list); if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0; MsgDlg = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER); gtk_window_set_title(GTK_WINDOW(MsgDlg), "GSsoft Msg"); gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5); Box = gtk_vbox_new(5, 0); gtk_container_add(GTK_CONTAINER(MsgDlg), Box); gtk_widget_show(Box); Txt = gtk_label_new(msg); gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5); gtk_widget_show(Txt); Box1 = gtk_hbutton_box_new(); gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0); gtk_widget_show(Box1); Ok = gtk_button_new_with_label("Ok"); gtk_signal_connect (GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL); gtk_container_add(GTK_CONTAINER(Box1), Ok); GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT); gtk_widget_show(Ok); gtk_widget_show(MsgDlg); gtk_main(); } void *SysLoadLibrary(char *lib) { return dlopen(lib, RTLD_NOW | RTLD_GLOBAL); } void *SysLoadSym(void *lib, char *sym) { void *ret = dlsym(lib, sym); if (ret == NULL) printf("null: %s\n", sym); return dlsym(lib, sym); } char *SysLibError() { return dlerror(); } void SysCloseLibrary(void *lib) { dlclose(lib); }