git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@46 7061adef-622a-194b-ae81-725974e89856

This commit is contained in:
miya 2008-11-11 00:04:32 +00:00
parent f1ae04cfdf
commit 2a832f393b
10 changed files with 364 additions and 257 deletions

View File

@ -26,6 +26,30 @@
#include <twl/os/common/ownerInfoEx.h>
#if 0
typedef struct LCFGTWLTPCalibData
{
LCFGNTRTPCalibData data; // TPキャリブレーションデータ
u8 rsv[ 8 ];
} LCFGTWLTPCalibData; // 20 bytes
// タッチパネルキャリブレーションデータ
typedef struct LCFGNTRTPCalibData
{
u16 raw_x1; // 第キャリブレーション点のTP取得値X
u16 raw_y1; // 〃 TP取得値Y
u8 dx1; // 〃 LCD座標 X
u8 dy1; // 〃 LCD座標 Y
u16 raw_x2; // 第キャリブレーション点のTP取得値X
u16 raw_y2; // 〃 TP取得値Y
u8 dx2; // 〃 LCD座標 X
u8 dy2; // 〃 LCD座標 Y
} LCFGNTRTPCalibData; // 12byte
#endif
#define OS_ADDR_TWL_SETTINGSDATA ( (OSTWLSettingsData *)HW_PARAM_TWL_SETTINGS_DATA )
void WLAN_FORCE_ON(void)
@ -164,6 +188,31 @@ BOOL MiyaBackupTWLSettings(const char *path)
return TRUE;
}
void MiyaReadTpCalData(void)
{
LCFGTWLSettingsData cfg_data;
LCFGTWLTPCalibData tp_cal_data;
if( FALSE == ReadTWLSettings( &cfg_data ) ) {
mprintf("Failed read TWLSettings 3.\n" );
}
/* とりあえず別でTPキャリブレーションデータだけ置いとく */
LCFG_TSD_GetTPCalibration( &tp_cal_data );
OS_TPrintf("tp. raw_x1 = %d\n",tp_cal_data.data.raw_x1);
OS_TPrintf("tp.raw_y1 = %d\n",tp_cal_data.data.raw_y1);
OS_TPrintf("tp.dx1 = %d\n",tp_cal_data.data.dx1);
OS_TPrintf("tp.dy1 = %d\n",tp_cal_data.data.dy1);
OS_TPrintf("tp.raw_x2 = %d\n",tp_cal_data.data.raw_x2);
OS_TPrintf("tp.raw_y2 = %d\n",tp_cal_data.data.raw_y2);
OS_TPrintf("tp.dx2 = %d\n",tp_cal_data.data.dx2);
OS_TPrintf("tp.dy2 = %d\n",tp_cal_data.data.dy2);
}
BOOL MiyaRestoreTWLSettings(const char *path)
{
FSFile f;
@ -173,6 +222,7 @@ BOOL MiyaRestoreTWLSettings(const char *path)
LCFGTWLSettingsData cfg_data;
LCFGReadResult retval;
LCFGTWLTPCalibData tp_cal_data;
BOOL tp_over_write_flag = TRUE;
retval = LCFGi_THW_ReadSecureInfo();
if( retval != LCFG_TSF_READ_RESULT_SUCCEEDED ) {
@ -188,6 +238,16 @@ BOOL MiyaRestoreTWLSettings(const char *path)
/* とりあえず別でTPキャリブレーションデータだけ置いとく */
LCFG_TSD_GetTPCalibration( &tp_cal_data );
if( (tp_cal_data.data.raw_x1 == 0 )
&& (tp_cal_data.data.raw_y1 == 0 )
&& (tp_cal_data.data.dx1 == 0 )
&& (tp_cal_data.data.dy1 == 0 )
&& (tp_cal_data.data.raw_x2 == 0 )
&& (tp_cal_data.data.raw_y2 == 0 )
&& (tp_cal_data.data.dx2 == 0 )
&& (tp_cal_data.data.dy2 == 0 ) ) {
tp_over_write_flag = FALSE;
}
FS_InitFile(&f);
@ -214,8 +274,10 @@ BOOL MiyaRestoreTWLSettings(const char *path)
return FALSE;
}
/* さっき置いといたTPキャリブレーションデータを上書き */
STD_CopyMemory( (void *)&cfg_data.tp, (void *)&tp_cal_data ,sizeof(LCFGTWLTPCalibData) );
if( tp_over_write_flag != FALSE ) {
/* さっき置いといたTPキャリブレーションデータを上書き */
STD_CopyMemory( (void *)&cfg_data.tp, (void *)&tp_cal_data ,sizeof(LCFGTWLTPCalibData) );
}
/* 実際に書き出し */
if( FALSE == WriteTWLSettings( &cfg_data ) ) {

View File

@ -42,6 +42,7 @@ BOOL MiyaReadHWNormalInfo( LCFGTWLHWNormalInfo *Info );
BOOL MiyaReadHWSecureInfo( LCFGTWLHWSecureInfo *Info );
BOOL MiyaReadHWNormalInfo_From_SD(const char *path, LCFGTWLHWNormalInfo *info);
void WLAN_FORCE_ON(void);
void MiyaReadTpCalData(void);
#if 0
typedef struct LCFGTWLHWNormalInfo

View File

@ -1769,7 +1769,7 @@ BOOL MydataLoadDecrypt(const char *path, void *pBuffer, int size, FSFile *log_fd
}
readSize = my_fs_crypto_read(&f, pBuffer, (s32)size);
if( readSize != size ) {
miya_log_fprintf(log_fd, "Failed Read File: %s\n",path);
miya_log_fprintf(log_fd, "%s Failed Read File: %s\n",__FUNCTION__,path);
}
bSuccess = FS_CloseFile(&f);
if( ! bSuccess ) {
@ -1782,7 +1782,6 @@ BOOL MydataLoadDecrypt(const char *path, void *pBuffer, int size, FSFile *log_fd
BOOL MydataSaveEncrypt(const char *path, void *pData, int size, FSFile *log_fd)
{
#pragma unused(log_fd)
FSFile f;
// BOOL flag;
BOOL bSuccess;
@ -1798,8 +1797,8 @@ BOOL MydataSaveEncrypt(const char *path, void *pData, int size, FSFile *log_fd)
bSuccess = FS_OpenFileEx(&f, path , FS_FILEMODE_W );
if( ! bSuccess ) {
res = FS_GetArchiveResultCode( path );
miya_log_fprintf(NULL, "%s file open error %s\n", __FUNCTION__,path );
miya_log_fprintf(NULL, " Failed open file:%s\n", my_fs_util_get_fs_result_word( res ));
miya_log_fprintf(log_fd, "%s file open error %s\n", __FUNCTION__,path );
miya_log_fprintf(log_fd, " Failed open file:%s\n", my_fs_util_get_fs_result_word( res ));
return FALSE;
}
}
@ -1810,6 +1809,7 @@ BOOL MydataSaveEncrypt(const char *path, void *pData, int size, FSFile *log_fd)
writtenSize = my_fs_crypto_write(&f, pData, (s32)size);
if( writtenSize != size ) {
miya_log_fprintf(log_fd, "%s Failed Write File: %s\n",__FUNCTION__,path);
return FALSE;
}
@ -1856,7 +1856,6 @@ BOOL MydataLoad(const char *path, void *pBuffer, int size, FSFile *log_fd)
#if 0
BOOL MydataSave(const char *path, void *pData, int size, FSFile *log_fd)
{
#pragma unused(log_fd)
FSFile f;
// BOOL flag;
@ -2141,26 +2140,36 @@ BOOL SDCardValidation(void)
BOOL CheckShopRecord(FSFile *log_fd)
{
#pragma unused(log_fd)
FSFile f;
#if 0
FSResult res;
#endif
BOOL ret_flag = TRUE;
BOOL bSuccess;
char path[64];
s32 readSize = 0;
/* "nand:/sys/log/shop.log */
miya_log_fprintf(log_fd, "%s START\n", __FUNCTION__);
FS_InitFile(&f);
STD_StrCpy(path, "nand:/sys/dev.kp");
// STD_StrCpy(path, "nand:/sys/dev.kp");
STD_StrCpy(path, "nand:/sys/log/shop.log");
/*
shop.logは
*/
bSuccess = FS_OpenFileEx(&f, path, (FS_FILEMODE_R));
if( ! bSuccess ) {
if( FS_RESULT_NO_ENTRY == FS_GetArchiveResultCode(path) ) {
/* キーペアファイルがない */
/* Shopログファイルがない */
ret_flag = FALSE;
miya_log_fprintf(log_fd, "No key pair file\n");
// miya_log_fprintf(log_fd, "No key pair file\n");
miya_log_fprintf(log_fd, "No shop log file\n");
}
}
else {
@ -2224,7 +2233,6 @@ BOOL CheckShopRecord(FSFile *log_fd)
ret_flag = FALSE;
}
miya_log_fprintf(log_fd, "\n");
#endif
if( ret_flag == TRUE ) {
bSuccess = FS_OpenFileEx(&f, path, (FS_FILEMODE_R));
@ -2238,6 +2246,8 @@ BOOL CheckShopRecord(FSFile *log_fd)
}
(void)FS_CloseFile(&f);
}
#endif
miya_log_fprintf(log_fd, "%s END\n\n", __FUNCTION__);
return ret_flag;

View File

@ -3,7 +3,7 @@
#define MY_DATA_VERSION_MAJOR 0
#define MY_DATA_VERSION_MINOR 6
#define MY_DATA_VERSION_MINOR 7
typedef struct {
u8 version_major;

View File

@ -1,4 +1,9 @@
#include <twl.h>
#include <twl/nam.h>
#include <nitro/fs.h>
#include "ecdl.h"
#include <twl/sea.h>
#include <twl/lcfg.h>
#include <twl/na.h>
@ -473,6 +478,7 @@ static char CheckRegistration()
s32 progress;
ECError ecError;
ECDeviceInfo di;
BOOL printf_status_flag = FALSE;
//ECDL_LOG("check registeration");
progress = EC_CheckRegistration();
@ -486,39 +492,63 @@ static char CheckRegistration()
return '\0'; // 微妙・・
}
#ifdef SDK_DEBUG
switch( di.registrationStatus[0] ) {
case '\0':
// mprintf(" my error.\n");
printf_status_flag = TRUE;
break;
case 'U':
// mprintf(" acount not transfered yet,\n");
// mprintf(" OR, acount already cleared\n\n");
printf_status_flag = TRUE;
break;
case 'R':
// mprintf(" already registered. please delete acount.\n");
printf_status_flag = TRUE;
break;
case 'P':
case 'T':
// mprintf(" invalid registration status '%c'\n", status );
printf_status_flag = TRUE;
break;
default:
break;
}
if( printf_status_flag == TRUE ) {
#define ECDL_DI_FMT "%-30s"
OS_TPrintf(ECDL_DI_FMT " %d\n", "isKeyPairConfirmed", di.isKeyPairConfirmed);
OS_TPrintf(ECDL_DI_FMT " %d\n", "deviceId", di.deviceId);
OS_TPrintf(ECDL_DI_FMT " %s\n", "serial", di.serial);
OS_TPrintf(ECDL_DI_FMT " %s\n", "originalSerial", di.originalSerial);
OS_TPrintf(ECDL_DI_FMT " %s\n", "accountId", di.accountId);
OS_TPrintf(ECDL_DI_FMT " %s\n", "registrationStatus", di.registrationStatus);
OS_TPrintf(ECDL_DI_FMT " %s\n", "extAccountId", di.extAccountId);
OS_TPrintf(ECDL_DI_FMT " %s\n", "country", di.country);
OS_TPrintf(ECDL_DI_FMT " %s\n", "accountCountry", di.accountCountry);
OS_TPrintf(ECDL_DI_FMT " %s\n", "region", di.region);
OS_TPrintf(ECDL_DI_FMT " %s\n", "language", di.language);
OS_TPrintf(ECDL_DI_FMT " %d\n", "blockSize", di.blockSize);
OS_TPrintf(ECDL_DI_FMT " %d\n", "usedBlocks", di.usedBlocks);
OS_TPrintf(ECDL_DI_FMT " %d\n", "totalBlocks", di.totalBlocks);
OS_TPrintf(ECDL_DI_FMT " %d\n", "netContentRestrictions", di.netContentRestrictions);
OS_TPrintf(ECDL_DI_FMT " %d\n", "userAge", di.userAge);
OS_TPrintf(ECDL_DI_FMT " %d\n", "parentalControlFlags", di.parentalControlFlags);
OS_TPrintf(ECDL_DI_FMT " %d\n", "parentalControlOgn", di.parentalControlOgn);
OS_TPrintf(ECDL_DI_FMT " %d\n", "isParentalControlEnabled", di.isParentalControlEnabled);
OS_TPrintf(ECDL_DI_FMT " %d\n", "isNeedTicketSync", di.isNeedTicketSync);
OS_TPrintf(ECDL_DI_FMT " %d\n", "lastTicketSyncTime", di.lastTicketSyncTime);
OS_TPrintf(ECDL_DI_FMT " %d\n", "wirelessMACAddr", di.wirelessMACAddr);
OS_TPrintf(ECDL_DI_FMT " %d\n", "bluetoothMACAddr", di.bluetoothMACAddr);
OS_TPrintf(ECDL_DI_FMT " %d\n", "titleId", di.titleId);
OS_TPrintf(ECDL_DI_FMT " %d\n", "freeChannelAppCount", di.freeChannelAppCount);
OS_TPrintf(ECDL_DI_FMT " %d\n", "usedUserInodes", di.usedUserInodes);
OS_TPrintf(ECDL_DI_FMT " %d\n", "maxUserInodes", di.maxUserInodes);
OS_TPrintf(ECDL_DI_FMT " %s\n", "deviceCode", di.deviceCode);
OS_TPrintf(ECDL_DI_FMT " %s\n", "accountDeviceCode", di.accountDeviceCode);
OS_TPrintf(ECDL_DI_FMT " %d\n", "isNeedTicketSyncImportAll", di.isNeedTicketSyncImportAll);
#endif
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "isKeyPairConfirmed", di.isKeyPairConfirmed);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "deviceId", di.deviceId);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "serial", di.serial);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "originalSerial", di.originalSerial);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "accountId", di.accountId);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "registrationStatus", di.registrationStatus);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "extAccountId", di.extAccountId);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "country", di.country);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "accountCountry", di.accountCountry);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "region", di.region);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "language", di.language);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "blockSize", di.blockSize);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "usedBlocks", di.usedBlocks);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "totalBlocks", di.totalBlocks);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "netContentRestrictions", di.netContentRestrictions);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "userAge", di.userAge);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "parentalControlFlags", di.parentalControlFlags);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "parentalControlOgn", di.parentalControlOgn);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "isParentalControlEnabled", di.isParentalControlEnabled);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "isNeedTicketSync", di.isNeedTicketSync);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "lastTicketSyncTime", di.lastTicketSyncTime);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "wirelessMACAddr", di.wirelessMACAddr);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "bluetoothMACAddr", di.bluetoothMACAddr);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "titleId", di.titleId);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "freeChannelAppCount", di.freeChannelAppCount);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "usedUserInodes", di.usedUserInodes);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "maxUserInodes", di.maxUserInodes);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "deviceCode", di.deviceCode);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %s\n", "accountDeviceCode", di.accountDeviceCode);
miya_log_fprintf(log_fd, ECDL_DI_FMT " %d\n", "isNeedTicketSyncImportAll", di.isNeedTicketSyncImportAll);
}
return di.registrationStatus[0];
}
@ -674,35 +704,36 @@ int ECDownload(const NAMTitleId* pTitleIds, u32 numTitleIds)
return ECDOWNLOAD_FAILURE;
}
else if( status == 'U') {
miya_log_fprintf(log_fd, "OK.\n");
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
mprintf("OK.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
miya_log_fprintf(log_fd, "NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_YELLOW );
mprintf(" acount not transfered yet,\n");
mprintf(" OR, acount already cleared\n\n");
mprintf(" acount not transfered yet.\n");
// mprintf(" OR, acount already cleared\n\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
miya_log_fprintf(log_fd, " acount not transfered yet.\n");
miya_log_fprintf(log_fd, " OR acount already cleared by user.\n");
// miya_log_fprintf(log_fd, " OR acount already cleared by user.\n");
// 「ご利用記録の削除」をした場合、ここでエラーになる。
// ここでOKにする?
return ECDOWNLOAD_NO_REGISTER;
return ECDOWNLOAD_FAILURE;
// return ECDOWNLOAD_NO_REGISTER;
}
else if( status == 'R') {
miya_log_fprintf(log_fd, "NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_YELLOW );
mprintf(" already registered. please delete acount.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
mprintf(" already registered. please delete acount.\n");
miya_log_fprintf(log_fd, " already registered. please delete acount.\n");
miya_log_fprintf(log_fd, " already registered. please delete acount.\n");
return ECDOWNLOAD_FAILURE;
}
else if( (status != 'P') && (status != 'T') ) {
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_YELLOW );
mprintf(" invalid registration status '%c'\n", status );
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
mprintf(" invalid registration status '%c'\n", status );
miya_log_fprintf(log_fd, " invalid registration status '%c'\n", status );
return ECDOWNLOAD_FAILURE;
}

View File

@ -8,7 +8,7 @@ extern "C" {
#define ECDOWNLOAD_DUMMY 0
#define ECDOWNLOAD_SUCCESS 1
#define ECDOWNLOAD_NO_REGISTER 2
// #define ECDOWNLOAD_NO_REGISTER 2
#define ECDOWNLOAD_FAILURE 3
int ECDownload(const NAMTitleId* pTitleIds, u32 numTitleIds);

View File

@ -13,11 +13,14 @@
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <nitro/nvram/nvram.h>
#include "ecdl.h"
#include <twl/sea.h>
#include <twl/lcfg.h>
#include <twl/na.h>
#include <twl/nam.h>
#include "ecdl.h"
#include <NitroWiFi/nhttp.h>
#include </twl/os/common/ownerInfoEx.h>
@ -36,7 +39,6 @@
#include "stream.h"
#include "hwi.h"
#include "hatamotolib.h"
#include "ecdl.h"
#include "mywlan.h"
#include "mydata.h"
#include "netconnect.h"
@ -64,8 +66,7 @@ static FSEventHook sSDHook;
static BOOL sd_card_flag = FALSE;
//static BOOL reboot_flag = FALSE;
static BOOL ec_download_success_flag = FALSE;
static BOOL ec_download_no_registered_flag = FALSE;
static BOOL ec_download_success_flag = TRUE;
static BOOL wlan_active_flag = TRUE;
@ -186,6 +187,114 @@ static BOOL start_my_thread(void)
return FALSE;
}
static BOOL LoadWlanConfig(void)
{
u8 buf[256];
int len;
int i; /* ユーザーデータ書き込みモード */
if( TRUE == LoadWlanConfigFile("sdmc:/wlan_cfg.txt") ) {
OS_TPrintf("SSID = %s\n", GetWlanSSID());
mfprintf(tc[3],"SSID = %s\n", GetWlanSSID());
OS_TPrintf("MODE = ");
mfprintf(tc[3],"MODE = ");
switch( GetWlanMode() ) {
case WCM_WEPMODE_NONE:
OS_TPrintf("NONE\n");
mfprintf(tc[3],"NONE\n");
break;
case WM_WEPMODE_40BIT:
OS_TPrintf("WEP128\n");
mfprintf(tc[3],"WEP128\n");
break;
case WM_WEPMODE_104BIT:
OS_TPrintf("WEP128\n");
mfprintf(tc[3],"WEP128\n");
break;
case WM_WEPMODE_128BIT:
OS_TPrintf("WEP128\n");
mfprintf(tc[3],"WEP128\n");
break;
case WCM_WEPMODE_WPA_TKIP:
OS_TPrintf("WPA-TKIP\n");
mfprintf(tc[3],"WPA-TKIP\n");
break;
case WCM_WEPMODE_WPA2_TKIP:
OS_TPrintf("WPA2-TKIP\n");
mfprintf(tc[3],"WPA2-TKIP\n");
break;
case WCM_WEPMODE_WPA_AES:
OS_TPrintf("WPA-AES\n");
mfprintf(tc[3],"WPA-AES\n");
break;
case WCM_WEPMODE_WPA2_AES :
OS_TPrintf("WPA2-AES\n");
mfprintf(tc[3],"WPA2-AES\n");
break;
defalut:
OS_TPrintf("Unknow mode..\n");
mfprintf(tc[3],"Unknow mode..\n");
break;
}
if( TRUE == GetKeyModeStr() ) {
OS_TPrintf("KEY STR = %s\n", GetWlanKEYSTR());
mfprintf(tc[3],"KEY STR = %s\n", GetWlanKEYSTR());
}
else {
len = GetWlanKEYBIN(buf);
if( len ) {
OS_TPrintf("KEY BIN = 0x");
mfprintf(tc[3],"KEY BIN = 0x");
for( i = 0 ; i < len ; i++ ) {
OS_TPrintf("%02X",buf[i]);
mfprintf(tc[3],"%02X",buf[i]);
}
OS_TPrintf("\n");
mfprintf(tc[3],"\n");
}
}
mfprintf(tc[3],"\n");
if( TRUE == GetDhcpMODE() ) {
mfprintf(tc[3],"DHCP client\n");
}
else {
u32 addr_temp;
addr_temp = GetIPAddr();
mfprintf(tc[3],"IP addr %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetNetmask();
mfprintf(tc[3],"netmask %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetGateway();
mfprintf(tc[3],"gateway %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetDNS1();
mfprintf(tc[3],"DNS1 %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetDNS2();
mfprintf(tc[3],"DNS2 %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
}
mfprintf(tc[3],"\n");
}
else {
OS_TPrintf("Invalid wlan cfg file\n");
mfprintf(tc[3],"Invalid wlan cfg file\n");
mprintf("Invalid wlan cfg file\n");
return FALSE;
}
return TRUE;
}
static BOOL RestoreFromSDCard1(void)
{
BOOL flag = TRUE;
@ -381,176 +490,6 @@ static BOOL RestoreFromSDCard6(void)
}
static BOOL RestoreFromSDCard8(void)
{
int list_count;
int error_count;
BOOL ret_flag = TRUE;
Error_Report_Init();
if( mydata.num_of_app_save_data > 0 ) {
if( (no_network_flag == TRUE)
|| (ec_download_success_flag == FALSE)
|| (ec_download_no_registered_flag == TRUE ) ) {
mprintf("Sys-App. save data restore ");
if( TRUE == RestoreDirEntryListSystemBackupOnly( MyFile_GetSaveDataListFileName() ,
MyFile_GetSaveDataRestoreLogFileName(),
&list_count, &error_count )) {
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
mprintf("OK.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
}
else {
// error
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
ret_flag = FALSE;
}
}
else {
mprintf("App. save data restore ");
if( TRUE == RestoreDirEntryList( MyFile_GetSaveDataListFileName() ,
MyFile_GetSaveDataRestoreLogFileName(),
&list_count, &error_count )) {
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
mprintf("OK.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
}
else {
// error
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
ret_flag = FALSE;
}
}
}
else if( mydata.num_of_app_save_data == 0 ) {
mprintf("Original device has no app. save data\n");
}
else {
mprintf("Original app. save data saving failed\n");
}
if( TRUE == Error_Report_Display(tc[0]) ) {
mprintf("\n");
}
Error_Report_End();
return ret_flag;
}
static BOOL LoadWlanConfig(void)
{
u8 buf[256];
int len;
int i; /* ユーザーデータ書き込みモード */
if( TRUE == LoadWlanConfigFile("sdmc:/wlan_cfg.txt") ) {
OS_TPrintf("SSID = %s\n", GetWlanSSID());
mfprintf(tc[3],"SSID = %s\n", GetWlanSSID());
OS_TPrintf("MODE = ");
mfprintf(tc[3],"MODE = ");
switch( GetWlanMode() ) {
case WCM_WEPMODE_NONE:
OS_TPrintf("NONE\n");
mfprintf(tc[3],"NONE\n");
break;
case WM_WEPMODE_40BIT:
OS_TPrintf("WEP128\n");
mfprintf(tc[3],"WEP128\n");
break;
case WM_WEPMODE_104BIT:
OS_TPrintf("WEP128\n");
mfprintf(tc[3],"WEP128\n");
break;
case WM_WEPMODE_128BIT:
OS_TPrintf("WEP128\n");
mfprintf(tc[3],"WEP128\n");
break;
case WCM_WEPMODE_WPA_TKIP:
OS_TPrintf("WPA-TKIP\n");
mfprintf(tc[3],"WPA-TKIP\n");
break;
case WCM_WEPMODE_WPA2_TKIP:
OS_TPrintf("WPA2-TKIP\n");
mfprintf(tc[3],"WPA2-TKIP\n");
break;
case WCM_WEPMODE_WPA_AES:
OS_TPrintf("WPA-AES\n");
mfprintf(tc[3],"WPA-AES\n");
break;
case WCM_WEPMODE_WPA2_AES :
OS_TPrintf("WPA2-AES\n");
mfprintf(tc[3],"WPA2-AES\n");
break;
defalut:
OS_TPrintf("Unknow mode..\n");
mfprintf(tc[3],"Unknow mode..\n");
break;
}
if( TRUE == GetKeyModeStr() ) {
OS_TPrintf("KEY STR = %s\n", GetWlanKEYSTR());
mfprintf(tc[3],"KEY STR = %s\n", GetWlanKEYSTR());
}
else {
len = GetWlanKEYBIN(buf);
if( len ) {
OS_TPrintf("KEY BIN = 0x");
mfprintf(tc[3],"KEY BIN = 0x");
for( i = 0 ; i < len ; i++ ) {
OS_TPrintf("%02X",buf[i]);
mfprintf(tc[3],"%02X",buf[i]);
}
OS_TPrintf("\n");
mfprintf(tc[3],"\n");
}
}
mfprintf(tc[3],"\n");
if( TRUE == GetDhcpMODE() ) {
mfprintf(tc[3],"DHCP client\n");
}
else {
u32 addr_temp;
addr_temp = GetIPAddr();
mfprintf(tc[3],"IP addr %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetNetmask();
mfprintf(tc[3],"netmask %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetGateway();
mfprintf(tc[3],"gateway %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetDNS1();
mfprintf(tc[3],"DNS1 %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
addr_temp = GetDNS2();
mfprintf(tc[3],"DNS2 %d.%d.%d.%d\n", (u32)((addr_temp >> 24) & 0xff),(u32)((addr_temp >> 16) & 0xff),
(u32)((addr_temp >> 8) & 0xff),(u32)(addr_temp & 0xff) );
}
mfprintf(tc[3],"\n");
}
else {
OS_TPrintf("Invalid wlan cfg file\n");
mfprintf(tc[3],"Invalid wlan cfg file\n");
mprintf("Invalid wlan cfg file\n");
return FALSE;
}
return TRUE;
}
static BOOL RestoreFromSDCard7(void)
{
@ -695,12 +634,6 @@ static BOOL RestoreFromSDCard7(void)
miya_log_fprintf(log_fd, "%s failed ECDownload 2\n", __FUNCTION__);
goto end_ec_f;
}
else if(ec_download_ret == ECDOWNLOAD_NO_REGISTER ) {
// ret_flag = FALSE;どうする?
ec_download_no_registered_flag = TRUE;
goto end_ec_f;
}
// 不要:セーブデータ領域を作成
// NAM_Init を忘れてた
SetupTitlesDataFile((NAMTitleId *)title_id_buf_ptr , (u32)title_id_count);
@ -774,6 +707,71 @@ static BOOL RestoreFromSDCard7(void)
}
static BOOL RestoreFromSDCard8(void)
{
int list_count;
int error_count;
BOOL ret_flag = TRUE;
Error_Report_Init();
if( mydata.num_of_app_save_data > 0 ) {
if( (no_network_flag == TRUE)
|| (ec_download_success_flag == FALSE)
|| ( mydata.shop_record_flag == FALSE ) ) {
mprintf("Sys-App. save data restore ");
if( TRUE == RestoreDirEntryListSystemBackupOnly( MyFile_GetSaveDataListFileName() ,
MyFile_GetSaveDataRestoreLogFileName(),
&list_count, &error_count )) {
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
mprintf("OK.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
}
else {
// error
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
ret_flag = FALSE;
}
}
else {
mprintf("App. save data restore ");
if( TRUE == RestoreDirEntryList( MyFile_GetSaveDataListFileName() ,
MyFile_GetSaveDataRestoreLogFileName(),
&list_count, &error_count )) {
m_set_palette(tc[0], M_TEXT_COLOR_GREEN );
mprintf("OK.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
}
else {
// error
m_set_palette(tc[0], M_TEXT_COLOR_RED );
mprintf("NG.\n");
m_set_palette(tc[0], M_TEXT_COLOR_WHITE );
ret_flag = FALSE;
}
}
}
else if( mydata.num_of_app_save_data == 0 ) {
mprintf("Original device has no app. save data\n");
}
else {
mprintf("Original app. save data saving failed\n");
}
if( TRUE == Error_Report_Display(tc[0]) ) {
mprintf("\n");
}
Error_Report_End();
return ret_flag;
}
typedef BOOL (*function_ptr)(void);
static function_ptr function_table[] =

View File

@ -142,7 +142,7 @@ NucStatus ProgressNupCheck(void)
{
// NUC_GetProgress() failed in checking, error code=34303
miya_log_fprintf(log_fd, "NUC_GetProgress() failed in checking, error code=%d\n", NUC_GetLastError());
mprintf("NUC_GetProgress() failed in checking\n error code=%d\n", NUC_GetLastError());
mprintf("NUC_GetProgress() failed in checking\n");
}
if (TestState.count++ % STRING_ANIM_CNT == 0)
{
@ -243,13 +243,13 @@ void ProgressNetConnect(void)
void ShowErrorMsg(int error_code)
{
if (error_code > 0) {
mprintf("Error Code:%d", error_code);
mprintf("--Error Code:%d\n", error_code);
mprintf(" %s\n", GetPublicMsg(error_code));
mprintf(" %s\n", GetPrivateMsg(error_code));
miya_log_fprintf(log_fd, "Error Code:%d\n", error_code);
miya_log_fprintf(log_fd, "%s\n", GetPublicMsg(error_code));
miya_log_fprintf(log_fd, "%s\n", GetPrivateMsg(error_code));
miya_log_fprintf(log_fd, "--Error Code:%d\n", error_code);
miya_log_fprintf(log_fd, " %s\n", GetPublicMsg(error_code));
miya_log_fprintf(log_fd, " %s\n", GetPrivateMsg(error_code));
}
else
{
@ -305,10 +305,9 @@ BOOL my_numc_proc(void)
status = ProgressNupCheck();
if (status == NUC_STATUS_ERROR)
{ // エラー発生
mprintf("\n");
miya_log_fprintf(log_fd, "\n");
ChangeState(PHASE_NUP_CLEANUP);
error_code = NUC_GetLastError();
ShowErrorMsg(error_code);
}
else if (status == NUC_STATUS_COMPLETED)
{ // 更新リスト 取得終了

View File

@ -178,18 +178,18 @@ static const char* PublicError[] =
{
/* エラーが発生しましたため、
TWL本体の更新ができません*/
"Error occurred.\nUnable to update TWL system.",
"Error occurred.\n Unable to update TWL system.",
/* TWL本体保存メモリの空き容量が
TWL本体の更新はできませんでした*/
"Insufficient memory in TWL\nUnable to update TWL system.",
"Insufficient memory in TWL\n Unable to update TWL system.",
/* サーバーに接続できません。
*/
"Unable to connect to server\nTry again later.",
"Unable to connect to server\n Try again later.",
/* インターネットのエラーにより、
TWL本体の更新ができません
*/
"Network Error occurred.\nTry again later."
"Network Error occurred.\n Try again later."
};
/*---------------------------------------------------------------------------*

View File

@ -13,12 +13,13 @@
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <nitro/nvram/nvram.h>
#include "ecdl.h"
#include <twl/sea.h>
#include <twl/lcfg.h>
#include <twl/na.h>
#include <twl/nam.h>
#include "ecdl.h"
#include "font.h"
#include "text.h"
#include "mprintf.h"
@ -28,7 +29,6 @@
#include "mynvram.h"
#include "stream.h"
#include "hwi.h"
#include "ecdl.h"
#include "mywlan.h"
#include "mydata.h"
#include "nuc.h"
@ -44,6 +44,8 @@
static BOOL completed_flag = FALSE;
static FSEventHook sSDHook;
static BOOL sd_card_flag = FALSE;
static BOOL no_sd_clean_flag = FALSE;
//static int miya_debug_level = 0;
@ -517,6 +519,13 @@ static void MyThreadProc(void *arg)
while( 1 ) {
(void)OS_SendMessage(&MyMesgQueue_response, (OSMessage)0, OS_MESSAGE_NOBLOCK);
(void)OS_ReceiveMessage(&MyMesgQueue_request, &message, OS_MESSAGE_BLOCK);
if( no_sd_clean_flag == FALSE ) {
mprintf("cleaning up SD card.. ");
(void)CleanSDCardFiles(NULL);
mprintf("done.\n");
}
flag = TRUE;
twl_card_validation_flag = TRUE;
MyFile_SetPathBase("sdmc:/");
@ -608,7 +617,6 @@ void TwlMain(void)
u32 s_timestamp;
ESError es_error_code;
int select_mode = 0;
BOOL no_sd_clean_flag = FALSE;
OS_Init();
OS_InitThread();
@ -679,6 +687,7 @@ void TwlMain(void)
}
// 不要NAM の初期化
// NAM_Init(&AllocForNAM, &FreeForNAM);
@ -873,9 +882,6 @@ void TwlMain(void)
/* ユーザーデータ吸出しモード */
if(completed_flag == FALSE ) {
if( sd_card_flag == TRUE ) {
if( no_sd_clean_flag == FALSE ) {
(void)CleanSDCardFiles(NULL);
}
text_blink_clear(tc[0]);
if( FALSE == start_my_thread() ) {