]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/tom.cpp
Minor memory allocation/free fixup
[virtualjaguar] / src / tom.cpp
index 7f425b9e6990af913c8c3d0994e528a58217e8f8..a8e482d6c6f1718ffa00a8a0bc2ebd1effd178f3 100644 (file)
@@ -359,7 +359,7 @@ render_xxx_scanline_fn * scanline_render_stretch[]=
 render_xxx_scanline_fn * scanline_render[8];
 
 
-// Screen info for various games...
+// Screen info for various games [NTSC]...
 /*
 Doom
 TOM: Horizontal Display End written by M68K: 1727
@@ -457,8 +457,6 @@ Vertical resolution: 238 lines
 
 void tom_calc_cry_rgb_mix_lut(void)
 {
-       memory_malloc_secure((void **)&tom_cry_rgb_mix_lut, 2 * 0x10000, "CRY/RGB mixed mode LUT");
-
        for (uint32 i=0; i<0x10000; i++)
        {
                uint16 color = i;
@@ -478,6 +476,7 @@ void tom_calc_cry_rgb_mix_lut(void)
                                blue = (((uint32)bluecv[chrm][chrl]) * y) >> 11;
                        color = (red << 10) | (green << 5) | blue;
                }
+
                tom_cry_rgb_mix_lut[i] = color;
        }
 }
@@ -852,6 +851,8 @@ void TOMExecScanline(uint16 scanline, bool render)
 //
 void tom_init(void)
 {
+       memory_malloc_secure((void **)&tom_cry_rgb_mix_lut, 2 * 0x10000, "CRY/RGB mixed mode LUT");
+
        op_init();
        blitter_init();
 //This should be done by JERRY!        pcm_init();
@@ -875,6 +876,7 @@ void tom_done(void)
 //     gpu_done();
 //     dsp_done();
        memory_free(tom_ram_8);
+       memory_free(tom_cry_rgb_mix_lut);
 }
 
 /*uint32 tom_getHBlankWidthInPixels(void)
@@ -917,10 +919,10 @@ uint32 tom_getVideoModeWidth(void)
        // To make it easier to make a quasi-fixed display size, we restrict the viewing
        // area to an arbitrary range of the Horizontal Count.
        uint16 pwidth = ((GET16(tom_ram_8, VMODE) & PWIDTH) >> 9) + 1;
-//     return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / pwidth;
+       return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / pwidth;
 //Temporary, for testing Doom...
-       return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / (pwidth == 8 ? 4 : pwidth);
-//     return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / (pwidth == 4 ? 8 : pwidth);
+//     return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / (pwidth == 8 ? 4 : pwidth);
+////   return (RIGHT_VISIBLE_HC - LEFT_VISIBLE_HC) / (pwidth == 4 ? 8 : pwidth);
 
 // More speculating...
 // According to the JTRM, the number of potential pixels across is given by the
@@ -970,8 +972,9 @@ uint32 tom_getVideoModeHeight(void)
 //     return (vbb - vbe) >> 1;        // Again, doesn't take interlacing into account...
 // This of course doesn't take interlacing into account. But I haven't seen any
 // Jaguar software that takes advantage of it either...
-//Also, doesn't reflect PAL Jaguar either... !!! FIX !!!
-       return 240;                                                                             // Set virtual screen height to 240 lines...
+//Also, doesn't reflect PAL Jaguar either... !!! FIX !!! [DONE]
+//     return 240;                                                                             // Set virtual screen height to 240 lines...
+       return (vjs.hardwareTypeNTSC ? 240 : 256);
 }
 
 //
@@ -980,8 +983,6 @@ uint32 tom_getVideoModeHeight(void)
 //
 void tom_reset(void)
 {
-//     extern bool hardwareTypeNTSC;
-
        op_reset();
        blitter_reset();
 //This should be done by JERRY!                pcm_reset();