mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-26 22:51:01 +00:00
LaunchAPPLServer: more accurate messages, fix leak
This commit is contained in:
parent
ed64f6dea3
commit
135795288f
@ -239,6 +239,7 @@ protected:
|
||||
public:
|
||||
void setListener(StreamListener *l) { listener = l; }
|
||||
|
||||
virtual ~ConnectionProvider() {}
|
||||
virtual Stream* getStream() = 0;
|
||||
virtual void idle() {}
|
||||
virtual void suspend() {}
|
||||
@ -317,7 +318,7 @@ public:
|
||||
|
||||
void onReset()
|
||||
{
|
||||
statusDisplay->SetStatus(AppStatus::ready, 0, 0);
|
||||
statusDisplay->SetStatus(gPrefs.port ? AppStatus::readyPrinter : AppStatus::readyModem, 0, 0);
|
||||
state = State::command;
|
||||
}
|
||||
|
||||
@ -344,7 +345,9 @@ public:
|
||||
dataSize = *(const uint32_t*)(p+8);
|
||||
rsrcSize = *(const uint32_t*)(p+12);
|
||||
|
||||
statusDisplay->SetStatus(AppStatus::downloading, 0, dataSize + rsrcSize);
|
||||
statusDisplay->SetStatus(command == RemoteCommand::upgradeLauncher ?
|
||||
AppStatus::upgrading : AppStatus::downloading,
|
||||
0, dataSize + rsrcSize);
|
||||
|
||||
FSDelete("\pRetro68App", 0);
|
||||
Create("\pRetro68App", 0, creator, type);
|
||||
@ -364,7 +367,7 @@ public:
|
||||
FSWrite(refNum, &count, p);
|
||||
remainingSize -= count;
|
||||
|
||||
statusDisplay->SetStatus(AppStatus::downloading, dataSize - remainingSize, dataSize + rsrcSize);
|
||||
statusDisplay->SetProgress(dataSize - remainingSize, dataSize + rsrcSize);
|
||||
|
||||
if(remainingSize)
|
||||
return count;
|
||||
@ -385,7 +388,7 @@ public:
|
||||
FSWrite(refNum, &count, p);
|
||||
remainingSize -= count;
|
||||
|
||||
statusDisplay->SetStatus(AppStatus::downloading, dataSize + rsrcSize - remainingSize, dataSize + rsrcSize);
|
||||
statusDisplay->SetProgress(dataSize + rsrcSize - remainingSize, dataSize + rsrcSize);
|
||||
|
||||
if(remainingSize)
|
||||
return count;
|
||||
@ -447,9 +450,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
state = State::command;
|
||||
connection->resume();
|
||||
statusDisplay->SetStatus(AppStatus::ready, 0, 0);
|
||||
onReset();
|
||||
}
|
||||
}
|
||||
else if(state == State::wait && nullEventCounter > 3)
|
||||
@ -482,8 +484,7 @@ public:
|
||||
}
|
||||
if(outSizeRemaining == 0 && stream->allDataArrived())
|
||||
{
|
||||
state = State::command;
|
||||
statusDisplay->SetStatus(AppStatus::ready, 0, 0);
|
||||
onReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,9 @@ resource 'WIND' (129, "Main") {
|
||||
resource 'STR#' (128, purgeable) {
|
||||
{
|
||||
"Listening on Modem Port...";
|
||||
"Listening on Printer Port...";
|
||||
"Downloading Application...";
|
||||
"Downloading Upgrade...";
|
||||
"Running Application...";
|
||||
"Sending Results...";
|
||||
}
|
||||
|
@ -69,8 +69,6 @@ StatusDisplay::StatusDisplay()
|
||||
DiffRgn(background, tmp, background);
|
||||
}
|
||||
DisposeRgn(tmp);
|
||||
|
||||
SetStatus(AppStatus::ready);
|
||||
}
|
||||
|
||||
StatusDisplay::~StatusDisplay()
|
||||
@ -176,7 +174,7 @@ void StatusDisplay::Idle()
|
||||
}
|
||||
|
||||
long newTimeRemaining = -1;
|
||||
if(status == AppStatus::downloading)
|
||||
if(status == AppStatus::downloading || status == AppStatus::upgrading)
|
||||
{
|
||||
long now = TickCount();
|
||||
if(now - startTime > 60 && progressDone > 4000)
|
||||
@ -206,7 +204,7 @@ void StatusDisplay::SetStatus(AppStatus stat)
|
||||
if(stat != status)
|
||||
{
|
||||
status = stat;
|
||||
if(status == AppStatus::downloading)
|
||||
if(status == AppStatus::downloading || status == AppStatus::upgrading)
|
||||
startTime = TickCount();
|
||||
GetIndString(statusString,128,(short)stat);
|
||||
SetPort(statusWindow);
|
||||
|
@ -5,10 +5,12 @@
|
||||
enum class AppStatus
|
||||
{
|
||||
empty = 0,
|
||||
ready = 1,
|
||||
downloading = 2,
|
||||
running = 3,
|
||||
uploading = 4
|
||||
readyModem = 1,
|
||||
readyPrinter,
|
||||
downloading,
|
||||
upgrading,
|
||||
running,
|
||||
uploading
|
||||
};
|
||||
|
||||
class StatusDisplay
|
||||
|
Loading…
Reference in New Issue
Block a user