aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CATSFC/system/language.msg18
-rw-r--r--source/nds/displaymodes.cpp111
-rw-r--r--source/nds/entry.cpp4
3 files changed, 84 insertions, 49 deletions
diff --git a/CATSFC/system/language.msg b/CATSFC/system/language.msg
index 4f003e4..86eb274 100644
--- a/CATSFC/system/language.msg
+++ b/CATSFC/system/language.msg
@@ -143,19 +143,19 @@ Select a game from the card
Select a game
#MSG_SCREEN_RATIO_0
-[0] Resized, entire screen
+[0] Entire screen
#MSG_SCREEN_RATIO_1
-[1] Original, show the bottom
+[1] Bottom, square pixels
#MSG_SCREEN_RATIO_2,
-[2] Original, show the top
+[2] Top, square pixels
#MSG_SCREEN_RATIO_3,
-[3] Original, show the middle
+[3] Middle, square pixels
#MSG_SCREEN_RATIO_4,
-[4] Resized, entire screen
+[4] Entire screen, antialiased
#MSG_FRAMESKIP_0
Manual
@@ -865,16 +865,16 @@ Sélectionner un jeu
[0] Écran entier
#MSG_SCREEN_RATIO_1
-[1] Couper le haut
+[1] Bas, pixels carrés
#MSG_SCREEN_RATIO_2,
-[2] Couper le bas
+[2] Haut, pixels carrés
#MSG_SCREEN_RATIO_3,
-[3] Montrer le milieu
+[3] Milieu, pixels carrés
#MSG_SCREEN_RATIO_4,
-[4] Écran entier
+[4] Écran entier anticrénelé
#MSG_FRAMESKIP_0
Manuelle
diff --git a/source/nds/displaymodes.cpp b/source/nds/displaymodes.cpp
index 4b52753..c45f7c1 100644
--- a/source/nds/displaymodes.cpp
+++ b/source/nds/displaymodes.cpp
@@ -1,53 +1,88 @@
-//entry.c
+/* displaymodes.cpp
+ *
+ * Copyright (C) 2012 GBAtemp user Nebuleon.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
#include <stdio.h>
#include "ds2_types.h"
-#include "ds2_cpu.h"
-#include "ds2_timer.h"
#include "ds2io.h"
-#include "fs_api.h"
-
#include "gfx.h"
-
-u32 y_scale_ = (224<<8) / 192;
-
-
-static inline void Put_Pixel (unsigned char* screen, int y, int y_scale)
+static uint16 SevenToSixScanlineResize (uint16 TopColour, uint16 BottomColour, uint8 TopFraction, uint8 BottomFraction)
{
-
- memcpy(&screen[((y<<1) << 8)], &GFX.Screen [(((y*y_scale)>>8)<<1) <<8], 256*2);
+ // Speed hacks!
+ if (TopColour == BottomColour) // Two colours identical (no calc)
+ return TopColour;
+ if (TopColour == 0x0000) // From black to a non-identical colour
+ return
+ // Red component
+ ( ( ((BottomColour >> 10) & 0x1F) * BottomFraction / 7 ) << 10 )
+ // Green component
+ | ( ( ((BottomColour >> 5) & 0x1F) * BottomFraction / 7 ) << 5 )
+ // Blue component
+ | ( ( (BottomColour & 0x1F) * BottomFraction / 7 ) )
+ ;
+ if (BottomColour == 0x0000) // To black from a non-identical colour
+ return
+ // Red component
+ ( ( ((TopColour >> 10) & 0x1F) * TopFraction / 7 ) << 10 )
+ // Green component
+ | ( ( ((TopColour >> 5) & 0x1F) * TopFraction / 7 ) << 5 )
+ // Blue component
+ | ( ( (TopColour & 0x1F) * TopFraction / 7 ) )
+ ;
+ return
+ // Red component
+ ( ( ((TopColour >> 10) & 0x1F) * TopFraction / 7 + ((BottomColour >> 10) & 0x1F) * BottomFraction / 7 ) << 10 )
+ // Green component
+ | ( ( ((TopColour >> 5) & 0x1F) * TopFraction / 7 + ((BottomColour >> 5) & 0x1F) * BottomFraction / 7 ) << 5 )
+ // Blue component
+ | ( ( (TopColour & 0x1F) * TopFraction / 7 + (BottomColour & 0x1F) * BottomFraction / 7 ) )
+ ;
}
-
-bool Draw_Frame_Flip(bool flip)
+void NDSSFCDrawFrameAntialiased ()
{
+ uint16 X, Y;
+ uint16 *SrcTop = (uint16 *) GFX.Screen, *SrcBottom = SrcTop + 256, *Dest = (uint16 *) up_screen_addr;
- int y = 0;
-
- do
+ for (Y = 0; Y < 224; Y += 7)
{
- int tempy = y << 4;
-
-
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_+1);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);tempy++;
- Put_Pixel ((unsigned char*)up_screen_addr, tempy, y_scale_);
+ for (X = 0; X < 256; X++)
+ *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 6, 1);
+ // At the end of this loop, line 1 for this block of 6
+ // has been drawn from the 2 first lines in the block
+ // of 7. Do the rest.
+ for (X = 0; X < 256; X++)
+ *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 5, 2);
+ for (X = 0; X < 256; X++)
+ *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 4, 3);
+ for (X = 0; X < 256; X++)
+ *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 3, 4);
+ for (X = 0; X < 256; X++)
+ *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 2, 5);
+ for (X = 0; X < 256; X++)
+ *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 1, 6);
+ // At the end of these loops, SrcTop and SrcBottom point to
+ // the first element in the 7th line of the current block and
+ // the first element in the 1st line of the next.
+ // We need to increase the pointer to start on lines 1 & 2.
+ SrcTop += 256;
+ SrcBottom += 256;
}
- while(++y < 12);
- return 1;
}
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index 33566d5..8c5d8e4 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -129,7 +129,7 @@ bool8 S9xInitUpdate ()
bool frame_flip = 0;
-extern bool Draw_Frame_Flip(bool flip);
+extern void NDSSFCDrawFrameAntialiased();
bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/)
@@ -154,7 +154,7 @@ bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/)
break;
case 4:
- frame_flip = Draw_Frame_Flip(frame_flip);
+ NDSSFCDrawFrameAntialiased ();
break;