diff --git a/README.md b/README.md index 0b82eae..b1d6a20 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,33 @@ 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 - -* 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) +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 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) * 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 * 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 ----- More details to come as functionality is added. diff --git a/ssheven-constants.r b/ssheven-constants.r index b3b9c41..09313c5 100644 --- a/ssheven-constants.r +++ b/ssheven-constants.r @@ -26,17 +26,25 @@ * "vanilla" supports basically nothing, which is good for us here */ #define SSHEVEN_TERMINAL_TYPE "vanilla" -/* alert for failure to find OT */ -#define ALRT_OT 128 -#define DITL_OT 129 - /* dialog for getting connection info */ #define DLOG_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 */ -#define ALRT_TM 128 -#define DITL_TM 129 +#define ALRT_TM 130 +#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 diff --git a/ssheven.c b/ssheven.c index ddc1bc7..5b91576 100644 --- a/ssheven.c +++ b/ssheven.c @@ -468,9 +468,9 @@ void* read_thread(void* arg) int safety_checks(void) { OSStatus err; - long int thread_manager_gestalt = 0; // check for thread manager + long int thread_manager_gestalt = 0; err = Gestalt(gestaltThreadMgrAttr, &thread_manager_gestalt); // bit one is prescence of thread manager @@ -530,6 +530,43 @@ int safety_checks(void) print_int(ot_version->minorAndBugRev & 0x0F); 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; } diff --git a/ssheven.r b/ssheven.r index f7b773d..042f1c1 100644 --- a/ssheven.r +++ b/ssheven.r @@ -92,6 +92,54 @@ resource 'ALRT' (ALRT_TM, purgeable) { 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" resource 'SIZE' (-1) {