Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Aug 24, 2024
1 parent ab7bc6f commit 9bdf687
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 195 deletions.
4 changes: 2 additions & 2 deletions Emulator/Base/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Thread::execute()

// The emulator got out of sync
if (missing > 0) {
warn("Emulation is way too slow (%ld frames behind)\n", missing);
debug(VID_DEBUG, "Emulation is way too slow (%ld frames behind)\n", missing);
} else {
warn("Emulation is way too fast (%ld time slices ahead)\n", -missing);
debug(VID_DEBUG, "Emulation is way too fast (%ld time slices ahead)\n", -missing);
}

resync();
Expand Down
17 changes: 7 additions & 10 deletions Emulator/Headless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
//
// See https://mozilla.org/MPL/2.0 for license information
// -----------------------------------------------------------------------------
/// @file

#include "config.h"
#include "Headless.h"
#include "HeadlessScripts.h"
#include "Amiga.h"
#include "Script.h"
#include "DiagRom.h"
#include <filesystem>
#include <chrono>

int main(int argc, char *argv[])
Expand Down Expand Up @@ -74,7 +75,7 @@ Headless::main(int argc, char *argv[])
if (keys.find("diagnose") != keys.end()) { runScript(selfTestScript); }
if (keys.find("arg1") != keys.end()) { runScript(keys["arg1"]); }

return 0;
return returnCode;
}

void
Expand Down Expand Up @@ -121,7 +122,7 @@ Headless::checkArguments()
}
}

int
void
Headless::runScript(const char **script)
{
auto path = std::filesystem::temp_directory_path() / "script.ini";
Expand All @@ -130,10 +131,10 @@ Headless::runScript(const char **script)
for (isize i = 0; script[i] != nullptr; i++) {
file << script[i] << std::endl;
}
return runScript(path);
runScript(path);
}

int
void
Headless::runScript(const std::filesystem::path &path)
{
// Read the input script
Expand All @@ -155,8 +156,6 @@ Headless::runScript(const std::filesystem::path &path)
const auto timeout = util::Time::seconds(500.0);
vamiga.retroShell.execScript(script);
waitForWakeUp(timeout);

return *returnCode;
}

void
Expand All @@ -169,7 +168,6 @@ void
Headless::process(Message msg)
{
static bool messages = keys.find("messages") != keys.end();
static string serout;

if (messages) {

Expand All @@ -182,13 +180,12 @@ Headless::process(Message msg)

case MSG_RSH_ERROR:

returnCode = 0;
returnCode = 1;
wakeUp();
break;

case MSG_ABORT:

returnCode = msg.value;
wakeUp();
break;

Expand Down
7 changes: 3 additions & 4 deletions Emulator/Headless.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "VAmiga.h"
#include "Wakeable.h"
#include "HeadlessScripts.h"
#include <map>

namespace vamiga {
Expand All @@ -29,7 +28,7 @@ class Headless : Wakeable {
std::map<string,string> keys;

// Return code
std::optional<int> returnCode;
int returnCode = 0;


//
Expand All @@ -50,8 +49,8 @@ class Headless : Wakeable {
void checkArguments() throws;

// Runs a RetroShell script
int runScript(const char **script);
int runScript(const std::filesystem::path &path);
void runScript(const char **script);
void runScript(const std::filesystem::path &path);


//
Expand Down
4 changes: 3 additions & 1 deletion Emulator/HeadlessScripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ static const char *smokeTestScript[] = {

"i host",
"i server",


"shutdown",

nullptr
};

Loading

0 comments on commit 9bdf687

Please sign in to comment.