diff --git a/.gitignore b/.gitignore
index b0056850a..e0c5a2611 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ output/**
.vscode
node_modules
Debug*/**
+libs_for_simulator/**
\ No newline at end of file
diff --git a/openBeken_win32_mvsc2017.vcxproj b/openBeken_win32_mvsc2017.vcxproj
index 106712588..9d34c180b 100644
--- a/openBeken_win32_mvsc2017.vcxproj
+++ b/openBeken_win32_mvsc2017.vcxproj
@@ -83,6 +83,7 @@
$(SolutionDir)$(Configuration)\
$(Configuration)\
+ openBeken_win32
$(SolutionDir)$(Configuration)\
@@ -91,6 +92,7 @@
$(SolutionDir)$(Configuration)\
$(Configuration)\
+ openBeken_win32
$(SolutionDir)$(Configuration)\
diff --git a/src/httpserver/http_tcp_server_nonblocking.c b/src/httpserver/http_tcp_server_nonblocking.c
index 6f0ae4557..76f3d5eb3 100644
--- a/src/httpserver/http_tcp_server_nonblocking.c
+++ b/src/httpserver/http_tcp_server_nonblocking.c
@@ -10,7 +10,7 @@
SOCKET ListenSocket = INVALID_SOCKET;
-#define DEFAULT_PORT "80"
+int g_port = 80;
int HTTPServer_Start() {
@@ -29,7 +29,10 @@ int HTTPServer_Start() {
closesocket(ListenSocket);
}
// Resolve the server address and port
- iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result);
+ char service[6];
+ snprintf(service, sizeof(service), "%u", g_port);
+
+ iResult = getaddrinfo(NULL, service, &hints, &result);
if ( iResult != 0 ) {
printf("getaddrinfo failed with error: %d\n", iResult);
WSACleanup();
diff --git a/src/sim/Simulator.cpp b/src/sim/Simulator.cpp
index 9acba0309..e035b8dcb 100644
--- a/src/sim/Simulator.cpp
+++ b/src/sim/Simulator.cpp
@@ -324,9 +324,9 @@ bool CSimulator::saveSimulationAs(const char *s) {
void CSimulator::showExitSaveMessageBox() {
const SDL_MessageBoxButtonData buttons[] =
{
+ {SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 2, "Cancel"},
{ /* .flags, .buttonid, .text */ 0, 0, "No" },
- { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes" },
- { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 2, "Cancel" },
+ {SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Yes"}
};
const SDL_MessageBoxColorScheme colorScheme =
{
@@ -438,5 +438,11 @@ void CSimulator::onKeyDown(int keyCode) {
}
}
+void CSimulator::loadRecentProject() {
+ if (recents->size() > 0) {
+ loadSimulation(recents->get(0));
+ }
+}
+
#endif
diff --git a/src/sim/Simulator.h b/src/sim/Simulator.h
index 648583b91..55d22b4ef 100644
--- a/src/sim/Simulator.h
+++ b/src/sim/Simulator.h
@@ -66,6 +66,11 @@ public:
return true;
return false;
}
+
+ ///
+ /// Load the last project.
+ ///
+ void loadRecentProject();
};
#endif
\ No newline at end of file
diff --git a/src/sim/sim_sdl.cpp b/src/sim/sim_sdl.cpp
index 145f383e2..44053ebaf 100644
--- a/src/sim/sim_sdl.cpp
+++ b/src/sim/sim_sdl.cpp
@@ -179,6 +179,7 @@ extern "C" int SIM_CreateWindow(int argc, char **argv)
glutInit(&argc, argv);
sim = new CSimulator();
sim->createWindow();
+ sim->loadRecentProject();
return 0;
}
extern "C" void SIM_RunWindow() {
diff --git a/src/win_main.c b/src/win_main.c
index 561599eb5..042ede7c0 100644
--- a/src/win_main.c
+++ b/src/win_main.c
@@ -27,6 +27,7 @@ int accum_time = 0;
int win_frameNum = 0;
// this time counter is simulated, I need this for unit tests to work
int g_simulatedTimeNow = 0;
+extern int g_port;
#define DEFAULT_FRAME_TIME 5
@@ -182,7 +183,30 @@ int g_bDoingUnitTestsNow = 0;
#include "sim/sim_public.h"
int __cdecl main(int argc, char **argv)
{
- bool bWantsUnitTests = 1;
+ bool bWantsUnitTests = true;
+
+ if (argc > 1) {
+ int value;
+
+ for (int i = 1; i < argc; i++) {
+ if (argv[i][0] == '-') {
+ if (wal_strnicmp(argv[i] + 1, "port", 4) == 0) {
+ i++;
+
+ if (i < argc && sscanf(argv[i], "%d", &value) == 1) {
+ g_port = value;
+ }
+ } else if (wal_strnicmp(argv[i] + 1, "runUnitTests", 12) == 0) {
+ i++;
+
+ if (i < argc && sscanf(argv[i], "%d", &value) == 1) {
+ bWantsUnitTests = value != 0;
+ }
+ }
+ }
+ }
+ }
+
WSADATA wsaData;
int iResult;