GTK: Remove the libglade interface

It was unmaintained anyway, and the other one is a better base to start
from.  And if someone ever needs one of these files, they are preserved
in the git history anyway.
This commit is contained in:
Emmanuel Gil Peyrot 2020-11-18 23:38:27 +01:00
parent a5f13edb7f
commit 72386f28de
29 changed files with 0 additions and 8407 deletions

View File

@ -1,545 +0,0 @@
/* callbacks.c - this file is part of DeSmuME
*
* Copyright (C) 2007-2015 DeSmuME Team
* Copyright (C) 2007 Damien Nozay (damdoum)
* Copyright (C) 2007 Pascal Giard (evilynux)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "callbacks.h"
#include "../GPU.h"
#define SAVESTATE_SLOT(x) ((x) < 10 ? (x) : 0)
/* globals */
int Frameskip = 0;
gboolean ScreenRightForce=FALSE;
gboolean ScreenRight=FALSE;
gboolean ScreenGap=FALSE;
gboolean ScreenNoGap=FALSE;
gboolean ScreenInvert=FALSE;
/* ******** Savestate menu items handling ******** */
static void set_menuitem_label(GtkWidget * w, char * text )
{
GtkLabel * child;
if ( GTK_BIN(w)->child )
{
child = (GtkLabel*)GTK_BIN(w)->child;
gtk_label_set_text(child, text);
}
}
static void clear_savestate_menu(const char * cb_name, u8 num)
{
GtkWidget * w;
char cb[40];
char text[40];
sprintf( cb, "%s%d", cb_name, num);
sprintf( text, _("State %d (empty)"), num);
w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, text );
}
static void update_savestate_menu(const char * cb_name, u8 num)
{
GtkWidget * w;
char cb[40];
snprintf( cb, 39, "%s%d", cb_name, num);
w = glade_xml_get_widget(xml, cb);
set_menuitem_label( w, savestates[SAVESTATE_SLOT(num)].date );
}
static void update_savestates_menu()
{
u8 i;
for( i = 1; i <= NB_STATES; i++ )
{
if( savestates[SAVESTATE_SLOT(i)].exists == TRUE )
{
update_savestate_menu("loadstate", i);
update_savestate_menu("savestate", i);
}
else
{
clear_savestate_menu("loadstate", i);
clear_savestate_menu("savestate", i);
}
}
}
static void update_savestate(u8 num)
{
desmume_pause();
savestate_slot(SAVESTATE_SLOT(num));
update_savestate_menu("savestate", num);
update_savestate_menu("loadstate", num);
desmume_resume();
}
/* inline & protos */
inline void SET_SENSITIVE(const gchar *w, gboolean b) {
gtk_widget_set_sensitive(
glade_xml_get_widget(xml, w), TRUE);
}
void enable_rom_features() {
scan_savestates();
update_savestates_menu();
SET_SENSITIVE("menu_exec", TRUE);
SET_SENSITIVE("menu_pause", TRUE);
SET_SENSITIVE("menu_reset", TRUE);
SET_SENSITIVE("wgt_Exec", TRUE);
SET_SENSITIVE("wgt_Reset", TRUE);
}
static void MAINWINDOW_RESIZE() {
GtkWidget * spacer1 = glade_xml_get_widget(xml, "misc_sep3");
GtkWidget * spacer2 = glade_xml_get_widget(xml, "misc_sep4");
int dim1,dim2;
BOOL rotate = (ScreenRotate==90.0 || ScreenRotate==270.0 );
dim1 = dim2 = 66 * ScreenCoeff_Size[0];
/* sees whether we want a gap */
if (!ScreenGap) dim1 = dim2 = -1;
if (ScreenNoGap) {
gtk_widget_hide (spacer1);
gtk_widget_hide (spacer2);
}
else
{
gtk_widget_show (spacer1);
gtk_widget_show (spacer2);
}
if (ScreenRight == rotate) {
if (ScreenRight)
dim2 = -1;
else
dim1 = -1;
} else {
dim1 = dim2 = -1;
}
gtk_widget_set_usize(spacer1, dim1, -1);
gtk_widget_set_usize(spacer2, -1, dim2);
gtk_window_resize ((GtkWindow*)pWindow,1,1);
}
/* MENU FILE ***** ***** ***** ***** */
void inline ADD_FILTER(GtkWidget * filech, const char * pattern, const char * name) {
GtkFileFilter *pFilter;
pFilter = gtk_file_filter_new();
gtk_file_filter_add_pattern(pFilter, pattern);
gtk_file_filter_set_name(pFilter, name);
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(filech), pFilter);
}
static void file_open() {
desmume_pause();
GtkWidget *pFileSelection;
GtkWidget *pParent;
gchar *sChemin;
pParent = GTK_WIDGET(pWindow);
/* Creating the selection window */
pFileSelection = gtk_file_chooser_dialog_new(_("Open..."),
GTK_WINDOW(pParent),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
/* On limite les actions a cette fenetre */
gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE);
ADD_FILTER(pFileSelection, "*.nds", _("Nds binary (.nds)"));
ADD_FILTER(pFileSelection, "*.ds.gba", _("Nds binary with loader (.ds.gba)"));
ADD_FILTER(pFileSelection, "*", _("All files"));
//ADD_FILTER(pFileSelection, "*.zip", "Nds zipped binary");
/* Affichage fenetre*/
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection)))
{
case GTK_RESPONSE_OK:
/* Recuperation du chemin */
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
if(desmume_open((const char*)sChemin) < 0)
{
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
_("Unable to load :\n%s"), sChemin);
gtk_dialog_run(GTK_DIALOG(pDialog));
gtk_widget_destroy(pDialog);
} else {
desmume_resume();
enable_rom_features();
}
g_free(sChemin);
break;
default:
break;
}
gtk_widget_destroy(pFileSelection);
}
void on_menu_open_activate (GtkMenuItem *menuitem, gpointer user_data) { file_open();}
void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_main_quit(); }
#define SCREENS_PIXEL_SIZE 98304
static void Printscreen()
{
GdkPixbuf *screenshot;
gchar *filename = NULL;
GError *error = NULL;
u8 *rgb;
u16 *gpuFramebuffer = (u16 *)GPU->GetDisplayInfo().masterNativeBuffer;
static int seq = 0;
rgb = (u8 *) malloc(SCREENS_PIXEL_SIZE*3);
if (!rgb)
return;
for (int i = 0; i < SCREENS_PIXEL_SIZE; i++) {
rgb[(i * 3) + 0] = ((gpuFramebuffer[i] >> 0) & 0x1f) << 3;
rgb[(i * 3) + 1] = ((gpuFramebuffer[i] >> 5) & 0x1f) << 3;
rgb[(i * 3) + 2] = ((gpuFramebuffer[i] >> 10) & 0x1f) << 3;
}
screenshot = gdk_pixbuf_new_from_data(rgb,
GDK_COLORSPACE_RGB,
FALSE,
8,
256,
192*2,
256*3,
NULL,
NULL);
do {
g_free(filename);
filename = g_strdup_printf("./desmume-screenshot-%d.png", seq++);
}
while (g_file_test(filename, G_FILE_TEST_EXISTS));
gdk_pixbuf_save(screenshot, filename, "png", &error, NULL);
if (error) {
g_error_free (error);
g_printerr("Failed to save %s", filename);
seq--;
}
free(rgb);
g_object_unref(screenshot);
g_free(filename);
}
void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { Printscreen(); }
/* MENU SAVES ***** ***** ***** ***** */
void on_loadstateXX_activate (GtkMenuItem *m, gpointer d) {
int slot = dyn_CAST(int,d);
loadstate_slot(SAVESTATE_SLOT(slot));
}
void on_savestateXX_activate (GtkMenuItem *m, gpointer d) {
int slot = dyn_CAST(int,d);
update_savestate(slot);
}
void on_savetypeXX_activate (GtkMenuItem *m, gpointer d) {
int type = dyn_CAST(int,d);
desmume_savetype(type);
}
/* MENU EMULATION ***** ***** ***** ***** */
void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data) { desmume_resume(); }
void on_menu_pause_activate (GtkMenuItem *menuitem, gpointer user_data) { desmume_pause(); }
void on_menu_reset_activate (GtkMenuItem *menuitem, gpointer user_data) { desmume_reset(); }
void on_menu_layers_activate (GtkMenuItem *menuitem, gpointer user_data) {
/* we want to hide or show the checkbox for the layers */
GtkWidget * w1 = glade_xml_get_widget(xml, "wvb_1_Main");
GtkWidget * w2 = glade_xml_get_widget(xml, "wvb_2_Sub");
if (gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem)==TRUE) {
gtk_widget_show(w1);
gtk_widget_show(w2);
} else {
gtk_widget_hide(w1);
gtk_widget_hide(w2);
}
/* pack the window */
MAINWINDOW_RESIZE();
}
/* SUBMENU FRAMESKIP ***** ***** ***** ***** */
void on_fsXX_activate (GtkMenuItem *menuitem,gpointer user_data) {
Frameskip = dyn_CAST(int,user_data);
// printf ("setting FS %d %d\n", Frameskip, user_data);
}
/* SUBMENU SIZE ***** ***** ***** ***** */
static void gtk_table_reattach(GtkTable * table, GtkWidget * w,
guint left_attach, guint right_attach, guint top_attach, guint bottom_attach,
GtkAttachOptions xoptions, GtkAttachOptions yoptions,
guint xpadding, guint ypadding) {
GList *list;
for (list = table->children; list; list = list->next)
{
GtkTableChild *table_child;
table_child = (GtkTableChild *) list->data;
if (table_child->widget == w) {
table_child->left_attach = left_attach;
table_child->right_attach = right_attach;
table_child->top_attach = top_attach;
table_child->bottom_attach = bottom_attach;
table_child->xexpand = (xoptions & GTK_EXPAND) != 0;
table_child->xshrink = (xoptions & GTK_SHRINK) != 0;
table_child->xfill = (xoptions & GTK_FILL) != 0;
table_child->xpadding = xpadding;
table_child->yexpand = (yoptions & GTK_EXPAND) != 0;
table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
table_child->yfill = (yoptions & GTK_FILL) != 0;
table_child->ypadding = ypadding;
break;
}
}
}
static void rightscreen(BOOL apply) {
GtkWidget *chk = glade_xml_get_widget(xml, "wvb_2_Sub");
GtkTable *table = (GtkTable *)glade_xml_get_widget(xml, "table_layout");
ScreenRight = apply || ScreenRightForce;
if (ScreenRight) {
/* we want to change the layout, lower screen goes right */
gtk_table_reattach(table, pDrawingArea2,
3,4, 0,1, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
gtk_table_reattach(table, chk,
4,5, 0,1, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
} else {
/* we want to change the layout, lower screen goes down */
gtk_table_reattach(table, pDrawingArea2,
1,2, 2,3, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
gtk_table_reattach(table, chk,
0,1, 2,3, (GtkAttachOptions) 0, (GtkAttachOptions) 0, 0,0);
ScreenRight = FALSE;
}
gtk_widget_queue_resize (GTK_WIDGET (table));
/* pack the window */
MAINWINDOW_RESIZE();
}
int H=192, W=256;
void resize (float Size1, float Size2) {
// not ready yet to handle different zoom factors
Size2 = Size1;
/* we want to scale drawing areas by a factor (1x,2x or 3x) */
gtk_widget_set_size_request (pDrawingArea, W * Size1, H * Size1);
gtk_widget_set_size_request (pDrawingArea2, W * Size2, H * Size2);
ScreenCoeff_Size[0] = Size1;
ScreenCoeff_Size[1] = Size2;
/* remove artifacts */
black_screen();
/* pack the window */
MAINWINDOW_RESIZE();
}
void rotate(float angle) {
BOOL rotated;
if (angle >= 360.0) angle -= 360.0;
ScreenRotate = angle;
rotated = (ScreenRotate==90.0 || ScreenRotate==270.0);
ScreenInvert = (ScreenRotate >= 180.0);
if (rotated) {
H=256; W=192;
} else {
W=256; H=192;
}
rightscreen(rotated);
resize(ScreenCoeff_Size[0],ScreenCoeff_Size[1]);
}
void on_sizeXX_activate (GtkMenuItem *menuitem, gpointer user_data) {
float f = dyn_CAST(float,user_data);
// printf("setting ZOOM %f\n",f);
resize(f,f);
}
/* MENU CONFIG ***** ***** ***** ***** */
void on_menu_controls_activate (GtkMenuItem *menuitem, gpointer user_data) {
edit_controls();
}
/* Show joystick controls configuration dialog
FIXME: sdl doesn't detect unplugged joysticks!! */
void on_menu_joy_controls_activate (GtkMenuItem *menuitem, gpointer
user_data)
{
GtkDialog * dlg;
GtkDialog * msgbox;
char * text;
/* At least one joystick connected?
Can't configure joystick if SDL Event loop is already running. */
if( (nbr_joy < 1) || desmume_running() )
{
if( nbr_joy < 1 )
text = _("You don't have any joystick!");
else
text = _("Can't configure joystick while the game is running!");
dlg = (GtkDialog*)glade_xml_get_widget(xml, "wMainW");
msgbox = (GtkDialog*)
gtk_message_dialog_new((GtkWindow*)dlg,
(GtkDialogFlags) (GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"%s",
text);
g_signal_connect(G_OBJECT(msgbox), "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_dialog_run( msgbox );
}
else
{
dlg = (GtkDialog*)glade_xml_get_widget(xml, "wJoyConfDlg");
init_joy_labels();
gtk_dialog_run(dlg);
}
}
void on_menu_audio_on_activate (GtkMenuItem *menuitem, gpointer user_data) {
/* we want set audio emulation ON or OFF */
if (gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem)) {
SPU_Pause(0);
} else {
SPU_Pause(1);
}
}
void on_menu_gapscreen_activate (GtkMenuItem *menuitem, gpointer user_data) {
/* we want to add a gap between screens */
ScreenGap = gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
/* pack the window */
MAINWINDOW_RESIZE();
}
void on_menu_nogap_activate (GtkMenuItem *menuitem, gpointer user_data) {
/* we'll make both gaps visibility false */
ScreenNoGap = gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
/* pack the window */
MAINWINDOW_RESIZE();
}
void on_menu_rightscreen_activate (GtkMenuItem *menuitem, gpointer user_data) {
ScreenRightForce=gtk_check_menu_item_get_active((GtkCheckMenuItem*)menuitem);
rightscreen(ScreenRightForce);
}
void on_menu_rotatescreen_activate (GtkMenuItem *menuitem, gpointer user_data) {
/* we want to rotate the screen */
float angle = dyn_CAST(float,user_data);
rotate(angle);
}
/* MENU TOOLS ***** ***** ***** ***** */
void on_menu_IO_regs_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_1_IOregs");
gtk_widget_show(dlg);
}
void on_menu_memview_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_2_MemView");
gtk_widget_show(dlg);
}
void on_menu_palview_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_3_PalView");
gtk_widget_show(dlg);
}
#ifdef GTKGLEXT_AVAILABLE
void on_menu_tileview_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * dlg = glade_xml_get_widget(xml_tools, "wtools_4_TileView");
gtk_widget_show(dlg);
}
#else
void on_menu_tileview_activate (GtkMenuItem *menuitem, gpointer user_data) {
g_printerr("You need gtkglext for the tile viewer\n");
}
#endif
void on_menu_wtoolsXX_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * w = (GtkWidget *) user_data;
gtk_widget_show(w);
}
/* MENU ? ***** ***** ***** ***** */
/* About dialog
FIXME: Add proper copyright */
void on_menu_apropos_activate (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget * wAbout = glade_xml_get_widget(xml, "wAboutDlg");
gtk_about_dialog_set_version((GtkAboutDialog *)wAbout, VERSION);
gtk_widget_show(wAbout);
}
/* TOOLBAR ***** ***** ***** ***** */
void on_wgt_Open_clicked (GtkToolButton *toolbutton, gpointer user_data) { file_open(); }
void on_wgt_Reset_clicked (GtkToolButton *toolbutton, gpointer user_data) { desmume_reset(); }
void on_wgt_Quit_clicked (GtkToolButton *toolbutton, gpointer user_data) { gtk_main_quit(); }
void on_wgt_Exec_toggled (GtkToggleToolButton *toggletoolbutton, gpointer user_data) {
if (gtk_toggle_tool_button_get_active(toggletoolbutton)==TRUE)
desmume_resume();
else
desmume_pause();
}
/* LAYERS ***** ***** ***** ***** */
static void change_bgx_layer(int layer, gboolean state, GPUEngineBase *gpuEngine) {
//if(!desmume_running()) return;
gpuEngine->SetLayerEnableState(layer, (state) ? true : false);
//fprintf(stderr,"Changed Layer %s to %d\n",layer,state);
}
void on_wc_1_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) {
int layer = dyn_CAST(int,user_data);
change_bgx_layer(layer, gtk_toggle_button_get_active(togglebutton), GPU->GetEngineMain());
}
void on_wc_2_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) {
int layer = dyn_CAST(int,user_data);
change_bgx_layer(layer, gtk_toggle_button_get_active(togglebutton), GPU->GetEngineSub());
}

View File

@ -1,75 +0,0 @@
/* callbacks.h - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "globals.h"
extern "C" {
/* MENU FILE */
G_MODULE_EXPORT void on_menu_open_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_quit_activate (GtkMenuItem *menuitem, gpointer user_data);
/* MENU SAVES */
G_MODULE_EXPORT void on_loadstateXX_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savestateXX_activate (GtkMenuItem *, gpointer );
G_MODULE_EXPORT void on_savetypeXX_activate (GtkMenuItem *, gpointer );
/* MENU EMULATION */
G_MODULE_EXPORT void on_menu_exec_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_pause_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_reset_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_layers_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_fsXX_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_sizeXX_activate (GtkMenuItem *menuitem, gpointer user_data);
/* MENU CONFIG */
G_MODULE_EXPORT void on_menu_controls_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_joy_controls_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_audio_on_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_gapscreen_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_nogap_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_rightscreen_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_rotatescreen_activate (GtkMenuItem *menuitem, gpointer user_data);
/* MENU TOOLS */
G_MODULE_EXPORT void on_menu_wtoolsXX_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_IO_regs_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_memview_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_palview_activate (GtkMenuItem *menuitem, gpointer user_data);
G_MODULE_EXPORT void on_menu_tileview_activate (GtkMenuItem *menuitem, gpointer user_data);
/* MENU ? */
G_MODULE_EXPORT void on_menu_apropos_activate (GtkMenuItem *menuitem, gpointer user_data);
/* TOOLBAR */
G_MODULE_EXPORT void on_wgt_Open_clicked (GtkToolButton *toolbutton, gpointer user_data);
G_MODULE_EXPORT void on_wgt_Exec_toggled (GtkToggleToolButton *toggletoolbutton,
gpointer user_data);
G_MODULE_EXPORT void on_wgt_Reset_clicked (GtkToolButton *toolbutton, gpointer user_data);
G_MODULE_EXPORT void on_wgt_Quit_clicked (GtkToolButton *toolbutton, gpointer user_data);
/* LAYERS TOGGLE */
G_MODULE_EXPORT void on_wc_1_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data);
G_MODULE_EXPORT void on_wc_2_BGXX_toggled (GtkToggleButton *togglebutton, gpointer user_data);
}

View File

@ -1,409 +0,0 @@
/* callbacks_IO.c - this file is part of DeSmuME
*
* Copyright (C) 2007-2015 DeSmuME Team
* Copyright (C) 2007 Damien Nozay (damdoum)
* Copyright (C) 2007 Pascal Giard (evilynux)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "callbacks_IO.h"
#include "keyval_names.h"
static u16 Cur_Keypad = 0;
float ScreenCoeff_Size[2]={1.0,1.0};
float ScreenRotate=0.0;
gboolean Boost=FALSE;
int BoostFS=20;
int saveFS;
/* ***** ***** INPUT BUTTONS / KEYBOARD ***** ***** */
gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) {
u16 Key = lookup_key(event->keyval);
guint mask;
mask = GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_MOD5_MASK; // shift,ctrl, both alts
if( (event->state & mask) == 0){
if (event->keyval == keyboard_cfg[KEY_BOOST-1]) {
Boost = !Boost;
if (Boost) {
saveFS = Frameskip;
Frameskip = BoostFS;
} else {
Frameskip = saveFS;
}
return 1;
}
if(Key){
ADD_KEY( Cur_Keypad, Key );
if(desmume_running()) update_keypad(Cur_Keypad);
return 1;
}
}
return 0;
}
gboolean on_wMainW_key_release_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) {
u16 Key = lookup_key(event->keyval);
RM_KEY( Cur_Keypad, Key );
if(desmume_running()) update_keypad(Cur_Keypad);
return 1;
}
/* ***** ***** SCREEN DRAWING ***** ***** */
#define RAW_W 256
#define RAW_H 192
#define RAW_OFFSET 256*192*sizeof(u16)
#define MAX_SIZE 3
u32 on_screen_image32[RAW_W*RAW_H*2*MAX_SIZE*MAX_SIZE];
int inline screen_size() {
int sz = ScreenCoeff_Size[0];
return RAW_W*RAW_H*2*sz*sz*sizeof(u32);
}
int inline offset_pixels_lower_screen() {
return screen_size()/2;
}
void black_screen () {
/* removes artifacts when resizing with scanlines */
memset(on_screen_image32,0,screen_size());
}
#ifndef GTKGLEXT_AVAILABLE
// they are empty if no opengl
// else see gdk_gl.c / gdk_gl.h
BOOL my_gl_Begin (int screen) { return FALSE; }
void my_gl_End (int screen) {}
void reshape (GtkWidget * widget, int screen) {}
void init_GL_capabilities( int use_software_convert) {}
int has_pix_col_map=0;
u32 pix_col_map[0x8000];
static void init_pix_col_map() {
// precalc factors
int a,b,c,A,B,C,rA,rB,rC;
if (has_pix_col_map) return;
for (a=0; a<0x20; a++) {
A=a<<10; rA=A<<9;
for (b=0; b<0x20; b++) {
B=b<<5; rB=B<<6;
for (c=0; c<0x20; c++) {
C=c; rC=C<<3;
pix_col_map[A|B|C]=rA|rB|rC;
}
}
}
has_pix_col_map=1;
}
static void decode_screen () {
int x,y, m, W,H,L,BL;
u32 image[RAW_H*2][RAW_W], pix;
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
const size_t pixCount = GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT;
u16 * pixel = (u16 *)displayInfo.masterNativeBuffer;
u32 * rgb32 = &on_screen_image32[0];
ColorspaceApplyIntensityToBuffer16<false, false>(pixel, pixCount, displayInfo.backlightIntensity[NDSDisplayID_Main]);
ColorspaceApplyIntensityToBuffer16<false, false>(pixel + pixCount, pixCount, displayInfo.backlightIntensity[NDSDisplayID_Touch]);
/* decode colors */
init_pix_col_map();
for (y=0; y<RAW_H*2; y++) {
for (x=0; x<RAW_W; x++) {
image[y][x] = pix_col_map[*pixel&0x07FFF];
pixel++;
}
}
#define LOOP(a,b,c,d,e,f) \
L=W*ScreenCoeff_Size[0]; \
BL=L*sizeof(u32); \
for (a; b; c) { \
for (d; e; f) { \
pix = image[y][x]; \
for (m=0; m<ScreenCoeff_Size[0]; m++) { \
*rgb32 = pix; rgb32++; \
} \
} \
/* lines duplicated for scaling height */ \
for (m=1; m<ScreenCoeff_Size[0]; m++) { \
memmove(rgb32, rgb32-L, BL); \
rgb32 += L; \
} \
}
/* load pixels in buffer accordingly */
if (ScreenRotate) {
W=RAW_H; H=RAW_W;
LOOP(x=RAW_W-1, x >= 0, x--, y=0, y < RAW_H, y++)
LOOP(x=RAW_W-1, x >= 0, x--, y=RAW_H, y < RAW_H*2, y++)
} else {
H=RAW_H*2; W=RAW_W;
LOOP(y=0, y < RAW_H*2, y++, x=0, x < RAW_W, x++)
}
}
gboolean screen (GtkWidget * widget, int off) {
int H,W,L;
if (off==0)
decode_screen();
if (ScreenRotate) {
W=RAW_H; H=RAW_W;
} else {
H=RAW_H; W=RAW_W;
}
L=W*ScreenCoeff_Size[0]*sizeof(u32);
off*= offset_pixels_lower_screen();
gdk_draw_rgb_32_image (widget->window,
widget->style->fg_gc[widget->state],0,0,
W*ScreenCoeff_Size[0], H*ScreenCoeff_Size[0],
GDK_RGB_DITHER_NONE,((guchar*)on_screen_image32)+off,L);
return TRUE;
}
#endif /* if GTKGLEXT_AVAILABLE */
/* OUTPUT SCREENS */
gboolean on_wDrawScreen_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) {
NDSDisplayID displayID = (NDSDisplayID)dyn_CAST(int,user_data);
return screen(widget, displayID);
}
gboolean on_wDrawScreen_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer user_data) {
NDSDisplayID displayID = (NDSDisplayID)dyn_CAST(int,user_data);
reshape(widget, displayID);
return TRUE;
}
/* ***** ***** INPUT STYLUS / MOUSE ***** ***** */
static void resize_incremental(int i, GdkEventScroll *event) {
#ifdef GTKGLEXT_AVAILABLE
float zoom_inc=.125, zoom_min=0.25, zoom_max=5.0;
#else
float zoom_inc=1.0, zoom_min=1.0, zoom_max=3.0;
#endif
switch (event->direction) {
case GDK_SCROLL_UP:
ScreenCoeff_Size[i]=MIN(ScreenCoeff_Size[i]+zoom_inc,zoom_max); break;
case GDK_SCROLL_DOWN:
ScreenCoeff_Size[i]=MAX(ScreenCoeff_Size[i]-zoom_inc,zoom_min); break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_RIGHT:
return;
}
resize(ScreenCoeff_Size[0],ScreenCoeff_Size[1]);
}
gboolean on_wDrawScreen_scroll_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) {
int scr = dyn_CAST(int,user_data);
// separate zoom factors not supported yet
scr = 0;
resize_incremental(scr,(GdkEventScroll*)event);
return TRUE;
}
static void set_touch_pos (int x, int y) {
s32 EmuX, EmuY;
x /= ScreenCoeff_Size[1];
y /= ScreenCoeff_Size[1];
EmuX = x; EmuY = y;
if (ScreenRotate==90.0 || ScreenRotate==270.0) { EmuX = 256-y; EmuY = x; }
if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255;
if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192;
if (ScreenInvert) {
EmuX = 255-EmuX;
EmuY = 192-EmuY;
}
NDS_setTouchPos(EmuX, EmuY);
}
gboolean on_wDrawScreen_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
int scr = dyn_CAST(int,user_data);
GdkModifierType state;
gint x,y;
switch (event->button) {
case 1:
if (((scr==1) ^ ScreenInvert) && desmume_running()) {
click = TRUE;
gdk_window_get_pointer(widget->window, &x, &y, &state);
if (state & GDK_BUTTON1_MASK)
set_touch_pos(x,y);
}
break;
case 3: break;
case 2:
// filter out 2x / 3x clicks
if (event->type==GDK_BUTTON_PRESS)
rotate(ScreenRotate + 90.0); break;
}
return TRUE;
}
gboolean on_wDrawScreen_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
int scr = dyn_CAST(int,user_data);
if ((scr==1) ^ ScreenInvert) {
if (click) NDS_releaseTouch();
click = FALSE;
}
return TRUE;
}
gboolean on_wDrawScreen_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data) {
int scr = dyn_CAST(int,user_data);
GdkModifierType state;
gint x,y;
if (((scr==1) ^ ScreenInvert) && click)
{
if(event->is_hint)
gdk_window_get_pointer(widget->window, &x, &y, &state);
else
{
x= (gint)event->x;
y= (gint)event->y;
state=(GdkModifierType)event->state;
}
// fprintf(stderr,"X=%d, Y=%d, S&1=%d\n", x,y,state&GDK_BUTTON1_MASK);
if(state & GDK_BUTTON1_MASK)
set_touch_pos(x,y);
}
return TRUE;
}
/* ***** ***** KEYBOARD CONFIG / KEY DEFINITION ***** ***** */
u16 Keypad_Temp[NB_KEYS];
guint temp_Key=0;
static void init_labels() {
int i;
char text[50], bname[20];
GtkButton *b;
for (i=0; i<NB_KEYS; i++) {
snprintf(text, 50, "%s : %s", key_names[i],KEYNAME(keyboard_cfg[i]));
snprintf(bname, 20, "button_%s", key_names[i]);
b = (GtkButton*)glade_xml_get_widget(xml, bname);
gtk_button_set_label(b,text);
}
}
/* Initialize the joystick controls labels for the configuration window */
void init_joy_labels() {
int i;
char text[50], bname[30];
GtkButton *b;
for (i=0; i<NB_KEYS; i++) {
if( joypad_cfg[i] == (u16)(-1) ) continue; /* Key not configured */
snprintf(text, 50, "%s : %d",key_names[i],joypad_cfg[i]);
snprintf(bname, 30, "button_joy_%s",key_names[i]);
b = (GtkButton*)glade_xml_get_widget(xml, bname);
gtk_button_set_label(b,text);
}
}
void edit_controls() {
GtkDialog * dlg = (GtkDialog*)glade_xml_get_widget(xml, "wKeybConfDlg");
memcpy(&Keypad_Temp, &keyboard_cfg, sizeof(keyboard_cfg));
/* we change the labels so we know keyb def */
init_labels();
gtk_widget_show((GtkWidget*)dlg);
}
void on_wKeybConfDlg_response (GtkDialog *dialog, gint arg1, gpointer user_data) {
/* overwrite keyb def if user selected ok */
if (arg1 == GTK_RESPONSE_OK)
memcpy(&keyboard_cfg, &Keypad_Temp, sizeof(keyboard_cfg));
gtk_widget_hide((GtkWidget*)dialog);
}
void inline current_key_label() {
GtkLabel * lbl = (GtkLabel*)glade_xml_get_widget(xml, "label_key");
gtk_label_set_text(lbl, KEYNAME(temp_Key));
}
gboolean on_wKeyDlg_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) {
temp_Key = event->keyval;
current_key_label();
return TRUE;
}
static void ask(GtkButton*b, int key) {
char text[50];
GtkDialog * dlg = (GtkDialog*)glade_xml_get_widget(xml, "wKeyDlg");
key--; /* key = bit position, start with 1 */
temp_Key = Keypad_Temp[key];
current_key_label();
switch (gtk_dialog_run(dlg))
{
case GTK_RESPONSE_OK:
Keypad_Temp[key]=temp_Key;
snprintf(text, 50, "%s : %s",key_names[key],KEYNAME(temp_Key));
gtk_button_set_label(b,text);
break;
case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_NONE:
break;
}
gtk_widget_hide((GtkWidget*)dlg);
}
/* Joystick configuration / Key definition */
static void ask_joy_key(GtkButton*b, int key)
{
char text[50];
u16 joykey;
GtkWidget * dlg = (GtkWidget*)glade_xml_get_widget(xml, "wJoyDlg");
key--; /* remove 1 to get index */
gtk_widget_show_now(dlg);
/* Need to force event processing. Otherwise, popup won't show up. */
while ( gtk_events_pending() ) gtk_main_iteration();
joykey = get_set_joy_key(key);
snprintf(text, 50, "%s : %d",key_names[key],joykey);
gtk_button_set_label(b,text);
gtk_widget_hide((GtkWidget*)dlg);
}
/* Bind a keyboard key to a keypad key */
void on_button_kb_key_clicked (GtkButton *b, gpointer user_data)
{
int key = dyn_CAST( int, user_data );
ask( b, key );
}
/* Bind a joystick button to a keypad key */
void on_button_joy_key_clicked (GtkButton *b, gpointer user_data)
{
int key = dyn_CAST( int, user_data );
ask_joy_key( b, key );
}

View File

@ -1,51 +0,0 @@
/* callbacks_IO.h - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Copyright (C) 2007 Pascal Giard (evilynux)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "globals.h"
#include "gdk_gl.h"
extern "C" {
/* INPUT BUTTONS / KEYBOARD */
G_MODULE_EXPORT gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
G_MODULE_EXPORT gboolean on_wMainW_key_release_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
/* OUTPUT SCREENS */
G_MODULE_EXPORT gboolean on_wDrawScreen_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
G_MODULE_EXPORT gboolean on_wDrawScreen_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
/* INPUT STYLUS / MOUSE */
G_MODULE_EXPORT gboolean on_wDrawScreen_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data);
G_MODULE_EXPORT gboolean on_wDrawScreen_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
G_MODULE_EXPORT gboolean on_wDrawScreen_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
G_MODULE_EXPORT gboolean on_wDrawScreen_scroll_event (GtkWidget *widget, GdkEvent *event, gpointer user_data);
/* KEYBOARD CONFIG / KEY DEFINITION */
G_MODULE_EXPORT gboolean on_wKeyDlg_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
G_MODULE_EXPORT void on_wKeybConfDlg_response (GtkDialog *dialog, gint arg1, gpointer user_data);
G_MODULE_EXPORT void on_button_kb_key_clicked (GtkButton *button, gpointer user_data);
/* Joystick configuration / Key definition */
G_MODULE_EXPORT void on_button_joy_key_clicked (GtkButton *button, gpointer user_data);
}

View File

@ -1,163 +0,0 @@
/* callbacks_1_ioregs.cpp - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Copyright (C) 2007 Pascal Giard (evilynux)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "callbacks_dtools.h"
#include "dTools_display.h"
/* ***** ***** IO REGISTERS ***** ***** */
static int cpu=0;
static BOOL init=FALSE;
static int size_=0;
static dTools_dsp dsp;
static void update_regs_fast();
static void update_regs();
/* Register name list */
#define NBR_IO_REGS 7
typedef struct
{
char name[20];
u32 addr;
BOOL trunc;
} reg_name_addr;
const reg_name_addr Reg_Names_Addr[NBR_IO_REGS] =
{
{ "REG_IPCFIFOCNT", REG_IPCFIFOCNT, TRUE },
{ "REG_SPICNT", REG_SPICNT, TRUE },
{ "REG_IME", REG_IME, TRUE },
{ "REG_IE", REG_IE, FALSE },
{ "REG_IF", REG_IF, FALSE },
{ "REG_POWCNT1", REG_POWCNT1, TRUE },
{ "REG_DISPCAPCNT", REG_DISPA_DISPCAPCNT, FALSE }
};
/* update */
static void wtools_1_update () {
update_regs_fast();
}
/* Update register display */
static u32 mem[NBR_IO_REGS];
static void update_regs_fast(){
char text[11];
int i; u32 w, m;
for( i = 0; i < NBR_IO_REGS; i++ )
{
w = MMU_read32(cpu,Reg_Names_Addr[i].addr);
m = mem[i];
if ( Reg_Names_Addr[i].trunc ) {
w &= 0xFFFF;
m &= 0xFFFF;
}
mem[i] = w;
if (w == m) continue;
if ( Reg_Names_Addr[i].trunc )
sprintf(text, " 0x%04X", w);
else
sprintf(text, "0x%08X", w);
dTools_display_select_attr(&dsp, 2);
dTools_display_clear_char(&dsp, size_+3, i, 10);
dTools_display_draw_text(&dsp, size_+3, i, text);
}
}
static void update_regs()
{
char text[80];
int len, i;
if (init==FALSE) {
GtkWidget * wPaint = glade_xml_get_widget(xml_tools, "wtools_1_draw");
for( i = 0; i < NBR_IO_REGS; i++ ) {
len = strlen(Reg_Names_Addr[i].name);
if (size_<len) size_=len;
}
len = size_ + strlen(" : 0x00000000");
dTools_display_init(&dsp, wPaint, len, NBR_IO_REGS, 5);
dTools_display_add_markup(&dsp, "<tt><span foreground=\"blue\"> </span></tt>");
dTools_display_add_markup(&dsp, "<tt>0x00000000</tt>");
dTools_display_add_markup(&dsp, "<tt><span foreground=\"red\">0x00000000</span></tt>");
init=TRUE;
}
dTools_display_clear(&dsp);
for( i = 0; i < NBR_IO_REGS; i++ )
{
mem[i] = MMU_read32(cpu,Reg_Names_Addr[i].addr);
if ( Reg_Names_Addr[i].trunc )
sprintf(text, " 0x%04X", mem[i]);
else
sprintf(text, "0x%08X", mem[i]);
dTools_display_select_attr(&dsp, 0);
dTools_display_draw_text(&dsp, 0, i, Reg_Names_Addr[i].name);
dTools_display_draw_text(&dsp, size_, i, " : ");
dTools_display_select_attr(&dsp, 1);
dTools_display_draw_text(&dsp, size_+3, i, text);
}
}
gboolean on_wtools_1_draw_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
// clear the red marks :)
if (event->button==1)
update_regs();
return TRUE;
}
gboolean on_wtools_1_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) {
update_regs();
return TRUE;
}
void on_wtools_1_combo_cpu_changed (GtkComboBox *widget, gpointer user_data) {
/* c == 0 means ARM9 */
cpu=gtk_combo_box_get_active(widget);
update_regs();
}
/* show, register, unregister */
void on_wtools_1_IOregs_show (GtkWidget *widget, gpointer user_data) {
GtkWidget * combo = glade_xml_get_widget(xml_tools, "wtools_1_combo_cpu");
// do as if we had selected this button and ARM7 cpu
gtk_combo_box_set_active((GtkComboBox*)combo, 0);
register_Tool(wtools_1_update);
}
gboolean on_wtools_1_IOregs_close (GtkWidget *widget, ...) {
unregister_Tool(wtools_1_update);
gtk_widget_hide(widget);
return TRUE;
}

View File

@ -1,289 +0,0 @@
/* callbacks_2_memview.cpp - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "callbacks_dtools.h"
#include "dTools_display.h"
/* ***** ***** MEMORY VIEWER ***** ***** */
enum SHOW {
Bit8,
Bit16,
Bit32
};
static BOOL init=FALSE;
static enum SHOW packmode=Bit8;
static u32 address=0, tmpaddr=0;
int cpu=0;
static char patt[512];
static u8 mem[0x100];
static dTools_dsp dsp;
static GtkEntry *wAddress;
static GtkRange *wRange;
static void refresh();
static void initialize();
/* update */
static void wtools_2_update() {
int i,j;
u8 m8, *mem8 =mem;
u16 m16, *mem16=(u16*)mem;
u32 m32, *mem32=(u32*)mem;
u32 addr;
char txt[16];
// red
dTools_display_select_attr(&dsp, 3);
addr = address;
switch (packmode) {
case Bit8:
for (i=0; i<0x10; i++) {
for (j=0; j<16; j++, addr++,mem8++) {
m8 = *mem8; *mem8 = MMU_read8(cpu, addr);
if (m8 != *mem8) {
sprintf(txt, "%02X", *mem8);
dTools_display_clear_char(&dsp, 12+3*j, i, 3);
dTools_display_draw_text(&dsp, 12+3*j, i, txt);
}
}
}
break;
case Bit16:
for (i=0; i<0x10; i++) {
for (j=0; j<16; j+=2, addr+=2,mem16++) {
m16 = *mem16; *mem16 = MMU_read16(cpu, addr);
if (m16 != *mem16) {
sprintf(txt, " %04X", *mem16);
dTools_display_clear_char(&dsp, 12+3*j, i, 6);
dTools_display_draw_text(&dsp, 12+3*j, i, txt);
}
}
}
break;
case Bit32:
for (i=0; i<0x10; i++) {
for (j=0; j<16; j+=4, addr+=4,mem32++) {
m32 = *mem32; *mem32 = MMU_read32(cpu, addr);
if (m32 != *mem32) {
sprintf(txt, " %08X", *mem32);
dTools_display_clear_char(&dsp, 12+3*j, i, 12);
dTools_display_draw_text(&dsp, 12+3*j, i, txt);
}
}
}
break;
}
}
gboolean on_wtools_2_draw_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {
// clear the red marks :)
if (event->button==1)
refresh();
return TRUE;
}
/* which cpu we look into */
void on_wtools_2_cpu_changed (GtkComboBox *widget, gpointer user_data) {
/* c == 0 means ARM9 */
cpu=gtk_combo_box_get_active(widget);
refresh();
}
/* how to pack bytes */
void on_wtools_2_r8_toggled (GtkToggleButton *togglebutton, gpointer user_data) { packmode=Bit8; refresh(); }
void on_wtools_2_r16_toggled (GtkToggleButton *togglebutton, gpointer user_data) { packmode=Bit16; refresh(); }
void on_wtools_2_r32_toggled (GtkToggleButton *togglebutton, gpointer user_data) { packmode=Bit32; refresh(); }
/* which address */
#define RANGE_MIN 0
#define RANGE_MAX 0x10000000
#define ADDR_MASK 0xFFFFFFF
#define STEP_ONE_LINE 0x1
#define STEP_ONE_PAGE 0x10
#define STEP_x10_PAGE 0x100
static void scroll_address(u32 addr) {
address = (addr & ADDR_MASK);
refresh();
}
static void change_address(u32 addr) {
addr /= 0x10;
gtk_range_set_value(wRange, addr);
}
static void add_to_address(s32 inc) {
u32 addr = (address+inc) & ADDR_MASK;
gtk_range_set_value(wRange, addr);
}
void on_wtools_2_GotoAddress_activate (GtkEntry *entry, gpointer user_data) {
change_address(strtol(gtk_entry_get_text(entry),NULL,0));
}
void on_wtools_2_GotoAddress_changed (GtkEntry *entry, gpointer user_data) {
tmpaddr=strtol(gtk_entry_get_text(entry),NULL,0);
}
void on_wtools_2_GotoButton_clicked (GtkButton *button, gpointer user_data) {
change_address(tmpaddr);
}
/* show, register, unregister */
void on_wtools_2_MemView_show (GtkWidget *widget, gpointer user_data) {
initialize();
register_Tool(wtools_2_update);
}
gboolean on_wtools_2_MemView_close (GtkWidget *widget, ...) {
unregister_Tool(wtools_2_update);
dTools_display_free(&dsp);
gtk_widget_hide(widget);
return TRUE;
}
/* scroll functions :D */
void on_wtools_2_scroll_value_changed (GtkRange *range, gpointer user_data) {
u32 addr=(u32)gtk_range_get_value(range);
scroll_address(addr);
}
gboolean on_wtools_2_draw_scroll_event (GtkWidget *widget, GdkEventScroll *event, gpointer user_data) {
switch (event->direction) {
case GDK_SCROLL_UP:
add_to_address(-STEP_ONE_PAGE); break;
case GDK_SCROLL_DOWN:
add_to_address(+STEP_ONE_PAGE); break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_RIGHT:
default:
break;
}
return TRUE;
}
gboolean on_wtools_2_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { refresh(); return TRUE; }
/* initialise what we have to */
static void initialize() {
GtkWidget * combo;
GtkWidget * wPaint;
GtkAdjustment *adj;
if (init) return;
combo = glade_xml_get_widget(xml_tools, "wtools_2_cpu");
adj = (GtkAdjustment *)gtk_adjustment_new (RANGE_MIN, RANGE_MIN, RANGE_MAX,
STEP_ONE_LINE, STEP_x10_PAGE, STEP_ONE_PAGE);
// get widget reference
wAddress = (GtkEntry*)glade_xml_get_widget(xml_tools, "wtools_2_GotoAddress");
wRange = (GtkRange*)glade_xml_get_widget(xml_tools, "wtools_2_scroll");
wPaint = glade_xml_get_widget(xml_tools, "wtools_2_draw");
dTools_display_init(&dsp, wPaint, 80, 16, 5);
#define PATT(x) x"<span foreground=\"#608060\">" x "</span>"
#define DUP(x) x x
sprintf(patt, "<tt><span foreground=\"blue\">0000:0000</span> | %s| 0123456789ABCDEF</tt>", DUP(DUP(DUP(PATT("00_")))) );
dTools_display_add_markup(&dsp, patt);
sprintf(patt, "<tt><span foreground=\"blue\">0000:0000</span> | %s| 0123456789ABCDEF</tt>", DUP(DUP(PATT("_0000_"))) );
dTools_display_add_markup(&dsp, patt);
sprintf(patt, "<tt><span foreground=\"blue\">0000:0000</span> | %s| 0123456789ABCDEF</tt>", DUP(PATT("__00000000__")) );
dTools_display_add_markup(&dsp, patt);
#undef DUP
#undef PATT
strcpy(patt, "<tt><span foreground=\"red\">__00000000__</span></tt>");
dTools_display_add_markup(&dsp, patt);
init = TRUE;
gtk_combo_box_set_active((GtkComboBox*)combo, 0);
gtk_range_set_adjustment(wRange, adj);
change_address(RANGE_MIN);
}
/* PAINT memory panel */
static void refresh() {
int i,j,addr;
u8 c;
u8 *mem8=mem;
u16 *mem16=(u16*)mem;
u32 *mem32=(u32*)mem;
char *ptxt, txt[]="0000:0000 | 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF | 0123456789ABCDEF\0";
if (!init) return;
addr=address * 0x10;
for (i=0; i<0x100; i++)
mem[i] = MMU_read8(cpu, addr+i);
dTools_display_clear(&dsp);
switch(packmode) {
case Bit8: dTools_display_select_attr(&dsp, 0); break;
case Bit16: dTools_display_select_attr(&dsp, 1); break;
case Bit32: dTools_display_select_attr(&dsp, 2); break;
}
// draw memory content here
for (i=0; i<0x10; i++) {
ptxt = txt;
sprintf(ptxt, "%04X:%04X | ", (addr>>16)&0xFFFF, addr&0xFFFF); ptxt+=12;
switch(packmode) {
case Bit8:
for (j=0; j<16; j++,ptxt+=3)
sprintf(ptxt, "%02X ", mem8[j]);
break;
case Bit16:
for (j=0; j<16; j+=2,ptxt+=6, mem16++)
sprintf(ptxt, " %04X ", *mem16);
break;
case Bit32:
for (j=0; j<16; j+=4,ptxt+=12, mem32++)
sprintf(ptxt, " %08X ", *mem32);
break;
}
sprintf(ptxt, "| "); ptxt +=2;
for (j=0; j<16; j++,ptxt++)
// only ASCII printable
sprintf(ptxt, "%c", ((c=mem8[j])<0x20)?'.':((c>=0x7F)?'.':c));
addr += 16;
mem8 +=16;
*(ptxt)=0;
dTools_display_draw_text(&dsp, 0, i, txt);
}
}

View File

@ -1,167 +0,0 @@
/* callbacks_3_palview.cpp - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "callbacks_dtools.h"
void init_combo_palette(GtkComboBox *combo, u16 ** addresses) {
GtkTreeIter iter;
GtkListStore* model = gtk_list_store_new(1, G_TYPE_STRING);
gtk_combo_box_set_model(combo, (GtkTreeModel*)model);
int i=0;
#define DO(str,addr,r) \
gtk_list_store_append (model, &iter); \
gtk_list_store_set (model, &iter, 0, str,-1); \
addresses[i]=((u16*)(addr) r); i++;
DO("Main screen BG PAL", MMU.ARM9_VMEM,)
DO("Main screen SPR PAL", MMU.ARM9_VMEM,+0x100)
DO("Sub screen BG PAL", MMU.ARM9_VMEM,+0x200)
DO("Sub screen SPR PAL", MMU.ARM9_VMEM,+0x300)
DO("Main screen ExtPAL 0", MMU.ExtPal[0][0],)
DO("Main screen ExtPAL 1", MMU.ExtPal[0][1],)
DO("Main screen ExtPAL 2", MMU.ExtPal[0][2],)
DO("Main screen ExtPAL 3", MMU.ExtPal[0][3],)
DO("Sub screen ExtPAL 0", MMU.ExtPal[1][0],)
DO("Sub screen ExtPAL 1", MMU.ExtPal[1][1],)
DO("Sub screen ExtPAL 2", MMU.ExtPal[1][2],)
DO("Sub screen ExtPAL 3", MMU.ExtPal[1][3],)
DO("Main screen SPR ExtPAL 0", MMU.ObjExtPal[0][0],)
DO("Main screen SPR ExtPAL 1", MMU.ObjExtPal[0][1],)
DO("Sub screen SPR ExtPAL 0", MMU.ObjExtPal[1][0],)
DO("Sub screen SPR ExtPAL 1", MMU.ObjExtPal[1][1],)
DO("Texture PAL 0", MMU.texInfo.texPalSlot[0],)
DO("Texture PAL 1", MMU.texInfo.texPalSlot[1],)
DO("Texture PAL 2", MMU.texInfo.texPalSlot[2],)
DO("Texture PAL 3", MMU.texInfo.texPalSlot[3],)
#undef DO
gtk_combo_box_set_active(combo,0);
}
static u16* base_addr[20];
static BOOL init=FALSE;
static int palnum=0;
static int palindex=0;
static void refresh();
static GtkWidget * wPaint;
static GtkSpinButton * wSpin;
static u16 mem[0x100];
//static COLOR c;
//static COLOR32 c32;
static GdkGC * gdkGC;
static inline void paint_col(int x, int y, u16 col) {
//c.val = col;
//COLOR_16_32(c,c32)
//gdk_rgb_gc_set_foreground(gdkGC, c32.val);
//gdk_draw_rectangle(wPaint->window, gdkGC, TRUE, x, y, 15, 15);
}
static inline void paint_cross(int x, int y) {
gdk_rgb_gc_set_foreground(gdkGC, 0x808080);
gdk_draw_rectangle(wPaint->window, gdkGC, TRUE, x, y, 15, 15);
gdk_rgb_gc_set_foreground(gdkGC, 0xFF0000);
gdk_draw_line(wPaint->window, gdkGC, x+14, y+1, x+1, y+14);
gdk_draw_line(wPaint->window, gdkGC, x+1, y+1, x+14, y+14);
}
static void wtools_3_update() {
int i,x,y,X,Y;
u16 * addr = base_addr[palindex], tmp;
gdkGC = gdk_gc_new(wPaint->window);
if (addr) {
memcpy(mem, addr, 0x100*sizeof(u16));
i=0;
for(y=Y= 0; y < 16; y++,Y+=16)
for(x=X= 0; x < 16; x++,X+=16) {
tmp=mem[i];
if (tmp != (mem[i]=*(addr+Y+x+0x100*palnum)))
paint_col(X,Y,mem[i]);
}
} else {
for(y=Y= 0; y < 16; y++,Y+=16)
for(x=X= 0; x < 16; x++,X+=16)
paint_cross(X,Y);
}
g_object_unref(gdkGC);
}
static void refresh() {
int x,y,X,Y; u16 * addr = base_addr[palindex];
gdkGC = gdk_gc_new(wPaint->window);
if (addr) {
memcpy(mem, addr, 0x100*sizeof(u16));
for(y=Y= 0; y < 16; y++,Y+=16)
for(x=X= 0; x < 16; x++,X+=16)
paint_col(X,Y,*(addr+Y+x+0x100*palnum));
} else {
for(y=Y= 0; y < 16; y++,Y+=16)
for(x=X= 0; x < 16; x++,X+=16)
paint_cross(X,Y);
}
g_object_unref(gdkGC);
}
static void initialize() {
GtkComboBox * combo;
if (init) return;
wPaint= glade_xml_get_widget(xml_tools, "wtools_3_draw");
wSpin = (GtkSpinButton*)glade_xml_get_widget(xml_tools, "wtools_3_palnum");
combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_3_palette");
init_combo_palette(combo, base_addr);
init=TRUE;
}
void on_wtools_3_PalView_show (GtkWidget *widget, gpointer data) {
initialize();
register_Tool(wtools_3_update);
}
gboolean on_wtools_3_PalView_close (GtkWidget *widget, ...) {
unregister_Tool(wtools_3_update);
gtk_widget_hide(widget);
return TRUE;
}
gboolean on_wtools_3_draw_expose_event (GtkWidget * widget, GdkEventExpose *event, gpointer user_data) {
refresh();
return TRUE;
}
void on_wtools_3_palette_changed (GtkComboBox *combo, gpointer user_data) {
palindex = gtk_combo_box_get_active(combo);
gtk_widget_set_sensitive((GtkWidget*)wSpin,(palindex >=4));
gtk_spin_button_set_value(wSpin,0);
refresh();
}
void on_wtools_3_palnum_value_changed (GtkSpinButton *spin, gpointer user_data) {
palnum = gtk_spin_button_get_value_as_int(spin);
refresh();
}

View File

@ -1,329 +0,0 @@
/* callbacks_3_palview.cpp - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "callbacks_dtools.h"
#ifdef GTKGLEXT_AVAILABLE
#include "../gdk_gl.h"
void init_combo_memory(GtkComboBox *combo, u8 ** addresses) {
GtkTreeIter iter;
GtkListStore* model = gtk_list_store_new(1, G_TYPE_STRING);
gtk_combo_box_set_model(combo, (GtkTreeModel*)model);
int i=0;
#define DO(str,addr,r) \
gtk_list_store_append (model, &iter); \
gtk_list_store_set (model, &iter, 0, str,-1); \
addresses[i]=(addr r); i++;
// FIXME: update tileview to actually work
// DO("A-BG - 0x6000000",MMU.ARM9_ABG,)
// DO("A-BG - 0x6010000",MMU.ARM9_ABG,+0x10000)
// DO("A-BG - 0x6020000",MMU.ARM9_ABG,+0x20000)
// DO("A-BG - 0x6030000",MMU.ARM9_ABG,+0x30000)
// DO("A-BG - 0x6040000",MMU.ARM9_ABG,+0x40000)
// DO("A-BG - 0x6050000",MMU.ARM9_ABG,+0x50000)
// DO("A-BG - 0x6060000",MMU.ARM9_ABG,+0x60000)
// DO("A-BG - 0x6070000",MMU.ARM9_ABG,+0x70000)
// DO("B-BG - 0x6200000",MMU.ARM9_BBG,)
// DO("B-BG - 0x6210000",MMU.ARM9_BBG,+0x10000)
// DO("A-OBJ- 0x6400000",MMU.ARM9_AOBJ,)
// DO("A-OBJ- 0x6410000",MMU.ARM9_AOBJ,+0x10000)
// DO("A-OBJ- 0x6420000",MMU.ARM9_AOBJ,+0x20000)
// DO("A-OBJ- 0x6430000",MMU.ARM9_AOBJ,+0x30000)
// DO("B-OBJ- 0x6600000",MMU.ARM9_BOBJ,)
// DO("B-OBJ- 0x6610000",MMU.ARM9_BOBJ,+0x10000)
DO("LCD - 0x6800000",MMU.ARM9_LCD,)
DO("LCD - 0x6810000",MMU.ARM9_LCD,+0x10000)
DO("LCD - 0x6820000",MMU.ARM9_LCD,+0x20000)
DO("LCD - 0x6830000",MMU.ARM9_LCD,+0x30000)
DO("LCD - 0x6840000",MMU.ARM9_LCD,+0x40000)
DO("LCD - 0x6850000",MMU.ARM9_LCD,+0x50000)
DO("LCD - 0x6860000",MMU.ARM9_LCD,+0x60000)
DO("LCD - 0x6870000",MMU.ARM9_LCD,+0x70000)
DO("LCD - 0x6880000",MMU.ARM9_LCD,+0x80000)
DO("LCD - 0x6890000",MMU.ARM9_LCD,+0x90000)
#undef DO
gtk_combo_box_set_active(combo,0);
}
static u16* pal_addr[20];
static u8* mem_addr[26];
static BOOL init=FALSE;
static int palnum=0;
static int palindex=0;
static int memnum=0;
static int colnum=0;
static void refresh();
static GtkWidget * wPaint;
static GtkSpinButton * wSpin;
static NDSDisplayID gl_context_num = NDSDisplayID_Main;
#define TILE_NUM_MAX 1024
#define TILE_W_SZ 8
#define TILE_H_SZ 8
static void wtools_4_update() {
}
typedef u16 tileBMP[8*8];
static void refresh() {
u16 palette_16[64];
u16 palette_256[64];
u8 * index16, * index256, * indexBMP;
u16 * pal;
int tile_n, index;
guint Textures;
if (!init) return;
index16 = index256 = indexBMP = mem_addr[memnum];
// this little thing doesnt display properly
// nothing drawn...
// seems that is the context is not shared there is a pb switching context
/*
if (!my_gl_Begin(gl_context_num)) return;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
my_gl_DrawBeautifulQuad();
my_gl_End(gl_context_num);
return;
*/
if (!my_gl_Begin(gl_context_num)) return;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
#if 1
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &Textures);
//proxy
glBindTexture(GL_TEXTURE_2D, Textures);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
256, 256, 0,
GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, indexBMP);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2d(-1.0, 1.0);
glTexCoord2f(1.0, 0.0); glVertex2d( 1.0, 1.0);
glTexCoord2f(1.0, 1.0); glVertex2d( 1.0,-1.0);
glTexCoord2f(0.0, 1.0); glVertex2d(-1.0,-1.0);
glEnd();
glDeleteTextures(1, &Textures);
my_gl_End(gl_context_num);
return;
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA,
256, 256, 0,
GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
switch(colnum) {
case 0: //BMP
for (tile_n=0; tile_n<TILE_NUM_MAX; tile_n++) {
glTexSubImage2D(GL_TEXTURE_2D, 0,
(tile_n & 0x1F)<<3, (tile_n >> 5)<<3,
8, 8, GL_RGBA,
GL_UNSIGNED_SHORT_1_5_5_5_REV, indexBMP);
indexBMP +=64;
}
break;
case 1: //256c
pal = pal_addr[palindex];
if (pal) {
pal += palnum*256;
for (tile_n=0; tile_n<1024; tile_n++) {
for (index=0; index<64; index++) {
palette_256[index]=pal[*index256];
index256++;
}
glTexSubImage2D(GL_TEXTURE_2D, 0,
(tile_n & 0x1F)<<3, (tile_n >> 5)<<3,
8, 8, GL_RGBA,
GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_256);
}
}
break;
case 2: //16c
pal = pal_addr[palindex];
if (pal) {
pal += palnum*16;
for (tile_n=0; tile_n<1024; tile_n++) {
for (index=0; index<64-1; index++) {
if (index & 1) continue;
palette_16[index] =pal[*index16 & 15];
palette_16[index+1]=pal[*index16 >> 4];
index16++;
}
glTexSubImage2D(GL_TEXTURE_2D, 0,
(tile_n & 0x1F)<<3, (tile_n >> 5)<<3,
8, 8, GL_RGBA,
GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_16);
}
}
break;
}
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2d(-0.5, 0.5);
glTexCoord2f(0.0, 1.0); glVertex2d(-0.5,-0.5);
glTexCoord2f(1.0, 1.0); glVertex2d( 0.5,-0.5);
glTexCoord2f(1.0, 0.0); glVertex2d( 0.5, 0.5);
glEnd();
glDeleteTextures(1, &Textures);
#else
glDisable(GL_LIGHTING);
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor4ub(255,255,255,255);
switch(colnum) {
case 0: //BMP
{
tileBMP tiles * = indexBMP;
for (tile_n=0; tile_n<1024; tile_n++) {
i = (tile_n & 0x1F) << 4;
j = (tile_n >> 5) << 12;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16; j+=512;
memcpy(bmp + j + i, indexBMP, 16); indexBMP += 16;
}
glRasterPos2i(0,0);
glDrawPixels(256,256,GL_RGBA,GL_UNSIGNED_SHORT_1_5_5_5_REV, bmp);
}
break;
case 1: //256c
if (pal = pal_addr[palindex]) {
pal += palnum*256;
for (tile_n=0; tile_n<1024; tile_n++) {
for (index=0; index<64; index++) {
palette_256[index]=pal[*index256];
index256++;
}
glRasterPos2i((tile_n & 0x1F)<<3, (tile_n >> 5)<<3);
glDrawPixels(8,8,GL_RGBA,GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_256);
}
}
break;
case 2: //16c
if (pal = pal_addr[palindex]) {
pal += palnum*16;
for (tile_n=0; tile_n<1024; tile_n++) {
for (index=0; index<64; index++) {
if (index & 1) continue;
palette_16[index] =pal[*index16 & 15];
palette_16[index+1]=pal[*index16 >> 4];
index16++;
}
glRasterPos2i((tile_n & 0x1F)<<3, (tile_n >> 5)<<3);
glDrawPixels(8,8,GL_RGBA,GL_UNSIGNED_SHORT_1_5_5_5_REV, palette_16);
}
}
break;
}
#endif
my_gl_End(gl_context_num);
}
static void initialize() {
GtkComboBox * combo;
if (init) return;
wPaint= glade_xml_get_widget(xml_tools, "wDraw_Tile");
wSpin = (GtkSpinButton*)glade_xml_get_widget(xml_tools, "wtools_4_palnum");
combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_4_palette");
init_combo_palette(combo, pal_addr);
combo = (GtkComboBox*)glade_xml_get_widget(xml_tools, "wtools_4_memory");
init_combo_memory(combo, mem_addr);
gl_context_num = init_GL_free_s(wPaint, NDSDisplayID_Main);
reshape(wPaint, gl_context_num);
gtk_widget_show(wPaint);
init=TRUE;
}
void on_wtools_4_TileView_show (GtkWidget *widget, gpointer data) {
initialize();
register_Tool(wtools_4_update);
}
gboolean on_wtools_4_TileView_close (GtkWidget *widget, ...) {
unregister_Tool(wtools_4_update);
gtk_widget_hide(widget);
return TRUE;
}
void on_wtools_4_palette_changed (GtkComboBox *combo, gpointer user_data) {
palindex = gtk_combo_box_get_active(combo);
gtk_widget_set_sensitive((GtkWidget*)wSpin,(palindex >=4));
gtk_spin_button_set_value(wSpin,0);
gtk_widget_queue_draw(wPaint);
}
void on_wtools_4_palnum_value_changed (GtkSpinButton *spin, gpointer user_data) {
palnum = gtk_spin_button_get_value_as_int(spin);
gtk_widget_queue_draw(wPaint);
}
void on_wtools_4_memory_changed (GtkComboBox *combo, gpointer user_data) {
memnum = gtk_combo_box_get_active(combo);
gtk_widget_queue_draw(wPaint);
}
void on_wtools_4_rXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) {
colnum = dyn_CAST(int,user_data);
gtk_widget_queue_draw(wPaint);
}
gboolean on_wDraw_Tile_expose_event (GtkWidget * w, GdkEventExpose * e, gpointer user_data) {
refresh();
return TRUE;
}
#else
void on_wtools_4_TileView_show (GtkWidget *widget, gpointer data) {
}
gboolean on_wtools_4_TileView_close (GtkWidget *widget, ...) {
return FALSE;
}
void on_wtools_4_palette_changed (GtkComboBox *combo, gpointer user_data) {
}
void on_wtools_4_palnum_value_changed (GtkSpinButton *spin, gpointer user_data) {
}
void on_wtools_4_memory_changed (GtkComboBox *combo, gpointer user_data) {
}
void on_wtools_4_rXX_toggled (GtkToggleButton *togglebutton, gpointer user_data) {
}
gboolean on_wDraw_Tile_expose_event (GtkWidget * w, GdkEventExpose * e, gpointer user_data) {
return FALSE;
}
#endif

View File

@ -1,79 +0,0 @@
/* callbacks_dtools.h - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CALLBACKS_DTOOLS_H__
#define __CALLBACKS_DTOOLS_H__
#include "../globals.h"
extern "C" {
/* ***** ***** IO REGISTERS ***** ***** */
G_MODULE_EXPORT void on_wtools_1_combo_cpu_changed (GtkComboBox *, gpointer );
G_MODULE_EXPORT void on_wtools_1_IOregs_show (GtkWidget *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_1_IOregs_close (GtkWidget *, ...);
G_MODULE_EXPORT gboolean on_wtools_1_draw_button_release_event(GtkWidget *, GdkEventButton *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_1_draw_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
/* ***** ***** MEMORY VIEWER ***** ***** */
G_MODULE_EXPORT void on_wtools_2_MemView_show (GtkWidget *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_2_MemView_close (GtkWidget *, ...);
G_MODULE_EXPORT void on_wtools_2_cpu_changed (GtkComboBox *, gpointer );
G_MODULE_EXPORT void on_wtools_2_r8_toggled (GtkToggleButton *, gpointer );
G_MODULE_EXPORT void on_wtools_2_r16_toggled (GtkToggleButton *, gpointer );
G_MODULE_EXPORT void on_wtools_2_r32_toggled (GtkToggleButton *, gpointer );
G_MODULE_EXPORT void on_wtools_2_GotoAddress_activate (GtkEntry *, gpointer );
G_MODULE_EXPORT void on_wtools_2_GotoAddress_changed (GtkEntry *, gpointer );
G_MODULE_EXPORT void on_wtools_2_GotoButton_clicked (GtkButton *, gpointer );
G_MODULE_EXPORT void on_wtools_2_scroll_value_changed (GtkRange *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_2_draw_button_release_event(GtkWidget *, GdkEventButton *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_2_draw_expose_event (GtkWidget *, GdkEventExpose *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_2_draw_scroll_event (GtkWidget *, GdkEventScroll *, gpointer );
/* ***** ***** PALETTE VIEWER ***** ***** */
// initialise combo box for all palettes
void init_combo_palette(GtkComboBox *combo, u16 ** addresses);
G_MODULE_EXPORT void on_wtools_3_PalView_show (GtkWidget *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_3_PalView_close (GtkWidget *, ...);
G_MODULE_EXPORT gboolean on_wtools_3_PalView_delete_event (GtkWidget *, GdkEvent *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_3_draw_expose_event (GtkWidget *, GdkEventExpose *, gpointer );
G_MODULE_EXPORT void on_wtools_3_palette_changed (GtkComboBox *, gpointer );
G_MODULE_EXPORT void on_wtools_3_palnum_value_changed (GtkSpinButton *, gpointer );
/* ***** ***** TILE VIEWER ***** ***** */
// initialise combo box for all palettes
void init_combo_memory(GtkComboBox *combo, u8 ** addresses);
G_MODULE_EXPORT void on_wtools_4_TileView_show (GtkWidget *, gpointer );
G_MODULE_EXPORT gboolean on_wtools_4_TileView_close (GtkWidget *, ...);
G_MODULE_EXPORT gboolean on_wtools_4_TileView_delete_event (GtkWidget *, GdkEvent *, gpointer );
G_MODULE_EXPORT void on_wtools_4_memory_changed (GtkComboBox *, gpointer );
G_MODULE_EXPORT void on_wtools_4_palette_changed (GtkComboBox *, gpointer );
G_MODULE_EXPORT void on_wtools_4_palnum_value_changed (GtkSpinButton *, gpointer );
G_MODULE_EXPORT void on_wtools_4_rXX_toggled (GtkToggleButton *togglebutton, gpointer user_data);
G_MODULE_EXPORT gboolean on_wDraw_Tile_expose_event (GtkWidget *, GdkEventExpose *, gpointer );
}
#endif

View File

@ -1,110 +0,0 @@
/* dTools_display.c
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _DTOOLS_DISPLAY_H_
#define _DTOOLS_DISPLAY_H_
#include <gtk/gtk.h>
typedef struct {
GtkWidget *widget;
GdkDrawable *draw;
GdkGC *gc_fg;
GdkGC *gc_bg;
PangoLayout* playout;
int size_w, size_h;
int char_w, char_h, padding;
GList * colors_rgb;
GList * attr_list;
PangoAttrList * curr_attr;
} dTools_dsp;
static void inline dTools_display_set_size(dTools_dsp * dsp, int w, int h, int pad) {
dsp->size_w = w;
dsp->size_h = h;
dsp->padding = pad;
// gtk_widget_set_size_request(dsp->widget,
// dsp->char_w * w + pad * 2, dsp->char_h * h + pad * 2);
gtk_widget_set_usize(dsp->widget,
dsp->char_w * w + pad * 2, dsp->char_h * h + pad * 2);
}
static void inline dTools_display_init(dTools_dsp * dsp, GtkWidget * widget, int w, int h, int pad) {
dsp->widget = widget;
dsp->draw = widget->window;
dsp->gc_fg = widget->style->fg_gc[widget->state];
dsp->gc_bg = widget->style->white_gc;
dsp->playout = gtk_widget_create_pango_layout(widget, NULL);
dsp->colors_rgb = NULL;
dsp->attr_list = NULL;
dsp->curr_attr = NULL;
pango_layout_set_markup(dsp->playout, "<tt>X</tt>",-1);
pango_layout_get_pixel_size(dsp->playout, &dsp->char_w, &dsp->char_h);
dTools_display_set_size(dsp, w, h, pad);
}
// void unref (gpointer data, ...) {
// pango_attr_list_unref(data);
// }
static void inline dTools_display_free(dTools_dsp * dsp) {
// g_list_foreach(dsp->attr_list, (GFunc)unref, NULL);
// g_object_unref(dsp->playout); // not alloc
}
static void inline dTools_display_add_markup(dTools_dsp * dsp, const char * markup) {
PangoAttrList *attr;
pango_parse_markup (markup, -1, 0, &attr, NULL, NULL, NULL);
dsp->attr_list = g_list_append(dsp->attr_list, attr);
dsp->curr_attr = attr;
}
static void inline dTools_display_clear(dTools_dsp * dsp) {
gdk_draw_rectangle(dsp->draw, dsp->gc_bg, TRUE, 0, 0,
dsp->widget->allocation.width, dsp->widget->allocation.height);
}
static void inline dTools_display_clear_char(dTools_dsp * dsp, int x, int y, int nb) {
gdk_draw_rectangle(dsp->draw, dsp->gc_bg, TRUE,
x * dsp->char_w + dsp->padding, y * dsp->char_h + dsp->padding,
nb * dsp->char_w, dsp->char_h);
}
static void inline dTools_display_select_attr(dTools_dsp * dsp, int index) {
PangoAttrList *attr = NULL;
attr = (PangoAttrList*) g_list_nth_data(dsp->attr_list, index);
if (attr != NULL) {
dsp->curr_attr = attr;
}
pango_layout_set_attributes(dsp->playout, dsp->curr_attr);
}
static void inline dTools_display_draw_text(dTools_dsp * dsp, int x, int y, const char * txt) {
pango_layout_set_text(dsp->playout, txt, -1);
gdk_draw_layout(dsp->draw, dsp->gc_fg,
x * dsp->char_w + dsp->padding,
y * dsp->char_h + dsp->padding,
dsp->playout);
}
#endif

View File

@ -1,9 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=DeSmuME (Gtk-Glade)
Comment=Nintento DS emulator
TryExec=desmume-glade
Exec=desmume-glade
Icon=DeSmuME
Categories=GNOME;GTK;Game;Emulator;

View File

@ -1,170 +0,0 @@
/* desmume.c - this file is part of DeSmuME
*
* Copyright (C) 2007-2015 DeSmuME Team
* Copyright (C) 2007 Pascal Giard (evilynux)
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "desmume.h"
#define EMULOOP_PRIO (G_PRIORITY_HIGH_IDLE + 20)
gboolean EmuLoop(gpointer data);
static BOOL regMainLoop = FALSE;
#define TICKS_PER_FRAME 17
static BOOL noticed_3D=FALSE;
volatile bool execute = false;
BOOL click = FALSE;
void desmume_mem_init();
u8 *desmume_rom_data = NULL;
u32 desmume_last_cycle;
void desmume_init()
{
NDS_Init();
SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4);
execute = false;
}
void desmume_free()
{
execute = false;
NDS_DeInit();
}
int desmume_open(const char *filename)
{
int i;
noticed_3D=FALSE;
clear_savestates();
i = NDS_LoadROM(filename);
return i;
}
void desmume_savetype(int type) {
backup_setManualBackupType(type);
}
void desmume_pause()
{
execute = false;
SPU_Pause(1);
}
void desmume_resume()
{
SPU_Pause(0);
execute = true;
if(!regMainLoop)
g_idle_add_full(EMULOOP_PRIO, &EmuLoop, NULL, NULL);
regMainLoop = TRUE;
}
void desmume_reset()
{
noticed_3D=FALSE;
NDS_Reset();
desmume_resume();
}
void desmume_toggle()
{
execute ^= true;
}
/*INLINE BOOL desmume_running()
{
return execute;
}*/
INLINE void desmume_cycle()
{
u16 keypad;
/* Joystick events */
/* Retrieve old value: can use joysticks w/ another device (from our side) */
keypad = get_keypad();
/* Process joystick events if any */
process_joystick_events( &keypad);
/* Update keypad value */
update_keypad(keypad);
NDS_exec<false>();
SPU_Emulate_user();
}
Uint32 fps, fps_SecStart, fps_FrameCount;
Uint32 fsFrameCount = 0;
Uint32 ticksPrevFrame = 0, ticksCurFrame = 0;
static void Draw()
{
}
gboolean EmuLoop(gpointer data)
{
if(desmume_running()) /* Si on est en train d'executer le programme ... */
{
if(Frameskip != 0 && (fsFrameCount % (Frameskip+1)) != 0)
NDS_SkipNextFrame();
fsFrameCount++;
fps_FrameCount++;
if(!fps_SecStart) fps_SecStart = SDL_GetTicks();
if(SDL_GetTicks() - fps_SecStart >= 1000)
{
fps_SecStart = SDL_GetTicks();
fps = fps_FrameCount;
fps_FrameCount = 0;
char Title[32];
sprintf(Title, "Desmume - %dfps", fps);
gtk_window_set_title(GTK_WINDOW(pWindow), Title);
}
desmume_cycle(); /* Emule ! */
//for(i = 0; i < Frameskip; i++) desmume_cycle(); /* cycles supplémentaires pour le frameskip */
Draw();
notify_Tools();
gtk_widget_queue_draw(pDrawingArea);
gtk_widget_queue_draw(pDrawingArea2);
ticksCurFrame = SDL_GetTicks();
if(!glade_fps_limiter_disabled)
{
if((ticksCurFrame - ticksPrevFrame) < TICKS_PER_FRAME)
while((ticksCurFrame - ticksPrevFrame) < TICKS_PER_FRAME)
ticksCurFrame = SDL_GetTicks();
}
ticksPrevFrame = SDL_GetTicks();
return TRUE;
}
gtk_widget_queue_draw(pDrawingArea);
gtk_widget_queue_draw(pDrawingArea2);
regMainLoop = FALSE;
return FALSE;
}

View File

@ -1,47 +0,0 @@
/* desmume.h - this file is part of DeSmuME
*
* Copyright (C) 2007-2015 DeSmuME Team
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __DESMUME_H__
#define __DESMUME_H__
#include "globals.h"
#define FPS_LIMITER_FRAME_PERIOD 5
extern SDL_sem *glade_fps_limiter_semaphore;
extern int glade_fps_limiter_disabled;
extern void desmume_init( void);
extern void desmume_free( void);
extern int desmume_open(const char *filename);
extern void desmume_savetype(int type);
extern void desmume_pause( void);
extern void desmume_resume( void);
extern void desmume_reset( void);
extern void desmume_toggle( void);
//extern BOOL desmume_running( void);
INLINE BOOL desmume_running(void)
{
return execute;
}
extern INLINE void desmume_cycle( void);
#endif /*__DESMUME_H__*/

View File

@ -1,115 +0,0 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH DESMUME 1 "June 26, 2007"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
desmume-glade \- Nintendo DS emulator
.SH SYNOPSIS
.B desmume-glade
.RI [ options ] " files" ...
.SH DESCRIPTION
This manual page documents briefly the
.B desmume-glade
program
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBdesmume\fP is a Nintendo DS emulator running homebrew demos and commercial games.
.SH OPTIONS
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`-').
A summary of options is included below.
.TP
.B \-\-load-slot=NUM
Loads savegame from slot NUM
.TP
.B \-\-soft-convert
Use software colour conversion during OpenGL screen rendering. May produce better or worse frame rates depending on hardware.
.TP
.B \-\-3d-engine=ENGINE
Select available 3d emulation:
.RS
0 = 3d disabled
.RE
.RS
1 = internal desmume software rasterizer (default)
.RE
.RS
2 = osmesa or gtkglext opengl (if available, depending on compilation options, see desmume \-\-help)
.RE
.TP
.B \-\-disable-limiter
Disables the 60 fps limiter
.TP
.B \-\-arm9gdb=PORT_NUM
Enable the ARM9 GDB stub on the given port
.TP
.B \-\-arm7gdb=PORT_NUM
Enable the ARM7 GDB stub on the given port
.TP
.B \-h, \-\-help
Show summary of options.
.TP
.B \-v, \-\-version
Show version of program.
.SH INPUT
Mouse cursor acts as stylus, mouse click replaces stylus touch.
.PP
Keyboard can be configured and by default works as follows:
.RS
F1-F10 load savegame from slot 1-10
.RE
.RS
Shift+F1-F10 save game to slot 1-10
.RE
.RS
Non-keypad arrows act as d-pad
.RE
.RS
z = A
.RE
.RS
x = B
.RE
.RS
a = Y
.RE
.RS
s = X
.RE
.RS
q = L
.RE
.RS
w = R
.RE
.RS
Enter = START
.RE
.RS
Left Shift = SELECT
.RE
.RS
Backspace = LID
.RE
.PP
Desmume accepts joystick events, which can be configured by user.
.SH AUTHOR
desmume was written by DeSmuME team
(http://sourceforge.net/projects/desmume).
.PP
This manual page was written by Pascal Giard <pascal@debian.org>, for the Debian project (but may be used by others).

View File

@ -1,208 +0,0 @@
/* $Id: gdk_3Demu.c,v 1.4 2007-07-15 21:50:30 evilynux Exp $
*/
/*
Copyright (C) 2006-2007 Ben Jaques
This file is part of DeSmuME
DeSmuME 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.
DeSmuME 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 DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef GTKGLEXT_AVAILABLE
#include <gdk/gdkgl.h>
#include <gdk/gdk.h>
// Localization
#include <libintl.h>
#define _(String) gettext (String)
#include "../types.h"
#include "../render3D.h"
#include "../OGLRender.h"
#include "gdk_3Demu.h"
/*
* The GDK 3D emulation.
* This uses the OpenGL Collector plugin, using gdkGLext for the platform
* specific helper functions.
*/
static GdkPixmap *target_pixmap;
static GdkGLContext *glcontext = NULL;
static GdkGLDrawable *gldrawable;
#if 0 /* not used */
static void
print_gl_config_attrib (GdkGLConfig *glconfig,
const gchar *attrib_str,
int attrib,
gboolean is_boolean)
{
int value;
g_print ("%s = ", attrib_str);
if (gdk_gl_config_get_attrib (glconfig, attrib, &value))
{
if (is_boolean)
g_print ("%s\n", value == TRUE ? "TRUE" : "FALSE");
else
g_print ("%d\n", value);
}
else
g_print (_("*** Cannot get %s attribute value\n"), attrib_str);
}
static void
examine_gl_config_attrib (GdkGLConfig *glconfig)
{
g_print ("\nOpenGL visual configurations :\n\n");
g_print ("gdk_gl_config_is_rgba (glconfig) = %s\n",
gdk_gl_config_is_rgba (glconfig) ? "TRUE" : "FALSE");
g_print ("gdk_gl_config_is_double_buffered (glconfig) = %s\n",
gdk_gl_config_is_double_buffered (glconfig) ? "TRUE" : "FALSE");
g_print ("gdk_gl_config_is_stereo (glconfig) = %s\n",
gdk_gl_config_is_stereo (glconfig) ? "TRUE" : "FALSE");
g_print ("gdk_gl_config_has_alpha (glconfig) = %s\n",
gdk_gl_config_has_alpha (glconfig) ? "TRUE" : "FALSE");
g_print ("gdk_gl_config_has_depth_buffer (glconfig) = %s\n",
gdk_gl_config_has_depth_buffer (glconfig) ? "TRUE" : "FALSE");
g_print ("gdk_gl_config_has_stencil_buffer (glconfig) = %s\n",
gdk_gl_config_has_stencil_buffer (glconfig) ? "TRUE" : "FALSE");
g_print ("gdk_gl_config_has_accum_buffer (glconfig) = %s\n",
gdk_gl_config_has_accum_buffer (glconfig) ? "TRUE" : "FALSE");
g_print ("\n");
print_gl_config_attrib (glconfig, "GDK_GL_USE_GL",
GDK_GL_USE_GL, TRUE);
print_gl_config_attrib (glconfig, "GDK_GL_BUFFER_SIZE",
GDK_GL_BUFFER_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_LEVEL",
GDK_GL_LEVEL, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_RGBA",
GDK_GL_RGBA, TRUE);
print_gl_config_attrib (glconfig, "GDK_GL_DOUBLEBUFFER",
GDK_GL_DOUBLEBUFFER, TRUE);
print_gl_config_attrib (glconfig, "GDK_GL_STEREO",
GDK_GL_STEREO, TRUE);
print_gl_config_attrib (glconfig, "GDK_GL_AUX_BUFFERS",
GDK_GL_AUX_BUFFERS, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_RED_SIZE",
GDK_GL_RED_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_GREEN_SIZE",
GDK_GL_GREEN_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_BLUE_SIZE",
GDK_GL_BLUE_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_ALPHA_SIZE",
GDK_GL_ALPHA_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_DEPTH_SIZE",
GDK_GL_DEPTH_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_STENCIL_SIZE",
GDK_GL_STENCIL_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_RED_SIZE",
GDK_GL_ACCUM_RED_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_GREEN_SIZE",
GDK_GL_ACCUM_GREEN_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_BLUE_SIZE",
GDK_GL_ACCUM_BLUE_SIZE, FALSE);
print_gl_config_attrib (glconfig, "GDK_GL_ACCUM_ALPHA_SIZE",
GDK_GL_ACCUM_ALPHA_SIZE, FALSE);
g_print ("\n");
}
#endif
static bool
begin_opengl_region_gdk_3d( void) {
bool failed = false;
gdk_error_trap_push();
failed = !gdk_gl_drawable_gl_begin(gldrawable, glcontext);
gdk_flush();
failed = failed | gdk_error_trap_pop();
if (failed) return false;
return true;
}
static void
end_opengl_region_gdk_3d( void) {
gdk_gl_drawable_gl_end (gldrawable);
}
static bool
initialise_gdk_3d( void) {
/* this does nothing */
return true;
}
int
init_opengl_gdk_3Demu( GdkDrawable * drawable) {
GdkGLConfig *glconfig;
/* create the off screen pixmap */
target_pixmap = gdk_pixmap_new ( drawable, 256, 192, -1);
if ( target_pixmap == NULL) {
g_print (_("*** Failed to create pixmap.\n"));
return 0;
}
glconfig = gdk_gl_config_new_by_mode ((GdkGLConfigMode) (GDK_GL_MODE_RGBA |
GDK_GL_MODE_DEPTH |
GDK_GL_MODE_STENCIL |
GDK_GL_MODE_SINGLE));
if (glconfig == NULL)
{
g_print (_("*** No appropriate OpenGL-capable visual found.\n"));
return 0;
}
/*
* Set OpenGL-capability to the pixmap
*/
gldrawable = GDK_GL_DRAWABLE (gdk_pixmap_set_gl_capability (target_pixmap,
glconfig,
NULL));
if ( gldrawable == NULL) {
g_print (_("Failed to create the GdkGLPixmap\n"));
return 0;
}
glcontext = gdk_gl_context_new (gldrawable,
NULL,
FALSE,
GDK_GL_RGBA_TYPE);
if (glcontext == NULL)
{
g_print (_("Connot create the OpenGL rendering context\n"));
return 0;
}
oglrender_init = initialise_gdk_3d;
oglrender_beginOpenGL = begin_opengl_region_gdk_3d;
oglrender_endOpenGL = end_opengl_region_gdk_3d;
return 1;
}
#endif

View File

@ -1,32 +0,0 @@
/* $Id: gdk_3Demu.h,v 1.1 2007-04-21 19:45:07 evilynux Exp $
*/
/*
Copyright (C) 2006-2007 Ben Jaques
This file is part of DeSmuME
DeSmuME 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.
DeSmuME 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 DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef GTKGLEXT_AVAILABLE
/*
* The GDK 3D emulation.
* This uses the OpenGL Collector plugin, using gdkGLext for the platform
* specific helper functions.
*/
int
init_opengl_gdk_3Demu( GdkDrawable * drawable);
#endif

View File

@ -1,296 +0,0 @@
/* gdk_gl.cpp - this file is part of DeSmuME
*
* Copyright (C) 2007-2017 DeSmuME Team
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gdk_gl.h"
#ifdef GTKGLEXT_AVAILABLE
#include <GL/gl.h>
#include <GL/glu.h>
#define _DUP8(a) a,a,a,a, a,a,a,a
#define _DUP4(a) a,a,a,a
#define _DUP2(a) a,a
// free number we can use in tools 0-1 reserved for screens
static int free_gl_drawable=2;
GdkGLConfig *my_glConfig=NULL;
GdkGLContext *my_glContext[8]={_DUP8(NULL)};
GdkGLDrawable *my_glDrawable[8]={_DUP8(NULL)};
GtkWidget *pDrawingTexArea;
GLuint screen_texture[2];
#undef _DUP8
#undef _DUP4
#undef _DUP2
/************************************************/
/* BEGIN & END */
/************************************************/
BOOL my_gl_Begin (NDSDisplayID displayID)
{
return gdk_gl_drawable_gl_begin(my_glDrawable[displayID], my_glContext[displayID]);
}
void my_gl_End (NDSDisplayID displayID)
{
if (gdk_gl_drawable_is_double_buffered (my_glDrawable[displayID]))
gdk_gl_drawable_swap_buffers (my_glDrawable[displayID]);
else
glFlush();
gdk_gl_drawable_gl_end(my_glDrawable[displayID]);
}
/************************************************/
/* OTHER GL COMMANDS */
/************************************************/
void my_gl_Identity()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void my_gl_Clear(NDSDisplayID displayID)
{
if (!my_gl_Begin(displayID))
return;
/* Set the background black */
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
my_gl_End(displayID);
}
/************************************************/
/* INITIALIZATION */
/************************************************/
void init_GL(GtkWidget *widget, NDSDisplayID displayID, NDSDisplayID sharedContextDisplayID)
{
// for (n=gtk_events_pending(); n>0; n--)
// gtk_main_iteration();
// init GL capability
my_glContext[displayID] = NULL;
my_glDrawable[displayID] = NULL;
if (!gtk_widget_set_gl_capability(
widget, my_glConfig,
my_glContext[sharedContextDisplayID],
//NULL,
TRUE,
GDK_GL_RGBA_TYPE)) {
printf ("gtk_widget_set_gl_capability\n");
exit(1);
}
// realize so that we get a GdkWindow
gtk_widget_realize(widget);
// make sure we realize
gdk_flush();
my_glDrawable[displayID] = gtk_widget_get_gl_drawable(widget);
if (displayID == sharedContextDisplayID)
{
my_glContext[displayID] = gtk_widget_get_gl_context(widget);
}
else
{
my_glContext[displayID] = my_glContext[sharedContextDisplayID];
return;
}
reshape(widget, displayID);
}
NDSDisplayID init_GL_free_s(GtkWidget *widget, NDSDisplayID sharedContextDisplayID)
{
NDSDisplayID r = (NDSDisplayID)free_gl_drawable;
my_glContext[r] = NULL;
my_glDrawable[r] = NULL;
init_GL(widget, r, sharedContextDisplayID);
free_gl_drawable++;
return r;
}
NDSDisplayID init_GL_free(GtkWidget *widget)
{
NDSDisplayID r = (NDSDisplayID)free_gl_drawable;
my_glContext[r] = NULL;
my_glDrawable[r] = NULL;
init_GL(widget, r, r);
free_gl_drawable++;
return r;
}
void init_GL_capabilities() {
uint16_t blank_texture[256 * 256];
memset(blank_texture, 0, sizeof(blank_texture));
my_glConfig = gdk_gl_config_new_by_mode (
(GdkGLConfigMode) (GDK_GL_MODE_RGBA
| GDK_GL_MODE_DEPTH
| GDK_GL_MODE_DOUBLE)
);
// initialize 1st drawing area
init_GL(pDrawingArea, NDSDisplayID_Main, NDSDisplayID_Main);
my_gl_Clear(NDSDisplayID_Main);
if (!my_gl_Begin(NDSDisplayID_Main))
return;
glEnable(GL_TEXTURE_2D);
glGenTextures(2, screen_texture);
/* Generate The Texture */
for (int i = 0; i < 2; i++)
{
glBindTexture(GL_TEXTURE_2D, screen_texture[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
#define MyFILTER GL_LINEAR
//#define MyFILTER GL_NEAREST
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, MyFILTER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, MyFILTER);
#undef MyFILTER
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256,
0, GL_RGBA,
GL_UNSIGNED_SHORT_1_5_5_5_REV,
blank_texture);
}
my_gl_End(NDSDisplayID_Main);
// initialize 2nd drawing area (sharing context)
init_GL(pDrawingArea2, NDSDisplayID_Touch, NDSDisplayID_Main);
my_gl_Clear(NDSDisplayID_Touch);
}
/************************************************/
/* RESHAPE */
/************************************************/
void reshape(GtkWidget *widget, NDSDisplayID displayID)
{
if (my_glDrawable[displayID] == NULL || !my_gl_Begin(displayID))
return;
glViewport (0, 0, widget->allocation.width, widget->allocation.height);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
my_gl_End(displayID);
}
/************************************************/
/* TEXTURING */
/************************************************/
static void
my_gl_ScreenTex()
{
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
glBindTexture(GL_TEXTURE_2D, screen_texture[NDSDisplayID_Main]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 192,
GL_RGBA,
GL_UNSIGNED_SHORT_1_5_5_5_REV,
displayInfo.renderedBuffer[NDSDisplayID_Main]);
glBindTexture(GL_TEXTURE_2D, screen_texture[NDSDisplayID_Touch]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 192,
GL_RGBA,
GL_UNSIGNED_SHORT_1_5_5_5_REV,
displayInfo.renderedBuffer[NDSDisplayID_Touch]);
}
static void my_gl_ScreenTexApply(NDSDisplayID displayID)
{
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
GLfloat backlightIntensity = displayInfo.backlightIntensity[displayID];
glBindTexture(GL_TEXTURE_2D, screen_texture[displayID]);
glBegin(GL_QUADS);
glColor3f(backlightIntensity, backlightIntensity, backlightIntensity); glTexCoord2f(0.00f, 0.00f); glVertex2f(-1.0f, 1.0f);
glColor3f(backlightIntensity, backlightIntensity, backlightIntensity); glTexCoord2f(1.00f, 0.00f); glVertex2f( 1.0f, 1.0f);
glColor3f(backlightIntensity, backlightIntensity, backlightIntensity); glTexCoord2f(1.00f, 0.75f); glVertex2f( 1.0f, -1.0f);
glColor3f(backlightIntensity, backlightIntensity, backlightIntensity); glTexCoord2f(0.00f, 0.75f); glVertex2f(-1.0f, -1.0f);
glEnd();
}
/************************************************/
/* RENDERING */
/************************************************/
gboolean screen(GtkWidget *widget, NDSDisplayID displayID)
{
NDSDisplayID displayToDraw = displayID;
// we take care to draw the right thing the right place
// we need to rearrange widgets not to use this trick
if (ScreenInvert)
{
displayToDraw = (displayID == NDSDisplayID_Main) ? NDSDisplayID_Touch : NDSDisplayID_Main;
}
if (!my_gl_Begin(displayID))
return TRUE;
glLoadIdentity();
// clear screen
glClearColor(0.0f,0.0f,0.0f,1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_DITHER);
glDisable(GL_STENCIL_TEST);
if (desmume_running())
{
// rotate
glRotatef(ScreenRotate, 0.0, 0.0, 1.0);
if (displayID == NDSDisplayID_Main)
{
my_gl_ScreenTex();
}
}
// apply part of the texture
my_gl_ScreenTexApply(displayToDraw);
my_gl_End(displayID);
return TRUE;
}
#endif /* if GTKGLEXT_AVAILABLE */

View File

@ -1,49 +0,0 @@
/* gdk_gl.h - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDKGL_H__
#define __GDKGL_H__
#include "globals.h"
#ifdef GTKGLEXT_AVAILABLE
#include <GL/gl.h>
#include <GL/glext.h>
#include <gdk/gdkgl.h>
#include <gtk/gtkglwidget.h>
#endif
#include "../GPU.h"
BOOL my_gl_Begin (NDSDisplayID displayID);
void my_gl_End (NDSDisplayID displayID);
void my_gl_Clear(NDSDisplayID displayID);
void my_gl_DrawBeautifulQuad( void);
void my_gl_Identity( void);
void init_GL_capabilities();
void init_GL(GtkWidget *widget, NDSDisplayID displayID, NDSDisplayID sharedContextDisplayID);
NDSDisplayID init_GL_free_s(GtkWidget *widget, NDSDisplayID sharedContextDisplayID);
NDSDisplayID init_GL_free(GtkWidget *widget);
void reshape(GtkWidget *widget, NDSDisplayID displayID);
gboolean screen(GtkWidget *widget, NDSDisplayID displayID);
#endif

View File

@ -1,129 +0,0 @@
/* -*- Mode: C; c-basic-offset: 4 -*-
* libglade - a library for building interfaces from XML files at runtime
* Copyright (C) 1998-2002 James Henstridge <james@daa.com.au>
*
* glade-xml.c: implementation of core public interface functions
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "globals.h"
#include <glade/glade-xml.h>
#include <glade/glade-init.h>
#include <glade/glade-build.h>
#include <gmodule.h>
typedef struct _GladeXMLPrivate nopriv_GladeXMLPrivate;
struct _GladeXMLPrivate {
GladeInterface *tree; /* the tree for this GladeXML */
GtkTooltips *tooltips; /* if not NULL, holds all tooltip info */
GHashTable *name_hash;
GHashTable *signals;
GtkWindow *toplevel;
GtkAccelGroup *accel_group;
GtkWidget *focus_widget;
GtkWidget *default_widget;
GList *deferred_props;
};
typedef struct _GladeSignalData GladeSignalData;
struct _GladeSignalData {
GObject *signal_object;
char *signal_name;
char *connect_object; /* or NULL if there is none */
gboolean signal_after;
};
static void
autoconnect_foreach_StringObject(const char *signal_handler,
GList * signals, GModule * allsymbols)
{
GCallback func;
if (!g_module_symbol(allsymbols, signal_handler, (void **) &func))
g_warning(_("could not find signal handler '%s'."),
signal_handler);
else
for (; signals != NULL; signals = signals->next) {
GladeSignalData *data = (GladeSignalData *) signals->data;
if (data->connect_object) {
GladeXML *self =
glade_get_widget_tree(GTK_WIDGET(data->signal_object));
char format[] = "%_\0\0";
if (sscanf(data->connect_object, "%%%c:", &format[1])) {
// this should solve 64bit problems but now memory gets
// (it should get) deallocated when program is destroyed
gpointer argument = g_malloc(sizeof(callback_arg));
sscanf(data->connect_object + 3, format, argument);
// printf ("%f \n",obj);
if (data->signal_after)
g_signal_connect_after(data->signal_object, data->signal_name, func, argument);
else
g_signal_connect(data->signal_object, data->signal_name, func, argument);
} else {
GObject *other = (GObject *) g_hash_table_lookup(
self->priv->name_hash,
data->connect_object);
g_signal_connect_object(data->signal_object, data->signal_name, func, other,
(GConnectFlags) ((data->signal_after ? G_CONNECT_AFTER : 0) | G_CONNECT_SWAPPED));
}
} else {
/* the signal_data argument is just a string, but may
* be helpful for someone */
if (data->signal_after)
g_signal_connect_after(data->signal_object, data->signal_name, func, NULL);
else
g_signal_connect(data->signal_object, data->signal_name, func, NULL);
}
}
}
/**
* glade_xml_signal_autoconnect_StringObject:
* @self: the GladeXML object.
*
* This function is a variation of glade_xml_signal_connect. It uses
* gmodule's introspective features (by openning the module %NULL) to
* look at the application's symbol table. From here it tries to match
* the signal handler names given in the interface description with
* symbols in the application and connects the signals.
*
* Note that this function will not work correctly if gmodule is not
* supported on the platform.
*/
void glade_xml_signal_autoconnect_StringObject(GladeXML * self)
{
GModule *allsymbols;
nopriv_GladeXMLPrivate *priv;
g_return_if_fail(self != NULL);
if (!g_module_supported())
g_error("glade_xml_signal_autoconnect requires working gmodule");
/* get a handle on the main executable -- use this to find symbols */
allsymbols = g_module_open(NULL, (GModuleFlags) 0);
priv = (nopriv_GladeXMLPrivate *) self->priv;
g_hash_table_foreach(priv->signals,
(GHFunc) autoconnect_foreach_StringObject,
allsymbols);
}

View File

@ -1,50 +0,0 @@
/* XPM */
static const char * DeSmuME_xpm[] = {
"32 32 15 1",
" c None",
". c #000000",
"+ c #F6F6FB",
"@ c #ECECF6",
"# c #E2E2F1",
"$ c #D8D8EC",
"% c #CFCFE7",
"& c #C5C5E2",
"* c #BBBBDE",
"= c #B1B1D9",
"- c #A8A8D4",
"; c #9E9ECF",
"> c #9494CA",
", c #8A8AC5",
"' c #8080C0",
" .................... ",
" .................... ",
".....++..+++++..+++++.. ",
".....++..++.....++..... ",
"..@@@@@..@@@@@..@@@@@.. ",
"..@@.@@..@@........@@.. ",
"..##.##..##.##..##.##.. ",
"..##.##..##.##..##.##.. ",
"..$$.$$..$$.$$..$$.$$.. ",
"..$$.$$..$$.$$..$$.$$.. ",
"..%%.%%..%%.%%..%%.%%.. ",
"..%%.%%..%%.%%..%%.%%.. ",
"..&&&&&..&&&&&..&&&&&.. ",
"....................... ",
".......********.**.**.. ",
" ..==.==.==.==.==.. ",
" ..==.==.==.==.==.. ",
" ..--.--.--.--.--.. ",
" ..--.--.--.--.--.. ",
" ..;;.;;.;;.;;;;;.. ",
" ..................... ",
" ..................... ",
" ..>>>>>>>>.>>>>>.. ",
" ..>>.>>.>>.>>..... ",
" ..,,.,,.,,.,,,,,.. ",
" ..,,.,,.,,.,,..... ",
" ..''.''.''.''.''.. ",
" ..''.''.''.''.''.. ",
" ..''.''.''.''.''.. ",
" ..''.''.''.'''''.. ",
" .................. ",
" .................. "};

File diff suppressed because it is too large Load Diff

View File

@ -1,537 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!-- Generated with glade3
Version: 3.0.1
Date: Sun May 20 22:49:31 2007
User: thoduv
Host: zerbu
-->
<glade-interface>
<widget class="GtkDialog" id="wtools_1_IOregs">
<property name="title">IO registers</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<signal name="show" handler="on_wtools_1_IOregs_show"/>
<signal name="delete_event" handler="on_wtools_1_IOregs_close"/>
<signal name="response" handler="on_wtools_1_IOregs_close"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">5</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkDrawingArea" id="wtools_1_draw">
<property name="visible">True</property>
<property name="events">GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="expose_event" handler="on_wtools_1_draw_expose_event"/>
<signal name="button_release_event" handler="on_wtools_1_draw_button_release_event"/>
</widget>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="wtools_1_combo_cpu">
<property name="visible">True</property>
<property name="items" translatable="yes">cpu : ARM9
cpu : ARM7</property>
<signal name="changed" handler="on_wtools_1_combo_cpu_changed"/>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="okbutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="wtools_2_MemView">
<property name="title">memory viewer</property>
<property name="icon">DeSmuME.xpm</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<signal name="show" handler="on_wtools_2_MemView_show"/>
<signal name="delete_event" handler="on_wtools_2_MemView_close"/>
<signal name="response" handler="on_wtools_2_MemView_close"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<widget class="GtkRadioButton" id="wtools_2_r8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">8 bit</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_wtools_2_r8_toggled"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_2_r16">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">16 bit</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">wtools_2_r8</property>
<signal name="toggled" handler="on_wtools_2_r16_toggled"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_2_r32">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">32 bit</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">wtools_2_r8</property>
<signal name="toggled" handler="on_wtools_2_r32_toggled"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="wtools_2_cpu">
<property name="visible">True</property>
<property name="items" translatable="yes">ARM9 cpu
ARM7 cpu</property>
<signal name="changed" handler="on_wtools_2_cpu_changed"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0.000000</property>
<property name="label" translatable="yes"> GoTo: </property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="wtools_2_GotoAddress">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_length">10</property>
<property name="invisible_char">●</property>
<property name="text">0x00000000</property>
<signal name="changed" handler="on_wtools_2_GotoAddress_changed"/>
<signal name="activate" handler="on_wtools_2_GotoAddress_activate"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="wtools_2_GotoButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Go!</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_wtools_2_GotoButton_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">6</property>
</packing>
</child>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkDrawingArea" id="wtools_2_draw">
<property name="visible">True</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="expose_event" handler="on_wtools_2_draw_expose_event"/>
<signal name="button_release_event" handler="on_wtools_2_draw_button_release_event"/>
<signal name="scroll_event" handler="on_wtools_2_draw_scroll_event"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkVScrollbar" id="wtools_2_scroll">
<property name="visible">True</property>
<property name="adjustment">0 0 0 0 0 0</property>
<signal name="value_changed" handler="on_wtools_2_scroll_value_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="closebutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="wtools_3_PalView">
<property name="title">Palette Viewer</property>
<property name="icon">DeSmuME.xpm</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<signal name="show" handler="on_wtools_3_PalView_show"/>
<signal name="delete_event" handler="on_wtools_3_PalView_close"/>
<signal name="response" handler="on_wtools_3_PalView_close"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox5">
<property name="visible">True</property>
<child>
<widget class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<child>
<widget class="GtkDrawingArea" id="wtools_3_draw">
<property name="width_request">256</property>
<property name="height_request">256</property>
<property name="visible">True</property>
<signal name="expose_event" handler="on_wtools_3_draw_expose_event"/>
</widget>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0.000000</property>
<property name="label" translatable="yes"> Palette : </property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="wtools_3_palnum">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">0 0 15 1 2 0</property>
<property name="climb_rate">1</property>
<signal name="value_changed" handler="on_wtools_3_palnum_value_changed"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="wtools_3_palette">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<signal name="changed" handler="on_wtools_3_palette_changed"/>
</widget>
<packing>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area5">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="closebutton2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="wtools_4_TileView">
<property name="title">Tile viewer</property>
<property name="resizable">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<signal name="delete_event" handler="on_wtools_4_TileView_close"/>
<signal name="show" handler="on_wtools_4_TileView_show"/>
<signal name="response" handler="on_wtools_4_TileView_close"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox6">
<property name="visible">True</property>
<child>
<widget class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">4</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkComboBox" id="wtools_4_memory">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<signal name="changed" handler="on_wtools_4_memory_changed"/>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_4_rBMP">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">BMP</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">wtools_4_r16</property>
<signal name="toggled" handler="on_wtools_4_rXX_toggled" object="%d:0"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_4_r256">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">256c</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">wtools_4_r16</property>
<signal name="toggled" handler="on_wtools_4_rXX_toggled" object="%d:1"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="wtools_4_r16">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">16c</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_wtools_4_rXX_toggled" object="%d:2"/>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0.000000</property>
<property name="label" translatable="yes"> Palette : </property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="wtools_4_palnum">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">0 0 15 1 2 0</property>
<property name="climb_rate">1</property>
<signal name="value_changed" handler="on_wtools_4_palnum_value_changed"/>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkDrawingArea" id="wDraw_Tile">
<property name="width_request">256</property>
<property name="height_request">256</property>
<property name="events">GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK</property>
<signal name="expose_event" handler="on_wDraw_Tile_expose_event"/>
</widget>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="wtools_4_palette">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<signal name="changed" handler="on_wtools_4_palette_changed"/>
</widget>
<packing>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="closebutton3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="response_id">-7</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -1,132 +0,0 @@
/* globals.h - this file is part of DeSmuME
*
* Copyright (C) 2007-2015 DeSmuME Team
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GLOBALS_H__
#define __GLOBALS_H__
#ifndef GTK_UI
#define GTK_UI
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// Localization
#include <libintl.h>
#define _(String) gettext (String)
#include <SDL.h>
// fix gtk-glade on windows with no configure
#ifndef DATADIR
#define DATADIR " "
#endif
#ifndef GLADEUI_UNINSTALLED_DIR
#define GLADEUI_UNINSTALLED_DIR "glade/"
#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glade/glade.h>
#include <glade/glade-xml.h>
typedef union _callback_arg{
gpointer my_pointer;
gconstpointer my_constpointer;
gfloat my_float;
gdouble my_double;
gsize my_size;
gssize my_ssize;
gboolean my_boolean;
guchar my_uchar;
guint my_uint;
guint8 my_uint8;
guint16 my_uint16;
guint32 my_uint32;
guint64 my_uint64;
gushort my_ushort;
gulong my_ulong;
gchar my_char;
gint my_int;
gint8 my_int8;
gint16 my_int16;
gint32 my_int32;
gint64 my_int64;
gshort my_short;
glong my_long;
} callback_arg;
#define dyn_CAST(gtype,var) (((callback_arg*)var)->my_##gtype)
#include "../MMU.h"
#include "../registers.h"
#include "../armcpu.h"
#include "../NDSSystem.h"
#include "../GPU.h"
#include "../shared/sndsdl.h"
#include "../shared/ctrlssdl.h"
#include "../types.h"
#include "../saves.h"
#include "../render3D.h"
#include "desmume.h"
// autoconnect with strings as user_data
void
glade_xml_signal_autoconnect_StringObject (GladeXML *self);
//---
extern int Frameskip;
/* main.cpp */
extern GtkWidget * pWindow;
extern GtkWidget * pDrawingArea, * pDrawingArea2;
extern GladeXML * xml, * xml_tools;
typedef void (*VoidFunPtr)();
void notify_Tools();
void register_Tool(VoidFunPtr fun);
void unregister_Tool(VoidFunPtr fun);
gchar * get_ui_file (const char *filename);
/* callbacks.cpp */
void enable_rom_features();
void resize (float Size1, float Size2);
void rotate(float angle);
extern gboolean ScreenInvert;
/* callbacks_IO.cpp */
extern float ScreenCoeff_Size[2];
extern float ScreenRotate;
void black_screen ();
void edit_controls();
void init_joy_labels();
#endif /* __GLOBALS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
/* keyval_names.h - this file is part of DeSmuME
*
* Copyright (C) 2007 Damien Nozay (damdoum)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
const char * KEYNAME(int k);
void init_keyvals();

View File

@ -1,566 +0,0 @@
/* main.c - this file is part of DeSmuME
*
* Copyright (C) 2007-2019 DeSmuME Team
* Copyright (C) 2007 Damien Nozay (damdoum)
* Copyright (C) 2007 Pascal Giard (evilynux)
* Author: damdoum at users.sourceforge.net
*
* This file 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, or (at your option)
* any later version.
*
* This file 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <X11/Xlib.h>
#include "callbacks.h"
#include "callbacks_IO.h"
#include "dTools/callbacks_dtools.h"
#include "globals.h"
#include "keyval_names.h"
#include "rasterize.h"
#include "desmume.h"
#include "firmware.h"
#include "../shared/desmume_config.h"
#ifdef GDB_STUB
#include "../armcpu.h"
#include "../gdbstub.h"
#endif
#ifdef GTKGLEXT_AVAILABLE
#include <gtk/gtkgl.h>
#include "../OGLRender.h"
#include "gdk_3Demu.h"
#endif
int glade_fps_limiter_disabled = 0;
GtkWidget * pWindow;
GtkWidget * pDrawingArea, * pDrawingArea2;
GladeXML * xml, * xml_tools;
const u16 gtk_kb_cfg[NB_KEYS] =
{
GDK_x, // A
GDK_z, // B
GDK_Shift_R, // select
GDK_Return, // start
GDK_Right, // Right
GDK_Left, // Left
GDK_Up, // Up
GDK_Down, // Down
GDK_w, // R
GDK_q, // L
GDK_s, // X
GDK_a, // Y
GDK_p, // DEBUG
GDK_o, // BOOST
GDK_BackSpace, // Lid
};
SoundInterface_struct *SNDCoreList[] = {
&SNDDummy,
&SNDDummy,
&SNDSDL,
NULL
};
GPU3DInterface *core3DList[] = {
&gpu3DNull,
&gpu3DRasterize
#ifdef GTKGLEXT_AVAILABLE
,
&gpu3Dgl
#endif
};
/*
*
* Command line handling
*
*/
struct configured_features {
int load_slot;
int opengl_2d;
int engine_3d;
int disable_limiter;
int savetype;
u16 arm9_gdb_port;
u16 arm7_gdb_port;
int firmware_language;
const char *nds_file;
};
static void
init_configured_features( struct configured_features *config) {
config->load_slot = 0;
config->arm9_gdb_port = 0;
config->arm7_gdb_port = 0;
config->opengl_2d = 0;
config->engine_3d = 1;
config->disable_limiter = 0;
config->savetype = 0;
config->nds_file = NULL;
/* use the default language */
config->firmware_language = -1;
}
static int
fill_configured_features( struct configured_features *config,
int argc, char ** argv) {
int good_args = 1;
int print_usage = 0;
int i;
for ( i = 1; i < argc && good_args; i++) {
if ( strcmp( argv[i], "--help") == 0) {
g_print( _("USAGE: %s [OPTIONS] [nds-file]\n"), argv[0]);
g_print( _("OPTIONS:\n"));
g_print( _("\
--load-slot=NUM Load game saved under NUM position.\n\n"));
g_print( _("\
--3d-engine=ENGINE Selects 3D rendering engine\n\
0 = disabled\n\
1 = internal desmume rasterizer (default)\n"));
#ifdef GTKGLEXT_AVAILABLE
g_print( _("\
2 = gtkglext off-screen 3d opengl\n\n"));
#endif
g_print( _("\
--disable-limiter Disables the 60 fps limiter\n\n"));
g_print( _("\
--save-type=TYPE Selects savetype:\n\
0 = Autodetect (default)\n\
1 = EEPROM 4kbit\n\
2 = EEPROM 64kbit\n\
3 = EEPROM 512kbit\n\
4 = FRAM 256kbit\n\
5 = FLASH 2mbit\n\
6 = FLASH 4mbit\n\
\n"));
g_print( _("\
--fwlang=LANG Set the language in the firmware, LANG as follows:\n\
0 = Japanese\n\
1 = English\n\
2 = French\n\
3 = German\n\
4 = Italian\n\
5 = Spanish\n\n"));
#ifdef GDB_STUB
g_print( _("\
--arm9gdb=PORT_NUM Enable the ARM9 GDB stub on the given port\n\
--arm7gdb=PORT_NUM Enable the ARM7 GDB stub on the given port\n\n"));
#endif
g_print( _("\
--help Display this message\n"));
//g_print(" --sticky Enable sticky keys and stylus\n");
good_args = 0;
}
else if ( strncmp( argv[i], "--load-slot=", 12) == 0) {
char *end_char;
int slot = strtoul( &argv[i][12], &end_char, 10);
if ( slot >= 0 && slot <= 10) {
config->load_slot = slot;
}
else {
g_printerr( _("I only know how to load from slots 1-10.\n"));
good_args = 0;
}
}
#ifdef GTKGLEXT_AVAILABLE
else if ( strcmp( argv[i], "--opengl-2d") == 0) {
// FIXME: to be implemented
config->opengl_2d = 1;
}
#define MAX3DEMU 2
#else
#define MAX3DEMU 1
#endif
else if ( strncmp( argv[i], "--3d-engine=", 12) == 0) {
char *end_char;
int engine = strtoul( &argv[i][12], &end_char, 10);
if ( engine >= 0 && engine <= MAX3DEMU) {
config->engine_3d = engine;
}
else {
g_printerr( _("Supported 3d engines: 0, 1, and on some machines 2; use --help option for details\n"));
good_args = 0;
}
}
else if ( strncmp( argv[i], "--save-type=", 12) == 0) {
char *end_char;
int type = strtoul( &argv[i][12], &end_char, 10);
if ( type >= 0 && type <= 6) {
config->savetype = type;
}
else {
g_printerr( _("select savetype from 0 to 6; use --help option for details\n"));
good_args = 0;
}
}
else if ( strncmp( argv[i], "--fwlang=", 9) == 0) {
char *end_char;
int lang = strtoul( &argv[i][9], &end_char, 10);
if ( lang >= 0 && lang <= 5) {
config->firmware_language = lang;
}
else {
g_printerr( _("Firmware language must be set to a value from 0 to 5.\n"));
good_args = 0;
}
}
#ifdef GDB_STUB
else if ( strncmp( argv[i], "--arm9gdb=", 10) == 0) {
char *end_char;
unsigned long port_num = strtoul( &argv[i][10], &end_char, 10);
if ( port_num > 0 && port_num < 65536) {
config->arm9_gdb_port = port_num;
}
else {
g_print( _("ARM9 GDB stub port must be in the range 1 to 65535\n"));
good_args = 0;
}
}
else if ( strncmp( argv[i], "--arm7gdb=", 10) == 0) {
char *end_char;
unsigned long port_num = strtoul( &argv[i][10], &end_char, 10);
if ( port_num > 0 && port_num < 65536) {
config->arm7_gdb_port = port_num;
}
else {
g_print( _("ARM7 GDB stub port must be in the range 1 to 65535\n"));
good_args = 0;
}
}
#endif
else if ( strcmp( argv[i], "--disable-limiter") == 0) {
config->disable_limiter = 1;
}
else {
if ( config->nds_file == NULL) {
config->nds_file = argv[i];
}
else {
g_print( _("NDS file (\"%s\") already set\n"), config->nds_file);
good_args = 0;
}
}
}
if ( good_args) {
/*
* check if the configured features are consistant
*/
}
if ( print_usage) {
g_print( _("USAGE: %s [options] [nds-file]\n"), argv[0]);
g_print( _("USAGE: %s --help - for help\n"), argv[0]);
}
return good_args;
}
/* ***** ***** TOOLS ***** ***** */
GList * tools_to_update = NULL;
// register tool
void register_Tool(VoidFunPtr fun) {
tools_to_update = g_list_append(tools_to_update, (void *) fun);
}
void unregister_Tool(VoidFunPtr fun) {
if (tools_to_update == NULL) return;
tools_to_update = g_list_remove(tools_to_update, (void *) fun);
}
static void notify_Tool (VoidFunPtr fun, gpointer func_data) {
fun();
}
void notify_Tools() {
g_list_foreach(tools_to_update, (GFunc)notify_Tool, NULL);
}
/* Return the glade directory.
Note: See configure.ac for the value of GLADEUI_UNINSTALLED_DIR. */
gchar * get_ui_file (const char *filename)
{
gchar *path;
/* looking in uninstalled (aka building) dir first */
path = g_build_filename (GLADEUI_UNINSTALLED_DIR, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) return path;
g_free (path);
/* looking in installed dir */
path = g_build_filename (DATADIR, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) return path;
g_free (path);
printf ("Failed to find ui file, \"%s\", in %s or %s\n",
filename ? filename : "", GLADEUI_UNINSTALLED_DIR, DATADIR);
/* not found */
return NULL;
}
/*
* The thread handling functions needed by the GDB stub code.
*/
#ifdef GDB_STUB
void *
createThread_gdb( void (*thread_function)( void *data),
void *thread_data) {
GThread *new_thread = g_thread_new(NULL, (GThreadFunc)thread_function,
thread_data);
return new_thread;
}
void
joinThread_gdb( void *thread_handle) {
g_thread_join((GThread *) thread_handle);
}
#endif
/* ***** ***** MAIN ***** ***** */
static int
common_gtk_glade_main( struct configured_features *my_config) {
gchar *uifile;
GKeyFile *keyfile;
/* use any language set on the command line */
if ( my_config->firmware_language != -1) {
CommonSettings.fwConfig.language = my_config->firmware_language;
}
desmume_savetype(my_config->savetype);
#ifdef GTKGLEXT_AVAILABLE
// check if you have GTHREAD when running configure script
//g_thread_init(NULL);
//register_gl_fun(my_gl_Begin,my_gl_End);
#endif
init_keyvals();
if(SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1)
{
fprintf(stderr, _("Error trying to initialize SDL: %s\n"),
SDL_GetError());
return 1;
}
desmume_init();
/*
* Activate the GDB stubs
* This has to come after the NDS_Init (called in desmume_init)
* where the cpus are set up.
*/
#ifdef GDB_STUB
gdbstub_mutex_init();
gdbstub_handle_t arm9_gdb_stub = NULL;
gdbstub_handle_t arm7_gdb_stub = NULL;
if ( my_config->arm9_gdb_port > 0) {
arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port,
&NDS_ARM9,
&arm9_direct_memory_iface);
if ( arm9_gdb_stub == NULL) {
g_printerr("Failed to create ARM9 gdbstub on port %d\n",
my_config->arm9_gdb_port);
exit( -1);
}
else {
activateStub_gdb( arm9_gdb_stub);
}
}
if ( my_config->arm7_gdb_port > 0) {
arm7_gdb_stub = createStub_gdb( my_config->arm7_gdb_port,
&NDS_ARM7,
&arm7_base_memory_iface);
if ( arm7_gdb_stub == NULL) {
g_printerr("Failed to create ARM7 gdbstub on port %d\n",
my_config->arm7_gdb_port);
exit( -1);
}
else {
activateStub_gdb( arm7_gdb_stub);
}
}
#endif
/* Initialize joysticks */
if(!init_joy()) return 1;
keyfile = desmume_config_read_file(gtk_kb_cfg);
/* load the interface */
uifile = get_ui_file("DeSmuMe.glade");
xml = glade_xml_new(uifile, NULL, NULL);
g_free (uifile);
uifile = get_ui_file("DeSmuMe_Dtools.glade");
xml_tools = glade_xml_new(uifile, NULL, NULL);
g_free (uifile);
pWindow = glade_xml_get_widget(xml, "wMainW");
pDrawingArea = glade_xml_get_widget(xml, "wDraw_Main");
pDrawingArea2 = glade_xml_get_widget(xml, "wDraw_Sub");
{
char wdgName[40];
snprintf(wdgName, 39, "savetype%d", my_config->savetype+1);
GtkWidget * wdgt = glade_xml_get_widget(xml, wdgName);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (wdgt), TRUE);
}
/* connect the signals in the interface */
glade_xml_signal_autoconnect_StringObject(xml);
glade_xml_signal_autoconnect_StringObject(xml_tools);
init_GL_capabilities();
/* check command line file */
if( my_config->nds_file) {
if(desmume_open( my_config->nds_file) >= 0) {
loadstate_slot( my_config->load_slot);
desmume_resume();
enable_rom_features();
} else {
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow),
GTK_DIALOG_MODAL,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
_("Unable to load :\n%s"), my_config->nds_file);
gtk_dialog_run(GTK_DIALOG(pDialog));
gtk_widget_destroy(pDialog);
}
}
gtk_widget_show(pDrawingArea);
gtk_widget_show(pDrawingArea2);
{
int engine = my_config->engine_3d;
#ifdef GTKGLEXT_AVAILABLE
if ( my_config->engine_3d==2 )
/* setup the gdk 3D emulation */
if(!init_opengl_gdk_3Demu(GDK_DRAWABLE(pWindow->window))){
fprintf( stderr, _("Failed to initialise openGL 3D emulation; "
"removing 3D support\n"));
engine = 0;
}
#endif
if (!GPU->Change3DRendererByID(engine)) {
GPU->Change3DRendererByID(RENDERID_SOFTRASTERIZER);
fprintf(stderr, _("3D renderer initialization failed!\nFalling back to 3D core: %s\n"), core3DList[RENDERID_SOFTRASTERIZER]->name);
}
}
// on_menu_tileview_activate(NULL,NULL);
/* setup the frame limiter and indicate if it is disabled */
glade_fps_limiter_disabled = my_config->disable_limiter;
/* start event loop */
gtk_main();
desmume_free();
#ifdef GDB_STUB
destroyStub_gdb( arm9_gdb_stub);
arm9_gdb_stub = NULL;
destroyStub_gdb( arm7_gdb_stub);
arm7_gdb_stub = NULL;
gdbstub_mutex_destroy();
#endif
/* Unload joystick */
uninit_joy();
SDL_Quit();
desmume_config_update_keys(keyfile);
desmume_config_update_joykeys(keyfile);
desmume_config_dispose(keyfile);
return EXIT_SUCCESS;
}
int main(int argc, char *argv[]) {
struct configured_features my_config;
// Localization
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
init_configured_features( &my_config);
/* X11 multi-threading support */
if(!XInitThreads())
{
fprintf(stderr, "Warning: X11 not thread-safe\n");
}
gtk_init(&argc, &argv);
#ifdef GTKGLEXT_AVAILABLE
gtk_gl_init( &argc, &argv);
#endif
if ( !fill_configured_features( &my_config, argc, argv)) {
exit(0);
}
return common_gtk_glade_main( &my_config);
}
#ifdef WIN32
int WinMain ( HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
LPSTR lpszArgument, int nFunsterStil)
{
int argc = 0;
char *argv[] = NULL;
/*
* FIXME:
* Emulate the argc and argv main parameters. Could do this using
* CommandLineToArgvW and then convert the wide chars to thin chars.
* Or parse the wide chars directly and call common_gtk_glade_main with a
* filled configuration structure.
*/
main( argc, argv);
}
#endif

View File

@ -1,46 +0,0 @@
dep_gtk2 = dependency('gtk+-2.0')
dep_glade = dependency('libglade-2.0')
dep_gmodule = dependency('gmodule-2.0')
dep_gtkglext = dependency('gtkglext-1.0')
dep_x11 = dependency('x11')
gtk_dependencies = dependencies + [dep_gtk2, dep_glade, dep_gmodule, dep_gtkglext, dep_x11]
desmume_src = [
'glade-xml.cpp',
'callbacks.cpp',
'callbacks_IO.cpp',
'desmume.cpp',
'keyval_names.cpp',
'main.cpp',
'gdk_gl.cpp',
'dTools/callbacks_1_ioregs.cpp',
'dTools/callbacks_2_memview.cpp',
'dTools/callbacks_3_palview.cpp',
'dTools/callbacks_4_tileview.cpp',
'gdk_3Demu.cpp',
'../shared/sndsdl.cpp',
'../shared/ctrlssdl.cpp',
'../../../driver.cpp',
]
# TODO: why do we have to redeclare it here with one more fs level?
includes = include_directories(
'../../../../src',
'../../../../src/libretro-common/include',
'../../../../src/frontend',
)
executable('desmume-glade',
desmume_src,
cpp_args: ['-DGETTEXT_PACKAGE="desmume"', '-DLOCALEDIR="' + get_option('localedir') + '"', '-DVERSION="Unknown version"', '-DGTKGLEXT_AVAILABLE'],
dependencies: gtk_dependencies,
include_directories: includes,
link_with: libdesmume,
install: true,
)
install_data('desmume-glade.desktop', install_dir: join_paths(get_option('datadir'), 'applications'))
install_data('glade/DeSmuME.xpm', install_dir: join_paths(get_option('datadir'), 'pixmaps'))
install_man('doc/desmume-glade.1')
install_data(['glade/DeSmuMe_Dtools.glade', 'glade/DeSmuMe.glade', 'glade/DeSmuME.xpm'], install_dir: join_paths(get_option('datadir'), 'glade'))

View File

@ -252,6 +252,3 @@ endif
if get_option('frontend-gtk') if get_option('frontend-gtk')
subdir('gtk') subdir('gtk')
endif endif
if get_option('frontend-glade')
subdir('gtk-glade')
endif

View File

@ -13,11 +13,6 @@ option('frontend-cli',
value: true, value: true,
description: 'Enable CLI frontend', description: 'Enable CLI frontend',
) )
option('frontend-glade',
type: 'boolean',
value: false,
description: 'Enable glade frontend',
)
option('wifi', option('wifi',
type: 'boolean', type: 'boolean',
value: false, value: false,