From dad64ade7027ec501ca3722ede1ce3d544bbe443 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@b08762b0-b915-fc4b-9d8c-17b2551a87ff> Date: Thu, 31 Jul 2008 01:04:56 +0000 Subject: [PATCH] =?UTF-8?q?NCFG=E3=82=92=E7=A0=B4=E5=A3=8A=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=83=84=E3=83=BC=E3=83=AB=E3=81=AE=E3=82=B3=E3=83=9F?= =?UTF-8?q?=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2040 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/debugsoft/Internet/NCFGTest/Makefile | 66 +++++++ .../Internet/NCFGTest/banner/banner.bnr | Bin 0 -> 9152 bytes build/debugsoft/Internet/NCFGTest/readme.txt | 21 ++ build/debugsoft/Internet/NCFGTest/src/main.c | 183 ++++++++++++++++++ 4 files changed, 270 insertions(+) create mode 100644 build/debugsoft/Internet/NCFGTest/Makefile create mode 100644 build/debugsoft/Internet/NCFGTest/banner/banner.bnr create mode 100644 build/debugsoft/Internet/NCFGTest/readme.txt create mode 100644 build/debugsoft/Internet/NCFGTest/src/main.c diff --git a/build/debugsoft/Internet/NCFGTest/Makefile b/build/debugsoft/Internet/NCFGTest/Makefile new file mode 100644 index 00000000..0929558e --- /dev/null +++ b/build/debugsoft/Internet/NCFGTest/Makefile @@ -0,0 +1,66 @@ +#! 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 + +TARGET_NAME = NCFGTest +TARGET_BIN = $(TARGET_NAME).srl +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 \ + + +MAKEROM := $(TWL_TOOLSDIR)/bin/makerom.TWL.exe + + +#------------------------- +# インストール指定 +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 ===== diff --git a/build/debugsoft/Internet/NCFGTest/banner/banner.bnr b/build/debugsoft/Internet/NCFGTest/banner/banner.bnr new file mode 100644 index 0000000000000000000000000000000000000000..541c2468b1a2687258096118a6a8df09b11c5610 GIT binary patch literal 9152 zcmeHNy-EW?5MHqm?1pPBgv|@6EZYheLhQ7$w>XmaKrO61QV913mihwP<_UbD<={v+ zezSK8rzSy^Xt>OTVfJ=z_uHGYVAO;YlQ^AwsOo*)Y{=`ZPa$GW{L`jOPOcc#C?|g>#QKvYy1wL+S zYs9Is2(GW<6VzEwfHhYdoQT(q0r$nRh;3tiE>B}Sw_j9#(?7#%<4RfD8}q#H`gaj=&P>l-nt{17w{vGvcPsVzHUB#Qb^Yu9r~CgV zo`2mv+4adZ0vZ90fJQ(gpb=OU0pSQDFQNPp_^6NEkX(12AJY8SJmgRKL2!-4OZdU) z|0O>-DwqQ(&w!~I2tU}^FRbJa#=>o*#f{O*xFC&xDL<(BU-$eM6V3m6ejkYIaOLa2 zn2d^IPuIWfXtD>c&-WqC|LlyBGil?#5B^2|>vg}n^MBEMf!1pTGy I|M>ym0b^;(1poj5 literal 0 HcmV?d00001 diff --git a/build/debugsoft/Internet/NCFGTest/readme.txt b/build/debugsoft/Internet/NCFGTest/readme.txt new file mode 100644 index 00000000..2c74e548 --- /dev/null +++ b/build/debugsoft/Internet/NCFGTest/readme.txt @@ -0,0 +1,21 @@ +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 エラーだった場合は、初回起動だと見なし、消去のみを行い、 + エラーを返しません。 +- 設定がされていた領域で消去が発生した場合は、エラーを通知します。 +- それ以外の場合は、エラーを返しません。 + (元々設定されていなかった領域で消去が発生した場合も含む) + diff --git a/build/debugsoft/Internet/NCFGTest/src/main.c b/build/debugsoft/Internet/NCFGTest/src/main.c new file mode 100644 index 00000000..d3104ffb --- /dev/null +++ b/build/debugsoft/Internet/NCFGTest/src/main.c @@ -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 +#include +#include +#include +#include + +//#include +//#include + +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(); +}