Permalink
Browse files

added console output on the screen which has a bigger backlog than on…

… DRC

added meta.xml and icon.png
  • Loading branch information...
1 parent b70bac5 commit 2b38c8b303ad291b8d8a7804b941b317ba04aec0 @dimok789 dimok789 committed Mar 2, 2016
Showing with 60 additions and 23 deletions.
  1. BIN meta/icon.png
  2. +14 −0 meta/meta.xml
  3. +46 −23 src/main.c
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<app version="1">
+ <name>FTPiiU</name>
+ <coder>joedj</coder>
+ <version>0.2</version>
+ <release_date>20160302200000</release_date>
+ <short_description>An FTP server</short_description>
+ <long_description>ftpiiU is an FTP server for WiiU.
+
+ Ported to WiiU by Dimok.
+ Based on FTPii from joedj
+ </long_description>
+
+</app>
View
@@ -21,9 +21,11 @@
#include "net.h"
#define PORT 21
-#define MAX_CONSOLE_LINES 18
+#define MAX_CONSOLE_LINES_TV 27
+#define MAX_CONSOLE_LINES_DRC 18
-static char * consoleArray[MAX_CONSOLE_LINES];
+static char * consoleArrayTv[MAX_CONSOLE_LINES_TV];
+static char * consoleArrayDrc[MAX_CONSOLE_LINES_DRC];
void console_printf(const char *format, ...)
{
@@ -33,16 +35,25 @@ void console_printf(const char *format, ...)
va_start(va, format);
if((vasprintf(&tmp, format, va) >= 0) && tmp)
{
- if(consoleArray[0])
- free(consoleArray[0]);
+ if(consoleArrayTv[0])
+ free(consoleArrayTv[0]);
+ if(consoleArrayDrc[0])
+ free(consoleArrayDrc[0]);
- for(int i = 1; i < MAX_CONSOLE_LINES; i++)
- consoleArray[i-1] = consoleArray[i];
+ for(int i = 1; i < MAX_CONSOLE_LINES_TV; i++)
+ consoleArrayTv[i-1] = consoleArrayTv[i];
+
+ for(int i = 1; i < MAX_CONSOLE_LINES_DRC; i++)
+ consoleArrayDrc[i-1] = consoleArrayDrc[i];
if(strlen(tmp) > 79)
tmp[79] = 0;
- consoleArray[MAX_CONSOLE_LINES-1] = (tmp);
+ consoleArrayTv[MAX_CONSOLE_LINES_TV-1] = (char*)malloc(strlen(tmp) + 1);
+ if(consoleArrayTv[MAX_CONSOLE_LINES_TV-1])
+ strcpy(consoleArrayTv[MAX_CONSOLE_LINES_TV-1], tmp);
+
+ consoleArrayDrc[MAX_CONSOLE_LINES_DRC-1] = (tmp);
}
va_end(va);
@@ -51,14 +62,18 @@ void console_printf(const char *format, ...)
OSScreenClearBufferEx(1, 0);
- for(int i = 0; i < MAX_CONSOLE_LINES; i++)
+ for(int i = 0; i < MAX_CONSOLE_LINES_TV; i++)
{
- if(consoleArray[i])
- {
- OSScreenPutFontEx(0, 0, i, consoleArray[i]);
- OSScreenPutFontEx(1, 0, i, consoleArray[i]);
- }
+ if(consoleArrayTv[i])
+ OSScreenPutFontEx(0, 0, i, consoleArrayTv[i]);
}
+
+ for(int i = 0; i < MAX_CONSOLE_LINES_DRC; i++)
+ {
+ if(consoleArrayDrc[i])
+ OSScreenPutFontEx(1, 0, i, consoleArrayDrc[i]);
+ }
+
OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1);
}
@@ -94,21 +109,20 @@ int Menu_Main(void)
log_printf("Mount SD partition\n");
mount_sd_fat("sd");
- for(int i = 0; i < MAX_CONSOLE_LINES; i++)
- {
- consoleArray[i] = NULL;
- }
+ for(int i = 0; i < MAX_CONSOLE_LINES_TV; i++)
+ consoleArrayTv[i] = NULL;
+
+ for(int i = 0; i < MAX_CONSOLE_LINES_DRC; i++)
+ consoleArrayDrc[i] = NULL;
VPADInit();
// Prepare screen
int screen_buf0_size = 0;
- int screen_buf1_size = 0;
// Init screen and screen buffers
OSScreenInit();
screen_buf0_size = OSScreenGetBufferSizeEx(0);
- screen_buf1_size = OSScreenGetBufferSizeEx(1);
OSScreenSetBufferEx(0, (void *)0xF4000000);
OSScreenSetBufferEx(1, (void *)(0xF4000000 + screen_buf0_size));
@@ -119,10 +133,6 @@ int Menu_Main(void)
OSScreenClearBufferEx(0, 0);
OSScreenClearBufferEx(1, 0);
- // Flush the cache
- DCFlushRange((void *)0xF4000000, screen_buf0_size);
- DCFlushRange((void *)(0xF4000000 + screen_buf0_size), screen_buf1_size);
-
// Flip buffers
OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1);
@@ -165,6 +175,19 @@ int Menu_Main(void)
network_close(serverSocket);
UnmountVirtualPaths();
+ //! free memory
+ for(int i = 0; i < MAX_CONSOLE_LINES_TV; i++)
+ {
+ if(consoleArrayTv[i])
+ free(consoleArrayTv[i]);
+ }
+
+ for(int i = 0; i < MAX_CONSOLE_LINES_DRC; i++)
+ {
+ if(consoleArrayDrc[i])
+ free(consoleArrayDrc[i]);
+ }
+
//!*******************************************************************
//! Enter main application *
//!*******************************************************************

0 comments on commit 2b38c8b

Please sign in to comment.