split out memorypak and about screen to seperate modules
This commit is contained in:
parent
fae2b19ebc
commit
04b8c0296c
21
inc/debug.h
21
inc/debug.h
@ -12,25 +12,8 @@
|
||||
#else
|
||||
#define TRACEF(disp, text, ...) do { if (0) dbg_printf(disp, text, __VA_ARGS__); } while (0)
|
||||
#define TRACE(disp, text) do { if (0) printText(text, 3, -1, disp); } while (0)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void dbg_printf(display_context_t disp, const char *fmt, ...)
|
||||
{
|
||||
char buf[32];
|
||||
setbuf(stderr, buf);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
u8 tmp[32];
|
||||
sprintf(tmp, "%s", buf);
|
||||
printText(tmp, 3, -1, disp);
|
||||
}
|
||||
#endif
|
||||
|
||||
void dbg_printf(display_context_t disp, const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
@ -16,8 +16,6 @@ int saveTypeToSd(display_context_t disp, char* save_filename ,int type);
|
||||
void drawShortInfoBox(display_context_t disp, char* text, u8 mode);
|
||||
void drawTextInput(display_context_t disp,char *msg);
|
||||
|
||||
void printText(char *msg, int x, int y, display_context_t dcon);
|
||||
|
||||
//#define ishexchar(c) (((c >= '0') && (c <= '9')) || ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f')))
|
||||
|
||||
/**
|
||||
|
15
inc/menu.h
Normal file
15
inc/menu.h
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Altra64 project contributors
|
||||
// See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
#ifndef _MENU_H_
|
||||
#define _MENU_H_
|
||||
|
||||
extern int text_offset;
|
||||
|
||||
void printText(char *msg, int x, int y, display_context_t dcon);
|
||||
|
||||
void menu_about(display_context_t disp);
|
||||
|
||||
#endif
|
21
src/debug.c
Normal file
21
src/debug.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <libdragon.h>
|
||||
#include "types.h"
|
||||
#include "debug.h"
|
||||
#include "menu.h"
|
||||
|
||||
void dbg_printf(display_context_t disp, const char *fmt, ...)
|
||||
{
|
||||
char buf[32];
|
||||
setbuf(stderr, buf);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
u8 tmp[32];
|
||||
sprintf(tmp, "%s", buf);
|
||||
printText(tmp, 3, -1, disp);
|
||||
}
|
51
src/main.c
51
src/main.c
@ -37,18 +37,16 @@
|
||||
#include "sound.h"
|
||||
#include "mp3.h"
|
||||
|
||||
//debug
|
||||
#include "debug.h"
|
||||
|
||||
// YAML parser
|
||||
#include <yaml.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "mem.h"
|
||||
#include "chksum64.h"
|
||||
#include "version.h"
|
||||
#include "image.h"
|
||||
#include "rom.h"
|
||||
#include "memorypak.h"
|
||||
#include "menu.h"
|
||||
|
||||
#ifdef USE_TRUETYPE
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
@ -223,7 +221,6 @@ char *save_path;
|
||||
|
||||
u8 sound_on = 0;
|
||||
u8 page_display = 0;
|
||||
int text_offset = 0;
|
||||
u8 tv_mode = 0; // 1=ntsc 2=pal 3=mpal 0=default automatic
|
||||
u8 quick_boot = 0;
|
||||
u8 enable_colored_list = 0;
|
||||
@ -244,9 +241,6 @@ char list_pwd_backup[256];
|
||||
|
||||
char dirz[512] = "rom://";
|
||||
|
||||
short int gCursorX;
|
||||
short int gCursorY;
|
||||
|
||||
int count = 0;
|
||||
int page = 0;
|
||||
int cursor = 0;
|
||||
@ -633,26 +627,6 @@ void display_dir(direntry_t *list, int cursor, int page, int max, int count, dis
|
||||
graphics_set_color(forecolor_menu, backcolor);
|
||||
}
|
||||
|
||||
void printText(char *msg, int x, int y, display_context_t dcon)
|
||||
{
|
||||
x = x + text_offset;
|
||||
|
||||
if (x != -1)
|
||||
gCursorX = x;
|
||||
if (y != -1)
|
||||
gCursorY = y;
|
||||
|
||||
if (dcon)
|
||||
graphics_draw_text(dcon, gCursorX * 8, gCursorY * 8, msg);
|
||||
|
||||
gCursorY++;
|
||||
if (gCursorY > 29)
|
||||
{
|
||||
gCursorY = 0;
|
||||
gCursorX++;
|
||||
}
|
||||
}
|
||||
|
||||
//background sprite
|
||||
void drawBg(display_context_t disp)
|
||||
{
|
||||
@ -2867,32 +2841,13 @@ void drawSet4(display_context_t disp)
|
||||
|
||||
void showAboutScreen(display_context_t disp)
|
||||
{
|
||||
char version_str[32];
|
||||
char firmware_str[32];
|
||||
|
||||
drawBoxNumber(disp, 2);
|
||||
display_show(disp);
|
||||
|
||||
if (sound_on)
|
||||
playSound(2);
|
||||
|
||||
|
||||
sprintf(version_str, "Altra64: v%s", Altra64_GetVersionString());
|
||||
printText(version_str, 9, 8, disp);
|
||||
sprintf(firmware_str, "ED64 firmware: v%03x", evd_getFirmVersion());
|
||||
printText(firmware_str, 9, -1, disp);
|
||||
printText("by JonesAlmighty", 9, -1, disp);
|
||||
printText(" ", 9, -1, disp);
|
||||
printText("Based on ALT64", 9, -1, disp);
|
||||
printText("By Saturnu", 9, -1, disp);
|
||||
printText(" ", 9, -1, disp);
|
||||
printText("credits to:", 9, -1, disp);
|
||||
printText("Jay Oster", 9, -1, disp);
|
||||
printText("Krikzz", 9, -1, disp);
|
||||
printText("Richard Weick", 9, -1, disp);
|
||||
printText("ChillyWilly", 9, -1, disp);
|
||||
printText("ShaunTaylor", 9, -1, disp);
|
||||
printText("Conle", 9, -1, disp);
|
||||
menu_about(disp);
|
||||
}
|
||||
|
||||
void loadFile(display_context_t disp)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "types.h"
|
||||
#include "memorypak.h"
|
||||
#include "fat.h"
|
||||
#include "main.h"
|
||||
#include "menu.h"
|
||||
#include "mem.h"
|
||||
#include "strlib.h"
|
||||
#include "sys.h"
|
||||
|
30
src/menu.c
Normal file
30
src/menu.c
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
#include <libdragon.h>
|
||||
#include "types.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
short int gCursorX;
|
||||
short int gCursorY;
|
||||
|
||||
int text_offset = 0;
|
||||
|
||||
void printText(char *msg, int x, int y, display_context_t dcon)
|
||||
{
|
||||
x = x + text_offset;
|
||||
|
||||
if (x != -1)
|
||||
gCursorX = x;
|
||||
if (y != -1)
|
||||
gCursorY = y;
|
||||
|
||||
if (dcon)
|
||||
graphics_draw_text(dcon, gCursorX * 8, gCursorY * 8, msg);
|
||||
|
||||
gCursorY++;
|
||||
if (gCursorY > 29)
|
||||
{
|
||||
gCursorY = 0;
|
||||
gCursorX++;
|
||||
}
|
||||
}
|
32
src/menu_about.c
Normal file
32
src/menu_about.c
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
#include <libdragon.h>
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "menu.h"
|
||||
#include "version.h"
|
||||
#include "main.h"
|
||||
#include "everdrive.h"
|
||||
|
||||
|
||||
void menu_about(display_context_t disp)
|
||||
{
|
||||
char version_str[32];
|
||||
char firmware_str[32];
|
||||
|
||||
sprintf(version_str, "Altra64: v%s", Altra64_GetVersionString());
|
||||
printText(version_str, 9, 8, disp);
|
||||
sprintf(firmware_str, "ED64 firmware: v%03x", evd_getFirmVersion());
|
||||
printText(firmware_str, 9, -1, disp);
|
||||
printText("by JonesAlmighty", 9, -1, disp);
|
||||
printText(" ", 9, -1, disp);
|
||||
printText("Based on ALT64", 9, -1, disp);
|
||||
printText("By Saturnu", 9, -1, disp);
|
||||
printText(" ", 9, -1, disp);
|
||||
printText("credits to:", 9, -1, disp);
|
||||
printText("Jay Oster", 9, -1, disp);
|
||||
printText("Krikzz", 9, -1, disp);
|
||||
printText("Richard Weick", 9, -1, disp);
|
||||
printText("ChillyWilly", 9, -1, disp);
|
||||
printText("ShaunTaylor", 9, -1, disp);
|
||||
printText("Conle", 9, -1, disp);
|
||||
}
|
Loading…
Reference in New Issue
Block a user