Merge pull request #116 from mjbudd77/master

Linux GTK GUI Feature Update
This commit is contained in:
mjbudd77 2020-06-05 08:01:33 -04:00 committed by GitHub
commit eeacd3c1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 9382 additions and 1872 deletions

View File

@ -19,8 +19,8 @@ opts.AddVariables(
BoolVariable('FRAMESKIP', 'Enable frameskipping', 1),
BoolVariable('OPENGL', 'Enable OpenGL support', 1),
BoolVariable('LUA', 'Enable Lua support', 1),
BoolVariable('GTK', 'Enable GTK2 GUI (SDL only)', 1),
BoolVariable('GTK3', 'Enable GTK3 GUI (SDL only)', 0),
BoolVariable('GTK', 'Enable GTK2 GUI (SDL only)', 0),
BoolVariable('GTK3', 'Enable GTK3 GUI (SDL only)', 1),
BoolVariable('NEWPPU', 'Enable new PPU core', 1),
BoolVariable('CREATE_AVI', 'Enable avi creation support (SDL only)', 1),
BoolVariable('LOGO', 'Enable a logoscreen when creating avis (SDL only)', 1),
@ -44,7 +44,7 @@ if platform.system == "ppc":
env['LSB_FIRST'] = 0
# Default compiler flags:
env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare'])
env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare', '-Wno-parentheses', '-Wno-unused-local-typedefs'])
env.Append(CXXFLAGS = ['-std=c++0x'])
if 'PLATFORM' in os.environ:
@ -97,7 +97,7 @@ else:
if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = "-DHAVE_ASPRINTF")
if env['SYSTEM_MINIZIP']:
assert conf.CheckLibWithHeader('minizip', 'minizip/unzip.h', 'C', 'unzOpen;', 1), "please install: libminizip"
assert env.ParseConfig('pkg-config minizip --cflags --libs'), "please install: libminizip"
assert conf.CheckLibWithHeader('z', 'zlib.h', 'c', 'inflate;', 1), "please install: zlib"
env.Append(CPPDEFINES=["_SYSTEM_MINIZIP"])
else:
@ -153,6 +153,9 @@ else:
elif conf.CheckLib('lua5.1'):
lua_link_flags = "-llua5.1"
lua_include_dir = "/usr/include/lua5.1"
elif conf.CheckLib('lua-5.1'):
lua_link_flags = "-llua-5.1"
lua_include_dir = "/usr/include/lua-5.1"
elif conf.CheckLib('lua'):
lua_link_flags = "-llua"
lua_include_dir = "/usr/include/lua"
@ -183,7 +186,7 @@ else:
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c', autoadd=1):
conf.env.Append(CCFLAGS = "-DOPENGL")
conf.env.Append(CPPDEFINES = ['PSS_STYLE=1'])
conf.env.Append(CPPDEFINES = ['PSS_STYLE=1',"FCEUDEF_DEBUGGER"])
env = conf.Finish()

8
appveyor.yml Normal file
View File

@ -0,0 +1,8 @@
version: 1.0.{build}
image:
- Visual Studio 2019
- Ubuntu2004
#- Ubuntu1804
build_script:
- cmd: msbuild "./vc/vc14_fceux.sln"
- sh: ./pipelines/linux_build.sh

16
azure-pipelines.yml Normal file
View File

@ -0,0 +1,16 @@
# C/C++ with GCC
# Build your C/C++ project with GCC using make.
# Add steps that publish test results, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc
trigger:
- master
- development
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
./pipelines/linux_build.sh
displayName: 'make'

119
pipelines/debpkg.pl Executable file
View File

@ -0,0 +1,119 @@
#!/usr/bin/perl
use strict;
my $VERSION="2.2.4";
my $INSTALL_PREFIX="/tmp/fceux";
my $CTL_FILENAME="$INSTALL_PREFIX/DEBIAN/control";
my $ARCH="amd64";
my $PKG_OUTPUT_FILE="fceux-$VERSION-$ARCH.deb";
# Start by auto figuring out dependencies of the executable.
# the rest of the package creation is trival.
my $SO_LIST=`objdump -x $INSTALL_PREFIX/usr/bin/fceux`;
#print "$SO_LIST";
my $i; my $j; my $k; my $pkg;
my @fd = split /\n/, $SO_LIST;
my @libls;
$#libls=0;
for ($i=0; $i<=$#fd; $i++)
{
#$fd[$i] =~ s/^\s+//;
#print "$fd[$i]\n";
if ( $fd[$i] =~ m/NEEDED\s+(.*)/ )
{
#print "$1 \n";
$libls[$#libls] = $1; $#libls++;
}
}
my %pkghash; my $pkgsearch;
my @pkglist; my @pkgdeps;
my $pkg; my $filepath;
$#pkgdeps=0;
for ($i=0; $i<$#libls; $i++)
{
$pkgsearch=`dpkg-query -S $libls[$i]`;
@pkglist = split /\n/, $pkgsearch;
for ($j=0; $j<=$#pkglist; $j++)
{
#$pkghash{$pkg} = 1;
#print " $libls[$i] '$pkglist[$j]' \n";
if ( $pkglist[$j] =~ m/(.*):$ARCH:\s+(.*)/ )
{
$pkg = $1;
$filepath = $2;
$filepath =~ s/^.*\///;
if ( $libls[$i] eq $filepath )
{
#print "PKG: '$pkg' '$libls[$i]' == '$filepath' \n";
# Don't put duplicate entries into the pkg depend list.
if ( !defined( $pkghash{$pkg} ) )
{
$pkgdeps[ $#pkgdeps ] = $pkg; $#pkgdeps++;
$pkghash{$pkg} = 1;
}
}
}
}
}
#
#
system("mkdir -p $INSTALL_PREFIX/DEBIAN");
open CTL, ">$CTL_FILENAME" or die "Error: Could not open file '$CTL_FILENAME'\n";
#
print CTL "Package: fceux\n";
print CTL "Version: $VERSION\n";
print CTL "Section: games\n";
print CTL "Priority: extra\n";
print CTL "Architecture: $ARCH\n";
print CTL "Homepage: http://fceux.com/\n";
print CTL "Essential: no\n";
#print CTL "Installed-Size: 1024\n";
print CTL "Maintainer: mjbudd77\n";
print CTL "Description: fceux is an emulator of the original (8-bit) Nintendo Entertainment System (NES)\n";
print CTL "Depends: $pkgdeps[0]";
for ($i=1; $i<$#pkgdeps; $i++)
{
print CTL ", $pkgdeps[$i]";
}
print CTL "\n";
close CTL;
#system("cat $CTL_FILENAME");
#
chdir "/tmp";
system("dpkg-deb --build fceux ");
if ( !(-e "/tmp/fceux.deb") )
{
die "Error: Failed to create package $PKG_OUTPUT_FILE\n";
}
system("mv fceux.deb $PKG_OUTPUT_FILE");
system("dpkg-deb -I $PKG_OUTPUT_FILE");
#
if ( -e "/tmp/$PKG_OUTPUT_FILE" )
{
print "**********************************************\n";
print "Created deb package: /tmp/$PKG_OUTPUT_FILE\n";
print "**********************************************\n";
}
else
{
die "Error: Failed to create package $PKG_OUTPUT_FILE\n";
}

114
pipelines/linux_build.sh Executable file
View File

@ -0,0 +1,114 @@
#!/bin/bash
id
pwd
cat /etc/os-release
SCRIPT_DIR=$( cd $(dirname $BASH_SOURCE[0]); pwd );
#echo $SCRIPT_DIR;
gcc --version
python2 --version
python3 --version
INSTALL_PREFIX=/tmp/fceux
echo '****************************************'
echo "APPVEYOR_SSH_KEY=$APPVEYOR_SSH_KEY";
echo "APPVEYOR_SSH_BLOCK=$APPVEYOR_SSH_BLOCK";
echo '****************************************'
echo '****************************************'
echo '****************************************'
echo '*** Installing Package Dependencies ***'
echo '****************************************'
echo '****************************************'
# Install Lua-5.1 development package
echo '****************************************'
echo 'Install Dependency lua5.1-dev'
echo '****************************************'
sudo apt-get --assume-yes install lua5.1-dev
pkg-config --cflags --libs lua5.1
# Install libSDL-1.2 and libSDL-2
echo '****************************************'
echo 'Install Dependency libsdl1.2-dev'
echo '****************************************'
sudo apt-get --assume-yes install libsdl1.2-dev
sdl-config --cflags --libs
echo '****************************************'
echo 'Install Dependency libsdl2-dev'
echo '****************************************'
sudo apt-get --assume-yes install libsdl2-dev
sdl2-config --cflags --libs
# Install libminizip-dev
echo '****************************************'
echo 'Install Dependency libminizip-dev'
echo '****************************************'
sudo apt-get --assume-yes install libminizip-dev
pkg-config --cflags --libs minizip
# GTK+-2 is no longer needed
#sudo apt-get install libgtk2.0-dev
# Install GTK+-3
echo '****************************************'
echo 'Install Dependency libgtk-3-dev'
echo '****************************************'
sudo apt-get --assume-yes install libgtk-3-dev
pkg-config --cflags --libs gtk+-3.0
# Install GTK+-3 Sourceview
sudo apt-get --assume-yes install libgtksourceview-3.0-dev
pkg-config --cflags --libs gtksourceview-3.0
# Install scons
echo '****************************************'
echo 'Install Build Dependency scons'
echo '****************************************'
sudo apt-get --assume-yes install scons
# Install cppcheck
echo '****************************************'
echo 'Install Check Dependency cppcheck'
echo '****************************************'
sudo apt-get --assume-yes install cppcheck
echo '**************************'
echo '*** Building Project ***'
echo '**************************'
mkdir -p $INSTALL_PREFIX/usr;
scons --clean
scons GTK3=1 SYSTEM_LUA=1 SYSTEM_MINIZIP=1 CREATE_AVI=1 install --prefix=$INSTALL_PREFIX/usr
# Debug via ssh if necessary
if [ ! -z $APPVEYOR_SSH_BLOCK ]; then
curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -
fi
if [ -e $INSTALL_PREFIX/usr/bin/fceux ]; then
echo '**************************************************************'
echo 'Printing Shared Object Dependencies for ./bin/fceux Executable'
echo '**************************************************************'
ldd $INSTALL_PREFIX/usr/bin/fceux
else
echo "Error: Executable Failed to build: $INSTALL_PREFIX/usr/bin/fceux";
exit 1;
fi
echo '**************************************************************'
echo 'Printing To Be Packaged Files '
echo '**************************************************************'
find $INSTALL_PREFIX
echo '**************************************************************'
echo 'Creating Debian Package'
echo '**************************************************************'
$SCRIPT_DIR/debpkg.pl;
echo '**************************************************************'
echo 'Testing Install of Package'
echo '**************************************************************'
sudo dpkg -i /tmp/fceux-*.deb

View File

@ -104,4 +104,4 @@ bool FCEU_OpenGenie(void);
void FCEU_CloseGenie(void);
void FCEU_KillGenie(void);
#endif#endif
#endif

View File

@ -565,9 +565,9 @@ void BreakHit(int bp_num)
{
FCEUI_SetEmulationPaused(EMULATIONPAUSED_PAUSED); //mbg merge 7/19/06 changed to use EmulationPaused()
#ifdef WIN32
//#ifdef WIN32
FCEUD_DebugBreakpoint(bp_num);
#endif
//#endif
}
int StackAddrBackup;

View File

@ -218,6 +218,11 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int
return(0);
//allocate adequate room for 32bpp palette
if ( palettetranslate )
{
free(palettetranslate);
palettetranslate=NULL;
}
palettetranslate=(uint32*)FCEU_dmalloc(256*4 + 512*4);
if(!palettetranslate)

View File

@ -8,7 +8,11 @@ Export('env')
source_list = Split(
"""
input.cpp
cheat.cpp
config.cpp
memview.cpp
ramwatch.cpp
debugger.cpp
sdl.cpp
sdl-joystick.cpp
sdl-sound.cpp

1323
src/drivers/sdl/cheat.cpp Normal file

File diff suppressed because it is too large Load Diff

3
src/drivers/sdl/cheat.h Normal file
View File

@ -0,0 +1,3 @@
// cheat.h
void openCheatsWindow(void);

View File

@ -26,6 +26,46 @@
#include <sys/stat.h>
#include <sys/types.h>
static const char* HotkeyStrings[HK_MAX] = {
"CheatMenu",
"BindState",
"LoadLua",
"ToggleBG",
"SaveState",
"FDSSelect",
"LoadState",
"FDSEject",
"VSInsertCoin",
"VSToggleDip",
"MovieToggleFrameDisplay",
"SubtitleDisplay",
"Reset",
"Screenshot",
"Pause",
"DecreaseSpeed",
"IncreaseSpeed",
"FrameAdvance",
"Turbo",
"ToggleInputDisplay",
"ToggleMovieRW",
"MuteCapture",
"Quit",
"FrameAdvanceLagSkip",
"LagCounterDisplay",
"SelectState0", "SelectState1", "SelectState2", "SelectState3",
"SelectState4", "SelectState5", "SelectState6", "SelectState7",
"SelectState8", "SelectState9", "SelectStateNext", "SelectStatePrev",
"VolumeDown", "VolumeUp" };
const char *getHotkeyString( int i )
{
if ( (i>=0) && (i<HK_MAX) )
{
return HotkeyStrings[i];
}
return NULL;
}
/**
* Read a custom pallete from a file and load it into the core.
*/
@ -269,9 +309,10 @@ InitConfig()
config->addOption("4buttonexit", "SDL.ABStartSelectExit", 0);
// GamePad 0 - 3
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++) {
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++)
{
char buf[64];
snprintf(buf, 20, "SDL.Input.GamePad.%d.", i);
snprintf(buf, sizeof(buf)-1, "SDL.Input.GamePad.%u.", i);
prefix = buf;
config->addOption(prefix + "DeviceType", DefaultGamePadDevice[i]);
@ -284,7 +325,7 @@ InitConfig()
// PowerPad 0 - 1
for(unsigned int i = 0; i < POWERPAD_NUM_DEVICES; i++) {
char buf[64];
snprintf(buf, 20, "SDL.Input.PowerPad.%d.", i);
snprintf(buf, sizeof(buf)-1, "SDL.Input.PowerPad.%u.", i);
prefix = buf;
config->addOption(prefix + "DeviceType", DefaultPowerPadDevice[i]);

View File

@ -22,36 +22,7 @@ enum HOTKEY { HK_CHEAT_MENU=0, HK_BIND_STATE, HK_LOAD_LUA, HK_TOGGLE_BG,
HK_SELECT_STATE_NEXT, HK_SELECT_STATE_PREV, HK_VOLUME_DOWN, HK_VOLUME_UP,
HK_MAX};
const char *getHotkeyString( int i );
static const char* HotkeyStrings[HK_MAX] = {
"CheatMenu",
"BindState",
"LoadLua",
"ToggleBG",
"SaveState",
"FDSSelect",
"LoadState",
"FDSEject",
"VSInsertCoin",
"VSToggleDip",
"MovieToggleFrameDisplay",
"SubtitleDisplay",
"Reset",
"Screenshot",
"Pause",
"DecreaseSpeed",
"IncreaseSpeed",
"FrameAdvance",
"Turbo",
"ToggleInputDisplay",
"ToggleMovieRW",
"MuteCapture",
"Quit",
"FrameAdvanceLagSkip",
"LagCounterDisplay",
"SelectState0", "SelectState1", "SelectState2", "SelectState3",
"SelectState4", "SelectState5", "SelectState6", "SelectState7",
"SelectState8", "SelectState9", "SelectStateNext", "SelectStatePrev",
"VolumeDown", "VolumeUp" };
#endif

2284
src/drivers/sdl/debugger.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
// debugger.h
//
void openDebuggerWindow (void);

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,6 @@
#endif
extern GtkWidget* MainWindow;
extern GtkWidget* evbox;
extern GtkRadioAction* stateSlot;
extern int GtkMouseData[3];
extern bool gtkIsStarted;
@ -55,6 +54,8 @@ void setGl(GtkWidget* w, gpointer p);
void setDoubleBuffering(GtkWidget* w, gpointer p);
#endif
void setStateMenuItem( int i );
void openVideoConfig();
void openSoundConfig();
void quit ();

View File

@ -31,6 +31,7 @@
#include "../../movie.h"
#include "../../fceu.h"
#include "../../driver.h"
#include "../../state.h"
#include "../../utils/xstring.h"
#ifdef _S9XLUA_H
#include "../../fceulua.h"
@ -177,12 +178,12 @@ int Hotkeys[HK_MAX] = { 0 };
// on every cycle of keyboardinput()
void
setHotKeys ()
setHotKeys (void)
{
std::string prefix = "SDL.Hotkeys.";
for (int i = 0; i < HK_MAX; i++)
{
g_config->getOption (prefix + HotkeyStrings[i], &Hotkeys[i]);
g_config->getOption (prefix + getHotkeyString(i), &Hotkeys[i]);
}
return;
}
@ -281,16 +282,16 @@ std::string GetFilename (const char *title, bool save, const char *filter)
if (save)
fileChooser = gtk_file_chooser_dialog_new ("Save as", NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
"_Cancel",
GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE_AS,
"_Save",
GTK_RESPONSE_ACCEPT, NULL);
else
fileChooser = gtk_file_chooser_dialog_new ("Open", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL,
"_Cancel",
GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN,
"_Open",
GTK_RESPONSE_ACCEPT, NULL);
// TODO: make file filters case insensitive
@ -739,22 +740,30 @@ static void KeyboardCommands ()
#endif
for (int i = 0; i < 10; i++)
{
if (_keyonly (Hotkeys[HK_SELECT_STATE_0 + i]))
{
#ifdef _GTK
gtk_radio_action_set_current_value (stateSlot, i);
setStateMenuItem(i);
#endif
FCEUI_SelectState (i, 1);
}
}
if (_keyonly (Hotkeys[HK_SELECT_STATE_NEXT]))
{
FCEUI_SelectStateNext (1);
#ifdef _GTK
setStateMenuItem( CurrentState );
#endif
}
if (_keyonly (Hotkeys[HK_SELECT_STATE_PREV]))
{
FCEUI_SelectStateNext (-1);
#ifdef _GTK
setStateMenuItem( CurrentState );
#endif
}
if (_keyonly (Hotkeys[HK_BIND_STATE]))
@ -1061,6 +1070,10 @@ int ButtonConfigBegin ()
// TODO - SDL2
#else
screen = SDL_SetVideoMode (420, 200, 8, 0);
if ( screen == NULL )
{
printf("Error: SDL_SetVideoMode Failed\n");
}
SDL_WM_SetCaption ("Button Config", 0);
#endif
}
@ -1663,7 +1676,9 @@ const char * ButtonName (const ButtConfig * bc, int which)
#else
return SDL_GetKeyName ((SDLKey) bc->ButtonNum[which]);
#endif
break;
case BUTTC_JOYSTICK:
{
int joyNum, inputNum;
const char *inputType, *inputDirection;
@ -1685,13 +1700,13 @@ const char * ButtonName (const ButtConfig * bc, int which)
inputValue = bc->ButtonNum[which] & 0xF;
if (inputValue & SDL_HAT_UP)
strncat (direction, "Up ", sizeof (direction));
strncat (direction, "Up ", sizeof (direction)-1);
if (inputValue & SDL_HAT_DOWN)
strncat (direction, "Down ", sizeof (direction));
strncat (direction, "Down ", sizeof (direction)-1);
if (inputValue & SDL_HAT_LEFT)
strncat (direction, "Left ", sizeof (direction));
strncat (direction, "Left ", sizeof (direction)-1);
if (inputValue & SDL_HAT_RIGHT)
strncat (direction, "Right ", sizeof (direction));
strncat (direction, "Right ", sizeof (direction)-1);
if (direction[0])
inputDirection = direction;
@ -1704,6 +1719,9 @@ const char * ButtonName (const ButtConfig * bc, int which)
inputNum = bc->ButtonNum[which];
inputDirection = "";
}
sprintf( name, "js%i:%s%i%s", joyNum, inputType, inputNum, inputDirection );
}
break;
}
return name;
@ -2041,7 +2059,7 @@ UpdateInput (Config * config)
for (unsigned int i = 0; i < 3; i++)
{
snprintf (buf, 64, "SDL.Input.%d", i);
snprintf (buf, 64, "SDL.Input.%u", i);
config->getOption (buf, &device);
if (device == "None")
@ -2127,7 +2145,7 @@ UpdateInput (Config * config)
for (unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++)
{
char buf[64];
snprintf (buf, 20, "SDL.Input.GamePad.%d.", i);
snprintf (buf, sizeof(buf)-1, "SDL.Input.GamePad.%u.", i);
prefix = buf;
config->getOption (prefix + "DeviceType", &device);
@ -2160,7 +2178,7 @@ UpdateInput (Config * config)
for (unsigned int i = 0; i < POWERPAD_NUM_DEVICES; i++)
{
char buf[64];
snprintf (buf, 20, "SDL.Input.PowerPad.%d.", i);
snprintf (buf, 32, "SDL.Input.PowerPad.%u.", i);
prefix = buf;
config->getOption (prefix + "DeviceType", &device);

1627
src/drivers/sdl/memview.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
// memview.h
//
void openMemoryViewWindow (void);

1235
src/drivers/sdl/ramwatch.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
// ramwatch.h
void openMemoryWatchWindow(void);

View File

@ -216,7 +216,7 @@ int FCEUD_GetDataFromServer(uint8 *data)
}
}
if(SDLNet_SocketReady(UDPSocket)
if(SDLNet_SocketReady(UDPSocket))
{

View File

@ -55,7 +55,7 @@
extern Config *g_config;
// STATIC GLOBALS
extern SDL_Surface *s_screen;
static SDL_Surface *s_screen = NULL;
static SDL_Surface *s_BlitBuf; // Buffer when using hardware-accelerated blits.
static SDL_Surface *s_IconSurface = NULL;
@ -83,6 +83,8 @@ static int s_paletterefresh;
extern bool MaxSpeed;
extern unsigned int gtk_draw_area_width;
extern unsigned int gtk_draw_area_height;
/**
* Attempts to destroy the graphical video display. Returns 0 on
* success, -1 on failure.
@ -181,13 +183,16 @@ InitVideo(FCEUGI *gi)
g_config->getOption("SDL.SpecialFilter", &s_sponge);
g_config->getOption("SDL.XStretch", &xstretch);
g_config->getOption("SDL.YStretch", &ystretch);
g_config->getOption("SDL.LastXRes", &xres);
g_config->getOption("SDL.LastYRes", &yres);
//g_config->getOption("SDL.LastXRes", &xres);
//g_config->getOption("SDL.LastYRes", &yres);
g_config->getOption("SDL.ClipSides", &s_clipSides);
g_config->getOption("SDL.NoFrame", &noframe);
g_config->getOption("SDL.ShowFPS", &show_fps);
xres = gtk_draw_area_width;
yres = gtk_draw_area_height;
// check the starting, ending, and total scan lines
FCEUI_GetCurrentVidSystem(&s_srendline, &s_erendline);
s_tlines = s_erendline - s_srendline + 1;
@ -374,10 +379,10 @@ InitVideo(FCEUGI *gi)
}
}
int scrw = NWIDTH * s_exs;
if(s_sponge == 3) {
scrw = 301 * s_exs;
}
//int scrw = NWIDTH * s_exs;
//if(s_sponge == 3) {
// scrw = 301 * s_exs;
//}
#ifdef OPENGL
if(!s_useOpenGL) {
@ -422,28 +427,30 @@ InitVideo(FCEUGI *gi)
}
#endif
s_screen = SDL_SetVideoMode(scrw, (int)(s_tlines * s_eys),
//s_screen = SDL_SetVideoMode(scrw, (int)(s_tlines * s_eys),
s_screen = SDL_SetVideoMode( xres, yres,
desbpp, flags);
if(!s_screen) {
FCEUD_PrintError(SDL_GetError());
return -1;
}
#ifdef _GTK
if(noGui == 0)
{
GtkRequisition req;
gtk_widget_size_request(GTK_WIDGET(MainWindow), &req);
gtk_window_resize(GTK_WINDOW(MainWindow), req.width, req.height);
// This code is not needed, gui.cpp handles all window sizing.
//#ifdef _GTK
// if(noGui == 0)
// {
// GtkRequisition req;
// gtk_widget_get_preferred_size(GTK_WIDGET(MainWindow), NULL, &req);
// gtk_window_resize(GTK_WINDOW(MainWindow), req.width, req.height);
// }
//#endif
}
#endif
}
s_curbpp = s_screen->format->BitsPerPixel;
if(!s_screen) {
FCEUD_PrintError(SDL_GetError());
KillVideo();
return -1;
}
s_curbpp = s_screen->format->BitsPerPixel;
#if 0
// XXX soules - this would be creating a surface on the video
@ -539,7 +546,7 @@ void ToggleFS()
if(noGui == 0)
{
if(!fullscreen)
showGui(0);
showGui(0);
else
showGui(1);
}
@ -665,14 +672,14 @@ BlitScreen(uint8 *XBuf)
dest = (uint8*)TmpScreen->pixels;
if(s_fullscreen) {
//if(s_fullscreen) { // Always do this calculation now. Screen resolution is always provided.
xo = (int)(((TmpScreen->w - NWIDTH * s_exs)) / 2);
dest += xo * (s_curbpp >> 3);
if(TmpScreen->h > (s_tlines * s_eys)) {
yo = (int)((TmpScreen->h - s_tlines * s_eys) / 2);
dest += yo * TmpScreen->pitch;
}
}
//}
// XXX soules - again, I'm surprised SDL can't handle this
// perform the blit, converting bpp if necessary

View File

@ -9,7 +9,6 @@
uint32 PtoV(uint16 x, uint16 y);
bool FCEUD_ShouldDrawInputAids();
bool FCEUI_AviDisableMovieMessages();
static SDL_Surface *s_screen;
bool FCEUI_AviEnableHUDrecording();
void FCEUI_SetAviEnableHUDrecording(bool enable);
bool FCEUI_AviDisableMovieMessages();

View File

@ -193,9 +193,9 @@ static void ShowUsage(char *prog)
*/
int LoadGame(const char *path)
{
if (isloaded){
CloseGame();
}
if (isloaded){
CloseGame();
}
if(!FCEUI_LoadGame(path, 1)) {
return 0;
}
@ -614,8 +614,8 @@ int main(int argc, char *argv[])
g_config->getOption("SDL.InputCfg", &s);
if(s.size() != 0)
{
InitVideo(GameInfo);
InputCfg(s);
InitVideo(GameInfo);
InputCfg(s);
}
// set the FAMICOM PAD 2 Mic thing
{
@ -861,10 +861,15 @@ int main(int argc, char *argv[])
InitGTKSubsystem(argc, argv);
while(gtk_events_pending())
gtk_main_iteration_do(FALSE);
// Ensure that the GUI has fully initialized.
// Give the X-server a small amount of time to init.
usleep(100000);
while(gtk_events_pending())
gtk_main_iteration_do(FALSE);
}
#endif
if(romIndex >= 0)
if(romIndex >= 0)
{
// load the specified game
error = LoadGame(argv[romIndex]);
@ -915,6 +920,15 @@ int main(int argc, char *argv[])
g_config->setOption("SDL.LuaScript", "");
if (s != "")
{
#ifdef __linux
// Resolve absolute path to file
char fullpath[2048];
if ( realpath( s.c_str(), fullpath ) != NULL )
{
//printf("Fullpath: '%s'\n", fullpath );
s.assign( fullpath );
}
#endif
FCEU_LoadLuaCode(s.c_str());
}
#endif

View File

@ -133,7 +133,7 @@ void EMUFILE::write64le(u64 val)
size_t EMUFILE::read64le(u64 *Bufo)
{
u64 buf;
u64 buf=0;
if(fread((char*)&buf,8) != 8)
return 0;
#ifndef LOCAL_BE
@ -174,7 +174,7 @@ size_t EMUFILE::read32le(s32* Bufo) { return read32le((u32*)Bufo); }
size_t EMUFILE::read32le(u32* Bufo)
{
u32 buf;
u32 buf=0;
if(fread(&buf,4)<4)
return 0;
#ifndef LOCAL_BE
@ -213,7 +213,7 @@ size_t EMUFILE::read16le(s16* Bufo) { return read16le((u16*)Bufo); }
size_t EMUFILE::read16le(u16* Bufo)
{
u32 buf;
u32 buf=0;
if(fread(&buf,2)<2)
return 0;
#ifndef LOCAL_BE

View File

@ -104,12 +104,14 @@ void ApplyIPS(FILE *ips, FCEUFILE* fp)
if((offset+size)>(uint32)fp->size)
{
// Probably a little slow.
buf=(char *)realloc(buf,offset+size);
if(!buf)
char *newbuf=(char *)realloc(buf,offset+size);
if(!newbuf)
{
free(buf); buf=NULL;
FCEU_printf(" Oops. IPS patch %d(type RLE) goes beyond end of file. Could not allocate memory.\n",count);
goto end;
}
buf=newbuf;
memset(buf+fp->size,0,offset+size-fp->size);
fp->size=offset+size;
}
@ -127,12 +129,14 @@ void ApplyIPS(FILE *ips, FCEUFILE* fp)
if((offset+size)>(uint32)fp->size)
{
// Probably a little slow.
buf=(char *)realloc(buf,offset+size);
if(!buf)
char *newbuf=(char *)realloc(buf,offset+size);
if(!newbuf)
{
free(buf); buf=NULL;
FCEU_printf(" Oops. IPS patch %d(type normal) goes beyond end of file. Could not allocate memory.\n",count);
goto end;
}
buf=newbuf;
memset(buf+fp->size,0,offset+size-fp->size);
}
fread(buf+offset,1,size,ips);
@ -475,9 +479,9 @@ void FCEUI_SetDirOverride(int which, char *n)
va_list ap;
int ret;
va_start(ap,fmt);
if(!(*strp=(char*)FCEU_dmalloc(2048))) //mbg merge 7/17/06 cast to char*
return(0);
va_start(ap,fmt);
ret=vsnprintf(*strp,2048,fmt,ap);
va_end(ap);
return(ret);

View File

@ -1375,7 +1375,9 @@ static void DoLine(void) {
GameHBIRQHook();
}
#ifdef WIN32
DEBUG(FCEUD_UpdateNTView(scanline, 0));
#endif
if (SpriteON)
RefreshSprites();
@ -1852,7 +1854,9 @@ int FCEUPPU_Loop(int skip) {
for (scanline = 0; scanline < totalscanlines; ) { //scanline is incremented in DoLine. Evil. :/
deempcnt[deemp]++;
if (scanline < 240)
#ifdef WIN32
DEBUG(FCEUD_UpdatePPUView(scanline, 1));
#endif
DoLine();
if (scanline < normalscanlines || scanline == totalscanlines)
@ -2145,8 +2149,10 @@ int FCEUX_PPU_Loop(int skip) {
ppuphase = PPUPHASE_BG;
if (sl != 0 && sl < 241) { // ignore the invisible
#ifdef WIN32
DEBUG(FCEUD_UpdatePPUView(scanline = yp, 1));
DEBUG(FCEUD_UpdateNTView(scanline = yp, 1));
#endif
}
//hack to fix SDF ship intro screen with split. is it right?

View File

@ -275,7 +275,7 @@ int write64le(uint64 b, EMUFILE* os)
int read32le(uint32 *Bufo, EMUFILE *fp)
{
uint32 buf;
uint32 buf=0;
if(fp->_fread(&buf,4)<4)
return 0;
#ifdef LOCAL_LE
@ -288,7 +288,7 @@ int read32le(uint32 *Bufo, EMUFILE *fp)
int read16le(u16 *Bufo, EMUFILE *is)
{
u16 buf;
u16 buf=0;
if(is->_fread((char*)&buf,2) != 2)
return 0;
#ifdef LOCAL_LE
@ -301,7 +301,7 @@ int read16le(u16 *Bufo, EMUFILE *is)
int read64le(uint64 *Bufo, EMUFILE *is)
{
uint64 buf;
uint64 buf=0;
if(is->_fread((char*)&buf,8) != 8)
return 0;
#ifdef LOCAL_LE

View File

@ -28,10 +28,10 @@ uint32 uppow2(uint32 n)
int x;
for(x=31;x>=0;x--)
if(n&(1<<x))
if(n&(1u<<x))
{
if((1<<x)!=n)
return(1<<(x+1));
if((1u<<x)!=n)
return(1u<<(x+1));
break;
}
return n;