Re: [hatari-devel] pVideoRaster in memory snapshot?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On 4/9/20 12:36 AM, Nicolas Pomarède wrote:
Le 08/04/2020 à 22:22, Eero Tamminen a écrit :
Hi Nicolas,

Why this ignores the stored "pVideoRaster" value and restores it instead to "VideoBase" variable STRam offset?
-------------------------
void Video_MemorySnapShot_Capture(bool bSave)
{
         Uint32  addr;
...
         MemorySnapShot_Store(&VideoBase, sizeof(VideoBase));
         if ( bSave )
         {
                 addr = pVideoRaster - STRam;
                 MemorySnapShot_Store(&addr, sizeof(addr));
         }
         else
         {
                 MemorySnapShot_Store(&addr, sizeof(addr));
                 pVideoRaster = &STRam[VideoBase];
         }
-------------------------

(If it's intentional, there should be a comment about the reason.)

Hi

that's because pVideoRaster is a pointer inside the host PC's RAM. So there's no point in saving pointer to RAM, it would be wrong, you can't restore them.

The question was not why it saves an offset, but why it doesn't
restore the pointer based on that saved offset.

Restore calculates pVideoRasterpointer using offset for another variable...


	- Eero


There're a fews others places in other HW components (fdc.c IIRC) where we need to save offsets relative to an allocated buffer, then on restore allocate a new buffer and add offset to get the correct value again.

I'm not sure this requires a comment (or maybe there's a comment in fdc.c but not here).



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/