mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
ブランチ元を間違えたので削除
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@703 385bec56-5757-e545-9c3a-d8741f4650f1
This commit is contained in:
parent
9ab96edcfe
commit
d7d6776a09
@ -1,59 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: HeapManager.cpp
|
|
||||||
|
|
||||||
Copyright 2009 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "HeapManager.h"
|
|
||||||
|
|
||||||
nn::fnd::ThreadSafeExpHeap s_AppHeap;
|
|
||||||
|
|
||||||
|
|
||||||
HeapManager::HeapManager(size_t byteSize, s32 alignment, bit8 groupId, nn::fnd::ExpHeapBase::AllocationMode mode, bool reuse)
|
|
||||||
{
|
|
||||||
m_Ptr = s_AppHeap.Allocate(byteSize, alignment, groupId, mode, reuse);
|
|
||||||
}
|
|
||||||
|
|
||||||
HeapManager::~HeapManager()
|
|
||||||
{
|
|
||||||
if(m_Ptr != NULL)
|
|
||||||
{
|
|
||||||
s_AppHeap.Free(m_Ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void* HeapManager::GetAddr()
|
|
||||||
{
|
|
||||||
return m_Ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeHeap()
|
|
||||||
{
|
|
||||||
s_AppHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t GetAllocatableSize(s32 alignment)
|
|
||||||
{
|
|
||||||
return s_AppHeap.GetAllocatableSize(alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* ForceAllocate(size_t byteSize, s32 alignment, bit8 groupId, nn::fnd::ExpHeapBase::AllocationMode mode, bool reuse)
|
|
||||||
{
|
|
||||||
return s_AppHeap.Allocate(byteSize, alignment, groupId, mode, reuse);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForceFree(void* ptr)
|
|
||||||
{
|
|
||||||
if(ptr != NULL)
|
|
||||||
{
|
|
||||||
s_AppHeap.Free(ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: HeapManager.h
|
|
||||||
|
|
||||||
Copyright 2009 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef HEAPMANAGER_H_
|
|
||||||
#define HEAPMANAGER_H_
|
|
||||||
|
|
||||||
#include <nn.h>
|
|
||||||
#include <nn/fnd.h>
|
|
||||||
|
|
||||||
class HeapManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit HeapManager(size_t byteSize, s32 alignment = nn::fnd::ExpHeapBase::DEFAULT_ALIGNMENT, bit8 groupId = 0,
|
|
||||||
nn::fnd::ExpHeapBase::AllocationMode mode = nn::fnd::ExpHeapBase::ALLOCATION_MODE_FIRST_FIT, bool reuse = false);
|
|
||||||
virtual ~HeapManager();
|
|
||||||
|
|
||||||
void* GetAddr();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void* m_Ptr;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
void InitializeHeap();
|
|
||||||
size_t GetAllocatableSize(s32 alignment = nn::fnd::ExpHeapBase::DEFAULT_ALIGNMENT);
|
|
||||||
|
|
||||||
// HeapManagerを使わず確保する場合のみ
|
|
||||||
void* ForceAllocate(size_t byteSize, s32 alignment = nn::fnd::ExpHeapBase::DEFAULT_ALIGNMENT, bit8 groupId = 0,
|
|
||||||
nn::fnd::ExpHeapBase::AllocationMode mode = nn::fnd::ExpHeapBase::ALLOCATION_MODE_FIRST_FIT, bool reuse = false);
|
|
||||||
|
|
||||||
// HeapManagerを使わず解放する場合のみ
|
|
||||||
void ForceFree(void* ptr);
|
|
||||||
|
|
||||||
#endif /* HEAPMANAGER_H_ */
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
#!/usr/bin/env omake
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Project: Horizon
|
|
||||||
# File: OMakefile
|
|
||||||
#
|
|
||||||
# Copyright (C)2009 Nintendo Co., Ltd. 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.
|
|
||||||
#
|
|
||||||
# $Rev$
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
CTR_APPTYPE=CARD
|
|
||||||
|
|
||||||
SUPPORTED_TARGETS = CTR-T*.Process.MPCore.*
|
|
||||||
|
|
||||||
SAMPLED_DEMOS_COMMON_INCLUDE_DIR = $(dir $(HORIZON_ROOT)/../CTR/SampleDemos/common/include)
|
|
||||||
INCLUDES += $(SAMPLED_DEMOS_COMMON_INCLUDE_DIR)
|
|
||||||
|
|
||||||
SOURCES[] =
|
|
||||||
main.cpp
|
|
||||||
scrollBuffer.cpp
|
|
||||||
VersionDetect.cpp
|
|
||||||
HeapManager.cpp
|
|
||||||
|
|
||||||
LIBS += lib_demo \
|
|
||||||
libnn_am \
|
|
||||||
libnn_cup \
|
|
||||||
libnn_ns \
|
|
||||||
|
|
||||||
ROMFS_ROOT = romfiles
|
|
||||||
|
|
||||||
DESCRIPTOR = SelfCup.desc
|
|
||||||
|
|
||||||
TARGET_PROGRAM = SelfCupTool
|
|
||||||
|
|
||||||
TITLE = SelfCupTool
|
|
||||||
ROM_SPEC_FILE = SelfCupTool.rsf
|
|
||||||
|
|
||||||
CTR_BANNER_SPEC = $(TARGET_PROGRAM).bsf
|
|
||||||
|
|
||||||
include $(ROOT_OMAKE)/modulerules
|
|
||||||
|
|
||||||
build: $(DEFAULT_TARGETS)
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
#!/usr/bin/env omake
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Project: Horizon
|
|
||||||
# File: OMakeroot
|
|
||||||
#
|
|
||||||
# Copyright (C)2009 Nintendo Co., Ltd. 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.
|
|
||||||
#
|
|
||||||
# $Rev:$
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# ディレクトリレイアウトについての説明
|
|
||||||
#
|
|
||||||
# a) ソースコードがルートディレクトリ直下に配置される場合
|
|
||||||
# 例:
|
|
||||||
# /OMakeroot
|
|
||||||
# /foo/bar/OMakefile
|
|
||||||
#
|
|
||||||
# 結果:
|
|
||||||
# OMakefile と同じディレクトリ以下に objects や images が生成されます。
|
|
||||||
#
|
|
||||||
# /foo/bar/objects/...
|
|
||||||
# /foo/bar/images/..
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# b) ソースコードが sources 以下に配置される場合
|
|
||||||
# 例:
|
|
||||||
# /OMakeroot
|
|
||||||
# /sources/foo/bar/OMakefile
|
|
||||||
#
|
|
||||||
# 結果:
|
|
||||||
# ルートディレクトリ以下に objects や images が生成されます。
|
|
||||||
#
|
|
||||||
# /objects/foo/bar/...
|
|
||||||
# /images/foo/bar/...
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
# ルート環境変数の取得
|
|
||||||
public.HORIZON_ROOT =
|
|
||||||
if $(defined-env HORIZON_ROOT)
|
|
||||||
HORIZON_ROOT = $(absname $(getenv HORIZON_ROOT))
|
|
||||||
export
|
|
||||||
|
|
||||||
if $(defined-env CTRSDK_ROOT)
|
|
||||||
CTRSDK_ROOT = $(absname $(getenv CTRSDK_ROOT))
|
|
||||||
if $(and $(defined-env HORIZON_ROOT), $(not $(equal $(HORIZON_ROOT), $(CTRSDK_ROOT))))
|
|
||||||
eprintln(HORIZON_ROOT と CTRSDK_ROOT が一致しません。同じパスを設定するか、どちらか一方だけを定義して下さい。)
|
|
||||||
exit(1)
|
|
||||||
HORIZON_ROOT = $(CTRSDK_ROOT)
|
|
||||||
export
|
|
||||||
|
|
||||||
if $(not $(HORIZON_ROOT))
|
|
||||||
eprintln($"$$CTRSDK_ROOT が定義されていません")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
include $(HORIZON_ROOT)/build/omake/commondefs
|
|
||||||
|
|
||||||
DefineCommandVars()
|
|
||||||
|
|
||||||
.PHONY: all build clean clobber
|
|
||||||
.PHONY: run run-scripts run-emumem
|
|
||||||
|
|
||||||
#
|
|
||||||
# OMakefile の読み込み
|
|
||||||
#
|
|
||||||
.SUBDIRS: .
|
|
||||||
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
ビルド環境
|
|
||||||
・SDK
|
|
||||||
Horizon 2.3 branch r38025 + r38091 SelfCup.desc
|
|
||||||
+ trunk r38944 pl_SharedDataTitleId.h
|
|
||||||
+ trunk r46913 CTR_UniqueId.inc
|
|
||||||
+ trunk r46913 CTR_Version.inc
|
|
||||||
@ -1,230 +0,0 @@
|
|||||||
AccessControlDescriptor:
|
|
||||||
AffinityMask: 1
|
|
||||||
AutoGen: true
|
|
||||||
CoreVersion: 3
|
|
||||||
DescVersion: 2
|
|
||||||
Descriptor: |
|
|
||||||
AP///wAABAADAAAAAAAFGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiAAAAAAAAABBUFQ6VQAAACRo
|
|
||||||
aW9GSU8AJGhvc3RpbzAkaG9zdGlvMWFjOnUAAAAAYm9zczpVAABjYW06dQAA
|
|
||||||
AGNlY2Q6dQAAY2ZnOnUAAABkbHA6RktDTGRscDpTUlZSZHNwOjpEU1BmcmQ6
|
|
||||||
dQAAAGZzOlVTRVIAZ3NwOjpHcHVoaWQ6VVNFUmh0dHA6QwAAbWljOnUAAABu
|
|
||||||
ZG06dQAAAG5ld3M6dQAAbndtOjpVRFNwdG06dQAAAHB4aTpkZXYAc29jOlUA
|
|
||||||
AABzc2w6QwAAAHkycjp1AAAAaXI6dQAAAABhbTpzeXMAAG5zOnMAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAD+//vw/7//8ec/APIA8JH/APaR/1D/gf9Y/4H/cP+B/3j/gf8B
|
|
||||||
AQD/AAIA/v//////////////////////////////////////////////////
|
|
||||||
////////////////////////////////////////AAAAAAAAAAAAAAAAAAAA
|
|
||||||
AAAAAAAAAAAAAAAAAAAAAAI=
|
|
||||||
DisableDebug: false
|
|
||||||
EnableInterruptNumbers: []
|
|
||||||
EnableSystemCalls:
|
|
||||||
ArbitrateAddress: 34
|
|
||||||
Break: 60
|
|
||||||
CancelTimer: 28
|
|
||||||
ClearEvent: 25
|
|
||||||
ClearTimer: 29
|
|
||||||
CloseHandle: 35
|
|
||||||
ConnectToPort: 45
|
|
||||||
ControlMemory: 1
|
|
||||||
CreateAddressArbiter: 33
|
|
||||||
CreateEvent: 23
|
|
||||||
CreateMemoryBlock: 30
|
|
||||||
CreateMutex: 19
|
|
||||||
CreateSemaphore: 21
|
|
||||||
CreateThread: 8
|
|
||||||
CreateTimer: 26
|
|
||||||
DuplicateHandle: 39
|
|
||||||
ExitProcess: 3
|
|
||||||
ExitThread: 9
|
|
||||||
GetCurrentProcessorNumber: 17
|
|
||||||
GetHandleInfo: 41
|
|
||||||
GetProcessAffinityMask: 4
|
|
||||||
GetProcessId: 53
|
|
||||||
GetProcessIdOfThread: 54
|
|
||||||
GetProcessIdealProcessor: 6
|
|
||||||
GetProcessInfo: 43
|
|
||||||
GetResourceLimit: 56
|
|
||||||
GetResourceLimitCurrentValues: 58
|
|
||||||
GetResourceLimitLimitValues: 57
|
|
||||||
GetSystemInfo: 42
|
|
||||||
GetSystemTick: 40
|
|
||||||
GetThreadAffinityMask: 13
|
|
||||||
GetThreadContext: 59
|
|
||||||
GetThreadId: 55
|
|
||||||
GetThreadIdealProcessor: 15
|
|
||||||
GetThreadInfo: 44
|
|
||||||
GetThreadPriority: 11
|
|
||||||
MapMemoryBlock: 31
|
|
||||||
OutputDebugString: 61
|
|
||||||
QueryMemory: 2
|
|
||||||
ReleaseMutex: 20
|
|
||||||
ReleaseSemaphore: 22
|
|
||||||
SendSyncRequest1: 46
|
|
||||||
SendSyncRequest2: 47
|
|
||||||
SendSyncRequest3: 48
|
|
||||||
SendSyncRequest4: 49
|
|
||||||
SendSyncRequest: 50
|
|
||||||
SetProcessAffinityMask: 5
|
|
||||||
SetProcessIdealProcessor: 7
|
|
||||||
SetThreadAffinityMask: 14
|
|
||||||
SetThreadIdealProcessor: 16
|
|
||||||
SetThreadPriority: 12
|
|
||||||
SetTimer: 27
|
|
||||||
SignalEvent: 24
|
|
||||||
SleepThread: 10
|
|
||||||
UnmapMemoryBlock: 32
|
|
||||||
WaitSynchronization1: 36
|
|
||||||
WaitSynchronizationN: 37
|
|
||||||
FileSystemAccess:
|
|
||||||
- Debug
|
|
||||||
- DirectSdmc
|
|
||||||
HandleTableSize: 512
|
|
||||||
IORegisterMapping:
|
|
||||||
- 1ff50000-1ff57fff
|
|
||||||
- 1ff70000-1ff77fff
|
|
||||||
IdealProcessor: 1
|
|
||||||
MemoryMapping:
|
|
||||||
- 1f000000-1f5fffff:r
|
|
||||||
MemoryType: Application
|
|
||||||
Priority: 24
|
|
||||||
ProgramId: 0x00040000ffffff00L
|
|
||||||
ServiceAccessControl:
|
|
||||||
- APT:U
|
|
||||||
- $hioFIO
|
|
||||||
- $hostio0
|
|
||||||
- $hostio1
|
|
||||||
- ac:u
|
|
||||||
- boss:U
|
|
||||||
- cam:u
|
|
||||||
- cecd:u
|
|
||||||
- cfg:u
|
|
||||||
- dlp:FKCL
|
|
||||||
- dlp:SRVR
|
|
||||||
- dsp::DSP
|
|
||||||
- frd:u
|
|
||||||
- fs:USER
|
|
||||||
- gsp::Gpu
|
|
||||||
- hid:USER
|
|
||||||
- http:C
|
|
||||||
- mic:u
|
|
||||||
- ndm:u
|
|
||||||
- news:u
|
|
||||||
- nwm::UDS
|
|
||||||
- ptm:u
|
|
||||||
- pxi:dev
|
|
||||||
- soc:U
|
|
||||||
- ssl:C
|
|
||||||
- y2r:u
|
|
||||||
- ir:u
|
|
||||||
- am:sys
|
|
||||||
- ns:s
|
|
||||||
Signature: |
|
|
||||||
JoBlPTNpFJiK0Vb+pw2vG5sMzDb6Z4wzALKvDHCSxDLZccb2sZS68CEsfhRD
|
|
||||||
j2oxkUaPuT9vKqM2fHZWdIswWhgSDXTH2fMxI3EEv69bx/Q/TOmVXdgAdyDs
|
|
||||||
3f9jnbFls6/TSWurjEuP6lHvJRFu/6uf+OMw0J70IGdTEhStY9F8ow22CQwy
|
|
||||||
bFsOTc/NXLqBcfCvbEWBLU9NF61mosAUWh0tmC2TDWi6lX7Yy4gbzehRdRwi
|
|
||||||
S8LHYSR0j3uTmNG8no9dJblwrvL92EtWaNNO7GJpvCXUGD3ZROAvQkztOgUB
|
|
||||||
y625LBuluwzDpPtZKOu94I61HzFW0Y9FRDxDVDkoMQ==
|
|
||||||
StorageId:
|
|
||||||
- 0
|
|
||||||
CommonHeaderKey:
|
|
||||||
D: |
|
|
||||||
SN7UPSo53uqDohKCYF4ToTBmqKDa5LJk/fT5rV5TiZa1oz2locDUSu77FRZp
|
|
||||||
JI4GRKc5mZG0MUh7WDD1ZVrE5sfaIA+yMYIHyAbXmL/nICn9Ef1mXnXCsX/O
|
|
||||||
Q+c/YNpRyluF94o/XM1f47z1wWM88vycWxMxpCQsQuHjZxtbDZ3bwGA3UrJC
|
|
||||||
D89jW4faZrAwfmqmdY3Iiv0lMeKSMb46BXBGMZ3Cm6lsbMvyF5xM/xaU0hGE
|
|
||||||
AYvoZ+2JzhevgojbVdMZo95UzsMBUpJe2/tH3svPtwYn2PfUbXJ46hKof0Nw
|
|
||||||
2B8jLMoTd5AIqpHZMdg1xy6cV6k6eYr3dNjMhEnwgQ==
|
|
||||||
DP: |
|
|
||||||
Jjc+wFMt0tdOmsHyMMpn7lQBiZbyFk2uX2SM2cgVnF89ybRvXDh1sNKrQOCs
|
|
||||||
OcpiKyCBGSNTQSy+250wVS3S4LML0syDE3v1qnS2Tilq/mSA4h3VYKQaIjOP
|
|
||||||
kQCjcy2rcjRLdTbgzsP/vuomz8qhk9pdbF2ag/H/b7a8IeSWiBk=
|
|
||||||
DQ: |
|
|
||||||
dxgd/9odYmc6TAED2mzyCyoNFEMD+dL5mgDb2S6DHKNE2JGXPaNe4m5qgswb
|
|
||||||
dfPolU0IxMfMk97wgDjSftd49Q9UhnA80I+vg449vTk0pb6ARC4uQAiR/I89
|
|
||||||
RzLCL/Xv8h1xLmb6aCiFtUoRUZuqk702SFZfAPl2lYbbEjm3sj0=
|
|
||||||
Exponent: |
|
|
||||||
AQAB
|
|
||||||
InverseQ: |
|
|
||||||
t7+DBhtWfLIKD3+57prNyoRgeXl9P8OZN+sXOC0ccKXFvvoG8HI3Xaf7z6gu
|
|
||||||
SfiKjRbSyou4GqLQGIvO2FJZVkIV+dbDrXC46J/UU2cSmJUNyWjwItgDQo0b
|
|
||||||
aL+dfl0JqNuQLomqJXU7KKhDZCstCR/Ye7z1NWRzAvasjuq613w=
|
|
||||||
Modulus: |
|
|
||||||
s24VC3NBkbOKPU7pouZC76Yzy3Dp+Ed/z56o164jUUbcKW270eT5HGy0tXQY
|
|
||||||
RD5G0PY2BhxLb53wJ9KUGu7JJvsB2ItLV4dIqDDvJRVQGgS+eugmbutQBFVB
|
|
||||||
DiJZfUjkuqVIlvhy3xzSsHv5hUfGWahGZxqDzWzh+12M0jR/gly3XAmIxKYd
|
|
||||||
Kqc3nyTaefOcLl6MArmQYMU83j8hlmqlCtuWQhvTiQFGFyIZFr9+zzfPgRzt
|
|
||||||
mKQbhrsGMqtBIitI4jS0ze9caA0JeoD7Y1p79bhPu3PU9rId01YnrV6zSddj
|
|
||||||
Zd9LEsNqFCsHS7Vlafd7KOtu6uvtYYXIVUUH6lrBZw==
|
|
||||||
P: |
|
|
||||||
3xUo397CAFhSrqGwZECAQZPeeLnI5JBOvNKymBygLEFyJX3qQv0aI0KnCdN4
|
|
||||||
PxWvFjOsw4+jzKZGMXtV8ySk9n1g1lkbqLD4mUjqeMyy2x4PPvkgAJS7wpBg
|
|
||||||
yQdUbqljh1Myio29IsqtaJdaxi8MnuJdDK26H7Tr0EGTVtMFX8k=
|
|
||||||
Q: |
|
|
||||||
zef2+iAMFC8JVAXjXHYi4EXAlhdsQ9pB3gF4pUntI2sNwzwJqna0MmPnpDJJ
|
|
||||||
5dGpKFRhGeyILSMwQVRKBEEoKQJtsIeGcQfgCX5r8fIL2iW5sz4AH32W0HoQ
|
|
||||||
AkT6AfkOhT5NsRe13gJII9+S1V1gNQAbszP7/1rVDdrAYBhFj68=
|
|
||||||
DefaultSpec:
|
|
||||||
AccessControlInfo:
|
|
||||||
AffinityMask: 1
|
|
||||||
FirmwareVersion: 3
|
|
||||||
HandleTableSize: 512
|
|
||||||
IORegisterMapping:
|
|
||||||
- 1ff50000-1ff57fff
|
|
||||||
- 1ff70000-1ff77fff
|
|
||||||
IdealProcessor: 0
|
|
||||||
MemoryMapping:
|
|
||||||
- 1f000000-1f5fffff:r
|
|
||||||
Priority: 16
|
|
||||||
BasicInfo:
|
|
||||||
CompanyCode: "00"
|
|
||||||
Logo: Nintendo
|
|
||||||
Title: default
|
|
||||||
ExeFs:
|
|
||||||
ReadOnly:
|
|
||||||
- RO
|
|
||||||
ReadWrite:
|
|
||||||
- RW
|
|
||||||
Text:
|
|
||||||
- STUP_ENTRY
|
|
||||||
Media:
|
|
||||||
MediaType: Card
|
|
||||||
PlainRegion:
|
|
||||||
- .module_id
|
|
||||||
Rom:
|
|
||||||
DefaultReject:
|
|
||||||
- .*
|
|
||||||
File:
|
|
||||||
- "*"
|
|
||||||
SystemControlInfo:
|
|
||||||
Dependency:
|
|
||||||
ac: 0x0004013000002403L
|
|
||||||
am: 0x0004013000001503L
|
|
||||||
boss: 0x0004013000003403L
|
|
||||||
camera: 0x0004013000001603L
|
|
||||||
cecd: 0x0004013000002603L
|
|
||||||
cfg: 0x0004013000001703L
|
|
||||||
codec: 0x0004013000001803L
|
|
||||||
csnd: 0x0004013000002703L
|
|
||||||
dlp: 0x0004013000002803L
|
|
||||||
dsp: 0x0004013000001a03L
|
|
||||||
friends: 0x0004013000003203L
|
|
||||||
gpio: 0x0004013000001b03L
|
|
||||||
gsp: 0x0004013000001c03L
|
|
||||||
hid: 0x0004013000001d03L
|
|
||||||
http: 0x0004013000002903L
|
|
||||||
i2c: 0x0004013000001e03L
|
|
||||||
mcu: 0x0004013000001f03L
|
|
||||||
mic: 0x0004013000002003L
|
|
||||||
ndm: 0x0004013000002b03L
|
|
||||||
news: 0x0004013000003503L
|
|
||||||
nim: 0x0004013000002c03L
|
|
||||||
nwm: 0x0004013000002d03L
|
|
||||||
pdn: 0x0004013000002103L
|
|
||||||
ps: 0x0004013000003103L
|
|
||||||
ptm: 0x0004013000002203L
|
|
||||||
socket: 0x0004013000002e03L
|
|
||||||
spi: 0x0004013000002303L
|
|
||||||
ssl: 0x0004013000002f03L
|
|
||||||
StackSize: 16384
|
|
||||||
Binary file not shown.
@ -1,18 +0,0 @@
|
|||||||
BasicInfo:
|
|
||||||
Title: SelfCupTool
|
|
||||||
ProductCode: CTR-P-234A
|
|
||||||
BackupMemoryType: None
|
|
||||||
Logo: Nintendo
|
|
||||||
|
|
||||||
TitleInfo:
|
|
||||||
Use: Evaluation
|
|
||||||
UniqueId: 0xf802a
|
|
||||||
Version: 0
|
|
||||||
|
|
||||||
SystemControlInfo:
|
|
||||||
AppType : Application
|
|
||||||
StackSize : 65536
|
|
||||||
Dependency:
|
|
||||||
- codec
|
|
||||||
- hid
|
|
||||||
- gsp
|
|
||||||
@ -1,109 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: VersionDetect.cpp
|
|
||||||
|
|
||||||
Copyright 2009 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <nn.h>
|
|
||||||
#include <nn/fs.h>
|
|
||||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
|
||||||
|
|
||||||
#include "VersionDetect.h"
|
|
||||||
#include "HeapManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
void GetCupVersion(nn::pl::CTR::CardUpdateVersion* cup, nn::cfg::CTR::CfgRegionCode region)
|
|
||||||
{
|
|
||||||
nn::Result result;
|
|
||||||
const size_t BUF_SIZE = 1024;
|
|
||||||
u8 buf[BUF_SIZE];
|
|
||||||
// CUPバージョン
|
|
||||||
{
|
|
||||||
result = nn::fs::MountContent("cver:", nn::fs::MEDIA_TYPE_NAND, cCupVerId[region], 0, 1, 1, buf,
|
|
||||||
BUF_SIZE);
|
|
||||||
|
|
||||||
nn::fs::FileInputStream fis;
|
|
||||||
|
|
||||||
result = fis.TryInitialize(L"cver:/version.bin");
|
|
||||||
if (result.IsSuccess())
|
|
||||||
{
|
|
||||||
s64 fileSize = fis.GetSize();
|
|
||||||
NN_LOG("version.bin size = %lld\n", fileSize);
|
|
||||||
s32 ret;
|
|
||||||
void* addr = NULL;
|
|
||||||
HeapManager heap(fileSize);
|
|
||||||
addr = heap.GetAddr();
|
|
||||||
if (addr != NULL)
|
|
||||||
{
|
|
||||||
result = fis.TryRead(&ret, addr, fileSize);
|
|
||||||
if (result.IsSuccess())
|
|
||||||
{
|
|
||||||
nn::pl::CTR::CardUpdateVersion* ver_buf = reinterpret_cast<nn::pl::CTR::CardUpdateVersion*> (addr);
|
|
||||||
|
|
||||||
std::memcpy(cup, ver_buf, sizeof(nn::pl::CTR::CardUpdateVersion));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fis.Finalize();
|
|
||||||
|
|
||||||
nn::fs::Unmount("cver:");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GetNupVersion(nn::pl::CTR::NetworkUpdateVersion* nup, nn::cfg::CTR::CfgRegionCode region)
|
|
||||||
{
|
|
||||||
nn::Result result;
|
|
||||||
const size_t BUF_SIZE = 1024;
|
|
||||||
u8 buf[BUF_SIZE];
|
|
||||||
|
|
||||||
// NUPバージョン
|
|
||||||
{
|
|
||||||
result = nn::fs::MountContent("nver:", nn::fs::MEDIA_TYPE_NAND, cNupVerId[region], 0, 1, 1, buf,
|
|
||||||
BUF_SIZE);
|
|
||||||
|
|
||||||
nn::fs::FileInputStream fis;
|
|
||||||
|
|
||||||
result = fis.TryInitialize(L"nver:/version.bin");
|
|
||||||
if (result.IsSuccess())
|
|
||||||
{
|
|
||||||
s64 fileSize = fis.GetSize();
|
|
||||||
NN_LOG("version.bin size = %lld\n", fileSize);
|
|
||||||
s32 ret;
|
|
||||||
void* addr = NULL;
|
|
||||||
HeapManager heap(fileSize);
|
|
||||||
addr = heap.GetAddr();
|
|
||||||
if (addr != NULL)
|
|
||||||
{
|
|
||||||
result = fis.TryRead(&ret, addr, fileSize);
|
|
||||||
if (result.IsSuccess())
|
|
||||||
{
|
|
||||||
nn::pl::CTR::NetworkUpdateVersion* ver_buf =
|
|
||||||
reinterpret_cast<nn::pl::CTR::NetworkUpdateVersion*> (addr);
|
|
||||||
|
|
||||||
std::memcpy(nup, ver_buf, sizeof(nn::pl::CTR::NetworkUpdateVersion));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fis.Finalize();
|
|
||||||
nn::fs::Unmount("nver:");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetSystemVersion(VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region)
|
|
||||||
{
|
|
||||||
GetCupVersion(&mVerData->cup, region);
|
|
||||||
GetNupVersion(&mVerData->nup, region);
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: VersionDetect.h
|
|
||||||
|
|
||||||
Copyright 2009 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef VERSIONDETECT_H_
|
|
||||||
#define VERSIONDETECT_H_
|
|
||||||
|
|
||||||
#include <nn/cfg/CTR/cfg_RegionCode.h>
|
|
||||||
#include <nn/pl/CTR/pl_SharedDataTitleId.h>
|
|
||||||
#include <nn/pl/CTR/pl_Version.h>
|
|
||||||
|
|
||||||
struct VerDef
|
|
||||||
{
|
|
||||||
nn::pl::CTR::CardUpdateVersion cup;
|
|
||||||
nn::pl::CTR::NetworkUpdateVersion nup;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO:リージョン追加時に範囲外アクセスにならないよう注意
|
|
||||||
const nn::ProgramId cCupVerId[] =
|
|
||||||
{
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_JP,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_US,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_EU,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_EU,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_CN,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_KR,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_CUP_VERSION_TW,
|
|
||||||
};
|
|
||||||
|
|
||||||
const nn::ProgramId cNupVerId[] =
|
|
||||||
{
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_JP,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_US,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_EU,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_EU,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_CN,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_KR,
|
|
||||||
nn::pl::CTR::SHAREDDATA_TITLEID_NUP_VERSION_TW,
|
|
||||||
};
|
|
||||||
|
|
||||||
// リージョンコードに基づいてバージョン情報を取得する
|
|
||||||
void GetSystemVersion(VerDef* mVerData, nn::cfg::CTR::CfgRegionCode region);
|
|
||||||
|
|
||||||
#endif /* VERSIONDETECT_H_ */
|
|
||||||
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ф8ф8фШчГГГГГГВ╫В╫8фВ╫В╫В╫В╫В╫ГГГГшчфГШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГШчyнYнВ╫шчшчВ╫В╫фВ╫В╫шчyнШчВ╫yнГГГГyнШФГГГГГшчВ╫В╫В╫В╫YнГyнГВ╫В╫В╫В╫В╫yнфшчГШФГYнyнВ╫В╫В╫yнВ╫╨жВ╫В╫В╫В╫В╫yнВ╫yнВ╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫yнГYнГВ╫В╫В╫В╫В╫фВ╫В╫ГyнГ8фВ╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
|
||||||
@ -1 +0,0 @@
|
|||||||
В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫8ф8фВ╫В╫В╫╨ж8ф╨жГГшчГГГГГГГГГГГГГГГГГГГГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8ф8фВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГШФГГГГГГГГГГ жфГГВ╫В╫ жВ╫ГГГГГ жГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫шчВ╫В╫В╫В╫В╫ГВ╫ШчВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫╨жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГГГГГГГГГГГГГГГШФ8фШчшчВ╫В╫ жВ╫YнВ╫В╫В╫В╫В╫ГГYнyнГГyнфВ╫В╫В╫В╫В╫В╫В╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчшчГшчШФВ╫В╫ГГYнГВ╫В╫В╫В╫В╫шчВ╫шчГГГГГГГГГГГГГГГГВ╫В╫YнШч жГГГГГГГГГГГГГГГГГГГГГГГГшч╨жВ╫ жВ╫шчВ╫В╫В╫В╫В╫ШФВ╫ШФВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шчВ╫yнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫YнВ╫ жГГГГВ╫шчВ╫шчГГГГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫╨жшчВ╫В╫В╫В╫В╫YнфyнГГГГГГГГГ жГГГГ╨жВ╫YнВ╫ШФYнВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫шч жВ╫В╫В╫В╫В╫В╫yнВ╫ГШФВ╫В╫фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ШФВ╫ГГГГГВ╫ШчВ╫YнГГШФГВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫ГГГГ жВ╫шчВ╫ГГГшч жВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫8фВ╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫В╫
|
|
||||||
@ -1,369 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: main.cpp
|
|
||||||
|
|
||||||
Copyright (C)2009 Nintendo Co., Ltd. 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <nn.h>
|
|
||||||
#include <nn/os.h>
|
|
||||||
#include <nn/dbg.h>
|
|
||||||
#include <nn/CTR.h>
|
|
||||||
#include <nn/ns.h>
|
|
||||||
#include <nn/ns/CTR/ns_ApiShell.h>
|
|
||||||
#include <nn/ns/CTR/ns_Shell.h>
|
|
||||||
#include <nn/fs/fs_FileSystemBase.h>
|
|
||||||
#include <nn/fs/CTR/MPCore/fs_FileSystemBasePrivate.h>
|
|
||||||
#include <nn/applet/CTR/applet_APIForSystem.h>
|
|
||||||
#include <nn/am.h>
|
|
||||||
#include <nn/cfg.h>
|
|
||||||
#include <nn/ptm_Private.h>
|
|
||||||
|
|
||||||
#include <nn/cup.h>
|
|
||||||
|
|
||||||
#include "demo.h"
|
|
||||||
#include "scrollBuffer.h"
|
|
||||||
#include "VersionDetect.h"
|
|
||||||
#include "HeapManager.h"
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
const s32 s_GxHeapSize = 0x800000;
|
|
||||||
uptr s_GxHeap;
|
|
||||||
|
|
||||||
demo::RenderSystemDrawing s_RenderSystem;
|
|
||||||
ScrollBuffer s_scrollBufferInstance;
|
|
||||||
ScrollBuffer *s_scrollBuffer;
|
|
||||||
|
|
||||||
char s_updaterBuffer[1 << 20] NN_ATTRIBUTE_ALIGN(4096);
|
|
||||||
|
|
||||||
nn::ProgramId GetHomeMenuProgramId(nn::cfg::CTR::CfgRegionCode region)
|
|
||||||
{
|
|
||||||
nn::ProgramId pid;
|
|
||||||
bit32 uid = nn::CTR::PROGRAM_ID_UNIQUE_ID_HOMEMENU;
|
|
||||||
bit8 ver = nn::CTR::PROGRAM_ID_VERSION_HOMEMENU;
|
|
||||||
|
|
||||||
switch( region )
|
|
||||||
{
|
|
||||||
case nn::cfg::CTR::CFG_REGION_AMERICA:
|
|
||||||
uid = nn::CTR::PROGRAM_ID_UNIQUE_ID_SYSMENU_US;
|
|
||||||
ver = nn::CTR::PROGRAM_ID_VERSION_SYSMENU_US;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nn::cfg::CTR::CFG_REGION_EUROPE:
|
|
||||||
case nn::cfg::CTR::CFG_REGION_AUSTRALIA:
|
|
||||||
uid = nn::CTR::PROGRAM_ID_UNIQUE_ID_SYSMENU_EU;
|
|
||||||
ver = nn::CTR::PROGRAM_ID_VERSION_SYSMENU_EU;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nn::cfg::CTR::CFG_REGION_CHINA:
|
|
||||||
uid = nn::CTR::PROGRAM_ID_UNIQUE_ID_SYSMENU_CN;
|
|
||||||
ver = nn::CTR::PROGRAM_ID_VERSION_SYSMENU_CN;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nn::cfg::CTR::CFG_REGION_KOREA:
|
|
||||||
uid = nn::CTR::PROGRAM_ID_UNIQUE_ID_SYSMENU_KR;
|
|
||||||
ver = nn::CTR::PROGRAM_ID_VERSION_SYSMENU_KR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nn::cfg::CTR::CFG_REGION_TAIWAN:
|
|
||||||
uid = nn::CTR::PROGRAM_ID_UNIQUE_ID_SYSMENU_TW;
|
|
||||||
ver = nn::CTR::PROGRAM_ID_VERSION_SYSMENU_TW;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pid = nn::CTR::MakeProgramId( nn::CTR::PROGRAM_ID_CATEGORY_APPLET,
|
|
||||||
uid,
|
|
||||||
ver ); // プログラムID
|
|
||||||
return pid;
|
|
||||||
}
|
|
||||||
|
|
||||||
// デモの初期化
|
|
||||||
void Initialize()
|
|
||||||
{
|
|
||||||
// NuiShellの初期化 (CUPに必須)
|
|
||||||
NN_UTIL_PANIC_IF_FAILED(nn::ns::CTR::InitializeForShell());
|
|
||||||
|
|
||||||
// amの初期化
|
|
||||||
nn::am::InitializeForSystemMenu();
|
|
||||||
|
|
||||||
// fsの初期化 (カード確認用)
|
|
||||||
nn::fs::Initialize();
|
|
||||||
|
|
||||||
// appletの初期化
|
|
||||||
//nn::applet::InitializeForSystem( nn::applet::PHOME_MENU_APPLET_ID, nn::applet::TYPE_SYS );
|
|
||||||
//nn::applet::Initialize( nn::applet::TEST2_APPLET_ID);
|
|
||||||
//nn::applet::SetAppletMode();
|
|
||||||
nn::applet::Enable();
|
|
||||||
|
|
||||||
nn::cfg::Initialize();
|
|
||||||
|
|
||||||
// デバイスメモリの設定
|
|
||||||
const s32 DEVICE_MEMORY_SIZE = 32 * 1024 * 1024;
|
|
||||||
NN_UTIL_PANIC_IF_FAILED(nn::os::SetDeviceMemorySize(DEVICE_MEMORY_SIZE));
|
|
||||||
|
|
||||||
// ヒープの初期化
|
|
||||||
InitializeHeap();
|
|
||||||
|
|
||||||
// 描画インスタンスの初期化
|
|
||||||
s_GxHeap = reinterpret_cast<uptr>(ForceAllocate(s_GxHeapSize));
|
|
||||||
s_RenderSystem.Initialize(s_GxHeap, s_GxHeapSize);
|
|
||||||
|
|
||||||
// 描画インスタンスの初期化
|
|
||||||
s_scrollBufferInstance.Initialize(&s_RenderSystem);
|
|
||||||
s_scrollBuffer = &s_scrollBufferInstance;
|
|
||||||
|
|
||||||
// GPU利用宣言
|
|
||||||
nn::applet::AssignGpuRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 消費時間取得用関数群
|
|
||||||
s64 s_StartTick;
|
|
||||||
void SetTick()
|
|
||||||
{
|
|
||||||
s_StartTick = nn::os::Tick::GetSystemCurrent();
|
|
||||||
}
|
|
||||||
s64 GetConsumedMillisec()
|
|
||||||
{
|
|
||||||
s64 endTick = nn::os::Tick::GetSystemCurrent();
|
|
||||||
nn::os::Tick consumed(endTick - s_StartTick);
|
|
||||||
return ((nn::fnd::TimeSpan) consumed).GetMilliSeconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 動いていることを知らせるための、くるくる画面表示取得用メソッド
|
|
||||||
const char s_progress[] = "-\\|/";
|
|
||||||
s32 s_progressIndex = 0;
|
|
||||||
char GetProgressChar()
|
|
||||||
{
|
|
||||||
s_progressIndex = (s_progressIndex + 1) % (sizeof(s_progress) - 1);
|
|
||||||
return s_progress[s_progressIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::Result UpdateCore()
|
|
||||||
{
|
|
||||||
nn::Result result;
|
|
||||||
nn::cup::ProgressInfo info;
|
|
||||||
|
|
||||||
/********************** アップデート*******************/
|
|
||||||
SetTick();
|
|
||||||
s_scrollBuffer->AppendText("Start Card Update")->Render();
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(nn::cup::CTR::DoUpdate());
|
|
||||||
|
|
||||||
// ステータスがStartedになるまで、プログレスは取得できない
|
|
||||||
s_scrollBuffer->AppendText("");
|
|
||||||
do
|
|
||||||
{
|
|
||||||
s_scrollBuffer->ReplaceText(" %c Initializing", GetProgressChar())->Render();
|
|
||||||
result = nn::cup::CTR::GetProgressInfo(&info);
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(result);
|
|
||||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(40));
|
|
||||||
} while (info.state == nn::cup::CTR::UPDATE_STATE_INITIALIZING);
|
|
||||||
|
|
||||||
// 抜けた際のstateがFAILEDかどうか確認
|
|
||||||
if (info.state == nn::cup::CTR::UPDATE_STATE_FAILED)
|
|
||||||
{
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(info.lastResult);
|
|
||||||
}
|
|
||||||
s_scrollBuffer->ReplaceText(" - Initialized (%lldmsec)", GetConsumedMillisec());
|
|
||||||
|
|
||||||
/********************* アップデート中 ******************/
|
|
||||||
SetTick();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
do
|
|
||||||
{
|
|
||||||
result = nn::cup::CTR::GetProgressInfo(&info);
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(result);
|
|
||||||
s_scrollBuffer->ReplaceText(" %c Title %d/%d, size %lld/%lld", GetProgressChar(), info.numImportedTitles,
|
|
||||||
info.numTotalTitles, info.importedSize, info.totalSize)->Render();
|
|
||||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(40));
|
|
||||||
|
|
||||||
} while (info.state == nn::cup::CTR::UPDATE_STATE_STARTED);
|
|
||||||
// 抜けた際のstateがFAILEDかどうか確認
|
|
||||||
if (info.state == nn::cup::CTR::UPDATE_STATE_FAILED)
|
|
||||||
{
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(info.lastResult);
|
|
||||||
}
|
|
||||||
s_scrollBuffer->AppendText(" - Imported (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
|
|
||||||
/***************** アップデート終了中 ******************/
|
|
||||||
SetTick();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
do
|
|
||||||
{
|
|
||||||
result = nn::cup::CTR::GetProgressInfo(&info);
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(result);
|
|
||||||
s_scrollBuffer->ReplaceText(" %c Update Finalizing", GetProgressChar())->Render();
|
|
||||||
nn::os::Thread::Sleep(nn::fnd::TimeSpan::FromMilliSeconds(40));
|
|
||||||
} while (info.state == nn::cup::CTR::UPDATE_STATE_FINALIZING);
|
|
||||||
// 抜けた際のstateがFAILEDかどうか確認
|
|
||||||
if (info.state == nn::cup::CTR::UPDATE_STATE_FAILED)
|
|
||||||
{
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(info.lastResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************* アップデート終了 *******************/
|
|
||||||
s_scrollBuffer->AppendText(" - Finalized (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
s_scrollBuffer->AppendText("");
|
|
||||||
|
|
||||||
return nn::ResultSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::Result UpdateSequence(bool *isHandledError)
|
|
||||||
{
|
|
||||||
nn::Result result;
|
|
||||||
nn::Result lastResult = nn::ResultSuccess();
|
|
||||||
|
|
||||||
/********************* CUPの初期化 *******************/
|
|
||||||
s_scrollBuffer->AppendText("Initializing Cup Library")->Render();
|
|
||||||
SetTick(); // 初期化開始前の時間をセット
|
|
||||||
result = nn::cup::CTR::Initialize(s_updaterBuffer, sizeof(s_updaterBuffer));
|
|
||||||
if (result == nn::cup::CTR::ResultUpdatePartitionNotFound())
|
|
||||||
{
|
|
||||||
s_scrollBuffer->AppendText(" - Update Partition Not Found (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
*isHandledError = true;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (result == nn::cup::CTR::ResultUpdateNotRequired())
|
|
||||||
{
|
|
||||||
s_scrollBuffer->AppendText(" - Already Updated (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
*isHandledError = true;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (result == nn::cup::CTR::ResultInvalidUpdatePartitionFormat())
|
|
||||||
{
|
|
||||||
s_scrollBuffer->AppendText(" - Invalid Update Partition (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
*isHandledError = true;
|
|
||||||
return result;
|
|
||||||
}NN_UTIL_RETURN_IF_FAILED(result);
|
|
||||||
|
|
||||||
s_scrollBuffer->AppendText(" - Need Update (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
|
|
||||||
lastResult = UpdateCore();
|
|
||||||
|
|
||||||
// Initializeに成功した場合のみ、再びInitializeするためにFinalizeが必要
|
|
||||||
SetTick();
|
|
||||||
s_scrollBuffer->AppendText("Finalizing Cup Library")->Render();
|
|
||||||
NN_UTIL_RETURN_IF_FAILED(nn::cup::CTR::Finalize());
|
|
||||||
s_scrollBuffer->AppendText(" - Complete (%lldmsec)", GetConsumedMillisec())->Render();
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
|
|
||||||
return lastResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::Result ExecuteCup(ScrollBuffer* scrollBuf)
|
|
||||||
{
|
|
||||||
nn::Result result;
|
|
||||||
bool isHandledError = false;
|
|
||||||
result = UpdateSequence(&isHandledError);
|
|
||||||
if (isHandledError == false && result.IsFailure())
|
|
||||||
{
|
|
||||||
{
|
|
||||||
// それ以外の場合は、Resultを表示
|
|
||||||
scrollBuf->AppendText(" - Unhandled Error: 0x%08x", result.GetPrintableBits());
|
|
||||||
scrollBuf->AppendText("")->Render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowError(const char* str)
|
|
||||||
{
|
|
||||||
s_scrollBuffer->AppendText(str);
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
|
||||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY0, 1, 0, 0, 1);
|
|
||||||
s_RenderSystem.Clear();
|
|
||||||
s_RenderSystem.SwapBuffers();
|
|
||||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY1);
|
|
||||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY1, 1, 0, 0, 1);
|
|
||||||
s_RenderSystem.Clear();
|
|
||||||
s_scrollBuffer->Render();
|
|
||||||
s_RenderSystem.SwapBuffers();
|
|
||||||
|
|
||||||
if (nn::applet::IsExpectedToCloseApplication())
|
|
||||||
{
|
|
||||||
nn::applet::PrepareToCloseApplication();
|
|
||||||
nn::applet::CloseApplication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void nnMain()
|
|
||||||
{
|
|
||||||
NN_LOG("Start Self Cup\n");
|
|
||||||
nn::Result result;
|
|
||||||
Initialize();
|
|
||||||
VerDef versionData;
|
|
||||||
|
|
||||||
nn::cfg::CfgRegionCode region = nn::cfg::GetRegion();
|
|
||||||
nn::ProgramId MMEN_PROGRAM_ID = GetHomeMenuProgramId(region);
|
|
||||||
GetSystemVersion(&versionData, region);
|
|
||||||
s_scrollBuffer->AppendText("Version: %d.%d.%d-%d%c", versionData.cup.majorVersion, versionData.cup.minorVersion,
|
|
||||||
versionData.cup.microVersion, versionData.nup.majorVersion, nn::cfg::GetRegionCodeA3(region)[0]);
|
|
||||||
|
|
||||||
nn::am::ProgramInfo outInfos;
|
|
||||||
result = nn::am::GetProgramInfos(&outInfos, nn::fs::MEDIA_TYPE_NAND, &MMEN_PROGRAM_ID, 1);
|
|
||||||
if (result.IsSuccess())
|
|
||||||
{
|
|
||||||
result = ExecuteCup(s_scrollBuffer);
|
|
||||||
}
|
|
||||||
else if (result == nn::am::ResultNotFound())
|
|
||||||
{
|
|
||||||
s_scrollBuffer->AppendText("Cannot find Home Menu");
|
|
||||||
}
|
|
||||||
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
GetSystemVersion(&versionData, region);
|
|
||||||
|
|
||||||
s_scrollBuffer->AppendText("Version: %d.%d.%d-%d%c", versionData.cup.majorVersion, versionData.cup.minorVersion,
|
|
||||||
versionData.cup.microVersion, versionData.nup.majorVersion, nn::cfg::GetRegionCodeA3(region)[0]);
|
|
||||||
|
|
||||||
s_scrollBuffer->AppendText("")->Render();
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY0);
|
|
||||||
if (result.IsSuccess() || result == nn::cup::CTR::ResultUpdateNotRequired())
|
|
||||||
{
|
|
||||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY0, 0, 1, 0, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY0, 1, 0, 0, 1);
|
|
||||||
}
|
|
||||||
s_RenderSystem.Clear();
|
|
||||||
s_RenderSystem.SwapBuffers();
|
|
||||||
s_RenderSystem.SetRenderTarget(NN_GX_DISPLAY1);
|
|
||||||
if (result.IsSuccess() || result == nn::cup::CTR::ResultUpdateNotRequired())
|
|
||||||
{
|
|
||||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY1, 0, 1, 0, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_RenderSystem.SetClearColor(NN_GX_DISPLAY1, 1, 0, 0, 1);
|
|
||||||
}
|
|
||||||
s_scrollBuffer->ReplaceText("%c Finished", GetProgressChar())->Render();
|
|
||||||
|
|
||||||
if (nn::applet::IsExpectedToCloseApplication())
|
|
||||||
{
|
|
||||||
nn::applet::PrepareToCloseApplication();
|
|
||||||
nn::applet::CloseApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: scrollBuffer.cpp
|
|
||||||
|
|
||||||
Copyright (C)2009 Nintendo Co., Ltd. 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include "scrollBuffer.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
char ScrollBuffer::s_buffers[MAX_BUFFER_LINE][MAX_BUFFER_CHARS];
|
|
||||||
|
|
||||||
char *ScrollBuffer::GetFormattedString(const char *fmt, va_list arg)
|
|
||||||
{
|
|
||||||
static char formattedBuffer[MAX_BUFFER_CHARS];
|
|
||||||
vsnprintf(formattedBuffer, MAX_BUFFER_CHARS, fmt, arg);
|
|
||||||
return formattedBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBuffer *ScrollBuffer::Update()
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBuffer *ScrollBuffer::AppendText(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list vlist;
|
|
||||||
va_start(vlist, fmt);
|
|
||||||
|
|
||||||
int nextPosition=(m_tail+1)%MAX_BUFFER_LINE;
|
|
||||||
if(nextPosition==m_head){
|
|
||||||
// ヘッドとビューの移動
|
|
||||||
if(m_head==m_currentView){
|
|
||||||
m_currentView=(m_head+1)%MAX_BUFFER_LINE;
|
|
||||||
}
|
|
||||||
m_head=(m_head+1)%MAX_BUFFER_LINE;
|
|
||||||
|
|
||||||
}
|
|
||||||
strlcpy(s_buffers[m_tail], GetFormattedString(fmt, vlist), MAX_BUFFER_CHARS);
|
|
||||||
m_tail=nextPosition;
|
|
||||||
NN_LOG("cup: %s\n", GetFormattedString(fmt, vlist));
|
|
||||||
|
|
||||||
// ビューの移動
|
|
||||||
if((m_currentView+MAX_DISPLAY_LINES)%MAX_BUFFER_LINE==m_tail){
|
|
||||||
m_currentView=(m_currentView+1)%MAX_BUFFER_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
ScrollBuffer *ScrollBuffer::ReplaceText(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list vlist;
|
|
||||||
va_start(vlist, fmt);
|
|
||||||
|
|
||||||
NN_ASSERT(m_tail!=m_head);
|
|
||||||
strlcpy(s_buffers[(m_tail-1)%MAX_BUFFER_LINE], GetFormattedString(fmt, vlist), MAX_BUFFER_CHARS);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrollBuffer::Render()
|
|
||||||
{
|
|
||||||
// 描画前処理
|
|
||||||
m_render->SetRenderTarget(NN_GX_DISPLAY1);
|
|
||||||
m_render->Clear();
|
|
||||||
m_render->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
|
|
||||||
// リングバッファなので、終端条件を調整
|
|
||||||
int tail=(m_tail<m_head) ? m_tail+ScrollBuffer::MAX_BUFFER_LINE : m_tail;
|
|
||||||
|
|
||||||
for(int i=m_currentView; i<tail; i++){
|
|
||||||
if(i<m_currentView+MAX_DISPLAY_LINES-1){
|
|
||||||
m_render->DrawText(0, (i-m_currentView)*FONT_SIZE, s_buffers[i%MAX_BUFFER_LINE]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 描画転送
|
|
||||||
m_render->SwapBuffers();
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*
|
|
||||||
Project: Horizon
|
|
||||||
File: scrollBuffer.h
|
|
||||||
|
|
||||||
Copyright (C)2009 Nintendo Co., Ltd. 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.
|
|
||||||
|
|
||||||
$Rev$
|
|
||||||
*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef SCROLL_BUFFER_H_
|
|
||||||
#define SCROLL_BUFFER_H_
|
|
||||||
|
|
||||||
#include "demo.h"
|
|
||||||
class ScrollBuffer
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
MAX_BUFFER_LINE=128,
|
|
||||||
MAX_BUFFER_CHARS=80,
|
|
||||||
MAX_DISPLAY_LINES=20,
|
|
||||||
FONT_SIZE=12
|
|
||||||
};
|
|
||||||
// 表示文字のバッファ (リングバッファ)
|
|
||||||
static char s_buffers[MAX_BUFFER_LINE][MAX_BUFFER_CHARS];
|
|
||||||
int m_head;
|
|
||||||
int m_tail;
|
|
||||||
int m_currentView;
|
|
||||||
|
|
||||||
demo::RenderSystemDrawing *m_render;
|
|
||||||
|
|
||||||
char *GetFormattedString(const char *fmt, va_list arg);
|
|
||||||
|
|
||||||
public:
|
|
||||||
ScrollBuffer() :
|
|
||||||
m_head(0), m_tail(0), m_currentView(0)
|
|
||||||
{}
|
|
||||||
void Initialize(demo::RenderSystemDrawing *render)
|
|
||||||
{
|
|
||||||
m_render=render;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBuffer *Update(); // キー入力を参照して、スクロールする
|
|
||||||
ScrollBuffer *AppendText(const char *fmt, ...); // 文字列を追加する
|
|
||||||
ScrollBuffer *ReplaceText(const char *fmt, ...); // 最新の文字列を置換する
|
|
||||||
void Render(); // レンダリング
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SCROLL_BUFFER_H
|
|
||||||
Loading…
Reference in New Issue
Block a user