[Scummvm-cvs-logs] SF.net SVN: scummvm:[47242] scummvm/trunk/backends/platform/n64

Hkz at users.sourceforge.net Hkz at users.sourceforge.net
Mon Jan 11 10:34:20 CET 2010


Revision: 47242
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47242&view=rev
Author:   Hkz
Date:     2010-01-11 09:34:20 +0000 (Mon, 11 Jan 2010)

Log Message:
-----------
N64: a few optimizations in framebuffer drawing code

Modified Paths:
--------------
    scummvm/trunk/backends/platform/n64/Makefile
    scummvm/trunk/backends/platform/n64/osys_n64_base.cpp

Modified: scummvm/trunk/backends/platform/n64/Makefile
===================================================================
--- scummvm/trunk/backends/platform/n64/Makefile	2010-01-11 09:30:41 UTC (rev 47241)
+++ scummvm/trunk/backends/platform/n64/Makefile	2010-01-11 09:34:20 UTC (rev 47242)
@@ -17,11 +17,11 @@
 DEFINES += -D__N64__ -DLIMIT_FPS -DNONSTANDARD_PORT -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_FANCY_THEMES -DDISABLE_DOSBOX_OPL -DENABLE_VKEYBD -DUSE_ZLIB
 LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs 
 
-DEFINES += -D_ENABLE_DEBUG_
+#DEFINES += -D_ENABLE_DEBUG_
 #DEFINES += -D_NORMAL_N64_DELAY_
 
 USE_LIBMAD=0
-USE_LIBOGG=1
+USE_LIBOGG=0
 
 ifeq ($(USE_LIBMAD),1)
 DEFINES += -DUSE_MAD
@@ -53,7 +53,7 @@
 
 ENABLED=STATIC_PLUGIN
 
-ENABLE_SCUMM=$(ENABLED)
+#ENABLE_SCUMM=$(ENABLED)
 #ENABLE_SKY=$(ENABLED)
 #ENABLE_SCI=$(ENABLED)
 #ENABLE_GOB=$(ENABLED)
@@ -64,6 +64,8 @@
 #ENABLE_QUEEN = $(ENABLED)
 #ENABLE_MADE = $(ENABLED)
 #ENABLE_SAGA = $(ENABLED)
+#ENABLE_TEENAGENT = $(ENABLED)
+#ENABLE_DRACI = $(ENABLED)
 
 OBJS :=	nintendo64.o osys_n64_base.o osys_n64_events.o osys_n64_utilities.o pakfs_save_manager.o framfs_save_manager.o
 

Modified: scummvm/trunk/backends/platform/n64/osys_n64_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/n64/osys_n64_base.cpp	2010-01-11 09:30:41 UTC (rev 47241)
+++ scummvm/trunk/backends/platform/n64/osys_n64_base.cpp	2010-01-11 09:34:20 UTC (rev 47242)
@@ -72,7 +72,7 @@
 	_frameBufferWidth = 340;
 
 	// Pixels to skip
-	_offscrPixels = 15;
+	_offscrPixels = 16;
 
 	// Video clock
 	_viClockRate = VI_NTSC_CLOCK;
@@ -254,7 +254,7 @@
 		_frameBufferWidth = 340;
 		_screenWidth = 320;
 		_screenHeight = 240;
-		_offscrPixels = 15;
+		_offscrPixels = 16;
 		_graphicMode = OVERS_PAL_340X240;
 		enableAudioPlayback();
 		break;
@@ -280,7 +280,7 @@
 		_frameBufferWidth = 340;
 		_screenWidth = 320;
 		_screenHeight = 240;
-		_offscrPixels = 15;
+		_offscrPixels = 16;
 		_graphicMode = OVERS_MPAL_340X240;
 		enableAudioPlayback();
 		break;
@@ -307,7 +307,7 @@
 		_frameBufferWidth = 340;
 		_screenWidth = 320;
 		_screenHeight = 240;
-		_offscrPixels = 15;
+		_offscrPixels = 16;
 		_graphicMode = OVERS_NTSC_340X240;
 		enableAudioPlayback();
 		break;
@@ -470,6 +470,7 @@
 
 	uint8 skip_lines = (_screenHeight - _gameHeight) / 4;
 	uint8 skip_pixels = (_screenWidth - _gameWidth) / 2; // Center horizontally the image
+	skip_pixels -= (skip_pixels % 8); // To keep aligned memory access
 
 	if (_dirtyPalette)
 		rebuildOffscreenGameBuffer();
@@ -479,7 +480,7 @@
 	uint16 *overlay_framebuffer = (uint16*)_dc->conf.framebuffer; // Current screen framebuffer
 	uint16 *game_framebuffer = overlay_framebuffer + (_frameBufferWidth * skip_lines * 2); // Skip some lines to center the image vertically
 
-	uint16 currentHeight;
+	uint16 currentHeight, currentWidth;
 	uint16 *tmpDst;
 	uint16 *tmpSrc;
 
@@ -488,7 +489,11 @@
 		tmpDst = game_framebuffer;
 		tmpSrc = _offscreen_hic + (_shakeOffset * _screenWidth);
 		for (currentHeight = _shakeOffset; currentHeight < _gameHeight; currentHeight++) {
-			memcpy((tmpDst + skip_pixels + _offscrPixels), tmpSrc, _screenWidth * 2);
+			uint64 *game_dest = (uint64*)(tmpDst + skip_pixels + _offscrPixels);
+			uint64 *game_src = (uint64*)tmpSrc;
+			for (currentWidth = 0; currentWidth < _gameWidth; currentWidth += 4) {
+				*game_dest++ = *game_src++;
+			}
 			tmpDst += _frameBufferWidth;
 			tmpSrc += _screenWidth;
 		}
@@ -502,7 +507,11 @@
 		tmpDst = overlay_framebuffer;
 		tmpSrc = _overlayBuffer;
 		for (currentHeight = 0; currentHeight < _overlayHeight; currentHeight++) {
-			memcpy((tmpDst + _offscrPixels), tmpSrc, _overlayWidth * 2);
+			uint64 *over_dest = (uint64*)(tmpDst + _offscrPixels);
+			uint64 *over_src = (uint64*)tmpSrc;
+			for (currentWidth = 0; currentWidth < _overlayWidth; currentWidth += 4) {
+				*over_dest++ = *over_src++;
+			}
 			tmpDst += _frameBufferWidth;
 			tmpSrc += _overlayWidth;
 		}
@@ -511,10 +520,11 @@
 	// Draw mouse cursor
 	if ((_mouseVisible || _overlayVisible) && _cursorHeight > 0 && _cursorWidth > 0) {
 		uint16 *mouse_framebuffer;
-		uint16 horiz_pix_skip = 0;
+		uint16 horiz_pix_skip;
 
 		if (_overlayVisible) {
 			mouse_framebuffer = overlay_framebuffer;
+			horiz_pix_skip = 0;
 		} else {
 			mouse_framebuffer = game_framebuffer;
 			horiz_pix_skip = skip_pixels;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list