add check and warnings/errors for CPU type

This commit is contained in:
cy384 2020-07-25 18:57:03 -04:00
parent db264d0065
commit 9242fc4ef6
4 changed files with 118 additions and 14 deletions

View File

@ -2,22 +2,33 @@
ssheven ssheven
------- -------
A modern SSH client for Mac OS 7/8/9 on m68k and PPC machines. A modern SSH client for Mac OS 7/8/9.
Project status: as of 0.1.0 (see github releases), an actual SSH client, with a zero-features "vanilla" fixed-size terminal Project status: as of 0.2.0 (see github releases), an actual SSH client that only crashes or locks up sometimes, with a zero-features "vanilla" fixed-size terminal
* encryption libraries: ham-handedly ported and fairly functional
* console emulation: very basic, no escape codes or anything yet (to be implemented with libvterm soon)
* UI/UX: it quits when you click the close button! (i.e. basically nothing yet)
system requirements system requirements
------------------- -------------------
* CPU: at least a 68020, which may still be too slow. Any PPC processor should be fast enough! * CPU: 33 MHz 68040 (or 68LC040) might be fast enough to connect without timeouts (even with mbedtls's hand written assembly in the slow part!). Any PPC processor should be fine.
* RAM: requires approx 2MB (adjust up via the info box if it crashes) * RAM: requires approx 2MB (adjust up via the info box if it crashes)
* Disk space: currently about 1MB for the fat binary, or about 600KB for one platform * Disk space: currently about 1MB for the fat binary, or about 600KB for one platform
* System 7.5 recommended, earlier System 7 versions possible with the Thread Manager extension installed * System 7.5 recommended, earlier System 7 versions possible with the Thread Manager extension installed
* Open Transport networking required, version 1.1.1 recommended minimum * Open Transport networking required, version 1.1.1 recommended minimum
to do
-----
* terminal resizing
* proper region invalidation/redraw
* good console emulation (to be implemented with libvterm)
* menus
* saving/loading connection settings
* nicer connection dialog
* preferences
* better error checking
* key authentication
* check server keys/known keys
* copy/paste
* figure out how to improve 68k performance (possibly impossible)
build build
----- -----
More details to come as functionality is added. More details to come as functionality is added.

View File

@ -26,17 +26,25 @@
* "vanilla" supports basically nothing, which is good for us here */ * "vanilla" supports basically nothing, which is good for us here */
#define SSHEVEN_TERMINAL_TYPE "vanilla" #define SSHEVEN_TERMINAL_TYPE "vanilla"
/* alert for failure to find OT */
#define ALRT_OT 128
#define DITL_OT 129
/* dialog for getting connection info */ /* dialog for getting connection info */
#define DLOG_CONNECT 128 #define DLOG_CONNECT 128
#define DITL_CONNECT 128 #define DITL_CONNECT 128
/* alert for failure to find OT */
#define ALRT_OT 129
#define DITL_OT 129
/* alert for failure to find thread manager */ /* alert for failure to find thread manager */
#define ALRT_TM 128 #define ALRT_TM 130
#define DITL_TM 129 #define DITL_TM 130
/* alert for slow CPU detected */
#define ALRT_CPU_SLOW 131
#define DITL_CPU_SLOW 131
/* alert for pre-68020 detected */
#define ALRT_CPU_BAD 132
#define DITL_CPU_BAD 132
#endif #endif

View File

@ -468,9 +468,9 @@ void* read_thread(void* arg)
int safety_checks(void) int safety_checks(void)
{ {
OSStatus err; OSStatus err;
long int thread_manager_gestalt = 0;
// check for thread manager // check for thread manager
long int thread_manager_gestalt = 0;
err = Gestalt(gestaltThreadMgrAttr, &thread_manager_gestalt); err = Gestalt(gestaltThreadMgrAttr, &thread_manager_gestalt);
// bit one is prescence of thread manager // bit one is prescence of thread manager
@ -530,6 +530,43 @@ int safety_checks(void)
print_int(ot_version->minorAndBugRev & 0x0F); print_int(ot_version->minorAndBugRev & 0x0F);
print_string_i("\n"); print_string_i("\n");
// check for CPU type and display warning if it's going to be too slow
long int cpu_type = 0;
int cpu_slow = 0;
int cpu_bad = 0;
err = Gestalt(gestaltNativeCPUtype, &cpu_type);
if (err != noErr || cpu_type == 0)
{
// earlier than 7.5, need to use other gestalt
err = Gestalt(gestaltProcessorType, &cpu_type);
if (err != noErr || cpu_type == 0)
{
CautionAlert(ALRT_CPU_SLOW, nil);
print_string_i("Failed to detect CPU type, continuing anyway.\n");
}
else
{
if (cpu_type <= gestalt68010) cpu_bad = 1;
if (cpu_type <= gestalt68030) cpu_slow = 1;
}
}
else
{
if (cpu_type <= gestaltCPU68010) cpu_bad = 1;
if (cpu_type <= gestaltCPU68030) cpu_slow = 1;
}
if (cpu_bad)
{
StopAlert(ALRT_CPU_BAD, nil);
return 0;
}
if (cpu_slow)
{
CautionAlert(ALRT_CPU_SLOW, nil);
}
return 1; return 1;
} }

View File

@ -92,6 +92,54 @@ resource 'ALRT' (ALRT_TM, purgeable) {
alertPositionMainScreen alertPositionMainScreen
}; };
resource 'DITL' (DITL_CPU_SLOW) {
{
{ 50, 260, 70, 340 },
Button { enabled, "OK" };
{ 10, 70, 30, 340 },
StaticText { enabled, "Your CPU is probably too slow!" };
}
};
resource 'ALRT' (ALRT_CPU_SLOW, purgeable) {
{ 50, 100, 50+80, 100+350 },
DITL_CPU_SLOW,
/* OK means draw default border on first button */
{
OK, visible, silent,
OK, visible, silent,
OK, visible, silent,
OK, visible, silent
},
alertPositionMainScreen
};
resource 'DITL' (DITL_CPU_BAD) {
{
{ 50, 260, 70, 340 },
Button { enabled, "OK" };
{ 10, 70, 30, 340 },
StaticText { enabled, "SSHeven requires a 68020 or later!" };
}
};
resource 'ALRT' (ALRT_CPU_BAD, purgeable) {
{ 50, 100, 50+80, 100+350 },
DITL_CPU_BAD,
/* OK means draw default border on first button */
{
OK, visible, silent,
OK, visible, silent,
OK, visible, silent,
OK, visible, silent
},
alertPositionMainScreen
};
#include "Processes.r" #include "Processes.r"
resource 'SIZE' (-1) { resource 'SIZE' (-1) {