diff --git a/CHANGELOG.md b/CHANGELOG.md index 75138af..e2f255a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ - Adjust screen colours to enhance visibility - Improved error handling for connection errors - Use a stack cookie to set minimum stack size to 32768 bytes (AmigaOS 3.1.4 or higher required) -- Shows a warning if the stack size is smaller than 32768 bytes +- Shows a warning if the stack size is smaller than 32768 bytes (AmigaOS 3 only) +- TODO - Fix send button in corner of screen on image mode in 3.X +- TODO - Fix colour of text cursor in OS4 ## 1.4.2 (2024-01-31) diff --git a/src/main.c b/src/main.c index 5b0c6c5..c0315a9 100644 --- a/src/main.c +++ b/src/main.c @@ -54,6 +54,23 @@ LONG main(int argc, char **argv) { if (cli == NULL) { wbStartupMessage = (struct WBStartup*)GetMsg(¤tTask->pr_MsgPort); } + + ULONG *upper, *lower, total; + + // For CLI tasks, stack bounds are determined differently + if (currentTask->pr_CLI) { + upper = (ULONG *)currentTask->pr_ReturnAddr + sizeof(ULONG); + total = *(ULONG *)currentTask->pr_ReturnAddr; + lower = upper - total; + } else { + upper = (ULONG *)currentTask->pr_Task.tc_SPUpper; + lower = (ULONG *)currentTask->pr_Task.tc_SPLower; + total = upper - lower; + } + + if (total < 327668) { + printf("Warning: The stack size of %ld bytes is too small. The minimum recommended stack size is 32768 bytes to avoid crashes.\n", total); + } #else if (argc == 0) { wbStartupMessage = (struct WBStartup *)argv; @@ -72,24 +89,6 @@ LONG main(int argc, char **argv) { #endif readConfig(); - ULONG *upper, *lower, total; - struct Task *task = FindTask(NULL); - - // For CLI tasks, stack bounds are determined differently - if (((struct Process *)task)->pr_CLI) { - upper = (ULONG *)((struct Process *)task)->pr_ReturnAddr + sizeof(ULONG); - total = *(ULONG *)((struct Process *)task)->pr_ReturnAddr; - lower = upper - total; - } else { - upper = (ULONG *)((struct Process *)task)->pr_Task.tc_SPUpper; - lower = (ULONG *)((struct Process *)task)->pr_Task.tc_SPLower; - total = upper - lower; - } - - if (total < 32768) { - printf("Warning: The stack size is too small. Please increase it to at least 32768 bytes to avoid crashes.\n"); - } - if (initVideo() == RETURN_ERROR) { printf("Failed to initialize video\n"); cleanExit(RETURN_ERROR); diff --git a/src/version.h b/src/version.h index 4af2b8b..dc482f3 100644 --- a/src/version.h +++ b/src/version.h @@ -1,3 +1,3 @@ #define APP_VERSION "1.4.3" -#define BUILD_NUMBER "2730" +#define BUILD_NUMBER "2734" #define APP_NAME "AmigaGPT" \ No newline at end of file