Skip to content

Commit 35ea38d

Browse files
committed
Fix remaining Windows build issues: API functions, C++ arrays, and warnings
- Added patch application to minimal build to ensure Fujisan API functions are available - Fixed C++ variable-length array errors by using std::vector instead - Fixed macro redefinition warnings with proper #ifndef guards - Added missing #include <vector> for C++14 compatibility This addresses: - Missing libatari800_set_disk_activity_callback and related API functions - C++ array initialization errors in C++14 mode - Macro redefinition warnings for Windows defines
1 parent 5f1ec76 commit 35ea38d

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

scripts/create-minimal-makefile.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ fi
2121
echo "Creating minimal Makefile for libatari800..."
2222
echo "This approach avoids autotools and problematic modules like XEP80"
2323

24+
# Ensure Fujisan patches are applied for required API functions
25+
if [ -d "fujisan-patches" ] && [ -f "fujisan-patches/apply-patches.sh" ]; then
26+
echo "Applying Fujisan patches for API functions..."
27+
cd fujisan-patches
28+
chmod +x apply-patches.sh
29+
./apply-patches.sh || echo "Patches may already be applied"
30+
cd ..
31+
else
32+
echo "Warning: Fujisan patches not found - some API functions may be missing"
33+
fi
34+
2435
# Create a basic Makefile that compiles the essential files for libatari800
2536
cat > Makefile << 'EOF'
2637
# Minimal Makefile for libatari800

src/atariemulator.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <QDateTime>
2222
#include <QFile>
2323
#include <cstring> // for memset
24+
#include <vector> // for std::vector
2425

2526
extern "C" {
2627
#ifdef NETSIO
@@ -243,7 +244,7 @@ bool AtariEmulator::initializeWithDisplayConfig(bool basicEnabled, const QString
243244
argBytes.append(arg.toUtf8());
244245
}
245246

246-
char* args[argBytes.size() + 1];
247+
std::vector<char*> args(argBytes.size() + 1);
247248
for (int i = 0; i < argBytes.size(); ++i) {
248249
args[i] = argBytes[i].data();
249250
}
@@ -254,7 +255,7 @@ bool AtariEmulator::initializeWithDisplayConfig(bool basicEnabled, const QString
254255
qDebug() << "Number of arguments:" << argBytes.size();
255256
qDebug() << "Note: Display parameters excluded due to libatari800 limitations";
256257

257-
if (libatari800_init(argBytes.size(), args)) {
258+
if (libatari800_init(argBytes.size(), args.data())) {
258259
qDebug() << "✓ Emulator initialized successfully";
259260
qDebug() << " Display settings saved to profile but not applied (requires full SDL atari800)";
260261
m_targetFps = libatari800_get_fps();
@@ -413,7 +414,7 @@ bool AtariEmulator::initializeWithInputConfig(bool basicEnabled, const QString&
413414
argBytes.append(arg.toUtf8());
414415
}
415416

416-
char* args[argBytes.size() + 1];
417+
std::vector<char*> args(argBytes.size() + 1);
417418
for (int i = 0; i < argBytes.size(); ++i) {
418419
args[i] = argBytes[i].data();
419420
}
@@ -425,7 +426,7 @@ bool AtariEmulator::initializeWithInputConfig(bool basicEnabled, const QString&
425426
qDebug() << "Keyboard Joystick 0 (Numpad + RCtrl):" << (kbdJoy0Enabled ? "ENABLED" : "DISABLED");
426427
qDebug() << "Keyboard Joystick 1 (WASD + LCtrl):" << (kbdJoy1Enabled ? "ENABLED" : "DISABLED");
427428

428-
if (libatari800_init(argBytes.size(), args)) {
429+
if (libatari800_init(argBytes.size(), args.data())) {
429430
qDebug() << "✓ Emulator initialized successfully with input settings";
430431

431432
#ifdef GUI_SDL

src/windows_compat.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,33 @@
1010
#endif
1111

1212
// Prevent common macro conflicts
13+
#ifndef WIN32_LEAN_AND_MEAN
1314
#define WIN32_LEAN_AND_MEAN
15+
#endif
16+
#ifndef NOMINMAX
1417
#define NOMINMAX
18+
#endif
19+
#ifndef NOSERVICE
1520
#define NOSERVICE
21+
#endif
22+
#ifndef NOMCX
1623
#define NOMCX
24+
#endif
25+
#ifndef NOIME
1726
#define NOIME
27+
#endif
28+
#ifndef NOKANJI
1829
#define NOKANJI
30+
#endif
31+
#ifndef NOHELP
1932
#define NOHELP
33+
#endif
34+
#ifndef NOPROFILER
2035
#define NOPROFILER
36+
#endif
37+
#ifndef NODEFERWINDOWPOS
2138
#define NODEFERWINDOWPOS
39+
#endif
2240

2341
// Include Windows headers first to prevent conflicts
2442
#include <windows.h>

0 commit comments

Comments
 (0)