diff options
| author | Eero Tamminen <oak@helsinkinet.fi> | 2022-08-01 18:15:14 (GMT) |
|---|---|---|
| committer | Eero Tamminen <oak@helsinkinet.fi> | 2022-08-18 22:11:22 (GMT) |
| commit | a10573d2e6bc6e885e3d28330f88857f78a81e91 (patch) | |
| tree | cef4c3ec6efa5d8a85b1ac139da56fbba20213d2 | |
| parent | 08bc257aa4915663fbf76872d22d6fdf881f58cd (diff) | |
| download | hatari-a10573d2e6bc6e885e3d28330f88857f78a81e91.zip hatari-a10573d2e6bc6e885e3d28330f88857f78a81e91.tar.gz | |
Clear DTA cache on GEMDOS HD changes, and free it on exit
| -rw-r--r-- | src/gemdos.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gemdos.c b/src/gemdos.c index bf2d22d..d23c5eb 100644 --- a/src/gemdos.c +++ b/src/gemdos.c @@ -392,6 +392,23 @@ static void GemDOS_ClearAllInternalDTAs(void) DTAIndex = 0; } +/** + * Free all DTA cache structures + */ +static void GemDOS_FreeAllInternalDTAs(void) +{ + int i; + for(i = 0; i < DTACount; i++) + { + ClearInternalDTA(i); + } + if (InternalDTAs) + { + free(InternalDTAs); + InternalDTAs = NULL; + } + DTAIndex = 0; +} /*-----------------------------------------------------------------------*/ /** @@ -527,10 +544,6 @@ static void GemDOS_ClearAllFileHandles(void) void GemDOS_Init(void) { bInitGemDOS = false; - - GemDOS_ClearAllFileHandles(); - GemDOS_ClearAllInternalDTAs(); - } /*-----------------------------------------------------------------------*/ @@ -696,6 +709,9 @@ void GemDOS_InitDrives(void) int ImagePartitions; bool bMultiPartitions; + GemDOS_ClearAllFileHandles(); + GemDOS_ClearAllInternalDTAs(); + bMultiPartitions = GemDOS_DetermineMaxPartitions(&nMaxDrives); /* initialize data for harddrive emulation: */ @@ -791,6 +807,8 @@ void GemDOS_UnInitDrives(void) { int i; + GemDOS_FreeAllInternalDTAs(); + GemDOS_Reset(); /* Close all open files on emulated drive */ if (GEMDOS_EMU_ON) |
