还差一个问题没解决,但是acf已经解决好了,先存档

This commit is contained in:
root 2022-08-10 11:28:09 +08:00
parent 3008b789c4
commit c7de48e5a0
5 changed files with 21 additions and 17 deletions

View File

@ -333,7 +333,7 @@ const char *acf_draw(int x, int y, unsigned width, unsigned height, unsigned max
if( maxwidth == 0 ) maxwidth = width; if( maxwidth == 0 ) maxwidth = width;
unsigned *option = width == 0 ? NULL : &maxwidth; unsigned *option = width == 0 ? NULL : &maxwidth;
const int ramsize = gblfont.height * maxwidth / BIT_PER_BYTE; const int ramsize = gblfont.height * maxwidth + BIT_PER_BYTE - 1 / BIT_PER_BYTE;
uint8_t *localram = malloc( ramsize ); uint8_t *localram = malloc( ramsize );
memset( localram, 0, ramsize ); memset( localram, 0, ramsize );

View File

@ -27,7 +27,7 @@
#include "drivers/gfx.h" #include "drivers/gfx.h"
#include "arm11/acf.h" #include "arm11/acf.h"
#define screenClean() //ee_printf("\x1b[2J\x1b[0m") #define screenClean() ee_printf("\x1b[2J\x1b[0m")
// Notes on these settings: // Notes on these settings:
// MAX_ENT_BUF_SIZE should be big enough to hold the average file/dir name length * MAX_DIR_ENTRIES. // MAX_ENT_BUF_SIZE should be big enough to hold the average file/dir name length * MAX_DIR_ENTRIES.
@ -40,7 +40,9 @@
#define SCREEN_COLS 19 #define SCREEN_COLS 19
#define SCREEN_ROWS 14u #define SCREEN_ROWS 14u
#define LINENO_TO_Y(y) ((y)+1)*15 #define LINENO_TO_Y(y) 4+(y)*15
#define CWIDTH 320u
#define CHEIGHT 240u
#define ENT_TYPE_FILE (0) #define ENT_TYPE_FILE (0)
#define ENT_TYPE_DIR (1) #define ENT_TYPE_DIR (1)
@ -138,7 +140,7 @@ static void showDirList(const DirList *const dList, u32 start)
//ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display //ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display
ee_printf("\x1b[%dm", *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36); ee_printf("\x1b[%dm", *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36);
acf_draw(0, LINENO_TO_Y(i-start), 320, 240, 292, &dList->ptrs[i][1] ); acf_draw(20, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, 292, &dList->ptrs[i][1] );
} }
} }
@ -170,14 +172,15 @@ Result browseFiles(const char *const basePath, char selected[512])
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( 0, LINENO_TO_Y(oldCursorPos-windowPos), 320, 240, 292, &dList->ptrs[oldCursorPos][1] ); acf_draw( 20, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, 292, &dList->ptrs[oldCursorPos][1] );
} }
acf_draw( 0, LINENO_TO_Y(cursorPos-windowPos), 320, 240, 292, &dList->ptrs[cursorPos][1] ); ee_printf("\x1b[33m");
acf_draw( 20, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, 292, &dList->ptrs[cursorPos][1] );
} }
else { else {
//ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, "<no gba rom>"); //ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, "<no gba rom>");
ee_printf("\x1b[0m"); ee_printf("\x1b[0m");
acf_draw( 0, LINENO_TO_Y(cursorPos-windowPos), 320, 240, 292, "<NO GBA ROM>" ); acf_draw( 20, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, 292, "<NO GBA ROM>" );
} }
u32 kDown; u32 kDown;

View File

@ -55,7 +55,6 @@ int main(void)
setBacklight(); setBacklight();
consoleInit(SCREEN_BOT, NULL); consoleInit(SCREEN_BOT, NULL);
//CODEC_init(); //CODEC_init();
res = acf_set_font("wqy11.acf");
if(res == RES_OK && (res = oafInitAndRun()) == RES_OK) if(res == RES_OK && (res = oafInitAndRun()) == RES_OK)
{ {

View File

@ -684,6 +684,8 @@ Result oafParseConfigEarly(void)
// Create the saves folder. // Create the saves folder.
if((res = fMkdir(OAF_SAVE_DIR)) != RES_OK && res != RES_FR_EXIST) break; if((res = fMkdir(OAF_SAVE_DIR)) != RES_OK && res != RES_FR_EXIST) break;
if((res = acf_set_font("wqy11.acf")) != RES_OK ) break;
// Parse the config. // Parse the config.
res = parseOafConfig("config.ini", true); res = parseOafConfig("config.ini", true);
} while(0); } while(0);