summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <huth@tuxfamily.org>2020-05-02 07:33:09 (GMT)
committerThomas Huth <huth@tuxfamily.org>2020-05-02 07:33:09 (GMT)
commit3f271be1a3f015e57a1fcf7e53a06619b01d357a (patch)
treec8ef90606885e06f330d227bd9b78347d77b1785
parent976e2238d24c413b76e2c2f0bb2937ee34dd5363 (diff)
downloadhatari-3f271be1a3f015e57a1fcf7.zip
hatari-3f271be1a3f015e57a1fcf7.tar.gz
Show the EmuTOS version if available
-rw-r--r--src/includes/tos.h1
-rw-r--r--src/statusbar.c13
-rw-r--r--src/tos.c10
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
{
diff --git a/src/tos.c b/src/tos.c
index 082acc0..d299ec6 100644
--- a/src/tos.c
+++ b/src/tos.c
@@ -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]);