mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-07 06:14:12 +08:00
重新找了个位置试试还会不会core dump
Merge branch 'master' of https://gitee.com/anod/open_agb_firm
This commit is contained in:
commit
c4f39b7e9e
@ -12,8 +12,8 @@
|
|||||||
extern int acf_set_font(const char *);
|
extern int acf_set_font(const char *);
|
||||||
extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, const char *);
|
extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, const char *);
|
||||||
|
|
||||||
#include "acf_dev.h"
|
#include "arm11/acf_dev.h"
|
||||||
#include "acf_cfg.h"
|
#include "arm11/acf_cfg.h"
|
||||||
|
|
||||||
#if ACF_CANVAS == ACFDEV_U8GBITMAP
|
#if ACF_CANVAS == ACFDEV_U8GBITMAP
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ extern uint8_t *acfCanvas;
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <console.h>
|
#include "arm11/console.h"
|
||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* 3数据,每个数据是前4个字节的bbx,第5个字节的前7位是DWIDTH的x分量,后1位0表示位图每次读取1字节,为1表示每次读取2字节。第6个字节及以后是BITMAP的数据,总长度是bbx[1]的长度。
|
* 3数据,每个数据是前4个字节的bbx,第5个字节的前7位是DWIDTH的x分量,后1位0表示位图每次读取1字节,为1表示每次读取2字节。第6个字节及以后是BITMAP的数据,总长度是bbx[1]的长度。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "acf.h"
|
#include "arm11/acf.h"
|
||||||
|
|
||||||
// 画点函数
|
// 画点函数
|
||||||
#ifndef ACF_LIT_POINT
|
#ifndef ACF_LIT_POINT
|
||||||
@ -53,7 +53,7 @@ int acf_set_font(const char *acfile)
|
|||||||
// open the font file
|
// open the font file
|
||||||
FHandle font;
|
FHandle font;
|
||||||
u32 readed;
|
u32 readed;
|
||||||
if( (RES_OK = fOpen(&font, acfile, FA_READ)) != RES_OK )
|
if( RES_OK != fOpen(&font, acfile, FA_READ) )
|
||||||
return ACFONT_NOT_FOUND;
|
return ACFONT_NOT_FOUND;
|
||||||
|
|
||||||
// 读取数据
|
// 读取数据
|
||||||
@ -159,7 +159,7 @@ int acf_set_font(const char *acfile)
|
|||||||
#define ISSET_H(c) TEST_H(c) == BYTE_H
|
#define ISSET_H(c) TEST_H(c) == BYTE_H
|
||||||
#define EXBYTE 0x3fu
|
#define EXBYTE 0x3fu
|
||||||
#define EXDATA(c) ((c)&EXBYTE)
|
#define EXDATA(c) ((c)&EXBYTE)
|
||||||
inline const char *next_unicode(const char *utf8, uint32_t *code)
|
static inline const char *next_unicode(const char *utf8, uint32_t *code)
|
||||||
{
|
{
|
||||||
if (utf8 == NULL || *utf8 == '\0')
|
if (utf8 == NULL || *utf8 == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -239,7 +239,7 @@ static int bsearch_font(FHandle fd, uint32_t unicode)
|
|||||||
|
|
||||||
uint8_t *cache = (uint8_t *)malloc(size);
|
uint8_t *cache = (uint8_t *)malloc(size);
|
||||||
if( RES_OK != fRead(fd, cache, size, &readed) ||
|
if( RES_OK != fRead(fd, cache, size, &readed) ||
|
||||||
readed != size )
|
readed != (u32)size )
|
||||||
{
|
{
|
||||||
free(cache);
|
free(cache);
|
||||||
return ACFONT_READ_EOF;
|
return ACFONT_READ_EOF;
|
||||||
@ -269,7 +269,7 @@ static int bsearch_font(FHandle fd, uint32_t unicode)
|
|||||||
|
|
||||||
#define BIT_AT_POS(mem, idx) ((mem)[(idx) / 8] & (1 << ((idx) % 8)))
|
#define BIT_AT_POS(mem, idx) ((mem)[(idx) / 8] & (1 << ((idx) % 8)))
|
||||||
#define SIZEOF_S6 6
|
#define SIZEOF_S6 6
|
||||||
inline int readS6(uint8_t *p, int index)
|
static inline int readS6(uint8_t *p, int index)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int symbol = BIT_AT_POS(p, index);
|
int symbol = BIT_AT_POS(p, index);
|
||||||
@ -293,7 +293,7 @@ static int render_unicode(FHandle fd, int *x, int *y, unsigned width, unsigned h
|
|||||||
int font_pos = bsearch_font(fd, code);
|
int font_pos = bsearch_font(fd, code);
|
||||||
if (font_pos < 0)
|
if (font_pos < 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (font_pos > gblfont.filesize)
|
if ((uint32_t)font_pos > gblfont.filesize)
|
||||||
return 0;
|
return 0;
|
||||||
font_pos += ACFONT_HEAD_SIZE + gblfont.amount * ACFONT_SIZEOF_INDEX;
|
font_pos += ACFONT_HEAD_SIZE + gblfont.amount * ACFONT_SIZEOF_INDEX;
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ static int render_unicode(FHandle fd, int *x, int *y, unsigned width, unsigned h
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if( RES_OK != fRead(fd, font, ACFONT_SIZEOF_GLYPH, &readed) ||
|
if( RES_OK != fRead(fd, font, ACFONT_SIZEOF_GLYPH, &readed) ||
|
||||||
(readed != ACFONT_SIZEOF_GLYPH && font_pos + ACFONT_SIZEOF_GLYPH < gblfont.filesize) )
|
(readed != ACFONT_SIZEOF_GLYPH && (uint32_t)font_pos + ACFONT_SIZEOF_GLYPH < gblfont.filesize) )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
int8_t bbx[4];
|
int8_t bbx[4];
|
||||||
@ -318,7 +318,7 @@ static int render_unicode(FHandle fd, int *x, int *y, unsigned width, unsigned h
|
|||||||
int cx = px + bbx[2], cy = py + bbx[1] + bbx[3]; // cx/cy计算位置进行绘制
|
int cx = px + bbx[2], cy = py + bbx[1] + bbx[3]; // cx/cy计算位置进行绘制
|
||||||
|
|
||||||
// 先检查宽度
|
// 先检查宽度
|
||||||
if ((width_max != NULL) && (cx + bbx[0] >= *width_max))
|
if ((width_max != NULL) && (cx + bbx[0] >= (int)(*width_max)))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
// 绘制
|
// 绘制
|
||||||
@ -326,7 +326,7 @@ static int render_unicode(FHandle fd, int *x, int *y, unsigned width, unsigned h
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < bbx[0]; ++j)
|
for (int j = 0; j < bbx[0]; ++j)
|
||||||
{
|
{
|
||||||
ACF_LIT_POINT(cx + j, cy - i, width, height, BIT_AT_POS(font + 4, bbx[0] * i + j));
|
ACF_LIT_POINT(cx + j, cy - i, (int)width, (int)height, BIT_AT_POS(font + 4, bbx[0] * i + j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ static int render_unicode(FHandle fd, int *x, int *y, unsigned width, unsigned h
|
|||||||
const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned maxwidth, const char *utf8_line)
|
const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned maxwidth, const char *utf8_line)
|
||||||
{
|
{
|
||||||
u32 font;
|
u32 font;
|
||||||
if( RES_OK != fOpen(&font, gblfont.filename, FA_READ) )
|
if( gblfont.filename == NULL || RES_OK != fOpen(&font, gblfont.filename, FA_READ) )
|
||||||
{
|
{
|
||||||
// log
|
// log
|
||||||
return utf8_line;
|
return utf8_line;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "arm11/drivers/hid.h"
|
#include "arm11/drivers/hid.h"
|
||||||
#include "arm11/fmt.h"
|
#include "arm11/fmt.h"
|
||||||
#include "drivers/gfx.h"
|
#include "drivers/gfx.h"
|
||||||
#include "acf.h"
|
#include "arm11/acf.h"
|
||||||
|
|
||||||
#define screenClean() ee_printf("\x1b[2J\x1b[0m")
|
#define screenClean() ee_printf("\x1b[2J\x1b[0m")
|
||||||
|
|
||||||
@ -85,7 +85,6 @@ static Result scanDir(const char *const path, DirList *const dList, const char *
|
|||||||
u32 read; // Number of entries read by fReadDir().
|
u32 read; // Number of entries read by fReadDir().
|
||||||
u32 numEntries = 0; // Total number of processed entries.
|
u32 numEntries = 0; // Total number of processed entries.
|
||||||
u32 entBufPos = 0; // Entry buffer position/number of bytes used.
|
u32 entBufPos = 0; // Entry buffer position/number of bytes used.
|
||||||
acf_set_font("wqy11.acf");
|
|
||||||
const u32 filterLen = strlen(filter);
|
const u32 filterLen = strlen(filter);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -170,7 +169,7 @@ Result browseFiles(const char *const basePath, char selected[512])
|
|||||||
//ee_printf("\x1b[%lu;H\x1b[33m>%.51s", cursorPos - windowPos, &dList->ptrs[cursorPos][1]); // Draw cursor.
|
//ee_printf("\x1b[%lu;H\x1b[33m>%.51s", cursorPos - windowPos, &dList->ptrs[cursorPos][1]); // Draw cursor.
|
||||||
if( oldCursorPos != cursorPos )
|
if( oldCursorPos != cursorPos )
|
||||||
{
|
{
|
||||||
ee_printf("\x1b[%dm", *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 37:36;
|
ee_printf("\x1b[%dm", *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 37:36);
|
||||||
acf_draw( 20, LINENO_TO_Y(oldCursorPos-windowPos), 320, 240, 292, &dList->ptrs[oldCursorPos][1] );
|
acf_draw( 20, LINENO_TO_Y(oldCursorPos-windowPos), 320, 240, 292, &dList->ptrs[oldCursorPos][1] );
|
||||||
}
|
}
|
||||||
acf_draw( 20, LINENO_TO_Y(cursorPos-windowPos), 320, 240, 292, &dList->ptrs[cursorPos][1] );
|
acf_draw( 20, LINENO_TO_Y(cursorPos-windowPos), 320, 240, 292, &dList->ptrs[cursorPos][1] );
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "arm11/drivers/lcd.h"
|
#include "arm11/drivers/lcd.h"
|
||||||
#include "arm11/gpu_cmd_lists.h"
|
#include "arm11/gpu_cmd_lists.h"
|
||||||
#include "arm11/drivers/mcu.h"
|
#include "arm11/drivers/mcu.h"
|
||||||
|
#include "arm11/acf.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "kevent.h"
|
#include "kevent.h"
|
||||||
|
|
||||||
@ -685,6 +686,9 @@ Result oafParseConfigEarly(void)
|
|||||||
|
|
||||||
// Parse the config.
|
// Parse the config.
|
||||||
res = parseOafConfig("config.ini", true);
|
res = parseOafConfig("config.ini", true);
|
||||||
|
|
||||||
|
// load font
|
||||||
|
acf_set_font("wqy11.acf");
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user