mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
Shop接続後個別にコマンドを送るための準備
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@212 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
7186946b1c
commit
08b0b17ee1
@ -36,23 +36,23 @@ do { \
|
|||||||
nn::nim::Shop::GetCustomerSupportCode(&csc)); \
|
nn::nim::Shop::GetCustomerSupportCode(&csc)); \
|
||||||
COMMON_LOGGER("CSCode: %d\n", csc); \
|
COMMON_LOGGER("CSCode: %d\n", csc); \
|
||||||
nn::dbg::PrintResult(result); \
|
nn::dbg::PrintResult(result); \
|
||||||
s_Result = result; \
|
s_ShopResult = result; \
|
||||||
goto LABEL_FINALIZE; \
|
ShopOperationFinalize(); \
|
||||||
|
return; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
nn::Result s_Result = nn::ResultSuccess();
|
nn::Result s_ShopResult = nn::ResultSuccess();
|
||||||
|
|
||||||
const size_t UNREGISTER_THREAD_STACK_SIZE = 0x1000;
|
const size_t UNREGISTER_THREAD_STACK_SIZE = 0x1000;
|
||||||
nn::os::Thread s_UnregisterThread;
|
nn::os::Thread s_UnregisterThread;
|
||||||
nn::os::StackBuffer<UNREGISTER_THREAD_STACK_SIZE> s_UnregisterThreadStack;
|
nn::os::StackBuffer<UNREGISTER_THREAD_STACK_SIZE> s_UnregisterThreadStack;
|
||||||
|
|
||||||
static const size_t ecBufferSize = 128 * 1024;
|
static const size_t EC_BUFFER_SIZE = 128 * 1024;
|
||||||
static u8 ecBufffer[ecBufferSize];
|
static u8 s_EcBufffer[EC_BUFFER_SIZE];
|
||||||
|
|
||||||
#ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
||||||
// 空文字列と NULL ポインタをそれぞれ <empty> と NULL として返す
|
// 空文字列と NULL ポインタをそれぞれ <empty> と NULL として返す
|
||||||
const char* Cstr(const char* p)
|
const char* Cstr(const char* p)
|
||||||
{
|
{
|
||||||
@ -137,7 +137,6 @@ void PrintECAccountInfo(const ECAccountInfo& accountInfo)
|
|||||||
PrintECTicketVersions(*(accountInfo.owned));
|
PrintECTicketVersions(*(accountInfo.owned));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
||||||
|
|
||||||
nn::Result PrintNetworkSetting()
|
nn::Result PrintNetworkSetting()
|
||||||
{
|
{
|
||||||
@ -199,14 +198,55 @@ nn::Result FinalizeInternal()
|
|||||||
|
|
||||||
namespace ConsoleRestore{
|
namespace ConsoleRestore{
|
||||||
|
|
||||||
// メイン関数
|
void ShopOperationConnect();
|
||||||
void ShopOperationSingleThreadFunc(ShopOperation op)
|
void ShopOperationFinalize();
|
||||||
|
|
||||||
|
|
||||||
|
void ShopOperationConnect()
|
||||||
{
|
{
|
||||||
nn::Result result = nn::ResultSuccess();
|
nn::Result result = nn::ResultSuccess();
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
Connect
|
||||||
|
-------------------------------------------------------------------- */
|
||||||
|
NN_LOG("nim::Shop::Connect\n");
|
||||||
|
ECAccountInfo* pAccountInfo;
|
||||||
|
result = nn::nim::Shop::Connect(&pAccountInfo, s_EcBufffer, EC_BUFFER_SIZE);
|
||||||
|
NIM_UNREGISTER_RESULT_CHECK(result);
|
||||||
|
|
||||||
|
PrintECAccountInfo(*pAccountInfo);
|
||||||
|
NN_LOG("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopOperationFinalize()
|
||||||
|
{
|
||||||
|
nn::Result result = nn::ResultSuccess();
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
Finalize
|
||||||
|
-------------------------------------------------------------------- */
|
||||||
|
NN_LOG("nim::FinalizeForShop\n");
|
||||||
|
result = nn::nim::FinalizeForShop();
|
||||||
|
NIM_UNREGISTER_RESULT_CHECK(result);
|
||||||
|
|
||||||
|
NN_LOG("util::ac::Initialize\n");
|
||||||
|
FinalizeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
// メイン関数
|
||||||
|
void ShopOperationSingleThreadFunc(ShopOperation op)
|
||||||
|
{
|
||||||
|
if(op == SHOP_OPERATION_CLOSE_WITHOUT_CONNECT)
|
||||||
|
{
|
||||||
|
ShopOperationFinalize();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NN_LOG("util::ac::Initialize\n");
|
NN_LOG("util::ac::Initialize\n");
|
||||||
InitializeInternal();
|
InitializeInternal();
|
||||||
|
|
||||||
|
nn::Result result = nn::ResultSuccess();
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
Initialize
|
Initialize
|
||||||
-------------------------------------------------------------------- */
|
-------------------------------------------------------------------- */
|
||||||
@ -223,6 +263,12 @@ void ShopOperationSingleThreadFunc(ShopOperation op)
|
|||||||
|
|
||||||
switch(op)
|
switch(op)
|
||||||
{
|
{
|
||||||
|
case SHOP_OPERATION_CONNECT_WITHOUT_CLOSE:
|
||||||
|
{
|
||||||
|
ShopOperationConnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
case SHOP_OPERATION_CONNECT_ONLY:
|
case SHOP_OPERATION_CONNECT_ONLY:
|
||||||
{
|
{
|
||||||
// Connectするのみ
|
// Connectするのみ
|
||||||
@ -231,13 +277,11 @@ void ShopOperationSingleThreadFunc(ShopOperation op)
|
|||||||
-------------------------------------------------------------------- */
|
-------------------------------------------------------------------- */
|
||||||
NN_LOG("nim::Shop::Connect\n");
|
NN_LOG("nim::Shop::Connect\n");
|
||||||
ECAccountInfo* pAccountInfo;
|
ECAccountInfo* pAccountInfo;
|
||||||
result = nn::nim::Shop::Connect(&pAccountInfo, ecBufffer, ecBufferSize);
|
result = nn::nim::Shop::Connect(&pAccountInfo, s_EcBufffer, EC_BUFFER_SIZE);
|
||||||
NIM_UNREGISTER_RESULT_CHECK(result);
|
NIM_UNREGISTER_RESULT_CHECK(result);
|
||||||
|
|
||||||
#ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
||||||
PrintECAccountInfo(*pAccountInfo);
|
PrintECAccountInfo(*pAccountInfo);
|
||||||
NN_LOG("\n");
|
NN_LOG("\n");
|
||||||
#endif //NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -256,13 +300,11 @@ void ShopOperationSingleThreadFunc(ShopOperation op)
|
|||||||
-------------------------------------------------------------------- */
|
-------------------------------------------------------------------- */
|
||||||
NN_LOG("nim::Shop::Connect\n");
|
NN_LOG("nim::Shop::Connect\n");
|
||||||
ECAccountInfo* pAccountInfo;
|
ECAccountInfo* pAccountInfo;
|
||||||
result = nn::nim::Shop::Connect(&pAccountInfo, ecBufffer, ecBufferSize);
|
result = nn::nim::Shop::Connect(&pAccountInfo, s_EcBufffer, EC_BUFFER_SIZE);
|
||||||
NIM_UNREGISTER_RESULT_CHECK(result);
|
NIM_UNREGISTER_RESULT_CHECK(result);
|
||||||
|
|
||||||
#ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
||||||
PrintECAccountInfo(*pAccountInfo);
|
PrintECAccountInfo(*pAccountInfo);
|
||||||
NN_LOG("\n");
|
NN_LOG("\n");
|
||||||
#endif //NN_SWITCH_DISABLE_DEBUG_PRINT
|
|
||||||
if (pAccountInfo->accountStatus && pAccountInfo->accountStatus[0] == 'R')
|
if (pAccountInfo->accountStatus && pAccountInfo->accountStatus[0] == 'R')
|
||||||
{
|
{
|
||||||
/* ---------------------------------------------------------------
|
/* ---------------------------------------------------------------
|
||||||
@ -280,24 +322,13 @@ void ShopOperationSingleThreadFunc(ShopOperation op)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShopOperationFinalize();
|
||||||
LABEL_FINALIZE:
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
|
||||||
Finalize
|
|
||||||
-------------------------------------------------------------------- */
|
|
||||||
NN_LOG("nim::FinalizeForShop\n");
|
|
||||||
result = nn::nim::FinalizeForShop();
|
|
||||||
NIM_UNREGISTER_RESULT_CHECK(result);
|
|
||||||
|
|
||||||
NN_LOG("util::ac::Initialize\n");
|
|
||||||
FinalizeInternal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartShopOperationSingle(ShopOperation op)
|
void StartShopOperationSingle(ShopOperation op)
|
||||||
{
|
{
|
||||||
NN_LOG("Start ShopOperationSingle\n");
|
NN_LOG("Start ShopOperationSingle\n");
|
||||||
s_Result = nn::ResultSuccess();
|
s_ShopResult = nn::ResultSuccess();
|
||||||
s_UnregisterThread.Start(ShopOperationSingleThreadFunc, op, s_UnregisterThreadStack);
|
s_UnregisterThread.Start(ShopOperationSingleThreadFunc, op, s_UnregisterThreadStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +346,7 @@ bool IsShopOperationSingleFinished()
|
|||||||
|
|
||||||
nn::Result GetShopOperationSingleResult()
|
nn::Result GetShopOperationSingleResult()
|
||||||
{
|
{
|
||||||
return s_Result;
|
return s_ShopResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,11 @@ namespace ConsoleRestore
|
|||||||
|
|
||||||
typedef enum SHOP_OPERATION
|
typedef enum SHOP_OPERATION
|
||||||
{
|
{
|
||||||
SHOP_OPERATION_CONNECT_ONLY,
|
SHOP_OPERATION_CONNECT_ONLY, // Shop::ConnectしてCloseするだけ
|
||||||
SHOP_OPERATION_GET_IVS,
|
SHOP_OPERATION_GET_IVS, // Shop::ImportIvsFromInfrastructureを実行
|
||||||
SHOP_OPERATION_UNREGISTER
|
SHOP_OPERATION_UNREGISTER, // Shop::Unregisterを実行
|
||||||
|
SHOP_OPERATION_CONNECT_WITHOUT_CLOSE, // Shop::ConnectしてCloseしない
|
||||||
|
SHOP_OPERATION_CLOSE_WITHOUT_CONNECT // Shop::ConnectせずいきなりCloseする
|
||||||
} ShopOperation;
|
} ShopOperation;
|
||||||
|
|
||||||
void StartShopOperationSingle(ShopOperation op);
|
void StartShopOperationSingle(ShopOperation op);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user