mirror of https://github.com/snes9xgit/snes9x.git
Import of GTK port changes.
This commit is contained in:
parent
9f3b69f575
commit
31f45619a5
|
@ -11,7 +11,7 @@ noinst_LIBRARIES =
|
|||
INCLUDES = -I$(top_srcdir) -I.. -DSNES9XLOCALEDIR=\""$(snes9xlocaledir)"\"
|
||||
|
||||
CLEANFILES = \
|
||||
src/gtk_glade.cpp \
|
||||
src/gtk_snes9x_ui.cpp \
|
||||
src/sourcify
|
||||
|
||||
snes9x_gtk_SOURCES = \
|
||||
|
@ -20,8 +20,6 @@ snes9x_gtk_SOURCES = \
|
|||
../filter/2xsai.h \
|
||||
../filter/epx.cpp \
|
||||
../filter/epx.h \
|
||||
../filter/hq2x.cpp \
|
||||
../filter/hq2x.h \
|
||||
src/filter_epx_unsafe.h \
|
||||
src/filter_epx_unsafe.cpp \
|
||||
src/gtk_binding.cpp \
|
||||
|
@ -39,9 +37,9 @@ snes9x_gtk_SOURCES = \
|
|||
src/gtk_display.h \
|
||||
src/gtk_file.cpp \
|
||||
src/gtk_file.h \
|
||||
src/gtk_glade.cpp \
|
||||
src/gtk_glade_window.cpp \
|
||||
src/gtk_glade_window.h \
|
||||
src/gtk_snes9x_ui.cpp \
|
||||
src/gtk_builder_window.cpp \
|
||||
src/gtk_builder_window.h \
|
||||
src/gtk_preferences.cpp \
|
||||
src/gtk_preferences.h \
|
||||
src/gtk_s9xcore.h \
|
||||
|
@ -57,6 +55,12 @@ snes9x_gtk_SOURCES = \
|
|||
src/snes_ntsc_impl.h \
|
||||
src/snes_ntsc.c
|
||||
|
||||
if HQ2X
|
||||
snes9x_gtk_SOURCES += \
|
||||
../filter/hq2x.cpp \
|
||||
../filter/hq2x.h
|
||||
endif
|
||||
|
||||
if PORTAUDIO
|
||||
snes9x_gtk_SOURCES += \
|
||||
src/gtk_sound_driver_portaudio.cpp \
|
||||
|
@ -230,8 +234,8 @@ SUFFIXES = .asm .ASM
|
|||
src/sourcify: src/sourcify.c
|
||||
$(CC) src/sourcify.c -o src/sourcify
|
||||
|
||||
src/gtk_glade.cpp: src/sourcify src/snes9x.glade
|
||||
src/sourcify src/snes9x.glade src/gtk_glade.cpp snes9x_glade
|
||||
src/gtk_snes9x_ui.cpp: src/sourcify src/snes9x.ui
|
||||
src/sourcify src/snes9x.ui src/gtk_snes9x_ui.cpp snes9x_ui
|
||||
|
||||
.asm.o:
|
||||
$(NASM) -f elf -DELF $(NASM_FLAGS) -i ./ -i ../ -i ../i386/ -i i386/ -o $@ $*.asm
|
||||
|
|
3002
gtk/Makefile.in
3002
gtk/Makefile.in
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
143
gtk/compile
143
gtk/compile
|
@ -1,143 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2009-10-06.20; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
AC_INIT([snes9x-gtk], 1.52)
|
||||
dnl Set CFLAGS, CXXFLAGS to something
|
||||
dnl before doing AC_PROG_CC, AC_PROG_CXX to avoid default -g
|
||||
CFLAGS="-O2 -Wall -W -pedantic -Wno-unused-parameter -pipe $CFLAGS"
|
||||
CFLAGS="-Os -Wall -W -pedantic -Wno-unused-parameter -pipe $CFLAGS"
|
||||
CXXFLAGS="$CFLAGS"
|
||||
|
||||
AC_PROG_CC
|
||||
|
@ -15,7 +15,7 @@ AM_INIT_AUTOMAKE([foreign subdir-objects])
|
|||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||
|
||||
AM_PROG_CC_C_O
|
||||
IT_PROG_INTLTOOL([0.40.1])
|
||||
IT_PROG_INTLTOOL([0.37.0])
|
||||
GETTEXT_PACKAGE=[snes9x-gtk]
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE")
|
||||
|
@ -109,6 +109,12 @@ AC_ARG_WITH(sdd1-decomp,
|
|||
[],
|
||||
[with_sdd1_decomp=yes])
|
||||
|
||||
AC_ARG_WITH(hq2x,
|
||||
[AS_HELP_STRING([--with(out)-hq2x],
|
||||
[Enable support for the HQ2x family of filters (default: with)])],
|
||||
[],
|
||||
[with_hq2x=yes])
|
||||
|
||||
AC_ARG_WITH(netplay,
|
||||
[AS_HELP_STRING([--with(out)-netplay],
|
||||
[Enable netplay support (default: without)])],
|
||||
|
@ -133,7 +139,7 @@ AC_ARG_WITH(zlib,
|
|||
[],
|
||||
[with_zlib=yes])
|
||||
|
||||
AC_ARG_WITH(png,
|
||||
AC_ARG_WITH(screenshot,
|
||||
[AS_HELP_STRING([--with(out)-screenshot],
|
||||
[Screenshot support through libpng if available (default: with)])],
|
||||
[],
|
||||
|
@ -145,6 +151,8 @@ else
|
|||
CFLAGS="$CFLAGS -fomit-frame-pointer"
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -DGSEAL_ENABLE -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
|
||||
|
||||
ZSNESFX='#ZSNESFX=yes'
|
||||
ZSNESC4='#ZSNESC4=yes'
|
||||
ASMCPU=''
|
||||
|
@ -167,9 +175,8 @@ fi
|
|||
GTK=yes
|
||||
snes9x_info_display="GTK"
|
||||
|
||||
PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.10])
|
||||
PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.16])
|
||||
PKG_CHECK_MODULES([GLIB], [gthread-2.0 >= 2.6 gobject-2.0 >= 2.6])
|
||||
PKG_CHECK_MODULES([GLADE], [libglade-2.0 >= 2.0])
|
||||
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.0])
|
||||
|
||||
if test yes = "$with_opengl" ; then
|
||||
|
@ -280,10 +287,27 @@ if test yes = "$with_xrandr" ; then
|
|||
echo "--> Disabling Xrandr support."
|
||||
])
|
||||
fi
|
||||
PKG_CHECK_MODULES([LIBPNG],libpng)
|
||||
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS $GLIB_CFLAGS $GLADE_CFLAGS $LIBXML_CFLAGS $PORTAUDIO_CFLAGS $LIBPNG_CFLAGS $SDL_CFLAGS $XV_CFLAGS $XRANDR_CFLAGS $ALSA_CFLAGS $PULSEAUDIO_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS $GLIB_LIBS $GLADE_LIBS $LIBXML_LIBS $PORTAUDIO_LIBS $LIBPNG_LIBS $SDL_LIBS $XV_LIBS $XRANDR_LIBS $ALSA_LIBS $PULSEAUDIO_LIBS"
|
||||
LIBPNG_CFLAGS=""
|
||||
LIBPNG_LIBS=""
|
||||
if test yes = "$with_screenshot"; then
|
||||
PKG_CHECK_MODULES([LIBPNG],[libpng],[
|
||||
CFLAGS="$CFLAGS -DHAVE_LIBPNG"
|
||||
],[
|
||||
echo "Cannot find libpng."
|
||||
echo "--> Disabling screenshot support."
|
||||
])
|
||||
fi
|
||||
|
||||
if test yes = "$with_hq2x" ; then
|
||||
HQ2X=yes
|
||||
CFLAGS="$CFLAGS -DUSE_HQ2X"
|
||||
else
|
||||
HQ2X=0
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS $GLIB_CFLAGS $LIBXML_CFLAGS $PORTAUDIO_CFLAGS $LIBPNG_CFLAGS $SDL_CFLAGS $XV_CFLAGS $XRANDR_CFLAGS $ALSA_CFLAGS $PULSEAUDIO_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS $GLIB_LIBS $LIBXML_LIBS $PORTAUDIO_LIBS $LIBPNG_LIBS $SDL_LIBS $XV_LIBS $XRANDR_LIBS $ALSA_LIBS $PULSEAUDIO_LIBS"
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if the CPU is IA32)
|
||||
|
@ -371,13 +395,6 @@ if test yes = "$with_zlib"; then
|
|||
], ,)
|
||||
fi
|
||||
|
||||
if test yes = "$with_screenshot"; then
|
||||
AC_CHECK_LIB(png, png_init_io, [
|
||||
CFLAGS="$CFLAGS -DHAVE_LIBPNG"
|
||||
LIBS="$LIBS -lpng"
|
||||
], , -lz -lm)
|
||||
fi
|
||||
|
||||
dnl Check for functions
|
||||
AC_CHECK_FUNC(mkstemp, [
|
||||
CFLAGS="$CFLAGS -DHAVE_MKSTEMP"
|
||||
|
@ -471,6 +488,7 @@ AM_CONDITIONAL(DEBUG, [test yes = "$with_debug" ])
|
|||
AM_CONDITIONAL(SDL, [test yes = "$GTKJOY"])
|
||||
AM_CONDITIONAL(ALSA, [test yes = "$ALSA"])
|
||||
AM_CONDITIONAL(PULSEAUDIO, [test yes = "$PULSEAUDIO"])
|
||||
AM_CONDITIONAL(HQ2X, [test yes = "$HQ2X"])
|
||||
|
||||
AC_SUBST(NASM)
|
||||
AC_SUBST(NASM_FLAGS)
|
||||
|
@ -545,3 +563,7 @@ if ! test yes = "$PORTAUDIO" ; then
|
|||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! test yes = "$HQ2X"; then
|
||||
echo "HQ2x filter compilation is disabled."
|
||||
fi
|
||||
|
|
|
@ -1,534 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = data
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(desktopdir)" \
|
||||
"$(DESTDIR)$(icon16x16dir)" "$(DESTDIR)$(icon24x24dir)" \
|
||||
"$(DESTDIR)$(icon32x32dir)" "$(DESTDIR)$(iconscalabledir)"
|
||||
DATA = $(desktop_DATA) $(icon16x16_DATA) $(icon24x24_DATA) \
|
||||
$(icon32x32_DATA) $(iconscalable_DATA)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALL_LINGUAS = @ALL_LINGUAS@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
GLADE_CFLAGS = @GLADE_CFLAGS@
|
||||
GLADE_LIBS = @GLADE_LIBS@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GREP = @GREP@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
|
||||
INTLTOOL_MERGE = @INTLTOOL_MERGE@
|
||||
INTLTOOL_PERL = @INTLTOOL_PERL@
|
||||
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPNG_CFLAGS = @LIBPNG_CFLAGS@
|
||||
LIBPNG_LIBS = @LIBPNG_LIBS@
|
||||
LIBS = @LIBS@
|
||||
LIBXML_CFLAGS = @LIBXML_CFLAGS@
|
||||
LIBXML_LIBS = @LIBXML_LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_OPTS = @MSGFMT_OPTS@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NASM = @NASM@
|
||||
NASM_FLAGS = @NASM_FLAGS@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
POFILES = @POFILES@
|
||||
PORTAUDIO_CFLAGS = @PORTAUDIO_CFLAGS@
|
||||
PORTAUDIO_LIBS = @PORTAUDIO_LIBS@
|
||||
POSUB = @POSUB@
|
||||
PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
|
||||
PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
|
||||
PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
|
||||
PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
|
||||
RANLIB = @RANLIB@
|
||||
SDLCONFIGFOUND = @SDLCONFIGFOUND@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XRANDR_CFLAGS = @XRANDR_CFLAGS@
|
||||
XRANDR_LIBS = @XRANDR_LIBS@
|
||||
XV_CFLAGS = @XV_CFLAGS@
|
||||
XV_LIBS = @XV_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
prog_nasm = @prog_nasm@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
snes9xlocaledir = @snes9xlocaledir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_DATA = snes9x.desktop
|
||||
icon16x16dir = $(datadir)/icons/hicolor/16x16/apps
|
||||
icon16x16_DATA = snes9x_16x16.png
|
||||
icon24x24dir = $(datadir)/icons/hicolor/24x24/apps
|
||||
icon24x24_DATA = snes9x_24x24.png
|
||||
icon32x32dir = $(datadir)/icons/hicolor/32x32/apps
|
||||
icon32x32_DATA = snes9x_32x32.png
|
||||
iconscalabledir = $(datadir)/icons/hicolor/scalable/apps
|
||||
iconscalable_DATA = snes9x.svg
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign data/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-desktopDATA: $(desktop_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(desktopdir)" || $(MKDIR_P) "$(DESTDIR)$(desktopdir)"
|
||||
@list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(desktopdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-desktopDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(desktopdir)" && rm -f $$files
|
||||
install-icon16x16DATA: $(icon16x16_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(icon16x16dir)" || $(MKDIR_P) "$(DESTDIR)$(icon16x16dir)"
|
||||
@list='$(icon16x16_DATA)'; test -n "$(icon16x16dir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(icon16x16dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(icon16x16dir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-icon16x16DATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(icon16x16_DATA)'; test -n "$(icon16x16dir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(icon16x16dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(icon16x16dir)" && rm -f $$files
|
||||
install-icon24x24DATA: $(icon24x24_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(icon24x24dir)" || $(MKDIR_P) "$(DESTDIR)$(icon24x24dir)"
|
||||
@list='$(icon24x24_DATA)'; test -n "$(icon24x24dir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(icon24x24dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(icon24x24dir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-icon24x24DATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(icon24x24_DATA)'; test -n "$(icon24x24dir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(icon24x24dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(icon24x24dir)" && rm -f $$files
|
||||
install-icon32x32DATA: $(icon32x32_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(icon32x32dir)" || $(MKDIR_P) "$(DESTDIR)$(icon32x32dir)"
|
||||
@list='$(icon32x32_DATA)'; test -n "$(icon32x32dir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(icon32x32dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(icon32x32dir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-icon32x32DATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(icon32x32_DATA)'; test -n "$(icon32x32dir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(icon32x32dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(icon32x32dir)" && rm -f $$files
|
||||
install-iconscalableDATA: $(iconscalable_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(iconscalabledir)" || $(MKDIR_P) "$(DESTDIR)$(iconscalabledir)"
|
||||
@list='$(iconscalable_DATA)'; test -n "$(iconscalabledir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(iconscalabledir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(iconscalabledir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-iconscalableDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(iconscalable_DATA)'; test -n "$(iconscalabledir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(iconscalabledir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(iconscalabledir)" && rm -f $$files
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(icon16x16dir)" "$(DESTDIR)$(icon24x24dir)" "$(DESTDIR)$(icon32x32dir)" "$(DESTDIR)$(iconscalabledir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-desktopDATA install-icon16x16DATA \
|
||||
install-icon24x24DATA install-icon32x32DATA \
|
||||
install-iconscalableDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-desktopDATA uninstall-icon16x16DATA \
|
||||
uninstall-icon24x24DATA uninstall-icon32x32DATA \
|
||||
uninstall-iconscalableDATA
|
||||
|
||||
.MAKE: install-am install-data-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am \
|
||||
install-data-hook install-desktopDATA install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-icon16x16DATA install-icon24x24DATA \
|
||||
install-icon32x32DATA install-iconscalableDATA install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am uninstall uninstall-am uninstall-desktopDATA \
|
||||
uninstall-icon16x16DATA uninstall-icon24x24DATA \
|
||||
uninstall-icon32x32DATA uninstall-iconscalableDATA
|
||||
|
||||
|
||||
install-data-hook:
|
||||
mv -f $(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/snes9x_16x16.png \
|
||||
$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/snes9x.png
|
||||
mv -f $(DESTDIR)$(datadir)/icons/hicolor/24x24/apps/snes9x_24x24.png \
|
||||
$(DESTDIR)$(datadir)/icons/hicolor/24x24/apps/snes9x.png
|
||||
mv -f $(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/snes9x_32x32.png \
|
||||
$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/snes9x.png
|
||||
touch -c $(DESTDIR)$(datadir)/icons/hicolor
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
630
gtk/depcomp
630
gtk/depcomp
|
@ -1,630 +0,0 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1008
gtk/doc/lgpl.txt
1008
gtk/doc/lgpl.txt
File diff suppressed because it is too large
Load Diff
520
gtk/install-sh
520
gtk/install-sh
|
@ -1,520 +0,0 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
376
gtk/missing
376
gtk/missing
|
@ -1,376 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
||||
# 2008, 2009 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
||||
\`g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
;;
|
||||
|
||||
tar*)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar*)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -1,111 +0,0 @@
|
|||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage" 1>&2
|
||||
exit 0
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
|
@ -1,217 +0,0 @@
|
|||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
# Copyright (C) 2004-2008 Rodney Dawes <dobey.pwns@gmail.com>
|
||||
#
|
||||
# This file may be copied and used freely without restrictions. It may
|
||||
# be used in projects which are not available under a GNU Public License,
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
#
|
||||
# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
|
||||
# instead of PACKAGE and to look for po2tbl in ./ not in intl/
|
||||
#
|
||||
# - Modified by jacob berkman <jacob@ximian.com> to install
|
||||
# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
|
||||
#
|
||||
# - Modified by Rodney Dawes <dobey.pwns@gmail.com> for use with intltool
|
||||
#
|
||||
# We have the following line for use by intltoolize:
|
||||
# INTLTOOL_MAKEFILE
|
||||
|
||||
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
libdir = @libdir@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
|
||||
subdir = po
|
||||
install_sh = @install_sh@
|
||||
# Automake >= 1.8 provides @mkdir_p@.
|
||||
# Until it can be supposed, use the safe fallback:
|
||||
mkdir_p = $(install_sh) -d
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
GMSGFMT = @GMSGFMT@
|
||||
MSGFMT = @MSGFMT@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
|
||||
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
|
||||
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
|
||||
GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
|
||||
|
||||
ALL_LINGUAS = @ALL_LINGUAS@
|
||||
|
||||
PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
|
||||
|
||||
USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi)
|
||||
|
||||
USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
|
||||
|
||||
POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
|
||||
|
||||
DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
|
||||
EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS
|
||||
|
||||
POTFILES = \
|
||||
# This comment gets stripped out
|
||||
|
||||
CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .po .pox .gmo .mo .msg .cat
|
||||
|
||||
.po.pox:
|
||||
$(MAKE) $(GETTEXT_PACKAGE).pot
|
||||
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
|
||||
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
||||
|
||||
.po.gmo:
|
||||
file=`echo $* | sed 's,.*/,,'`.gmo \
|
||||
&& rm -f $$file && $(GMSGFMT) -o $$file $<
|
||||
|
||||
.po.cat:
|
||||
sed -f ../intl/po2msg.sed < $< > $*.msg \
|
||||
&& rm -f $@ && gencat $@ $*.msg
|
||||
|
||||
|
||||
all: all-@USE_NLS@
|
||||
|
||||
all-yes: $(CATALOGS)
|
||||
all-no:
|
||||
|
||||
$(GETTEXT_PACKAGE).pot: $(POTFILES)
|
||||
$(GENPOT)
|
||||
|
||||
install: install-data
|
||||
install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
linguas="$(USE_LINGUAS)"; \
|
||||
for lang in $$linguas; do \
|
||||
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
|
||||
$(mkdir_p) $$dir; \
|
||||
if test -r $$lang.gmo; then \
|
||||
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
|
||||
echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
|
||||
echo "installing $(srcdir)/$$lang.gmo as" \
|
||||
"$$dir/$(GETTEXT_PACKAGE).mo"; \
|
||||
fi; \
|
||||
if test -r $$lang.gmo.m; then \
|
||||
$(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
|
||||
echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
|
||||
else \
|
||||
if test -r $(srcdir)/$$lang.gmo.m ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
|
||||
$$dir/$(GETTEXT_PACKAGE).mo.m; \
|
||||
echo "installing $(srcdir)/$$lang.gmo.m as" \
|
||||
"$$dir/$(GETTEXT_PACKAGE).mo.m"; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# Empty stubs to satisfy archaic automake needs
|
||||
dvi info tags TAGS ID:
|
||||
|
||||
# Define this as empty until I found a useful application.
|
||||
install-exec installcheck:
|
||||
|
||||
uninstall:
|
||||
linguas="$(USE_LINGUAS)"; \
|
||||
for lang in $$linguas; do \
|
||||
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
|
||||
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
|
||||
done
|
||||
|
||||
check: all $(GETTEXT_PACKAGE).pot
|
||||
rm -f missing notexist
|
||||
srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
|
||||
if [ -r missing -o -r notexist ]; then \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
mostlyclean:
|
||||
rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
|
||||
rm -f .intltool-merge-cache
|
||||
|
||||
clean: mostlyclean
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile Makefile.in POTFILES stamp-it
|
||||
rm -f *.mo *.msg *.cat *.cat.m *.gmo
|
||||
|
||||
maintainer-clean: distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
rm -f Makefile.in.in
|
||||
|
||||
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
dist distdir: $(DISTFILES)
|
||||
dists="$(DISTFILES)"; \
|
||||
extra_dists="$(EXTRA_DISTFILES)"; \
|
||||
for file in $$extra_dists; do \
|
||||
test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
|
||||
done; \
|
||||
for file in $$dists; do \
|
||||
test -f $$file || file="$(srcdir)/$$file"; \
|
||||
ln $$file $(distdir) 2> /dev/null \
|
||||
|| cp -p $$file $(distdir); \
|
||||
done
|
||||
|
||||
update-po: Makefile
|
||||
$(MAKE) $(GETTEXT_PACKAGE).pot
|
||||
tmpdir=`pwd`; \
|
||||
linguas="$(USE_LINGUAS)"; \
|
||||
for lang in $$linguas; do \
|
||||
echo "$$lang:"; \
|
||||
result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
|
||||
if $$result; then \
|
||||
if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
|
||||
rm -f $$tmpdir/$$lang.new.po; \
|
||||
else \
|
||||
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
|
||||
:; \
|
||||
else \
|
||||
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
|
||||
rm -f $$tmpdir/$$lang.new.po; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
else \
|
||||
echo "msgmerge for $$lang.gmo failed!"; \
|
||||
rm -f $$tmpdir/$$lang.new.po; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
Makefile POTFILES: stamp-it
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-it; \
|
||||
$(MAKE) stamp-it; \
|
||||
fi
|
||||
|
||||
stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
$(SHELL) ./config.status
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make not to export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
905
gtk/po/fr_FR.po
905
gtk/po/fr_FR.po
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,254 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "gtk_builder_window.h"
|
||||
|
||||
extern const unsigned char snes9x_ui[];
|
||||
extern const int snes9x_ui_size;
|
||||
|
||||
GtkBuilderWindow::GtkBuilderWindow (const char *root)
|
||||
{
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
(const gchar *) snes9x_ui,
|
||||
snes9x_ui_size,
|
||||
NULL);
|
||||
|
||||
window = get_widget (root);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GtkBuilderWindow::~GtkBuilderWindow (void)
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
GtkBuilderWindow::get_widget (const char *name)
|
||||
{
|
||||
return GTK_WIDGET (gtk_builder_get_object (builder, name));
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::signal_connection_func (GtkBuilder *builder,
|
||||
GObject *object,
|
||||
const gchar *signal_name,
|
||||
const char *handler_name,
|
||||
GObject *connect_object,
|
||||
GConnectFlags flags,
|
||||
gpointer data)
|
||||
{
|
||||
GCallback function = NULL;
|
||||
GtkBuilderWindow *window = (GtkBuilderWindow *) data;
|
||||
GtkBuilderWindowCallbacks *callbacks = window->callbacks;
|
||||
|
||||
for (int i = 0; callbacks[i].signal; i++)
|
||||
{
|
||||
if (!strcmp (handler_name, callbacks[i].signal))
|
||||
{
|
||||
function = callbacks[i].function;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (function)
|
||||
{
|
||||
if (connect_object)
|
||||
{
|
||||
fprintf (stderr, "Error: found a persistent object signal.\n");
|
||||
g_signal_connect_object (object,
|
||||
signal_name,
|
||||
function,
|
||||
connect_object,
|
||||
flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_connect_data (object,
|
||||
signal_name,
|
||||
function,
|
||||
data,
|
||||
NULL,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::signal_connect (GtkBuilderWindowCallbacks *callbacks)
|
||||
{
|
||||
if (!callbacks)
|
||||
return;
|
||||
|
||||
this->callbacks = callbacks;
|
||||
|
||||
gtk_builder_connect_signals_full (builder,
|
||||
signal_connection_func,
|
||||
(gpointer) this);
|
||||
|
||||
this->callbacks = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::enable_widget (const char *name, unsigned char state)
|
||||
{
|
||||
gtk_widget_set_sensitive (get_widget (name), state);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::resize (int width, int height)
|
||||
{
|
||||
if (width > 0 && height > 0)
|
||||
gtk_window_resize (GTK_WINDOW (window), width, height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::refresh (void)
|
||||
{
|
||||
gtk_widget_queue_draw (GTK_WIDGET (window));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
GtkBuilderWindow::get_width (void)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
int
|
||||
GtkBuilderWindow::get_height (void)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_button_label (const char *name, const char *label)
|
||||
{
|
||||
gtk_button_set_label (GTK_BUTTON (get_widget (name)), label);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
GtkBuilderWindow::get_check (const char *name)
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (get_widget (name))))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
GtkBuilderWindow::get_entry_value (const char *name)
|
||||
{
|
||||
return atoi (gtk_entry_get_text (GTK_ENTRY (get_widget (name))));;
|
||||
}
|
||||
|
||||
const char *
|
||||
GtkBuilderWindow::get_entry_text (const char *name)
|
||||
{
|
||||
return gtk_entry_get_text (GTK_ENTRY (get_widget (name)));
|
||||
}
|
||||
|
||||
float
|
||||
GtkBuilderWindow::get_slider (const char *name)
|
||||
{
|
||||
return (float) gtk_range_get_value (GTK_RANGE (get_widget (name)));
|
||||
}
|
||||
|
||||
unsigned char
|
||||
GtkBuilderWindow::get_combo (const char *name)
|
||||
{
|
||||
return gtk_combo_box_get_active (GTK_COMBO_BOX (get_widget (name)));
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_slider (const char *name, float value)
|
||||
{
|
||||
gtk_range_set_value (GTK_RANGE (get_widget (name)), (double) value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_check (const char *name, unsigned char value)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (get_widget (name)),
|
||||
value);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_entry_value (const char *name, unsigned int value)
|
||||
{
|
||||
char text[80];
|
||||
|
||||
snprintf (text, 80, "%u", value);
|
||||
gtk_entry_set_text (GTK_ENTRY (get_widget (name)), text);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_entry_text (const char *name, const char *text)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (get_widget (name)), text);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_combo (const char *name, unsigned char value)
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (get_widget (name)), value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GtkBuilderWindow::set_spin (const char *name, unsigned int value)
|
||||
{
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (get_widget (name)),
|
||||
(double) value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GtkWindow *
|
||||
GtkBuilderWindow::get_window (void)
|
||||
{
|
||||
return GTK_WINDOW (window);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
GtkBuilderWindow::get_spin (const char *name)
|
||||
{
|
||||
return (unsigned int)
|
||||
gtk_spin_button_get_value (GTK_SPIN_BUTTON (get_widget (name)));
|
||||
}
|
||||
|
||||
int
|
||||
GtkBuilderWindow::has_focus (const char *widget)
|
||||
{
|
||||
return gtk_widget_is_focus (get_widget (widget));
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
#ifndef __GTK_GLADE_WINDOW_H
|
||||
#define __GTK_GLADE_WINDOW_H
|
||||
#ifndef __GTK_BUILDER_WINDOW_H
|
||||
#define __GTK_BUILDER_WINDOW_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *signal;
|
||||
GCallback function;
|
||||
} GladeWindowCallbacks;
|
||||
} GtkBuilderWindowCallbacks;
|
||||
|
||||
class GladeWindow
|
||||
class GtkBuilderWindow
|
||||
{
|
||||
public:
|
||||
GladeWindow (const char *buffer, int size, const char *root);
|
||||
GtkBuilderWindow (const char *root);
|
||||
~GtkBuilderWindow ();
|
||||
GtkWidget *get_widget (const char *name);
|
||||
void resize (int width, int height);
|
||||
GtkWindow *get_window (void);
|
||||
|
@ -21,10 +21,7 @@ class GladeWindow
|
|||
int get_width (void);
|
||||
int get_height (void);
|
||||
|
||||
protected:
|
||||
void signal_connect (const char *name, GCallback func);
|
||||
void signal_connect (const char *name, GCallback func, gpointer data);
|
||||
void signal_connect (GladeWindowCallbacks *callbacks);
|
||||
void signal_connect (GtkBuilderWindowCallbacks *callbacks);
|
||||
void enable_widget (const char *name, unsigned char state);
|
||||
void set_button_label (const char *name, const char *label);
|
||||
unsigned char get_check (const char *name);
|
||||
|
@ -41,8 +38,12 @@ class GladeWindow
|
|||
void set_slider (const char *name, float value);
|
||||
int has_focus (const char *widget);
|
||||
|
||||
GtkWidget *window;
|
||||
GladeXML *glade;
|
||||
protected:
|
||||
static void signal_connection_func (GtkBuilder *, GObject *, const gchar *, const char *, GObject *, GConnectFlags, gpointer);
|
||||
|
||||
GtkWidget *window;
|
||||
GtkBuilder *builder;
|
||||
GtkBuilderWindowCallbacks *callbacks;
|
||||
};
|
||||
|
||||
#endif /* __GTK_GLADE_WINDOW_H */
|
||||
#endif /* __GTK_BUILDER_WINDOW_H */
|
|
@ -22,6 +22,7 @@ display_errorbox (const char *error)
|
|||
GTK_BUTTONS_OK,
|
||||
"%s",
|
||||
error);
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
|
@ -51,11 +52,11 @@ event_code_toggled (GtkCellRendererToggle *cell_renderer,
|
|||
}
|
||||
|
||||
Snes9xCheats::Snes9xCheats (void)
|
||||
: GladeWindow (snes9x_glade, snes9x_glade_size, "cheat_window")
|
||||
: GtkBuilderWindow ("cheat_window")
|
||||
{
|
||||
GtkTreeView *view;
|
||||
GtkCellRenderer *renderer;
|
||||
GladeWindowCallbacks callbacks[] =
|
||||
GtkBuilderWindowCallbacks callbacks[] =
|
||||
{
|
||||
{ "add_code", G_CALLBACK (event_add_code) },
|
||||
{ "remove_code", G_CALLBACK (event_remove_code) },
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef __GTK_CHEAT_H
|
||||
#define __GTK_CHEAT_H
|
||||
|
||||
#include "gtk_glade_window.h"
|
||||
#include "gtk_builder_window.h"
|
||||
|
||||
#define TYPE_GAME_GENIE 0
|
||||
#define TYPE_ACTION_REPLAY 1
|
||||
#define TYPE_GOLDFINGER 2
|
||||
|
||||
class Snes9xCheats : public GladeWindow
|
||||
class Snes9xCheats : public GtkBuilderWindow
|
||||
{
|
||||
public:
|
||||
Snes9xCheats (void);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <glade/glade-build.h>
|
||||
|
||||
#include "gtk_config.h"
|
||||
#include "gtk_s9x.h"
|
||||
|
@ -128,7 +127,6 @@ Snes9xConfig::load_defaults (void)
|
|||
aspect_ratio = 0;
|
||||
scale_method = 0;
|
||||
overscan = 0;
|
||||
data_location = DIR_ROM;
|
||||
save_sram_after_secs = 0;
|
||||
rom_loaded = 0;
|
||||
multithreading = 0;
|
||||
|
@ -143,11 +141,11 @@ Snes9xConfig::load_defaults (void)
|
|||
mute_sound = FALSE;
|
||||
fullscreen = FALSE;
|
||||
ui_visible = TRUE;
|
||||
statusbar_visible = TRUE;
|
||||
statusbar_visible = FALSE;
|
||||
default_esc_behavior = 1;
|
||||
prevent_screensaver = FALSE;
|
||||
sound_driver = 0;
|
||||
sound_buffer_size = 64;
|
||||
sound_buffer_size = 32;
|
||||
sound_playback_rate = 5;
|
||||
sound_input_rate = 31950;
|
||||
last_directory[0] = '\0';
|
||||
|
@ -155,7 +153,11 @@ Snes9xConfig::load_defaults (void)
|
|||
window_height = -1;
|
||||
preferences_width = -1;
|
||||
preferences_height = -1;
|
||||
custom_sram_directory[0] = '\0';
|
||||
sram_directory[0] = '\0';
|
||||
export_directory[0] = '\0';
|
||||
savestate_directory[0] = '\0';
|
||||
cheat_directory[0] = '\0';
|
||||
patch_directory[0] = '\0';
|
||||
screensaver_needs_reset = FALSE;
|
||||
ntsc_setup = snes_ntsc_composite;
|
||||
ntsc_scanline_intensity = 1;
|
||||
|
@ -177,6 +179,10 @@ Snes9xConfig::load_defaults (void)
|
|||
use_pbos = 1;
|
||||
pbo_format = 0;
|
||||
npot_textures = FALSE;
|
||||
use_shaders = 0;
|
||||
fragment_shader[0] = '\0';
|
||||
vertex_shader[0] = '\0';
|
||||
sync_every_frame = FALSE;
|
||||
#endif
|
||||
|
||||
/* Snes9X Variables */
|
||||
|
@ -280,10 +286,13 @@ Snes9xConfig::save_config_file (void)
|
|||
xml_out_int (xml, "overscan", overscan);
|
||||
xml_out_int (xml, "force_hires", force_hires);
|
||||
xml_out_int (xml, "force_inverted_byte_order", force_inverted_byte_order);
|
||||
xml_out_int (xml, "data_location", data_location);
|
||||
xml_out_int (xml, "multithreading", multithreading);
|
||||
xml_out_string (xml, "last_directory", last_directory);
|
||||
xml_out_string (xml, "custom_sram_directory", custom_sram_directory);
|
||||
xml_out_string (xml, "sram_directory", sram_directory);
|
||||
xml_out_string (xml, "savestate_directory", savestate_directory);
|
||||
xml_out_string (xml, "cheat_directory", cheat_directory);
|
||||
xml_out_string (xml, "patch_directory", patch_directory);
|
||||
xml_out_string (xml, "export_directory", export_directory);
|
||||
xml_out_int (xml, "window_width", window_width);
|
||||
xml_out_int (xml, "window_height", window_height);
|
||||
xml_out_int (xml, "preferences_width", preferences_width);
|
||||
|
@ -317,9 +326,13 @@ Snes9xConfig::save_config_file (void)
|
|||
#ifdef USE_OPENGL
|
||||
xml_out_int (xml, "bilinear_filter", bilinear_filter);
|
||||
xml_out_int (xml, "sync_to_vblank", sync_to_vblank);
|
||||
xml_out_int (xml, "sync_every_frame", sync_every_frame);
|
||||
xml_out_int (xml, "use_pbos", use_pbos);
|
||||
xml_out_int (xml, "pbo_format", pbo_format);
|
||||
xml_out_int (xml, "npot_textures", npot_textures);
|
||||
xml_out_int (xml, "use_shaders", use_shaders);
|
||||
xml_out_string (xml, "fragment_shader", fragment_shader);
|
||||
xml_out_string (xml, "vertex_shader", vertex_shader);
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOYSTICK
|
||||
|
@ -462,9 +475,13 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
else if (!strcasecmp (name, "scale_method"))
|
||||
{
|
||||
scale_method = atoi (value);
|
||||
|
||||
#ifdef USE_HQ2X
|
||||
if (scale_method >= NUM_FILTERS)
|
||||
scale_method = 0;
|
||||
#else
|
||||
if (scale_method >= NUM_FILTERS - 3)
|
||||
scale_method = 0;
|
||||
#endif /* USE_HQ2X */
|
||||
}
|
||||
else if (!strcasecmp (name, "multithreading"))
|
||||
{
|
||||
|
@ -491,6 +508,12 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
{
|
||||
#ifdef USE_OPENGL
|
||||
sync_to_vblank = atoi (value);
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp (name, "sync_every_frame"))
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
sync_every_frame = atoi (value);
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp (name, "use_pbos"))
|
||||
|
@ -510,6 +533,24 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
{
|
||||
#ifdef USE_OPENGL
|
||||
npot_textures = atoi (value);
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp (name, "use_shaders"))
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
use_shaders = atoi (value);
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp (name, "fragment_shader"))
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
strncpy (fragment_shader, value, PATH_MAX);
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp (name, "vertex_shader"))
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
strncpy (vertex_shader, value, PATH_MAX);
|
||||
#endif
|
||||
}
|
||||
else if (!strcasecmp (name, "joystick_threshold"))
|
||||
|
@ -520,7 +561,7 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
}
|
||||
else if (!strcasecmp (name, "data_location"))
|
||||
{
|
||||
data_location = atoi (value);
|
||||
/* Deprecated */
|
||||
}
|
||||
else if (!strcasecmp (name, "save_sram_after_secs"))
|
||||
{
|
||||
|
@ -599,7 +640,27 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
}
|
||||
else if (!strcasecmp (name, "custom_sram_directory"))
|
||||
{
|
||||
strncpy (custom_sram_directory, value, PATH_MAX);
|
||||
strncpy (sram_directory, value, PATH_MAX);
|
||||
}
|
||||
else if (!strcasecmp (name, "sram_directory"))
|
||||
{
|
||||
strncpy (sram_directory, value, PATH_MAX);
|
||||
}
|
||||
else if (!strcasecmp (name, "savestate_directory"))
|
||||
{
|
||||
strncpy (savestate_directory, value, PATH_MAX);
|
||||
}
|
||||
else if (!strcasecmp (name, "cheat_directory"))
|
||||
{
|
||||
strncpy (cheat_directory, value, PATH_MAX);
|
||||
}
|
||||
else if (!strcasecmp (name, "patch_directory"))
|
||||
{
|
||||
strncpy (patch_directory, value, PATH_MAX);
|
||||
}
|
||||
else if (!strcasecmp (name, "export_directory"))
|
||||
{
|
||||
strncpy (export_directory, value, PATH_MAX);
|
||||
}
|
||||
else if (!strcasecmp (name, "window_width"))
|
||||
{
|
||||
|
@ -1044,7 +1105,7 @@ Snes9xConfig::load_config_file (void)
|
|||
|
||||
if (stat (pathname, &file_info))
|
||||
{
|
||||
if (mkdir (pathname, 0))
|
||||
if (mkdir (pathname, 0755))
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("Couldn't create config directory: %s\n"),
|
||||
|
@ -1052,6 +1113,10 @@ Snes9xConfig::load_config_file (void)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chmod (pathname, 0755);
|
||||
}
|
||||
|
||||
free (pathname);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __GTK_CONFIG_H
|
||||
#define __GTK_CONFIG_H
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <X11/Xlib.h>
|
||||
#ifdef USE_XRANDR
|
||||
|
@ -10,10 +11,6 @@
|
|||
#include "gtk_control.h"
|
||||
#include "snes_ntsc.h"
|
||||
|
||||
#define DIR_ROM 0
|
||||
#define DIR_CONFIG 1
|
||||
#define DIR_CUSTOM 2
|
||||
|
||||
#define HWA_NONE 0
|
||||
#define HWA_OPENGL 1
|
||||
#define HWA_XV 2
|
||||
|
@ -90,9 +87,12 @@ class Snes9xConfig
|
|||
unsigned char allow_xrandr;
|
||||
|
||||
/* Data options */
|
||||
unsigned char data_location;
|
||||
unsigned char save_sram_after_secs;
|
||||
char custom_sram_directory [PATH_MAX];
|
||||
char sram_directory [PATH_MAX];
|
||||
char savestate_directory [PATH_MAX];
|
||||
char cheat_directory [PATH_MAX];
|
||||
char patch_directory [PATH_MAX];
|
||||
char export_directory [PATH_MAX];
|
||||
char last_directory [PATH_MAX];
|
||||
|
||||
/* Controls */
|
||||
|
@ -124,6 +124,9 @@ class Snes9xConfig
|
|||
int num_threads;
|
||||
unsigned char screensaver_needs_reset;
|
||||
|
||||
int pointer_is_visible;
|
||||
struct timeval pointer_timestamp;
|
||||
|
||||
#ifdef USE_XRANDR
|
||||
XRRScreenConfiguration *xrr_config;
|
||||
XRRScreenSize *xrr_sizes;
|
||||
|
@ -140,6 +143,10 @@ class Snes9xConfig
|
|||
unsigned char use_pbos;
|
||||
int pbo_format;
|
||||
unsigned char npot_textures;
|
||||
unsigned char use_shaders;
|
||||
char fragment_shader[PATH_MAX];
|
||||
char vertex_shader[PATH_MAX];
|
||||
unsigned char sync_every_frame;
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOYSTICK
|
||||
|
|
|
@ -129,6 +129,22 @@ S9xPollPointer (uint32 id, int16 *x, int16 *y)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
S9xIsMousePluggedIn (void)
|
||||
{
|
||||
enum controllers ctl;
|
||||
int8 id1, id2, id3, id4;
|
||||
|
||||
for (int i = 0; i <= 1; i++)
|
||||
{
|
||||
S9xGetController (i, &ctl, &id1, &id2, &id3, &id4);
|
||||
if (ctl == CTL_MOUSE)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
S9xGrabJoysticks (void)
|
||||
{
|
||||
|
|
|
@ -94,5 +94,6 @@ class JoyDevice
|
|||
|
||||
void S9xDeinitInputDevices (void);
|
||||
Binding S9xGetBindingByName (const char *name);
|
||||
bool S9xIsMousePluggedIn (void);
|
||||
|
||||
#endif /* __GTK_CONTROL_H*/
|
||||
|
|
|
@ -69,6 +69,72 @@ S9xGetAspect (void)
|
|||
return (8.0 / 7.0);
|
||||
}
|
||||
|
||||
void
|
||||
S9xApplyAspect (int &s_width, /* Output: x */
|
||||
int &s_height, /* Output: y */
|
||||
int &d_width, /* Output: width */
|
||||
int &d_height) /* Output: height */
|
||||
{
|
||||
double screen_aspect = (double) d_width / (double) d_height;
|
||||
double snes_aspect = S9xGetAspect ();
|
||||
double granularity = 1.0 / (double) MAX (d_width, d_height);
|
||||
int x, y, w, h;
|
||||
|
||||
if (!gui_config->scale_to_fit)
|
||||
{
|
||||
if (gui_config->maintain_aspect_ratio)
|
||||
{
|
||||
w = s_height * snes_aspect;
|
||||
h = s_height;
|
||||
x = (d_width - w) / 2;
|
||||
y = (d_height - s_height) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (d_width - s_width) / 2;
|
||||
y = (d_height - s_height) / 2;
|
||||
w = s_width;
|
||||
h = s_height;
|
||||
}
|
||||
}
|
||||
|
||||
else if (gui_config->maintain_aspect_ratio &&
|
||||
!(screen_aspect <= snes_aspect * (1.0 + granularity) &&
|
||||
screen_aspect >= snes_aspect * (1.0 - granularity)))
|
||||
{
|
||||
if (screen_aspect > snes_aspect)
|
||||
{
|
||||
x = (d_width - (int) (d_height * snes_aspect)) / 2;
|
||||
y = 0;
|
||||
w = (int) (d_height * snes_aspect);
|
||||
h = d_height;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = (d_height - (int) (d_width / snes_aspect)) / 2;
|
||||
w = d_width;
|
||||
h = (int) (d_width / snes_aspect);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = d_width;
|
||||
h = d_height;
|
||||
}
|
||||
|
||||
s_width = x;
|
||||
s_height = y;
|
||||
d_width = w;
|
||||
d_height = h;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xRegisterYUVTables (uint8 *y, uint8 *u, uint8 *v)
|
||||
{
|
||||
|
@ -571,11 +637,11 @@ internal_convert_scale (void *src_buffer,
|
|||
int height,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
int line_start,
|
||||
int line_end,
|
||||
int bpp)
|
||||
{
|
||||
register uint32 x_error = 0, x_fraction;
|
||||
uint32 y_error = 0, y_fraction;
|
||||
int yy = 0;
|
||||
register uint32 x_fraction, y_fraction;
|
||||
|
||||
x_fraction = (width * 0x10000) / dest_width;
|
||||
y_fraction = (height * 0x10000) / dest_height;
|
||||
|
@ -585,23 +651,14 @@ internal_convert_scale (void *src_buffer,
|
|||
if (bpp == 15)
|
||||
{
|
||||
/* Format in fourcc is xrrrrrgg gggbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -624,23 +681,14 @@ internal_convert_scale (void *src_buffer,
|
|||
else if (bpp == 16)
|
||||
{
|
||||
/* Format in fourcc is rrrrrggg gggbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -664,23 +712,15 @@ internal_convert_scale (void *src_buffer,
|
|||
else if (bpp == 24)
|
||||
{
|
||||
/* Format in fourcc is rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -703,23 +743,15 @@ internal_convert_scale (void *src_buffer,
|
|||
else if (bpp == 32)
|
||||
{
|
||||
/* Format in fourcc is xxxxxxxx rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -747,23 +779,15 @@ internal_convert_scale (void *src_buffer,
|
|||
{
|
||||
/* Format in fourcc is xrrrrrgg gggbbbbb */
|
||||
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -786,23 +810,15 @@ internal_convert_scale (void *src_buffer,
|
|||
else if (bpp == 16)
|
||||
{
|
||||
/* Format in fourcc is rrrrrggg gggbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -826,23 +842,15 @@ internal_convert_scale (void *src_buffer,
|
|||
else if (bpp == 24)
|
||||
{
|
||||
/* Format in fourcc is rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
x_error = 0;
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -865,22 +873,15 @@ internal_convert_scale (void *src_buffer,
|
|||
else if (bpp == 32)
|
||||
{
|
||||
/* Format in fourcc is xxxxxxxx rrrrrrrr gggggggg bbbbbbbb */
|
||||
for (register int y = 0; y < dest_height; y++)
|
||||
for (register int y = line_start; y < line_end; y++)
|
||||
{
|
||||
register uint8 *data =
|
||||
(uint8 *) dst_buffer + y * dst_pitch;
|
||||
|
||||
register uint16 *snes =
|
||||
(uint16 *) (((uint8 *) src_buffer) + yy * src_pitch);
|
||||
|
||||
y_error += y_fraction;
|
||||
|
||||
while (y_error >= 0x10000)
|
||||
{
|
||||
yy++;
|
||||
y_error -= 0x10000;
|
||||
}
|
||||
(uint16 *) (((uint8 *) src_buffer) + ((y_fraction * y) >> 16) * src_pitch);
|
||||
|
||||
register uint32 x_error = 0;
|
||||
for (register int x = 0; x < dest_width; x++)
|
||||
{
|
||||
uint32 pixel = *snes;
|
||||
|
@ -1031,6 +1032,7 @@ get_filter_scale (int &width, int &height)
|
|||
height *= 2;
|
||||
break;
|
||||
|
||||
#ifdef USE_HQ2X
|
||||
case FILTER_HQ4X:
|
||||
if (((width * 4) <= S9xDisplayDriver::scaled_max_width) &&
|
||||
((height * 4) <= S9xDisplayDriver::scaled_max_height))
|
||||
|
@ -1053,6 +1055,7 @@ get_filter_scale (int &width, int &height)
|
|||
width *= 2;
|
||||
height *= 2;
|
||||
break;
|
||||
#endif /* USE_HQ2X */
|
||||
|
||||
case FILTER_EPX:
|
||||
width *= 2;
|
||||
|
@ -1120,7 +1123,7 @@ internal_filter (uint8 *src_buffer,
|
|||
|
||||
break;
|
||||
|
||||
|
||||
#ifdef USE_HQ2X
|
||||
case FILTER_HQ4X:
|
||||
|
||||
if (((width * 4) <= S9xDisplayDriver::scaled_max_width) &&
|
||||
|
@ -1163,6 +1166,7 @@ internal_filter (uint8 *src_buffer,
|
|||
height);
|
||||
|
||||
break;
|
||||
#endif /* USE_HQ2X */
|
||||
|
||||
case FILTER_EPX:
|
||||
|
||||
|
@ -1280,6 +1284,8 @@ thread_worker (gpointer data,
|
|||
job->height,
|
||||
job->dst_width,
|
||||
job->dst_height,
|
||||
job->line_start,
|
||||
job->line_end,
|
||||
job->bpp);
|
||||
break;
|
||||
}
|
||||
|
@ -1323,37 +1329,33 @@ internal_threaded_convert_scale (void *src_buffer,
|
|||
for (i = 0; i < gui_config->num_threads - 1; i++)
|
||||
{
|
||||
job[i].operation_type = JOB_SCALE_AND_CONVERT;
|
||||
job[i].src_buffer =
|
||||
((uint8 *) src_buffer) + (src_pitch * i * (height / gui_config->num_threads));
|
||||
job[i].src_buffer = (uint8 *) src_buffer;
|
||||
job[i].src_pitch = src_pitch;
|
||||
job[i].dst_buffer =
|
||||
((uint8 *) dst_buffer) + (dst_pitch * i * (dst_height / gui_config->num_threads));
|
||||
job[i].dst_buffer = (uint8 *) dst_buffer;
|
||||
job[i].dst_pitch = dst_pitch;
|
||||
job[i].width = width;
|
||||
job[i].height = height / gui_config->num_threads;
|
||||
job[i].height = height;
|
||||
job[i].dst_width = dst_width;
|
||||
job[i].dst_height = dst_height / gui_config->num_threads;
|
||||
job[i].dst_height = dst_height;
|
||||
job[i].line_start = i * (dst_height / gui_config->num_threads);
|
||||
job[i].line_end = (i + 1) * (dst_height / gui_config->num_threads);
|
||||
job[i].bpp = bpp;
|
||||
job[i].complete = 0;
|
||||
|
||||
g_thread_pool_push (pool, (gpointer) &(job[i]), NULL);
|
||||
}
|
||||
|
||||
i = gui_config->num_threads - 1;
|
||||
|
||||
job[i].operation_type = JOB_SCALE_AND_CONVERT;
|
||||
job[i].src_buffer =
|
||||
((uint8 *) src_buffer) + (src_pitch * i * (height / gui_config->num_threads));
|
||||
job[i].src_buffer = (uint8 *) src_buffer;
|
||||
job[i].src_pitch = src_pitch;
|
||||
job[i].dst_buffer =
|
||||
((uint8 *) dst_buffer) + (dst_pitch * i * (dst_height / gui_config->num_threads));
|
||||
job[i].dst_buffer = (uint8 *) dst_buffer;
|
||||
job[i].dst_pitch = dst_pitch;
|
||||
job[i].width = width;
|
||||
job[i].height =
|
||||
height - ((gui_config->num_threads - 1) * (height / gui_config->num_threads));
|
||||
job[i].height = height;
|
||||
job[i].dst_width = dst_width;
|
||||
job[i].dst_height =
|
||||
dst_height - ((gui_config->num_threads - 1) * (dst_height / gui_config->num_threads));
|
||||
job[i].dst_height = dst_height;
|
||||
job[i].line_start = i * (height / gui_config->num_threads);
|
||||
job[i].line_end = dst_height;
|
||||
job[i].bpp = bpp;
|
||||
|
||||
thread_worker ((gpointer) &(job[i]), NULL);
|
||||
|
@ -1403,8 +1405,6 @@ internal_threaded_convert (void *src_buffer,
|
|||
g_thread_pool_push (pool, (gpointer) &(job[i]), NULL);
|
||||
}
|
||||
|
||||
i = gui_config->num_threads - 1;
|
||||
|
||||
job[i].operation_type = (bpp == -1 ? JOB_CONVERT_YUV : JOB_CONVERT);
|
||||
job[i].src_buffer =
|
||||
((uint8 *) src_buffer) + (src_pitch * i * (height / gui_config->num_threads));
|
||||
|
@ -1469,8 +1469,6 @@ internal_threaded_convert_mask (void *src_buffer,
|
|||
g_thread_pool_push (pool, (gpointer) &(job[i]), NULL);
|
||||
}
|
||||
|
||||
i = gui_config->num_threads - 1;
|
||||
|
||||
job[i].operation_type = (bpp == -1 ? JOB_CONVERT_YUV : JOB_CONVERT);
|
||||
job[i].src_buffer =
|
||||
((uint8 *) src_buffer) + (src_pitch * i * (height / gui_config->num_threads));
|
||||
|
@ -1512,8 +1510,11 @@ internal_threaded_filter (uint8 *src_buffer,
|
|||
{
|
||||
int i, flag;
|
||||
int dwidth = width, dheight = height;
|
||||
int src_coverage = 0, dst_coverage = 0;
|
||||
int height_scale;
|
||||
|
||||
get_filter_scale (dwidth, dheight);
|
||||
height_scale = dheight / height;
|
||||
|
||||
/* If the threadpool doesn't exist, create it */
|
||||
create_thread_pool ();
|
||||
|
@ -1521,34 +1522,29 @@ internal_threaded_filter (uint8 *src_buffer,
|
|||
for (i = 0; i < gui_config->num_threads - 1; i++)
|
||||
{
|
||||
job[i].operation_type = JOB_FILTER;
|
||||
job[i].src_buffer =
|
||||
src_buffer + (src_pitch * i * (height / gui_config->num_threads));
|
||||
job[i].src_pitch = src_pitch;
|
||||
job[i].dst_buffer =
|
||||
dst_buffer + (dst_pitch * i * (dheight / gui_config->num_threads));
|
||||
job[i].dst_pitch = dst_pitch;
|
||||
job[i].width = width;
|
||||
job[i].height = height / gui_config->num_threads;
|
||||
job[i].complete = 0;
|
||||
job[i].dst_width = width;
|
||||
job[i].dst_height = height;
|
||||
job[i].width = width;
|
||||
job[i].src_pitch = src_pitch;
|
||||
job[i].dst_pitch = dst_pitch;
|
||||
job[i].src_buffer = src_buffer + (src_pitch * src_coverage);
|
||||
job[i].dst_buffer = dst_buffer + (dst_pitch * dst_coverage);
|
||||
|
||||
job[i].height = (height / gui_config->num_threads) & ~3; /* Cut to multiple of 4 */
|
||||
src_coverage += job[i].height;
|
||||
dst_coverage += job[i].height * height_scale;
|
||||
|
||||
|
||||
g_thread_pool_push (pool, (gpointer) &(job[i]), NULL);
|
||||
}
|
||||
|
||||
i = gui_config->num_threads - 1;
|
||||
|
||||
job[i].operation_type = JOB_FILTER;
|
||||
job[i].src_buffer =
|
||||
src_buffer + (src_pitch * i * (height / gui_config->num_threads));
|
||||
job[i].src_pitch = src_pitch;
|
||||
job[i].dst_buffer =
|
||||
dst_buffer + (dst_pitch * i * (dheight / gui_config->num_threads));
|
||||
job[i].dst_pitch = dst_pitch;
|
||||
job[i].width = width;
|
||||
job[i].height = height - ((gui_config->num_threads - 1) * (height / gui_config->num_threads));
|
||||
job[i].dst_width = width;
|
||||
job[i].dst_height = height;
|
||||
job[i].src_pitch = src_pitch;
|
||||
job[i].dst_pitch = dst_pitch;
|
||||
job[i].src_buffer = src_buffer + (src_pitch * src_coverage);
|
||||
job[i].dst_buffer = dst_buffer + (dst_pitch * dst_coverage);
|
||||
|
||||
job[i].height = height - src_coverage;
|
||||
|
||||
thread_worker ((gpointer) &(job[i]), NULL);
|
||||
|
||||
|
@ -1717,6 +1713,8 @@ S9xConvertScale (void *src,
|
|||
height,
|
||||
dest_width,
|
||||
dest_height,
|
||||
0,
|
||||
dest_height,
|
||||
bpp);
|
||||
return;
|
||||
}
|
||||
|
@ -1770,10 +1768,11 @@ S9xQueryDrivers (void)
|
|||
|
||||
#ifdef USE_XRANDR
|
||||
int error_base_p, event_base_p;
|
||||
Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
|
||||
gui_config->allow_xrandr = 1;
|
||||
|
||||
if (!XRRQueryExtension (GDK_DISPLAY (), &event_base_p, &error_base_p))
|
||||
if (!XRRQueryExtension (display, &event_base_p, &error_base_p))
|
||||
{
|
||||
gui_config->allow_xrandr = 0;
|
||||
gui_config->change_display_resolution = FALSE;
|
||||
|
@ -1781,8 +1780,8 @@ S9xQueryDrivers (void)
|
|||
|
||||
if (gui_config->allow_xrandr)
|
||||
{
|
||||
gui_config->xrr_config = XRRGetScreenInfo (GDK_DISPLAY (),
|
||||
DefaultRootWindow (GDK_DISPLAY ()));
|
||||
gui_config->xrr_config = XRRGetScreenInfo (display,
|
||||
DefaultRootWindow (display));
|
||||
gui_config->xrr_original_size =
|
||||
XRRConfigCurrentConfiguration (gui_config->xrr_config,
|
||||
&(gui_config->xrr_rotation));
|
||||
|
@ -1890,8 +1889,10 @@ S9xInitDisplay (int argc, char **argv)
|
|||
Settings.SupportHiRes = TRUE;
|
||||
S9xSetRenderPixelFormat (RGB555);
|
||||
S9xBlit2xSaIFilterInit ();
|
||||
#ifdef USE_HQ2X
|
||||
S9xBlitHQ2xFilterInit ();
|
||||
|
||||
#endif /* USE_HQ2SX */
|
||||
|
||||
S9xQueryDrivers ();
|
||||
S9xInitDriver ();
|
||||
S9xGraphicsInit ();
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include "gtk_s9x.h"
|
||||
#include "filter/2xsai.h"
|
||||
#ifdef USE_HQ2X
|
||||
#include "filter/hq2x.h"
|
||||
#endif
|
||||
#include "filter/epx.h"
|
||||
#include "filter_epx_unsafe.h"
|
||||
|
||||
|
@ -11,13 +13,13 @@
|
|||
#define FILTER_SUPEREAGLE 1
|
||||
#define FILTER_2XSAI 2
|
||||
#define FILTER_SUPER2XSAI 3
|
||||
#define FILTER_HQ2X 4
|
||||
#define FILTER_HQ3X 5
|
||||
#define FILTER_HQ4X 6
|
||||
#define FILTER_EPX 7
|
||||
#define FILTER_EPX_SMOOTH 8
|
||||
#define FILTER_NTSC 9
|
||||
#define FILTER_SCANLINES 10
|
||||
#define FILTER_EPX 4
|
||||
#define FILTER_EPX_SMOOTH 5
|
||||
#define FILTER_NTSC 6
|
||||
#define FILTER_SCANLINES 7
|
||||
#define FILTER_HQ2X 8
|
||||
#define FILTER_HQ3X 9
|
||||
#define FILTER_HQ4X 10
|
||||
#define NUM_FILTERS 11
|
||||
|
||||
#define NTSC_COMPOSITE 0
|
||||
|
@ -48,6 +50,8 @@ typedef struct thread_job_t
|
|||
int inv_rmask;
|
||||
int inv_gmask;
|
||||
int inv_bmask;
|
||||
int line_start;
|
||||
int line_end;
|
||||
|
||||
volatile int complete;
|
||||
}
|
||||
|
@ -56,6 +60,7 @@ thread_job_t;
|
|||
void S9xRegisterYUVTables (uint8 *y, uint8 *u, uint8 *v);
|
||||
void S9xSetEndianess (int type);
|
||||
double S9xGetAspect (void);
|
||||
void S9xApplyAspect (int&, int&, int&, int&);
|
||||
|
||||
void S9xConvertYUV (void *src_buffer,
|
||||
void *dst_buffer,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <cairo.h>
|
||||
#include "gtk_display.h"
|
||||
#include "gtk_display_driver_gtk.h"
|
||||
|
||||
|
@ -9,6 +11,7 @@ S9xGTKDisplayDriver::S9xGTKDisplayDriver (Snes9xWindow *window,
|
|||
this->window = window;
|
||||
this->config = config;
|
||||
this->drawing_area = GTK_WIDGET (window->drawing_area);
|
||||
this->pixbuf = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -16,11 +19,14 @@ S9xGTKDisplayDriver::S9xGTKDisplayDriver (Snes9xWindow *window,
|
|||
void
|
||||
S9xGTKDisplayDriver::update (int width, int height)
|
||||
{
|
||||
int c_width, c_height, final_pitch;
|
||||
uint8 *final_buffer;
|
||||
int x, y, w, h;
|
||||
int c_width, c_height, final_pitch;
|
||||
uint8 *final_buffer;
|
||||
GtkAllocation allocation;
|
||||
|
||||
c_width = drawing_area->allocation.width;
|
||||
c_height = drawing_area->allocation.height;
|
||||
gtk_widget_get_allocation (drawing_area, &allocation);
|
||||
c_width = allocation.width;
|
||||
c_height = allocation.height;
|
||||
|
||||
if (width == SIZE_FLAG_DIRTY)
|
||||
{
|
||||
|
@ -54,70 +60,9 @@ S9xGTKDisplayDriver::update (int width, int height)
|
|||
final_pitch = image_width * image_bpp;
|
||||
}
|
||||
|
||||
if (!config->scale_to_fit &&
|
||||
(width > gdk_buffer_width || height > gdk_buffer_height))
|
||||
{
|
||||
this->clear ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (config->scale_to_fit)
|
||||
{
|
||||
double screen_aspect = (double) c_width / (double) c_height;
|
||||
double snes_aspect = S9xGetAspect ();
|
||||
double granularity = 1.0 / (double) MAX (c_width, c_height);
|
||||
|
||||
if (config->maintain_aspect_ratio &&
|
||||
!(screen_aspect <= snes_aspect * (1.0 + granularity) &&
|
||||
screen_aspect >= snes_aspect * (1.0 - granularity)))
|
||||
{
|
||||
if (screen_aspect > snes_aspect)
|
||||
{
|
||||
output (final_buffer,
|
||||
final_pitch,
|
||||
(c_width - (int) (c_height * snes_aspect)) / 2,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
(int) (c_height * snes_aspect),
|
||||
c_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
output (final_buffer,
|
||||
final_pitch,
|
||||
0,
|
||||
(c_height - c_width / snes_aspect) / 2,
|
||||
width,
|
||||
height,
|
||||
c_width,
|
||||
(c_width / snes_aspect));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output (final_buffer,
|
||||
final_pitch,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
c_width,
|
||||
c_height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output (final_buffer,
|
||||
final_pitch,
|
||||
(c_width - width) / 2,
|
||||
(c_height - height) / 2,
|
||||
width,
|
||||
height,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
x = width; y = height; w = c_width; h = c_height;
|
||||
S9xApplyAspect (x, y, w, h);
|
||||
output (final_buffer, final_pitch, x, y, width, height, w, h);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -132,37 +77,55 @@ S9xGTKDisplayDriver::output (void *src,
|
|||
int dst_width,
|
||||
int dst_height)
|
||||
{
|
||||
GdkGC *gc = drawing_area->style->bg_gc[GTK_WIDGET_STATE (drawing_area)];
|
||||
if (dst_width > gdk_buffer_width || dst_height > gdk_buffer_height)
|
||||
{
|
||||
gdk_buffer_width = dst_width;
|
||||
gdk_buffer_height = dst_height;
|
||||
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
|
||||
padded_buffer[2] = realloc (padded_buffer[2],
|
||||
gdk_buffer_width * gdk_buffer_height * 3);
|
||||
pixbuf = gdk_pixbuf_new_from_data ((guchar *) padded_buffer[2],
|
||||
GDK_COLORSPACE_RGB,
|
||||
FALSE,
|
||||
8,
|
||||
gdk_buffer_width,
|
||||
gdk_buffer_height,
|
||||
gdk_buffer_width * 3,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (width != dst_width || height != dst_height)
|
||||
{
|
||||
S9xConvertScale (src,
|
||||
padded_buffer[2],
|
||||
src_pitch,
|
||||
gdk_buffer_width * 3,
|
||||
width,
|
||||
height,
|
||||
dst_width, dst_height,
|
||||
24);
|
||||
padded_buffer[2],
|
||||
src_pitch,
|
||||
gdk_buffer_width * 3,
|
||||
width,
|
||||
height,
|
||||
dst_width, dst_height,
|
||||
24);
|
||||
}
|
||||
else
|
||||
{
|
||||
S9xConvert (src,
|
||||
padded_buffer[2],
|
||||
src_pitch,
|
||||
gdk_buffer_width * 3,
|
||||
width,
|
||||
height,
|
||||
24);
|
||||
padded_buffer[2],
|
||||
src_pitch,
|
||||
gdk_buffer_width * 3,
|
||||
width,
|
||||
height,
|
||||
24);
|
||||
}
|
||||
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
gc,
|
||||
x, y,
|
||||
dst_width, dst_height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
(guchar *) padded_buffer[2],
|
||||
gdk_buffer_width * 3);
|
||||
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (drawing_area));
|
||||
|
||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
|
||||
|
||||
cairo_rectangle (cr, x, y, dst_width, dst_height);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
window->set_mouseable_area (x, y, width, height);
|
||||
|
||||
|
@ -173,6 +136,7 @@ int
|
|||
S9xGTKDisplayDriver::init (void)
|
||||
{
|
||||
int padding;
|
||||
GtkAllocation allocation;
|
||||
|
||||
buffer[0] = malloc (image_padded_size);
|
||||
buffer[1] = malloc (scaled_padded_size);
|
||||
|
@ -183,10 +147,21 @@ S9xGTKDisplayDriver::init (void)
|
|||
padding = (scaled_padded_size - scaled_size) / 2;
|
||||
padded_buffer[1] = (void *) (((uint8 *) buffer[1]) + padding);
|
||||
|
||||
gdk_buffer_width = drawing_area->allocation.width;
|
||||
gdk_buffer_height = drawing_area->allocation.height;
|
||||
gtk_widget_get_allocation (drawing_area, &allocation);
|
||||
gdk_buffer_width = allocation.width;
|
||||
gdk_buffer_height = allocation.height;
|
||||
|
||||
padded_buffer[2] = malloc (gdk_buffer_width * gdk_buffer_height * 3);
|
||||
pixbuf = gdk_pixbuf_new_from_data ((guchar *) padded_buffer[2],
|
||||
GDK_COLORSPACE_RGB,
|
||||
FALSE,
|
||||
8,
|
||||
gdk_buffer_width,
|
||||
gdk_buffer_height,
|
||||
gdk_buffer_width * 3,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
|
||||
memset (buffer[0], 0, image_padded_size);
|
||||
|
@ -206,6 +181,8 @@ S9xGTKDisplayDriver::deinit (void)
|
|||
|
||||
free (buffer[0]);
|
||||
free (buffer[1]);
|
||||
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
free (padded_buffer[2]);
|
||||
|
||||
return;
|
||||
|
@ -214,112 +191,52 @@ S9xGTKDisplayDriver::deinit (void)
|
|||
void
|
||||
S9xGTKDisplayDriver::clear (void)
|
||||
{
|
||||
int w, h;
|
||||
int c_width = drawing_area->allocation.width;
|
||||
int c_height = drawing_area->allocation.height;
|
||||
GdkColor black = { 0, 0, 0, 0 };
|
||||
GdkGC *gc = NULL;
|
||||
int x, y, w, h;
|
||||
int width, height;
|
||||
GtkAllocation allocation;
|
||||
|
||||
gc = drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)];
|
||||
gdk_gc_set_rgb_fg_color (gc, &black);
|
||||
gtk_widget_get_allocation (drawing_area, &allocation);
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
|
||||
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (drawing_area));
|
||||
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
|
||||
|
||||
if (window->last_width <= 0 || window->last_height <= 0)
|
||||
{
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
c_width, c_height);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get width of modified display */
|
||||
w = window->last_width;
|
||||
h = window->last_height;
|
||||
get_filter_scale (w, h);
|
||||
x = window->last_width;
|
||||
y = window->last_height;
|
||||
get_filter_scale (x, y);
|
||||
w = width;
|
||||
h = height;
|
||||
S9xApplyAspect (x, y, w, h);
|
||||
|
||||
if (config->scale_to_fit)
|
||||
if (x > 0)
|
||||
{
|
||||
double screen_aspect = (double) c_width / (double) c_height;
|
||||
double snes_aspect = S9xGetAspect ();
|
||||
double granularity = 1.0 / (double) MAX (c_width, c_height);
|
||||
|
||||
if (config->maintain_aspect_ratio &&
|
||||
!(screen_aspect <= snes_aspect * (1.0 + granularity) &&
|
||||
screen_aspect >= snes_aspect * (1.0 - granularity)))
|
||||
{
|
||||
int bar_size;
|
||||
if (screen_aspect > snes_aspect)
|
||||
{
|
||||
/* Black bars on left and right */
|
||||
w = (int) (c_height * snes_aspect);
|
||||
bar_size = (c_width - w) / 2;
|
||||
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
bar_size, c_height);
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
bar_size + w, 0,
|
||||
c_width - bar_size - w,
|
||||
c_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Black bars on top and bottom */
|
||||
h = (int) (c_width / snes_aspect);
|
||||
bar_size = (c_height - h) / 2;
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
c_width, bar_size);
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0, bar_size + h,
|
||||
c_width,
|
||||
c_height - bar_size - h);
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
cairo_rectangle (cr, 0, y, x, h);
|
||||
}
|
||||
else
|
||||
if (x + w < width)
|
||||
{
|
||||
/* Black bars on top, bottom, left, and right :-) */
|
||||
int bar_width, bar_height;
|
||||
|
||||
bar_height = (c_height - h) / 2;
|
||||
bar_width = (c_width - w) / 2;
|
||||
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
c_width, bar_height);
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0,
|
||||
bar_height + h,
|
||||
c_width,
|
||||
c_height - (bar_height + h));
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
0, bar_height,
|
||||
bar_width, h);
|
||||
gdk_draw_rectangle (drawing_area->window,
|
||||
gc,
|
||||
TRUE,
|
||||
bar_width + w, bar_height,
|
||||
c_width - (bar_width + w),
|
||||
h);
|
||||
cairo_rectangle (cr, x + w, y, width - (x + w), h);
|
||||
}
|
||||
if (y > 0)
|
||||
{
|
||||
cairo_rectangle (cr, 0, 0, width, y);
|
||||
}
|
||||
if (y + h < height)
|
||||
{
|
||||
cairo_rectangle (cr, 0, y + h, width, height - (y + h));
|
||||
}
|
||||
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -327,21 +244,6 @@ S9xGTKDisplayDriver::clear (void)
|
|||
void
|
||||
S9xGTKDisplayDriver::refresh (int width, int height)
|
||||
{
|
||||
int c_width, c_height;
|
||||
|
||||
c_width = drawing_area->allocation.width;
|
||||
c_height = drawing_area->allocation.height;
|
||||
|
||||
if (c_width != gdk_buffer_width || c_height != gdk_buffer_height)
|
||||
{
|
||||
free (padded_buffer[2]);
|
||||
|
||||
gdk_buffer_width = c_width;
|
||||
gdk_buffer_height = c_height;
|
||||
|
||||
padded_buffer[2] = malloc (gdk_buffer_width * gdk_buffer_height * 3);
|
||||
}
|
||||
|
||||
if (!config->rom_loaded)
|
||||
return;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ class S9xGTKDisplayDriver : public S9xDisplayDriver
|
|||
int dst_width,
|
||||
int dst_height);
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
int gdk_buffer_width;
|
||||
int gdk_buffer_height;
|
||||
};
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "gtk_display.h"
|
||||
|
@ -38,6 +40,44 @@ static const char *glUnmapBufferNames[] = { "glUnmapBuffer",
|
|||
"glUnmapBufferEXT",
|
||||
NULL };
|
||||
|
||||
static char *
|
||||
get_file_contents (const char *filename)
|
||||
{
|
||||
struct stat fs;
|
||||
int fd;
|
||||
|
||||
if (!filename || !strlen (filename) || stat (filename, &fs))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fd = open (filename, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return NULL;
|
||||
|
||||
char *contents = new char[fs.st_size + 1];
|
||||
|
||||
int bytes_read = 0;
|
||||
while (bytes_read < fs.st_size)
|
||||
{
|
||||
int retval;
|
||||
retval = read (fd, contents + bytes_read, fs.st_size - bytes_read);
|
||||
if (retval == -1)
|
||||
{
|
||||
delete[] contents;
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
bytes_read += retval;
|
||||
}
|
||||
|
||||
contents[fs.st_size] = '\0';
|
||||
|
||||
close (fd);
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
gl_proc
|
||||
get_null_address_proc (const GLubyte *name)
|
||||
{
|
||||
|
@ -110,16 +150,23 @@ S9xOpenGLDisplayDriver::update (int width, int height)
|
|||
GLint filter;
|
||||
uint8 *final_buffer = NULL;
|
||||
int final_pitch;
|
||||
int c_width, c_height;
|
||||
void *pboMemory = NULL;
|
||||
|
||||
c_width = drawing_area->allocation.width;
|
||||
c_height = drawing_area->allocation.height;
|
||||
int x, y, w, h;
|
||||
|
||||
if (width <= 0)
|
||||
{
|
||||
gdk_window_hide (gdk_window);
|
||||
return;
|
||||
}
|
||||
|
||||
gl_lock ();
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation (drawing_area, &allocation);
|
||||
|
||||
if (output_window_width != allocation.width ||
|
||||
output_window_height != allocation.height)
|
||||
{
|
||||
resize_window (allocation.width, allocation.height);
|
||||
}
|
||||
|
||||
/* This avoids messing with the texture parameters every time */
|
||||
if (config->bilinear_filter != filtering)
|
||||
|
@ -160,173 +207,37 @@ S9xOpenGLDisplayDriver::update (int width, int height)
|
|||
final_pitch = image_width * image_bpp;
|
||||
}
|
||||
|
||||
double screen_aspect = (double) c_width / (double) c_height;
|
||||
double snes_aspect = S9xGetAspect ();
|
||||
double granularity = 1.0 / (double) MAX (c_width, c_height);
|
||||
x = width; y = height;
|
||||
w = allocation.width; h = allocation.height;
|
||||
S9xApplyAspect (x, y, w, h);
|
||||
|
||||
if (!config->scale_to_fit)
|
||||
glViewport (x, y, w, h);
|
||||
window->set_mouseable_area (x, y, w, h);
|
||||
|
||||
update_texture_size (width, height);
|
||||
|
||||
if (using_pbos)
|
||||
{
|
||||
glViewport ((c_width - width) / 2, (c_height - height) / 2,
|
||||
width, height);
|
||||
|
||||
window->set_mouseable_area ((c_width - width) / 2,
|
||||
(c_height - height) / 2,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
|
||||
else if (config->maintain_aspect_ratio &&
|
||||
!(screen_aspect <= snes_aspect * (1.0 + granularity) &&
|
||||
screen_aspect >= snes_aspect * (1.0 - granularity)))
|
||||
{
|
||||
if (screen_aspect > snes_aspect)
|
||||
if (config->pbo_format == PBO_FMT_16)
|
||||
{
|
||||
glViewport ((c_width - (int)(c_height * snes_aspect)) / 2, 0,
|
||||
(int)(c_height * snes_aspect), c_height);
|
||||
|
||||
window->set_mouseable_area ((c_width -
|
||||
(int) (c_height * snes_aspect)) / 2,
|
||||
0,
|
||||
(int) (c_height * snes_aspect),
|
||||
c_height);
|
||||
}
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width * height * 2,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
else
|
||||
{
|
||||
glViewport (0, (c_height - (int) (c_width / snes_aspect)) / 2,
|
||||
c_width, (int) (c_width / snes_aspect));
|
||||
window->set_mouseable_area (0,
|
||||
(c_height -
|
||||
(int) (c_width / snes_aspect)) / 2,
|
||||
c_width,
|
||||
(int) (c_width / snes_aspect));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
glViewport (0, 0, c_width, c_height);
|
||||
window->set_mouseable_area (0, 0, c_width, c_height);
|
||||
}
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
update_texture_size (width, height);
|
||||
|
||||
if (using_pbos)
|
||||
{
|
||||
if (config->pbo_format == PBO_FMT_16)
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width * height * 2,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
memcpy ((uint8 *) pboMemory + (width * y * 2),
|
||||
final_buffer + (y * final_pitch),
|
||||
width * image_bpp);
|
||||
}
|
||||
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
memcpy ((uint8 *) pboMemory + (width * y * 2),
|
||||
final_buffer + (y * final_pitch),
|
||||
width * image_bpp);
|
||||
}
|
||||
else if (config->pbo_format == PBO_FMT_24)
|
||||
{
|
||||
/* Complement width to next multiple of 4 to force line size to
|
||||
* be a multiple of 4 bytes. Otherwise, packing fails. */
|
||||
int width_mul_4 = width + ((4 - (width % 4)) % 4);
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width_mul_4 * height * 3,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
/* Pixel swizzling in software */
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xConvert (final_buffer,
|
||||
pboMemory,
|
||||
final_pitch,
|
||||
width_mul_4 * 3,
|
||||
width,
|
||||
height,
|
||||
24);
|
||||
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width_mul_4);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
else /* PBO_FMT_32 */
|
||||
{
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width * height * 4,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
/* Pixel swizzling in software */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
#else
|
||||
S9xSetEndianess (ENDIAN_LSB);
|
||||
#endif
|
||||
S9xConvert (final_buffer,
|
||||
pboMemory,
|
||||
final_pitch,
|
||||
width * 4,
|
||||
width,
|
||||
height,
|
||||
32);
|
||||
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
PBO_BGRA_NATIVE_ORDER,
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, final_pitch / image_bpp);
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
|
@ -335,28 +246,135 @@ S9xOpenGLDisplayDriver::update (int width, int height)
|
|||
height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
final_buffer);
|
||||
}
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
if (tex_target == GL_TEXTURE_2D)
|
||||
{
|
||||
texcoords[1] = (float) (height) / texture_height;
|
||||
texcoords[2] = (float) (width) / texture_width;
|
||||
texcoords[3] = texcoords[1];
|
||||
texcoords[4] = texcoords[2];
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
else if (tex_target == GL_TEXTURE_RECTANGLE)
|
||||
else if (config->pbo_format == PBO_FMT_24)
|
||||
{
|
||||
texcoords[1] = (float) (height);
|
||||
texcoords[2] = (float) (width);
|
||||
texcoords[3] = texcoords[1];
|
||||
texcoords[4] = texcoords[2];
|
||||
}
|
||||
/* Complement width to next multiple of 4 to force line size to
|
||||
* be a multiple of 4 bytes. Otherwise, packing fails. */
|
||||
int width_mul_4 = width + ((4 - (width % 4)) % 4);
|
||||
|
||||
glDrawArrays (GL_QUADS, 0, 4);
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width_mul_4 * height * 3,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
/* Pixel swizzling in software */
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
S9xConvert (final_buffer,
|
||||
pboMemory,
|
||||
final_pitch,
|
||||
width_mul_4 * 3,
|
||||
width,
|
||||
height,
|
||||
24);
|
||||
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width_mul_4);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
else /* PBO_FMT_32 */
|
||||
{
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
glBufferData (GL_PIXEL_UNPACK_BUFFER,
|
||||
width * height * 4,
|
||||
NULL,
|
||||
GL_STREAM_DRAW);
|
||||
pboMemory = glMapBuffer (GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
/* Pixel swizzling in software */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
S9xSetEndianess (ENDIAN_MSB);
|
||||
#else
|
||||
S9xSetEndianess (ENDIAN_LSB);
|
||||
#endif
|
||||
S9xConvert (final_buffer,
|
||||
pboMemory,
|
||||
final_pitch,
|
||||
width * 4,
|
||||
width,
|
||||
height,
|
||||
32);
|
||||
|
||||
glUnmapBuffer (GL_PIXEL_UNPACK_BUFFER);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
PBO_BGRA_NATIVE_ORDER,
|
||||
BUFFER_OFFSET (0));
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, final_pitch / image_bpp);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
final_buffer);
|
||||
}
|
||||
|
||||
gl_unlock ();
|
||||
if (tex_target == GL_TEXTURE_2D)
|
||||
{
|
||||
texcoords[1] = (float) (height) / texture_height;
|
||||
texcoords[2] = (float) (width) / texture_width;
|
||||
texcoords[3] = texcoords[1];
|
||||
texcoords[4] = texcoords[2];
|
||||
}
|
||||
else if (tex_target == GL_TEXTURE_RECTANGLE)
|
||||
{
|
||||
texcoords[1] = (float) (height);
|
||||
texcoords[2] = (float) (width);
|
||||
texcoords[3] = texcoords[1];
|
||||
texcoords[4] = texcoords[2];
|
||||
}
|
||||
|
||||
if (using_shaders)
|
||||
{
|
||||
GLint location;
|
||||
|
||||
float inputSize[2] = { width, height };
|
||||
location = glGetUniformLocation (program, "rubyInputSize");
|
||||
glUniform2fv (location, 1, inputSize);
|
||||
|
||||
float outputSize[2] = {w , h };
|
||||
location = glGetUniformLocation (program, "rubyOutputSize");
|
||||
glUniform2fv (location, 1, outputSize);
|
||||
|
||||
float textureSize[2] = { texture_width, texture_height };
|
||||
location = glGetUniformLocation (program, "rubyTextureSize");
|
||||
glUniform2fv (location, 1, textureSize);
|
||||
}
|
||||
|
||||
glDrawArrays (GL_QUADS, 0, 4);
|
||||
|
||||
gl_swap ();
|
||||
|
||||
return;
|
||||
|
@ -368,8 +386,6 @@ S9xOpenGLDisplayDriver::clear_buffers (void)
|
|||
memset (buffer[0], 0, image_padded_size);
|
||||
memset (buffer[1], 0, scaled_padded_size);
|
||||
|
||||
gl_lock ();
|
||||
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, scaled_max_width);
|
||||
glTexSubImage2D (tex_target,
|
||||
0,
|
||||
|
@ -380,7 +396,6 @@ S9xOpenGLDisplayDriver::clear_buffers (void)
|
|||
GL_BGRA,
|
||||
GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
buffer[1]);
|
||||
gl_unlock ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -402,8 +417,8 @@ S9xOpenGLDisplayDriver::update_texture_size (int width, int height)
|
|||
width,
|
||||
height,
|
||||
0,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
PBO_GET_FORMAT (config->pbo_format),
|
||||
PBO_GET_PACKING (config->pbo_format),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
|
@ -432,6 +447,9 @@ S9xOpenGLDisplayDriver::load_pixel_buffer_functions (void)
|
|||
{
|
||||
const char *extensions = (const char *) glGetString (GL_EXTENSIONS);
|
||||
|
||||
if (!extensions)
|
||||
return 0;
|
||||
|
||||
if (strstr (extensions, "pixel_buffer_object"))
|
||||
{
|
||||
glGenBuffers =
|
||||
|
@ -462,45 +480,110 @@ S9xOpenGLDisplayDriver::load_pixel_buffer_functions (void)
|
|||
(glUnmapBufferProc)
|
||||
get_aliased_extension (glUnmapBufferNames);
|
||||
|
||||
if (!glGenBuffers ||
|
||||
!glBindBuffer ||
|
||||
!glBufferData ||
|
||||
!glBufferSubData ||
|
||||
!glMapBuffer ||
|
||||
!glUnmapBuffer ||
|
||||
!glDeleteBuffers)
|
||||
if (glGenBuffers &&
|
||||
glBindBuffer &&
|
||||
glBufferData &&
|
||||
glBufferSubData &&
|
||||
glMapBuffer &&
|
||||
glUnmapBuffer &&
|
||||
glDeleteBuffers)
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
S9xOpenGLDisplayDriver::load_shader_functions (void)
|
||||
{
|
||||
const char *extensions = (const char *) glGetString (GL_EXTENSIONS);
|
||||
|
||||
if (!extensions)
|
||||
return 0;
|
||||
|
||||
if (strstr (extensions, "fragment_program"))
|
||||
{
|
||||
glCreateProgram = (glCreateProgramProc) glGetProcAddress ((GLubyte *) "glCreateProgram");
|
||||
glCreateShader = (glCreateShaderProc) glGetProcAddress ((GLubyte *) "glCreateShader");
|
||||
glCompileShader = (glCompileShaderProc) glGetProcAddress ((GLubyte *) "glCompileShader");
|
||||
glDeleteShader = (glDeleteShaderProc) glGetProcAddress ((GLubyte *) "glDeleteShader");
|
||||
glDeleteProgram = (glDeleteProgramProc) glGetProcAddress ((GLubyte *) "glDeleteProgram");
|
||||
glAttachShader = (glAttachShaderProc) glGetProcAddress ((GLubyte *) "glAttachShader");
|
||||
glDetachShader = (glDetachShaderProc) glGetProcAddress ((GLubyte *) "glDetachShader");
|
||||
glLinkProgram = (glLinkProgramProc) glGetProcAddress ((GLubyte *) "glLinkProgram");
|
||||
glUseProgram = (glUseProgramProc) glGetProcAddress ((GLubyte *) "glUseProgram");
|
||||
glShaderSource = (glShaderSourceProc) glGetProcAddress ((GLubyte *) "glShaderSource");
|
||||
glGetUniformLocation = (glGetUniformLocationProc) glGetProcAddress ((GLubyte *) "glGetUniformLocation");
|
||||
glUniform2fv = (glUniform2fvProc) glGetProcAddress ((GLubyte *) "glUniform2fv");
|
||||
|
||||
if (glCreateProgram &&
|
||||
glCreateShader &&
|
||||
glCompileShader &&
|
||||
glDeleteShader &&
|
||||
glDeleteProgram &&
|
||||
glAttachShader &&
|
||||
glDetachShader &&
|
||||
glLinkProgram &&
|
||||
glUseProgram &&
|
||||
glShaderSource &&
|
||||
glGetUniformLocation &&
|
||||
glUniform2fv)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
S9xOpenGLDisplayDriver::load_shaders (const char *vertex_file,
|
||||
const char *fragment_file)
|
||||
{
|
||||
char *fragment, *vertex;
|
||||
|
||||
if (!load_shader_functions ())
|
||||
{
|
||||
fprintf (stderr, _("Cannot load GLSL shader functions.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
fragment = get_file_contents (fragment_file);
|
||||
if (!fragment)
|
||||
{
|
||||
fprintf (stderr, _("Cannot load fragment program.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
vertex = get_file_contents (vertex_file);
|
||||
if (!vertex)
|
||||
{
|
||||
fprintf (stderr, _("Cannot load vertex program.\n"));
|
||||
delete[] fragment;
|
||||
return 0;
|
||||
}
|
||||
|
||||
program = glCreateProgram ();
|
||||
vertex_shader = glCreateShader (GL_VERTEX_SHADER);
|
||||
fragment_shader = glCreateShader (GL_FRAGMENT_SHADER);
|
||||
glShaderSource (vertex_shader, 1, (const GLchar **) &vertex, NULL);
|
||||
glShaderSource (fragment_shader, 1, (const GLchar **) &fragment, NULL);
|
||||
glCompileShader (vertex_shader);
|
||||
glCompileShader (fragment_shader);
|
||||
glAttachShader (program, vertex_shader);
|
||||
glAttachShader (program, fragment_shader);
|
||||
glLinkProgram (program);
|
||||
|
||||
glUseProgram (program);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
S9xOpenGLDisplayDriver::opengl_defaults (void)
|
||||
{
|
||||
XVisualInfo *vi;
|
||||
int glx_attribs[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
|
||||
Display *display = GDK_DISPLAY ();
|
||||
|
||||
vi = glXChooseVisual (display, DefaultScreen (display), glx_attribs);
|
||||
|
||||
glx_context = glXCreateContext (display,
|
||||
vi,
|
||||
0,
|
||||
1);
|
||||
glXMakeCurrent (display, GDK_WINDOW_XWINDOW (drawing_area->window), glx_context);
|
||||
|
||||
gl_lock ();
|
||||
|
||||
const char *extensions = (const char *) glGetString (GL_EXTENSIONS);
|
||||
|
||||
using_pbos = 0;
|
||||
if (config->use_pbos)
|
||||
{
|
||||
|
@ -516,14 +599,29 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
|
|||
}
|
||||
}
|
||||
|
||||
using_shaders = 0;
|
||||
if (config->use_shaders)
|
||||
{
|
||||
if (!load_shaders (config->vertex_shader, config->fragment_shader))
|
||||
{
|
||||
config->use_shaders = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
using_shaders = 1;
|
||||
}
|
||||
}
|
||||
|
||||
tex_target = GL_TEXTURE_2D;
|
||||
texture_width = 1024;
|
||||
texture_height = 1024;
|
||||
dyn_resizing = FALSE;
|
||||
|
||||
if (config->npot_textures)
|
||||
const char *extensions = (const char *) glGetString (GL_EXTENSIONS);
|
||||
|
||||
if (extensions && config->npot_textures)
|
||||
{
|
||||
if (strstr (extensions, "_texture_rectangle"))
|
||||
if (!using_shaders && strstr (extensions, "_texture_rectangle"))
|
||||
{
|
||||
tex_target = GL_TEXTURE_RECTANGLE;
|
||||
texture_width = scaled_max_width;
|
||||
|
@ -569,8 +667,8 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
|
|||
texture_width,
|
||||
texture_height,
|
||||
0,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
PBO_GET_FORMAT (config->pbo_format),
|
||||
PBO_GET_PACKING (config->pbo_format),
|
||||
NULL);
|
||||
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||
|
@ -618,23 +716,135 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
|
|||
glLoadIdentity ();
|
||||
glOrtho (0.0, 1.0, 0.0, 1.0, -1, 1);
|
||||
|
||||
gl_unlock ();
|
||||
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
S9xOpenGLDisplayDriver::refresh (int width, int height)
|
||||
{
|
||||
if (!config->rom_loaded)
|
||||
{
|
||||
gdk_window_hide (gdk_window);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xOpenGLDisplayDriver::resize_window (int width, int height)
|
||||
{
|
||||
g_object_unref (gdk_window);
|
||||
XDestroyWindow (display, xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
create_window (width, height);
|
||||
gdk_window_show (gdk_window);
|
||||
|
||||
glXMakeCurrent (display, xwindow, glx_context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xOpenGLDisplayDriver::create_window (int width, int height)
|
||||
{
|
||||
XSetWindowAttributes window_attr;
|
||||
|
||||
window_attr.colormap = xcolormap;
|
||||
window_attr.border_pixel = 0;
|
||||
window_attr.event_mask = StructureNotifyMask | ExposureMask;
|
||||
window_attr.background_pixmap = None;
|
||||
|
||||
xwindow = XCreateWindow (display,
|
||||
GDK_WINDOW_XWINDOW (gtk_widget_get_window (drawing_area)),
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
vi->depth,
|
||||
InputOutput,
|
||||
vi->visual,
|
||||
CWColormap | CWBorderPixel | CWBackPixmap | CWEventMask,
|
||||
&window_attr);
|
||||
XSync (display, False);
|
||||
|
||||
output_window_width = width;
|
||||
output_window_height = height;
|
||||
|
||||
XMapWindow (display, xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
gdk_window = gdk_window_foreign_new (xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
gdk_window_set_user_data (gdk_window, drawing_area);
|
||||
}
|
||||
|
||||
int
|
||||
S9xOpenGLDisplayDriver::init_glx (void)
|
||||
{
|
||||
int glx_attribs[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
|
||||
|
||||
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
|
||||
vi = glXChooseVisual (display, DefaultScreen (display), glx_attribs);
|
||||
|
||||
if (!vi)
|
||||
{
|
||||
fprintf (stderr, _("Couldn't find an adequate OpenGL visual.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
xcolormap = XCreateColormap (display,
|
||||
GDK_WINDOW_XWINDOW (gtk_widget_get_window (drawing_area)),
|
||||
vi->visual,
|
||||
AllocNone);
|
||||
|
||||
create_window (1, 1);
|
||||
gdk_window_hide (gdk_window);
|
||||
|
||||
glx_context = glXCreateContext (display, vi, 0, 1);
|
||||
|
||||
if (!glx_context)
|
||||
{
|
||||
XFreeColormap (display, xcolormap);
|
||||
g_object_unref (gdk_window);
|
||||
XDestroyWindow (display, xwindow);
|
||||
|
||||
fprintf (stderr, _("Couldn't create an OpenGL context.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!glXMakeCurrent (display, xwindow, glx_context))
|
||||
{
|
||||
XFreeColormap (display, xcolormap);
|
||||
g_object_unref (gdk_window);
|
||||
XDestroyWindow (display, xwindow);
|
||||
glXDestroyContext (display, glx_context);
|
||||
|
||||
fprintf (stderr, "glXMakeCurrent failed.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
S9xOpenGLDisplayDriver::init (void)
|
||||
{
|
||||
int padding;
|
||||
initialized = 0;
|
||||
|
||||
opengl_defaults ();
|
||||
if (!init_glx ())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!opengl_defaults ())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Create two system buffers to avoid DMA contention */
|
||||
|
||||
|
@ -654,7 +864,9 @@ S9xOpenGLDisplayDriver::init (void)
|
|||
|
||||
filtering = -1;
|
||||
|
||||
this->swap_control (config->sync_to_vblank);
|
||||
swap_control (config->sync_to_vblank);
|
||||
|
||||
initialized = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -665,9 +877,7 @@ S9xOpenGLDisplayDriver::swap_control (int enable)
|
|||
glSwapIntervalProc glSwapInterval = NULL;
|
||||
const char *ext_str;
|
||||
|
||||
ext_str = glXQueryExtensionsString (GDK_DISPLAY (),
|
||||
GDK_SCREEN_XNUMBER (
|
||||
gdk_screen_get_default ()));
|
||||
ext_str = glXQueryExtensionsString (display, DefaultScreen (display));
|
||||
|
||||
/* We try to set this with both extensions since some cards pretend
|
||||
* to support both, but ignore one. */
|
||||
|
@ -714,24 +924,15 @@ S9xOpenGLDisplayDriver::get_current_buffer (void)
|
|||
return (uint16 *) padded_buffer[0];
|
||||
}
|
||||
|
||||
void
|
||||
S9xOpenGLDisplayDriver::gl_lock (void)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xOpenGLDisplayDriver::gl_unlock (void)
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xOpenGLDisplayDriver::gl_swap (void)
|
||||
{
|
||||
glXSwapBuffers (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (drawing_area->window));
|
||||
glXSwapBuffers (display, xwindow);
|
||||
|
||||
if (config->sync_every_frame)
|
||||
{
|
||||
glFinish ();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -739,7 +940,19 @@ S9xOpenGLDisplayDriver::gl_swap (void)
|
|||
void
|
||||
S9xOpenGLDisplayDriver::deinit (void)
|
||||
{
|
||||
glXDestroyContext (GDK_DISPLAY (), glx_context);
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
if (using_shaders)
|
||||
{
|
||||
glUseProgram (0);
|
||||
glDetachShader (program, vertex_shader);
|
||||
glDetachShader (program, fragment_shader);
|
||||
glDeleteShader (vertex_shader);
|
||||
glDeleteShader (fragment_shader);
|
||||
glDeleteProgram (program);
|
||||
using_shaders = 0;
|
||||
}
|
||||
|
||||
GFX.Screen = NULL;
|
||||
|
||||
|
@ -749,8 +962,6 @@ S9xOpenGLDisplayDriver::deinit (void)
|
|||
free (buffer[0]);
|
||||
free (buffer[1]);
|
||||
|
||||
gl_lock ();
|
||||
|
||||
if (using_pbos)
|
||||
{
|
||||
glBindBuffer (GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
@ -758,8 +969,13 @@ S9xOpenGLDisplayDriver::deinit (void)
|
|||
}
|
||||
|
||||
glDeleteTextures (1, &texmap);
|
||||
glXDestroyContext (display, glx_context);
|
||||
|
||||
gl_unlock ();
|
||||
XFree (vi);
|
||||
XFreeColormap (display, xcolormap);
|
||||
|
||||
g_object_unref (gdk_window);
|
||||
XDestroyWindow (display, xwindow);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -774,8 +990,9 @@ int
|
|||
S9xOpenGLDisplayDriver::query_availability (void)
|
||||
{
|
||||
int errorBase, eventBase;
|
||||
Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
|
||||
if (glXQueryExtension (GDK_DISPLAY (), &errorBase, &eventBase) == False)
|
||||
if (glXQueryExtension (display, &errorBase, &eventBase) == False)
|
||||
{
|
||||
if (gui_config->hw_accel == HWA_OPENGL)
|
||||
gui_config->hw_accel = HWA_NONE;
|
||||
|
@ -783,5 +1000,4 @@ S9xOpenGLDisplayDriver::query_availability (void)
|
|||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#define GL_WRITE_ONLY 0x88B9
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_TEXTURE_RECTANGLE 0x84F5
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define BUFFER_OFFSET(i) ((char *) NULL + (i))
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
|
@ -24,27 +26,48 @@
|
|||
#else
|
||||
#define PBO_BGRA_NATIVE_ORDER GL_UNSIGNED_BYTE
|
||||
#endif
|
||||
#define PBO_GET_FORMAT(x) (((x) == PBO_FMT_16 || (x) == PBO_FMT_32) ? GL_BGRA : GL_RGB)
|
||||
#define PBO_GET_PACKING(x) (((x) == PBO_FMT_16) ? GL_UNSIGNED_SHORT_1_5_5_5_REV : (((x) == PBO_FMT_24) ? GL_UNSIGNED_BYTE : PBO_BGRA_NATIVE_ORDER))
|
||||
|
||||
/* The following are procedure pointer types.
|
||||
* These aren't necessarily guaranteed to be in GL 1.1 */
|
||||
typedef int (*glSwapIntervalProc) (int interval);
|
||||
typedef void (*gl_proc) (void);
|
||||
typedef gl_proc (*getProcAddressProc) (const GLubyte *name);
|
||||
|
||||
typedef void (*gl_proc) (void);
|
||||
typedef gl_proc (*getProcAddressProc) (const GLubyte *name);
|
||||
|
||||
typedef void (*glGenBuffersProc) (GLsizei n, GLuint *buffers);
|
||||
typedef void (*glDeleteBuffersProc) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (*glBindBufferProc) (GLenum target, GLuint buffer);
|
||||
typedef void (*glBufferDataProc) (GLenum target,
|
||||
GLsizeiptr size,
|
||||
const GLvoid *data,
|
||||
GLenum usage);
|
||||
typedef void (*glBufferSubDataProc) (GLenum target,
|
||||
GLintptr offset,
|
||||
GLsizeiptr size,
|
||||
const GLvoid *data);
|
||||
typedef GLvoid *(*glMapBufferProc) (GLenum target, GLenum access);
|
||||
typedef GLboolean (*glUnmapBufferProc) (GLenum target);
|
||||
typedef GLint (*glSwapIntervalProc) (GLint interval);
|
||||
/* Procedures for pixel buffer objects */
|
||||
typedef void (*glGenBuffersProc) (GLsizei n, GLuint *buffers);
|
||||
typedef void (*glDeleteBuffersProc) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (*glBindBufferProc) (GLenum target, GLuint buffer);
|
||||
typedef void (*glBufferDataProc) (GLenum target,
|
||||
GLsizeiptr size,
|
||||
const GLvoid *data,
|
||||
GLenum usage);
|
||||
typedef void (*glBufferSubDataProc) (GLenum target,
|
||||
GLintptr offset,
|
||||
GLsizeiptr size,
|
||||
const GLvoid *data);
|
||||
typedef GLvoid *(*glMapBufferProc) (GLenum target, GLenum access);
|
||||
typedef GLboolean (*glUnmapBufferProc) (GLenum target);
|
||||
/* Procedures for GLSL */
|
||||
typedef GLuint (*glCreateProgramProc) (void);
|
||||
typedef GLuint (*glCreateShaderProc) (GLenum type);
|
||||
typedef void (*glCompileShaderProc) (GLuint shader);
|
||||
typedef void (*glDeleteShaderProc) (GLuint shader);
|
||||
typedef void (*glDeleteProgramProc) (GLuint program);
|
||||
typedef void (*glAttachShaderProc) (GLuint program, GLuint shader);
|
||||
typedef void (*glDetachShaderProc) (GLuint program, GLuint shader);
|
||||
typedef void (*glLinkProgramProc) (GLuint program);
|
||||
typedef void (*glUseProgramProc) (GLuint program);
|
||||
typedef void (*glShaderSourceProc) (GLuint shader,
|
||||
GLsizei count,
|
||||
const GLchar* *string,
|
||||
const GLint *length);
|
||||
typedef GLint (*glGetUniformLocationProc) (GLuint program,
|
||||
const GLchar *name);
|
||||
typedef void (*glUniform2fvProc) (GLint location,
|
||||
GLsizei count,
|
||||
const GLfloat *value);
|
||||
|
||||
class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
||||
{
|
||||
|
@ -62,36 +85,64 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
|||
static int query_availability (void);
|
||||
|
||||
private:
|
||||
void opengl_defaults (void);
|
||||
int opengl_defaults (void);
|
||||
void swap_control (int enable);
|
||||
void gl_lock (void);
|
||||
void gl_unlock (void);
|
||||
void gl_swap (void);
|
||||
int load_pixel_buffer_functions (void);
|
||||
int load_shader_functions (void);
|
||||
int load_shaders (const char *, const char *);
|
||||
gl_proc get_aliased_extension (const char **name);
|
||||
void update_texture_size (int width, int height);
|
||||
int init_glx (void);
|
||||
void create_window (int width, int height);
|
||||
void resize_window (int width, int height);
|
||||
|
||||
getProcAddressProc glGetProcAddress;
|
||||
glGenBuffersProc glGenBuffers;
|
||||
glBindBufferProc glBindBuffer;
|
||||
glBufferDataProc glBufferData;
|
||||
glBufferSubDataProc glBufferSubData;
|
||||
glMapBufferProc glMapBuffer;
|
||||
glUnmapBufferProc glUnmapBuffer;
|
||||
glDeleteBuffersProc glDeleteBuffers;
|
||||
getProcAddressProc glGetProcAddress;
|
||||
glGenBuffersProc glGenBuffers;
|
||||
glBindBufferProc glBindBuffer;
|
||||
glBufferDataProc glBufferData;
|
||||
glBufferSubDataProc glBufferSubData;
|
||||
glMapBufferProc glMapBuffer;
|
||||
glUnmapBufferProc glUnmapBuffer;
|
||||
glDeleteBuffersProc glDeleteBuffers;
|
||||
glCreateProgramProc glCreateProgram;
|
||||
glCreateShaderProc glCreateShader;
|
||||
glCompileShaderProc glCompileShader;
|
||||
glDeleteShaderProc glDeleteShader;
|
||||
glDeleteProgramProc glDeleteProgram;
|
||||
glAttachShaderProc glAttachShader;
|
||||
glDetachShaderProc glDetachShader;
|
||||
glLinkProgramProc glLinkProgram;
|
||||
glUseProgramProc glUseProgram;
|
||||
glShaderSourceProc glShaderSource;
|
||||
glGetUniformLocationProc glGetUniformLocation;
|
||||
glUniform2fvProc glUniform2fv;
|
||||
|
||||
GLint texture_width;
|
||||
GLint texture_height;
|
||||
GLfloat vertices[8];
|
||||
GLfloat texcoords[8];
|
||||
GLuint texmap;
|
||||
GLuint pbo;
|
||||
GLenum tex_target;
|
||||
GLint texture_width;
|
||||
GLint texture_height;
|
||||
GLfloat vertices[8];
|
||||
GLfloat texcoords[8];
|
||||
GLuint texmap;
|
||||
GLuint pbo;
|
||||
GLenum tex_target;
|
||||
GLuint program;
|
||||
GLuint fragment_shader;
|
||||
GLuint vertex_shader;
|
||||
|
||||
int dyn_resizing;
|
||||
int filtering;
|
||||
int using_pbos;
|
||||
GLXContext glx_context;
|
||||
int dyn_resizing;
|
||||
int filtering;
|
||||
int using_pbos;
|
||||
int using_shaders;
|
||||
int initialized;
|
||||
|
||||
Display *display;
|
||||
Window xwindow;
|
||||
Colormap xcolormap;
|
||||
XVisualInfo *vi;
|
||||
GdkWindow *gdk_window;
|
||||
GLXContext glx_context;
|
||||
int output_window_width;
|
||||
int output_window_height;
|
||||
};
|
||||
|
||||
#endif /* __GTK_DISPLAY_DRIVER_OPENGL_H */
|
||||
|
|
|
@ -30,21 +30,72 @@ S9xXVDisplayDriver::S9xXVDisplayDriver (Snes9xWindow *window,
|
|||
this->config = config;
|
||||
this->drawing_area = GTK_WIDGET (window->drawing_area);
|
||||
display =
|
||||
gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (drawing_area->window));
|
||||
gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (gtk_widget_get_window (drawing_area)));
|
||||
last_known_width = last_known_height = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xXVDisplayDriver::resize_window (int width, int height)
|
||||
{
|
||||
g_object_unref (gdk_window);
|
||||
XDestroyWindow (display, xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
create_window (width, height);
|
||||
gdk_window_show (gdk_window);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
S9xXVDisplayDriver::create_window (int width, int height)
|
||||
{
|
||||
XSetWindowAttributes window_attr;
|
||||
|
||||
window_attr.colormap = xcolormap;
|
||||
window_attr.border_pixel = 0;
|
||||
window_attr.event_mask = StructureNotifyMask | ExposureMask;
|
||||
window_attr.background_pixmap = None;
|
||||
|
||||
xwindow = XCreateWindow (display,
|
||||
GDK_WINDOW_XWINDOW (gtk_widget_get_window (drawing_area)),
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
vi->depth,
|
||||
InputOutput,
|
||||
vi->visual,
|
||||
CWColormap | CWBorderPixel | CWBackPixmap | CWEventMask,
|
||||
&window_attr);
|
||||
XSync (display, False);
|
||||
|
||||
output_window_width = width;
|
||||
output_window_height = height;
|
||||
|
||||
XMapWindow (display, xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
gdk_window = gdk_window_foreign_new (xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
gdk_window_set_user_data (gdk_window, drawing_area);
|
||||
}
|
||||
|
||||
void
|
||||
S9xXVDisplayDriver::update (int width, int height)
|
||||
{
|
||||
int current_width, current_height, final_pitch;
|
||||
uint8 *final_buffer;
|
||||
int dst_x, dst_y, dst_width, dst_height;
|
||||
GtkAllocation allocation;
|
||||
|
||||
current_width = drawing_area->allocation.width;
|
||||
current_height = drawing_area->allocation.height;
|
||||
gtk_widget_get_allocation (drawing_area, &allocation);
|
||||
current_width = allocation.width;
|
||||
current_height = allocation.height;
|
||||
|
||||
if (width <= 0)
|
||||
{
|
||||
|
@ -52,13 +103,10 @@ S9xXVDisplayDriver::update (int width, int height)
|
|||
return;
|
||||
}
|
||||
|
||||
if (output_window_width != current_width ||
|
||||
output_window_height!= current_height)
|
||||
if (output_window_width != current_width ||
|
||||
output_window_height != current_height)
|
||||
{
|
||||
gdk_window_move_resize (gdk_window, 0, 0, current_width, current_height);
|
||||
gdk_window_show (gdk_window);
|
||||
output_window_width = current_width;
|
||||
output_window_height = current_height;
|
||||
resize_window (current_width, current_height);
|
||||
}
|
||||
|
||||
if (config->scale_method > 0)
|
||||
|
@ -84,12 +132,6 @@ S9xXVDisplayDriver::update (int width, int height)
|
|||
final_pitch = image_width * image_bpp;
|
||||
}
|
||||
|
||||
if (!config->scale_to_fit && (width > current_width || height > current_height))
|
||||
{
|
||||
clear ();
|
||||
return;
|
||||
}
|
||||
|
||||
update_image_size (width, height);
|
||||
|
||||
if (format == FOURCC_YUY2)
|
||||
|
@ -115,47 +157,9 @@ S9xXVDisplayDriver::update (int width, int height)
|
|||
bpp);
|
||||
}
|
||||
|
||||
if (config->scale_to_fit)
|
||||
{
|
||||
double screen_aspect = (double) current_width / (double) current_height;
|
||||
double snes_aspect = S9xGetAspect ();
|
||||
double granularity = 1.0 / (double) MAX (current_width, current_height);
|
||||
|
||||
if (config->maintain_aspect_ratio &&
|
||||
!(screen_aspect <= snes_aspect * (1.0 + granularity) &&
|
||||
screen_aspect >= snes_aspect * (1.0 - granularity)))
|
||||
{
|
||||
if (screen_aspect > snes_aspect)
|
||||
{
|
||||
dst_x = (current_width - (int) (current_height * snes_aspect)) / 2;
|
||||
dst_y = 0;
|
||||
dst_width = (int) (current_height * snes_aspect);
|
||||
dst_height = current_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_x = 0;
|
||||
dst_y = (current_height - current_width / snes_aspect) / 2;
|
||||
dst_width = current_width;
|
||||
dst_height = (current_width / snes_aspect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_x = 0;
|
||||
dst_y = 0;
|
||||
dst_width = current_width;
|
||||
dst_height = current_height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dst_x = (current_width - width) / 2;
|
||||
dst_y = (current_height - height) / 2;
|
||||
dst_width = width;
|
||||
dst_height = height;
|
||||
}
|
||||
|
||||
dst_x = width; dst_y = height;
|
||||
dst_width = current_width; dst_height = current_height;
|
||||
S9xApplyAspect (dst_x, dst_y, dst_width, dst_height);
|
||||
|
||||
if (last_known_width != dst_width || last_known_height != dst_height)
|
||||
{
|
||||
|
@ -167,7 +171,7 @@ S9xXVDisplayDriver::update (int width, int height)
|
|||
XvShmPutImage (display,
|
||||
xv_portid,
|
||||
xwindow,
|
||||
xgc,
|
||||
XDefaultGC (display, XDefaultScreen (display)),
|
||||
xv_image,
|
||||
0,
|
||||
0,
|
||||
|
@ -263,7 +267,7 @@ S9xXVDisplayDriver::init (void)
|
|||
/* Setup XV */
|
||||
gtk_widget_realize (drawing_area);
|
||||
|
||||
display = gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (drawing_area->window));
|
||||
display = gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (gtk_widget_get_window (drawing_area)));
|
||||
screen = gtk_widget_get_screen (drawing_area);
|
||||
root = gdk_screen_get_root_window (screen);
|
||||
|
||||
|
@ -413,7 +417,7 @@ S9xXVDisplayDriver::init (void)
|
|||
}
|
||||
|
||||
/* Create a sub-window */
|
||||
XVisualInfo vi_template, *vi;
|
||||
XVisualInfo vi_template;
|
||||
int vi_num_items;
|
||||
|
||||
vi_template.visualid = visualid;
|
||||
|
@ -435,50 +439,16 @@ S9xXVDisplayDriver::init (void)
|
|||
|
||||
XSetWindowAttributes window_attr;
|
||||
xcolormap = XCreateColormap (display,
|
||||
GDK_WINDOW_XWINDOW (drawing_area->window),
|
||||
GDK_WINDOW_XWINDOW (gtk_widget_get_window (drawing_area)),
|
||||
vi->visual,
|
||||
AllocNone);
|
||||
|
||||
window_attr.colormap = xcolormap;
|
||||
window_attr.border_pixel = 0;
|
||||
window_attr.event_mask = StructureNotifyMask | ExposureMask;
|
||||
window_attr.event_mask = StructureNotifyMask | ExposureMask | PropertyChangeMask;
|
||||
window_attr.background_pixmap = None;
|
||||
|
||||
xwindow = XCreateWindow (display,
|
||||
GDK_WINDOW_XWINDOW (drawing_area->window),
|
||||
0,
|
||||
0,
|
||||
256,
|
||||
224,
|
||||
0,
|
||||
vi->depth,
|
||||
InputOutput,
|
||||
vi->visual,
|
||||
CWColormap | CWBorderPixel | CWBackPixmap | CWEventMask,
|
||||
&window_attr);
|
||||
XSync (display, False);
|
||||
|
||||
output_window_width = 256;
|
||||
output_window_height = 224;
|
||||
|
||||
XMapWindow (display, xwindow);
|
||||
XSync (display, False);
|
||||
|
||||
xgc = XCreateGC (display, xwindow, 0, NULL);
|
||||
XFree (vi);
|
||||
|
||||
gdk_display_sync (gtk_widget_get_display (drawing_area));
|
||||
gdk_window = gdk_window_foreign_new (xwindow);
|
||||
XSync (display, False);
|
||||
gdk_display_sync (gtk_widget_get_display (drawing_area));
|
||||
|
||||
if (gdk_window == NULL)
|
||||
{
|
||||
fprintf (stderr, "Failed to wrap native window.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
gdk_window_set_user_data (gdk_window, drawing_area);
|
||||
create_window (1, 1);
|
||||
gdk_window_hide (gdk_window);
|
||||
|
||||
/* Allocate a shared memory image. */
|
||||
|
@ -523,9 +493,10 @@ S9xXVDisplayDriver::deinit (void)
|
|||
XSync (display, 0);
|
||||
|
||||
XFreeColormap (display, xcolormap);
|
||||
gdk_window_unref (gdk_window);
|
||||
XFree (vi);
|
||||
|
||||
g_object_unref (gdk_window);
|
||||
XDestroyWindow (display, xwindow);
|
||||
XFreeGC (display, xgc);
|
||||
|
||||
free (buffer[0]);
|
||||
free (buffer[1]);
|
||||
|
@ -542,9 +513,14 @@ S9xXVDisplayDriver::deinit (void)
|
|||
void
|
||||
S9xXVDisplayDriver::clear (void)
|
||||
{
|
||||
int x, y, w, h;
|
||||
int width = drawing_area->allocation.width;
|
||||
int height = drawing_area->allocation.height;
|
||||
int x, y, w, h;
|
||||
int width, height;
|
||||
GtkAllocation allocation;
|
||||
GC xgc = XDefaultGC (display, XDefaultScreen (display));
|
||||
|
||||
gtk_widget_get_allocation (drawing_area, &allocation);
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
|
||||
if (window->last_width <= 0 || window->last_height <= 0)
|
||||
{
|
||||
|
@ -553,45 +529,12 @@ S9xXVDisplayDriver::clear (void)
|
|||
}
|
||||
|
||||
/* Get width of modified display */
|
||||
w = window->last_width;
|
||||
h = window->last_height;
|
||||
get_filter_scale (w, h);
|
||||
|
||||
if (config->scale_to_fit)
|
||||
{
|
||||
double screen_aspect = (double) width / (double) height;
|
||||
double snes_aspect = S9xGetAspect ();
|
||||
double granularity = 1.0 / (double) MAX (width, height);
|
||||
|
||||
if (config->maintain_aspect_ratio &&
|
||||
!(screen_aspect <= snes_aspect * (1.0 + granularity) &&
|
||||
screen_aspect >= snes_aspect * (1.0 - granularity)))
|
||||
{
|
||||
if (screen_aspect > snes_aspect)
|
||||
{
|
||||
x = (width - (int) (height * snes_aspect)) / 2;
|
||||
y = 0;
|
||||
w = (int) (height * snes_aspect);
|
||||
h = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = (height - width / snes_aspect) / 2;
|
||||
w = width;
|
||||
h = (width / snes_aspect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (width - w) / 2;
|
||||
y = (height - h) / 2;
|
||||
}
|
||||
x = window->last_width;
|
||||
y = window->last_height;
|
||||
get_filter_scale (x, y);
|
||||
w = width;
|
||||
h = height;
|
||||
S9xApplyAspect (x, y, w, h);
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
|
@ -689,14 +632,15 @@ S9xXVDisplayDriver::query_availability (void)
|
|||
p_request_base,
|
||||
p_event_base,
|
||||
p_error_base;
|
||||
Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
|
||||
/* Test if XV and SHM are feasible */
|
||||
if (!XShmQueryExtension (GDK_DISPLAY ()))
|
||||
if (!XShmQueryExtension (display))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (XvQueryExtension (GDK_DISPLAY (),
|
||||
if (XvQueryExtension (display,
|
||||
&p_version,
|
||||
&p_release,
|
||||
&p_request_base,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __GTK_DISPLAY_DRIVER_XV_H
|
||||
#define __GTK_DISPLAY_DRIVER_XV_H
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#include <X11/extensions/Xvlib.h>
|
||||
|
||||
|
@ -27,11 +29,14 @@ class S9xXVDisplayDriver : public S9xDisplayDriver
|
|||
private:
|
||||
void clear (void);
|
||||
void update_image_size (int width, int height);
|
||||
void resize_window (int width, int height);
|
||||
void create_window (int width, int height);
|
||||
|
||||
Display *display;
|
||||
Window xwindow;
|
||||
GC xgc;
|
||||
Colormap xcolormap;
|
||||
XVisualInfo *vi;
|
||||
GdkWindow *gdk_window;
|
||||
|
||||
XvImage *xv_image;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gtk_s9x.h"
|
||||
|
||||
|
@ -130,72 +131,65 @@ const char *
|
|||
S9xGetDirectory (enum s9x_getdirtype dirtype)
|
||||
{
|
||||
static char path[PATH_MAX + 1];
|
||||
char *config_dir = get_config_dir ();
|
||||
|
||||
switch (dirtype)
|
||||
{
|
||||
default:
|
||||
case DEFAULT_DIR:
|
||||
strcpy (path, config_dir);
|
||||
break;
|
||||
|
||||
case HOME_DIR:
|
||||
strcpy (path, getenv ("HOME"));
|
||||
break;
|
||||
|
||||
case ROM_DIR:
|
||||
sprintf (path, "%s/roms", config_dir);
|
||||
break;
|
||||
|
||||
case SNAPSHOT_DIR:
|
||||
sprintf (path, "%s/snapshots", config_dir);
|
||||
sprintf (path, "%s", gui_config->savestate_directory);
|
||||
break;
|
||||
|
||||
case IPS_DIR:
|
||||
case CHEAT_DIR:
|
||||
case SRAM_DIR:
|
||||
case ROMFILENAME_DIR:
|
||||
case BIOS_DIR:
|
||||
char *loc;
|
||||
|
||||
strcpy (path, Memory.ROMFilename);
|
||||
|
||||
loc = strrchr (path, SLASH_CHAR);
|
||||
|
||||
if (loc == NULL)
|
||||
{
|
||||
if (getcwd (path, PATH_MAX + 1) == NULL)
|
||||
{
|
||||
strcpy (path, getenv ("HOME"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
path[loc - path] = '\0';
|
||||
}
|
||||
|
||||
if (gui_config->data_location == DIR_ROM ||
|
||||
dirtype == ROMFILENAME_DIR)
|
||||
{
|
||||
/* printf ("Got %s\n", path); */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (gui_config->data_location == DIR_CONFIG)
|
||||
sprintf (path, "%s/sram", config_dir);
|
||||
else if (gui_config->data_location == DIR_CUSTOM)
|
||||
sprintf (path, "%s", gui_config->custom_sram_directory);
|
||||
|
||||
sprintf (path, "%s", gui_config->patch_directory);
|
||||
break;
|
||||
|
||||
case CHEAT_DIR:
|
||||
sprintf (path, "%s", gui_config->cheat_directory);
|
||||
break;
|
||||
|
||||
case SRAM_DIR:
|
||||
sprintf (path, "%s", gui_config->sram_directory);
|
||||
break;
|
||||
|
||||
case SCREENSHOT_DIR:
|
||||
case SPC_DIR:
|
||||
sprintf (path, "%s", gui_config->export_directory);
|
||||
|
||||
default:
|
||||
path[0] = '\0';
|
||||
}
|
||||
|
||||
/* Try and mkdir, whether it exists or not */
|
||||
mkdir (path, 0777);
|
||||
if (dirtype != HOME_DIR && path[0] != '\0')
|
||||
{
|
||||
mkdir (path, 0755);
|
||||
chmod (path, 0755);
|
||||
}
|
||||
|
||||
free (config_dir);
|
||||
/* Anything else, use ROM filename path */
|
||||
if (path[0] == '\0')
|
||||
{
|
||||
char *loc;
|
||||
|
||||
/* printf ("path: %s\n", path); */
|
||||
strcpy (path, Memory.ROMFilename);
|
||||
|
||||
loc = strrchr (path, SLASH_CHAR);
|
||||
|
||||
if (loc == NULL)
|
||||
{
|
||||
if (getcwd (path, PATH_MAX + 1) == NULL)
|
||||
{
|
||||
strcpy (path, getenv ("HOME"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
path[loc - path] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
@ -307,17 +301,33 @@ S9xOpenSnapshotFile (const char *fname, bool8 read_only, STREAM *file)
|
|||
{
|
||||
if ((*file = OPEN_STREAM (filename, "rb")))
|
||||
return (TRUE);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Failed to open file stream for reading. (%s)\n",
|
||||
zError (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*file = OPEN_STREAM (filename, "wb")))
|
||||
{
|
||||
if (chown (filename, getuid (), getgid ()) < 0)
|
||||
{
|
||||
fprintf (stderr, "Couldn't set ownership of file.\n");
|
||||
return (FALSE);
|
||||
}
|
||||
else
|
||||
return (TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Couldn't open stream with zlib. (%s)\n",
|
||||
zError (errno));
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (stderr, "zlib: Couldn't open snapshot file:\n%s\n", filename);
|
||||
|
||||
#else
|
||||
char command [PATH_MAX];
|
||||
|
||||
|
@ -333,7 +343,11 @@ S9xOpenSnapshotFile (const char *fname, bool8 read_only, STREAM *file)
|
|||
if (*file = popen (command, "wb"))
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
fprintf (stderr, "gzip: Couldn't open snapshot file:\n%s\n", filename);
|
||||
|
||||
#endif
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
@ -380,7 +394,7 @@ S9xLoadState (const char *filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Failed to load state file %s\n", filename);
|
||||
fprintf (stderr, "Failed to load state file: %s\n", filename);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -389,10 +403,15 @@ S9xLoadState (const char *filename)
|
|||
void
|
||||
S9xSaveState (const char *filename)
|
||||
{
|
||||
S9xFreezeGame (filename);
|
||||
|
||||
sprintf (buf, "%s saved", filename);
|
||||
S9xSetInfoString (buf);
|
||||
if (S9xFreezeGame (filename))
|
||||
{
|
||||
sprintf (buf, "%s saved", filename);
|
||||
S9xSetInfoString (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Couldn't save state file: %s\n", filename);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -408,7 +427,7 @@ S9xOpenROMDialog (void)
|
|||
{
|
||||
"*.smc", "*.SMC", "*.fig", "*.FIG", "*.sfc", "*.SFC",
|
||||
"*.jma", "*.JMA", "*.zip", "*.ZIP", "*.gd3", "*.GD3",
|
||||
"*.swc", "*.SWC",
|
||||
"*.swc", "*.SWC", "*.gz" , "*.GZ",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -483,11 +502,12 @@ S9xQuickSaveSlot (int slot)
|
|||
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
|
||||
slot);
|
||||
|
||||
sprintf (buf, "%s.%03d saved", def, slot);
|
||||
if (S9xFreezeGame (filename))
|
||||
{
|
||||
sprintf (buf, "%s.%03d saved", def, slot);
|
||||
|
||||
S9xSetInfoString (buf);
|
||||
|
||||
S9xFreezeGame (filename);
|
||||
S9xSetInfoString (buf);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,194 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include "gtk_glade_window.h"
|
||||
|
||||
GladeWindow::GladeWindow (const char *buffer, int size, const char *root)
|
||||
{
|
||||
glade = glade_xml_new_from_buffer (buffer, size, root, NULL);
|
||||
|
||||
window = get_widget (root);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
GladeWindow::get_widget (const char *name)
|
||||
{
|
||||
return glade_xml_get_widget (glade, name);
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::signal_connect (const char *name, GCallback func)
|
||||
{
|
||||
glade_xml_signal_connect_data (glade, name, func, (gpointer) this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::signal_connect (const char *name, GCallback func, gpointer data)
|
||||
{
|
||||
glade_xml_signal_connect_data (glade, name, func, (gpointer) data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::signal_connect (GladeWindowCallbacks *callbacks)
|
||||
{
|
||||
if (!callbacks)
|
||||
return;
|
||||
|
||||
for (int i = 0; callbacks[i].signal; i++)
|
||||
{
|
||||
signal_connect (callbacks[i].signal, callbacks[i].function);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::enable_widget (const char *name, unsigned char state)
|
||||
{
|
||||
gtk_widget_set_sensitive (get_widget (name), state);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::resize (int width, int height)
|
||||
{
|
||||
gtk_window_resize (GTK_WINDOW (window), width, height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::refresh (void)
|
||||
{
|
||||
gtk_widget_queue_draw (GTK_WIDGET (window));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
GladeWindow::get_width (void)
|
||||
{
|
||||
return window->allocation.width;
|
||||
}
|
||||
|
||||
int
|
||||
GladeWindow::get_height (void)
|
||||
{
|
||||
return window->allocation.height;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_button_label (const char *name, const char *label)
|
||||
{
|
||||
gtk_button_set_label (GTK_BUTTON (get_widget (name)), label);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
GladeWindow::get_check (const char *name)
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (get_widget (name))))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
GladeWindow::get_entry_value (const char *name)
|
||||
{
|
||||
return atoi (gtk_entry_get_text (GTK_ENTRY (get_widget (name))));;
|
||||
}
|
||||
|
||||
const char *
|
||||
GladeWindow::get_entry_text (const char *name)
|
||||
{
|
||||
return gtk_entry_get_text (GTK_ENTRY (get_widget (name)));
|
||||
}
|
||||
|
||||
float
|
||||
GladeWindow::get_slider (const char *name)
|
||||
{
|
||||
return (float) gtk_range_get_value (GTK_RANGE (get_widget (name)));
|
||||
}
|
||||
|
||||
unsigned char
|
||||
GladeWindow::get_combo (const char *name)
|
||||
{
|
||||
return gtk_combo_box_get_active (GTK_COMBO_BOX (get_widget (name)));
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_slider (const char *name, float value)
|
||||
{
|
||||
gtk_range_set_value (GTK_RANGE (get_widget (name)), (double) value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_check (const char *name, unsigned char value)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (get_widget (name)),
|
||||
value);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_entry_value (const char *name, unsigned int value)
|
||||
{
|
||||
char text[80];
|
||||
|
||||
snprintf (text, 80, "%u", value);
|
||||
gtk_entry_set_text (GTK_ENTRY (get_widget (name)), text);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_entry_text (const char *name, const char *text)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (get_widget (name)), text);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_combo (const char *name, unsigned char value)
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (get_widget (name)), value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
GladeWindow::set_spin (const char *name, unsigned int value)
|
||||
{
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (get_widget (name)),
|
||||
(double) value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GtkWindow *
|
||||
GladeWindow::get_window (void)
|
||||
{
|
||||
return GTK_WINDOW (window);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
GladeWindow::get_spin (const char *name)
|
||||
{
|
||||
return (unsigned int)
|
||||
gtk_spin_button_get_value (GTK_SPIN_BUTTON (get_widget (name)));
|
||||
}
|
||||
|
||||
int
|
||||
GladeWindow::has_focus (const char *widget)
|
||||
{
|
||||
return gtk_widget_is_focus (get_widget (widget));
|
||||
}
|
|
@ -55,6 +55,7 @@ S9xNetplayConnect (void)
|
|||
"Couldn't connect to server: %s:%d",
|
||||
gui_config->netplay_last_host,
|
||||
gui_config->netplay_last_port);
|
||||
gtk_window_set_title (GTK_WINDOW (msg), _("Connection Error"));
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (msg));
|
||||
gtk_widget_destroy (msg);
|
||||
|
|
|
@ -2,58 +2,58 @@
|
|||
#include "gtk_s9x.h"
|
||||
#include "gtk_file.h"
|
||||
|
||||
static void
|
||||
static void
|
||||
event_browse_clicked (GtkButton *button, gpointer data)
|
||||
{
|
||||
char *filename;
|
||||
Snes9xNetplayDialog *np_dialog = (Snes9xNetplayDialog *) data;
|
||||
|
||||
|
||||
filename = S9xOpenROMDialog ();
|
||||
|
||||
|
||||
if (filename)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (np_dialog->get_widget ("rom_image")),
|
||||
gtk_entry_set_text (GTK_ENTRY (np_dialog->get_widget ("rom_image")),
|
||||
filename);
|
||||
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
event_clear_clicked (GtkButton *button, gpointer data)
|
||||
{
|
||||
Snes9xNetplayDialog *np_dialog = (Snes9xNetplayDialog *) data;
|
||||
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (np_dialog->get_widget ("rom_image")), "");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
event_server_toggled (GtkToggleButton *toggle, gpointer data)
|
||||
{
|
||||
Snes9xNetplayDialog *np_dialog = (Snes9xNetplayDialog *) data;
|
||||
|
||||
np_dialog->update_state ();
|
||||
|
||||
np_dialog->update_state ();
|
||||
}
|
||||
|
||||
Snes9xNetplayDialog::Snes9xNetplayDialog (Snes9xConfig *config) :
|
||||
GladeWindow (snes9x_glade, snes9x_glade_size, "netplay_dialog")
|
||||
GtkBuilderWindow ("netplay_dialog")
|
||||
{
|
||||
GladeWindowCallbacks callbacks[] =
|
||||
GtkBuilderWindowCallbacks callbacks[] =
|
||||
{
|
||||
{ "server_toggled", G_CALLBACK (event_server_toggled) },
|
||||
{ "browse_clicked", G_CALLBACK (event_browse_clicked) },
|
||||
{ "clear_clicked", G_CALLBACK (event_clear_clicked) },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
signal_connect (callbacks);
|
||||
|
||||
|
||||
this->config = config;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -65,17 +65,17 @@ Snes9xNetplayDialog::update_state (void)
|
|||
enable_widget ("connect_box", FALSE);
|
||||
enable_widget ("default_port_box", TRUE);
|
||||
enable_widget ("sync_reset", TRUE);
|
||||
enable_widget ("send_image", TRUE);
|
||||
enable_widget ("send_image", TRUE);
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
enable_widget ("connect_box", TRUE);
|
||||
enable_widget ("default_port_box", FALSE);
|
||||
enable_widget ("sync_reset", FALSE);
|
||||
enable_widget ("send_image", FALSE);
|
||||
enable_widget ("send_image", FALSE);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -91,9 +91,9 @@ Snes9xNetplayDialog::settings_to_dialog (void)
|
|||
set_spin ("frames_behind", config->netplay_max_frame_loss);
|
||||
set_check ("connect_radio", !config->netplay_is_server);
|
||||
set_check ("host_radio", config->netplay_is_server);
|
||||
|
||||
|
||||
update_state ();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,9 +108,9 @@ Snes9xNetplayDialog::settings_from_dialog (void)
|
|||
config->netplay_default_port = get_spin ("default_port");
|
||||
config->netplay_max_frame_loss = get_spin ("frames_behind");
|
||||
config->netplay_is_server = get_check ("host_radio");
|
||||
|
||||
|
||||
config->save_config_file ();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -118,25 +118,25 @@ int
|
|||
Snes9xNetplayDialog::show (void)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
||||
settings_to_dialog ();
|
||||
|
||||
|
||||
result = gtk_dialog_run (GTK_DIALOG (window));
|
||||
|
||||
gtk_widget_hide (window);
|
||||
|
||||
|
||||
if (result == GTK_RESPONSE_OK)
|
||||
{
|
||||
settings_from_dialog ();
|
||||
|
||||
settings_from_dialog ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Snes9xNetplayDialog::~Snes9xNetplayDialog (void)
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#ifndef __GTK_NETPLAY_DIALOG_H
|
||||
#define __GTK_NETPLAY_DIALOG_H
|
||||
|
||||
#include "gtk_glade_window.h"
|
||||
#include "gtk_builder_window.h"
|
||||
#include "gtk_config.h"
|
||||
|
||||
class Snes9xNetplayDialog : public GladeWindow
|
||||
class Snes9xNetplayDialog : public GtkBuilderWindow
|
||||
{
|
||||
public:
|
||||
Snes9xNetplayDialog (Snes9xConfig *config);
|
||||
~Snes9xNetplayDialog (void);
|
||||
int show (void);
|
||||
void update_state (void);
|
||||
|
||||
|
||||
private:
|
||||
Snes9xConfig *config;
|
||||
void settings_to_dialog (void);
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "gtk_display.h"
|
||||
#include "gtk_binding.h"
|
||||
|
||||
#define SAME_GAME _("Same location as current game")
|
||||
|
||||
gboolean
|
||||
snes9x_preferences_open (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -83,7 +85,7 @@ event_control_toggle (GtkToggleButton *widget, gpointer data)
|
|||
}
|
||||
|
||||
window->last_toggled = widget;
|
||||
name = gtk_widget_get_name (GTK_WIDGET (widget));
|
||||
name = gtk_buildable_get_name (GTK_BUILDABLE (widget));
|
||||
state = gtk_toggle_button_get_active (widget);
|
||||
|
||||
toggle_lock = 1;
|
||||
|
@ -216,6 +218,123 @@ event_reset_current_joypad (GtkButton *widget, gpointer data)
|
|||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_shader_select (GtkButton *widget, gpointer data)
|
||||
{
|
||||
#ifdef USE_OPENGL
|
||||
Snes9xPreferences *window = (Snes9xPreferences *) data;
|
||||
GtkWidget *dialog;
|
||||
char *filename = NULL;
|
||||
gint result;
|
||||
GtkEntry *entry;
|
||||
|
||||
if (!strcmp (gtk_buildable_get_name (GTK_BUILDABLE (widget)), "fragment_shader_button"))
|
||||
{
|
||||
entry = GTK_ENTRY (window->get_widget ("fragment_shader"));
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = GTK_ENTRY (window->get_widget ("vertex_shader"));
|
||||
}
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Select Shader File",
|
||||
window->get_window (),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
if (strcmp (gui_config->last_directory, ""))
|
||||
{
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
|
||||
gui_config->last_directory);
|
||||
}
|
||||
|
||||
if (strlen (gtk_entry_get_text (entry)))
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
|
||||
gtk_entry_get_text (entry));
|
||||
|
||||
|
||||
result = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_hide_all (dialog);
|
||||
|
||||
if (result == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
if (filename != NULL)
|
||||
{
|
||||
gtk_entry_set_text (entry, filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
event_game_data_clear (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_entry_set_text (entry, SAME_GAME);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_game_data_browse (GtkButton *widget, gpointer data)
|
||||
{
|
||||
Snes9xPreferences *window = (Snes9xPreferences *) data;
|
||||
GtkWidget *dialog;
|
||||
char *filename = NULL;
|
||||
gint result;
|
||||
GtkEntry *entry;
|
||||
char entry_name[256];
|
||||
|
||||
strcpy (entry_name, gtk_buildable_get_name (GTK_BUILDABLE (widget)));
|
||||
|
||||
sprintf (strstr (entry_name, "_browse"), "_directory");
|
||||
entry = GTK_ENTRY (window->get_widget (entry_name));
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Select directory",
|
||||
window->get_window (),
|
||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
if (strcmp (gui_config->last_directory, ""))
|
||||
{
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
|
||||
gui_config->last_directory);
|
||||
}
|
||||
|
||||
if (strcmp (gtk_entry_get_text (entry), SAME_GAME))
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
|
||||
gtk_entry_get_text (entry));
|
||||
|
||||
result = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_hide_all (dialog);
|
||||
|
||||
if (result == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
if (filename != NULL)
|
||||
{
|
||||
gtk_entry_set_text (entry, filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
event_hw_accel_changed (GtkComboBox *widget, gpointer data)
|
||||
{
|
||||
|
@ -340,6 +459,7 @@ Snes9xPreferences::calibration_dialog (void)
|
|||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
_("Current joystick centers have been saved."));
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Calibration Complete"));
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
|
@ -350,34 +470,15 @@ Snes9xPreferences::calibration_dialog (void)
|
|||
|
||||
#endif
|
||||
|
||||
Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
|
||||
GladeWindow (snes9x_glade, snes9x_glade_size, "preferences_window")
|
||||
static void
|
||||
event_about_clicked (GtkButton *widget, gpointer data)
|
||||
{
|
||||
GladeWindowCallbacks callbacks[] =
|
||||
{
|
||||
{ "control_toggle", G_CALLBACK (event_control_toggle) },
|
||||
{ "on_key_press", G_CALLBACK (event_key_press) },
|
||||
{ "control_combo_changed", G_CALLBACK (event_control_combo_changed) },
|
||||
{ "change_current_page", G_CALLBACK (event_switch_page) },
|
||||
{ "sram_folder_browse", G_CALLBACK (event_sram_folder_browse) },
|
||||
{ "scale_method_changed", G_CALLBACK (event_scale_method_changed) },
|
||||
{ "hw_accel_changed", G_CALLBACK (event_hw_accel_changed) },
|
||||
{ "reset_current_joypad", G_CALLBACK (event_reset_current_joypad) },
|
||||
{ "swap_with", G_CALLBACK (event_swap_with) },
|
||||
{ "style_set", G_CALLBACK (event_style_set) },
|
||||
{ "ntsc_composite_preset", G_CALLBACK (event_ntsc_composite_preset) },
|
||||
{ "ntsc_svideo_preset", G_CALLBACK (event_ntsc_svideo_preset) },
|
||||
{ "ntsc_rgb_preset", G_CALLBACK (event_ntsc_rgb_preset) },
|
||||
{ "ntsc_monochrome_preset", G_CALLBACK (event_ntsc_monochrome_preset) },
|
||||
#ifdef USE_JOYSTICK
|
||||
{ "calibrate", G_CALLBACK (event_calibrate) },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
std::string version_string;
|
||||
GtkBuilderWindow *about_dialog = new GtkBuilderWindow ("about_dialog");
|
||||
Snes9xPreferences *preferences = (Snes9xPreferences *) data;
|
||||
|
||||
((version_string += _("GTK port version: ")) += SNES9X_GTK_VERSION) += "\n";
|
||||
((version_string += _("Snes9x version: ")) += VERSION) += ", ";
|
||||
((version_string += _("GTK+ port version: ")) += SNES9X_GTK_VERSION) += "\n";
|
||||
(version_string += SNES9X_GTK_AUTHORS) += "\n";
|
||||
(version_string += _("English localization by Brandon Wright")) += "\n";
|
||||
|
||||
|
@ -402,11 +503,53 @@ Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
|
|||
#ifdef NETPLAY_SUPPORT
|
||||
version_string += _(" NetPlay");
|
||||
#endif
|
||||
(version_string += _("</i>\n\nSnes9x version: ")) += VERSION;
|
||||
version_string += "</i>";
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (get_widget ("version_string_label")),
|
||||
gtk_label_set_label (GTK_LABEL (about_dialog->get_widget ("version_string_label")),
|
||||
version_string.c_str ());
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (about_dialog->get_widget ("preferences_splash")),
|
||||
top_level->splash);
|
||||
|
||||
gtk_window_set_transient_for (about_dialog->get_window (),
|
||||
preferences->get_window ());
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (about_dialog->get_window ()));
|
||||
|
||||
delete about_dialog;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
|
||||
GtkBuilderWindow ("preferences_window")
|
||||
{
|
||||
GtkBuilderWindowCallbacks callbacks[] =
|
||||
{
|
||||
{ "control_toggle", G_CALLBACK (event_control_toggle) },
|
||||
{ "on_key_press", G_CALLBACK (event_key_press) },
|
||||
{ "control_combo_changed", G_CALLBACK (event_control_combo_changed) },
|
||||
{ "change_current_page", G_CALLBACK (event_switch_page) },
|
||||
{ "sram_folder_browse", G_CALLBACK (event_sram_folder_browse) },
|
||||
{ "scale_method_changed", G_CALLBACK (event_scale_method_changed) },
|
||||
{ "hw_accel_changed", G_CALLBACK (event_hw_accel_changed) },
|
||||
{ "reset_current_joypad", G_CALLBACK (event_reset_current_joypad) },
|
||||
{ "swap_with", G_CALLBACK (event_swap_with) },
|
||||
{ "style_set", G_CALLBACK (event_style_set) },
|
||||
{ "ntsc_composite_preset", G_CALLBACK (event_ntsc_composite_preset) },
|
||||
{ "ntsc_svideo_preset", G_CALLBACK (event_ntsc_svideo_preset) },
|
||||
{ "ntsc_rgb_preset", G_CALLBACK (event_ntsc_rgb_preset) },
|
||||
{ "ntsc_monochrome_preset", G_CALLBACK (event_ntsc_monochrome_preset) },
|
||||
{ "shader_select", G_CALLBACK (event_shader_select) },
|
||||
{ "game_data_browse", G_CALLBACK (event_game_data_browse) },
|
||||
{ "game_data_clear", G_CALLBACK (event_game_data_clear) },
|
||||
{ "about_clicked", G_CALLBACK (event_about_clicked) },
|
||||
#ifdef USE_JOYSTICK
|
||||
{ "calibrate", G_CALLBACK (event_calibrate) },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
last_toggled = NULL;
|
||||
this->config = config;
|
||||
|
||||
|
@ -417,9 +560,6 @@ Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
|
|||
gtk_size_group_add_widget (size_group[1], get_widget ("change_display_resolution"));
|
||||
gtk_size_group_add_widget (size_group[1], get_widget ("scale_method_label"));
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (get_widget ("preferences_splash")),
|
||||
top_level->splash);
|
||||
|
||||
fix_style ();
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
@ -431,7 +571,6 @@ Snes9xPreferences::Snes9xPreferences (Snes9xConfig *config) :
|
|||
|
||||
Snes9xPreferences::~Snes9xPreferences (void)
|
||||
{
|
||||
g_object_unref (glade);
|
||||
g_object_unref (size_group[0]);
|
||||
g_object_unref (size_group[1]);
|
||||
|
||||
|
@ -502,10 +641,27 @@ Snes9xPreferences::move_settings_to_dialog (void)
|
|||
set_check ("force_hires", config->force_hires);
|
||||
set_check ("maintain_aspect_ratio", config->maintain_aspect_ratio);
|
||||
set_combo ("aspect_ratio", config->aspect_ratio);
|
||||
set_check ("rom_folder_radio", config->data_location==DIR_ROM);
|
||||
set_check ("config_folder_radio", config->data_location==DIR_CONFIG);
|
||||
set_check ("custom_folder_radio", config->data_location==DIR_CUSTOM);
|
||||
set_entry_text ("custom_folder_entry", config->custom_sram_directory);
|
||||
if (config->sram_directory[0] == '\0')
|
||||
set_entry_text ("sram_directory", SAME_GAME);
|
||||
else
|
||||
set_entry_text ("sram_directory", config->sram_directory);
|
||||
if (config->savestate_directory[0] == '\0')
|
||||
set_entry_text ("savestate_directory", SAME_GAME);
|
||||
else
|
||||
set_entry_text ("savestate_directory", config->savestate_directory);
|
||||
if (config->patch_directory[0] == '\0')
|
||||
set_entry_text ("patch_directory", SAME_GAME);
|
||||
else
|
||||
set_entry_text ("patch_directory", config->patch_directory);
|
||||
if (config->cheat_directory[0] == '\0')
|
||||
set_entry_text ("cheat_directory", SAME_GAME);
|
||||
else
|
||||
set_entry_text ("cheat_directory", config->cheat_directory);
|
||||
if (config->export_directory[0] == '\0')
|
||||
set_entry_text ("export_directory", SAME_GAME);
|
||||
else
|
||||
set_entry_text ("export_directory", config->export_directory);
|
||||
|
||||
set_combo ("resolution_combo", config->xrr_index);
|
||||
set_combo ("scale_method_combo", config->scale_method);
|
||||
set_entry_value ("save_sram_after_sec", Settings.AutoSaveDelay);
|
||||
|
@ -575,9 +731,13 @@ Snes9xPreferences::move_settings_to_dialog (void)
|
|||
#ifdef USE_OPENGL
|
||||
set_check ("bilinear_filter", config->bilinear_filter);
|
||||
set_check ("sync_to_vblank", config->sync_to_vblank);
|
||||
set_check ("sync_every_frame", config->sync_every_frame);
|
||||
set_check ("use_pbos", config->use_pbos);
|
||||
set_combo ("pixel_format", config->pbo_format);
|
||||
set_check ("npot_textures", config->npot_textures);
|
||||
set_check ("use_shaders", config->use_shaders);
|
||||
set_entry_text ("fragment_shader", config->fragment_shader);
|
||||
set_entry_text ("vertex_shader", config->vertex_shader);
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOYSTICK
|
||||
|
@ -610,7 +770,7 @@ Snes9xPreferences::get_settings_from_dialog (void)
|
|||
(7 - (get_combo ("playback_combo")))) ||
|
||||
(config->sound_input_rate != get_slider ("sound_input_rate")) ||
|
||||
(Settings.SoundSync != get_check ("sync_sound"))
|
||||
)
|
||||
)
|
||||
{
|
||||
sound_needs_restart = 1;
|
||||
}
|
||||
|
@ -661,12 +821,6 @@ Snes9xPreferences::get_settings_from_dialog (void)
|
|||
config->force_inverted_byte_order = get_check ("force_inverted_byte_order");
|
||||
Settings.AutoSaveDelay = get_entry_value ("save_sram_after_sec");
|
||||
config->multithreading = get_check ("multithreading");
|
||||
config->data_location = get_check ("rom_folder_radio") ?
|
||||
DIR_ROM : config->data_location;
|
||||
config->data_location = get_check ("config_folder_radio") ?
|
||||
DIR_CONFIG : config->data_location;
|
||||
config->data_location = get_check ("custom_folder_radio") ?
|
||||
DIR_CUSTOM : config->data_location;
|
||||
config->pause_emulation_on_switch = get_check ("pause_emulation_on_switch");
|
||||
Settings.SkipFrames = get_combo ("frameskip_combo");
|
||||
Settings.DisableHDMA = !(get_check ("hdma_check"));
|
||||
|
@ -696,7 +850,9 @@ Snes9xPreferences::get_settings_from_dialog (void)
|
|||
if (config->sync_to_vblank != get_check ("sync_to_vblank") ||
|
||||
config->npot_textures != get_check ("npot_textures") ||
|
||||
config->use_pbos != get_check ("use_pbos") ||
|
||||
config->pbo_format != get_combo ("pixel_format"))
|
||||
config->pbo_format != get_combo ("pixel_format") ||
|
||||
config->use_shaders != get_check ("use_shaders") ||
|
||||
get_check ("use_shaders"))
|
||||
{
|
||||
gfx_needs_restart = 1;
|
||||
}
|
||||
|
@ -705,14 +861,65 @@ Snes9xPreferences::get_settings_from_dialog (void)
|
|||
config->sync_to_vblank = get_check ("sync_to_vblank");
|
||||
config->use_pbos = get_check ("use_pbos");
|
||||
config->npot_textures = get_check ("npot_textures");
|
||||
config->use_shaders = get_check ("use_shaders");
|
||||
config->sync_every_frame = get_check ("sync_every_frame");
|
||||
|
||||
strncpy (config->fragment_shader, get_entry_text ("fragment_shader"), PATH_MAX);
|
||||
strncpy (config->vertex_shader, get_entry_text ("vertex_shader"), PATH_MAX);
|
||||
|
||||
config->pbo_format = get_combo ("pixel_format");
|
||||
|
||||
#endif
|
||||
char safety_sram_directory [PATH_MAX];
|
||||
|
||||
strncpy (config->custom_sram_directory,
|
||||
get_entry_text ("custom_folder_entry"),
|
||||
PATH_MAX);
|
||||
strncpy (safety_sram_directory, get_entry_text ("sram_directory"), PATH_MAX);
|
||||
strncpy (config->savestate_directory, get_entry_text ("savestate_directory"), PATH_MAX);
|
||||
strncpy (config->patch_directory, get_entry_text ("patch_directory"), PATH_MAX);
|
||||
strncpy (config->cheat_directory, get_entry_text ("cheat_directory"), PATH_MAX);
|
||||
strncpy (config->export_directory, get_entry_text ("export_directory"), PATH_MAX);
|
||||
|
||||
if (!strcmp (safety_sram_directory, SAME_GAME))
|
||||
safety_sram_directory[0] = '\0';
|
||||
if (!strcmp (config->savestate_directory, SAME_GAME))
|
||||
config->savestate_directory[0] = '\0';
|
||||
if (!strcmp (config->patch_directory, SAME_GAME))
|
||||
config->patch_directory[0] = '\0';
|
||||
if (!strcmp (config->cheat_directory, SAME_GAME))
|
||||
config->cheat_directory[0] = '\0';
|
||||
if (!strcmp (config->export_directory, SAME_GAME))
|
||||
config->export_directory[0] = '\0';
|
||||
|
||||
if (strcmp (safety_sram_directory, config->sram_directory) && config->rom_loaded)
|
||||
{
|
||||
GtkWidget *msg;
|
||||
int responseid;
|
||||
|
||||
msg = gtk_message_dialog_new (GTK_WINDOW (this->window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_OK_CANCEL,
|
||||
_("Changing the SRAM directory with a game loaded will replace the .srm file in the selected directory with the SRAM from the running game. If this is not what you want, click 'cancel'."));
|
||||
gtk_window_set_title (GTK_WINDOW (msg), _("Warning: Possible File Overwrite"));
|
||||
|
||||
responseid = gtk_dialog_run (GTK_DIALOG (msg));
|
||||
|
||||
if (responseid == GTK_RESPONSE_OK)
|
||||
{
|
||||
strncpy (config->sram_directory, safety_sram_directory, PATH_MAX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config->sram_directory[0] == '\0')
|
||||
set_entry_text ("sram_directory", SAME_GAME);
|
||||
else
|
||||
set_entry_text ("sram_directory", config->sram_directory);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy (config->sram_directory, safety_sram_directory, PATH_MAX);
|
||||
}
|
||||
|
||||
if (Settings.SkipFrames == 0)
|
||||
Settings.SkipFrames = AUTO_FRAMERATE;
|
||||
|
@ -854,6 +1061,16 @@ Snes9xPreferences::show (void)
|
|||
gtk_widget_hide (get_widget ("resolution_box"));
|
||||
}
|
||||
|
||||
#ifdef USE_HQ2X
|
||||
combo = get_widget ("scale_method_combo");
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo),
|
||||
_("HQ2x"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo),
|
||||
_("HQ3x"));
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo),
|
||||
_("HQ4x"));
|
||||
#endif
|
||||
|
||||
combo = get_widget ("hw_accel");
|
||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo),
|
||||
_("None - Use software scaler"));
|
||||
|
@ -921,10 +1138,15 @@ Snes9xPreferences::show (void)
|
|||
config->save_config_file ();
|
||||
break;
|
||||
|
||||
default:
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
case GTK_RESPONSE_DELETE_EVENT:
|
||||
gtk_widget_hide (window);
|
||||
close_dialog = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,18 +2,13 @@
|
|||
#define __GTK_PREFERENCES_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
#include "gtk_s9x.h"
|
||||
#include "gtk_glade_window.h"
|
||||
#include "gtk_builder_window.h"
|
||||
|
||||
gboolean snes9x_preferences_open (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
gboolean snes9x_preferences_close (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
|
||||
class Snes9xPreferences : public GladeWindow
|
||||
class Snes9xPreferences : public GtkBuilderWindow
|
||||
{
|
||||
public:
|
||||
Snes9xPreferences (Snes9xConfig *config);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
void S9xPostRomInit (void);
|
||||
void S9xSyncSpeedFinish (void);
|
||||
static void S9xCheckPointerTimer (void);
|
||||
static gboolean S9xIdleFunc (gpointer data);
|
||||
static gboolean S9xScreenSaverCheckFunc (gpointer data);
|
||||
|
||||
|
@ -45,7 +46,6 @@ main (int argc, char *argv[])
|
|||
gdk_threads_init ();
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
glade_init ();
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, SNES9XLOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
@ -73,6 +73,11 @@ main (int argc, char *argv[])
|
|||
g_set_application_name ("Snes9x");
|
||||
|
||||
top_level = new Snes9xWindow (gui_config);
|
||||
|
||||
/* If we're going to fullscreen, do it before showing window to avoid flicker. */
|
||||
if ((gui_config->full_screen_on_open && rom_filename) || (gui_config->fullscreen))
|
||||
gtk_window_fullscreen (top_level->get_window ());
|
||||
|
||||
top_level->show ();
|
||||
|
||||
S9xInitDisplay (argc, argv);
|
||||
|
@ -97,7 +102,8 @@ main (int argc, char *argv[])
|
|||
|
||||
if (rom_filename)
|
||||
{
|
||||
top_level->try_open_rom (rom_filename);
|
||||
if (S9xOpenROM (rom_filename) && gui_config->full_screen_on_open)
|
||||
gtk_window_unfullscreen (top_level->get_window());
|
||||
}
|
||||
|
||||
memset (&sig_callback, 0, sizeof (struct sigaction));
|
||||
|
@ -334,6 +340,8 @@ S9xIdleFunc (gpointer data)
|
|||
if (syncing)
|
||||
S9xSyncSpeedFinish ();
|
||||
|
||||
S9xCheckPointerTimer ();
|
||||
|
||||
S9xProcessEvents (TRUE);
|
||||
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
|
@ -397,6 +405,7 @@ S9xParseArg (char **argv, int &i, int argc)
|
|||
{
|
||||
gui_config->scale_method = FILTER_SUPER2XSAI;
|
||||
}
|
||||
#ifdef USE_HQ2X
|
||||
else if (!strcasecmp (argv[i], "hq2x"))
|
||||
{
|
||||
gui_config->scale_method = FILTER_HQ2X;
|
||||
|
@ -409,6 +418,7 @@ S9xParseArg (char **argv, int &i, int argc)
|
|||
{
|
||||
gui_config->scale_method = FILTER_HQ4X;
|
||||
}
|
||||
#endif /* USE_HQ2X */
|
||||
else if (!strcasecmp (argv[i], "epx"))
|
||||
{
|
||||
gui_config->scale_method = FILTER_EPX;
|
||||
|
@ -597,6 +607,23 @@ S9xSyncSpeed (void)
|
|||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
S9xCheckPointerTimer (void)
|
||||
{
|
||||
if (!gui_config->pointer_is_visible)
|
||||
return;
|
||||
|
||||
gettimeofday (&now, NULL);
|
||||
|
||||
if (TIMER_DIFF (now, gui_config->pointer_timestamp) > 1000000)
|
||||
{
|
||||
top_level->hide_mouse_cursor ();
|
||||
gui_config->pointer_is_visible = FALSE;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Final exit point, issues exit (0) */
|
||||
void
|
||||
S9xExit (void)
|
||||
|
|
|
@ -30,15 +30,12 @@
|
|||
#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
#define SNES9X_GTK_AUTHORS "(c) Copyright 2007 - 2010 Brandon Wright (bearoso@gmail.com)"
|
||||
#define SNES9X_GTK_VERSION "79"
|
||||
#define SNES9X_GTK_AUTHORS "(c) 2007 - 2010 Brandon Wright (bearoso@gmail.com)"
|
||||
#define SNES9X_GTK_VERSION "81"
|
||||
|
||||
extern Snes9xWindow *top_level;
|
||||
extern Snes9xConfig *gui_config;
|
||||
|
||||
extern const char snes9x_glade[];
|
||||
extern const int snes9x_glade_size;
|
||||
|
||||
int S9xOpenROM (const char *filename);
|
||||
void S9xNoROMLoaded (void);
|
||||
void S9xROMLoaded (void);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <glade/glade-build.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#ifdef USE_XV
|
||||
#include <X11/extensions/XShm.h>
|
||||
|
@ -139,42 +139,7 @@ event_drawingarea_expose (GtkWidget *widget,
|
|||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
Snes9xWindow *window = (Snes9xWindow *) data;
|
||||
|
||||
if ((!window->config->rom_loaded || window->last_width < 0)
|
||||
&& window->last_width != SIZE_FLAG_DIRTY)
|
||||
{
|
||||
if (!(window->config->fullscreen) && !(window->maximized_state))
|
||||
{
|
||||
window->config->window_width = window->get_width ();
|
||||
window->config->window_height = window->get_height ();
|
||||
}
|
||||
|
||||
window->draw_background (event->area.x,
|
||||
event->area.y,
|
||||
event->area.width,
|
||||
event->area.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->last_width > 0 || !window->is_paused ())
|
||||
S9xDisplayRefresh (window->last_width, window->last_height);
|
||||
|
||||
if (!(window->config->fullscreen))
|
||||
{
|
||||
window->config->window_width = window->get_width ();
|
||||
window->config->window_height = window->get_height ();
|
||||
}
|
||||
|
||||
if (window->is_paused ()
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
|| NetPlay.Paused
|
||||
#endif
|
||||
)
|
||||
{
|
||||
S9xDeinitUpdate (window->last_width, window->last_height);
|
||||
}
|
||||
}
|
||||
((Snes9xWindow *) data)->expose (event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -195,14 +160,19 @@ event_key (GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||
}
|
||||
|
||||
/* Provide escape key to get out of fullscreen */
|
||||
if (event->keyval == GDK_Escape && event->type == GDK_KEY_RELEASE)
|
||||
if (event->keyval == GDK_Escape)
|
||||
{
|
||||
if (window->config->default_esc_behavior == ESC_EXIT_FULLSCREEN)
|
||||
window->leave_fullscreen_mode ();
|
||||
else if (window->config->default_esc_behavior == ESC_EXIT_SNES9X)
|
||||
S9xExit ();
|
||||
else
|
||||
window->toggle_ui ();
|
||||
if (event->type == GDK_KEY_RELEASE)
|
||||
{
|
||||
if (window->config->default_esc_behavior == ESC_EXIT_FULLSCREEN)
|
||||
window->leave_fullscreen_mode ();
|
||||
else if (window->config->default_esc_behavior == ESC_EXIT_SNES9X)
|
||||
S9xExit ();
|
||||
else
|
||||
window->toggle_ui ();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
keyval = event->keyval;
|
||||
|
@ -213,9 +183,16 @@ event_key (GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||
/* If no mapping for modifier version exists, try non-modifier */
|
||||
cmd = S9xGetMapping (b.hex ());
|
||||
if (cmd.type == S9xNoMapping)
|
||||
{
|
||||
b = Binding (event->keyval, false, false, false);
|
||||
cmd = S9xGetMapping (b.hex ());
|
||||
}
|
||||
|
||||
S9xReportButton (b.hex (), (event->type == GDK_KEY_PRESS));
|
||||
if (cmd.type != S9xNoMapping)
|
||||
{
|
||||
S9xReportButton (b.hex (), (event->type == GDK_KEY_PRESS));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE; /* Pass the key to GTK */
|
||||
}
|
||||
|
@ -235,8 +212,8 @@ event_motion_notify (GtkWidget *widget,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
c_width = GTK_WIDGET (window->drawing_area)->allocation.width;
|
||||
c_height = GTK_WIDGET (window->drawing_area)->allocation.height;
|
||||
c_width = window->get_width ();
|
||||
c_height = window->get_height ();
|
||||
|
||||
window->mouse_loc_x = (uint16)
|
||||
((int) (event->x) - window->mouse_region_x) * 256 /
|
||||
|
@ -246,6 +223,14 @@ event_motion_notify (GtkWidget *widget,
|
|||
((int) (event->y) - window->mouse_region_y) * SNES_HEIGHT_EXTENDED /
|
||||
(window->mouse_region_height <= 0 ? 1 : window->mouse_region_height);
|
||||
|
||||
if (!window->config->pointer_is_visible)
|
||||
{
|
||||
if (!S9xIsMousePluggedIn ())
|
||||
window->show_mouse_cursor ();
|
||||
}
|
||||
|
||||
gettimeofday (&(window->config->pointer_timestamp), NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -449,7 +434,7 @@ static void
|
|||
event_save_state (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
int slot;
|
||||
char *name = (char *) gtk_widget_get_name (widget);
|
||||
char *name = (char *) gtk_buildable_get_name (GTK_BUILDABLE (widget));
|
||||
|
||||
slot = atoi (&(name[11]));
|
||||
|
||||
|
@ -470,7 +455,7 @@ static void
|
|||
event_load_state (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
int slot;
|
||||
char *name = (char *) gtk_widget_get_name (widget);
|
||||
char *name = (char *) gtk_buildable_get_name (GTK_BUILDABLE (widget));
|
||||
|
||||
slot = atoi (&(name[11]));
|
||||
|
||||
|
@ -537,7 +522,7 @@ event_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data)
|
|||
static void
|
||||
event_port (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
const gchar *name = gtk_widget_get_name (widget);
|
||||
const gchar *name = gtk_buildable_get_name (GTK_BUILDABLE (widget));
|
||||
|
||||
if (!(gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))))
|
||||
return;
|
||||
|
@ -586,9 +571,9 @@ event_port (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
|
||||
GladeWindow (snes9x_glade, snes9x_glade_size, "main_window")
|
||||
GtkBuilderWindow ("main_window")
|
||||
{
|
||||
GladeWindowCallbacks callbacks[] =
|
||||
GtkBuilderWindowCallbacks callbacks[] =
|
||||
{
|
||||
{ "main_window_delete_event", G_CALLBACK (event_main_window_delete) },
|
||||
{ "main_window_state_event", G_CALLBACK (event_main_window_state_event) },
|
||||
|
@ -643,7 +628,8 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
|
|||
last_width = -1;
|
||||
last_height = -1;
|
||||
this->config = config;
|
||||
cursor = NULL;
|
||||
empty_cursor = NULL;
|
||||
default_cursor = NULL;
|
||||
recent_menu = NULL;
|
||||
fullscreen_state = 0;
|
||||
maximized_state = 0;
|
||||
|
@ -667,8 +653,8 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
|
|||
|
||||
gtk_widget_realize (window);
|
||||
gtk_widget_realize (GTK_WIDGET (drawing_area));
|
||||
gdk_window_set_back_pixmap (window->window, NULL, FALSE);
|
||||
gdk_window_set_back_pixmap (GTK_WIDGET (drawing_area)->window, NULL, FALSE);
|
||||
gdk_window_set_back_pixmap (gtk_widget_get_window (window), NULL, FALSE);
|
||||
gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (drawing_area)), NULL, FALSE);
|
||||
|
||||
gtk_check_menu_item_set_active (
|
||||
GTK_CHECK_MENU_ITEM (get_widget ("show_statusbar_item")),
|
||||
|
@ -690,11 +676,54 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
|
|||
config->window_height = 224;
|
||||
}
|
||||
|
||||
default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
|
||||
gdk_window_set_cursor (gtk_widget_get_window (window), default_cursor);
|
||||
|
||||
resize (config->window_width, config->window_height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
Snes9xWindow::expose (GdkEventExpose *event)
|
||||
{
|
||||
if (event && (!config->rom_loaded || last_width < 0) && last_width != SIZE_FLAG_DIRTY)
|
||||
{
|
||||
if (!(config->fullscreen) && !(maximized_state))
|
||||
{
|
||||
config->window_width = get_width ();
|
||||
config->window_height = get_height ();
|
||||
}
|
||||
|
||||
draw_background (event->area.x,
|
||||
event->area.y,
|
||||
event->area.width,
|
||||
event->area.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (last_width > 0 || !is_paused ())
|
||||
S9xDisplayRefresh (last_width, last_height);
|
||||
|
||||
if (!(config->fullscreen))
|
||||
{
|
||||
config->window_width = get_width ();
|
||||
config->window_height = get_height ();
|
||||
}
|
||||
|
||||
if (is_paused ()
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
|| NetPlay.Paused
|
||||
#endif
|
||||
)
|
||||
{
|
||||
S9xDeinitUpdate (last_width, last_height);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
Snes9xWindow::focus_notify (int state)
|
||||
{
|
||||
|
@ -720,7 +749,7 @@ void
|
|||
Snes9xWindow::open_multicart_dialog (void)
|
||||
{
|
||||
int result;
|
||||
GladeWindow *dialog = new GladeWindow (snes9x_glade, snes9x_glade_size, "multicart_dialog");
|
||||
GtkBuilderWindow *dialog = new GtkBuilderWindow ("multicart_dialog");
|
||||
GtkFileChooser *slota, *slotb;
|
||||
GtkWidget *multicart_dialog = GTK_WIDGET (dialog->get_window ());
|
||||
|
||||
|
@ -765,17 +794,16 @@ Snes9xWindow::open_multicart_dialog (void)
|
|||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
_("Couldn't load files."));
|
||||
gtk_window_set_title (GTK_WINDOW (msg), _("Error"));
|
||||
gtk_dialog_run (GTK_DIALOG (msg));
|
||||
gtk_widget_destroy (msg);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy (multicart_dialog);
|
||||
delete dialog;
|
||||
|
||||
unpause_from_focus_change ();
|
||||
|
||||
delete dialog;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -902,6 +930,7 @@ Snes9xWindow::try_open_rom (const char *filename)
|
|||
GTK_BUTTONS_CLOSE,
|
||||
_("Couldn't load file '%s'"),
|
||||
filename);
|
||||
gtk_window_set_title (GTK_WINDOW (msg), _("Error"));
|
||||
gtk_dialog_run (GTK_DIALOG (msg));
|
||||
gtk_widget_destroy (msg);
|
||||
|
||||
|
@ -1014,50 +1043,28 @@ Snes9xWindow::load_state_dialog ()
|
|||
void
|
||||
Snes9xWindow::movie_seek_dialog (void)
|
||||
{
|
||||
GladeXML *seek_dialog_xml;
|
||||
GtkWidget *seek_dialog;
|
||||
char str[1024];
|
||||
gint result;
|
||||
|
||||
if (!S9xMovieActive ())
|
||||
return;
|
||||
|
||||
GtkBuilderWindow *seek_dialog = new GtkBuilderWindow ("frame_advance_dialog");
|
||||
GtkWindow *seek_window = seek_dialog->get_window ();
|
||||
|
||||
pause_from_focus_change ();
|
||||
|
||||
seek_dialog_xml = glade_xml_new_from_buffer (snes9x_glade,
|
||||
snes9x_glade_size,
|
||||
"frame_advance_dialog",
|
||||
NULL);
|
||||
snprintf (str, 1024, _("The current frame in the movie is <b>%d</b>."), S9xMovieGetFrameCounter ());
|
||||
gtk_label_set_label (GTK_LABEL (seek_dialog->get_widget ("current_frame_label")), str);
|
||||
|
||||
seek_dialog = glade_xml_get_widget (seek_dialog_xml,
|
||||
"frame_advance_dialog");
|
||||
snprintf (str, 1024, "%d", S9xMovieGetFrameCounter ());
|
||||
seek_dialog->set_entry_text ("frame_entry", str);
|
||||
|
||||
snprintf (str, 1024,
|
||||
_("The current frame in the movie is <b>%d</b>."),
|
||||
S9xMovieGetFrameCounter ());
|
||||
gtk_label_set_label (GTK_LABEL (
|
||||
glade_xml_get_widget (seek_dialog_xml,
|
||||
"current_frame_label")),
|
||||
str);
|
||||
gtk_window_set_transient_for (seek_window, get_window ());
|
||||
|
||||
snprintf (str, 1024,
|
||||
"%d",
|
||||
S9xMovieGetFrameCounter ());
|
||||
gtk_entry_set_text (GTK_ENTRY (glade_xml_get_widget (seek_dialog_xml,
|
||||
"frame_entry")),
|
||||
str);
|
||||
result = gtk_dialog_run (GTK_DIALOG (seek_window));
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (seek_dialog),
|
||||
get_window ());
|
||||
|
||||
result = gtk_dialog_run (GTK_DIALOG (seek_dialog));
|
||||
|
||||
int entry_value =
|
||||
atoi (
|
||||
gtk_entry_get_text (
|
||||
GTK_ENTRY (
|
||||
glade_xml_get_widget (
|
||||
seek_dialog_xml, "frame_entry"))));
|
||||
int entry_value = seek_dialog->get_entry_value ("frame_entry");
|
||||
|
||||
switch (result)
|
||||
{
|
||||
|
@ -1073,7 +1080,7 @@ Snes9xWindow::movie_seek_dialog (void)
|
|||
break;
|
||||
}
|
||||
|
||||
gtk_widget_destroy (seek_dialog);
|
||||
delete seek_dialog;
|
||||
|
||||
unpause_from_focus_change ();
|
||||
|
||||
|
@ -1222,6 +1229,7 @@ Snes9xWindow::save_spc_dialog ()
|
|||
GTK_BUTTONS_CLOSE,
|
||||
_("Couldn't save SPC file '%s'"),
|
||||
filename);
|
||||
gtk_window_set_title (GTK_WINDOW (msg), _("Error"));
|
||||
gtk_dialog_run (GTK_DIALOG (msg));
|
||||
gtk_widget_destroy (msg);
|
||||
}
|
||||
|
@ -1270,7 +1278,7 @@ Snes9xWindow::show_status_message (const char *message)
|
|||
gtk_statusbar_pop (statusbar, gtk_statusbar_get_context_id (statusbar, "info"));
|
||||
gtk_statusbar_push (statusbar, gtk_statusbar_get_context_id (statusbar, "info"), message);
|
||||
|
||||
g_timeout_add_seconds (2, statusbar_timeout, statusbar);
|
||||
g_timeout_add (2000, statusbar_timeout, statusbar);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1342,7 +1350,7 @@ Snes9xWindow::show_rom_info (void)
|
|||
|
||||
msg = gtk_message_dialog_new_with_markup (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_MESSAGE_OTHER,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
_("<b>Information for %s</b>\n\n"
|
||||
"<i>Name:</i> %s\n"
|
||||
|
@ -1384,6 +1392,7 @@ Snes9xWindow::show_rom_info (void)
|
|||
Memory.CalculatedChecksum) ?
|
||||
_("\n\nThis ROM has been modified or damaged")
|
||||
: "");
|
||||
gtk_window_set_title (GTK_WINDOW (msg), _("File Information"));
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (msg));
|
||||
|
||||
|
@ -1463,13 +1472,13 @@ Snes9xWindow::configure_widgets (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (config->rom_loaded)
|
||||
propagate_pause_state ();
|
||||
|
||||
if (config->rom_loaded && !Settings.Paused)
|
||||
hide_mouse_cursor ();
|
||||
else
|
||||
show_mouse_cursor ();
|
||||
|
||||
propagate_pause_state ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1487,19 +1496,10 @@ Snes9xWindow::set_mouseable_area (int x, int y, int width, int height)
|
|||
void
|
||||
Snes9xWindow::reset_screensaver (void)
|
||||
{
|
||||
static int xdg_screen_saver_works = TRUE;
|
||||
|
||||
if (!focused)
|
||||
return;
|
||||
|
||||
/* XTest method breaks in new X.org */
|
||||
if (!xdg_screen_saver_works ||
|
||||
!g_spawn_command_line_async ("/usr/bin/xdg-screensaver reset", NULL))
|
||||
{
|
||||
xdg_screen_saver_works = FALSE;
|
||||
}
|
||||
|
||||
XResetScreenSaver (GDK_DISPLAY ());
|
||||
XResetScreenSaver (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
|
||||
|
||||
config->screensaver_needs_reset = FALSE;
|
||||
|
||||
|
@ -1523,8 +1523,6 @@ Snes9xWindow::enter_fullscreen_mode (void)
|
|||
if (config->fullscreen)
|
||||
return;
|
||||
|
||||
S9xSoundStop ();
|
||||
|
||||
config->rom_loaded = 0;
|
||||
|
||||
nfs_width = config->window_width;
|
||||
|
@ -1556,7 +1554,7 @@ Snes9xWindow::enter_fullscreen_mode (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
Display *display = gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (window->window));
|
||||
Display *display = gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (gtk_widget_get_window (window)));
|
||||
GdkScreen *screen = gtk_widget_get_screen (window);
|
||||
GdkWindow *root = gdk_screen_get_root_window (screen);
|
||||
|
||||
|
@ -1572,9 +1570,7 @@ Snes9xWindow::enter_fullscreen_mode (void)
|
|||
#endif
|
||||
|
||||
gdk_display_sync (gdk_display_get_default ());
|
||||
gdk_window_raise (GTK_WIDGET (window)->window);
|
||||
|
||||
S9xSoundStart ();
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
||||
config->fullscreen = 1;
|
||||
config->rom_loaded = rom_loaded;
|
||||
|
@ -1596,8 +1592,6 @@ Snes9xWindow::leave_fullscreen_mode (void)
|
|||
if (!config->fullscreen)
|
||||
return;
|
||||
|
||||
S9xSoundStop ();
|
||||
|
||||
config->rom_loaded = 0;
|
||||
|
||||
#ifdef USE_XRANDR
|
||||
|
@ -1605,7 +1599,7 @@ Snes9xWindow::leave_fullscreen_mode (void)
|
|||
{
|
||||
gtk_widget_hide (window);
|
||||
|
||||
Display *display = gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (window->window));
|
||||
Display *display = gdk_x11_drawable_get_xdisplay (GDK_DRAWABLE (gtk_widget_get_window (window)));
|
||||
GdkScreen *screen = gtk_widget_get_screen (window);
|
||||
GdkWindow *root = gdk_screen_get_root_window (screen);
|
||||
|
||||
|
@ -1630,8 +1624,6 @@ Snes9xWindow::leave_fullscreen_mode (void)
|
|||
resize (nfs_width, nfs_height);
|
||||
gtk_window_move (GTK_WINDOW (window), nfs_x, nfs_y);
|
||||
|
||||
S9xSoundStart ();
|
||||
|
||||
config->rom_loaded = rom_loaded;
|
||||
|
||||
config->fullscreen = 0;
|
||||
|
@ -1645,14 +1637,19 @@ void
|
|||
Snes9xWindow::draw_background (int rect_x, int rect_y, int rect_w, int rect_h)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (drawing_area);
|
||||
GdkGC *gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
|
||||
int w = widget->allocation.width;
|
||||
int h = widget->allocation.height;
|
||||
GdkColor sel = widget->style->bg[GTK_STATE_SELECTED];
|
||||
GtkAllocation allocation;
|
||||
GdkColor sel;
|
||||
int w,h;
|
||||
cairo_pattern_t *pattern;
|
||||
cairo_t *cr;
|
||||
GdkRectangle rect;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
w = allocation.width;
|
||||
h = allocation.height;
|
||||
|
||||
sel = gtk_widget_get_style (widget)->bg[GTK_STATE_SELECTED];
|
||||
|
||||
if (rect_x < 0)
|
||||
{
|
||||
rect.x = 0;
|
||||
|
@ -1668,10 +1665,10 @@ Snes9xWindow::draw_background (int rect_x, int rect_y, int rect_w, int rect_h)
|
|||
rect.height = rect_h;
|
||||
}
|
||||
|
||||
gdk_window_begin_paint_rect (widget->window, &rect);
|
||||
gdk_window_begin_paint_rect (gtk_widget_get_window (widget), &rect);
|
||||
|
||||
/* Draw a fancy-pants gradient */
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
pattern = cairo_pattern_create_linear (0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
|
@ -1695,30 +1692,31 @@ Snes9xWindow::draw_background (int rect_x, int rect_y, int rect_w, int rect_h)
|
|||
(double) rect.height);
|
||||
|
||||
cairo_clip (cr);
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
|
||||
cairo_rectangle (cr, 0.0, 0.0, (double) w, (double) h);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
/* Put the Snes9x logo in the center */
|
||||
gdk_draw_pixbuf (widget->window,
|
||||
gc,
|
||||
splash,
|
||||
0,
|
||||
0,
|
||||
gdk_cairo_set_source_pixbuf (cr, splash,
|
||||
(w - gdk_pixbuf_get_width (splash)) / 2,
|
||||
(h - gdk_pixbuf_get_height (splash)) / 2);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
(w - gdk_pixbuf_get_width (splash)) / 2,
|
||||
(h - gdk_pixbuf_get_height (splash)) / 2,
|
||||
gdk_pixbuf_get_width (splash),
|
||||
gdk_pixbuf_get_height (splash),
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0,
|
||||
0);
|
||||
gdk_pixbuf_get_height (splash));
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_pattern_destroy (pattern);
|
||||
cairo_destroy (cr);
|
||||
|
||||
gdk_window_end_paint (widget->window);
|
||||
gdk_window_end_paint (gtk_widget_get_window (widget));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1726,14 +1724,17 @@ Snes9xWindow::draw_background (int rect_x, int rect_y, int rect_w, int rect_h)
|
|||
void
|
||||
Snes9xWindow::resize_viewport (int width, int height)
|
||||
{
|
||||
GtkWidget *item;
|
||||
int y_padding = 0;
|
||||
GtkWidget *item;
|
||||
GtkAllocation allocation;
|
||||
int y_padding = 0;
|
||||
|
||||
item = get_widget ("menubar");
|
||||
y_padding += GTK_WIDGET_VISIBLE (item) ? item->allocation.height : 0;
|
||||
gtk_widget_get_allocation (item, &allocation);
|
||||
y_padding += gtk_widget_get_visible (item) ? allocation.height : 0;
|
||||
|
||||
item = get_widget ("statusbar");
|
||||
y_padding += GTK_WIDGET_VISIBLE (item) ? item->allocation.height : 0;
|
||||
gtk_widget_get_allocation (item, &allocation);
|
||||
y_padding += gtk_widget_get_visible (item) ? allocation.height : 0;
|
||||
|
||||
resize (width, height + y_padding);
|
||||
|
||||
|
@ -1743,29 +1744,14 @@ Snes9xWindow::resize_viewport (int width, int height)
|
|||
void
|
||||
Snes9xWindow::hide_mouse_cursor (void)
|
||||
{
|
||||
GdkPixmap *cursor_pixmap;
|
||||
GdkGC *gc;
|
||||
GdkColor fg = { 0, 0, 0, 0 };
|
||||
GdkColor bg = { 0, 0, 0, 0 };
|
||||
|
||||
if (!cursor)
|
||||
if (!empty_cursor)
|
||||
{
|
||||
cursor_pixmap = gdk_pixmap_new (NULL, 1, 1, 1);
|
||||
gc = gdk_gc_new (GDK_DRAWABLE (cursor_pixmap));
|
||||
gdk_gc_set_foreground (gc, &fg);
|
||||
gdk_draw_point (GDK_DRAWABLE (cursor_pixmap),
|
||||
gc,
|
||||
0, 0);
|
||||
|
||||
cursor = gdk_cursor_new_from_pixmap (cursor_pixmap,
|
||||
cursor_pixmap,
|
||||
&fg, &bg,
|
||||
0, 0);
|
||||
g_object_unref (gc);
|
||||
g_object_unref (cursor_pixmap);
|
||||
empty_cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
|
||||
}
|
||||
|
||||
gdk_window_set_cursor (GTK_WIDGET (drawing_area)->window, cursor);
|
||||
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (drawing_area)),
|
||||
empty_cursor);
|
||||
config->pointer_is_visible = FALSE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1773,7 +1759,9 @@ Snes9xWindow::hide_mouse_cursor (void)
|
|||
void
|
||||
Snes9xWindow::show_mouse_cursor (void)
|
||||
{
|
||||
gdk_window_set_cursor (GTK_WIDGET (drawing_area)->window, NULL);
|
||||
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (drawing_area)),
|
||||
NULL);
|
||||
config->pointer_is_visible = TRUE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1806,6 +1794,8 @@ Snes9xWindow::show (void)
|
|||
"item-activated",
|
||||
G_CALLBACK (event_recent_open),
|
||||
(gpointer) this);
|
||||
|
||||
gtk_widget_show (recent_menu);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1826,8 +1816,6 @@ Snes9xWindow::propagate_pause_state (void)
|
|||
if (config->rom_loaded)
|
||||
enable_widget ("pause_item", TRUE);
|
||||
|
||||
hide_mouse_cursor ();
|
||||
|
||||
S9xDisplayClearBuffers ();
|
||||
}
|
||||
else
|
||||
|
@ -1835,11 +1823,12 @@ Snes9xWindow::propagate_pause_state (void)
|
|||
S9xSoundStop ();
|
||||
enable_widget ("pause_item", FALSE);
|
||||
|
||||
show_mouse_cursor ();
|
||||
}
|
||||
|
||||
configure_widgets ();
|
||||
update_statusbar ();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1907,6 +1896,7 @@ Snes9xWindow::set_menu_item_accel_to_binding (const char *name,
|
|||
{
|
||||
Binding bin;
|
||||
char str[255];
|
||||
GtkAccelGroup *accel_group = NULL;
|
||||
|
||||
if (!strcmp (binding, "Escape Key"))
|
||||
{
|
||||
|
@ -1927,10 +1917,19 @@ Snes9xWindow::set_menu_item_accel_to_binding (const char *name,
|
|||
return;
|
||||
}
|
||||
|
||||
gtk_widget_set_accel_path (get_widget (name),
|
||||
str,
|
||||
glade_xml_ensure_accel (glade));
|
||||
GSList *accel_group_list = gtk_accel_groups_from_object (G_OBJECT (window));
|
||||
|
||||
if (accel_group_list)
|
||||
{
|
||||
accel_group = GTK_ACCEL_GROUP (accel_group_list->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
||||
}
|
||||
|
||||
gtk_widget_set_accel_path (get_widget (name), str, accel_group);
|
||||
|
||||
if (!gtk_accel_map_lookup_entry (str, NULL))
|
||||
{
|
||||
|
|
|
@ -7,15 +7,13 @@
|
|||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <glade/glade.h>
|
||||
|
||||
#include "gtk_s9x.h"
|
||||
#include "gtk_glade_window.h"
|
||||
#include "gtk_builder_window.h"
|
||||
|
||||
#define SIZE_FLAG_NO_DRAWING -1
|
||||
#define SIZE_FLAG_DIRTY -2
|
||||
|
||||
class Snes9xWindow : public GladeWindow
|
||||
class Snes9xWindow : public GtkBuilderWindow
|
||||
{
|
||||
public:
|
||||
Snes9xWindow (Snes9xConfig *config);
|
||||
|
@ -67,6 +65,7 @@ class Snes9xWindow : public GladeWindow
|
|||
void update_accels (void);
|
||||
void toggle_ui (void);
|
||||
void resize_viewport (int width, int height);
|
||||
void expose (GdkEventExpose *event);
|
||||
|
||||
Snes9xConfig *config;
|
||||
unsigned char user_pause;
|
||||
|
@ -81,7 +80,7 @@ class Snes9xWindow : public GladeWindow
|
|||
int paused_from_focus_loss;
|
||||
uint16 mouse_loc_x, mouse_loc_y;
|
||||
GdkPixbuf *icon, *splash;
|
||||
GdkCursor *cursor;
|
||||
GdkCursor *default_cursor, *empty_cursor;
|
||||
GtkDrawingArea *drawing_area;
|
||||
GtkWidget *recent_menu;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,7 +32,7 @@ main (int argc,
|
|||
"int %s_size = %d;\n\n",
|
||||
argv[3],
|
||||
(int) file_info.st_size);
|
||||
fprintf (outfile, "char %s [] = \n{\n ", argv[3]);
|
||||
fprintf (outfile, "unsigned char %s [] = \n{\n ", argv[3]);
|
||||
|
||||
counter = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue