mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
NCFGTest → NCFGCrusher
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2112 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
ddc02bb61d
commit
74caf66a64
68
build/debugsoft/Internet/NCFGCrusher/Makefile
Normal file
68
build/debugsoft/Internet/NCFGCrusher/Makefile
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#! make -f
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Project: TwlWiFi - NCFG - demos - ncfg-1
|
||||||
|
# File: Makefile
|
||||||
|
#
|
||||||
|
# Copyright 2007 Nintendo. All rights reserved.
|
||||||
|
#
|
||||||
|
# These coded instructions, statements, and computer programs contain
|
||||||
|
# proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||||
|
# Company Ltd., and are protected by Federal copyright law. They may
|
||||||
|
# not be disclosed to third parties or copied or duplicated in any form,
|
||||||
|
# in whole or in part, without the prior written consent of Nintendo.
|
||||||
|
#
|
||||||
|
# $Date:: $
|
||||||
|
# $Rev$
|
||||||
|
# $Author$
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SUBDIRS = $(ROOT)/build/demos/gx/UnitTours/DEMOLib
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
TARGET_PLATFORM = TWL
|
||||||
|
TWL_ARCHGEN := LIMITED
|
||||||
|
TWL_NANDAPP := TRUE
|
||||||
|
TARGET_NAME = NCFGCrusher
|
||||||
|
TARGET_BIN = $(TARGET_NAME).srl
|
||||||
|
#TARGET_BIN = $(TARGET_NAME).tad
|
||||||
|
SRCS = main.c
|
||||||
|
|
||||||
|
|
||||||
|
ROM_SPEC = $(TARGET_NAME).autogen.rsf
|
||||||
|
ROM_SPEC_TEMPLATE = $(ROOT)/include/twl/specfiles/ROM-TS_sys.rsf
|
||||||
|
ROM_SPEC_PARAM = MakerCode=01 \
|
||||||
|
BannerFile=./banner/banner.bnr \
|
||||||
|
GameCode=4S03 \
|
||||||
|
TitleName=$(TARGET_NAME) \
|
||||||
|
AppType=USER \
|
||||||
|
# Media=NAND \
|
||||||
|
|
||||||
|
|
||||||
|
MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.exe
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# ƒCƒ“ƒXƒg<C692>[ƒ‹Žw’è
|
||||||
|
ifneq ($(TWL_IPL_RED_ROOT),)
|
||||||
|
INSTALL_DIR = $(TWL_IPL_RED_ROOT)/debugsoft/$(TARGET_NAME)
|
||||||
|
INSTALL_TARGETS = $(BINDIR)/$(TARGET_BIN)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/commondefs
|
||||||
|
include $(TWLWIFI_ROOT)/build/buildtools/commondefs.demos
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/commondefs.gx.demolib
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
do-build: $(TARGETS)
|
||||||
|
|
||||||
|
include $(TWLWIFI_ROOT)/build/buildtools/modulerules
|
||||||
|
include $(TWLSDK_ROOT)/build/buildtools/modulerules
|
||||||
|
|
||||||
|
#===== End of Makefile =====
|
||||||
BIN
build/debugsoft/Internet/NCFGCrusher/banner/banner.bnr
Normal file
BIN
build/debugsoft/Internet/NCFGCrusher/banner/banner.bnr
Normal file
Binary file not shown.
33
build/debugsoft/Internet/NCFGCrusher/readme.txt
Normal file
33
build/debugsoft/Internet/NCFGCrusher/readme.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
NCFGTest
|
||||||
|
|
||||||
|
*概要
|
||||||
|
接続設定を破壊するツールです。
|
||||||
|
|
||||||
|
*操作方法
|
||||||
|
上下キーで破壊する接続設定を選択し、Aボタンで決定します。
|
||||||
|
下画面に元の接続設定データと、破壊後のデータが表示されます。
|
||||||
|
|
||||||
|
破壊は、各データの先頭に 0x61 ~ 0x67を埋め込む形で実現しています。
|
||||||
|
|
||||||
|
|
||||||
|
----------
|
||||||
|
*NCFGの修復仕様まとめ
|
||||||
|
|
||||||
|
接続設定のCRCをチェックし、エラーがある場合はその設定を初期化します。
|
||||||
|
(IPアドレスの設定や、接続タイプ等が全てクリアされる状態)
|
||||||
|
|
||||||
|
Nitroのときのように、接続設定1と2を異常にすると、3も道連れになりクリアされるというようなことはありません。
|
||||||
|
|
||||||
|
|
||||||
|
より、詳細な仕様は影舞に記されています。
|
||||||
|
http://phoenix.boy.nintendo.co.jp/~twl-wifi/kagemai/html/user.cgi?project=twl-wifi&action=view_report&id=84
|
||||||
|
http://phoenix.boy.nintendo.co.jp/~twl-wifi/kagemai/html/user.cgi?project=twl-wifi&action=view_report&id=83
|
||||||
|
|
||||||
|
一部抜粋
|
||||||
|
- CRC エラーの接続先は、個別に消去します。
|
||||||
|
- 全領域 CRC エラーだった場合は、初回起動だと見なし、消去のみを行い、
|
||||||
|
エラーを返しません。
|
||||||
|
- 設定がされていた領域で消去が発生した場合は、エラーを通知します。
|
||||||
|
- それ以外の場合は、エラーを返しません。
|
||||||
|
(元々設定されていなかった領域で消去が発生した場合も含む)
|
||||||
|
|
||||||
183
build/debugsoft/Internet/NCFGCrusher/src/main.c
Normal file
183
build/debugsoft/Internet/NCFGCrusher/src/main.c
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Project: TwlWiFi - NCFG - demos - ncfg-1
|
||||||
|
File: main.c
|
||||||
|
|
||||||
|
Copyright 2007 Nintendo. All rights reserved.
|
||||||
|
|
||||||
|
These coded instructions, statements, and computer programs contain
|
||||||
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||||||
|
Company Ltd., and are protected by Federal copyright law. They may
|
||||||
|
not be disclosed to third parties or copied or duplicated in any form,
|
||||||
|
in whole or in part, without the prior written consent of Nintendo.
|
||||||
|
|
||||||
|
$Date:: $
|
||||||
|
$Rev$
|
||||||
|
$Author$
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
NVRAM 上のネットワーク設定を一定の値で初期化しながら、
|
||||||
|
その結果をダンプするサンプルプログラムです。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
#include <nitro.h>
|
||||||
|
#include <nitroWiFi.h>
|
||||||
|
#include <nitroWiFi/ncfg.h>
|
||||||
|
#include <DEMO.h>
|
||||||
|
#include <nitro/pad.h>
|
||||||
|
|
||||||
|
//#include <nitro/std.h>
|
||||||
|
//#include <nitro/fs.h>
|
||||||
|
|
||||||
|
static void MainLoop(void);
|
||||||
|
//static void VBlankIntr(void);
|
||||||
|
|
||||||
|
static void ReadNCFG(s32 index, u8* out);
|
||||||
|
static void WriteNCFG(s32 index);
|
||||||
|
static void InitDEMOSystem(void);
|
||||||
|
|
||||||
|
static u32 UpdateCursor(u32 val, u32 max, u16 key);
|
||||||
|
|
||||||
|
static const char* SLOT_NAME[] = {
|
||||||
|
"SLOT_1", "SLOT_2", "SLOT_3", "SLOT_EX_1", "SLOT_EX_2", "SLOT_EX_3"
|
||||||
|
};
|
||||||
|
static const u32 SLOT_NUM = sizeof(SLOT_NAME) / sizeof(char*);
|
||||||
|
|
||||||
|
void NitroMain()
|
||||||
|
{
|
||||||
|
OS_Init();
|
||||||
|
FX_Init();
|
||||||
|
GX_Init();
|
||||||
|
|
||||||
|
// GX_DispOff();
|
||||||
|
// GXS_DispOff();
|
||||||
|
|
||||||
|
// V ブランク割り込み設定
|
||||||
|
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
|
||||||
|
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
|
||||||
|
(void)GX_VBlankIntr(TRUE);
|
||||||
|
|
||||||
|
// 割り込み許可
|
||||||
|
(void)OS_EnableIrq();
|
||||||
|
(void)OS_EnableInterrupts();
|
||||||
|
|
||||||
|
InitDEMOSystem();
|
||||||
|
|
||||||
|
(void)PAD_Read();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OS_TPrintf("UP DOWN - SELECT NCFG SLOT\n");
|
||||||
|
OS_TPrintf("A - OVERWRITE NCFG\n");
|
||||||
|
|
||||||
|
|
||||||
|
MainLoop();
|
||||||
|
|
||||||
|
OS_Terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 UpdateCursor(u32 val, u32 max, u16 key)
|
||||||
|
{
|
||||||
|
if(key & PAD_KEY_DOWN)
|
||||||
|
{
|
||||||
|
val = (val + 1) % max;
|
||||||
|
}
|
||||||
|
if(key & PAD_KEY_UP)
|
||||||
|
{
|
||||||
|
val = (val + max - 1) % max;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MainLoop(void)
|
||||||
|
{
|
||||||
|
u32 index = 0;
|
||||||
|
s32 slot_index[] =
|
||||||
|
{
|
||||||
|
NCFG_SLOT_1,
|
||||||
|
NCFG_SLOT_2,
|
||||||
|
NCFG_SLOT_3,
|
||||||
|
NCFG_SLOT_EX_1,
|
||||||
|
NCFG_SLOT_EX_2,
|
||||||
|
NCFG_SLOT_EX_3,
|
||||||
|
};
|
||||||
|
u16 key = 0, old_key = 0, trig = 0;
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
s32 i = 0;
|
||||||
|
|
||||||
|
old_key = key;
|
||||||
|
key = PAD_Read();
|
||||||
|
trig = (u16)(key & (key ^ old_key));
|
||||||
|
|
||||||
|
index = UpdateCursor(index, SLOT_NUM, trig);
|
||||||
|
if(trig & PAD_BUTTON_A)
|
||||||
|
{
|
||||||
|
WriteNCFG(slot_index[index]);
|
||||||
|
OS_TPrintf("%s was modified\n", SLOT_NAME[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < SLOT_NUM; ++i)
|
||||||
|
{
|
||||||
|
|
||||||
|
DEMODrawText(0, i * 8, ((index == i) ? "*" : " "));
|
||||||
|
DEMODrawText(8, i * 8, "%s\n", SLOT_NAME[i]);
|
||||||
|
}
|
||||||
|
DEMO_DrawFlip();
|
||||||
|
OS_WaitVBlankIntr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ReadNCFG(s32 index, u8* out)
|
||||||
|
{
|
||||||
|
static u8 buf[512];
|
||||||
|
FSFile fp;
|
||||||
|
s32 result;
|
||||||
|
|
||||||
|
FS_InitFile(&fp);
|
||||||
|
|
||||||
|
result = NCFG_ReadBackupMemory(buf, sizeof(buf), index);
|
||||||
|
OS_TPrintf("NCFG_ReadBackupMemory(%d): %d\n", index, result);
|
||||||
|
if ( result >= 0 )
|
||||||
|
{
|
||||||
|
// OS_TPrintfEx("% *.16b", result, buf);
|
||||||
|
OS_TPrintfEx("% 256.16b", buf);
|
||||||
|
OS_TPrintf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
MI_CpuCopy8(buf, out, sizeof(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void WriteNCFG(s32 index)
|
||||||
|
{
|
||||||
|
static u8 buf[512];
|
||||||
|
s32 result;
|
||||||
|
|
||||||
|
ReadNCFG(index, buf);
|
||||||
|
MI_CpuCopy("abcdefg", buf, 7);
|
||||||
|
result = NCFG_WriteBackupMemory(index, buf, sizeof(buf));
|
||||||
|
OS_TPrintf("NCFG_WriteBackupMemory(%d): %d\n", index, result);
|
||||||
|
OS_TPrintfEx("% 256.16b", buf);
|
||||||
|
OS_TPrintf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*
|
||||||
|
Name: InitDEMOSystem
|
||||||
|
|
||||||
|
Description: コンソールの画面出力用の表示設定を行います。
|
||||||
|
|
||||||
|
Arguments: なし。
|
||||||
|
|
||||||
|
Returns: なし。
|
||||||
|
*---------------------------------------------------------------------------*/
|
||||||
|
static void InitDEMOSystem(void)
|
||||||
|
{
|
||||||
|
// 画面表示の初期化。
|
||||||
|
DEMOInitCommon();
|
||||||
|
DEMOInitVRAM();
|
||||||
|
DEMOInitDisplayBitmap();
|
||||||
|
DEMOHookConsole();
|
||||||
|
DEMOSetBitmapTextColor(GX_RGBA(31, 31, 31, 1));
|
||||||
|
DEMOSetBitmapGroundColor(DEMO_RGB_CLEAR);
|
||||||
|
DEMOStartDisplay();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user