cfg,nor,acの設定をYボタンでセーブデータに保存、無入力で書き込みできるように

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@653 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
N2614 2012-02-23 04:42:48 +00:00
parent a6203551a6
commit 70f75a8afb
6 changed files with 73 additions and 23 deletions

View File

@ -29,6 +29,8 @@ INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR) \
SOURCES[] =
main.cpp
HeapManager.cpp
CfgChanger.cpp
syokaikidou.cpp
sysSharedExtSaveData.cpp
sysUserInfoAccessor.cpp
@ -44,7 +46,7 @@ CCFLAGS += --restrict
ROM_SPEC_FILE = $(TARGET_PROGRAM).rsf
# DESC
DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/systemapplications/Mset.desc
DESCRIPTOR = $(HORIZON_ROOT)/resources/specfiles/systemapplications/Mset_EU.desc
LIBS += lib_demo \
libnn_ns \

View File

@ -1,28 +1,39 @@
BasicInfo:
Title : SkipFirstLaunch
ProductCode: SkipFirstLaunch
BackupMemoryType: None
BackupMemoryType: 128KB
TitleInfo:
Use: System
Category: SystemApplication
UniqueId: 0x00200
UniqueId: 0x00220
Version: 0
SystemControlInfo:
AppType : Application
StackSize : 0x4000
StackSize : 0x8000
Dependency :
- codec
- hid
- gsp
- friends
- nim
- ac
- news
- ndm
AccessControlInfo:
Priority : 16
DisableDebug : true
FileSystemAccess:
- Debug
- CategorySystemApplication
- CategorySystemSettings
Option:
FreeProductCode: true
CardInfo:
CardDevice: None
CardDevice: NorFlash

View File

@ -19,8 +19,12 @@
#include <nn/cfg/CTR/cfg_ApiInit.h>
#include <nn/cfg/CTR/detail/cfg_Keys.h>
#include <nn/ns.h>
#include <nn/news/CTR/system/news_BossUtil.h>
#include <nn/hid/CTR/hid_ApiWithPrivilege.h>
#include "HeapManager.h"
#include "syokaikidou.h"
#include "CfgChanger.h"
#include "demo.h"
@ -65,18 +69,52 @@ extern "C" void nnMain()
nn::cfg::CTR::init::Initialize();
// RenderSystem の準備
nn::fnd::ExpHeap appHeap;
appHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize());
common::InitializeHeap();
const size_t s_GxHeapSize = 8 * 1024 * 1024;
void* heapForGx = appHeap.Allocate(s_GxHeapSize);
common::HeapManager gxHeap(s_GxHeapSize);
void* heapForGx = gxHeap.GetAddr();
s_RenderSystem.Initialize(reinterpret_cast<uptr>(heapForGx), s_GxHeapSize);
s_RenderSystem.SetClearColor(NN_GX_DISPLAY_BOTH, 0, 1, 0, 1);
result = nn::ns::InitializeForShell();
HANDLE_ERROR(result);
fnc_1st_setting();
fnc_starting_set();
nn::fs::Initialize();
nn::hid::InitializeWithPrivilege();
nn::hid::PadReader padReader;
nn::hid::PadStatus padStatus;
bool updateSaveData = false;
padReader.ReadLatest(&padStatus);
if(padStatus.hold & nn::hid::BUTTON_Y)
{
NN_LOG("Updating SaveData\n");
updateSaveData = true;
CfgChanger changer;
result = changer.ImportToBackup();
if(result.IsFailure())
{
NN_DBG_PRINT_RESULT(result);
}
else
{
NN_LOG("Updating SaveData done.\n");
}
}
if(!updateSaveData)
{
NN_LOG("Set SaveData");
CfgChanger changer;
if(changer.RestoreFromBackup().IsSuccess())
{
nn::news::CTR::boss::Initialize();
fnc_1st_setting();
fnc_starting_set();
}
}
for(;;)
{
@ -94,8 +132,6 @@ extern "C" void nnMain()
result = nn::ns::FinalizeForShell();
HANDLE_ERROR(result);
s_RenderSystem.Finalize();
appHeap.Free(heapForGx);
appHeap.Finalize();
result = nn::applet::PrepareToCloseApplication();
HANDLE_ERROR(result);
result = nn::applet::CloseApplication();

View File

@ -10,6 +10,8 @@
#include "IDB.h"
#include "IDBi.h"
#include "IDBUT.h"
#include "HeapManager.h"
#include "syokaikidou.h"
namespace System
{
@ -38,10 +40,10 @@ void fnc_1st_setting()
// IDBの初期化
{
u32 size = IDB_GetBufferSize();
u8* buf;
//u8* buf = new( sys::Mem::getMainHeap() ) u8[size];
common::HeapManager heap(size);
void* buf = heap.GetAddr();
IDB_Initialize( buf, false, false );
IDB_Initialize( reinterpret_cast<u8*>(buf), false, false );
// MSETとPNOTEのアイコンを特別にIDBに登録
{
@ -91,8 +93,6 @@ void fnc_1st_setting()
}
IDB_Finalize();
delete []buf;
}
}
@ -111,8 +111,8 @@ void fnc_starting_set()
sys::UserInfoAccessor::setBossTask();
u8 net = 0;
sys::UserInfoAccessor::saveFirstInfo( 1, net );
// 初回起動フラグはバックアップデータから書き込む
//sys::UserInfoAccessor::saveFirstInfo( 1, net );
// cfg 情報送信のタスク登録
sys::UserInfoAccessor::setBossSendInfoTaskFirst();

View File

@ -125,6 +125,7 @@ u8* File::read( const wchar_t* fileName, u32* size, bool device, bool prefix )
*/
u8* File::readLZ( const char* fileName, u32* size )
{
NN_PANIC("comment out function, %s:%d", __func__, __LINE__);
#if 0
u8* comp_buf = read( fileName, size, false, false );
u32 arc_size = nn::cx::GetUncompressedSize( comp_buf );
@ -145,6 +146,7 @@ u8* File::readLZ( const char* fileName, u32* size )
*/
u8* File::mountShare( const char* name, nn::ProgramId tit_id, int data_num, int files, int dirs )
{
NN_PANIC("comment out function, %s:%d", __func__, __LINE__);
#if 0
int size = nn::fs::GetContentRequiredMemorySize( nn::fs::MEDIA_TYPE_NAND,
tit_id, data_num, files, dirs );

View File

@ -4,6 +4,7 @@
*/
#ifndef MAKE_AREACHECK
#include "HeapManager.h"
//#include "sys.h"
#include "sysUserInfoAccessor.h"
@ -2262,8 +2263,8 @@ nn::Result result;
bool UserInfoAccessor::save_boss_send_info_()
{
size_t size = sizeof( BossSendInfo );
//BossSendInfo* pSaveData = new( sys::Mem::getMainHeap() ) BossSendInfo;
BossSendInfo* pSaveData;
common::HeapManager heap(size);
BossSendInfo* pSaveData = reinterpret_cast<BossSendInfo*>(heap.GetAddr());
bool ret = false;
sys::File::initializeMsetSys();
@ -2281,8 +2282,6 @@ bool ret = false;
}
sys::File::finalizeMsetSys();
if( pSaveData != NULL ) { delete pSaveData; }
return ret;
}