(GX) redo video/RGUI code to use new font location

This commit is contained in:
Toad King 2012-12-13 16:12:51 -05:00
parent 59bc3d4ba7
commit 2209103248
6 changed files with 34 additions and 12 deletions

View File

@ -40,7 +40,7 @@ LIBS := -lfat -lretro_wii -lwiiuse -logc -lbte
APP_BOOTER_DIR = wii/app_booter
OBJ = console/griffin/griffin.o console/font.binobj $(APP_BOOTER_DIR)/app_booter.binobj
OBJ = console/griffin/griffin.o $(APP_BOOTER_DIR)/app_booter.binobj
ifeq ($(PERF_TEST), 1)
CFLAGS += -DPERF_TEST

View File

@ -16,7 +16,7 @@
#include "rgui.h"
#include "list.h"
#include "../rarch_console_video.h"
#include "../font.h"
#include "../../gfx/fonts/bitmap.h"
#include "../../screenshot.h"
#include <stdlib.h>
#include <stddef.h>
@ -90,7 +90,7 @@ struct rgui_handle
char path_buf[PATH_MAX];
uint8_t *font;
const uint8_t *font;
bool alloc_font;
};
@ -152,20 +152,22 @@ static void copy_glyph(uint8_t *glyph, const uint8_t *buf)
static void init_font(rgui_handle_t *rgui, const uint8_t *font_bmp_buf)
{
rgui->font = (uint8_t *) calloc(1, FONT_OFFSET(256));
uint8_t *font = (uint8_t *) calloc(1, FONT_OFFSET(256));
rgui->alloc_font = true;
for (unsigned i = 0; i < 256; i++)
{
unsigned y = i / 16;
unsigned x = i % 16;
copy_glyph(&rgui->font[FONT_OFFSET(i)],
copy_glyph(&font[FONT_OFFSET(i)],
font_bmp_buf + 54 + 3 * (256 * (255 - 16 * y) + 16 * x));
}
rgui->font = font;
}
rgui_handle_t *rgui_init(const char *base_path,
uint16_t *framebuf, size_t framebuf_pitch,
const uint8_t *font_bmp_buf, uint8_t *font_bin_buf,
const uint8_t *font_bmp_buf, const uint8_t *font_bin_buf,
rgui_folder_enum_cb_t folder_cb, void *userdata)
{
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui));
@ -198,7 +200,7 @@ void rgui_free(rgui_handle_t *rgui)
rgui_list_free(rgui->path_stack);
rgui_list_free(rgui->folder_buf);
if (rgui->alloc_font)
free(rgui->font);
free((uint8_t *) rgui->font);
free(rgui);
}

View File

@ -109,7 +109,7 @@ extern unsigned RGUI_HEIGHT;
rgui_handle_t *rgui_init(const char *base_path,
uint16_t *framebuf, size_t framebuf_pitch,
const uint8_t *font_bmp_buf, uint8_t *font_bin_buf,
const uint8_t *font_bmp_buf, const uint8_t *font_bin_buf,
rgui_folder_enum_cb_t folder_cb, void *userdata);
void rgui_iterate(rgui_handle_t *rgui, rgui_action_t action);

View File

@ -1,3 +1,21 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RARCH_FONT_BITMAP_H
#define __RARCH_FONT_BITMAP_H
#define FONT_WIDTH 5
#define FONT_HEIGHT 10
#define FONT_WIDTH_STRIDE (FONT_WIDTH + 1)
@ -119,3 +137,5 @@ const unsigned char bitmap_bin[1792] = {
0x63, 0xF4, 0x00, 0x00, 0x40, 0x81, 0x18, 0x63, 0xF4, 0x00, 0x00, 0x44, 0x80, 0x18, 0x63, 0xF4,
0xD0, 0x01, 0x20, 0x84, 0x17, 0x63, 0x7C, 0x21, 0x00, 0x40, 0x81, 0x18, 0x63, 0xF4, 0xD0, 0x01
};
#endif

View File

@ -23,7 +23,7 @@
#include "../../libretro.h"
#include "../../console/rgui/rgui.h"
#include "../../console/font.h"
#include "../../gfx/fonts/bitmap.h"
#include "../../console/rarch_console_exec.h"
#include "../../console/rarch_console_input.h"
@ -394,7 +394,7 @@ static void menu_init(void)
{
rgui = rgui_init("",
menu_framebuf, RGUI_WIDTH * sizeof(uint16_t),
NULL /* _binary_console_font_bmp_start */, _binary_console_font_bin_start, folder_cb, NULL);
NULL /* _binary_console_font_bmp_start */, bitmap_bin, folder_cb, NULL);
g_extern.console.rmenu.mode = MODE_MENU;
rgui_iterate(rgui, RGUI_ACTION_REFRESH);

View File

@ -18,7 +18,7 @@
#include "../driver.h"
#include "../general.h"
#include "../console/rarch_console_video.h"
#include "../console/font.h"
#include "../gfx/fonts/bitmap.h"
#include "../console/rgui/rgui.h"
#include "../gfx/gfx_common.h"
@ -752,7 +752,7 @@ static void gx_blit_line(unsigned x, unsigned y, const char *message)
GXColor c;
uint8_t rem = 1 << ((i + j * FONT_WIDTH) & 7);
unsigned offset = (i + j * FONT_WIDTH) >> 3;
bool col = (_binary_console_font_bin_start[FONT_OFFSET((unsigned char) *message) + offset] & rem);
bool col = (bitmap_bin[FONT_OFFSET((unsigned char) *message) + offset] & rem);
if (col)
c = w;