Skip to content

Commit 9687f84

Browse files
authored
Merge branch 'master' into no-addresses-in-code
2 parents 9288c21 + 6376c9a commit 9687f84

File tree

151 files changed

+7400
-5552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+7400
-5552
lines changed

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FCEUX SDL 2.3.0 SDL README
1+
FCEUX SDL 2.4.0 SDL README
22
==========================
33
Originally By Lukas Sabota (sf: punkrockguy318)
44
Updated By mjbudd77
@@ -26,7 +26,7 @@ Table of Contents
2626
* cmake - Required to build fceux.
2727
* qt5 OR qt6 - (qt version >= 5.11 recommended)
2828
* liblua5.1 (optional) - Will statically link internally if the system cannot provide this.
29-
* libx264 (optional) - H.264 video encoder for avi recording
29+
* libx264 (optional) - H.264 video encoder for avi recording (recommended)
3030
* minizip
3131
* zlib
3232
* openGL

fceux.icns

-8.85 KB
Binary file not shown.

fceux1.png

1.62 KB
Loading

icons/fceux.ico

354 KB
Binary file not shown.

output/fceux.chm

2.16 KB
Binary file not shown.

pipelines/macOS_build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ echo "Number of Processors: $NPROC";
2020

2121
INSTALL_PREFIX=/tmp/fceux
2222

23+
# Clean build and packaging directories
24+
sudo rm -rf build;
25+
sudo rm -rf $INSTALL_PREFIX/fceux.app;
26+
27+
# Remove windows specific DLLs so that they don't get installed
28+
find output -name *.dll -exec rm -f {} \;
29+
2330
gcc --version
2431

2532
echo '****************************************'

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ You should get releases from here: https://sourceforge.net/projects/fceultra/fil
1818

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

21-
2.3.0 is the most recent release but most people are using the autobuilds.
21+
2.4.0 is the most recent release but most people are using the autobuilds.

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,11 @@ install( TARGETS ${APP_NAME}
554554
# Use \$ to defer expansion until install script is called; CPack will call it with its own CMAKE_INSTALL_PREFIX
555555
set(APP \${CMAKE_INSTALL_PREFIX}/${APP_NAME}.app)
556556

557+
install( DIRECTORY ${CMAKE_SOURCE_DIR}/output/.
558+
DESTINATION ${APP_NAME}.app/Contents/Resources COMPONENT Extra )
559+
557560
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/fceux.icns )
558-
set(CPACK_GENERATOR "DRAGNDROP")
561+
set(CPACK_GENERATOR "DragNDrop")
559562
include(CPACK)
560563

561564
# macdeployqt tool that comes with Qt: https://doc.qt.io/qt-5/macos-deployment.html#macdeploy

src/config.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const char *FCEUI_GetAboutString(void)
4141
"FCEU TAS - blip & nitsuja\n"
4242
"FCEU TAS+ - Luke Gustafson\n"
4343
"\n"
44+
"Logo/icon:\n"
45+
"Terwilf\n"
46+
"\n"
4447
"FCEUX is dedicated to the fallen heroes\n"
4548
"of NES emulation. In Memoriam --\n"
4649
"ugetab\n"

src/drivers/Qt/AboutWindow.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ AboutWindow::AboutWindow(QWidget *parent)
7676
QPushButton *closeButton;
7777
char stmp[256];
7878

79-
pm2 = pm.scaled( 64, 64 );
79+
pm2 = pm.scaled( 128, 128 );
8080

8181
setWindowTitle( tr("About fceuX") );
8282

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

9494
mainLayout->addLayout( hbox1 );
9595

96-
hbox1 = new QHBoxLayout();
97-
lbl = new QLabel( tr("fceuX") );
96+
//hbox1 = new QHBoxLayout();
97+
//lbl = new QLabel( tr("fceuX") );
9898

99-
hbox1->addWidget( lbl );
100-
hbox1->setAlignment( Qt::AlignCenter );
99+
//hbox1->addWidget( lbl );
100+
//hbox1->setAlignment( Qt::AlignCenter );
101101

102-
mainLayout->addLayout( hbox1 );
102+
//mainLayout->addLayout( hbox1 );
103103

104104
hbox1 = new QHBoxLayout();
105105
lbl = new QLabel( tr(FCEU_VERSION_STRING) );

src/drivers/Qt/ConsoleUtilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int fceuExecutablePath( char *outputPath, int outputSize )
273273
if ( result == 0 )
274274
{
275275
char *dir;
276-
exePath[ bufSize ] = 0;
276+
exePath[ sizeof(exePath)-1 ] = 0;
277277
//printf("EXE Path: '%s' \n", exePath );
278278

279279
dir = ::dirname( exePath );

src/drivers/Qt/ConsoleVideoConf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
9797
scalerSelect->addItem( tr("Prescale 2x"), 6 );
9898
scalerSelect->addItem( tr("Prescale 3x"), 7 );
9999
scalerSelect->addItem( tr("Prescale 4x"), 8 );
100-
scalerSelect->addItem( tr("PAL"), 9 );
100+
scalerSelect->addItem( tr("PAL 3x"), 9 );
101101

102102
hbox1 = new QHBoxLayout();
103103

src/drivers/Qt/ConsoleViewerGL.cpp

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include <QApplication>
3232
#include <QScreen>
33+
#include <QWindow>
3334
#include <QMouseEvent>
3435

3536
#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
@@ -72,13 +73,6 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
7273
setMinimumHeight( 224 );
7374
setFocusPolicy(Qt::StrongFocus);
7475

75-
QScreen *screen = QGuiApplication::primaryScreen();
76-
77-
if ( screen != NULL )
78-
{
79-
devPixRatio = screen->devicePixelRatio();
80-
//printf("Ratio: %f \n", screen->devicePixelRatio() );
81-
}
8276
localBufSize = (4 * GL_NES_WIDTH) * (4 * GL_NES_HEIGHT) * sizeof(uint32_t);
8377

8478
localBuf = (uint32_t*)malloc( localBufSize );
@@ -116,8 +110,43 @@ ConsoleViewGL_t::~ConsoleViewGL_t(void)
116110
}
117111
}
118112

113+
void ConsoleViewGL_t::screenChanged( QScreen *screen )
114+
{
115+
int w,h;
116+
117+
devPixRatio = screen->devicePixelRatio();
118+
119+
w = (int)(devPixRatio * width() );
120+
h = (int)(devPixRatio * height() );
121+
122+
view_width = w;
123+
view_height = h;
124+
125+
gui_draw_area_width = w;
126+
gui_draw_area_height = h;
127+
128+
buildTextures();
129+
130+
//printf("GL Ratio: %f %ix%i\n", screen->devicePixelRatio(), w, h );
131+
}
132+
119133
int ConsoleViewGL_t::init( void )
120134
{
135+
QScreen *screen = NULL;
136+
137+
if ( window() != NULL )
138+
{
139+
if ( window()->windowHandle() != NULL )
140+
{
141+
screen = window()->windowHandle()->screen();
142+
}
143+
}
144+
145+
if ( screen != NULL )
146+
{
147+
devPixRatio = screen->devicePixelRatio();
148+
printf("GL Ratio: %f \n", screen->devicePixelRatio() );
149+
}
121150
return 0;
122151
}
123152

@@ -624,5 +653,6 @@ void ConsoleViewGL_t::paintGL(void)
624653
glDisable(GL_TEXTURE_2D);
625654
glDisable(GL_TEXTURE_RECTANGLE);
626655

656+
nes_shm->render_count++;
627657
//printf("Paint GL!\n");
628658
}

src/drivers/Qt/ConsoleViewerGL.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <stdint.h>
77

8+
#include <QScreen>
89
#include <QOpenGLWidget>
910
#include <QOpenGLFunctions>
1011

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

40+
void screenChanged(QScreen *scr);
41+
3942
protected:
4043
void initializeGL(void);
4144
void resizeGL(int w, int h);

src/drivers/Qt/ConsoleViewerSDL.cpp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,21 @@ int ConsoleViewSDL_t::init(void)
214214
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" );
215215
}
216216

217-
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
217+
if ( SDL_WasInit(SDL_INIT_VIDEO) == 0 )
218218
{
219-
printf("[SDL] Failed to initialize video subsystem.\n");
220-
return -1;
219+
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
220+
{
221+
printf("[SDL] Failed to initialize video subsystem.\n");
222+
return -1;
223+
}
224+
else
225+
{
226+
printf("Initialized SDL Video Subsystem\n");
227+
}
221228
}
222229
else
223230
{
224-
printf("Initialized SDL Video Subsystem\n");
231+
printf("SDL Video Subsystem is Initialized\n");
225232
}
226233

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

233240
windowHandle = this->winId();
234241

235-
//printf("Window Handle: %llu \n", windowHandle );
236-
237-
//sleep(1);
242+
if (sdlWindow == NULL)
243+
{
244+
sdlWindow = SDL_CreateWindowFrom( (void*)windowHandle);
245+
}
238246

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

253+
SDL_ShowWindow( sdlWindow );
254+
246255
uint32_t baseFlags = vsyncEnabled ? SDL_RENDERER_PRESENTVSYNC : 0;
247256

248257
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, baseFlags | SDL_RENDERER_ACCELERATED);
@@ -289,6 +298,11 @@ void ConsoleViewSDL_t::cleanup(void)
289298
SDL_DestroyRenderer(sdlRenderer);
290299
sdlRenderer = NULL;
291300
}
301+
if ( sdlWindow )
302+
{
303+
SDL_DestroyWindow( sdlWindow );
304+
sdlWindow = NULL;
305+
}
292306
}
293307

294308
void ConsoleViewSDL_t::reset(void)
@@ -422,7 +436,7 @@ void ConsoleViewSDL_t::resizeEvent(QResizeEvent *event)
422436
s = event->size();
423437
view_width = s.width();
424438
view_height = s.height();
425-
//printf("SDL Resize: %i x %i \n", view_width, view_height);
439+
printf("SDL Resize: %i x %i \n", view_width, view_height);
426440

427441
gui_draw_area_width = view_width;
428442
gui_draw_area_height = view_height;
@@ -636,4 +650,5 @@ void ConsoleViewSDL_t::render(void)
636650

637651
SDL_RenderPresent(sdlRenderer);
638652

653+
nes_shm->render_count++;
639654
}

src/drivers/Qt/ConsoleWindow.cpp

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
221221
// Create AVI Recording Disk Thread
222222
aviDiskThread = new AviRecordDiskThread_t(this);
223223

224+
scrHandlerConnected = false;
224225
}
225226

226227
consoleWin_t::~consoleWin_t(void)
@@ -334,6 +335,46 @@ void consoleWin_t::videoReset(void)
334335
return;
335336
}
336337

338+
void consoleWin_t::initScreenHandler(void)
339+
{
340+
if ( !scrHandlerConnected )
341+
{
342+
QWidget *w;
343+
344+
w = this->window();
345+
346+
// This needs to be scheduled after window creation.
347+
if ( w != NULL)
348+
{
349+
QWindow *hdl = w->windowHandle();
350+
351+
if (hdl != NULL)
352+
{
353+
//printf("Connecting to screenChanged Signal\n");
354+
connect( hdl, SIGNAL(screenChanged(QScreen*)), this, SLOT(winScreenChanged(QScreen*)) );
355+
scrHandlerConnected = true;
356+
357+
winScreenChanged( hdl->screen() );
358+
}
359+
}
360+
}
361+
362+
}
363+
364+
void consoleWin_t::winScreenChanged(QScreen *scr)
365+
{
366+
if ( scr == NULL )
367+
{
368+
return;
369+
}
370+
371+
//printf("Screen Changed: %p\n", scr );
372+
if ( viewport_GL != NULL )
373+
{
374+
viewport_GL->screenChanged( scr );
375+
}
376+
}
377+
337378
QSize consoleWin_t::calcRequiredSize(void)
338379
{
339380
QSize out( GL_NES_WIDTH, GL_NES_HEIGHT );
@@ -644,6 +685,12 @@ void consoleWin_t::dropEvent(QDropEvent *event)
644685
}
645686
}
646687

688+
void consoleWin_t::showEvent(QShowEvent *event)
689+
{
690+
//printf("Main Window Show Event\n");
691+
initScreenHandler();
692+
}
693+
647694
//---------------------------------------------------------------------------
648695
void consoleWin_t::initHotKeys(void)
649696
{
@@ -3867,7 +3914,6 @@ void consoleWin_t::syncActionConfig( QAction *act, const char *property )
38673914

38683915
void consoleWin_t::updatePeriodic(void)
38693916
{
3870-
38713917
// Process all events before attempting to render viewport
38723918
QCoreApplication::processEvents();
38733919

src/drivers/Qt/ConsoleWindow.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ class consoleWin_t : public QMainWindow
248248
bool mainMenuEmuPauseSet;
249249
bool mainMenuEmuWasPaused;
250250
bool mainMenuPauseWhenActv;
251+
bool scrHandlerConnected;
251252

252253
std::list <std::string*> romList;
253254
std::vector <autoFireMenuAction*> afActList;
@@ -261,11 +262,13 @@ class consoleWin_t : public QMainWindow
261262
void keyReleaseEvent(QKeyEvent *event);
262263
void dragEnterEvent(QDragEnterEvent *event);
263264
void dropEvent(QDropEvent *event);
265+
void showEvent(QShowEvent *event);
264266
void syncActionConfig( QAction *act, const char *property );
265267
void showErrorMsgWindow(void);
266268

267269
private:
268270
void initHotKeys(void);
271+
void initScreenHandler(void);
269272
void createMainMenu(void);
270273
void buildRecentRomMenu(void);
271274
void saveRecentRomMenu(void);
@@ -405,6 +408,7 @@ class consoleWin_t : public QMainWindow
405408
void wavRecordStart(void);
406409
void wavRecordAsStart(void);
407410
void wavRecordStop(void);
411+
void winScreenChanged( QScreen *scr );
408412

409413
};
410414

0 commit comments

Comments
 (0)