Skip to content

Commit

Permalink
Merge branch 'master' into no-addresses-in-code
Browse files Browse the repository at this point in the history
  • Loading branch information
warmCabin authored Jun 28, 2021
2 parents 9288c21 + 6376c9a commit 9687f84
Show file tree
Hide file tree
Showing 151 changed files with 7,400 additions and 5,552 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FCEUX SDL 2.3.0 SDL README
FCEUX SDL 2.4.0 SDL README
==========================
Originally By Lukas Sabota (sf: punkrockguy318)
Updated By mjbudd77
Expand Down Expand Up @@ -26,7 +26,7 @@ Table of Contents
* cmake - Required to build fceux.
* qt5 OR qt6 - (qt version >= 5.11 recommended)
* liblua5.1 (optional) - Will statically link internally if the system cannot provide this.
* libx264 (optional) - H.264 video encoder for avi recording
* libx264 (optional) - H.264 video encoder for avi recording (recommended)
* minizip
* zlib
* openGL
Expand Down
Binary file modified fceux.icns
Binary file not shown.
Binary file modified fceux1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/fceux.ico
Binary file not shown.
Binary file modified output/fceux.chm
Binary file not shown.
7 changes: 7 additions & 0 deletions pipelines/macOS_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ echo "Number of Processors: $NPROC";

INSTALL_PREFIX=/tmp/fceux

# Clean build and packaging directories
sudo rm -rf build;
sudo rm -rf $INSTALL_PREFIX/fceux.app;

# Remove windows specific DLLs so that they don't get installed
find output -name *.dll -exec rm -f {} \;

gcc --version

echo '****************************************'
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ You should get releases from here: https://sourceforge.net/projects/fceultra/fil

That's because github forces us to use tags we don't have for releases.

2.3.0 is the most recent release but most people are using the autobuilds.
2.4.0 is the most recent release but most people are using the autobuilds.
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,11 @@ install( TARGETS ${APP_NAME}
# Use \$ to defer expansion until install script is called; CPack will call it with its own CMAKE_INSTALL_PREFIX
set(APP \${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app)

install( DIRECTORY ${CMAKE_SOURCE_DIR}/output/.
DESTINATION ${APP_NAME}.app/Contents/Resources COMPONENT Extra )

set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
set(CPACK_GENERATOR "DRAGNDROP")
set(CPACK_GENERATOR "DragNDrop")
include(CPACK)

# macdeployqt tool that comes with Qt: https://doc.qt.io/qt-5/macos-deployment.html#macdeploy
Expand Down
3 changes: 3 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const char *FCEUI_GetAboutString(void)
"FCEU TAS - blip & nitsuja\n"
"FCEU TAS+ - Luke Gustafson\n"
"\n"
"Logo/icon:\n"
"Terwilf\n"
"\n"
"FCEUX is dedicated to the fallen heroes\n"
"of NES emulation. In Memoriam --\n"
"ugetab\n"
Expand Down
12 changes: 6 additions & 6 deletions src/drivers/Qt/AboutWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ AboutWindow::AboutWindow(QWidget *parent)
QPushButton *closeButton;
char stmp[256];

pm2 = pm.scaled( 64, 64 );
pm2 = pm.scaled( 128, 128 );

setWindowTitle( tr("About fceuX") );

Expand All @@ -93,13 +93,13 @@ AboutWindow::AboutWindow(QWidget *parent)

mainLayout->addLayout( hbox1 );

hbox1 = new QHBoxLayout();
lbl = new QLabel( tr("fceuX") );
//hbox1 = new QHBoxLayout();
//lbl = new QLabel( tr("fceuX") );

hbox1->addWidget( lbl );
hbox1->setAlignment( Qt::AlignCenter );
//hbox1->addWidget( lbl );
//hbox1->setAlignment( Qt::AlignCenter );

mainLayout->addLayout( hbox1 );
//mainLayout->addLayout( hbox1 );

hbox1 = new QHBoxLayout();
lbl = new QLabel( tr(FCEU_VERSION_STRING) );
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/Qt/ConsoleUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int fceuExecutablePath( char *outputPath, int outputSize )
if ( result == 0 )
{
char *dir;
exePath[ bufSize ] = 0;
exePath[ sizeof(exePath)-1 ] = 0;
//printf("EXE Path: '%s' \n", exePath );

dir = ::dirname( exePath );
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/Qt/ConsoleVideoConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
scalerSelect->addItem( tr("Prescale 2x"), 6 );
scalerSelect->addItem( tr("Prescale 3x"), 7 );
scalerSelect->addItem( tr("Prescale 4x"), 8 );
scalerSelect->addItem( tr("PAL"), 9 );
scalerSelect->addItem( tr("PAL 3x"), 9 );

hbox1 = new QHBoxLayout();

Expand Down
44 changes: 37 additions & 7 deletions src/drivers/Qt/ConsoleViewerGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <QApplication>
#include <QScreen>
#include <QWindow>
#include <QMouseEvent>

#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
Expand Down Expand Up @@ -72,13 +73,6 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
setMinimumHeight( 224 );
setFocusPolicy(Qt::StrongFocus);

QScreen *screen = QGuiApplication::primaryScreen();

if ( screen != NULL )
{
devPixRatio = screen->devicePixelRatio();
//printf("Ratio: %f \n", screen->devicePixelRatio() );
}
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);

localBuf = (uint32_t*)malloc( localBufSize );
Expand Down Expand Up @@ -116,8 +110,43 @@ ConsoleViewGL_t::~ConsoleViewGL_t(void)
}
}

void ConsoleViewGL_t::screenChanged( QScreen *screen )
{
int w,h;

devPixRatio = screen->devicePixelRatio();

w = (int)(devPixRatio * width() );
h = (int)(devPixRatio * height() );

view_width = w;
view_height = h;

gui_draw_area_width = w;
gui_draw_area_height = h;

buildTextures();

//printf("GL Ratio: %f %ix%i\n", screen->devicePixelRatio(), w, h );
}

int ConsoleViewGL_t::init( void )
{
QScreen *screen = NULL;

if ( window() != NULL )
{
if ( window()->windowHandle() != NULL )
{
screen = window()->windowHandle()->screen();
}
}

if ( screen != NULL )
{
devPixRatio = screen->devicePixelRatio();
printf("GL Ratio: %f \n", screen->devicePixelRatio() );
}
return 0;
}

Expand Down Expand Up @@ -624,5 +653,6 @@ void ConsoleViewGL_t::paintGL(void)
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_RECTANGLE);

nes_shm->render_count++;
//printf("Paint GL!\n");
}
3 changes: 3 additions & 0 deletions src/drivers/Qt/ConsoleViewerGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <stdint.h>

#include <QScreen>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>

Expand Down Expand Up @@ -36,6 +37,8 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
void getAspectXY( double &x, double &y );
double getAspectRatio(void);

void screenChanged(QScreen *scr);

protected:
void initializeGL(void);
void resizeGL(int w, int h);
Expand Down
33 changes: 24 additions & 9 deletions src/drivers/Qt/ConsoleViewerSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,21 @@ int ConsoleViewSDL_t::init(void)
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" );
}

if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
if ( SDL_WasInit(SDL_INIT_VIDEO) == 0 )
{
printf("[SDL] Failed to initialize video subsystem.\n");
return -1;
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
{
printf("[SDL] Failed to initialize video subsystem.\n");
return -1;
}
else
{
printf("Initialized SDL Video Subsystem\n");
}
}
else
{
printf("Initialized SDL Video Subsystem\n");
printf("SDL Video Subsystem is Initialized\n");
}

for (int i=0; i<SDL_GetNumVideoDrivers(); i++)
Expand All @@ -232,17 +239,19 @@ int ConsoleViewSDL_t::init(void)

windowHandle = this->winId();

//printf("Window Handle: %llu \n", windowHandle );

//sleep(1);
if (sdlWindow == NULL)
{
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
}

sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
if (sdlWindow == NULL)
{
printf("[SDL] Failed to create window from handle.\n");
return -1;
}

SDL_ShowWindow( sdlWindow );

uint32_t baseFlags = vsyncEnabled ? SDL_RENDERER_PRESENTVSYNC : 0;

sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_ACCELERATED);
Expand Down Expand Up @@ -289,6 +298,11 @@ void ConsoleViewSDL_t::cleanup(void)
SDL_DestroyRenderer(sdlRenderer);
sdlRenderer = NULL;
}
if ( sdlWindow )
{
SDL_DestroyWindow( sdlWindow );
sdlWindow = NULL;
}
}

void ConsoleViewSDL_t::reset(void)
Expand Down Expand Up @@ -422,7 +436,7 @@ void ConsoleViewSDL_t::resizeEvent(QResizeEvent *event)
s = event->size();
view_width = s.width();
view_height = s.height();
//printf("SDL Resize: %i x %i \n", view_width, view_height);
printf("SDL Resize: %i x %i \n", view_width, view_height);

gui_draw_area_width = view_width;
gui_draw_area_height = view_height;
Expand Down Expand Up @@ -636,4 +650,5 @@ void ConsoleViewSDL_t::render(void)

SDL_RenderPresent(sdlRenderer);

nes_shm->render_count++;
}
48 changes: 47 additions & 1 deletion src/drivers/Qt/ConsoleWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
// Create AVI Recording Disk Thread
aviDiskThread = new AviRecordDiskThread_t(this);

scrHandlerConnected = false;
}

consoleWin_t::~consoleWin_t(void)
Expand Down Expand Up @@ -334,6 +335,46 @@ void consoleWin_t::videoReset(void)
return;
}

void consoleWin_t::initScreenHandler(void)
{
if ( !scrHandlerConnected )
{
QWidget *w;

w = this->window();

// This needs to be scheduled after window creation.
if ( w != NULL)
{
QWindow *hdl = w->windowHandle();

if (hdl != NULL)
{
//printf("Connecting to screenChanged Signal\n");
connect( hdl, SIGNAL(screenChanged(QScreen*)), this, SLOT(winScreenChanged(QScreen*)) );
scrHandlerConnected = true;

winScreenChanged( hdl->screen() );
}
}
}

}

void consoleWin_t::winScreenChanged(QScreen *scr)
{
if ( scr == NULL )
{
return;
}

//printf("Screen Changed: %p\n", scr );
if ( viewport_GL != NULL )
{
viewport_GL->screenChanged( scr );
}
}

QSize consoleWin_t::calcRequiredSize(void)
{
QSize out( GL_NES_WIDTH, GL_NES_HEIGHT );
Expand Down Expand Up @@ -644,6 +685,12 @@ void consoleWin_t::dropEvent(QDropEvent *event)
}
}

void consoleWin_t::showEvent(QShowEvent *event)
{
//printf("Main Window Show Event\n");
initScreenHandler();
}

//---------------------------------------------------------------------------
void consoleWin_t::initHotKeys(void)
{
Expand Down Expand Up @@ -3867,7 +3914,6 @@ void consoleWin_t::syncActionConfig( QAction *act, const char *property )

void consoleWin_t::updatePeriodic(void)
{

// Process all events before attempting to render viewport
QCoreApplication::processEvents();

Expand Down
4 changes: 4 additions & 0 deletions src/drivers/Qt/ConsoleWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class consoleWin_t : public QMainWindow
bool mainMenuEmuPauseSet;
bool mainMenuEmuWasPaused;
bool mainMenuPauseWhenActv;
bool scrHandlerConnected;

std::list <std::string*> romList;
std::vector <autoFireMenuAction*> afActList;
Expand All @@ -261,11 +262,13 @@ class consoleWin_t : public QMainWindow
void keyReleaseEvent(QKeyEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void showEvent(QShowEvent *event);
void syncActionConfig( QAction *act, const char *property );
void showErrorMsgWindow(void);

private:
void initHotKeys(void);
void initScreenHandler(void);
void createMainMenu(void);
void buildRecentRomMenu(void);
void saveRecentRomMenu(void);
Expand Down Expand Up @@ -405,6 +408,7 @@ class consoleWin_t : public QMainWindow
void wavRecordStart(void);
void wavRecordAsStart(void);
void wavRecordStop(void);
void winScreenChanged( QScreen *scr );

};

Expand Down
Loading

0 comments on commit 9687f84

Please sign in to comment.