-cleaned up debug message system

-improved wifi gecko (now buffers messages, more stable etc)
This commit is contained in:
fix94.1 2012-12-08 16:17:35 +00:00
parent 470e40a9e6
commit c19f116046
57 changed files with 306 additions and 309 deletions

View File

@ -25,7 +25,7 @@ distribution.
#define BANNER_TOOLS_H_ #define BANNER_TOOLS_H_
#include <gctypes.h> #include <gctypes.h>
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define MAKE_FOURCC(a, b, c, d) ((a) * (1 << 24) + (b) * (1 << 16) + (c) * (1 << 8) + (d) * (1 << 0)) #define MAKE_FOURCC(a, b, c, d) ((a) * (1 << 24) + (b) * (1 << 16) + (c) * (1 << 8) + (d) * (1 << 0))

View File

@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include "BannerWindow.hpp" #include "BannerWindow.hpp"
#include "gx_addons.h" #include "gx_addons.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/utils.h" #include "loader/utils.h"
#include "menu/menu.hpp" #include "menu/menu.hpp"

View File

@ -34,7 +34,7 @@
#include <malloc.h> #include <malloc.h>
#include "banner.h" #include "banner.h"
#include "MD5.h" #include "MD5.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/fs.h" #include "loader/fs.h"
#include "unzip/U8Archive.h" #include "unzip/U8Archive.h"

View File

@ -6,7 +6,7 @@
#include "channel_launcher.h" #include "channel_launcher.h"
#include "booter/external_booter.hpp" #include "booter/external_booter.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/disc.h" #include "loader/disc.h"
#include "loader/fs.h" #include "loader/fs.h"
#include "loader/fst.h" #include "loader/fst.h"

View File

@ -33,7 +33,7 @@
#include "channels.h" #include "channels.h"
#include "banner.h" #include "banner.h"
#include "config/config.hpp" #include "config/config.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "loader/fs.h" #include "loader/fs.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"

View File

@ -38,7 +38,7 @@
#include "nand.hpp" #include "nand.hpp"
#include "identify.h" #include "identify.h"
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/alt_ios.h" #include "loader/alt_ios.h"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/fs.h" #include "loader/fs.h"

View File

@ -2,7 +2,7 @@
#include <fstream> #include <fstream>
#include "config.hpp" #include "config.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
static const char *g_whitespaces = " \f\n\r\t\v"; static const char *g_whitespaces = " \f\n\r\t\v";

View File

@ -35,7 +35,7 @@
#include "usbstorage.h" #include "usbstorage.h"
#include "usbstorage_libogc.h" #include "usbstorage_libogc.h"
#include "usbthread.h" #include "usbthread.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
/* IOCTL commands */ /* IOCTL commands */
#define UMS_BASE (('U'<<24)|('M'<<16)|('S'<<8)) #define UMS_BASE (('U'<<24)|('M'<<16)|('S'<<8))

View File

@ -22,7 +22,7 @@
#include "usbthread.h" #include "usbthread.h"
#include "usbstorage.h" #include "usbstorage.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
lwp_t USB_Thread = LWP_THREAD_NULL; lwp_t USB_Thread = LWP_THREAD_NULL;
volatile bool CheckUSB = false; volatile bool CheckUSB = false;

View File

@ -18,7 +18,7 @@ en exposed s_fsop fsop structure can be used by callback to update operation sta
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/utils.h" #include "loader/utils.h"
#define SET(a, b) a = b; DCFlushRange(&a, sizeof(a)); #define SET(a, b) a = b; DCFlushRange(&a, sizeof(a));

View File

@ -29,7 +29,7 @@
#include "gc/gc.hpp" #include "gc/gc.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "loader/utils.h" #include "loader/utils.h"
#include "loader/disc.h" #include "loader/disc.h"

View File

@ -22,7 +22,7 @@
#include "gc.hpp" #include "gc.hpp"
#include "gcdisc.hpp" #include "gcdisc.hpp"
#include "loader/gc_disc_dump.hpp" #include "loader/gc_disc_dump.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
using namespace std; using namespace std;

View File

@ -1,5 +1,3 @@
//Enable the line below to always write SD log
//#define sd_write_log
#include <gccore.h> #include <gccore.h>
#include <malloc.h> #include <malloc.h>
@ -8,16 +6,18 @@
#include <sys/iosupport.h> #include <sys/iosupport.h>
#include <stdarg.h> #include <stdarg.h>
#include "gecko.h" #include "gecko.hpp"
#include "wifi_gecko.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "wifi_gecko.hpp"
/* init-globals */ #define GPRINTF_SIZE 256
bool geckoinit = false;
bool textVideoInit = false;
bool bufferMessages = true;
bool WriteToSD = false;
#define SDWRITE_SIZE 1024 #define SDWRITE_SIZE 1024
bool geckoinit = false;
bool sd_inited = false;
bool bufferMessages = true;
char gprintfBuffer[GPRINTF_SIZE];
char sdwritebuffer[SDWRITE_SIZE]; char sdwritebuffer[SDWRITE_SIZE];
static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len) static ssize_t __out_write(struct _reent *r __attribute__((unused)), int fd __attribute__((unused)), const char *ptr, size_t len)
@ -66,16 +66,26 @@ static void USBGeckoOutput()
devoptab_list[STD_ERR] = &gecko_out; devoptab_list[STD_ERR] = &gecko_out;
} }
static char ascii(char s)
{
if(s < 0x20)
return '.';
if(s > 0x7E)
return '.';
return s;
}
static void WriteToFile(const char* tmp, size_t len) static void WriteToFile(const char* tmp, size_t len)
{ {
if(!bufferMessages) if(bufferMessages == false)
return; return;
if((strlen(sdwritebuffer) + len) < SDWRITE_SIZE) if((strlen(sdwritebuffer) + len) < SDWRITE_SIZE)
strcat(sdwritebuffer, tmp); strcat(sdwritebuffer, tmp);
if(WriteToSD) if(sd_inited == false)
{ return;
FILE *outfile = fopen("sd:/wiiflow.log", "a"); FILE *outfile = fopen("sd:/wiiflow.log", "a");
if(outfile) if(outfile)
{ {
@ -84,32 +94,46 @@ static void WriteToFile(const char* tmp, size_t len)
fclose(outfile); fclose(outfile);
} }
} }
void Gecko_Init(void)
{
USBGeckoOutput();
memset(sdwritebuffer, 0, SDWRITE_SIZE);
memset(gprintfBuffer, 0, GPRINTF_SIZE);
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
if(geckoattached)
{
geckoinit = true;
usb_flush(EXI_CHANNEL_1);
const char *initstr = "USB Gecko inited.\n";
__out_write(NULL, 0, initstr, strlen(initstr));
}
} }
#define GPRINTF_SIZE 256 void LogToSD_SetBuffer(bool buf)
static char gprintfBuffer[GPRINTF_SIZE]; {
bufferMessages = buf;
sd_inited = true;
}
#ifdef __cplusplus
extern "C"
{
#endif
void gprintf(const char *format, ...) void gprintf(const char *format, ...)
{ {
va_list va; va_list va;
va_start(va, format); va_start(va, format);
size_t len = vsnprintf(gprintfBuffer, GPRINTF_SIZE - 1, format, va); size_t len = vsnprintf(gprintfBuffer, GPRINTF_SIZE - 1, format, va);
gprintfBuffer[GPRINTF_SIZE - 1] = '\0';
va_end(va); va_end(va);
__out_write(NULL, 0, gprintfBuffer, len); __out_write(NULL, 0, gprintfBuffer, len);
WifiGecko_Send(gprintfBuffer, len); WiFiDebugger.Send(gprintfBuffer, len);
WriteToFile(gprintfBuffer, len); WriteToFile(gprintfBuffer, len);
} }
char ascii(char s)
{
if(s < 0x20)
return '.';
if(s > 0x7E)
return '.';
return s;
}
void ghexdump(void *d, int len) void ghexdump(void *d, int len)
{ {
u8 *data; u8 *data;
@ -141,26 +165,6 @@ void ghexdump(void *d, int len)
} }
} }
static const char *initstr = "USB Gecko inited.\n"; #ifdef __cplusplus
bool InitGecko() }
{
if(geckoinit)
return geckoinit;
USBGeckoOutput();
memset(sdwritebuffer, 0, SDWRITE_SIZE);
memset(gprintfBuffer, 0, GPRINTF_SIZE);
#ifdef sd_write_log
WriteToSD = true;
#endif #endif
u32 geckoattached = usb_isgeckoalive(EXI_CHANNEL_1);
if(geckoattached)
{
geckoinit = true;
usb_flush(EXI_CHANNEL_1);
__out_write(NULL, 0, initstr, strlen(initstr));
}
return geckoinit;
}

View File

@ -1,20 +1,18 @@
#ifndef _GECKO_H_ #ifndef _GECKO_HPP_
#define _GECKO_H_ #define _GECKO_HPP_
#include <gccore.h>
void Gecko_Init(void);
void LogToSD_SetBuffer(bool buf);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <gccore.h>
extern bool bufferMessages;
extern bool WriteToSD;
//use this just like printf();
void gprintf(const char *format, ...); void gprintf(const char *format, ...);
void ghexdump(void *d, int len); void ghexdump(void *d, int len);
bool InitGecko();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,134 +0,0 @@
/****************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* for WiiXplorer 2010
***************************************************************************/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <network.h>
#include <errno.h>
#include "wifi_gecko.h"
#include "loader/utils.h"
// set to use TCP socket instead of UDP
#define WIFI_GECKO_USE_TCP (0)
static int connection = -1;
static int init = 0;
const char *dest_ip = NULL;
u16 dest_port = 0;
void WifiGecko_Init(const char *ip, const u16 port)
{
dest_ip = ip;
dest_port = port;
init = 1;
}
void WifiGecko_Close()
{
if (!init) return;
if(connection >= 0)
net_close(connection);
connection = -1;
}
int WifiGecko_Connect()
{
if (!init) return -2;
if(connection >= 0)
return connection;
if (dest_ip == NULL || dest_port == 0) return connection;
#if WIFI_GECKO_USE_TCP
connection = net_socket(PF_INET, SOCK_STREAM, 0);
#else
connection = net_socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
#endif
if (connection < 0)
return connection;
struct sockaddr_in connect_addr;
memset(&connect_addr, 0, sizeof(connect_addr));
#if WIFI_GECKO_USE_TCP
connect_addr.sin_family = PF_INET;
#else
connect_addr.sin_family = AF_INET;
#endif
connect_addr.sin_port = htons(dest_port);
inet_aton(dest_ip, &connect_addr.sin_addr);
if(net_connect(connection, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0)
{
WifiGecko_Close();
return -1;
}
// First time connect, send hello message
char *msg = "Wiiflow WiFi Gecko output console connected\n";
net_send(connection, msg, strlen(msg), 0);
return connection;
}
int WifiGecko_Send(const char * data, int datasize)
{
if (!init) return -2;
if(WifiGecko_Connect() < 0)
return connection;
int ret = 0, done = 0, blocksize = 1024;
while (done < datasize)
{
while(net_get_status() == -EBUSY);
if(blocksize > datasize-done)
blocksize = datasize-done;
ret = net_send(connection, data + done, blocksize, 0);
if (ret < 0)
{
WifiGecko_Close();
return ret;
}
else if(ret == 0)
{
break;
}
done += ret;
usleep (1000);
}
return ret;
}

124
source/gecko/wifi_gecko.cpp Normal file
View File

@ -0,0 +1,124 @@
/****************************************************************************
* Copyright (C) 2010 by Dimok
* (C) 2012 by FIX94
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "wifi_gecko.hpp"
#include "loader/utils.h"
/* set to use TCP socket instead of UDP */
//#define WIFI_GECKO_USE_TCP 1
WifiGecko WiFiDebugger;
WifiGecko::WifiGecko()
{
connection = -1;
inited = false;
buffer = true;
dest_ip = NULL;
dest_port = 0;
memset(wifigeckobuffer, 0, WIFIGECKO_SIZE);
}
void WifiGecko::SetBuffer(bool buf)
{
buffer = buf;
}
void WifiGecko::Init(const char *ip, const u16 port)
{
dest_ip = ip;
dest_port = port;
inited = true;
}
void WifiGecko::Close()
{
if(connection >= 0)
net_close(connection);
connection = -1;
inited = false;
dest_ip = NULL;
dest_port = 0;
}
int WifiGecko::Connect()
{
if(inited == false)
return -2;
if(connection != -1 || dest_ip == NULL || dest_port == 0)
return connection;
int tmp_con = -1;
memset(&connect_addr, 0, sizeof(connect_addr));
#ifdef WIFI_GECKO_USE_TCP
connect_addr.sin_family = PF_INET;
tmp_con = net_socket(connect_addr.sin_family, SOCK_STREAM, 0);
#else
connect_addr.sin_family = AF_INET;
tmp_con = net_socket(connect_addr.sin_family, SOCK_DGRAM, IPPROTO_IP);
#endif
if(tmp_con < 0)
return -3;
connect_addr.sin_port = htons(dest_port);
inet_aton(dest_ip, &connect_addr.sin_addr);
if(net_connect(tmp_con, (sockaddr*)&connect_addr, sizeof(connect_addr)) < 0)
{
Close();
return -4;
}
connection = tmp_con;
return connection;
}
int WifiGecko::Send(const char *data, int datasize)
{
if(buffer == false)
return -1;
if((strlen(wifigeckobuffer) + datasize) < WIFIGECKO_SIZE)
strcat(wifigeckobuffer, data);
if(Connect() < 0)
return connection;
u32 sendsize = strlen(wifigeckobuffer);
while(net_get_status() == -EBUSY)
usleep(100);
int ret = net_send(connection, wifigeckobuffer, sendsize, 0);
if(ret < 0)
Close();
memset(wifigeckobuffer, 0, WIFIGECKO_SIZE);
return ret;
}

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* Copyright (C) 2010 * Copyright (C) 2010 by Dimok
* by Dimok * (C) 2012 by FIX94
* *
* This software is provided 'as-is', without any express or implied * This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any * warranty. In no event will the authors be held liable for any
@ -20,23 +20,33 @@
* *
* 3. This notice may not be removed or altered from any source * 3. This notice may not be removed or altered from any source
* distribution. * distribution.
*
* for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#ifndef WIFI_GECKO_H_ #ifndef WIFI_GECKO_HPP_
#define WIFI_GECKO_H_ #define WIFI_GECKO_HPP_
#ifdef __cplusplus #include <network.h>
extern "C" {
#endif
void WifiGecko_Init(const char *ip, u16 port); #define WIFIGECKO_SIZE 1024
int WifiGecko_Connect();
void WifiGecko_Close();
int WifiGecko_Send(const char * data, int datasize);
#ifdef __cplusplus class WifiGecko
} {
#endif public:
WifiGecko();
void Init(const char *ip, u16 port);
int Send(const char *data, int datasize);
void SetBuffer(bool buf);
private:
int Connect();
void Close();
bool inited;
bool buffer;
const char *dest_ip;
u16 dest_port;
volatile int connection;
sockaddr_in connect_addr;
char wifigeckobuffer[WIFIGECKO_SIZE];
};
extern WifiGecko WiFiDebugger;
#endif #endif

View File

@ -30,7 +30,7 @@
#include "defines.h" #include "defines.h"
#include "text.hpp" #include "text.hpp"
#include "config/config.hpp" #include "config/config.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#define NAME_OFFSET_DB "gametdb_offsets.bin" #define NAME_OFFSET_DB "gametdb_offsets.bin"
#define MAXREADSIZE 1024*1024 //Cache size only for parsing the offsets: 1MB #define MAXREADSIZE 1024*1024 //Cache size only for parsing the offsets: 1MB

View File

@ -29,7 +29,7 @@
#include <asndlib.h> #include <asndlib.h>
#include <malloc.h> #include <malloc.h>
#include "WiiMovie.hpp" #include "WiiMovie.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define SND_BUFFERS 8 #define SND_BUFFERS 8
#define FRAME_BUFFERS 8 #define FRAME_BUFFERS 8

View File

@ -14,7 +14,7 @@
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "fonts.h" #include "fonts.h"
#include "types.h" #include "types.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "wstringEx/wstringEx.hpp" #include "wstringEx/wstringEx.hpp"

View File

@ -2,7 +2,7 @@
#include "pngu.h" #include "pngu.h"
#include "boxmesh.hpp" #include "boxmesh.hpp"
#include "text.hpp" #include "text.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
using namespace std; using namespace std;

View File

@ -13,7 +13,7 @@ More info : http://frontier-dev.net
#include "pngu.h" #include "pngu.h"
#include "png.h" #include "png.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/utils.h" #include "loader/utils.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"

View File

@ -6,7 +6,7 @@
#include "video.hpp" #include "video.hpp"
#include "pngu.h" #include "pngu.h"
#include "Gekko.h" #include "Gekko.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/utils.h" #include "loader/utils.h"
#define DEFAULT_FIFO_SIZE (256 * 1024) #define DEFAULT_FIFO_SIZE (256 * 1024)

View File

@ -5,7 +5,7 @@
#include <ogc/machine/processor.h> #include <ogc/machine/processor.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define EXECUTE_ADDR ((u8 *)0x92000000) #define EXECUTE_ADDR ((u8 *)0x92000000)
#define BOOTER_ADDR ((u8 *)0x93000000) #define BOOTER_ADDR ((u8 *)0x93000000)

View File

@ -9,7 +9,7 @@
#include <gccore.h> #include <gccore.h>
#include <malloc.h> #include <malloc.h>
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/disc.h" #include "loader/disc.h"
#include "loader/utils.h" #include "loader/utils.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"

View File

@ -7,7 +7,7 @@
#include <vector> #include <vector>
#include "loader/disc.h" #include "loader/disc.h"
//#include "gecko.h" //#include "gecko.hpp"
using namespace std; using namespace std;
const char io[4][5] = { const char io[4][5] = {

View File

@ -13,7 +13,7 @@
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "devicemounter/sdhc.h" #include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "memory/memory.h" #include "memory/memory.h"
#include "types.h" #include "types.h"

View File

@ -35,7 +35,7 @@
#include "nk.h" #include "nk.h"
#include "fs.h" #include "fs.h"
#include "mload.h" #include "mload.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
int mainIOS = 0; int mainIOS = 0;

View File

@ -20,7 +20,7 @@
#include "cios.h" #include "cios.h"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/memory.h" #include "memory/memory.h"
struct discHdr wii_hdr ATTRIBUTE_ALIGN(32); struct discHdr wii_hdr ATTRIBUTE_ALIGN(32);

View File

@ -16,7 +16,7 @@
#include "ext2_frag.h" #include "ext2_frag.h"
#include "fatfile_frag.h" #include "fatfile_frag.h"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "libwbfs/libwbfs.h" #include "libwbfs/libwbfs.h"
FragList *frag_list = NULL; FragList *frag_list = NULL;

View File

@ -6,7 +6,7 @@
#include "fs.h" #include "fs.h"
#include "utils.h" #include "utils.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
static fstats stats ATTRIBUTE_ALIGN(32); static fstats stats ATTRIBUTE_ALIGN(32);

View File

@ -28,7 +28,7 @@
#include "fst.h" #include "fst.h"
#include "sys.h" #include "sys.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#define FSTDIRTYPE 1 #define FSTDIRTYPE 1

View File

@ -35,7 +35,7 @@
#include "wdvd.h" #include "wdvd.h"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "gui/Gekko.h" #include "gui/Gekko.h"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"

View File

@ -16,7 +16,7 @@
*/ */
#include "mload.h" #include "mload.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
static const char mload_fs[] ATTRIBUTE_ALIGN(32) = "/dev/mload"; static const char mload_fs[] ATTRIBUTE_ALIGN(32) = "/dev/mload";

View File

@ -31,7 +31,7 @@
#include "nk.h" #include "nk.h"
#include "armboot.h" #include "armboot.h"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
bool checked = false; bool checked = false;
bool neek = false; bool neek = false;

View File

@ -12,7 +12,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ogcsys.h> #include <ogcsys.h>
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define PLAYRECPATH "/title/00000001/00000002/data/play_rec.dat" #define PLAYRECPATH "/title/00000001/00000002/data/play_rec.dat"
#define SECONDS_TO_2000 946684800LL #define SECONDS_TO_2000 946684800LL

View File

@ -12,7 +12,7 @@
#include <ctype.h> #include <ctype.h>
#include "splits.h" #include "splits.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define off64_t off_t #define off64_t off_t
#define FMT_llu "%llu" #define FMT_llu "%llu"

View File

@ -13,7 +13,7 @@
#include "sys.h" #include "sys.h"
#include "channel/channel_launcher.h" #include "channel/channel_launcher.h"
#include "loader/nk.h" #include "loader/nk.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
#include "memory/memory.h" #include "memory/memory.h"
#include "wiiuse/wpad.h" #include "wiiuse/wpad.h"

View File

@ -21,7 +21,7 @@
#include "devicemounter/sdhc.h" #include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "libwbfs/libwbfs.h" #include "libwbfs/libwbfs.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
/* Constants */ /* Constants */

View File

@ -21,7 +21,7 @@
#include "devicemounter/sdhc.h" #include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "libwbfs/libwbfs.h" #include "libwbfs/libwbfs.h"
#define MAX_FAT_PATH 1024 #define MAX_FAT_PATH 1024

View File

@ -2,7 +2,7 @@
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <ogcsys.h> #include <ogcsys.h>
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
/* Constants */ /* Constants */
#define IOCTL_DI_READID 0x70 #define IOCTL_DI_READID 0x70

View File

@ -5,7 +5,7 @@
#include <stdio.h> #include <stdio.h>
#include "wip.h" #include "wip.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
static WIP_Code *CodeList = NULL; static WIP_Code *CodeList = NULL;

View File

@ -6,7 +6,7 @@
#include "booter/external_booter.hpp" #include "booter/external_booter.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "gui/video.hpp" #include "gui/video.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "homebrew/homebrew.h" #include "homebrew/homebrew.h"
@ -27,7 +27,7 @@ int main(int argc, char **argv)
{ {
mainIOS = DOL_MAIN_IOS; mainIOS = DOL_MAIN_IOS;
__exception_setreload(5); __exception_setreload(5);
InitGecko(); //USB Gecko and SD buffer Gecko_Init(); //USB Gecko and SD/WiFi buffer
gprintf(" \nWelcome to %s!\nThis is the debug output.\n", VERSION_STRING.c_str()); gprintf(" \nWelcome to %s!\nThis is the debug output.\n", VERSION_STRING.c_str());
m_vid.init(); // Init video m_vid.init(); // Init video

View File

@ -5,7 +5,7 @@
#include "mem2.hpp" #include "mem2.hpp"
#include "mem2alloc.hpp" #include "mem2alloc.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "loader/utils.h" #include "loader/utils.h"
#define MEM2_PRIORITY_SIZE 0x1000 #define MEM2_PRIORITY_SIZE 0x1000

View File

@ -146,6 +146,9 @@ CMenu::CMenu()
m_prevBg = NULL; m_prevBg = NULL;
m_nextBg = NULL; m_nextBg = NULL;
m_lqBg = NULL; m_lqBg = NULL;
m_use_sd_logging = false;
m_use_wifi_gecko = false;
init_network = false;
} }
void CMenu::init() void CMenu::init()
@ -204,15 +207,16 @@ void CMenu::init()
fsop_MakeFolder(m_appDir.c_str()); fsop_MakeFolder(m_appDir.c_str());
/* Load/Create our wiiflow.ini */ /* Load/Create our wiiflow.ini */
m_cfg.load(fmt("%s/" CFG_FILENAME, m_appDir.c_str())); m_cfg.load(fmt("%s/" CFG_FILENAME, m_appDir.c_str()));
/* Check if we want WiFi/SD Gecko */ /* Check if we want WiFi Gecko */
m_use_wifi_gecko = m_cfg.getBool("DEBUG", "wifi_gecko"); m_use_wifi_gecko = m_cfg.getBool("DEBUG", "wifi_gecko", false);
if (m_cfg.getBool("GENERAL", "async_network") || has_enabled_providers() || m_use_wifi_gecko) WiFiDebugger.SetBuffer(m_use_wifi_gecko);
_reload_wifi_gecko(); /* Check if we want SD Gecko */
if(!WriteToSD) m_use_sd_logging = m_cfg.getBool("DEBUG", "sd_write_log", false);
{ LogToSD_SetBuffer(m_use_sd_logging);
WriteToSD = m_cfg.getBool("DEBUG", "sd_write_log", false); /* Init Network if wanted */
bufferMessages = WriteToSD; init_network = (m_cfg.getBool("GENERAL", "async_network") || has_enabled_providers() || m_use_wifi_gecko);
} if(init_network)
_netInit();
/* Check if we want a cIOS loaded */ /* Check if we want a cIOS loaded */
int ForceIOS = min(m_cfg.getInt("GENERAL", "force_cios_rev", 0), 254); int ForceIOS = min(m_cfg.getInt("GENERAL", "force_cios_rev", 0), 254);
if(ForceIOS > 0) if(ForceIOS > 0)
@ -525,7 +529,6 @@ void CMenu::cleanup()
CoverFlow.shutdown(); CoverFlow.shutdown();
wiiLightOff(); wiiLightOff();
_deinitNetwork();
Close_Inputs(); Close_Inputs();
LWP_MutexDestroy(m_mutex); LWP_MutexDestroy(m_mutex);
@ -534,6 +537,8 @@ void CMenu::cleanup()
cleaned_up = true; cleaned_up = true;
//gprintf(" \nMemory cleaned up\n"); //gprintf(" \nMemory cleaned up\n");
gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize()); gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
/* Lets deinit our possible wifi gecko here */
_deinitNetwork();
} }
void CMenu::_Theme_Cleanup(void) void CMenu::_Theme_Cleanup(void)
@ -637,15 +642,14 @@ void CMenu::_Theme_Cleanup(void)
theme.soundSet.clear(); theme.soundSet.clear();
} }
void CMenu::_reload_wifi_gecko(void) void CMenu::_netInit(void)
{
if(m_use_wifi_gecko)
{ {
if(!init_network)
return;
_initAsyncNetwork(); _initAsyncNetwork();
while(net_get_status() == -EBUSY) while(net_get_status() == -EBUSY)
usleep(100); usleep(100);
} }
}
void CMenu::_setAA(int aa) void CMenu::_setAA(int aa)
{ {

View File

@ -12,7 +12,8 @@
#include "channel/channels.h" #include "channel/channels.h"
#include "cheats/gct.h" #include "cheats/gct.h"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "gecko/wifi_gecko.hpp"
#include "gui/coverflow.hpp" #include "gui/coverflow.hpp"
#include "gui/cursor.hpp" #include "gui/cursor.hpp"
#include "gui/fanart.hpp" #include "gui/fanart.hpp"
@ -969,7 +970,9 @@ public:
void directlaunch(const char *GameID); void directlaunch(const char *GameID);
private: private:
bool m_use_wifi_gecko; bool m_use_wifi_gecko;
void _reload_wifi_gecko(); bool m_use_sd_logging;
bool init_network;
void _netInit();
bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file); bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file);
int _loadIOS(u8 ios, int userIOS, string id); int _loadIOS(u8 ios, int userIOS, string id);
void _launch(dir_discHdr *hdr); void _launch(dir_discHdr *hdr);

View File

@ -3,7 +3,6 @@
#include "defines.h" #include "defines.h"
#include "channel/channels.h" #include "channel/channels.h"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "gecko/gecko.h"
#include "loader/cios.h" #include "loader/cios.h"
#include "loader/nk.h" #include "loader/nk.h"

View File

@ -1,7 +1,6 @@
#include "menu.hpp" #include "menu.hpp"
#include "types.h" #include "types.h"
#include "gecko/gecko.h"
#include "loader/wbfs.h" #include "loader/wbfs.h"
#include "libwbfs/wiidisc.h" #include "libwbfs/wiidisc.h"

View File

@ -9,8 +9,6 @@
#include "lockMutex.hpp" #include "lockMutex.hpp"
#include "channel/nand.hpp" #include "channel/nand.hpp"
#include "devicemounter/usbstorage.h" #include "devicemounter/usbstorage.h"
#include "gecko/gecko.h"
#include "gecko/wifi_gecko.h"
#include "gui/GameTDB.hpp" #include "gui/GameTDB.hpp"
#include "gui/pngu.h" #include "gui/pngu.h"
#include "loader/fs.h" #include "loader/fs.h"
@ -413,17 +411,11 @@ s32 CMenu::_networkComplete(s32 ok, void *usrData)
if(wifigecko) if(wifigecko)
{ {
// Get ip const string &ip = m->m_cfg.getString("DEBUG", "wifi_gecko_ip");
std::string ip = m->m_cfg.getString("DEBUG", "wifi_gecko_ip");
u16 port = m->m_cfg.getInt("DEBUG", "wifi_gecko_port", 4405); u16 port = m->m_cfg.getInt("DEBUG", "wifi_gecko_port", 4405);
if(ip.size() > 0 && port != 0) if(ip.size() > 0 && port != 0)
{ WiFiDebugger.Init(ip.c_str(), port);
gprintf("NET: WIFI Gecko to %s:%d\n", ip.c_str(), port);
WifiGecko_Init(ip.c_str(), port);
} }
}
return 0; return 0;
} }

View File

@ -1,6 +1,5 @@
#include "menu.hpp" #include "menu.hpp"
#include "gecko/gecko.h"
extern const u8 error_png[]; extern const u8 error_png[];
s16 m_errorLblMessage; s16 m_errorLblMessage;

View File

@ -19,7 +19,6 @@
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "gc/gc.hpp" #include "gc/gc.hpp"
#include "gc/gcdisc.hpp" #include "gc/gcdisc.hpp"
#include "gecko/gecko.h"
#include "gui/WiiMovie.hpp" #include "gui/WiiMovie.hpp"
#include "gui/GameTDB.hpp" #include "gui/GameTDB.hpp"
#include "gui/Gekko.h" #include "gui/Gekko.h"
@ -951,7 +950,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id)
{ {
if(!loadIOS(gameIOS, false)) if(!loadIOS(gameIOS, false))
{ {
_reload_wifi_gecko(); _netInit();
error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS)); error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS));
return LOAD_IOS_FAILED; return LOAD_IOS_FAILED;
} }
@ -1011,7 +1010,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id)
gprintf("Reloading IOS into %d\n", gameIOS); gprintf("Reloading IOS into %d\n", gameIOS);
if(!loadIOS(gameIOS, true)) if(!loadIOS(gameIOS, true))
{ {
_reload_wifi_gecko(); _netInit();
error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS)); error(sfmt("errgame4", L"Couldn't load IOS %i", gameIOS));
return LOAD_IOS_FAILED; return LOAD_IOS_FAILED;
} }

View File

@ -20,7 +20,7 @@
#include "SoundHandler.hpp" #include "SoundHandler.hpp"
#include "list/ListGenerator.hpp" #include "list/ListGenerator.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define MUSIC_DEPTH 10 #define MUSIC_DEPTH 10
Musicplayer MusicPlayer; Musicplayer MusicPlayer;

View File

@ -31,7 +31,7 @@
#include "WavDecoder.hpp" #include "WavDecoder.hpp"
#include "AifDecoder.hpp" #include "AifDecoder.hpp"
#include "BNSDecoder.hpp" #include "BNSDecoder.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "memory/mem2.hpp" #include "memory/mem2.hpp"
SoundHandler SoundHandle; SoundHandler SoundHandle;

View File

@ -4,7 +4,7 @@
#include "gcard.h" #include "gcard.h"
#include "http.h" #include "http.h"
#include "loader/utils.h" #include "loader/utils.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#define MAX_URL_SIZE 178 // 128 + 48 + 6 #define MAX_URL_SIZE 178 // 128 + 48 + 6

View File

@ -5,7 +5,7 @@
#include <time.h> #include <time.h>
#include "http.h" #include "http.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
/** /**
* Emptyblock is a statically defined variable for functions to return if they are unable * Emptyblock is a statically defined variable for functions to return if they are unable

View File

@ -22,7 +22,7 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "gui/text.hpp" #include "gui/text.hpp"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
#include "devicemounter/PartitionHandle.h" #include "devicemounter/PartitionHandle.h"
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "types.h" #include "types.h"

View File

@ -21,7 +21,7 @@
#include <string.h> #include <string.h>
#include "ash.h" #include "ash.h"
#include "gecko/gecko.h" #include "gecko/gecko.hpp"
bool IsAshCompressed( const u8 *stuff, u32 len ) bool IsAshCompressed( const u8 *stuff, u32 len )
{ {