2010-03-19 00:31:15 +00:00
/* 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 <stdarg.h>
# include <stdlib.h>
# include <string.h>
# include <gtk/gtk.h>
# include <dlfcn.h>
# include "GS.h"
# include "Linux.h"
2010-04-03 12:48:27 +00:00
# include "zerogs.h"
2010-03-19 00:31:15 +00:00
# include <map>
2010-06-11 11:48:07 +00:00
extern u32 THR_KeyEvent ; // value for passing out key events beetwen threads
extern bool THR_bShift ;
2010-03-19 00:31:15 +00:00
static map < string , confOptsStruct > mapConfOpts ;
void CALLBACK GSkeyEvent ( keyEvent * ev )
{
//static bool bShift = false;
static bool bAlt = false ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
switch ( ev - > evt )
{
2010-03-19 00:31:15 +00:00
case KEYPRESS :
2010-05-01 20:33:53 +00:00
switch ( ev - > key )
{
2010-03-19 00:31:15 +00:00
case XK_F5 :
case XK_F6 :
case XK_F7 :
case XK_F9 :
THR_KeyEvent = ev - > key ;
break ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
case XK_Escape :
2010-06-19 06:23:40 +00:00
if ( conf . fullscreen ( ) ) GSclose ( ) ;
2010-03-19 00:31:15 +00:00
break ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
case XK_Shift_L :
case XK_Shift_R :
//bShift = true;
THR_bShift = true ;
break ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
case XK_Alt_L :
case XK_Alt_R :
bAlt = true ;
break ;
2010-05-01 20:33:53 +00:00
}
2010-03-19 00:31:15 +00:00
break ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
case KEYRELEASE :
2010-05-01 20:33:53 +00:00
switch ( ev - > key )
{
2010-03-19 00:31:15 +00:00
case XK_Shift_L :
case XK_Shift_R :
//bShift = false;
THR_bShift = false ;
break ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
case XK_Alt_L :
case XK_Alt_R :
bAlt = false ;
break ;
}
}
}
2010-03-27 02:21:09 +00:00
void add_map_entry ( u32 option , const char * key , const char * desc )
{
confOpts . value = option ;
confOpts . desc = desc ;
mapConfOpts [ key ] = confOpts ;
}
2010-03-27 04:28:12 +00:00
void CreateGameHackTable ( GtkWidget * treeview )
2010-03-19 00:31:15 +00:00
{
char descbuf [ 255 ] ;
bool itval ;
GtkCellRenderer * treerend ;
GtkListStore * treestore ; //Gets typecast as GtkTreeModel as needed.
GtkTreeIter treeiter ;
GtkTreeViewColumn * treecol ;
2010-04-25 00:31:27 +00:00
2010-03-19 00:31:15 +00:00
//--------- Let's build a treeview for our advanced options! --------//
2010-05-01 20:33:53 +00:00
treestore = gtk_list_store_new ( 2 , G_TYPE_BOOLEAN , G_TYPE_STRING ) ;
2010-03-19 00:31:15 +00:00
//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 ( ) ;
2010-05-01 23:34:44 +00:00
gtk_tree_view_column_pack_start ( treecol , treerend , true ) ;
2010-03-19 00:31:15 +00:00
gtk_tree_view_column_add_attribute ( treecol , treerend , " active " , 0 ) ; //link 'active' attrib to first column of model
2010-05-01 23:34:44 +00:00
g_object_set ( treerend , " activatable " , true , NULL ) ; //set 'activatable' attrib true by default for all rows regardless of model.
2010-03-19 00:31:15 +00:00
g_signal_connect ( treerend , " toggled " , ( GCallback ) OnToggle_advopts , treestore ) ; //set a global callback, we also pass a reference to our treestore.
2010-04-25 00:31:27 +00:00
2010-03-19 00:31:15 +00:00
//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 ( ) ;
2010-05-01 23:34:44 +00:00
gtk_tree_view_column_pack_start ( treecol , treerend , true ) ;
2010-03-19 00:31:15 +00:00
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 ( ) ;
2010-04-25 00:31:27 +00:00
2010-04-03 12:48:27 +00:00
add_map_entry ( GAME_TEXTURETARGS , " 00000001 " , " Tex Target checking - 00000001 \n Lego Racers " ) ;
add_map_entry ( GAME_AUTORESET , " 00000002 " , " Auto reset targs - 00000002 \n Shadow Hearts, Samurai Warriors. Use when game is slow and toggling AA fixes it. " ) ;
add_map_entry ( GAME_NOTARGETRESOLVE , " 00000010 " , " No target resolves - 00000010 \n Stops all resolving of targets. Try this first for really slow games. Dark Cloud 1 " ) ;
add_map_entry ( GAME_EXACTCOLOR , " 00000020 " , " Exact color testing - 00000020 \n Fixes overbright or shadow/black artifacts (Crash 'n Burn). " ) ;
add_map_entry ( GAME_NOCOLORCLAMP , " 00000040 " , " No color clamping - 00000040 \n Speeds up games, but might be too bright or too dim. " ) ;
add_map_entry ( GAME_NOALPHAFAIL , " 00000100 " , " Alpha Fail hack - 00000100 \n For Sonic Unleashed, Shadow the Hedgehog, Ghost in the Shell. Remove vertical stripes or other coloring artefacts. Break Persona 4 and MGS3 " ) ;
add_map_entry ( GAME_NODEPTHUPDATE , " 00000200 " , " Disable depth updates - 00000200 " ) ;
add_map_entry ( GAME_QUICKRESOLVE1 , " 00000400 " , " Resolve Hack #1 - 00000400 \n Kingdom Hearts. Speeds some games. " ) ;
add_map_entry ( GAME_NOQUICKRESOLVE , " 00000800 " , " Resolve Hack #2 - 00000800 \n Shadow Hearts, Urbz. Destroy FFX " ) ;
add_map_entry ( GAME_NOTARGETCLUT , " 00001000 " , " No target CLUT - 00001000 \n Resident Evil 4, or foggy scenes. " ) ;
add_map_entry ( GAME_NOSTENCIL , " 00002000 " , " Disable stencil buffer - 00002000 \n Usually safe to do for simple scenes. Harvest Moon " ) ;
add_map_entry ( GAME_NODEPTHRESOLVE , " 00008000 " , " No depth resolve - 00008000 \n Might give z buffer artifacts. " ) ;
add_map_entry ( GAME_FULL16BITRES , " 00010000 " , " Full 16 bit resolution - 00010000 \n Use when half the screen is missing. " ) ;
add_map_entry ( GAME_RESOLVEPROMOTED , " 00020000 " , " Resolve Hack #3 - 00020000 \n Neopets " ) ;
add_map_entry ( GAME_FASTUPDATE , " 00040000 " , " Fast Update - 00040000 \n Okami. Speeds some games. Needs for Sonic Unleashed " ) ;
add_map_entry ( GAME_NOALPHATEST , " 00080000 " , " Disable alpha testing - 00080000 " ) ;
add_map_entry ( GAME_DISABLEMRTDEPTH , " 00100000 " , " Enable Multiple RTs - 00100000 " ) ;
add_map_entry ( GAME_XENOSPECHACK , " 01000000 " , " Specular Highlights - 01000000 \n Makes Xenosaga and Okage graphics faster by removing highlights " ) ;
add_map_entry ( GAME_PARTIALPOINTERS , " 02000000 " , " Partial targets - 02000000 " ) ;
add_map_entry ( GAME_PARTIALDEPTH , " 04000000 " , " Partial depth - 04000000 " ) ;
add_map_entry ( GAME_GUSTHACK , " 10000000 " , " Gust fix, made gustgame more clean and fast - 10000000 " ) ;
add_map_entry ( GAME_NOLOGZ , " 20000000 " , " No logarithmic Z, could decrease number of Z-artefacts - 20000000 " ) ;
add_map_entry ( GAME_INTERLACE2X , " 00000004 " , " Interlace 2X - 00000004 \n Fixes 2x bigger screen (Gradius 3). " ) ;
2010-03-19 00:31:15 +00:00
2010-05-01 20:33:53 +00:00
for ( map < string , confOptsStruct > : : iterator it = mapConfOpts . begin ( ) ; it ! = mapConfOpts . end ( ) ; + + it )
2010-03-19 00:31:15 +00:00
{
gtk_list_store_append ( treestore , & treeiter ) ; //new row
2010-05-01 23:34:44 +00:00
itval = ( conf . gamesettings & it - > second . value ) ? true : false ;
2010-03-19 00:31:15 +00:00
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.
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
g_object_unref ( treestore ) ; //allow model to be destroyed when the tree is destroyed.
2010-04-25 00:31:27 +00:00
2010-03-19 00:31:15 +00:00
//don't select/highlight rows
gtk_tree_selection_set_mode ( gtk_tree_view_get_selection ( GTK_TREE_VIEW ( treeview ) ) , GTK_SELECTION_NONE ) ;
//------treeview done -------//
2010-03-27 04:28:12 +00:00
}
void SaveGameHackTable ( GtkWidget * treeview )
{
GtkTreeModel * treemodel ;
GtkTreeIter treeiter ;
gboolean treeoptval ;
2010-04-25 00:31:27 +00:00
2010-03-27 04:28:12 +00:00
//------- get advanced options from the treeview model -------//
treemodel = gtk_tree_view_get_model ( GTK_TREE_VIEW ( treeview ) ) ;
gtk_tree_model_get_iter_first ( treemodel , & treeiter ) ;
2010-03-19 00:31:15 +00:00
2010-03-27 04:28:12 +00:00
conf . gamesettings = 0 ;
2010-05-01 20:33:53 +00:00
for ( map < string , confOptsStruct > : : iterator it = mapConfOpts . begin ( ) ; it ! = mapConfOpts . end ( ) ; + + it )
2010-03-27 04:28:12 +00:00
{
2010-05-01 23:34:44 +00:00
treeoptval = false ;
2010-03-27 04:28:12 +00:00
gtk_tree_model_get ( treemodel , & treeiter , 0 , & treeoptval , - 1 ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
if ( treeoptval ) conf . gamesettings | = it - > second . value ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
gtk_tree_model_iter_next ( treemodel , & treeiter ) ;
2010-03-27 04:28:12 +00:00
}
2010-04-25 00:31:27 +00:00
2010-03-27 04:28:12 +00:00
GSsetGameCRC ( 0 , conf . gamesettings ) ;
2010-05-01 20:33:53 +00:00
2010-03-27 04:28:12 +00:00
//---------- done getting advanced options ---------//
2010-03-19 00:31:15 +00:00
}
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 ) ;
}
2010-03-27 04:28:12 +00:00
void DisplayDialog ( )
2010-03-19 00:31:15 +00:00
{
2010-05-01 20:33:53 +00:00
int return_value ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
GtkWidget * dialog ;
GtkWidget * main_frame , * main_box ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
GtkWidget * option_frame , * option_box ;
GtkWidget * log_check ;
GtkWidget * int_label , * int_box ;
GtkWidget * bilinear_check , * bilinear_label ;
GtkWidget * aa_label , * aa_box ;
GtkWidget * wireframe_check , * avi_check ;
GtkWidget * snap_label , * snap_box ;
GtkWidget * size_label , * size_box ;
GtkWidget * fullscreen_check , * widescreen_check ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
GtkWidget * advanced_frame , * advanced_box ;
GtkWidget * advanced_scroll ;
GtkWidget * tree ;
2010-04-25 00:31:27 +00:00
2010-06-19 06:23:40 +00:00
if ( ! ( conf . loaded ( ) ) ) LoadConfig ( ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons (
" ZZOgl PG Config " ,
NULL , /* parent window*/
( GtkDialogFlags ) ( GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT ) ,
GTK_STOCK_CANCEL ,
GTK_RESPONSE_REJECT ,
GTK_STOCK_OK ,
GTK_RESPONSE_ACCEPT ,
NULL ) ;
log_check = gtk_check_button_new_with_label ( " Logging (For Debugging): " ) ;
int_label = gtk_label_new ( " Interlacing: (F5 to toggle) " ) ;
int_box = gtk_combo_box_new_text ( ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( int_box ) , " No Interlacing " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( int_box ) , " Interlace 0 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( int_box ) , " Interlace 1 " ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( int_box ) , conf . interlace ) ;
bilinear_check = gtk_check_button_new_with_label ( " Bilinear Filtering (Shift + F5) " ) ;
bilinear_label = gtk_label_new ( " Best quality is off. Turn on for speed. " ) ;
aa_label = gtk_label_new ( " Anti-Aliasing for Higher Quality(F6) " ) ;
aa_box = gtk_combo_box_new_text ( ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( aa_box ) , " 1X - No Anti-Aliasing " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( aa_box ) , " 2X - Anti-Aliasing x 2 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( aa_box ) , " 4X - Anti-Aliasing x 4 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( aa_box ) , " 8X - Anti-Aliasing x 8 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( aa_box ) , " 16X - Anti-Aliasing x 16 " ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( aa_box ) , conf . aa ) ;
wireframe_check = gtk_check_button_new_with_label ( " Wireframe Rendering(Shift + F6) " ) ;
avi_check = gtk_check_button_new_with_label ( " Capture Avi (as zerogs.avi)(F7) " ) ;
snap_label = gtk_label_new ( " Snapshot format: " ) ;
snap_box = gtk_combo_box_new_text ( ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( snap_box ) , " JPEG " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( snap_box ) , " TIFF " ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( snap_box ) , conf . options & GSOPTION_TGASNAP ) ;
fullscreen_check = gtk_check_button_new_with_label ( " Fullscreen (Alt + Enter) " ) ;
2010-03-27 04:28:12 +00:00
widescreen_check = gtk_check_button_new_with_label ( " Widescreen " ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
size_label = gtk_label_new ( " Default Window Size: (no speed impact) " ) ;
size_box = gtk_combo_box_new_text ( ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( size_box ) , " 640x480 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( size_box ) , " 800x600 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( size_box ) , " 1024x768 " ) ;
gtk_combo_box_append_text ( GTK_COMBO_BOX ( size_box ) , " 1280x960 " ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( size_box ) , ( conf . options & GSOPTION_WINDIMS ) > > 4 ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
main_box = gtk_hbox_new ( false , 5 ) ;
main_frame = gtk_frame_new ( " ZZOgl PG Config " ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
gtk_container_add ( GTK_CONTAINER ( main_frame ) , main_box ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
option_box = gtk_vbox_new ( false , 5 ) ;
option_frame = gtk_frame_new ( " " ) ;
gtk_container_add ( GTK_CONTAINER ( option_frame ) , option_box ) ;
advanced_box = gtk_vbox_new ( false , 5 ) ;
advanced_frame = gtk_frame_new ( " Advanced Settings: " ) ;
gtk_container_add ( GTK_CONTAINER ( advanced_frame ) , advanced_box ) ;
2010-04-25 00:31:27 +00:00
2010-03-27 04:28:12 +00:00
tree = gtk_tree_view_new ( ) ;
2010-05-01 20:33:53 +00:00
2010-03-27 04:28:12 +00:00
CreateGameHackTable ( tree ) ;
2010-05-01 20:33:53 +00:00
2010-03-27 04:28:12 +00:00
advanced_scroll = gtk_scrolled_window_new ( NULL , NULL ) ;
2010-05-01 20:33:53 +00:00
2010-03-27 04:28:12 +00:00
gtk_scrolled_window_add_with_viewport ( GTK_SCROLLED_WINDOW ( advanced_scroll ) , tree ) ;
2010-04-25 00:31:27 +00:00
2010-04-25 07:21:29 +00:00
gtk_box_pack_start ( GTK_BOX ( option_box ) , log_check , false , false , 2 ) ;
2010-03-27 04:28:12 +00:00
gtk_box_pack_start ( GTK_BOX ( option_box ) , int_label , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , int_box , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , bilinear_check , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , bilinear_label , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , aa_label , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , aa_box , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , wireframe_check , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , avi_check , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , snap_label , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , snap_box , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , fullscreen_check , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , widescreen_check , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , size_label , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( option_box ) , size_box , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( advanced_box ) , advanced_scroll , true , true , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( main_box ) , option_frame , false , false , 2 ) ;
gtk_box_pack_start ( GTK_BOX ( main_box ) , advanced_frame , true , true , 2 ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( log_check ) , conf . log ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( bilinear_check ) , conf . bilinear ) ;
2010-06-19 06:23:40 +00:00
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( wireframe_check ) , ( conf . wireframe ( ) ) ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( avi_check ) , ( conf . captureAvi ( ) ) ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( fullscreen_check ) , ( conf . fullscreen ( ) ) ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widescreen_check ) , ( conf . widescreen ( ) ) ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
gtk_container_add ( GTK_CONTAINER ( GTK_DIALOG ( dialog ) - > vbox ) , main_frame ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
gtk_widget_show_all ( dialog ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
return_value = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
if ( return_value = = GTK_RESPONSE_ACCEPT )
{
int fake_options = 0 ;
SaveGameHackTable ( tree ) ;
if ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( int_box ) ) ! = - 1 )
2010-03-27 04:28:12 +00:00
conf . interlace = gtk_combo_box_get_active ( GTK_COMBO_BOX ( int_box ) ) ;
2010-05-01 20:33:53 +00:00
if ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( aa_box ) ) ! = - 1 )
2010-03-27 04:28:12 +00:00
conf . aa = gtk_combo_box_get_active ( GTK_COMBO_BOX ( aa_box ) ) ;
2010-04-25 00:31:27 +00:00
conf . negaa = 0 ;
2010-05-01 20:33:53 +00:00
switch ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( size_box ) ) )
2010-03-27 04:28:12 +00:00
{
2010-05-01 20:33:53 +00:00
case 0 :
fake_options | = GSOPTION_WIN640 ;
break ;
case 1 :
fake_options | = GSOPTION_WIN800 ;
break ;
case 2 :
fake_options | = GSOPTION_WIN1024 ;
break ;
case 3 :
fake_options | = GSOPTION_WIN1280 ;
break ;
2010-03-27 04:28:12 +00:00
}
2010-04-25 00:31:27 +00:00
2010-04-25 07:21:29 +00:00
conf . log = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( log_check ) ) ;
2010-05-01 20:33:53 +00:00
2010-03-27 04:28:12 +00:00
conf . bilinear = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( bilinear_check ) ) ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( wireframe_check ) ) )
2010-03-27 04:28:12 +00:00
fake_options | = GSOPTION_WIREFRAME ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( avi_check ) ) )
2010-03-27 04:28:12 +00:00
fake_options | = GSOPTION_CAPTUREAVI ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( fullscreen_check ) ) )
2010-03-27 04:28:12 +00:00
fake_options | = GSOPTION_FULLSCREEN ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( widescreen_check ) ) )
2010-03-27 04:28:12 +00:00
fake_options | = GSOPTION_WIDESCREEN ;
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
if ( gtk_combo_box_get_active ( GTK_COMBO_BOX ( snap_box ) ) = = 1 )
2010-03-27 04:28:12 +00:00
fake_options | = GSOPTION_TGASNAP ;
conf . options = fake_options ;
2010-05-01 20:33:53 +00:00
2010-03-27 04:28:12 +00:00
SaveConfig ( ) ;
2010-05-01 20:33:53 +00:00
}
2010-04-25 00:31:27 +00:00
2010-05-01 20:33:53 +00:00
gtk_widget_destroy ( dialog ) ;
2010-03-19 00:31:15 +00:00
}
2010-03-27 04:28:12 +00:00
void CALLBACK GSconfigure ( )
2010-03-19 00:31:15 +00:00
{
2010-03-27 04:28:12 +00:00
char strcurdir [ 256 ] ;
getcwd ( strcurdir , 256 ) ;
2010-04-25 00:31:27 +00:00
2010-06-19 06:23:40 +00:00
if ( ! ( conf . loaded ( ) ) ) LoadConfig ( ) ;
2010-04-25 00:31:27 +00:00
2010-03-27 04:28:12 +00:00
DisplayDialog ( ) ;
2010-03-19 00:31:15 +00:00
}
2010-04-02 05:53:14 +00:00
void SysMessage ( const char * fmt , . . . )
2010-03-19 00:31:15 +00:00
{
2010-05-01 20:33:53 +00:00
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 ;
GtkWidget * dialog ;
dialog = gtk_message_dialog_new ( NULL ,
GTK_DIALOG_DESTROY_WITH_PARENT ,
GTK_MESSAGE_INFO ,
GTK_BUTTONS_OK ,
" %s " , msg ) ;
gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
gtk_widget_destroy ( dialog ) ;
2010-03-19 00:31:15 +00:00
}
2010-04-25 00:31:27 +00:00
void CALLBACK GSabout ( )
2010-03-19 00:31:15 +00:00
{
2010-03-27 04:28:12 +00:00
SysMessage ( " ZZOgl PG: by Zeydlitz (PG version worked on by arcum42). Based off of ZeroGS, by zerofrog. " ) ;
2010-03-19 00:31:15 +00:00
}
2010-04-25 00:31:27 +00:00
s32 CALLBACK GStest ( )
2010-03-19 00:31:15 +00:00
{
2010-03-27 04:28:12 +00:00
return 0 ;
2010-03-19 00:31:15 +00:00
}
2010-04-25 00:31:27 +00:00
void * SysLoadLibrary ( char * lib )
2010-03-19 00:31:15 +00:00
{
return dlopen ( lib , RTLD_NOW | RTLD_GLOBAL ) ;
}
2010-04-25 00:31:27 +00:00
void * SysLoadSym ( void * lib , char * sym )
2010-03-19 00:31:15 +00:00
{
void * ret = dlsym ( lib , sym ) ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
if ( ret = = NULL ) printf ( " null: %s \n " , sym ) ;
2010-05-01 20:33:53 +00:00
2010-03-19 00:31:15 +00:00
return dlsym ( lib , sym ) ;
}
2010-04-25 00:31:27 +00:00
char * SysLibError ( )
2010-03-19 00:31:15 +00:00
{
return dlerror ( ) ;
}
2010-04-25 00:31:27 +00:00
void SysCloseLibrary ( void * lib )
2010-03-19 00:31:15 +00:00
{
dlclose ( lib ) ;
}