Skip to content

Commit

Permalink
added console output on the screen which has a bigger backlog than on…
Browse files Browse the repository at this point in the history
… DRC

added meta.xml and icon.png
  • Loading branch information
dimok789 committed Mar 2, 2016
1 parent b70bac5 commit 2b38c8b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 23 deletions.
Binary file added meta/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions meta/meta.xml
Original file line number Diff line number Diff line change
@@ -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>
69 changes: 46 additions & 23 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...)
{
Expand All @@ -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);

Expand All @@ -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);
}
Expand Down Expand Up @@ -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));

Expand All @@ -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);
Expand Down Expand Up @@ -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 *
//!*******************************************************************
Expand Down

0 comments on commit 2b38c8b

Please sign in to comment.