complete WifiGecko logging

(except for those messages, send prior to network init)
This commit is contained in:
Christopher Roy Bratusek 2012-08-30 00:33:05 +02:00
parent 72cc00dbdd
commit fcc18ae686
17 changed files with 103 additions and 58 deletions

Binary file not shown.

View File

@ -16,7 +16,7 @@
#include "Tools/parser.h"
#include "Tools/SelectIos.h"
#include "Neek/uneek_fs.h"
#include "gecko.h"
#include "xprintf.h"
#include "ahbfix.h"
#define BLOCKSIZE 70*1024 //70KB
@ -211,7 +211,7 @@ int BootHomebrew()
asize = strlen(abuf);
while (asize != 0)
{
gprintf("argument = %s\n",abuf);
xprintf("argument = %s\n",abuf);
arg_add(abuf);
abuf+=asize;
abuf+=1;
@ -243,29 +243,41 @@ int BootHomebrew()
if (in_neek == false)
{
xprintf("Booting Homebrew");
if(wiiload)
{
xprintf(" via wiiload\n");
if(Options.wiiload_ahb == 2)
{
xprintf("with HW_AHBPROT\n");
Patch_ahbprot();
}
if(Options.wiiload_ahb != 0)
{
xprintf("with IOS reload\n");
IOS_ReloadIOS(Options.wiiload_ios);
}
else
xprintf("without reloading IOS\n");
}
else
{
xprintf(" from storage device\n");
if(Settings.force_reload == "HW_AHBPROT")
{
xprintf("with HW_AHBPROT\n");
Patch_ahbprot();
}
if(Settings.force_reload != "NORELOAD")
{
xprintf("with IOS reload\n");
IOS_ReloadIOS(SelectedIOS());
}
else
xprintf("without IOS reload\n");
}
}
@ -301,6 +313,9 @@ int BootGameCubeHomebrew()
if(homebrewsize == 0)
return -1;
xprintf("Booting GC Homebrew\n");
xprintf("if it fails, install correct cMIOS!\n");
static tikview view ATTRIBUTE_ALIGN(32);
DI2_Init();

View File

@ -12,6 +12,7 @@
#include "Network/update.h"
#include "Network/tcp.h"
#include "Network/wifi_gecko.h"
#include "xprintf.h"
/*** Extern variables ***/
extern GuiWindow * mainWindow;
@ -662,14 +663,17 @@ int MenuMain()
if(boot_buffer)
menu = MENU_EXIT;
if(!first && Options.wifigecko)
if(!first)
{
WifiGecko_Connect();
wifi_printf("The HomebrewFilter rev%i\n", SvnRev());
usleep(500);
wifi_printf("= == == == == == == == =\n");
usleep(500);
wifi_printf(" Wifi Gecko connected.");
if(Options.wifigecko)
WifiGecko_Connect();
xprintf("The HomebrewFilter rev%i\n", SvnRev());
usleep(1000);
xprintf("= == == == == == == == =\n");
usleep(1000);
xprintf(" Wifi Gecko connected.\n\n");
first = true;
}

View File

@ -7,7 +7,7 @@
#include <dirent.h>
#include "uneek_fs.h"
#include "../gecko.h"
#include "xprintf.h"
#include "common.h"
struct SSettingsNeek2o n2oSettings;
@ -69,7 +69,7 @@ int boot_neek2o()
}
if(kpath[0] != 0)
{
gprintf ("Booting neek...\n");
xprintf ("Booting neek...\n");
//check if it's sneek or uneek
if (n2oSettings.neeknandpath[0] == 0)
{
@ -92,21 +92,21 @@ int boot_neek2o()
{
if (n2oSettings.neeknandpath[0] == 0)
{
gprintf("Warning:bootneek.xml not found\n");
xprintf("Warning:bootneek.xml not found\n");
}
else
{
gprintf("Warning:bootneek.xml contains an invalid nandpath\n");
xprintf("Warning:bootneek.xml contains an invalid nandpath\n");
}
}
if (nresult == -2)
{
gprintf("Will use nandcfg.bin nand or rootnand instead\n");
xprintf("Will use nandcfg.bin nand or rootnand instead\n");
}
if (nresult == -3)
{
//we might still check if nandpath.bin contains a valid nandpath
gprintf("Will use nandpath.bin instead\n");
xprintf("Will use nandpath.bin instead\n");
}
//if a specific dipath is requested, let's generate the file
if (n2oSettings.neekdipath[0] != 0)
@ -119,12 +119,12 @@ int boot_neek2o()
nresult = set_neek_channel();
if (nresult == -2)
{
gprintf("Error: could not create /sys/launch.sys\n");
gprintf("Unable to boot the neek with the requested startup channel\n");
xprintf("Error: could not create /sys/launch.sys\n");
xprintf("Unable to boot the neek with the requested startup channel\n");
}
if (nresult == -3)
{
gprintf("Error: could not locate the requested neek startup channel on the nand\n");
xprintf("Error: could not locate the requested neek startup channel on the nand\n");
}
if (nresult == 1)
{
@ -141,7 +141,7 @@ int boot_neek2o()
}
else
{
gprintf("ERROR:unable to load kernel.bin\n");
xprintf("ERROR:unable to load kernel.bin\n");
}
}
else
@ -151,8 +151,8 @@ int boot_neek2o()
}
else
{
gprintf("couldn't find sneek2o or uneek2o\n");
xprintf("couldn't find sneek2o or uneek2o\n");
ExitApp();
}
return false;
}
}

View File

@ -8,6 +8,7 @@
#include <malloc.h>
#include "uneek_fs.h"
#include "gecko.h"
#include "Network/wifi_gecko.h"
#include "armboot.h"
//#include "../build/kernel_bin.h"
@ -33,6 +34,7 @@ void DoMini(u8* kbuf, size_t kernel_size)
return;
}
gprintf( "mini buffer: %p\n", mini );
wifi_printf( "mini buffer: %p\n", mini );
// memcpy( mini, kernel_bin,KERNEL_SIZE);
@ -47,6 +49,7 @@ void DoMini(u8* kbuf, size_t kernel_size)
DCFlushRange( mini+kernel_size+4, armboot_size );
gprintf( "armboot.bin copied\n" );
wifi_printf( "armboot.bin copied\n" );
*(u32*)0xc150f000 = 0x424d454d;
asm volatile( "eieio" );
@ -58,6 +61,8 @@ void DoMini(u8* kbuf, size_t kernel_size)
gprintf( "physical memory address: %08x\n", MEM_VIRTUAL_TO_PHYSICAL( mini ) );
gprintf( "loading bootmii IOS\n" );
wifi_printf( "physical memory address: %08x\n", MEM_VIRTUAL_TO_PHYSICAL( mini ) );
wifi_printf( "loading bootmii IOS\n" );
// pass position of kernel.bin to mini
@ -75,6 +80,7 @@ void DoMini(u8* kbuf, size_t kernel_size)
IOS_ReloadIOS( 0xfe );
gprintf( "well shit. this shouldnt happen\n" );
wifi_printf( "well shit. this shouldnt happen\n" );
free( mini );
}

View File

@ -81,6 +81,7 @@ distribution.
#ifdef SHOW_GECKO_DEBUG
#include "gecko.h"
#include "Network/wifi_gecko.h"
#endif
#define MAX_READ_SECTORS 16 //yet to be determined how much is allowed?
@ -619,6 +620,7 @@ bool WII_Launch_Channel(char* which)
{
#ifdef SHOW_GECKO_DEBUG
gprintf("Title %s has an invalid length\n",which);
wifi_printf("Title %s has an invalid length\n",which);
#endif
return false;
}
@ -641,8 +643,10 @@ bool WII_Launch_Channel(char* which)
title_id = title_id + (u64)(titlelsb);
#ifdef SHOW_GECKO_DEBUG
gprintf( "titleid = %08x %08x\r\n", (u32)((title_id)>>32), (u32)(title_id) );
wifi_printf( "titleid = %08x %08x\r\n", (u32)((title_id)>>32), (u32)(title_id) );
s32 lret = WII_LaunchTitle(title_id);
gprintf("WII_LaunchTitle returned %d\r\n",lret);
wifi_printf("WII_LaunchTitle returned %d\r\n",lret);
#else
WII_LaunchTitle(title_id);
#endif

View File

@ -9,7 +9,7 @@
#include <malloc.h>
#include "common.h"
#include "gecko.h"
#include "Network/wifi_gecko.h"
extern struct SSettingsNeek2o n2oSettings;
@ -263,6 +263,7 @@ s32 set_neek_channel(void)
stitlexsb[17]= 0;
strcat(titlefolder,stitlexsb);
gprintf("Titlefolder = %s\n",titlefolder);
wifi_printf("Titlefolder = %s\n",titlefolder);
if (DirExist(titlefolder))
{
//calculate the channel for storage in launch.sys
@ -275,6 +276,7 @@ s32 set_neek_channel(void)
title = (u64)(titlemsb) << 32;
title = title + (u64)(titlelsb);
gprintf( "titleid = %08x %08x\r\n", (u32)((title)>>32), (u32)(title) );
wifi_printf( "titleid = %08x %08x\r\n", (u32)((title)>>32), (u32)(title) );
fp = fopen(launchfile, "wb");
if(fp)
{

View File

@ -9,7 +9,7 @@
#include "main.h"
#include "BootHomebrew/BootHomebrew.h"
#include "Prompts/prompts.h"
#include "gecko.h"
#include "xprintf.h"
#define READ_SIZE (1 << 10)
@ -67,7 +67,7 @@ int oport(unsigned short portnum)
sa.sin_len = 8;
if ((s= net_socket(AF_INET, SOCK_STREAM, 0)) < 0) /* create socket */
{
gprintf("net_socket failed\n");
xprintf("net_socket failed\n");
return(-1);
}
@ -75,7 +75,7 @@ int oport(unsigned short portnum)
err = net_setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&one, sizeof(one));
if (err < 0)
{
gprintf("net_setsockopt SO_REUSEADDR error");
xprintf("net_setsockopt SO_REUSEADDR error");
return (-1);
}
@ -96,7 +96,7 @@ int oport(unsigned short portnum)
/*
u32 buflen = 8;
int t = net_accept(s,(struct sockaddr *)&sa, &buflen);
gprintf("Dummy net_accept returned %d\n",t);
xprintf("Dummy net_accept returned %d\n",t);
*/
return(s);
@ -142,7 +142,7 @@ int read_data(int s, /* connected socket */
}
else if (br < 0) /* signal an error to the caller */
{
gprintf("NetRead failure\n");
xprintf("NetRead failure\n");
return br;
}
}
@ -192,7 +192,7 @@ static void * tcp_callback(void *arg)
// Waiting for connection
client = get_connection(listen, &addr);
gprintf("After get_connection\n");
xprintf("After get_connection\n");
if(client > 0)
{
// client connected
@ -221,7 +221,7 @@ static void * tcp_callback(void *arg)
//wait 2 milliseconds hopefully fixes the error we see
//usleep (100000);
gprintf("reading protocol id\n");
xprintf("reading protocol id\n");
int temp = read_data(client, (char *)&read, 4);
if(temp < 0)
{
@ -245,7 +245,7 @@ static void * tcp_callback(void *arg)
compress = true;
//printf("HAXX\n");
gprintf("reading version\n");
xprintf("reading version\n");
read_data(client, (char *)&read, 4);
/*int WIILOAD_VERSION_MAYOR = (u8)(((u16)(read >> 16)) >> 8);
int WIILOAD_VERSION_MINOR = (u8)(((u16)(read >> 16)) & 0xFF);
@ -256,10 +256,10 @@ static void * tcp_callback(void *arg)
printf("args %x08\n", read);
printf("args a=%x b=%x\n", a, b);*/
gprintf("reading size\n");
xprintf("reading size\n");
read_data(client, (char *)&size, 4);
gprintf("reading uncompressed size\n");
xprintf("reading uncompressed size\n");
read_data(client, (char *)&uncfilesize, 4);
}
else
@ -268,7 +268,7 @@ static void * tcp_callback(void *arg)
offset = 0;
while(offset < size && (read = read_data(client, (char *)bfr, (size - offset) > READ_SIZE ? READ_SIZE : (size - offset))) > 0)
{
gprintf("finished reading block at offset %x\n",offset);
//xprintf("finished reading block at offset %x\n",offset);
memcpy(data + offset, bfr, READ_SIZE);
offset += read;
@ -283,7 +283,7 @@ static void * tcp_callback(void *arg)
// These are the arguments....
int ret = NetRead(client, (u8 *) Argtemp, 1023, 250);
Argtemp[ret] = 0;
//gprintf("all arguments = %s\n",Argtemp);
//xprintf("all arguments = %s\n",Argtemp);
if (ret > 2 && Argtemp[ret - 1] == '\0' && Argtemp[ret - 2] == '\0') // Check if it is really an arg
{
CopyArgs((u8*)(Argtemp),ret);

View File

@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
#include <network.h>
#include "xprintf.h"
#define DESTINATION_IP "10.0.0.6"
#define DESTINATION_PORT 4405

View File

@ -10,7 +10,7 @@
#include "main.h"
#include "BootHomebrew/BootHomebrew.h"
#include "Prompts/prompts.h"
#include "gecko.h"
#include "xprintf.h"
#define READ_SIZE (1 << 10)
@ -54,7 +54,7 @@ int read_gecko_data(int s, /* connected socket */
}
else if (br < 0) /* signal an error to the caller */
{
gprintf("GeckoRead failure\n");
xprintf("GeckoRead failure\n");
return br;
}
if (ticks_to_millisecs(gettime()) > t)
@ -104,12 +104,12 @@ static void * gecko_l_callback(void *arg)
}
else
{
//gprintf("wiiload_gecko thread running\n");
//xprintf("wiiload_gecko thread running\n");
int temp = usb_recvbuffer_safe_ex(channel,(char *)&read,4,100);
if(temp == 4)
{
gprintf("4 bytes received from usb buffer\n");
xprintf("4 bytes received from usb buffer\n");
GuiImage * progressImg = new GuiImage(new GuiImageData(Theme.progress));
progressImg->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -144,7 +144,7 @@ static void * gecko_l_callback(void *arg)
compress = true;
// printf("HAXX\n");
gprintf("reading version\n");
xprintf("reading version\n");
read_gecko_data(channel, (char *)&read, 4,1000);
// int WIILOAD_VERSION_MAYOR = (u8)(((u16)(read >> 16)) >> 8);
@ -156,11 +156,11 @@ static void * gecko_l_callback(void *arg)
// printf("args %x08\n", read);
// printf("args a=%x b=%x\n", a, b);
gprintf("reading size\n");
xprintf("reading size\n");
read_gecko_data(channel, (char *)&size, 4, 1000);
gprintf("reading uncompressed size\n");
xprintf("reading uncompressed size\n");
read_gecko_data(channel, (char *)&uncfilesize, 4, 1000);
}
@ -170,7 +170,7 @@ static void * gecko_l_callback(void *arg)
offset = 0;
while(offset < size && (read = read_gecko_data(channel, (char *)bfr, (size - offset) > READ_SIZE ? READ_SIZE : (size - offset), 2000)) > 0)
{
gprintf("finished reading block at offset %x\n",offset);
xprintf("finished reading block at offset %x\n",offset);
memcpy(gdata + offset, bfr, READ_SIZE);
offset += read;
@ -187,12 +187,12 @@ static void * gecko_l_callback(void *arg)
// These are the arguments....
tms = ticks_to_millisecs(gettime());
gprintf("timer1 = %d\n",tms);
xprintf("timer1 = %d\n",tms);
int ret = read_gecko_data(channel, (char *) (GArgtemp), 1023, 1000);
tms = ticks_to_millisecs(gettime());
gprintf("timer2 = %d\n",tms);
xprintf("timer2 = %d\n",tms);
GArgtemp[ret] = 0;
//gprintf("all arguments = %s\n",GArgtemp);
//xprintf("all arguments = %s\n",GArgtemp);
if (ret > 2 && GArgtemp[ret - 1] == '\0' && GArgtemp[ret - 2] == '\0') // Check if it is really an arg
{
CopyArgs((u8*)(GArgtemp),ret);
@ -254,7 +254,7 @@ static void * gecko_l_callback(void *arg)
else
{
usleep(250 * 1000);
//gprintf(".");
//xprintf(".");
}
}
}

View File

@ -4,7 +4,7 @@
#include <string.h>
#include <unistd.h>
#include "gecko.h"
#include "Network/wifi_gecko.h"
#include "RuntimeIOSPatch.h"
#define MEM_PROT 0xD8B420A
@ -32,6 +32,7 @@ const u8 addticket_patch[] = { 0xE0 };
u32 apply_patch(const char *name, const u8 *old, u32 old_size, const u8 *patch, u32 patch_size, u32 patch_offset)
{
gprintf("Applying patch %s.....", name);
wifi_printf("Applying patch %s.....", name);
u8 *ptr = (u8 *) 0x93400000;
u32 i, found = 0;
u8 *start;
@ -51,9 +52,15 @@ u32 apply_patch(const char *name, const u8 *old, u32 old_size, const u8 *patch,
}
if(found)
{
gprintf("Patched\n");
wifi_printf("Patched\n");
}
else
{
gprintf("\n");
wifi_printf("\n");
}
return found;
}

View File

@ -7,7 +7,7 @@
#include "main.h"
#include "filelist.h"
#include "Neek/uneek_fs.h"
#include "gecko.h"
#include "xprintf.h"
using namespace std;

View File

@ -1,7 +1,7 @@
#include "main.h"
#include <dirent.h>
#include <sstream>
#include "gecko.h"
#include "xprintf.h"
extern const u8 banner_bin[];
extern const u32 banner_bin_size;
@ -132,7 +132,7 @@ void save()
}
else
{
gprintf("ERROR: ISFS: opening %s failed\n", Settings.settings_dat.c_str());
xprintf("ERROR: ISFS: opening %s failed\n", Settings.settings_dat.c_str());
}
ISFS_Close(file);

View File

@ -28,7 +28,7 @@ distribution.
#include <string.h>
#include <gccore.h>
#include <ogc/machine/processor.h>
#include "gecko.h"
#include "xprintf.h"
#include "Tools/load_channel.h"
#include "filelist.h"
@ -52,7 +52,7 @@ s32 Patch_ahbprot(void)
if (read32(CHECK_AHB) != 0xffffffff)
{
gprintf("AHBPROT doesn't seem to be disabled.\n");
xprintf("AHBPROT doesn't seem to be disabled.\n");
return false;
}
else
@ -63,7 +63,7 @@ s32 Patch_ahbprot(void)
{
if (!memcmp(patchme, ticket_check, sizeof(ticket_check)))
{
gprintf("Found TMD Access rights check at %p\n", patchme);
xprintf("Found TMD Access rights check at %p\n", patchme);
// write16/uncached poke doesn't work for this. Go figure.
patchme[4] = 0x23FF; // li r3, 0xFF
DCFlushRange(patchme+4, 2);

View File

@ -3,6 +3,7 @@
#include <string.h>
#include <malloc.h>
#include <sys/iosupport.h>
#include "xprintf.h"
/* init-globals */
static bool geckoinit = false;

View File

@ -36,6 +36,7 @@
#include "BootHomebrew/dolloader.h"
#include "DiskOperations/di2.h"
#include "gecko.h"
#include "xprintf.h"
#include "Network/wiiload_gecko.h"
#include "Neek/uneek_fs.h"
#include "Neek/bootneek.h"
@ -98,7 +99,7 @@ void addAppIos(string foldername, int ios)
void ExitApp()
{
gprintf("Running ExitApp()\n");
xprintf("Running ExitApp()\n");
ShutdownPads();
StopGX();
save();
@ -109,7 +110,7 @@ void ExitApp()
static void WiiResetPressed()
{
gprintf("Reset button pressed \n");
xprintf("Reset button pressed \n");
runaway = true;
PowerOff = SYS_RETURNTOMENU;
}
@ -118,7 +119,7 @@ static void WiiPowerPressed()
{
if(runaway == false)
{
gprintf("Power button pressed \n");
xprintf("Power button pressed \n");
runaway = true;
PowerOff = SYS_POWEROFF_STANDBY;
}
@ -232,7 +233,7 @@ main(int argc, char *argv[])
}
else
{
gprintf("Warning: no AHBPROT\n");
xprintf("Warning: no AHBPROT\n");
}
}
DI2_Init(); // Init DVD

View File

@ -1,8 +1,12 @@
//rev41:
- fixed auto-connecting Internet via WiFi
- basic support for WifiGecko
* only connection message is shown currently
* most messages are shown via WifiGecko
those that are sent prior to network initialization
will be missing
* option to en/disable WifiGecko (settings->network)
if enabled messages will be send via WifiGecko,
elese via USB Gecko (if one is plugged in)
* no option yet to change IP and Port
* also works via LAN