Indentation fixed

This commit is contained in:
shadlyd15 2022-05-07 22:40:11 +02:00
parent 5a850a611d
commit d7d4dc3f21
6 changed files with 269 additions and 285 deletions

View File

@ -6,11 +6,9 @@
EFI_EVENT TimerEvent;
EFIAPI void TimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
)
{ kernel.ticks++; }
EFIAPI void TimerHandler ( IN EFI_EVENT Event, IN void *Context){
kernel.ticks++;
}
unsigned long long timer_ticks(){
return kernel.ticks;

View File

@ -129,18 +129,6 @@ void setCursor(INT16 x, INT16 y) {
/**********************************************************************/
void setTextColor(UINT32 c) { textcolor = textbgcolor = c; }
/**********************************************************************/
/*!
@brief Set text font color with custom background color
@param c 16-bit 5-6-5 Color to draw text with
@param bg 16-bit 5-6-5 Color to draw background/fill with
*/
/**********************************************************************/
// void setTextColor(UINT32 c, UINT32 bg) {
// textcolor = c;
// textbgcolor = bg;
// }
/**********************************************************************/
/*!
@brief Set whether text that is too long for the screen width should

View File

@ -109,7 +109,6 @@
void setCursor(INT16 x, INT16 y);
void setTextColor(UINT32 c);
// void setTextColor(UINT32 c, UINT32 bg);
void setTextWrap(bool w);
void cp437(bool x);
INT16 width(void);

View File

@ -19,36 +19,7 @@ ui_state_t g_ui_state = UI_STATE_SPLASH;
static int total_roms = 0;
static int current_rom_index = 0;
CHAR16 * strstr_16(CHAR16 * string, CHAR16 * substring){
CHAR16 *a, *b;
// https://opensource.apple.com/source/tcl/tcl-10/tcl/compat/strstr.c.auto.html
/* First scan quickly through the two strings looking for a
* single-character match. When it's found, then compare the
* rest of the substring.
*/
b = substring;
if (*b == 0) {
return string;
}
for ( ; *string != 0; string += 1) {
if (*string != *b) {
continue;
}
a = string;
while (1) {
if (*b == 0) {
return string;
}
if (*a++ != *b++) {
break;
}
}
b = substring;
}
return NULL;
}
CHAR16* strstr_16(CHAR16 *string, CHAR16 *substring);
void draw_menu(CHAR16 *item_name){
int x_offset = (kernel.graphics->Mode->Info->HorizontalResolution - 601) / 2;
@ -78,15 +49,14 @@ bool load_current_nes_file(){
uefi_call_wrapper(FileHandle->Read, 3, FileHandle, &ReadSize, Buffer);
if (fce_load_rom((char*) Buffer) == 0){
// Print(L"ROM LOADED\n\r");
draw_menu(L "ROM LOADED");
rc = true;
} else{
}
else{
draw_menu(L "ROM LOAD ERROR");
}
// uefi_call_wrapper(FileHandle->Close, 0);
FreePool(Buffer);
return rc;
}
@ -103,7 +73,8 @@ void render_menu(UINT16 key){
case KEY_DOWN:
case KEY_LEFT:{
current_rom_index--;
if(current_rom_index < 0){
if (current_rom_index < 0)
{
current_rom_index = total_roms - 1;
}
break;
@ -121,7 +92,6 @@ void render_menu(UINT16 key){
}
void save_rom_info(EFI_FILE_INFO *info){
// Print(L"FileName = %s\n", info -> FileName);
if ((strstr_16(info->FileName, L ".nes")) || (strstr_16(info->FileName, L ".NES"))){
StrCpy(rom_collection[total_roms], info->FileName);
total_roms++;
@ -152,7 +122,8 @@ ui_state_t ui_manage_states(){
fce_init();
graphics_clear_framebuffer(kernel.graphics);
g_ui_state = UI_STATE_PLAY;
} else{
}
else{
g_ui_state = UI_STATE_MENU;
}
break;
@ -161,7 +132,6 @@ ui_state_t ui_manage_states(){
case UI_STATE_PLAY:{
fce_run();
// hal_nes_ctrl_key_clear();
break;
}
}
@ -189,14 +159,13 @@ void render_splash_screen(){
int y_offset = (kernel.graphics->Mode->Info->VerticalResolution - bmp_header->PixelWidth) / 2;
graphics_draw_bitmap(kernel.graphics, x_offset, y_offset, (void **) Buffer);
// uefi_call_wrapper(FileHandle->Close, 0);
FreePool(Buffer);
// WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
}
void ui_key_handler(uint32_t key){
if(g_ui_state == UI_STATE_MENU){render_menu(key);}
if (g_ui_state == UI_STATE_MENU){
render_menu(key);
}
else if (g_ui_state == UI_STATE_PLAY){
hal_nes_set_key(key);
if (key == 'r'){
@ -204,3 +173,33 @@ void ui_key_handler(uint32_t key){
}
}
}
CHAR16* strstr_16(CHAR16 *string, CHAR16 *substring){
// https://opensource.apple.com/source/tcl/tcl-10/tcl/compat/strstr.c.auto.html
// Modified for CHAR16
/*First scan quickly through the two strings looking for a
*single-character match. When it's found, then compare the
*rest of the substring.
*/
CHAR16 *a, *b;
b = substring;
if (*b == 0){
return string;
}
for (; *string != 0; string += 1){
if (*string != *b){
continue;
}
a = string;
while (1){
if (*b == 0){
return string;
}
if (*a++ != *b++){
break;
}
}
b = substring;
}
return NULL;
}