use libogc's maketexture function

This commit is contained in:
dborth 2009-01-16 04:48:15 +00:00
parent 83848d915d
commit 20157ba7b5

View File

@ -18,6 +18,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <ogc/texconv.h>
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
#include "aram.h" #include "aram.h"
@ -646,51 +647,6 @@ ResetVideo_Menu ()
GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC); GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
} }
/****************************************************************************
* MakeTexture
*
* Proper GNU Asm rendition of the above, converted by shagkur. - Thanks!
***************************************************************************/
static void
MakeTexture (const void *src, void *dst, s32 width, s32 height)
{
register u32 tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0;
__asm__ __volatile__ (" srwi %6,%6,2\n"
" srwi %7,%7,2\n"
" subi %3,%4,4\n"
" mr %4,%3\n"
" subi %4,%4,4\n"
"2: mtctr %6\n"
" mr %0,%5\n"
//
"1: lwz %1,0(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,4(%5)\n"
" stwu %2,8(%3)\n"
" lwz %1,1024(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,1028(%5)\n"
" stwu %2,8(%3)\n"
" lwz %1,2048(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,2052(%5)\n"
" stwu %2,8(%3)\n"
" lwz %1,3072(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,3076(%5)\n"
" stwu %2,8(%3)\n"
" addi %5,%5,8\n"
" bdnz 1b\n"
" addi %5,%0,4096\n"
" subic. %7,%7,1\n"
" bne 2b"
// 0 1 2 3 4 5 6 7
:"=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2),
"=&r" (tmp3), "+r" (dst):"r" (src), "r" (width),
"r" (height));
}
/**************************************************************************** /****************************************************************************
* Update Video * Update Video
***************************************************************************/ ***************************************************************************/
@ -765,7 +721,7 @@ update_video (int width, int height)
CheckVideo = 0; CheckVideo = 0;
} }
MakeTexture ((char *) GFX.Screen, (char *) texturemem, vwidth, vheight); // convert image to texture MakeTexture565((char *) GFX.Screen, (char *) texturemem, vwidth, vheight); // convert image to texture
DCFlushRange (texturemem, TEX_WIDTH * TEX_HEIGHT * 2); // update the texture memory DCFlushRange (texturemem, TEX_WIDTH * TEX_HEIGHT * 2); // update the texture memory
GX_InvalidateTexAll (); GX_InvalidateTexAll ();