mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Merge branch 'master' into Enterprise
This commit is contained in:
commit
333981e2a7
@ -11,11 +11,11 @@
|
|||||||
using namespace Concurrency;
|
using namespace Concurrency;
|
||||||
|
|
||||||
AsyncTaskQueue::AsyncTaskQueue()
|
AsyncTaskQueue::AsyncTaskQueue()
|
||||||
#ifndef __APPLE__
|
#ifndef USE_GCD
|
||||||
: should_destruct_(false)
|
: should_destruct_(false)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef USE_GCD
|
||||||
serial_dispatch_queue_ = dispatch_queue_create("com.thomasharte.clocksignal.asyntaskqueue", DISPATCH_QUEUE_SERIAL);
|
serial_dispatch_queue_ = dispatch_queue_create("com.thomasharte.clocksignal.asyntaskqueue", DISPATCH_QUEUE_SERIAL);
|
||||||
#else
|
#else
|
||||||
thread_ = std::make_unique<std::thread>([this]() {
|
thread_ = std::make_unique<std::thread>([this]() {
|
||||||
@ -44,7 +44,7 @@ AsyncTaskQueue::AsyncTaskQueue()
|
|||||||
}
|
}
|
||||||
|
|
||||||
AsyncTaskQueue::~AsyncTaskQueue() {
|
AsyncTaskQueue::~AsyncTaskQueue() {
|
||||||
#ifdef __APPLE__
|
#ifdef USE_GCD
|
||||||
flush();
|
flush();
|
||||||
dispatch_release(serial_dispatch_queue_);
|
dispatch_release(serial_dispatch_queue_);
|
||||||
serial_dispatch_queue_ = nullptr;
|
serial_dispatch_queue_ = nullptr;
|
||||||
@ -57,7 +57,7 @@ AsyncTaskQueue::~AsyncTaskQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AsyncTaskQueue::enqueue(std::function<void(void)> function) {
|
void AsyncTaskQueue::enqueue(std::function<void(void)> function) {
|
||||||
#ifdef __APPLE__
|
#ifdef USE_GCD
|
||||||
dispatch_async(serial_dispatch_queue_, ^{function();});
|
dispatch_async(serial_dispatch_queue_, ^{function();});
|
||||||
#else
|
#else
|
||||||
std::lock_guard lock(queue_mutex_);
|
std::lock_guard lock(queue_mutex_);
|
||||||
@ -67,7 +67,7 @@ void AsyncTaskQueue::enqueue(std::function<void(void)> function) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AsyncTaskQueue::flush() {
|
void AsyncTaskQueue::flush() {
|
||||||
#ifdef __APPLE__
|
#ifdef USE_GCD
|
||||||
dispatch_sync(serial_dispatch_queue_, ^{});
|
dispatch_sync(serial_dispatch_queue_, ^{});
|
||||||
#else
|
#else
|
||||||
auto flush_mutex = std::make_shared<std::mutex>();
|
auto flush_mutex = std::make_shared<std::mutex>();
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) && !defined(IGNORE_APPLE)
|
||||||
#include <dispatch/dispatch.h>
|
#include <dispatch/dispatch.h>
|
||||||
|
#define USE_GCD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Concurrency {
|
namespace Concurrency {
|
||||||
@ -47,7 +48,7 @@ class AsyncTaskQueue {
|
|||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __APPLE__
|
#ifdef USE_GCD
|
||||||
dispatch_queue_t serial_dispatch_queue_;
|
dispatch_queue_t serial_dispatch_queue_;
|
||||||
#else
|
#else
|
||||||
std::unique_ptr<std::thread> thread_;
|
std::unique_ptr<std::thread> thread_;
|
||||||
|
@ -29,11 +29,11 @@ void VideoBase::set_use_square_pixels(bool use_square_pixels) {
|
|||||||
use_square_pixels_ = use_square_pixels;
|
use_square_pixels_ = use_square_pixels;
|
||||||
|
|
||||||
// HYPER-UGLY HACK. See correlated hack in the Macintosh.
|
// HYPER-UGLY HACK. See correlated hack in the Macintosh.
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) && !defined(IGNORE_APPLE)
|
||||||
crt_.set_visible_area(Outputs::Display::Rect(0.128f, 0.122f, 0.75f, 0.77f));
|
crt_.set_visible_area(Outputs::Display::Rect(0.128f, 0.122f, 0.75f, 0.77f));
|
||||||
#else
|
#else
|
||||||
if(use_square_pixels) {
|
if(use_square_pixels) {
|
||||||
crt_.set_visible_area(Outputs::Display::Rect(0.128f, 0.112f, 0.75f, 0.73f));
|
crt_.set_visible_area(Outputs::Display::Rect(0.128f, 0.09f, 0.75f, 0.77f));
|
||||||
} else {
|
} else {
|
||||||
crt_.set_visible_area(Outputs::Display::Rect(0.128f, 0.12f, 0.75f, 0.77f));
|
crt_.set_visible_area(Outputs::Display::Rect(0.128f, 0.12f, 0.75f, 0.77f));
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ template <class BusHandler, bool is_iie> class Video: public VideoBase {
|
|||||||
// The OpenGL scan target introduces a phase error of 1/8th of a wave. The Metal one does not.
|
// The OpenGL scan target introduces a phase error of 1/8th of a wave. The Metal one does not.
|
||||||
// Supply the real phase value if this is an Apple build.
|
// Supply the real phase value if this is an Apple build.
|
||||||
// TODO: eliminate UGLY HACK.
|
// TODO: eliminate UGLY HACK.
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) && !defined(IGNORE_APPLE)
|
||||||
constexpr int phase = 224;
|
constexpr int phase = 224;
|
||||||
#else
|
#else
|
||||||
constexpr int phase = 0;
|
constexpr int phase = 0;
|
||||||
|
@ -35,7 +35,7 @@ Video::Video(DeferredAudio &audio, DriveSpeedAccumulator &drive_speed_accumulato
|
|||||||
// The [newer] Metal scan target has no such issue. So assume that Apple => Metal,
|
// The [newer] Metal scan target has no such issue. So assume that Apple => Metal,
|
||||||
// and set a visible area to work around the OpenGL issue if required.
|
// and set a visible area to work around the OpenGL issue if required.
|
||||||
// TODO: eliminate UGLY HACK.
|
// TODO: eliminate UGLY HACK.
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) && !defined(IGNORE_APPLE)
|
||||||
crt_.set_visible_area(Outputs::Display::Rect(0.08f, 10.0f / 368.0f, 0.82f, 344.0f / 368.0f));
|
crt_.set_visible_area(Outputs::Display::Rect(0.08f, 10.0f / 368.0f, 0.82f, 344.0f / 368.0f));
|
||||||
#else
|
#else
|
||||||
crt_.set_visible_area(Outputs::Display::Rect(0.08f, -0.025f, 0.82f, 0.82f));
|
crt_.set_visible_area(Outputs::Display::Rect(0.08f, -0.025f, 0.82f, 0.82f));
|
||||||
|
@ -5892,6 +5892,11 @@
|
|||||||
"$(USER_LIBRARY_DIR)/Frameworks",
|
"$(USER_LIBRARY_DIR)/Frameworks",
|
||||||
);
|
);
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
IGNORE_APPLE,
|
||||||
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
};
|
};
|
||||||
@ -5913,7 +5918,10 @@
|
|||||||
);
|
);
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GCC_OPTIMIZATION_LEVEL = 2;
|
GCC_OPTIMIZATION_LEVEL = 2;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
NDEBUG,
|
||||||
|
IGNORE_APPLE,
|
||||||
|
);
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = ""/Users/thomasharte/Desktop/Soft/Apple II/WOZs/Prince of Persia side A.woz""
|
argument = ""/Users/thomasharte/Desktop/Soft/Apple II/WOZs/Prince of Persia side A.woz""
|
||||||
isEnabled = "YES">
|
isEnabled = "NO">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "--rompath=~/ROMs"
|
argument = "--rompath=~/ROMs"
|
||||||
@ -125,12 +125,12 @@
|
|||||||
isEnabled = "NO">
|
isEnabled = "NO">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "--model=cpc6128"
|
argument = "--model=mac512k"
|
||||||
isEnabled = "NO">
|
isEnabled = "YES">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "--new=appleii"
|
argument = "--new=macintosh"
|
||||||
isEnabled = "NO">
|
isEnabled = "YES">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "--use-square-pixels"
|
argument = "--use-square-pixels"
|
||||||
|
@ -21,6 +21,7 @@ linux {
|
|||||||
# Add flags (i) to identify that this is a Qt build; and
|
# Add flags (i) to identify that this is a Qt build; and
|
||||||
# (ii) to disable asserts in release builds.
|
# (ii) to disable asserts in release builds.
|
||||||
DEFINES += TARGET_QT
|
DEFINES += TARGET_QT
|
||||||
|
DEFINES += IGNORE_APPLE
|
||||||
QMAKE_CXXFLAGS_RELEASE += -DNDEBUG
|
QMAKE_CXXFLAGS_RELEASE += -DNDEBUG
|
||||||
|
|
||||||
# Generate warnings for any use of APIs deprecated prior to Qt 6.0.0.
|
# Generate warnings for any use of APIs deprecated prior to Qt 6.0.0.
|
||||||
|
@ -112,11 +112,11 @@ void MainWindow::init() {
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
romRequestBaseText = ui->missingROMsBox->toPlainText();
|
romRequestBaseText = ui->missingROMsBox->toPlainText();
|
||||||
|
|
||||||
createActions();
|
|
||||||
restoreSelections();
|
|
||||||
|
|
||||||
// TEMPORARY: remove the Apple IIgs tab; this machine isn't ready yet.
|
// TEMPORARY: remove the Apple IIgs tab; this machine isn't ready yet.
|
||||||
ui->machineSelectionTabs->removeTab(ui->machineSelectionTabs->indexOf(ui->appleIIgsTab));
|
ui->machineSelectionTabs->removeTab(ui->machineSelectionTabs->indexOf(ui->appleIIgsTab));
|
||||||
|
|
||||||
|
createActions();
|
||||||
|
restoreSelections();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createActions() {
|
void MainWindow::createActions() {
|
||||||
@ -207,14 +207,15 @@ QString MainWindow::getFilename(const char *title) {
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::insertFile(const QString &fileName) {
|
bool MainWindow::insertFile(const QString &fileName) {
|
||||||
if(!machine) return;
|
if(!machine) return false;
|
||||||
|
|
||||||
auto mediaTarget = machine->media_target();
|
auto mediaTarget = machine->media_target();
|
||||||
if(!mediaTarget) return;
|
if(!mediaTarget) return false;
|
||||||
|
|
||||||
Analyser::Static::Media media = Analyser::Static::GetMedia(fileName.toStdString());
|
const Analyser::Static::Media media = Analyser::Static::GetMedia(fileName.toStdString());
|
||||||
mediaTarget->insert_media(media);
|
if(media.empty()) return false;
|
||||||
|
return mediaTarget->insert_media(media);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::launchFile(const QString &fileName) {
|
bool MainWindow::launchFile(const QString &fileName) {
|
||||||
@ -732,7 +733,10 @@ void MainWindow::dropEvent(QDropEvent* event) {
|
|||||||
case UIPhase::RunningMachine: {
|
case UIPhase::RunningMachine: {
|
||||||
// Attempt to insert into the running machine.
|
// Attempt to insert into the running machine.
|
||||||
const auto fileName = event->mimeData()->urls()[0].toLocalFile();
|
const auto fileName = event->mimeData()->urls()[0].toLocalFile();
|
||||||
insertFile(fileName);
|
if(!insertFile(fileName)) {
|
||||||
|
deleteMachine();
|
||||||
|
launchFile(fileName);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
// TODO: permit multiple files dropped at once in both of the above cases.
|
// TODO: permit multiple files dropped at once in both of the above cases.
|
||||||
|
@ -104,7 +104,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
|
|||||||
} keyboardInputMode;
|
} keyboardInputMode;
|
||||||
|
|
||||||
QAction *insertAction = nullptr;
|
QAction *insertAction = nullptr;
|
||||||
void insertFile(const QString &fileName);
|
bool insertFile(const QString &fileName);
|
||||||
|
|
||||||
bool launchFile(const QString &fileName);
|
bool launchFile(const QString &fileName);
|
||||||
void launchTarget(std::unique_ptr<Analyser::Static::Target> &&);
|
void launchTarget(std::unique_ptr<Analyser::Static::Target> &&);
|
||||||
|
@ -774,7 +774,7 @@ int main(int argc, char *argv[]) {
|
|||||||
default: break;
|
default: break;
|
||||||
case ::Machine::Error::MissingROM: {
|
case ::Machine::Error::MissingROM: {
|
||||||
std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/, or provide a --rompath, e.g. --rompath=~/ROMs." << std::endl;
|
std::cerr << "Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/, or provide a --rompath, e.g. --rompath=~/ROMs." << std::endl;
|
||||||
std::cerr << "Needed — but didn't find —";
|
std::cerr << "Needed but didn't find";
|
||||||
|
|
||||||
using DescriptionFlag = ROM::Description::DescriptionFlag;
|
using DescriptionFlag = ROM::Description::DescriptionFlag;
|
||||||
std::wcerr << missing_roms.description(DescriptionFlag::Filename | DescriptionFlag::CRC, L'*');
|
std::wcerr << missing_roms.description(DescriptionFlag::Filename | DescriptionFlag::CRC, L'*');
|
||||||
|
Loading…
Reference in New Issue
Block a user