diff options
| author | Thomas Huth <huth@tuxfamily.org> | 2020-05-02 07:33:09 (GMT) |
|---|---|---|
| committer | Thomas Huth <huth@tuxfamily.org> | 2020-05-02 07:33:09 (GMT) |
| commit | 3f271be1a3f015e57a1fcf7e53a06619b01d357a (patch) | |
| tree | c8ef90606885e06f330d227bd9b78347d77b1785 | |
| parent | 976e2238d24c413b76e2c2f0bb2937ee34dd5363 (diff) | |
| download | hatari-3f271be1a3f015e57a1fcf7.zip hatari-3f271be1a3f015e57a1fcf7.tar.gz | |
Show the EmuTOS version if available
| -rw-r--r-- | src/includes/tos.h | 1 | ||||
| -rw-r--r-- | src/statusbar.c | 13 | ||||
| -rw-r--r-- | src/tos.c | 10 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/includes/tos.h b/src/includes/tos.h index 3ecbc4a..c9d8c70 100644 --- a/src/includes/tos.h +++ b/src/includes/tos.h @@ -9,6 +9,7 @@ #define HATARI_TOS_H extern bool bIsEmuTOS; +extern Uint32 EmuTosVersion; extern Uint16 TosVersion; extern Uint32 TosAddress, TosSize; extern bool bTosImageLoaded; diff --git a/src/statusbar.c b/src/statusbar.c index 6c456ad..d5744ff 100644 --- a/src/statusbar.c +++ b/src/statusbar.c @@ -624,7 +624,18 @@ void Statusbar_UpdateInfo(void) end = Statusbar_AddString(end, ", "); if (bIsEmuTOS) { - end = Statusbar_AddString(end, "EmuTOS"); + if (EmuTosVersion > 0) + { + char str[20]; + snprintf(str, sizeof(str), "EmuTOS %d.%d.%d", + EmuTosVersion >> 24, (EmuTosVersion >> 16) & 0xff, + (EmuTosVersion >> 8) & 0xff); + end = Statusbar_AddString(end, str); + } + else + { + end = Statusbar_AddString(end, "EmuTOS"); + } } else { @@ -45,6 +45,7 @@ const char TOS_fileid[] = "Hatari tos.c : " __DATE__ " " __TIME__; #define TEST_PRG_START (TEST_PRG_BASEPAGE + 0x100) bool bIsEmuTOS; +Uint32 EmuTosVersion; Uint16 TosVersion; /* eg. 0x0100, 0x0102 */ Uint32 TosAddress, TosSize; /* Address in ST memory and size of TOS image */ bool bTosImageLoaded = false; /* Successfully loaded a TOS image? */ @@ -960,7 +961,7 @@ static uint8_t *TOS_LoadImage(void) TosVersion = 0; pTosFile = File_Read(ConfigureParams.Rom.szTosImageFileName, &nFileSize, pszTosNameExts); - if (!pTosFile || nFileSize <= 0) + if (!pTosFile || nFileSize < 0x40) { Log_AlertDlg(LOG_FATAL, "Can not load TOS file:\n'%s'", ConfigureParams.Rom.szTosImageFileName); free(pTosFile); @@ -992,6 +993,13 @@ static uint8_t *TOS_LoadImage(void) /* Check for EmuTOS ... (0x45544F53 = 'ETOS') */ bIsEmuTOS = (SDL_SwapBE32(*(Uint32 *)&pTosFile[0x2c]) == 0x45544F53); + if (bIsEmuTOS) + { + if (SDL_SwapBE32(*(Uint32 *)&pTosFile[0x34]) == 0x4F534558) + EmuTosVersion = SDL_SwapBE32(*(Uint32 *)&pTosFile[0x3c]); + else + EmuTosVersion = 0; /* Older than 1.0 */ + } /* Now, look at start of image to find Version number and address */ TosVersion = SDL_SwapBE16(*(Uint16 *)&pTosFile[2]); |
