Removed GXVideo plugin as per original author suggestion.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@77475 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\dario86_cp 2012-04-14 11:39:27 +00:00
parent bebb814b15
commit 4bf6253973
28 changed files with 0 additions and 16276 deletions

View File

@ -4,8 +4,6 @@ SUBDIRS += plugins/dfxvideo plugins/dfcdrom plugins/dfnet
SUBDIRS += plugins/bladesio1
SUBDIRS += $(GXVIDEO)
SUBDIRS += $(PEOPSXGL)
EXTRA_DIST = AUTHORS COPYING INSTALL NEWS README ChangeLog ChangeLog.df strip_fPIC.sh

View File

@ -146,17 +146,6 @@ if test "$BUILD_OPENGL" = "yes"; then
AC_CONFIG_FILES([plugins/peopsxgl/Makefile])
fi
AC_ARG_ENABLE(gxvideo, [ --enable-gxvideo build gxvideo plugin (default=no)],
[ BUILD_GXVIDEO="$enableval" ],[ BUILD_GXVIDEO="no" ])
GXVIDEO=""
if test "$BUILD_GXVIDEO" = "yes"; then
GXVIDEO="plugins/gxvideo"
AC_SUBST(GXVIDEO)
AC_CONFIG_FILES([plugins/gxvideo/Makefile])
fi
AM_CONDITIONAL(X86_NASM, false)
if expr x"$build_cpu" : 'xi.86' > /dev/null; then

View File

@ -1,39 +0,0 @@
STRIP_FPIC = sh $(top_srcdir)/strip_fPIC.sh
SUFFIXES = .asm
.asm.lo:
$(LIBTOOL) --tag=CC --mode=compile \
$(STRIP_FPIC) $(NASM) -f elf -d ELF -I${srcdir}/ $<
AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
-DDATADIR=\"${datadir}/psemu/\" \
$(GTK2_CFLAGS) $(GLADE2_CFLAGS) \
-I../../libpcsxcore \
-I../../include
bindir = @libdir@/games/psemu/
libdir = @libdir@/games/psemu/
noinst_LTLIBRARIES = libcfg.la libglobals.la
libcfg_la_SOURCES = cfg.c cfg.h globals.h
libglobals_la_SOURCES = globals.c
lib_LTLIBRARIES = libGXVideo.la
libGXVideo_la_SOURCES = gpu.c gpu.h draw.c draw.h fps.c fps.h key.c key.h menu.c menu.h prim.c prim.h soft.c soft.h gpu_utils.h interp.h swap.h
if X86_NASM
libGXVideo_la_SOURCES += i386.asm macros.inc
AM_CPPFLAGS += -DUSE_NASM=1
endif
libGXVideo_la_LDFLAGS = -module -avoid-version
libGXVideo_la_LIBADD = libcfg.la libglobals.la -lX11 -lXv -lXext -lm
bin_PROGRAMS = cfgGXVideo
cfgGXVideo_SOURCES = gpucfg/main.c
cfgGXVideo_LDADD = libcfg.la libglobals.la $(GTK2_LIBS) $(GLADE2_LIBS) -lXext
glade_DATA = gpucfg/gxvideo.glade
gladedir = $(datadir)/psemu/
EXTRA_DIST = $(glade_DATA)

View File

@ -1,261 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "globals.h"
#include "cfg.h"
#define DEFAULT_CFG_NAME "gxvideo.cfg"
int get_int_value (char const * file_buffer, char const * name, int dflt) {
char * p = strstr(file_buffer, name);
if (p != NULL) {
p += strlen(name);
while ((*p == ' ') || (*p == '='))
++p;
if (*p != '\n')
return atoi(p);
}
return dflt;
}
double get_double_value(char const * file_buffer, char const * name,
double dflt) {
char * p = strstr(file_buffer, name);
if (p != NULL) {
p += strlen(name);
while ((*p == ' ') || (*p == '='))
++p;
if (*p != '\n')
return atof(p);
}
return dflt;
}
void write_int_value (FILE * f, char const * name, int val) {
fprintf(f, "%s = %d\n", name, val);
}
void write_double_value (FILE * f, char const * name, double val) {
fprintf(f, "%s = %.1f\n", name, val);
}
void ReadConfigFile() {
struct stat buf;
FILE * f_in;
char cfg_file_name[256];
int len, size;
char * file_buffer;
if (g_file_name)
strcpy(cfg_file_name, g_file_name);
else {
strcpy(cfg_file_name, DEFAULT_CFG_NAME);
f_in = fopen(cfg_file_name, "rb");
if (!f_in) {
strcpy(cfg_file_name, "cfg/" DEFAULT_CFG_NAME);
f_in = fopen(cfg_file_name, "rb");
if (!f_in)
snprintf(cfg_file_name, 255, "%s/.pcsxr/plugins/" DEFAULT_CFG_NAME, getenv("HOME"));
else
fclose(f_in);
} else
fclose(f_in);
}
if (stat(cfg_file_name, &buf) == -1)
return;
size = buf.st_size;
f_in = fopen(cfg_file_name, "rb");
if (!f_in)
return;
file_buffer = (char *) malloc(size + 1);
len = fread(file_buffer, 1, size, f_in);
/* ensure end_of_string */
file_buffer[len] = 0;
fclose(f_in);
g_cfg.ResX = get_int_value(file_buffer, "ResX", g_cfg.ResX);
if (g_cfg.ResX < 20)
g_cfg.ResX = 20;
g_cfg.ResX = (g_cfg.ResX / 4) * 4;
g_cfg.ResY = get_int_value(file_buffer, "ResY", g_cfg.ResY);
if (g_cfg.ResY < 20)
g_cfg.ResY = 20;
g_cfg.ResY = (g_cfg.ResY / 4) * 4;
g_cfg.Dithering = get_int_value(file_buffer, "Dithering", g_cfg.Dithering);
g_cfg.FullScreen = get_int_value(file_buffer, "FullScreen", g_cfg.FullScreen);
g_cfg.ShowFPS = get_int_value(file_buffer, "ShowFPS", g_cfg.ShowFPS);
if (g_cfg.ShowFPS < 0)
g_cfg.ShowFPS = 0;
if (g_cfg.ShowFPS > 1)
g_cfg.ShowFPS = 1;
g_cfg.Maintain43 = get_int_value(file_buffer, "Maintain43", g_cfg.Maintain43);
if (g_cfg.Maintain43 < 0)
g_cfg.Maintain43 = 0;
if (g_cfg.Maintain43 > 1)
g_cfg.Maintain43 = 1;
g_cfg.UseFrameLimit = get_int_value(file_buffer, "UseFrameLimit", g_cfg.UseFrameLimit);
if (g_cfg.UseFrameLimit < 0)
g_cfg.UseFrameLimit = 0;
if (g_cfg.UseFrameLimit > 1)
g_cfg.UseFrameLimit = 1;
g_cfg.UseFrameSkip = 0;
g_cfg.FPSDetection = get_int_value(file_buffer, "FPSDetection", g_cfg.FPSDetection);
if (g_cfg.FPSDetection < 1)
g_cfg.FPSDetection = 1;
if (g_cfg.FPSDetection > 2)
g_cfg.FPSDetection = 2;
g_cfg.FrameRate = get_double_value(file_buffer, "FrameRate", g_cfg.FrameRate);
g_cfg.FrameRate /= 10;
if (g_cfg.FrameRate < 10.0f)
g_cfg.FrameRate = 10.0f;
if (g_cfg.FrameRate > 1000.0f)
g_cfg.FrameRate = 1000.0f;
g_cfg.CfgFixes = get_int_value(file_buffer, "CfgFixes", g_cfg.CfgFixes);
g_cfg.UseFixes = get_int_value(file_buffer, "UseFixes", g_cfg.UseFixes);
if (g_cfg.UseFixes < 0)
g_cfg.UseFixes = 0;
if (g_cfg.UseFixes > 1)
g_cfg.UseFixes = 1;
free(file_buffer);
}
void ExecCfg(char const * arg) {
char cfg[256];
struct stat buf;
strcpy(cfg, "./cfgGXVideo");
if (stat(cfg, &buf) != -1) {
if (fork() == 0) {
execl(cfg, "cfgGXVideo", arg, NULL);
exit(0);
}
return;
}
strcpy(cfg, "./cfg/cfgGXVideo");
if (stat(cfg, &buf) != -1) {
if (fork() == 0) {
execl(cfg, "cfgGXVideo", arg, NULL);
exit(0);
}
return;
}
sprintf(cfg, "%s/.pcsxr/plugins/cfg/cfgGXVideo", getenv("HOME"));
if (stat(cfg, &buf) != -1) {
if (fork() == 0) {
execl(cfg, "cfgGXVideo", arg, NULL);
exit(0);
}
return;
}
printf("ERROR: cfgGXVideo file not found!\n");
}
void SoftDlgProc(void) {
ExecCfg("CFG");
}
void AboutDlgProc(void) {
char args[256];
sprintf(args, "ABOUT");
ExecCfg(args);
}
void ReadConfig(void) {
/* set defaults */
g_cfg.ResX = 640;
g_cfg.ResY = 480;
g_cfg.NoStretch = 0;
g_cfg.Dithering = 0;
g_cfg.FullScreen = 0;
g_cfg.ShowFPS = 0;
g_cfg.Maintain43 = 0;
g_cfg.UseFrameLimit = 1;
g_cfg.UseFrameSkip = 0;
g_cfg.FPSDetection = 1;
g_cfg.FrameRate = 200.0;
g_cfg.CfgFixes = 0;
g_cfg.UseFixes = 0;
// read sets
ReadConfigFile();
}
void WriteConfig(void) {
FILE *f_out;
char cfg_file_name[256];
if (g_file_name)
strcpy(cfg_file_name, g_file_name);
else {
strcpy(cfg_file_name, DEFAULT_CFG_NAME);
f_out = fopen(cfg_file_name, "rb");
if (!f_out) {
strcpy(cfg_file_name, "cfg/" DEFAULT_CFG_NAME);
f_out = fopen(cfg_file_name, "rb");
if (!f_out)
snprintf(cfg_file_name, 255, "%s/.pcsxr/plugins/" DEFAULT_CFG_NAME, getenv("HOME"));
else
fclose(f_out);
} else
fclose(f_out);
}
f_out = fopen(cfg_file_name, "wb");
if (!f_out)
return;
#define WRITE_VALUE(type, name) write_##type##_value(f_out, #name, g_cfg.name)
WRITE_VALUE(int, ResX);
WRITE_VALUE(int, ResY);
WRITE_VALUE(int, NoStretch);
WRITE_VALUE(int, Dithering);
WRITE_VALUE(int, FullScreen);
WRITE_VALUE(int, ShowFPS);
WRITE_VALUE(int, Maintain43);
WRITE_VALUE(int, UseFrameLimit);
WRITE_VALUE(int, UseFrameSkip);
WRITE_VALUE(int, FPSDetection);
WRITE_VALUE(double, FrameRate);
WRITE_VALUE(int, CfgFixes);
WRITE_VALUE(int, UseFixes);
fclose(f_out);
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef _GPU_CFG_H_
#define _GPU_CFG_H_
#include <stdint.h>
typedef struct {
int ResX;
int ResY;
int NoStretch;
int Dithering;
int FullScreen;
int ShowFPS;
int Maintain43;
int UseFrameLimit;
int UseFrameSkip;
int FPSDetection;
double FrameRate;
int CfgFixes;
int UseFixes;
int video_output;
} gxv_cfg_t;
void ReadConfig(void);
void WriteConfig(void);
void ReadWinSizeConfig(void);
void SoftDlgProc(void);
void AboutDlgProc(void);
#endif

View File

@ -1,757 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <sys/shm.h>
#include <X11/cursorfont.h>
#include "globals.h"
#include "swap.h"
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
enum {
GXV_YUV_PORT = 0, GXV_RGB_PORT = 1, GXV_MAX_PORT = 2,
};
gxv_blit_t available_port[GXV_MAX_PORT];
/* Convert RGB to YUV */
inline uint32_t rgb_to_yuv(uint8_t R, uint8_t G, uint8_t B) {
uint8_t Y, U, V;
Y = abs(R * 2104 + G * 4130 + B * 802 + 4096 + 131072) >> 13;
Y = MIN(Y, 235);
U = abs(R * -1214 + G * -2384 + B * 3598 + 4096 + 1048576) >> 13;
U = MIN(U, 240);
V = abs(R * 3598 + G * -3013 + B * -585 + 4096 + 1048576) >> 13;
V = MIN(V, 240);
return Y << 24 | V << 16 | Y << 8 | U;
}
inline uint32_t rgb_to_yuv2(uint8_t R0, uint8_t G0, uint8_t B0, uint8_t R1,
uint8_t G1, uint8_t B1) {
int32_t Y0, U0, V0;
int32_t Y1, U1, V1;
int32_t U, V;
Y0 = abs(R0 * 2104 + G0 * 4130 + B0 * 802 + 4096 + 131072) >> 13;
Y0 = MIN(Y0, 235);
U0 = abs(R0 * -1214 + G0 * -2384 + B0 * 3598 + 4096 + 1048576) >> 13;
U0 = MIN(U0, 240);
V0 = abs(R0 * 3598 + G0 * -3013 + B0 * -585 + 4096 + 1048576) >> 13;
V0 = MIN(V0, 240);
Y1 = abs(R1 * 2104 + G1 * 4130 + B1 * 802 + 4096 + 131072) >> 13;
Y1 = MIN(Y1, 235);
U1 = abs(R1 * -1214 + G1 * -2384 + B1 * 3598 + 4096 + 1048576) >> 13;
U1 = MIN(U1, 240);
V1 = abs(R1 * 3598 + G1 * -3013 + B1 * -585 + 4096 + 1048576) >> 13;
V1 = MIN(V1, 240);
U = (U0 + U1) / 2;
V = (V0 + V1) / 2;
return Y1 << 24 | V << 16 | Y0 << 8 | U;
}
#define colorMask8 0x00FEFEFE
#define lowPixelMask8 0x00010101
#define qcolorMask8 0x00FCFCFC
#define qlowpixelMask8 0x00030303
static Atom xv_intern_atom_if_exists(Display *display, char const * atom_name) {
XvAttribute * attributes;
int attrib_count, i;
Atom xv_atom = None;
attributes = XvQueryPortAttributes(display, g_draw.xv_port, &attrib_count);
if (attributes != NULL) {
for (i = 0; i < attrib_count; ++i) {
if (strcmp(attributes[i].name, atom_name) == 0) {
xv_atom = XInternAtom(display, atom_name, False);
break; // found what we want, break out
}
}
XFree(attributes);
}
return xv_atom;
}
// close display
void DestroyDisplay(void) {
if (g_draw.display) {
XFreeColormap(g_draw.display, g_draw.colormap);
if (g_draw.hGC) {
XFreeGC(g_draw.display, g_draw.hGC);
g_draw.hGC = 0;
}
if (g_draw.Ximage) {
XDestroyImage(g_draw.Ximage);
g_draw.Ximage = 0;
}
if (g_draw.XCimage) {
XFree(g_draw.XCimage);
g_draw.XCimage = 0;
}
if (g_draw.XFimage) {
XDestroyImage(g_draw.XFimage);
g_draw.XFimage = 0;
}
XShmDetach(g_draw.display, &g_draw.shminfo);
shmdt(g_draw.shminfo.shmaddr);
shmctl(g_draw.shminfo.shmid, IPC_RMID, NULL);
Atom atom_vsync = xv_intern_atom_if_exists(g_draw.display,
"XV_SYNC_TO_VBLANK");
if (atom_vsync != None) {
XvSetPortAttribute(g_draw.display, g_draw.xv_port, atom_vsync,
g_draw.xv_vsync);
}
XSync(g_draw.display, False);
XCloseDisplay(g_draw.display);
}
}
// Create display
void create_display(void) {
//fprintf(stderr, "Entering %s\n", __FUNCTION__);
XSetWindowAttributes winattr;
int myscreen;
Screen * screen;
XEvent event;
XSizeHints hints;
XWMHints wm_hints;
MotifWmHints mwmhints;
Atom mwmatom;
Atom delwindow;
XGCValues gcv;
int i;
int ret, j, p;
int formats;
unsigned int p_num_adaptors = 0, p_num_ports = 0;
XvAdaptorInfo *ai;
XvImageFormatValues *fo;
// Open display
g_draw.display = XOpenDisplay(NULL);
if (!g_draw.display) {
fprintf(stderr, "Failed to open display!!!\n");
DestroyDisplay();
return;
}
myscreen = DefaultScreen(g_draw.display);
// desktop fullscreen switch
if (g_cfg.FullScreen)
g_draw.fx = 1;
screen = DefaultScreenOfDisplay(g_draw.display);
g_draw.root_window_id = RootWindow(g_draw.display, myscreen);
//Look for an Xvideo RGB port
ret = XvQueryAdaptors(g_draw.display, g_draw.root_window_id,
&p_num_adaptors, &ai);
if (ret != Success) {
if (ret == XvBadExtension)
fprintf(stderr, "XvBadExtension returned at XvQueryExtension.\n");
else if (ret == XvBadAlloc)
fprintf(stderr, "XvBadAlloc returned at XvQueryExtension.\n");
else
fprintf(stderr, "other error happaned at XvQueryAdaptors.\n");
exit(EXIT_FAILURE);
}
g_draw.depth = DefaultDepth(g_draw.display, myscreen);
g_draw.xv_id = -1;
g_draw.xv_port = -1;
g_draw.xv = -1;
for (i = 0; i < p_num_adaptors; i++) {
p_num_ports = ai[i].base_id + ai[i].num_ports;
for (p = ai[i].base_id; p < p_num_ports; p++) {
fo = XvListImageFormats(g_draw.display, p, &formats);
for (j = 0; j < formats; ++j) {
if (fo[j].type == XvYUV && fo[j].bits_per_pixel == 16
&& fo[j].format == XvPacked && strncmp("UYVY",
fo[j].component_order, 4) == 0) {
g_draw.xv_port = p;
g_draw.xv_id = fo[j].id;
g_draw.xv = GXV_YUV_PORT;
j = formats;
p = p_num_ports;
i = p_num_adaptors;
break;
}
if (fo[j].type == XvRGB && fo[j].bits_per_pixel == 32) {
g_draw.xv_port = p;
g_draw.xv_id = fo[j].id;
printf("RGB mode found. id: %x\n", g_draw.xv_id);
g_draw.xv = GXV_RGB_PORT;
//break out of loops
j = formats;
p = p_num_ports;
i = p_num_adaptors;
}
}
if (fo)
XFree(fo);
}
}
if (p_num_adaptors > 0)
XvFreeAdaptorInfo(ai);
if (g_draw.xv < 0) {
fprintf(stderr, "RGB & YUV not found. Quitting.\n");
exit(EXIT_FAILURE);
}
Atom atom_vsync = xv_intern_atom_if_exists(g_draw.display,
"XV_SYNC_TO_VBLANK");
if (atom_vsync != None) {
XvGetPortAttribute(g_draw.display, g_draw.xv_port, atom_vsync,
&g_draw.xv_vsync);
XvSetPortAttribute(g_draw.display, g_draw.xv_port, atom_vsync, 0);
}
g_draw.myvisual = 0;
if (XMatchVisualInfo(g_draw.display, myscreen, g_draw.depth, TrueColor,
&g_draw.vi))
g_draw.myvisual = &g_draw.vi;
if (!g_draw.myvisual) {
fprintf(stderr, "Failed to obtain visual!\n");
DestroyDisplay();
return;
}
if (!g_cfg.FullScreen)
g_draw.cursor = XCreateFontCursor(g_draw.display, XC_trek);
else {
g_draw.cursor = None;
}
g_draw.colormap = XCreateColormap(g_draw.display, g_draw.root_window_id,
g_draw.myvisual->visual, AllocNone);
winattr.background_pixel = BlackPixelOfScreen(screen);
winattr.border_pixel = WhitePixelOfScreen(screen);
winattr.bit_gravity = ForgetGravity;
winattr.win_gravity = NorthWestGravity;
winattr.backing_store = NotUseful;
winattr.override_redirect = False;
winattr.save_under = False;
winattr.event_mask = 0;
winattr.do_not_propagate_mask = 0;
winattr.colormap = g_draw.colormap;
winattr.cursor = None;
g_draw.window = XCreateWindow(g_draw.display, g_draw.root_window_id, 0, 0,
g_cfg.ResX, g_cfg.ResY, 0, g_draw.myvisual->depth, InputOutput,
g_draw.myvisual->visual, CWBorderPixel | CWBackPixel | CWEventMask
| CWDontPropagate | CWColormap | CWCursor, &winattr);
if (!g_draw.window) {
fprintf(stderr, "Failed in XCreateWindow()!!!\n");
DestroyDisplay();
return;
}
delwindow = XInternAtom(g_draw.display, "WM_DELETE_WINDOW", 0);
XSetWMProtocols(g_draw.display, g_draw.window, &delwindow, 1);
hints.flags = USPosition | USSize;
hints.base_width = g_cfg.ResX;
hints.base_height = g_cfg.ResY;
wm_hints.input = 1;
wm_hints.flags = InputHint;
XSetWMHints(g_draw.display, g_draw.window, &wm_hints);
XSetWMNormalHints(g_draw.display, g_draw.window, &hints);
//if (pCaptionText)
// XStoreName(draw_ctx.display, draw_ctx.window, pCaptionText);
//else
XStoreName(g_draw.display, g_draw.window, "GXVideo GPU");
XDefineCursor(g_draw.display, g_draw.window, g_draw.cursor);
// hack to get rid of window title bar
if (g_draw.fx) {
mwmhints.flags = MWM_HINTS_DECORATIONS;
mwmhints.decorations = 0;
mwmatom = XInternAtom(g_draw.display, "_MOTIF_WM_HINTS", 0);
XChangeProperty(g_draw.display, g_draw.window, mwmatom, mwmatom, 32,
PropModeReplace, (unsigned char *) &mwmhints, 4);
}
// key stuff
XSelectInput(g_draw.display, g_draw.window, FocusChangeMask | ExposureMask
| KeyPressMask | KeyReleaseMask);
XMapRaised(g_draw.display, g_draw.window);
XClearWindow(g_draw.display, g_draw.window);
XWindowEvent(g_draw.display, g_draw.window, ExposureMask, &event);
if (g_draw.fx) {
XResizeWindow(g_draw.display, g_draw.window, screen->width,
screen->height);
hints.min_width = hints.max_width = hints.base_width = screen->width;
hints.min_height = hints.max_height = hints.base_height
= screen->height;
XSetWMNormalHints(g_draw.display, g_draw.window, &hints);
// set the window layer for GNOME
{
XEvent xev;
memset(&xev, 0, sizeof(xev));
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = 1;
xev.xclient.message_type = XInternAtom(g_draw.display,
"_NET_WM_STATE", 0);
xev.xclient.window = g_draw.window;
xev.xclient.format = 32;
xev.xclient.data.l[0] = 1;
xev.xclient.data.l[1] = XInternAtom(g_draw.display,
"_NET_WM_STATE_FULLSCREEN", 0);
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
XSendEvent(g_draw.display, g_draw.root_window_id, 0,
SubstructureRedirectMask | SubstructureNotifyMask, &xev);
}
}
gcv.graphics_exposures = False;
gcv.foreground = WhitePixelOfScreen(screen);
gcv.background = BlackPixelOfScreen(screen);
g_draw.hGC = XCreateGC(g_draw.display, g_draw.window, GCGraphicsExposures
|GCForeground | GCBackground, &gcv);
if (!g_draw.hGC) {
fprintf(stderr, "No gfx context!!!\n");
DestroyDisplay();
}
g_draw.Xpixels = (char *) malloc(600 * 15 * 4);
uint32_t color;
if (g_draw.xv == GXV_YUV_PORT)
color = rgb_to_yuv(0x00, 0x00, 0xff);
else
color = 0x0000ff;
for (i = 0; i < 600 * 15; ++i)
((uint32_t *) g_draw.Xpixels)[i] = color;
g_draw.XFimage = XCreateImage(g_draw.display, g_draw.myvisual->visual,
g_draw.depth, ZPixmap, 0, (char *) g_draw.Xpixels, 600, 15,
g_draw.depth > 16 ? 32 : 16, 0);
/* fix the green back ground in YUV mode */
if (g_draw.xv == GXV_YUV_PORT)
color = rgb_to_yuv(0x00, 0x00, 0x00);
else
color = 0;
g_draw.Xpixels = (char *) malloc(8 * 8 * 4);
for (i = 0; i < 8 * 8; ++i)
((uint32_t *) g_draw.Xpixels)[i] = color;
g_draw.XCimage = XvCreateImage(g_draw.display, g_draw.xv_port,
g_draw.xv_id, (char *) g_draw.Xpixels, 8, 8);
/*
Allocate max that could be needed:
Big(est?) PSX res: 640x512
32bpp (times 4)
2xsai func= 3xwidth,3xheight
= approx 11.8mb
*/
g_draw.shminfo.shmid
= shmget(IPC_PRIVATE, 1024 * 512 * 4, IPC_CREAT | 0777);
g_draw.shminfo.shmaddr = shmat(g_draw.shminfo.shmid, 0, 0);
g_draw.shminfo.readOnly = 0;
if (!XShmAttach(g_draw.display, &g_draw.shminfo)) {
printf("XShmAttach failed !\n");
exit(-1);
}
uint32_t *pShmaddr = (uint32_t *) g_draw.shminfo.shmaddr;
for (i = 0; i < 1024 * 512; ++i)
pShmaddr[i] = color;
//fprintf(stderr, "Return %s\n", __FUNCTION__);
return;
}
int rgb_check_port(XvImageFormatValues const * fo) {
if (fo->type == XvRGB && fo->bits_per_pixel == 32) {
g_draw.xv_id = fo->id;
return 1;
}
return 0;
}
void rgb_blit_16(int8_t * buff, int32_t x, int32_t y, int32_t w, int32_t h) {
//fprintf(stderr, "BlitToYUV\n");
int16_t * src_pxl;
int8_t * dst_pxl;
int32_t startxy;
int32_t _x, _y;
startxy = 0;
dst_pxl = buff;
for (_y = y; _y < h; ++_y) {
src_pxl = &g_gpu.psx_vram.s16[startxy];
for (_x = x; _x < w; ++_x) {
dst_pxl[0] = ((*src_pxl) << 3) & 0xf8;
dst_pxl[1] = ((*src_pxl) >> 2) & 0xf8;
dst_pxl[2] = ((*src_pxl) >> 7) & 0xf8;
dst_pxl += 3;
src_pxl += 1;
}
startxy += 2048;
}
}
void rgb_blit_24(int8_t * buff, int32_t x, int32_t y, int32_t w, int32_t h) {
//fprintf(stderr, "BlitToYUV\n");
int8_t * src_pxl;
int8_t * dst_pxl;
int32_t startxy;
int32_t _x, _y;
dst_pxl = buff;
startxy = 0;
for (_y = y; _y < h; ++_y) {
src_pxl = &g_gpu.psx_vram.s8[startxy];
for (_x = x; _x < w; ++_x) {
dst_pxl[0] = src_pxl[0];
dst_pxl[1] = src_pxl[1];
dst_pxl[2] = src_pxl[2];
dst_pxl += 3;
src_pxl += 3;
}
startxy += 2048;
}
}
int yuyv_check_port(XvImageFormatValues * fo) {
if (fo->type == XvYUV && fo->bits_per_pixel == 16 && fo->format == XvPacked
&& strncmp("UYVY", fo->component_order, 4) == 0) {
g_draw.xv_id = fo->id;
return 1;
}
return 0;
}
void yuyv_blit_24(int8_t * buff, int32_t x, int32_t y, int32_t w, int32_t h) {
//fprintf(stderr, "yuyv_blit_24 %d %d %d %d\n", x, y, w, h);
uint8_t * src_pxl;
int8_t R0, G0, B0;
int8_t R1, G1, B1;
uint32_t * dst_pxl;
int32_t _x, _y;
/* x and w should be multiple of 2 to be align */
x = x & 0xfffffffe;
w = (w + 1) & 0xfffffffe;
dst_pxl = (uint32_t *) (buff);
for (_y = y; _y < (y + h); _y += 1) {
src_pxl = &g_gpu.psx_vram.u8[x * 3 + (_y * 2048)];
for (_x = 0; _x < (w / 2); ++_x) {
R0 = src_pxl[0];
G0 = src_pxl[1];
B0 = src_pxl[2];
R1 = src_pxl[3];
G1 = src_pxl[4];
B1 = src_pxl[5];
*dst_pxl++ = rgb_to_yuv2(R0, G0, B0, R1, G1, B1);
src_pxl += 6;
}
}
}
void yuyv_blit_16(int8_t * buff, int32_t x, int32_t y, int32_t w, int32_t h) {
//fprintf(stderr, "yuyv_blit_16 %d %d %d %d\n", x, y, w, h);
int8_t R0, G0, B0;
int8_t R1, G1, B1;
uint32_t * dst_pxl;
int32_t _x, _y;
int32_t s;
uint16_t * src_pxl;
/* x must be a multiple of 2 */
/* x and w must be a multiple of 2 */
x = x & 0xfffffffe;
w = (w + 1) & 0xfffffffe;
dst_pxl = (uint32_t *) (buff);
for (_y = y; _y < (y + h); _y += 1) {
src_pxl = &g_gpu.psx_vram.u16[x + (_y * 1024)];
for (_x = 0; _x < (w / 2); ++_x) {
s = GETLE16(src_pxl++);
R0 = (s << 3) & 0xf8;
G0 = (s >> 2) & 0xf8;
B0 = (s >> 7) & 0xf8;
s = GETLE16(src_pxl++);
R1 = (s << 3) & 0xf8;
G1 = (s >> 2) & 0xf8;
B1 = (s >> 7) & 0xf8;
*dst_pxl++ = rgb_to_yuv2(R0, G0, B0, R1, G1, B1);
}
}
}
/**
* compute the position and the size of output screen
* The aspect of the psx output mode is preserved.
* Note: dest dx,dy,dw,dh are both input and output variables
*/
inline void maintain_aspect(uint32_t * dx, uint32_t * dy, uint32_t * dw,
uint32_t * dh, int32_t w, int32_t h) {
double ratio_x = ((double) *dw) / ((double) w);
double ratio_y = ((double) *dh) / ((double) h);
double ratio;
if (ratio_x < ratio_y) {
ratio = ratio_x;
} else {
ratio = ratio_y;
}
uint32_t tw = (uint32_t) floor(w * ratio);
uint32_t th = (uint32_t) floor(h * ratio);
*dx += (uint32_t) floor((*dw - tw) / 2.0);
*dy += (uint32_t) floor((*dh - th) / 2.0);
*dw = tw;
*dh = th;
}
void do_buffer_swap(void) {
//Screen *screen;
Window _dw;
XvImage *xvi;
unsigned int dstx, dsty;
unsigned int _d, _w, _h; //don't care about _d
dstx = 0;
dsty = 0;
XSync(g_draw.display, False);
XGetGeometry(g_draw.display, g_draw.window, &_dw, (int *) &_d, (int *) &_d,
&_w, &_h, &_d, &_d);
if (g_cfg.ShowFPS) {
dsty += 15;
_h -= 15;
compute_fps();
snprintf(g_draw.msg, 511, "FPS : %f", g_draw.fps);
XDrawImageString(g_draw.display, g_draw.window, g_draw.hGC, 0, 12,
g_draw.msg, strlen(g_draw.msg));
}
uint32_t _x_, _y_, _w_, _h_;
/* if video mode is valid */
if (g_gpu.dsp.mode.x) {
if (g_gpu.status_reg & STATUS_RGB24) {
_x_ = (g_gpu.dsp.position.x * 2) / 3;
} else {
_x_ = g_gpu.dsp.position.x;
}
_y_ = g_gpu.dsp.position.y;
_w_ = (g_gpu.dsp.range.x1 - g_gpu.dsp.range.x0) / g_gpu.dsp.mode.x;
_h_ = (g_gpu.dsp.range.y1 - g_gpu.dsp.range.y0) * g_gpu.dsp.mode.y;
if (g_gpu.status_reg & STATUS_RGB24) {
available_port[g_draw.xv].blit_24_bits(
(int8_t *) g_draw.shminfo.shmaddr, _x_, _y_, _w_, _h_);
} else {
available_port[GXV_YUV_PORT].blit_16_bits(
(int8_t *) g_draw.shminfo.shmaddr, _x_, _y_, _w_, _h_);
}
xvi = XvShmCreateImage(g_draw.display, g_draw.xv_port, g_draw.xv_id, 0,
_w_, _h_, &g_draw.shminfo);
xvi->data = g_draw.shminfo.shmaddr;
//screen = DefaultScreenOfDisplay(g_draw.display);
//screennum = DefaultScreen(display);
// if (g_cfg.FullScreen) {
// _w = screen->width;
// _h = screen->height;
// }
if (g_cfg.Maintain43)
maintain_aspect(&dstx, &dsty, &_w, &_h, _w_, (g_gpu.dsp.range.y1
- g_gpu.dsp.range.y0));
// int _i;
// int32_t * dst_pxl;
// dst_pxl = (int32_t *) &g_draw.shminfo.shmaddr[2048 * _y_];
// for (_i = _x_ / 2; _i < (_x_ + _w_) / 2; ++_i)
// dst_pxl[_i] = rgb_to_yuv2(255, 0, 0, 255, 0, 0);
// dst_pxl = (int32_t *) &g_draw.shminfo.shmaddr[2048 * (_y_ + _h_)];
// for (_i = _x_ / 2; _i < (_x_ + _w_) / 2; ++_i)
// dst_pxl[_i] = rgb_to_yuv2(255, 0, 0, 255, 0, 0);
// dst_pxl = (int32_t *) &g_draw.shminfo.shmaddr[4 * (_x_ / 2)];
// for (_i = _y_; _i < (_y_ + _h_); ++_i)
// dst_pxl[_i * 512] = rgb_to_yuv2(255, 0, 0, 255, 0, 0);
// dst_pxl = (int32_t *) &g_draw.shminfo.shmaddr[4 * ((_x_ + _w_) / 2)];
// for (_i = _y_; _i < (_y_ + _h_); ++_i)
// dst_pxl[_i * 512] = rgb_to_yuv2(255, 0, 0, 255, 0, 0);
//fprintf(stderr, "From %d,%d,%d,%d\n", _x_, _y_, _w_, _h_);
XvShmPutImage(g_draw.display, g_draw.xv_port, g_draw.window,
g_draw.hGC, xvi, 0, 0, _w_, _h_,
//0, 0, 1024, 512,
/* dst */
dstx, dsty, _w, _h, 1);
XFree(xvi);
}
}
void do_clear_screen_buffer(void) // CLEAR DX BUFFER
{
XClearWindow(g_draw.display, g_draw.window);
}
void Xcleanup() // X CLEANUP
{
//CloseMenu();
}
/**
* Call on GPUopen
* Return the current display.
**/
unsigned long init_display() {
available_port[GXV_YUV_PORT].blit_24_bits = yuyv_blit_24;
available_port[GXV_YUV_PORT].blit_16_bits = yuyv_blit_16;
available_port[GXV_RGB_PORT].blit_24_bits = rgb_blit_24;
available_port[GXV_RGB_PORT].blit_16_bits = rgb_blit_16;
create_display(); // x stuff
g_draw.bIsFirstFrame = 0;
return (unsigned long) g_draw.display;
}
void CloseDisplay(void) {
Xcleanup(); // cleanup dx
DestroyDisplay();
}
void CreatePic(unsigned char * pMem) {
unsigned char * p = (unsigned char *) malloc(128 * 96 * 4);
unsigned char * ps;
//int x, y;
ps = p;
// if (iDesktopCol == 16) {
// unsigned short s;
// for (y = 0; y < 96; y++) {
// for (x = 0; x < 128; x++) {
// s = (*(pMem + 0)) >> 3;
// s |= ((*(pMem + 1)) & 0xfc) << 3;
// s |= ((*(pMem + 2)) & 0xf8) << 8;
// pMem += 3;
// *((unsigned short *) (ps + y * 256 + x * 2)) = s;
// }
// }
// } else if (iDesktopCol == 15) {
// unsigned short s;
// for (y = 0; y < 96; y++) {
// for (x = 0; x < 128; x++) {
// s = (*(pMem + 0)) >> 3;
// s |= ((*(pMem + 1)) & 0xfc) << 2;
// s |= ((*(pMem + 2)) & 0xf8) << 7;
// pMem += 3;
// *((unsigned short *) (ps + y * 256 + x * 2)) = s;
// }
// }
// } else if (iDesktopCol == 32) {
// uint32_t l;
// for (y = 0; y < 96; y++) {
// for (x = 0; x < 128; x++) {
// l = *(pMem + 0);
// l |= (*(pMem + 1)) << 8;
// l |= (*(pMem + 2)) << 16;
// pMem += 3;
// *((uint32_t *) (ps + y * 512 + x * 4)) = l;
// }
// }
// }
g_draw.XPimage = XCreateImage(g_draw.display, g_draw.myvisual->visual,
g_draw.depth, ZPixmap, 0, (char *) p, 128, 96,
g_draw.depth > 16 ? 32 : 16, 0);
}
void DestroyPic(void) {
if (g_draw.XPimage) { /*
XPutImage(display,window,hGC, XCimage,
0, 0, 0, 0, iResX, iResY);*/
XDestroyImage(g_draw.XPimage);
g_draw.XPimage = 0;
}
}
void ShowGpuPic(void) {
}
void ShowTextGpuPic(void) {
}

View File

@ -1,111 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef _GPU_DRAW_H_
#define _GPU_DRAW_H_
#include <time.h>
#include <stdint.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>
#include "gpu_utils.h"
typedef struct {
int iResX;
int iResY;
long lLowerpart;
int bIsFirstFrame;
int bCheckMask;
uint16_t sSetMask;
uint32_t lSetMask;
int iDesktopCol;
int iShowFPS;
int iWinSize;
int iMaintainAspect;
int iUseNoStretchBlt;
int iFastFwd;
int iDebugMode;
int iFVDisplay;
gxv_point_t ptCursorPoint[8];
unsigned short usCursorActive;
int xv_port;
int xv_id;
int xv_vsync;
int xv;
XShmSegmentInfo shminfo;
int finalw, finalh;
/* X Stuff */
Cursor cursor;
XVisualInfo vi;
XVisualInfo * myvisual;
Display * display;
Colormap colormap;
Window window;
GC hGC;
XImage * Ximage;
XvImage * XCimage;
XImage * XFimage;
XImage * XPimage;
char * Xpixels;
char * pCaptionText;
int fx;
int depth;
int root_window_id;
time_t tStart;
double fps;
char msg[512];
} gxv_draw_t;
typedef struct {
void (*blit_24_bits)(int8_t * buff, int32_t x, int32_t y, int32_t w, int32_t h);
void (*blit_16_bits)(int8_t * buff, int32_t x, int32_t y, int32_t w, int32_t h);
} gxv_blit_t;
void do_buffer_swap(void);
void do_clear_screen_buffer(void);
void do_clear_front_buffer(void);
unsigned long init_display(void);
void CloseDisplay(void);
void CreatePic(unsigned char * pMem);
void DestroyPic(void);
void DisplayPic(void);
void ShowGpuPic(void);
void ShowTextGpuPic(void);
typedef struct {
#define MWM_HINTS_DECORATIONS 2
long flags;
long functions;
long decorations;
long input_mode;
} MotifWmHints;
#endif // _GPU_DRAW_H_

View File

@ -1,69 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#include <unistd.h>
#include <sys/time.h>
#include "globals.h"
#include "fps.h"
#include "gpu.h"
#define TIMEBASE 100000
unsigned long time_get_time() {
struct timeval tv;
gettimeofday(&tv, 0); // well, maybe there are better ways
return tv.tv_sec * 100000 + tv.tv_usec / 10; // to do that, but at least it works
}
void frame_cap(int fps) {
static unsigned int last_time = 0;
unsigned int c = time_get_time();
if (!fps) {
last_time = c;
return;
}
if (last_time + (100000/fps) < c) {
last_time = c;
return;
}
while (last_time + (100000/fps) - 20 > c) {
usleep(((100000/fps) - 20 - (c - last_time)) * 10 );
c = time_get_time();
}
last_time = c;
}
void compute_fps() {
static int count = 0;
static unsigned int last_time = 0;
unsigned int c = time_get_time();
++count;
if((c - last_time) > 100000) {
g_draw.fps = ((double)count) / ((double)(c - last_time)) * 100000;
count = 0;
last_time = c;
}
}

View File

@ -1,27 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef _FPS_INTERNALS_H
#define _FPS_INTERNALS_H
void frame_cap(int fps);
void compute_fps();
#endif // _FPS_INTERNALS_H

View File

@ -1,28 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#include "globals.h"
char * g_file_name = 0;
gxv_cfg_t g_cfg = { };
gxv_gpu_t g_gpu = { };
gxv_draw_t g_draw = { };
gxv_prim_t g_prim = { };
gxv_soft_t g_soft = { };

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef GLOBALS_H_
#define GLOBALS_H_
#include "cfg.h"
#include "fps.h"
#include "gpu.h"
#include "draw.h"
#include "prim.h"
#include "soft.h"
extern char * g_file_name;
extern gxv_cfg_t g_cfg;
extern gxv_gpu_t g_gpu;
extern gxv_draw_t g_draw;
extern gxv_prim_t g_prim;
extern gxv_soft_t g_soft;
#endif /* GLOBALS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,116 +0,0 @@
/***************************************************************************
gpu.h - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#ifndef _GPU_INTERNALS_H
#define _GPU_INTERNALS_H
#include <gpu_utils.h>
#define OPAQUEON 10
#define OPAQUEOFF 11
#define KEY_RESETTEXSTORE 1
#define KEY_SHOWFPS 2
#define KEY_RESETOPAQUE 4
#define KEY_RESETDITHER 8
#define KEY_RESETFILTER 16
#define KEY_RESETADVBLEND 32
//#define KEY_BLACKWHITE 64
#define KEY_BADTEXTURES 128
#define KEY_CHECKTHISOUT 256
#if !defined(__BIG_ENDIAN__) || defined(__x86_64__) || defined(__i386__)
#ifndef __LITTLE_ENDIAN__
#define __LITTLE_ENDIAN__
#endif
#endif
#define RED(x) (x & 0xff)
#define BLUE(x) ((x>>16) & 0xff)
#define GREEN(x) ((x>>8) & 0xff)
#define COLOR(x) (x & 0xffffff)
#define INFO_TW 0
#define INFO_DRAWSTART 1
#define INFO_DRAWEND 2
#define INFO_DRAWOFF 3
#define SHADETEXBIT(x) ((x>>24) & 0x1)
#define SEMITRANSBIT(x) ((x>>25) & 0x1)
#define PSXRGB(r,g,b) ((g<<10)|(b<<5)|r)
#define DATAREGISTERMODES unsigned short
#define DR_NORMAL 0
#define DR_VRAMTRANSFER 1
#define STATUS_ODDLINES 0x80000000
#define STATUS_DMABITS 0x60000000 // Two bits
#define STATUS_READYFORCOMMANDS 0x10000000
#define STATUS_READYFORVRAM 0x08000000
#define STATUS_IDLE 0x04000000
#define STATUS_DISPLAYDISABLED 0x00800000
#define STATUS_INTERLACED 0x00400000
#define STATUS_RGB24 0x00200000
#define STATUS_PAL 0x00100000
#define STATUS_DOUBLEHEIGHT 0x00080000
#define STATUS_WIDTHBITS 0x00070000 // Three bits
#define STATUS_MASKENABLED 0x00001000
#define STATUS_MASKDRAWN 0x00000800
#define STATUS_DRAWINGALLOWED 0x00000400
#define STATUS_DITHER 0x00000200
typedef struct {
short x;
short y;
short Width;
short Height;
short RowsRemaining;
short ColsRemaining;
unsigned short *ImagePtr;
} gxv_vram_load_t;
typedef struct {
gxv_vram_load_t VRAMWrite;
gxv_vram_load_t VRAMRead;
uint16_t DataWriteMode;
uint16_t DataReadMode;
int iColDepth;
int iWindowMode;
int bDebugText;
gxv_display_t dsp;
uint32_t status_reg;
long lGPUdataRet;
gxv_pointer_t psxVSecure;
gxv_pointer_t psx_vram;
gxv_pointer_t psxVuw_eom;
uint32_t lGPUInfoVals[16];
uint32_t ulStatusControl[256];
uint32_t gpuDataM[256];
unsigned char gpuCommand;
long gpuDataC;
long gpuDataP;
int fps;
} gxv_gpu_t;
#endif // _GPU_INTERNALS_H

View File

@ -1,76 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
* Inspired by original author : Pete Bernert
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#ifndef GPU_UTILS_H_
#define GPU_UTILS_H_
#include <stdint.h>
typedef struct {
uint16_t rgb16;
} __attribute__((__packed__)) gxv_rgb16;
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
} __attribute__((__packed__)) gxv_rgb24;
/* for fast recast ^^ */
typedef union {
uint8_t * u8;
int8_t * s8;
uint16_t * u16;
int16_t * s16;
uint32_t * u32;
int32_t * s32;
gxv_rgb16 * rgb16;
gxv_rgb24 * rgb24;
} gxv_pointer_t;
typedef struct {
int32_t x;
int32_t y;
} gxv_point_t;
typedef struct {
int16_t x;
int16_t y;
} gxv_spoint_t;
typedef struct {
int16_t x0;
int16_t x1;
int16_t y0;
int16_t y1;
} gxv_rect_t;
typedef struct {
gxv_point_t position;
gxv_point_t mode;
gxv_point_t DrawOffset;
gxv_rect_t range;
} gxv_display_t;
typedef struct {
gxv_rect_t Position;
} gxv_win_t;
#endif /* GPU_UTILS_H_ */

View File

@ -1,542 +0,0 @@
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="resolution_liststore">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">320x240</col>
</row>
<row>
<col id="0" translatable="yes">640x480</col>
</row>
<row>
<col id="0" translatable="yes">800x600</col>
</row>
<row>
<col id="0" translatable="yes">1024x768</col>
</row>
<row>
<col id="0" translatable="yes">1152x864</col>
</row>
<row>
<col id="0" translatable="yes">1280x960</col>
</row>
<row>
<col id="0" translatable="yes">1600x1200</col>
</row>
</data>
</object>
<object class="GtkDialog" id="config_window">
<property name="border_width">5</property>
<property name="title" translatable="yes">Configure GXVideo plugin</property>
<property name="window_position">center</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="column_spacing">2</property>
<property name="row_spacing">2</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Initial Window Size: </property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Dithering: </property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="dithering_combobox">
<property name="visible">True</property>
<property name="model">dithering_liststore</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fullscreen_checkbutton">
<property name="label" translatable="yes">Fullscreen</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="resolution_combobox">
<property name="visible">True</property>
<property name="model">resolution_liststore</property>
<property name="active">3</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="maintain_ratio_checkbutton">
<property name="label" translatable="yes">Maintain original aspect ratio</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Screen&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkCheckButton" id="show_fps_checkbutton">
<property name="label" translatable="yes">Show FPS</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkCheckButton" id="set_fps_checkbutton">
<property name="label" translatable="yes">Framerate Limit: </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="fps_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_length">7</property>
<property name="invisible_char">&#x25CF;</property>
<property name="width_chars">6</property>
<property name="text" translatable="yes">200.0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="auto_fps_limit_checkbutton">
<property name="label" translatable="yes">Auto detect framerate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Framerate&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="use_game_fixes_checkbutton">
<property name="label" translatable="yes">Use game fixes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="top_padding">2</property>
<property name="bottom_padding">2</property>
<property name="left_padding">16</property>
<property name="right_padding">2</property>
<child>
<object class="GtkTable" id="fixes_table">
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<property name="column_spacing">2</property>
<property name="row_spacing">2</property>
<child>
<object class="GtkCheckButton" id="fix0_checkbutton">
<property name="label" translatable="yes">Odd/even bit hack</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="fix1_checkbutton">
<property name="label" translatable="yes">Expand screen width</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix2_checkbutton">
<property name="label" translatable="yes">Ignore brightness color</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix3_checkbutton">
<property name="label" translatable="yes">Disable coordinate check</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix4_checkbutton">
<property name="label" translatable="yes">Disable CPU Saving</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix5_checkbutton">
<property name="label" translatable="yes">PC FPS calculation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix6_checkbutton">
<property name="label" translatable="yes">Lazy screen update</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix7_checkbutton">
<property name="label" translatable="yes">Old frame skipping</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix8_checkbutton">
<property name="label" translatable="yes">Repeated flat tex triangles</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix9_checkbutton">
<property name="label" translatable="yes">Draw quads with triangles</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="fix10_checkbutton">
<property name="label" translatable="yes">Fake 'gpu busy' states</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Compatibility&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save_button">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel_button</action-widget>
<action-widget response="0">save_button</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="dithering_liststore">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Off (fastest)</col>
</row>
<row>
<col id="0" translatable="yes">Game dependant</col>
</row>
<row>
<col id="0" translatable="yes">Always</col>
</row>
</data>
</object>
</interface>

View File

@ -1,367 +0,0 @@
/*
* Copyright (C) 2010 Benoit Gschwind
*
* 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 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*/
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "globals.h"
#include "config.h"
#ifdef ENABLE_NLS
#include <libintl.h>
#include <locale.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#define READBINARY "rb"
#define WRITEBINARY "wb"
#define CONFIG_FILENAME "dfxvideo.cfg"
enum {
VIDMODE_320x200 = 0,
VIDMODE_640x480,
VIDMODE_800x600,
VIDMODE_1024x768,
VIDMODE_1152x864,
VIDMODE_1280x960,
VIDMODE_1600x1200
}; /* Video_modes */
typedef struct {
GtkWidget * config_window;
GtkWidget * resolution_combobox;
GtkWidget * dithering_combobox;
GtkWidget * maintain_ratio_checkbutton;
GtkWidget * fullscreen_checkbutton;
GtkWidget * show_fps_checkbutton;
GtkWidget * set_fps_checkbutton;
GtkWidget * auto_fps_limit_checkbutton;
GtkWidget * fps_entry;
GtkWidget * use_game_fixes_checkbutton;
GtkWidget * save_button;
GtkWidget * cancel_button;
GtkWidget * fixes_table;
GtkWidget * fix_checkbutton[11];
} cfg_window_t;
void save_config(cfg_window_t *);
/* This function checks for the value being outside the accepted range,
and returns the appropriate boundary value */
int set_limit(char *p, int len, int lower, int upper) {
int val = 0;
if (p)
val = atoi(p + len);
/* printf("Checking for val %d greater than %d and lower than %d, ", val, lower, upper);*/
if (val < lower)
val = lower;
if (val > upper)
val = upper;
/* printf ("val is now %d\n", val);*/
return val;
}
void on_about_clicked(GtkWidget * widget, gpointer user_data) {
gtk_widget_destroy(widget);
exit(0);
}
void set_widget_sensitive(GtkWidget * widget, gboolean * state) {
gtk_widget_set_sensitive(widget, *state);
}
void on_fullscreen_toggled(GtkWidget * widget, cfg_window_t * w) {
gtk_widget_set_sensitive(w->resolution_combobox,
!gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(w->fullscreen_checkbutton)));
}
void update_fixes_stase(GtkWidget * ths, GtkWidget * w) {
gtk_widget_set_sensitive(ths, gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(w)));
}
void on_use_fixes_toggled(GtkWidget * widget, cfg_window_t * w) {
/* Set the state of each of the fixes to the value of the use fixes toggle */
gtk_container_foreach(GTK_CONTAINER (w->fixes_table),
(GtkCallback) update_fixes_stase, w->use_game_fixes_checkbutton);
}
void on_fps_toggled(GtkWidget * widget, cfg_window_t * w) {
gboolean state_set_fps = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(w->set_fps_checkbutton));
gboolean state_auto_fps_limit = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(w->auto_fps_limit_checkbutton));
gtk_widget_set_sensitive(w->fps_entry, state_set_fps
&& !state_auto_fps_limit);
gtk_widget_set_sensitive(w->auto_fps_limit_checkbutton, state_set_fps);
}
void on_destroy_window(GtkWidget * widget, cfg_window_t * w) {
free(w);
}
void on_click_save_button(GtkWidget * widget, cfg_window_t * w) {
save_config(w);
gtk_widget_destroy(GTK_WIDGET(w->config_window));
gtk_exit(0);
}
void on_click_cancel_button(GtkWidget * widget, cfg_window_t * w) {
gtk_widget_destroy(GTK_WIDGET(w->config_window));
gtk_exit(0);
}
int main(int argc, char *argv[]) {
cfg_window_t * w = 0;
GtkWidget * widget;
GtkBuilder * builder;
int i, val;
char tempstr[50];
#ifdef ENABLE_NLS
setlocale(LC_ALL, "");
bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
#endif
if (argc != 2) {
printf("Usage: cfgGXVideo {ABOUT | CFG}\n");
return 0;
}
if (strcmp(argv[1], "CFG") != 0 && strcmp(argv[1], "ABOUT") != 0) {
printf("Usage: cfgGXVideo {ABOUT | CFG}\n");
return 0;
}
gtk_set_locale();
gtk_init(&argc, &argv);
if (strcmp(argv[1], "ABOUT") == 0) {
const char *authors[] = { "Pete Bernert and the P.E.Op.S. team",
"Ryan Schultz", "Andrew Burton", NULL };
widget = gtk_about_dialog_new();
gtk_about_dialog_set_name(GTK_ABOUT_DIALOG (widget),
"P.E.Op.S PCSXR Video Plugin");
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG (widget), "1.17");
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG (widget), authors);
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG (widget),
"http://pcsx-df.sourceforge.net/");
g_signal_connect_data(GTK_OBJECT(widget), "response",
G_CALLBACK(on_about_clicked), NULL, NULL, G_CONNECT_AFTER);
gtk_widget_show(widget);
gtk_main();
return 0;
}
builder = gtk_builder_new();
if (!builder) {
g_warning("We could not load the interface!");
return -1;
}
gtk_builder_add_from_file(builder, DATADIR "gxvideo.glade", NULL);
w = (cfg_window_t *) malloc(sizeof(cfg_window_t));
#define CFG_GET_WIDGET(name) w->name = GTK_WIDGET(gtk_builder_get_object(builder, #name))
CFG_GET_WIDGET(config_window);
CFG_GET_WIDGET(config_window);
CFG_GET_WIDGET(resolution_combobox);
CFG_GET_WIDGET(dithering_combobox);
CFG_GET_WIDGET(maintain_ratio_checkbutton);
CFG_GET_WIDGET(fullscreen_checkbutton);
CFG_GET_WIDGET(show_fps_checkbutton);
CFG_GET_WIDGET(set_fps_checkbutton);
CFG_GET_WIDGET(auto_fps_limit_checkbutton);
CFG_GET_WIDGET(fps_entry);
CFG_GET_WIDGET(use_game_fixes_checkbutton);
CFG_GET_WIDGET(save_button);
CFG_GET_WIDGET(cancel_button);
CFG_GET_WIDGET(fixes_table);
for (i = 0; i < 11; ++i) {
sprintf(tempstr, "fix%d_checkbutton", i);
w->fix_checkbutton[i]
= GTK_WIDGET(gtk_builder_get_object(builder, tempstr));
}
ReadConfig();
switch (g_cfg.ResX) {
case 1600:
val = VIDMODE_1600x1200;
break;
case 1280:
val = VIDMODE_1280x960;
break;
case 1152:
val = VIDMODE_1152x864;
break;
case 1024:
val = VIDMODE_1024x768;
break;
case 800:
val = VIDMODE_800x600;
break;
case 640:
val = VIDMODE_640x480;
break;
default:
val = VIDMODE_320x200;
}
gtk_combo_box_set_active(GTK_COMBO_BOX (w->resolution_combobox), val);
gtk_combo_box_set_active(GTK_COMBO_BOX (w->dithering_combobox),
g_cfg.Dithering);
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON (w->maintain_ratio_checkbutton), g_cfg.Maintain43);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w->fullscreen_checkbutton),
g_cfg.FullScreen);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w->show_fps_checkbutton),
g_cfg.ShowFPS);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w->set_fps_checkbutton),
g_cfg.UseFrameLimit);
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON (w->auto_fps_limit_checkbutton),
g_cfg.FPSDetection);
sprintf(tempstr, "%.1f", g_cfg.FrameRate);
gtk_entry_set_text(GTK_ENTRY(w->fps_entry), tempstr);
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON (w->use_game_fixes_checkbutton), g_cfg.UseFixes);
for (i = 0; i < 11; ++i) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (w->fix_checkbutton[i]),
(g_cfg.CfgFixes >> i) & 1);
}
g_signal_connect_data(GTK_OBJECT(w->config_window), "destroy",
G_CALLBACK(on_destroy_window), w, NULL, 0);
g_signal_connect_data(GTK_OBJECT(w->save_button), "clicked",
G_CALLBACK(on_click_save_button), w, NULL, G_CONNECT_AFTER);
g_signal_connect_data(GTK_OBJECT(w->cancel_button), "clicked",
G_CALLBACK(on_click_cancel_button), w, NULL, G_CONNECT_AFTER);
g_signal_connect_data(GTK_OBJECT(w->fullscreen_checkbutton), "clicked",
G_CALLBACK(on_fullscreen_toggled), w, NULL, G_CONNECT_AFTER);
g_signal_connect_data(GTK_OBJECT(w->use_game_fixes_checkbutton), "clicked",
G_CALLBACK(on_use_fixes_toggled), w, NULL, G_CONNECT_AFTER);
g_signal_connect_data(GTK_OBJECT(w->set_fps_checkbutton), "clicked",
G_CALLBACK(on_fps_toggled), w, NULL, G_CONNECT_AFTER);
g_signal_connect_data(GTK_OBJECT(w->auto_fps_limit_checkbutton), "clicked",
G_CALLBACK(on_fps_toggled), w, NULL, G_CONNECT_AFTER);
on_fullscreen_toggled(0, w);
on_fps_toggled(0, w);
on_use_fixes_toggled(0, w);
gtk_widget_show_all(w->config_window);
gtk_main();
return 0;
}
void save_config(cfg_window_t * w) {
int val;
val = gtk_combo_box_get_active(GTK_COMBO_BOX (w->resolution_combobox));
if (val == VIDMODE_320x200) {
g_cfg.ResX = 320;
g_cfg.ResY = 240;
} else if (val == VIDMODE_640x480) {
g_cfg.ResX = 640;
g_cfg.ResY = 480;
} else if (val == VIDMODE_800x600) {
g_cfg.ResX = 800;
g_cfg.ResY = 600;
} else if (val == VIDMODE_1024x768) {
g_cfg.ResX = 1024;
g_cfg.ResY = 768;
} else if (val == VIDMODE_1152x864) {
g_cfg.ResX = 1152;
g_cfg.ResY = 864;
} else if (val == VIDMODE_1280x960) {
g_cfg.ResX = 1280;
g_cfg.ResY = 960;
} else if (val == VIDMODE_1600x1200) {
g_cfg.ResX = 1600;
g_cfg.ResY = 1200;
}
val = gtk_combo_box_get_active(GTK_COMBO_BOX (w->dithering_combobox));
g_cfg.Dithering = val;
val = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON (w->maintain_ratio_checkbutton));
g_cfg.Maintain43 = val;
val = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON (w->fullscreen_checkbutton));
g_cfg.FullScreen = val;
val = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(w->show_fps_checkbutton));
g_cfg.ShowFPS = val;
val = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON (w->set_fps_checkbutton));
g_cfg.UseFrameLimit = val;
val = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON (w->auto_fps_limit_checkbutton));
g_cfg.FPSDetection = val;
//Framerate stored *10
val = atof(gtk_entry_get_text(GTK_ENTRY(w->fps_entry))) * 10;
g_cfg.FrameRate = val;
val = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON (w->use_game_fixes_checkbutton));
g_cfg.UseFixes = val;
val = 0;
int i;
for (i = 0; i < 11; ++i) {
if (gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON (w->fix_checkbutton[i])))
val |= 1 << i;
}
g_cfg.CfgFixes = val;
WriteConfig();
free(w);
// Close the window and exit control from the plugin
gtk_exit(0);
}

View File

@ -1,67 +0,0 @@
; i386.asm - description
; -------------------
; begin : Sun Nov 08 2001
; copyright : (C) 2001 by Pete Bernert
; email : BlackDove@addcom.de
; ported from inline gcc to nasm by linuzappz
; This program is free software; you can redistribute it and/or modify *
; it under the terms of the GNU General Public License as published by *
; the Free Software Foundation; either version 2 of the License, or *
; (at your option) any later version. See also the license.txt file for *
; additional informations. *
bits 32
section .text
%include "macros.inc"
NEWSYM i386_BGR24to16
push ebp
mov ebp, esp
push ebx
push edx
mov eax, [ebp+8] ; this can hold the G value
mov ebx, eax ; this can hold the R value
mov edx, eax ; this can hold the B value
shr ebx, 3 ; move the R value
and edx, 00f80000h ; mask the B value
shr edx, 9 ; move the B value
and eax, 00f800h ; mask the G value
shr eax, 6 ; move the G value
and ebx, 0000001fh ; mask the R value
or eax, ebx ; add R to G value
or eax, edx ; add B to RG value
pop edx
pop ebx
mov esp, ebp
pop ebp
ret
NEWSYM i386_shl10idiv
push ebp
mov ebp, esp
push ebx
push edx
mov eax, [ebp+8]
mov ebx, [ebp+12]
mov edx, eax
shl eax, 10
sar edx, 22
idiv ebx
pop edx
pop ebx
mov esp, ebp
pop ebp
ret
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif

View File

@ -1,294 +0,0 @@
/*
* This file is part of the Advance project.
*
* Copyright (C) 2003 Andrea Mazzoleni
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* In addition, as a special exception, Andrea Mazzoleni
* gives permission to link the code of this program with
* the MAME library (or with modified versions of MAME that use the
* same license as MAME), and distribute linked combinations including
* the two. You must obey the GNU General Public License in all
* respects for all of the code used other than MAME. If you modify
* this file, you may extend this exception to your version of the
* file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*/
#ifndef __INTERP_H
#define __INTERP_H
/***************************************************************************/
/* Basic types */
/***************************************************************************/
/* interpolation */
static unsigned interp_mask[2];
static unsigned interp_bits_per_pixel;
#define INTERP_16_MASK_1(v) (v & interp_mask[0])
#define INTERP_16_MASK_2(v) (v & interp_mask[1])
static __inline unsigned short interp_16_521(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*2 + INTERP_16_MASK_1(p3)*1) / 8)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*2 + INTERP_16_MASK_2(p3)*1) / 8);
}
static __inline unsigned short interp_16_332(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)*2) / 8)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)*2) / 8);
}
static __inline unsigned short interp_16_611(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*6 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 8)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*6 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 8);
}
static __inline unsigned short interp_16_71(unsigned short p1, unsigned short p2)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*7 + INTERP_16_MASK_1(p2)) / 8)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*7 + INTERP_16_MASK_2(p2)) / 8);
}
static __inline unsigned short interp_16_211(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*2 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 4)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*2 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 4);
}
static __inline unsigned short interp_16_772(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1(((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2))*7 + INTERP_16_MASK_1(p3)*2) / 16)
| INTERP_16_MASK_2(((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2))*7 + INTERP_16_MASK_2(p3)*2) / 16);
}
static __inline unsigned short interp_16_11(unsigned short p1, unsigned short p2)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2)) / 2)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2)) / 2);
}
static __inline unsigned short interp_16_31(unsigned short p1, unsigned short p2)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)) / 4)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)) / 4);
}
static __inline unsigned short interp_16_1411(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*14 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 16)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*14 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 16);
}
static __inline unsigned short interp_16_431(unsigned short p1, unsigned short p2, unsigned short p3)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*4 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)) / 8)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*4 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)) / 8);
}
static __inline unsigned short interp_16_53(unsigned short p1, unsigned short p2)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*3) / 8)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*3) / 8);
}
static __inline unsigned short interp_16_151(unsigned short p1, unsigned short p2)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*15 + INTERP_16_MASK_1(p2)) / 16)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*15 + INTERP_16_MASK_2(p2)) / 16);
}
static __inline unsigned short interp_16_97(unsigned short p1, unsigned short p2)
{
return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*9 + INTERP_16_MASK_1(p2)*7) / 16)
| INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*9 + INTERP_16_MASK_2(p2)*7) / 16);
}
#define INTERP_32_MASK_1(v) (v & 0xFF00FF)
#define INTERP_32_MASK_2(v) (v & 0x00FF00)
static __inline unsigned int interp_32_521(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*2 + INTERP_32_MASK_1(p3)*1) / 8)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*2 + INTERP_32_MASK_2(p3)*1) / 8);
}
static __inline unsigned int interp_32_332(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)*2) / 8)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)*2) / 8);
}
static __inline unsigned int interp_32_211(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*2 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 4)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*2 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 4);
}
static __inline unsigned int interp_32_611(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*6 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 8)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*6 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 8);
}
static __inline unsigned int interp_32_71(unsigned int p1, unsigned int p2)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*7 + INTERP_32_MASK_1(p2)) / 8)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*7 + INTERP_32_MASK_2(p2)) / 8);
}
static __inline unsigned int interp_32_772(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1(((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2))*7 + INTERP_32_MASK_1(p3)*2) / 16)
| INTERP_32_MASK_2(((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2))*7 + INTERP_32_MASK_2(p3)*2) / 16);
}
static __inline unsigned int interp_32_11(unsigned int p1, unsigned int p2)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2)) / 2)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2)) / 2);
}
static __inline unsigned int interp_32_31(unsigned int p1, unsigned int p2)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)) / 4)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)) / 4);
}
static __inline unsigned int interp_32_1411(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*14 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 16)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*14 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 16);
}
static __inline unsigned int interp_32_431(unsigned int p1, unsigned int p2, unsigned int p3)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*4 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)) / 8)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*4 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)) / 8);
}
static __inline unsigned int interp_32_53(unsigned int p1, unsigned int p2)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*3) / 8)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*3) / 8);
}
static __inline unsigned int interp_32_151(unsigned int p1, unsigned int p2)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*15 + INTERP_32_MASK_1(p2)) / 16)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*15 + INTERP_32_MASK_2(p2)) / 16);
}
static __inline unsigned int interp_32_97(unsigned int p1, unsigned int p2)
{
return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*9 + INTERP_32_MASK_1(p2)*7) / 16)
| INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*9 + INTERP_32_MASK_2(p2)*7) / 16);
}
/***************************************************************************/
/* diff */
#define INTERP_Y_LIMIT (0x30*4)
#define INTERP_U_LIMIT (0x07*4)
#define INTERP_V_LIMIT (0x06*8)
__inline static int interp_16_diff(unsigned short p1, unsigned short p2)
{
int r, g, b;
int y, u, v;
if (p1 == p2)
return 0;
if (interp_bits_per_pixel == 16) {
b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3;
g = (int)((p1 & 0x7E0) - (p2 & 0x7E0)) >> 3;
r = (int)((p1 & 0xF800) - (p2 & 0xF800)) >> 8;
} else {
b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3;
g = (int)((p1 & 0x3E0) - (p2 & 0x3E0)) >> 2;
r = (int)((p1 & 0x7C00) - (p2 & 0x7C00)) >> 7;
}
y = r + g + b;
u = r - b;
v = -r + 2*g - b;
if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT)
return 1;
if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT)
return 1;
if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT)
return 1;
return 0;
}
__inline static int interp_32_diff(unsigned int p1, unsigned int p2)
{
int r, g, b;
int y, u, v;
if ((p1 & 0xF8F8F8) == (p2 & 0xF8F8F8))
return 0;
b = (int)((p1 & 0xFF) - (p2 & 0xFF));
g = (int)((p1 & 0xFF00) - (p2 & 0xFF00)) >> 8;
r = (int)((p1 & 0xFF0000) - (p2 & 0xFF0000)) >> 16;
y = r + g + b;
u = r - b;
v = -r + 2*g - b;
if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT)
return 1;
if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT)
return 1;
if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT)
return 1;
return 0;
}
__inline static void interp_set(unsigned bits_per_pixel)
{
interp_bits_per_pixel = bits_per_pixel;
switch (bits_per_pixel) {
case 15 :
interp_mask[0] = 0x7C1F;
interp_mask[1] = 0x03E0;
break;
case 16 :
interp_mask[0] = 0xF81F;
interp_mask[1] = 0x07E0;
break;
case 32 :
interp_mask[0] = 0xFF00FF;
interp_mask[1] = 0x00FF00;
break;
}
}
#endif

View File

@ -1,43 +0,0 @@
/***************************************************************************
key.c - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#include "menu.h"
#include "gpu.h"
#include "draw.h"
#include "key.h"
#define VK_INSERT 65379
#define VK_HOME 65360
#define VK_PRIOR 65365
#define VK_NEXT 65366
#define VK_END 65367
#define VK_DEL 65535
#define VK_F5 65474
void GPUmakeSnapshot(void);
unsigned long ulKeybits = 0;
void GPUkeypressed(int keycode) {
}
void SetKeyHandler(void) {
}
void ReleaseKeyHandler(void) {
}

View File

@ -1,24 +0,0 @@
/***************************************************************************
key.h - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#ifndef _KEY_INTERNALS_H
#define _KEY_INTERNALS_H
void SetKeyHandler(void);
void ReleaseKeyHandler(void);
#endif // _KEY_INTERNALS_H

View File

@ -1,40 +0,0 @@
; macros.inc - description
; -------------------
; begin : Sun Nov 08 2001
; based on ZSNES macros.mac
; email : linuzappz@pcsx.net
; This program is free software; you can redistribute it and/or modify *
; it under the terms of the GNU General Public License as published by *
; the Free Software Foundation; either version 2 of the License, or *
; (at your option) any later version. See also the license.txt file for *
; additional informations. *
%ifdef __WIN32__
%imacro EXTSYM 1-*
%rep %0
extern _%1
%define %1 _%1
%rotate 1
%endrep
%endmacro
%imacro NEWSYM 1
global _%1
_%1:
%1:
%endmacro
%else
%define EXTSYM extern
%imacro NEWSYM 1
global %1
%1:
%endmacro
%endif

View File

@ -1,57 +0,0 @@
/***************************************************************************
menu.c - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#include "draw.h"
#include "menu.h"
#include "gpu.h"
unsigned long dwCoreFlags = 0;
// create lists/stuff for fonts (actually there are no more lists, but I am too lazy to change the func names ;)
void InitMenu(void)
{
}
// kill existing lists/fonts
void CloseMenu(void)
{
DestroyPic();
}
// DISPLAY FPS/MENU TEXT
#include <time.h>
//extern time_t tStart;
int iMPos=0; // menu arrow pos
void DisplayText(void) // DISPLAY TEXT
{
}
// Build Menu buffer (== Dispbuffer without FPS)...
void BuildDispMenu(int iInc)
{
}
// Some menu action...
void SwitchDispMenu(int iStep) // SWITCH DISP MENU
{
// update info
}

View File

@ -1,27 +0,0 @@
/***************************************************************************
menu.h - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#ifndef _GPU_MENU_H_
#define _GPU_MENU_H_
void DisplayText(void);
void CloseMenu(void);
void InitMenu(void);
void BuildDispMenu(int iInc);
void SwitchDispMenu(int iStep);
#endif // _GPU_MENU_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
/***************************************************************************
prim.h - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#ifndef _PRIMDRAW_H_
#define _PRIMDRAW_H_
typedef struct {
char bUsingTWin;
gxv_win_t TWin;
//unsigned long clutid; // global clut
unsigned short usMirror; // sprite mirror
int iDither;
int32_t drawX;
int32_t drawY;
int32_t drawW;
int32_t drawH;
uint32_t dwCfgFixes;
uint32_t dwActFixes;
uint32_t dwEmuFixes;
int iUseFixes;
int iUseDither;
} gxv_prim_t;
extern void (*primTableJ[256])(unsigned char *);
void UploadScreen (long Position);
void PrepareFullScreenUpload (long Position);
#endif // _PRIMDRAW_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,60 +0,0 @@
/***************************************************************************
soft.h - description
-------------------
begin : Sun Oct 28 2001
copyright : (C) 2001 by Pete Bernert
email : BlackDove@addcom.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#ifndef _GPU_SOFT_H_
#define _GPU_SOFT_H_
#include <stdint.h>
typedef struct {
short g_m1;
short g_m2;
short g_m3;
short DrawSemiTrans;
short Ymin;
short Ymax;
short ly0, lx0, ly1, lx1, ly2, lx2, ly3, lx3; // global psx vertex coords
int32_t GlobalTextAddrX, GlobalTextAddrY, GlobalTextTP;
int32_t GlobalTextREST, GlobalTextABR, GlobalTextPAGE;
} gxv_soft_t;
void offsetPSXLine(void);
void offsetPSX2(void);
void offsetPSX3(void);
void offsetPSX4(void);
void FillSoftwareAreaTrans(short x0, short y0, short x1, short y1,
unsigned short col);
void FillSoftwareArea(short x0, short y0, short x1, short y1,
unsigned short col);
void drawPoly3G(int32_t rgb1, int32_t rgb2, int32_t rgb3);
void drawPoly4G(int32_t rgb1, int32_t rgb2, int32_t rgb3, int32_t rgb4);
void drawPoly3F(int32_t rgb);
void drawPoly4F(int32_t rgb);
void drawPoly4FT(unsigned char * baseAddr);
void drawPoly4GT(unsigned char * baseAddr);
void drawPoly3FT(unsigned char * baseAddr);
void drawPoly3GT(unsigned char * baseAddr);
void DrawSoftwareSprite(unsigned char * baseAddr, short w, short h, int32_t tx,
int32_t ty);
void DrawSoftwareSpriteTWin(unsigned char * baseAddr, int32_t w, int32_t h);
void DrawSoftwareSpriteMirror(unsigned char * baseAddr, int32_t w, int32_t h);
void DrawSoftwareLineShade(int32_t rgb0, int32_t rgb1);
void DrawSoftwareLineFlat(int32_t rgb);
#endif // _GPU_SOFT_H_

View File

@ -1,26 +0,0 @@
#include <stdint.h>
// byteswappings
#define SWAP16(x) ({ uint16_t y=(x); (((y)>>8 & 0xff) | ((y)<<8 & 0xff00)); })
#define SWAP32(x) ({ uint32_t y=(x); (((y)>>24 & 0xfful) | ((y)>>8 & 0xff00ul) | ((y)<<8 & 0xff0000ul) | ((y)<<24 & 0xff000000ul)); })
// little endian config
#define HOST2LE32(x) (x)
#define HOST2BE32(x) SWAP32(x)
#define LE2HOST32(x) (x)
#define BE2HOST32(x) SWAP32(x)
#define HOST2LE16(x) (x)
#define HOST2BE16(x) SWAP16(x)
#define LE2HOST16(x) (x)
#define BE2HOST16(x) SWAP16(x)
#define GETLEs16(X) ((int16_t)GETLE16((uint16_t *)X))
#define GETLEs32(X) ((int16_t)GETLE32((uint16_t *)X))
#define GETLE16(X) LE2HOST16(*(uint16_t *)X)
#define GETLE32(X) LE2HOST32(*(uint32_t *)X)
#define GETLE16D(X) ({uint32_t val = GETLE32(X); (val<<16 | val >> 16);})
#define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y);}while(0)
#define PUTLE32(X, Y) do{*((uint32_t *)X)=HOST2LE16((uint32_t)Y);}while(0)