Created
June 23, 2012 01:18
-
-
Save ToadKing/2976108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile.wii b/Makefile.wii | |
index 89364c3..c6a6c38 100644 | |
--- a/Makefile.wii | |
+++ b/Makefile.wii | |
@@ -14,6 +14,8 @@ CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc | |
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++ | |
LD = $(DEVKITPPC)/bin/powerpc-eabi-ld | |
+FREETYPECONFIG = $(DEVKITPRO)/portlibs/ppc/bin/freetype-config | |
+ | |
DOL_TARGET := retroarch.dol | |
ELF_TARGET := retroarch.elf | |
@@ -21,10 +23,10 @@ INCLUDE := -I. -I$(DEVKITPRO)/libogc/include | |
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L. | |
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float | |
-CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) | |
-CXXFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) | |
-LDFLAGS := $(MACHDEP) | |
-LIBS := -lfat -lretro -lwiiuse -logc -lbte -lfreetype | |
+CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) $(shell $(FREETYPECONFIG) --cflags) | |
+CXXFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) $(shell $(FREETYPECONFIG) --cflags) | |
+LDFLAGS := $(MACHDEP) $(shell $(FREETYPECONFIG) --libs) | |
+LIBS := -lfat -lretro -lwiiuse -logc -lbte | |
OBJ = console/griffin/griffin.o console/font.bmpobj console/rzlib/rzlib.o | |
diff --git a/wii/video.c b/wii/video.c | |
index 338f8b0..ac45565 100644 | |
--- a/wii/video.c | |
+++ b/wii/video.c | |
@@ -25,7 +25,7 @@ | |
// All very hardcoded for now. | |
-static void *g_framebuf[3]; | |
+static void *g_framebuf[2]; | |
static unsigned g_vi_framebuf; | |
static unsigned g_render_framebuf; | |
@@ -45,7 +45,7 @@ static size_t display_list_size; | |
static void retrace_callback(u32 retrace_count) | |
{ | |
(void)retrace_count; | |
- VIDEO_SetNextFramebuffer(g_framebuf[g_vi_framebuf % 3]); | |
+ VIDEO_SetNextFramebuffer(g_framebuf[g_vi_framebuf % 2]); | |
VIDEO_Flush(); | |
if (g_vi_framebuf < g_render_framebuf) | |
g_vi_framebuf++; | |
@@ -54,7 +54,7 @@ static void retrace_callback(u32 retrace_count) | |
static void setup_video_mode(GXRModeObj *mode) | |
{ | |
VIDEO_Configure(mode); | |
- for (unsigned i = 0; i < 3; i++) | |
+ for (unsigned i = 0; i < 2; i++) | |
{ | |
g_framebuf[i] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(mode)); | |
VIDEO_ClearFrameBuffer(mode, g_framebuf[i], COLOR_BLACK); | |
@@ -171,7 +171,7 @@ void wii_video_deinit(void) | |
VIDEO_SetBlack(true); | |
VIDEO_Flush(); | |
- for (unsigned i = 0; i < 3; i++) | |
+ for (unsigned i = 0; i < 2; i++) | |
free(MEM_K1_TO_K0(g_framebuf[i])); | |
} | |
@@ -207,7 +207,7 @@ static void *wii_init(const video_info_t *video, | |
src += pitch; \ | |
} | |
-static void update_texture(const uint32_t *src, | |
+static void update_texture2(const uint32_t *src, | |
unsigned width, unsigned height, unsigned pitch) | |
{ | |
pitch >>= 2; | |
@@ -225,12 +225,97 @@ static void update_texture(const uint32_t *src, | |
BLIT_LINE(4) | |
BLIT_LINE(6) | |
} | |
- | |
+ | |
init_texture(width << 1, height); | |
DCFlushRange(g_tex.data, sizeof(g_tex.data)); | |
GX_InvalidateTexAll(); | |
} | |
+static void update_texture(const uint32_t *src, | |
+ unsigned width, unsigned height, unsigned pitch) | |
+{ | |
+ register u32 tmp0, tmp1, tmp2, tmp3, line2, line2b, line3, line3b, line4, line4b, line5; | |
+ register u32 ormask=0x80008000u; | |
+ register u32 *dst = g_tex.data; | |
+ width &= ~3; | |
+ height &= ~3; | |
+ | |
+ __asm__ __volatile__ ( | |
+ " srwi %[width],%[width],2\n" | |
+ " srwi %[height],%[height],2\n" | |
+ " subi %[tmp3],%[dst],4\n" | |
+ " mr %[dst],%[tmp3]\n" | |
+ " subi %[dst],%[dst],4\n" | |
+ " mr %[line2],%[pitch]\n" | |
+ " addi %[line2b],%[line2],4\n" | |
+ " mulli %[line3],%[pitch],2\n" | |
+ " addi %[line3b],%[line3],4\n" | |
+ " mulli %[line4],%[pitch],3\n" | |
+ " addi %[line4b],%[line4],4\n" | |
+ " mulli %[line5],%[pitch],4\n" | |
+ | |
+ "2: mtctr %[width]\n" | |
+ " mr %[tmp0],%[src]\n" | |
+ | |
+ "1: lwz %[tmp1],0(%[src])\n" | |
+ " or %[tmp1],%[tmp1],%[ormask]\n" | |
+ " stwu %[tmp1],8(%[dst])\n" | |
+ " lwz %[tmp2],4(%[src])\n" | |
+ " or %[tmp2],%[tmp2],%[ormask]\n" | |
+ " stwu %[tmp2],8(%[tmp3])\n" | |
+ | |
+ " lwzx %[tmp1],%[line2],%[src]\n" | |
+ " or %[tmp1],%[tmp1],%[ormask]\n" | |
+ " stwu %[tmp1],8(%[dst])\n" | |
+ " lwzx %[tmp2],%[line2b],%[src]\n" | |
+ " or %[tmp2],%[tmp2],%[ormask]\n" | |
+ " stwu %[tmp2],8(%[tmp3])\n" | |
+ | |
+ " lwzx %[tmp1],%[line3],%[src]\n" | |
+ " or %[tmp1],%[tmp1],%[ormask]\n" | |
+ " stwu %[tmp1],8(%[dst])\n" | |
+ " lwzx %[tmp2],%[line3b],%[src]\n" | |
+ " or %[tmp2],%[tmp2],%[ormask]\n" | |
+ " stwu %[tmp2],8(%[tmp3])\n" | |
+ | |
+ " lwzx %[tmp1],%[line4],%[src]\n" | |
+ " or %[tmp1],%[tmp1],%[ormask]\n" | |
+ " stwu %[tmp1],8(%[dst])\n" | |
+ " lwzx %[tmp2],%[line4b],%[src]\n" | |
+ " or %[tmp2],%[tmp2],%[ormask]\n" | |
+ " stwu %[tmp2],8(%[tmp3])\n" | |
+ | |
+ " addi %[src],%[src],8\n" | |
+ " bdnz 1b\n" | |
+ " add %[src],%[tmp0],%[line5]\n" | |
+ " subic. %[height],%[height],1\n" | |
+ " bne 2b" | |
+ : | |
+ [tmp0] "=&b" (tmp0), | |
+ [tmp1] "=&b" (tmp1), | |
+ [tmp2] "=&b" (tmp2), | |
+ [tmp3] "=&b" (tmp3), | |
+ [line2] "=&b" (line2), | |
+ [line2b] "=&b" (line2b), | |
+ [line3] "=&b" (line3), | |
+ [line3b] "=&b" (line3b), | |
+ [line4] "=&b" (line4), | |
+ [line4b] "=&b" (line4b), | |
+ [line5] "=&b" (line5), | |
+ [dst] "+b" (dst) | |
+ : | |
+ [src] "b" (src), | |
+ [width] "b" (width), | |
+ [height] "b" (height), | |
+ [pitch] "b" (pitch), | |
+ [ormask] "b" (ormask) | |
+ ); | |
+ | |
+ init_texture(width, height); | |
+ DCFlushRange(g_tex.data, sizeof(g_tex.data)); | |
+ GX_InvalidateTexAll(); | |
+} | |
+ | |
static bool wii_frame(void *data, const void *frame, | |
unsigned width, unsigned height, unsigned pitch, | |
const char *msg) | |
@@ -242,7 +327,7 @@ static bool wii_frame(void *data, const void *frame, | |
GX_CallDispList(display_list, display_list_size); | |
GX_DrawDone(); | |
- GX_CopyDisp(g_framebuf[g_render_framebuf % 3], GX_TRUE); | |
+ GX_CopyDisp(g_framebuf[g_render_framebuf % 2], GX_TRUE); | |
GX_Flush(); | |
g_render_framebuf++; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment