{
}
+#define get_screen_pixels() \
+ screen_pixels \
+
+#define get_screen_pitch() \
+ screen_pitch \
+
+#elif defined(WIZ_BUILD)
+
+static u16 rot_buffer[240*4];
+static u32 rot_lines_total = 4;
+static u32 rot_line_count = 0;
+static char rot_msg_buff[64];
+
+static u32 screen_offset = 0;
+static u16 *screen_pixels = NULL;
+const u32 screen_pitch = 320;
+
#define get_screen_pixels() \
screen_pixels \
if(skip_next_frame)
return;
+#ifdef WIZ_BUILD
+ if (screen_scale == unscaled_rot || screen_scale == scaled_aspect_rot)
+ {
+ if (rot_line_count == rot_lines_total)
+ {
+ rot_line_count = 0;
+ if (vcount - rot_lines_total < FONT_HEIGHT && rot_msg_buff[0])
+ {
+ print_string_ext(rot_msg_buff, 0xFFFF, 0x0000, 0, 0,
+ rot_buffer, 240, 0, vcount - rot_lines_total, rot_lines_total);
+ if (vcount >= FONT_HEIGHT)
+ rot_msg_buff[0] = 0;
+ }
+ if (screen_scale == unscaled_rot)
+ do_rotated_blit(gpsp_gp2x_screen, rot_buffer, vcount);
+ else
+ upscale_aspect_row(gpsp_gp2x_screen, rot_buffer, vcount/3);
+ }
+ screen_offset = &rot_buffer[rot_line_count++ * 240];
+ }
+#endif
+
// If the screen is in in forced blank draw pure white.
if(dispcnt & 0x80)
{
}
}
+#elif defined(WIZ_BUILD)
+
+void flip_screen()
+{
+ if((resolution_width == small_resolution_width) &&
+ (resolution_height == small_resolution_height))
+ {
+ switch(screen_scale)
+ {
+ case scaled_aspect:
+ upscale_aspect(gpsp_gp2x_screen, screen_pixels);
+ break;
+ case unscaled_rot:
+ do_rotated_blit(gpsp_gp2x_screen, rot_buffer, 160);
+ rot_line_count = 0;
+ goto no_clean;
+ case scaled_aspect_rot:
+ rot_line_count = 0;
+ goto no_clean;
+ }
+ }
+ warm_cache_op_all(WOP_D_CLEAN);
+
+no_clean:
+ pollux_video_flip();
+ screen_pixels = (u16 *)gpsp_gp2x_screen + screen_offset;
+}
+
#else
#define integer_scale_copy_2() \
SDL_Rect drect = {40, 40, 240, 160};
SDL_BlitSurface(screen, &srect, hw_screen, &drect);
}
+ else if((screen_scale == scaled_aspect) &&
+ (resolution_width == small_resolution_width) &&
+ (resolution_height == small_resolution_height))
+ {
+ SDL_Rect drect = {0, 10, 0, 0};
+ SDL_BlitSurface(screen, NULL, hw_screen, &drect);
+ }
else
{
SDL_BlitSurface(screen, NULL, hw_screen, NULL);
}
+ warm_cache_op_all(WOP_D_CLEAN);
}
#else
SDL_Flip(screen);
GE_CMD(NOP, 0);
}
+#elif defined(WIZ_BUILD)
+
+void init_video()
+{
+}
+
#else
void init_video()
screen = SDL_CreateRGBSurface(SDL_HWSURFACE, 240 * video_scale,
160 * video_scale, 16, 0xFFFF, 0xFFFF, 0xFFFF, 0);
- gp2x_load_mmuhack();
+ warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1);
#else
screen = SDL_SetVideoMode(240 * video_scale, 160 * video_scale, 16, 0);
#endif
sceGuSync(0, 0); */
}
+#elif defined(WIZ_BUILD)
+
+void video_resolution_large()
+{
+ screen_offset = 0;
+ resolution_width = 320;
+ resolution_height = 240;
+
+ fb_use_buffers(1);
+ flip_screen();
+ clear_screen(0);
+ wiz_lcd_set_portrait(0);
+}
+
+void video_resolution_small()
+{
+ fb_use_buffers(4);
+
+ switch (screen_scale)
+ {
+ case unscaled:
+ screen_offset = 320*40 + 40;
+ wiz_lcd_set_portrait(0);
+ break;
+ case scaled_aspect:
+ screen_offset = 320*(80 - 14) + 80;
+ wiz_lcd_set_portrait(0);
+ break;
+ case unscaled_rot:
+ wiz_lcd_set_portrait(1);
+ rot_lines_total = 4;
+ rot_line_count = 0;
+ break;
+ case scaled_aspect_rot:
+ wiz_lcd_set_portrait(1);
+ rot_lines_total = 3;
+ rot_line_count = 0;
+ break;
+ }
+
+ flip_screen();
+ clear_screen(0);
+
+ resolution_width = 240;
+ resolution_height = 160;
+}
+
+void set_gba_resolution(video_scale_type scale)
+{
+ screen_scale = scale;
+}
+
+void clear_screen(u16 color)
+{
+ u32 col = ((u32)color << 16) | color;
+ u32 *p = gpsp_gp2x_screen;
+ int c = 320*240/2;
+ while (c-- > 0)
+ *p++ = col;
+}
+
#else
void video_resolution_large()
resolution_height = 240;
SDL_ShowCursor(0);
- gp2x_load_mmuhack();
+ warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1);
#else
screen = SDL_SetVideoMode(480, 272, 16, 0);
resolution_width = 480;
current_scale = screen_scale;
#ifdef GP2X_BUILD
+ int w, h;
SDL_FreeSurface(screen);
SDL_GP2X_AllowGfxMemory(NULL, 0);
- hw_screen = SDL_SetVideoMode((screen_scale == unscaled ? 320 :
- small_resolution_width * video_scale), (screen_scale == unscaled ? 320 :
- small_resolution_height * video_scale), 16, SDL_HWSURFACE);
+
+ w = 320; h = 240;
+ if (screen_scale != unscaled)
+ {
+ w = small_resolution_width * video_scale;
+ h = small_resolution_height * video_scale;
+ }
+ if (screen_scale == scaled_aspect) h += 20;
+ hw_screen = SDL_SetVideoMode(w, h, 16, SDL_HWSURFACE);
screen = SDL_CreateRGBSurface(SDL_HWSURFACE,
small_resolution_width * video_scale, small_resolution_height *
SDL_ShowCursor(0);
- gp2x_load_mmuhack();
+ warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1);
#else
screen = SDL_SetVideoMode(small_resolution_width * video_scale,
small_resolution_height * video_scale, 16, 0);
}
void print_string_ext(const char *str, u16 fg_color, u16 bg_color,
- u32 x, u32 y, void *_dest_ptr, u32 pitch, u32 pad)
+ u32 x, u32 y, void *_dest_ptr, u32 pitch, u32 pad, u32 h_offset, u32 height)
{
u16 *dest_ptr = (u16 *)_dest_ptr + (y * pitch) + x;
u8 current_char = str[0];
u32 current_row;
u32 glyph_offset;
- u32 i = 0, i2, i3;
+ u32 i = 0, i2, i3, h;
u32 str_index = 1;
u32 current_x = x;
-
- /* EDIT */
- if(y + FONT_HEIGHT >= resolution_height)
+ if(y + height > resolution_height)
return;
while(current_char)
{
glyph_offset = _font_offset[current_char];
current_x += FONT_WIDTH;
- for(i2 = 0; i2 < FONT_HEIGHT; i2++, glyph_offset++)
+ glyph_offset += h_offset;
+ for(i2 = h_offset, h = 0; i2 < FONT_HEIGHT && h < height; i2++, h++, glyph_offset++)
{
current_row = _font_bits[glyph_offset];
for(i3 = 0; i3 < FONT_WIDTH; i3++)
}
dest_ptr += (pitch - FONT_WIDTH);
}
- dest_ptr = dest_ptr - (pitch * FONT_HEIGHT) + FONT_WIDTH;
+ dest_ptr = dest_ptr - (pitch * h) + FONT_WIDTH;
}
i++;
str_index++;
}
- if(current_x + FONT_WIDTH >= resolution_width /* EDIT */)
- break;
+ if(current_x + FONT_WIDTH > resolution_width /* EDIT */)
+ {
+ while (current_char && current_char != '\n')
+ {
+ current_char = str[str_index++];
+ }
+ }
}
}
void print_string(const char *str, u16 fg_color, u16 bg_color,
u32 x, u32 y)
{
+#ifdef WIZ_BUILD
+ if ((screen_scale == unscaled_rot || screen_scale == scaled_aspect_rot) &&
+ (resolution_width == small_resolution_width) &&
+ (resolution_height == small_resolution_height))
+ {
+ snprintf(rot_msg_buff, sizeof(rot_msg_buff), "%s", str);
+ return;
+ }
+#endif
print_string_ext(str, fg_color, bg_color, x, y, get_screen_pixels(),
- get_screen_pitch(), 0);
+ get_screen_pitch(), 0, 0, FONT_HEIGHT);
}
void print_string_pad(const char *str, u16 fg_color, u16 bg_color,
u32 x, u32 y, u32 pad)
{
print_string_ext(str, fg_color, bg_color, x, y, get_screen_pixels(),
- get_screen_pitch(), pad);
+ get_screen_pitch(), pad, 0, FONT_HEIGHT);
}
u32 debug_cursor_x = 0;
va_start(ap, format);
debug_screen_printf(format, ap);
- debug_screen_printf("\n");
+ debug_screen_newline(1);
+// debug_screen_printf("\n");
va_end(ap);
}