LaunchAPPL: shared file transport

This commit is contained in:
Wolfgang Thaller 2019-01-23 19:41:12 +01:00
parent 303428e10a
commit d16f1aae6b
45 changed files with 1416 additions and 213 deletions

View File

@ -3,9 +3,11 @@ find_package(Boost COMPONENTS filesystem program_options)
set(LAUNCHMETHODS
Executor.h Executor.cc
MiniVMac.h MiniVMac.cc
SSH.h SSH.cc
SSH.h SSH.cc
StreamBasedLauncher.h StreamBasedLauncher.cc
Serial.h Serial.cc
TCP.h TCP.cc
SharedFile.h SharedFile.cc
)
if(APPLE)

View File

@ -22,6 +22,7 @@
#include "SSH.h"
#include "Serial.h"
#include "TCP.h"
#include "SharedFile.h"
namespace po = boost::program_options;
namespace fs = boost::filesystem;
@ -46,7 +47,8 @@ static void RegisterLaunchMethods()
new Executor(), new MiniVMac(),
new SSH(),
new Serial(),
new TCP()
new TCP(),
new SharedFile()
// #### Add new `LaunchMethod`s here.
};

View File

@ -1,5 +1,5 @@
#include "Serial.h"
#include "Launcher.h"
#include "StreamBasedLauncher.h"
#include "Utilities.h"
#include "Stream.h"
#include "ReliableStream.h"
@ -15,7 +15,7 @@
namespace po = boost::program_options;
using namespace std::literals::chrono_literals;
class SerialStream : public Stream
class SerialStream : public WaitableStream
{
static const long kReadBufferSize = 4096;
uint8_t readBuffer[kReadBufferSize];
@ -25,28 +25,18 @@ public:
virtual void write(const void* p, size_t n) override;
void wait();
virtual void wait() override;
SerialStream(po::variables_map &options);
~SerialStream();
};
class SerialLauncher : public Launcher
class SerialLauncher : public StreamBasedLauncher
{
SerialStream stream;
ReliableStream rStream;
std::vector<char> outputBytes;
bool upgradeMode = false;
public:
SerialLauncher(po::variables_map& options);
virtual ~SerialLauncher();
virtual bool Go(int timeout = 0);
virtual void DumpOutput();
private:
void write(const void *p, size_t n);
size_t read(void * p, size_t n);
};
@ -128,41 +118,10 @@ void SerialStream::wait()
}
}
SerialLauncher::SerialLauncher(po::variables_map &options)
: Launcher(options), stream(options), rStream(&stream)
: StreamBasedLauncher(options), stream(options), rStream(&stream)
{
if(options.count("upgrade-server"))
upgradeMode = true;
}
SerialLauncher::~SerialLauncher()
{
}
size_t SerialLauncher::read(void *p0, size_t n)
{
uint8_t* p = (uint8_t*)p0;
size_t gotBytes = rStream.read(p, n);
while(gotBytes < n)
{
rStream.flushWrite();
stream.wait();
gotBytes += rStream.read(p + gotBytes, n - gotBytes);
}
return gotBytes;
}
void SerialLauncher::write(const void *p, size_t n)
{
while(!rStream.readyToWrite())
stream.wait();
rStream.write(p, n);
}
bool SerialLauncher::Go(int timeout)
{
uint32_t tmp;
SetupStream(&stream, &rStream);
do
{
@ -175,50 +134,6 @@ bool SerialLauncher::Go(int timeout)
} while(!rStream.resetResponseArrived());
std::cerr << "Connected." << std::endl;
{
RemoteCommand cmd = upgradeMode ? RemoteCommand::upgradeLauncher : RemoteCommand::launchApp;
write(&cmd, 1);
write(std::string(app.type).data(), 4);
write(std::string(app.creator).data(), 4);
std::ostringstream rsrcOut;
app.resources.writeFork(rsrcOut);
std::string rsrc = rsrcOut.str();
std::string& data = app.data;
std::cerr << "Transfering " << (data.size() + rsrc.size() + 1023) / 1024 << " KB." << std::endl;
tmp = htonl(data.size());
write(&tmp, 4);
tmp = htonl(rsrc.size());
write(&tmp, 4);
write(data.data(), data.size());
write(rsrc.data(), rsrc.size());
}
while(!rStream.allDataArrived())
stream.wait();
std::cerr << "Running Appliation..." << std::endl;
read(&tmp, 4);
uint32_t result = ntohl(tmp);
std::cerr << "Finished (result = " << result << ")." << std::endl;
if(result == 0)
{
read(&tmp, 4);
uint32_t size = ntohl(tmp);
outputBytes.resize(size);
if(size > 0)
read(outputBytes.data(), size);
}
return result == 0;
}
void SerialLauncher::DumpOutput()
{
std::cout.write(outputBytes.data(), outputBytes.size());
}
void Serial::GetOptions(options_description &desc)

View File

@ -0,0 +1,99 @@
#include "SharedFile.h"
#include "StreamBasedLauncher.h"
#include "Utilities.h"
#include "Stream.h"
#include "ServerProtocol.h"
#include <chrono>
#include <iostream>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
namespace po = boost::program_options;
using namespace std::literals::chrono_literals;
class SharedFileStream : public WaitableStream
{
static const long kReadBufferSize = 4096;
uint8_t readBuffer[kReadBufferSize];
fs::path shared_directory;
public:
virtual void write(const void* p, size_t n) override;
virtual void wait() override;
SharedFileStream(po::variables_map &options);
~SharedFileStream();
};
class SharedFileLauncher : public StreamBasedLauncher
{
SharedFileStream stream;
public:
SharedFileLauncher(po::variables_map& options);
};
SharedFileStream::SharedFileStream(po::variables_map &options)
{
shared_directory = options["shared-directory"].as<std::string>();
}
SharedFileStream::~SharedFileStream()
{
}
void SharedFileStream::write(const void* p, size_t n)
{
if(n == 0)
return;
{
fs::ofstream out(shared_directory / "in_channel_1", std::ios::binary);
out.write((const char*)p, n);
}
fs::rename(shared_directory / "in_channel_1", shared_directory / "in_channel");
do
{
usleep(100000);
} while(fs::exists(shared_directory / "in_channel"));
}
void SharedFileStream::wait()
{
usleep(100000);
if(fs::exists(shared_directory / "out_channel"))
{
{
fs::ifstream in(shared_directory / "out_channel");
while(in.read((char*)readBuffer, sizeof(readBuffer)), in.gcount() > 0)
notifyReceive(readBuffer, in.gcount());
}
fs::remove(shared_directory / "out_channel");
}
}
SharedFileLauncher::SharedFileLauncher(po::variables_map &options)
: StreamBasedLauncher(options), stream(options)
{
SetupStream(&stream);
}
void SharedFile::GetOptions(options_description &desc)
{
desc.add_options()
("shared-directory", po::value<std::string>(), "Path to a directory shared with the old mac")
;
}
bool SharedFile::CheckOptions(variables_map &options)
{
return options.count("shared-directory") != 0;
}
std::unique_ptr<Launcher> SharedFile::MakeLauncher(variables_map &options)
{
return std::unique_ptr<Launcher>(new SharedFileLauncher(options));
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "LaunchMethod.h"
class SharedFile : public LaunchMethod
{
public:
virtual std::string GetName() { return "shared"; }
virtual void GetOptions(options_description& desc);
virtual bool CheckOptions(variables_map& options);
virtual std::unique_ptr<Launcher> MakeLauncher(variables_map& options);
};

View File

@ -0,0 +1,91 @@
#include "StreamBasedLauncher.h"
#include "Stream.h"
#include "ServerProtocol.h"
#include <iostream>
StreamBasedLauncher::StreamBasedLauncher(boost::program_options::variables_map &options)
: Launcher(options)
{
if(options.count("upgrade-server"))
upgradeMode = true;
}
StreamBasedLauncher::~StreamBasedLauncher()
{
}
void StreamBasedLauncher::SetupStream(WaitableStream* aStream, Stream* wrapped)
{
this->stream = aStream;
this->rStream = wrapped ? wrapped : aStream;
}
ssize_t StreamBasedLauncher::read(void *p0, size_t n)
{
uint8_t* p = (uint8_t*)p0;
size_t gotBytes = rStream->read(p, n);
while(gotBytes < n)
{
rStream->flushWrite();
stream->wait();
gotBytes += rStream->read(p + gotBytes, n - gotBytes);
}
return gotBytes;
}
void StreamBasedLauncher::write(const void *p, size_t n)
{
while(!rStream->readyToWrite())
stream->wait();
rStream->write(p, n);
}
bool StreamBasedLauncher::Go(int timeout)
{
uint32_t tmp;
{
RemoteCommand cmd = upgradeMode ? RemoteCommand::upgradeLauncher : RemoteCommand::launchApp;
write(&cmd, 1);
write(std::string(app.type).data(), 4);
write(std::string(app.creator).data(), 4);
std::ostringstream rsrcOut;
app.resources.writeFork(rsrcOut);
std::string rsrc = rsrcOut.str();
std::string& data = app.data;
std::cerr << "Transferring " << (data.size() + rsrc.size() + 1023) / 1024 << " KB." << std::endl;
tmp = htonl(data.size());
write(&tmp, 4);
tmp = htonl(rsrc.size());
write(&tmp, 4);
write(data.data(), data.size());
write(rsrc.data(), rsrc.size());
}
while(!rStream->allDataArrived())
stream->wait();
std::cerr << "Running Appliation..." << std::endl;
read(&tmp, 4);
uint32_t result = ntohl(tmp);
std::cerr << "Finished (result = " << result << ")." << std::endl;
if(result == 0)
{
read(&tmp, 4);
uint32_t size = ntohl(tmp);
outputBytes.resize(size);
if(size > 0)
read(outputBytes.data(), size);
}
return result == 0;
}
void StreamBasedLauncher::DumpOutput()
{
std::cout.write(outputBytes.data(), outputBytes.size());
}

View File

@ -0,0 +1,26 @@
#pragma once
#include "Launcher.h"
#include <vector>
class Stream;
class WaitableStream;
class StreamBasedLauncher : public Launcher
{
WaitableStream *stream;
Stream *rStream;
std::vector<char> outputBytes;
bool upgradeMode = false;
public:
StreamBasedLauncher(boost::program_options::variables_map& options);
virtual ~StreamBasedLauncher();
virtual bool Go(int timeout = 0);
virtual void DumpOutput();
protected:
void SetupStream(WaitableStream* aStream, Stream* wrapped = nullptr);
private:
void write(const void *p, size_t n);
ssize_t read(void * p, size_t n);
};

View File

@ -1,5 +1,5 @@
#include "TCP.h"
#include "Launcher.h"
#include "StreamBasedLauncher.h"
#include "Utilities.h"
#include "Stream.h"
#include "ServerProtocol.h"
@ -14,7 +14,7 @@
namespace po = boost::program_options;
using namespace std::literals::chrono_literals;
class TCPStream : public Stream
class TCPStream : public WaitableStream
{
static const long kReadBufferSize = 4096;
@ -24,28 +24,17 @@ public:
virtual void write(const void* p, size_t n) override;
void wait();
virtual void wait() override;
TCPStream(po::variables_map &options);
~TCPStream();
};
class TCPLauncher : public Launcher
class TCPLauncher : public StreamBasedLauncher
{
TCPStream stream;
TCPStream& rStream = stream;
std::vector<char> outputBytes;
bool upgradeMode = false;
public:
TCPLauncher(po::variables_map& options);
virtual ~TCPLauncher();
virtual bool Go(int timeout = 0);
virtual void DumpOutput();
private:
void write(const void *p, size_t n);
ssize_t read(void * p, size_t n);
};
@ -81,86 +70,10 @@ void TCPStream::wait()
notifyReceive(readBuffer, n);
}
TCPLauncher::TCPLauncher(po::variables_map &options)
: Launcher(options), stream(options)
: StreamBasedLauncher(options), stream(options)
{
if(options.count("upgrade-server"))
upgradeMode = true;
}
TCPLauncher::~TCPLauncher()
{
}
ssize_t TCPLauncher::read(void *p0, size_t n)
{
uint8_t* p = (uint8_t*)p0;
size_t gotBytes = rStream.read(p, n);
while(gotBytes < n)
{
rStream.flushWrite();
stream.wait();
gotBytes += rStream.read(p + gotBytes, n - gotBytes);
}
return gotBytes;
}
void TCPLauncher::write(const void *p, size_t n)
{
while(!rStream.readyToWrite())
stream.wait();
rStream.write(p, n);
}
bool TCPLauncher::Go(int timeout)
{
uint32_t tmp;
{
RemoteCommand cmd = upgradeMode ? RemoteCommand::upgradeLauncher : RemoteCommand::launchApp;
write(&cmd, 1);
write(std::string(app.type).data(), 4);
write(std::string(app.creator).data(), 4);
std::ostringstream rsrcOut;
app.resources.writeFork(rsrcOut);
std::string rsrc = rsrcOut.str();
std::string& data = app.data;
std::cerr << "Transfering " << (data.size() + rsrc.size() + 1023) / 1024 << " KB." << std::endl;
tmp = htonl(data.size());
write(&tmp, 4);
tmp = htonl(rsrc.size());
write(&tmp, 4);
write(data.data(), data.size());
write(rsrc.data(), rsrc.size());
}
while(!rStream.allDataArrived())
stream.wait();
std::cerr << "Running Appliation..." << std::endl;
read(&tmp, 4);
uint32_t result = ntohl(tmp);
std::cerr << "Finished (result = " << result << ")." << std::endl;
if(result == 0)
{
read(&tmp, 4);
uint32_t size = ntohl(tmp);
outputBytes.resize(size);
if(size > 0)
read(outputBytes.data(), size);
}
return result == 0;
}
void TCPLauncher::DumpOutput()
{
std::cout.write(outputBytes.data(), outputBytes.size());
SetupStream(&stream);
}
void TCP::GetOptions(options_description &desc)

View File

@ -36,6 +36,12 @@ protected:
void notifyReset();
};
class WaitableStream : public Stream
{
public:
virtual void wait() = 0;
};
class StreamWrapper : public Stream, private StreamListener
{
Stream* underlying_;

View File

@ -54,6 +54,16 @@
# emulator = tcp
# tcp-address = 192.168.0.42 # IP address of your mac
# ########### A real Mac or emulator that can access a shared volume
# Prerequisited:
# - LaunchAPPLServer compiled by Retro68 for your Mac or emulator
# - A volume or folder shared between your classic Mac/emulator and the computer you're running LaunchAPPL on
# For example, this can be SheepShaver or Basilisk with their built-in shared folder support.
# emulator = shared
# shared-directory = /path/to/some/empty/directory
# ########### Mini vMac (old 68K Macs)

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AboutBox.h"
#include <Windows.h>
#include <TextEdit.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Window.h"

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AppLauncher.h"
#include <Processes.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <memory>

View File

@ -25,6 +25,13 @@ else()
)
endif()
list(APPEND CONNECTION_SOURCES
SharedFileStream.h
SharedFileStream.cc
SharedFileProvider.h
SharedFileProvider.cc
)
option(LAUNCHAPPLSERVER_DEBUG_CONSOLE "Add a debug console to LaunchAPPLServer" FALSE)
set(MAYBE_CONSOLE)
@ -50,6 +57,8 @@ add_application(LaunchAPPLServer
AboutBox.cc
ConnectionProvider.h
CarbonFileCompat.h
Preferences.h
Preferences.cc
${CONNECTION_SOURCES}
)
@ -73,7 +82,7 @@ else()
endif()
if(CMAKE_SYSTEM_NAME MATCHES RetroPPC)
target_link_libraries(LaunchAPPLServer -lOpenTransportAppPPC -lOpenTransportLib -lOpenTptInternetLib )
target_link_libraries(LaunchAPPLServer -lOpenTransportAppPPC -lOpenTransportLib -lOpenTptInternetLib -lNavigationLib)
endif()
if(FALSE)

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Files.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
class StreamListener;

View File

@ -1,5 +1,5 @@
/*
Copyright 2018 Wolfgang Thaller.
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
@ -34,6 +34,7 @@
#include "AppLauncher.h"
#include "StatusDisplay.h"
#include "AboutBox.h"
#include "Preferences.h"
#include <ServerProtocol.h>
#include <Processes.h>
@ -48,6 +49,7 @@
#if !TARGET_CPU_68K
#include "OpenTptConnectionProvider.h"
#endif
#include "SharedFileProvider.h"
#include "SystemInfo.h"
@ -68,33 +70,19 @@ enum
kItemAbout = 1,
kItemClose = 1,
kItemQuit = 3
};
kItemQuit = 3,
enum class Port : int
{
modemPort = 0,
printerPort,
macTCP,
openTptTCP
kItemChooseFolder = 14
};
#if TARGET_API_MAC_CARBON
bool portsAvailable[] = { false, false, false, false };
bool portsAvailable[] = { false, false, false, false, true };
#else
bool portsAvailable[] = { true, true, false, false };
bool portsAvailable[] = { true, true, false, false, true };
#endif
bool hasIconUtils = true;
bool hasColorQD = true;
struct Prefs
{
const static int currentVersion = 1;
int version = currentVersion;
Port port = Port::modemPort;
long baud = 19200;
bool inSubLaunch = false;
};
bool hasSys7StdFile = true;
Prefs gPrefs;
@ -170,7 +158,9 @@ void UpdateMenus()
CheckMenuItem(m, 3, gPrefs.port == Port::modemPort);
SetItemEnabled(m, 4, portsAvailable[(int)Port::printerPort]);
CheckMenuItem(m, 4, gPrefs.port == Port::printerPort);
for(int i = 6; i <= CountMenuItems(m); i++)
SetItemEnabled(m, 5, portsAvailable[(int)Port::sharedFiles]);
CheckMenuItem(m, 5, gPrefs.port == Port::sharedFiles);
for(int i = 7; i < kItemChooseFolder; i++)
{
Str255 str;
long baud;
@ -250,6 +240,13 @@ void DoMenuCommand(long menuCommand)
case 4:
gPrefs.port = Port::printerPort;
break;
case 5:
gPrefs.port = Port::sharedFiles;
break;
case kItemChooseFolder:
ChooseSharedDirectory();
UnloadSeg((void*) &ChooseSharedDirectory);
break;
default:
GetMenuItemText(GetMenuHandle(menuID), menuItem, str);
StringToNum(str, &gPrefs.baud);
@ -301,7 +298,7 @@ public:
size_t onReceive(const uint8_t* p, size_t n)
{
#ifdef DEBUG_CONSOLE
// printf("Received %d bytes in state %d.\n", (int)n, (int)state);
printf("Received %d bytes in state %d.\n", (int)n, (int)state);
#endif
switch(state)
{
@ -546,8 +543,13 @@ LaunchServer server;
void ConnectionChanged()
{
void *connectionSeg = connection ? connection->segmentToUnload() : nullptr;
connection.reset(); // deallocate before we create the new provider
if(connectionSeg)
UnloadSeg(connectionSeg);
bool first = true;
for(;;)
{
@ -582,6 +584,15 @@ void ConnectionChanged()
connection = std::make_unique<OpenTptConnectionProvider>(statusDisplay.get());;
break;
#endif
case Port::sharedFiles:
if(gPrefs.sharedDirectoryPath[0] == 0)
{
ChooseSharedDirectory();
UnloadSeg((void*) &ChooseSharedDirectory);
}
if(gPrefs.sharedDirectoryPath[0] != 0)
connection = std::make_unique<SharedFileProvider>(statusDisplay.get());;
break;
default:
;
}
@ -657,6 +668,9 @@ int main()
err = Gestalt(gestaltQuickdrawVersion, &response);
hasColorQD = err == noErr && response != 0;
err = Gestalt(gestaltStandardFileAttr, &response);
hasSys7StdFile = err == noErr && (response & (1 << gestaltStandardFile58)) != 0;
}
}
#else

View File

@ -1,5 +1,5 @@
/*
Copyright 2018 Wolfgang Thaller.
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
@ -22,6 +22,7 @@
#include "Windows.r"
#include "MacTypes.r"
#include "Finder.r"
#include "Dialogs.r"
resource 'MENU' (128) {
128, textMenuProc;
@ -67,6 +68,7 @@ resource 'MENU' (131) {
"OpenTransport TCP", noIcon, noKey, noMark, plain;
"Modem Port", noIcon, noKey, noMark, plain;
"Printer Port", noIcon, noKey, noMark, plain;
"Shared Files", noIcon, noKey, noMark, plain;
"-", noIcon, noKey, noMark, plain;
"9600", noIcon, noKey, noMark, plain;
"19200", noIcon, noKey, check, plain;
@ -74,6 +76,8 @@ resource 'MENU' (131) {
"57600", noIcon, noKey, noMark, plain;
"115200", noIcon, noKey, noMark, plain;
"230400", noIcon, noKey, noMark, plain;
"-", noIcon, noKey, noMark, plain;
"Choose Shared Directory...", noIcon, noKey, noMark, plain;
}
};
@ -115,6 +119,7 @@ resource 'STR#' (128, purgeable) {
"Listening on Printer Port...";
"Listening on TCP port 1984 (MacTCP)...";
"Listening on TCP port 1984 (OpenTransport)...";
"Waiting for shared files...";
"Downloading Application...";
"Downloading Upgrade...";
"Running Application...";
@ -151,7 +156,7 @@ resource 'SIZE' (-1) {
notDisplayManagerAware,
reserved,
reserved,
350 * 1024,
500 * 1024,
136 * 1024
};
@ -178,3 +183,75 @@ resource 'BNDL' (128, purgeable) {
}
}
};
resource 'DLOG' (128, purgeable)
{
{0, 0, 225, 348},
dBoxProc,
invisible,
noGoAway,
0x0,
128,
"",
noAutoCenter
};
resource 'DITL' (128, purgeable)
{
{
/* [1] */
{138, 256, 156, 336},
Button { enabled, "Open" },
/* [2] */
{1152, 59, 1232, 77},
Button { enabled, "" },
/* [3] */
{188, 256, 206, 336},
Button { enabled, "Cancel" },
/* [4] */
{39, 232, 59, 347},
UserItem { disabled },
/* [5] */
{68, 256, 86, 336},
Button { enabled, "Eject" },
/* [6] */
{93, 256, 111, 336},
Button { enabled, "Drive" },
/* [7] */
{39, 12, 210, 230},
UserItem { enabled },
/* [8] */
{39, 229, 210, 246},
UserItem { enabled },
/* [9] */
{124, 252, 125, 340},
UserItem { disabled },
/* [10] */
{1044, 20, 1145, 116},
StaticText { disabled, "" },
/* [11] */
{163, 256, 181, 336},
Button { enabled, "Choose" }
}
};
resource 'DLOG' (129, purgeable)
{
{0, 0, 200, 344}, dBoxProc, invisible, noGoAway, 0,
129, "", noAutoCenter
};
resource 'DITL'(129)
{
{
{169, 252, 189, 332}, Button { enabled, "Open" },
{107, 252, 127, 332}, Button { enabled, "Cancel" },
{0, 0, 0, 0}, HelpItem { disabled, HMScanhdlg {-6042}},
{8, 235, 24, 337}, UserItem { enabled },
{32, 252, 52, 332}, Button { enabled, "Eject" },
{60, 252, 80, 332}, Button { enabled, "Desktop" },
{29, 12, 193, 230}, UserItem { enabled },
{6, 12, 25, 230}, UserItem { enabled },
{93, 251, 94, 333}, Picture { disabled, 11 },
{138, 252, 158, 332}, Button { enabled, "Choose" },
}
};

View File

@ -7,6 +7,9 @@ SEGMENT MacTCP
*/MacTCPStream.*
*/TCPConnectionProvider.*
SEGMENT SharedFile
*/SharedFile*.*
SEGMENT Launcher
*/AppLauncher.*
*/ToolLauncher.*

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Icons.r"
resource 'icl8' (128, purgeable) {

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MacSerialStream.h"
#include <Serial.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACSERIALSTREAM_H_
#define MACSERIALSTREAM_H_

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MacTCPStream.h"
#include <Devices.h>
#include <string.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Stream.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OpenTptConnectionProvider.h"
#include "OpenTptStream.h"
#include <ReliableStream.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ConnectionProvider.h"
#include <memory>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ConditionalMacros.h>
#if TARGET_API_MAC_CARBON
#define OTCARBONAPPLICATION 1

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Stream.h>

View File

@ -0,0 +1,243 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Preferences.h"
#include <Navigation.h>
#include <StandardFile.h>
#include <LowMem.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include "Window.h"
#include "SystemInfo.h"
static void ConvertToPathName(const FSSpec& spec)
{
Str255 buf;
unsigned char path[257];
CInfoPBRec ipb;
long dirID = spec.parID;
path[0] = 0;
while(dirID != 1)
{
ipb.dirInfo.ioCompletion = nullptr;
ipb.dirInfo.ioVRefNum = spec.vRefNum;
ipb.dirInfo.ioNamePtr = buf;
ipb.dirInfo.ioFDirIndex = -1;
ipb.dirInfo.ioDrDirID = dirID;
PBGetCatInfoSync(&ipb);
buf[buf[0]+1] = 0;
printf("element: %s\n", buf+1);
if(path[0] + buf[0] + 1 > 255)
{
printf("Path length overflow.\n");
return;
}
path[++path[0]] = ':';
std::reverse_copy(buf + 1, buf + 1 + buf[0], path + path[0] + 1);
path[0] += buf[0];
dirID = ipb.dirInfo.ioDrParID;
}
std::reverse(path + 1, path + 1 + path[0]);
path[path[0] + 1] = 0;
printf("path: %s\n", path+1);
memcpy(gPrefs.sharedDirectoryPath, path, path[0] + 1);
WritePrefs();
}
#if !TARGET_CPU_68K
// TODO: need to properly link to Navigation.far.o on 68K
static pascal void NavEventProc(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBackParms, void *callBackUD)
{
if(callBackSelector == kNavCBEvent)
{
if(callBackParms->eventData.eventDataParms.event->what == updateEvt)
{
auto win = reinterpret_cast<WindowRef>(callBackParms->eventData.eventDataParms.event->message);
if(auto winObject = reinterpret_cast<Window*>(GetWRefCon(win)))
{
winObject->Update();
}
}
}
}
static bool ChooseSharedDirectoryNav(FSSpec& spec)
{
bool success = false;
NavReplyRecord reply = {};
NavDialogOptions options = {};
options.version = kNavDialogOptionsVersion;
options.location = {-1,-1};
auto eventProc = NewNavEventUPP(&NavEventProc);
OSErr err = NavChooseFolder(nullptr, &reply, &options, eventProc, nullptr, nullptr);
DisposeNavEventUPP(eventProc);
if(err == noErr)
{
if(reply.validRecord)
{
long count = 0;
err = AECountItems(&reply.selection, &count);
if(err == noErr && count > 0)
{
AEKeyword keyword;
DescType actualType;
Size actualSize;
err = AEGetNthPtr(&reply.selection, 1, typeFSS, &keyword, &actualType,
&spec, sizeof(spec), &actualSize);
if(err == noErr)
success = true;
}
NavDisposeReply(&reply);
}
}
return success;
}
#endif
#if !TARGET_API_MAC_CARBON
static bool choosePressed = false;
static pascal short DlgHookProc(short item, DialogRef theDialog)
{
if(choosePressed)
return 1;
if(item == 11)
{
choosePressed = true;
return sfHookOpenFolder;
}
return item;
}
static pascal Boolean FileFilterProc(CInfoPBPtr pb)
{
return true;
}
static bool ChooseSharedDirectory6(FSSpec& spec)
{
SFReply reply;
auto dlgHookProc = NewDlgHookUPP(&DlgHookProc);
auto fileFilterProc = NewFileFilterUPP(&FileFilterProc);
choosePressed = false;
SFPGetFile(Point{-1,-1}, "\p", fileFilterProc, 0, nullptr, dlgHookProc, &reply, 128, nullptr);
DisposeDlgHookUPP(dlgHookProc);
DisposeFileFilterUPP(fileFilterProc);
if(choosePressed)
{
spec.name[0] = 0;
spec.parID = LMGetCurDirStore();
spec.vRefNum = -LMGetSFSaveDisk();
return true;
}
return false;
}
static pascal short DlgHookYDProc(short item, DialogRef theDialog, void *yourDataPtr)
{
if(choosePressed)
return 1;
if(item == 10)
{
choosePressed = true;
return sfHookOpenFolder;
}
return item;
}
static pascal Boolean FileFilterYDProc(CInfoPBPtr pb, void *yourDataPtr)
{
return true;
}
static bool ChooseSharedDirectory7(FSSpec& spec)
{
StandardFileReply reply;
auto dlgHookProc = NewDlgHookYDUPP(&DlgHookYDProc);
auto fileFilterProc = NewFileFilterYDUPP(&FileFilterYDProc);
choosePressed = false;
CustomGetFile(
fileFilterProc,
0,
nullptr,
&reply,
129,
Point{-1,-1},
dlgHookProc,
/*filterProc*/nullptr,
nullptr, nullptr,
nullptr);
DisposeDlgHookYDUPP(dlgHookProc);
DisposeFileFilterYDUPP(fileFilterProc);
if(choosePressed)
{
spec.name[0] = 0;
spec.parID = LMGetCurDirStore();
spec.vRefNum = -LMGetSFSaveDisk();
return true;
}
return false;
}
#endif
void ChooseSharedDirectory()
{
FSSpec spec;
bool ok = false;
#if TARGET_API_MAC_CARBON
ok = ChooseSharedDirectoryNav(spec);
#else
#if !TARGET_CPU_68K
if(NavServicesAvailable())
ok = ChooseSharedDirectoryNav(spec);
#else
if(!hasSys7StdFile)
ok = ChooseSharedDirectory6(spec);
#endif
else
ok = ChooseSharedDirectory7(spec);
#endif
if(ok)
ConvertToPathName(spec);
}

View File

@ -0,0 +1,48 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <MacTypes.h>
enum class Port : int
{
modemPort = 0,
printerPort,
macTCP,
openTptTCP,
sharedFiles
};
struct Prefs
{
const static int currentVersion = 2;
int version = currentVersion;
Port port = Port::modemPort;
long baud = 19200;
bool inSubLaunch = false;
Str255 sharedDirectoryPath;
};
extern Prefs gPrefs;
void ChooseSharedDirectory();
void ReadPrefs();
void WritePrefs();

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SerialConnectionProvider.h"
#include "MacSerialStream.h"
#include <ReliableStream.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ConnectionProvider.h"
#include <memory>

View File

@ -0,0 +1,54 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SharedFileProvider.h"
#include "SharedFileStream.h"
#include "Preferences.h"
SharedFileProvider::SharedFileProvider(StatusDisplay *statusDisplay)
{
stream = std::make_unique<SharedFileStream>(gPrefs.sharedDirectoryPath);
}
SharedFileProvider::~SharedFileProvider()
{
}
Stream* SharedFileProvider::getStream()
{
return stream.get();
}
void SharedFileProvider::idle()
{
if(stream)
{
stream->setListener(listener);
stream->idle();
}
}
void SharedFileProvider::unloadSegDummy()
{
}
void *SharedFileProvider::segmentToUnload()
{
return (void*) &unloadSegDummy;
}

View File

@ -0,0 +1,41 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ConnectionProvider.h"
#include <memory>
class SharedFileStream;
class StatusDisplay;
class SharedFileProvider : public ConnectionProvider
{
std::unique_ptr<SharedFileStream> stream;
static void unloadSegDummy();
public:
SharedFileProvider(StatusDisplay *statusDisplay);
virtual ~SharedFileProvider();
virtual Stream* getStream();
virtual void idle();
virtual void* segmentToUnload();
};

View File

@ -0,0 +1,137 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SharedFileStream.h"
#include <Files.h>
#include <stdio.h>
#include <string.h>
#include <TextUtils.h>
void SharedFileStream::MakeFileName(unsigned char *name, int i)
{
const unsigned char *templ = "\pout_channel_";
memcpy(name, templ, templ[0]+1);
Str31 s;
NumToString(i, s);
memcpy(name + name[0] + 1, s + 1, s[0]);
name[0] += s[0];
}
void SharedFileStream::write(const void* p, size_t n)
{
Str31 name;
MakeFileName(name, outQueueTail++);
HCreate(vRefNum, dirID, name, 'R68L', 'DATA' );
short refNum;
OSErr err = HOpenDF(vRefNum, dirID, name, fsWrDenyPerm, &refNum);
if(err)
return;
long count = n;
FSWrite(refNum, &count, p);
FSClose(refNum);
}
void SharedFileStream::idle()
{
const unsigned char* in_channel = "\pin_channel";
static int count = 0;
if(++count % 10)
return;
short refNum;
OSErr err = HOpenDF(vRefNum, dirID, in_channel, fsRdDenyPerm, &refNum);
if(err == 0)
{
long count, countTotal = 0;
do
{
count = kReadBufferSize;
err = FSRead(refNum, &count, &readBuffer);
countTotal += count;
if((err == noErr || err == eofErr) && count > 0)
notifyReceive(readBuffer, count);
} while(err == noErr);
FSClose(refNum);
#ifdef DEBUG_CONSOLE
printf("read %ld bytes, deleting package\n", countTotal);
#endif
HDelete(vRefNum, dirID, in_channel);
}
if(outQueueTail > outQueueHead)
{
const unsigned char* out_channel = "\pout_channel";
Str31 name;
MakeFileName(name, outQueueHead);
if(HRename(vRefNum, dirID, name, out_channel) == noErr)
++outQueueHead;
}
if(outQueueHead == outQueueTail)
outQueueHead = outQueueTail = 1;
}
bool SharedFileStream::allDataArrived() const
{
return outQueueHead == outQueueTail;
}
SharedFileStream::SharedFileStream(const unsigned char* path)
{
Str255 str;
memcpy(str, path, path[0] + 1);
CInfoPBRec ipb;
ipb.hFileInfo.ioCompletion = nullptr;
ipb.hFileInfo.ioVRefNum = 0;
ipb.hFileInfo.ioNamePtr = str;
ipb.hFileInfo.ioFDirIndex = 0;
ipb.hFileInfo.ioDirID = 0;
PBGetCatInfoSync(&ipb);
dirID = ipb.hFileInfo.ioDirID;
#ifdef DEBUG_CONSOLE
printf("dirID = %ld\n", dirID);
str[str[0]+1] = 0;
printf("name = %s\n", str + 1);
#endif
HParamBlockRec hpb;
hpb.ioParam.ioCompletion = nullptr;
hpb.ioParam.ioVRefNum = 0;
hpb.volumeParam.ioVolIndex = -1;
memcpy(str, path, path[0] + 1);
hpb.volumeParam.ioNamePtr = str;
PBHGetVInfoSync(&hpb);
#ifdef DEBUG_CONSOLE
str[str[0]+1] = 0;
printf("vRefNum = %d, name = %s\n", hpb.volumeParam.ioVRefNum, str + 1);
#endif
vRefNum = hpb.volumeParam.ioVRefNum;
}
SharedFileStream::~SharedFileStream()
{
}

View File

@ -0,0 +1,43 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Stream.h>
#include <stdint.h>
class SharedFileStream : public Stream
{
short vRefNum;
long dirID;
int outQueueHead = 1, outQueueTail = 1;
static const long kReadBufferSize = 4096;
uint8_t readBuffer[kReadBufferSize];
void MakeFileName(unsigned char *name, int i);
public:
virtual void write(const void* p, size_t n) override;
virtual bool allDataArrived() const override;
void idle();
SharedFileStream(const unsigned char* path);
~SharedFileStream();
};

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "StatusDisplay.h"
#include <Quickdraw.h>
#include <Windows.h>
@ -8,7 +27,6 @@ const short tableTop = 50;
const short tableLineHeight = 20;
const short tableBaseline = 15;
enum class StatusDisplay::Stat : short
{
heapSize,

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include <MacTypes.h>
#include <Windows.h>
#include <TextUtils.h>
@ -14,6 +33,7 @@ enum class AppStatus
readyPrinter,
readyMacTCP,
readyOpenTpt,
readySharedFiles,
downloading,
upgrading,
running,

View File

@ -1,4 +1,24 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
extern bool hasColorQD;
extern bool hasIconUtils;
extern bool hasSys7StdFile;

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TCPConnectionProvider.h"
#include "MacTCPStream.h"
#include <ReliableStream.h>
@ -12,7 +31,6 @@ TCPConnectionProvider::TCPConnectionProvider(StatusDisplay *statusDisplay)
TCPConnectionProvider::~TCPConnectionProvider()
{
}
Stream* TCPConnectionProvider::getStream()

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ConnectionProvider.h"
#include <memory>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AppLauncher.h"
#include <AppleEvents.h>

View File

@ -1,3 +1,22 @@
/*
Copyright 2019 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro68. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
class Window

View File

@ -328,6 +328,7 @@ Currently, LaunchAPPL supports the following methods for launching Mac applicati
* ssh - Invoke the `LaunchAPPL` tool remotely via ssh
* serial - Connect to a real Mac running the `LaunchAPPLServer` application via a null modem cable
* tcp - Connect to a real Mac running the `LaunchAPPLServer` application via a completely insecure TCP connection
* shared - Communicate with `LaunchAPPLServer` via files in a shared folder
If you're running on a Mac that's old enough to use the `classic` or `carbon` backends,
they will work out of the box, just launch an application as follows